diff --git a/.github/workflows/cd.yml b/.github/workflows/cd.yml index d0aa480a73a641..05c2f13f08b550 100644 --- a/.github/workflows/cd.yml +++ b/.github/workflows/cd.yml @@ -2,8 +2,8 @@ name: CD on: push: - branches: [ r137-dev ] - + branches: [r137-dev] + workflow_dispatch: jobs: @@ -12,20 +12,23 @@ jobs: runs-on: ubuntu-latest steps: - name: Git checkout - uses: actions/checkout@v2 - - name: Install node - uses: actions/setup-node@v2 + uses: actions/checkout@v4 + - name: 安装 pnpm + uses: pnpm/action-setup@v4 with: - node-version: 16 - cache: 'npm' - - name: Install packages - run: npm ci - + version: 10 + - name: 使用 Nnode.js ${{ matrix.node-version }} + uses: actions/setup-node@v4 + with: + node-version: ${{ matrix.node-version }} + cache: 'pnpm' + - name: 安装依赖 + run: pnpm install - name: Build - run: npm run build + run: pnpm run build - name: Install deployment packages - run: npm ci + run: pnpm install working-directory: deployment - name: Deploy to OSS @@ -38,22 +41,31 @@ jobs: steps: - name: Git checkout - uses: actions/checkout@v2 + uses: actions/checkout@v4 - name: Install node uses: actions/setup-node@v2 with: - node-version: 16 - cache: 'npm' + node-version: 20 - name: Modify version run: | sed -i 's/"version" *: *"\(.*\)"/"version": "\1-'$(git rev-parse HEAD)'"/g' package.json - - name: Install packages - run: npm ci + - uses: actions/checkout@v4 + - name: 安装 pnpm + uses: pnpm/action-setup@v4 + with: + version: 10 + - name: 使用 Nnode.js ${{ matrix.node-version }} + uses: actions/setup-node@v4 + with: + node-version: ${{ matrix.node-version }} + cache: "pnpm" + - name: 安装依赖 + run: pnpm install - name: Build - run: npm run build + run: pnpm run build - name: Modify npm repository run: | @@ -61,4 +73,4 @@ jobs: echo "//npm.internal.oppenlab.com/repository/npm_private/:_authToken=${{ secrets.NPM_AUTH_TOKEN }}" >> ~/.npmrc - name: Publish to npm - run: npm publish + run: pnpm publish diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index bff19c28c5aacc..0161e19856103e 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -19,38 +19,52 @@ jobs: runs-on: ubuntu-latest steps: - name: Git checkout - uses: actions/checkout@v2 + uses: actions/checkout@v4 - name: Install node uses: actions/setup-node@v2 with: - node-version: 16 - cache: 'npm' - - name: Install packages - run: npm ci - + node-version: 20 + - name: 安装 pnpm + uses: pnpm/action-setup@v4 + with: + version: 10 + - name: 使用 Nnode.js ${{ matrix.node-version }} + uses: actions/setup-node@v4 + with: + node-version: ${{ matrix.node-version }} + cache: 'pnpm' + - name: 安装依赖 + run: pnpm install + - name: Build packages + run: pnpm run build - name: === Linting === - run: npm run lint + run: pnpm run lint unit: name: "Unit testing" runs-on: ubuntu-latest steps: - name: Git checkout - uses: actions/checkout@v2 - - name: Install node - uses: actions/setup-node@v2 + uses: actions/checkout@v4 + - name: 安装 pnpm + uses: pnpm/action-setup@v4 with: - node-version: 16 - cache: 'npm' + version: 10 + - name: 使用 Nnode.js ${{ matrix.node-version }} + uses: actions/setup-node@v4 + with: + node-version: ${{ matrix.node-version }} + cache: 'pnpm' + - name: 安装依赖 + run: pnpm install - name: Install packages run: | - npm ci - npm ci --prefix test + pnpm install + pnpm install --prefix test - name: Build - run: npm run build - + run: pnpm run build - name: === Unit testing === - run: npm run test-unit + run: pnpm run test-unit e2e: name: "E2E testing" @@ -63,36 +77,50 @@ jobs: FORCE_COLOR: 1 steps: - name: Git checkout - uses: actions/checkout@v2 + uses: actions/checkout@v4 - name: Install node uses: actions/setup-node@v2 with: - node-version: 16 - cache: 'npm' + node-version: 20 + - name: 安装 pnpm + uses: pnpm/action-setup@v4 + with: + version: 10 + - name: 使用 Nnode.js ${{ matrix.node-version }} + uses: actions/setup-node@v4 + with: + node-version: ${{ matrix.node-version }} + cache: 'pnpm' - name: Install packages run: | - npm ci - npm ci --prefix test - sudo apt-get install xvfb + pnpm install + pnpm install --prefix test + sudo apt-get install -y xvfb - name: Build - run: npm run build - + run: pnpm run build - name: === E2E testing === - run: xvfb-run --auto-servernum npm run test-e2e + run: xvfb-run --auto-servernum pnpm run test-e2e e2e-cov: name: "Ready for release" runs-on: ubuntu-latest steps: - name: Git checkout - uses: actions/checkout@v2 + uses: actions/checkout@v4 - name: Install node uses: actions/setup-node@v2 with: - node-version: 16 - cache: 'npm' - - name: Install packages - run: npm ci - + node-version: 20 + - name: 安装 pnpm + uses: pnpm/action-setup@v4 + with: + version: 10 + - name: 使用 Nnode.js ${{ matrix.node-version }} + uses: actions/setup-node@v4 + with: + node-version: ${{ matrix.node-version }} + cache: 'pnpm' + - name: 安装依赖 + run: pnpm install - name: === Ready for release === - run: npm run test-e2e-cov + run: pnpm run test-e2e-cov diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 7d302e21c9cdb4..5e454e425d72c2 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -16,13 +16,14 @@ jobs: - name: Install node uses: actions/setup-node@v2 with: - node-version: 16 - cache: 'npm' + node-version: 20 + - name: Install pnpm + run: npm install -g pnpm - name: Install packages - run: npm ci + run: pnpm install - name: Build - run: npm run build + run: pnpm run build - name: Output version number id: version @@ -44,16 +45,17 @@ jobs: - name: Install node uses: actions/setup-node@v2 with: - node-version: 16 - cache: 'npm' + node-version: 20 + - name: Install pnpm + run: npm install -g pnpm - name: Install packages - run: npm ci + run: pnpm install - name: Build - run: npm run build + run: pnpm run build - name: Install deployment packages - run: npm ci + run: pnpm install working-directory: deployment - name: Deploy to OSS @@ -73,13 +75,14 @@ jobs: - name: Install node uses: actions/setup-node@v2 with: - node-version: 16 - cache: 'npm' + node-version: 20 + - name: Install pnpm + run: npm install -g pnpm - name: Install packages - run: npm ci + run: pnpm install - name: Build - run: npm run build + run: pnpm run build - name: Modify npm repository run: | @@ -87,4 +90,4 @@ jobs: echo "//npm.internal.oppenlab.com/repository/npm_private/:_authToken=${{ secrets.NPM_AUTH_TOKEN }}" >> ~/.npmrc - name: Publish to npm - run: npm publish + run: pnpm publish diff --git a/build/three.cjs b/build/three.cjs index 90b5bc6f5bf4f9..d7c7f77dd1380a 100644 --- a/build/three.cjs +++ b/build/three.cjs @@ -206,13 +206,10 @@ const platform = { }; this.devicePixelRatio = params.devicePixelRatio; }, - setProperties(properties) { this.properties = Object.assign(this.properties || {}, properties); } - }; - if (typeof window !== 'undefined' && typeof window.window !== 'undefined') { // When running three.js in a virtual dom environment like jsdom, the window object // may not contains all the members that are required by the platform, so we should @@ -237,182 +234,169 @@ if (typeof window !== 'undefined' && typeof window.window !== 'undefined') { /** * https://github.com/mrdoob/eventdispatcher.js/ */ + class EventDispatcher { addEventListener(type, listener) { if (this._listeners === undefined) this._listeners = {}; const listeners = this._listeners; - if (listeners[type] === undefined) { listeners[type] = []; } - if (listeners[type].indexOf(listener) === -1) { listeners[type].push(listener); } } - hasEventListener(type, listener) { if (this._listeners === undefined) return false; const listeners = this._listeners; return listeners[type] !== undefined && listeners[type].indexOf(listener) !== -1; } - removeEventListener(type, listener) { if (this._listeners === undefined) return; const listeners = this._listeners; const listenerArray = listeners[type]; - if (listenerArray !== undefined) { const index = listenerArray.indexOf(listener); - if (index !== -1) { listenerArray.splice(index, 1); } } } - dispatchEvent(event) { if (this._listeners === undefined) return; const listeners = this._listeners; const listenerArray = listeners[event.type]; - if (listenerArray !== undefined) { - event.target = this; // Make a copy, in case listeners are removed while iterating. + event.target = this; + // Make a copy, in case listeners are removed while iterating. const array = listenerArray.slice(0); - for (let i = 0, l = array.length; i < l; i++) { array[i].call(this, event); } - event.target = null; } } - } const _lut = []; - for (let i = 0; i < 256; i++) { _lut[i] = (i < 16 ? '0' : '') + i.toString(16); } - let _seed = 1234567; const DEG2RAD = Math.PI / 180; -const RAD2DEG = 180 / Math.PI; // http://stackoverflow.com/questions/105034/how-to-create-a-guid-uuid-in-javascript/21963136#21963136 +const RAD2DEG = 180 / Math.PI; +// http://stackoverflow.com/questions/105034/how-to-create-a-guid-uuid-in-javascript/21963136#21963136 function generateUUID() { const d0 = Math.random() * 0xffffffff | 0; const d1 = Math.random() * 0xffffffff | 0; const d2 = Math.random() * 0xffffffff | 0; const d3 = Math.random() * 0xffffffff | 0; - const uuid = _lut[d0 & 0xff] + _lut[d0 >> 8 & 0xff] + _lut[d0 >> 16 & 0xff] + _lut[d0 >> 24 & 0xff] + '-' + _lut[d1 & 0xff] + _lut[d1 >> 8 & 0xff] + '-' + _lut[d1 >> 16 & 0x0f | 0x40] + _lut[d1 >> 24 & 0xff] + '-' + _lut[d2 & 0x3f | 0x80] + _lut[d2 >> 8 & 0xff] + '-' + _lut[d2 >> 16 & 0xff] + _lut[d2 >> 24 & 0xff] + _lut[d3 & 0xff] + _lut[d3 >> 8 & 0xff] + _lut[d3 >> 16 & 0xff] + _lut[d3 >> 24 & 0xff]; // .toUpperCase() here flattens concatenated strings to save heap memory space. + const uuid = _lut[d0 & 0xff] + _lut[d0 >> 8 & 0xff] + _lut[d0 >> 16 & 0xff] + _lut[d0 >> 24 & 0xff] + '-' + _lut[d1 & 0xff] + _lut[d1 >> 8 & 0xff] + '-' + _lut[d1 >> 16 & 0x0f | 0x40] + _lut[d1 >> 24 & 0xff] + '-' + _lut[d2 & 0x3f | 0x80] + _lut[d2 >> 8 & 0xff] + '-' + _lut[d2 >> 16 & 0xff] + _lut[d2 >> 24 & 0xff] + _lut[d3 & 0xff] + _lut[d3 >> 8 & 0xff] + _lut[d3 >> 16 & 0xff] + _lut[d3 >> 24 & 0xff]; + // .toUpperCase() here flattens concatenated strings to save heap memory space. return uuid.toUpperCase(); } - function clamp(value, min, max) { return Math.max(min, Math.min(max, value)); -} // compute euclidian modulo of m % n -// https://en.wikipedia.org/wiki/Modulo_operation - +} +// compute euclidian modulo of m % n +// https://en.wikipedia.org/wiki/Modulo_operation function euclideanModulo(n, m) { return (n % m + m) % m; -} // Linear mapping from range to range - +} +// Linear mapping from range to range function mapLinear(x, a1, a2, b1, b2) { return b1 + (x - a1) * (b2 - b1) / (a2 - a1); -} // https://www.gamedev.net/tutorials/programming/general-and-gameplay-programming/inverse-lerp-a-super-useful-yet-often-overlooked-function-r5230/ - +} +// https://www.gamedev.net/tutorials/programming/general-and-gameplay-programming/inverse-lerp-a-super-useful-yet-often-overlooked-function-r5230/ function inverseLerp(x, y, value) { if (x !== y) { return (value - x) / (y - x); } else { return 0; } -} // https://en.wikipedia.org/wiki/Linear_interpolation - +} +// https://en.wikipedia.org/wiki/Linear_interpolation function lerp(x, y, t) { return (1 - t) * x + t * y; -} // http://www.rorydriscoll.com/2016/03/07/frame-rate-independent-damping-using-lerp/ - +} +// http://www.rorydriscoll.com/2016/03/07/frame-rate-independent-damping-using-lerp/ function damp(x, y, lambda, dt) { return lerp(x, y, 1 - Math.exp(-lambda * dt)); -} // https://www.desmos.com/calculator/vcsjnyz7x4 - +} +// https://www.desmos.com/calculator/vcsjnyz7x4 function pingpong(x, length = 1) { return length - Math.abs(euclideanModulo(x, length * 2) - length); -} // http://en.wikipedia.org/wiki/Smoothstep - +} +// http://en.wikipedia.org/wiki/Smoothstep function smoothstep(x, min, max) { if (x <= min) return 0; if (x >= max) return 1; x = (x - min) / (max - min); return x * x * (3 - 2 * x); } - function smootherstep(x, min, max) { if (x <= min) return 0; if (x >= max) return 1; x = (x - min) / (max - min); return x * x * x * (x * (x * 6 - 15) + 10); -} // Random integer from interval - +} +// Random integer from interval function randInt(low, high) { return low + Math.floor(Math.random() * (high - low + 1)); -} // Random float from interval - +} +// Random float from interval function randFloat(low, high) { return low + Math.random() * (high - low); -} // Random float from <-range/2, range/2> interval - +} +// Random float from <-range/2, range/2> interval function randFloatSpread(range) { return range * (0.5 - Math.random()); -} // Deterministic pseudo-random float in the interval [ 0, 1 ] - +} +// Deterministic pseudo-random float in the interval [ 0, 1 ] function seededRandom(s) { - if (s !== undefined) _seed = s % 2147483647; // Park-Miller algorithm + if (s !== undefined) _seed = s % 2147483647; + + // Park-Miller algorithm _seed = _seed * 16807 % 2147483647; return (_seed - 1) / 2147483646; } - function degToRad(degrees) { return degrees * DEG2RAD; } - function radToDeg(radians) { return radians * RAD2DEG; } - function isPowerOfTwo(value) { return (value & value - 1) === 0 && value !== 0; } - function ceilPowerOfTwo(value) { return Math.pow(2, Math.ceil(Math.log(value) / Math.LN2)); } - function floorPowerOfTwo(value) { return Math.pow(2, Math.floor(Math.log(value) / Math.LN2)); } - function setQuaternionFromProperEuler(q, a, b, c, order) { // Intrinsic Proper Euler Angles - see https://en.wikipedia.org/wiki/Euler_angles + // rotations are applied to the axes in the order specified by 'order' // rotation by angle 'a' is applied first, then by angle 'b', then by angle 'c' // angles are in radians + const cos = Math.cos; const sin = Math.sin; const c2 = cos(b / 2); @@ -423,32 +407,25 @@ function setQuaternionFromProperEuler(q, a, b, c, order) { const s1_3 = sin((a - c) / 2); const c3_1 = cos((c - a) / 2); const s3_1 = sin((c - a) / 2); - switch (order) { case 'XYX': q.set(c2 * s13, s2 * c1_3, s2 * s1_3, c2 * c13); break; - case 'YZY': q.set(s2 * s1_3, c2 * s13, s2 * c1_3, c2 * c13); break; - case 'ZXZ': q.set(s2 * c1_3, s2 * s1_3, c2 * s13, c2 * c13); break; - case 'XZX': q.set(c2 * s13, s2 * s3_1, s2 * c3_1, c2 * c13); break; - case 'YXY': q.set(s2 * c3_1, c2 * s13, s2 * s3_1, c2 * c13); break; - case 'ZYZ': q.set(s2 * s3_1, s2 * c3_1, c2 * s13, c2 * c13); break; - default: console.warn('THREE.MathUtils: .setQuaternionFromProperEuler() encountered an unknown order: ' + order); } @@ -485,348 +462,284 @@ class Vector2 { this.x = x; this.y = y; } - get width() { return this.x; } - set width(value) { this.x = value; } - get height() { return this.y; } - set height(value) { this.y = value; } - set(x, y) { this.x = x; this.y = y; return this; } - setScalar(scalar) { this.x = scalar; this.y = scalar; return this; } - setX(x) { this.x = x; return this; } - setY(y) { this.y = y; return this; } - setComponent(index, value) { switch (index) { case 0: this.x = value; break; - case 1: this.y = value; break; - default: throw new Error('index is out of range: ' + index); } - return this; } - getComponent(index) { switch (index) { case 0: return this.x; - case 1: return this.y; - default: throw new Error('index is out of range: ' + index); } } - clone() { return new this.constructor(this.x, this.y); } - copy(v) { this.x = v.x; this.y = v.y; return this; } - add(v, w) { if (w !== undefined) { console.warn('THREE.Vector2: .add() now only accepts one argument. Use .addVectors( a, b ) instead.'); return this.addVectors(v, w); } - this.x += v.x; this.y += v.y; return this; } - addScalar(s) { this.x += s; this.y += s; return this; } - addVectors(a, b) { this.x = a.x + b.x; this.y = a.y + b.y; return this; } - addScaledVector(v, s) { this.x += v.x * s; this.y += v.y * s; return this; } - sub(v, w) { if (w !== undefined) { console.warn('THREE.Vector2: .sub() now only accepts one argument. Use .subVectors( a, b ) instead.'); return this.subVectors(v, w); } - this.x -= v.x; this.y -= v.y; return this; } - subScalar(s) { this.x -= s; this.y -= s; return this; } - subVectors(a, b) { this.x = a.x - b.x; this.y = a.y - b.y; return this; } - multiply(v) { this.x *= v.x; this.y *= v.y; return this; } - multiplyScalar(scalar) { this.x *= scalar; this.y *= scalar; return this; } - divide(v) { this.x /= v.x; this.y /= v.y; return this; } - divideScalar(scalar) { return this.multiplyScalar(1 / scalar); } - applyMatrix3(m) { const x = this.x, - y = this.y; + y = this.y; const e = m.elements; this.x = e[0] * x + e[3] * y + e[6]; this.y = e[1] * x + e[4] * y + e[7]; return this; } - min(v) { this.x = Math.min(this.x, v.x); this.y = Math.min(this.y, v.y); return this; } - max(v) { this.x = Math.max(this.x, v.x); this.y = Math.max(this.y, v.y); return this; } - clamp(min, max) { // assumes min < max, componentwise + this.x = Math.max(min.x, Math.min(max.x, this.x)); this.y = Math.max(min.y, Math.min(max.y, this.y)); return this; } - clampScalar(minVal, maxVal) { this.x = Math.max(minVal, Math.min(maxVal, this.x)); this.y = Math.max(minVal, Math.min(maxVal, this.y)); return this; } - clampLength(min, max) { const length = this.length(); return this.divideScalar(length || 1).multiplyScalar(Math.max(min, Math.min(max, length))); } - floor() { this.x = Math.floor(this.x); this.y = Math.floor(this.y); return this; } - ceil() { this.x = Math.ceil(this.x); this.y = Math.ceil(this.y); return this; } - round() { this.x = Math.round(this.x); this.y = Math.round(this.y); return this; } - roundToZero() { 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); return this; } - negate() { this.x = -this.x; this.y = -this.y; return this; } - dot(v) { return this.x * v.x + this.y * v.y; } - cross(v) { return this.x * v.y - this.y * v.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() { // computes the angle in radians with respect to the positive x-axis + const angle = Math.atan2(-this.y, -this.x) + Math.PI; return angle; } - distanceTo(v) { return Math.sqrt(this.distanceToSquared(v)); } - distanceToSquared(v) { const dx = this.x - v.x, - dy = this.y - v.y; + dy = this.y - v.y; return dx * dx + dy * dy; } - manhattanDistanceTo(v) { return Math.abs(this.x - v.x) + Math.abs(this.y - v.y); } - setLength(length) { return this.normalize().multiplyScalar(length); } - lerp(v, alpha) { this.x += (v.x - this.x) * alpha; this.y += (v.y - this.y) * alpha; return this; } - lerpVectors(v1, v2, alpha) { this.x = v1.x + (v2.x - v1.x) * alpha; this.y = v1.y + (v2.y - v1.y) * alpha; return this; } - equals(v) { return v.x === this.x && v.y === this.y; } - fromArray(array, offset = 0) { this.x = array[offset]; this.y = array[offset + 1]; return this; } - toArray(array = [], offset = 0) { array[offset] = this.x; array[offset + 1] = this.y; return array; } - fromBufferAttribute(attribute, index, offset) { if (offset !== undefined) { console.warn('THREE.Vector2: offset has been removed from .fromBufferAttribute().'); } - this.x = attribute.getX(index); this.y = attribute.getY(index); return this; } - rotateAround(center, angle) { const c = Math.cos(angle), - s = Math.sin(angle); + s = Math.sin(angle); const x = this.x - center.x; const y = this.y - center.y; this.x = x * c - y * s + center.x; this.y = x * s + y * c + center.y; return this; } - random() { this.x = Math.random(); this.y = Math.random(); return this; } - *[Symbol.iterator]() { yield this.x; yield this.y; } - } - Vector2.prototype.isVector2 = true; class Matrix3 { constructor() { this.elements = [1, 0, 0, 0, 1, 0, 0, 0, 1]; - if (arguments.length > 0) { console.error('THREE.Matrix3: the constructor no longer reads arguments. use .set() instead.'); } } - set(n11, n12, n13, n21, n22, n23, n31, n32, n33) { const te = this.elements; te[0] = n11; @@ -840,12 +753,10 @@ class Matrix3 { te[8] = n33; return this; } - identity() { this.set(1, 0, 0, 0, 1, 0, 0, 0, 1); return this; } - copy(m) { const te = this.elements; const me = m.elements; @@ -860,50 +771,45 @@ class Matrix3 { te[8] = me[8]; return this; } - extractBasis(xAxis, yAxis, zAxis) { xAxis.setFromMatrix3Column(this, 0); yAxis.setFromMatrix3Column(this, 1); zAxis.setFromMatrix3Column(this, 2); return this; } - setFromMatrix4(m) { const me = m.elements; this.set(me[0], me[4], me[8], me[1], me[5], me[9], me[2], me[6], me[10]); return this; } - multiply(m) { return this.multiplyMatrices(this, m); } - premultiply(m) { return this.multiplyMatrices(m, this); } - multiplyMatrices(a, b) { const ae = a.elements; const be = b.elements; const te = this.elements; const a11 = ae[0], - a12 = ae[3], - a13 = ae[6]; + a12 = ae[3], + a13 = ae[6]; const a21 = ae[1], - a22 = ae[4], - a23 = ae[7]; + a22 = ae[4], + a23 = ae[7]; const a31 = ae[2], - a32 = ae[5], - a33 = ae[8]; + a32 = ae[5], + a33 = ae[8]; const b11 = be[0], - b12 = be[3], - b13 = be[6]; + b12 = be[3], + b13 = be[6]; const b21 = be[1], - b22 = be[4], - b23 = be[7]; + b22 = be[4], + b23 = be[7]; const b31 = be[2], - b32 = be[5], - b33 = be[8]; + b32 = be[5], + b33 = be[8]; te[0] = a11 * b11 + a12 * b21 + a13 * b31; te[3] = a11 * b12 + a12 * b22 + a13 * b32; te[6] = a11 * b13 + a12 * b23 + a13 * b33; @@ -915,7 +821,6 @@ class Matrix3 { te[8] = a31 * b13 + a32 * b23 + a33 * b33; return this; } - multiplyScalar(s) { const te = this.elements; te[0] *= s; @@ -929,36 +834,34 @@ class Matrix3 { te[8] *= s; return this; } - determinant() { const te = this.elements; const a = te[0], - b = te[1], - c = te[2], - d = te[3], - e = te[4], - f = te[5], - g = te[6], - h = te[7], - i = te[8]; + b = te[1], + c = te[2], + d = te[3], + e = te[4], + f = te[5], + g = te[6], + h = te[7], + i = te[8]; return a * e * i - a * f * h - b * d * i + b * f * g + c * d * h - c * e * g; } - invert() { const te = this.elements, - n11 = te[0], - n21 = te[1], - n31 = te[2], - n12 = te[3], - n22 = te[4], - n32 = te[5], - n13 = te[6], - n23 = te[7], - n33 = te[8], - t11 = n33 * n22 - n32 * n23, - t12 = n32 * n13 - n33 * n12, - t13 = n23 * n12 - n22 * n13, - det = n11 * t11 + n21 * t12 + n31 * t13; + n11 = te[0], + n21 = te[1], + n31 = te[2], + n12 = te[3], + n22 = te[4], + n32 = te[5], + n13 = te[6], + n23 = te[7], + n33 = te[8], + t11 = n33 * n22 - n32 * n23, + t12 = n32 * n13 - n33 * n12, + t13 = n23 * n12 - n22 * n13, + det = n11 * t11 + n21 * t12 + n31 * t13; if (det === 0) return this.set(0, 0, 0, 0, 0, 0, 0, 0, 0); const detInv = 1 / det; te[0] = t11 * detInv; @@ -972,7 +875,6 @@ class Matrix3 { te[8] = (n22 * n11 - n21 * n12) * detInv; return this; } - transpose() { let tmp; const m = this.elements; @@ -987,11 +889,9 @@ class Matrix3 { m[7] = tmp; return this; } - getNormalMatrix(matrix4) { return this.setFromMatrix4(matrix4).invert().transpose(); } - transposeIntoArray(r) { const m = this.elements; r[0] = m[0]; @@ -1005,14 +905,12 @@ class Matrix3 { r[8] = m[8]; return this; } - setUvTransform(tx, ty, sx, sy, rotation, cx, cy) { const c = Math.cos(rotation); const s = Math.sin(rotation); this.set(sx * c, sx * s, -sx * (c * cx + s * cy) + cx + tx, -sy * s, sy * c, -sy * (-s * cx + c * cy) + cy + ty, 0, 0, 1); return this; } - scale(sx, sy) { const te = this.elements; te[0] *= sx; @@ -1023,17 +921,16 @@ class Matrix3 { te[7] *= sy; return this; } - rotate(theta) { const c = Math.cos(theta); const s = Math.sin(theta); const te = this.elements; const a11 = te[0], - a12 = te[3], - a13 = te[6]; + a12 = te[3], + a13 = te[6]; const a21 = te[1], - a22 = te[4], - a23 = te[7]; + a22 = te[4], + a23 = te[7]; te[0] = c * a11 + s * a21; te[3] = c * a12 + s * a22; te[6] = c * a13 + s * a23; @@ -1042,7 +939,6 @@ class Matrix3 { te[7] = -s * a13 + c * a23; return this; } - translate(tx, ty) { const te = this.elements; te[0] += tx * te[2]; @@ -1053,26 +949,20 @@ class Matrix3 { te[7] += ty * te[8]; return this; } - equals(matrix) { const te = this.elements; const me = matrix.elements; - for (let i = 0; i < 9; i++) { if (te[i] !== me[i]) return false; } - return true; } - fromArray(array, offset = 0) { for (let i = 0; i < 9; i++) { this.elements[i] = array[i + offset]; } - return this; } - toArray(array = [], offset = 0) { const te = this.elements; array[offset] = te[0]; @@ -1086,24 +976,20 @@ class Matrix3 { array[offset + 8] = te[8]; return array; } - clone() { return new this.constructor().fromArray(this.elements); } - } - Matrix3.prototype.isMatrix3 = true; function arrayNeedsUint32(array) { // assumes larger values usually on last + for (let i = array.length - 1; i >= 0; --i) { if (array[i] > 65535) return true; } - return false; } - const TYPED_ARRAYS = { Int8Array: Int8Array, Uint8Array: Uint8Array, @@ -1115,47 +1001,37 @@ const TYPED_ARRAYS = { Float32Array: Float32Array, Float64Array: Float64Array }; - function getTypedArray(type, buffer) { return new TYPED_ARRAYS[type](buffer); } - function createElementNS(name) { return platform.createElementNS('http://www.w3.org/1999/xhtml', name); } let _canvas; - class ImageUtils { static getDataURL(image) { if (/^data:/i.test(image.src)) { return image.src; } - if (typeof HTMLCanvasElement == 'undefined') { return image.src; } - let canvas; - if (image instanceof HTMLCanvasElement) { canvas = image; } else { if (_canvas === undefined) _canvas = createElementNS('canvas'); _canvas.width = image.width; _canvas.height = image.height; - const context = _canvas.getContext('2d'); - if (image instanceof ImageData) { context.putImageData(image, 0, 0); } else { context.drawImage(image, 0, 0, image.width, image.height); } - canvas = _canvas; } - if (canvas.width > 2048 || canvas.height > 2048) { console.warn('THREE.ImageUtils.getDataURL: Image converted to jpg for performance reasons', image); return canvas.toDataURL('image/jpeg', 0.6); @@ -1163,11 +1039,9 @@ class ImageUtils { return canvas.toDataURL('image/png'); } } - } let textureId = 0; - class Texture extends EventDispatcher { constructor(image = Texture.DEFAULT_IMAGE, mapping = Texture.DEFAULT_MAPPING, wrapS = ClampToEdgeWrapping, wrapT = ClampToEdgeWrapping, magFilter = LinearFilter, minFilter = LinearMipmapLinearFilter, format = RGBAFormat, type = UnsignedByteType, anisotropy = 1, encoding = LinearEncoding) { super(); @@ -1197,33 +1071,29 @@ class Texture extends EventDispatcher { this.premultiplyAlpha = false; this.flipY = true; this.unpackAlignment = 4; // valid values: 1, 2, 4, 8 (see http://www.khronos.org/opengles/sdk/docs/man/xhtml/glPixelStorei.xml) + // Values of encoding !== THREE.LinearEncoding only supported on map, envMap and emissiveMap. // // Also changing the encoding after already used by a Material will not automatically make the Material // update. You need to explicitly call Material.needsUpdate to trigger it to recompile. - this.encoding = encoding; this.userData = {}; this.version = 0; this.onUpdate = null; this.isRenderTargetTexture = false; // indicates whether a texture belongs to a render target or not - this.needsPMREMUpdate = false; // indicates whether this texture should be processed by PMREMGenerator or not (only relevant for render target textures) + // In WebGL2, sRGB textures can be trancoded to Linear automatically, but reference to this issue: https://github.com/mrdoob/three.js/issues/26183 // there're performance issues when doing this, so you can set the sRGBToLinearWithShader to false to transcode the sRGB texture to Linear with // shader, especially to those textures that are updated in each frame - this.sRGBToLinearWithShader = !Texture.useSrgbTextures; } - 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(source) { this.name = source.name; this.image = source.image; @@ -1251,14 +1121,11 @@ class Texture extends EventDispatcher { this.userData = JSON.parse(JSON.stringify(source.userData)); return this; } - toJSON(meta) { const isRootObject = meta === undefined || typeof meta === 'string'; - if (!isRootObject && meta.textures[this.uuid] !== undefined) { return meta.textures[this.uuid]; } - const output = { metadata: { version: 4.5, @@ -1283,24 +1150,22 @@ class Texture extends EventDispatcher { premultiplyAlpha: this.premultiplyAlpha, unpackAlignment: this.unpackAlignment }; - if (this.image !== undefined) { // TODO: Move to THREE.Image - const image = this.image; + const image = this.image; if (image.uuid === undefined) { image.uuid = generateUUID(); // UGH } - if (!isRootObject && meta.images[image.uuid] === undefined) { let url; - if (Array.isArray(image)) { // process array of images e.g. CubeTexture - url = []; + url = []; for (let i = 0, l = image.length; i < l; i++) { // check cube texture with data textures + if (image[i].isDataTexture) { url.push(serializeImage(image[i].image)); } else { @@ -1309,104 +1174,86 @@ class Texture extends EventDispatcher { } } else { // process single image + url = serializeImage(image); } - meta.images[image.uuid] = { uuid: image.uuid, url: url }; } - output.image = image.uuid; } - if (JSON.stringify(this.userData) !== '{}') output.userData = this.userData; - if (!isRootObject) { meta.textures[this.uuid] = output; } - return output; } - dispose() { this.dispatchEvent({ type: 'dispose' }); } - transformUv(uv) { if (this.mapping !== UVMapping) return uv; uv.applyMatrix3(this.matrix); - if (uv.x < 0 || uv.x > 1) { switch (this.wrapS) { case RepeatWrapping: uv.x = uv.x - Math.floor(uv.x); break; - case ClampToEdgeWrapping: uv.x = uv.x < 0 ? 0 : 1; break; - case MirroredRepeatWrapping: if (Math.abs(Math.floor(uv.x) % 2) === 1) { uv.x = Math.ceil(uv.x) - uv.x; } else { uv.x = uv.x - Math.floor(uv.x); } - break; } } - if (uv.y < 0 || uv.y > 1) { switch (this.wrapT) { case RepeatWrapping: uv.y = uv.y - Math.floor(uv.y); break; - case ClampToEdgeWrapping: uv.y = uv.y < 0 ? 0 : 1; break; - case MirroredRepeatWrapping: if (Math.abs(Math.floor(uv.y) % 2) === 1) { uv.y = Math.ceil(uv.y) - uv.y; } else { uv.y = uv.y - Math.floor(uv.y); } - break; } } - if (this.flipY) { uv.y = 1 - uv.y; } - return uv; } - set needsUpdate(value) { if (value === true) this.version++; } - } - Texture.DEFAULT_IMAGE = undefined; Texture.DEFAULT_MAPPING = UVMapping; Texture.useSrgbTextures = true; Texture.prototype.isTexture = true; - function serializeImage(image) { if (typeof HTMLImageElement !== 'undefined' && image instanceof HTMLImageElement || typeof HTMLCanvasElement !== 'undefined' && image instanceof HTMLCanvasElement || typeof ImageBitmap !== 'undefined' && image instanceof ImageBitmap) { // default images + return ImageUtils.getDataURL(image); } else { if (image.data) { // images of DataTexture + return { data: Array.prototype.slice.call(image.data), width: image.width, @@ -1427,23 +1274,18 @@ class Vector4 { this.z = z; this.w = w; } - get width() { return this.z; } - set width(value) { this.z = value; } - get height() { return this.w; } - set height(value) { this.w = value; } - set(x, y, z, w) { this.x = x; this.y = y; @@ -1451,7 +1293,6 @@ class Vector4 { this.w = w; return this; } - setScalar(scalar) { this.x = scalar; this.y = scalar; @@ -1459,75 +1300,58 @@ class Vector4 { this.w = scalar; return this; } - setX(x) { this.x = x; return this; } - setY(y) { this.y = y; return this; } - setZ(z) { this.z = z; return this; } - setW(w) { this.w = w; return this; } - setComponent(index, value) { switch (index) { case 0: this.x = value; break; - case 1: this.y = value; break; - case 2: this.z = value; break; - case 3: this.w = value; break; - default: throw new Error('index is out of range: ' + index); } - return this; } - getComponent(index) { switch (index) { 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: ' + index); } } - clone() { return new this.constructor(this.x, this.y, this.z, this.w); } - copy(v) { this.x = v.x; this.y = v.y; @@ -1535,20 +1359,17 @@ class Vector4 { this.w = v.w !== undefined ? v.w : 1; return this; } - add(v, w) { if (w !== undefined) { console.warn('THREE.Vector4: .add() now only accepts one argument. Use .addVectors( a, b ) instead.'); return this.addVectors(v, w); } - this.x += v.x; this.y += v.y; this.z += v.z; this.w += v.w; return this; } - addScalar(s) { this.x += s; this.y += s; @@ -1556,7 +1377,6 @@ class Vector4 { this.w += s; return this; } - addVectors(a, b) { this.x = a.x + b.x; this.y = a.y + b.y; @@ -1564,7 +1384,6 @@ class Vector4 { this.w = a.w + b.w; return this; } - addScaledVector(v, s) { this.x += v.x * s; this.y += v.y * s; @@ -1572,20 +1391,17 @@ class Vector4 { this.w += v.w * s; return this; } - sub(v, w) { if (w !== undefined) { console.warn('THREE.Vector4: .sub() now only accepts one argument. Use .subVectors( a, b ) instead.'); return this.subVectors(v, w); } - this.x -= v.x; this.y -= v.y; this.z -= v.z; this.w -= v.w; return this; } - subScalar(s) { this.x -= s; this.y -= s; @@ -1593,7 +1409,6 @@ class Vector4 { this.w -= s; return this; } - subVectors(a, b) { this.x = a.x - b.x; this.y = a.y - b.y; @@ -1601,7 +1416,6 @@ class Vector4 { this.w = a.w - b.w; return this; } - multiply(v) { this.x *= v.x; this.y *= v.y; @@ -1609,7 +1423,6 @@ class Vector4 { this.w *= v.w; return this; } - multiplyScalar(scalar) { this.x *= scalar; this.y *= scalar; @@ -1617,21 +1430,24 @@ class Vector4 { this.w *= scalar; return this; } - applyQuaternion(q) { const x = this.x, - y = this.y, - z = this.z, - w = this.w; + y = this.y, + z = this.z, + w = this.w; const qx = q.x, - qy = q.y, - qz = q.z, - qw = q.w; // calculate quat * vector + qy = q.y, + qz = q.z, + qw = q.w; + + // calculate quat * vector const ix = qw * x + qy * z - qz * y; const iy = qw * y + qz * x - qx * z; const iz = qw * z + qx * y - qy * x; - const iw = -qx * x - qy * y - qz * z; // calculate result * inverse quat + const iw = -qx * x - qy * y - qz * z; + + // calculate result * inverse quat this.x = ix * qw + iw * -qx + iy * -qz - iz * -qy; this.y = iy * qw + iw * -qy + iz * -qx - ix * -qz; @@ -1639,12 +1455,11 @@ class Vector4 { this.w = w; return this; } - applyMatrix4(m) { const x = this.x, - y = this.y, - z = this.z, - w = this.w; + y = this.y, + z = this.z, + w = this.w; const e = m.elements; this.x = e[0] * x + e[4] * y + e[8] * z + e[12] * w; this.y = e[1] * x + e[5] * y + e[9] * z + e[13] * w; @@ -1652,17 +1467,16 @@ class Vector4 { this.w = e[3] * x + e[7] * y + e[11] * z + e[15] * w; return this; } - divideScalar(scalar) { return this.multiplyScalar(1 / scalar); } - setAxisAngleFromQuaternion(q) { // http://www.euclideanspace.com/maths/geometry/rotations/conversions/quaternionToAngle/index.htm + // q is assumed to be normalized + this.w = 2 * Math.acos(q.w); const s = Math.sqrt(1 - q.w * q.w); - if (s < 0.0001) { this.x = 1; this.y = 0; @@ -1672,40 +1486,42 @@ class Vector4 { this.y = q.y / s; this.z = q.z / s; } - return this; } - setAxisAngleFromRotationMatrix(m) { // http://www.euclideanspace.com/maths/geometry/rotations/conversions/matrixToAngle/index.htm + // assumes the upper 3x3 of m is a pure rotation matrix (i.e, unscaled) - let angle, x, y, z; // variables for result + let angle, x, y, z; // variables for result const epsilon = 0.01, - // margin to allow for rounding errors - epsilon2 = 0.1, - // margin to distinguish between 0 and 180 degrees - te = m.elements, - m11 = te[0], - m12 = te[4], - m13 = te[8], - m21 = te[1], - m22 = te[5], - m23 = te[9], - m31 = te[2], - m32 = te[6], - m33 = te[10]; - + // margin to allow for rounding errors + epsilon2 = 0.1, + // margin to distinguish between 0 and 180 degrees + + te = m.elements, + m11 = te[0], + m12 = te[4], + m13 = te[8], + m21 = te[1], + m22 = te[5], + m23 = te[9], + m31 = te[2], + m32 = te[6], + m33 = te[10]; if (Math.abs(m12 - m21) < epsilon && Math.abs(m13 - m31) < epsilon && Math.abs(m23 - m32) < epsilon) { // singularity found // first check for identity matrix which must have +1 for all terms // in leading diagonal and zero in other terms + if (Math.abs(m12 + m21) < epsilon2 && Math.abs(m13 + m31) < epsilon2 && Math.abs(m23 + m32) < epsilon2 && Math.abs(m11 + m22 + m33 - 3) < epsilon2) { // this singularity is identity matrix so angle = 0 + this.set(1, 0, 0, 0); return this; // zero angle, arbitrary axis - } // otherwise this singularity is angle = 180 + } + // otherwise this singularity is angle = 180 angle = Math.PI; const xx = (m11 + 1) / 2; @@ -1714,9 +1530,9 @@ class Vector4 { const xy = (m12 + m21) / 4; const xz = (m13 + m31) / 4; const yz = (m23 + m32) / 4; - if (xx > yy && xx > zz) { // m11 is the largest diagonal term + if (xx < epsilon) { x = 0; y = 0.707106781; @@ -1728,6 +1544,7 @@ class Vector4 { } } else if (yy > zz) { // m22 is the largest diagonal term + if (yy < epsilon) { x = 0.707106781; y = 0; @@ -1739,6 +1556,7 @@ class Vector4 { } } else { // m33 is the largest diagonal term so base result on this + if (zz < epsilon) { x = 0.707106781; y = 0.707106781; @@ -1749,15 +1567,17 @@ class Vector4 { y = yz / z; } } - this.set(x, y, z, angle); return this; // return 180 deg rotation - } // as we have reached here there are no singularities so we can handle normally + } + // as we have reached here there are no singularities so we can handle normally let s = Math.sqrt((m32 - m23) * (m32 - m23) + (m13 - m31) * (m13 - m31) + (m21 - m12) * (m21 - m12)); // used to normalize - if (Math.abs(s) < 0.001) s = 1; // prevent divide by zero, should not happen if matrix is orthogonal and should be + if (Math.abs(s) < 0.001) s = 1; + + // prevent divide by zero, should not happen if matrix is orthogonal and should be // caught by singularity test above, but I've left it in just in case this.x = (m32 - m23) / s; @@ -1766,7 +1586,6 @@ class Vector4 { this.w = Math.acos((m11 + m22 + m33 - 1) / 2); return this; } - min(v) { this.x = Math.min(this.x, v.x); this.y = Math.min(this.y, v.y); @@ -1774,7 +1593,6 @@ class Vector4 { this.w = Math.min(this.w, v.w); return this; } - max(v) { this.x = Math.max(this.x, v.x); this.y = Math.max(this.y, v.y); @@ -1782,16 +1600,15 @@ class Vector4 { this.w = Math.max(this.w, v.w); return this; } - clamp(min, max) { // assumes min < max, componentwise + this.x = Math.max(min.x, Math.min(max.x, this.x)); this.y = Math.max(min.y, Math.min(max.y, this.y)); this.z = Math.max(min.z, Math.min(max.z, this.z)); this.w = Math.max(min.w, Math.min(max.w, this.w)); return this; } - clampScalar(minVal, maxVal) { this.x = Math.max(minVal, Math.min(maxVal, this.x)); this.y = Math.max(minVal, Math.min(maxVal, this.y)); @@ -1799,12 +1616,10 @@ class Vector4 { this.w = Math.max(minVal, Math.min(maxVal, this.w)); return this; } - clampLength(min, max) { const length = this.length(); return this.divideScalar(length || 1).multiplyScalar(Math.max(min, Math.min(max, length))); } - floor() { this.x = Math.floor(this.x); this.y = Math.floor(this.y); @@ -1812,7 +1627,6 @@ class Vector4 { this.w = Math.floor(this.w); return this; } - ceil() { this.x = Math.ceil(this.x); this.y = Math.ceil(this.y); @@ -1820,7 +1634,6 @@ class Vector4 { this.w = Math.ceil(this.w); return this; } - round() { this.x = Math.round(this.x); this.y = Math.round(this.y); @@ -1828,7 +1641,6 @@ class Vector4 { this.w = Math.round(this.w); return this; } - roundToZero() { 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); @@ -1836,7 +1648,6 @@ class Vector4 { this.w = this.w < 0 ? Math.ceil(this.w) : Math.floor(this.w); return this; } - negate() { this.x = -this.x; this.y = -this.y; @@ -1844,31 +1655,24 @@ class Vector4 { this.w = -this.w; return this; } - dot(v) { return this.x * v.x + this.y * v.y + this.z * v.z + this.w * v.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(length) { return this.normalize().multiplyScalar(length); } - lerp(v, alpha) { this.x += (v.x - this.x) * alpha; this.y += (v.y - this.y) * alpha; @@ -1876,7 +1680,6 @@ class Vector4 { this.w += (v.w - this.w) * alpha; return this; } - lerpVectors(v1, v2, alpha) { this.x = v1.x + (v2.x - v1.x) * alpha; this.y = v1.y + (v2.y - v1.y) * alpha; @@ -1884,11 +1687,9 @@ class Vector4 { this.w = v1.w + (v2.w - v1.w) * alpha; return this; } - equals(v) { return v.x === this.x && v.y === this.y && v.z === this.z && v.w === this.w; } - fromArray(array, offset = 0) { this.x = array[offset]; this.y = array[offset + 1]; @@ -1896,7 +1697,6 @@ class Vector4 { this.w = array[offset + 3]; return this; } - toArray(array = [], offset = 0) { array[offset] = this.x; array[offset + 1] = this.y; @@ -1904,19 +1704,16 @@ class Vector4 { array[offset + 3] = this.w; return array; } - fromBufferAttribute(attribute, index, offset) { if (offset !== undefined) { console.warn('THREE.Vector4: offset has been removed from .fromBufferAttribute().'); } - this.x = attribute.getX(index); this.y = attribute.getY(index); this.z = attribute.getZ(index); this.w = attribute.getW(index); return this; } - random() { this.x = Math.random(); this.y = Math.random(); @@ -1924,16 +1721,13 @@ class Vector4 { this.w = Math.random(); return this; } - *[Symbol.iterator]() { yield this.x; yield this.y; yield this.z; yield this.w; } - } - Vector4.prototype.isVector4 = true; /* @@ -1941,7 +1735,6 @@ Vector4.prototype.isVector4 = true; * Texture parameters for an auto-generated target texture * depthBuffer/stencilBuffer: Booleans to indicate if we should generate these buffers */ - class WebGLRenderTarget extends EventDispatcher { constructor(width, height, options = {}) { super(); @@ -1964,16 +1757,15 @@ class WebGLRenderTarget extends EventDispatcher { this.depthBuffer = options.depthBuffer !== undefined ? options.depthBuffer : true; this.stencilBuffer = options.stencilBuffer !== undefined ? options.stencilBuffer : false; this.depthTexture = options.depthTexture !== undefined ? options.depthTexture : null; + /** * ios16.4.1 gl.DEPTH_COMPONENT16 does not work well in rendertarget * it only works in depthBuffer true & stencilBuffer false & depthTexture null * see WebGlTextures.setupRenderBufferStorage * */ - platform.properties && (this.useDEPTH_COMPONENT24 = platform.properties.rendertargetUseDEPTH_COMPONENT24); this.samples = options.samples !== undefined ? options.samples : 0; } - setTexture(texture) { texture.image = { width: this.width, @@ -1982,7 +1774,6 @@ class WebGLRenderTarget extends EventDispatcher { }; this.texture = texture; } - setSize(width, height, depth = 1) { if (this.width !== width || this.height !== height || this.depth !== depth) { this.width = width; @@ -1993,21 +1784,20 @@ class WebGLRenderTarget extends EventDispatcher { this.texture.image.depth = depth; this.dispose(); } - this.viewport.set(0, 0, width, height); this.scissor.set(0, 0, width, height); } - clone() { return new this.constructor().copy(this); } - copy(source) { this.width = source.width; this.height = source.height; this.depth = source.depth; this.viewport.copy(source.viewport); - this.texture = source.texture.clone(); // ensure image object is not shared, see #20328 + this.texture = source.texture.clone(); + + // ensure image object is not shared, see #20328 this.texture.image = Object.assign({}, source.texture.image); this.depthBuffer = source.depthBuffer; @@ -2016,15 +1806,12 @@ class WebGLRenderTarget extends EventDispatcher { this.samples = source.samples; return this; } - dispose() { this.dispatchEvent({ type: 'dispose' }); } - } - WebGLRenderTarget.prototype.isWebGLRenderTarget = true; class WebGLMultipleRenderTargets extends WebGLRenderTarget { @@ -2032,32 +1819,26 @@ class WebGLMultipleRenderTargets extends WebGLRenderTarget { super(width, height, options); const texture = this.texture; this.texture = []; - for (let i = 0; i < count; i++) { this.texture[i] = texture.clone(); } } - setSize(width, height, depth = 1) { if (this.width !== width || this.height !== height || this.depth !== depth) { this.width = width; this.height = height; this.depth = depth; - for (let i = 0, il = this.texture.length; i < il; i++) { this.texture[i].image.width = width; this.texture[i].image.height = height; this.texture[i].image.depth = depth; } - this.dispose(); } - this.viewport.set(0, 0, width, height); this.scissor.set(0, 0, width, height); return this; } - copy(source) { this.dispose(); this.width = source.width; @@ -2069,16 +1850,12 @@ class WebGLMultipleRenderTargets extends WebGLRenderTarget { this.stencilBuffer = source.stencilBuffer; this.depthTexture = source.depthTexture; this.texture.length = 0; - for (let i = 0, il = source.texture.length; i < il; i++) { this.texture[i] = source.texture[i].clone(); } - return this; } - } - WebGLMultipleRenderTargets.prototype.isWebGLMultipleRenderTargets = true; class Quaternion { @@ -2088,23 +1865,21 @@ class Quaternion { this._z = z; this._w = w; } - static slerp(qa, qb, qm, t) { console.warn('THREE.Quaternion: Static .slerp() has been deprecated. Use qm.slerpQuaternions( qa, qb, t ) instead.'); return qm.slerpQuaternions(qa, qb, t); } - static slerpFlat(dst, dstOffset, src0, srcOffset0, src1, srcOffset1, t) { // fuzz-free, array-based Quaternion SLERP operation + let x0 = src0[srcOffset0 + 0], - y0 = src0[srcOffset0 + 1], - z0 = src0[srcOffset0 + 2], - w0 = src0[srcOffset0 + 3]; + y0 = src0[srcOffset0 + 1], + z0 = src0[srcOffset0 + 2], + w0 = src0[srcOffset0 + 3]; const x1 = src1[srcOffset1 + 0], - y1 = src1[srcOffset1 + 1], - z1 = src1[srcOffset1 + 2], - w1 = src1[srcOffset1 + 3]; - + y1 = src1[srcOffset1 + 1], + z1 = src1[srcOffset1 + 2], + w1 = src1[srcOffset1 + 3]; if (t === 0) { dst[dstOffset + 0] = x0; dst[dstOffset + 1] = y0; @@ -2112,7 +1887,6 @@ class Quaternion { dst[dstOffset + 3] = w0; return; } - if (t === 1) { dst[dstOffset + 0] = x1; dst[dstOffset + 1] = y1; @@ -2120,26 +1894,26 @@ class Quaternion { dst[dstOffset + 3] = w1; return; } - if (w0 !== w1 || x0 !== x1 || y0 !== y1 || z0 !== z1) { let s = 1 - t; const cos = x0 * x1 + y0 * y1 + z0 * z1 + w0 * w1, - dir = cos >= 0 ? 1 : -1, - sqrSin = 1 - cos * cos; // Skip the Slerp for tiny steps to avoid numeric problems: + dir = cos >= 0 ? 1 : -1, + sqrSin = 1 - cos * cos; + // Skip the Slerp for tiny steps to avoid numeric problems: if (sqrSin > Number.EPSILON) { const sin = Math.sqrt(sqrSin), - len = Math.atan2(sin, cos * dir); + len = Math.atan2(sin, cos * dir); s = Math.sin(s * len) / sin; t = Math.sin(t * len) / sin; } - const tDir = t * dir; x0 = x0 * s + x1 * tDir; y0 = y0 * s + y1 * tDir; z0 = z0 * s + z1 * tDir; - w0 = w0 * s + w1 * tDir; // Normalize in case we just did a lerp: + w0 = w0 * s + w1 * tDir; + // Normalize in case we just did a lerp: if (s === 1 - t) { const f = 1 / Math.sqrt(x0 * x0 + y0 * y0 + z0 * z0 + w0 * w0); x0 *= f; @@ -2148,13 +1922,11 @@ class Quaternion { w0 *= f; } } - dst[dstOffset] = x0; dst[dstOffset + 1] = y0; dst[dstOffset + 2] = z0; dst[dstOffset + 3] = w0; } - static multiplyQuaternionsFlat(dst, dstOffset, src0, srcOffset0, src1, srcOffset1) { const x0 = src0[srcOffset0]; const y0 = src0[srcOffset0 + 1]; @@ -2170,82 +1942,63 @@ class Quaternion { dst[dstOffset + 3] = w0 * w1 - x0 * x1 - y0 * y1 - z0 * z1; return dst; } - get x() { return this._x; } - set x(value) { this._x = value; - this._onChangeCallback(); } - get y() { return this._y; } - set y(value) { this._y = value; - this._onChangeCallback(); } - get z() { return this._z; } - set z(value) { this._z = value; - this._onChangeCallback(); } - get w() { return this._w; } - set w(value) { this._w = value; - this._onChangeCallback(); } - set(x, y, z, w) { this._x = x; this._y = y; this._z = z; this._w = w; - this._onChangeCallback(); - return this; } - clone() { return new this.constructor(this._x, this._y, this._z, this._w); } - copy(quaternion) { this._x = quaternion.x; this._y = quaternion.y; this._z = quaternion.z; this._w = quaternion.w; - this._onChangeCallback(); - return this; } - setFromEuler(euler, update) { if (!(euler && euler.isEuler)) { throw new Error('THREE.Quaternion: .setFromEuler() now expects an Euler rotation rather than a Vector3 and order.'); } - const x = euler._x, - y = euler._y, - z = euler._z, - order = euler._order; // http://www.mathworks.com/matlabcentral/fileexchange/ + y = euler._y, + z = euler._z, + order = euler._order; + + // http://www.mathworks.com/matlabcentral/fileexchange/ // 20696-function-to-convert-between-dcm-euler-angles-quaternions-and-euler-vectors/ // content/SpinCalc.m @@ -2257,7 +2010,6 @@ class Quaternion { const s1 = sin(x / 2); const s2 = sin(y / 2); const s3 = sin(z / 2); - switch (order) { case 'XYZ': this._x = s1 * c2 * c3 + c1 * s2 * s3; @@ -2265,80 +2017,72 @@ class Quaternion { this._z = c1 * c2 * s3 + s1 * s2 * c3; this._w = c1 * c2 * c3 - s1 * s2 * s3; break; - case 'YXZ': this._x = s1 * c2 * c3 + c1 * s2 * s3; this._y = c1 * s2 * c3 - s1 * c2 * s3; this._z = c1 * c2 * s3 - s1 * s2 * c3; this._w = c1 * c2 * c3 + s1 * s2 * s3; break; - case 'ZXY': this._x = s1 * c2 * c3 - c1 * s2 * s3; this._y = c1 * s2 * c3 + s1 * c2 * s3; this._z = c1 * c2 * s3 + s1 * s2 * c3; this._w = c1 * c2 * c3 - s1 * s2 * s3; break; - case 'ZYX': this._x = s1 * c2 * c3 - c1 * s2 * s3; this._y = c1 * s2 * c3 + s1 * c2 * s3; this._z = c1 * c2 * s3 - s1 * s2 * c3; this._w = c1 * c2 * c3 + s1 * s2 * s3; break; - case 'YZX': this._x = s1 * c2 * c3 + c1 * s2 * s3; this._y = c1 * s2 * c3 + s1 * c2 * s3; this._z = c1 * c2 * s3 - s1 * s2 * c3; this._w = c1 * c2 * c3 - s1 * s2 * s3; break; - case 'XZY': this._x = s1 * c2 * c3 - c1 * s2 * s3; this._y = c1 * s2 * c3 - s1 * c2 * s3; this._z = c1 * c2 * s3 + s1 * s2 * c3; this._w = c1 * c2 * c3 + s1 * s2 * s3; break; - default: console.warn('THREE.Quaternion: .setFromEuler() encountered an unknown order: ' + order); } - if (update !== false) this._onChangeCallback(); return this; } - setFromAxisAngle(axis, angle) { // http://www.euclideanspace.com/maths/geometry/rotations/conversions/angleToQuaternion/index.htm + // assumes axis is normalized + const halfAngle = angle / 2, - s = Math.sin(halfAngle); + s = Math.sin(halfAngle); this._x = axis.x * s; this._y = axis.y * s; this._z = axis.z * s; this._w = Math.cos(halfAngle); - this._onChangeCallback(); - return this; } - setFromRotationMatrix(m) { // http://www.euclideanspace.com/maths/geometry/rotations/conversions/matrixToQuaternion/index.htm + // assumes the upper 3x3 of m is a pure rotation matrix (i.e, unscaled) - const te = m.elements, - m11 = te[0], - m12 = te[4], - m13 = te[8], - m21 = te[1], - m22 = te[5], - m23 = te[9], - m31 = te[2], - m32 = te[6], - m33 = te[10], - trace = m11 + m22 + m33; + const te = m.elements, + m11 = te[0], + m12 = te[4], + m13 = te[8], + m21 = te[1], + m22 = te[5], + m23 = te[9], + m31 = te[2], + m32 = te[6], + m33 = te[10], + trace = m11 + m22 + m33; if (trace > 0) { const s = 0.5 / Math.sqrt(trace + 1.0); this._w = 0.25 / s; @@ -2364,20 +2108,17 @@ class Quaternion { this._y = (m23 + m32) / s; this._z = 0.25 * s; } - this._onChangeCallback(); - return this; } - setFromUnitVectors(vFrom, vTo) { // assumes direction vectors vFrom and vTo are normalized - let r = vFrom.dot(vTo) + 1; + let r = vFrom.dot(vTo) + 1; if (r < Number.EPSILON) { // vFrom and vTo point in opposite directions - r = 0; + r = 0; if (Math.abs(vFrom.x) > Math.abs(vFrom.z)) { this._x = -vFrom.y; this._y = vFrom.x; @@ -2391,19 +2132,17 @@ class Quaternion { } } else { // crossVectors( vFrom, vTo ); // inlined to avoid cyclic dependency on Vector3 + this._x = vFrom.y * vTo.z - vFrom.z * vTo.y; this._y = vFrom.z * vTo.x - vFrom.x * vTo.z; this._z = vFrom.x * vTo.y - vFrom.y * vTo.x; this._w = r; } - return this.normalize(); } - angleTo(q) { return 2 * Math.acos(Math.abs(clamp(this.dot(q), -1, 1))); } - rotateTowards(q, step) { const angle = this.angleTo(q); if (angle === 0) return this; @@ -2411,41 +2150,32 @@ class Quaternion { this.slerp(q, t); return this; } - identity() { return this.set(0, 0, 0, 1); } - invert() { // quaternion is assumed to have unit length + return this.conjugate(); } - conjugate() { this._x *= -1; this._y *= -1; this._z *= -1; - this._onChangeCallback(); - return this; } - dot(v) { return this._x * v._x + this._y * v._y + this._z * v._z + this._w * v._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 l = this.length(); - if (l === 0) { this._x = 0; this._y = 0; @@ -2458,55 +2188,48 @@ class Quaternion { this._z = this._z * l; this._w = this._w * l; } - this._onChangeCallback(); - return this; } - multiply(q, p) { if (p !== undefined) { console.warn('THREE.Quaternion: .multiply() now only accepts one argument. Use .multiplyQuaternions( a, b ) instead.'); return this.multiplyQuaternions(q, p); } - return this.multiplyQuaternions(this, q); } - premultiply(q) { return this.multiplyQuaternions(q, this); } - multiplyQuaternions(a, b) { // from http://www.euclideanspace.com/maths/algebra/realNormedAlgebra/quaternions/code/index.htm + const qax = a._x, - qay = a._y, - qaz = a._z, - qaw = a._w; + qay = a._y, + qaz = a._z, + qaw = a._w; const qbx = b._x, - qby = b._y, - qbz = b._z, - qbw = b._w; + qby = b._y, + qbz = b._z, + qbw = b._w; this._x = qax * qbw + qaw * qbx + qay * qbz - qaz * qby; this._y = qay * qbw + qaw * qby + qaz * qbx - qax * qbz; this._z = qaz * qbw + qaw * qbz + qax * qby - qay * qbx; this._w = qaw * qbw - qax * qbx - qay * qby - qaz * qbz; - this._onChangeCallback(); - return this; } - slerp(qb, t) { if (t === 0) return this; if (t === 1) return this.copy(qb); const x = this._x, - y = this._y, - z = this._z, - w = this._w; // http://www.euclideanspace.com/maths/algebra/realNormedAlgebra/quaternions/slerp/ + y = this._y, + z = this._z, + w = this._w; - let cosHalfTheta = w * qb._w + x * qb._x + y * qb._y + z * qb._z; + // http://www.euclideanspace.com/maths/algebra/realNormedAlgebra/quaternions/slerp/ + let cosHalfTheta = w * qb._w + x * qb._x + y * qb._y + z * qb._z; if (cosHalfTheta < 0) { this._w = -qb._w; this._x = -qb._x; @@ -2516,7 +2239,6 @@ class Quaternion { } else { this.copy(qb); } - if (cosHalfTheta >= 1.0) { this._w = w; this._x = x; @@ -2524,9 +2246,7 @@ class Quaternion { this._z = z; return this; } - const sqrSinHalfTheta = 1.0 - cosHalfTheta * cosHalfTheta; - if (sqrSinHalfTheta <= Number.EPSILON) { const s = 1 - t; this._w = s * w + t * this._w; @@ -2534,34 +2254,28 @@ class Quaternion { this._y = s * y + t * this._y; this._z = s * z + t * this._z; this.normalize(); - this._onChangeCallback(); - return this; } - const sinHalfTheta = Math.sqrt(sqrSinHalfTheta); const halfTheta = Math.atan2(sinHalfTheta, cosHalfTheta); const ratioA = Math.sin((1 - t) * halfTheta) / sinHalfTheta, - ratioB = Math.sin(t * halfTheta) / sinHalfTheta; + ratioB = Math.sin(t * halfTheta) / sinHalfTheta; this._w = w * ratioA + this._w * ratioB; this._x = x * ratioA + this._x * ratioB; this._y = y * ratioA + this._y * ratioB; this._z = z * ratioA + this._z * ratioB; - this._onChangeCallback(); - return this; } - slerpQuaternions(qa, qb, t) { return this.copy(qa).slerp(qb, t); } - random() { // Derived from http://planning.cs.uiuc.edu/node198.html // Note, this source uses w, x, y, z ordering, // so we swap the order below. + const u1 = Math.random(); const sqrt1u1 = Math.sqrt(1 - u1); const sqrtu1 = Math.sqrt(u1); @@ -2569,22 +2283,17 @@ class Quaternion { const u3 = 2 * Math.PI * Math.random(); return this.set(sqrt1u1 * Math.cos(u2), sqrtu1 * Math.sin(u3), sqrtu1 * Math.cos(u3), sqrt1u1 * Math.sin(u2)); } - equals(quaternion) { return quaternion._x === this._x && quaternion._y === this._y && quaternion._z === this._z && quaternion._w === this._w; } - fromArray(array, offset = 0) { this._x = array[offset]; this._y = array[offset + 1]; this._z = array[offset + 2]; this._w = array[offset + 3]; - this._onChangeCallback(); - return this; } - toArray(array = [], offset = 0) { array[offset] = this._x; array[offset + 1] = this._y; @@ -2592,7 +2301,6 @@ class Quaternion { array[offset + 3] = this._w; return array; } - fromBufferAttribute(attribute, index) { this._x = attribute.getX(index); this._y = attribute.getY(index); @@ -2600,16 +2308,12 @@ class Quaternion { this._w = attribute.getW(index); return this; } - _onChange(callback) { this._onChangeCallback = callback; return this; } - _onChangeCallback() {} - } - Quaternion.prototype.isQuaternion = true; class Vector3 { @@ -2618,7 +2322,6 @@ class Vector3 { this.y = y; this.z = z; } - set(x, y, z) { if (z === undefined) z = this.z; // sprite.scale.set(x,y) @@ -2627,193 +2330,159 @@ class Vector3 { this.z = z; return this; } - setScalar(scalar) { this.x = scalar; this.y = scalar; this.z = scalar; return this; } - setX(x) { this.x = x; return this; } - setY(y) { this.y = y; return this; } - setZ(z) { this.z = z; return this; } - setComponent(index, value) { switch (index) { case 0: this.x = value; break; - case 1: this.y = value; break; - case 2: this.z = value; break; - default: throw new Error('index is out of range: ' + index); } - return this; } - getComponent(index) { switch (index) { case 0: return this.x; - case 1: return this.y; - case 2: return this.z; - default: throw new Error('index is out of range: ' + index); } } - clone() { return new this.constructor(this.x, this.y, this.z); } - copy(v) { this.x = v.x; this.y = v.y; this.z = v.z; return this; } - add(v, w) { if (w !== undefined) { console.warn('THREE.Vector3: .add() now only accepts one argument. Use .addVectors( a, b ) instead.'); return this.addVectors(v, w); } - this.x += v.x; this.y += v.y; this.z += v.z; return this; } - addScalar(s) { this.x += s; this.y += s; this.z += s; return this; } - addVectors(a, b) { this.x = a.x + b.x; this.y = a.y + b.y; this.z = a.z + b.z; return this; } - addScaledVector(v, s) { this.x += v.x * s; this.y += v.y * s; this.z += v.z * s; return this; } - sub(v, w) { if (w !== undefined) { console.warn('THREE.Vector3: .sub() now only accepts one argument. Use .subVectors( a, b ) instead.'); return this.subVectors(v, w); } - this.x -= v.x; this.y -= v.y; this.z -= v.z; return this; } - subScalar(s) { this.x -= s; this.y -= s; this.z -= s; return this; } - subVectors(a, b) { this.x = a.x - b.x; this.y = a.y - b.y; this.z = a.z - b.z; return this; } - multiply(v, w) { if (w !== undefined) { console.warn('THREE.Vector3: .multiply() now only accepts one argument. Use .multiplyVectors( a, b ) instead.'); return this.multiplyVectors(v, w); } - this.x *= v.x; this.y *= v.y; this.z *= v.z; return this; } - multiplyScalar(scalar) { this.x *= scalar; this.y *= scalar; this.z *= scalar; return this; } - multiplyVectors(a, b) { this.x = a.x * b.x; this.y = a.y * b.y; this.z = a.z * b.z; return this; } - applyEuler(euler) { if (!(euler && euler.isEuler)) { console.error('THREE.Vector3: .applyEuler() now expects an Euler rotation rather than a Vector3 and order.'); } - return this.applyQuaternion(_quaternion$4.setFromEuler(euler)); } - applyAxisAngle(axis, angle) { return this.applyQuaternion(_quaternion$4.setFromAxisAngle(axis, angle)); } - applyMatrix3(m) { const x = this.x, - y = this.y, - z = this.z; + y = this.y, + z = this.z; const e = m.elements; this.x = e[0] * x + e[3] * y + e[6] * z; this.y = e[1] * x + e[4] * y + e[7] * z; this.z = e[2] * x + e[5] * y + e[8] * z; return this; } - applyNormalMatrix(m) { return this.applyMatrix3(m).normalize(); } - applyMatrix4(m) { const x = this.x, - y = this.y, - z = this.z; + y = this.y, + z = this.z; const e = m.elements; const w = 1 / (e[3] * x + e[7] * y + e[11] * z + e[15]); this.x = (e[0] * x + e[4] * y + e[8] * z + e[12]) * w; @@ -2821,235 +2490,209 @@ class Vector3 { this.z = (e[2] * x + e[6] * y + e[10] * z + e[14]) * w; return this; } - applyQuaternion(q) { const x = this.x, - y = this.y, - z = this.z; + y = this.y, + z = this.z; const qx = q.x, - qy = q.y, - qz = q.z, - qw = q.w; // calculate quat * vector + qy = q.y, + qz = q.z, + qw = q.w; + + // calculate quat * vector const ix = qw * x + qy * z - qz * y; const iy = qw * y + qz * x - qx * z; const iz = qw * z + qx * y - qy * x; - const iw = -qx * x - qy * y - qz * z; // calculate result * inverse quat + const iw = -qx * x - qy * y - qz * z; + + // calculate result * inverse quat this.x = ix * qw + iw * -qx + iy * -qz - iz * -qy; this.y = iy * qw + iw * -qy + iz * -qx - ix * -qz; this.z = iz * qw + iw * -qz + ix * -qy - iy * -qx; return this; } - project(camera) { return this.applyMatrix4(camera.matrixWorldInverse).applyMatrix4(camera.projectionMatrix); } - unproject(camera) { return this.applyMatrix4(camera.projectionMatrixInverse).applyMatrix4(camera.matrixWorld); } - transformDirection(m) { // input: THREE.Matrix4 affine matrix // vector interpreted as a direction + const x = this.x, - y = this.y, - z = this.z; + y = this.y, + z = this.z; const e = m.elements; this.x = e[0] * x + e[4] * y + e[8] * z; this.y = e[1] * x + e[5] * y + e[9] * z; this.z = e[2] * x + e[6] * y + e[10] * z; return this.normalize(); } - divide(v) { this.x /= v.x; this.y /= v.y; this.z /= v.z; return this; } - divideScalar(scalar) { return this.multiplyScalar(1 / scalar); } - min(v) { this.x = Math.min(this.x, v.x); this.y = Math.min(this.y, v.y); this.z = Math.min(this.z, v.z); return this; } - max(v) { this.x = Math.max(this.x, v.x); this.y = Math.max(this.y, v.y); this.z = Math.max(this.z, v.z); return this; } - clamp(min, max) { // assumes min < max, componentwise + this.x = Math.max(min.x, Math.min(max.x, this.x)); this.y = Math.max(min.y, Math.min(max.y, this.y)); this.z = Math.max(min.z, Math.min(max.z, this.z)); return this; } - clampScalar(minVal, maxVal) { this.x = Math.max(minVal, Math.min(maxVal, this.x)); this.y = Math.max(minVal, Math.min(maxVal, this.y)); this.z = Math.max(minVal, Math.min(maxVal, this.z)); return this; } - clampLength(min, max) { const length = this.length(); return this.divideScalar(length || 1).multiplyScalar(Math.max(min, Math.min(max, length))); } - floor() { this.x = Math.floor(this.x); this.y = Math.floor(this.y); this.z = Math.floor(this.z); return this; } - ceil() { this.x = Math.ceil(this.x); this.y = Math.ceil(this.y); this.z = Math.ceil(this.z); return this; } - round() { this.x = Math.round(this.x); this.y = Math.round(this.y); this.z = Math.round(this.z); return this; } - roundToZero() { 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); return this; } - negate() { this.x = -this.x; this.y = -this.y; this.z = -this.z; return this; } - dot(v) { return this.x * v.x + this.y * v.y + this.z * v.z; - } // TODO lengthSquared? + } + // TODO lengthSquared? 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(length) { return this.normalize().multiplyScalar(length); } - lerp(v, alpha) { this.x += (v.x - this.x) * alpha; this.y += (v.y - this.y) * alpha; this.z += (v.z - this.z) * alpha; return this; } - lerpVectors(v1, v2, alpha) { this.x = v1.x + (v2.x - v1.x) * alpha; this.y = v1.y + (v2.y - v1.y) * alpha; this.z = v1.z + (v2.z - v1.z) * alpha; return this; } - cross(v, w) { if (w !== undefined) { console.warn('THREE.Vector3: .cross() now only accepts one argument. Use .crossVectors( a, b ) instead.'); return this.crossVectors(v, w); } - return this.crossVectors(this, v); } - crossVectors(a, b) { const ax = a.x, - ay = a.y, - az = a.z; + ay = a.y, + az = a.z; const bx = b.x, - by = b.y, - bz = b.z; + by = b.y, + bz = b.z; this.x = ay * bz - az * by; this.y = az * bx - ax * bz; this.z = ax * by - ay * bx; return this; } - projectOnVector(v) { const denominator = v.lengthSq(); if (denominator === 0) return this.set(0, 0, 0); const scalar = v.dot(this) / denominator; return this.copy(v).multiplyScalar(scalar); } - projectOnPlane(planeNormal) { _vector$c.copy(this).projectOnVector(planeNormal); - return this.sub(_vector$c); } - reflect(normal) { // reflect incident vector off plane orthogonal to normal // normal is assumed to have unit length + return this.sub(_vector$c.copy(normal).multiplyScalar(2 * this.dot(normal))); } - angleTo(v) { const denominator = Math.sqrt(this.lengthSq() * v.lengthSq()); if (denominator === 0) return Math.PI / 2; - const theta = this.dot(v) / denominator; // clamp, to handle numerical problems + const theta = this.dot(v) / denominator; + + // clamp, to handle numerical problems return Math.acos(clamp(theta, -1, 1)); } - distanceTo(v) { return Math.sqrt(this.distanceToSquared(v)); } - distanceToSquared(v) { const dx = this.x - v.x, - dy = this.y - v.y, - dz = this.z - v.z; + dy = this.y - v.y, + dz = this.z - v.z; return dx * dx + dy * dy + dz * dz; } - manhattanDistanceTo(v) { return Math.abs(this.x - v.x) + Math.abs(this.y - v.y) + Math.abs(this.z - v.z); } - setFromSpherical(s) { return this.setFromSphericalCoords(s.radius, s.phi, s.theta); } - setFromSphericalCoords(radius, phi, theta) { const sinPhiRadius = Math.sin(phi) * radius; this.x = sinPhiRadius * Math.sin(theta); @@ -3057,18 +2700,15 @@ class Vector3 { this.z = sinPhiRadius * Math.cos(theta); return this; } - setFromCylindrical(c) { return this.setFromCylindricalCoords(c.radius, c.theta, c.y); } - setFromCylindricalCoords(radius, theta, y) { this.x = radius * Math.sin(theta); this.y = y; this.z = radius * Math.cos(theta); return this; } - setFromMatrixPosition(m) { const e = m.elements; this.x = e[12]; @@ -3076,7 +2716,6 @@ class Vector3 { this.z = e[14]; return this; } - setFromMatrixScale(m) { const sx = this.setFromMatrixColumn(m, 0).length(); const sy = this.setFromMatrixColumn(m, 1).length(); @@ -3086,53 +2725,45 @@ class Vector3 { this.z = sz; return this; } - setFromMatrixColumn(m, index) { return this.fromArray(m.elements, index * 4); } - setFromMatrix3Column(m, index) { return this.fromArray(m.elements, index * 3); } - equals(v) { return v.x === this.x && v.y === this.y && v.z === this.z; } - fromArray(array, offset = 0) { this.x = array[offset]; this.y = array[offset + 1]; this.z = array[offset + 2]; return this; } - toArray(array = [], offset = 0) { array[offset] = this.x; array[offset + 1] = this.y; array[offset + 2] = this.z; return array; } - fromBufferAttribute(attribute, index, offset) { if (offset !== undefined) { console.warn('THREE.Vector3: offset has been removed from .fromBufferAttribute().'); } - this.x = attribute.getX(index); this.y = attribute.getY(index); this.z = attribute.getZ(index); return this; } - random() { this.x = Math.random(); this.y = Math.random(); this.z = Math.random(); return this; } - randomDirection() { // Derived from https://mathworld.wolfram.com/SpherePointPicking.html + const u = (Math.random() - 0.5) * 2; const t = Math.random() * Math.PI * 2; const f = Math.sqrt(1 - u ** 2); @@ -3141,19 +2772,14 @@ class Vector3 { this.z = u; return this; } - *[Symbol.iterator]() { yield this.x; yield this.y; yield this.z; } - } - Vector3.prototype.isVector3 = true; - const _vector$c = /*@__PURE__*/new Vector3(); - const _quaternion$4 = /*@__PURE__*/new Quaternion(); class Box3 { @@ -3161,13 +2787,11 @@ class Box3 { this.min = min; this.max = max; } - set(min, max) { this.min.copy(min); this.max.copy(max); return this; } - setFromArray(array) { let minX = +Infinity; let minY = +Infinity; @@ -3175,7 +2799,6 @@ class Box3 { let maxX = -Infinity; let maxY = -Infinity; let maxZ = -Infinity; - for (let i = 0, l = array.length; i < l; i += 3) { const x = array[i]; const y = array[i + 1]; @@ -3187,12 +2810,10 @@ class Box3 { if (y > maxY) maxY = y; if (z > maxZ) maxZ = z; } - this.min.set(minX, minY, minZ); this.max.set(maxX, maxY, maxZ); return this; } - setFromBufferAttribute(attribute) { let minX = +Infinity; let minY = +Infinity; @@ -3200,7 +2821,6 @@ class Box3 { let maxX = -Infinity; let maxY = -Infinity; let maxZ = -Infinity; - for (let i = 0, l = attribute.count; i < l; i++) { const x = attribute.getX(i); const y = attribute.getY(i); @@ -3212,150 +2832,122 @@ class Box3 { if (y > maxY) maxY = y; if (z > maxZ) maxZ = z; } - this.min.set(minX, minY, minZ); this.max.set(maxX, maxY, maxZ); return this; } - setFromPoints(points) { this.makeEmpty(); - for (let i = 0, il = points.length; i < il; i++) { this.expandByPoint(points[i]); } - return this; } - setFromCenterAndSize(center, size) { const halfSize = _vector$b.copy(size).multiplyScalar(0.5); - this.min.copy(center).sub(halfSize); this.max.copy(center).add(halfSize); return this; } - setFromObject(object, precise = false) { this.makeEmpty(); return this.expandByObject(object, precise); } - clone() { return new this.constructor().copy(this); } - copy(box) { this.min.copy(box.min); this.max.copy(box.max); return this; } - makeEmpty() { this.min.x = this.min.y = this.min.z = +Infinity; this.max.x = this.max.y = this.max.z = -Infinity; return this; } - isEmpty() { // this is a more robust check for empty than ( volume <= 0 ) because volume can get positive with two negative axes + return this.max.x < this.min.x || this.max.y < this.min.y || this.max.z < this.min.z; } - getCenter(target) { return this.isEmpty() ? target.set(0, 0, 0) : target.addVectors(this.min, this.max).multiplyScalar(0.5); } - getSize(target) { return this.isEmpty() ? target.set(0, 0, 0) : target.subVectors(this.max, this.min); } - expandByPoint(point) { this.min.min(point); this.max.max(point); return this; } - expandByVector(vector) { this.min.sub(vector); this.max.add(vector); return this; } - expandByScalar(scalar) { this.min.addScalar(-scalar); this.max.addScalar(scalar); return this; } - expandByObject(object, precise = false) { // Computes the world-axis-aligned bounding box of an object (including its children), // accounting for both the object's, and children's, world transforms + object.updateWorldMatrix(false, false); const geometry = object.geometry; - if (geometry !== undefined) { if (precise && geometry.attributes != undefined && geometry.attributes.position !== undefined) { const position = geometry.attributes.position; - for (let i = 0, l = position.count; i < l; i++) { _vector$b.fromBufferAttribute(position, i).applyMatrix4(object.matrixWorld); - this.expandByPoint(_vector$b); } } else { if (geometry.boundingBox === null) { geometry.computeBoundingBox(); } - _box$4.copy(geometry.boundingBox); - _box$4.applyMatrix4(object.matrixWorld); - this.union(_box$4); } } - const children = object.children; - for (let i = 0, l = children.length; i < l; i++) { this.expandByObject(children[i], precise); } - return this; } - containsPoint(point) { return point.x < this.min.x || point.x > this.max.x || point.y < this.min.y || point.y > this.max.y || point.z < this.min.z || point.z > this.max.z ? false : true; } - containsBox(box) { return this.min.x <= box.min.x && box.max.x <= this.max.x && this.min.y <= box.min.y && box.max.y <= this.max.y && this.min.z <= box.min.z && box.max.z <= this.max.z; } - getParameter(point, target) { // This can potentially have a divide by zero if the box // has a size dimension of 0. + return target.set((point.x - this.min.x) / (this.max.x - this.min.x), (point.y - this.min.y) / (this.max.y - this.min.y), (point.z - this.min.z) / (this.max.z - this.min.z)); } - intersectsBox(box) { // using 6 splitting planes to rule out intersections. return box.max.x < this.min.x || box.min.x > this.max.x || box.max.y < this.min.y || box.min.y > this.max.y || box.max.z < this.min.z || box.min.z > this.max.z ? false : true; } - intersectsSphere(sphere) { // Find the point on the AABB closest to the sphere center. - this.clampPoint(sphere.center, _vector$b); // If that point is inside the sphere, the AABB and sphere intersect. + this.clampPoint(sphere.center, _vector$b); + // If that point is inside the sphere, the AABB and sphere intersect. return _vector$b.distanceToSquared(sphere.center) <= sphere.radius * sphere.radius; } - intersectsPlane(plane) { // We compute the minimum and maximum dot product values. If those values // are on the same side (back or front) of the plane, then there is no intersection. - let min, max; + let min, max; if (plane.normal.x > 0) { min = plane.normal.x * this.min.x; max = plane.normal.x * this.max.x; @@ -3363,7 +2955,6 @@ class Box3 { min = plane.normal.x * this.max.x; max = plane.normal.x * this.min.x; } - if (plane.normal.y > 0) { min += plane.normal.y * this.min.y; max += plane.normal.y * this.max.y; @@ -3371,7 +2962,6 @@ class Box3 { min += plane.normal.y * this.max.y; max += plane.normal.y * this.min.y; } - if (plane.normal.z > 0) { min += plane.normal.z * this.min.z; max += plane.normal.z * this.max.z; @@ -3379,412 +2969,319 @@ class Box3 { min += plane.normal.z * this.max.z; max += plane.normal.z * this.min.z; } - return min <= -plane.constant && max >= -plane.constant; } - intersectsTriangle(triangle) { if (this.isEmpty()) { return false; - } // compute box center and extents - + } + // compute box center and extents this.getCenter(_center); + _extents.subVectors(this.max, _center); - _extents.subVectors(this.max, _center); // translate triangle to aabb origin - - + // translate triangle to aabb origin _v0$2.subVectors(triangle.a, _center); - _v1$7.subVectors(triangle.b, _center); + _v2$3.subVectors(triangle.c, _center); - _v2$3.subVectors(triangle.c, _center); // compute edge vectors for triangle - - + // compute edge vectors for triangle _f0.subVectors(_v1$7, _v0$2); - _f1.subVectors(_v2$3, _v1$7); + _f2.subVectors(_v0$2, _v2$3); - _f2.subVectors(_v0$2, _v2$3); // test against axes that are given by cross product combinations of the edges of the triangle and the edges of the aabb + // test against axes that are given by cross product combinations of the edges of the triangle and the edges of the aabb // make an axis testing of each of the 3 sides of the aabb against each of the 3 sides of the triangle = 9 axis of separation // axis_ij = u_i x f_j (u0, u1, u2 = face normals of aabb = x,y,z axes vectors since aabb is axis aligned) - - let axes = [0, -_f0.z, _f0.y, 0, -_f1.z, _f1.y, 0, -_f2.z, _f2.y, _f0.z, 0, -_f0.x, _f1.z, 0, -_f1.x, _f2.z, 0, -_f2.x, -_f0.y, _f0.x, 0, -_f1.y, _f1.x, 0, -_f2.y, _f2.x, 0]; - if (!satForAxes(axes, _v0$2, _v1$7, _v2$3, _extents)) { return false; - } // test 3 face normals from the aabb - + } + // test 3 face normals from the aabb axes = [1, 0, 0, 0, 1, 0, 0, 0, 1]; - if (!satForAxes(axes, _v0$2, _v1$7, _v2$3, _extents)) { return false; - } // finally testing the face normal of the triangle - // use already existing triangle edge vectors here - + } + // finally testing the face normal of the triangle + // use already existing triangle edge vectors here _triangleNormal.crossVectors(_f0, _f1); - axes = [_triangleNormal.x, _triangleNormal.y, _triangleNormal.z]; return satForAxes(axes, _v0$2, _v1$7, _v2$3, _extents); } - clampPoint(point, target) { return target.copy(point).clamp(this.min, this.max); } - distanceToPoint(point) { const clampedPoint = _vector$b.copy(point).clamp(this.min, this.max); - return clampedPoint.sub(point).length(); } - getBoundingSphere(target) { this.getCenter(target.center); target.radius = this.getSize(_vector$b).length() * 0.5; return target; } - intersect(box) { this.min.max(box.min); - this.max.min(box.max); // ensure that if there is no overlap, the result is fully empty, not slightly empty with non-inf/+inf values that will cause subsequence intersects to erroneously return valid values. + this.max.min(box.max); + // ensure that if there is no overlap, the result is fully empty, not slightly empty with non-inf/+inf values that will cause subsequence intersects to erroneously return valid values. if (this.isEmpty()) this.makeEmpty(); return this; } - union(box) { this.min.min(box.min); this.max.max(box.max); return this; } - applyMatrix4(matrix) { // transform of empty box is an empty box. - if (this.isEmpty()) return this; // NOTE: I am using a binary pattern to specify all 2^3 combinations below + if (this.isEmpty()) return this; + // NOTE: I am using a binary pattern to specify all 2^3 combinations below _points[0].set(this.min.x, this.min.y, this.min.z).applyMatrix4(matrix); // 000 - - _points[1].set(this.min.x, this.min.y, this.max.z).applyMatrix4(matrix); // 001 - - _points[2].set(this.min.x, this.max.y, this.min.z).applyMatrix4(matrix); // 010 - - _points[3].set(this.min.x, this.max.y, this.max.z).applyMatrix4(matrix); // 011 - - _points[4].set(this.max.x, this.min.y, this.min.z).applyMatrix4(matrix); // 100 - - _points[5].set(this.max.x, this.min.y, this.max.z).applyMatrix4(matrix); // 101 - - _points[6].set(this.max.x, this.max.y, this.min.z).applyMatrix4(matrix); // 110 - - _points[7].set(this.max.x, this.max.y, this.max.z).applyMatrix4(matrix); // 111 - this.setFromPoints(_points); return this; } - translate(offset) { this.min.add(offset); this.max.add(offset); return this; } - equals(box) { return box.min.equals(this.min) && box.max.equals(this.max); } - } - Box3.prototype.isBox3 = true; const _points = [/*@__PURE__*/new Vector3(), /*@__PURE__*/new Vector3(), /*@__PURE__*/new Vector3(), /*@__PURE__*/new Vector3(), /*@__PURE__*/new Vector3(), /*@__PURE__*/new Vector3(), /*@__PURE__*/new Vector3(), /*@__PURE__*/new Vector3()]; - const _vector$b = /*@__PURE__*/new Vector3(); +const _box$4 = /*@__PURE__*/new Box3(); -const _box$4 = /*@__PURE__*/new Box3(); // triangle centered vertices - +// triangle centered vertices const _v0$2 = /*@__PURE__*/new Vector3(); - const _v1$7 = /*@__PURE__*/new Vector3(); +const _v2$3 = /*@__PURE__*/new Vector3(); -const _v2$3 = /*@__PURE__*/new Vector3(); // triangle edge vectors - +// triangle edge vectors const _f0 = /*@__PURE__*/new Vector3(); - const _f1 = /*@__PURE__*/new Vector3(); - const _f2 = /*@__PURE__*/new Vector3(); - const _center = /*@__PURE__*/new Vector3(); - const _extents = /*@__PURE__*/new Vector3(); - const _triangleNormal = /*@__PURE__*/new Vector3(); - const _testAxis = /*@__PURE__*/new Vector3(); - function satForAxes(axes, v0, v1, v2, extents) { for (let i = 0, j = axes.length - 3; i <= j; i += 3) { - _testAxis.fromArray(axes, i); // project the aabb onto the seperating axis - - - const r = extents.x * Math.abs(_testAxis.x) + extents.y * Math.abs(_testAxis.y) + extents.z * Math.abs(_testAxis.z); // project all 3 vertices of the triangle onto the seperating axis - + _testAxis.fromArray(axes, i); + // project the aabb onto the seperating axis + const r = extents.x * Math.abs(_testAxis.x) + extents.y * Math.abs(_testAxis.y) + extents.z * Math.abs(_testAxis.z); + // project all 3 vertices of the triangle onto the seperating axis const p0 = v0.dot(_testAxis); const p1 = v1.dot(_testAxis); - const p2 = v2.dot(_testAxis); // actual test, basically see if either of the most extreme of the triangle points intersects r - + const p2 = v2.dot(_testAxis); + // actual test, basically see if either of the most extreme of the triangle points intersects r if (Math.max(-Math.max(p0, p1, p2), Math.min(p0, p1, p2)) > r) { // points of the projected triangle are outside the projected half-length of the aabb // the axis is seperating and we can exit return false; } } - return true; } const _box$3 = /*@__PURE__*/new Box3(); - const _v1$6 = /*@__PURE__*/new Vector3(); - const _toFarthestPoint = /*@__PURE__*/new Vector3(); - const _toPoint = /*@__PURE__*/new Vector3(); - class Sphere { constructor(center = new Vector3(), radius = -1) { this.center = center; this.radius = radius; } - set(center, radius) { this.center.copy(center); this.radius = radius; return this; } - setFromPoints(points, optionalCenter) { const center = this.center; - if (optionalCenter !== undefined) { center.copy(optionalCenter); } else { _box$3.setFromPoints(points).getCenter(center); } - let maxRadiusSq = 0; - for (let i = 0, il = points.length; i < il; i++) { maxRadiusSq = Math.max(maxRadiusSq, center.distanceToSquared(points[i])); } - this.radius = Math.sqrt(maxRadiusSq); return this; } - copy(sphere) { this.center.copy(sphere.center); this.radius = sphere.radius; return this; } - isEmpty() { return this.radius < 0; } - makeEmpty() { this.center.set(0, 0, 0); this.radius = -1; return this; } - containsPoint(point) { return point.distanceToSquared(this.center) <= this.radius * this.radius; } - distanceToPoint(point) { return point.distanceTo(this.center) - this.radius; } - intersectsSphere(sphere) { const radiusSum = this.radius + sphere.radius; return sphere.center.distanceToSquared(this.center) <= radiusSum * radiusSum; } - intersectsBox(box) { return box.intersectsSphere(this); } - intersectsPlane(plane) { return Math.abs(plane.distanceToPoint(this.center)) <= this.radius; } - clampPoint(point, target) { const deltaLengthSq = this.center.distanceToSquared(point); target.copy(point); - if (deltaLengthSq > this.radius * this.radius) { target.sub(this.center).normalize(); target.multiplyScalar(this.radius).add(this.center); } - return target; } - getBoundingBox(target) { if (this.isEmpty()) { // Empty sphere produces empty bounding box target.makeEmpty(); return target; } - target.set(this.center, this.center); target.expandByScalar(this.radius); return target; } - applyMatrix4(matrix) { this.center.applyMatrix4(matrix); this.radius = this.radius * matrix.getMaxScaleOnAxis(); return this; } - translate(offset) { this.center.add(offset); return this; } - expandByPoint(point) { // from https://github.com/juj/MathGeoLib/blob/2940b99b99cfe575dd45103ef20f4019dee15b54/src/Geometry/Sphere.cpp#L649-L671 - _toPoint.subVectors(point, this.center); + _toPoint.subVectors(point, this.center); const lengthSq = _toPoint.lengthSq(); - if (lengthSq > this.radius * this.radius) { const length = Math.sqrt(lengthSq); - const missingRadiusHalf = (length - this.radius) * 0.5; // Nudge this sphere towards the target point. Add half the missing distance to radius, + const missingRadiusHalf = (length - this.radius) * 0.5; + + // Nudge this sphere towards the target point. Add half the missing distance to radius, // and the other half to position. This gives a tighter enclosure, instead of if // the whole missing distance were just added to radius. this.center.add(_toPoint.multiplyScalar(missingRadiusHalf / length)); this.radius += missingRadiusHalf; } - return this; } - union(sphere) { // from https://github.com/juj/MathGeoLib/blob/2940b99b99cfe575dd45103ef20f4019dee15b54/src/Geometry/Sphere.cpp#L759-L769 + // To enclose another sphere into this sphere, we only need to enclose two points: // 1) Enclose the farthest point on the other sphere into this sphere. // 2) Enclose the opposite point of the farthest point into this sphere. + if (this.center.equals(sphere.center) === true) { _toFarthestPoint.set(0, 0, 1).multiplyScalar(sphere.radius); } else { _toFarthestPoint.subVectors(sphere.center, this.center).normalize().multiplyScalar(sphere.radius); } - this.expandByPoint(_v1$6.copy(sphere.center).add(_toFarthestPoint)); this.expandByPoint(_v1$6.copy(sphere.center).sub(_toFarthestPoint)); return this; } - equals(sphere) { return sphere.center.equals(this.center) && sphere.radius === this.radius; } - clone() { return new this.constructor().copy(this); } - } const _vector$a = /*@__PURE__*/new Vector3(); - const _segCenter = /*@__PURE__*/new Vector3(); - const _segDir = /*@__PURE__*/new Vector3(); - const _diff = /*@__PURE__*/new Vector3(); - const _edge1 = /*@__PURE__*/new Vector3(); - const _edge2 = /*@__PURE__*/new Vector3(); - const _normal$1 = /*@__PURE__*/new Vector3(); - class Ray { constructor(origin = new Vector3(), direction = new Vector3(0, 0, -1)) { this.origin = origin; this.direction = direction; } - set(origin, direction) { this.origin.copy(origin); this.direction.copy(direction); return this; } - copy(ray) { this.origin.copy(ray.origin); this.direction.copy(ray.direction); return this; } - at(t, target) { return target.copy(this.direction).multiplyScalar(t).add(this.origin); } - lookAt(v) { this.direction.copy(v).sub(this.origin).normalize(); return this; } - recast(t) { this.origin.copy(this.at(t, _vector$a)); return this; } - closestPointToPoint(point, target) { target.subVectors(point, this.origin); const directionDistance = target.dot(this.direction); - if (directionDistance < 0) { return target.copy(this.origin); } - return target.copy(this.direction).multiplyScalar(directionDistance).add(this.origin); } - distanceToPoint(point) { return Math.sqrt(this.distanceSqToPoint(point)); } - distanceSqToPoint(point) { - const directionDistance = _vector$a.subVectors(point, this.origin).dot(this.direction); // point behind the ray + const directionDistance = _vector$a.subVectors(point, this.origin).dot(this.direction); + // point behind the ray if (directionDistance < 0) { return this.origin.distanceToSquared(point); } - _vector$a.copy(this.direction).multiplyScalar(directionDistance).add(this.origin); - return _vector$a.distanceToSquared(point); } - distanceSqToSegment(v0, v1, optionalPointOnRay, optionalPointOnSegment) { // from https://github.com/pmjoniak/GeometricTools/blob/master/GTEngine/Include/Mathematics/GteDistRaySegment.h // It returns the min distance between the ray and the segment @@ -3792,47 +3289,43 @@ class Ray { // It can also set two optional targets : // - The closest point on the ray // - The closest point on the segment - _segCenter.copy(v0).add(v1).multiplyScalar(0.5); + _segCenter.copy(v0).add(v1).multiplyScalar(0.5); _segDir.copy(v1).sub(v0).normalize(); - _diff.copy(this.origin).sub(_segCenter); - const segExtent = v0.distanceTo(v1) * 0.5; const a01 = -this.direction.dot(_segDir); - const b0 = _diff.dot(this.direction); - const b1 = -_diff.dot(_segDir); - const c = _diff.lengthSq(); - const det = Math.abs(1 - a01 * a01); let s0, s1, sqrDist, extDet; - if (det > 0) { // The ray and segment are not parallel. + s0 = a01 * b1 - b0; s1 = a01 * b0 - b1; extDet = segExtent * det; - if (s0 >= 0) { if (s1 >= -extDet) { if (s1 <= extDet) { // region 0 // Minimum at interior points of ray and segment. + const invDet = 1 / det; s0 *= invDet; s1 *= invDet; sqrDist = s0 * (s0 + a01 * s1 + 2 * b0) + s1 * (a01 * s0 + s1 + 2 * b1) + c; } else { // region 1 + s1 = segExtent; s0 = Math.max(0, -(a01 * s1 + b0)); sqrDist = -s0 * s0 + s1 * (s1 + 2 * b1) + c; } } else { // region 5 + s1 = -segExtent; s0 = Math.max(0, -(a01 * s1 + b0)); sqrDist = -s0 * s0 + s1 * (s1 + 2 * b1) + c; @@ -3840,16 +3333,19 @@ class Ray { } else { if (s1 <= -extDet) { // region 4 + s0 = Math.max(0, -(-a01 * segExtent + b0)); s1 = s0 > 0 ? -segExtent : Math.min(Math.max(-segExtent, -b1), segExtent); sqrDist = -s0 * s0 + s1 * (s1 + 2 * b1) + c; } else if (s1 <= extDet) { // region 3 + s0 = 0; s1 = Math.min(Math.max(-segExtent, -b1), segExtent); sqrDist = s1 * (s1 + 2 * b1) + c; } else { // region 2 + s0 = Math.max(0, -(a01 * segExtent + b0)); s1 = s0 > 0 ? segExtent : Math.min(Math.max(-segExtent, -b1), segExtent); sqrDist = -s0 * s0 + s1 * (s1 + 2 * b1) + c; @@ -3857,102 +3353,94 @@ class Ray { } } else { // Ray and segment are parallel. + s1 = a01 > 0 ? -segExtent : segExtent; s0 = Math.max(0, -(a01 * s1 + b0)); sqrDist = -s0 * s0 + s1 * (s1 + 2 * b1) + c; } - if (optionalPointOnRay) { optionalPointOnRay.copy(this.direction).multiplyScalar(s0).add(this.origin); } - if (optionalPointOnSegment) { optionalPointOnSegment.copy(_segDir).multiplyScalar(s1).add(_segCenter); } - return sqrDist; } - intersectSphere(sphere, target) { _vector$a.subVectors(sphere.center, this.origin); - const tca = _vector$a.dot(this.direction); - const d2 = _vector$a.dot(_vector$a) - tca * tca; const radius2 = sphere.radius * sphere.radius; if (d2 > radius2) return null; - const thc = Math.sqrt(radius2 - d2); // t0 = first intersect point - entrance on front of sphere + const thc = Math.sqrt(radius2 - d2); + + // t0 = first intersect point - entrance on front of sphere + const t0 = tca - thc; - const t0 = tca - thc; // t1 = second intersect point - exit point on back of sphere + // t1 = second intersect point - exit point on back of sphere + const t1 = tca + thc; - const t1 = tca + thc; // test to see if both t0 and t1 are behind the ray - if so, return null + // test to see if both t0 and t1 are behind the ray - if so, return null + if (t0 < 0 && t1 < 0) return null; - if (t0 < 0 && t1 < 0) return null; // test to see if t0 is behind the ray: + // test to see if t0 is behind the ray: // if it is, the ray is inside the sphere, so return the second exit point scaled by t1, // in order to always return an intersect point that is in front of the ray. + if (t0 < 0) return this.at(t1, target); - if (t0 < 0) return this.at(t1, target); // else t0 is in front of the ray, so return the first collision point scaled by t0 - + // else t0 is in front of the ray, so return the first collision point scaled by t0 return this.at(t0, target); } - intersectsSphere(sphere) { return this.distanceSqToPoint(sphere.center) <= sphere.radius * sphere.radius; } - distanceToPlane(plane) { const denominator = plane.normal.dot(this.direction); - if (denominator === 0) { // line is coplanar, return origin if (plane.distanceToPoint(this.origin) === 0) { return 0; - } // Null is preferable to undefined since undefined means.... it is undefined + } + // Null is preferable to undefined since undefined means.... it is undefined return null; } + const t = -(this.origin.dot(plane.normal) + plane.constant) / denominator; - const t = -(this.origin.dot(plane.normal) + plane.constant) / denominator; // Return if the ray never intersects the plane + // Return if the ray never intersects the plane return t >= 0 ? t : null; } - intersectPlane(plane, target) { const t = this.distanceToPlane(plane); - if (t === null) { return null; } - return this.at(t, target); } - intersectsPlane(plane) { // check if the ray lies on the plane first - const distToPoint = plane.distanceToPoint(this.origin); + const distToPoint = plane.distanceToPoint(this.origin); if (distToPoint === 0) { return true; } - const denominator = plane.normal.dot(this.direction); - if (denominator * distToPoint < 0) { return true; - } // ray origin is behind the plane (and is pointing behind it) + } + // ray origin is behind the plane (and is pointing behind it) return false; } - intersectBox(box, target) { let tmin, tmax, tymin, tymax, tzmin, tzmax; const invdirx = 1 / this.direction.x, - invdiry = 1 / this.direction.y, - invdirz = 1 / this.direction.z; + invdiry = 1 / this.direction.y, + invdirz = 1 / this.direction.z; const origin = this.origin; - if (invdirx >= 0) { tmin = (box.min.x - origin.x) * invdirx; tmax = (box.max.x - origin.x) * invdirx; @@ -3960,7 +3448,6 @@ class Ray { tmin = (box.max.x - origin.x) * invdirx; tmax = (box.min.x - origin.x) * invdirx; } - if (invdiry >= 0) { tymin = (box.min.y - origin.y) * invdiry; tymax = (box.max.y - origin.y) * invdiry; @@ -3968,13 +3455,13 @@ class Ray { tymin = (box.max.y - origin.y) * invdiry; tymax = (box.min.y - origin.y) * invdiry; } + if (tmin > tymax || tymin > tmax) return null; - if (tmin > tymax || tymin > tmax) return null; // These lines also handle the case where tmin or tmax is NaN + // These lines also handle the case where tmin or tmax is NaN // (result of 0 * Infinity). x !== x returns true if x is NaN if (tymin > tmin || tmin !== tmin) tmin = tymin; if (tymax < tmax || tmax !== tmax) tmax = tymax; - if (invdirz >= 0) { tzmin = (box.min.z - origin.z) * invdirz; tzmax = (box.max.z - origin.z) * invdirz; @@ -3982,36 +3469,34 @@ class Ray { tzmin = (box.max.z - origin.z) * invdirz; tzmax = (box.min.z - origin.z) * invdirz; } - if (tmin > tzmax || tzmin > tmax) return null; if (tzmin > tmin || tmin !== tmin) tmin = tzmin; - if (tzmax < tmax || tmax !== tmax) tmax = tzmax; //return point closest to the ray (positive side) + if (tzmax < tmax || tmax !== tmax) tmax = tzmax; + + //return point closest to the ray (positive side) if (tmax < 0) return null; return this.at(tmin >= 0 ? tmin : tmax, target); } - intersectsBox(box) { return this.intersectBox(box, _vector$a) !== null; } - intersectTriangle(a, b, c, backfaceCulling, target) { // Compute the offset origin, edges, and normal. + // from https://github.com/pmjoniak/GeometricTools/blob/master/GTEngine/Include/Mathematics/GteIntrRay3Triangle3.h - _edge1.subVectors(b, a); + _edge1.subVectors(b, a); _edge2.subVectors(c, a); + _normal$1.crossVectors(_edge1, _edge2); - _normal$1.crossVectors(_edge1, _edge2); // Solve Q + t*D = b1*E1 + b2*E2 (Q = kDiff, D = ray direction, + // Solve Q + t*D = b1*E1 + b2*E2 (Q = kDiff, D = ray direction, // E1 = kEdge1, E2 = kEdge2, N = Cross(E1,E2)) by // |Dot(D,N)|*b1 = sign(Dot(D,N))*Dot(D,Cross(Q,E2)) // |Dot(D,N)|*b2 = sign(Dot(D,N))*Dot(D,Cross(E1,Q)) // |Dot(D,N)|*t = -sign(Dot(D,N))*Dot(Q,N) - - let DdN = this.direction.dot(_normal$1); let sign; - if (DdN > 0) { if (backfaceCulling) return null; sign = 1; @@ -4021,63 +3506,56 @@ class Ray { } else { return null; } - _diff.subVectors(this.origin, a); + const DdQxE2 = sign * this.direction.dot(_edge2.crossVectors(_diff, _edge2)); - const DdQxE2 = sign * this.direction.dot(_edge2.crossVectors(_diff, _edge2)); // b1 < 0, no intersection - + // b1 < 0, no intersection if (DdQxE2 < 0) { return null; } + const DdE1xQ = sign * this.direction.dot(_edge1.cross(_diff)); - const DdE1xQ = sign * this.direction.dot(_edge1.cross(_diff)); // b2 < 0, no intersection - + // b2 < 0, no intersection if (DdE1xQ < 0) { return null; - } // b1+b2 > 1, no intersection - + } + // b1+b2 > 1, no intersection if (DdQxE2 + DdE1xQ > DdN) { return null; - } // Line intersects triangle, check if ray does. - - - const QdN = -sign * _diff.dot(_normal$1); // t < 0, no intersection + } + // Line intersects triangle, check if ray does. + const QdN = -sign * _diff.dot(_normal$1); + // t < 0, no intersection if (QdN < 0) { return null; - } // Ray intersects triangle. - + } + // Ray intersects triangle. return this.at(QdN / DdN, target); } - applyMatrix4(matrix4) { this.origin.applyMatrix4(matrix4); this.direction.transformDirection(matrix4); return this; } - equals(ray) { return ray.origin.equals(this.origin) && ray.direction.equals(this.direction); } - clone() { return new this.constructor().copy(this); } - } class Matrix4 { constructor() { this.elements = [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1]; - if (arguments.length > 0) { console.error('THREE.Matrix4: the constructor no longer reads arguments. use .set() instead.'); } } - set(n11, n12, n13, n14, n21, n22, n23, n24, n31, n32, n33, n34, n41, n42, n43, n44) { const te = this.elements; te[0] = n11; @@ -4098,16 +3576,13 @@ class Matrix4 { te[15] = n44; return this; } - identity() { this.set(1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1); return this; } - clone() { return new Matrix4().fromArray(this.elements); } - copy(m) { const te = this.elements; const me = m.elements; @@ -4129,45 +3604,37 @@ class Matrix4 { te[15] = me[15]; return this; } - copyPosition(m) { const te = this.elements, - me = m.elements; + me = m.elements; te[12] = me[12]; te[13] = me[13]; te[14] = me[14]; return this; } - setFromMatrix3(m) { const me = m.elements; this.set(me[0], me[3], me[6], 0, me[1], me[4], me[7], 0, me[2], me[5], me[8], 0, 0, 0, 0, 1); return this; } - extractBasis(xAxis, yAxis, zAxis) { xAxis.setFromMatrixColumn(this, 0); yAxis.setFromMatrixColumn(this, 1); zAxis.setFromMatrixColumn(this, 2); return this; } - makeBasis(xAxis, yAxis, zAxis) { this.set(xAxis.x, yAxis.x, zAxis.x, 0, xAxis.y, yAxis.y, zAxis.y, 0, xAxis.z, yAxis.z, zAxis.z, 0, 0, 0, 0, 1); return this; } - extractRotation(m) { // this method does not support reflection matrices + const te = this.elements; const me = m.elements; - const scaleX = 1 / _v1$5.setFromMatrixColumn(m, 0).length(); - const scaleY = 1 / _v1$5.setFromMatrixColumn(m, 1).length(); - const scaleZ = 1 / _v1$5.setFromMatrixColumn(m, 2).length(); - te[0] = me[0] * scaleX; te[1] = me[1] * scaleX; te[2] = me[2] * scaleX; @@ -4186,28 +3653,25 @@ class Matrix4 { te[15] = 1; return this; } - makeRotationFromEuler(euler) { if (!(euler && euler.isEuler)) { console.error('THREE.Matrix4: .makeRotationFromEuler() now expects a Euler rotation rather than a Vector3 and order.'); } - const te = this.elements; const x = euler.x, - y = euler.y, - z = euler.z; + y = euler.y, + z = euler.z; const a = Math.cos(x), - b = Math.sin(x); + b = Math.sin(x); const c = Math.cos(y), - d = Math.sin(y); + d = Math.sin(y); const e = Math.cos(z), - f = Math.sin(z); - + f = Math.sin(z); if (euler.order === 'XYZ') { const ae = a * e, - af = a * f, - be = b * e, - bf = b * f; + af = a * f, + be = b * e, + bf = b * f; te[0] = c * e; te[4] = -c * f; te[8] = d; @@ -4219,9 +3683,9 @@ class Matrix4 { te[10] = a * c; } else if (euler.order === 'YXZ') { const ce = c * e, - cf = c * f, - de = d * e, - df = d * f; + cf = c * f, + de = d * e, + df = d * f; te[0] = ce + df * b; te[4] = de * b - cf; te[8] = a * d; @@ -4233,9 +3697,9 @@ class Matrix4 { te[10] = a * c; } else if (euler.order === 'ZXY') { const ce = c * e, - cf = c * f, - de = d * e, - df = d * f; + cf = c * f, + de = d * e, + df = d * f; te[0] = ce - df * b; te[4] = -a * f; te[8] = de + cf * b; @@ -4247,9 +3711,9 @@ class Matrix4 { te[10] = a * c; } else if (euler.order === 'ZYX') { const ae = a * e, - af = a * f, - be = b * e, - bf = b * f; + af = a * f, + be = b * e, + bf = b * f; te[0] = c * e; te[4] = be * d - af; te[8] = ae * d + bf; @@ -4261,9 +3725,9 @@ class Matrix4 { te[10] = a * c; } else if (euler.order === 'YZX') { const ac = a * c, - ad = a * d, - bc = b * c, - bd = b * d; + ad = a * d, + bc = b * c, + bd = b * d; te[0] = c * e; te[4] = bd - ac * f; te[8] = bc * f + ad; @@ -4275,9 +3739,9 @@ class Matrix4 { te[10] = ac - bd * f; } else if (euler.order === 'XZY') { const ac = a * c, - ad = a * d, - bc = b * c, - bd = b * d; + ad = a * d, + bc = b * c, + bd = b * d; te[0] = c * e; te[4] = -f; te[8] = d * e; @@ -4287,55 +3751,46 @@ class Matrix4 { te[2] = bc * f - ad; te[6] = b * e; te[10] = bd * f + ac; - } // bottom row - + } + // bottom row te[3] = 0; te[7] = 0; - te[11] = 0; // last column + te[11] = 0; + // last column te[12] = 0; te[13] = 0; te[14] = 0; te[15] = 1; return this; } - makeRotationFromQuaternion(q) { return this.compose(_zero, q, _one); } - lookAt(eye, target, up) { const te = this.elements; - _z.subVectors(eye, target); - if (_z.lengthSq() === 0) { // eye and target are in the same position + _z.z = 1; } - _z.normalize(); - _x.crossVectors(up, _z); - if (_x.lengthSq() === 0) { // up and z are parallel + if (Math.abs(up.z) === 1) { _z.x += 0.0001; } else { _z.z += 0.0001; } - _z.normalize(); - _x.crossVectors(up, _z); } - _x.normalize(); - _y.crossVectors(_z, _x); - te[0] = _x.x; te[4] = _y.x; te[8] = _z.x; @@ -4347,56 +3802,52 @@ class Matrix4 { te[10] = _z.z; return this; } - multiply(m, n) { if (n !== undefined) { console.warn('THREE.Matrix4: .multiply() now only accepts one argument. Use .multiplyMatrices( a, b ) instead.'); return this.multiplyMatrices(m, n); } - return this.multiplyMatrices(this, m); } - premultiply(m) { return this.multiplyMatrices(m, this); } - multiplyMatrices(a, b) { const ae = a.elements; const be = b.elements; const te = this.elements; const a11 = ae[0], - a12 = ae[4], - a13 = ae[8], - a14 = ae[12]; + a12 = ae[4], + a13 = ae[8], + a14 = ae[12]; const a21 = ae[1], - a22 = ae[5], - a23 = ae[9], - a24 = ae[13]; + a22 = ae[5], + a23 = ae[9], + a24 = ae[13]; const a31 = ae[2], - a32 = ae[6], - a33 = ae[10], - a34 = ae[14]; + a32 = ae[6], + a33 = ae[10], + a34 = ae[14]; const a41 = ae[3], - a42 = ae[7], - a43 = ae[11], - a44 = ae[15]; + a42 = ae[7], + a43 = ae[11], + a44 = ae[15]; const b11 = be[0], - b12 = be[4], - b13 = be[8], - b14 = be[12]; + b12 = be[4], + b13 = be[8], + b14 = be[12]; const b21 = be[1], - b22 = be[5], - b23 = be[9], - b24 = be[13]; + b22 = be[5], + b23 = be[9], + b24 = be[13]; const b31 = be[2], - b32 = be[6], - b33 = be[10], - b34 = be[14]; + b32 = be[6], + b33 = be[10], + b34 = be[14]; const b41 = be[3], - b42 = be[7], - b43 = be[11], - b44 = be[15]; + b42 = be[7], + b43 = be[11], + b44 = be[15]; te[0] = a11 * b11 + a12 * b21 + a13 * b31 + a14 * b41; te[4] = a11 * b12 + a12 * b22 + a13 * b32 + a14 * b42; te[8] = a11 * b13 + a12 * b23 + a13 * b33 + a14 * b43; @@ -4415,7 +3866,6 @@ class Matrix4 { te[15] = a41 * b14 + a42 * b24 + a43 * b34 + a44 * b44; return this; } - multiplyScalar(s) { const te = this.elements; te[0] *= s; @@ -4436,30 +3886,30 @@ class Matrix4 { te[15] *= s; return this; } - determinant() { const te = this.elements; const n11 = te[0], - n12 = te[4], - n13 = te[8], - n14 = te[12]; + n12 = te[4], + n13 = te[8], + n14 = te[12]; const n21 = te[1], - n22 = te[5], - n23 = te[9], - n24 = te[13]; + n22 = te[5], + n23 = te[9], + n24 = te[13]; const n31 = te[2], - n32 = te[6], - n33 = te[10], - n34 = te[14]; + n32 = te[6], + n33 = te[10], + n34 = te[14]; const n41 = te[3], - n42 = te[7], - n43 = te[11], - n44 = te[15]; //TODO: make this more efficient + n42 = te[7], + n43 = te[11], + n44 = te[15]; + + //TODO: make this more efficient //( based on http://www.euclideanspace.com/maths/algebra/matrix/functions/inverse/fourD/index.htm ) return n41 * (+n14 * n23 * n32 - n13 * n24 * n32 - n14 * n22 * n33 + n12 * n24 * n33 + n13 * n22 * n34 - n12 * n23 * n34) + n42 * (+n11 * n23 * n34 - n11 * n24 * n33 + n14 * n21 * n33 - n13 * n21 * n34 + n13 * n24 * n31 - n14 * n23 * n31) + n43 * (+n11 * n24 * n32 - n11 * n22 * n34 - n14 * n21 * n32 + n12 * n21 * n34 + n14 * n22 * n31 - n12 * n24 * n31) + n44 * (-n13 * n22 * n31 - n11 * n23 * n32 + n11 * n22 * n33 + n13 * n21 * n32 - n12 * n21 * n33 + n12 * n23 * n31); } - transpose() { const te = this.elements; let tmp; @@ -4483,10 +3933,8 @@ class Matrix4 { te[14] = tmp; return this; } - setPosition(x, y, z) { const te = this.elements; - if (x.isVector3) { te[12] = x.x; te[13] = x.y; @@ -4496,33 +3944,31 @@ class Matrix4 { te[13] = y; te[14] = z; } - return this; } - invert() { // based on http://www.euclideanspace.com/maths/algebra/matrix/functions/inverse/fourD/index.htm const te = this.elements, - n11 = te[0], - n21 = te[1], - n31 = te[2], - n41 = te[3], - n12 = te[4], - n22 = te[5], - n32 = te[6], - n42 = te[7], - n13 = te[8], - n23 = te[9], - n33 = te[10], - n43 = te[11], - n14 = te[12], - n24 = te[13], - n34 = te[14], - n44 = te[15], - t11 = n23 * n34 * n42 - n24 * n33 * n42 + n24 * n32 * n43 - n22 * n34 * n43 - n23 * n32 * n44 + n22 * n33 * n44, - t12 = n14 * n33 * n42 - n13 * n34 * n42 - n14 * n32 * n43 + n12 * n34 * n43 + n13 * n32 * n44 - n12 * n33 * n44, - t13 = n13 * n24 * n42 - n14 * n23 * n42 + n14 * n22 * n43 - n12 * n24 * n43 - n13 * n22 * n44 + n12 * n23 * n44, - t14 = n14 * n23 * n32 - n13 * n24 * n32 - n14 * n22 * n33 + n12 * n24 * n33 + n13 * n22 * n34 - n12 * n23 * n34; + n11 = te[0], + n21 = te[1], + n31 = te[2], + n41 = te[3], + n12 = te[4], + n22 = te[5], + n32 = te[6], + n42 = te[7], + n13 = te[8], + n23 = te[9], + n33 = te[10], + n43 = te[11], + n14 = te[12], + n24 = te[13], + n34 = te[14], + n44 = te[15], + t11 = n23 * n34 * n42 - n24 * n33 * n42 + n24 * n32 * n43 - n22 * n34 * n43 - n23 * n32 * n44 + n22 * n33 * n44, + t12 = n14 * n33 * n42 - n13 * n34 * n42 - n14 * n32 * n43 + n12 * n34 * n43 + n13 * n32 * n44 - n12 * n33 * n44, + t13 = n13 * n24 * n42 - n14 * n23 * n42 + n14 * n22 * n43 - n12 * n24 * n43 - n13 * n22 * n44 + n12 * n23 * n44, + t14 = n14 * n23 * n32 - n13 * n24 * n32 - n14 * n22 * n33 + n12 * n24 * n33 + n13 * n22 * n34 - n12 * n23 * n34; const det = n11 * t11 + n21 * t12 + n31 * t13 + n41 * t14; if (det === 0) return this.set(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0); const detInv = 1 / det; @@ -4544,12 +3990,11 @@ class Matrix4 { te[15] = (n12 * n23 * n31 - n13 * n22 * n31 + n13 * n21 * n32 - n11 * n23 * n32 - n12 * n21 * n33 + n11 * n22 * n33) * detInv; return this; } - scale(v) { const te = this.elements; const x = v.x, - y = v.y, - z = v.z; + y = v.y, + z = v.z; te[0] *= x; te[4] *= y; te[8] *= z; @@ -4564,7 +4009,6 @@ class Matrix4 { te[11] *= z; return this; } - getMaxScaleOnAxis() { const te = this.elements; const scaleXSq = te[0] * te[0] + te[1] * te[1] + te[2] * te[2]; @@ -4572,78 +4016,71 @@ class Matrix4 { const scaleZSq = te[8] * te[8] + te[9] * te[9] + te[10] * te[10]; return Math.sqrt(Math.max(scaleXSq, scaleYSq, scaleZSq)); } - makeTranslation(x, y, z) { this.set(1, 0, 0, x, 0, 1, 0, y, 0, 0, 1, z, 0, 0, 0, 1); return this; } - makeRotationX(theta) { const c = Math.cos(theta), - s = Math.sin(theta); + s = Math.sin(theta); this.set(1, 0, 0, 0, 0, c, -s, 0, 0, s, c, 0, 0, 0, 0, 1); return this; } - makeRotationY(theta) { const c = Math.cos(theta), - s = Math.sin(theta); + s = Math.sin(theta); this.set(c, 0, s, 0, 0, 1, 0, 0, -s, 0, c, 0, 0, 0, 0, 1); return this; } - makeRotationZ(theta) { const c = Math.cos(theta), - s = Math.sin(theta); + s = Math.sin(theta); this.set(c, -s, 0, 0, s, c, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1); return this; } - makeRotationAxis(axis, angle) { // Based on http://www.gamedev.net/reference/articles/article1199.asp + const c = Math.cos(angle); const s = Math.sin(angle); const t = 1 - c; const x = axis.x, - y = axis.y, - z = axis.z; + y = axis.y, + z = axis.z; const tx = t * x, - ty = t * y; + ty = t * y; this.set(tx * x + c, tx * y - s * z, tx * z + s * y, 0, tx * y + s * z, ty * y + c, ty * z - s * x, 0, tx * z - s * y, ty * z + s * x, t * z * z + c, 0, 0, 0, 0, 1); return this; } - makeScale(x, y, z) { this.set(x, 0, 0, 0, 0, y, 0, 0, 0, 0, z, 0, 0, 0, 0, 1); return this; } - makeShear(xy, xz, yx, yz, zx, zy) { this.set(1, yx, zx, 0, xy, 1, zy, 0, xz, yz, 1, 0, 0, 0, 0, 1); return this; } - compose(position, quaternion, scale) { const te = this.elements; const x = quaternion._x, - y = quaternion._y, - z = quaternion._z, - w = quaternion._w; + y = quaternion._y, + z = quaternion._z, + w = quaternion._w; const x2 = x + x, - y2 = y + y, - z2 = z + z; + y2 = y + y, + z2 = z + z; const xx = x * x2, - xy = x * y2, - xz = x * z2; + xy = x * y2, + xz = x * z2; const yy = y * y2, - yz = y * z2, - zz = z * z2; + yz = y * z2, + zz = z * z2; const wx = w * x2, - wy = w * y2, - wz = w * z2; + wy = w * y2, + wz = w * z2; const sx = scale.x, - sy = scale.y, - sz = scale.z; + sy = scale.y, + sz = scale.z; te[0] = (1 - (yy + zz)) * sx; te[1] = (xy + wz) * sx; te[2] = (xz - wy) * sx; @@ -4662,25 +4099,21 @@ class Matrix4 { te[15] = 1; return this; } - decompose(position, quaternion, scale) { const te = this.elements; - let sx = _v1$5.set(te[0], te[1], te[2]).length(); - const sy = _v1$5.set(te[4], te[5], te[6]).length(); + const sz = _v1$5.set(te[8], te[9], te[10]).length(); - const sz = _v1$5.set(te[8], te[9], te[10]).length(); // if determine is negative, we need to invert one scale - - + // if determine is negative, we need to invert one scale const det = this.determinant(); if (det < 0) sx = -sx; position.x = te[12]; position.y = te[13]; - position.z = te[14]; // scale the rotation part + position.z = te[14]; + // scale the rotation part _m1$2.copy(this); - const invSX = 1 / sx; const invSY = 1 / sy; const invSZ = 1 / sz; @@ -4699,12 +4132,10 @@ class Matrix4 { scale.z = sz; return this; } - makePerspective(left, right, top, bottom, near, far) { if (far === undefined) { console.warn('THREE.Matrix4: .makePerspective() has been redefined and has a new signature. Please check the docs.'); } - const te = this.elements; const x = 2 * near / (right - left); const y = 2 * near / (top - bottom); @@ -4730,7 +4161,6 @@ class Matrix4 { te[15] = 0; return this; } - makeOrthographic(left, right, top, bottom, near, far) { const te = this.elements; const w = 1.0 / (right - left); @@ -4757,26 +4187,20 @@ class Matrix4 { te[15] = 1; return this; } - equals(matrix) { const te = this.elements; const me = matrix.elements; - for (let i = 0; i < 16; i++) { if (te[i] !== me[i]) return false; } - return true; } - fromArray(array, offset = 0) { for (let i = 0; i < 16; i++) { this.elements[i] = array[i + offset]; } - return this; } - toArray(array = [], offset = 0) { const te = this.elements; array[offset] = te[0]; @@ -4797,29 +4221,18 @@ class Matrix4 { array[offset + 15] = te[15]; return array; } - } - Matrix4.prototype.isMatrix4 = true; - const _v1$5 = /*@__PURE__*/new Vector3(); - const _m1$2 = /*@__PURE__*/new Matrix4(); - const _zero = /*@__PURE__*/new Vector3(0, 0, 0); - const _one = /*@__PURE__*/new Vector3(1, 1, 1); - const _x = /*@__PURE__*/new Vector3(); - const _y = /*@__PURE__*/new Vector3(); - const _z = /*@__PURE__*/new Vector3(); const _matrix$1 = /*@__PURE__*/new Matrix4(); - const _quaternion$3 = /*@__PURE__*/new Quaternion(); - class Euler { constructor(x = 0, y = 0, z = 0, order = Euler.DefaultOrder) { this._x = x; @@ -4827,90 +4240,69 @@ class Euler { this._z = z; this._order = order; } - get x() { return this._x; } - set x(value) { this._x = value; - this._onChangeCallback(); } - get y() { return this._y; } - set y(value) { this._y = value; - this._onChangeCallback(); } - get z() { return this._z; } - set z(value) { this._z = value; - this._onChangeCallback(); } - get order() { return this._order; } - set order(value) { this._order = value; - this._onChangeCallback(); } - set(x, y, z, order = this._order) { this._x = x; this._y = y; this._z = z; this._order = order; - this._onChangeCallback(); - return this; } - clone() { return new this.constructor(this._x, this._y, this._z, this._order); } - copy(euler) { this._x = euler._x; this._y = euler._y; this._z = euler._z; this._order = euler._order; - this._onChangeCallback(); - return this; } - setFromRotationMatrix(m, order = this._order, update = true) { // assumes the upper 3x3 of m is a pure rotation matrix (i.e, unscaled) + const te = m.elements; const m11 = te[0], - m12 = te[4], - m13 = te[8]; + m12 = te[4], + m13 = te[8]; const m21 = te[1], - m22 = te[5], - m23 = te[9]; + m22 = te[5], + m23 = te[9]; const m31 = te[2], - m32 = te[6], - m33 = te[10]; - + m32 = te[6], + m33 = te[10]; switch (order) { case 'XYZ': this._y = Math.asin(clamp(m13, -1, 1)); - if (Math.abs(m13) < 0.9999999) { this._x = Math.atan2(-m23, m33); this._z = Math.atan2(-m12, m11); @@ -4918,12 +4310,9 @@ class Euler { this._x = Math.atan2(m32, m22); this._z = 0; } - break; - case 'YXZ': this._x = Math.asin(-clamp(m23, -1, 1)); - if (Math.abs(m23) < 0.9999999) { this._y = Math.atan2(m13, m33); this._z = Math.atan2(m21, m22); @@ -4931,12 +4320,9 @@ class Euler { this._y = Math.atan2(-m31, m11); this._z = 0; } - break; - case 'ZXY': this._x = Math.asin(clamp(m32, -1, 1)); - if (Math.abs(m32) < 0.9999999) { this._y = Math.atan2(-m31, m33); this._z = Math.atan2(-m12, m22); @@ -4944,12 +4330,9 @@ class Euler { this._y = 0; this._z = Math.atan2(m21, m11); } - break; - case 'ZYX': this._y = Math.asin(-clamp(m31, -1, 1)); - if (Math.abs(m31) < 0.9999999) { this._x = Math.atan2(m32, m33); this._z = Math.atan2(m21, m11); @@ -4957,12 +4340,9 @@ class Euler { this._x = 0; this._z = Math.atan2(-m12, m22); } - break; - case 'YZX': this._z = Math.asin(clamp(m21, -1, 1)); - if (Math.abs(m21) < 0.9999999) { this._x = Math.atan2(-m23, m22); this._y = Math.atan2(-m31, m11); @@ -4970,12 +4350,9 @@ class Euler { this._x = 0; this._y = Math.atan2(m13, m33); } - break; - case 'XZY': this._z = Math.asin(-clamp(m12, -1, 1)); - if (Math.abs(m12) < 0.9999999) { this._x = Math.atan2(m32, m22); this._y = Math.atan2(m13, m11); @@ -4983,50 +4360,38 @@ class Euler { this._x = Math.atan2(-m23, m33); this._y = 0; } - break; - default: console.warn('THREE.Euler: .setFromRotationMatrix() encountered an unknown order: ' + order); } - this._order = order; if (update === true) this._onChangeCallback(); return this; } - setFromQuaternion(q, order, update) { _matrix$1.makeRotationFromQuaternion(q); - return this.setFromRotationMatrix(_matrix$1, order, update); } - setFromVector3(v, order = this._order) { return this.set(v.x, v.y, v.z, order); } - reorder(newOrder) { // WARNING: this discards revolution information -bhouston - _quaternion$3.setFromEuler(this); + _quaternion$3.setFromEuler(this); return this.setFromQuaternion(_quaternion$3, newOrder); } - equals(euler) { return euler._x === this._x && euler._y === this._y && euler._z === this._z && euler._order === this._order; } - fromArray(array) { this._x = array[0]; this._y = array[1]; this._z = array[2]; if (array[3] !== undefined) this._order = array[3]; - this._onChangeCallback(); - return this; } - toArray(array = [], offset = 0) { array[offset] = this._x; array[offset + 1] = this._y; @@ -5034,7 +4399,6 @@ class Euler { array[offset + 3] = this._order; return array; } - toVector3(optionalResult) { if (optionalResult) { return optionalResult.set(this._x, this._y, this._z); @@ -5042,16 +4406,12 @@ class Euler { return new Vector3(this._x, this._y, this._z); } } - _onChange(callback) { this._onChangeCallback = callback; return this; } - _onChangeCallback() {} - } - Euler.prototype.isEuler = true; Euler.DefaultOrder = 'XYZ'; Euler.RotationOrders = ['XYZ', 'YZX', 'ZXY', 'XZY', 'YXZ', 'ZYX']; @@ -5060,70 +4420,49 @@ class Layers { constructor() { this.mask = 1 | 0; } - set(channel) { this.mask = (1 << channel | 0) >>> 0; } - enable(channel) { this.mask |= 1 << channel | 0; } - enableAll() { this.mask = 0xffffffff | 0; } - toggle(channel) { this.mask ^= 1 << channel | 0; } - disable(channel) { this.mask &= ~(1 << channel | 0); } - disableAll() { this.mask = 0; } - test(layers) { return (this.mask & layers.mask) !== 0; } - isEnabled(channel) { return (this.mask & (1 << channel | 0)) !== 0; } - } let _object3DId = 0; - const _v1$4 = /*@__PURE__*/new Vector3(); - const _q1 = /*@__PURE__*/new Quaternion(); - const _m1$1 = /*@__PURE__*/new Matrix4(); - const _target = /*@__PURE__*/new Vector3(); - const _position$3 = /*@__PURE__*/new Vector3(); - const _scale$2 = /*@__PURE__*/new Vector3(); - const _quaternion$2 = /*@__PURE__*/new Quaternion(); - const _xAxis = /*@__PURE__*/new Vector3(1, 0, 0); - const _yAxis = /*@__PURE__*/new Vector3(0, 1, 0); - const _zAxis = /*@__PURE__*/new Vector3(0, 0, 1); - const _addedEvent = { type: 'added' }; const _removedEvent = { type: 'removed' }; - class Object3D extends EventDispatcher { constructor() { super(); @@ -5140,19 +4479,14 @@ class Object3D extends EventDispatcher { const rotation = new Euler(); const quaternion = new Quaternion(); const scale = new Vector3(1, 1, 1); - function onRotationChange() { quaternion.setFromEuler(rotation, false); } - function onQuaternionChange() { rotation.setFromQuaternion(quaternion, undefined, false); } - rotation._onChange(onRotationChange); - quaternion._onChange(onQuaternionChange); - Object.defineProperties(this, { position: { configurable: true, @@ -5194,355 +4528,288 @@ class Object3D extends EventDispatcher { this.animations = []; this.userData = {}; } - - onBeforeRender() {} - - onAfterRender() {} - + onBeforeRender(/* renderer, scene, camera, geometry, material, group */) {} + onAfterRender(/* renderer, scene, camera, geometry, material, group */) {} applyMatrix4(matrix) { if (this.matrixAutoUpdate) this.updateMatrix(); this.matrix.premultiply(matrix); this.matrix.decompose(this.position, this.quaternion, this.scale); } - applyQuaternion(q) { this.quaternion.premultiply(q); return this; } - setRotationFromAxisAngle(axis, angle) { // assumes axis is normalized + this.quaternion.setFromAxisAngle(axis, angle); } - setRotationFromEuler(euler) { this.quaternion.setFromEuler(euler, true); } - setRotationFromMatrix(m) { // assumes the upper 3x3 of m is a pure rotation matrix (i.e, unscaled) + this.quaternion.setFromRotationMatrix(m); } - setRotationFromQuaternion(q) { // assumes q is normalized + this.quaternion.copy(q); } - rotateOnAxis(axis, angle) { // rotate object on axis in object space // axis is assumed to be normalized - _q1.setFromAxisAngle(axis, angle); + _q1.setFromAxisAngle(axis, angle); this.quaternion.multiply(_q1); return this; } - rotateOnWorldAxis(axis, angle) { // rotate object on axis in world space // axis is assumed to be normalized // method assumes no rotated parent - _q1.setFromAxisAngle(axis, angle); + _q1.setFromAxisAngle(axis, angle); this.quaternion.premultiply(_q1); return this; } - rotateX(angle) { return this.rotateOnAxis(_xAxis, angle); } - rotateY(angle) { return this.rotateOnAxis(_yAxis, angle); } - rotateZ(angle) { return this.rotateOnAxis(_zAxis, angle); } - translateOnAxis(axis, distance) { // translate object by distance along axis in object space // axis is assumed to be normalized - _v1$4.copy(axis).applyQuaternion(this.quaternion); + _v1$4.copy(axis).applyQuaternion(this.quaternion); this.position.add(_v1$4.multiplyScalar(distance)); return this; } - translateX(distance) { return this.translateOnAxis(_xAxis, distance); } - translateY(distance) { return this.translateOnAxis(_yAxis, distance); } - translateZ(distance) { return this.translateOnAxis(_zAxis, distance); } - localToWorld(vector) { return vector.applyMatrix4(this.matrixWorld); } - worldToLocal(vector) { return vector.applyMatrix4(_m1$1.copy(this.matrixWorld).invert()); } - lookAt(x, y, z) { // This method does not support objects having non-uniformly-scaled parent(s) + if (x.isVector3) { _target.copy(x); } else { _target.set(x, y, z); } - const parent = this.parent; this.updateWorldMatrix(true, false); - _position$3.setFromMatrixPosition(this.matrixWorld); - if (this.isCamera || this.isLight) { _m1$1.lookAt(_position$3, _target, this.up); } else { _m1$1.lookAt(_target, _position$3, this.up); } - this.quaternion.setFromRotationMatrix(_m1$1); - if (parent) { _m1$1.extractRotation(parent.matrixWorld); - _q1.setFromRotationMatrix(_m1$1); - this.quaternion.premultiply(_q1.invert()); } } - add(object) { if (arguments.length > 1) { for (let i = 0; i < arguments.length; i++) { this.add(arguments[i]); } - return this; } - if (object === this) { console.error('THREE.Object3D.add: object can\'t be added as a child of itself.', object); return this; } - if (object && object.isObject3D) { if (object.parent !== null) { object.parent.remove(object); } - object.parent = this; this.children.push(object); object.dispatchEvent(_addedEvent); } else { console.error('THREE.Object3D.add: object not an instance of THREE.Object3D.', object); } - return this; } - remove(object) { if (arguments.length > 1) { for (let i = 0; i < arguments.length; i++) { this.remove(arguments[i]); } - return this; } - const index = this.children.indexOf(object); - if (index !== -1) { object.parent = null; this.children.splice(index, 1); object.dispatchEvent(_removedEvent); } - return this; } - removeFromParent() { const parent = this.parent; - if (parent !== null) { parent.remove(this); } - return this; } - clear() { for (let i = 0; i < this.children.length; i++) { const object = this.children[i]; object.parent = null; object.dispatchEvent(_removedEvent); } - this.children.length = 0; return this; } - attach(object) { // adds object as a child of this, while maintaining the object's world transform + // Note: This method does not support scene graphs having non-uniformly-scaled nodes(s) - this.updateWorldMatrix(true, false); + this.updateWorldMatrix(true, false); _m1$1.copy(this.matrixWorld).invert(); - if (object.parent !== null) { object.parent.updateWorldMatrix(true, false); - _m1$1.multiply(object.parent.matrixWorld); } - object.applyMatrix4(_m1$1); this.add(object); object.updateWorldMatrix(false, true); return this; } - getObjectById(id) { return this.getObjectByProperty('id', id); } - getObjectByName(name) { return this.getObjectByProperty('name', name); } - getObjectByProperty(name, value) { if (this[name] === value) return this; - for (let i = 0, l = this.children.length; i < l; i++) { const child = this.children[i]; const object = child.getObjectByProperty(name, value); - if (object !== undefined) { return object; } } - return undefined; } - getWorldPosition(target) { this.updateWorldMatrix(true, false); return target.setFromMatrixPosition(this.matrixWorld); } - getWorldQuaternion(target) { this.updateWorldMatrix(true, false); this.matrixWorld.decompose(_position$3, target, _scale$2); return target; } - getWorldScale(target) { this.updateWorldMatrix(true, false); this.matrixWorld.decompose(_position$3, _quaternion$2, target); return target; } - getWorldDirection(target) { this.updateWorldMatrix(true, false); const e = this.matrixWorld.elements; return target.set(e[8], e[9], e[10]).normalize(); } - - raycast() {} - + raycast(/* raycaster, intersects */) {} traverse(callback) { callback(this); const children = this.children; - for (let i = 0, l = children.length; i < l; i++) { children[i].traverse(callback); } } - traverseVisible(callback) { if (this.visible === false) return; callback(this); const children = this.children; - for (let i = 0, l = children.length; i < l; i++) { children[i].traverseVisible(callback); } } - traverseAncestors(callback) { const parent = this.parent; - if (parent !== null) { callback(parent); parent.traverseAncestors(callback); } } - updateMatrix() { this.matrix.compose(this.position, this.quaternion, this.scale); this.matrixWorldNeedsUpdate = true; } - updateMatrixWorld(force) { if (this.matrixAutoUpdate) this.updateMatrix(); - if (this.matrixWorldNeedsUpdate || force) { if (this.parent === null) { this.matrixWorld.copy(this.matrix); } else { this.matrixWorld.multiplyMatrices(this.parent.matrixWorld, this.matrix); } - this.matrixWorldNeedsUpdate = false; force = true; - } // update children + } + // update children const children = this.children; - for (let i = 0, l = children.length; i < l; i++) { children[i].updateMatrixWorld(force); } } - updateWorldMatrix(updateParents, updateChildren) { const parent = this.parent; - if (updateParents === true && parent !== null) { parent.updateWorldMatrix(true, false); } - if (this.matrixAutoUpdate) this.updateMatrix(); - if (this.parent === null) { this.matrixWorld.copy(this.matrix); } else { this.matrixWorld.multiplyMatrices(this.parent.matrixWorld, this.matrix); - } // update children + } + // update children if (updateChildren === true) { const children = this.children; - for (let i = 0, l = children.length; i < l; i++) { children[i].updateWorldMatrix(false, true); } } } - toJSON(meta) { // meta is a string when called from JSON.stringify const isRootObject = meta === undefined || typeof meta === 'string'; - const output = {}; // meta is a hash used to collect geometries, materials. + const output = {}; + + // meta is a hash used to collect geometries, materials. // not providing it implies that this is the root object // being serialized. - if (isRootObject) { // initialize meta obj meta = { @@ -5559,8 +4826,9 @@ class Object3D extends EventDispatcher { type: 'Object', generator: 'Object3D.toJSON' }; - } // standard Object3D serialization + } + // standard Object3D serialization const object = {}; object.uuid = this.uuid; @@ -5574,24 +4842,25 @@ class Object3D extends EventDispatcher { if (JSON.stringify(this.userData) !== '{}') object.userData = this.userData; object.layers = this.layers.mask; object.matrix = this.matrix.toArray(); - if (this.matrixAutoUpdate === false) object.matrixAutoUpdate = false; // object specific properties + if (this.matrixAutoUpdate === false) object.matrixAutoUpdate = false; + + // object specific properties if (this.isInstancedMesh) { object.type = 'InstancedMesh'; object.count = this.count; object.instanceMatrix = this.instanceMatrix.toJSON(); if (this.instanceColor !== null) object.instanceColor = this.instanceColor.toJSON(); - } // + } + // function serialize(library, element) { if (library[element.uuid] === undefined) { library[element.uuid] = element.toJSON(meta); } - return element.uuid; } - if (this.isScene) { if (this.background) { if (this.background.isColor) { @@ -5600,17 +4869,14 @@ class Object3D extends EventDispatcher { object.background = this.background.toJSON(meta).uuid; } } - if (this.environment && this.environment.isTexture) { object.environment = this.environment.toJSON(meta).uuid; } } else if (this.isMesh || this.isLine || this.isPoints) { object.geometry = serialize(meta.geometries, this.geometry); const parameters = this.geometry.parameters; - if (parameters !== undefined && parameters.shapes !== undefined) { const shapes = parameters.shapes; - if (Array.isArray(shapes)) { for (let i = 0, l = shapes.length; i < l; i++) { const shape = shapes[i]; @@ -5621,50 +4887,44 @@ class Object3D extends EventDispatcher { } } } - if (this.isSkinnedMesh) { object.bindMode = this.bindMode; object.bindMatrix = this.bindMatrix.toArray(); - if (this.skeleton !== undefined) { serialize(meta.skeletons, this.skeleton); object.skeleton = this.skeleton.uuid; } } - if (this.material !== undefined) { if (Array.isArray(this.material)) { const uuids = []; - for (let i = 0, l = this.material.length; i < l; i++) { uuids.push(serialize(meta.materials, this.material[i])); } - object.material = uuids; } else { object.material = serialize(meta.materials, this.material); } - } // + } + // if (this.children.length > 0) { object.children = []; - for (let i = 0; i < this.children.length; i++) { object.children.push(this.children[i].toJSON(meta).object); } - } // + } + // if (this.animations.length > 0) { object.animations = []; - for (let i = 0; i < this.animations.length; i++) { const animation = this.animations[i]; object.animations.push(serialize(meta.animations, animation)); } } - if (isRootObject) { const geometries = extractFromCache(meta.geometries); const materials = extractFromCache(meta.materials); @@ -5681,29 +4941,25 @@ class Object3D extends EventDispatcher { if (skeletons.length > 0) output.skeletons = skeletons; if (animations.length > 0) output.animations = animations; } - output.object = object; - return output; // extract data from the cache hash + return output; + + // extract data from the cache hash // remove metadata on each item // and return as array - function extractFromCache(cache) { const values = []; - for (const key in cache) { const data = cache[key]; delete data.metadata; values.push(data); } - return values; } } - clone(recursive) { return new this.constructor().copy(this, recursive); } - copy(source, recursive = true) { this.name = source.name; this.up.copy(source.up); @@ -5722,104 +4978,76 @@ class Object3D extends EventDispatcher { this.frustumCulled = source.frustumCulled; this.renderOrder = source.renderOrder; this.userData = JSON.parse(JSON.stringify(source.userData)); - if (recursive === true) { for (let i = 0; i < source.children.length; i++) { const child = source.children[i]; this.add(child.clone()); } } - return this; } - } - Object3D.DefaultUp = new Vector3(0, 1, 0); Object3D.DefaultMatrixAutoUpdate = true; Object3D.prototype.isObject3D = true; const _v0$1 = /*@__PURE__*/new Vector3(); - const _v1$3 = /*@__PURE__*/new Vector3(); - const _v2$2 = /*@__PURE__*/new Vector3(); - const _v3$1 = /*@__PURE__*/new Vector3(); - const _vab = /*@__PURE__*/new Vector3(); - const _vac = /*@__PURE__*/new Vector3(); - const _vbc = /*@__PURE__*/new Vector3(); - const _vap = /*@__PURE__*/new Vector3(); - const _vbp = /*@__PURE__*/new Vector3(); - const _vcp = /*@__PURE__*/new Vector3(); - class Triangle { constructor(a = new Vector3(), b = new Vector3(), c = new Vector3()) { this.a = a; this.b = b; this.c = c; } - static getNormal(a, b, c, target) { target.subVectors(c, b); - _v0$1.subVectors(a, b); - target.cross(_v0$1); const targetLengthSq = target.lengthSq(); - if (targetLengthSq > 0) { return target.multiplyScalar(1 / Math.sqrt(targetLengthSq)); } - return target.set(0, 0, 0); - } // static/instance method to calculate barycentric coordinates - // based on: http://www.blackpawn.com/texts/pointinpoly/default.html - + } + // static/instance method to calculate barycentric coordinates + // based on: http://www.blackpawn.com/texts/pointinpoly/default.html static getBarycoord(point, a, b, c, target) { _v0$1.subVectors(c, a); - _v1$3.subVectors(b, a); - _v2$2.subVectors(point, a); - const dot00 = _v0$1.dot(_v0$1); - const dot01 = _v0$1.dot(_v1$3); - const dot02 = _v0$1.dot(_v2$2); - const dot11 = _v1$3.dot(_v1$3); - const dot12 = _v1$3.dot(_v2$2); + const denom = dot00 * dot11 - dot01 * dot01; - const denom = dot00 * dot11 - dot01 * dot01; // collinear or singular triangle - + // collinear or singular triangle if (denom === 0) { // arbitrary location outside of triangle? // not sure if this is the best idea, maybe should be returning undefined return target.set(-2, -1, -1); } - const invDenom = 1 / denom; const u = (dot11 * dot02 - dot01 * dot12) * invDenom; - const v = (dot00 * dot12 - dot01 * dot02) * invDenom; // barycentric coordinates must always sum to 1 + const v = (dot00 * dot12 - dot01 * dot02) * invDenom; + // barycentric coordinates must always sum to 1 return target.set(1 - u - v, v, u); } - static containsPoint(point, a, b, c) { this.getBarycoord(point, a, b, c, _v3$1); return _v3$1.x >= 0 && _v3$1.y >= 0 && _v3$1.x + _v3$1.y <= 1; } - static getUV(point, p1, p2, p3, uv1, uv2, uv3, target) { this.getBarycoord(point, p1, p2, p3, _v3$1); target.set(0, 0); @@ -5828,177 +5056,137 @@ class Triangle { target.addScaledVector(uv3, _v3$1.z); return target; } - static isFrontFacing(a, b, c, direction) { _v0$1.subVectors(c, b); + _v1$3.subVectors(a, b); - _v1$3.subVectors(a, b); // strictly front facing - - + // strictly front facing return _v0$1.cross(_v1$3).dot(direction) < 0 ? true : false; } - set(a, b, c) { this.a.copy(a); this.b.copy(b); this.c.copy(c); return this; } - setFromPointsAndIndices(points, i0, i1, i2) { this.a.copy(points[i0]); this.b.copy(points[i1]); this.c.copy(points[i2]); return this; } - setFromAttributeAndIndices(attribute, i0, i1, i2) { this.a.fromBufferAttribute(attribute, i0); this.b.fromBufferAttribute(attribute, i1); this.c.fromBufferAttribute(attribute, i2); return this; } - clone() { return new this.constructor().copy(this); } - copy(triangle) { this.a.copy(triangle.a); this.b.copy(triangle.b); this.c.copy(triangle.c); return this; } - getArea() { _v0$1.subVectors(this.c, this.b); - _v1$3.subVectors(this.a, this.b); - return _v0$1.cross(_v1$3).length() * 0.5; } - getMidpoint(target) { return target.addVectors(this.a, this.b).add(this.c).multiplyScalar(1 / 3); } - getNormal(target) { return Triangle.getNormal(this.a, this.b, this.c, target); } - getPlane(target) { return target.setFromCoplanarPoints(this.a, this.b, this.c); } - getBarycoord(point, target) { return Triangle.getBarycoord(point, this.a, this.b, this.c, target); } - getUV(point, uv1, uv2, uv3, target) { return Triangle.getUV(point, this.a, this.b, this.c, uv1, uv2, uv3, target); } - containsPoint(point) { return Triangle.containsPoint(point, this.a, this.b, this.c); } - isFrontFacing(direction) { return Triangle.isFrontFacing(this.a, this.b, this.c, direction); } - intersectsBox(box) { return box.intersectsTriangle(this); } - closestPointToPoint(p, target) { const a = this.a, - b = this.b, - c = this.c; - let v, w; // algorithm thanks to Real-Time Collision Detection by Christer Ericson, + b = this.b, + c = this.c; + let v, w; + + // algorithm thanks to Real-Time Collision Detection by Christer Ericson, // published by Morgan Kaufmann Publishers, (c) 2005 Elsevier Inc., // under the accompanying license; see chapter 5.1.5 for detailed explanation. // basically, we're distinguishing which of the voronoi regions of the triangle // the point lies in with the minimum amount of redundant computation. _vab.subVectors(b, a); - _vac.subVectors(c, a); - _vap.subVectors(p, a); - const d1 = _vab.dot(_vap); - const d2 = _vac.dot(_vap); - if (d1 <= 0 && d2 <= 0) { // vertex region of A; barycentric coords (1, 0, 0) return target.copy(a); } - _vbp.subVectors(p, b); - const d3 = _vab.dot(_vbp); - const d4 = _vac.dot(_vbp); - if (d3 >= 0 && d4 <= d3) { // vertex region of B; barycentric coords (0, 1, 0) return target.copy(b); } - const vc = d1 * d4 - d3 * d2; - if (vc <= 0 && d1 >= 0 && d3 <= 0) { - v = d1 / (d1 - d3); // edge region of AB; barycentric coords (1-v, v, 0) - + v = d1 / (d1 - d3); + // edge region of AB; barycentric coords (1-v, v, 0) return target.copy(a).addScaledVector(_vab, v); } - _vcp.subVectors(p, c); - const d5 = _vab.dot(_vcp); - const d6 = _vac.dot(_vcp); - if (d6 >= 0 && d5 <= d6) { // vertex region of C; barycentric coords (0, 0, 1) return target.copy(c); } - const vb = d5 * d2 - d1 * d6; - if (vb <= 0 && d2 >= 0 && d6 <= 0) { - w = d2 / (d2 - d6); // edge region of AC; barycentric coords (1-w, 0, w) - + w = d2 / (d2 - d6); + // edge region of AC; barycentric coords (1-w, 0, w) return target.copy(a).addScaledVector(_vac, w); } - const va = d3 * d6 - d5 * d4; - if (va <= 0 && d4 - d3 >= 0 && d5 - d6 >= 0) { _vbc.subVectors(c, b); - - w = (d4 - d3) / (d4 - d3 + (d5 - d6)); // edge region of BC; barycentric coords (0, 1-w, w) - + w = (d4 - d3) / (d4 - d3 + (d5 - d6)); + // edge region of BC; barycentric coords (0, 1-w, w) return target.copy(b).addScaledVector(_vbc, w); // edge region of BC - } // face region - - - const denom = 1 / (va + vb + vc); // u = va * denom + } + // face region + const denom = 1 / (va + vb + vc); + // u = va * denom v = vb * denom; w = vc * denom; return target.copy(a).addScaledVector(_vab, v).addScaledVector(_vac, w); } - equals(triangle) { return triangle.a.equals(this.a) && triangle.b.equals(this.b) && triangle.c.equals(this.c); } - } let materialId = 0; - class Material extends EventDispatcher { constructor() { super(); @@ -6050,54 +5238,41 @@ class Material extends EventDispatcher { this.version = 0; this._alphaTest = 0; } - get alphaTest() { return this._alphaTest; } - set alphaTest(value) { if (this._alphaTest > 0 !== value > 0) { this.version++; } - this._alphaTest = value; } - - onBuild() {} - - onBeforeRender() {} - - onBeforeCompile() {} - + onBuild(/* shaderobject, renderer */) {} + onBeforeRender(/* renderer, scene, camera, geometry, object, group */) {} + onBeforeCompile(/* shaderobject, renderer */) {} customProgramCacheKey() { return this.onBeforeCompile.toString(); } - setValues(values) { if (values === undefined) return; - for (const key in values) { const newValue = values[key]; - if (newValue === undefined) { console.warn('THREE.Material: \'' + key + '\' parameter is undefined.'); continue; - } // for backward compatability if shading is set in the constructor - + } + // for backward compatability if shading is set in the constructor if (key === 'shading') { console.warn('THREE.' + this.type + ': .shading has been removed. Use the boolean .flatShading instead.'); this.flatShading = newValue === FlatShading ? true : false; continue; } - const currentValue = this[key]; - if (currentValue === undefined) { console.warn('THREE.' + this.type + ': \'' + key + '\' is not a property of this material.'); continue; } - if (currentValue && currentValue.isColor) { currentValue.set(newValue); } else if (currentValue && currentValue.isVector3 && newValue && newValue.isVector3) { @@ -6107,25 +5282,23 @@ class Material extends EventDispatcher { } } } - toJSON(meta) { const isRoot = meta === undefined || typeof meta === 'string'; - if (isRoot) { meta = { textures: {}, images: {} }; } - const data = { metadata: { version: 4.5, type: 'Material', generator: 'Material.toJSON' } - }; // standard Material serialization + }; + // standard Material serialization data.uuid = this.uuid; data.type = this.type; if (this.name !== '') data.name = this.name; @@ -6143,71 +5316,57 @@ class Material extends EventDispatcher { if (this.shininess !== undefined) data.shininess = this.shininess; if (this.clearcoat !== undefined) data.clearcoat = this.clearcoat; if (this.clearcoatRoughness !== undefined) data.clearcoatRoughness = this.clearcoatRoughness; - if (this.clearcoatMap && this.clearcoatMap.isTexture) { data.clearcoatMap = this.clearcoatMap.toJSON(meta).uuid; } - if (this.clearcoatRoughnessMap && this.clearcoatRoughnessMap.isTexture) { data.clearcoatRoughnessMap = this.clearcoatRoughnessMap.toJSON(meta).uuid; } - if (this.clearcoatNormalMap && this.clearcoatNormalMap.isTexture) { data.clearcoatNormalMap = this.clearcoatNormalMap.toJSON(meta).uuid; data.clearcoatNormalScale = this.clearcoatNormalScale.toArray(); } - if (this.map && this.map.isTexture) data.map = this.map.toJSON(meta).uuid; if (this.matcap && this.matcap.isTexture) data.matcap = this.matcap.toJSON(meta).uuid; if (this.alphaMap && this.alphaMap.isTexture) data.alphaMap = this.alphaMap.toJSON(meta).uuid; - if (this.lightMap && this.lightMap.isTexture) { data.lightMap = this.lightMap.toJSON(meta).uuid; data.lightMapIntensity = this.lightMapIntensity; } - if (this.aoMap && this.aoMap.isTexture) { data.aoMap = this.aoMap.toJSON(meta).uuid; data.aoMapIntensity = this.aoMapIntensity; } - if (this.bumpMap && this.bumpMap.isTexture) { data.bumpMap = this.bumpMap.toJSON(meta).uuid; data.bumpScale = this.bumpScale; } - if (this.normalMap && this.normalMap.isTexture) { data.normalMap = this.normalMap.toJSON(meta).uuid; data.normalMapType = this.normalMapType; data.normalScale = this.normalScale.toArray(); } - if (this.displacementMap && this.displacementMap.isTexture) { data.displacementMap = this.displacementMap.toJSON(meta).uuid; data.displacementScale = this.displacementScale; data.displacementBias = this.displacementBias; } - if (this.roughnessMap && this.roughnessMap.isTexture) data.roughnessMap = this.roughnessMap.toJSON(meta).uuid; if (this.metalnessMap && this.metalnessMap.isTexture) data.metalnessMap = this.metalnessMap.toJSON(meta).uuid; if (this.emissiveMap && this.emissiveMap.isTexture) data.emissiveMap = this.emissiveMap.toJSON(meta).uuid; if (this.specularMap && this.specularMap.isTexture) data.specularMap = this.specularMap.toJSON(meta).uuid; if (this.specularIntensityMap && this.specularIntensityMap.isTexture) data.specularIntensityMap = this.specularIntensityMap.toJSON(meta).uuid; if (this.specularColorMap && this.specularColorMap.isTexture) data.specularColorMap = this.specularColorMap.toJSON(meta).uuid; - if (this.envMap && this.envMap.isTexture) { data.envMap = this.envMap.toJSON(meta).uuid; if (this.combine !== undefined) data.combine = this.combine; } - if (this.envMapIntensity !== undefined) data.envMapIntensity = this.envMapIntensity; if (this.reflectivity !== undefined) data.reflectivity = this.reflectivity; if (this.refractionRatio !== undefined) data.refractionRatio = this.refractionRatio; - if (this.gradientMap && this.gradientMap.isTexture) { data.gradientMap = this.gradientMap.toJSON(meta).uuid; } - if (this.transmission !== undefined) data.transmission = this.transmission; if (this.transmissionMap && this.transmissionMap.isTexture) data.transmissionMap = this.transmissionMap.toJSON(meta).uuid; if (this.thickness !== undefined) data.thickness = this.thickness; @@ -6233,8 +5392,9 @@ class Material extends EventDispatcher { data.stencilFuncMask = this.stencilFuncMask; data.stencilFail = this.stencilFail; data.stencilZFail = this.stencilZFail; - data.stencilZPass = this.stencilZPass; // rotation (SpriteMaterial) + data.stencilZPass = this.stencilZPass; + // rotation (SpriteMaterial) if (this.rotation && this.rotation !== 0) data.rotation = this.rotation; if (this.polygonOffset === true) data.polygonOffset = true; if (this.polygonOffsetFactor !== 0) data.polygonOffsetFactor = this.polygonOffsetFactor; @@ -6254,34 +5414,30 @@ class Material extends EventDispatcher { if (this.flatShading === true) data.flatShading = this.flatShading; if (this.visible === false) data.visible = false; if (this.toneMapped === false) data.toneMapped = false; - if (JSON.stringify(this.userData) !== '{}') data.userData = this.userData; // TODO: Copied from Object3D.toJSON + if (JSON.stringify(this.userData) !== '{}') data.userData = this.userData; + + // TODO: Copied from Object3D.toJSON function extractFromCache(cache) { const values = []; - for (const key in cache) { const data = cache[key]; delete data.metadata; values.push(data); } - return values; } - if (isRoot) { const textures = extractFromCache(meta.textures); const images = extractFromCache(meta.images); if (textures.length > 0) data.textures = textures; if (images.length > 0) data.images = images; } - return data; } - clone() { return new this.constructor().copy(this); } - copy(source) { this.name = source.name; this.fog = source.fog; @@ -6309,16 +5465,13 @@ class Material extends EventDispatcher { this.stencilWrite = source.stencilWrite; const srcPlanes = source.clippingPlanes; let dstPlanes = null; - if (srcPlanes !== null) { const n = srcPlanes.length; dstPlanes = new Array(n); - for (let i = 0; i !== n; ++i) { dstPlanes[i] = srcPlanes[i].clone(); } } - this.clippingPlanes = dstPlanes; this.clipIntersection = source.clipIntersection; this.clipShadows = source.clipShadows; @@ -6337,19 +5490,15 @@ class Material extends EventDispatcher { this.userData = JSON.parse(JSON.stringify(source.userData)); return this; } - dispose() { this.dispatchEvent({ type: 'dispose' }); } - set needsUpdate(value) { if (value === true) this.version++; } - } - Material.r115Compatible = false; Material.prototype.isMaterial = true; @@ -6513,7 +5662,6 @@ const _hslB = { s: 0, l: 0 }; - function hue2rgb(p, q, t) { if (t < 0) t += 1; if (t > 1) t -= 1; @@ -6522,25 +5670,20 @@ function hue2rgb(p, q, t) { if (t < 2 / 3) return p + (q - p) * 6 * (2 / 3 - t); return p; } - function SRGBToLinear(c) { return c < 0.04045 ? c * 0.0773993808 : Math.pow(c * 0.9478672986 + 0.0521327014, 2.4); } - function LinearToSRGB(c) { return c < 0.0031308 ? c * 12.92 : 1.055 * Math.pow(c, 0.41666) - 0.055; } - class Color { constructor(r, g, b) { if (g === undefined && b === undefined) { // r is THREE.Color, hex or string return this.set(r); } - return this.setRGB(r, g, b); } - set(value) { if (value && value.isColor) { this.copy(value); @@ -6549,17 +5692,14 @@ class Color { } else if (typeof value === 'string') { this.setStyle(value); } - return this; } - setScalar(scalar) { this.r = scalar; this.g = scalar; this.b = scalar; return this; } - setHex(hex) { hex = Math.floor(hex); this.r = (hex >> 16 & 255) / 255; @@ -6567,20 +5707,17 @@ class Color { this.b = (hex & 255) / 255; return this; } - setRGB(r, g, b) { this.r = r; this.g = g; this.b = b; return this; } - setHSL(h, s, l) { // h,s,l ranges are in 0.0 - 1.0 h = euclideanModulo(h, 1); s = clamp(s, 0, 1); l = clamp(l, 0, 1); - if (s === 0) { this.r = this.g = this.b = l; } else { @@ -6590,27 +5727,22 @@ class Color { this.g = hue2rgb(q, p, h); this.b = hue2rgb(q, p, h - 1 / 3); } - return this; } - setStyle(style) { function handleAlpha(string) { if (string === undefined) return; - if (parseFloat(string) < 1) { console.warn('THREE.Color: Alpha component of ' + style + ' will be ignored.'); } } - let m; - if (m = /^((?:rgb|hsl)a?)\(([^\)]*)\)/.exec(style)) { // rgb / hsl + let color; const name = m[1]; const components = m[2]; - switch (name) { case 'rgb': case 'rgba': @@ -6622,7 +5754,6 @@ class Color { handleAlpha(color[4]); return this; } - if (color = /^\s*(\d+)\%\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(components)) { // rgb(100%,0%,0%) rgba(100%,0%,0%,0.5) this.r = Math.min(100, parseInt(color[1], 10)) / 100; @@ -6631,9 +5762,7 @@ class Color { handleAlpha(color[4]); return this; } - break; - case 'hsl': case 'hsla': if (color = /^\s*(\d*\.?\d+)\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(components)) { @@ -6644,14 +5773,13 @@ class Color { handleAlpha(color[4]); return this.setHSL(h, s, l); } - break; } } else if (m = /^\#([A-Fa-f\d]+)$/.exec(style)) { // hex color + const hex = m[1]; const size = hex.length; - if (size === 3) { // #ff0 this.r = parseInt(hex.charAt(0) + hex.charAt(0), 16) / 255; @@ -6666,18 +5794,14 @@ class Color { return this; } } - if (style && style.length > 0) { return this.setColorName(style); } - return this; } - setColorName(style) { // color keywords const hex = _colorKeywords[style.toLowerCase()]; - if (hex !== undefined) { // red this.setHex(hex); @@ -6685,97 +5809,80 @@ class Color { // unknown color console.warn('THREE.Color: Unknown color ' + style); } - return this; } - clone() { return new this.constructor(this.r, this.g, this.b); } - copy(color) { this.r = color.r; this.g = color.g; this.b = color.b; return this; } - copySRGBToLinear(color) { this.r = SRGBToLinear(color.r); this.g = SRGBToLinear(color.g); this.b = SRGBToLinear(color.b); return this; } - copyLinearToSRGB(color) { this.r = LinearToSRGB(color.r); this.g = LinearToSRGB(color.g); this.b = LinearToSRGB(color.b); return this; } - convertSRGBToLinear() { this.copySRGBToLinear(this); return this; } - convertLinearToSRGB() { this.copyLinearToSRGB(this); return this; } - getHex() { return this.r * 255 << 16 ^ this.g * 255 << 8 ^ this.b * 255 << 0; } - getHexString() { return ('000000' + this.getHex().toString(16)).slice(-6); } - getHSL(target) { // h,s,l ranges are in 0.0 - 1.0 + const r = this.r, - g = this.g, - b = this.b; + g = this.g, + b = this.b; const max = Math.max(r, g, b); const min = Math.min(r, g, b); let hue, saturation; const lightness = (min + max) / 2.0; - if (min === max) { hue = 0; saturation = 0; } else { const delta = max - min; saturation = lightness <= 0.5 ? delta / (max + min) : delta / (2 - max - min); - switch (max) { case r: hue = (g - b) / delta + (g < b ? 6 : 0); break; - case g: hue = (b - r) / delta + 2; break; - case b: hue = (r - g) / delta + 4; break; } - hue /= 6; } - target.h = hue; target.s = saturation; target.l = lightness; return target; } - getStyle() { return 'rgb(' + (this.r * 255 | 0) + ',' + (this.g * 255 | 0) + ',' + (this.b * 255 | 0) + ')'; } - offsetHSL(h, s, l) { this.getHSL(_hslA); _hslA.h += h; @@ -6784,63 +5891,54 @@ class Color { this.setHSL(_hslA.h, _hslA.s, _hslA.l); return this; } - add(color) { this.r += color.r; this.g += color.g; this.b += color.b; return this; } - addColors(color1, color2) { this.r = color1.r + color2.r; this.g = color1.g + color2.g; this.b = color1.b + color2.b; return this; } - addScalar(s) { this.r += s; this.g += s; this.b += s; return this; } - sub(color) { this.r = Math.max(0, this.r - color.r); this.g = Math.max(0, this.g - color.g); this.b = Math.max(0, this.b - color.b); return this; } - multiply(color) { this.r *= color.r; this.g *= color.g; this.b *= color.b; return this; } - multiplyScalar(s) { this.r *= s; this.g *= s; this.b *= s; return this; } - lerp(color, alpha) { this.r += (color.r - this.r) * alpha; this.g += (color.g - this.g) * alpha; this.b += (color.b - this.b) * alpha; return this; } - lerpColors(color1, color2, alpha) { this.r = color1.r + (color2.r - color1.r) * alpha; this.g = color1.g + (color2.g - color1.g) * alpha; this.b = color1.b + (color2.b - color1.b) * alpha; return this; } - lerpHSL(color, alpha) { this.getHSL(_hslA); color.getHSL(_hslB); @@ -6850,46 +5948,38 @@ class Color { this.setHSL(h, s, l); return this; } - equals(c) { return c.r === this.r && c.g === this.g && c.b === this.b; } - fromArray(array, offset = 0) { this.r = array[offset]; this.g = array[offset + 1]; this.b = array[offset + 2]; return this; } - toArray(array = [], offset = 0) { array[offset] = this.r; array[offset + 1] = this.g; array[offset + 2] = this.b; return array; } - fromBufferAttribute(attribute, index) { this.r = attribute.getX(index); this.g = attribute.getY(index); this.b = attribute.getZ(index); - if (attribute.normalized === true) { // assuming Uint8Array + this.r /= 255; this.g /= 255; this.b /= 255; } - return this; } - toJSON() { return this.getHex(); } - } - Color.NAMES = _colorKeywords; Color.prototype.isColor = true; Color.prototype.r = 1; @@ -6948,7 +6038,6 @@ class MeshBasicMaterial extends Material { this.wireframeLinejoin = 'round'; this.setValues(parameters); } - copy(source) { super.copy(source); this.color.copy(source.color); @@ -6969,21 +6058,16 @@ class MeshBasicMaterial extends Material { this.wireframeLinejoin = source.wireframeLinejoin; return this; } - } - MeshBasicMaterial.prototype.isMeshBasicMaterial = true; const _vector$9 = /*@__PURE__*/new Vector3(); - const _vector2$1 = /*@__PURE__*/new Vector2(); - class BufferAttribute { constructor(array, itemSize, normalized) { if (Array.isArray(array)) { throw new TypeError('THREE.BufferAttribute: array should be a Typed Array.'); } - this.name = ''; this.array = array; this.itemSize = itemSize; @@ -6996,18 +6080,14 @@ class BufferAttribute { }; this.version = 0; } - onUploadCallback() {} - set needsUpdate(value) { if (value === true) this.version++; } - setUsage(value) { this.usage = value; return this; } - copy(source) { this.name = source.name; this.array = new source.array.constructor(source.array); @@ -7017,215 +6097,162 @@ class BufferAttribute { this.usage = source.usage; return this; } - copyAt(index1, attribute, index2) { index1 *= this.itemSize; index2 *= attribute.itemSize; - for (let i = 0, l = this.itemSize; i < l; i++) { this.array[index1 + i] = attribute.array[index2 + i]; } - return this; } - copyArray(array) { this.array.set(array); return this; } - copyColorsArray(colors) { const array = this.array; let offset = 0; - for (let i = 0, l = colors.length; i < l; i++) { let color = colors[i]; - if (color === undefined) { console.warn('THREE.BufferAttribute.copyColorsArray(): color is undefined', i); color = new Color(); } - array[offset++] = color.r; array[offset++] = color.g; array[offset++] = color.b; } - return this; } - copyVector2sArray(vectors) { const array = this.array; let offset = 0; - for (let i = 0, l = vectors.length; i < l; i++) { let vector = vectors[i]; - if (vector === undefined) { console.warn('THREE.BufferAttribute.copyVector2sArray(): vector is undefined', i); vector = new Vector2(); } - array[offset++] = vector.x; array[offset++] = vector.y; } - return this; } - copyVector3sArray(vectors) { const array = this.array; let offset = 0; - for (let i = 0, l = vectors.length; i < l; i++) { let vector = vectors[i]; - if (vector === undefined) { console.warn('THREE.BufferAttribute.copyVector3sArray(): vector is undefined', i); vector = new Vector3(); } - array[offset++] = vector.x; array[offset++] = vector.y; array[offset++] = vector.z; } - return this; } - copyVector4sArray(vectors) { const array = this.array; let offset = 0; - for (let i = 0, l = vectors.length; i < l; i++) { let vector = vectors[i]; - if (vector === undefined) { console.warn('THREE.BufferAttribute.copyVector4sArray(): vector is undefined', i); vector = new Vector4(); } - array[offset++] = vector.x; array[offset++] = vector.y; array[offset++] = vector.z; array[offset++] = vector.w; } - return this; } - applyMatrix3(m) { if (this.itemSize === 2) { for (let i = 0, l = this.count; i < l; i++) { _vector2$1.fromBufferAttribute(this, i); - _vector2$1.applyMatrix3(m); - this.setXY(i, _vector2$1.x, _vector2$1.y); } } else if (this.itemSize === 3) { for (let i = 0, l = this.count; i < l; i++) { _vector$9.fromBufferAttribute(this, i); - _vector$9.applyMatrix3(m); - this.setXYZ(i, _vector$9.x, _vector$9.y, _vector$9.z); } } - return this; } - applyMatrix4(m) { for (let i = 0, l = this.count; i < l; i++) { _vector$9.x = this.getX(i); _vector$9.y = this.getY(i); _vector$9.z = this.getZ(i); - _vector$9.applyMatrix4(m); - this.setXYZ(i, _vector$9.x, _vector$9.y, _vector$9.z); } - return this; } - applyNormalMatrix(m) { for (let i = 0, l = this.count; i < l; i++) { _vector$9.x = this.getX(i); _vector$9.y = this.getY(i); _vector$9.z = this.getZ(i); - _vector$9.applyNormalMatrix(m); - this.setXYZ(i, _vector$9.x, _vector$9.y, _vector$9.z); } - return this; } - transformDirection(m) { for (let i = 0, l = this.count; i < l; i++) { _vector$9.x = this.getX(i); _vector$9.y = this.getY(i); _vector$9.z = this.getZ(i); - _vector$9.transformDirection(m); - this.setXYZ(i, _vector$9.x, _vector$9.y, _vector$9.z); } - return this; } - set(value, offset = 0) { this.array.set(value, offset); return this; } - getX(index) { return this.array[index * this.itemSize]; } - setX(index, x) { this.array[index * this.itemSize] = x; return this; } - getY(index) { return this.array[index * this.itemSize + 1]; } - setY(index, y) { this.array[index * this.itemSize + 1] = y; return this; } - getZ(index) { return this.array[index * this.itemSize + 2]; } - setZ(index, z) { this.array[index * this.itemSize + 2] = z; return this; } - getW(index) { return this.array[index * this.itemSize + 3]; } - setW(index, w) { this.array[index * this.itemSize + 3] = w; return this; } - setXY(index, x, y) { index *= this.itemSize; this.array[index + 0] = x; this.array[index + 1] = y; return this; } - setXYZ(index, x, y, z) { index *= this.itemSize; this.array[index + 0] = x; @@ -7233,7 +6260,6 @@ class BufferAttribute { this.array[index + 2] = z; return this; } - setXYZW(index, x, y, z, w) { index *= this.itemSize; this.array[index + 0] = x; @@ -7242,16 +6268,13 @@ class BufferAttribute { this.array[index + 3] = w; return this; } - onUpload(callback) { this.onUploadCallback = callback; return this; } - clone() { return new this.constructor(this.array, this.itemSize).copy(this); } - toJSON() { const data = { itemSize: this.itemSize, @@ -7264,97 +6287,70 @@ class BufferAttribute { if (this.updateRange.offset !== 0 || this.updateRange.count !== -1) data.updateRange = this.updateRange; return data; } - } +BufferAttribute.prototype.isBufferAttribute = true; -BufferAttribute.prototype.isBufferAttribute = true; // +// class Int8BufferAttribute extends BufferAttribute { constructor(array, itemSize, normalized) { super(new Int8Array(array), itemSize, normalized); } - } - class Uint8BufferAttribute extends BufferAttribute { constructor(array, itemSize, normalized) { super(new Uint8Array(array), itemSize, normalized); } - } - class Uint8ClampedBufferAttribute extends BufferAttribute { constructor(array, itemSize, normalized) { super(new Uint8ClampedArray(array), itemSize, normalized); } - } - class Int16BufferAttribute extends BufferAttribute { constructor(array, itemSize, normalized) { super(new Int16Array(array), itemSize, normalized); } - } - class Uint16BufferAttribute extends BufferAttribute { constructor(array, itemSize, normalized) { super(new Uint16Array(array), itemSize, normalized); } - } - class Int32BufferAttribute extends BufferAttribute { constructor(array, itemSize, normalized) { super(new Int32Array(array), itemSize, normalized); } - } - class Uint32BufferAttribute extends BufferAttribute { constructor(array, itemSize, normalized) { super(new Uint32Array(array), itemSize, normalized); } - } - class Float16BufferAttribute extends BufferAttribute { constructor(array, itemSize, normalized) { super(new Uint16Array(array), itemSize, normalized); } - } - Float16BufferAttribute.prototype.isFloat16BufferAttribute = true; - class Float32BufferAttribute extends BufferAttribute { constructor(array, itemSize, normalized) { super(new Float32Array(array), itemSize, normalized); } - } - class Float64BufferAttribute extends BufferAttribute { constructor(array, itemSize, normalized) { super(new Float64Array(array), itemSize, normalized); } - -} // +} let _id$1 = 0; - const _m1 = /*@__PURE__*/new Matrix4(); - const _obj = /*@__PURE__*/new Object3D(); - const _offset = /*@__PURE__*/new Vector3(); - const _box$2 = /*@__PURE__*/new Box3(); - const _boxMorphTargets = /*@__PURE__*/new Box3(); - const _vector$8 = /*@__PURE__*/new Vector3(); - class BufferGeometry extends EventDispatcher { constructor() { super(); @@ -7377,39 +6373,31 @@ class BufferGeometry extends EventDispatcher { }; this.userData = {}; } - getIndex() { return this.index; } - setIndex(index) { if (Array.isArray(index)) { this.index = new (arrayNeedsUint32(index) ? Uint32BufferAttribute : Uint16BufferAttribute)(index, 1); } else { this.index = index; } - return this; } - getAttribute(name) { return this.attributes[name]; } - setAttribute(name, attribute) { this.attributes[name] = attribute; return this; } - deleteAttribute(name) { delete this.attributes[name]; return this; } - hasAttribute(name) { return this.attributes[name] !== undefined; } - addGroup(start, count, materialIndex = 0) { this.groups.push({ start: start, @@ -7417,155 +6405,123 @@ class BufferGeometry extends EventDispatcher { materialIndex: materialIndex }); } - clearGroups() { this.groups = []; } - setDrawRange(start, count) { this.drawRange.start = start; this.drawRange.count = count; } - applyMatrix4(matrix) { const position = this.attributes.position; - if (position !== undefined) { position.applyMatrix4(matrix); position.needsUpdate = true; } - const normal = this.attributes.normal; - if (normal !== undefined) { const normalMatrix = new Matrix3().getNormalMatrix(matrix); normal.applyNormalMatrix(normalMatrix); normal.needsUpdate = true; } - const tangent = this.attributes.tangent; - if (tangent !== undefined) { tangent.transformDirection(matrix); tangent.needsUpdate = true; } - if (this.boundingBox !== null) { this.computeBoundingBox(); } - if (this.boundingSphere !== null) { this.computeBoundingSphere(); } - return this; } - applyQuaternion(q) { _m1.makeRotationFromQuaternion(q); - this.applyMatrix4(_m1); return this; } - rotateX(angle) { // rotate geometry around world x-axis - _m1.makeRotationX(angle); + _m1.makeRotationX(angle); this.applyMatrix4(_m1); return this; } - rotateY(angle) { // rotate geometry around world y-axis - _m1.makeRotationY(angle); + _m1.makeRotationY(angle); this.applyMatrix4(_m1); return this; } - rotateZ(angle) { // rotate geometry around world z-axis - _m1.makeRotationZ(angle); + _m1.makeRotationZ(angle); this.applyMatrix4(_m1); return this; } - translate(x, y, z) { // translate geometry - _m1.makeTranslation(x, y, z); + _m1.makeTranslation(x, y, z); this.applyMatrix4(_m1); return this; } - scale(x, y, z) { // scale geometry - _m1.makeScale(x, y, z); + _m1.makeScale(x, y, z); this.applyMatrix4(_m1); return this; } - lookAt(vector) { _obj.lookAt(vector); - _obj.updateMatrix(); - this.applyMatrix4(_obj.matrix); return this; } - center() { this.computeBoundingBox(); this.boundingBox.getCenter(_offset).negate(); this.translate(_offset.x, _offset.y, _offset.z); return this; } - setFromPoints(points) { const position = []; - for (let i = 0, l = points.length; i < l; i++) { const point = points[i]; position.push(point.x, point.y, point.z || 0); } - this.setAttribute('position', new Float32BufferAttribute(position, 3)); return this; } - computeBoundingBox() { if (this.boundingBox === null) { this.boundingBox = new Box3(); } - const position = this.attributes.position; const morphAttributesPosition = this.morphAttributes.position; - if (position && position.isGLBufferAttribute) { console.error('THREE.BufferGeometry.computeBoundingBox(): GLBufferAttribute requires a manual bounding box. Alternatively set "mesh.frustumCulled" to "false".', this); this.boundingBox.set(new Vector3(-Infinity, -Infinity, -Infinity), new Vector3(+Infinity, +Infinity, +Infinity)); return; } - if (position !== undefined) { - this.boundingBox.setFromBufferAttribute(position); // process morph attributes if present + this.boundingBox.setFromBufferAttribute(position); + + // process morph attributes if present if (morphAttributesPosition) { for (let i = 0, il = morphAttributesPosition.length; i < il; i++) { const morphAttribute = morphAttributesPosition[i]; - _box$2.setFromBufferAttribute(morphAttribute); - if (this.morphTargetsRelative) { _vector$8.addVectors(this.boundingBox.min, _box$2.min); - this.boundingBox.expandByPoint(_vector$8); - _vector$8.addVectors(this.boundingBox.max, _box$2.max); - this.boundingBox.expandByPoint(_vector$8); } else { this.boundingBox.expandByPoint(_box$2.min); @@ -7576,133 +6532,111 @@ class BufferGeometry extends EventDispatcher { } else { this.boundingBox.makeEmpty(); } - if (isNaN(this.boundingBox.min.x) || isNaN(this.boundingBox.min.y) || isNaN(this.boundingBox.min.z)) { console.error('THREE.BufferGeometry.computeBoundingBox(): Computed min/max have NaN values. The "position" attribute is likely to have NaN values.', this); } } - computeBoundingSphere() { if (this.boundingSphere === null) { this.boundingSphere = new Sphere(); } - const position = this.attributes.position; const morphAttributesPosition = this.morphAttributes.position; - if (position && position.isGLBufferAttribute) { console.error('THREE.BufferGeometry.computeBoundingSphere(): GLBufferAttribute requires a manual bounding sphere. Alternatively set "mesh.frustumCulled" to "false".', this); this.boundingSphere.set(new Vector3(), Infinity); return; } - if (position) { // first, find the center of the bounding sphere - const center = this.boundingSphere.center; - _box$2.setFromBufferAttribute(position); // process morph attributes if present + const center = this.boundingSphere.center; + _box$2.setFromBufferAttribute(position); + // process morph attributes if present if (morphAttributesPosition) { for (let i = 0, il = morphAttributesPosition.length; i < il; i++) { const morphAttribute = morphAttributesPosition[i]; - _boxMorphTargets.setFromBufferAttribute(morphAttribute); - if (this.morphTargetsRelative) { _vector$8.addVectors(_box$2.min, _boxMorphTargets.min); - _box$2.expandByPoint(_vector$8); - _vector$8.addVectors(_box$2.max, _boxMorphTargets.max); - _box$2.expandByPoint(_vector$8); } else { _box$2.expandByPoint(_boxMorphTargets.min); - _box$2.expandByPoint(_boxMorphTargets.max); } } } + _box$2.getCenter(center); - _box$2.getCenter(center); // second, try to find a boundingSphere with a radius smaller than the + // second, try to find a boundingSphere with a radius smaller than the // boundingSphere of the boundingBox: sqrt(3) smaller in the best case - let maxRadiusSq = 0; - for (let i = 0, il = position.count; i < il; i++) { _vector$8.fromBufferAttribute(position, i); - maxRadiusSq = Math.max(maxRadiusSq, center.distanceToSquared(_vector$8)); - } // process morph attributes if present + } + // process morph attributes if present if (morphAttributesPosition) { for (let i = 0, il = morphAttributesPosition.length; i < il; i++) { const morphAttribute = morphAttributesPosition[i]; const morphTargetsRelative = this.morphTargetsRelative; - for (let j = 0, jl = morphAttribute.count; j < jl; j++) { _vector$8.fromBufferAttribute(morphAttribute, j); - if (morphTargetsRelative) { _offset.fromBufferAttribute(position, j); - _vector$8.add(_offset); } - maxRadiusSq = Math.max(maxRadiusSq, center.distanceToSquared(_vector$8)); } } } - this.boundingSphere.radius = Math.sqrt(maxRadiusSq); - if (isNaN(this.boundingSphere.radius)) { console.error('THREE.BufferGeometry.computeBoundingSphere(): Computed radius is NaN. The "position" attribute is likely to have NaN values.', this); } } } - computeTangents() { const index = this.index; - const attributes = this.attributes; // based on http://www.terathon.com/code/tangent.html + const attributes = this.attributes; + + // based on http://www.terathon.com/code/tangent.html // (per vertex tangents) if (index === null || attributes.position === undefined || attributes.normal === undefined || attributes.uv === undefined) { console.error('THREE.BufferGeometry: .computeTangents() failed. Missing required attributes (index, position, normal or uv)'); return; } - const indices = index.array; const positions = attributes.position.array; const normals = attributes.normal.array; const uvs = attributes.uv.array; const nVertices = positions.length / 3; - if (attributes.tangent === undefined) { this.setAttribute('tangent', new BufferAttribute(new Float32Array(4 * nVertices), 4)); } - const tangents = attributes.tangent.array; const tan1 = [], - tan2 = []; - + tan2 = []; for (let i = 0; i < nVertices; i++) { tan1[i] = new Vector3(); tan2[i] = new Vector3(); } - const vA = new Vector3(), - vB = new Vector3(), - vC = new Vector3(), - uvA = new Vector2(), - uvB = new Vector2(), - uvC = new Vector2(), - sdir = new Vector3(), - tdir = new Vector3(); - + vB = new Vector3(), + vC = new Vector3(), + uvA = new Vector2(), + uvB = new Vector2(), + uvC = new Vector2(), + sdir = new Vector3(), + tdir = new Vector3(); function handleTriangle(a, b, c) { vA.fromArray(positions, a * 3); vB.fromArray(positions, b * 3); @@ -7714,7 +6648,9 @@ class BufferGeometry extends EventDispatcher { vC.sub(vA); uvB.sub(uvA); uvC.sub(uvA); - const r = 1.0 / (uvB.x * uvC.y - uvC.x * uvB.y); // silently ignore degenerate uv triangles having coincident or colinear vertices + const r = 1.0 / (uvB.x * uvC.y - uvC.x * uvB.y); + + // silently ignore degenerate uv triangles having coincident or colinear vertices if (!isFinite(r)) return; sdir.copy(vB).multiplyScalar(uvC.y).addScaledVector(vC, -uvB.y).multiplyScalar(r); @@ -7726,38 +6662,36 @@ class BufferGeometry extends EventDispatcher { tan2[b].add(tdir); tan2[c].add(tdir); } - let groups = this.groups; - if (groups.length === 0) { groups = [{ start: 0, count: indices.length }]; } - for (let i = 0, il = groups.length; i < il; ++i) { const group = groups[i]; const start = group.start; const count = group.count; - for (let j = start, jl = start + count; j < jl; j += 3) { handleTriangle(indices[j + 0], indices[j + 1], indices[j + 2]); } } - const tmp = new Vector3(), - tmp2 = new Vector3(); + tmp2 = new Vector3(); const n = new Vector3(), - n2 = new Vector3(); - + n2 = new Vector3(); function handleVertex(v) { n.fromArray(normals, v * 3); n2.copy(n); - const t = tan1[v]; // Gram-Schmidt orthogonalize + const t = tan1[v]; + + // Gram-Schmidt orthogonalize tmp.copy(t); - tmp.sub(n.multiplyScalar(n.dot(t))).normalize(); // Calculate handedness + tmp.sub(n.multiplyScalar(n.dot(t))).normalize(); + + // Calculate handedness tmp2.crossVectors(n2, t); const test = tmp2.dot(tan2[v]); @@ -7767,12 +6701,10 @@ class BufferGeometry extends EventDispatcher { tangents[v * 4 + 2] = tmp.z; tangents[v * 4 + 3] = w; } - for (let i = 0, il = groups.length; i < il; ++i) { const group = groups[i]; const start = group.start; const count = group.count; - for (let j = start, jl = start + count; j < jl; j += 3) { handleVertex(indices[j + 0]); handleVertex(indices[j + 1]); @@ -7780,32 +6712,31 @@ class BufferGeometry extends EventDispatcher { } } } - computeVertexNormals() { const index = this.index; const positionAttribute = this.getAttribute('position'); - if (positionAttribute !== undefined) { let normalAttribute = this.getAttribute('normal'); - if (normalAttribute === undefined) { normalAttribute = new BufferAttribute(new Float32Array(positionAttribute.count * 3), 3); this.setAttribute('normal', normalAttribute); } else { // reset existing normals to zero + for (let i = 0, il = normalAttribute.count; i < il; i++) { normalAttribute.setXYZ(i, 0, 0, 0); } } - const pA = new Vector3(), - pB = new Vector3(), - pC = new Vector3(); + pB = new Vector3(), + pC = new Vector3(); const nA = new Vector3(), - nB = new Vector3(), - nC = new Vector3(); + nB = new Vector3(), + nC = new Vector3(); const cb = new Vector3(), - ab = new Vector3(); // indexed elements + ab = new Vector3(); + + // indexed elements if (index) { for (let i = 0, il = index.count; i < il; i += 3) { @@ -7830,6 +6761,7 @@ class BufferGeometry extends EventDispatcher { } } else { // non-indexed elements (unconnected triangle soup) + for (let i = 0, il = positionAttribute.count; i < il; i += 3) { pA.fromBufferAttribute(positionAttribute, i + 0); pB.fromBufferAttribute(positionAttribute, i + 1); @@ -7842,25 +6774,20 @@ class BufferGeometry extends EventDispatcher { normalAttribute.setXYZ(i + 2, cb.x, cb.y, cb.z); } } - this.normalizeNormals(); normalAttribute.needsUpdate = true; } } - merge(geometry, offset) { if (!(geometry && geometry.isBufferGeometry)) { console.error('THREE.BufferGeometry.merge(): geometry not an instance of THREE.BufferGeometry.', geometry); return; } - if (offset === undefined) { offset = 0; console.warn('THREE.BufferGeometry.merge(): Overwriting original geometry, starting at offset=0. ' + 'Use BufferGeometryUtils.mergeBufferGeometries() for lossless merge.'); } - const attributes = this.attributes; - for (const key in attributes) { if (geometry.attributes[key] === undefined) continue; const attribute1 = attributes[key]; @@ -7869,27 +6796,20 @@ class BufferGeometry extends EventDispatcher { const attributeArray2 = attribute2.array; const attributeOffset = attribute2.itemSize * offset; const length = Math.min(attributeArray2.length, attributeArray1.length - attributeOffset); - for (let i = 0, j = attributeOffset; i < length; i++, j++) { attributeArray1[j] = attributeArray2[i]; } } - return this; } - normalizeNormals() { const normals = this.attributes.normal; - for (let i = 0, il = normals.count; i < il; i++) { _vector$8.fromBufferAttribute(normals, i); - _vector$8.normalize(); - normals.setXYZ(i, _vector$8.x, _vector$8.y, _vector$8.z); } } - toNonIndexed() { function convertBufferAttribute(attribute, indices) { const array = attribute.array; @@ -7897,42 +6817,41 @@ class BufferGeometry extends EventDispatcher { const normalized = attribute.normalized; const array2 = new array.constructor(indices.length * itemSize); let index = 0, - index2 = 0; - + index2 = 0; for (let i = 0, l = indices.length; i < l; i++) { if (attribute.isInterleavedBufferAttribute) { index = indices[i] * attribute.data.stride + attribute.offset; } else { index = indices[i] * itemSize; } - for (let j = 0; j < itemSize; j++) { array2[index2++] = array[index++]; } } - return new BufferAttribute(array2, itemSize, normalized); - } // + } + // if (this.index === null) { console.warn('THREE.BufferGeometry.toNonIndexed(): BufferGeometry is already non-indexed.'); return this; } - const geometry2 = new BufferGeometry(); const indices = this.index.array; - const attributes = this.attributes; // attributes + const attributes = this.attributes; + + // attributes for (const name in attributes) { const attribute = attributes[name]; const newAttribute = convertBufferAttribute(attribute, indices); geometry2.setAttribute(name, newAttribute); - } // morph attributes + } + // morph attributes const morphAttributes = this.morphAttributes; - for (const name in morphAttributes) { const morphArray = []; const morphAttribute = morphAttributes[name]; // morphAttribute: array of Float32BufferAttributes @@ -7942,22 +6861,19 @@ class BufferGeometry extends EventDispatcher { const newAttribute = convertBufferAttribute(attribute, indices); morphArray.push(newAttribute); } - geometry2.morphAttributes[name] = morphArray; } + geometry2.morphTargetsRelative = this.morphTargetsRelative; - geometry2.morphTargetsRelative = this.morphTargetsRelative; // groups + // groups const groups = this.groups; - for (let i = 0, l = groups.length; i < l; i++) { const group = groups[i]; geometry2.addGroup(group.start, group.count, group.materialIndex); } - return geometry2; } - toJSON() { const data = { metadata: { @@ -7965,118 +6881,109 @@ class BufferGeometry extends EventDispatcher { type: 'BufferGeometry', generator: 'BufferGeometry.toJSON' } - }; // standard BufferGeometry serialization + }; + + // standard BufferGeometry serialization data.uuid = this.uuid; data.type = this.type; if (this.name !== '') data.name = this.name; if (Object.keys(this.userData).length > 0) data.userData = this.userData; - if (this.parameters !== undefined) { const parameters = this.parameters; - for (const key in parameters) { if (parameters[key] !== undefined) data[key] = parameters[key]; } - return data; - } // for simplicity the code assumes attributes are not shared across geometries, see #15811 + } + // for simplicity the code assumes attributes are not shared across geometries, see #15811 data.data = { attributes: {} }; const index = this.index; - if (index !== null) { data.data.index = { type: index.array.constructor.name, array: Array.prototype.slice.call(index.array) }; } - const attributes = this.attributes; - for (const key in attributes) { const attribute = attributes[key]; data.data.attributes[key] = attribute.toJSON(data.data); } - const morphAttributes = {}; let hasMorphAttributes = false; - for (const key in this.morphAttributes) { const attributeArray = this.morphAttributes[key]; const array = []; - for (let i = 0, il = attributeArray.length; i < il; i++) { const attribute = attributeArray[i]; array.push(attribute.toJSON(data.data)); } - if (array.length > 0) { morphAttributes[key] = array; hasMorphAttributes = true; } } - if (hasMorphAttributes) { data.data.morphAttributes = morphAttributes; data.data.morphTargetsRelative = this.morphTargetsRelative; } - const groups = this.groups; - if (groups.length > 0) { data.data.groups = JSON.parse(JSON.stringify(groups)); } - const boundingSphere = this.boundingSphere; - if (boundingSphere !== null) { data.data.boundingSphere = { center: boundingSphere.center.toArray(), radius: boundingSphere.radius }; } - return data; } - clone() { return new this.constructor().copy(this); } - copy(source) { // reset + this.index = null; this.attributes = {}; this.morphAttributes = {}; this.groups = []; this.boundingBox = null; - this.boundingSphere = null; // used for storing cloned, shared data + this.boundingSphere = null; - const data = {}; // name + // used for storing cloned, shared data - this.name = source.name; // index + const data = {}; - const index = source.index; + // name + + this.name = source.name; + // index + + const index = source.index; if (index !== null) { this.setIndex(index.clone(data)); - } // attributes + } + // attributes const attributes = source.attributes; - for (const name in attributes) { const attribute = attributes[name]; this.setAttribute(name, attribute.clone(data)); - } // morph attributes + } + // morph attributes const morphAttributes = source.morphAttributes; - for (const name in morphAttributes) { const array = []; const morphAttribute = morphAttributes[name]; // morphAttribute: array of Float32BufferAttributes @@ -8084,87 +6991,71 @@ class BufferGeometry extends EventDispatcher { for (let i = 0, l = morphAttribute.length; i < l; i++) { array.push(morphAttribute[i].clone(data)); } - this.morphAttributes[name] = array; } + this.morphTargetsRelative = source.morphTargetsRelative; - this.morphTargetsRelative = source.morphTargetsRelative; // groups + // groups const groups = source.groups; - for (let i = 0, l = groups.length; i < l; i++) { const group = groups[i]; this.addGroup(group.start, group.count, group.materialIndex); - } // bounding box + } + // bounding box const boundingBox = source.boundingBox; - if (boundingBox !== null) { this.boundingBox = boundingBox.clone(); - } // bounding sphere + } + // bounding sphere const boundingSphere = source.boundingSphere; - if (boundingSphere !== null) { this.boundingSphere = boundingSphere.clone(); - } // draw range + } + // draw range this.drawRange.start = source.drawRange.start; - this.drawRange.count = source.drawRange.count; // user data + this.drawRange.count = source.drawRange.count; + + // user data - this.userData = source.userData; // geometry generator parameters + this.userData = source.userData; + + // geometry generator parameters if (source.parameters !== undefined) this.parameters = Object.assign({}, source.parameters); return this; } - dispose() { this.dispatchEvent({ type: 'dispose' }); } - } - BufferGeometry.prototype.isBufferGeometry = true; const _inverseMatrix$2 = /*@__PURE__*/new Matrix4(); - const _ray$2 = /*@__PURE__*/new Ray(); - const _sphere$3 = /*@__PURE__*/new Sphere(); - const _vA$1 = /*@__PURE__*/new Vector3(); - const _vB$1 = /*@__PURE__*/new Vector3(); - const _vC$1 = /*@__PURE__*/new Vector3(); - const _tempA = /*@__PURE__*/new Vector3(); - const _tempB = /*@__PURE__*/new Vector3(); - const _tempC = /*@__PURE__*/new Vector3(); - const _morphA = /*@__PURE__*/new Vector3(); - const _morphB = /*@__PURE__*/new Vector3(); - const _morphC = /*@__PURE__*/new Vector3(); - const _uvA$1 = /*@__PURE__*/new Vector2(); - const _uvB$1 = /*@__PURE__*/new Vector2(); - const _uvC$1 = /*@__PURE__*/new Vector2(); - const _intersectionPoint = /*@__PURE__*/new Vector3(); - const _intersectionPointWorld = /*@__PURE__*/new Vector3(); - class Mesh extends Object3D { constructor(geometry = new BufferGeometry(), material = new MeshBasicMaterial()) { super(); @@ -8173,37 +7064,28 @@ class Mesh extends Object3D { this.material = material; this.updateMorphTargets(); } - copy(source) { super.copy(source); - if (source.morphTargetInfluences !== undefined) { this.morphTargetInfluences = source.morphTargetInfluences.slice(); } - if (source.morphTargetDictionary !== undefined) { this.morphTargetDictionary = Object.assign({}, source.morphTargetDictionary); } - this.material = source.material; this.geometry = source.geometry; return this; } - updateMorphTargets() { const geometry = this.geometry; - if (geometry.isBufferGeometry) { const morphAttributes = geometry.morphAttributes; const keys = Object.keys(morphAttributes); - if (keys.length > 0) { const morphAttribute = morphAttributes[keys[0]]; - if (morphAttribute !== undefined) { this.morphTargetInfluences = []; this.morphTargetDictionary = {}; - for (let m = 0, ml = morphAttribute.length; m < ml; m++) { const name = morphAttribute[m].name || String(m); this.morphTargetInfluences.push(0); @@ -8213,38 +7095,35 @@ class Mesh extends Object3D { } } else { const morphTargets = geometry.morphTargets; - if (morphTargets !== undefined && morphTargets.length > 0) { console.error('THREE.Mesh.updateMorphTargets() no longer supports THREE.Geometry. Use THREE.BufferGeometry instead.'); } } } - raycast(raycaster, intersects) { const geometry = this.geometry; const material = this.material; const matrixWorld = this.matrixWorld; - if (material === undefined) return; // Checking boundingSphere distance to ray + if (material === undefined) return; - if (geometry.boundingSphere === null) geometry.computeBoundingSphere(); + // Checking boundingSphere distance to ray + if (geometry.boundingSphere === null) geometry.computeBoundingSphere(); _sphere$3.copy(geometry.boundingSphere); - _sphere$3.applyMatrix4(matrixWorld); + if (raycaster.ray.intersectsSphere(_sphere$3) === false) return; - if (raycaster.ray.intersectsSphere(_sphere$3) === false) return; // + // _inverseMatrix$2.copy(matrixWorld).invert(); + _ray$2.copy(raycaster.ray).applyMatrix4(_inverseMatrix$2); - _ray$2.copy(raycaster.ray).applyMatrix4(_inverseMatrix$2); // Check boundingBox before continuing - + // Check boundingBox before continuing if (geometry.boundingBox !== null) { if (_ray$2.intersectsBox(geometry.boundingBox) === false) return; } - let intersection; - if (geometry.isBufferGeometry) { const index = geometry.index; const position = geometry.attributes.position; @@ -8254,25 +7133,22 @@ class Mesh extends Object3D { const uv2 = geometry.attributes.uv2; const groups = geometry.groups; const drawRange = geometry.drawRange; - if (index !== null) { // indexed buffer geometry + if (Array.isArray(material)) { for (let i = 0, il = groups.length; i < il; i++) { const group = groups[i]; const groupMaterial = material[group.materialIndex]; const start = Math.max(group.start, drawRange.start); const end = Math.min(index.count, Math.min(group.start + group.count, drawRange.start + drawRange.count)); - for (let j = start, jl = end; j < jl; j += 3) { const a = index.getX(j); const b = index.getX(j + 1); const c = index.getX(j + 2); intersection = checkBufferGeometryIntersection(this, groupMaterial, raycaster, _ray$2, position, morphPosition, morphTargetsRelative, uv, uv2, a, b, c); - if (intersection) { intersection.faceIndex = Math.floor(j / 3); // triangle number in indexed buffer semantics - intersection.face.materialIndex = group.materialIndex; intersects.push(intersection); } @@ -8281,38 +7157,33 @@ class Mesh extends Object3D { } else { const start = Math.max(0, drawRange.start); const end = Math.min(index.count, drawRange.start + drawRange.count); - for (let i = start, il = end; i < il; i += 3) { const a = index.getX(i); const b = index.getX(i + 1); const c = index.getX(i + 2); intersection = checkBufferGeometryIntersection(this, material, raycaster, _ray$2, position, morphPosition, morphTargetsRelative, uv, uv2, a, b, c); - if (intersection) { intersection.faceIndex = Math.floor(i / 3); // triangle number in indexed buffer semantics - intersects.push(intersection); } } } } else if (position !== undefined) { // non-indexed buffer geometry + if (Array.isArray(material)) { for (let i = 0, il = groups.length; i < il; i++) { const group = groups[i]; const groupMaterial = material[group.materialIndex]; const start = Math.max(group.start, drawRange.start); const end = Math.min(position.count, Math.min(group.start + group.count, drawRange.start + drawRange.count)); - for (let j = start, jl = end; j < jl; j += 3) { const a = j; const b = j + 1; const c = j + 2; intersection = checkBufferGeometryIntersection(this, groupMaterial, raycaster, _ray$2, position, morphPosition, morphTargetsRelative, uv, uv2, a, b, c); - if (intersection) { intersection.faceIndex = Math.floor(j / 3); // triangle number in non-indexed buffer semantics - intersection.face.materialIndex = group.materialIndex; intersects.push(intersection); } @@ -8321,16 +7192,13 @@ class Mesh extends Object3D { } else { const start = Math.max(0, drawRange.start); const end = Math.min(position.count, drawRange.start + drawRange.count); - for (let i = start, il = end; i < il; i += 3) { const a = i; const b = i + 1; const c = i + 2; intersection = checkBufferGeometryIntersection(this, material, raycaster, _ray$2, position, morphPosition, morphTargetsRelative, uv, uv2, a, b, c); - if (intersection) { intersection.faceIndex = Math.floor(i / 3); // triangle number in non-indexed buffer semantics - intersects.push(intersection); } } @@ -8340,26 +7208,18 @@ class Mesh extends Object3D { console.error('THREE.Mesh.raycast() no longer supports THREE.Geometry. Use THREE.BufferGeometry instead.'); } } - } - Mesh.prototype.isMesh = true; - function checkIntersection(object, material, raycaster, ray, pA, pB, pC, point) { let intersect; - if (material.side === BackSide) { intersect = ray.intersectTriangle(pC, pB, pA, true, point); } else { intersect = ray.intersectTriangle(pA, pB, pC, material.side !== DoubleSide, point); } - if (intersect === null) return null; - _intersectionPointWorld.copy(point); - _intersectionPointWorld.applyMatrix4(object.matrixWorld); - const distance = raycaster.ray.origin.distanceTo(_intersectionPointWorld); if (distance < raycaster.near || distance > raycaster.far) return null; return { @@ -8368,85 +7228,55 @@ function checkIntersection(object, material, raycaster, ray, pA, pB, pC, point) object: object }; } - function checkBufferGeometryIntersection(object, material, raycaster, ray, position, morphPosition, morphTargetsRelative, uv, uv2, a, b, c) { _vA$1.fromBufferAttribute(position, a); - _vB$1.fromBufferAttribute(position, b); - _vC$1.fromBufferAttribute(position, c); - const morphInfluences = object.morphTargetInfluences; - if (morphPosition && morphInfluences) { _morphA.set(0, 0, 0); - _morphB.set(0, 0, 0); - _morphC.set(0, 0, 0); - for (let i = 0, il = morphPosition.length; i < il; i++) { const influence = morphInfluences[i]; const morphAttribute = morphPosition[i]; if (influence === 0) continue; - _tempA.fromBufferAttribute(morphAttribute, a); - _tempB.fromBufferAttribute(morphAttribute, b); - _tempC.fromBufferAttribute(morphAttribute, c); - if (morphTargetsRelative) { _morphA.addScaledVector(_tempA, influence); - _morphB.addScaledVector(_tempB, influence); - _morphC.addScaledVector(_tempC, influence); } else { _morphA.addScaledVector(_tempA.sub(_vA$1), influence); - _morphB.addScaledVector(_tempB.sub(_vB$1), influence); - _morphC.addScaledVector(_tempC.sub(_vC$1), influence); } } - _vA$1.add(_morphA); - _vB$1.add(_morphB); - _vC$1.add(_morphC); } - if (object.isSkinnedMesh) { object.boneTransform(a, _vA$1); object.boneTransform(b, _vB$1); object.boneTransform(c, _vC$1); } - const intersection = checkIntersection(object, material, raycaster, ray, _vA$1, _vB$1, _vC$1, _intersectionPoint); - if (intersection) { if (uv) { _uvA$1.fromBufferAttribute(uv, a); - _uvB$1.fromBufferAttribute(uv, b); - _uvC$1.fromBufferAttribute(uv, c); - intersection.uv = Triangle.getUV(_intersectionPoint, _vA$1, _vB$1, _vC$1, _uvA$1, _uvB$1, _uvC$1, new Vector2()); } - if (uv2) { _uvA$1.fromBufferAttribute(uv2, a); - _uvB$1.fromBufferAttribute(uv2, b); - _uvC$1.fromBufferAttribute(uv2, c); - intersection.uv2 = Triangle.getUV(_intersectionPoint, _vA$1, _vB$1, _vC$1, _uvA$1, _uvB$1, _uvC$1, new Vector2()); } - const face = { a: a, b: b, @@ -8457,7 +7287,6 @@ function checkBufferGeometryIntersection(object, material, raycaster, ray, posit Triangle.getNormal(_vA$1, _vB$1, _vC$1, face.normal); intersection.face = face; } - return intersection; } @@ -8473,38 +7302,41 @@ class BoxGeometry extends BufferGeometry { heightSegments: heightSegments, depthSegments: depthSegments }; - const scope = this; // segments + const scope = this; + + // segments widthSegments = Math.floor(widthSegments); heightSegments = Math.floor(heightSegments); - depthSegments = Math.floor(depthSegments); // buffers + depthSegments = Math.floor(depthSegments); + + // buffers const indices = []; const vertices = []; const normals = []; - const uvs = []; // helper variables + const uvs = []; + + // helper variables let numberOfVertices = 0; - let groupStart = 0; // build each side of the box geometry + let groupStart = 0; - buildPlane('z', 'y', 'x', -1, -1, depth, height, width, depthSegments, heightSegments, 0); // px + // build each side of the box geometry + buildPlane('z', 'y', 'x', -1, -1, depth, height, width, depthSegments, heightSegments, 0); // px buildPlane('z', 'y', 'x', 1, -1, depth, height, -width, depthSegments, heightSegments, 1); // nx - buildPlane('x', 'z', 'y', 1, 1, width, depth, height, widthSegments, depthSegments, 2); // py - buildPlane('x', 'z', 'y', 1, -1, width, depth, -height, widthSegments, depthSegments, 3); // ny - buildPlane('x', 'y', 'z', 1, -1, width, height, depth, widthSegments, heightSegments, 4); // pz - buildPlane('x', 'y', 'z', -1, -1, width, height, -depth, widthSegments, heightSegments, 5); // nz + // build geometry this.setIndex(indices); this.setAttribute('position', new Float32BufferAttribute(vertices, 3)); this.setAttribute('normal', new Float32BufferAttribute(normals, 3)); this.setAttribute('uv', new Float32BufferAttribute(uvs, 2)); - function buildPlane(u, v, w, udir, vdir, width, height, depth, gridX, gridY, materialIndex) { const segmentWidth = width / gridX; const segmentHeight = height / gridY; @@ -8515,78 +7347,98 @@ class BoxGeometry extends BufferGeometry { const gridY1 = gridY + 1; let vertexCounter = 0; let groupCount = 0; - const vector = new Vector3(); // generate vertices, normals and uvs + const vector = new Vector3(); + + // generate vertices, normals and uvs for (let iy = 0; iy < gridY1; iy++) { const y = iy * segmentHeight - heightHalf; - for (let ix = 0; ix < gridX1; ix++) { - const x = ix * segmentWidth - widthHalf; // set values to correct vector component + const x = ix * segmentWidth - widthHalf; + + // set values to correct vector component vector[u] = x * udir; vector[v] = y * vdir; - vector[w] = depthHalf; // now apply vector to vertex buffer + vector[w] = depthHalf; - vertices.push(vector.x, vector.y, vector.z); // set values to correct vector component + // now apply vector to vertex buffer + + vertices.push(vector.x, vector.y, vector.z); + + // set values to correct vector component vector[u] = 0; vector[v] = 0; - vector[w] = depth > 0 ? 1 : -1; // now apply vector to normal buffer + vector[w] = depth > 0 ? 1 : -1; + + // now apply vector to normal buffer + + normals.push(vector.x, vector.y, vector.z); - normals.push(vector.x, vector.y, vector.z); // uvs + // uvs uvs.push(ix / gridX); - uvs.push(1 - iy / gridY); // counters + uvs.push(1 - iy / gridY); + + // counters vertexCounter += 1; } - } // indices + } + + // indices + // 1. you need three indices to draw a single face // 2. a single segment consists of two faces // 3. so we need to generate six (2*3) indices per segment - for (let iy = 0; iy < gridY; iy++) { for (let ix = 0; ix < gridX; ix++) { const a = numberOfVertices + ix + gridX1 * iy; const b = numberOfVertices + ix + gridX1 * (iy + 1); const c = numberOfVertices + (ix + 1) + gridX1 * (iy + 1); - const d = numberOfVertices + (ix + 1) + gridX1 * iy; // faces + const d = numberOfVertices + (ix + 1) + gridX1 * iy; + + // faces indices.push(a, b, d); - indices.push(b, c, d); // increase counter + indices.push(b, c, d); + + // increase counter groupCount += 6; } - } // add a group to the geometry. this will ensure multi material support + } + + // add a group to the geometry. this will ensure multi material support + scope.addGroup(groupStart, groupCount, materialIndex); - scope.addGroup(groupStart, groupCount, materialIndex); // calculate new start value for groups + // calculate new start value for groups + + groupStart += groupCount; - groupStart += groupCount; // update total number of vertices + // update total number of vertices numberOfVertices += vertexCounter; } } - static fromJSON(data) { return new BoxGeometry(data.width, data.height, data.depth, data.widthSegments, data.heightSegments, data.depthSegments); } - } /** * Uniform Utilities */ + function cloneUniforms(src) { const dst = {}; - for (const u in src) { dst[u] = {}; - for (const p in src[u]) { const property = src[u][p]; - if (property && (property.isColor || property.isMatrix3 || property.isMatrix4 || property.isVector2 || property.isVector3 || property.isVector4 || property.isTexture || property.isQuaternion)) { dst[u][p] = property.clone(); } else if (Array.isArray(property)) { @@ -8596,22 +7448,20 @@ function cloneUniforms(src) { } } } - return dst; } function mergeUniforms(uniforms) { const merged = {}; - for (let u = 0; u < uniforms.length; u++) { const tmp = cloneUniforms(uniforms[u]); - for (const p in tmp) { merged[p] = tmp[p]; } } - return merged; -} // Legacy +} + +// Legacy const UniformsUtils = { clone: cloneUniforms, @@ -8649,9 +7499,7 @@ class ShaderMaterial extends Material { this.wireframe = false; this.wireframeLinewidth = 1; this.fog = false; // set to use scene fog - this.lights = false; // set to use scene lights - this.clipping = false; // set to use user-defined clipping planes this.extensions = { @@ -8662,10 +7510,10 @@ class ShaderMaterial extends Material { drawBuffers: false, // set to use draw buffers shaderTextureLOD: false // set to use shader texture LOD + }; - }; // When rendered geometry doesn't include these attributes but the material does, + // When rendered geometry doesn't include these attributes but the material does, // use these default values in WebGL. This avoids errors when buffer data is missing. - this.defaultAttributeValues = { 'color': [1, 1, 1], 'uv': [0, 0], @@ -8674,16 +7522,13 @@ class ShaderMaterial extends Material { this.index0AttributeName = undefined; this.uniformsNeedUpdate = false; this.glslVersion = null; - if (parameters !== undefined) { if (parameters.attributes !== undefined) { console.error('THREE.ShaderMaterial: attributes should now be defined in THREE.BufferGeometry instead.'); } - this.setValues(parameters); } } - copy(source) { super.copy(source); this.fragmentShader = source.fragmentShader; @@ -8698,16 +7543,13 @@ class ShaderMaterial extends Material { this.glslVersion = source.glslVersion; return this; } - toJSON(meta) { const data = super.toJSON(meta); data.glslVersion = this.glslVersion; data.uniforms = {}; - for (const name in this.uniforms) { const uniform = this.uniforms[name]; const value = uniform.value; - if (value && value.isTexture) { data.uniforms[name] = { type: 't', @@ -8746,25 +7588,22 @@ class ShaderMaterial extends Material { } else { data.uniforms[name] = { value: value - }; // note: the array variants v2v, v3v, v4v, m4v and tv are not supported so far + }; + + // note: the array variants v2v, v3v, v4v, m4v and tv are not supported so far } } - if (Object.keys(this.defines).length > 0) data.defines = this.defines; data.vertexShader = this.vertexShader; data.fragmentShader = this.fragmentShader; const extensions = {}; - for (const key in this.extensions) { if (this.extensions[key] === true) extensions[key] = true; } - if (Object.keys(extensions).length > 0) data.extensions = extensions; return data; } - } - ShaderMaterial.prototype.isShaderMaterial = true; class Camera extends Object3D { @@ -8775,7 +7614,6 @@ class Camera extends Object3D { this.projectionMatrix = new Matrix4(); this.projectionMatrixInverse = new Matrix4(); } - copy(source, recursive) { super.copy(source, recursive); this.matrixWorldInverse.copy(source.matrixWorldInverse); @@ -8783,29 +7621,23 @@ class Camera extends Object3D { this.projectionMatrixInverse.copy(source.projectionMatrixInverse); return this; } - getWorldDirection(target) { this.updateWorldMatrix(true, false); const e = this.matrixWorld.elements; return target.set(-e[8], -e[9], -e[10]).normalize(); } - updateMatrixWorld(force) { super.updateMatrixWorld(force); this.matrixWorldInverse.copy(this.matrixWorld).invert(); } - updateWorldMatrix(updateParents, updateChildren) { super.updateWorldMatrix(updateParents, updateChildren); this.matrixWorldInverse.copy(this.matrixWorld).invert(); } - clone() { return new this.constructor().copy(this); } - } - Camera.prototype.isCamera = true; class PerspectiveCamera extends Camera { @@ -8820,12 +7652,10 @@ class PerspectiveCamera extends Camera { this.aspect = aspect; this.view = null; this.filmGauge = 35; // width of the film (default in millimeters) - this.filmOffset = 0; // horizontal film offset (same unit as gauge) this.updateProjectionMatrix(); } - copy(source, recursive) { super.copy(source, recursive); this.fov = source.fov; @@ -8839,6 +7669,7 @@ class PerspectiveCamera extends Camera { this.filmOffset = source.filmOffset; return this; } + /** * Sets the FOV by focal length in respect to the current .filmGauge. * @@ -8847,37 +7678,32 @@ class PerspectiveCamera extends Camera { * * Values for focal length and film gauge must have the same unit. */ - - setFocalLength(focalLength) { /** see {@link http://www.bobatkins.com/photography/technical/field_of_view.html} */ const vExtentSlope = 0.5 * this.getFilmHeight() / focalLength; this.fov = RAD2DEG * 2 * Math.atan(vExtentSlope); this.updateProjectionMatrix(); } + /** * Calculates the focal length from the current .fov and .filmGauge. */ - - getFocalLength() { const vExtentSlope = Math.tan(DEG2RAD * 0.5 * this.fov); return 0.5 * this.getFilmHeight() / vExtentSlope; } - getEffectiveFOV() { return RAD2DEG * 2 * Math.atan(Math.tan(DEG2RAD * 0.5 * this.fov) / this.zoom); } - getFilmWidth() { // film not completely covered in portrait format (aspect < 1) return this.filmGauge * Math.min(this.aspect, 1); } - getFilmHeight() { // film not completely covered in landscape format (aspect > 1) return this.filmGauge / Math.max(this.aspect, 1); } + /** * Sets an offset in a larger frustum. This is useful for multi-window or * multi-monitor/multi-machine setups. @@ -8913,11 +7739,8 @@ class PerspectiveCamera extends Camera { * * Note there is no reason monitors have to be the same size or in a grid. */ - - setViewOffset(fullWidth, fullHeight, x, y, width, height) { this.aspect = fullWidth / fullHeight; - if (this.view === null) { this.view = { enabled: true, @@ -8929,7 +7752,6 @@ class PerspectiveCamera extends Camera { height: 1 }; } - this.view.enabled = true; this.view.fullWidth = fullWidth; this.view.fullHeight = fullHeight; @@ -8939,15 +7761,12 @@ class PerspectiveCamera extends Camera { this.view.height = height; this.updateProjectionMatrix(); } - clearViewOffset() { if (this.view !== null) { this.view.enabled = false; } - this.updateProjectionMatrix(); } - updateProjectionMatrix() { const near = this.near; let top = near * Math.tan(DEG2RAD * 0.5 * this.fov) / this.zoom; @@ -8955,22 +7774,19 @@ class PerspectiveCamera extends Camera { let width = this.aspect * height; let left = -0.5 * width; const view = this.view; - if (this.view !== null && this.view.enabled) { const fullWidth = view.fullWidth, - fullHeight = view.fullHeight; + fullHeight = view.fullHeight; left += view.offsetX * width / fullWidth; top -= view.offsetY * height / fullHeight; width *= view.width / fullWidth; height *= view.height / fullHeight; } - const skew = this.filmOffset; if (skew !== 0) left += near * skew / this.getFilmWidth(); this.projectionMatrix.makePerspective(left, left + width, top, top - height, near, this.far); this.projectionMatrixInverse.copy(this.projectionMatrix).invert(); } - toJSON(meta) { const data = super.toJSON(meta); data.object.fov = this.fov; @@ -8984,24 +7800,19 @@ class PerspectiveCamera extends Camera { data.object.filmOffset = this.filmOffset; return data; } - } - PerspectiveCamera.prototype.isPerspectiveCamera = true; const fov = 90, - aspect = 1; - + aspect = 1; class CubeCamera extends Object3D { constructor(near, far, renderTarget) { super(); this.type = 'CubeCamera'; - if (renderTarget.isWebGLCubeRenderTarget !== true) { console.error('THREE.CubeCamera: The constructor now expects an instance of WebGLCubeRenderTarget as third parameter.'); return; } - this.renderTarget = renderTarget; const cameraPX = new PerspectiveCamera(fov, aspect, near, far); cameraPX.layers = this.layers; @@ -9034,7 +7845,6 @@ class CubeCamera extends Object3D { cameraNZ.lookAt(new Vector3(0, 0, -1)); this.add(cameraNZ); } - update(renderer, scene) { if (this.parent === null) this.updateMatrixWorld(); const renderTarget = this.renderTarget; @@ -9061,7 +7871,6 @@ class CubeCamera extends Object3D { renderer.xr.enabled = currentXrEnabled; renderTarget.texture.needsPMREMUpdate = true; } - } class CubeTexture extends Texture { @@ -9071,17 +7880,13 @@ class CubeTexture extends Texture { super(images, mapping, wrapS, wrapT, magFilter, minFilter, format, type, anisotropy, encoding); this.flipY = false; } - get images() { return this.image; } - set images(value) { this.image = value; } - } - CubeTexture.prototype.isCubeTexture = true; class WebGLCubeRenderTarget extends WebGLRenderTarget { @@ -9090,11 +7895,13 @@ class WebGLCubeRenderTarget extends WebGLRenderTarget { console.warn('THREE.WebGLCubeRenderTarget: constructor signature is now WebGLCubeRenderTarget( size, options )'); options = dummy; } - super(size, size, options); - options = options || {}; // By convention -- likely based on the RenderMan spec from the 1990's -- cube maps are specified by WebGL (and three.js) + options = options || {}; + + // By convention -- likely based on the RenderMan spec from the 1990's -- cube maps are specified by WebGL (and three.js) // in a coordinate system in which positive-x is to the right when looking up the positive-z axis -- in other words, // in a left-handed coordinate system. By continuing this convention, preexisting cube maps continued to render correctly. + // three.js uses a right-handed coordinate system. So environment maps used in three.js appear to have px and nx swapped // and the flag isRenderTargetTexture controls this conversion. The flip is not required when using WebGLCubeRenderTarget.texture // as a cube texture (this is detected when isRenderTargetTexture is set to true for cube textures). @@ -9104,11 +7911,9 @@ class WebGLCubeRenderTarget extends WebGLRenderTarget { this.texture.generateMipmaps = options.generateMipmaps !== undefined ? options.generateMipmaps : false; this.texture.minFilter = options.minFilter !== undefined ? options.minFilter : LinearFilter; } - fromEquirectangularTexture(renderer, texture) { this.texture.type = texture.type; this.texture.format = RGBAFormat; // see #18859 - this.texture.encoding = texture.encoding; this.texture.generateMipmaps = texture.generateMipmaps; this.texture.minFilter = texture.minFilter; @@ -9119,9 +7924,7 @@ class WebGLCubeRenderTarget extends WebGLRenderTarget { value: null } }, - vertexShader: - /* glsl */ - ` + vertexShader: /* glsl */` varying vec3 vWorldDirection; @@ -9140,9 +7943,7 @@ class WebGLCubeRenderTarget extends WebGLRenderTarget { } `, - fragmentShader: - /* glsl */ - ` + fragmentShader: /* glsl */` uniform sampler2D tEquirect; @@ -9172,8 +7973,9 @@ class WebGLCubeRenderTarget extends WebGLRenderTarget { }); material.uniforms.tEquirect.value = texture; const mesh = new Mesh(geometry, material); - const currentMinFilter = texture.minFilter; // Avoid blurred poles + const currentMinFilter = texture.minFilter; + // Avoid blurred poles if (texture.minFilter === LinearMipmapLinearFilter) texture.minFilter = LinearFilter; const camera = new CubeCamera(1, 10, this); camera.update(renderer, mesh); @@ -9182,170 +7984,137 @@ class WebGLCubeRenderTarget extends WebGLRenderTarget { mesh.material.dispose(); return this; } - clear(renderer, color, depth, stencil) { const currentRenderTarget = renderer.getRenderTarget(); - for (let i = 0; i < 6; i++) { renderer.setRenderTarget(this, i); renderer.clear(color, depth, stencil); } - renderer.setRenderTarget(currentRenderTarget); } - } - WebGLCubeRenderTarget.prototype.isWebGLCubeRenderTarget = true; const _vector1 = /*@__PURE__*/new Vector3(); - const _vector2 = /*@__PURE__*/new Vector3(); - const _normalMatrix = /*@__PURE__*/new Matrix3(); - class Plane { constructor(normal = new Vector3(1, 0, 0), constant = 0) { // normal is assumed to be normalized + this.normal = normal; this.constant = constant; } - set(normal, constant) { this.normal.copy(normal); this.constant = constant; return this; } - setComponents(x, y, z, w) { this.normal.set(x, y, z); this.constant = w; return this; } - setFromNormalAndCoplanarPoint(normal, point) { this.normal.copy(normal); this.constant = -point.dot(this.normal); return this; } - setFromCoplanarPoints(a, b, c) { - const normal = _vector1.subVectors(c, b).cross(_vector2.subVectors(a, b)).normalize(); // Q: should an error be thrown if normal is zero (e.g. degenerate plane)? + const normal = _vector1.subVectors(c, b).cross(_vector2.subVectors(a, b)).normalize(); + // Q: should an error be thrown if normal is zero (e.g. degenerate plane)? this.setFromNormalAndCoplanarPoint(normal, a); return this; } - copy(plane) { this.normal.copy(plane.normal); this.constant = plane.constant; return this; } - normalize() { // Note: will lead to a divide by zero if the plane is invalid. + const inverseNormalLength = 1.0 / this.normal.length(); this.normal.multiplyScalar(inverseNormalLength); this.constant *= inverseNormalLength; return this; } - negate() { this.constant *= -1; this.normal.negate(); return this; } - distanceToPoint(point) { return this.normal.dot(point) + this.constant; } - distanceToSphere(sphere) { return this.distanceToPoint(sphere.center) - sphere.radius; } - projectPoint(point, target) { return target.copy(this.normal).multiplyScalar(-this.distanceToPoint(point)).add(point); } - intersectLine(line, target) { const direction = line.delta(_vector1); const denominator = this.normal.dot(direction); - if (denominator === 0) { // line is coplanar, return origin if (this.distanceToPoint(line.start) === 0) { return target.copy(line.start); - } // Unsure if this is the correct method to handle this case. - + } + // Unsure if this is the correct method to handle this case. return null; } - const t = -(line.start.dot(this.normal) + this.constant) / denominator; - if (t < 0 || t > 1) { return null; } - return target.copy(direction).multiplyScalar(t).add(line.start); } - intersectsLine(line) { // Note: this tests if a line intersects the plane, not whether it (or its end-points) are coplanar with it. + const startSign = this.distanceToPoint(line.start); const endSign = this.distanceToPoint(line.end); return startSign < 0 && endSign > 0 || endSign < 0 && startSign > 0; } - intersectsBox(box) { return box.intersectsPlane(this); } - intersectsSphere(sphere) { return sphere.intersectsPlane(this); } - coplanarPoint(target) { return target.copy(this.normal).multiplyScalar(-this.constant); } - applyMatrix4(matrix, optionalNormalMatrix) { const normalMatrix = optionalNormalMatrix || _normalMatrix.getNormalMatrix(matrix); - const referencePoint = this.coplanarPoint(_vector1).applyMatrix4(matrix); const normal = this.normal.applyMatrix3(normalMatrix).normalize(); this.constant = -referencePoint.dot(normal); return this; } - translate(offset) { this.constant -= offset.dot(this.normal); return this; } - equals(plane) { return plane.normal.equals(this.normal) && plane.constant === this.constant; } - clone() { return new this.constructor().copy(this); } - } - Plane.prototype.isPlane = true; const _sphere$2 = /*@__PURE__*/new Sphere(); - const _vector$7 = /*@__PURE__*/new Vector3(); - class Frustum { constructor(p0 = new Plane(), p1 = new Plane(), p2 = new Plane(), p3 = new Plane(), p4 = new Plane(), p5 = new Plane()) { this.planes = [p0, p1, p2, p3, p4, p5]; } - set(p0, p1, p2, p3, p4, p5) { const planes = this.planes; planes[0].copy(p0); @@ -9356,36 +8125,32 @@ class Frustum { planes[5].copy(p5); return this; } - copy(frustum) { const planes = this.planes; - for (let i = 0; i < 6; i++) { planes[i].copy(frustum.planes[i]); } - return this; } - setFromProjectionMatrix(m) { const planes = this.planes; const me = m.elements; const me0 = me[0], - me1 = me[1], - me2 = me[2], - me3 = me[3]; + me1 = me[1], + me2 = me[2], + me3 = me[3]; const me4 = me[4], - me5 = me[5], - me6 = me[6], - me7 = me[7]; + me5 = me[5], + me6 = me[6], + me7 = me[7]; const me8 = me[8], - me9 = me[9], - me10 = me[10], - me11 = me[11]; + me9 = me[9], + me10 = me[10], + me11 = me[11]; const me12 = me[12], - me13 = me[13], - me14 = me[14], - me15 = me[15]; + me13 = me[13], + me14 = me[14], + me15 = me[15]; planes[0].setComponents(me3 - me0, me7 - me4, me11 - me8, me15 - me12).normalize(); planes[1].setComponents(me3 + me0, me7 + me4, me11 + me8, me15 + me12).normalize(); planes[2].setComponents(me3 + me1, me7 + me5, me11 + me9, me15 + me13).normalize(); @@ -9394,85 +8159,65 @@ class Frustum { planes[5].setComponents(me3 + me2, me7 + me6, me11 + me10, me15 + me14).normalize(); return this; } - intersectsObject(object) { const geometry = object.geometry; if (geometry.boundingSphere === null) geometry.computeBoundingSphere(); - _sphere$2.copy(geometry.boundingSphere); - if (object.skeleton && object.skeleton.rootMotionBone) { const rootMotion = object.skeleton.rootMotionBone.matrixWorld.clone(); rootMotion.multiply(object.skeleton.rootMotionBoneInitialMatrixInverse); - _sphere$2.applyMatrix4(rootMotion); } else { _sphere$2.applyMatrix4(object.matrixWorld); } - return this.intersectsSphere(_sphere$2); } - intersectsSprite(sprite) { _sphere$2.center.set(0, 0, 0); - _sphere$2.radius = 0.7071067811865476; - _sphere$2.applyMatrix4(sprite.matrixWorld); - return this.intersectsSphere(_sphere$2); } - intersectsSphere(sphere) { const planes = this.planes; const center = sphere.center; const negRadius = -sphere.radius; - for (let i = 0; i < 6; i++) { const distance = planes[i].distanceToPoint(center); - if (distance < negRadius) { return false; } } - return true; } - intersectsBox(box) { const planes = this.planes; - for (let i = 0; i < 6; i++) { - const plane = planes[i]; // corner at max distance + const plane = planes[i]; + + // corner at max distance _vector$7.x = plane.normal.x > 0 ? box.max.x : box.min.x; _vector$7.y = plane.normal.y > 0 ? box.max.y : box.min.y; _vector$7.z = plane.normal.z > 0 ? box.max.z : box.min.z; - if (plane.distanceToPoint(_vector$7) < 0) { return false; } } - return true; } - containsPoint(point) { const planes = this.planes; - for (let i = 0; i < 6; i++) { if (planes[i].distanceToPoint(point) < 0) { return false; } } - return true; } - clone() { return new this.constructor().copy(this); } - } function WebGLAnimation() { @@ -9480,12 +8225,10 @@ function WebGLAnimation() { let isAnimating = false; let animationLoop = null; let requestId = null; - function onAnimationFrame(time, frame) { animationLoop(time, frame); requestId = context.requestAnimationFrame(onAnimationFrame); } - return { start: function () { if (isAnimating === true) return; @@ -9509,7 +8252,6 @@ function WebGLAnimation() { function WebGLAttributes(gl, capabilities) { const isWebGL2 = capabilities.isWebGL2; const buffers = new WeakMap(); - function createBuffer(attribute, bufferType) { const array = attribute.array; const usage = attribute.usage; @@ -9518,7 +8260,6 @@ function WebGLAttributes(gl, capabilities) { gl.bufferData(bufferType, array, usage); attribute.onUploadCallback(); let type = gl.FLOAT; - if (array instanceof Float32Array) { type = gl.FLOAT; } else if (array instanceof Float64Array) { @@ -9546,7 +8287,6 @@ function WebGLAttributes(gl, capabilities) { } else if (array instanceof Uint8ClampedArray) { type = gl.UNSIGNED_BYTE; } - return { buffer: buffer, type: type, @@ -9554,14 +8294,13 @@ function WebGLAttributes(gl, capabilities) { version: attribute.version }; } - function updateBuffer(buffer, attribute, bufferType) { const array = attribute.array; const updateRange = attribute.updateRange; gl.bindBuffer(bufferType, buffer); - if (updateRange.count === -1) { // Not using update ranges + gl.bufferSubData(bufferType, 0, array); } else { if (isWebGL2) { @@ -9569,31 +8308,27 @@ function WebGLAttributes(gl, capabilities) { } else { gl.bufferSubData(bufferType, updateRange.offset * array.BYTES_PER_ELEMENT, array.subarray(updateRange.offset, updateRange.offset + updateRange.count)); } - updateRange.count = -1; // reset range } - } // + } + // function get(attribute) { if (attribute.isInterleavedBufferAttribute) attribute = attribute.data; return buffers.get(attribute); } - function remove(attribute) { if (attribute.isInterleavedBufferAttribute) attribute = attribute.data; const data = buffers.get(attribute); - if (data) { gl.deleteBuffer(data.buffer); buffers.delete(attribute); } } - function update(attribute, bufferType) { if (attribute.isGLBufferAttribute) { const cached = buffers.get(attribute); - if (!cached || cached.version < attribute.version) { buffers.set(attribute, { buffer: attribute.buffer, @@ -9602,13 +8337,10 @@ function WebGLAttributes(gl, capabilities) { version: attribute.version }); } - return; } - if (attribute.isInterleavedBufferAttribute) attribute = attribute.data; const data = buffers.get(attribute); - if (data === undefined) { buffers.set(attribute, createBuffer(attribute, bufferType)); } else if (data.version < attribute.version) { @@ -9616,7 +8348,6 @@ function WebGLAttributes(gl, capabilities) { data.version = attribute.version; } } - return { get: get, remove: remove, @@ -9641,16 +8372,16 @@ class PlaneGeometry extends BufferGeometry { const gridX1 = gridX + 1; const gridY1 = gridY + 1; const segment_width = width / gridX; - const segment_height = height / gridY; // + const segment_height = height / gridY; + + // const indices = []; const vertices = []; const normals = []; const uvs = []; - for (let iy = 0; iy < gridY1; iy++) { const y = iy * segment_height - height_half; - for (let ix = 0; ix < gridX1; ix++) { const x = ix * segment_width - width_half; vertices.push(x, -y, 0); @@ -9659,7 +8390,6 @@ class PlaneGeometry extends BufferGeometry { uvs.push(1 - iy / gridY); } } - for (let iy = 0; iy < gridY; iy++) { for (let ix = 0; ix < gridX; ix++) { const a = ix + gridX1 * iy; @@ -9670,17 +8400,14 @@ class PlaneGeometry extends BufferGeometry { indices.push(b, c, d); } } - this.setIndex(indices); this.setAttribute('position', new Float32BufferAttribute(vertices, 3)); this.setAttribute('normal', new Float32BufferAttribute(normals, 3)); this.setAttribute('uv', new Float32BufferAttribute(uvs, 2)); } - static fromJSON(data) { return new PlaneGeometry(data.width, data.height, data.widthSegments, data.heightSegments); } - } var alphamap_fragment = "#ifdef USE_ALPHAMAP\n\tdiffuseColor.a *= texture2D( alphaMap, vUv ).g;\n#endif"; @@ -10489,10 +9216,10 @@ const ShaderLib = { vertexShader: ShaderChunk.background_vert, fragmentShader: ShaderChunk.background_frag }, - /* ------------------------------------------------------------------------- // Cube map shader ------------------------------------------------------------------------- */ + cube: { uniforms: mergeUniforms([UniformsLib.envmap, { opacity: { @@ -10624,52 +9351,45 @@ function WebGLBackground(renderer, cubemaps, state, objects, alpha, premultiplie let currentBackgroundVersion = 0; let currentTonemapping = null; let currentBgToneMapped = null; - function render(renderList, scene, renderTarget) { let forceClear = false; let background = scene.isScene === true ? scene.background : null; const bgToneMapped = scene.isScene === true ? scene.bgToneMapped : false; - if (background && background.isTexture) { background = cubemaps.get(background); - } // Ignore background in AR - // TODO: Reconsider this. + } + // Ignore background in AR + // TODO: Reconsider this. const xr = renderer.xr; const session = xr.getSession && xr.getSession(); - if (session && session.environmentBlendMode === 'additive') { background = null; } - const color = clearColor.clone(); let alpha = clearAlpha; - if (background && background.isColor) { color.set(background); alpha = 1.0; forceClear = true; } - if (background === null || background.isColor) { - const outputEncoding = renderTarget !== null ? renderer.getTextureEncodingFromMap(renderTarget.texture) : renderer.outputEncoding; // Assume background color is in sRGB color space. + const outputEncoding = renderTarget !== null ? renderer.getTextureEncodingFromMap(renderTarget.texture) : renderer.outputEncoding; + // Assume background color is in sRGB color space. if (outputEncoding === LinearEncoding) { color.convertSRGBToLinear(); } else if (outputEncoding === RGBEEncoding) { color.convertSRGBToLinear(); alpha = 128.0 / 255.0; // Exponent will be 0. } - const premultiplyAlpha = renderTarget != null ? renderTarget.texture.premultiplyAlpha : premultipliedAlpha; setClear(color, alpha, premultiplyAlpha); } - if (renderer.autoClear || forceClear) { renderer.clear(renderer.autoClearColor, renderer.autoClearDepth, renderer.autoClearStencil); } - if (background && (background.isCubeTexture || background.mapping === CubeUVReflectionMapping)) { if (boxMesh === undefined) { boxMesh = new Mesh(new BoxGeometry(1, 1, 1), new ShaderMaterial({ @@ -10685,12 +9405,11 @@ function WebGLBackground(renderer, cubemaps, state, objects, alpha, premultiplie boxMesh.layers.enableAll(); boxMesh.geometry.deleteAttribute('normal'); boxMesh.geometry.deleteAttribute('uv'); - boxMesh.onBeforeRender = function (renderer, scene, camera) { this.matrixWorld.copyPosition(camera.matrixWorld); - }; // enable code injection for non-built-in material - + }; + // enable code injection for non-built-in material Object.defineProperty(boxMesh.material, 'envMap', { get: function () { return this.uniforms.envMap.value; @@ -10698,20 +9417,18 @@ function WebGLBackground(renderer, cubemaps, state, objects, alpha, premultiplie }); objects.update(boxMesh); } - boxMesh.material.toneMapped = bgToneMapped; boxMesh.material.uniforms.envMap.value = background; boxMesh.material.uniforms.flipEnvMap.value = background.isCubeTexture && background.isRenderTargetTexture === false ? -1 : 1; - if (currentBackground !== background || currentBackgroundVersion !== background.version || currentTonemapping !== renderer.toneMapping || currentBgToneMapped !== bgToneMapped) { boxMesh.material.needsUpdate = true; currentBackground = background; currentBackgroundVersion = background.version; currentTonemapping = renderer.toneMapping; currentBgToneMapped = bgToneMapped; - } // push to the pre-sorted opaque render list - + } + // push to the pre-sorted opaque render list renderList.unshift(boxMesh, boxMesh.geometry, boxMesh.material, 0, 0, null); } else if (background && background.isTexture) { if (planeMesh === undefined) { @@ -10726,8 +9443,9 @@ function WebGLBackground(renderer, cubemaps, state, objects, alpha, premultiplie fog: false })); planeMesh.layers.enableAll(); - planeMesh.geometry.deleteAttribute('normal'); // enable code injection for non-built-in material + planeMesh.geometry.deleteAttribute('normal'); + // enable code injection for non-built-in material Object.defineProperty(planeMesh.material, 'map', { get: function () { return this.uniforms.t2D.value; @@ -10735,33 +9453,27 @@ function WebGLBackground(renderer, cubemaps, state, objects, alpha, premultiplie }); objects.update(planeMesh); } - planeMesh.material.toneMapped = bgToneMapped; planeMesh.material.uniforms.t2D.value = background; - if (background.matrixAutoUpdate === true) { background.updateMatrix(); } - planeMesh.material.uniforms.uvTransform.value.copy(background.matrix); - if (currentBackground !== background || currentBackgroundVersion !== background.version || currentTonemapping !== renderer.toneMapping || currentBgToneMapped !== bgToneMapped) { planeMesh.material.needsUpdate = true; currentBackground = background; currentBackgroundVersion = background.version; currentTonemapping = renderer.toneMapping; currentBgToneMapped = bgToneMapped; - } // push to the pre-sorted opaque render list - + } + // push to the pre-sorted opaque render list renderList.unshift(planeMesh, planeMesh.geometry, planeMesh.material, 0, 0, null); } } - function setClear(color, alpha, premultiplyAlpha) { state.buffers.color.setClear(color.r, color.g, color.b, alpha, premultiplyAlpha); } - return { getClearColor: function () { return clearColor; @@ -10789,23 +9501,18 @@ function WebGLBindingStates(gl, extensions, attributes, capabilities) { const bindingStates = {}; const defaultState = createBindingState(null); let currentState = defaultState; - function setup(object, material, program, geometry, index) { let updateBuffers = false; - if (vaoAvailable) { const state = getBindingState(geometry, program, material); - if (currentState !== state) { currentState = state; bindVertexArrayObject(currentState.object); } - updateBuffers = needsUpdate(geometry, index); if (updateBuffers) saveCache(geometry, index); } else { const wireframe = material.wireframe === true; - if (currentState.geometry !== geometry.id || currentState.program !== program.id || currentState.wireframe !== wireframe) { currentState.geometry = geometry.id; currentState.program = program.id; @@ -10813,76 +9520,59 @@ function WebGLBindingStates(gl, extensions, attributes, capabilities) { updateBuffers = true; } } - if (object.isInstancedMesh === true) { updateBuffers = true; } - if (index !== null) { attributes.update(index, gl.ELEMENT_ARRAY_BUFFER); } - if (updateBuffers) { setupVertexAttributes(object, material, program, geometry); - if (index !== null) { gl.bindBuffer(gl.ELEMENT_ARRAY_BUFFER, attributes.get(index).buffer); } } } - function createVertexArrayObject() { if (capabilities.isWebGL2) return gl.createVertexArray(); return extension.createVertexArrayOES(); } - function bindVertexArrayObject(vao) { if (capabilities.isWebGL2) return gl.bindVertexArray(vao); return extension.bindVertexArrayOES(vao); } - function deleteVertexArrayObject(vao) { if (capabilities.isWebGL2) return gl.deleteVertexArray(vao); return extension.deleteVertexArrayOES(vao); } - function getBindingState(geometry, program, material) { const wireframe = material.wireframe === true; let programMap = bindingStates[geometry.id]; - if (programMap === undefined) { programMap = {}; bindingStates[geometry.id] = programMap; } - let stateMap = programMap[program.id]; - if (stateMap === undefined) { stateMap = {}; programMap[program.id] = stateMap; } - let state = stateMap[wireframe]; - if (state === undefined) { state = createBindingState(createVertexArrayObject()); stateMap[wireframe] = state; } - return state; } - function createBindingState(vao) { const newAttributes = []; const enabledAttributes = []; const attributeDivisors = []; - for (let i = 0; i < maxVertexAttributes; i++) { newAttributes[i] = 0; enabledAttributes[i] = 0; attributeDivisors[i] = 0; } - return { // for backward compatibility on non-VAO support browser geometry: null, @@ -10896,12 +9586,10 @@ function WebGLBindingStates(gl, extensions, attributes, capabilities) { index: null }; } - function needsUpdate(geometry, index) { const cachedAttributes = currentState.attributes; const geometryAttributes = geometry.attributes; let attributesNum = 0; - for (const key in geometryAttributes) { const cachedAttribute = cachedAttributes[key]; const geometryAttribute = geometryAttributes[key]; @@ -10910,69 +9598,55 @@ function WebGLBindingStates(gl, extensions, attributes, capabilities) { if (cachedAttribute.data !== geometryAttribute.data) return true; attributesNum++; } - if (currentState.attributesNum !== attributesNum) return true; if (currentState.index !== index) return true; return false; } - function saveCache(geometry, index) { const cache = {}; const attributes = geometry.attributes; let attributesNum = 0; - for (const key in attributes) { const attribute = attributes[key]; const data = {}; data.attribute = attribute; - if (attribute.data) { data.data = attribute.data; } - cache[key] = data; attributesNum++; } - currentState.attributes = cache; currentState.attributesNum = attributesNum; currentState.index = index; } - function initAttributes() { const newAttributes = currentState.newAttributes; - for (let i = 0, il = newAttributes.length; i < il; i++) { newAttributes[i] = 0; } } - function enableAttribute(attribute) { enableAttributeAndDivisor(attribute, 0); } - function enableAttributeAndDivisor(attribute, meshPerAttribute) { const newAttributes = currentState.newAttributes; const enabledAttributes = currentState.enabledAttributes; const attributeDivisors = currentState.attributeDivisors; newAttributes[attribute] = 1; - if (enabledAttributes[attribute] === 0) { gl.enableVertexAttribArray(attribute); enabledAttributes[attribute] = 1; } - if (attributeDivisors[attribute] !== meshPerAttribute) { const extension = capabilities.isWebGL2 ? gl : extensions.get('ANGLE_instanced_arrays'); extension[capabilities.isWebGL2 ? 'vertexAttribDivisor' : 'vertexAttribDivisorANGLE'](attribute, meshPerAttribute); attributeDivisors[attribute] = meshPerAttribute; } } - function disableUnusedAttributes() { const newAttributes = currentState.newAttributes; const enabledAttributes = currentState.enabledAttributes; - for (let i = 0, il = enabledAttributes.length; i < il; i++) { if (enabledAttributes[i] !== newAttributes[i]) { gl.disableVertexAttribArray(i); @@ -10980,7 +9654,6 @@ function WebGLBindingStates(gl, extensions, attributes, capabilities) { } } } - function vertexAttribPointer(index, size, type, normalized, stride, offset) { if (capabilities.isWebGL2 === true && (type === gl.INT || type === gl.UNSIGNED_INT)) { gl.vertexAttribIPointer(index, size, type, stride, offset); @@ -10988,48 +9661,41 @@ function WebGLBindingStates(gl, extensions, attributes, capabilities) { gl.vertexAttribPointer(index, size, type, normalized, stride, offset); } } - function setupVertexAttributes(object, material, program, geometry) { if (capabilities.isWebGL2 === false && (object.isInstancedMesh || geometry.isInstancedBufferGeometry)) { if (extensions.get('ANGLE_instanced_arrays') === null) return; } - initAttributes(); const geometryAttributes = geometry.attributes; const programAttributes = program.getAttributes(); const materialDefaultAttributeValues = material.defaultAttributeValues; - for (const name in programAttributes) { const programAttribute = programAttributes[name]; - if (programAttribute.location >= 0) { let geometryAttribute = geometryAttributes[name]; - if (geometryAttribute === undefined) { if (name === 'instanceMatrix' && object.instanceMatrix) geometryAttribute = object.instanceMatrix; if (name === 'instanceColor' && object.instanceColor) geometryAttribute = object.instanceColor; } - if (geometryAttribute !== undefined) { const normalized = geometryAttribute.normalized; const size = geometryAttribute.itemSize; - const attribute = attributes.get(geometryAttribute); // TODO Attribute may not be available on context restore + const attribute = attributes.get(geometryAttribute); + + // TODO Attribute may not be available on context restore if (attribute === undefined) continue; const buffer = attribute.buffer; const type = attribute.type; const bytesPerElement = attribute.bytesPerElement; - if (geometryAttribute.isInterleavedBufferAttribute) { const data = geometryAttribute.data; const stride = data.stride; const offset = geometryAttribute.offset; - if (data && data.isInstancedInterleavedBuffer) { for (let i = 0; i < programAttribute.locationSize; i++) { enableAttributeAndDivisor(programAttribute.location + i, data.meshPerAttribute); } - if (object.isInstancedMesh !== true && geometry._maxInstanceCount === undefined) { geometry._maxInstanceCount = data.meshPerAttribute * data.count; } @@ -11038,9 +9704,7 @@ function WebGLBindingStates(gl, extensions, attributes, capabilities) { enableAttribute(programAttribute.location + i); } } - gl.bindBuffer(gl.ARRAY_BUFFER, buffer); - for (let i = 0; i < programAttribute.locationSize; i++) { vertexAttribPointer(programAttribute.location + i, size / programAttribute.locationSize, type, normalized, stride * bytesPerElement, (offset + size / programAttribute.locationSize * i) * bytesPerElement); } @@ -11049,7 +9713,6 @@ function WebGLBindingStates(gl, extensions, attributes, capabilities) { for (let i = 0; i < programAttribute.locationSize; i++) { enableAttributeAndDivisor(programAttribute.location + i, geometryAttribute.meshPerAttribute); } - if (object.isInstancedMesh !== true && geometry._maxInstanceCount === undefined) { geometry._maxInstanceCount = geometryAttribute.meshPerAttribute * geometryAttribute.count; } @@ -11058,30 +9721,24 @@ function WebGLBindingStates(gl, extensions, attributes, capabilities) { enableAttribute(programAttribute.location + i); } } - gl.bindBuffer(gl.ARRAY_BUFFER, buffer); - for (let i = 0; i < programAttribute.locationSize; i++) { vertexAttribPointer(programAttribute.location + i, size / programAttribute.locationSize, type, normalized, size * bytesPerElement, size / programAttribute.locationSize * i * bytesPerElement); } } } else if (materialDefaultAttributeValues !== undefined) { const value = materialDefaultAttributeValues[name]; - if (value !== undefined) { switch (value.length) { case 2: gl.vertexAttrib2fv(programAttribute.location, value); break; - case 3: gl.vertexAttrib3fv(programAttribute.location, value); break; - case 4: gl.vertexAttrib4fv(programAttribute.location, value); break; - default: gl.vertexAttrib1fv(programAttribute.location, value); } @@ -11089,78 +9746,62 @@ function WebGLBindingStates(gl, extensions, attributes, capabilities) { } } } - disableUnusedAttributes(); } - function dispose() { reset(); - for (const geometryId in bindingStates) { const programMap = bindingStates[geometryId]; - for (const programId in programMap) { const stateMap = programMap[programId]; - for (const wireframe in stateMap) { deleteVertexArrayObject(stateMap[wireframe].object); delete stateMap[wireframe]; } - delete programMap[programId]; } - delete bindingStates[geometryId]; } } - function releaseStatesOfGeometry(geometry) { if (bindingStates[geometry.id] === undefined) return; const programMap = bindingStates[geometry.id]; - for (const programId in programMap) { const stateMap = programMap[programId]; - for (const wireframe in stateMap) { deleteVertexArrayObject(stateMap[wireframe].object); delete stateMap[wireframe]; } - delete programMap[programId]; } - delete bindingStates[geometry.id]; } - function releaseStatesOfProgram(program) { for (const geometryId in bindingStates) { const programMap = bindingStates[geometryId]; if (programMap[program.id] === undefined) continue; const stateMap = programMap[program.id]; - for (const wireframe in stateMap) { deleteVertexArrayObject(stateMap[wireframe].object); delete stateMap[wireframe]; } - delete programMap[program.id]; } } - function reset() { resetDefaultState(); if (currentState === defaultState) return; currentState = defaultState; bindVertexArrayObject(currentState.object); - } // for backward-compatilibity + } + // for backward-compatilibity function resetDefaultState() { defaultState.geometry = null; defaultState.program = null; defaultState.wireframe = false; } - return { setup: setup, reset: reset, @@ -11177,37 +9818,32 @@ function WebGLBindingStates(gl, extensions, attributes, capabilities) { function WebGLBufferRenderer(gl, extensions, info, capabilities) { const isWebGL2 = capabilities.isWebGL2; let mode; - function setMode(value) { mode = value; } - function render(start, count) { gl.drawArrays(mode, start, count); info.update(count, mode, 1); } - function renderInstances(start, count, primcount) { if (primcount === 0) return; let extension, methodName; - if (isWebGL2) { extension = gl; methodName = 'drawArraysInstanced'; } else { extension = extensions.get('ANGLE_instanced_arrays'); methodName = 'drawArraysInstancedANGLE'; - if (extension === null) { console.error('THREE.WebGLBufferRenderer: using THREE.InstancedBufferGeometry but hardware does not support extension ANGLE_instanced_arrays.'); return; } } - extension[methodName](mode, start, count, primcount); info.update(count, mode, primcount); - } // + } + // this.setMode = setMode; this.render = render; @@ -11216,47 +9852,37 @@ function WebGLBufferRenderer(gl, extensions, info, capabilities) { function WebGLCapabilities(gl, extensions, parameters) { let maxAnisotropy; - function getMaxAnisotropy() { if (maxAnisotropy !== undefined) return maxAnisotropy; - if (extensions.has('EXT_texture_filter_anisotropic') === true) { const extension = extensions.get('EXT_texture_filter_anisotropic'); maxAnisotropy = gl.getParameter(extension.MAX_TEXTURE_MAX_ANISOTROPY_EXT); } else { maxAnisotropy = 0; } - return maxAnisotropy; } - function getMaxPrecision(precision) { if (precision === 'highp') { if (gl.getShaderPrecisionFormat(gl.VERTEX_SHADER, gl.HIGH_FLOAT).precision > 0 && gl.getShaderPrecisionFormat(gl.FRAGMENT_SHADER, gl.HIGH_FLOAT).precision > 0) { return 'highp'; } - precision = 'mediump'; } - if (precision === 'mediump') { if (gl.getShaderPrecisionFormat(gl.VERTEX_SHADER, gl.MEDIUM_FLOAT).precision > 0 && gl.getShaderPrecisionFormat(gl.FRAGMENT_SHADER, gl.MEDIUM_FLOAT).precision > 0) { return 'mediump'; } } - return 'lowp'; } - const isWebGL2 = typeof WebGL2RenderingContext !== 'undefined' && gl instanceof WebGL2RenderingContext || typeof WebGL2ComputeRenderingContext !== 'undefined' && gl instanceof WebGL2ComputeRenderingContext; let precision = parameters.precision !== undefined ? parameters.precision : 'highp'; const maxPrecision = getMaxPrecision(precision); - if (maxPrecision !== precision) { console.warn('THREE.WebGLRenderer:', precision, 'not supported, using', maxPrecision, 'instead.'); precision = maxPrecision; } - const drawBuffers = isWebGL2 || extensions.has('WEBGL_draw_buffers'); const logarithmicDepthBuffer = parameters.logarithmicDepthBuffer === true; const maxTextures = gl.getParameter(gl.MAX_TEXTURE_IMAGE_UNITS); @@ -11296,21 +9922,21 @@ function WebGLCapabilities(gl, extensions, parameters) { function WebGLClipping(properties) { const scope = this; let globalState = null, - numGlobalPlanes = 0, - localClippingEnabled = false, - renderingShadows = false; + numGlobalPlanes = 0, + localClippingEnabled = false, + renderingShadows = false; const plane = new Plane(), - viewNormalMatrix = new Matrix3(), - uniform = { - value: null, - needsUpdate: false - }; + viewNormalMatrix = new Matrix3(), + uniform = { + value: null, + needsUpdate: false + }; this.uniform = uniform; this.numPlanes = 0; this.numIntersection = 0; - this.init = function (planes, enableLocalClipping, camera) { - const enabled = planes.length !== 0 || enableLocalClipping || // enable state of previous frame - the clipping code has to + const enabled = planes.length !== 0 || enableLocalClipping || + // enable state of previous frame - the clipping code has to // run another frame in order to reset the state: numGlobalPlanes !== 0 || localClippingEnabled; localClippingEnabled = enableLocalClipping; @@ -11318,86 +9944,73 @@ function WebGLClipping(properties) { numGlobalPlanes = planes.length; return enabled; }; - this.beginShadows = function () { renderingShadows = true; projectPlanes(null); }; - this.endShadows = function () { renderingShadows = false; resetGlobalState(); }; - this.setState = function (material, camera, useCache) { const planes = material.clippingPlanes, - clipIntersection = material.clipIntersection, - clipShadows = material.clipShadows; + clipIntersection = material.clipIntersection, + clipShadows = material.clipShadows; const materialProperties = properties.get(material); - if (!localClippingEnabled || planes === null || planes.length === 0 || renderingShadows && !clipShadows) { // there's no local clipping + if (renderingShadows) { // there's no global clipping + projectPlanes(null); } else { resetGlobalState(); } } else { const nGlobal = renderingShadows ? 0 : numGlobalPlanes, - lGlobal = nGlobal * 4; + lGlobal = nGlobal * 4; let dstArray = materialProperties.clippingState || null; uniform.value = dstArray; // ensure unique state dstArray = projectPlanes(planes, camera, lGlobal, useCache); - for (let i = 0; i !== lGlobal; ++i) { dstArray[i] = globalState[i]; } - materialProperties.clippingState = dstArray; this.numIntersection = clipIntersection ? this.numPlanes : 0; this.numPlanes += nGlobal; } }; - function resetGlobalState() { if (uniform.value !== globalState) { uniform.value = globalState; uniform.needsUpdate = numGlobalPlanes > 0; } - scope.numPlanes = numGlobalPlanes; scope.numIntersection = 0; } - function projectPlanes(planes, camera, dstOffset, skipTransform) { const nPlanes = planes !== null ? planes.length : 0; let dstArray = null; - if (nPlanes !== 0) { dstArray = uniform.value; - if (skipTransform !== true || dstArray === null) { const flatSize = dstOffset + nPlanes * 4, - viewMatrix = camera.matrixWorldInverse; + viewMatrix = camera.matrixWorldInverse; viewNormalMatrix.getNormalMatrix(viewMatrix); - if (dstArray === null || dstArray.length < flatSize) { dstArray = new Float32Array(flatSize); } - for (let i = 0, i4 = dstOffset; i !== nPlanes; ++i, i4 += 4) { plane.copy(planes[i]).applyMatrix4(viewMatrix, viewNormalMatrix); plane.normal.toArray(dstArray, i4); dstArray[i4 + 3] = plane.constant; } } - uniform.value = dstArray; uniform.needsUpdate = true; } - scope.numPlanes = nPlanes; scope.numIntersection = 0; return dstArray; @@ -11406,28 +10019,23 @@ function WebGLClipping(properties) { function WebGLCubeMaps(renderer) { let cubemaps = new WeakMap(); - function mapTextureMapping(texture, mapping) { if (mapping === EquirectangularReflectionMapping) { texture.mapping = CubeReflectionMapping; } else if (mapping === EquirectangularRefractionMapping) { texture.mapping = CubeRefractionMapping; } - return texture; } - function get(texture) { if (texture && texture.isTexture && texture.isRenderTargetTexture === false) { const mapping = texture.mapping; - if (mapping === EquirectangularReflectionMapping || mapping === EquirectangularRefractionMapping) { if (cubemaps.has(texture)) { const cubemap = cubemaps.get(texture).texture; return mapTextureMapping(cubemap, texture.mapping); } else { const image = texture.image; - if (image && image.height > 0) { const renderTarget = new WebGLCubeRenderTarget(image.height / 2); renderTarget.fromEquirectangularTexture(renderer, texture); @@ -11436,30 +10044,26 @@ function WebGLCubeMaps(renderer) { return mapTextureMapping(renderTarget.texture, texture.mapping); } else { // image not yet ready. try the conversion next frame + return null; } } } } - return texture; } - function onTextureDispose(event) { const texture = event.target; texture.removeEventListener('dispose', onTextureDispose); const cubemap = cubemaps.get(texture); - if (cubemap !== undefined) { cubemaps.delete(texture); cubemap.dispose(); } } - function dispose() { cubemaps = new WeakMap(); } - return { get: get, dispose: dispose @@ -11480,7 +10084,6 @@ class OrthographicCamera extends Camera { this.far = far; this.updateProjectionMatrix(); } - copy(source, recursive) { super.copy(source, recursive); this.left = source.left; @@ -11493,7 +10096,6 @@ class OrthographicCamera extends Camera { this.view = source.view === null ? null : Object.assign({}, source.view); return this; } - setViewOffset(fullWidth, fullHeight, x, y, width, height) { if (this.view === null) { this.view = { @@ -11506,7 +10108,6 @@ class OrthographicCamera extends Camera { height: 1 }; } - this.view.enabled = true; this.view.fullWidth = fullWidth; this.view.fullHeight = fullHeight; @@ -11516,15 +10117,12 @@ class OrthographicCamera extends Camera { this.view.height = height; this.updateProjectionMatrix(); } - clearViewOffset() { if (this.view !== null) { this.view.enabled = false; } - this.updateProjectionMatrix(); } - updateProjectionMatrix() { const dx = (this.right - this.left) / (2 * this.zoom); const dy = (this.top - this.bottom) / (2 * this.zoom); @@ -11534,7 +10132,6 @@ class OrthographicCamera extends Camera { let right = cx + dx; let top = cy + dy; let bottom = cy - dy; - if (this.view !== null && this.view.enabled) { const scaleW = (this.right - this.left) / this.view.fullWidth / this.zoom; const scaleH = (this.top - this.bottom) / this.view.fullHeight / this.zoom; @@ -11543,11 +10140,9 @@ class OrthographicCamera extends Camera { top -= scaleH * this.view.offsetY; bottom = top - scaleH * this.view.height; } - this.projectionMatrix.makeOrthographic(left, right, top, bottom, this.near, this.far); this.projectionMatrixInverse.copy(this.projectionMatrix).invert(); } - toJSON(meta) { const data = super.toJSON(meta); data.object.zoom = this.zoom; @@ -11560,9 +10155,7 @@ class OrthographicCamera extends Camera { if (this.view !== null) data.object.view = Object.assign({}, this.view); return data; } - } - OrthographicCamera.prototype.isOrthographicCamera = true; class RawShaderMaterial extends ShaderMaterial { @@ -11570,46 +10163,45 @@ class RawShaderMaterial extends ShaderMaterial { super(parameters); this.type = 'RawShaderMaterial'; } - } - RawShaderMaterial.prototype.isRawShaderMaterial = true; const LOD_MIN = 4; const LOD_MAX = 8; -const SIZE_MAX = Math.pow(2, LOD_MAX); // The standard deviations (radians) associated with the extra mips. These are +const SIZE_MAX = Math.pow(2, LOD_MAX); + +// The standard deviations (radians) associated with the extra mips. These are // chosen to approximate a Trowbridge-Reitz distribution function times the // geometric shadowing function. These sigma values squared must match the // variance #defines in cube_uv_reflection_fragment.glsl.js. - const EXTRA_LOD_SIGMA = [0.125, 0.215, 0.35, 0.446, 0.526, 0.582]; -const TOTAL_LODS = LOD_MAX - LOD_MIN + 1 + EXTRA_LOD_SIGMA.length; // The maximum length of the blur for loop. Smaller sigmas will use fewer -// samples and exit early, but not recompile the shader. +const TOTAL_LODS = LOD_MAX - LOD_MIN + 1 + EXTRA_LOD_SIGMA.length; +// The maximum length of the blur for loop. Smaller sigmas will use fewer +// samples and exit early, but not recompile the shader. const MAX_SAMPLES = 20; const ENCODINGS = { [LinearEncoding]: 0, [sRGBEncoding]: 1, [RGBEEncoding]: 2 }; - const _flatCamera = /*@__PURE__*/new OrthographicCamera(); - const { _lodPlanes, _sizeLods, _sigmas } = /*@__PURE__*/_createPlanes(); - const _clearColor = /*@__PURE__*/new Color(); +let _oldTarget = null; -let _oldTarget = null; // Golden Ratio - +// Golden Ratio const PHI = (1 + Math.sqrt(5)) / 2; -const INV_PHI = 1 / PHI; // Vertices of a dodecahedron (except the opposites, which represent the -// same axis), used as axis directions evenly spread on a sphere. +const INV_PHI = 1 / PHI; +// Vertices of a dodecahedron (except the opposites, which represent the +// same axis), used as axis directions evenly spread on a sphere. const _axisDirections = [/*@__PURE__*/new Vector3(1, 1, 1), /*@__PURE__*/new Vector3(-1, 1, 1), /*@__PURE__*/new Vector3(1, 1, -1), /*@__PURE__*/new Vector3(-1, 1, -1), /*@__PURE__*/new Vector3(0, PHI, INV_PHI), /*@__PURE__*/new Vector3(0, PHI, -INV_PHI), /*@__PURE__*/new Vector3(INV_PHI, 0, PHI), /*@__PURE__*/new Vector3(-INV_PHI, 0, PHI), /*@__PURE__*/new Vector3(PHI, INV_PHI, 0), /*@__PURE__*/new Vector3(-PHI, INV_PHI, 0)]; + /** * This class generates a Prefiltered, Mipmapped Radiance Environment Map * (PMREM) from a cubeMap environment texture. This allows different levels of @@ -11633,9 +10225,9 @@ class PMREMGenerator { this._flipCubeUVMaxLevelTileShader = null; this._equirectShader = null; this._cubemapShader = null; - this._compileMaterial(this._blurMaterial); } + /** * Generates a PMREM from a supplied Scene, which can be faster than using an * image if networking bandwidth is low. Optional sigma specifies a blur radius @@ -11643,118 +10235,93 @@ class PMREMGenerator { * and far planes ensure the scene is rendered in its entirety (the cubeCamera * is placed at the origin). */ - - fromScene(scene, sigma = 0, near = 0.1, far = 100) { _oldTarget = this._renderer.getRenderTarget(); - const cubeUVRenderTarget = this._allocateTargets(); - this._sceneToCubeUV(scene, near, far, this._pingPongRenderTarget); - this._flipCubeUVMaxLevelTile(this._pingPongRenderTarget, cubeUVRenderTarget); - if (sigma > 0) { this._blur(cubeUVRenderTarget, 0, 0, sigma); } - this._applyPMREM(cubeUVRenderTarget); - this._cleanup(cubeUVRenderTarget); - return cubeUVRenderTarget; } + /** * Generates a PMREM from an equirectangular texture, which can be either LDR * (RGBFormat) or HDR (RGBEFormat). The ideal input image size is 1k (1024 x 512), * as this matches best with the 256 x 256 cubemap output. */ - - fromEquirectangular(equirectangular, renderTarget = null) { return this._fromTexture(equirectangular, renderTarget); } + /** * Generates a PMREM from an cubemap texture, which can be either LDR * (RGBFormat) or HDR (RGBEFormat). The ideal input cube size is 256 x 256, * as this matches best with the 256 x 256 cubemap output. */ - - fromCubemap(cubemap, renderTarget = null) { return this._fromTexture(cubemap, renderTarget); } + /** * Pre-compiles the cubemap shader. You can get faster start-up by invoking this method during * your texture's network fetch for increased concurrency. */ - - compileCubemapShader() { if (this._cubemapShader === null) { this._cubemapShader = _getCubemapShader(); - this._compileMaterial(this._cubemapShader); } } + /** * Pre-compiles the equirectangular shader. You can get faster start-up by invoking this method during * your texture's network fetch for increased concurrency. */ - - compileEquirectangularShader() { if (this._equirectShader === null) { this._equirectShader = _getEquirectShader(); - this._compileMaterial(this._equirectShader); } } + /** * Disposes of the PMREMGenerator's internal memory. Note that PMREMGenerator is a static class, * so you should not need more than one PMREMGenerator object. If you do, calling dispose() on * one of them will cause any others to also become unusable. */ - - dispose() { this._blurMaterial.dispose(); - if (this._pingPongRenderTarget !== null) this._pingPongRenderTarget.dispose(); if (this._flipCubeUVMaxLevelTileShader !== null) this._flipCubeUVMaxLevelTileShader.dispose(); if (this._cubemapShader !== null) this._cubemapShader.dispose(); if (this._equirectShader !== null) this._equirectShader.dispose(); - for (let i = 0; i < _lodPlanes.length; i++) { _lodPlanes[i].dispose(); } - } // private interface + } + // private interface _cleanup(outputTarget) { this._renderer.setRenderTarget(_oldTarget); - outputTarget.scissorTest = false; - _setViewport(outputTarget, 0, 0, outputTarget.width, outputTarget.height); } - _fromTexture(texture, renderTarget) { _oldTarget = this._renderer.getRenderTarget(); - const cubeUVRenderTarget = renderTarget || this._allocateTargets(texture); - this._textureToCubeUV(texture, cubeUVRenderTarget); - this._applyPMREM(cubeUVRenderTarget); - this._cleanup(cubeUVRenderTarget); - return cubeUVRenderTarget; } - _allocateTargets(texture) { // warning: null texture is valid + const params = { magFilter: NearestFilter, minFilter: NearestFilter, @@ -11764,24 +10331,17 @@ class PMREMGenerator { encoding: RGBEEncoding, depthBuffer: false }; - const cubeUVRenderTarget = _createRenderTarget(params); - cubeUVRenderTarget.depthBuffer = texture ? false : true; - if (this._pingPongRenderTarget === null) { this._pingPongRenderTarget = _createRenderTarget(params); } - return cubeUVRenderTarget; } - _compileMaterial(material) { const tmpMesh = new Mesh(_lodPlanes[0], material); - this._renderer.compile(tmpMesh, _flatCamera); } - _sceneToCubeUV(scene, near, far, cubeUVRenderTarget) { const fov = 90; const aspect = 1; @@ -11805,7 +10365,6 @@ class PMREMGenerator { const backgroundBox = new Mesh(new BoxGeometry(), backgroundMaterial); let useSolidColor = false; const background = scene.background; - if (background) { if (background.isColor) { backgroundMaterial.color.copy(background); @@ -11816,10 +10375,8 @@ class PMREMGenerator { backgroundMaterial.color.copy(_clearColor); useSolidColor = true; } - for (let i = 0; i < 6; i++) { const col = i % 3; - if (col === 0) { cubeCamera.up.set(0, upSign[i], 0); cubeCamera.lookAt(forwardSign[i], 0, 0); @@ -11830,18 +10387,13 @@ class PMREMGenerator { cubeCamera.up.set(0, upSign[i], 0); cubeCamera.lookAt(0, 0, forwardSign[i]); } - _setViewport(cubeUVRenderTarget, col * SIZE_MAX, i > 2 ? SIZE_MAX : 0, SIZE_MAX, SIZE_MAX); - renderer.setRenderTarget(cubeUVRenderTarget); - if (useSolidColor) { renderer.render(backgroundBox, cubeCamera); } - renderer.render(scene, cubeCamera); } - backgroundBox.geometry.dispose(); backgroundBox.material.dispose(); renderer.toneMapping = toneMapping; @@ -11849,60 +10401,47 @@ class PMREMGenerator { renderer.autoClear = originalAutoClear; scene.background = background; } - _setEncoding(uniform, texture) { uniform.value = ENCODINGS[this._renderer.getTextureEncodingFromMap(texture)]; } - _textureToCubeUV(texture, cubeUVRenderTarget) { const renderer = this._renderer; const isCubeTexture = texture.mapping === CubeReflectionMapping || texture.mapping === CubeRefractionMapping; - if (isCubeTexture) { if (this._cubemapShader === null) { this._cubemapShader = _getCubemapShader(); } - this._cubemapShader.uniforms.flipEnvMap.value = texture.isRenderTargetTexture === false ? -1 : 1; } else { if (this._equirectShader === null) { this._equirectShader = _getEquirectShader(); } } - const material = isCubeTexture ? this._cubemapShader : this._equirectShader; const mesh = new Mesh(_lodPlanes[0], material); const uniforms = material.uniforms; uniforms['envMap'].value = texture; - if (!isCubeTexture) { uniforms['texelSize'].value.set(1.0 / texture.image.width, 1.0 / texture.image.height); } - this._setEncoding(uniforms['inputEncoding'], texture); - this._setEncoding(uniforms['outputEncoding'], cubeUVRenderTarget.texture); - _setViewport(cubeUVRenderTarget, 0, 0, 3 * SIZE_MAX, 2 * SIZE_MAX); - renderer.setRenderTarget(cubeUVRenderTarget); renderer.render(mesh, _flatCamera); } - _applyPMREM(cubeUVRenderTarget) { const renderer = this._renderer; const autoClear = renderer.autoClear; renderer.autoClear = false; - for (let i = 1; i < TOTAL_LODS; i++) { const sigma = Math.sqrt(_sigmas[i] * _sigmas[i] - _sigmas[i - 1] * _sigmas[i - 1]); const poleAxis = _axisDirections[(i - 1) % _axisDirections.length]; - this._blur(cubeUVRenderTarget, i - 1, i, sigma, poleAxis); } - renderer.autoClear = autoClear; } + /** * This is a two-pass Gaussian blur for a cubemap. Normally this is done * vertically and horizontally, but this breaks down on a cube. Here we apply @@ -11910,25 +10449,19 @@ class PMREMGenerator { * the poles) to approximate the orthogonally-separable blur. It is least * accurate at the poles, but still does a decent job. */ - - _blur(cubeUVRenderTarget, lodIn, lodOut, sigma, poleAxis) { const pingPongRenderTarget = this._pingPongRenderTarget; - this._halfBlur(cubeUVRenderTarget, pingPongRenderTarget, lodIn, lodOut, sigma, 'latitudinal', poleAxis); - this._halfBlur(pingPongRenderTarget, cubeUVRenderTarget, lodOut, lodOut, sigma, 'longitudinal', poleAxis); } - _halfBlur(targetIn, targetOut, lodIn, lodOut, sigmaRadians, direction, poleAxis) { const renderer = this._renderer; const blurMaterial = this._blurMaterial; - if (direction !== 'latitudinal' && direction !== 'longitudinal') { console.error('blur direction must be either latitudinal or longitudinal!'); - } // Number of standard deviations at which to cut off the discrete approximation. - + } + // Number of standard deviations at which to cut off the discrete approximation. const STANDARD_DEVIATIONS = 3; const blurMesh = new Mesh(_lodPlanes[lodOut], blurMaterial); const blurUniforms = blurMaterial.uniforms; @@ -11936,101 +10469,73 @@ class PMREMGenerator { const radiansPerPixel = isFinite(sigmaRadians) ? Math.PI / (2 * pixels) : 2 * Math.PI / (2 * MAX_SAMPLES - 1); const sigmaPixels = sigmaRadians / radiansPerPixel; const samples = isFinite(sigmaRadians) ? 1 + Math.floor(STANDARD_DEVIATIONS * sigmaPixels) : MAX_SAMPLES; - if (samples > MAX_SAMPLES) { console.warn(`sigmaRadians, ${sigmaRadians}, is too large and will clip, as it requested ${samples} samples when the maximum is set to ${MAX_SAMPLES}`); } - const weights = []; let sum = 0; - for (let i = 0; i < MAX_SAMPLES; ++i) { const x = i / sigmaPixels; const weight = Math.exp(-x * x / 2); weights.push(weight); - if (i === 0) { sum += weight; } else if (i < samples) { sum += 2 * weight; } } - for (let i = 0; i < weights.length; i++) { weights[i] = weights[i] / sum; } - blurUniforms['envMap'].value = targetIn.texture; blurUniforms['samples'].value = samples; blurUniforms['weights'].value = weights; blurUniforms['latitudinal'].value = direction === 'latitudinal'; - if (poleAxis) { blurUniforms['poleAxis'].value = poleAxis; } - blurUniforms['dTheta'].value = radiansPerPixel; blurUniforms['mipInt'].value = LOD_MAX - lodIn; - this._setEncoding(blurUniforms['inputEncoding'], targetIn.texture); - this._setEncoding(blurUniforms['outputEncoding'], targetIn.texture); - const outputSize = _sizeLods[lodOut]; const x = 3 * Math.max(0, SIZE_MAX - 2 * outputSize); const y = (lodOut === 0 ? 0 : 2 * SIZE_MAX) + 2 * outputSize * (lodOut > LOD_MAX - LOD_MIN ? lodOut - LOD_MAX + LOD_MIN : 0); - _setViewport(targetOut, x, y, 3 * outputSize, 2 * outputSize); - renderer.setRenderTarget(targetOut); renderer.render(blurMesh, _flatCamera); } - _flipCubeUVMaxLevelTile(targetIn, targetOut) { const renderer = this._renderer; - if (this._flipCubeUVMaxLevelTileShader === null) { this._flipCubeUVMaxLevelTileShader = _getFlipCubeUVMaxLevelTileShader(); } - const flipMaterial = this._flipCubeUVMaxLevelTileShader; const flipMesh = new Mesh(_lodPlanes[0], flipMaterial); const flipUniforms = flipMaterial.uniforms; flipUniforms['envMap'].value = targetIn.texture; - this._setEncoding(flipUniforms['inputEncoding'], targetIn.texture); - this._setEncoding(flipUniforms['outputEncoding'], targetIn.texture); - _setViewport(targetOut, 0, 0, 3 * SIZE_MAX, 2 * SIZE_MAX); - renderer.setRenderTarget(targetOut); renderer.render(flipMesh, _flatCamera); } - } - function _createPlanes() { const _lodPlanes = []; const _sizeLods = []; const _sigmas = []; let lod = LOD_MAX; - for (let i = 0; i < TOTAL_LODS; i++) { const sizeLod = Math.pow(2, lod); - _sizeLods.push(sizeLod); - let sigma = 1.0 / sizeLod; - if (i > LOD_MAX - LOD_MIN) { sigma = EXTRA_LOD_SIGMA[i - LOD_MAX + LOD_MIN - 1]; } else if (i === 0) { sigma = 0; } - _sigmas.push(sigma); - const texelSize = 1.0 / (sizeLod - 1); const min = -texelSize / 2; const max = 1 + texelSize / 2; @@ -12043,7 +10548,6 @@ function _createPlanes() { const position = new Float32Array(positionSize * vertices * cubeFaces); const uv = new Float32Array(uvSize * vertices * cubeFaces); const faceIndex = new Float32Array(faceIndexSize * vertices * cubeFaces); - for (let face = 0; face < cubeFaces; face++) { const x = face % 3 * 2 / 3 - 1; const y = face > 2 ? 0 : -1; @@ -12053,26 +10557,21 @@ function _createPlanes() { const fill = [face, face, face, face, face, face]; faceIndex.set(fill, faceIndexSize * vertices * face); } - const planes = new BufferGeometry(); planes.setAttribute('position', new BufferAttribute(position, positionSize)); planes.setAttribute('uv', new BufferAttribute(uv, uvSize)); planes.setAttribute('faceIndex', new BufferAttribute(faceIndex, faceIndexSize)); - _lodPlanes.push(planes); - if (lod > LOD_MIN) { lod--; } } - return { _lodPlanes, _sizeLods, _sigmas }; } - function _createRenderTarget(params) { const cubeUVRenderTarget = new WebGLRenderTarget(3 * SIZE_MAX, 3 * SIZE_MAX, params); cubeUVRenderTarget.texture.mapping = CubeUVReflectionMapping; @@ -12080,12 +10579,10 @@ function _createRenderTarget(params) { cubeUVRenderTarget.scissorTest = true; return cubeUVRenderTarget; } - function _setViewport(target, x, y, width, height) { target.viewport.set(x, y, width, height); target.scissor.set(x, y, width, height); } - function _getBlurShader(maxSamples) { const weights = new Float32Array(maxSamples); const poleAxis = new Vector3(0, 1, 0); @@ -12124,9 +10621,7 @@ function _getBlurShader(maxSamples) { } }, vertexShader: _getCommonVertexShader(), - fragmentShader: - /* glsl */ - ` + fragmentShader: /* glsl */` precision mediump float; precision mediump int; @@ -12197,7 +10692,6 @@ function _getBlurShader(maxSamples) { }); return shaderMaterial; } - function _getFlipCubeUVMaxLevelTileShader() { const shaderMaterial = new RawShaderMaterial({ name: 'FlipCubeUVMaxLevelTile', @@ -12213,9 +10707,7 @@ function _getFlipCubeUVMaxLevelTileShader() { } }, vertexShader: _getCommonVertexShader(), - fragmentShader: - /* glsl */ - ` + fragmentShader: /* glsl */` precision mediump float; precision mediump int; @@ -12254,7 +10746,6 @@ function _getFlipCubeUVMaxLevelTileShader() { }); return shaderMaterial; } - function _getEquirectShader() { const texelSize = new Vector2(1, 1); const shaderMaterial = new RawShaderMaterial({ @@ -12274,9 +10765,7 @@ function _getEquirectShader() { } }, vertexShader: _getCommonVertexShader(), - fragmentShader: - /* glsl */ - ` + fragmentShader: /* glsl */` precision mediump float; precision mediump int; @@ -12321,7 +10810,6 @@ function _getEquirectShader() { }); return shaderMaterial; } - function _getCubemapShader() { const shaderMaterial = new RawShaderMaterial({ name: 'CubemapToCubeUV', @@ -12340,9 +10828,7 @@ function _getCubemapShader() { } }, vertexShader: _getCommonVertexShader(), - fragmentShader: - /* glsl */ - ` + fragmentShader: /* glsl */` precision mediump float; precision mediump int; @@ -12369,11 +10855,8 @@ function _getCubemapShader() { }); return shaderMaterial; } - function _getCommonVertexShader() { - return ( - /* glsl */ - ` + return /* glsl */` precision mediump float; precision mediump int; @@ -12426,14 +10909,10 @@ function _getCommonVertexShader() { gl_Position = vec4( position, 1.0 ); } - ` - ); + `; } - function _getEncodings() { - return ( - /* glsl */ - ` + return /* glsl */` uniform int inputEncoding; uniform int outputEncoding; @@ -12481,19 +10960,19 @@ function _getEncodings() { return inputTexelToLinear( color ); } - ` - ); + `; } function WebGLCubeUVMaps(renderer) { let cubeUVmaps = new WeakMap(); let pmremGenerator = null; - function get(texture) { if (texture && texture.isTexture) { const mapping = texture.mapping; const isEquirectMap = mapping === EquirectangularReflectionMapping || mapping === EquirectangularRefractionMapping; - const isCubeMap = mapping === CubeReflectionMapping || mapping === CubeRefractionMapping; // equirect/cube map to cubeUV conversion + const isCubeMap = mapping === CubeReflectionMapping || mapping === CubeRefractionMapping; + + // equirect/cube map to cubeUV conversion if (isEquirectMap || isCubeMap) { if (texture.isRenderTargetTexture && texture.needsPMREMUpdate === true) { @@ -12508,7 +10987,6 @@ function WebGLCubeUVMaps(renderer) { return cubeUVmaps.get(texture).texture; } else { const image = texture.image; - if (isEquirectMap && image && image.height > 0 || isCubeMap && image && isCubeTextureComplete(image)) { if (pmremGenerator === null) pmremGenerator = new PMREMGenerator(renderer); const renderTarget = isEquirectMap ? pmremGenerator.fromEquirectangular(texture) : pmremGenerator.fromCubemap(texture); @@ -12517,47 +10995,39 @@ function WebGLCubeUVMaps(renderer) { return renderTarget.texture; } else { // image not yet ready. try the conversion next frame + return null; } } } } } - return texture; } - function isCubeTextureComplete(image) { let count = 0; const length = 6; - for (let i = 0; i < length; i++) { if (image[i] !== undefined) count++; } - return count === length; } - function onTextureDispose(event) { const texture = event.target; texture.removeEventListener('dispose', onTextureDispose); const cubemapUV = cubeUVmaps.get(texture); - if (cubemapUV !== undefined) { cubeUVmaps.delete(texture); cubemapUV.dispose(); } } - function dispose() { cubeUVmaps = new WeakMap(); - if (pmremGenerator !== null) { pmremGenerator.dispose(); pmremGenerator = null; } } - return { get: get, dispose: dispose @@ -12567,14 +11037,11 @@ function WebGLCubeUVMaps(renderer) { function WebGLExtensions(gl, parameters) { const extensions = {}; const _allowedExtensions = parameters.allowedExtensions; - function getExtension(name) { if (extensions[name] !== undefined) { return extensions[name]; } - let extension; - if (_allowedExtensions !== undefined && _allowedExtensions.indexOf(name) === -1) { console.warn('THREE.WebGLRenderer: Attempt to use extension ' + name + ' which is not allowed.'); extension = null; @@ -12583,28 +11050,22 @@ function WebGLExtensions(gl, parameters) { case 'WEBGL_depth_texture': extension = gl.getExtension('WEBGL_depth_texture') || gl.getExtension('MOZ_WEBGL_depth_texture') || gl.getExtension('WEBKIT_WEBGL_depth_texture'); break; - case 'EXT_texture_filter_anisotropic': extension = gl.getExtension('EXT_texture_filter_anisotropic') || gl.getExtension('MOZ_EXT_texture_filter_anisotropic') || gl.getExtension('WEBKIT_EXT_texture_filter_anisotropic'); break; - case 'WEBGL_compressed_texture_s3tc': extension = gl.getExtension('WEBGL_compressed_texture_s3tc') || gl.getExtension('MOZ_WEBGL_compressed_texture_s3tc') || gl.getExtension('WEBKIT_WEBGL_compressed_texture_s3tc'); break; - case 'WEBGL_compressed_texture_pvrtc': extension = gl.getExtension('WEBGL_compressed_texture_pvrtc') || gl.getExtension('WEBKIT_WEBGL_compressed_texture_pvrtc'); break; - default: extension = gl.getExtension(name); } } - extensions[name] = extension; return extension; } - return { has: function (name) { return getExtension(name) !== null; @@ -12622,18 +11083,15 @@ function WebGLExtensions(gl, parameters) { getExtension('OES_vertex_array_object'); getExtension('ANGLE_instanced_arrays'); } - getExtension('OES_texture_float_linear'); getExtension('EXT_color_buffer_half_float'); getExtension('WEBGL_multisampled_render_to_texture'); }, get: function (name) { const extension = getExtension(name); - if (extension === null) { console.warn('THREE.WebGLRenderer: ' + name + ' extension not supported.'); } - return extension; } }; @@ -12642,37 +11100,30 @@ function WebGLExtensions(gl, parameters) { function WebGLGeometries(gl, attributes, info, bindingStates) { const geometries = {}; const wireframeAttributes = new WeakMap(); - function onGeometryDispose(event) { const geometry = event.target; - if (geometry.index !== null) { attributes.remove(geometry.index); } - for (const name in geometry.attributes) { attributes.remove(geometry.attributes[name]); } - geometry.removeEventListener('dispose', onGeometryDispose); delete geometries[geometry.id]; const attribute = wireframeAttributes.get(geometry); - if (attribute) { attributes.remove(attribute); wireframeAttributes.delete(geometry); } - bindingStates.releaseStatesOfGeometry(geometry); - if (geometry.isInstancedBufferGeometry === true) { delete geometry._maxInstanceCount; - } // + } + // info.memory.geometries--; } - function get(object, geometry) { if (geometries[geometry.id] === true) return geometry; geometry.addEventListener('dispose', onGeometryDispose); @@ -12680,36 +11131,33 @@ function WebGLGeometries(gl, attributes, info, bindingStates) { info.memory.geometries++; return geometry; } - function update(geometry) { - const geometryAttributes = geometry.attributes; // Updating index buffer in VAO now. See WebGLBindingStates. + const geometryAttributes = geometry.attributes; + + // Updating index buffer in VAO now. See WebGLBindingStates. for (const name in geometryAttributes) { attributes.update(geometryAttributes[name], gl.ARRAY_BUFFER); - } // morph targets + } + // morph targets const morphAttributes = geometry.morphAttributes; - for (const name in morphAttributes) { const array = morphAttributes[name]; - for (let i = 0, l = array.length; i < l; i++) { attributes.update(array[i], gl.ARRAY_BUFFER); } } } - function updateWireframeAttribute(geometry) { const indices = []; const geometryIndex = geometry.index; const geometryPosition = geometry.attributes.position; let version = 0; - if (geometryIndex !== null) { const array = geometryIndex.array; version = geometryIndex.version; - for (let i = 0, l = array.length; i < l; i += 3) { const a = array[i + 0]; const b = array[i + 1]; @@ -12719,7 +11167,6 @@ function WebGLGeometries(gl, attributes, info, bindingStates) { } else { const array = geometryPosition.array; version = geometryPosition.version; - for (let i = 0, l = array.length / 3 - 1; i < l; i += 3) { const a = i + 0; const b = i + 1; @@ -12727,25 +11174,27 @@ function WebGLGeometries(gl, attributes, info, bindingStates) { indices.push(a, b, b, c, c, a); } } - const attribute = new (arrayNeedsUint32(indices) ? Uint32BufferAttribute : Uint16BufferAttribute)(indices, 1); - attribute.version = version; // Updating index buffer in VAO now. See WebGLBindingStates + attribute.version = version; + + // Updating index buffer in VAO now. See WebGLBindingStates + // const previousAttribute = wireframeAttributes.get(geometry); - if (previousAttribute) attributes.remove(previousAttribute); // + if (previousAttribute) attributes.remove(previousAttribute); + + // wireframeAttributes.set(geometry, attribute); } - function getWireframeAttribute(geometry) { const currentAttribute = wireframeAttributes.get(geometry); - if (currentAttribute) { const geometryIndex = geometry.index; - if (geometryIndex !== null) { // if the attribute is obsolete, create a new one + if (currentAttribute.version < geometryIndex.version) { updateWireframeAttribute(geometry); } @@ -12753,10 +11202,8 @@ function WebGLGeometries(gl, attributes, info, bindingStates) { } else { updateWireframeAttribute(geometry); } - return wireframeAttributes.get(geometry); } - return { get: get, update: update, @@ -12767,44 +11214,37 @@ function WebGLGeometries(gl, attributes, info, bindingStates) { function WebGLIndexedBufferRenderer(gl, extensions, info, capabilities) { const isWebGL2 = capabilities.isWebGL2; let mode; - function setMode(value) { mode = value; } - let type, bytesPerElement; - function setIndex(value) { type = value.type; bytesPerElement = value.bytesPerElement; } - function render(start, count) { gl.drawElements(mode, count, type, start * bytesPerElement); info.update(count, mode, 1); } - function renderInstances(start, count, primcount) { if (primcount === 0) return; let extension, methodName; - if (isWebGL2) { extension = gl; methodName = 'drawElementsInstanced'; } else { extension = extensions.get('ANGLE_instanced_arrays'); methodName = 'drawElementsInstancedANGLE'; - if (extension === null) { console.error('THREE.WebGLIndexedBufferRenderer: using THREE.InstancedBufferGeometry but hardware does not support extension ANGLE_instanced_arrays.'); return; } } - extension[methodName](mode, count, type, start * bytesPerElement, primcount); info.update(count, mode, primcount); - } // + } + // this.setMode = setMode; this.setIndex = setIndex; @@ -12824,37 +11264,29 @@ function WebGLInfo(gl) { points: 0, lines: 0 }; - function update(count, mode, instanceCount) { render.calls++; - switch (mode) { case gl.TRIANGLES: render.triangles += instanceCount * (count / 3); break; - case gl.LINES: render.lines += instanceCount * (count / 2); break; - case gl.LINE_STRIP: render.lines += instanceCount * (count - 1); break; - case gl.LINE_LOOP: render.lines += instanceCount * count; break; - case gl.POINTS: render.points += instanceCount * count; break; - default: console.error('THREE.WebGLInfo: Unknown draw mode:', mode); break; } } - function reset() { render.frame++; render.calls = 0; @@ -12862,7 +11294,6 @@ function WebGLInfo(gl) { render.points = 0; render.lines = 0; } - return { memory: memory, render: render, @@ -12889,46 +11320,38 @@ class DataTexture2DArray extends Texture { this.flipY = false; this.unpackAlignment = 1; } - } - DataTexture2DArray.prototype.isDataTexture2DArray = true; function numericalSort(a, b) { return a[0] - b[0]; } - function absNumericalSort(a, b) { return Math.abs(b[1]) - Math.abs(a[1]); } - function denormalize(morph, attribute) { let denominator = 1; const array = attribute.isInterleavedBufferAttribute ? attribute.data.array : attribute.array; if (array instanceof Int8Array) denominator = 127;else if (array instanceof Int16Array) denominator = 32767;else if (array instanceof Int32Array) denominator = 2147483647;else console.error('THREE.WebGLMorphtargets: Unsupported morph attribute data type: ', array); morph.divideScalar(denominator); } - function WebGLMorphtargets(gl, capabilities, textures) { const influencesList = {}; const morphInfluences = new Float32Array(8); const morphTextures = new WeakMap(); const morph = new Vector3(); const workInfluences = []; - for (let i = 0; i < 8; i++) { workInfluences[i] = [i, 0]; } - function update(object, geometry, material, program) { const objectInfluences = object.morphTargetInfluences; - if (capabilities.isWebGL2 === true) { // instead of using attributes, the WebGL 2 code path encodes morph targets // into an array of data textures. Each layer represents a single morph target. + const numberOfMorphTargets = geometry.morphAttributes.position.length; let entry = morphTextures.get(geometry); - if (entry === undefined || entry.count !== numberOfMorphTargets) { if (entry !== undefined) entry.texture.dispose(); const hasMorphNormals = geometry.morphAttributes.normal !== undefined; @@ -12939,26 +11362,23 @@ function WebGLMorphtargets(gl, capabilities, textures) { let width = numberOfVertices * numberOfVertexData; let height = 1; - if (width > capabilities.maxTextureSize) { height = Math.ceil(width / capabilities.maxTextureSize); width = capabilities.maxTextureSize; } - const buffer = new Float32Array(width * height * 4 * numberOfMorphTargets); const texture = new DataTexture2DArray(buffer, width, height, numberOfMorphTargets); texture.format = RGBAFormat; // using RGBA since RGB might be emulated (and is thus slower) - texture.type = FloatType; - texture.needsUpdate = true; // fill buffer + texture.needsUpdate = true; - const vertexDataStride = numberOfVertexData * 4; + // fill buffer + const vertexDataStride = numberOfVertexData * 4; for (let i = 0; i < numberOfMorphTargets; i++) { const morphTarget = morphTargets[i]; const morphNormal = morphNormals[i]; const offset = width * height * 4 * i; - for (let j = 0; j < morphTarget.count; j++) { morph.fromBufferAttribute(morphTarget, j); if (morphTarget.normalized === true) denormalize(morph, morphTarget); @@ -12967,7 +11387,6 @@ function WebGLMorphtargets(gl, capabilities, textures) { buffer[offset + stride + 1] = morph.y; buffer[offset + stride + 2] = morph.z; buffer[offset + stride + 3] = 0; - if (hasMorphNormals === true) { morph.fromBufferAttribute(morphNormal, j); if (morphNormal.normalized === true) denormalize(morph, morphNormal); @@ -12978,30 +11397,26 @@ function WebGLMorphtargets(gl, capabilities, textures) { } } } - entry = { count: numberOfMorphTargets, texture: texture, size: new Vector2(width, height) }; morphTextures.set(geometry, entry); - function disposeTexture() { texture.dispose(); morphTextures.delete(geometry); geometry.removeEventListener('dispose', disposeTexture); } - geometry.addEventListener('dispose', disposeTexture); - } // + } + // let morphInfluencesSum = 0; - for (let i = 0; i < objectInfluences.length; i++) { morphInfluencesSum += objectInfluences[i]; } - const morphBaseInfluence = geometry.morphTargetsRelative ? 1 : 1 - morphInfluencesSum; program.getUniforms().setValue(gl, 'morphTargetBaseInfluence', morphBaseInfluence); program.getUniforms().setValue(gl, 'morphTargetInfluences', objectInfluences); @@ -13010,29 +11425,27 @@ function WebGLMorphtargets(gl, capabilities, textures) { } else { // When object doesn't have morph target influences defined, we treat it as a 0-length array // This is important to make sure we set up morphTargetBaseInfluence / morphTargetInfluences + const length = objectInfluences === undefined ? 0 : objectInfluences.length; let influences = influencesList[geometry.id]; - if (influences === undefined || influences.length !== length) { // initialise list - influences = []; + influences = []; for (let i = 0; i < length; i++) { influences[i] = [i, 0]; } - influencesList[geometry.id] = influences; - } // Collect influences + } + // Collect influences for (let i = 0; i < length; i++) { const influence = influences[i]; influence[0] = i; influence[1] = objectInfluences[i]; } - influences.sort(absNumericalSort); - for (let i = 0; i < 8; i++) { if (i < length && influences[i][1]) { workInfluences[i][0] = influences[i][0]; @@ -13042,50 +11455,42 @@ function WebGLMorphtargets(gl, capabilities, textures) { workInfluences[i][1] = 0; } } - workInfluences.sort(numericalSort); const morphTargets = geometry.morphAttributes.position; const morphNormals = geometry.morphAttributes.normal; let morphInfluencesSum = 0; - for (let i = 0; i < 8; i++) { const influence = workInfluences[i]; const index = influence[0]; const value = influence[1]; - if (index !== Number.MAX_SAFE_INTEGER && value) { if (morphTargets && geometry.getAttribute('morphTarget' + i) !== morphTargets[index]) { geometry.setAttribute('morphTarget' + i, morphTargets[index]); } - if (morphNormals && geometry.getAttribute('morphNormal' + i) !== morphNormals[index]) { geometry.setAttribute('morphNormal' + i, morphNormals[index]); } - morphInfluences[i] = value; morphInfluencesSum += value; } else { if (morphTargets && geometry.hasAttribute('morphTarget' + i) === true) { geometry.deleteAttribute('morphTarget' + i); } - if (morphNormals && geometry.hasAttribute('morphNormal' + i) === true) { geometry.deleteAttribute('morphNormal' + i); } - morphInfluences[i] = 0; } - } // GLSL shader uses formula baseinfluence * base + sum(target * influence) + } + + // GLSL shader uses formula baseinfluence * base + sum(target * influence) // This allows us to switch between absolute morphs and relative morphs without changing shader code // When baseinfluence = 1 - sum(influence), the above is equivalent to sum((target - base) * influence) - - const morphBaseInfluence = geometry.morphTargetsRelative ? 1 : 1 - morphInfluencesSum; program.getUniforms().setValue(gl, 'morphTargetBaseInfluence', morphBaseInfluence); program.getUniforms().setValue(gl, 'morphTargetInfluences', morphInfluences); } } - return { update: update }; @@ -13093,43 +11498,37 @@ function WebGLMorphtargets(gl, capabilities, textures) { function WebGLObjects(gl, geometries, attributes, info) { let updateMap = new WeakMap(); - function update(object) { const frame = info.render.frame; const geometry = object.geometry; - const buffergeometry = geometries.get(object, geometry); // Update once per frame + const buffergeometry = geometries.get(object, geometry); + + // Update once per frame if (updateMap.get(buffergeometry) !== frame) { geometries.update(buffergeometry); updateMap.set(buffergeometry, frame); } - if (object.isInstancedMesh) { if (object.hasEventListener('dispose', onInstancedMeshDispose) === false) { object.addEventListener('dispose', onInstancedMeshDispose); } - attributes.update(object.instanceMatrix, gl.ARRAY_BUFFER); - if (object.instanceColor !== null) { attributes.update(object.instanceColor, gl.ARRAY_BUFFER); } } - return buffergeometry; } - function dispose() { updateMap = new WeakMap(); } - function onInstancedMeshDispose(event) { const instancedMesh = event.target; instancedMesh.removeEventListener('dispose', onInstancedMeshDispose); attributes.remove(instancedMesh.instanceMatrix); if (instancedMesh.instanceColor !== null) attributes.remove(instancedMesh.instanceColor); } - return { update: update, dispose: dispose @@ -13145,6 +11544,7 @@ class DataTexture3D extends Texture { // texture.anisotropy = 16; // // See #14839 + super(null); this.image = { data, @@ -13159,9 +11559,7 @@ class DataTexture3D extends Texture { this.flipY = false; this.unpackAlignment = 1; } - } - DataTexture3D.prototype.isDataTexture3D = true; /** @@ -13209,88 +11607,89 @@ DataTexture3D.prototype.isDataTexture3D = true; const emptyTexture = new Texture(); const emptyTexture2dArray = new DataTexture2DArray(); const emptyTexture3d = new DataTexture3D(); -const emptyCubeTexture = new CubeTexture(); // --- Utilities --- +const emptyCubeTexture = new CubeTexture(); + +// --- Utilities --- + // Array Caches (provide typed arrays for temporary by size) const arrayCacheF32 = []; -const arrayCacheI32 = []; // Float32Array caches used for uploading Matrix uniforms +const arrayCacheI32 = []; + +// Float32Array caches used for uploading Matrix uniforms const mat4array = new Float32Array(16); const mat3array = new Float32Array(9); -const mat2array = new Float32Array(4); // Flattening for arrays of vectors and matrices +const mat2array = new Float32Array(4); + +// Flattening for arrays of vectors and matrices function flatten(array, nBlocks, blockSize) { const firstElem = array[0]; - if (firstElem <= 0 || firstElem > 0) return array; // unoptimized: ! isNaN( firstElem ) + if (firstElem <= 0 || firstElem > 0) return array; + // unoptimized: ! isNaN( firstElem ) // see http://jacksondunstan.com/articles/983 const n = nBlocks * blockSize; let r = arrayCacheF32[n]; - if (r === undefined) { r = new Float32Array(n); arrayCacheF32[n] = r; } - if (nBlocks !== 0) { firstElem.toArray(r, 0); - for (let i = 1, offset = 0; i !== nBlocks; ++i) { offset += blockSize; array[i].toArray(r, offset); } } - return r; } - function arraysEqual(a, b) { if (a.length !== b.length) return false; - for (let i = 0, l = a.length; i < l; i++) { if (a[i] !== b[i]) return false; } - return true; } - function copyArray(a, b) { for (let i = 0, l = b.length; i < l; i++) { a[i] = b[i]; } -} // Texture unit allocation +} +// Texture unit allocation function allocTexUnits(textures, n) { let r = arrayCacheI32[n]; - if (r === undefined) { r = new Int32Array(n); arrayCacheI32[n] = r; } - for (let i = 0; i !== n; ++i) { r[i] = textures.allocateTextureUnit(); } - return r; -} // --- Setters --- +} + +// --- Setters --- + // Note: Defining these methods externally, because they come in a bunch // and this way their names minify. -// Single scalar +// Single scalar function setValueV1f(gl, v) { const cache = this.cache; if (cache[0] === v) return; gl.uniform1f(this.addr, v); cache[0] = v; -} // Single float vector (from flat array or THREE.VectorN) +} +// Single float vector (from flat array or THREE.VectorN) function setValueV2f(gl, v) { const cache = this.cache; - if (v.x !== undefined) { if (cache[0] !== v.x || cache[1] !== v.y) { gl.uniform2f(this.addr, v.x, v.y); @@ -13303,10 +11702,8 @@ function setValueV2f(gl, v) { copyArray(cache, v); } } - function setValueV3f(gl, v) { const cache = this.cache; - if (v.x !== undefined) { if (cache[0] !== v.x || cache[1] !== v.y || cache[2] !== v.z) { gl.uniform3f(this.addr, v.x, v.y, v.z); @@ -13327,10 +11724,8 @@ function setValueV3f(gl, v) { copyArray(cache, v); } } - function setValueV4f(gl, v) { const cache = this.cache; - if (v.x !== undefined) { if (cache[0] !== v.x || cache[1] !== v.y || cache[2] !== v.z || cache[3] !== v.w) { gl.uniform4f(this.addr, v.x, v.y, v.z, v.w); @@ -13344,13 +11739,13 @@ function setValueV4f(gl, v) { gl.uniform4fv(this.addr, v); copyArray(cache, v); } -} // Single matrix (from flat array or THREE.MatrixN) +} +// Single matrix (from flat array or THREE.MatrixN) function setValueM2(gl, v) { const cache = this.cache; const elements = v.elements; - if (elements === undefined) { if (arraysEqual(cache, v)) return; gl.uniformMatrix2fv(this.addr, false, v); @@ -13362,11 +11757,9 @@ function setValueM2(gl, v) { copyArray(cache, elements); } } - function setValueM3(gl, v) { const cache = this.cache; const elements = v.elements; - if (elements === undefined) { if (arraysEqual(cache, v)) return; gl.uniformMatrix3fv(this.addr, false, v); @@ -13378,11 +11771,9 @@ function setValueM3(gl, v) { copyArray(cache, elements); } } - function setValueM4(gl, v) { const cache = this.cache; const elements = v.elements; - if (elements === undefined) { if (arraysEqual(cache, v)) return; gl.uniformMatrix4fv(this.addr, false, v); @@ -13393,16 +11784,18 @@ function setValueM4(gl, v) { gl.uniformMatrix4fv(this.addr, false, mat4array); copyArray(cache, elements); } -} // Single integer / boolean +} +// Single integer / boolean function setValueV1i(gl, v) { const cache = this.cache; if (cache[0] === v) return; gl.uniform1i(this.addr, v); cache[0] = v; -} // Single integer / boolean vector (from flat array) +} +// Single integer / boolean vector (from flat array) function setValueV2i(gl, v) { const cache = this.cache; @@ -13410,29 +11803,29 @@ function setValueV2i(gl, v) { gl.uniform2iv(this.addr, v); copyArray(cache, v); } - function setValueV3i(gl, v) { const cache = this.cache; if (arraysEqual(cache, v)) return; gl.uniform3iv(this.addr, v); copyArray(cache, v); } - function setValueV4i(gl, v) { const cache = this.cache; if (arraysEqual(cache, v)) return; gl.uniform4iv(this.addr, v); copyArray(cache, v); -} // Single unsigned integer +} +// Single unsigned integer function setValueV1ui(gl, v) { const cache = this.cache; if (cache[0] === v) return; gl.uniform1ui(this.addr, v); cache[0] = v; -} // Single unsigned integer vector (from flat array) +} +// Single unsigned integer vector (from flat array) function setValueV2ui(gl, v) { const cache = this.cache; @@ -13440,85 +11833,71 @@ function setValueV2ui(gl, v) { gl.uniform2uiv(this.addr, v); copyArray(cache, v); } - function setValueV3ui(gl, v) { const cache = this.cache; if (arraysEqual(cache, v)) return; gl.uniform3uiv(this.addr, v); copyArray(cache, v); } - function setValueV4ui(gl, v) { const cache = this.cache; if (arraysEqual(cache, v)) return; gl.uniform4uiv(this.addr, v); copyArray(cache, v); -} // Single texture (2D / Cube) +} +// Single texture (2D / Cube) function setValueT1(gl, v, textures) { const cache = this.cache; const unit = textures.allocateTextureUnit(); - if (cache[0] !== unit) { gl.uniform1i(this.addr, unit); cache[0] = unit; } - textures.safeSetTexture2D(v || emptyTexture, unit); } - function setValueT3D1(gl, v, textures) { const cache = this.cache; const unit = textures.allocateTextureUnit(); - if (cache[0] !== unit) { gl.uniform1i(this.addr, unit); cache[0] = unit; } - textures.setTexture3D(v || emptyTexture3d, unit); } - function setValueT6(gl, v, textures) { const cache = this.cache; const unit = textures.allocateTextureUnit(); - if (cache[0] !== unit) { gl.uniform1i(this.addr, unit); cache[0] = unit; } - textures.safeSetTextureCube(v || emptyCubeTexture, unit); } - function setValueT2DArray1(gl, v, textures) { const cache = this.cache; const unit = textures.allocateTextureUnit(); - if (cache[0] !== unit) { gl.uniform1i(this.addr, unit); cache[0] = unit; } - textures.setTexture2DArray(v || emptyTexture2dArray, unit); -} // Helper to pick the right setter for the singular case +} +// Helper to pick the right setter for the singular case function getSingularSetter(type) { switch (type) { case 0x1406: return setValueV1f; // FLOAT - case 0x8b50: return setValueV2f; // _VEC2 - case 0x8b51: return setValueV3f; // _VEC3 - case 0x8b52: return setValueV4f; // _VEC4 @@ -13526,11 +11905,9 @@ function getSingularSetter(type) { case 0x8b5a: return setValueM2; // _MAT2 - case 0x8b5b: return setValueM3; // _MAT3 - case 0x8b5c: return setValueM4; // _MAT4 @@ -13539,17 +11916,14 @@ function getSingularSetter(type) { case 0x8b56: return setValueV1i; // INT, BOOL - case 0x8b53: case 0x8b57: return setValueV2i; // _VEC2 - case 0x8b54: case 0x8b58: return setValueV3i; // _VEC3 - case 0x8b55: case 0x8b59: return setValueV4i; @@ -13558,190 +11932,163 @@ function getSingularSetter(type) { case 0x1405: return setValueV1ui; // UINT - case 0x8dc6: return setValueV2ui; // _VEC2 - case 0x8dc7: return setValueV3ui; // _VEC3 - case 0x8dc8: return setValueV4ui; // _VEC4 case 0x8b5e: // SAMPLER_2D - case 0x8d66: // SAMPLER_EXTERNAL_OES - case 0x8dca: // INT_SAMPLER_2D - case 0x8dd2: // UNSIGNED_INT_SAMPLER_2D - case 0x8b62: // SAMPLER_2D_SHADOW return setValueT1; - case 0x8b5f: // SAMPLER_3D - case 0x8dcb: // INT_SAMPLER_3D - case 0x8dd3: // UNSIGNED_INT_SAMPLER_3D return setValueT3D1; - case 0x8b60: // SAMPLER_CUBE - case 0x8dcc: // INT_SAMPLER_CUBE - case 0x8dd4: // UNSIGNED_INT_SAMPLER_CUBE - case 0x8dc5: // SAMPLER_CUBE_SHADOW return setValueT6; - case 0x8dc1: // SAMPLER_2D_ARRAY - case 0x8dcf: // INT_SAMPLER_2D_ARRAY - case 0x8dd7: // UNSIGNED_INT_SAMPLER_2D_ARRAY - case 0x8dc4: // SAMPLER_2D_ARRAY_SHADOW return setValueT2DArray1; } -} // Array of scalars +} +// Array of scalars function setValueV1fArray(gl, v) { gl.uniform1fv(this.addr, v); -} // Array of vectors (from flat array or array of THREE.VectorN) +} +// Array of vectors (from flat array or array of THREE.VectorN) function setValueV2fArray(gl, v) { const data = flatten(v, this.size, 2); gl.uniform2fv(this.addr, data); } - function setValueV3fArray(gl, v) { const data = flatten(v, this.size, 3); gl.uniform3fv(this.addr, data); } - function setValueV4fArray(gl, v) { const data = flatten(v, this.size, 4); gl.uniform4fv(this.addr, data); -} // Array of matrices (from flat array or array of THREE.MatrixN) +} +// Array of matrices (from flat array or array of THREE.MatrixN) function setValueM2Array(gl, v) { const data = flatten(v, this.size, 4); gl.uniformMatrix2fv(this.addr, false, data); } - function setValueM3Array(gl, v) { const data = flatten(v, this.size, 9); gl.uniformMatrix3fv(this.addr, false, data); } - function setValueM4Array(gl, v) { const data = flatten(v, this.size, 16); gl.uniformMatrix4fv(this.addr, false, data); -} // Array of integer / boolean +} +// Array of integer / boolean function setValueV1iArray(gl, v) { gl.uniform1iv(this.addr, v); -} // Array of integer / boolean vectors (from flat array) +} +// Array of integer / boolean vectors (from flat array) function setValueV2iArray(gl, v) { gl.uniform2iv(this.addr, v); } - function setValueV3iArray(gl, v) { gl.uniform3iv(this.addr, v); } - function setValueV4iArray(gl, v) { gl.uniform4iv(this.addr, v); -} // Array of unsigned integer +} +// Array of unsigned integer function setValueV1uiArray(gl, v) { gl.uniform1uiv(this.addr, v); -} // Array of unsigned integer vectors (from flat array) +} +// Array of unsigned integer vectors (from flat array) function setValueV2uiArray(gl, v) { gl.uniform2uiv(this.addr, v); } - function setValueV3uiArray(gl, v) { gl.uniform3uiv(this.addr, v); } - function setValueV4uiArray(gl, v) { gl.uniform4uiv(this.addr, v); -} // Array of textures (2D / 3D / Cube / 2DArray) +} +// Array of textures (2D / 3D / Cube / 2DArray) function setValueT1Array(gl, v, textures) { const n = v.length; const units = allocTexUnits(textures, n); gl.uniform1iv(this.addr, units); - for (let i = 0; i !== n; ++i) { textures.safeSetTexture2D(v[i] || emptyTexture, units[i]); } } - function setValueT3DArray(gl, v, textures) { const n = v.length; const units = allocTexUnits(textures, n); gl.uniform1iv(this.addr, units); - for (let i = 0; i !== n; ++i) { textures.setTexture3D(v[i] || emptyTexture3d, units[i]); } } - function setValueT6Array(gl, v, textures) { const n = v.length; const units = allocTexUnits(textures, n); gl.uniform1iv(this.addr, units); - for (let i = 0; i !== n; ++i) { textures.safeSetTextureCube(v[i] || emptyCubeTexture, units[i]); } } - function setValueT2DArrayArray(gl, v, textures) { const n = v.length; const units = allocTexUnits(textures, n); gl.uniform1iv(this.addr, units); - for (let i = 0; i !== n; ++i) { textures.setTexture2DArray(v[i] || emptyTexture2dArray, units[i]); } -} // Helper to pick the right setter for a pure (bottom-level) array +} +// Helper to pick the right setter for a pure (bottom-level) array function getPureArraySetter(type) { switch (type) { case 0x1406: return setValueV1fArray; // FLOAT - case 0x8b50: return setValueV2fArray; // _VEC2 - case 0x8b51: return setValueV3fArray; // _VEC3 - case 0x8b52: return setValueV4fArray; // _VEC4 @@ -13749,11 +12096,9 @@ function getPureArraySetter(type) { case 0x8b5a: return setValueM2Array; // _MAT2 - case 0x8b5b: return setValueM3Array; // _MAT3 - case 0x8b5c: return setValueM4Array; // _MAT4 @@ -13762,17 +12107,14 @@ function getPureArraySetter(type) { case 0x8b56: return setValueV1iArray; // INT, BOOL - case 0x8b53: case 0x8b57: return setValueV2iArray; // _VEC2 - case 0x8b54: case 0x8b58: return setValueV3iArray; // _VEC3 - case 0x8b55: case 0x8b59: return setValueV4iArray; @@ -13781,105 +12123,89 @@ function getPureArraySetter(type) { case 0x1405: return setValueV1uiArray; // UINT - case 0x8dc6: return setValueV2uiArray; // _VEC2 - case 0x8dc7: return setValueV3uiArray; // _VEC3 - case 0x8dc8: return setValueV4uiArray; // _VEC4 case 0x8b5e: // SAMPLER_2D - case 0x8d66: // SAMPLER_EXTERNAL_OES - case 0x8dca: // INT_SAMPLER_2D - case 0x8dd2: // UNSIGNED_INT_SAMPLER_2D - case 0x8b62: // SAMPLER_2D_SHADOW return setValueT1Array; - case 0x8b5f: // SAMPLER_3D - case 0x8dcb: // INT_SAMPLER_3D - case 0x8dd3: // UNSIGNED_INT_SAMPLER_3D return setValueT3DArray; - case 0x8b60: // SAMPLER_CUBE - case 0x8dcc: // INT_SAMPLER_CUBE - case 0x8dd4: // UNSIGNED_INT_SAMPLER_CUBE - case 0x8dc5: // SAMPLER_CUBE_SHADOW return setValueT6Array; - case 0x8dc1: // SAMPLER_2D_ARRAY - case 0x8dcf: // INT_SAMPLER_2D_ARRAY - case 0x8dd7: // UNSIGNED_INT_SAMPLER_2D_ARRAY - case 0x8dc4: // SAMPLER_2D_ARRAY_SHADOW return setValueT2DArrayArray; } -} // --- Uniform Classes --- +} +// --- Uniform Classes --- function SingleUniform(id, activeInfo, addr) { this.id = id; this.addr = addr; this.cache = []; - this.setValue = getSingularSetter(activeInfo.type); // this.path = activeInfo.name; // DEBUG -} + this.setValue = getSingularSetter(activeInfo.type); + // this.path = activeInfo.name; // DEBUG +} function PureArrayUniform(id, activeInfo, addr) { this.id = id; this.addr = addr; this.cache = []; this.size = activeInfo.size; - this.setValue = getPureArraySetter(activeInfo.type); // this.path = activeInfo.name; // DEBUG -} + this.setValue = getPureArraySetter(activeInfo.type); + // this.path = activeInfo.name; // DEBUG +} PureArrayUniform.prototype.updateCache = function (data) { const cache = this.cache; - if (data instanceof Float32Array && cache.length !== data.length) { this.cache = new Float32Array(data.length); } - copyArray(cache, data); }; - function StructuredUniform(id) { this.id = id; this.seq = []; this.map = {}; } - StructuredUniform.prototype.setValue = function (gl, value, textures) { const seq = this.seq; - for (let i = 0, n = seq.length; i !== n; ++i) { const u = seq[i]; u.setValue(gl, value[u.id], textures); } -}; // --- Top-level --- +}; + +// --- Top-level --- + // Parser - builds up the property tree from the path strings +const RePathPart = /(\w+)(\])?(\[|\.)?/g; -const RePathPart = /(\w+)(\])?(\[|\.)?/g; // extracts +// extracts // - the identifier (member name or array index) // - followed by an optional right bracket (found when array index) // - followed by an optional left bracket or dot (type of subscript) @@ -13892,84 +12218,78 @@ function addUniform(container, uniformObject) { container.seq.push(uniformObject); container.map[uniformObject.id] = uniformObject; } - function parseUniform(activeInfo, addr, container) { const path = activeInfo.name, - pathLength = path.length; // reset RegExp object, because of the early exit of a previous run + pathLength = path.length; + // reset RegExp object, because of the early exit of a previous run RePathPart.lastIndex = 0; - while (true) { const match = RePathPart.exec(path), - matchEnd = RePathPart.lastIndex; + matchEnd = RePathPart.lastIndex; let id = match[1]; const idIsIndex = match[2] === ']', - subscript = match[3]; + subscript = match[3]; if (idIsIndex) id = id | 0; // convert to integer if (subscript === undefined || subscript === '[' && matchEnd + 2 === pathLength) { // bare name or "pure" bottom-level array "[0]" suffix + addUniform(container, subscript === undefined ? new SingleUniform(id, activeInfo, addr) : new PureArrayUniform(id, activeInfo, addr)); break; } else { // step into inner node / create it in case it doesn't exist + const map = container.map; let next = map[id]; - if (next === undefined) { next = new StructuredUniform(id); addUniform(container, next); } - container = next; } } -} // Root Container +} +// Root Container function WebGLUniforms(gl, program) { this.seq = []; this.map = {}; const n = gl.getProgramParameter(program, gl.ACTIVE_UNIFORMS); - for (let i = 0; i < n; ++i) { const info = gl.getActiveUniform(program, i), - addr = gl.getUniformLocation(program, info.name); + addr = gl.getUniformLocation(program, info.name); parseUniform(info, addr, this); } } - WebGLUniforms.prototype.setValue = function (gl, name, value, textures) { const u = this.map[name]; if (u !== undefined) u.setValue(gl, value, textures); }; - WebGLUniforms.prototype.setOptional = function (gl, object, name) { const v = object[name]; if (v !== undefined) this.setValue(gl, name, v); -}; // Static interface +}; +// Static interface WebGLUniforms.upload = function (gl, seq, values, textures) { for (let i = 0, n = seq.length; i !== n; ++i) { const u = seq[i], - v = values[u.id]; - + v = values[u.id]; if (v.needsUpdate !== false) { // note: always updating when .needsUpdate is undefined u.setValue(gl, v.value, textures); } } }; - WebGLUniforms.seqWithValue = function (seq, values) { const r = []; - for (let i = 0, n = seq.length; i !== n; ++i) { const u = seq[i]; if (u.id in values) r.push(u); } - return r; }; @@ -13981,113 +12301,93 @@ function WebGLShader(gl, type, string) { } let programIdCount = 0; - function addLineNumbers(string) { const lines = string.split('\n'); - for (let i = 0; i < lines.length; i++) { lines[i] = i + 1 + ': ' + lines[i]; } - return lines.join('\n'); } - function getEncodingComponents(encoding) { switch (encoding) { case LinearEncoding: return ['Linear', '( value )']; - case sRGBEncoding: return ['sRGB', '( value )']; - case RGBEEncoding: return ['RGBE', '( value )']; - default: console.warn('THREE.WebGLProgram: Unsupported encoding:', encoding); return ['Linear', '( value )']; } } - function getShaderErrors(gl, shader, type) { const status = gl.getShaderParameter(shader, gl.COMPILE_STATUS); const errors = gl.getShaderInfoLog(shader).trim(); - if (status && errors === '') return ''; // --enable-privileged-webgl-extension + if (status && errors === '') return ''; + + // --enable-privileged-webgl-extension // console.log( '**' + type + '**', gl.getExtension( 'WEBGL_debug_shaders' ).getTranslatedShaderSource( shader ) ); return type.toUpperCase() + '\n\n' + errors + '\n\n' + addLineNumbers(gl.getShaderSource(shader)); } - function getTexelDecodingFunction(functionName, encoding) { const components = getEncodingComponents(encoding); return 'vec4 ' + functionName + '( vec4 value ) { return ' + components[0] + 'ToLinear' + components[1] + '; }'; } - function getTexelEncodingFunction(functionName, encoding) { const components = getEncodingComponents(encoding); return 'vec4 ' + functionName + '( vec4 value ) { return LinearTo' + components[0] + components[1] + '; }'; } - function getToneMappingFunction(functionName, toneMapping) { let toneMappingName; - switch (toneMapping) { case LinearToneMapping: toneMappingName = 'Linear'; break; - case ReinhardToneMapping: toneMappingName = 'Reinhard'; break; - case CineonToneMapping: toneMappingName = 'OptimizedCineon'; break; - case ACESFilmicToneMapping: toneMappingName = 'ACESFilmic'; break; - case CustomToneMapping: toneMappingName = 'Custom'; break; - default: console.warn('THREE.WebGLProgram: Unsupported toneMapping:', toneMapping); toneMappingName = 'Linear'; } - return 'vec3 ' + functionName + '( vec3 color ) { return ' + toneMappingName + 'ToneMapping( color ); }'; } - function generateExtensions(parameters) { const chunks = [parameters.extensionDerivatives || parameters.envMapCubeUV || parameters.bumpMap || parameters.tangentSpaceNormalMap || parameters.clearcoatNormalMap || parameters.flatShading || parameters.shaderID === 'physical' ? '#extension GL_OES_standard_derivatives : enable' : '', (parameters.extensionFragDepth || parameters.logarithmicDepthBuffer) && parameters.rendererExtensionFragDepth ? '#extension GL_EXT_frag_depth : enable' : '', parameters.extensionDrawBuffers && parameters.rendererExtensionDrawBuffers ? '#extension GL_EXT_draw_buffers : require' : '', (parameters.extensionShaderTextureLOD || parameters.envMap || parameters.transmission) && parameters.rendererExtensionShaderTextureLod ? '#extension GL_EXT_shader_texture_lod : enable' : '']; return chunks.filter(filterEmptyLine).join('\n'); } - function generateDefines(defines) { const chunks = []; - for (const name in defines) { const value = defines[name]; if (value === false) continue; chunks.push('#define ' + name + ' ' + value); } - return chunks.join('\n'); } - function fetchAttributeLocations(gl, program) { const attributes = {}; const n = gl.getProgramParameter(program, gl.ACTIVE_ATTRIBUTES); - for (let i = 0; i < n; i++) { const info = gl.getActiveAttrib(program, i); const name = info.name; let locationSize = 1; if (info.type === gl.FLOAT_MAT2) locationSize = 2; if (info.type === gl.FLOAT_MAT3) locationSize = 3; - if (info.type === gl.FLOAT_MAT4) locationSize = 4; // console.log( 'THREE.WebGLProgram: ACTIVE VERTEX ATTRIBUTE:', name, i ); + if (info.type === gl.FLOAT_MAT4) locationSize = 4; + + // console.log( 'THREE.WebGLProgram: ACTIVE VERTEX ATTRIBUTE:', name, i ); attributes[name] = { type: info.type, @@ -14095,66 +12395,55 @@ function fetchAttributeLocations(gl, program) { locationSize: locationSize }; } - return attributes; } - function filterEmptyLine(string) { return string !== ''; } - function replaceLightNums(string, parameters) { return string.replace(/NUM_DIR_LIGHTS/g, parameters.numDirLights).replace(/NUM_SPOT_LIGHTS/g, parameters.numSpotLights).replace(/NUM_RECT_AREA_LIGHTS/g, parameters.numRectAreaLights).replace(/NUM_POINT_LIGHTS/g, parameters.numPointLights).replace(/NUM_HEMI_LIGHTS/g, parameters.numHemiLights).replace(/NUM_DIR_LIGHT_SHADOWS/g, parameters.numDirLightShadows).replace(/NUM_SPOT_LIGHT_SHADOWS/g, parameters.numSpotLightShadows).replace(/NUM_POINT_LIGHT_SHADOWS/g, parameters.numPointLightShadows); } - function replaceClippingPlaneNums(string, parameters) { return string.replace(/NUM_CLIPPING_PLANES/g, parameters.numClippingPlanes).replace(/UNION_CLIPPING_PLANES/g, parameters.numClippingPlanes - parameters.numClipIntersection); -} // Resolve Includes +} +// Resolve Includes const includePattern = /^[ \t]*#include +<([\w\d./]+)>/gm; - function resolveIncludes(string) { return string.replace(includePattern, includeReplacer); } - function includeReplacer(match, include) { const string = ShaderChunk[include]; - if (string === undefined) { throw new Error('Can not resolve #include <' + include + '>'); } - return resolveIncludes(string); -} // Unroll Loops +} +// Unroll Loops const deprecatedUnrollLoopPattern = /#pragma unroll_loop[\s]+?for \( int i \= (\d+)\; i < (\d+)\; i \+\+ \) \{([\s\S]+?)(?=\})\}/g; const unrollLoopPattern = /#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 unrollLoops(string) { return string.replace(unrollLoopPattern, loopReplacer).replace(deprecatedUnrollLoopPattern, deprecatedLoopReplacer); } - function deprecatedLoopReplacer(match, start, end, snippet) { console.warn('WebGLProgram: #pragma unroll_loop shader syntax is deprecated. Please use #pragma unroll_loop_start syntax instead.'); return loopReplacer(match, start, end, snippet); } - function loopReplacer(match, start, end, snippet) { let string = ''; - for (let i = parseInt(start); i < parseInt(end); i++) { string += snippet.replace(/\[\s*i\s*\]/g, '[ ' + i + ' ]').replace(/UNROLLED_LOOP_INDEX/g, i); } - return string; -} // +} +// function generatePrecision(parameters) { let precisionstring = 'precision ' + parameters.precision + ' float;\nprecision ' + parameters.precision + ' int;'; - if (parameters.precision === 'highp') { precisionstring += '\n#define HIGH_PRECISION'; } else if (parameters.precision === 'mediump') { @@ -14162,13 +12451,10 @@ function generatePrecision(parameters) { } else if (parameters.precision === 'lowp') { precisionstring += '\n#define LOW_PRECISION'; } - return precisionstring; } - function generateShadowMapTypeDefine(parameters) { let shadowMapTypeDefine = 'SHADOWMAP_TYPE_BASIC'; - if (parameters.shadowMapType === PCFShadowMap) { shadowMapTypeDefine = 'SHADOWMAP_TYPE_PCF'; } else if (parameters.shadowMapType === PCFSoftShadowMap) { @@ -14176,33 +12462,26 @@ function generateShadowMapTypeDefine(parameters) { } else if (parameters.shadowMapType === VSMShadowMap) { shadowMapTypeDefine = 'SHADOWMAP_TYPE_VSM'; } - return shadowMapTypeDefine; } - function generateEnvMapTypeDefine(parameters) { let envMapTypeDefine = 'ENVMAP_TYPE_CUBE'; - if (parameters.envMap) { switch (parameters.envMapMode) { case CubeReflectionMapping: case CubeRefractionMapping: envMapTypeDefine = 'ENVMAP_TYPE_CUBE'; break; - case CubeUVReflectionMapping: case CubeUVRefractionMapping: envMapTypeDefine = 'ENVMAP_TYPE_CUBE_UV'; break; } } - return envMapTypeDefine; } - function generateEnvMapModeDefine(parameters) { let envMapModeDefine = 'ENVMAP_MODE_REFLECTION'; - if (parameters.envMap) { switch (parameters.envMapMode) { case CubeRefractionMapping: @@ -14211,35 +12490,29 @@ function generateEnvMapModeDefine(parameters) { break; } } - return envMapModeDefine; } - function generateEnvMapBlendingDefine(parameters) { let envMapBlendingDefine = 'ENVMAP_BLENDING_NONE'; - if (parameters.envMap) { switch (parameters.combine) { case MultiplyOperation: envMapBlendingDefine = 'ENVMAP_BLENDING_MULTIPLY'; break; - case MixOperation: envMapBlendingDefine = 'ENVMAP_BLENDING_MIX'; break; - case AddOperation: envMapBlendingDefine = 'ENVMAP_BLENDING_ADD'; break; } } - return envMapBlendingDefine; } - function WebGLProgram(renderer, cacheKey, parameters, bindingStates) { // TODO Send this event to Three.js DevTools // console.log( 'WebGLProgram', cacheKey ); + const gl = renderer.getContext(); const defines = parameters.defines; let vertexShader = parameters.vertexShader; @@ -14253,26 +12526,23 @@ function WebGLProgram(renderer, cacheKey, parameters, bindingStates) { const program = gl.createProgram(); let prefixVertex, prefixFragment; let versionString = parameters.glslVersion ? '#version ' + parameters.glslVersion + '\n' : ''; - if (parameters.isRawShaderMaterial) { prefixVertex = [customDefines].filter(filterEmptyLine).join('\n'); - if (prefixVertex.length > 0) { prefixVertex += '\n'; } - prefixFragment = [customExtensions, customDefines].filter(filterEmptyLine).join('\n'); - if (prefixFragment.length > 0) { prefixFragment += '\n'; } } else { prefixVertex = [generatePrecision(parameters), '#define SHADER_NAME ' + parameters.shaderName, customDefines, parameters.instancing ? '#define USE_INSTANCING' : '', parameters.instancingColor ? '#define USE_INSTANCING_COLOR' : '', parameters.supportsVertexTextures ? '#define VERTEX_TEXTURES' : '', '#define MAX_BONES ' + parameters.maxBones, parameters.useFog && parameters.fog ? '#define USE_FOG' : '', parameters.useFog && parameters.fogExp2 ? '#define FOG_EXP2' : '', parameters.map ? '#define USE_MAP' : '', parameters.envMap ? '#define USE_ENVMAP' : '', parameters.envMap ? '#define ' + envMapModeDefine : '', parameters.lightMap ? '#define USE_LIGHTMAP' : '', parameters.aoMap ? '#define USE_AOMAP' : '', parameters.emissiveMap ? '#define USE_EMISSIVEMAP' : '', parameters.bumpMap ? '#define USE_BUMPMAP' : '', parameters.normalMap ? '#define USE_NORMALMAP' : '', parameters.lowerNormalMap ? '#define USE_LOWER_8_BIT_NORMALMAP' : '', parameters.normalMap && parameters.objectSpaceNormalMap ? '#define OBJECTSPACE_NORMALMAP' : '', parameters.normalMap && parameters.tangentSpaceNormalMap ? '#define TANGENTSPACE_NORMALMAP' : '', parameters.clearcoatMap ? '#define USE_CLEARCOATMAP' : '', parameters.clearcoatRoughnessMap ? '#define USE_CLEARCOAT_ROUGHNESSMAP' : '', parameters.clearcoatNormalMap ? '#define USE_CLEARCOAT_NORMALMAP' : '', parameters.displacementMap && parameters.supportsVertexTextures ? '#define USE_DISPLACEMENTMAP' : '', parameters.specularMap ? '#define USE_SPECULARMAP' : '', parameters.specularIntensityMap ? '#define USE_SPECULARINTENSITYMAP' : '', parameters.specularColorMap ? '#define USE_SPECULARCOLORMAP' : '', parameters.roughnessMap ? '#define USE_ROUGHNESSMAP' : '', parameters.metalnessMap ? '#define USE_METALNESSMAP' : '', parameters.alphaMap ? '#define USE_ALPHAMAP' : '', parameters.transmission ? '#define USE_TRANSMISSION' : '', parameters.transmissionMap ? '#define USE_TRANSMISSIONMAP' : '', parameters.thicknessMap ? '#define USE_THICKNESSMAP' : '', parameters.sheenColorMap ? '#define USE_SHEENCOLORMAP' : '', parameters.sheenRoughnessMap ? '#define USE_SHEENROUGHNESSMAP' : '', parameters.vertexTangents ? '#define USE_TANGENT' : '', parameters.vertexColors ? '#define USE_COLOR' : '', parameters.vertexAlphas ? '#define USE_COLOR_ALPHA' : '', parameters.vertexUvs ? '#define USE_UV' : '', parameters.uvsVertexOnly ? '#define UVS_VERTEX_ONLY' : '', parameters.flatShading ? '#define FLAT_SHADED' : '', parameters.skinning ? '#define USE_SKINNING' : '', parameters.useVertexTexture ? '#define BONE_TEXTURE' : '', parameters.morphTargets ? '#define USE_MORPHTARGETS' : '', parameters.morphNormals && parameters.flatShading === false ? '#define USE_MORPHNORMALS' : '', parameters.morphTargets && parameters.isWebGL2 ? '#define MORPHTARGETS_TEXTURE' : '', parameters.morphTargets && parameters.isWebGL2 ? '#define MORPHTARGETS_COUNT ' + parameters.morphTargetsCount : '', parameters.doubleSided ? '#define DOUBLE_SIDED' : '', parameters.flipSided ? '#define FLIP_SIDED' : '', parameters.shadowMapEnabled ? '#define USE_SHADOWMAP' : '', parameters.shadowMapEnabled ? '#define ' + shadowMapTypeDefine : '', parameters.sizeAttenuation ? '#define USE_SIZEATTENUATION' : '', parameters.logarithmicDepthBuffer ? '#define USE_LOGDEPTHBUF' : '', parameters.logarithmicDepthBuffer && parameters.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', ' attribute mat4 instanceMatrix;', '#endif', '#ifdef USE_INSTANCING_COLOR', ' attribute vec3 instanceColor;', '#endif', 'attribute vec3 position;', 'attribute vec3 normal;', 'attribute vec2 uv;', '#ifdef USE_TANGENT', ' attribute vec4 tangent;', '#endif', '#if defined( USE_COLOR_ALPHA )', ' attribute vec4 color;', '#elif defined( USE_COLOR )', ' attribute vec3 color;', '#endif', '#if ( defined( USE_MORPHTARGETS ) && ! defined( MORPHTARGETS_TEXTURE ) )', ' attribute vec3 morphTarget0;', ' attribute vec3 morphTarget1;', ' attribute vec3 morphTarget2;', ' attribute vec3 morphTarget3;', ' #ifdef USE_MORPHNORMALS', ' attribute vec3 morphNormal0;', ' attribute vec3 morphNormal1;', ' attribute vec3 morphNormal2;', ' attribute vec3 morphNormal3;', ' #else', ' attribute vec3 morphTarget4;', ' attribute vec3 morphTarget5;', ' attribute vec3 morphTarget6;', ' attribute vec3 morphTarget7;', ' #endif', '#endif', '#ifdef USE_SKINNING', ' attribute vec4 skinIndex;', ' attribute vec4 skinWeight;', '#endif', '\n'].filter(filterEmptyLine).join('\n'); - prefixFragment = [customExtensions, generatePrecision(parameters), '#define SHADER_NAME ' + parameters.shaderName, customDefines, parameters.useFog && parameters.fog ? '#define USE_FOG' : '', parameters.useFog && parameters.fogExp2 ? '#define FOG_EXP2' : '', parameters.map ? '#define USE_MAP' : '', parameters.matcap ? '#define USE_MATCAP' : '', parameters.envMap ? '#define USE_ENVMAP' : '', parameters.envMap ? '#define ' + envMapTypeDefine : '', parameters.envMap ? '#define ' + envMapModeDefine : '', parameters.envMap ? '#define ' + envMapBlendingDefine : '', parameters.lightMap ? '#define USE_LIGHTMAP' : '', parameters.aoMap ? '#define USE_AOMAP' : '', parameters.emissiveMap ? '#define USE_EMISSIVEMAP' : '', parameters.bumpMap ? '#define USE_BUMPMAP' : '', parameters.normalMap ? '#define USE_NORMALMAP' : '', parameters.lowerNormalMap ? '#define USE_LOWER_8_BIT_NORMALMAP' : '', parameters.normalMap && parameters.objectSpaceNormalMap ? '#define OBJECTSPACE_NORMALMAP' : '', parameters.normalMap && parameters.tangentSpaceNormalMap ? '#define TANGENTSPACE_NORMALMAP' : '', parameters.clearcoat ? '#define USE_CLEARCOAT' : '', parameters.clearcoatMap ? '#define USE_CLEARCOATMAP' : '', parameters.clearcoatRoughnessMap ? '#define USE_CLEARCOAT_ROUGHNESSMAP' : '', parameters.clearcoatNormalMap ? '#define USE_CLEARCOAT_NORMALMAP' : '', parameters.specularMap ? '#define USE_SPECULARMAP' : '', parameters.specularIntensityMap ? '#define USE_SPECULARINTENSITYMAP' : '', parameters.specularColorMap ? '#define USE_SPECULARCOLORMAP' : '', parameters.roughnessMap ? '#define USE_ROUGHNESSMAP' : '', parameters.metalnessMap ? '#define USE_METALNESSMAP' : '', parameters.alphaMap ? '#define USE_ALPHAMAP' : '', parameters.alphaTest ? '#define USE_ALPHATEST' : '', parameters.sheen ? '#define USE_SHEEN' : '', parameters.sheenColorMap ? '#define USE_SHEENCOLORMAP' : '', parameters.sheenRoughnessMap ? '#define USE_SHEENROUGHNESSMAP' : '', parameters.transmission ? '#define USE_TRANSMISSION' : '', parameters.transmissionMap ? '#define USE_TRANSMISSIONMAP' : '', parameters.thicknessMap ? '#define USE_THICKNESSMAP' : '', parameters.refraction ? '#define USE_REFRACTION' : '', parameters.vertexTangents ? '#define USE_TANGENT' : '', parameters.vertexColors || parameters.instancingColor ? '#define USE_COLOR' : '', parameters.vertexAlphas ? '#define USE_COLOR_ALPHA' : '', parameters.vertexUvs ? '#define USE_UV' : '', parameters.uvsVertexOnly ? '#define UVS_VERTEX_ONLY' : '', parameters.gradientMap ? '#define USE_GRADIENTMAP' : '', parameters.flatShading ? '#define FLAT_SHADED' : '', parameters.doubleSided ? '#define DOUBLE_SIDED' : '', parameters.flipSided ? '#define FLIP_SIDED' : '', parameters.shadowMapEnabled ? '#define USE_SHADOWMAP' : '', parameters.shadowMapEnabled ? '#define ' + shadowMapTypeDefine : '', parameters.premultipliedAlpha ? '#define PREMULTIPLIED_ALPHA' : '', parameters.physicallyCorrectLights ? '#define PHYSICALLY_CORRECT_LIGHTS' : '', parameters.logarithmicDepthBuffer ? '#define USE_LOGDEPTHBUF' : '', parameters.logarithmicDepthBuffer && parameters.rendererExtensionFragDepth ? '#define USE_LOGDEPTHBUF_EXT' : '', (parameters.extensionShaderTextureLOD || parameters.envMap) && parameters.rendererExtensionShaderTextureLod ? '#define TEXTURE_LOD_EXT' : '', 'uniform mat4 viewMatrix;', 'uniform vec3 cameraPosition;', 'uniform bool isOrthographic;', parameters.toneMapping !== NoToneMapping ? '#define TONE_MAPPING' : '', parameters.toneMapping !== NoToneMapping ? ShaderChunk['tonemapping_pars_fragment'] : '', // this code is required here because it is used by the toneMapping() function defined below - parameters.toneMapping !== NoToneMapping ? getToneMappingFunction('toneMapping', parameters.toneMapping) : '', parameters.dithering ? '#define DITHERING' : '', parameters.transparent ? '' : '#define OPAQUE', ShaderChunk['encodings_pars_fragment'], // this code is required here because it is used by the various encoding/decoding function defined below + prefixFragment = [customExtensions, generatePrecision(parameters), '#define SHADER_NAME ' + parameters.shaderName, customDefines, parameters.useFog && parameters.fog ? '#define USE_FOG' : '', parameters.useFog && parameters.fogExp2 ? '#define FOG_EXP2' : '', parameters.map ? '#define USE_MAP' : '', parameters.matcap ? '#define USE_MATCAP' : '', parameters.envMap ? '#define USE_ENVMAP' : '', parameters.envMap ? '#define ' + envMapTypeDefine : '', parameters.envMap ? '#define ' + envMapModeDefine : '', parameters.envMap ? '#define ' + envMapBlendingDefine : '', parameters.lightMap ? '#define USE_LIGHTMAP' : '', parameters.aoMap ? '#define USE_AOMAP' : '', parameters.emissiveMap ? '#define USE_EMISSIVEMAP' : '', parameters.bumpMap ? '#define USE_BUMPMAP' : '', parameters.normalMap ? '#define USE_NORMALMAP' : '', parameters.lowerNormalMap ? '#define USE_LOWER_8_BIT_NORMALMAP' : '', parameters.normalMap && parameters.objectSpaceNormalMap ? '#define OBJECTSPACE_NORMALMAP' : '', parameters.normalMap && parameters.tangentSpaceNormalMap ? '#define TANGENTSPACE_NORMALMAP' : '', parameters.clearcoat ? '#define USE_CLEARCOAT' : '', parameters.clearcoatMap ? '#define USE_CLEARCOATMAP' : '', parameters.clearcoatRoughnessMap ? '#define USE_CLEARCOAT_ROUGHNESSMAP' : '', parameters.clearcoatNormalMap ? '#define USE_CLEARCOAT_NORMALMAP' : '', parameters.specularMap ? '#define USE_SPECULARMAP' : '', parameters.specularIntensityMap ? '#define USE_SPECULARINTENSITYMAP' : '', parameters.specularColorMap ? '#define USE_SPECULARCOLORMAP' : '', parameters.roughnessMap ? '#define USE_ROUGHNESSMAP' : '', parameters.metalnessMap ? '#define USE_METALNESSMAP' : '', parameters.alphaMap ? '#define USE_ALPHAMAP' : '', parameters.alphaTest ? '#define USE_ALPHATEST' : '', parameters.sheen ? '#define USE_SHEEN' : '', parameters.sheenColorMap ? '#define USE_SHEENCOLORMAP' : '', parameters.sheenRoughnessMap ? '#define USE_SHEENROUGHNESSMAP' : '', parameters.transmission ? '#define USE_TRANSMISSION' : '', parameters.transmissionMap ? '#define USE_TRANSMISSIONMAP' : '', parameters.thicknessMap ? '#define USE_THICKNESSMAP' : '', parameters.refraction ? '#define USE_REFRACTION' : '', parameters.vertexTangents ? '#define USE_TANGENT' : '', parameters.vertexColors || parameters.instancingColor ? '#define USE_COLOR' : '', parameters.vertexAlphas ? '#define USE_COLOR_ALPHA' : '', parameters.vertexUvs ? '#define USE_UV' : '', parameters.uvsVertexOnly ? '#define UVS_VERTEX_ONLY' : '', parameters.gradientMap ? '#define USE_GRADIENTMAP' : '', parameters.flatShading ? '#define FLAT_SHADED' : '', parameters.doubleSided ? '#define DOUBLE_SIDED' : '', parameters.flipSided ? '#define FLIP_SIDED' : '', parameters.shadowMapEnabled ? '#define USE_SHADOWMAP' : '', parameters.shadowMapEnabled ? '#define ' + shadowMapTypeDefine : '', parameters.premultipliedAlpha ? '#define PREMULTIPLIED_ALPHA' : '', parameters.physicallyCorrectLights ? '#define PHYSICALLY_CORRECT_LIGHTS' : '', parameters.logarithmicDepthBuffer ? '#define USE_LOGDEPTHBUF' : '', parameters.logarithmicDepthBuffer && parameters.rendererExtensionFragDepth ? '#define USE_LOGDEPTHBUF_EXT' : '', (parameters.extensionShaderTextureLOD || parameters.envMap) && parameters.rendererExtensionShaderTextureLod ? '#define TEXTURE_LOD_EXT' : '', 'uniform mat4 viewMatrix;', 'uniform vec3 cameraPosition;', 'uniform bool isOrthographic;', parameters.toneMapping !== NoToneMapping ? '#define TONE_MAPPING' : '', parameters.toneMapping !== NoToneMapping ? ShaderChunk['tonemapping_pars_fragment'] : '', + // this code is required here because it is used by the toneMapping() function defined below + parameters.toneMapping !== NoToneMapping ? getToneMappingFunction('toneMapping', parameters.toneMapping) : '', parameters.dithering ? '#define DITHERING' : '', parameters.transparent ? '' : '#define OPAQUE', ShaderChunk['encodings_pars_fragment'], + // this code is required here because it is used by the various encoding/decoding function defined below parameters.map ? getTexelDecodingFunction('mapTexelToLinear', parameters.mapEncoding) : '', parameters.matcap ? getTexelDecodingFunction('matcapTexelToLinear', parameters.matcapEncoding) : '', parameters.envMap ? getTexelDecodingFunction('envMapTexelToLinear', parameters.envMapEncoding) : '', parameters.emissiveMap ? getTexelDecodingFunction('emissiveMapTexelToLinear', parameters.emissiveMapEncoding) : '', parameters.specularColorMap ? getTexelDecodingFunction('specularColorMapTexelToLinear', parameters.specularColorMapEncoding) : '', parameters.sheenColorMap ? getTexelDecodingFunction('sheenColorMapTexelToLinear', parameters.sheenColorMapEncoding) : '', parameters.lightMap ? getTexelDecodingFunction('lightMapTexelToLinear', parameters.lightMapEncoding) : '', getTexelEncodingFunction('linearToOutputTexel', parameters.outputEncoding), parameters.depthPacking ? '#define DEPTH_PACKING ' + parameters.depthPacking : '', '\n'].filter(filterEmptyLine).join('\n'); } - vertexShader = resolveIncludes(vertexShader); vertexShader = replaceLightNums(vertexShader, parameters); vertexShader = replaceClippingPlaneNums(vertexShader, parameters); @@ -14281,22 +12551,25 @@ function WebGLProgram(renderer, cacheKey, parameters, bindingStates) { fragmentShader = replaceClippingPlaneNums(fragmentShader, parameters); vertexShader = unrollLoops(vertexShader); fragmentShader = unrollLoops(fragmentShader); - if (parameters.isWebGL2 && parameters.isRawShaderMaterial !== true) { // GLSL 3.0 conversion for built-in materials and ShaderMaterial + versionString = '#version 300 es\n'; prefixVertex = ['precision mediump sampler2DArray;', '#define attribute in', '#define varying out', '#define texture2D texture'].join('\n') + '\n' + prefixVertex; prefixFragment = ['#define varying in', parameters.glslVersion === GLSL3 ? '' : 'layout(location = 0) out highp vec4 pc_fragColor;', parameters.glslVersion === GLSL3 ? '' : '#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' + prefixFragment; } - const vertexGlsl = versionString + prefixVertex + vertexShader; - const fragmentGlsl = versionString + prefixFragment + fragmentShader; // console.log( '*VERTEX*', vertexGlsl ); + const fragmentGlsl = versionString + prefixFragment + fragmentShader; + + // console.log( '*VERTEX*', vertexGlsl ); // console.log( '*FRAGMENT*', fragmentGlsl ); const glVertexShader = WebGLShader(gl, gl.VERTEX_SHADER, vertexGlsl); const glFragmentShader = WebGLShader(gl, gl.FRAGMENT_SHADER, fragmentGlsl); gl.attachShader(program, glVertexShader); - gl.attachShader(program, glFragmentShader); // Force a particular attribute to index 0. + gl.attachShader(program, glFragmentShader); + + // Force a particular attribute to index 0. if (parameters.index0AttributeName !== undefined) { gl.bindAttribLocation(program, 0, parameters.index0AttributeName); @@ -14304,16 +12577,15 @@ function WebGLProgram(renderer, cacheKey, parameters, bindingStates) { // programs with morphTargets displace position out of attribute 0 gl.bindAttribLocation(program, 0, 'position'); } + gl.linkProgram(program); - gl.linkProgram(program); // check for link errors - + // check for link errors if (renderer.debug.checkShaderErrors) { const programLog = gl.getProgramInfoLog(program).trim(); const vertexLog = gl.getShaderInfoLog(glVertexShader).trim(); const fragmentLog = gl.getShaderInfoLog(glFragmentShader).trim(); let runnable = true; let haveDiagnostics = true; - if (gl.getProgramParameter(program, gl.LINK_STATUS) === false) { runnable = false; const vertexErrors = getShaderErrors(gl, glVertexShader, 'vertex'); @@ -14324,7 +12596,6 @@ function WebGLProgram(renderer, cacheKey, parameters, bindingStates) { } else if (vertexLog === '' || fragmentLog === '') { haveDiagnostics = false; } - if (haveDiagnostics) { this.diagnostics = { runnable: runnable, @@ -14339,43 +12610,46 @@ function WebGLProgram(renderer, cacheKey, parameters, bindingStates) { } }; } - } // Clean up + } + + // Clean up + // Crashes in iOS9 and iOS10. #18402 // gl.detachShader( program, glVertexShader ); // gl.detachShader( program, glFragmentShader ); - gl.deleteShader(glVertexShader); - gl.deleteShader(glFragmentShader); // set up caching for uniform locations + gl.deleteShader(glFragmentShader); - let cachedUniforms; + // set up caching for uniform locations + let cachedUniforms; this.getUniforms = function () { if (cachedUniforms === undefined) { cachedUniforms = new WebGLUniforms(gl, program); } - return cachedUniforms; - }; // set up caching for attribute locations + }; + // set up caching for attribute locations let cachedAttributes; - this.getAttributes = function () { if (cachedAttributes === undefined) { cachedAttributes = fetchAttributeLocations(gl, program); } - return cachedAttributes; - }; // free resource + }; + // free resource this.destroy = function () { bindingStates.releaseStatesOfProgram(this); gl.deleteProgram(program); this.program = undefined; - }; // + }; + // this.name = parameters.shaderName; this.id = programIdCount++; @@ -14388,97 +12662,72 @@ function WebGLProgram(renderer, cacheKey, parameters, bindingStates) { } let _id = 0; - class WebGLShaderCache { constructor() { this.shaderCache = new Map(); this.materialCache = new Map(); } - update(material) { const vertexShader = material.vertexShader; const fragmentShader = material.fragmentShader; - const vertexShaderStage = this._getShaderStage(vertexShader); - const fragmentShaderStage = this._getShaderStage(fragmentShader); - const materialShaders = this._getShaderCacheForMaterial(material); - if (materialShaders.has(vertexShaderStage) === false) { materialShaders.add(vertexShaderStage); vertexShaderStage.usedTimes++; } - if (materialShaders.has(fragmentShaderStage) === false) { materialShaders.add(fragmentShaderStage); fragmentShaderStage.usedTimes++; } - return this; } - remove(material) { const materialShaders = this.materialCache.get(material); - for (const shaderStage of materialShaders) { shaderStage.usedTimes--; if (shaderStage.usedTimes === 0) this.shaderCache.delete(shaderStage); } - this.materialCache.delete(material); return this; } - getVertexShaderID(material) { return this._getShaderStage(material.vertexShader).id; } - getFragmentShaderID(material) { return this._getShaderStage(material.fragmentShader).id; } - dispose() { this.shaderCache.clear(); this.materialCache.clear(); } - _getShaderCacheForMaterial(material) { const cache = this.materialCache; - if (cache.has(material) === false) { cache.set(material, new Set()); } - return cache.get(material); } - _getShaderStage(code) { const cache = this.shaderCache; - if (cache.has(code) === false) { const stage = new WebGLShaderStage(); cache.set(code, stage); } - return cache.get(code); } - } - class WebGLShaderStage { constructor() { this.id = _id++; this.usedTimes = 0; } - } function WebGLPrograms(renderer, cubemaps, cubeuvmaps, extensions, capabilities, bindingStates, clipping) { const _programLayers = new Layers(); - const _customShaders = new WebGLShaderCache(); - const programs = []; const isWebGL2 = capabilities.isWebGL2; const logarithmicDepthBuffer = capabilities.logarithmicDepthBuffer; @@ -14505,11 +12754,9 @@ function WebGLPrograms(renderer, cubemaps, cubeuvmaps, extensions, capabilities, ShadowMaterial: 'shadow', SpriteMaterial: 'sprite' }; - function getMaxBones(object) { const skeleton = object.skeleton; const bones = skeleton.bones; - if (floatVertexTextures) { return 1024; } else { @@ -14519,39 +12766,35 @@ function WebGLPrograms(renderer, cubemaps, cubeuvmaps, extensions, capabilities, // - leave some extra space for other uniforms // - limit here is ANGLE's 254 max uniform vectors // (up to 54 should be safe) + const nVertexUniforms = maxVertexUniforms; const nVertexMatrices = Math.floor((nVertexUniforms - 20) / 4); const maxBones = Math.min(nVertexMatrices, bones.length); - if (maxBones < bones.length) { console.warn('THREE.WebGLRenderer: Skeleton has ' + bones.length + ' bones. This GPU supports ' + maxBones + '.'); return 0; } - return maxBones; } } - function getParameters(material, lights, shadows, scene, object) { const fog = scene.fog; const environment = material.isMeshStandardMaterial ? scene.environment : null; const envMap = (material.isMeshStandardMaterial ? cubeuvmaps : cubemaps).get(material.envMap || environment); - const shaderID = shaderIDs[material.type]; // heuristics to create shader parameters according to lights in the scene + const shaderID = shaderIDs[material.type]; + + // heuristics to create shader parameters according to lights in the scene // (not to blow over maxLights budget) const maxBones = object.isSkinnedMesh ? getMaxBones(object) : 0; - if (material.precision !== null) { precision = capabilities.getMaxPrecision(material.precision); - if (precision !== material.precision) { console.warn('THREE.WebGLProgram.getParameters:', material.precision, 'not supported, using', precision, 'instead.'); } } - let vertexShader, fragmentShader; let customVertexShaderID, customFragmentShaderID; - if (shaderID) { const shader = ShaderLib[shaderID]; vertexShader = shader.vertexShader; @@ -14559,13 +12802,10 @@ function WebGLPrograms(renderer, cubemaps, cubeuvmaps, extensions, capabilities, } else { vertexShader = material.vertexShader; fragmentShader = material.fragmentShader; - _customShaders.update(material); - customVertexShaderID = _customShaders.getVertexShaderID(material); customFragmentShaderID = _customShaders.getFragmentShaderID(material); } - const currentRenderTarget = renderer.getRenderTarget(); const useAlphaTest = material.alphaTest > 0; const useClearcoat = material.clearcoat > 0; @@ -14675,34 +12915,28 @@ function WebGLPrograms(renderer, cubemaps, cubeuvmaps, extensions, capabilities, }; return parameters; } - function getProgramCacheKey(parameters) { const array = []; - if (parameters.shaderID) { array.push(parameters.shaderID); } else { array.push(parameters.customVertexShaderID); array.push(parameters.customFragmentShaderID); } - if (parameters.defines !== undefined) { for (const name in parameters.defines) { array.push(name); array.push(parameters.defines[name]); } } - if (parameters.isRawShaderMaterial === false) { getProgramCacheKeyParameters(array, parameters); getProgramCacheKeyBooleans(array, parameters); array.push(renderer.outputEncoding); } - array.push(parameters.customProgramCacheKey); return array.join(); } - function getProgramCacheKeyParameters(array, parameters) { array.push(parameters.precision); array.push(parameters.outputEncoding); @@ -14733,10 +12967,8 @@ function WebGLPrograms(renderer, cubemaps, cubeuvmaps, extensions, capabilities, array.push(parameters.specularColorMapEncoding); array.push(parameters.sheenColorMapEncoding); } - function getProgramCacheKeyBooleans(array, parameters) { _programLayers.disableAll(); - if (parameters.isWebGL2) _programLayers.enable(0); if (parameters.supportsVertexTextures) _programLayers.enable(1); if (parameters.instancing) _programLayers.enable(2); @@ -14770,9 +13002,7 @@ function WebGLPrograms(renderer, cubemaps, cubeuvmaps, extensions, capabilities, if (parameters.uvsVertexOnly) _programLayers.enable(30); if (parameters.fog) _programLayers.enable(31); array.push(_programLayers.mask); - _programLayers.disableAll(); - if (parameters.useFog) _programLayers.enable(0); if (parameters.flatShading) _programLayers.enable(1); if (parameters.logarithmicDepthBuffer) _programLayers.enable(2); @@ -14800,61 +13030,52 @@ function WebGLPrograms(renderer, cubemaps, cubeuvmaps, extensions, capabilities, if (parameters.refraction) _programLayers.enable(24); array.push(_programLayers.mask); } - function getUniforms(material) { const shaderID = shaderIDs[material.type]; let uniforms; - if (shaderID) { const shader = ShaderLib[shaderID]; uniforms = UniformsUtils.clone(shader.uniforms); } else { uniforms = material.uniforms; } - return uniforms; } - function acquireProgram(parameters, cacheKey) { - let program; // Check if code has been already compiled + let program; + // Check if code has been already compiled for (let p = 0, pl = programs.length; p < pl; p++) { const preexistingProgram = programs[p]; - if (preexistingProgram.cacheKey === cacheKey) { program = preexistingProgram; ++program.usedTimes; break; } } - if (program === undefined) { program = new WebGLProgram(renderer, cacheKey, parameters, bindingStates); programs.push(program); } - return program; } - function releaseProgram(program) { if (--program.usedTimes === 0) { // Remove from unordered set const i = programs.indexOf(program); programs[i] = programs[programs.length - 1]; - programs.pop(); // Free WebGL resources + programs.pop(); + // Free WebGL resources program.destroy(); } } - function releaseShaderCache(material) { _customShaders.remove(material); } - function dispose() { _customShaders.dispose(); } - return { getParameters: getParameters, getProgramCacheKey: getProgramCacheKey, @@ -14870,30 +13091,23 @@ function WebGLPrograms(renderer, cubemaps, cubeuvmaps, extensions, capabilities, function WebGLProperties() { let properties = new WeakMap(); - function get(object) { let map = properties.get(object); - if (map === undefined) { map = {}; properties.set(object, map); } - return map; } - function remove(object) { properties.delete(object); } - function update(object, key, value) { properties.get(object)[key] = value; } - function dispose() { properties = new WeakMap(); } - return { get: get, remove: remove, @@ -14915,7 +13129,6 @@ function painterSortStable(a, b) { return a.id - b.id; } } - function reversePainterSortStable(a, b) { if (a.groupOrder !== b.groupOrder) { return a.groupOrder - b.groupOrder; @@ -14927,24 +13140,20 @@ function reversePainterSortStable(a, b) { return a.id - b.id; } } - function WebGLRenderList() { const renderItems = []; let renderItemsIndex = 0; const opaque = []; const transmissive = []; const transparent = []; - function init() { renderItemsIndex = 0; opaque.length = 0; transmissive.length = 0; transparent.length = 0; } - function getNextRenderItem(object, geometry, material, groupOrder, z, group) { let renderItem = renderItems[renderItemsIndex]; - if (renderItem === undefined) { renderItem = { id: object.id, @@ -14967,14 +13176,11 @@ function WebGLRenderList() { renderItem.z = z; renderItem.group = group; } - renderItemsIndex++; return renderItem; } - function push(object, geometry, material, groupOrder, z, group) { const renderItem = getNextRenderItem(object, geometry, material, groupOrder, z, group); - if (material.transmission > 0.0) { transmissive.push(renderItem); } else if (material.transparent === true) { @@ -14983,10 +13189,8 @@ function WebGLRenderList() { opaque.push(renderItem); } } - function unshift(object, geometry, material, groupOrder, z, group) { const renderItem = getNextRenderItem(object, geometry, material, groupOrder, z, group); - if (material.transmission > 0.0) { transmissive.unshift(renderItem); } else if (material.transparent === true) { @@ -14995,15 +13199,14 @@ function WebGLRenderList() { opaque.unshift(renderItem); } } - function sort(customOpaqueSort, customTransparentSort) { if (opaque.length > 1) opaque.sort(customOpaqueSort || painterSortStable); if (transmissive.length > 1) transmissive.sort(customTransparentSort || reversePainterSortStable); if (transparent.length > 1) transparent.sort(customTransparentSort || reversePainterSortStable); } - function finish() { // Clear references from inactive renderItems in the list + for (let i = renderItemsIndex, il = renderItems.length; i < il; i++) { const renderItem = renderItems[i]; if (renderItem.id === null) break; @@ -15014,7 +13217,6 @@ function WebGLRenderList() { renderItem.group = null; } } - return { opaque: opaque, transmissive: transmissive, @@ -15026,13 +13228,10 @@ function WebGLRenderList() { sort: sort }; } - function WebGLRenderLists() { let lists = new WeakMap(); - function get(scene, renderCallDepth) { let list; - if (lists.has(scene) === false) { list = new WebGLRenderList(); lists.set(scene, [list]); @@ -15044,14 +13243,11 @@ function WebGLRenderLists() { list = lists.get(scene)[renderCallDepth]; } } - return list; } - function dispose() { lists = new WeakMap(); } - return { get: get, dispose: dispose @@ -15065,9 +13261,7 @@ function UniformsCache() { if (lights[light.id] !== undefined) { return lights[light.id]; } - let uniforms; - switch (light.type) { case 'DirectionalLight': uniforms = { @@ -15075,7 +13269,6 @@ function UniformsCache() { color: new Color() }; break; - case 'SpotLight': uniforms = { position: new Vector3(), @@ -15087,7 +13280,6 @@ function UniformsCache() { decay: 0 }; break; - case 'PointLight': uniforms = { position: new Vector3(), @@ -15096,7 +13288,6 @@ function UniformsCache() { decay: 0 }; break; - case 'HemisphereLight': uniforms = { direction: new Vector3(), @@ -15104,7 +13295,6 @@ function UniformsCache() { groundColor: new Color() }; break; - case 'RectAreaLight': uniforms = { color: new Color(), @@ -15114,13 +13304,11 @@ function UniformsCache() { }; break; } - lights[light.id] = uniforms; return uniforms; } }; } - function ShadowUniformsCache() { const lights = {}; return { @@ -15128,9 +13316,7 @@ function ShadowUniformsCache() { if (lights[light.id] !== undefined) { return lights[light.id]; } - let uniforms; - switch (light.type) { case 'DirectionalLight': uniforms = { @@ -15140,7 +13326,6 @@ function ShadowUniformsCache() { shadowMapSize: new Vector2() }; break; - case 'SpotLight': uniforms = { shadowBias: 0, @@ -15149,7 +13334,6 @@ function ShadowUniformsCache() { shadowMapSize: new Vector2() }; break; - case 'PointLight': uniforms = { shadowBias: 0, @@ -15160,21 +13344,18 @@ function ShadowUniformsCache() { shadowCameraFar: 1000 }; break; + // TODO (abelnation): set RectAreaLight shadow uniforms } - lights[light.id] = uniforms; return uniforms; } }; } - let nextVersion = 0; - function shadowCastingLightsFirst(lightA, lightB) { return (lightB.castShadow ? 1 : 0) - (lightA.castShadow ? 1 : 0); } - function WebGLLights(extensions, capabilities) { const cache = new UniformsCache(); const shadowCache = ShadowUniformsCache(); @@ -15209,20 +13390,15 @@ function WebGLLights(extensions, capabilities) { pointShadowMatrix: [], hemi: [] }; - for (let i = 0; i < 9; i++) state.probe.push(new Vector3()); - const vector3 = new Vector3(); const matrix4 = new Matrix4(); const matrix42 = new Matrix4(); - function setup(lights, physicallyCorrectLights) { let r = 0, - g = 0, - b = 0; - + g = 0, + b = 0; for (let i = 0; i < 9; i++) state.probe[i].set(0, 0, 0); - let directionalLength = 0; let pointLength = 0; let spotLength = 0; @@ -15231,17 +13407,16 @@ function WebGLLights(extensions, capabilities) { let numDirectionalShadows = 0; let numPointShadows = 0; let numSpotShadows = 0; - lights.sort(shadowCastingLightsFirst); // artist-friendly light intensity scaling factor + lights.sort(shadowCastingLightsFirst); + // artist-friendly light intensity scaling factor const scaleFactor = physicallyCorrectLights !== true ? Math.PI : 1; - for (let i = 0, l = lights.length; i < l; i++) { const light = lights[i]; const color = light.color; const intensity = light.intensity; const distance = light.distance; const shadowMap = light.shadow && light.shadow.map ? light.shadow.map.texture : null; - if (light.isAmbientLight) { r += color.r * intensity * scaleFactor; g += color.g * intensity * scaleFactor; @@ -15253,7 +13428,6 @@ function WebGLLights(extensions, capabilities) { } else if (light.isDirectionalLight) { const uniforms = cache.get(light); uniforms.color.copy(light.color).multiplyScalar(light.intensity * scaleFactor); - if (light.castShadow) { const shadow = light.shadow; const shadowUniforms = shadowCache.get(light); @@ -15266,7 +13440,6 @@ function WebGLLights(extensions, capabilities) { state.directionalShadowMatrix[directionalLength] = light.shadow.matrix; numDirectionalShadows++; } - state.directional[directionalLength] = uniforms; directionalLength++; } else if (light.isSpotLight) { @@ -15277,7 +13450,6 @@ function WebGLLights(extensions, capabilities) { uniforms.coneCos = Math.cos(light.angle); uniforms.penumbraCos = Math.cos(light.angle * (1 - light.penumbra)); uniforms.decay = light.decay; - if (light.castShadow) { const shadow = light.shadow; const shadowUniforms = shadowCache.get(light); @@ -15290,14 +13462,15 @@ function WebGLLights(extensions, capabilities) { state.spotShadowMatrix[spotLength] = light.shadow.matrix; numSpotShadows++; } - state.spot[spotLength] = uniforms; spotLength++; } else if (light.isRectAreaLight) { - const uniforms = cache.get(light); // (a) intensity is the total visible light emitted + const uniforms = cache.get(light); + + // (a) intensity is the total visible light emitted //uniforms.color.copy( color ).multiplyScalar( intensity / ( light.width * light.height * Math.PI ) ); - // (b) intensity is the brightness of the light + // (b) intensity is the brightness of the light uniforms.color.copy(color).multiplyScalar(intensity); uniforms.halfWidth.set(light.width * 0.5, 0.0, 0.0); uniforms.halfHeight.set(0.0, light.height * 0.5, 0.0); @@ -15308,7 +13481,6 @@ function WebGLLights(extensions, capabilities) { uniforms.color.copy(light.color).multiplyScalar(light.intensity * scaleFactor); uniforms.distance = light.distance; uniforms.decay = light.decay; - if (light.castShadow) { const shadow = light.shadow; const shadowUniforms = shadowCache.get(light); @@ -15323,7 +13495,6 @@ function WebGLLights(extensions, capabilities) { state.pointShadowMatrix[pointLength] = light.shadow.matrix; numPointShadows++; } - state.point[pointLength] = uniforms; pointLength++; } else if (light.isHemisphereLight) { @@ -15334,14 +13505,15 @@ function WebGLLights(extensions, capabilities) { hemiLength++; } } - if (rectAreaLength > 0) { if (capabilities.isWebGL2) { // WebGL 2 + state.rectAreaLTC1 = UniformsLib.LTC_FLOAT_1; state.rectAreaLTC2 = UniformsLib.LTC_FLOAT_2; } else { // WebGL 1 + if (extensions.has('OES_texture_float_linear') === true) { state.rectAreaLTC1 = UniformsLib.LTC_FLOAT_1; state.rectAreaLTC2 = UniformsLib.LTC_FLOAT_2; @@ -15353,12 +13525,10 @@ function WebGLLights(extensions, capabilities) { } } } - state.ambient[0] = r; state.ambient[1] = g; state.ambient[2] = b; const hash = state.hash; - if (hash.directionalLength !== directionalLength || hash.pointLength !== pointLength || hash.spotLength !== spotLength || hash.rectAreaLength !== rectAreaLength || hash.hemiLength !== hemiLength || hash.numDirectionalShadows !== numDirectionalShadows || hash.numPointShadows !== numPointShadows || hash.numSpotShadows !== numSpotShadows) { state.directional.length = directionalLength; state.spot.length = spotLength; @@ -15385,7 +13555,6 @@ function WebGLLights(extensions, capabilities) { state.version = nextVersion++; } } - function setupView(lights, camera) { let directionalLength = 0; let pointLength = 0; @@ -15393,10 +13562,8 @@ function WebGLLights(extensions, capabilities) { let rectAreaLength = 0; let hemiLength = 0; const viewMatrix = camera.matrixWorldInverse; - for (let i = 0, l = lights.length; i < l; i++) { const light = lights[i]; - if (light.isDirectionalLight) { const uniforms = state.directional[directionalLength]; uniforms.direction.setFromMatrixPosition(light.matrixWorld); @@ -15416,8 +13583,9 @@ function WebGLLights(extensions, capabilities) { } else if (light.isRectAreaLight) { const uniforms = state.rectArea[rectAreaLength]; uniforms.position.setFromMatrixPosition(light.matrixWorld); - uniforms.position.applyMatrix4(viewMatrix); // extract local rotation of light to derive width/height half vectors + uniforms.position.applyMatrix4(viewMatrix); + // extract local rotation of light to derive width/height half vectors matrix42.identity(); matrix4.copy(light.matrixWorld); matrix4.premultiply(viewMatrix); @@ -15441,7 +13609,6 @@ function WebGLLights(extensions, capabilities) { } } } - return { setup: setup, setupView: setupView, @@ -15453,28 +13620,22 @@ function WebGLRenderState(extensions, capabilities) { const lights = new WebGLLights(extensions, capabilities); const lightsArray = []; const shadowsArray = []; - function init() { lightsArray.length = 0; shadowsArray.length = 0; } - function pushLight(light) { lightsArray.push(light); } - function pushShadow(shadowLight) { shadowsArray.push(shadowLight); } - function setupLights(physicallyCorrectLights) { lights.setup(lightsArray, physicallyCorrectLights); } - function setupLightsView(camera) { lights.setupView(lightsArray, camera); } - const state = { lightsArray: lightsArray, shadowsArray: shadowsArray, @@ -15489,13 +13650,10 @@ function WebGLRenderState(extensions, capabilities) { pushShadow: pushShadow }; } - function WebGLRenderStates(extensions, capabilities) { let renderStates = new WeakMap(); - function get(scene, renderCallDepth = 0) { let renderState; - if (renderStates.has(scene) === false) { renderState = new WebGLRenderState(extensions, capabilities); renderStates.set(scene, [renderState]); @@ -15507,14 +13665,11 @@ function WebGLRenderStates(extensions, capabilities) { renderState = renderStates.get(scene)[renderCallDepth]; } } - return renderState; } - function dispose() { renderStates = new WeakMap(); } - return { get: get, dispose: dispose @@ -15554,7 +13709,6 @@ class MeshDepthMaterial extends Material { this.fog = false; this.setValues(parameters); } - copy(source) { super.copy(source); this.depthPacking = source.depthPacking; @@ -15567,9 +13721,7 @@ class MeshDepthMaterial extends Material { this.wireframeLinewidth = source.wireframeLinewidth; return this; } - } - MeshDepthMaterial.prototype.isMeshDepthMaterial = true; /** @@ -15605,7 +13757,6 @@ class MeshDistanceMaterial extends Material { this.fog = false; this.setValues(parameters); } - copy(source) { super.copy(source); this.referencePosition.copy(source.referencePosition); @@ -15618,9 +13769,7 @@ class MeshDistanceMaterial extends Material { this.displacementBias = source.displacementBias; return this; } - } - MeshDistanceMaterial.prototype.isMeshDistanceMaterial = true; const vertex = "void main() {\n\tgl_Position = vec4( position, 1.0 );\n}"; @@ -15628,17 +13777,15 @@ const fragment = "uniform sampler2D shadow_pass;\nuniform vec2 resolution;\nunif function WebGLShadowMap(_renderer, _objects, _capabilities) { let _frustum = new Frustum(); - const _shadowMapSize = new Vector2(), - _viewportSize = new Vector2(), - _viewport = new Vector4(), - _depthMaterial = new MeshDepthMaterial({ - depthPacking: RGBADepthPacking - }), - _distanceMaterial = new MeshDistanceMaterial(), - _materialCache = {}, - _maxTextureSize = _capabilities.maxTextureSize; - + _viewportSize = new Vector2(), + _viewport = new Vector4(), + _depthMaterial = new MeshDepthMaterial({ + depthPacking: RGBADepthPacking + }), + _distanceMaterial = new MeshDistanceMaterial(), + _materialCache = {}, + _maxTextureSize = _capabilities.maxTextureSize; const shadowSide = { 0: BackSide, 1: FrontSide, @@ -15672,62 +13819,47 @@ function WebGLShadowMap(_renderer, _objects, _capabilities) { this.autoUpdate = true; this.needsUpdate = false; this.type = PCFShadowMap; - this.render = function (lights, scene, camera) { if (scope.enabled === false) return; if (scope.autoUpdate === false && scope.needsUpdate === false) return; if (lights.length === 0) return; - const currentRenderTarget = _renderer.getRenderTarget(); - const activeCubeFace = _renderer.getActiveCubeFace(); - const activeMipmapLevel = _renderer.getActiveMipmapLevel(); + const _state = _renderer.state; - const _state = _renderer.state; // Set GL state for depth map. - + // Set GL state for depth map. _state.setBlending(NoBlending); - _state.buffers.color.setClear(1, 1, 1, 1); - _state.buffers.depth.setTest(true); + _state.setScissorTest(false); - _state.setScissorTest(false); // render depth map - + // render depth map for (let i = 0, il = lights.length; i < il; i++) { const light = lights[i]; const shadow = light.shadow; - if (shadow === undefined) { console.warn('THREE.WebGLShadowMap:', light, 'has no shadow.'); continue; } - if (shadow.autoUpdate === false && shadow.needsUpdate === false) continue; - _shadowMapSize.copy(shadow.mapSize); - const shadowFrameExtents = shadow.getFrameExtents(); - _shadowMapSize.multiply(shadowFrameExtents); - _viewportSize.copy(shadow.mapSize); - if (_shadowMapSize.x > _maxTextureSize || _shadowMapSize.y > _maxTextureSize) { if (_shadowMapSize.x > _maxTextureSize) { _viewportSize.x = Math.floor(_maxTextureSize / shadowFrameExtents.x); _shadowMapSize.x = _viewportSize.x * shadowFrameExtents.x; shadow.mapSize.x = _viewportSize.x; } - if (_shadowMapSize.y > _maxTextureSize) { _viewportSize.y = Math.floor(_maxTextureSize / shadowFrameExtents.y); _shadowMapSize.y = _viewportSize.y * shadowFrameExtents.y; shadow.mapSize.y = _viewportSize.y; } } - if (shadow.map === null && !shadow.isPointLightShadow && this.type === VSMShadowMap) { const pars = { minFilter: LinearFilter, @@ -15739,7 +13871,6 @@ function WebGLShadowMap(_renderer, _objects, _capabilities) { shadow.mapPass = new WebGLRenderTarget(_shadowMapSize.x, _shadowMapSize.y, pars); shadow.camera.updateProjectionMatrix(); } - if (shadow.map === null) { const pars = { minFilter: NearestFilter, @@ -15750,112 +13881,88 @@ function WebGLShadowMap(_renderer, _objects, _capabilities) { shadow.map.texture.name = light.name + '.shadowMap'; shadow.camera.updateProjectionMatrix(); } - _renderer.setRenderTarget(shadow.map); - _renderer.clear(); - const viewportCount = shadow.getViewportCount(); - for (let vp = 0; vp < viewportCount; vp++) { const viewport = shadow.getViewport(vp); - _viewport.set(_viewportSize.x * viewport.x, _viewportSize.y * viewport.y, _viewportSize.x * viewport.z, _viewportSize.y * viewport.w); - _state.viewport(_viewport); - shadow.updateMatrices(light, vp); _frustum = shadow.getFrustum(); renderObject(scene, camera, shadow.camera, light, this.type); - } // do blur pass for VSM + } + // do blur pass for VSM if (!shadow.isPointLightShadow && this.type === VSMShadowMap) { VSMPass(shadow, camera); } - shadow.needsUpdate = false; } - scope.needsUpdate = false; - _renderer.setRenderTarget(currentRenderTarget, activeCubeFace, activeMipmapLevel); }; - function VSMPass(shadow, camera) { const geometry = _objects.update(fullScreenMesh); - if (shadowMaterialVertical.defines.VSM_SAMPLES !== shadow.blurSamples) { shadowMaterialVertical.defines.VSM_SAMPLES = shadow.blurSamples; shadowMaterialHorizontal.defines.VSM_SAMPLES = shadow.blurSamples; shadowMaterialVertical.needsUpdate = true; shadowMaterialHorizontal.needsUpdate = true; - } // vertical pass + } + // vertical pass shadowMaterialVertical.uniforms.shadow_pass.value = shadow.map.texture; shadowMaterialVertical.uniforms.resolution.value = shadow.mapSize; shadowMaterialVertical.uniforms.radius.value = shadow.radius; - _renderer.setRenderTarget(shadow.mapPass); - _renderer.clear(); + _renderer.renderBufferDirect(camera, null, geometry, shadowMaterialVertical, fullScreenMesh, null); - _renderer.renderBufferDirect(camera, null, geometry, shadowMaterialVertical, fullScreenMesh, null); // horizontal pass - + // horizontal pass shadowMaterialHorizontal.uniforms.shadow_pass.value = shadow.mapPass.texture; shadowMaterialHorizontal.uniforms.resolution.value = shadow.mapSize; shadowMaterialHorizontal.uniforms.radius.value = shadow.radius; - _renderer.setRenderTarget(shadow.map); - _renderer.clear(); - _renderer.renderBufferDirect(camera, null, geometry, shadowMaterialHorizontal, fullScreenMesh, null); } - function getDepthMaterial(object, geometry, material, light, shadowCameraNear, shadowCameraFar, type) { let result = null; const customMaterial = light.isPointLight === true ? object.customDistanceMaterial : object.customDepthMaterial; - if (customMaterial !== undefined) { result = customMaterial; } else { result = light.isPointLight === true ? _distanceMaterial : _depthMaterial; } - if (_renderer.localClippingEnabled && material.clipShadows === true && material.clippingPlanes.length !== 0 || material.displacementMap && material.displacementScale !== 0 || material.alphaMap && material.alphaTest > 0) { // in this case we need a unique material instance reflecting the // appropriate state + const keyA = result.uuid, - keyB = material.uuid; + keyB = material.uuid; let materialsForVariant = _materialCache[keyA]; - if (materialsForVariant === undefined) { materialsForVariant = {}; _materialCache[keyA] = materialsForVariant; } - let cachedMaterial = materialsForVariant[keyB]; - if (cachedMaterial === undefined) { cachedMaterial = result.clone(); materialsForVariant[keyB] = cachedMaterial; } - result = cachedMaterial; } - result.visible = material.visible; result.wireframe = material.wireframe; - if (type === VSMShadowMap) { result.side = material.shadowSide !== null ? material.shadowSide : material.side; } else { result.side = material.shadowSide !== null ? material.shadowSide : shadowSide[material.side]; } - result.alphaMap = material.alphaMap; result.alphaTest = material.alphaTest; result.clipShadows = material.clipShadows; @@ -15866,51 +13973,38 @@ function WebGLShadowMap(_renderer, _objects, _capabilities) { result.displacementBias = material.displacementBias; result.wireframeLinewidth = material.wireframeLinewidth; result.linewidth = material.linewidth; - if (light.isPointLight === true && result.isMeshDistanceMaterial === true) { result.referencePosition.setFromMatrixPosition(light.matrixWorld); result.nearDistance = shadowCameraNear; result.farDistance = shadowCameraFar; } - return result; } - function renderObject(object, camera, shadowCamera, light, type) { if (object.visible === false) return; const visible = object.layers.test(camera.layers); - if (visible && (object.isMesh || object.isLine || object.isPoints)) { if ((object.castShadow || object.receiveShadow && type === VSMShadowMap) && (!object.frustumCulled || _frustum.intersectsObject(object))) { object.modelViewMatrix.multiplyMatrices(shadowCamera.matrixWorldInverse, object.matrixWorld); - const geometry = _objects.update(object); - const material = object.material; - if (Array.isArray(material)) { const groups = geometry.groups; - for (let k = 0, kl = groups.length; k < kl; k++) { const group = groups[k]; const groupMaterial = material[group.materialIndex]; - if (groupMaterial && groupMaterial.visible) { const depthMaterial = getDepthMaterial(object, geometry, groupMaterial, light, shadowCamera.near, shadowCamera.far, type); - _renderer.renderBufferDirect(shadowCamera, null, geometry, depthMaterial, object, group); } } } else if (material.visible) { const depthMaterial = getDepthMaterial(object, geometry, material, light, shadowCamera.near, shadowCamera.far, type); - _renderer.renderBufferDirect(shadowCamera, null, geometry, depthMaterial, object, null); } } } - const children = object.children; - for (let i = 0, l = children.length; i < l; i++) { renderObject(children[i], camera, shadowCamera, light, type); } @@ -15919,7 +14013,6 @@ function WebGLShadowMap(_renderer, _objects, _capabilities) { function WebGLState(gl, extensions, capabilities) { const isWebGL2 = capabilities.isWebGL2; - function ColorBuffer() { let locked = false; const color = new Vector4(); @@ -15941,9 +14034,7 @@ function WebGLState(gl, extensions, capabilities) { g *= a; b *= a; } - color.set(r, g, b, a); - if (currentColorClear.equals(color) === false) { gl.clearColor(r, g, b, a); currentColorClear.copy(color); @@ -15956,7 +14047,6 @@ function WebGLState(gl, extensions, capabilities) { } }; } - function DepthBuffer() { let locked = false; let currentDepthMask = null; @@ -15983,42 +14073,33 @@ function WebGLState(gl, extensions, capabilities) { case NeverDepth: gl.depthFunc(gl.NEVER); break; - case AlwaysDepth: gl.depthFunc(gl.ALWAYS); break; - case LessDepth: gl.depthFunc(gl.LESS); break; - case LessEqualDepth: gl.depthFunc(gl.LEQUAL); break; - case EqualDepth: gl.depthFunc(gl.EQUAL); break; - case GreaterEqualDepth: gl.depthFunc(gl.GEQUAL); break; - case GreaterDepth: gl.depthFunc(gl.GREATER); break; - case NotEqualDepth: gl.depthFunc(gl.NOTEQUAL); break; - default: gl.depthFunc(gl.LEQUAL); } } else { gl.depthFunc(gl.LEQUAL); } - currentDepthFunc = depthFunc; } }, @@ -16039,7 +14120,6 @@ function WebGLState(gl, extensions, capabilities) { } }; } - function StencilBuffer() { let locked = false; let currentStencilMask = null; @@ -16103,8 +14183,9 @@ function WebGLState(gl, extensions, capabilities) { currentStencilClear = null; } }; - } // + } + // const colorBuffer = new ColorBuffer(); const depthBuffer = new DepthBuffer(); @@ -16132,7 +14213,6 @@ function WebGLState(gl, extensions, capabilities) { let lineWidthAvailable = false; let version = 0; const glVersion = gl.getParameter(gl.VERSION); - if (glVersion.indexOf('WebGL') !== -1) { version = parseFloat(/^WebGL (\d)/.exec(glVersion)[1]); lineWidthAvailable = version >= 1.0; @@ -16140,32 +14220,28 @@ function WebGLState(gl, extensions, capabilities) { version = parseFloat(/^OpenGL ES (\d)/.exec(glVersion)[1]); lineWidthAvailable = version >= 2.0; } - let currentTextureSlot = null; let currentBoundTextures = {}; const scissorParam = gl.getParameter(gl.SCISSOR_BOX); const viewportParam = gl.getParameter(gl.VIEWPORT); const currentScissor = new Vector4().fromArray(scissorParam); const currentViewport = new Vector4().fromArray(viewportParam); - function createTexture(type, target, count) { const data = new Uint8Array(4); // 4 is required to match default unpack alignment of 4. - const texture = gl.createTexture(); gl.bindTexture(type, texture); gl.texParameteri(type, gl.TEXTURE_MIN_FILTER, gl.NEAREST); gl.texParameteri(type, gl.TEXTURE_MAG_FILTER, gl.NEAREST); - for (let i = 0; i < count; i++) { gl.texImage2D(target + i, 0, gl.RGBA, 1, 1, 0, gl.RGBA, gl.UNSIGNED_BYTE, data); } - return texture; } - const emptyTextures = {}; emptyTextures[gl.TEXTURE_2D] = createTexture(gl.TEXTURE_2D, gl.TEXTURE_2D, 1); - emptyTextures[gl.TEXTURE_CUBE_MAP] = createTexture(gl.TEXTURE_CUBE_MAP, gl.TEXTURE_CUBE_MAP_POSITIVE_X, 6); // init + emptyTextures[gl.TEXTURE_CUBE_MAP] = createTexture(gl.TEXTURE_CUBE_MAP, gl.TEXTURE_CUBE_MAP_POSITIVE_X, 6); + + // init colorBuffer.setClear(0, 0, 0, 1); depthBuffer.setClear(1); @@ -16175,7 +14251,9 @@ function WebGLState(gl, extensions, capabilities) { setFlipSided(false); setCullFace(CullFaceBack); enable(gl.CULL_FACE); - setBlending(NoBlending); // + setBlending(NoBlending); + + // function enable(id) { if (enabledCapabilities[id] !== true) { @@ -16183,56 +14261,45 @@ function WebGLState(gl, extensions, capabilities) { enabledCapabilities[id] = true; } } - function disable(id) { if (enabledCapabilities[id] !== false) { gl.disable(id); enabledCapabilities[id] = false; } } - function bindFramebuffer(target, framebuffer) { if (currentBoundFramebuffers[target] !== framebuffer) { gl.bindFramebuffer(target, framebuffer); currentBoundFramebuffers[target] = framebuffer; - if (isWebGL2) { // gl.DRAW_FRAMEBUFFER is equivalent to gl.FRAMEBUFFER + if (target === gl.DRAW_FRAMEBUFFER) { currentBoundFramebuffers[gl.FRAMEBUFFER] = framebuffer; } - if (target === gl.FRAMEBUFFER) { currentBoundFramebuffers[gl.DRAW_FRAMEBUFFER] = framebuffer; } } - return true; } - return false; } - function drawBuffers(renderTarget, framebuffer) { let drawBuffers = defaultDrawbuffers; let needsUpdate = false; - if (renderTarget) { drawBuffers = currentDrawbuffers.get(framebuffer); - if (drawBuffers === undefined) { drawBuffers = []; currentDrawbuffers.set(framebuffer, drawBuffers); } - if (renderTarget.isWebGLMultipleRenderTargets) { const textures = renderTarget.texture; - if (drawBuffers.length !== textures.length || drawBuffers[0] !== gl.COLOR_ATTACHMENT0) { for (let i = 0, il = textures.length; i < il; i++) { drawBuffers[i] = gl.COLOR_ATTACHMENT0 + i; } - drawBuffers.length = textures.length; needsUpdate = true; } @@ -16248,7 +14315,6 @@ function WebGLState(gl, extensions, capabilities) { needsUpdate = true; } } - if (needsUpdate) { if (capabilities.isWebGL2) { gl.drawBuffers(drawBuffers); @@ -16257,35 +14323,29 @@ function WebGLState(gl, extensions, capabilities) { } } } - function useProgram(program) { if (currentProgram !== program) { gl.useProgram(program); currentProgram = program; return true; } - return false; } - const equationToGL = { [AddEquation]: gl.FUNC_ADD, [SubtractEquation]: gl.FUNC_SUBTRACT, [ReverseSubtractEquation]: gl.FUNC_REVERSE_SUBTRACT }; - if (isWebGL2) { equationToGL[MinEquation] = gl.MIN; equationToGL[MaxEquation] = gl.MAX; } else { const extension = extensions.get('EXT_blend_minmax'); - if (extension !== null) { equationToGL[MinEquation] = extension.MIN_EXT; equationToGL[MaxEquation] = extension.MAX_EXT; } } - const factorToGL = { [ZeroFactor]: gl.ZERO, [OneFactor]: gl.ONE, @@ -16299,22 +14359,18 @@ function WebGLState(gl, extensions, capabilities) { [OneMinusDstColorFactor]: gl.ONE_MINUS_DST_COLOR, [OneMinusDstAlphaFactor]: gl.ONE_MINUS_DST_ALPHA }; - function setBlending(blending, blendEquation, blendSrc, blendDst, blendEquationAlpha, blendSrcAlpha, blendDstAlpha, premultipliedAlpha) { if (blending === NoBlending) { if (currentBlendingEnabled === true) { disable(gl.BLEND); currentBlendingEnabled = false; } - return; } - if (currentBlendingEnabled === false) { enable(gl.BLEND); currentBlendingEnabled = true; } - if (blending !== CustomBlending) { if (blending !== currentBlending || premultipliedAlpha !== currentPremultipledAlpha) { if (currentBlendEquation !== AddEquation || currentBlendEquationAlpha !== AddEquation) { @@ -16322,25 +14378,20 @@ function WebGLState(gl, extensions, capabilities) { currentBlendEquation = AddEquation; currentBlendEquationAlpha = AddEquation; } - if (premultipliedAlpha) { switch (blending) { case NormalBlending: gl.blendFuncSeparate(gl.ONE, gl.ONE_MINUS_SRC_ALPHA, gl.ONE, gl.ONE_MINUS_SRC_ALPHA); break; - case AdditiveBlending: gl.blendFunc(gl.ONE, gl.ONE); break; - case SubtractiveBlending: gl.blendFuncSeparate(gl.ZERO, gl.ONE_MINUS_SRC_COLOR, gl.ZERO, gl.ONE); break; - case MultiplyBlending: gl.blendFuncSeparate(gl.ZERO, gl.SRC_COLOR, gl.ZERO, gl.SRC_ALPHA); break; - default: console.error('THREE.WebGLState: Invalid blending: ', blending); break; @@ -16350,25 +14401,20 @@ function WebGLState(gl, extensions, capabilities) { case NormalBlending: gl.blendFuncSeparate(gl.SRC_ALPHA, gl.ONE_MINUS_SRC_ALPHA, gl.ONE, gl.ONE_MINUS_SRC_ALPHA); break; - case AdditiveBlending: gl.blendFunc(gl.SRC_ALPHA, gl.ONE); break; - case SubtractiveBlending: gl.blendFuncSeparate(gl.ZERO, gl.ONE_MINUS_SRC_COLOR, gl.ZERO, gl.ONE); break; - case MultiplyBlending: gl.blendFunc(gl.ZERO, gl.SRC_COLOR); break; - default: console.error('THREE.WebGLState: Invalid blending: ', blending); break; } } - currentBlendSrc = null; currentBlendDst = null; currentBlendSrcAlpha = null; @@ -16376,21 +14422,19 @@ function WebGLState(gl, extensions, capabilities) { currentBlending = blending; currentPremultipledAlpha = premultipliedAlpha; } - return; - } // custom blending + } + // custom blending blendEquationAlpha = blendEquationAlpha || blendEquation; blendSrcAlpha = blendSrcAlpha || blendSrc; blendDstAlpha = blendDstAlpha || blendDst; - if (blendEquation !== currentBlendEquation || blendEquationAlpha !== currentBlendEquationAlpha) { gl.blendEquationSeparate(equationToGL[blendEquation], equationToGL[blendEquationAlpha]); currentBlendEquation = blendEquation; currentBlendEquationAlpha = blendEquationAlpha; } - if (blendSrc !== currentBlendSrc || blendDst !== currentBlendDst || blendSrcAlpha !== currentBlendSrcAlpha || blendDstAlpha !== currentBlendDstAlpha) { gl.blendFuncSeparate(factorToGL[blendSrc], factorToGL[blendDst], factorToGL[blendSrcAlpha], factorToGL[blendDstAlpha]); currentBlendSrc = blendSrc; @@ -16398,11 +14442,9 @@ function WebGLState(gl, extensions, capabilities) { currentBlendSrcAlpha = blendSrcAlpha; currentBlendDstAlpha = blendDstAlpha; } - currentBlending = blending; currentPremultipledAlpha = null; } - function setMaterial(material, frontFaceCW) { material.side === DoubleSide ? disable(gl.CULL_FACE) : enable(gl.CULL_FACE); let flipSided = material.side === BackSide; @@ -16415,17 +14457,16 @@ function WebGLState(gl, extensions, capabilities) { colorBuffer.setMask(material.colorWrite); const stencilWrite = material.stencilWrite; stencilBuffer.setTest(stencilWrite); - if (stencilWrite) { stencilBuffer.setMask(material.stencilWriteMask); stencilBuffer.setFunc(material.stencilFunc, material.stencilRef, material.stencilFuncMask); stencilBuffer.setOp(material.stencilFail, material.stencilZFail, material.stencilZPass); } - setPolygonOffset(material.polygonOffset, material.polygonOffsetFactor, material.polygonOffsetUnits); material.alphaToCoverage === true ? enable(gl.SAMPLE_ALPHA_TO_COVERAGE) : disable(gl.SAMPLE_ALPHA_TO_COVERAGE); - } // + } + // function setFlipSided(flipSided) { if (currentFlipSided !== flipSided) { @@ -16434,15 +14475,12 @@ function WebGLState(gl, extensions, capabilities) { } else { gl.frontFace(gl.CCW); } - currentFlipSided = flipSided; } } - function setCullFace(cullFace) { if (cullFace !== CullFaceNone) { enable(gl.CULL_FACE); - if (cullFace !== currentCullFace) { if (cullFace === CullFaceBack) { gl.cullFace(gl.BACK); @@ -16455,21 +14493,17 @@ function WebGLState(gl, extensions, capabilities) { } else { disable(gl.CULL_FACE); } - currentCullFace = cullFace; } - function setLineWidth(width) { if (width !== currentLineWidth) { if (lineWidthAvailable) gl.lineWidth(width); currentLineWidth = width; } } - function setPolygonOffset(polygonOffset, factor, units) { if (polygonOffset) { enable(gl.POLYGON_OFFSET_FILL); - if (currentPolygonOffsetFactor !== factor || currentPolygonOffsetUnits !== units) { gl.polygonOffset(factor, units); currentPolygonOffsetFactor = factor; @@ -16479,32 +14513,28 @@ function WebGLState(gl, extensions, capabilities) { disable(gl.POLYGON_OFFSET_FILL); } } - function setScissorTest(scissorTest) { if (scissorTest) { enable(gl.SCISSOR_TEST); } else { disable(gl.SCISSOR_TEST); } - } // texture + } + // texture function activeTexture(webglSlot) { if (webglSlot === undefined) webglSlot = gl.TEXTURE0 + maxTextures - 1; - if (currentTextureSlot !== webglSlot) { gl.activeTexture(webglSlot); currentTextureSlot = webglSlot; } } - function bindTexture(webglType, webglTexture) { if (currentTextureSlot === null) { activeTexture(); } - let boundTexture = currentBoundTextures[currentTextureSlot]; - if (boundTexture === undefined) { boundTexture = { type: undefined, @@ -16512,24 +14542,20 @@ function WebGLState(gl, extensions, capabilities) { }; currentBoundTextures[currentTextureSlot] = boundTexture; } - if (boundTexture.type !== webglType || boundTexture.texture !== webglTexture) { gl.bindTexture(webglType, webglTexture || emptyTextures[webglType]); boundTexture.type = webglType; boundTexture.texture = webglTexture; } } - function unbindTexture() { const boundTexture = currentBoundTextures[currentTextureSlot]; - if (boundTexture !== undefined && boundTexture.type !== undefined) { gl.bindTexture(boundTexture.type, null); boundTexture.type = undefined; boundTexture.texture = undefined; } } - function compressedTexImage2D() { try { gl.compressedTexImage2D.apply(gl, arguments); @@ -16537,7 +14563,6 @@ function WebGLState(gl, extensions, capabilities) { console.error('THREE.WebGLState:', error); } } - function texSubImage2D() { try { gl.texSubImage2D.apply(gl, arguments); @@ -16545,7 +14570,6 @@ function WebGLState(gl, extensions, capabilities) { console.error('THREE.WebGLState:', error); } } - function texSubImage3D() { try { gl.texSubImage3D.apply(gl, arguments); @@ -16553,7 +14577,6 @@ function WebGLState(gl, extensions, capabilities) { console.error('THREE.WebGLState:', error); } } - function compressedTexSubImage2D() { try { gl.compressedTexSubImage2D.apply(gl, arguments); @@ -16561,7 +14584,6 @@ function WebGLState(gl, extensions, capabilities) { console.error('THREE.WebGLState:', error); } } - function texStorage2D() { try { gl.texStorage2D.apply(gl, arguments); @@ -16569,7 +14591,6 @@ function WebGLState(gl, extensions, capabilities) { console.error('THREE.WebGLState:', error); } } - function texStorage3D() { try { gl.texStorage3D.apply(gl, arguments); @@ -16577,7 +14598,6 @@ function WebGLState(gl, extensions, capabilities) { console.error('THREE.WebGLState:', error); } } - function texImage2D() { try { gl.texImage2D.apply(gl, arguments); @@ -16585,15 +14605,15 @@ function WebGLState(gl, extensions, capabilities) { console.error('THREE.WebGLState:', error); } } - function texImage3D() { try { gl.texImage3D.apply(gl, arguments); } catch (error) { console.error('THREE.WebGLState:', error); } - } // + } + // function scissor(scissor) { if (currentScissor.equals(scissor) === false) { @@ -16601,17 +14621,18 @@ function WebGLState(gl, extensions, capabilities) { currentScissor.copy(scissor); } } - function viewport(viewport) { if (currentViewport.equals(viewport) === false) { gl.viewport(viewport.x, viewport.y, viewport.z, viewport.w); currentViewport.copy(viewport); } - } // + } + // function reset() { // reset state + gl.disable(gl.BLEND); gl.disable(gl.CULL_FACE); gl.disable(gl.DEPTH_TEST); @@ -16636,16 +14657,16 @@ function WebGLState(gl, extensions, capabilities) { gl.polygonOffset(0, 0); gl.activeTexture(gl.TEXTURE0); gl.bindFramebuffer(gl.FRAMEBUFFER, null); - if (isWebGL2 === true) { gl.bindFramebuffer(gl.DRAW_FRAMEBUFFER, null); gl.bindFramebuffer(gl.READ_FRAMEBUFFER, null); } - gl.useProgram(null); gl.lineWidth(1); gl.scissor(0, 0, gl.canvas.width, gl.canvas.height); - gl.viewport(0, 0, gl.canvas.width, gl.canvas.height); // reset internals + gl.viewport(0, 0, gl.canvas.width, gl.canvas.height); + + // reset internals enabledCapabilities = {}; currentTextureSlot = null; @@ -16674,12 +14695,10 @@ function WebGLState(gl, extensions, capabilities) { depthBuffer.reset(); stencilBuffer.reset(); } - function clearTextureBindingState() { currentTextureSlot = null; currentBoundTextures = {}; } - return { buffers: { color: colorBuffer, @@ -16724,41 +14743,46 @@ function WebGLTextures(_gl, extensions, state, properties, capabilities, utils, const maxSamples = capabilities.maxSamples; const MultisampledRenderToTextureExtension = extensions.has('WEBGL_multisampled_render_to_texture') ? extensions.get('WEBGL_multisampled_render_to_texture') : null; const supportsInvalidateFramebuffer = typeof navigator === 'undefined' ? false : /OculusBrowser/g.test(navigator.userAgent); - const _videoTextures = new WeakMap(); + let _canvas; - let _canvas; // cordova iOS (as of 5.0) still uses UIWebView, which provides OffscreenCanvas, + // cordova iOS (as of 5.0) still uses UIWebView, which provides OffscreenCanvas, // also OffscreenCanvas.getContext("webgl"), but not OffscreenCanvas.getContext("2d")! // Some implementations may only implement OffscreenCanvas partially (e.g. lacking 2d). - let useOffscreenCanvas = false; - try { useOffscreenCanvas = typeof OffscreenCanvas !== 'undefined' && new OffscreenCanvas(1, 1).getContext('2d') !== null; - } catch (err) {// Ignore any errors - } + } catch (err) { + // Ignore any errors + } function createCanvas(width, height) { // Use OffscreenCanvas when available. Specially needed in web workers + return useOffscreenCanvas ? new OffscreenCanvas(width, height) : createElementNS('canvas'); } - function resizeImage(image, needsPowerOfTwo, needsNewCanvas, maxSize) { - let scale = 1; // handle case if texture exceeds max size + let scale = 1; + + // handle case if texture exceeds max size if (image.width > maxSize || image.height > maxSize) { scale = maxSize / Math.max(image.width, image.height); - } // only perform resize if necessary + } + // only perform resize if necessary if (scale < 1 || needsPowerOfTwo === true) { // only perform resize for certain image types + if (typeof HTMLImageElement !== 'undefined' && image instanceof HTMLImageElement || typeof HTMLCanvasElement !== 'undefined' && image instanceof HTMLCanvasElement || typeof ImageBitmap !== 'undefined' && image instanceof ImageBitmap) { const floor = needsPowerOfTwo ? floorPowerOfTwo : Math.floor; const width = floor(scale * image.width); const height = floor(scale * image.height); - if (_canvas === undefined) _canvas = createCanvas(width, height); // cube textures can't reuse the same canvas + if (_canvas === undefined) _canvas = createCanvas(width, height); + + // cube textures can't reuse the same canvas const canvas = needsNewCanvas ? createCanvas(width, height) : _canvas; canvas.width = width; @@ -16771,53 +14795,41 @@ function WebGLTextures(_gl, extensions, state, properties, capabilities, utils, if ('data' in image) { console.warn('THREE.WebGLRenderer: Image in DataTexture is too big (' + image.width + 'x' + image.height + ').'); } - return image; } } - return image; } - function isPowerOfTwo$1(image) { return isPowerOfTwo(image.width) && isPowerOfTwo(image.height); } - function textureNeedsPowerOfTwo(texture) { if (isWebGL2) return false; return texture.wrapS !== ClampToEdgeWrapping || texture.wrapT !== ClampToEdgeWrapping || texture.minFilter !== NearestFilter && texture.minFilter !== LinearFilter; } - function textureNeedsGenerateMipmaps(texture, supportsMips) { return texture.generateMipmaps && supportsMips && texture.minFilter !== NearestFilter && texture.minFilter !== LinearFilter; } - function generateMipmap(target) { _gl.generateMipmap(target); } - function getInternalFormat(internalFormatName, glFormat, glType, encoding, sRGBToLinearWithShader = !Texture.useSrgbTextures) { if (isWebGL2 === false) return glFormat; - if (internalFormatName !== null) { if (_gl[internalFormatName] !== undefined) return _gl[internalFormatName]; console.warn('THREE.WebGLRenderer: Attempt to use non-existing WebGL internal format \'' + internalFormatName + '\''); } - let internalFormat = glFormat; - if (glFormat === _gl.RED) { if (glType === _gl.FLOAT) internalFormat = _gl.R32F; if (glType === _gl.HALF_FLOAT) internalFormat = _gl.R16F; if (glType === _gl.UNSIGNED_BYTE) internalFormat = _gl.R8; } - if (glFormat === _gl.RG) { if (glType === _gl.FLOAT) internalFormat = _gl.RG32F; if (glType === _gl.HALF_FLOAT) internalFormat = _gl.RG16F; if (glType === _gl.UNSIGNED_BYTE) internalFormat = _gl.RG8; } - if (glFormat === _gl.RGBA) { if (glType === _gl.FLOAT) internalFormat = _gl.RGBA32F; if (glType === _gl.HALF_FLOAT) internalFormat = _gl.RGBA16F; @@ -16825,144 +14837,124 @@ function WebGLTextures(_gl, extensions, state, properties, capabilities, utils, if (glType === _gl.UNSIGNED_SHORT_4_4_4_4) internalFormat = _gl.RGBA4; if (glType === _gl.UNSIGNED_SHORT_5_5_5_1) internalFormat = _gl.RGB5_A1; } - if (internalFormat === _gl.R16F || internalFormat === _gl.R32F || internalFormat === _gl.RG16F || internalFormat === _gl.RG32F || internalFormat === _gl.RGBA16F || internalFormat === _gl.RGBA32F) { extensions.get('EXT_color_buffer_float'); } - return internalFormat; } - function getMipLevels(texture, image, supportsMips) { if (textureNeedsGenerateMipmaps(texture, supportsMips) === true || texture.isFramebufferTexture && texture.minFilter !== NearestFilter && texture.minFilter !== LinearFilter) { return Math.log2(Math.max(image.width, image.height)) + 1; } else if (texture.mipmaps !== undefined && texture.mipmaps.length > 0) { // user-defined mipmaps + return texture.mipmaps.length; } else if (texture.isCompressedTexture && Array.isArray(texture.image)) { return image.mipmaps.length; } else { // texture without mipmaps (only base level) + return 1; } - } // Fallback filters for non-power-of-2 textures + } + // Fallback filters for non-power-of-2 textures function filterFallback(f) { if (f === NearestFilter || f === NearestMipmapNearestFilter || f === NearestMipmapLinearFilter) { return _gl.NEAREST; } - return _gl.LINEAR; - } // + } + // function onTextureDispose(event) { const texture = event.target; texture.removeEventListener('dispose', onTextureDispose); deallocateTexture(texture); - if (texture.isVideoTexture) { _videoTextures.delete(texture); } - info.memory.textures--; } - function onRenderTargetDispose(event) { const renderTarget = event.target; renderTarget.removeEventListener('dispose', onRenderTargetDispose); deallocateRenderTarget(renderTarget); - } // + } + // function deallocateTexture(texture) { const textureProperties = properties.get(texture); if (textureProperties.__webglInit === undefined) return; - _gl.deleteTexture(textureProperties.__webglTexture); - delete textureProperties.__webglTexture; properties.remove(texture); } - function deallocateRenderTarget(renderTarget) { const texture = renderTarget.texture; const renderTargetProperties = properties.get(renderTarget); const textureProperties = properties.get(texture); if (!renderTarget) return; - if (textureProperties.__webglTexture !== undefined) { _gl.deleteTexture(textureProperties.__webglTexture); - delete textureProperties.__webglTexture; info.memory.textures--; } - if (renderTarget.depthTexture) { renderTarget.depthTexture.dispose(); } - if (renderTarget.isWebGLCubeRenderTarget) { for (let i = 0; i < 6; i++) { _gl.deleteFramebuffer(renderTargetProperties.__webglFramebuffer[i]); - if (renderTargetProperties.__webglDepthbuffer) _gl.deleteRenderbuffer(renderTargetProperties.__webglDepthbuffer[i]); } } else { _gl.deleteFramebuffer(renderTargetProperties.__webglFramebuffer); - if (renderTargetProperties.__webglDepthbuffer) _gl.deleteRenderbuffer(renderTargetProperties.__webglDepthbuffer); if (renderTargetProperties.__webglMultisampledFramebuffer) _gl.deleteFramebuffer(renderTargetProperties.__webglMultisampledFramebuffer); if (renderTargetProperties.__webglColorRenderbuffer) _gl.deleteRenderbuffer(renderTargetProperties.__webglColorRenderbuffer); if (renderTargetProperties.__webglDepthRenderbuffer) _gl.deleteRenderbuffer(renderTargetProperties.__webglDepthRenderbuffer); } - if (renderTarget.isWebGLMultipleRenderTargets) { for (let i = 0, il = texture.length; i < il; i++) { const attachmentProperties = properties.get(texture[i]); - if (attachmentProperties.__webglTexture) { _gl.deleteTexture(attachmentProperties.__webglTexture); - info.memory.textures--; } - properties.remove(texture[i]); } } - properties.remove(texture); properties.remove(renderTarget); - } // + } + // let textureUnits = 0; - function resetTextureUnits() { textureUnits = 0; } - function allocateTextureUnit() { const textureUnit = textureUnits; - if (textureUnit >= maxTextures) { console.warn('THREE.WebGLTextures: Trying to use ' + textureUnit + ' texture units while this GPU supports only ' + maxTextures); } - textureUnits += 1; return textureUnit; - } // + } + // function setTexture2D(texture, slot) { const textureProperties = properties.get(texture); if (texture.isExternalTexture2D) textureProperties.__webglTexture = texture.webglTexture; if (texture.isVideoTexture) updateVideoTexture(texture); - if (texture.version > 0 && textureProperties.__version !== texture.version) { const image = texture.image; - if (image === undefined) { console.warn('THREE.WebGLRenderer: Texture marked for update but image is undefined'); } else if (image.complete === false) { @@ -16972,47 +14964,36 @@ function WebGLTextures(_gl, extensions, state, properties, capabilities, utils, return; } } - state.activeTexture(_gl.TEXTURE0 + slot); state.bindTexture(_gl.TEXTURE_2D, textureProperties.__webglTexture); } - function setTexture2DArray(texture, slot) { const textureProperties = properties.get(texture); - if (texture.version > 0 && textureProperties.__version !== texture.version) { uploadTexture(textureProperties, texture, slot); return; } - state.activeTexture(_gl.TEXTURE0 + slot); state.bindTexture(_gl.TEXTURE_2D_ARRAY, textureProperties.__webglTexture); } - function setTexture3D(texture, slot) { const textureProperties = properties.get(texture); - if (texture.version > 0 && textureProperties.__version !== texture.version) { uploadTexture(textureProperties, texture, slot); return; } - state.activeTexture(_gl.TEXTURE0 + slot); state.bindTexture(_gl.TEXTURE_3D, textureProperties.__webglTexture); } - function setTextureCube(texture, slot) { const textureProperties = properties.get(texture); - if (texture.version > 0 && textureProperties.__version !== texture.version) { uploadCubeTexture(textureProperties, texture, slot); return; } - state.activeTexture(_gl.TEXTURE0 + slot); state.bindTexture(_gl.TEXTURE_CUBE_MAP, textureProperties.__webglTexture); } - const wrappingToGL = { [RepeatWrapping]: _gl.REPEAT, [ClampToEdgeWrapping]: _gl.CLAMP_TO_EDGE, @@ -17026,56 +15007,41 @@ function WebGLTextures(_gl, extensions, state, properties, capabilities, utils, [LinearMipmapNearestFilter]: _gl.LINEAR_MIPMAP_NEAREST, [LinearMipmapLinearFilter]: _gl.LINEAR_MIPMAP_LINEAR }; - function setTextureParameters(textureType, texture, supportsMips) { if (supportsMips) { _gl.texParameteri(textureType, _gl.TEXTURE_WRAP_S, wrappingToGL[texture.wrapS]); - _gl.texParameteri(textureType, _gl.TEXTURE_WRAP_T, wrappingToGL[texture.wrapT]); - if (textureType === _gl.TEXTURE_3D || textureType === _gl.TEXTURE_2D_ARRAY) { _gl.texParameteri(textureType, _gl.TEXTURE_WRAP_R, wrappingToGL[texture.wrapR]); } - _gl.texParameteri(textureType, _gl.TEXTURE_MAG_FILTER, filterToGL[texture.magFilter]); - _gl.texParameteri(textureType, _gl.TEXTURE_MIN_FILTER, filterToGL[texture.minFilter]); } else { _gl.texParameteri(textureType, _gl.TEXTURE_WRAP_S, _gl.CLAMP_TO_EDGE); - _gl.texParameteri(textureType, _gl.TEXTURE_WRAP_T, _gl.CLAMP_TO_EDGE); - if (textureType === _gl.TEXTURE_3D || textureType === _gl.TEXTURE_2D_ARRAY) { _gl.texParameteri(textureType, _gl.TEXTURE_WRAP_R, _gl.CLAMP_TO_EDGE); } - if (texture.wrapS !== ClampToEdgeWrapping || texture.wrapT !== ClampToEdgeWrapping) { console.warn('THREE.WebGLRenderer: Texture is not power of two. Texture.wrapS and Texture.wrapT should be set to THREE.ClampToEdgeWrapping.'); } - _gl.texParameteri(textureType, _gl.TEXTURE_MAG_FILTER, filterFallback(texture.magFilter)); - _gl.texParameteri(textureType, _gl.TEXTURE_MIN_FILTER, filterFallback(texture.minFilter)); - if (texture.minFilter !== NearestFilter && texture.minFilter !== LinearFilter) { console.warn('THREE.WebGLRenderer: Texture is not power of two. Texture.minFilter should be set to THREE.NearestFilter or THREE.LinearFilter.'); } } - if (extensions.has('EXT_texture_filter_anisotropic') === true) { const extension = extensions.get('EXT_texture_filter_anisotropic'); if (texture.type === FloatType && extensions.has('OES_texture_float_linear') === false) return; // verify extension for WebGL 1 and WebGL 2 - if (isWebGL2 === false && texture.type === HalfFloatType && extensions.has('OES_texture_half_float_linear') === false) return; // verify extension for WebGL 1 only if (texture.anisotropy > 1 || properties.get(texture).__currentAnisotropy) { _gl.texParameterf(textureType, extension.TEXTURE_MAX_ANISOTROPY_EXT, Math.min(texture.anisotropy, capabilities.getMaxAnisotropy())); - properties.get(texture).__currentAnisotropy = texture.anisotropy; } } } - function initTexture(textureProperties, texture) { if (textureProperties.__webglInit === undefined) { textureProperties.__webglInit = true; @@ -17084,7 +15050,6 @@ function WebGLTextures(_gl, extensions, state, properties, capabilities, utils, info.memory.textures++; } } - function uploadTexture(textureProperties, texture, slot) { let textureType = _gl.TEXTURE_2D; if (texture.isDataTexture2DArray) textureType = _gl.TEXTURE_2D_ARRAY; @@ -17092,32 +15057,26 @@ function WebGLTextures(_gl, extensions, state, properties, capabilities, utils, initTexture(textureProperties, texture); state.activeTexture(_gl.TEXTURE0 + slot); state.bindTexture(textureType, textureProperties.__webglTexture); - _gl.pixelStorei(_gl.UNPACK_FLIP_Y_WEBGL, texture.flipY); - _gl.pixelStorei(_gl.UNPACK_PREMULTIPLY_ALPHA_WEBGL, texture.premultiplyAlpha); - _gl.pixelStorei(_gl.UNPACK_ALIGNMENT, texture.unpackAlignment); - _gl.pixelStorei(_gl.UNPACK_COLORSPACE_CONVERSION_WEBGL, _gl.NONE); - const needsPowerOfTwo = textureNeedsPowerOfTwo(texture) && isPowerOfTwo$1(texture.image) === false; const image = resizeImage(texture.image, needsPowerOfTwo, false, maxTextureSize); const supportsMips = isPowerOfTwo$1(image) || isWebGL2, - glFormat = utils.convert(texture.format, texture.encoding); + glFormat = utils.convert(texture.format, texture.encoding); let glType = utils.convert(texture.type), - glInternalFormat = getInternalFormat(texture.internalFormat, glFormat, glType, texture.encoding, texture.sRGBToLinearWithShader); + glInternalFormat = getInternalFormat(texture.internalFormat, glFormat, glType, texture.encoding, texture.sRGBToLinearWithShader); setTextureParameters(textureType, texture, supportsMips); let mipmap; const mipmaps = texture.mipmaps; const useTexStorage = isWebGL2 && texture.isVideoTexture !== true; const allocateMemory = textureProperties.__version === undefined; const levels = getMipLevels(texture, image, supportsMips); - if (texture.isDepthTexture) { // populate depth texture with dummy data - glInternalFormat = _gl.DEPTH_COMPONENT; + glInternalFormat = _gl.DEPTH_COMPONENT; if (isWebGL2) { if (texture.type === FloatType) { glInternalFormat = _gl.DEPTH_COMPONENT32F; @@ -17132,8 +15091,9 @@ function WebGLTextures(_gl, extensions, state, properties, capabilities, utils, if (texture.type === FloatType) { console.error('WebGLRenderer: Floating point depth texture requires WebGL2.'); } - } // validation checks for WebGL 1 + } + // validation checks for WebGL 1 if (texture.format === DepthFormat && glInternalFormat === _gl.DEPTH_COMPONENT) { // The error INVALID_OPERATION is generated by texImage2D if format and internalformat are @@ -17145,21 +15105,22 @@ function WebGLTextures(_gl, extensions, state, properties, capabilities, utils, glType = utils.convert(texture.type); } } - if (texture.format === DepthStencilFormat && glInternalFormat === _gl.DEPTH_COMPONENT) { // Depth stencil textures need the DEPTH_STENCIL internal format // (https://www.khronos.org/registry/webgl/extensions/WEBGL_depth_texture/) - glInternalFormat = _gl.DEPTH_STENCIL; // The error INVALID_OPERATION is generated by texImage2D if format and internalformat are + glInternalFormat = _gl.DEPTH_STENCIL; + + // The error INVALID_OPERATION is generated by texImage2D if format and internalformat are // DEPTH_STENCIL and type is not UNSIGNED_INT_24_8_WEBGL. // (https://www.khronos.org/registry/webgl/extensions/WEBGL_depth_texture/) - if (texture.type !== UnsignedInt248Type) { console.warn('THREE.WebGLRenderer: Use UnsignedInt248Type for DepthStencilFormat DepthTexture.'); texture.type = UnsignedInt248Type; glType = utils.convert(texture.type); } - } // + } + // if (useTexStorage && allocateMemory) { state.texStorage2D(_gl.TEXTURE_2D, 1, glInternalFormat, image.width, image.height); @@ -17170,28 +15131,25 @@ function WebGLTextures(_gl, extensions, state, properties, capabilities, utils, // use manually created mipmaps if available // if there are no manual mipmaps // set 0 level mipmap and then use GL to generate other mipmap levels + if (mipmaps.length > 0 && supportsMips) { if (useTexStorage && allocateMemory) { state.texStorage2D(_gl.TEXTURE_2D, levels, glInternalFormat, mipmaps[0].width, mipmaps[0].height); } - for (let i = 0, il = mipmaps.length; i < il; i++) { mipmap = mipmaps[i]; - if (useTexStorage) { state.texSubImage2D(_gl.TEXTURE_2D, 0, 0, 0, mipmap.width, mipmap.height, glFormat, glType, mipmap.data); } else { state.texImage2D(_gl.TEXTURE_2D, i, glInternalFormat, mipmap.width, mipmap.height, 0, glFormat, glType, mipmap.data); } } - texture.generateMipmaps = false; } else { if (useTexStorage) { if (allocateMemory) { state.texStorage2D(_gl.TEXTURE_2D, levels, glInternalFormat, image.width, image.height); } - state.texSubImage2D(_gl.TEXTURE_2D, 0, 0, 0, image.width, image.height, glFormat, glType, image.data); } else { state.texImage2D(_gl.TEXTURE_2D, 0, glInternalFormat, image.width, image.height, 0, glFormat, glType, image.data); @@ -17201,10 +15159,8 @@ function WebGLTextures(_gl, extensions, state, properties, capabilities, utils, if (useTexStorage && allocateMemory) { state.texStorage2D(_gl.TEXTURE_2D, levels, glInternalFormat, mipmaps[0].width, mipmaps[0].height); } - for (let i = 0, il = mipmaps.length; i < il; i++) { mipmap = mipmaps[i]; - if (texture.format !== RGBAFormat) { if (glFormat !== null) { if (useTexStorage) { @@ -17228,7 +15184,6 @@ function WebGLTextures(_gl, extensions, state, properties, capabilities, utils, if (allocateMemory) { state.texStorage3D(_gl.TEXTURE_2D_ARRAY, levels, glInternalFormat, image.width, image.height, image.depth); } - state.texSubImage3D(_gl.TEXTURE_2D_ARRAY, 0, 0, 0, 0, image.width, image.height, image.depth, glFormat, glType, image.data); } else { state.texImage3D(_gl.TEXTURE_2D_ARRAY, 0, glInternalFormat, image.width, image.height, image.depth, 0, glFormat, glType, image.data); @@ -17238,7 +15193,6 @@ function WebGLTextures(_gl, extensions, state, properties, capabilities, utils, if (allocateMemory) { state.texStorage3D(_gl.TEXTURE_3D, levels, glInternalFormat, image.width, image.height, image.depth); } - state.texSubImage3D(_gl.TEXTURE_3D, 0, 0, 0, 0, image.width, image.height, image.depth, glFormat, glType, image.data); } else { state.texImage3D(_gl.TEXTURE_3D, 0, glInternalFormat, image.width, image.height, image.depth, 0, glFormat, glType, image.data); @@ -17248,8 +15202,7 @@ function WebGLTextures(_gl, extensions, state, properties, capabilities, utils, state.texStorage2D(_gl.TEXTURE_2D, levels, glInternalFormat, image.width, image.height); } else if (allocateMemory) { let width = image.width, - height = image.height; - + height = image.height; for (let i = 0; i < levels; i++) { state.texImage2D(_gl.TEXTURE_2D, i, glInternalFormat, width, height, 0, glFormat, glType, null); width >>= 1; @@ -17258,64 +15211,53 @@ function WebGLTextures(_gl, extensions, state, properties, capabilities, utils, } } else { // regular Texture (image, video, canvas) + // use manually created mipmaps if available // if there are no manual mipmaps // set 0 level mipmap and then use GL to generate other mipmap levels + if (mipmaps.length > 0 && supportsMips) { if (useTexStorage && allocateMemory) { state.texStorage2D(_gl.TEXTURE_2D, levels, glInternalFormat, mipmaps[0].width, mipmaps[0].height); } - for (let i = 0, il = mipmaps.length; i < il; i++) { mipmap = mipmaps[i]; - if (useTexStorage) { state.texSubImage2D(_gl.TEXTURE_2D, i, 0, 0, glFormat, glType, mipmap); } else { state.texImage2D(_gl.TEXTURE_2D, i, glInternalFormat, glFormat, glType, mipmap); } } - texture.generateMipmaps = false; } else { if (useTexStorage) { if (allocateMemory) { state.texStorage2D(_gl.TEXTURE_2D, levels, glInternalFormat, image.width, image.height); } - state.texSubImage2D(_gl.TEXTURE_2D, 0, 0, 0, glFormat, glType, image); } else { state.texImage2D(_gl.TEXTURE_2D, 0, glInternalFormat, glFormat, glType, image); } } } - if (textureNeedsGenerateMipmaps(texture, supportsMips)) { generateMipmap(textureType); } - textureProperties.__version = texture.version; if (texture.onUpdate) texture.onUpdate(texture); } - function uploadCubeTexture(textureProperties, texture, slot) { if (texture.image.length !== 6) return; initTexture(textureProperties, texture); state.activeTexture(_gl.TEXTURE0 + slot); state.bindTexture(_gl.TEXTURE_CUBE_MAP, textureProperties.__webglTexture); - _gl.pixelStorei(_gl.UNPACK_FLIP_Y_WEBGL, texture.flipY); - _gl.pixelStorei(_gl.UNPACK_PREMULTIPLY_ALPHA_WEBGL, texture.premultiplyAlpha); - _gl.pixelStorei(_gl.UNPACK_ALIGNMENT, texture.unpackAlignment); - _gl.pixelStorei(_gl.UNPACK_COLORSPACE_CONVERSION_WEBGL, _gl.NONE); - const isCompressed = texture && (texture.isCompressedTexture || texture.image[0].isCompressedTexture); const isDataTexture = texture.image[0] && texture.image[0].isDataTexture; const cubeImage = []; - for (let i = 0; i < 6; i++) { if (!isCompressed && !isDataTexture) { cubeImage[i] = resizeImage(texture.image[i], false, true, maxCubemapSize); @@ -17323,29 +15265,24 @@ function WebGLTextures(_gl, extensions, state, properties, capabilities, utils, cubeImage[i] = isDataTexture ? texture.image[i].image : texture.image[i]; } } - const image = cubeImage[0], - supportsMips = isPowerOfTwo$1(image) || isWebGL2, - glFormat = utils.convert(texture.format, texture.encoding), - glType = utils.convert(texture.type), - glInternalFormat = getInternalFormat(texture.internalFormat, glFormat, glType, texture.encoding, texture.sRGBToLinearWithShader); + supportsMips = isPowerOfTwo$1(image) || isWebGL2, + glFormat = utils.convert(texture.format, texture.encoding), + glType = utils.convert(texture.type), + glInternalFormat = getInternalFormat(texture.internalFormat, glFormat, glType, texture.encoding, texture.sRGBToLinearWithShader); const useTexStorage = isWebGL2 && texture.isVideoTexture !== true; const allocateMemory = textureProperties.__version === undefined; let levels = getMipLevels(texture, image, supportsMips); setTextureParameters(_gl.TEXTURE_CUBE_MAP, texture, supportsMips); let mipmaps; - if (isCompressed) { if (useTexStorage && allocateMemory) { state.texStorage2D(_gl.TEXTURE_CUBE_MAP, levels, glInternalFormat, image.width, image.height); } - for (let i = 0; i < 6; i++) { mipmaps = cubeImage[i].mipmaps; - for (let j = 0; j < mipmaps.length; j++) { const mipmap = mipmaps[j]; - if (texture.format !== RGBAFormat) { if (glFormat !== null) { if (useTexStorage) { @@ -17367,15 +15304,14 @@ function WebGLTextures(_gl, extensions, state, properties, capabilities, utils, } } else { mipmaps = texture.mipmaps; - if (useTexStorage && allocateMemory) { // TODO: Uniformly handle mipmap definitions // Normal textures and compressed cube textures define base level + mips with their mipmap array // Uncompressed cube textures use their mipmap array only for mips (no base level) + if (mipmaps.length > 0) levels++; state.texStorage2D(_gl.TEXTURE_CUBE_MAP, levels, glInternalFormat, cubeImage[0].width, cubeImage[0].height); } - for (let i = 0; i < 6; i++) { if (isDataTexture) { if (useTexStorage) { @@ -17383,11 +15319,9 @@ function WebGLTextures(_gl, extensions, state, properties, capabilities, utils, } else { state.texImage2D(_gl.TEXTURE_CUBE_MAP_POSITIVE_X + i, 0, glInternalFormat, cubeImage[i].width, cubeImage[i].height, 0, glFormat, glType, cubeImage[i].data); } - for (let j = 0; j < mipmaps.length; j++) { const mipmap = mipmaps[j]; const mipmapImage = mipmap.image[i].image; - if (useTexStorage) { state.texSubImage2D(_gl.TEXTURE_CUBE_MAP_POSITIVE_X + i, j + 1, 0, 0, mipmapImage.width, mipmapImage.height, glFormat, glType, mipmapImage.data); } else { @@ -17400,10 +15334,8 @@ function WebGLTextures(_gl, extensions, state, properties, capabilities, utils, } else { state.texImage2D(_gl.TEXTURE_CUBE_MAP_POSITIVE_X + i, 0, glInternalFormat, glFormat, glType, cubeImage[i]); } - for (let j = 0; j < mipmaps.length; j++) { const mipmap = mipmaps[j]; - if (useTexStorage) { state.texSubImage2D(_gl.TEXTURE_CUBE_MAP_POSITIVE_X + i, j + 1, 0, 0, glFormat, glType, mipmap.image[i]); } else { @@ -17413,24 +15345,22 @@ function WebGLTextures(_gl, extensions, state, properties, capabilities, utils, } } } - if (textureNeedsGenerateMipmaps(texture, supportsMips)) { // We assume images for cube map have the same size. generateMipmap(_gl.TEXTURE_CUBE_MAP); } - textureProperties.__version = texture.version; if (texture.onUpdate) texture.onUpdate(texture); - } // Render targets - // Setup storage for target texture and bind it to correct framebuffer + } + // Render targets + // Setup storage for target texture and bind it to correct framebuffer function setupFrameBufferTexture(framebuffer, renderTarget, texture, attachment, textureTarget) { const glFormat = utils.convert(texture.format, texture.encoding); const glType = utils.convert(texture.type); const glInternalFormat = getInternalFormat(texture.internalFormat, glFormat, glType, texture.encoding, texture.sRGBToLinearWithShader); const renderTargetProperties = properties.get(renderTarget); - if (!renderTargetProperties.__hasExternalTextures) { if (textureTarget === _gl.TEXTURE_3D || textureTarget === _gl.TEXTURE_2D_ARRAY) { state.texImage3D(textureTarget, 0, glInternalFormat, renderTarget.width, renderTarget.height, renderTarget.depth, 0, glFormat, glType, null); @@ -17438,28 +15368,22 @@ function WebGLTextures(_gl, extensions, state, properties, capabilities, utils, state.texImage2D(textureTarget, 0, glInternalFormat, renderTarget.width, renderTarget.height, 0, glFormat, glType, null); } } - state.bindFramebuffer(_gl.FRAMEBUFFER, framebuffer); - if (useMultisampledRenderToTexture(renderTarget)) { MultisampledRenderToTextureExtension.framebufferTexture2DMultisampleEXT(_gl.FRAMEBUFFER, attachment, textureTarget, properties.get(texture).__webglTexture, 0, getRenderTargetSamples(renderTarget)); } else { _gl.framebufferTexture2D(_gl.FRAMEBUFFER, attachment, textureTarget, properties.get(texture).__webglTexture, 0); } - state.bindFramebuffer(_gl.FRAMEBUFFER, null); - } // Setup storage for internal depth/stencil buffers and bind to correct framebuffer - + } + // Setup storage for internal depth/stencil buffers and bind to correct framebuffer function setupRenderBufferStorage(renderbuffer, renderTarget, isMultisample) { _gl.bindRenderbuffer(_gl.RENDERBUFFER, renderbuffer); - if (renderTarget.depthBuffer && !renderTarget.stencilBuffer) { let glInternalFormat = renderTarget.useDEPTH_COMPONENT24 ? _gl.DEPTH_COMPONENT24 : _gl.DEPTH_COMPONENT16; - if (isMultisample || useMultisampledRenderToTexture(renderTarget)) { const depthTexture = renderTarget.depthTexture; - if (depthTexture && depthTexture.isDepthTexture) { if (depthTexture.type === FloatType) { glInternalFormat = _gl.DEPTH_COMPONENT32F; @@ -17467,9 +15391,7 @@ function WebGLTextures(_gl, extensions, state, properties, capabilities, utils, glInternalFormat = _gl.DEPTH_COMPONENT24; } } - const samples = getRenderTargetSamples(renderTarget); - if (useMultisampledRenderToTexture(renderTarget)) { MultisampledRenderToTextureExtension.renderbufferStorageMultisampleEXT(_gl.RENDERBUFFER, samples, glInternalFormat, renderTarget.width, renderTarget.height); } else { @@ -17478,11 +15400,9 @@ function WebGLTextures(_gl, extensions, state, properties, capabilities, utils, } else { _gl.renderbufferStorage(_gl.RENDERBUFFER, glInternalFormat, renderTarget.width, renderTarget.height); } - _gl.framebufferRenderbuffer(_gl.FRAMEBUFFER, _gl.DEPTH_ATTACHMENT, _gl.RENDERBUFFER, renderbuffer); } else if (renderTarget.depthBuffer && renderTarget.stencilBuffer) { const samples = getRenderTargetSamples(renderTarget); - if (isMultisample && useMultisampledRenderToTexture(renderTarget) === false) { _gl.renderbufferStorageMultisample(_gl.RENDERBUFFER, samples, _gl.DEPTH24_STENCIL8, renderTarget.width, renderTarget.height); } else if (useMultisampledRenderToTexture(renderTarget)) { @@ -17490,7 +15410,6 @@ function WebGLTextures(_gl, extensions, state, properties, capabilities, utils, } else { _gl.renderbufferStorage(_gl.RENDERBUFFER, _gl.DEPTH_STENCIL, renderTarget.width, renderTarget.height); } - _gl.framebufferRenderbuffer(_gl.FRAMEBUFFER, _gl.DEPTH_STENCIL_ATTACHMENT, _gl.RENDERBUFFER, renderbuffer); } else { // Use the first texture for MRT so far @@ -17499,7 +15418,6 @@ function WebGLTextures(_gl, extensions, state, properties, capabilities, utils, const glType = utils.convert(texture.type); const glInternalFormat = getInternalFormat(texture.internalFormat, glFormat, glType, texture.encoding, texture.sRGBToLinearWithShader); const samples = getRenderTargetSamples(renderTarget); - if (isMultisample && useMultisampledRenderToTexture(renderTarget) === false) { _gl.renderbufferStorageMultisample(_gl.RENDERBUFFER, samples, glInternalFormat, renderTarget.width, renderTarget.height); } else if (useMultisampledRenderToTexture(renderTarget)) { @@ -17508,33 +15426,27 @@ function WebGLTextures(_gl, extensions, state, properties, capabilities, utils, _gl.renderbufferStorage(_gl.RENDERBUFFER, glInternalFormat, renderTarget.width, renderTarget.height); } } - _gl.bindRenderbuffer(_gl.RENDERBUFFER, null); - } // Setup resources for a Depth Texture for a FBO (needs an extension) - + } + // Setup resources for a Depth Texture for a FBO (needs an extension) function setupDepthTexture(framebuffer, renderTarget) { const isCube = renderTarget && renderTarget.isWebGLCubeRenderTarget; if (isCube) throw new Error('Depth Texture with cube render targets is not supported'); state.bindFramebuffer(_gl.FRAMEBUFFER, framebuffer); - if (!(renderTarget.depthTexture && renderTarget.depthTexture.isDepthTexture)) { throw new Error('renderTarget.depthTexture must be an instance of THREE.DepthTexture'); - } // upload an empty depth texture with framebuffer size - + } + // upload an empty depth texture with framebuffer size if (!properties.get(renderTarget.depthTexture).__webglTexture || renderTarget.depthTexture.image.width !== renderTarget.width || renderTarget.depthTexture.image.height !== renderTarget.height) { renderTarget.depthTexture.image.width = renderTarget.width; renderTarget.depthTexture.image.height = renderTarget.height; renderTarget.depthTexture.needsUpdate = true; } - setTexture2D(renderTarget.depthTexture, 0); - const webglDepthTexture = properties.get(renderTarget.depthTexture).__webglTexture; - const samples = getRenderTargetSamples(renderTarget); - if (renderTarget.depthTexture.format === DepthFormat) { if (useMultisampledRenderToTexture(renderTarget)) { MultisampledRenderToTextureExtension.framebufferTexture2DMultisampleEXT(_gl.FRAMEBUFFER, _gl.DEPTH_ATTACHMENT, _gl.TEXTURE_2D, webglDepthTexture, 0, samples); @@ -17550,20 +15462,18 @@ function WebGLTextures(_gl, extensions, state, properties, capabilities, utils, } else { throw new Error('Unknown depthTexture format'); } - } // Setup GL resources for a non-texture depth buffer - + } + // Setup GL resources for a non-texture depth buffer function setupDepthRenderbuffer(renderTarget) { const renderTargetProperties = properties.get(renderTarget); const isCube = renderTarget.isWebGLCubeRenderTarget === true; - if (renderTarget.depthTexture && !renderTargetProperties.__autoAllocateDepthBuffer) { if (isCube) throw new Error('target.depthTexture not supported in Cube render targets'); setupDepthTexture(renderTargetProperties.__webglFramebuffer, renderTarget); } else { if (isCube) { renderTargetProperties.__webglDepthbuffer = []; - for (let i = 0; i < 6; i++) { state.bindFramebuffer(_gl.FRAMEBUFFER, renderTargetProperties.__webglFramebuffer[i]); renderTargetProperties.__webglDepthbuffer[i] = _gl.createRenderbuffer(); @@ -17575,60 +15485,52 @@ function WebGLTextures(_gl, extensions, state, properties, capabilities, utils, setupRenderBufferStorage(renderTargetProperties.__webglDepthbuffer, renderTarget, false); } } - state.bindFramebuffer(_gl.FRAMEBUFFER, null); - } // rebind framebuffer with external textures - + } + // rebind framebuffer with external textures function rebindTextures(renderTarget, colorTexture, depthTexture) { const renderTargetProperties = properties.get(renderTarget); - if (colorTexture !== undefined) { setupFrameBufferTexture(renderTargetProperties.__webglFramebuffer, renderTarget, renderTarget.texture, _gl.COLOR_ATTACHMENT0, _gl.TEXTURE_2D); } - if (depthTexture !== undefined) { setupDepthRenderbuffer(renderTarget); } - } // Set up GL resources for the render target - + } + // Set up GL resources for the render target function setupRenderTarget(renderTarget) { const texture = renderTarget.texture; const renderTargetProperties = properties.get(renderTarget); const textureProperties = properties.get(texture); renderTarget.addEventListener('dispose', onRenderTargetDispose); - if (renderTarget.isWebGLMultipleRenderTargets !== true) { if (textureProperties.__webglTexture === undefined) { textureProperties.__webglTexture = _gl.createTexture(); } - textureProperties.__version = texture.version; info.memory.textures++; } - const isCube = renderTarget.isWebGLCubeRenderTarget === true; const isMultipleRenderTargets = renderTarget.isWebGLMultipleRenderTargets === true; const isRenderTarget3D = texture.isDataTexture3D || texture.isDataTexture2DArray; - const supportsMips = isPowerOfTwo$1(renderTarget) || isWebGL2; // Setup framebuffer + const supportsMips = isPowerOfTwo$1(renderTarget) || isWebGL2; + + // Setup framebuffer if (isCube) { renderTargetProperties.__webglFramebuffer = []; - for (let i = 0; i < 6; i++) { renderTargetProperties.__webglFramebuffer[i] = _gl.createFramebuffer(); } } else { renderTargetProperties.__webglFramebuffer = _gl.createFramebuffer(); - if (isMultipleRenderTargets) { if (capabilities.drawBuffers) { const textures = renderTarget.texture; - for (let i = 0, il = textures.length; i < il; i++) { const attachmentProperties = properties.get(textures[i]); - if (attachmentProperties.__webglTexture === undefined) { attachmentProperties.__webglTexture = _gl.createTexture(); info.memory.textures++; @@ -17640,66 +15542,53 @@ function WebGLTextures(_gl, extensions, state, properties, capabilities, utils, } else if (isWebGL2 && renderTarget.samples > 0 && useMultisampledRenderToTexture(renderTarget) === false) { renderTargetProperties.__webglMultisampledFramebuffer = _gl.createFramebuffer(); renderTargetProperties.__webglColorRenderbuffer = _gl.createRenderbuffer(); - _gl.bindRenderbuffer(_gl.RENDERBUFFER, renderTargetProperties.__webglColorRenderbuffer); - const glFormat = utils.convert(texture.format, texture.encoding); const glType = utils.convert(texture.type); const glInternalFormat = getInternalFormat(texture.internalFormat, glFormat, glType, texture.encoding); const samples = getRenderTargetSamples(renderTarget); - _gl.renderbufferStorageMultisample(_gl.RENDERBUFFER, samples, glInternalFormat, renderTarget.width, renderTarget.height); - state.bindFramebuffer(_gl.FRAMEBUFFER, renderTargetProperties.__webglMultisampledFramebuffer); - _gl.framebufferRenderbuffer(_gl.FRAMEBUFFER, _gl.COLOR_ATTACHMENT0, _gl.RENDERBUFFER, renderTargetProperties.__webglColorRenderbuffer); - _gl.bindRenderbuffer(_gl.RENDERBUFFER, null); - if (renderTarget.depthBuffer) { renderTargetProperties.__webglDepthRenderbuffer = _gl.createRenderbuffer(); setupRenderBufferStorage(renderTargetProperties.__webglDepthRenderbuffer, renderTarget, true); } - state.bindFramebuffer(_gl.FRAMEBUFFER, null); } - } // Setup color buffer + } + // Setup color buffer if (isCube) { state.bindTexture(_gl.TEXTURE_CUBE_MAP, textureProperties.__webglTexture); setTextureParameters(_gl.TEXTURE_CUBE_MAP, texture, supportsMips); - for (let i = 0; i < 6; i++) { setupFrameBufferTexture(renderTargetProperties.__webglFramebuffer[i], renderTarget, texture, _gl.COLOR_ATTACHMENT0, _gl.TEXTURE_CUBE_MAP_POSITIVE_X + i); } - if (textureNeedsGenerateMipmaps(texture, supportsMips)) { generateMipmap(_gl.TEXTURE_CUBE_MAP); } - state.unbindTexture(); } else if (isMultipleRenderTargets) { const textures = renderTarget.texture; - for (let i = 0, il = textures.length; i < il; i++) { const attachment = textures[i]; const attachmentProperties = properties.get(attachment); state.bindTexture(_gl.TEXTURE_2D, attachmentProperties.__webglTexture); setTextureParameters(_gl.TEXTURE_2D, attachment, supportsMips); setupFrameBufferTexture(renderTargetProperties.__webglFramebuffer, renderTarget, attachment, _gl.COLOR_ATTACHMENT0 + i, _gl.TEXTURE_2D); - if (textureNeedsGenerateMipmaps(attachment, supportsMips)) { generateMipmap(_gl.TEXTURE_2D); } } - state.unbindTexture(); } else { let glTextureType = _gl.TEXTURE_2D; - if (isRenderTarget3D) { // Render targets containing layers, i.e: Texture 3D and 2d arrays + if (isWebGL2) { const isTexture3D = texture.isDataTexture3D; glTextureType = isTexture3D ? _gl.TEXTURE_3D : _gl.TEXTURE_2D_ARRAY; @@ -17707,43 +15596,35 @@ function WebGLTextures(_gl, extensions, state, properties, capabilities, utils, console.warn('THREE.DataTexture3D and THREE.DataTexture2DArray only supported with WebGL2.'); } } - state.bindTexture(glTextureType, textureProperties.__webglTexture); setTextureParameters(glTextureType, texture, supportsMips); setupFrameBufferTexture(renderTargetProperties.__webglFramebuffer, renderTarget, texture, _gl.COLOR_ATTACHMENT0, glTextureType); - if (textureNeedsGenerateMipmaps(texture, supportsMips)) { generateMipmap(glTextureType); } - state.unbindTexture(); - } // Setup depth and stencil buffers + } + // Setup depth and stencil buffers if (renderTarget.depthBuffer) { setupDepthRenderbuffer(renderTarget); } } - function updateRenderTargetMipmap(renderTarget) { const supportsMips = isPowerOfTwo$1(renderTarget) || isWebGL2; const textures = renderTarget.isWebGLMultipleRenderTargets === true ? renderTarget.texture : [renderTarget.texture]; - for (let i = 0, il = textures.length; i < il; i++) { const texture = textures[i]; - if (textureNeedsGenerateMipmaps(texture, supportsMips)) { const target = renderTarget.isWebGLCubeRenderTarget ? _gl.TEXTURE_CUBE_MAP : _gl.TEXTURE_2D; - const webglTexture = properties.get(texture).__webglTexture; - state.bindTexture(target, webglTexture); generateMipmap(target); state.unbindTexture(); } } } - function updateMultisampleRenderTarget(renderTarget) { if (isWebGL2 && renderTarget.samples > 0 && useMultisampledRenderToTexture(renderTarget) === false) { const width = renderTarget.width; @@ -17751,89 +15632,75 @@ function WebGLTextures(_gl, extensions, state, properties, capabilities, utils, let mask = _gl.COLOR_BUFFER_BIT; const invalidationArray = [_gl.COLOR_ATTACHMENT0]; const depthStyle = renderTarget.stencilBuffer ? _gl.DEPTH_STENCIL_ATTACHMENT : _gl.DEPTH_ATTACHMENT; - if (renderTarget.depthBuffer) { invalidationArray.push(depthStyle); } - const renderTargetProperties = properties.get(renderTarget); const ignoreDepthValues = renderTargetProperties.__ignoreDepthValues !== undefined ? renderTargetProperties.__ignoreDepthValues : false; - if (ignoreDepthValues === false) { if (renderTarget.depthBuffer) mask |= _gl.DEPTH_BUFFER_BIT; if (renderTarget.stencilBuffer) mask |= _gl.STENCIL_BUFFER_BIT; } - state.bindFramebuffer(_gl.READ_FRAMEBUFFER, renderTargetProperties.__webglMultisampledFramebuffer); state.bindFramebuffer(_gl.DRAW_FRAMEBUFFER, renderTargetProperties.__webglFramebuffer); - if (ignoreDepthValues === true) { _gl.invalidateFramebuffer(_gl.READ_FRAMEBUFFER, [depthStyle]); - _gl.invalidateFramebuffer(_gl.DRAW_FRAMEBUFFER, [depthStyle]); } + _gl.blitFramebuffer(0, 0, width, height, 0, 0, width, height, mask, _gl.NEAREST); - _gl.blitFramebuffer(0, 0, width, height, 0, 0, width, height, mask, _gl.NEAREST); // https://github.com/mrdoob/three.js/pull/23692 - - + // https://github.com/mrdoob/three.js/pull/23692 if (supportsInvalidateFramebuffer) { _gl.invalidateFramebuffer(_gl.READ_FRAMEBUFFER, invalidationArray); } - state.bindFramebuffer(_gl.READ_FRAMEBUFFER, null); state.bindFramebuffer(_gl.DRAW_FRAMEBUFFER, renderTargetProperties.__webglMultisampledFramebuffer); } } - function getRenderTargetSamples(renderTarget) { return Math.min(maxSamples, renderTarget.samples); } - function useMultisampledRenderToTexture(renderTarget) { const renderTargetProperties = properties.get(renderTarget); return isWebGL2 && renderTarget.samples > 0 && extensions.has('WEBGL_multisampled_render_to_texture') === true && renderTargetProperties.__useRenderToTexture !== false; } - function updateVideoTexture(texture) { - const frame = info.render.frame; // Check the last frame we updated the VideoTexture + const frame = info.render.frame; + + // Check the last frame we updated the VideoTexture if (_videoTextures.get(texture) !== frame) { _videoTextures.set(texture, frame); - texture.update(); } - } // backwards compatibility + } + // backwards compatibility let warnedTexture2D = false; let warnedTextureCube = false; - function safeSetTexture2D(texture, slot) { if (texture && texture.isWebGLRenderTarget) { if (warnedTexture2D === false) { console.warn('THREE.WebGLTextures.safeSetTexture2D: don\'t use render targets as textures. Use their .texture property instead.'); warnedTexture2D = true; } - texture = texture.texture; } - setTexture2D(texture, slot); } - function safeSetTextureCube(texture, slot) { if (texture && texture.isWebGLCubeRenderTarget) { if (warnedTextureCube === false) { console.warn('THREE.WebGLTextures.safeSetTextureCube: don\'t use cube render targets as textures. Use their .texture property instead.'); warnedTextureCube = true; } - texture = texture.texture; } - setTextureCube(texture, slot); - } // + } + // this.allocateTextureUnit = allocateTextureUnit; this.resetTextureUnits = resetTextureUnits; @@ -17854,7 +15721,6 @@ function WebGLTextures(_gl, extensions, state, properties, capabilities, utils, function WebGLUtils(gl, extensions, capabilities) { const isWebGL2 = capabilities.isWebGL2; - function convert(p, encoding = null) { let extension; if (p === UnsignedByteType) return gl.UNSIGNED_BYTE; @@ -17866,35 +15732,35 @@ function WebGLUtils(gl, extensions, capabilities) { if (p === IntType) return gl.INT; if (p === UnsignedIntType) return gl.UNSIGNED_INT; if (p === FloatType) return gl.FLOAT; - if (p === HalfFloatType) { if (isWebGL2) return gl.HALF_FLOAT; extension = extensions.get('OES_texture_half_float'); - if (extension !== null) { return extension.HALF_FLOAT_OES; } else { return null; } } - if (p === AlphaFormat) return gl.ALPHA; if (p === RGBAFormat) return gl.RGBA; if (p === LuminanceFormat) return gl.LUMINANCE; if (p === LuminanceAlphaFormat) return gl.LUMINANCE_ALPHA; if (p === DepthFormat) return gl.DEPTH_COMPONENT; if (p === DepthStencilFormat) return gl.DEPTH_STENCIL; - if (p === RedFormat) return gl.RED; // WebGL2 formats. + if (p === RedFormat) return gl.RED; + + // WebGL2 formats. if (p === RedIntegerFormat) return gl.RED_INTEGER; if (p === RGFormat) return gl.RG; if (p === RGIntegerFormat) return gl.RG_INTEGER; - if (p === RGBAIntegerFormat) return gl.RGBA_INTEGER; // S3TC + if (p === RGBAIntegerFormat) return gl.RGBA_INTEGER; + + // S3TC if (p === RGB_S3TC_DXT1_Format || p === RGBA_S3TC_DXT1_Format || p === RGBA_S3TC_DXT3_Format || p === RGBA_S3TC_DXT5_Format) { if (encoding === sRGBEncoding) { extension = extensions.get('WEBGL_compressed_texture_s3tc_srgb'); - if (extension !== null) { if (p === RGB_S3TC_DXT1_Format) return extension.COMPRESSED_SRGB_S3TC_DXT1_EXT; if (p === RGBA_S3TC_DXT1_Format) return extension.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT; @@ -17905,7 +15771,6 @@ function WebGLUtils(gl, extensions, capabilities) { } } else { extension = extensions.get('WEBGL_compressed_texture_s3tc'); - if (extension !== null) { if (p === RGB_S3TC_DXT1_Format) return extension.COMPRESSED_RGB_S3TC_DXT1_EXT; if (p === RGBA_S3TC_DXT1_Format) return extension.COMPRESSED_RGBA_S3TC_DXT1_EXT; @@ -17915,12 +15780,12 @@ function WebGLUtils(gl, extensions, capabilities) { return null; } } - } // PVRTC + } + // PVRTC if (p === RGB_PVRTC_4BPPV1_Format || p === RGB_PVRTC_2BPPV1_Format || p === RGBA_PVRTC_4BPPV1_Format || p === RGBA_PVRTC_2BPPV1_Format) { extension = extensions.get('WEBGL_compressed_texture_pvrtc'); - if (extension !== null) { if (p === RGB_PVRTC_4BPPV1_Format) return extension.COMPRESSED_RGB_PVRTC_4BPPV1_IMG; if (p === RGB_PVRTC_2BPPV1_Format) return extension.COMPRESSED_RGB_PVRTC_2BPPV1_IMG; @@ -17929,35 +15794,35 @@ function WebGLUtils(gl, extensions, capabilities) { } else { return null; } - } // ETC1 + } + // ETC1 if (p === RGB_ETC1_Format) { extension = extensions.get('WEBGL_compressed_texture_etc1'); - if (extension !== null) { return extension.COMPRESSED_RGB_ETC1_WEBGL; } else { return null; } - } // ETC2 + } + // ETC2 if (p === RGB_ETC2_Format || p === RGBA_ETC2_EAC_Format) { extension = extensions.get('WEBGL_compressed_texture_etc'); - if (extension !== null) { if (p === RGB_ETC2_Format) return encoding === sRGBEncoding ? extension.COMPRESSED_SRGB8_ETC2 : extension.COMPRESSED_RGB8_ETC2; if (p === RGBA_ETC2_EAC_Format) return encoding === sRGBEncoding ? extension.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC : extension.COMPRESSED_RGBA8_ETC2_EAC; } else { return null; } - } // ASTC + } + // ASTC if (p === RGBA_ASTC_4x4_Format || p === RGBA_ASTC_5x4_Format || p === RGBA_ASTC_5x5_Format || p === RGBA_ASTC_6x5_Format || p === RGBA_ASTC_6x6_Format || p === RGBA_ASTC_8x5_Format || p === RGBA_ASTC_8x6_Format || p === RGBA_ASTC_8x8_Format || p === RGBA_ASTC_10x5_Format || p === RGBA_ASTC_10x6_Format || p === RGBA_ASTC_10x8_Format || p === RGBA_ASTC_10x10_Format || p === RGBA_ASTC_12x10_Format || p === RGBA_ASTC_12x12_Format) { extension = extensions.get('WEBGL_compressed_texture_astc'); - if (extension !== null) { if (p === RGBA_ASTC_4x4_Format) return encoding === sRGBEncoding ? extension.COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR : extension.COMPRESSED_RGBA_ASTC_4x4_KHR; if (p === RGBA_ASTC_5x4_Format) return encoding === sRGBEncoding ? extension.COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR : extension.COMPRESSED_RGBA_ASTC_5x4_KHR; @@ -17976,24 +15841,24 @@ function WebGLUtils(gl, extensions, capabilities) { } else { return null; } - } // BPTC + } + // BPTC if (p === RGBA_BPTC_Format) { extension = extensions.get('EXT_texture_compression_bptc'); - if (extension !== null) { if (p === RGBA_BPTC_Format) return encoding === sRGBEncoding ? extension.COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT : extension.COMPRESSED_RGBA_BPTC_UNORM_EXT; } else { return null; } - } // + } + // if (p === UnsignedInt248Type) { if (isWebGL2) return gl.UNSIGNED_INT_24_8; extension = extensions.get('WEBGL_depth_texture'); - if (extension !== null) { return extension.UNSIGNED_INT_24_8_WEBGL; } else { @@ -18001,7 +15866,6 @@ function WebGLUtils(gl, extensions, capabilities) { } } } - return { convert: convert }; @@ -18012,9 +15876,7 @@ class ArrayCamera extends PerspectiveCamera { super(); this.cameras = array; } - } - ArrayCamera.prototype.isArrayCamera = true; class Group extends Object3D { @@ -18022,22 +15884,18 @@ class Group extends Object3D { super(); this.type = 'Group'; } - } - Group.prototype.isGroup = true; const _moveEvent = { type: 'move' }; - class WebXRController { constructor() { this._targetRay = null; this._grip = null; this._hand = null; } - getHandSpace() { if (this._hand === null) { this._hand = new Group(); @@ -18048,10 +15906,8 @@ class WebXRController { pinching: false }; } - return this._hand; } - getTargetRaySpace() { if (this._targetRay === null) { this._targetRay = new Group(); @@ -18062,10 +15918,8 @@ class WebXRController { this._targetRay.hasAngularVelocity = false; this._targetRay.angularVelocity = new Vector3(); } - return this._targetRay; } - getGripSpace() { if (this._grip === null) { this._grip = new Group(); @@ -18076,47 +15930,36 @@ class WebXRController { this._grip.hasAngularVelocity = false; this._grip.angularVelocity = new Vector3(); } - return this._grip; } - dispatchEvent(event) { if (this._targetRay !== null) { this._targetRay.dispatchEvent(event); } - if (this._grip !== null) { this._grip.dispatchEvent(event); } - if (this._hand !== null) { this._hand.dispatchEvent(event); } - return this; } - disconnect(inputSource) { this.dispatchEvent({ type: 'disconnected', data: inputSource }); - if (this._targetRay !== null) { this._targetRay.visible = false; } - if (this._grip !== null) { this._grip.visible = false; } - if (this._hand !== null) { this._hand.visible = false; } - return this; } - update(inputSource, frame, referenceSpace) { let inputPose = null; let gripPose = null; @@ -18124,69 +15967,58 @@ class WebXRController { const targetRay = this._targetRay; const grip = this._grip; const hand = this._hand; - if (inputSource && frame.session.visibilityState !== 'visible-blurred') { if (targetRay !== null) { inputPose = frame.getPose(inputSource.targetRaySpace, referenceSpace); - if (inputPose !== null) { targetRay.matrix.fromArray(inputPose.transform.matrix); targetRay.matrix.decompose(targetRay.position, targetRay.rotation, targetRay.scale); - if (inputPose.linearVelocity) { targetRay.hasLinearVelocity = true; targetRay.linearVelocity.copy(inputPose.linearVelocity); } else { targetRay.hasLinearVelocity = false; } - if (inputPose.angularVelocity) { targetRay.hasAngularVelocity = true; targetRay.angularVelocity.copy(inputPose.angularVelocity); } else { targetRay.hasAngularVelocity = false; } - this.dispatchEvent(_moveEvent); } } - if (hand && inputSource.hand) { handPose = true; - for (const inputjoint of inputSource.hand.values()) { // Update the joints groups with the XRJoint poses const jointPose = frame.getJointPose(inputjoint, referenceSpace); - if (hand.joints[inputjoint.jointName] === undefined) { // The transform of this joint will be updated with the joint pose on each frame const joint = new Group(); joint.matrixAutoUpdate = false; joint.visible = false; - hand.joints[inputjoint.jointName] = joint; // ?? - + hand.joints[inputjoint.jointName] = joint; + // ?? hand.add(joint); } - const joint = hand.joints[inputjoint.jointName]; - if (jointPose !== null) { joint.matrix.fromArray(jointPose.transform.matrix); joint.matrix.decompose(joint.position, joint.rotation, joint.scale); joint.jointRadius = jointPose.radius; } - joint.visible = jointPose !== null; - } // Custom events - // Check pinchz + } + // Custom events + // Check pinchz const indexTip = hand.joints['index-finger-tip']; const thumbTip = hand.joints['thumb-tip']; const distance = indexTip.position.distanceTo(thumbTip.position); const distanceToPinch = 0.02; const threshold = 0.005; - if (hand.inputState.pinching && distance > distanceToPinch + threshold) { hand.inputState.pinching = false; this.dispatchEvent({ @@ -18205,18 +16037,15 @@ class WebXRController { } else { if (grip !== null && inputSource.gripSpace) { gripPose = frame.getPose(inputSource.gripSpace, referenceSpace); - if (gripPose !== null) { grip.matrix.fromArray(gripPose.transform.matrix); grip.matrix.decompose(grip.position, grip.rotation, grip.scale); - if (gripPose.linearVelocity) { grip.hasLinearVelocity = true; grip.linearVelocity.copy(gripPose.linearVelocity); } else { grip.hasLinearVelocity = false; } - if (gripPose.angularVelocity) { grip.hasAngularVelocity = true; grip.angularVelocity.copy(gripPose.angularVelocity); @@ -18227,32 +16056,25 @@ class WebXRController { } } } - if (targetRay !== null) { targetRay.visible = inputPose !== null; } - if (grip !== null) { grip.visible = gripPose !== null; } - if (hand !== null) { hand.visible = handPose !== null; } - return this; } - } class DepthTexture extends Texture { constructor(width, height, type, mapping, wrapS, wrapT, magFilter, minFilter, anisotropy, format) { format = format !== undefined ? format : DepthFormat; - if (format !== DepthFormat && format !== DepthStencilFormat) { throw new Error('DepthTexture format must be either THREE.DepthFormat or THREE.DepthStencilFormat'); } - if (type === undefined && format === DepthFormat) type = UnsignedShortType; if (type === undefined && format === DepthStencilFormat) type = UnsignedInt248Type; super(null, mapping, wrapS, wrapT, magFilter, minFilter, format, type, anisotropy); @@ -18265,9 +16087,7 @@ class DepthTexture extends Texture { this.flipY = false; this.generateMipmaps = false; } - } - DepthTexture.prototype.isDepthTexture = true; class WebXRManager extends EventDispatcher { @@ -18287,7 +16107,9 @@ class WebXRManager extends EventDispatcher { let initialRenderTarget = null; let newRenderTarget = null; const controllers = []; - const inputSourcesMap = new Map(); // + const inputSourcesMap = new Map(); + + // const cameraL = new PerspectiveCamera(); cameraL.layers.enable(1); @@ -18300,49 +16122,42 @@ class WebXRManager extends EventDispatcher { cameraVR.layers.enable(1); cameraVR.layers.enable(2); let _currentDepthNear = null; - let _currentDepthFar = null; // + let _currentDepthFar = null; + + // this.cameraAutoUpdate = true; this.enabled = false; this.isPresenting = false; - this.getController = function (index) { let controller = controllers[index]; - if (controller === undefined) { controller = new WebXRController(); controllers[index] = controller; } - return controller.getTargetRaySpace(); }; - this.getControllerGrip = function (index) { let controller = controllers[index]; - if (controller === undefined) { controller = new WebXRController(); controllers[index] = controller; } - return controller.getGripSpace(); }; - this.getHand = function (index) { let controller = controllers[index]; - if (controller === undefined) { controller = new WebXRController(); controllers[index] = controller; } - return controller.getHandSpace(); - }; // + }; + // function onSessionEvent(event) { const controller = inputSourcesMap.get(event.inputSource); - if (controller) { controller.dispatchEvent({ type: event.type, @@ -18350,21 +16165,24 @@ class WebXRManager extends EventDispatcher { }); } } - function onSessionEnd() { inputSourcesMap.forEach(function (controller, inputSource) { controller.disconnect(inputSource); }); inputSourcesMap.clear(); _currentDepthNear = null; - _currentDepthFar = null; // restore framebuffer/rendering state + _currentDepthFar = null; + + // restore framebuffer/rendering state renderer.setRenderTarget(initialRenderTarget); glBaseLayer = null; glProjLayer = null; glBinding = null; session = null; - newRenderTarget = null; // + newRenderTarget = null; + + // animation.stop(); scope.isPresenting = false; @@ -18372,46 +16190,35 @@ class WebXRManager extends EventDispatcher { type: 'sessionend' }); } - this.setFramebufferScaleFactor = function (value) { framebufferScaleFactor = value; - if (scope.isPresenting === true) { console.warn('THREE.WebXRManager: Cannot change framebuffer scale while presenting.'); } }; - this.setReferenceSpaceType = function (value) { referenceSpaceType = value; - if (scope.isPresenting === true) { console.warn('THREE.WebXRManager: Cannot change reference space type while presenting.'); } }; - this.getReferenceSpace = function () { return referenceSpace; }; - this.getBaseLayer = function () { return glProjLayer !== null ? glProjLayer : glBaseLayer; }; - this.getBinding = function () { return glBinding; }; - this.getFrame = function () { return xrFrame; }; - this.getSession = function () { return session; }; - this.setSession = async function (value) { session = value; - if (session !== null) { initialRenderTarget = renderer.getRenderTarget(); session.addEventListener('select', onSessionEvent); @@ -18422,11 +16229,9 @@ class WebXRManager extends EventDispatcher { session.addEventListener('squeezeend', onSessionEvent); session.addEventListener('end', onSessionEnd); session.addEventListener('inputsourceschange', onInputSourcesChange); - if (attributes.xrCompatible !== true) { await gl.makeXRCompatible(); } - if (session.renderState.layers === undefined || renderer.capabilities.isWebGL2 === false) { const layerInit = { antialias: session.renderState.layers === undefined ? attributes.antialias : true, @@ -18448,13 +16253,11 @@ class WebXRManager extends EventDispatcher { let depthFormat = null; let depthType = null; let glDepthFormat = null; - if (attributes.depth) { glDepthFormat = attributes.stencil ? gl.DEPTH24_STENCIL8 : gl.DEPTH_COMPONENT24; depthFormat = attributes.stencil ? DepthStencilFormat : DepthFormat; depthType = attributes.stencil ? UnsignedInt248Type : UnsignedShortType; } - const projectionlayerInit = { colorFormat: renderer.outputEncoding === sRGBEncoding ? gl.SRGB8_ALPHA8 : gl.RGBA8, depthFormat: glDepthFormat, @@ -18476,10 +16279,9 @@ class WebXRManager extends EventDispatcher { const renderTargetProperties = renderer.properties.get(newRenderTarget); renderTargetProperties.__ignoreDepthValues = glProjLayer.ignoreDepthValues; } - newRenderTarget.isXRRenderTarget = true; // TODO Remove this when possible, see #23278 - // Set foveation to maximum. + // Set foveation to maximum. this.setFoveation(1.0); referenceSpace = await session.requestReferenceSpace(referenceSpaceType); animation.setContext(session); @@ -18490,19 +16292,20 @@ class WebXRManager extends EventDispatcher { }); } }; - function onInputSourcesChange(event) { - const inputSources = session.inputSources; // Assign inputSources to available controllers + const inputSources = session.inputSources; + + // Assign inputSources to available controllers for (let i = 0; i < controllers.length; i++) { inputSourcesMap.set(inputSources[i], controllers[i]); - } // Notify disconnected + } + // Notify disconnected for (let i = 0; i < event.removed.length; i++) { const inputSource = event.removed[i]; const controller = inputSourcesMap.get(inputSource); - if (controller) { controller.dispatchEvent({ type: 'disconnected', @@ -18510,13 +16313,13 @@ class WebXRManager extends EventDispatcher { }); inputSourcesMap.delete(inputSource); } - } // Notify connected + } + // Notify connected for (let i = 0; i < event.added.length; i++) { const inputSource = event.added[i]; const controller = inputSourcesMap.get(inputSource); - if (controller) { controller.dispatchEvent({ type: 'connected', @@ -18524,27 +16327,29 @@ class WebXRManager extends EventDispatcher { }); } } - } // + } + // const cameraLPos = new Vector3(); const cameraRPos = new Vector3(); + /** * Assumes 2 cameras that are parallel and share an X-axis, and that * the cameras' projection and world matrices have already been set. * And that near and far planes are identical for both cameras. * Visualization of this technique: https://computergraphics.stackexchange.com/a/4765 */ - function setProjectionFromUnion(camera, cameraL, cameraR) { cameraLPos.setFromMatrixPosition(cameraL.matrixWorld); cameraRPos.setFromMatrixPosition(cameraR.matrixWorld); const ipd = cameraLPos.distanceTo(cameraRPos); const projL = cameraL.projectionMatrix.elements; - const projR = cameraR.projectionMatrix.elements; // VR systems will have identical far and near planes, and + const projR = cameraR.projectionMatrix.elements; + + // VR systems will have identical far and near planes, and // most likely identical top and bottom frustum extents. // Use the left camera for these values. - const near = projL[14] / (projL[10] - 1); const far = projL[14] / (projL[10] + 1); const topFov = (projL[9] + 1) / projL[5]; @@ -18552,20 +16357,23 @@ class WebXRManager extends EventDispatcher { const leftFov = (projL[8] - 1) / projL[0]; const rightFov = (projR[8] + 1) / projR[0]; const left = near * leftFov; - const right = near * rightFov; // Calculate the new camera's position offset from the - // left camera. xOffset should be roughly half `ipd`. + const right = near * rightFov; + // Calculate the new camera's position offset from the + // left camera. xOffset should be roughly half `ipd`. const zOffset = ipd / (-leftFov + rightFov); - const xOffset = zOffset * -leftFov; // TODO: Better way to apply this offset? + const xOffset = zOffset * -leftFov; + // TODO: Better way to apply this offset? cameraL.matrixWorld.decompose(camera.position, camera.quaternion, camera.scale); camera.translateX(xOffset); camera.translateZ(zOffset); camera.matrixWorld.compose(camera.position, camera.quaternion, camera.scale); - camera.matrixWorldInverse.copy(camera.matrixWorld).invert(); // Find the union of the frustum values of the cameras and scale + camera.matrixWorldInverse.copy(camera.matrixWorld).invert(); + + // Find the union of the frustum values of the cameras and scale // the values so that the near plane's position does not change in world space, // although must now be relative to the new union camera. - const near2 = near + zOffset; const far2 = far + zOffset; const left2 = left - xOffset; @@ -18574,24 +16382,21 @@ class WebXRManager extends EventDispatcher { const bottom2 = bottomFov * far / far2 * near2; camera.projectionMatrix.makePerspective(left2, right2, top2, bottom2, near2, far2); } - function updateCamera(camera, parent) { if (parent === null) { camera.matrixWorld.copy(camera.matrix); } else { camera.matrixWorld.multiplyMatrices(parent.matrixWorld, camera.matrix); } - camera.matrixWorldInverse.copy(camera.matrixWorld).invert(); } - this.updateCamera = function (camera) { if (session === null) return; cameraVR.near = cameraR.near = cameraL.near = camera.near; cameraVR.far = cameraR.far = cameraL.far = camera.far; - if (_currentDepthNear !== cameraVR.near || _currentDepthFar !== cameraVR.far) { // Note that the new renderState won't apply until the next frame. See #18320 + session.updateRenderState({ depthNear: cameraVR.near, depthFar: cameraVR.far @@ -18599,16 +16404,15 @@ class WebXRManager extends EventDispatcher { _currentDepthNear = cameraVR.near; _currentDepthFar = cameraVR.far; } - const parent = camera.parent; const cameras = cameraVR.cameras; updateCamera(cameraVR, parent); - for (let i = 0; i < cameras.length; i++) { updateCamera(cameras[i], parent); } + cameraVR.matrixWorld.decompose(cameraVR.position, cameraVR.quaternion, cameraVR.scale); - cameraVR.matrixWorld.decompose(cameraVR.position, cameraVR.quaternion, cameraVR.scale); // update user camera and its children + // update user camera and its children camera.position.copy(cameraVR.position); camera.quaternion.copy(cameraVR.quaternion); @@ -18616,130 +16420,121 @@ class WebXRManager extends EventDispatcher { camera.matrix.copy(cameraVR.matrix); camera.matrixWorld.copy(cameraVR.matrixWorld); const children = camera.children; - for (let i = 0, l = children.length; i < l; i++) { children[i].updateMatrixWorld(true); - } // update projection matrix for proper view frustum culling + } + // update projection matrix for proper view frustum culling if (cameras.length === 2) { setProjectionFromUnion(cameraVR, cameraL, cameraR); } else { // assume single camera setup (AR) + cameraVR.projectionMatrix.copy(cameraL.projectionMatrix); } }; - this.getCamera = function () { return cameraVR; }; - this.getFoveation = function () { if (glProjLayer !== null) { return glProjLayer.fixedFoveation; } - if (glBaseLayer !== null) { return glBaseLayer.fixedFoveation; } - return undefined; }; - this.setFoveation = function (foveation) { // 0 = no foveation = full resolution // 1 = maximum foveation = the edges render at lower resolution + if (glProjLayer !== null) { glProjLayer.fixedFoveation = foveation; } - if (glBaseLayer !== null && glBaseLayer.fixedFoveation !== undefined) { glBaseLayer.fixedFoveation = foveation; } - }; // Animation Loop + }; + // Animation Loop let onAnimationFrameCallback = null; - function onAnimationFrame(time, frame) { pose = frame.getViewerPose(referenceSpace); xrFrame = frame; - if (pose !== null) { const views = pose.views; - if (glBaseLayer !== null) { renderer.setRenderTargetFramebuffer(newRenderTarget, glBaseLayer.framebuffer); renderer.setRenderTarget(newRenderTarget); } + let cameraVRNeedsUpdate = false; - let cameraVRNeedsUpdate = false; // check if it's necessary to rebuild cameraVR's camera list + // check if it's necessary to rebuild cameraVR's camera list if (views.length !== cameraVR.cameras.length) { cameraVR.cameras.length = 0; cameraVRNeedsUpdate = true; } - for (let i = 0; i < views.length; i++) { const view = views[i]; let viewport = null; - if (glBaseLayer !== null) { viewport = glBaseLayer.getViewport(view); } else { const glSubImage = glBinding.getViewSubImage(glProjLayer, view); - viewport = glSubImage.viewport; // For side-by-side projection, we only produce a single texture for both eyes. + viewport = glSubImage.viewport; + // For side-by-side projection, we only produce a single texture for both eyes. if (i === 0) { renderer.setRenderTargetTextures(newRenderTarget, glSubImage.colorTexture, glProjLayer.ignoreDepthValues ? undefined : glSubImage.depthStencilTexture); renderer.setRenderTarget(newRenderTarget); } } - - const camera = cameras[i]; + let camera = cameras[i]; + if (camera === undefined) { + camera = new PerspectiveCamera(); + camera.layers.enable(i); + camera.viewport = new Vector4(); + cameras[i] = camera; + } camera.matrix.fromArray(view.transform.matrix); camera.projectionMatrix.fromArray(view.projectionMatrix); camera.viewport.set(viewport.x, viewport.y, viewport.width, viewport.height); - if (i === 0) { cameraVR.matrix.copy(camera.matrix); } - if (cameraVRNeedsUpdate === true) { cameraVR.cameras.push(camera); } } - } // + } + // const inputSources = session.inputSources; - for (let i = 0; i < controllers.length; i++) { const controller = controllers[i]; const inputSource = inputSources[i]; controller.update(inputSource, frame, referenceSpace); } - if (onAnimationFrameCallback) onAnimationFrameCallback(time, frame); xrFrame = null; } - const animation = new WebGLAnimation(); animation.setAnimationLoop(onAnimationFrame); - this.setAnimationLoop = function (callback) { onAnimationFrameCallback = callback; }; - this.dispose = function () {}; } - } function WebGLMaterials(properties) { function refreshFogUniforms(uniforms, fog) { uniforms.fogColor.value.copy(fog.color); - if (fog.isFog) { uniforms.fogNear.value = fog.near; uniforms.fogFar.value = fog.far; @@ -18747,7 +16542,6 @@ function WebGLMaterials(properties) { uniforms.fogDensity.value = fog.density; } } - function refreshMaterialUniforms(uniforms, material, pixelRatio, height, transmissionRenderTarget) { if (material.isMeshBasicMaterial) { refreshUniformsCommon(uniforms, material); @@ -18762,7 +16556,6 @@ function WebGLMaterials(properties) { refreshUniformsPhong(uniforms, material); } else if (material.isMeshStandardMaterial) { refreshUniformsCommon(uniforms, material); - if (material.isMeshPhysicalMaterial) { refreshUniformsPhysical(uniforms, material, transmissionRenderTarget); } else { @@ -18782,7 +16575,6 @@ function WebGLMaterials(properties) { refreshUniformsNormal(uniforms, material); } else if (material.isLineBasicMaterial) { refreshUniformsLine(uniforms, material); - if (material.isLineDashedMaterial) { refreshUniformsDash(uniforms, material); } @@ -18797,36 +16589,27 @@ function WebGLMaterials(properties) { material.uniformsNeedUpdate = false; // #15581 } } - function refreshUniformsCommon(uniforms, material) { uniforms.opacity.value = material.opacity; - if (material.color) { uniforms.diffuse.value.copy(material.color); } - if (material.emissive) { uniforms.emissive.value.copy(material.emissive).multiplyScalar(material.emissiveIntensity); } - if (material.map) { uniforms.map.value = material.map; } - if (material.alphaMap) { uniforms.alphaMap.value = material.alphaMap; } - if (material.specularMap) { uniforms.specularMap.value = material.specularMap; } - if (material.alphaTest > 0) { uniforms.alphaTest.value = material.alphaTest; } - const envMap = properties.get(material).envMap; - if (envMap) { uniforms.envMap.value = envMap; uniforms.flipEnvMap.value = envMap.isCubeTexture && envMap.isRenderTargetTexture === false ? -1 : 1; @@ -18834,16 +16617,16 @@ function WebGLMaterials(properties) { uniforms.ior.value = material.ior; uniforms.refractionRatio.value = material.refractionRatio; } - if (material.lightMap) { uniforms.lightMap.value = material.lightMap; uniforms.lightMapIntensity.value = material.lightMapIntensity; } - if (material.aoMap) { uniforms.aoMap.value = material.aoMap; uniforms.aoMapIntensity.value = material.aoMapIntensity; - } // uv repeat and offset setting priorities + } + + // uv repeat and offset setting priorities // 1. color map // 2. specular map // 3. displacementMap map @@ -18861,9 +16644,7 @@ function WebGLMaterials(properties) { // 15. transmission map // 16. thickness map - let uvScaleMap; - if (material.map) { uvScaleMap = material.map; } else if (material.specularMap) { @@ -18901,137 +16682,115 @@ function WebGLMaterials(properties) { } else if (material.sheenRoughnessMap) { uvScaleMap = material.sheenRoughnessMap; } - if (uvScaleMap !== undefined) { // backwards compatibility if (uvScaleMap.isWebGLRenderTarget) { uvScaleMap = uvScaleMap.texture; } - if (uvScaleMap.matrixAutoUpdate === true) { uvScaleMap.updateMatrix(); } - uniforms.uvTransform.value.copy(uvScaleMap.matrix); - } // uv repeat and offset setting priorities for uv2 + } + + // uv repeat and offset setting priorities for uv2 // 1. ao map // 2. light map - let uv2ScaleMap; - if (material.aoMap) { uv2ScaleMap = material.aoMap; } else if (material.lightMap) { uv2ScaleMap = material.lightMap; } - if (uv2ScaleMap !== undefined) { // backwards compatibility if (uv2ScaleMap.isWebGLRenderTarget) { uv2ScaleMap = uv2ScaleMap.texture; } - if (uv2ScaleMap.matrixAutoUpdate === true) { uv2ScaleMap.updateMatrix(); } - uniforms.uv2Transform.value.copy(uv2ScaleMap.matrix); } } - function refreshUniformsLine(uniforms, material) { uniforms.diffuse.value.copy(material.color); uniforms.opacity.value = material.opacity; } - function refreshUniformsDash(uniforms, material) { uniforms.dashSize.value = material.dashSize; uniforms.totalSize.value = material.dashSize + material.gapSize; uniforms.scale.value = material.scale; } - function refreshUniformsPoints(uniforms, material, pixelRatio, height) { uniforms.diffuse.value.copy(material.color); uniforms.opacity.value = material.opacity; uniforms.size.value = material.size * pixelRatio; uniforms.scale.value = height * 0.5; - if (material.map) { uniforms.map.value = material.map; } - if (material.alphaMap) { uniforms.alphaMap.value = material.alphaMap; } - if (material.alphaTest > 0) { uniforms.alphaTest.value = material.alphaTest; - } // uv repeat and offset setting priorities + } + + // uv repeat and offset setting priorities // 1. color map // 2. alpha map - let uvScaleMap; - if (material.map) { uvScaleMap = material.map; } else if (material.alphaMap) { uvScaleMap = material.alphaMap; } - if (uvScaleMap !== undefined) { if (uvScaleMap.matrixAutoUpdate === true) { uvScaleMap.updateMatrix(); } - uniforms.uvTransform.value.copy(uvScaleMap.matrix); } } - function refreshUniformsSprites(uniforms, material) { uniforms.diffuse.value.copy(material.color); uniforms.opacity.value = material.opacity; uniforms.rotation.value = material.rotation; - if (material.map) { uniforms.map.value = material.map; } - if (material.alphaMap) { uniforms.alphaMap.value = material.alphaMap; } - if (material.alphaTest > 0) { uniforms.alphaTest.value = material.alphaTest; - } // uv repeat and offset setting priorities + } + + // uv repeat and offset setting priorities // 1. color map // 2. alpha map - let uvScaleMap; - if (material.map) { uvScaleMap = material.map; } else if (material.alphaMap) { uvScaleMap = material.alphaMap; } - if (uvScaleMap !== undefined) { if (uvScaleMap.matrixAutoUpdate === true) { uvScaleMap.updateMatrix(); } - uniforms.uvTransform.value.copy(uvScaleMap.matrix); } } - function refreshUniformsLambert(uniforms, material) { if (material.emissiveMap) { uniforms.emissiveMap.value = material.emissiveMap; } } - function refreshUniformsPhong(uniforms, material) { uniforms.specular.value.copy(material.specular); uniforms.shininess.value = Math.max(material.shininess, 1e-4); // to prevent pow( 0.0, 0.0 ) @@ -19039,102 +16798,83 @@ function WebGLMaterials(properties) { if (material.emissiveMap) { uniforms.emissiveMap.value = material.emissiveMap; } - if (material.bumpMap) { uniforms.bumpMap.value = material.bumpMap; uniforms.bumpScale.value = material.bumpScale; if (material.side === BackSide) uniforms.bumpScale.value *= -1; } - if (material.normalMap) { uniforms.normalMap.value = material.normalMap; uniforms.normalScale.value.copy(material.normalScale); if (material.side === BackSide) uniforms.normalScale.value.negate(); } - if (material.displacementMap) { uniforms.displacementMap.value = material.displacementMap; uniforms.displacementScale.value = material.displacementScale; uniforms.displacementBias.value = material.displacementBias; } } - function refreshUniformsToon(uniforms, material) { if (material.gradientMap) { uniforms.gradientMap.value = material.gradientMap; } - if (material.emissiveMap) { uniforms.emissiveMap.value = material.emissiveMap; } - if (material.bumpMap) { uniforms.bumpMap.value = material.bumpMap; uniforms.bumpScale.value = material.bumpScale; if (material.side === BackSide) uniforms.bumpScale.value *= -1; } - if (material.normalMap) { uniforms.normalMap.value = material.normalMap; uniforms.normalScale.value.copy(material.normalScale); if (material.side === BackSide) uniforms.normalScale.value.negate(); } - if (material.displacementMap) { uniforms.displacementMap.value = material.displacementMap; uniforms.displacementScale.value = material.displacementScale; uniforms.displacementBias.value = material.displacementBias; } } - function refreshUniformsStandard(uniforms, material) { uniforms.roughness.value = material.roughness; uniforms.metalness.value = material.metalness; uniforms.f90_r115_compatability.value = material.f90; - if (material.refraction > 0) { uniforms.refraction.value = material.refraction; } - if (material.roughnessMap) { uniforms.roughnessMap.value = material.roughnessMap; } - if (material.metalnessMap) { uniforms.metalnessMap.value = material.metalnessMap; } - if (material.emissiveMap) { uniforms.emissiveMap.value = material.emissiveMap; } - if (material.bumpMap) { uniforms.bumpMap.value = material.bumpMap; uniforms.bumpScale.value = material.bumpScale; if (material.side === BackSide) uniforms.bumpScale.value *= -1; } - if (material.normalMap) { uniforms.normalMap.value = material.normalMap; uniforms.normalScale.value.copy(material.normalScale); if (material.lowerNormalMap) uniforms.lowerNormalMap.value = material.lowerNormalMap; if (material.side === BackSide) uniforms.normalScale.value.negate(); } - if (material.displacementMap) { uniforms.displacementMap.value = material.displacementMap; uniforms.displacementScale.value = material.displacementScale; uniforms.displacementBias.value = material.displacementBias; } - const envMap = properties.get(material).envMap; - if (envMap) { //uniforms.envMap.value = material.envMap; // part of uniforms common uniforms.envMapIntensity.value = material.envMapIntensity; } } - function refreshUniformsPhysical(uniforms, material, transmissionRenderTarget) { refreshUniformsStandard(uniforms, material); uniforms.ior.value = material.ior; // also part of uniforms common @@ -19142,93 +16882,73 @@ function WebGLMaterials(properties) { if (material.sheen > 0) { uniforms.sheenColor.value.copy(material.sheenColor).multiplyScalar(material.sheen); uniforms.sheenRoughness.value = material.sheenRoughness; - if (material.sheenColorMap) { uniforms.sheenColorMap.value = material.sheenColorMap; } - if (material.sheenRoughnessMap) { uniforms.sheenRoughnessMap.value = material.sheenRoughnessMap; } } - if (material.clearcoat > 0) { uniforms.clearcoat.value = material.clearcoat; uniforms.clearcoatRoughness.value = material.clearcoatRoughness; - if (material.clearcoatMap) { uniforms.clearcoatMap.value = material.clearcoatMap; } - if (material.clearcoatRoughnessMap) { uniforms.clearcoatRoughnessMap.value = material.clearcoatRoughnessMap; } - if (material.clearcoatNormalMap) { uniforms.clearcoatNormalScale.value.copy(material.clearcoatNormalScale); uniforms.clearcoatNormalMap.value = material.clearcoatNormalMap; - if (material.side === BackSide) { uniforms.clearcoatNormalScale.value.negate(); } } } - if (material.transmission > 0) { uniforms.transmission.value = material.transmission; uniforms.transmissionSamplerMap.value = transmissionRenderTarget.texture; uniforms.transmissionSamplerSize.value.set(transmissionRenderTarget.width, transmissionRenderTarget.height); - if (material.transmissionMap) { uniforms.transmissionMap.value = material.transmissionMap; } - uniforms.thickness.value = material.thickness; - if (material.thicknessMap) { uniforms.thicknessMap.value = material.thicknessMap; } - uniforms.attenuationDistance.value = material.attenuationDistance; uniforms.attenuationColor.value.copy(material.attenuationColor); } - uniforms.specularIntensity.value = material.specularIntensity; uniforms.specularColor.value.copy(material.specularColor); - if (material.specularIntensityMap) { uniforms.specularIntensityMap.value = material.specularIntensityMap; } - if (material.specularColorMap) { uniforms.specularColorMap.value = material.specularColorMap; } } - function refreshUniformsMatcap(uniforms, material) { if (material.matcap) { uniforms.matcap.value = material.matcap; } - if (material.bumpMap) { uniforms.bumpMap.value = material.bumpMap; uniforms.bumpScale.value = material.bumpScale; if (material.side === BackSide) uniforms.bumpScale.value *= -1; } - if (material.normalMap) { uniforms.normalMap.value = material.normalMap; uniforms.normalScale.value.copy(material.normalScale); if (material.side === BackSide) uniforms.normalScale.value.negate(); } - if (material.displacementMap) { uniforms.displacementMap.value = material.displacementMap; uniforms.displacementScale.value = material.displacementScale; uniforms.displacementBias.value = material.displacementBias; } } - function refreshUniformsDepth(uniforms, material) { if (material.displacementMap) { uniforms.displacementMap.value = material.displacementMap; @@ -19236,39 +16956,33 @@ function WebGLMaterials(properties) { uniforms.displacementBias.value = material.displacementBias; } } - function refreshUniformsDistance(uniforms, material) { if (material.displacementMap) { uniforms.displacementMap.value = material.displacementMap; uniforms.displacementScale.value = material.displacementScale; uniforms.displacementBias.value = material.displacementBias; } - uniforms.referencePosition.value.copy(material.referencePosition); uniforms.nearDistance.value = material.nearDistance; uniforms.farDistance.value = material.farDistance; } - function refreshUniformsNormal(uniforms, material) { if (material.bumpMap) { uniforms.bumpMap.value = material.bumpMap; uniforms.bumpScale.value = material.bumpScale; if (material.side === BackSide) uniforms.bumpScale.value *= -1; } - if (material.normalMap) { uniforms.normalMap.value = material.normalMap; uniforms.normalScale.value.copy(material.normalScale); if (material.side === BackSide) uniforms.normalScale.value.negate(); } - if (material.displacementMap) { uniforms.displacementMap.value = material.displacementMap; uniforms.displacementScale.value = material.displacementScale; uniforms.displacementBias.value = material.displacementBias; } } - return { refreshFogUniforms: refreshFogUniforms, refreshMaterialUniforms: refreshMaterialUniforms @@ -19280,97 +16994,113 @@ function createCanvasElement() { canvas.style.display = 'block'; return canvas; } - function WebGLRenderer(parameters = {}) { const _canvas = parameters.canvas !== undefined ? parameters.canvas : createCanvasElement(), - _context = parameters.context !== undefined ? parameters.context : null, - _alpha = parameters.alpha !== undefined ? parameters.alpha : false, - _depth = parameters.depth !== undefined ? parameters.depth : true, - _stencil = parameters.stencil !== undefined ? parameters.stencil : true, - _antialias = parameters.antialias !== undefined ? parameters.antialias : false, - _premultipliedAlpha = parameters.premultipliedAlpha !== undefined ? parameters.premultipliedAlpha : true, - _preserveDrawingBuffer = parameters.preserveDrawingBuffer !== undefined ? parameters.preserveDrawingBuffer : false, - _powerPreference = parameters.powerPreference !== undefined ? parameters.powerPreference : 'default', - _failIfMajorPerformanceCaveat = parameters.failIfMajorPerformanceCaveat !== undefined ? parameters.failIfMajorPerformanceCaveat : false; - + _context = parameters.context !== undefined ? parameters.context : null, + _alpha = parameters.alpha !== undefined ? parameters.alpha : false, + _depth = parameters.depth !== undefined ? parameters.depth : true, + _stencil = parameters.stencil !== undefined ? parameters.stencil : true, + _antialias = parameters.antialias !== undefined ? parameters.antialias : false, + _premultipliedAlpha = parameters.premultipliedAlpha !== undefined ? parameters.premultipliedAlpha : true, + _preserveDrawingBuffer = parameters.preserveDrawingBuffer !== undefined ? parameters.preserveDrawingBuffer : false, + _powerPreference = parameters.powerPreference !== undefined ? parameters.powerPreference : 'default', + _failIfMajorPerformanceCaveat = parameters.failIfMajorPerformanceCaveat !== undefined ? parameters.failIfMajorPerformanceCaveat : false; let currentRenderList = null; - let currentRenderState = null; // render() can be called from within a callback triggered by another render. + let currentRenderState = null; + + // render() can be called from within a callback triggered by another render. // We track this so that the nested render call gets its list and state isolated from the parent render call. const renderListStack = []; - const renderStateStack = []; // public properties + const renderStateStack = []; + + // public properties - this.domElement = _canvas; // Debug configuration container + this.domElement = _canvas; + // Debug configuration container this.debug = { /** * Enables error checking and reporting when shader programs are being compiled * @type {boolean} */ checkShaderErrors: true - }; // clearing + }; + + // clearing this.autoClear = true; this.autoClearColor = true; this.autoClearDepth = true; - this.autoClearStencil = true; // scene graph + this.autoClearStencil = true; + + // scene graph + + this.sortObjects = true; - this.sortObjects = true; // user-defined clipping + // user-defined clipping this.clippingPlanes = []; - this.localClippingEnabled = false; // physically based shading + this.localClippingEnabled = false; - this.outputEncoding = LinearEncoding; // physical lights + // physically based shading - this.physicallyCorrectLights = false; // tone mapping + this.outputEncoding = LinearEncoding; + + // physical lights + + this.physicallyCorrectLights = false; + + // tone mapping this.toneMapping = NoToneMapping; - this.toneMappingExposure = 1.0; // internal properties + this.toneMappingExposure = 1.0; + + // internal properties const _this = this; + let _isContextLost = false; - let _isContextLost = false; // internal state cache + // internal state cache let _currentActiveCubeFace = 0; let _currentActiveMipmapLevel = 0; let _currentRenderTarget = null; - let _currentMaterialId = -1; - let _currentCamera = null; - const _currentViewport = new Vector4(); - const _currentScissor = new Vector4(); + let _currentScissorTest = null; - let _currentScissorTest = null; // + // let _width = _canvas.width; let _height = _canvas.height; let _pixelRatio = 1; let _opaqueSort = null; let _transparentSort = null; - const _viewport = new Vector4(0, 0, _width, _height); - const _scissor = new Vector4(0, 0, _width, _height); + let _scissorTest = false; - let _scissorTest = false; // frustum + // frustum - const _frustum = new Frustum(); // clipping + const _frustum = new Frustum(); + // clipping let _clippingEnabled = false; - let _localClippingEnabled = false; // transmission + let _localClippingEnabled = false; - let _transmissionRenderTarget = null; // camera matrices cache + // transmission - const _projScreenMatrix = new Matrix4(); + let _transmissionRenderTarget = null; - const _vector3 = new Vector3(); + // camera matrices cache + const _projScreenMatrix = new Matrix4(); + const _vector3 = new Vector3(); const _vector2 = new Vector2(); - const _emptyScene = { background: null, fog: null, @@ -19389,26 +17119,21 @@ function WebGLRenderer(parameters = {}) { projectionMatrix: new Matrix4(), matrixWorldInverse: new Matrix4() }; - function getTargetPixelRatio() { return _currentRenderTarget === null ? _pixelRatio : 1; - } // initialize + } + // initialize let _gl = _context; - function getContext(contextNames, contextAttributes) { for (let i = 0; i < contextNames.length; i++) { const contextName = contextNames[i]; - const context = _canvas.getContext(contextName, contextAttributes); - if (context !== null) return context; } - return null; } - try { const contextAttributes = { alpha: true, @@ -19419,23 +17144,20 @@ function WebGLRenderer(parameters = {}) { preserveDrawingBuffer: _preserveDrawingBuffer, powerPreference: _powerPreference, failIfMajorPerformanceCaveat: _failIfMajorPerformanceCaveat - }; // OffscreenCanvas does not have setAttribute, see #22811 + }; - if ('setAttribute' in _canvas) _canvas.setAttribute('data-engine', `three.js r${REVISION}`); // event listeners must be registered before WebGL context is created, see #12753 + // OffscreenCanvas does not have setAttribute, see #22811 + if ('setAttribute' in _canvas) _canvas.setAttribute('data-engine', `three.js r${REVISION}`); + // event listeners must be registered before WebGL context is created, see #12753 _canvas.addEventListener('webglcontextlost', onContextLost, false); - _canvas.addEventListener('webglcontextrestored', onContextRestore, false); - if (_gl === null) { const contextNames = ['webgl2', 'webgl', 'experimental-webgl']; - if (_this.isWebGL1Renderer === true) { contextNames.shift(); } - _gl = getContext(contextNames, contextAttributes); - if (_gl === null) { if (getContext(contextNames)) { throw new Error('Error creating WebGL context with your selected attributes.'); @@ -19443,8 +17165,9 @@ function WebGLRenderer(parameters = {}) { throw new Error('Error creating WebGL context.'); } } - } // Some experimental-webgl implementations do not have getShaderPrecisionFormat + } + // Some experimental-webgl implementations do not have getShaderPrecisionFormat if (_gl.getShaderPrecisionFormat === undefined) { _gl.getShaderPrecisionFormat = function () { @@ -19459,13 +17182,11 @@ function WebGLRenderer(parameters = {}) { console.error('THREE.WebGLRenderer: ' + error.message); throw error; } - let extensions, capabilities, state, info; let properties, textures, cubemaps, cubeuvmaps, attributes, geometries, objects; let programCache, materials, renderLists, renderStates, clipping, shadowMap; let background, morphtargets, bufferRenderer, indexedBufferRenderer; let utils, bindingStates; - function initGLContext() { extensions = new WebGLExtensions(_gl, parameters); capabilities = new WebGLCapabilities(_gl, extensions, parameters); @@ -19500,67 +17221,58 @@ function WebGLRenderer(parameters = {}) { _this.state = state; _this.info = info; } + initGLContext(); - initGLContext(); // xr + // xr const xr = new WebXRManager(_this, _gl); - this.xr = xr; // API + this.xr = xr; + + // API this.getContext = function () { return _gl; }; - this.getContextAttributes = function () { return _gl.getContextAttributes(); }; - this.forceContextLoss = function () { const extension = extensions.get('WEBGL_lose_context'); if (extension) extension.loseContext(); }; - this.forceContextRestore = function () { const extension = extensions.get('WEBGL_lose_context'); if (extension) extension.restoreContext(); }; - this.getPixelRatio = function () { return _pixelRatio; }; - this.setPixelRatio = function (value) { if (value === undefined) return; _pixelRatio = value; this.setSize(_width, _height, false); }; - this.getSize = function (target) { return target.set(_width, _height); }; - this.setSize = function (width, height, updateStyle) { if (xr.isPresenting) { console.warn('THREE.WebGLRenderer: Can\'t change size while VR device is presenting.'); return; } - _width = width; _height = height; _canvas.width = Math.floor(width * _pixelRatio); _canvas.height = Math.floor(height * _pixelRatio); - if (updateStyle !== false) { _canvas.style.width = width + 'px'; _canvas.style.height = height + 'px'; } - this.setViewport(0, 0, width, height); }; - this.getDrawingBufferSize = function (target) { return target.set(_width * _pixelRatio, _height * _pixelRatio).floor(); }; - this.setDrawingBufferSize = function (width, height, pixelRatio) { _width = width; _height = height; @@ -19569,81 +17281,65 @@ function WebGLRenderer(parameters = {}) { _canvas.height = Math.floor(height * pixelRatio); this.setViewport(0, 0, width, height); }; - this.getCurrentViewport = function (target) { return target.copy(_currentViewport); }; - this.getViewport = function (target) { return target.copy(_viewport); }; - this.setViewport = function (x, y, width, height) { if (x.isVector4) { _viewport.set(x.x, x.y, x.z, x.w); } else { _viewport.set(x, y, width, height); } - state.viewport(_currentViewport.copy(_viewport).multiplyScalar(_pixelRatio).floor()); }; - this.getScissor = function (target) { return target.copy(_scissor); }; - this.setScissor = function (x, y, width, height) { if (x.isVector4) { _scissor.set(x.x, x.y, x.z, x.w); } else { _scissor.set(x, y, width, height); } - state.scissor(_currentScissor.copy(_scissor).multiplyScalar(_pixelRatio).floor()); }; - this.getScissorTest = function () { return _scissorTest; }; - this.setScissorTest = function (boolean) { state.setScissorTest(_scissorTest = boolean); }; - this.setOpaqueSort = function (method) { _opaqueSort = method; }; - this.setTransparentSort = function (method) { _transparentSort = method; - }; // Clearing + }; + // Clearing this.getClearColor = function (target) { return target.copy(background.getClearColor()); }; - this.setClearColor = function () { background.setClearColor.apply(background, arguments); }; - this.getClearAlpha = function () { return background.getClearAlpha(); }; - this.setClearAlpha = function () { background.setClearAlpha.apply(background, arguments); }; - this.clear = function (color, depth, stencil) { let bits = 0; if (color === undefined || color) bits |= _gl.COLOR_BUFFER_BIT; if (depth === undefined || depth) bits |= _gl.DEPTH_BUFFER_BIT; if (stencil === undefined || stencil) bits |= _gl.STENCIL_BUFFER_BIT; - _gl.clear(bits); }; - this.clearEncodingAware = function (color, depth, stencil) { const savedAutoClear = this.autoClear; const savedAutoClearColor = this.autoClearColor; @@ -19659,25 +17355,21 @@ function WebGLRenderer(parameters = {}) { this.autoClearDepth = savedAutoClearDepth; this.autoClearStencil = savedAutoClearStencil; }; - this.clearColor = function () { this.clear(true, false, false); }; - this.clearDepth = function () { this.clear(false, true, false); }; - this.clearStencil = function () { this.clear(false, false, true); - }; // Returns the actual encoding that should be used to read from or write to the map in shaders. + }; + + // Returns the actual encoding that should be used to read from or write to the map in shaders. // It can be different from map.encoding because usage of SRGB8_ALPHA8 textures. // This function's implementation should be kept in sync with WebGLTextures.getInternalFormat. - - this.getTextureEncodingFromMap = function (map) { let encoding; - if (map && map.isTexture) { encoding = map.encoding; } else if (map && map.isWebGLRenderTarget) { @@ -19686,24 +17378,20 @@ function WebGLRenderer(parameters = {}) { } else { encoding = LinearEncoding; } - if (capabilities.isWebGL2 && map && map.isTexture && map.format === RGBAFormat && map.type === UnsignedByteType && map.encoding === sRGBEncoding && !map.sRGBToLinearWithShader) { encoding = LinearEncoding; // disable inline decode for sRGB textures in WebGL 2 } - if (map && map.isCompressedTexture) { encoding = LinearEncoding; // disable inline decode for sRGB compressed textures } - return encoding; - }; // + }; + // this.dispose = function () { _canvas.removeEventListener('webglcontextlost', onContextLost, false); - _canvas.removeEventListener('webglcontextrestored', onContextRestore, false); - renderLists.dispose(); renderStates.dispose(); properties.dispose(); @@ -19715,26 +17403,22 @@ function WebGLRenderer(parameters = {}) { xr.dispose(); xr.removeEventListener('sessionstart', onXRSessionStart); xr.removeEventListener('sessionend', onXRSessionEnd); - if (_transmissionRenderTarget) { _transmissionRenderTarget.dispose(); - _transmissionRenderTarget = null; } - animation.stop(); - }; // Events + }; + // Events function onContextLost(event) { event.preventDefault(); console.log('THREE.WebGLRenderer: Context Lost.'); _isContextLost = true; } - - function - /* event */ - onContextRestore() { + function onContextRestore(/* event */ + ) { console.log('THREE.WebGLRenderer: Context Restored.'); _isContextLost = false; const infoAutoReset = info.autoReset; @@ -19749,68 +17433,69 @@ function WebGLRenderer(parameters = {}) { shadowMap.needsUpdate = shadowMapNeedsUpdate; shadowMap.type = shadowMapType; } - function onMaterialDispose(event) { const material = event.target; material.removeEventListener('dispose', onMaterialDispose); deallocateMaterial(material); - } // Buffer deallocation + } + // Buffer deallocation function deallocateMaterial(material) { releaseMaterialProgramReferences(material); properties.remove(material); } - function releaseMaterialProgramReferences(material) { const programs = properties.get(material).programs; - if (programs !== undefined) { programs.forEach(function (program) { programCache.releaseProgram(program); }); - if (material.isShaderMaterial) { programCache.releaseShaderCache(material); } } - } // Buffer rendering + } + // Buffer rendering this.renderBufferDirect = function (camera, scene, geometry, material, object, group) { if (scene === null) scene = _emptyScene; // renderBufferDirect second parameter used to be fog (could be null) const frontFaceCW = object.isMesh && object.matrixWorld.determinant() < 0; const program = setProgram(camera, scene, geometry, material, object); - state.setMaterial(material, frontFaceCW); // + state.setMaterial(material, frontFaceCW); + + // let index = geometry.index; - const position = geometry.attributes.position; // + const position = geometry.attributes.position; + + // if (index === null) { if (position === undefined || position.count === 0) return; } else if (index.count === 0) { return; - } // + } + // let rangeFactor = 1; - if (material.wireframe === true) { index = geometries.getWireframeAttribute(geometry); rangeFactor = 2; } - bindingStates.setup(object, material, program, geometry, index); let attribute; let renderer = bufferRenderer; - if (index !== null) { attribute = attributes.get(index); renderer = indexedBufferRenderer; renderer.setIndex(attribute); - } // + } + // const dataCount = index !== null ? index.count : position.count; const rangeStart = geometry.drawRange.start * rangeFactor; @@ -19820,7 +17505,9 @@ function WebGLRenderer(parameters = {}) { const drawStart = Math.max(rangeStart, groupStart); const drawEnd = Math.min(dataCount, rangeStart + rangeCount, groupStart + groupCount) - 1; const drawCount = Math.max(0, drawEnd - drawStart + 1); - if (drawCount === 0) return; // + if (drawCount === 0) return; + + // if (object.isMesh) { if (material.wireframe === true) { @@ -19834,7 +17521,6 @@ function WebGLRenderer(parameters = {}) { if (lineWidth === undefined) lineWidth = 1; // Not using Line*Material state.setLineWidth(lineWidth * getTargetPixelRatio()); - if (object.isLineSegments) { renderer.setMode(_gl.LINES); } else if (object.isLineLoop) { @@ -19844,14 +17530,12 @@ function WebGLRenderer(parameters = {}) { } } else if (object.isPoints) { renderer.setMode(_gl.POINTS); - if (material.isOFTPointSpriteMaterial) { material.uniforms.pointSize.value = material.pointSize * getTargetPixelRatio(); } } else if (object.isSprite) { renderer.setMode(_gl.TRIANGLES); } - if (object.isInstancedMesh) { renderer.renderInstances(drawStart, drawCount, object.count); } else if (geometry.isInstancedBufferGeometry) { @@ -19860,8 +17544,9 @@ function WebGLRenderer(parameters = {}) { } else { renderer.render(drawStart, drawCount); } - }; // Compile + }; + // Compile this.compile = function (scene, camera) { currentRenderState = renderStates.get(scene); @@ -19870,7 +17555,6 @@ function WebGLRenderer(parameters = {}) { scene.traverseVisible(function (object) { if (object.isLight && object.layers.test(camera.layers)) { currentRenderState.pushLight(object); - if (object.castShadow) { currentRenderState.pushShadow(object); } @@ -19879,7 +17563,6 @@ function WebGLRenderer(parameters = {}) { currentRenderState.setupLights(_this.physicallyCorrectLights); scene.traverse(function (object) { const material = object.material; - if (material) { if (Array.isArray(material)) { for (let i = 0; i < material.length; i++) { @@ -19893,63 +17576,59 @@ function WebGLRenderer(parameters = {}) { }); renderStateStack.pop(); currentRenderState = null; - }; // Animation Loop + }; + // Animation Loop let onAnimationFrameCallback = null; - function onAnimationFrame(time) { if (onAnimationFrameCallback) onAnimationFrameCallback(time); } - function onXRSessionStart() { animation.stop(); } - function onXRSessionEnd() { animation.start(); } - const animation = new WebGLAnimation(); animation.setAnimationLoop(onAnimationFrame); animation.setContext(platform.animationContext); - this.setAnimationLoop = function (callback) { onAnimationFrameCallback = callback; xr.setAnimationLoop(callback); callback === null ? animation.stop() : animation.start(); }; - xr.addEventListener('sessionstart', onXRSessionStart); - xr.addEventListener('sessionend', onXRSessionEnd); // Rendering + xr.addEventListener('sessionend', onXRSessionEnd); + + // Rendering this.render = function (scene, camera) { if (camera !== undefined && camera.isCamera !== true) { console.error('THREE.WebGLRenderer.render: camera is not an instance of THREE.Camera.'); return; } + if (_isContextLost === true) return; - if (_isContextLost === true) return; // update scene graph + // update scene graph - if (scene.autoUpdate === true) scene.updateMatrixWorld(); // update camera matrices and frustum + if (scene.autoUpdate === true) scene.updateMatrixWorld(); - if (camera.parent === null) camera.updateMatrixWorld(); + // update camera matrices and frustum + if (camera.parent === null) camera.updateMatrixWorld(); if (xr.enabled === true && xr.isPresenting === true) { if (xr.cameraAutoUpdate === true) xr.updateCamera(camera); camera = xr.getCamera(); // use XR camera for rendering - } // - + } + // if (scene.isScene === true) scene.onBeforeRender(_this, scene, camera, _currentRenderTarget); currentRenderState = renderStates.get(scene, renderStateStack.length); currentRenderState.init(); renderStateStack.push(currentRenderState); - _projScreenMatrix.multiplyMatrices(camera.projectionMatrix, camera.matrixWorldInverse); - _frustum.setFromProjectionMatrix(_projScreenMatrix); - _localClippingEnabled = this.localClippingEnabled; _clippingEnabled = clipping.init(this.clippingPlanes, _localClippingEnabled, camera); currentRenderList = renderLists.get(scene, renderListStack.length); @@ -19957,74 +17636,82 @@ function WebGLRenderer(parameters = {}) { renderListStack.push(currentRenderList); projectObject(scene, camera, 0, _this.sortObjects); currentRenderList.finish(); - if (_this.sortObjects === true) { currentRenderList.sort(_opaqueSort, _transparentSort); - } // + } + // if (_clippingEnabled === true) clipping.beginShadows(); const shadowsArray = currentRenderState.state.shadowsArray; shadowMap.render(shadowsArray, scene, camera); - if (_clippingEnabled === true) clipping.endShadows(); // + if (_clippingEnabled === true) clipping.endShadows(); - if (this.info.autoReset === true) this.info.reset(); // + // - background.render(currentRenderList, scene, _currentRenderTarget); // render scene + if (this.info.autoReset === true) this.info.reset(); - currentRenderState.setupLights(_this.physicallyCorrectLights); + // + background.render(currentRenderList, scene, _currentRenderTarget); + + // render scene + + currentRenderState.setupLights(_this.physicallyCorrectLights); if (camera.isArrayCamera) { const cameras = camera.cameras; - for (let i = 0, l = cameras.length; i < l; i++) { const camera2 = cameras[i]; renderScene(currentRenderList, scene, camera2, camera2.viewport); } } else { renderScene(currentRenderList, scene, camera); - } // + } + // if (_currentRenderTarget !== null) { // resolve multisample renderbuffers to a single-sample texture if necessary - textures.updateMultisampleRenderTarget(_currentRenderTarget); // Generate mipmap if we're using any kind of mipmap filtering + + textures.updateMultisampleRenderTarget(_currentRenderTarget); + + // Generate mipmap if we're using any kind of mipmap filtering textures.updateRenderTargetMipmap(_currentRenderTarget); - } // + } + + // + if (scene.isScene === true) scene.onAfterRender(_this, scene, camera); - if (scene.isScene === true) scene.onAfterRender(_this, scene, camera); // Ensure depth buffer writing is enabled so it can be cleared on next render + // Ensure depth buffer writing is enabled so it can be cleared on next render state.buffers.depth.setTest(true); state.buffers.depth.setMask(true); state.buffers.color.setMask(true); - state.setPolygonOffset(false); // _gl.finish(); + state.setPolygonOffset(false); + + // _gl.finish(); bindingStates.resetDefaultState(); _currentMaterialId = -1; _currentCamera = null; renderStateStack.pop(); - if (renderStateStack.length > 0) { currentRenderState = renderStateStack[renderStateStack.length - 1]; } else { currentRenderState = null; } - renderListStack.pop(); - if (renderListStack.length > 0) { currentRenderList = renderListStack[renderListStack.length - 1]; } else { currentRenderList = null; } }; - function projectObject(object, camera, groupOrder, sortObjects) { if (object.visible === false) return; const visible = object.layers.test(camera.layers); - if (visible) { if (object.isGroup) { groupOrder = object.renderOrder; @@ -20032,7 +17719,6 @@ function WebGLRenderer(parameters = {}) { if (object.autoUpdate === true) object.update(camera); } else if (object.isLight) { currentRenderState.pushLight(object); - if (object.castShadow) { currentRenderState.pushShadow(object); } @@ -20041,10 +17727,8 @@ function WebGLRenderer(parameters = {}) { if (sortObjects) { _vector3.setFromMatrixPosition(object.matrixWorld).applyMatrix4(_projScreenMatrix); } - const geometry = objects.update(object); const material = object.material; - if (material.visible) { currentRenderList.push(object, geometry, material, groupOrder, _vector3.z, null); } @@ -20052,27 +17736,23 @@ function WebGLRenderer(parameters = {}) { } else if (object.isMesh || object.isLine || object.isPoints) { if (object.isSkinnedMesh) { // update skeleton only once in a frame + if (object.skeleton.frame !== info.render.frame) { object.skeleton.update(); object.skeleton.frame = info.render.frame; } } - if (!object.frustumCulled || _frustum.intersectsObject(object)) { if (sortObjects) { _vector3.setFromMatrixPosition(object.matrixWorld).applyMatrix4(_projScreenMatrix); } - const geometry = objects.update(object); const material = object.material; - if (Array.isArray(material)) { const groups = geometry.groups; - for (let i = 0, l = groups.length; i < l; i++) { const group = groups[i]; const groupMaterial = material[group.materialIndex]; - if (groupMaterial && groupMaterial.visible) { currentRenderList.push(object, geometry, groupMaterial, groupOrder, _vector3.z, group); } @@ -20083,14 +17763,11 @@ function WebGLRenderer(parameters = {}) { } } } - const children = object.children; - for (let i = 0, l = children.length; i < l; i++) { projectObject(children[i], camera, groupOrder, sortObjects); } } - function renderScene(currentRenderList, scene, camera, viewport) { const opaqueObjects = currentRenderList.opaque; const transmissiveObjects = currentRenderList.transmissive; @@ -20102,7 +17779,6 @@ function WebGLRenderer(parameters = {}) { if (transmissiveObjects.length > 0) renderObjects(transmissiveObjects, scene, camera); if (transparentObjects.length > 0) renderObjects(transparentObjects, scene, camera); } - function renderTransmissionPass(opaqueObjects, scene, camera) { if (_transmissionRenderTarget === null) { const needsAntialias = _antialias === true && capabilities.isWebGL2 === true; @@ -20114,70 +17790,53 @@ function WebGLRenderer(parameters = {}) { samples: needsAntialias ? 4 : 0 }); } - _this.getDrawingBufferSize(_vector2); - _transmissionRenderTarget.setSize(_vector2.x, _vector2.y); - const currentRenderTarget = _this.getRenderTarget(); - _this.setRenderTarget(_transmissionRenderTarget); + _this.clear(); - _this.clear(); // Turn off the features which can affect the frag color for opaque objects pass. + // Turn off the features which can affect the frag color for opaque objects pass. // Otherwise they are applied twice in opaque objects pass and transmission objects pass. - - const currentToneMapping = _this.toneMapping; _this.toneMapping = NoToneMapping; renderObjects(opaqueObjects, scene, camera); _this.toneMapping = currentToneMapping; textures.updateMultisampleRenderTarget(_transmissionRenderTarget); textures.updateRenderTargetMipmap(_transmissionRenderTarget); - _this.setRenderTarget(currentRenderTarget); } - function renderObjects(renderList, scene, camera) { const overrideMaterial = scene.isScene === true ? scene.overrideMaterial : null; - for (let i = 0, l = renderList.length; i < l; i++) { const renderItem = renderList[i]; const object = renderItem.object; const geometry = renderItem.geometry; const material = overrideMaterial === null ? renderItem.material : overrideMaterial; const group = renderItem.group; - if (object.layers.test(camera.layers)) { renderObject(object, scene, camera, geometry, material, group); } } } - function renderObject(object, scene, camera, geometry, material, group) { object.onBeforeRender(_this, scene, camera, geometry, material, group); object.modelViewMatrix.multiplyMatrices(camera.matrixWorldInverse, object.matrixWorld); object.normalMatrix.getNormalMatrix(object.modelViewMatrix); material.onBeforeRender(_this, scene, camera, geometry, object, group); - if (material.transparent === true && material.side === DoubleSide) { material.side = BackSide; material.needsUpdate = true; - _this.renderBufferDirect(camera, scene, geometry, material, object, group); - material.side = FrontSide; material.needsUpdate = true; - _this.renderBufferDirect(camera, scene, geometry, material, object, group); - material.side = DoubleSide; } else { _this.renderBufferDirect(camera, scene, geometry, material, object, group); } - object.onAfterRender(_this, scene, camera, geometry, material, group); } - function getProgram(material, scene, object) { if (scene.isScene !== true) scene = _emptyScene; // scene could be a Mesh, Line, Points, ... @@ -20187,23 +17846,24 @@ function WebGLRenderer(parameters = {}) { const lightsStateVersion = lights.state.version; const parameters = programCache.getParameters(material, lights.state, shadowsArray, scene, object); const programCacheKey = programCache.getProgramCacheKey(parameters); - let programs = materialProperties.programs; // always update environment and fog - changing these trigger an getProgram call, but it's possible that the program doesn't change + let programs = materialProperties.programs; + + // always update environment and fog - changing these trigger an getProgram call, but it's possible that the program doesn't change materialProperties.environment = material.isMeshStandardMaterial ? scene.environment : null; materialProperties.fog = scene.fog; materialProperties.envMap = (material.isMeshStandardMaterial ? cubeuvmaps : cubemaps).get(material.envMap || materialProperties.environment); - if (programs === undefined) { // new material + material.addEventListener('dispose', onMaterialDispose); programs = new Map(); materialProperties.programs = programs; } - let program = programs.get(programCacheKey); - if (program !== undefined) { // early out if program and light state is identical + if (materialProperties.currentProgram === program && materialProperties.lightsStateVersion === lightsStateVersion) { updateCommonMaterialProperties(material, parameters); return program; @@ -20216,20 +17876,19 @@ function WebGLRenderer(parameters = {}) { programs.set(programCacheKey, program); materialProperties.uniforms = parameters.uniforms; } - const uniforms = materialProperties.uniforms; - if (!material.isShaderMaterial && !material.isRawShaderMaterial || material.clipping === true) { uniforms.clippingPlanes = clipping.uniform; } + updateCommonMaterialProperties(material, parameters); - updateCommonMaterialProperties(material, parameters); // store the light setup it was created for + // store the light setup it was created for materialProperties.needsLights = materialNeedsLights(material); materialProperties.lightsStateVersion = lightsStateVersion; - if (materialProperties.needsLights) { // wire up the material to this renderer's lighting state + uniforms.ambientLightColor.value = lights.state.ambient; uniforms.lightProbe.value = lights.state.probe; uniforms.directionalLights.value = lights.state.directional; @@ -20247,16 +17906,15 @@ function WebGLRenderer(parameters = {}) { uniforms.spotShadowMap.value = lights.state.spotShadowMap; uniforms.spotShadowMatrix.value = lights.state.spotShadowMatrix; uniforms.pointShadowMap.value = lights.state.pointShadowMap; - uniforms.pointShadowMatrix.value = lights.state.pointShadowMatrix; // TODO (abelnation): add area lights shadow info to uniforms + uniforms.pointShadowMatrix.value = lights.state.pointShadowMatrix; + // TODO (abelnation): add area lights shadow info to uniforms } - const progUniforms = program.getUniforms(); const uniformsList = WebGLUniforms.seqWithValue(progUniforms.seq, uniforms); materialProperties.currentProgram = program; materialProperties.uniformsList = uniformsList; return program; } - function updateCommonMaterialProperties(material, parameters) { const materialProperties = properties.get(material); materialProperties.outputEncoding = parameters.outputEncoding; @@ -20270,7 +17928,6 @@ function WebGLRenderer(parameters = {}) { materialProperties.vertexAlphas = parameters.vertexAlphas; materialProperties.vertexTangents = parameters.vertexTangents; } - function setProgram(camera, scene, geometry, material, object) { if (scene.isScene !== true) scene = _emptyScene; // scene could be a Mesh, Line, Points, ... @@ -20286,20 +17943,20 @@ function WebGLRenderer(parameters = {}) { const morphTargetsCount = !!geometry.morphAttributes.position ? geometry.morphAttributes.position.length : 0; const materialProperties = properties.get(material); const lights = currentRenderState.state.lights; - if (_clippingEnabled === true) { if (_localClippingEnabled === true || camera !== _currentCamera) { - const useCache = camera === _currentCamera && material.id === _currentMaterialId; // we might want to call this function with some ClippingGroup + const useCache = camera === _currentCamera && material.id === _currentMaterialId; + + // we might want to call this function with some ClippingGroup // object instead of the material, once it becomes feasible // (#8465, #8379) - clipping.setState(material, camera, useCache); } - } // + } + // let needsProgramChange = false; - if (material.version === materialProperties.__version) { if (materialProperties.needsLights && materialProperties.lightsStateVersion !== lights.state.version) { needsProgramChange = true; @@ -20333,76 +17990,69 @@ function WebGLRenderer(parameters = {}) { } else { needsProgramChange = true; materialProperties.__version = material.version; - } // + } + // let program = materialProperties.currentProgram; - if (needsProgramChange === true) { program = getProgram(material, scene, object); } - let refreshProgram = false; let refreshMaterial = false; let refreshLights = false; const p_uniforms = program.getUniforms(), - m_uniforms = materialProperties.uniforms; - + m_uniforms = materialProperties.uniforms; if (state.useProgram(program.program)) { refreshProgram = true; refreshMaterial = true; refreshLights = true; } - if (material.id !== _currentMaterialId) { _currentMaterialId = material.id; refreshMaterial = true; } - if (refreshProgram || _currentCamera !== camera) { p_uniforms.setValue(_gl, 'projectionMatrix', camera.projectionMatrix); - if (capabilities.logarithmicDepthBuffer) { p_uniforms.setValue(_gl, 'logDepthBufFC', 2.0 / (Math.log(camera.far + 1.0) / Math.LN2)); } - if (_currentCamera !== camera) { - _currentCamera = camera; // lighting uniforms depend on the camera so enforce an update + _currentCamera = camera; + + // lighting uniforms depend on the camera so enforce an update // now, in case this material supports lights - or later, when // the next material that does gets activated: refreshMaterial = true; // set to true on material change - refreshLights = true; // remains set until update done - } // load material specific uniforms - // (shader material also gets them for the sake of genericity) + } + // load material specific uniforms + // (shader material also gets them for the sake of genericity) if (material.isShaderMaterial || material.isMeshPhongMaterial || material.isMeshToonMaterial || material.isMeshStandardMaterial || material.envMap) { const uCamPos = p_uniforms.map.cameraPosition; - if (uCamPos !== undefined) { uCamPos.setValue(_gl, _vector3.setFromMatrixPosition(camera.matrixWorld)); } } - if (material.isMeshPhongMaterial || material.isMeshToonMaterial || material.isMeshLambertMaterial || material.isMeshBasicMaterial || material.isMeshStandardMaterial || material.isShaderMaterial) { p_uniforms.setValue(_gl, 'isOrthographic', camera.isOrthographicCamera === true); } - if (material.isMeshPhongMaterial || material.isMeshToonMaterial || material.isMeshLambertMaterial || material.isMeshBasicMaterial || material.isMeshStandardMaterial || material.isShaderMaterial || material.isShadowMaterial || object.isSkinnedMesh) { p_uniforms.setValue(_gl, 'viewMatrix', camera.matrixWorldInverse); } - } // skinning and morph target uniforms must be set even if material didn't change + } + + // skinning and morph target uniforms must be set even if material didn't change // auto-setting of texture unit for bone and morph texture must go before other textures // otherwise textures used for skinning and morphing can take over texture units reserved for other material textures - if (object.isSkinnedMesh) { p_uniforms.setOptional(_gl, object, 'bindMatrix'); p_uniforms.setOptional(_gl, object, 'bindMatrixInverse'); const skeleton = object.skeleton; - if (skeleton) { if (capabilities.floatVertexTextures) { if (skeleton.boneTexture === null) skeleton.computeBoneTexture(); @@ -20413,55 +18063,53 @@ function WebGLRenderer(parameters = {}) { } } } - if (!!geometry && (geometry.morphAttributes.position !== undefined || geometry.morphAttributes.normal !== undefined)) { morphtargets.update(object, geometry, material, program); } - if (refreshMaterial || materialProperties.receiveShadow !== object.receiveShadow) { materialProperties.receiveShadow = object.receiveShadow; p_uniforms.setValue(_gl, 'receiveShadow', object.receiveShadow); } - if (refreshMaterial) { p_uniforms.setValue(_gl, 'toneMappingExposure', _this.toneMappingExposure); - if (materialProperties.needsLights) { // the current material requires lighting info + // note: all lighting uniforms are always set correctly // they simply reference the renderer's state for their // values // // use the current material's .needsUpdate flags to set // the GL state when required + markUniformsLightsNeedsUpdate(m_uniforms, refreshLights); - } // refresh uniforms common to several materials + } + // refresh uniforms common to several materials if (fog && material.fog) { materials.refreshFogUniforms(m_uniforms, fog); } - materials.refreshMaterialUniforms(m_uniforms, material, _pixelRatio, _height, _transmissionRenderTarget); WebGLUniforms.upload(_gl, materialProperties.uniformsList, m_uniforms, textures); } - if (material.isShaderMaterial && material.uniformsNeedUpdate === true) { WebGLUniforms.upload(_gl, materialProperties.uniformsList, m_uniforms, textures); material.uniformsNeedUpdate = false; } - if (material.isSpriteMaterial) { p_uniforms.setValue(_gl, 'center', object.center); - } // common matrices + } + // common matrices p_uniforms.setValue(_gl, 'modelViewMatrix', object.modelViewMatrix); p_uniforms.setValue(_gl, 'normalMatrix', object.normalMatrix); p_uniforms.setValue(_gl, 'modelMatrix', object.matrixWorld); return program; - } // If uniforms are marked as clean, they don't need to be loaded to the GPU. + } + // If uniforms are marked as clean, they don't need to be loaded to the GPU. function markUniformsLightsNeedsUpdate(uniforms, value) { uniforms.ambientLightColor.needsUpdate = value; @@ -20475,32 +18123,25 @@ function WebGLRenderer(parameters = {}) { uniforms.rectAreaLights.needsUpdate = value; uniforms.hemisphereLights.needsUpdate = value; } - function materialNeedsLights(material) { return material.isMeshLambertMaterial || material.isMeshToonMaterial || material.isMeshPhongMaterial || material.isMeshStandardMaterial || material.isShadowMaterial || material.isShaderMaterial && material.lights === true; } - this.getActiveCubeFace = function () { return _currentActiveCubeFace; }; - this.getActiveMipmapLevel = function () { return _currentActiveMipmapLevel; }; - this.getRenderTarget = function () { return _currentRenderTarget; }; - this.setRenderTargetTextures = function (renderTarget, colorTexture, depthTexture) { properties.get(renderTarget.texture).__webglTexture = colorTexture; properties.get(renderTarget.depthTexture).__webglTexture = depthTexture; const renderTargetProperties = properties.get(renderTarget); renderTargetProperties.__hasExternalTextures = true; - if (renderTargetProperties.__hasExternalTextures) { renderTargetProperties.__autoAllocateDepthBuffer = depthTexture === undefined; - if (!renderTargetProperties.__autoAllocateDepthBuffer) { // The multisample_render_to_texture extension doesn't work properly if there // are midframe flushes and an external depth buffer. Disable use of the extension. @@ -20511,22 +18152,18 @@ function WebGLRenderer(parameters = {}) { } } }; - this.setRenderTargetFramebuffer = function (renderTarget, defaultFramebuffer) { const renderTargetProperties = properties.get(renderTarget); renderTargetProperties.__webglFramebuffer = defaultFramebuffer; renderTargetProperties.__useDefaultFramebuffer = defaultFramebuffer === undefined; }; - this.setRenderTarget = function (renderTarget, activeCubeFace = 0, activeMipmapLevel = 0) { _currentRenderTarget = renderTarget; _currentActiveCubeFace = activeCubeFace; _currentActiveMipmapLevel = activeMipmapLevel; let useDefaultFramebuffer = true; - if (renderTarget) { const renderTargetProperties = properties.get(renderTarget); - if (renderTargetProperties.__useDefaultFramebuffer !== undefined) { // We need to make sure to rebind the framebuffer. state.bindFramebuffer(_gl.FRAMEBUFFER, null); @@ -20538,20 +18175,15 @@ function WebGLRenderer(parameters = {}) { textures.rebindTextures(renderTarget, properties.get(renderTarget.texture).__webglTexture, properties.get(renderTarget.depthTexture).__webglTexture); } } - let framebuffer = null; let isCube = false; let isRenderTarget3D = false; - if (renderTarget) { const texture = renderTarget.texture; - if (texture.isDataTexture3D || texture.isDataTexture2DArray) { isRenderTarget3D = true; } - const __webglFramebuffer = properties.get(renderTarget).__webglFramebuffer; - if (renderTarget.isWebGLCubeRenderTarget) { framebuffer = __webglFramebuffer[activeCubeFace]; isCube = true; @@ -20560,80 +18192,62 @@ function WebGLRenderer(parameters = {}) { } else { framebuffer = __webglFramebuffer; } - _currentViewport.copy(renderTarget.viewport); - _currentScissor.copy(renderTarget.scissor); - _currentScissorTest = renderTarget.scissorTest; } else { _currentViewport.copy(_viewport).multiplyScalar(_pixelRatio).floor(); - _currentScissor.copy(_scissor).multiplyScalar(_pixelRatio).floor(); - _currentScissorTest = _scissorTest; } - const framebufferBound = state.bindFramebuffer(_gl.FRAMEBUFFER, framebuffer); - if (framebufferBound && capabilities.drawBuffers && useDefaultFramebuffer) { state.drawBuffers(renderTarget, framebuffer); } - state.viewport(_currentViewport); state.scissor(_currentScissor); state.setScissorTest(_currentScissorTest); - if (isCube) { const textureProperties = properties.get(renderTarget.texture); - _gl.framebufferTexture2D(_gl.FRAMEBUFFER, _gl.COLOR_ATTACHMENT0, _gl.TEXTURE_CUBE_MAP_POSITIVE_X + activeCubeFace, textureProperties.__webglTexture, activeMipmapLevel); } else if (isRenderTarget3D) { const textureProperties = properties.get(renderTarget.texture); const layer = activeCubeFace || 0; - _gl.framebufferTextureLayer(_gl.FRAMEBUFFER, _gl.COLOR_ATTACHMENT0, textureProperties.__webglTexture, activeMipmapLevel || 0, layer); } - _currentMaterialId = -1; // reset current material to ensure correct uniform bindings }; - this.readRenderTargetPixels = function (renderTarget, x, y, width, height, buffer, activeCubeFaceIndex) { if (!(renderTarget && renderTarget.isWebGLRenderTarget)) { console.error('THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.'); return; } - let framebuffer = properties.get(renderTarget).__webglFramebuffer; - if (renderTarget.isWebGLCubeRenderTarget && activeCubeFaceIndex !== undefined) { framebuffer = framebuffer[activeCubeFaceIndex]; } - if (framebuffer) { state.bindFramebuffer(_gl.FRAMEBUFFER, framebuffer); - try { const texture = renderTarget.texture; const textureFormat = texture.format; const textureType = texture.type; - if (textureFormat !== RGBAFormat && utils.convert(textureFormat) !== _gl.getParameter(_gl.IMPLEMENTATION_COLOR_READ_FORMAT)) { console.error('THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in RGBA or implementation defined format.'); return; } - const halfFloatSupportedByExt = textureType === HalfFloatType && (extensions.has('EXT_color_buffer_half_float') || capabilities.isWebGL2 && extensions.has('EXT_color_buffer_float')); - - if (textureType !== UnsignedByteType && utils.convert(textureType) !== _gl.getParameter(_gl.IMPLEMENTATION_COLOR_READ_TYPE) && // Edge and Chrome Mac < 52 (#9513) - !(textureType === FloatType && (capabilities.isWebGL2 || extensions.has('OES_texture_float') || extensions.has('WEBGL_color_buffer_float'))) && // Chrome Mac >= 52 and Firefox + if (textureType !== UnsignedByteType && utils.convert(textureType) !== _gl.getParameter(_gl.IMPLEMENTATION_COLOR_READ_TYPE) && + // Edge and Chrome Mac < 52 (#9513) + !(textureType === FloatType && (capabilities.isWebGL2 || extensions.has('OES_texture_float') || extensions.has('WEBGL_color_buffer_float'))) && + // Chrome Mac >= 52 and Firefox !halfFloatSupportedByExt) { console.error('THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in UnsignedByteType or implementation defined type.'); return; } - if (_gl.checkFramebufferStatus(_gl.FRAMEBUFFER) === _gl.FRAMEBUFFER_COMPLETE) { // the following if statement ensures valid read requests (no out-of-bounds pixels, see #8604) + if (x >= 0 && x <= renderTarget.width - width && y >= 0 && y <= renderTarget.height - height) { _gl.readPixels(x, y, width, height, utils.convert(textureFormat), utils.convert(textureType), buffer); } @@ -20642,37 +18256,32 @@ function WebGLRenderer(parameters = {}) { } } finally { // restore framebuffer of current render target if necessary + const framebuffer = _currentRenderTarget !== null ? properties.get(_currentRenderTarget).__webglFramebuffer : null; state.bindFramebuffer(_gl.FRAMEBUFFER, framebuffer); } } }; - this.copyFramebufferToTexture = function (position, texture, level = 0) { const levelScale = Math.pow(2, -level); const width = Math.floor(texture.image.width * levelScale); const height = Math.floor(texture.image.height * levelScale); textures.setTexture2D(texture, 0); - _gl.copyTexSubImage2D(_gl.TEXTURE_2D, level, 0, 0, position.x, position.y, width, height); - state.unbindTexture(); }; - this.copyTextureToTexture = function (position, srcTexture, dstTexture, level = 0) { const width = srcTexture.image.width; const height = srcTexture.image.height; const glFormat = utils.convert(dstTexture.format); const glType = utils.convert(dstTexture.type); - textures.setTexture2D(dstTexture, 0); // As another texture upload may have changed pixelStorei - // parameters, make sure they are correct for the dstTexture + textures.setTexture2D(dstTexture, 0); + // As another texture upload may have changed pixelStorei + // parameters, make sure they are correct for the dstTexture _gl.pixelStorei(_gl.UNPACK_FLIP_Y_WEBGL, dstTexture.flipY); - _gl.pixelStorei(_gl.UNPACK_PREMULTIPLY_ALPHA_WEBGL, dstTexture.premultiplyAlpha); - _gl.pixelStorei(_gl.UNPACK_ALIGNMENT, dstTexture.unpackAlignment); - if (srcTexture.isDataTexture) { _gl.texSubImage2D(_gl.TEXTURE_2D, level, position.x, position.y, width, height, glFormat, glType, srcTexture.image.data); } else { @@ -20681,26 +18290,23 @@ function WebGLRenderer(parameters = {}) { } else { _gl.texSubImage2D(_gl.TEXTURE_2D, level, position.x, position.y, glFormat, glType, srcTexture.image); } - } // Generate mipmaps only when copying level 0 - + } + // Generate mipmaps only when copying level 0 if (level === 0 && dstTexture.generateMipmaps) _gl.generateMipmap(_gl.TEXTURE_2D); state.unbindTexture(); }; - this.copyTextureToTexture3D = function (sourceBox, position, srcTexture, dstTexture, level = 0) { if (_this.isWebGL1Renderer) { console.warn('THREE.WebGLRenderer.copyTextureToTexture3D: can only be used with WebGL2.'); return; } - const width = sourceBox.max.x - sourceBox.min.x + 1; const height = sourceBox.max.y - sourceBox.min.y + 1; const depth = sourceBox.max.z - sourceBox.min.z + 1; const glFormat = utils.convert(dstTexture.format); const glType = utils.convert(dstTexture.type); let glTarget; - if (dstTexture.isDataTexture3D) { textures.setTexture3D(dstTexture, 0); glTarget = _gl.TEXTURE_3D; @@ -20711,67 +18317,44 @@ function WebGLRenderer(parameters = {}) { console.warn('THREE.WebGLRenderer.copyTextureToTexture3D: only supports THREE.DataTexture3D and THREE.DataTexture2DArray.'); return; } - _gl.pixelStorei(_gl.UNPACK_FLIP_Y_WEBGL, dstTexture.flipY); - _gl.pixelStorei(_gl.UNPACK_PREMULTIPLY_ALPHA_WEBGL, dstTexture.premultiplyAlpha); - _gl.pixelStorei(_gl.UNPACK_ALIGNMENT, dstTexture.unpackAlignment); - const unpackRowLen = _gl.getParameter(_gl.UNPACK_ROW_LENGTH); - const unpackImageHeight = _gl.getParameter(_gl.UNPACK_IMAGE_HEIGHT); - const unpackSkipPixels = _gl.getParameter(_gl.UNPACK_SKIP_PIXELS); - const unpackSkipRows = _gl.getParameter(_gl.UNPACK_SKIP_ROWS); - const unpackSkipImages = _gl.getParameter(_gl.UNPACK_SKIP_IMAGES); - const image = srcTexture.isCompressedTexture ? srcTexture.mipmaps[0] : srcTexture.image; - _gl.pixelStorei(_gl.UNPACK_ROW_LENGTH, image.width); - _gl.pixelStorei(_gl.UNPACK_IMAGE_HEIGHT, image.height); - _gl.pixelStorei(_gl.UNPACK_SKIP_PIXELS, sourceBox.min.x); - _gl.pixelStorei(_gl.UNPACK_SKIP_ROWS, sourceBox.min.y); - _gl.pixelStorei(_gl.UNPACK_SKIP_IMAGES, sourceBox.min.z); - if (srcTexture.isDataTexture || srcTexture.isDataTexture3D) { _gl.texSubImage3D(glTarget, level, position.x, position.y, position.z, width, height, depth, glFormat, glType, image.data); } else { if (srcTexture.isCompressedTexture) { console.warn('THREE.WebGLRenderer.copyTextureToTexture3D: untested support for compressed srcTexture.'); - _gl.compressedTexSubImage3D(glTarget, level, position.x, position.y, position.z, width, height, depth, glFormat, image.data); } else { _gl.texSubImage3D(glTarget, level, position.x, position.y, position.z, width, height, depth, glFormat, glType, image); } } - _gl.pixelStorei(_gl.UNPACK_ROW_LENGTH, unpackRowLen); - _gl.pixelStorei(_gl.UNPACK_IMAGE_HEIGHT, unpackImageHeight); - _gl.pixelStorei(_gl.UNPACK_SKIP_PIXELS, unpackSkipPixels); - _gl.pixelStorei(_gl.UNPACK_SKIP_ROWS, unpackSkipRows); + _gl.pixelStorei(_gl.UNPACK_SKIP_IMAGES, unpackSkipImages); - _gl.pixelStorei(_gl.UNPACK_SKIP_IMAGES, unpackSkipImages); // Generate mipmaps only when copying level 0 - - + // Generate mipmaps only when copying level 0 if (level === 0 && dstTexture.generateMipmaps) _gl.generateMipmap(glTarget); state.unbindTexture(); }; - this.initTexture = function (texture) { textures.setTexture2D(texture, 0); state.unbindTexture(); }; - this.resetState = function () { _currentActiveCubeFace = 0; _currentActiveMipmapLevel = 0; @@ -20779,18 +18362,15 @@ function WebGLRenderer(parameters = {}) { state.reset(); bindingStates.reset(); }; - if (typeof __THREE_DEVTOOLS__ !== 'undefined') { __THREE_DEVTOOLS__.dispatchEvent(new CustomEvent('observe', { detail: this })); } } - WebGLRenderer.prototype.isWebGLRenderer = true; class WebGL1Renderer extends WebGLRenderer {} - WebGL1Renderer.prototype.isWebGL1Renderer = true; class FogExp2 { @@ -20799,21 +18379,18 @@ class FogExp2 { this.color = new Color(color); this.density = density; } - clone() { return new FogExp2(this.color, this.density); } - - toJSON() { + toJSON(/* meta */ + ) { return { type: 'FogExp2', color: this.color.getHex(), density: this.density }; } - } - FogExp2.prototype.isFogExp2 = true; class Fog { @@ -20823,12 +18400,11 @@ class Fog { this.near = near; this.far = far; } - clone() { return new Fog(this.color, this.near, this.far); } - - toJSON() { + toJSON(/* meta */ + ) { return { type: 'Fog', color: this.color.getHex(), @@ -20836,9 +18412,7 @@ class Fog { far: this.far }; } - } - Fog.prototype.isFog = true; class Scene extends Object3D { @@ -20858,7 +18432,6 @@ class Scene extends Object3D { })); } } - copy(source, recursive) { super.copy(source, recursive); this.bgToneMapped = source.bgToneMapped; @@ -20870,16 +18443,13 @@ class Scene extends Object3D { this.matrixAutoUpdate = source.matrixAutoUpdate; return this; } - toJSON(meta) { const data = super.toJSON(meta); if (this.fog !== null) data.object.fog = this.fog.toJSON(); data.object.bgToneMapped = this.bgToneMapped.toJSON(); return data; } - } - Scene.prototype.isScene = true; class InterleavedBuffer { @@ -20895,18 +18465,14 @@ class InterleavedBuffer { this.version = 0; this.uuid = generateUUID(); } - onUploadCallback() {} - set needsUpdate(value) { if (value === true) this.version++; } - setUsage(value) { this.usage = value; return this; } - copy(source) { this.array = new source.array.constructor(source.array); this.count = source.count; @@ -20914,61 +18480,52 @@ class InterleavedBuffer { this.usage = source.usage; return this; } - copyAt(index1, attribute, index2) { index1 *= this.stride; index2 *= attribute.stride; - for (let i = 0, l = this.stride; i < l; i++) { this.array[index1 + i] = attribute.array[index2 + i]; } - return this; } - set(value, offset = 0) { this.array.set(value, offset); return this; } - clone(data) { if (data.arrayBuffers === undefined) { data.arrayBuffers = {}; } - if (this.array.buffer._uuid === undefined) { this.array.buffer._uuid = generateUUID(); } - if (data.arrayBuffers[this.array.buffer._uuid] === undefined) { data.arrayBuffers[this.array.buffer._uuid] = this.array.slice(0).buffer; } - const array = new this.array.constructor(data.arrayBuffers[this.array.buffer._uuid]); const ib = new this.constructor(array, this.stride); ib.setUsage(this.usage); return ib; } - onUpload(callback) { this.onUploadCallback = callback; return this; } - toJSON(data) { if (data.arrayBuffers === undefined) { data.arrayBuffers = {}; - } // generate UUID for array buffer if necessary + } + // generate UUID for array buffer if necessary if (this.array.buffer._uuid === undefined) { this.array.buffer._uuid = generateUUID(); } - if (data.arrayBuffers[this.array.buffer._uuid] === undefined) { data.arrayBuffers[this.array.buffer._uuid] = Array.prototype.slice.call(new Uint32Array(this.array.buffer)); - } // + } + // return { uuid: this.uuid, @@ -20977,13 +18534,10 @@ class InterleavedBuffer { stride: this.stride }; } - } - InterleavedBuffer.prototype.isInterleavedBuffer = true; const _vector$6 = /*@__PURE__*/new Vector3(); - class InterleavedBufferAttribute { constructor(interleavedBuffer, itemSize, offset, normalized = false) { this.name = ''; @@ -20992,104 +18546,79 @@ class InterleavedBufferAttribute { this.offset = offset; this.normalized = normalized === true; } - get count() { return this.data.count; } - get array() { return this.data.array; } - set needsUpdate(value) { this.data.needsUpdate = value; } - applyMatrix4(m) { for (let i = 0, l = this.data.count; i < l; i++) { _vector$6.x = this.getX(i); _vector$6.y = this.getY(i); _vector$6.z = this.getZ(i); - _vector$6.applyMatrix4(m); - this.setXYZ(i, _vector$6.x, _vector$6.y, _vector$6.z); } - return this; } - applyNormalMatrix(m) { for (let i = 0, l = this.count; i < l; i++) { _vector$6.x = this.getX(i); _vector$6.y = this.getY(i); _vector$6.z = this.getZ(i); - _vector$6.applyNormalMatrix(m); - this.setXYZ(i, _vector$6.x, _vector$6.y, _vector$6.z); } - return this; } - transformDirection(m) { for (let i = 0, l = this.count; i < l; i++) { _vector$6.x = this.getX(i); _vector$6.y = this.getY(i); _vector$6.z = this.getZ(i); - _vector$6.transformDirection(m); - this.setXYZ(i, _vector$6.x, _vector$6.y, _vector$6.z); } - return this; } - setX(index, x) { this.data.array[index * this.data.stride + this.offset] = x; return this; } - setY(index, y) { this.data.array[index * this.data.stride + this.offset + 1] = y; return this; } - setZ(index, z) { this.data.array[index * this.data.stride + this.offset + 2] = z; return this; } - setW(index, w) { this.data.array[index * this.data.stride + this.offset + 3] = w; return this; } - getX(index) { return this.data.array[index * this.data.stride + this.offset]; } - getY(index) { return this.data.array[index * this.data.stride + this.offset + 1]; } - getZ(index) { return this.data.array[index * this.data.stride + this.offset + 2]; } - getW(index) { return this.data.array[index * this.data.stride + this.offset + 3]; } - setXY(index, x, y) { index = index * this.data.stride + this.offset; this.data.array[index + 0] = x; this.data.array[index + 1] = y; return this; } - setXYZ(index, x, y, z) { index = index * this.data.stride + this.offset; this.data.array[index + 0] = x; @@ -21097,7 +18626,6 @@ class InterleavedBufferAttribute { this.data.array[index + 2] = z; return this; } - setXYZW(index, x, y, z, w) { index = index * this.data.stride + this.offset; this.data.array[index + 0] = x; @@ -21106,47 +18634,39 @@ class InterleavedBufferAttribute { this.data.array[index + 3] = w; return this; } - clone(data) { if (data === undefined) { console.log('THREE.InterleavedBufferAttribute.clone(): Cloning an interlaved buffer attribute will deinterleave buffer data.'); const array = []; - for (let i = 0; i < this.count; i++) { const index = i * this.data.stride + this.offset; - for (let j = 0; j < this.itemSize; j++) { array.push(this.data.array[index + j]); } } - return new BufferAttribute(new this.array.constructor(array), this.itemSize, this.normalized); } else { if (data.interleavedBuffers === undefined) { data.interleavedBuffers = {}; } - if (data.interleavedBuffers[this.data.uuid] === undefined) { data.interleavedBuffers[this.data.uuid] = this.data.clone(data); } - return new InterleavedBufferAttribute(data.interleavedBuffers[this.data.uuid], this.itemSize, this.offset, this.normalized); } } - toJSON(data) { if (data === undefined) { console.log('THREE.InterleavedBufferAttribute.toJSON(): Serializing an interlaved buffer attribute will deinterleave buffer data.'); const array = []; - for (let i = 0; i < this.count; i++) { const index = i * this.data.stride + this.offset; - for (let j = 0; j < this.itemSize; j++) { array.push(this.data.array[index + j]); } - } // deinterleave data and save it as an ordinary buffer attribute for now + } + // deinterleave data and save it as an ordinary buffer attribute for now return { itemSize: this.itemSize, @@ -21156,14 +18676,13 @@ class InterleavedBufferAttribute { }; } else { // save as true interlaved attribtue + if (data.interleavedBuffers === undefined) { data.interleavedBuffers = {}; } - if (data.interleavedBuffers[this.data.uuid] === undefined) { data.interleavedBuffers[this.data.uuid] = this.data.toJSON(data); } - return { isInterleavedBufferAttribute: true, itemSize: this.itemSize, @@ -21173,9 +18692,7 @@ class InterleavedBufferAttribute { }; } } - } - InterleavedBufferAttribute.prototype.isInterleavedBufferAttribute = true; /** @@ -21200,7 +18717,6 @@ class SpriteMaterial extends Material { this.transparent = true; this.setValues(parameters); } - copy(source) { super.copy(source); this.color.copy(source.color); @@ -21210,111 +18726,74 @@ class SpriteMaterial extends Material { this.sizeAttenuation = source.sizeAttenuation; return this; } - } - SpriteMaterial.prototype.isSpriteMaterial = true; let _geometry; - const _intersectPoint = /*@__PURE__*/new Vector3(); - const _worldScale = /*@__PURE__*/new Vector3(); - const _mvPosition = /*@__PURE__*/new Vector3(); - const _alignedPosition = /*@__PURE__*/new Vector2(); - const _rotatedPosition = /*@__PURE__*/new Vector2(); - const _viewWorldMatrix = /*@__PURE__*/new Matrix4(); - const _vA = /*@__PURE__*/new Vector3(); - const _vB = /*@__PURE__*/new Vector3(); - const _vC = /*@__PURE__*/new Vector3(); - const _uvA = /*@__PURE__*/new Vector2(); - const _uvB = /*@__PURE__*/new Vector2(); - const _uvC = /*@__PURE__*/new Vector2(); - class Sprite extends Object3D { constructor(material) { super(); this.type = 'Sprite'; - if (_geometry === undefined) { _geometry = new BufferGeometry(); const float32Array = new Float32Array([-0.5, -0.5, 0, 0, 0, 0.5, -0.5, 0, 1, 0, 0.5, 0.5, 0, 1, 1, -0.5, 0.5, 0, 0, 1]); const interleavedBuffer = new InterleavedBuffer(float32Array, 5); - _geometry.setIndex([0, 1, 2, 0, 2, 3]); - _geometry.setAttribute('position', new InterleavedBufferAttribute(interleavedBuffer, 3, 0, false)); - _geometry.setAttribute('uv', new InterleavedBufferAttribute(interleavedBuffer, 2, 3, false)); } - this.geometry = _geometry; this.material = material !== undefined ? material : new SpriteMaterial(); this.center = new Vector2(0.5, 0.5); } - raycast(raycaster, intersects) { if (raycaster.camera === null) { console.error('THREE.Sprite: "Raycaster.camera" needs to be set in order to raycast against sprites.'); } - _worldScale.setFromMatrixScale(this.matrixWorld); - _viewWorldMatrix.copy(raycaster.camera.matrixWorld); - this.modelViewMatrix.multiplyMatrices(raycaster.camera.matrixWorldInverse, this.matrixWorld); - _mvPosition.setFromMatrixPosition(this.modelViewMatrix); - if (raycaster.camera.isPerspectiveCamera && this.material.sizeAttenuation === false) { _worldScale.multiplyScalar(-_mvPosition.z); } - const rotation = this.material.rotation; let sin, cos; - if (rotation !== 0) { cos = Math.cos(rotation); sin = Math.sin(rotation); } - const center = this.center; transformVertex(_vA.set(-0.5, -0.5, 0), _mvPosition, center, _worldScale, sin, cos); transformVertex(_vB.set(0.5, -0.5, 0), _mvPosition, center, _worldScale, sin, cos); transformVertex(_vC.set(0.5, 0.5, 0), _mvPosition, center, _worldScale, sin, cos); - _uvA.set(0, 0); - _uvB.set(1, 0); + _uvC.set(1, 1); - _uvC.set(1, 1); // check first triangle - - + // check first triangle let intersect = raycaster.ray.intersectTriangle(_vA, _vB, _vC, false, _intersectPoint); - if (intersect === null) { // check second triangle transformVertex(_vB.set(-0.5, 0.5, 0), _mvPosition, center, _worldScale, sin, cos); - _uvB.set(0, 1); - intersect = raycaster.ray.intersectTriangle(_vA, _vC, _vB, false, _intersectPoint); - if (intersect === null) { return; } } - const distance = raycaster.ray.origin.distanceTo(_intersectPoint); if (distance < raycaster.near || distance > raycaster.far) return; intersects.push({ @@ -21325,41 +18804,35 @@ class Sprite extends Object3D { object: this }); } - copy(source) { super.copy(source); if (source.center !== undefined) this.center.copy(source.center); this.material = source.material; return this; } - } - Sprite.prototype.isSprite = true; - function transformVertex(vertexPosition, mvPosition, center, scale, sin, cos) { // compute position in camera space - _alignedPosition.subVectors(vertexPosition, center).addScalar(0.5).multiply(scale); // to check if rotation is not zero - + _alignedPosition.subVectors(vertexPosition, center).addScalar(0.5).multiply(scale); + // to check if rotation is not zero if (sin !== undefined) { _rotatedPosition.x = cos * _alignedPosition.x - sin * _alignedPosition.y; _rotatedPosition.y = sin * _alignedPosition.x + cos * _alignedPosition.y; } else { _rotatedPosition.copy(_alignedPosition); } - vertexPosition.copy(mvPosition); vertexPosition.x += _rotatedPosition.x; - vertexPosition.y += _rotatedPosition.y; // transform to world space + vertexPosition.y += _rotatedPosition.y; + // transform to world space vertexPosition.applyMatrix4(_viewWorldMatrix); } const _v1$2 = /*@__PURE__*/new Vector3(); - const _v2$1 = /*@__PURE__*/new Vector3(); - class LOD extends Object3D { constructor() { super(); @@ -21376,31 +18849,25 @@ class LOD extends Object3D { }); this.autoUpdate = true; } - copy(source) { super.copy(source, false); const levels = source.levels; - for (let i = 0, l = levels.length; i < l; i++) { const level = levels[i]; this.addLevel(level.object.clone(), level.distance); } - this.autoUpdate = source.autoUpdate; return this; } - addLevel(object, distance = 0) { distance = Math.abs(distance); const levels = this.levels; let l; - for (l = 0; l < levels.length; l++) { if (distance < levels[l].distance) { break; } } - levels.splice(l, 0, { distance: distance, object: object @@ -21408,52 +18875,38 @@ class LOD extends Object3D { this.add(object); return this; } - getCurrentLevel() { return this._currentLevel; } - getObjectForDistance(distance) { const levels = this.levels; - if (levels.length > 0) { let i, l; - for (i = 1, l = levels.length; i < l; i++) { if (distance < levels[i].distance) { break; } } - return levels[i - 1].object; } - return null; } - raycast(raycaster, intersects) { const levels = this.levels; - if (levels.length > 0) { _v1$2.setFromMatrixPosition(this.matrixWorld); - const distance = raycaster.ray.origin.distanceTo(_v1$2); this.getObjectForDistance(distance).raycast(raycaster, intersects); } } - update(camera) { const levels = this.levels; - if (levels.length > 1) { _v1$2.setFromMatrixPosition(camera.matrixWorld); - _v2$1.setFromMatrixPosition(this.matrixWorld); - const distance = _v1$2.distanceTo(_v2$1) / camera.zoom; levels[0].object.visible = true; let i, l; - for (i = 1, l = levels.length; i < l; i++) { if (distance >= levels[i].distance) { levels[i - 1].object.visible = false; @@ -21462,21 +18915,17 @@ class LOD extends Object3D { break; } } - this._currentLevel = i - 1; - for (; i < l; i++) { levels[i].object.visible = false; } } } - toJSON(meta) { const data = super.toJSON(meta); if (this.autoUpdate === false) data.object.autoUpdate = false; data.object.levels = []; const levels = this.levels; - for (let i = 0, l = levels.length; i < l; i++) { const level = levels[i]; data.object.levels.push({ @@ -21484,22 +18933,15 @@ class LOD extends Object3D { distance: level.distance }); } - return data; } - } const _basePosition = /*@__PURE__*/new Vector3(); - const _skinIndex = /*@__PURE__*/new Vector4(); - const _skinWeight = /*@__PURE__*/new Vector4(); - const _vector$5 = /*@__PURE__*/new Vector3(); - const _matrix = /*@__PURE__*/new Matrix4(); - class SkinnedMesh extends Mesh { constructor(geometry, material) { super(geometry, material); @@ -21508,7 +18950,6 @@ class SkinnedMesh extends Mesh { this.bindMatrix = new Matrix4(); this.bindMatrixInverse = new Matrix4(); } - copy(source) { super.copy(source); this.bindMode = source.bindMode; @@ -21517,48 +18958,38 @@ class SkinnedMesh extends Mesh { this.skeleton = source.skeleton; return this; } - bind(skeleton, bindMatrix) { this.skeleton = skeleton; - if (bindMatrix === undefined) { this.updateMatrixWorld(true); this.skeleton.calculateInverses(); bindMatrix = this.matrixWorld; } - this.bindMatrix.copy(bindMatrix); this.bindMatrixInverse.copy(bindMatrix).invert(); } - pose() { this.skeleton.pose(); } - normalizeSkinWeights() { const vector = new Vector4(); const skinWeight = this.geometry.attributes.skinWeight; - for (let i = 0, l = skinWeight.count; i < l; i++) { vector.x = skinWeight.getX(i); vector.y = skinWeight.getY(i); vector.z = skinWeight.getZ(i); vector.w = skinWeight.getW(i); const scale = 1.0 / vector.manhattanLength(); - if (scale !== Infinity) { vector.multiplyScalar(scale); } else { vector.set(1, 0, 0, 0); // do something reasonable } - skinWeight.setXYZW(i, vector.x, vector.y, vector.z, vector.w); } } - updateMatrixWorld(force) { super.updateMatrixWorld(force); - if (this.bindMode === 'attached') { this.bindMatrixInverse.copy(this.matrixWorld).invert(); } else if (this.bindMode === 'detached') { @@ -21567,36 +18998,24 @@ class SkinnedMesh extends Mesh { console.warn('THREE.SkinnedMesh: Unrecognized bindMode: ' + this.bindMode); } } - boneTransform(index, target) { const skeleton = this.skeleton; const geometry = this.geometry; - _skinIndex.fromBufferAttribute(geometry.attributes.skinIndex, index); - _skinWeight.fromBufferAttribute(geometry.attributes.skinWeight, index); - _basePosition.copy(target).applyMatrix4(this.bindMatrix); - target.set(0, 0, 0); - for (let i = 0; i < 4; i++) { const weight = _skinWeight.getComponent(i); - if (weight !== 0) { const boneIndex = _skinIndex.getComponent(i); - _matrix.multiplyMatrices(skeleton.bones[boneIndex].matrixWorld, skeleton.boneInverses[boneIndex]); - target.addScaledVector(_vector$5.copy(_basePosition).applyMatrix4(_matrix), weight); } } - return target.applyMatrix4(this.bindMatrixInverse); } - } - SkinnedMesh.prototype.isSkinnedMesh = true; class Bone extends Object3D { @@ -21604,9 +19023,7 @@ class Bone extends Object3D { super(); this.type = 'Bone'; } - } - Bone.prototype.isBone = true; class DataTexture extends Texture { @@ -21623,15 +19040,11 @@ class DataTexture extends Texture { this.flipY = false; this.unpackAlignment = 1; } - } - DataTexture.prototype.isDataTexture = true; const _offsetMatrix = /*@__PURE__*/new Matrix4(); - const _identityMatrix = /*@__PURE__*/new Matrix4(); - class Skeleton { constructor(bones = [], boneInverses = []) { this.uuid = generateUUID(); @@ -21644,55 +19057,51 @@ class Skeleton { this.frame = -1; this.init(); } - init() { const bones = this.bones; const boneInverses = this.boneInverses; - this.boneMatrices = new Float32Array(bones.length * 16); // calculate inverse bone matrices if necessary + this.boneMatrices = new Float32Array(bones.length * 16); + + // calculate inverse bone matrices if necessary if (boneInverses.length === 0) { this.calculateInverses(); } else { // handle special case + if (bones.length !== boneInverses.length) { console.warn('THREE.Skeleton: Number of inverse bone matrices does not match amount of bones.'); this.boneInverses = []; - for (let i = 0, il = this.bones.length; i < il; i++) { this.boneInverses.push(new Matrix4()); } } } } - calculateInverses() { this.boneInverses.length = 0; - for (let i = 0, il = this.bones.length; i < il; i++) { const inverse = new Matrix4(); - if (this.bones[i]) { inverse.copy(this.bones[i].matrixWorld).invert(); } - this.boneInverses.push(inverse); } } - pose() { // recover the bind-time world matrices + for (let i = 0, il = this.bones.length; i < il; i++) { const bone = this.bones[i]; - if (bone) { bone.matrixWorld.copy(this.boneInverses[i]).invert(); } - } // compute the local matrices, positions, rotations and scales + } + // compute the local matrices, positions, rotations and scales for (let i = 0, il = this.bones.length; i < il; i++) { const bone = this.bones[i]; - if (bone) { if (bone.parent && bone.parent.isBone) { bone.matrix.copy(bone.parent.matrixWorld).invert(); @@ -21700,36 +19109,32 @@ class Skeleton { } else { bone.matrix.copy(bone.matrixWorld); } - bone.matrix.decompose(bone.position, bone.quaternion, bone.scale); } } } - update() { const bones = this.bones; const boneInverses = this.boneInverses; const boneMatrices = this.boneMatrices; - const boneTexture = this.boneTexture; // flatten bone matrices to array + const boneTexture = this.boneTexture; + + // flatten bone matrices to array for (let i = 0, il = bones.length; i < il; i++) { // compute the offset between the current and the original transform - const matrix = bones[i] ? bones[i].matrixWorld : _identityMatrix; + const matrix = bones[i] ? bones[i].matrixWorld : _identityMatrix; _offsetMatrix.multiplyMatrices(matrix, boneInverses[i]); - _offsetMatrix.toArray(boneMatrices, i * 16); } - if (boneTexture !== null) { boneTexture.needsUpdate = true; } } - clone() { return new Skeleton(this.bones, this.boneInverses); } - computeBoneTexture() { // layout (1 matrix = 4 pixels) // RGBA RGBA RGBA RGBA (=> column1, column2, column3, column4) @@ -21737,12 +19142,11 @@ class Skeleton { // 16x16 pixel texture max 64 bones * 4 pixels = (16 * 16) // 32x32 pixel texture max 256 bones * 4 pixels = (32 * 32) // 64x64 pixel texture max 1024 bones * 4 pixels = (64 * 64) - let size = Math.sqrt(this.bones.length * 4); // 4 pixels needed for 1 matrix + let size = Math.sqrt(this.bones.length * 4); // 4 pixels needed for 1 matrix size = ceilPowerOfTwo(size); size = Math.max(size, 4); const boneMatrices = new Float32Array(size * size * 4); // 4 floats per RGBA pixel - boneMatrices.set(this.boneMatrices); // copy current values const boneTexture = new DataTexture(boneMatrices, size, size, RGBAFormat, FloatType); @@ -21752,46 +19156,36 @@ class Skeleton { this.boneTextureSize = size; return this; } - getBoneByName(name) { for (let i = 0, il = this.bones.length; i < il; i++) { const bone = this.bones[i]; - if (bone.name === name) { return bone; } } - return undefined; } - dispose() { if (this.boneTexture !== null) { this.boneTexture.dispose(); this.boneTexture = null; } } - fromJSON(json, bones) { this.uuid = json.uuid; - for (let i = 0, l = json.bones.length; i < l; i++) { const uuid = json.bones[i]; let bone = bones[uuid]; - if (bone === undefined) { console.warn('THREE.Skeleton: No bone found with UUID:', uuid); bone = new Bone(); } - this.bones.push(bone); this.boneInverses.push(new Matrix4().fromArray(json.boneInverses[i])); } - this.init(); return this; } - setRootMotionBone(bone) { if (typeof bone == 'object') { if (bone.type == 'Bone') { @@ -21805,13 +19199,11 @@ class Skeleton { } } } - if (this.rootMotionBone) { this.rootMotionBoneInitialMatrixInverse = this.rootMotionBone.matrixWorld.clone(); this.rootMotionBoneInitialMatrixInverse.invert(); } } - toJSON() { const data = { metadata: { @@ -21825,17 +19217,14 @@ class Skeleton { data.uuid = this.uuid; const bones = this.bones; const boneInverses = this.boneInverses; - for (let i = 0, l = bones.length; i < l; i++) { const bone = bones[i]; data.bones.push(bone.uuid); const boneInverse = boneInverses[i]; data.boneInverses.push(boneInverse.toArray()); } - return data; } - } class InstancedBufferAttribute extends BufferAttribute { @@ -21845,36 +19234,27 @@ class InstancedBufferAttribute extends BufferAttribute { normalized = false; console.error('THREE.InstancedBufferAttribute: The constructor now expects normalized as the third argument.'); } - super(array, itemSize, normalized); this.meshPerAttribute = meshPerAttribute; } - copy(source) { super.copy(source); this.meshPerAttribute = source.meshPerAttribute; return this; } - toJSON() { const data = super.toJSON(); data.meshPerAttribute = this.meshPerAttribute; data.isInstancedBufferAttribute = true; return data; } - } - InstancedBufferAttribute.prototype.isInstancedBufferAttribute = true; const _instanceLocalMatrix = /*@__PURE__*/new Matrix4(); - const _instanceWorldMatrix = /*@__PURE__*/new Matrix4(); - const _instanceIntersects = []; - const _mesh = /*@__PURE__*/new Mesh(); - class InstancedMesh extends Mesh { constructor(geometry, material, count) { super(geometry, material); @@ -21883,7 +19263,6 @@ class InstancedMesh extends Mesh { this.count = count; this.frustumCulled = false; } - copy(source) { super.copy(source); this.instanceMatrix.copy(source.instanceMatrix); @@ -21891,33 +19270,30 @@ class InstancedMesh extends Mesh { this.count = source.count; return this; } - getColorAt(index, color) { color.fromArray(this.instanceColor.array, index * 3); } - getMatrixAt(index, matrix) { matrix.fromArray(this.instanceMatrix.array, index * 16); } - raycast(raycaster, intersects) { const matrixWorld = this.matrixWorld; const raycastTimes = this.count; _mesh.geometry = this.geometry; _mesh.material = this.material; if (_mesh.material === undefined) return; - for (let instanceId = 0; instanceId < raycastTimes; instanceId++) { // calculate the world matrix for each instance - this.getMatrixAt(instanceId, _instanceLocalMatrix); - _instanceWorldMatrix.multiplyMatrices(matrixWorld, _instanceLocalMatrix); // the mesh represents this single instance + this.getMatrixAt(instanceId, _instanceLocalMatrix); + _instanceWorldMatrix.multiplyMatrices(matrixWorld, _instanceLocalMatrix); + // the mesh represents this single instance _mesh.matrixWorld = _instanceWorldMatrix; + _mesh.raycast(raycaster, _instanceIntersects); - _mesh.raycast(raycaster, _instanceIntersects); // process the result of raycast - + // process the result of raycast for (let i = 0, l = _instanceIntersects.length; i < l; i++) { const intersect = _instanceIntersects[i]; @@ -21925,33 +19301,25 @@ class InstancedMesh extends Mesh { intersect.object = this; intersects.push(intersect); } - _instanceIntersects.length = 0; } } - setColorAt(index, color) { if (this.instanceColor === null) { this.instanceColor = new InstancedBufferAttribute(new Float32Array(this.instanceMatrix.count * 3), 3); } - color.toArray(this.instanceColor.array, index * 3); } - setMatrixAt(index, matrix) { matrix.toArray(this.instanceMatrix.array, index * 16); } - updateMorphTargets() {} - dispose() { this.dispatchEvent({ type: 'dispose' }); } - } - InstancedMesh.prototype.isInstancedMesh = true; /** @@ -21975,7 +19343,6 @@ class LineBasicMaterial extends Material { this.linejoin = 'round'; this.setValues(parameters); } - copy(source) { super.copy(source); this.color.copy(source.color); @@ -21984,21 +19351,14 @@ class LineBasicMaterial extends Material { this.linejoin = source.linejoin; return this; } - } - LineBasicMaterial.prototype.isLineBasicMaterial = true; const _start$1 = /*@__PURE__*/new Vector3(); - const _end$1 = /*@__PURE__*/new Vector3(); - const _inverseMatrix$1 = /*@__PURE__*/new Matrix4(); - const _ray$1 = /*@__PURE__*/new Ray(); - const _sphere$1 = /*@__PURE__*/new Sphere(); - class Line extends Object3D { constructor(geometry = new BufferGeometry(), material = new LineBasicMaterial()) { super(); @@ -22007,32 +19367,26 @@ class Line extends Object3D { this.material = material; this.updateMorphTargets(); } - copy(source) { super.copy(source); this.material = source.material; this.geometry = source.geometry; return this; } - computeLineDistances() { const geometry = this.geometry; - if (geometry.isBufferGeometry) { // we assume non-indexed geometry + if (geometry.index === null) { const positionAttribute = geometry.attributes.position; const lineDistances = [0]; - for (let i = 1, l = positionAttribute.count; i < l; i++) { _start$1.fromBufferAttribute(positionAttribute, i - 1); - _end$1.fromBufferAttribute(positionAttribute, i); - lineDistances[i] = lineDistances[i - 1]; lineDistances[i] += _start$1.distanceTo(_end$1); } - geometry.setAttribute('lineDistance', new Float32BufferAttribute(lineDistances, 1)); } else { console.warn('THREE.Line.computeLineDistances(): Computation only possible with non-indexed BufferGeometry.'); @@ -22040,29 +19394,26 @@ class Line extends Object3D { } else if (geometry.isGeometry) { console.error('THREE.Line.computeLineDistances() no longer supports THREE.Geometry. Use THREE.BufferGeometry instead.'); } - return this; } - raycast(raycaster, intersects) { const geometry = this.geometry; const matrixWorld = this.matrixWorld; const threshold = raycaster.params.Line.threshold; - const drawRange = geometry.drawRange; // Checking boundingSphere distance to ray + const drawRange = geometry.drawRange; - if (geometry.boundingSphere === null) geometry.computeBoundingSphere(); + // Checking boundingSphere distance to ray + if (geometry.boundingSphere === null) geometry.computeBoundingSphere(); _sphere$1.copy(geometry.boundingSphere); - _sphere$1.applyMatrix4(matrixWorld); - _sphere$1.radius += threshold; - if (raycaster.ray.intersectsSphere(_sphere$1) === false) return; // + if (raycaster.ray.intersectsSphere(_sphere$1) === false) return; - _inverseMatrix$1.copy(matrixWorld).invert(); + // + _inverseMatrix$1.copy(matrixWorld).invert(); _ray$1.copy(raycaster.ray).applyMatrix4(_inverseMatrix$1); - const localThreshold = threshold / ((this.scale.x + this.scale.y + this.scale.z) / 3); const localThresholdSq = localThreshold * localThreshold; const vStart = new Vector3(); @@ -22070,24 +19421,19 @@ class Line extends Object3D { const interSegment = new Vector3(); const interRay = new Vector3(); const step = this.isLineSegments ? 2 : 1; - if (geometry.isBufferGeometry) { const index = geometry.index; const attributes = geometry.attributes; const positionAttribute = attributes.position; - if (index !== null) { const start = Math.max(0, drawRange.start); const end = Math.min(index.count, drawRange.start + drawRange.count); - for (let i = start, l = end - 1; i < l; i += step) { const a = index.getX(i); const b = index.getX(i + 1); vStart.fromBufferAttribute(positionAttribute, a); vEnd.fromBufferAttribute(positionAttribute, b); - const distSq = _ray$1.distanceSqToSegment(vStart, vEnd, interRay, interSegment); - if (distSq > localThresholdSq) continue; interRay.applyMatrix4(this.matrixWorld); //Move back to world space for distance calculation @@ -22107,13 +19453,10 @@ class Line extends Object3D { } else { const start = Math.max(0, drawRange.start); const end = Math.min(positionAttribute.count, drawRange.start + drawRange.count); - for (let i = start, l = end - 1; i < l; i += step) { vStart.fromBufferAttribute(positionAttribute, i); vEnd.fromBufferAttribute(positionAttribute, i + 1); - const distSq = _ray$1.distanceSqToSegment(vStart, vEnd, interRay, interSegment); - if (distSq > localThresholdSq) continue; interRay.applyMatrix4(this.matrixWorld); //Move back to world space for distance calculation @@ -22135,21 +19478,16 @@ class Line extends Object3D { console.error('THREE.Line.raycast() no longer supports THREE.Geometry. Use THREE.BufferGeometry instead.'); } } - updateMorphTargets() { const geometry = this.geometry; - if (geometry.isBufferGeometry) { const morphAttributes = geometry.morphAttributes; const keys = Object.keys(morphAttributes); - if (keys.length > 0) { const morphAttribute = morphAttributes[keys[0]]; - if (morphAttribute !== undefined) { this.morphTargetInfluences = []; this.morphTargetDictionary = {}; - for (let m = 0, ml = morphAttribute.length; m < ml; m++) { const name = morphAttribute[m].name || String(m); this.morphTargetInfluences.push(0); @@ -22159,45 +19497,35 @@ class Line extends Object3D { } } else { const morphTargets = geometry.morphTargets; - if (morphTargets !== undefined && morphTargets.length > 0) { console.error('THREE.Line.updateMorphTargets() does not support THREE.Geometry. Use THREE.BufferGeometry instead.'); } } } - } - Line.prototype.isLine = true; const _start = /*@__PURE__*/new Vector3(); - const _end = /*@__PURE__*/new Vector3(); - class LineSegments extends Line { constructor(geometry, material) { super(geometry, material); this.type = 'LineSegments'; } - computeLineDistances() { const geometry = this.geometry; - if (geometry.isBufferGeometry) { // we assume non-indexed geometry + if (geometry.index === null) { const positionAttribute = geometry.attributes.position; const lineDistances = []; - for (let i = 0, l = positionAttribute.count; i < l; i += 2) { _start.fromBufferAttribute(positionAttribute, i); - _end.fromBufferAttribute(positionAttribute, i + 1); - lineDistances[i] = i === 0 ? 0 : lineDistances[i - 1]; lineDistances[i + 1] = lineDistances[i] + _start.distanceTo(_end); } - geometry.setAttribute('lineDistance', new Float32BufferAttribute(lineDistances, 1)); } else { console.warn('THREE.LineSegments.computeLineDistances(): Computation only possible with non-indexed BufferGeometry.'); @@ -22205,12 +19533,9 @@ class LineSegments extends Line { } else if (geometry.isGeometry) { console.error('THREE.LineSegments.computeLineDistances() no longer supports THREE.Geometry. Use THREE.BufferGeometry instead.'); } - return this; } - } - LineSegments.prototype.isLineSegments = true; class LineLoop extends Line { @@ -22218,9 +19543,7 @@ class LineLoop extends Line { super(geometry, material); this.type = 'LineLoop'; } - } - LineLoop.prototype.isLineLoop = true; /** @@ -22247,7 +19570,6 @@ class PointsMaterial extends Material { this.sizeAttenuation = true; this.setValues(parameters); } - copy(source) { super.copy(source); this.color.copy(source.color); @@ -22257,19 +19579,13 @@ class PointsMaterial extends Material { this.sizeAttenuation = source.sizeAttenuation; return this; } - } - PointsMaterial.prototype.isPointsMaterial = true; const _inverseMatrix = /*@__PURE__*/new Matrix4(); - const _ray = /*@__PURE__*/new Ray(); - const _sphere = /*@__PURE__*/new Sphere(); - const _position$2 = /*@__PURE__*/new Vector3(); - class Points extends Object3D { constructor(geometry = new BufferGeometry(), material = new PointsMaterial()) { super(); @@ -22278,59 +19594,49 @@ class Points extends Object3D { this.material = material; this.updateMorphTargets(); } - copy(source) { super.copy(source); this.material = source.material; this.geometry = source.geometry; return this; } - raycast(raycaster, intersects) { const geometry = this.geometry; const matrixWorld = this.matrixWorld; const threshold = raycaster.params.Points.threshold; - const drawRange = geometry.drawRange; // Checking boundingSphere distance to ray + const drawRange = geometry.drawRange; - if (geometry.boundingSphere === null) geometry.computeBoundingSphere(); + // Checking boundingSphere distance to ray + if (geometry.boundingSphere === null) geometry.computeBoundingSphere(); _sphere.copy(geometry.boundingSphere); - _sphere.applyMatrix4(matrixWorld); - _sphere.radius += threshold; - if (raycaster.ray.intersectsSphere(_sphere) === false) return; // + if (raycaster.ray.intersectsSphere(_sphere) === false) return; - _inverseMatrix.copy(matrixWorld).invert(); + // + _inverseMatrix.copy(matrixWorld).invert(); _ray.copy(raycaster.ray).applyMatrix4(_inverseMatrix); - const localThreshold = threshold / ((this.scale.x + this.scale.y + this.scale.z) / 3); const localThresholdSq = localThreshold * localThreshold; - if (geometry.isBufferGeometry) { const index = geometry.index; const attributes = geometry.attributes; const positionAttribute = attributes.position; - if (index !== null) { const start = Math.max(0, drawRange.start); const end = Math.min(index.count, drawRange.start + drawRange.count); - for (let i = start, il = end; i < il; i++) { const a = index.getX(i); - _position$2.fromBufferAttribute(positionAttribute, a); - testPoint(_position$2, a, localThresholdSq, matrixWorld, raycaster, intersects, this); } } else { const start = Math.max(0, drawRange.start); const end = Math.min(positionAttribute.count, drawRange.start + drawRange.count); - for (let i = start, l = end; i < l; i++) { _position$2.fromBufferAttribute(positionAttribute, i); - testPoint(_position$2, i, localThresholdSq, matrixWorld, raycaster, intersects, this); } } @@ -22338,21 +19644,16 @@ class Points extends Object3D { console.error('THREE.Points.raycast() no longer supports THREE.Geometry. Use THREE.BufferGeometry instead.'); } } - updateMorphTargets() { const geometry = this.geometry; - if (geometry.isBufferGeometry) { const morphAttributes = geometry.morphAttributes; const keys = Object.keys(morphAttributes); - if (keys.length > 0) { const morphAttribute = morphAttributes[keys[0]]; - if (morphAttribute !== undefined) { this.morphTargetInfluences = []; this.morphTargetDictionary = {}; - for (let m = 0, ml = morphAttribute.length; m < ml; m++) { const name = morphAttribute[m].name || String(m); this.morphTargetInfluences.push(0); @@ -22362,25 +19663,18 @@ class Points extends Object3D { } } else { const morphTargets = geometry.morphTargets; - if (morphTargets !== undefined && morphTargets.length > 0) { console.error('THREE.Points.updateMorphTargets() does not support THREE.Geometry. Use THREE.BufferGeometry instead.'); } } } - } - Points.prototype.isPoints = true; - function testPoint(point, index, localThresholdSq, matrixWorld, raycaster, intersects, object) { const rayPointDistanceSq = _ray.distanceSqToPoint(point); - if (rayPointDistanceSq < localThresholdSq) { const intersectPoint = new Vector3(); - _ray.closestPointToPoint(point, intersectPoint); - intersectPoint.applyMatrix4(matrixWorld); const distance = raycaster.ray.origin.distanceTo(intersectPoint); if (distance < raycaster.near || distance > raycaster.far) return; @@ -22402,32 +19696,25 @@ class VideoTexture extends Texture { this.magFilter = magFilter !== undefined ? magFilter : LinearFilter; this.generateMipmaps = false; const scope = this; - function updateVideo() { scope.needsUpdate = true; video.requestVideoFrameCallback(updateVideo); } - if ('requestVideoFrameCallback' in video) { video.requestVideoFrameCallback(updateVideo); } } - clone() { return new this.constructor(this.image).copy(this); } - update() { const video = this.image; - const hasVideoFrameCallback = ('requestVideoFrameCallback' in video); - + const hasVideoFrameCallback = 'requestVideoFrameCallback' in video; if (hasVideoFrameCallback === false && video.readyState >= video.HAVE_CURRENT_DATA) { this.needsUpdate = true; } } - } - VideoTexture.prototype.isVideoTexture = true; class FramebufferTexture extends Texture { @@ -22442,9 +19729,7 @@ class FramebufferTexture extends Texture { this.generateMipmaps = false; this.needsUpdate = true; } - } - FramebufferTexture.prototype.isFramebufferTexture = true; class CompressedTexture extends Texture { @@ -22454,17 +19739,19 @@ class CompressedTexture extends Texture { width: width, height: height }; - this.mipmaps = mipmaps; // no flipping for cube textures + this.mipmaps = mipmaps; + + // no flipping for cube textures // (also flipping doesn't work for compressed textures ) - this.flipY = false; // can't generate mipmaps for compressed textures + this.flipY = false; + + // can't generate mipmaps for compressed textures // mips must be embedded in DDS files this.generateMipmaps = false; } - } - CompressedTexture.prototype.isCompressedTexture = true; class CanvasTexture extends Texture { @@ -22472,21 +19759,18 @@ class CanvasTexture extends Texture { super(canvas, mapping, wrapS, wrapT, magFilter, minFilter, format, type, anisotropy); this.needsUpdate = true; } - } - CanvasTexture.prototype.isCanvasTexture = true; // A External 2d texture is a 2d texture that's created out of three.js. // We have no control over it's type, format, parameters, etc..., // and can only use it as a shader uniform. + class ExternalTexture2D { constructor() { this.webglTexture = null; } - } - ExternalTexture2D.prototype.isExternalTexture2D = true; class CircleGeometry extends BufferGeometry { @@ -22499,50 +19783,61 @@ class CircleGeometry extends BufferGeometry { thetaStart: thetaStart, thetaLength: thetaLength }; - segments = Math.max(3, segments); // buffers + segments = Math.max(3, segments); + + // buffers const indices = []; const vertices = []; const normals = []; - const uvs = []; // helper variables + const uvs = []; + + // helper variables const vertex = new Vector3(); - const uv = new Vector2(); // center point + const uv = new Vector2(); + + // center point vertices.push(0, 0, 0); normals.push(0, 0, 1); uvs.push(0.5, 0.5); - for (let s = 0, i = 3; s <= segments; s++, i += 3) { - const segment = thetaStart + s / segments * thetaLength; // vertex + const segment = thetaStart + s / segments * thetaLength; + + // vertex vertex.x = radius * Math.cos(segment); vertex.y = radius * Math.sin(segment); - vertices.push(vertex.x, vertex.y, vertex.z); // normal + vertices.push(vertex.x, vertex.y, vertex.z); + + // normal - normals.push(0, 0, 1); // uvs + normals.push(0, 0, 1); + + // uvs uv.x = (vertices[i] / radius + 1) / 2; uv.y = (vertices[i + 1] / radius + 1) / 2; uvs.push(uv.x, uv.y); - } // indices + } + // indices for (let i = 1; i <= segments; i++) { indices.push(i, i + 1, 0); - } // build geometry + } + // build geometry this.setIndex(indices); this.setAttribute('position', new Float32BufferAttribute(vertices, 3)); this.setAttribute('normal', new Float32BufferAttribute(normals, 3)); this.setAttribute('uv', new Float32BufferAttribute(uvs, 2)); } - static fromJSON(data) { return new CircleGeometry(data.radius, data.segments, data.thetaStart, data.thetaLength); } - } class CylinderGeometry extends BufferGeometry { @@ -22561,89 +19856,115 @@ class CylinderGeometry extends BufferGeometry { }; const scope = this; radialSegments = Math.floor(radialSegments); - heightSegments = Math.floor(heightSegments); // buffers + heightSegments = Math.floor(heightSegments); + + // buffers const indices = []; const vertices = []; const normals = []; - const uvs = []; // helper variables + const uvs = []; + + // helper variables let index = 0; const indexArray = []; const halfHeight = height / 2; - let groupStart = 0; // generate geometry + let groupStart = 0; - generateTorso(); + // generate geometry + generateTorso(); if (openEnded === false) { if (radiusTop > 0) generateCap(true); if (radiusBottom > 0) generateCap(false); - } // build geometry + } + // build geometry this.setIndex(indices); this.setAttribute('position', new Float32BufferAttribute(vertices, 3)); this.setAttribute('normal', new Float32BufferAttribute(normals, 3)); this.setAttribute('uv', new Float32BufferAttribute(uvs, 2)); - function generateTorso() { const normal = new Vector3(); const vertex = new Vector3(); - let groupCount = 0; // this will be used to calculate the normal + let groupCount = 0; + + // this will be used to calculate the normal + const slope = (radiusBottom - radiusTop) / height; - const slope = (radiusBottom - radiusTop) / height; // generate vertices, normals and uvs + // generate vertices, normals and uvs for (let y = 0; y <= heightSegments; y++) { const indexRow = []; - const v = y / heightSegments; // calculate the radius of the current row + const v = y / heightSegments; - const radius = v * (radiusBottom - radiusTop) + radiusTop; + // calculate the radius of the current row + const radius = v * (radiusBottom - radiusTop) + radiusTop; for (let x = 0; x <= radialSegments; x++) { const u = x / radialSegments; const theta = u * thetaLength + thetaStart; const sinTheta = Math.sin(theta); - const cosTheta = Math.cos(theta); // vertex + const cosTheta = Math.cos(theta); + + // vertex vertex.x = radius * sinTheta; vertex.y = -v * height + halfHeight; vertex.z = radius * cosTheta; - vertices.push(vertex.x, vertex.y, vertex.z); // normal + vertices.push(vertex.x, vertex.y, vertex.z); + + // normal normal.set(sinTheta, slope, cosTheta).normalize(); - normals.push(normal.x, normal.y, normal.z); // uv + normals.push(normal.x, normal.y, normal.z); + + // uv + + uvs.push(u, 1 - v); - uvs.push(u, 1 - v); // save index of vertex in respective row + // save index of vertex in respective row indexRow.push(index++); - } // now save vertices of the row in our index array + } + // now save vertices of the row in our index array indexArray.push(indexRow); - } // generate indices + } + // generate indices for (let x = 0; x < radialSegments; x++) { for (let y = 0; y < heightSegments; y++) { // we use the index array to access the correct indices + const a = indexArray[y][x]; const b = indexArray[y + 1][x]; const c = indexArray[y + 1][x + 1]; - const d = indexArray[y][x + 1]; // faces + const d = indexArray[y][x + 1]; + + // faces indices.push(a, b, d); - indices.push(b, c, d); // update group counter + indices.push(b, c, d); + + // update group counter groupCount += 6; } - } // add a group to the geometry. this will ensure multi material support + } + // add a group to the geometry. this will ensure multi material support - scope.addGroup(groupStart, groupCount, 0); // calculate new start value for groups + scope.addGroup(groupStart, groupCount, 0); + + // calculate new start value for groups groupStart += groupCount; } - function generateCap(top) { // save the index of the first center vertex const centerIndexStart = index; @@ -22651,71 +19972,92 @@ class CylinderGeometry extends BufferGeometry { const vertex = new Vector3(); let groupCount = 0; const radius = top === true ? radiusTop : radiusBottom; - const sign = top === true ? 1 : -1; // first we generate the center vertex data of the cap. + const sign = top === true ? 1 : -1; + + // first we generate the center vertex data of the cap. // because the geometry needs one set of uvs per face, // we must generate a center vertex per face/segment for (let x = 1; x <= radialSegments; x++) { // vertex - vertices.push(0, halfHeight * sign, 0); // normal - normals.push(0, sign, 0); // uv + vertices.push(0, halfHeight * sign, 0); + + // normal - uvs.push(0.5, 0.5); // increase index + normals.push(0, sign, 0); + + // uv + + uvs.push(0.5, 0.5); + + // increase index index++; - } // save the index of the last center vertex + } + // save the index of the last center vertex + const centerIndexEnd = index; - const centerIndexEnd = index; // now we generate the surrounding vertices, normals and uvs + // now we generate the surrounding vertices, normals and uvs for (let x = 0; x <= radialSegments; x++) { const u = x / radialSegments; const theta = u * thetaLength + thetaStart; const cosTheta = Math.cos(theta); - const sinTheta = Math.sin(theta); // vertex + const sinTheta = Math.sin(theta); + + // vertex vertex.x = radius * sinTheta; vertex.y = halfHeight * sign; vertex.z = radius * cosTheta; - vertices.push(vertex.x, vertex.y, vertex.z); // normal + vertices.push(vertex.x, vertex.y, vertex.z); + + // normal - normals.push(0, sign, 0); // uv + normals.push(0, sign, 0); + + // uv uv.x = cosTheta * 0.5 + 0.5; uv.y = sinTheta * 0.5 * sign + 0.5; - uvs.push(uv.x, uv.y); // increase index + uvs.push(uv.x, uv.y); + + // increase index index++; - } // generate indices + } + // generate indices for (let x = 0; x < radialSegments; x++) { const c = centerIndexStart + x; const i = centerIndexEnd + x; - if (top === true) { // face top + indices.push(i, i + 1, c); } else { // face bottom + indices.push(i + 1, i, c); } - groupCount += 3; - } // add a group to the geometry. this will ensure multi material support + } + + // add a group to the geometry. this will ensure multi material support + scope.addGroup(groupStart, groupCount, top === true ? 1 : 2); - scope.addGroup(groupStart, groupCount, top === true ? 1 : 2); // calculate new start value for groups + // calculate new start value for groups groupStart += groupCount; } } - static fromJSON(data) { return new CylinderGeometry(data.radiusTop, data.radiusBottom, data.height, data.radialSegments, data.heightSegments, data.openEnded, data.thetaStart, data.thetaLength); } - } class ConeGeometry extends CylinderGeometry { @@ -22732,11 +20074,9 @@ class ConeGeometry extends CylinderGeometry { thetaLength: thetaLength }; } - static fromJSON(data) { return new ConeGeometry(data.radius, data.height, data.radialSegments, data.heightSegments, data.openEnded, data.thetaStart, data.thetaLength); } - } class PolyhedronGeometry extends BufferGeometry { @@ -22748,54 +20088,71 @@ class PolyhedronGeometry extends BufferGeometry { indices: indices, radius: radius, detail: detail - }; // default buffer data + }; + + // default buffer data const vertexBuffer = []; - const uvBuffer = []; // the subdivision creates the vertex buffer data + const uvBuffer = []; + + // the subdivision creates the vertex buffer data - subdivide(detail); // all vertices should lie on a conceptual sphere with a given radius + subdivide(detail); - applyRadius(radius); // finally, create the uv data + // all vertices should lie on a conceptual sphere with a given radius - generateUVs(); // build non-indexed geometry + applyRadius(radius); + + // finally, create the uv data + + generateUVs(); + + // build non-indexed geometry this.setAttribute('position', new Float32BufferAttribute(vertexBuffer, 3)); this.setAttribute('normal', new Float32BufferAttribute(vertexBuffer.slice(), 3)); this.setAttribute('uv', new Float32BufferAttribute(uvBuffer, 2)); - if (detail === 0) { this.computeVertexNormals(); // flat normals } else { this.normalizeNormals(); // smooth normals - } // helper functions + } + // helper functions function subdivide(detail) { const a = new Vector3(); const b = new Vector3(); - const c = new Vector3(); // iterate over all faces and apply a subdivison with the given detail value + const c = new Vector3(); + + // iterate over all faces and apply a subdivison with the given detail value for (let i = 0; i < indices.length; i += 3) { // get the vertices of the face + getVertexByIndex(indices[i + 0], a); getVertexByIndex(indices[i + 1], b); - getVertexByIndex(indices[i + 2], c); // perform subdivision + getVertexByIndex(indices[i + 2], c); + + // perform subdivision subdivideFace(a, b, c, detail); } } - function subdivideFace(a, b, c, detail) { - const cols = detail + 1; // we use this multidimensional array as a data structure for creating the subdivision + const cols = detail + 1; - const v = []; // construct all of the vertices for this subdivision + // we use this multidimensional array as a data structure for creating the subdivision + + const v = []; + + // construct all of the vertices for this subdivision for (let i = 0; i <= cols; i++) { v[i] = []; const aj = a.clone().lerp(c, i / cols); const bj = b.clone().lerp(c, i / cols); const rows = cols - i; - for (let j = 0; j <= rows; j++) { if (j === 0 && i === cols) { v[i][j] = aj; @@ -22803,13 +20160,13 @@ class PolyhedronGeometry extends BufferGeometry { v[i][j] = aj.clone().lerp(bj, j / rows); } } - } // construct all of the faces + } + // construct all of the faces for (let i = 0; i < cols; i++) { for (let j = 0; j < 2 * (cols - i) - 1; j++) { const k = Math.floor(j / 2); - if (j % 2 === 0) { pushVertex(v[i][k + 1]); pushVertex(v[i + 1][k]); @@ -22822,9 +20179,10 @@ class PolyhedronGeometry extends BufferGeometry { } } } - function applyRadius(radius) { - const vertex = new Vector3(); // iterate over the entire buffer and apply the radius to each vertex + const vertex = new Vector3(); + + // iterate over the entire buffer and apply the radius to each vertex for (let i = 0; i < vertexBuffer.length; i += 3) { vertex.x = vertexBuffer[i + 0]; @@ -22836,10 +20194,8 @@ class PolyhedronGeometry extends BufferGeometry { vertexBuffer[i + 2] = vertex.z; } } - function generateUVs() { const vertex = new Vector3(); - for (let i = 0; i < vertexBuffer.length; i += 3) { vertex.x = vertexBuffer[i + 0]; vertex.y = vertexBuffer[i + 1]; @@ -22848,20 +20204,22 @@ class PolyhedronGeometry extends BufferGeometry { const v = inclination(vertex) / Math.PI + 0.5; uvBuffer.push(u, 1 - v); } - correctUVs(); correctSeam(); } - function correctSeam() { // handle case when face straddles the seam, see #3269 + for (let i = 0; i < uvBuffer.length; i += 6) { // uv data of a single face + const x0 = uvBuffer[i + 0]; const x1 = uvBuffer[i + 2]; const x2 = uvBuffer[i + 4]; const max = Math.max(x0, x1, x2); - const min = Math.min(x0, x1, x2); // 0.9 is somewhat arbitrary + const min = Math.min(x0, x1, x2); + + // 0.9 is somewhat arbitrary if (max > 0.9 && min < 0.1) { if (x0 < 0.2) uvBuffer[i + 0] += 1; @@ -22870,18 +20228,15 @@ class PolyhedronGeometry extends BufferGeometry { } } } - function pushVertex(vertex) { vertexBuffer.push(vertex.x, vertex.y, vertex.z); } - function getVertexByIndex(index, vertex) { const stride = index * 3; vertex.x = vertices[stride + 0]; vertex.y = vertices[stride + 1]; vertex.z = vertices[stride + 2]; } - function correctUVs() { const a = new Vector3(); const b = new Vector3(); @@ -22890,7 +20245,6 @@ class PolyhedronGeometry extends BufferGeometry { const uvA = new Vector2(); const uvB = new Vector2(); const uvC = new Vector2(); - for (let i = 0, j = 0; i < vertexBuffer.length; i += 9, j += 6) { a.set(vertexBuffer[i + 0], vertexBuffer[i + 1], vertexBuffer[i + 2]); b.set(vertexBuffer[i + 3], vertexBuffer[i + 4], vertexBuffer[i + 5]); @@ -22905,42 +20259,44 @@ class PolyhedronGeometry extends BufferGeometry { correctUV(uvC, j + 4, c, azi); } } - function correctUV(uv, stride, vector, azimuth) { if (azimuth < 0 && uv.x === 1) { uvBuffer[stride] = uv.x - 1; } - if (vector.x === 0 && vector.z === 0) { uvBuffer[stride] = azimuth / 2 / Math.PI + 0.5; } - } // Angle around the Y axis, counter-clockwise when looking from above. + } + // Angle around the Y axis, counter-clockwise when looking from above. function azimuth(vector) { return Math.atan2(vector.z, -vector.x); - } // Angle above the XZ plane. + } + // Angle above the XZ plane. function inclination(vector) { return Math.atan2(-vector.y, Math.sqrt(vector.x * vector.x + vector.z * vector.z)); } } - static fromJSON(data) { return new PolyhedronGeometry(data.vertices, data.indices, data.radius, data.details); } - } class DodecahedronGeometry extends PolyhedronGeometry { constructor(radius = 1, detail = 0) { const t = (1 + Math.sqrt(5)) / 2; const r = 1 / t; - const vertices = [// (±1, ±1, ±1) - -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, ±1/φ, ±φ) - 0, -r, -t, 0, -r, t, 0, r, -t, 0, r, t, // (±1/φ, ±φ, 0) - -r, -t, 0, -r, t, 0, r, -t, 0, r, t, 0, // (±φ, 0, ±1/φ) + const vertices = [ + // (±1, ±1, ±1) + -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, ±1/φ, ±φ) + 0, -r, -t, 0, -r, t, 0, r, -t, 0, r, t, + // (±1/φ, ±φ, 0) + -r, -t, 0, -r, t, 0, r, -t, 0, r, t, 0, + // (±φ, 0, ±1/φ) -t, 0, -r, t, 0, -r, -t, 0, r, t, 0, r]; const indices = [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]; super(vertices, indices, radius, detail); @@ -22950,21 +20306,15 @@ class DodecahedronGeometry extends PolyhedronGeometry { detail: detail }; } - static fromJSON(data) { return new DodecahedronGeometry(data.radius, data.detail); } - } const _v0 = new Vector3(); - const _v1$1 = new Vector3(); - const _normal = new Vector3(); - const _triangle = new Triangle(); - class EdgesGeometry extends BufferGeometry { constructor(geometry = null, thresholdAngle = 1) { super(); @@ -22973,7 +20323,6 @@ class EdgesGeometry extends BufferGeometry { geometry: geometry, thresholdAngle: thresholdAngle }; - if (geometry !== null) { const precisionPoints = 4; const precision = Math.pow(10, precisionPoints); @@ -22986,7 +20335,6 @@ class EdgesGeometry extends BufferGeometry { const hashes = new Array(3); const edgeData = {}; const vertices = []; - for (let i = 0; i < indexCount; i += 3) { if (indexAttr) { indexArr[0] = indexAttr.getX(i); @@ -22997,7 +20345,6 @@ class EdgesGeometry extends BufferGeometry { indexArr[1] = i + 1; indexArr[2] = i + 2; } - const { a, b, @@ -23006,19 +20353,19 @@ class EdgesGeometry extends BufferGeometry { a.fromBufferAttribute(positionAttr, indexArr[0]); b.fromBufferAttribute(positionAttr, indexArr[1]); c.fromBufferAttribute(positionAttr, indexArr[2]); + _triangle.getNormal(_normal); - _triangle.getNormal(_normal); // create hashes for the edge from the vertices - - + // create hashes for the edge from the vertices hashes[0] = `${Math.round(a.x * precision)},${Math.round(a.y * precision)},${Math.round(a.z * precision)}`; hashes[1] = `${Math.round(b.x * precision)},${Math.round(b.y * precision)},${Math.round(b.z * precision)}`; - hashes[2] = `${Math.round(c.x * precision)},${Math.round(c.y * precision)},${Math.round(c.z * precision)}`; // skip degenerate triangles + hashes[2] = `${Math.round(c.x * precision)},${Math.round(c.y * precision)},${Math.round(c.z * precision)}`; + // skip degenerate triangles if (hashes[0] === hashes[1] || hashes[1] === hashes[2] || hashes[2] === hashes[0]) { continue; - } // iterate over every edge - + } + // iterate over every edge for (let j = 0; j < 3; j++) { // get the first and next vertex making up the edge const jNext = (j + 1) % 3; @@ -23028,7 +20375,6 @@ class EdgesGeometry extends BufferGeometry { const v1 = _triangle[vertKeys[jNext]]; const hash = `${vecHash0}_${vecHash1}`; const reverseHash = `${vecHash1}_${vecHash0}`; - if (reverseHash in edgeData && edgeData[reverseHash]) { // if we found a sibling edge add it into the vertex array if // it meets the angle threshold and delete the edge from the map. @@ -23036,7 +20382,6 @@ class EdgesGeometry extends BufferGeometry { vertices.push(v0.x, v0.y, v0.z); vertices.push(v1.x, v1.y, v1.z); } - edgeData[reverseHash] = null; } else if (!(hash in edgeData)) { // if we've already got an edge here then skip adding a new one @@ -23047,29 +20392,24 @@ class EdgesGeometry extends BufferGeometry { }; } } - } // iterate over all remaining, unmatched edges and add them to the vertex array - + } + // iterate over all remaining, unmatched edges and add them to the vertex array for (const key in edgeData) { if (edgeData[key]) { const { index0, index1 } = edgeData[key]; - _v0.fromBufferAttribute(positionAttr, index0); - _v1$1.fromBufferAttribute(positionAttr, index1); - vertices.push(_v0.x, _v0.y, _v0.z); vertices.push(_v1$1.x, _v1$1.y, _v1$1.z); } } - this.setAttribute('position', new Float32BufferAttribute(vertices, 3)); } } - } /** @@ -23106,79 +20446,79 @@ class Curve { constructor() { this.type = 'Curve'; this.arcLengthDivisions = 200; - } // Virtual base class method to overwrite and implement in subclasses - // - t [0 .. 1] + } + // Virtual base class method to overwrite and implement in subclasses + // - t [0 .. 1] - getPoint() { + getPoint(/* t, optionalTarget */ + ) { console.warn('THREE.Curve: .getPoint() not implemented.'); return null; - } // Get point at relative position in curve according to arc length - // - u [0 .. 1] + } + // Get point at relative position in curve according to arc length + // - u [0 .. 1] getPointAt(u, optionalTarget) { const t = this.getUtoTmapping(u); return this.getPoint(t, optionalTarget); - } // Get sequence of points using getPoint( t ) + } + // Get sequence of points using getPoint( t ) getPoints(divisions = 5) { const points = []; - for (let d = 0; d <= divisions; d++) { points.push(this.getPoint(d / divisions)); } - return points; - } // Get sequence of points using getPointAt( u ) + } + // Get sequence of points using getPointAt( u ) getSpacedPoints(divisions = 5) { const points = []; - for (let d = 0; d <= divisions; d++) { points.push(this.getPointAt(d / divisions)); } - return points; - } // Get total curve arc length + } + // Get total curve arc length getLength() { const lengths = this.getLengths(); return lengths[lengths.length - 1]; - } // Get list of cumulative segment lengths + } + // Get list of cumulative segment lengths getLengths(divisions = this.arcLengthDivisions) { if (this.cacheArcLengths && this.cacheArcLengths.length === divisions + 1 && !this.needsUpdate) { return this.cacheArcLengths; } - this.needsUpdate = false; const cache = []; let current, - last = this.getPoint(0); + last = this.getPoint(0); let sum = 0; cache.push(0); - for (let p = 1; p <= divisions; p++) { current = this.getPoint(p / divisions); sum += current.distanceTo(last); cache.push(sum); last = current; } - this.cacheArcLengths = cache; return cache; // { sums: cache, sum: sum }; Sum is in the last element. } - updateArcLengths() { this.needsUpdate = true; this.getLengths(); - } // Given u ( 0 .. 1 ), get a t to find p. This gives you points which are equidistant + } + // Given u ( 0 .. 1 ), get a t to find p. This gives you points which are equidistant getUtoTmapping(u, distance) { const arcLengths = this.getLengths(); @@ -23190,53 +20530,60 @@ class Curve { targetArcLength = distance; } else { targetArcLength = u * arcLengths[il - 1]; - } // binary search for the index with largest value smaller than target u distance + } + // binary search for the index with largest value smaller than target u distance let low = 0, - high = il - 1, - comparison; - + high = il - 1, + comparison; while (low <= high) { i = Math.floor(low + (high - low) / 2); // less likely to overflow, though probably not issue here, JS doesn't really have integers, all numbers are floats comparison = arcLengths[i] - targetArcLength; - if (comparison < 0) { low = i + 1; } else if (comparison > 0) { high = i - 1; } else { high = i; - break; // DONE + break; + + // DONE } } - i = high; - if (arcLengths[i] === targetArcLength) { return i / (il - 1); - } // we could get finer grain at lengths, or use simple interpolation between two points + } + // we could get finer grain at lengths, or use simple interpolation between two points const lengthBefore = arcLengths[i]; const lengthAfter = arcLengths[i + 1]; - const segmentLength = lengthAfter - lengthBefore; // determine where we are between the 'before' and 'after' points + const segmentLength = lengthAfter - lengthBefore; + + // determine where we are between the 'before' and 'after' points - const segmentFraction = (targetArcLength - lengthBefore) / segmentLength; // add that fractional amount to t + const segmentFraction = (targetArcLength - lengthBefore) / segmentLength; + + // add that fractional amount to t const t = (i + segmentFraction) / (il - 1); return t; - } // Returns a unit vector tangent at t + } + + // Returns a unit vector tangent at t // In case any sub curve does not implement its tangent derivation, // 2 points a small delta apart will be used to find its gradient // which seems to give a reasonable approximation - getTangent(t, optionalTarget) { const delta = 0.0001; let t1 = t - delta; - let t2 = t + delta; // Capping in case of danger + let t2 = t + delta; + + // Capping in case of danger if (t1 < 0) t1 = 0; if (t2 > 1) t2 = 1; @@ -23246,27 +20593,29 @@ class Curve { tangent.copy(pt2).sub(pt1).normalize(); return tangent; } - getTangentAt(u, optionalTarget) { const t = this.getUtoTmapping(u); return this.getTangent(t, optionalTarget); } - computeFrenetFrames(segments, closed) { // see http://www.cs.indiana.edu/pub/techreports/TR425.pdf + const normal = new Vector3(); const tangents = []; const normals = []; const binormals = []; const vec = new Vector3(); - const mat = new Matrix4(); // compute the tangent vectors for each segment on the curve + const mat = new Matrix4(); + + // compute the tangent vectors for each segment on the curve for (let i = 0; i <= segments; i++) { const u = i / segments; tangents[i] = this.getTangentAt(u, new Vector3()); - } // select an initial normal vector perpendicular to the first tangent vector, - // and in the direction of the minimum tangent xyz component + } + // select an initial normal vector perpendicular to the first tangent vector, + // and in the direction of the minimum tangent xyz component normals[0] = new Vector3(); binormals[0] = new Vector3(); @@ -23274,72 +20623,63 @@ class Curve { const tx = Math.abs(tangents[0].x); const ty = Math.abs(tangents[0].y); const tz = Math.abs(tangents[0].z); - if (tx <= min) { min = tx; normal.set(1, 0, 0); } - if (ty <= min) { min = ty; normal.set(0, 1, 0); } - if (tz <= min) { normal.set(0, 0, 1); } - vec.crossVectors(tangents[0], normal).normalize(); normals[0].crossVectors(tangents[0], vec); - binormals[0].crossVectors(tangents[0], normals[0]); // compute the slowly-varying normal and binormal vectors for each segment on the curve + binormals[0].crossVectors(tangents[0], normals[0]); + + // compute the slowly-varying normal and binormal vectors for each segment on the curve for (let i = 1; i <= segments; i++) { normals[i] = normals[i - 1].clone(); binormals[i] = binormals[i - 1].clone(); vec.crossVectors(tangents[i - 1], tangents[i]); - if (vec.length() > Number.EPSILON) { vec.normalize(); const theta = Math.acos(clamp(tangents[i - 1].dot(tangents[i]), -1, 1)); // clamp for floating pt errors normals[i].applyMatrix4(mat.makeRotationAxis(vec, theta)); } - binormals[i].crossVectors(tangents[i], normals[i]); - } // if the curve is closed, postprocess the vectors so the first and last normal vectors are the same + } + // if the curve is closed, postprocess the vectors so the first and last normal vectors are the same if (closed === true) { let theta = Math.acos(clamp(normals[0].dot(normals[segments]), -1, 1)); theta /= segments; - if (tangents[0].dot(vec.crossVectors(normals[0], normals[segments])) > 0) { theta = -theta; } - for (let i = 1; i <= segments; i++) { // twist a little... normals[i].applyMatrix4(mat.makeRotationAxis(tangents[i], theta * i)); binormals[i].crossVectors(tangents[i], normals[i]); } } - return { tangents: tangents, normals: normals, binormals: binormals }; } - clone() { return new this.constructor().copy(this); } - copy(source) { this.arcLengthDivisions = source.arcLengthDivisions; return this; } - toJSON() { const data = { metadata: { @@ -23352,12 +20692,10 @@ class Curve { data.type = this.type; return data; } - fromJSON(json) { this.arcLengthDivisions = json.arcLengthDivisions; return this; } - } class EllipseCurve extends Curve { @@ -23373,17 +20711,15 @@ class EllipseCurve extends Curve { this.aClockwise = aClockwise; this.aRotation = aRotation; } - getPoint(t, optionalTarget) { const point = optionalTarget || new Vector2(); const twoPi = Math.PI * 2; let deltaAngle = this.aEndAngle - this.aStartAngle; - const samePoints = Math.abs(deltaAngle) < Number.EPSILON; // ensures that deltaAngle is 0 .. 2 PI + const samePoints = Math.abs(deltaAngle) < Number.EPSILON; + // ensures that deltaAngle is 0 .. 2 PI while (deltaAngle < 0) deltaAngle += twoPi; - while (deltaAngle > twoPi) deltaAngle -= twoPi; - if (deltaAngle < Number.EPSILON) { if (samePoints) { deltaAngle = 0; @@ -23391,7 +20727,6 @@ class EllipseCurve extends Curve { deltaAngle = twoPi; } } - if (this.aClockwise === true && !samePoints) { if (deltaAngle === twoPi) { deltaAngle = -twoPi; @@ -23399,24 +20734,21 @@ class EllipseCurve extends Curve { deltaAngle = deltaAngle - twoPi; } } - const angle = this.aStartAngle + t * deltaAngle; let x = this.aX + this.xRadius * Math.cos(angle); let y = this.aY + this.yRadius * Math.sin(angle); - if (this.aRotation !== 0) { const cos = Math.cos(this.aRotation); const sin = Math.sin(this.aRotation); const tx = x - this.aX; - const ty = y - this.aY; // Rotate the point about the center of the ellipse. + const ty = y - this.aY; + // Rotate the point about the center of the ellipse. x = tx * cos - ty * sin + this.aX; y = tx * sin + ty * cos + this.aY; } - return point.set(x, y); } - copy(source) { super.copy(source); this.aX = source.aX; @@ -23429,7 +20761,6 @@ class EllipseCurve extends Curve { this.aRotation = source.aRotation; return this; } - toJSON() { const data = super.toJSON(); data.aX = this.aX; @@ -23442,7 +20773,6 @@ class EllipseCurve extends Curve { data.aRotation = this.aRotation; return data; } - fromJSON(json) { super.fromJSON(json); this.aX = json.aX; @@ -23455,9 +20785,7 @@ class EllipseCurve extends Curve { this.aRotation = json.aRotation; return this; } - } - EllipseCurve.prototype.isEllipseCurve = true; class ArcCurve extends EllipseCurve { @@ -23465,9 +20793,7 @@ class ArcCurve extends EllipseCurve { super(aX, aY, aRadius, aRadius, aStartAngle, aEndAngle, aClockwise); this.type = 'ArcCurve'; } - } - ArcCurve.prototype.isArcCurve = true; /** @@ -23491,9 +20817,10 @@ which can be placed in CurveUtils. function CubicPoly() { let c0 = 0, - c1 = 0, - c2 = 0, - c3 = 0; + c1 = 0, + c2 = 0, + c3 = 0; + /* * Compute coefficients for a cubic polynomial * p(s) = c0 + c1*s + c2*s^2 + c3*s^3 @@ -23502,14 +20829,12 @@ function CubicPoly() { * and * p'(0) = t0, p'(1) = t1. */ - function init(x0, x1, t0, t1) { c0 = x0; c1 = t0; c2 = -3 * x0 + 3 * x1 - 2 * t0 - t1; c3 = 2 * x0 - 2 * x1 + t0 + t1; } - return { initCatmullRom: function (x0, x1, x2, x3, tension) { init(x1, x2, tension * (x2 - x0), tension * (x3 - x1)); @@ -23517,8 +20842,9 @@ function CubicPoly() { initNonuniformCatmullRom: function (x0, x1, x2, x3, dt0, dt1, dt2) { // compute tangents when parameterized in [t1,t2] let t1 = (x1 - x0) / dt0 - (x2 - x0) / (dt0 + dt1) + (x2 - x1) / dt1; - let t2 = (x2 - x1) / dt1 - (x3 - x1) / (dt1 + dt2) + (x3 - x2) / dt2; // rescale tangents for parametrization in [0,1] + let t2 = (x2 - x1) / dt1 - (x3 - x1) / (dt1 + dt2) + (x3 - x2) / dt2; + // rescale tangents for parametrization in [0,1] t1 *= dt1; t2 *= dt1; init(x1, x2, t1, t2); @@ -23529,14 +20855,14 @@ function CubicPoly() { return c0 + c1 * t + c2 * t2 + c3 * t3; } }; -} // +} +// const tmp = new Vector3(); const px = new CubicPoly(), - py = new CubicPoly(), - pz = new CubicPoly(); - + py = new CubicPoly(), + pz = new CubicPoly(); class CatmullRomCurve3 extends Curve { constructor(points = [], closed = false, curveType = 'centripetal', tension = 0.5) { super(); @@ -23546,7 +20872,6 @@ class CatmullRomCurve3 extends Curve { this.curveType = curveType; this.tension = tension; } - getPoint(t, optionalTarget = new Vector3()) { const point = optionalTarget; const points = this.points; @@ -23554,14 +20879,12 @@ class CatmullRomCurve3 extends Curve { const p = (l - (this.closed ? 0 : 1)) * t; let intPoint = Math.floor(p); let weight = p - intPoint; - if (this.closed) { intPoint += intPoint > 0 ? 0 : (Math.floor(Math.abs(intPoint) / l) + 1) * l; } else if (weight === 0 && intPoint === l - 1) { intPoint = l - 2; weight = 1; } - let p0, p3; // 4 points (p1 & p2 defined below) if (this.closed || intPoint > 0) { @@ -23571,10 +20894,8 @@ class CatmullRomCurve3 extends Curve { tmp.subVectors(points[0], points[1]).add(points[0]); p0 = tmp; } - const p1 = points[intPoint % l]; const p2 = points[(intPoint + 1) % l]; - if (this.closed || intPoint + 2 < l) { p3 = points[(intPoint + 2) % l]; } else { @@ -23582,14 +20903,14 @@ class CatmullRomCurve3 extends Curve { tmp.subVectors(points[l - 1], points[l - 2]).add(points[l - 1]); p3 = tmp; } - if (this.curveType === 'centripetal' || this.curveType === 'chordal') { // init Centripetal / Chordal Catmull-Rom const pow = this.curveType === 'chordal' ? 0.5 : 0.25; let dt0 = Math.pow(p0.distanceToSquared(p1), pow); let dt1 = Math.pow(p1.distanceToSquared(p2), pow); - let dt2 = Math.pow(p2.distanceToSquared(p3), pow); // safety check for repeated points + let dt2 = Math.pow(p2.distanceToSquared(p3), pow); + // safety check for repeated points if (dt1 < 1e-4) dt1 = 1.0; if (dt0 < 1e-4) dt0 = dt1; if (dt2 < 1e-4) dt2 = dt1; @@ -23601,109 +20922,93 @@ class CatmullRomCurve3 extends Curve { py.initCatmullRom(p0.y, p1.y, p2.y, p3.y, this.tension); pz.initCatmullRom(p0.z, p1.z, p2.z, p3.z, this.tension); } - point.set(px.calc(weight), py.calc(weight), pz.calc(weight)); return point; } - copy(source) { super.copy(source); this.points = []; - for (let i = 0, l = source.points.length; i < l; i++) { const point = source.points[i]; this.points.push(point.clone()); } - this.closed = source.closed; this.curveType = source.curveType; this.tension = source.tension; return this; } - toJSON() { const data = super.toJSON(); data.points = []; - for (let i = 0, l = this.points.length; i < l; i++) { const point = this.points[i]; data.points.push(point.toArray()); } - data.closed = this.closed; data.curveType = this.curveType; data.tension = this.tension; return data; } - fromJSON(json) { super.fromJSON(json); this.points = []; - for (let i = 0, l = json.points.length; i < l; i++) { const point = json.points[i]; this.points.push(new Vector3().fromArray(point)); } - this.closed = json.closed; this.curveType = json.curveType; this.tension = json.tension; return this; } - } - CatmullRomCurve3.prototype.isCatmullRomCurve3 = true; /** * Bezier Curves formulas obtained from * https://en.wikipedia.org/wiki/B%C3%A9zier_curve */ + function CatmullRom(t, p0, p1, p2, p3) { const v0 = (p2 - p0) * 0.5; const v1 = (p3 - p1) * 0.5; const t2 = t * t; const t3 = t * t2; return (2 * p1 - 2 * p2 + v0 + v1) * t3 + (-3 * p1 + 3 * p2 - 2 * v0 - v1) * t2 + v0 * t + p1; -} // +} +// function QuadraticBezierP0(t, p) { const k = 1 - t; return k * k * p; } - function QuadraticBezierP1(t, p) { return 2 * (1 - t) * t * p; } - function QuadraticBezierP2(t, p) { return t * t * p; } - function QuadraticBezier(t, p0, p1, p2) { return QuadraticBezierP0(t, p0) + QuadraticBezierP1(t, p1) + QuadraticBezierP2(t, p2); -} // +} +// function CubicBezierP0(t, p) { const k = 1 - t; return k * k * k * p; } - function CubicBezierP1(t, p) { const k = 1 - t; return 3 * k * k * t * p; } - function CubicBezierP2(t, p) { return 3 * (1 - t) * t * t * p; } - function CubicBezierP3(t, p) { return t * t * t * p; } - function CubicBezier(t, p0, p1, p2, p3) { return CubicBezierP0(t, p0) + CubicBezierP1(t, p1) + CubicBezierP2(t, p2) + CubicBezierP3(t, p3); } @@ -23717,17 +21022,15 @@ class CubicBezierCurve extends Curve { this.v2 = v2; this.v3 = v3; } - getPoint(t, optionalTarget = new Vector2()) { const point = optionalTarget; const v0 = this.v0, - v1 = this.v1, - v2 = this.v2, - v3 = this.v3; + v1 = this.v1, + v2 = this.v2, + v3 = this.v3; point.set(CubicBezier(t, v0.x, v1.x, v2.x, v3.x), CubicBezier(t, v0.y, v1.y, v2.y, v3.y)); return point; } - copy(source) { super.copy(source); this.v0.copy(source.v0); @@ -23736,7 +21039,6 @@ class CubicBezierCurve extends Curve { this.v3.copy(source.v3); return this; } - toJSON() { const data = super.toJSON(); data.v0 = this.v0.toArray(); @@ -23745,7 +21047,6 @@ class CubicBezierCurve extends Curve { data.v3 = this.v3.toArray(); return data; } - fromJSON(json) { super.fromJSON(json); this.v0.fromArray(json.v0); @@ -23754,9 +21055,7 @@ class CubicBezierCurve extends Curve { this.v3.fromArray(json.v3); return this; } - } - CubicBezierCurve.prototype.isCubicBezierCurve = true; class CubicBezierCurve3 extends Curve { @@ -23768,17 +21067,15 @@ class CubicBezierCurve3 extends Curve { this.v2 = v2; this.v3 = v3; } - getPoint(t, optionalTarget = new Vector3()) { const point = optionalTarget; const v0 = this.v0, - v1 = this.v1, - v2 = this.v2, - v3 = this.v3; + v1 = this.v1, + v2 = this.v2, + v3 = this.v3; point.set(CubicBezier(t, v0.x, v1.x, v2.x, v3.x), CubicBezier(t, v0.y, v1.y, v2.y, v3.y), CubicBezier(t, v0.z, v1.z, v2.z, v3.z)); return point; } - copy(source) { super.copy(source); this.v0.copy(source.v0); @@ -23787,7 +21084,6 @@ class CubicBezierCurve3 extends Curve { this.v3.copy(source.v3); return this; } - toJSON() { const data = super.toJSON(); data.v0 = this.v0.toArray(); @@ -23796,7 +21092,6 @@ class CubicBezierCurve3 extends Curve { data.v3 = this.v3.toArray(); return data; } - fromJSON(json) { super.fromJSON(json); this.v0.fromArray(json.v0); @@ -23805,9 +21100,7 @@ class CubicBezierCurve3 extends Curve { this.v3.fromArray(json.v3); return this; } - } - CubicBezierCurve3.prototype.isCubicBezierCurve3 = true; class LineCurve extends Curve { @@ -23817,54 +21110,45 @@ class LineCurve extends Curve { this.v1 = v1; this.v2 = v2; } - getPoint(t, optionalTarget = new Vector2()) { const point = optionalTarget; - if (t === 1) { point.copy(this.v2); } else { point.copy(this.v2).sub(this.v1); point.multiplyScalar(t).add(this.v1); } - return point; - } // Line curve is linear, so we can overwrite default getPointAt - + } + // Line curve is linear, so we can overwrite default getPointAt getPointAt(u, optionalTarget) { return this.getPoint(u, optionalTarget); } - getTangent(t, optionalTarget) { const tangent = optionalTarget || new Vector2(); tangent.copy(this.v2).sub(this.v1).normalize(); return tangent; } - copy(source) { super.copy(source); this.v1.copy(source.v1); this.v2.copy(source.v2); return this; } - toJSON() { const data = super.toJSON(); data.v1 = this.v1.toArray(); data.v2 = this.v2.toArray(); return data; } - fromJSON(json) { super.fromJSON(json); this.v1.fromArray(json.v1); this.v2.fromArray(json.v2); return this; } - } - LineCurve.prototype.isLineCurve = true; class LineCurve3 extends Curve { @@ -23875,46 +21159,38 @@ class LineCurve3 extends Curve { this.v1 = v1; this.v2 = v2; } - getPoint(t, optionalTarget = new Vector3()) { const point = optionalTarget; - if (t === 1) { point.copy(this.v2); } else { point.copy(this.v2).sub(this.v1); point.multiplyScalar(t).add(this.v1); } - return point; - } // Line curve is linear, so we can overwrite default getPointAt - - + } + // Line curve is linear, so we can overwrite default getPointAt getPointAt(u, optionalTarget) { return this.getPoint(u, optionalTarget); } - copy(source) { super.copy(source); this.v1.copy(source.v1); this.v2.copy(source.v2); return this; } - toJSON() { const data = super.toJSON(); data.v1 = this.v1.toArray(); data.v2 = this.v2.toArray(); return data; } - fromJSON(json) { super.fromJSON(json); this.v1.fromArray(json.v1); this.v2.fromArray(json.v2); return this; } - } class QuadraticBezierCurve extends Curve { @@ -23925,16 +21201,14 @@ class QuadraticBezierCurve extends Curve { this.v1 = v1; this.v2 = v2; } - getPoint(t, optionalTarget = new Vector2()) { const point = optionalTarget; const v0 = this.v0, - v1 = this.v1, - v2 = this.v2; + v1 = this.v1, + v2 = this.v2; point.set(QuadraticBezier(t, v0.x, v1.x, v2.x), QuadraticBezier(t, v0.y, v1.y, v2.y)); return point; } - copy(source) { super.copy(source); this.v0.copy(source.v0); @@ -23942,7 +21216,6 @@ class QuadraticBezierCurve extends Curve { this.v2.copy(source.v2); return this; } - toJSON() { const data = super.toJSON(); data.v0 = this.v0.toArray(); @@ -23950,7 +21223,6 @@ class QuadraticBezierCurve extends Curve { data.v2 = this.v2.toArray(); return data; } - fromJSON(json) { super.fromJSON(json); this.v0.fromArray(json.v0); @@ -23958,9 +21230,7 @@ class QuadraticBezierCurve extends Curve { this.v2.fromArray(json.v2); return this; } - } - QuadraticBezierCurve.prototype.isQuadraticBezierCurve = true; class QuadraticBezierCurve3 extends Curve { @@ -23971,16 +21241,14 @@ class QuadraticBezierCurve3 extends Curve { this.v1 = v1; this.v2 = v2; } - getPoint(t, optionalTarget = new Vector3()) { const point = optionalTarget; const v0 = this.v0, - v1 = this.v1, - v2 = this.v2; + v1 = this.v1, + v2 = this.v2; point.set(QuadraticBezier(t, v0.x, v1.x, v2.x), QuadraticBezier(t, v0.y, v1.y, v2.y), QuadraticBezier(t, v0.z, v1.z, v2.z)); return point; } - copy(source) { super.copy(source); this.v0.copy(source.v0); @@ -23988,7 +21256,6 @@ class QuadraticBezierCurve3 extends Curve { this.v2.copy(source.v2); return this; } - toJSON() { const data = super.toJSON(); data.v0 = this.v0.toArray(); @@ -23996,7 +21263,6 @@ class QuadraticBezierCurve3 extends Curve { data.v2 = this.v2.toArray(); return data; } - fromJSON(json) { super.fromJSON(json); this.v0.fromArray(json.v0); @@ -24004,9 +21270,7 @@ class QuadraticBezierCurve3 extends Curve { this.v2.fromArray(json.v2); return this; } - } - QuadraticBezierCurve3.prototype.isQuadraticBezierCurve3 = true; class SplineCurve extends Curve { @@ -24015,7 +21279,6 @@ class SplineCurve extends Curve { this.type = 'SplineCurve'; this.points = points; } - getPoint(t, optionalTarget = new Vector2()) { const point = optionalTarget; const points = this.points; @@ -24029,45 +21292,34 @@ class SplineCurve extends Curve { point.set(CatmullRom(weight, p0.x, p1.x, p2.x, p3.x), CatmullRom(weight, p0.y, p1.y, p2.y, p3.y)); return point; } - copy(source) { super.copy(source); this.points = []; - for (let i = 0, l = source.points.length; i < l; i++) { const point = source.points[i]; this.points.push(point.clone()); } - return this; } - toJSON() { const data = super.toJSON(); data.points = []; - for (let i = 0, l = this.points.length; i < l; i++) { const point = this.points[i]; data.points.push(point.toArray()); } - return data; } - fromJSON(json) { super.fromJSON(json); this.points = []; - for (let i = 0, l = json.points.length; i < l; i++) { const point = json.points[i]; this.points.push(new Vector2().fromArray(point)); } - return this; } - } - SplineCurve.prototype.isSplineCurve = true; var Curves = /*#__PURE__*/Object.freeze({ @@ -24096,32 +21348,33 @@ class CurvePath extends Curve { this.curves = []; this.autoClose = false; // Automatically closes the path } - add(curve) { this.curves.push(curve); } - closePath() { // Add a line curve if start and end of lines are not connected const startPoint = this.curves[0].getPoint(0); const endPoint = this.curves[this.curves.length - 1].getPoint(1); - if (!startPoint.equals(endPoint)) { this.curves.push(new LineCurve(endPoint, startPoint)); } - } // To get accurate point with reference to + } + + // To get accurate point with reference to // entire path distance at time t, // following has to be done: + // 1. Length of each sub path have to be known // 2. Locate and identify type of curve // 3. Get t for the curve // 4. Return curve.getPointAt(t') - getPoint(t, optionalTarget) { const d = t * this.getLength(); const curveLengths = this.getCurveLengths(); - let i = 0; // To think about boundaries points. + let i = 0; + + // To think about boundaries points. while (i < curveLengths.length) { if (curveLengths[i] >= d) { @@ -24131,73 +21384,68 @@ class CurvePath extends Curve { const u = segmentLength === 0 ? 0 : 1 - diff / segmentLength; return curve.getPointAt(u, optionalTarget); } - i++; } + return null; - return null; // loop where sum != 0, sum > d , sum+1 d , sum+1 1 && !points[points.length - 1].equals(points[0])) { points.push(points[0]); } - return points; } - copy(source) { super.copy(source); this.curves = []; - for (let i = 0, l = source.curves.length; i < l; i++) { const curve = source.curves[i]; this.curves.push(curve.clone()); } - this.autoClose = source.autoClose; return this; } - toJSON() { const data = super.toJSON(); data.autoClose = this.autoClose; data.curves = []; - for (let i = 0, l = this.curves.length; i < l; i++) { const curve = this.curves[i]; data.curves.push(curve.toJSON()); } - return data; } - fromJSON(json) { super.fromJSON(json); this.autoClose = json.autoClose; this.curves = []; - for (let i = 0, l = json.curves.length; i < l; i++) { const curve = json.curves[i]; this.curves.push(new Curves[curve.type]().fromJSON(curve)); } - return this; } - } class Path extends CurvePath { @@ -24260,114 +21496,92 @@ class Path extends CurvePath { super(); this.type = 'Path'; this.currentPoint = new Vector2(); - if (points) { this.setFromPoints(points); } } - setFromPoints(points) { this.moveTo(points[0].x, points[0].y); - for (let i = 1, l = points.length; i < l; i++) { this.lineTo(points[i].x, points[i].y); } - return this; } - moveTo(x, y) { this.currentPoint.set(x, y); // TODO consider referencing vectors instead of copying? return this; } - lineTo(x, y) { const curve = new LineCurve(this.currentPoint.clone(), new Vector2(x, y)); this.curves.push(curve); this.currentPoint.set(x, y); return this; } - quadraticCurveTo(aCPx, aCPy, aX, aY) { const curve = new QuadraticBezierCurve(this.currentPoint.clone(), new Vector2(aCPx, aCPy), new Vector2(aX, aY)); this.curves.push(curve); this.currentPoint.set(aX, aY); return this; } - bezierCurveTo(aCP1x, aCP1y, aCP2x, aCP2y, aX, aY) { const curve = new CubicBezierCurve(this.currentPoint.clone(), new Vector2(aCP1x, aCP1y), new Vector2(aCP2x, aCP2y), new Vector2(aX, aY)); this.curves.push(curve); this.currentPoint.set(aX, aY); return this; } - - splineThru(pts - /*Array of Vector*/ - ) { + splineThru(pts /*Array of Vector*/) { const npts = [this.currentPoint.clone()].concat(pts); const curve = new SplineCurve(npts); this.curves.push(curve); this.currentPoint.copy(pts[pts.length - 1]); return this; } - arc(aX, aY, aRadius, aStartAngle, aEndAngle, aClockwise) { const x0 = this.currentPoint.x; const y0 = this.currentPoint.y; this.absarc(aX + x0, aY + y0, aRadius, aStartAngle, aEndAngle, aClockwise); return this; } - absarc(aX, aY, aRadius, aStartAngle, aEndAngle, aClockwise) { this.absellipse(aX, aY, aRadius, aRadius, aStartAngle, aEndAngle, aClockwise); return this; } - ellipse(aX, aY, xRadius, yRadius, aStartAngle, aEndAngle, aClockwise, aRotation) { const x0 = this.currentPoint.x; const y0 = this.currentPoint.y; this.absellipse(aX + x0, aY + y0, xRadius, yRadius, aStartAngle, aEndAngle, aClockwise, aRotation); return this; } - absellipse(aX, aY, xRadius, yRadius, aStartAngle, aEndAngle, aClockwise, aRotation) { const curve = new EllipseCurve(aX, aY, xRadius, yRadius, aStartAngle, aEndAngle, aClockwise, aRotation); - if (this.curves.length > 0) { // if a previous curve is present, attempt to join const firstPoint = curve.getPoint(0); - if (!firstPoint.equals(this.currentPoint)) { this.lineTo(firstPoint.x, firstPoint.y); } } - this.curves.push(curve); const lastPoint = curve.getPoint(1); this.currentPoint.copy(lastPoint); return this; } - copy(source) { super.copy(source); this.currentPoint.copy(source.currentPoint); return this; } - toJSON() { const data = super.toJSON(); data.currentPoint = this.currentPoint.toArray(); return data; } - fromJSON(json) { super.fromJSON(json); this.currentPoint.fromArray(json.currentPoint); return this; } - } class Shape extends Path { @@ -24377,17 +21591,15 @@ class Shape extends Path { this.type = 'Shape'; this.holes = []; } - getPointsHoles(divisions) { const holesPts = []; - for (let i = 0, l = this.holes.length; i < l; i++) { holesPts[i] = this.holes[i].getPoints(divisions); } - return holesPts; - } // get points of shape and holes (keypoints based on segments parameter) + } + // get points of shape and holes (keypoints based on segments parameter) extractPoints(divisions) { return { @@ -24395,50 +21607,41 @@ class Shape extends Path { holes: this.getPointsHoles(divisions) }; } - copy(source) { super.copy(source); this.holes = []; - for (let i = 0, l = source.holes.length; i < l; i++) { const hole = source.holes[i]; this.holes.push(hole.clone()); } - return this; } - toJSON() { const data = super.toJSON(); data.uuid = this.uuid; data.holes = []; - for (let i = 0, l = this.holes.length; i < l; i++) { const hole = this.holes[i]; data.holes.push(hole.toJSON()); } - return data; } - fromJSON(json) { super.fromJSON(json); this.uuid = json.uuid; this.holes = []; - for (let i = 0, l = json.holes.length; i < l; i++) { const hole = json.holes[i]; this.holes.push(new Path().fromJSON(hole)); } - return this; } - } /** * Port from https://github.com/mapbox/earcut (v2.2.2) */ + const Earcut = { triangulate: function (data, holeIndices, dim = 2) { const hasHoles = holeIndices && holeIndices.length; @@ -24447,12 +21650,12 @@ const Earcut = { const triangles = []; if (!outerNode || outerNode.next === outerNode.prev) return triangles; let minX, minY, maxX, maxY, x, y, invSize; - if (hasHoles) outerNode = eliminateHoles(data, holeIndices, outerNode, dim); // if the shape is not too simple, we'll use z-order curve hash later; calculate polygon bbox + if (hasHoles) outerNode = eliminateHoles(data, holeIndices, outerNode, dim); + // if the shape is not too simple, we'll use z-order curve hash later; calculate polygon bbox if (data.length > 80 * dim) { minX = maxX = data[0]; minY = maxY = data[1]; - for (let i = dim; i < outerLen; i += dim) { x = data[i]; y = data[i + 1]; @@ -24460,45 +21663,40 @@ const Earcut = { if (y < minY) minY = y; if (x > maxX) maxX = x; if (y > maxY) maxY = y; - } // minX, minY and invSize are later used to transform coords into integers for z-order calculation - + } + // minX, minY and invSize are later used to transform coords into integers for z-order calculation invSize = Math.max(maxX - minX, maxY - minY); invSize = invSize !== 0 ? 1 / invSize : 0; } - earcutLinked(outerNode, triangles, dim, minX, minY, invSize); return triangles; } -}; // create a circular doubly linked list from polygon points in the specified winding order +}; +// create a circular doubly linked list from polygon points in the specified winding order function linkedList(data, start, end, dim, clockwise) { let i, last; - if (clockwise === signedArea(data, start, end, dim) > 0) { for (i = start; i < end; i += dim) last = insertNode(i, data[i], data[i + 1], last); } else { for (i = end - dim; i >= start; i -= dim) last = insertNode(i, data[i], data[i + 1], last); } - if (last && equals(last, last.next)) { removeNode(last); last = last.next; } - return last; -} // eliminate colinear or duplicate points - +} +// eliminate colinear or duplicate points function filterPoints(start, end) { if (!start) return start; if (!end) end = start; let p = start, - again; - + again; do { again = false; - if (!p.steiner && (equals(p, p.next) || area(p.prev, p, p.next) === 0)) { removeNode(p); p = end = p.prev; @@ -24508,167 +21706,163 @@ function filterPoints(start, end) { p = p.next; } } while (again || p !== end); - return end; -} // main ear slicing loop which triangulates a polygon (given as a linked list) - +} +// main ear slicing loop which triangulates a polygon (given as a linked list) function earcutLinked(ear, triangles, dim, minX, minY, invSize, pass) { - if (!ear) return; // interlink polygon nodes in z-order + if (!ear) return; + // interlink polygon nodes in z-order if (!pass && invSize) indexCurve(ear, minX, minY, invSize); let stop = ear, - prev, - next; // iterate through ears, slicing them one by one + prev, + next; + // iterate through ears, slicing them one by one while (ear.prev !== ear.next) { prev = ear.prev; next = ear.next; - if (invSize ? isEarHashed(ear, minX, minY, invSize) : isEar(ear)) { // cut off the triangle triangles.push(prev.i / dim); triangles.push(ear.i / dim); triangles.push(next.i / dim); - removeNode(ear); // skipping the next vertex leads to less sliver triangles + removeNode(ear); + // skipping the next vertex leads to less sliver triangles ear = next.next; stop = next.next; continue; } + ear = next; - ear = next; // if we looped through the whole remaining polygon and can't find any more ears - + // if we looped through the whole remaining polygon and can't find any more ears if (ear === stop) { // try filtering points and slicing again if (!pass) { - earcutLinked(filterPoints(ear), triangles, dim, minX, minY, invSize, 1); // if this didn't work, try curing all small self-intersections locally + earcutLinked(filterPoints(ear), triangles, dim, minX, minY, invSize, 1); + + // if this didn't work, try curing all small self-intersections locally } else if (pass === 1) { ear = cureLocalIntersections(filterPoints(ear), triangles, dim); - earcutLinked(ear, triangles, dim, minX, minY, invSize, 2); // as a last resort, try splitting the remaining polygon into two + earcutLinked(ear, triangles, dim, minX, minY, invSize, 2); + + // as a last resort, try splitting the remaining polygon into two } else if (pass === 2) { splitEarcut(ear, triangles, dim, minX, minY, invSize); } - break; } } -} // check whether a polygon node forms a valid ear with adjacent nodes - +} +// check whether a polygon node forms a valid ear with adjacent nodes function isEar(ear) { const a = ear.prev, - b = ear, - c = ear.next; + b = ear, + c = ear.next; if (area(a, b, c) >= 0) return false; // reflex, can't be an ear - // now make sure we don't have other points inside the potential ear + // now make sure we don't have other points inside the potential ear let p = ear.next.next; - while (p !== ear.prev) { if (pointInTriangle(a.x, a.y, b.x, b.y, c.x, c.y, p.x, p.y) && area(p.prev, p, p.next) >= 0) return false; p = p.next; } - return true; } - function isEarHashed(ear, minX, minY, invSize) { const a = ear.prev, - b = ear, - c = ear.next; + b = ear, + c = ear.next; if (area(a, b, c) >= 0) return false; // reflex, can't be an ear - // triangle bbox; min & max are calculated like this for speed + // triangle bbox; min & max are calculated like this for speed const minTX = a.x < b.x ? a.x < c.x ? a.x : c.x : b.x < c.x ? b.x : c.x, - minTY = a.y < b.y ? a.y < c.y ? a.y : c.y : b.y < c.y ? b.y : c.y, - maxTX = a.x > b.x ? a.x > c.x ? a.x : c.x : b.x > c.x ? b.x : c.x, - maxTY = a.y > b.y ? a.y > c.y ? a.y : c.y : b.y > c.y ? b.y : c.y; // z-order range for the current triangle bbox; + minTY = a.y < b.y ? a.y < c.y ? a.y : c.y : b.y < c.y ? b.y : c.y, + maxTX = a.x > b.x ? a.x > c.x ? a.x : c.x : b.x > c.x ? b.x : c.x, + maxTY = a.y > b.y ? a.y > c.y ? a.y : c.y : b.y > c.y ? b.y : c.y; + // z-order range for the current triangle bbox; const minZ = zOrder(minTX, minTY, minX, minY, invSize), - maxZ = zOrder(maxTX, maxTY, minX, minY, invSize); + maxZ = zOrder(maxTX, maxTY, minX, minY, invSize); let p = ear.prevZ, - n = ear.nextZ; // look for points inside the triangle in both directions + n = ear.nextZ; + // look for points inside the triangle in both directions while (p && p.z >= minZ && n && n.z <= maxZ) { if (p !== ear.prev && p !== ear.next && pointInTriangle(a.x, a.y, b.x, b.y, c.x, c.y, p.x, p.y) && area(p.prev, p, p.next) >= 0) return false; p = p.prevZ; if (n !== ear.prev && n !== ear.next && pointInTriangle(a.x, a.y, b.x, b.y, c.x, c.y, n.x, n.y) && area(n.prev, n, n.next) >= 0) return false; n = n.nextZ; - } // look for remaining points in decreasing z-order - + } + // look for remaining points in decreasing z-order while (p && p.z >= minZ) { if (p !== ear.prev && p !== ear.next && pointInTriangle(a.x, a.y, b.x, b.y, c.x, c.y, p.x, p.y) && area(p.prev, p, p.next) >= 0) return false; p = p.prevZ; - } // look for remaining points in increasing z-order - + } + // look for remaining points in increasing z-order while (n && n.z <= maxZ) { if (n !== ear.prev && n !== ear.next && pointInTriangle(a.x, a.y, b.x, b.y, c.x, c.y, n.x, n.y) && area(n.prev, n, n.next) >= 0) return false; n = n.nextZ; } - return true; -} // go through all polygon nodes and cure small local self-intersections - +} +// go through all polygon nodes and cure small local self-intersections function cureLocalIntersections(start, triangles, dim) { let p = start; - do { const a = p.prev, - b = p.next.next; - + b = p.next.next; if (!equals(a, b) && intersects(a, p, p.next, b) && locallyInside(a, b) && locallyInside(b, a)) { triangles.push(a.i / dim); triangles.push(p.i / dim); - triangles.push(b.i / dim); // remove two nodes involved + triangles.push(b.i / dim); + // remove two nodes involved removeNode(p); removeNode(p.next); p = start = b; } - p = p.next; } while (p !== start); - return filterPoints(p); -} // try splitting polygon into two and triangulate them independently - +} +// try splitting polygon into two and triangulate them independently function splitEarcut(start, triangles, dim, minX, minY, invSize) { // look for a valid diagonal that divides the polygon into two let a = start; - do { let b = a.next.next; - while (b !== a.prev) { if (a.i !== b.i && isValidDiagonal(a, b)) { // split the polygon in two by the diagonal - let c = splitPolygon(a, b); // filter colinear points around the cuts + let c = splitPolygon(a, b); + // filter colinear points around the cuts a = filterPoints(a, a.next); - c = filterPoints(c, c.next); // run earcut on each half + c = filterPoints(c, c.next); + // run earcut on each half earcutLinked(a, triangles, dim, minX, minY, invSize); earcutLinked(c, triangles, dim, minX, minY, invSize); return; } - b = b.next; } - a = a.next; } while (a !== start); -} // link every hole into the outer loop, producing a single-ring polygon without holes - +} +// link every hole into the outer loop, producing a single-ring polygon without holes function eliminateHoles(data, holeIndices, outerNode, dim) { const queue = []; let i, len, start, end, list; - for (i = 0, len = holeIndices.length; i < len; i++) { start = holeIndices[i] * dim; end = i < len - 1 ? holeIndices[i + 1] * dim : data.length; @@ -24676,74 +21870,68 @@ function eliminateHoles(data, holeIndices, outerNode, dim) { if (list === list.next) list.steiner = true; queue.push(getLeftmost(list)); } + queue.sort(compareX); - queue.sort(compareX); // process holes from left to right - + // process holes from left to right for (i = 0; i < queue.length; i++) { eliminateHole(queue[i], outerNode); outerNode = filterPoints(outerNode, outerNode.next); } - return outerNode; } - function compareX(a, b) { return a.x - b.x; -} // find a bridge between vertices that connects hole with an outer ring and and link it - +} +// find a bridge between vertices that connects hole with an outer ring and and link it function eliminateHole(hole, outerNode) { outerNode = findHoleBridge(hole, outerNode); - if (outerNode) { - const b = splitPolygon(outerNode, hole); // filter collinear points around the cuts + const b = splitPolygon(outerNode, hole); + // filter collinear points around the cuts filterPoints(outerNode, outerNode.next); filterPoints(b, b.next); } -} // David Eberly's algorithm for finding a bridge between hole and outer polygon - +} +// David Eberly's algorithm for finding a bridge between hole and outer polygon function findHoleBridge(hole, outerNode) { let p = outerNode; const hx = hole.x; const hy = hole.y; let qx = -Infinity, - m; // find a segment intersected by a ray from the hole's leftmost point to the left; - // segment's endpoint with lesser x will be potential connection point + m; + // find a segment intersected by a ray from the hole's leftmost point to the left; + // segment's endpoint with lesser x will be potential connection point do { if (hy <= p.y && hy >= p.next.y && p.next.y !== p.y) { const x = p.x + (hy - p.y) * (p.next.x - p.x) / (p.next.y - p.y); - if (x <= hx && x > qx) { qx = x; - if (x === hx) { if (hy === p.y) return p; if (hy === p.next.y) return p.next; } - m = p.x < p.next.x ? p : p.next; } } - p = p.next; } while (p !== outerNode); - if (!m) return null; if (hx === qx) return m; // hole touches outer segment; pick leftmost endpoint + // look for points inside the triangle of hole point, segment intersection and endpoint; // if there are no points found, we have a valid connection; // otherwise choose the point of the minimum angle with the ray as connection point const stop = m, - mx = m.x, - my = m.y; + mx = m.x, + my = m.y; let tanMin = Infinity, - tan; + tan; p = m; - do { if (hx >= p.x && p.x >= mx && hx !== p.x && pointInTriangle(hy < my ? hx : qx, hy, mx, my, hy < my ? qx : hx, hy, p.x, p.y)) { tan = Math.abs(hy - p.y) / (hx - p.x); // tangential @@ -24753,66 +21941,57 @@ function findHoleBridge(hole, outerNode) { tanMin = tan; } } - p = p.next; } while (p !== stop); - return m; -} // whether sector in vertex m contains sector in vertex p in the same coordinates - +} +// whether sector in vertex m contains sector in vertex p in the same coordinates function sectorContainsSector(m, p) { return area(m.prev, m, p.prev) < 0 && area(p.next, m, m.next) < 0; -} // interlink polygon nodes in z-order - +} +// interlink polygon nodes in z-order function indexCurve(start, minX, minY, invSize) { let p = start; - do { if (p.z === null) p.z = zOrder(p.x, p.y, minX, minY, invSize); p.prevZ = p.prev; p.nextZ = p.next; p = p.next; } while (p !== start); - p.prevZ.nextZ = null; p.prevZ = null; sortLinked(p); -} // Simon Tatham's linked list merge sort algorithm -// http://www.chiark.greenend.org.uk/~sgtatham/algorithms/listsort.html - +} +// Simon Tatham's linked list merge sort algorithm +// http://www.chiark.greenend.org.uk/~sgtatham/algorithms/listsort.html function sortLinked(list) { let i, - p, - q, - e, - tail, - numMerges, - pSize, - qSize, - inSize = 1; - + p, + q, + e, + tail, + numMerges, + pSize, + qSize, + inSize = 1; do { p = list; list = null; tail = null; numMerges = 0; - while (p) { numMerges++; q = p; pSize = 0; - for (i = 0; i < inSize; i++) { pSize++; q = q.nextZ; if (!q) break; } - qSize = inSize; - while (pSize > 0 || qSize > 0 && q) { if (pSize !== 0 && (qSize === 0 || !q || p.z <= q.z)) { e = p; @@ -24823,23 +22002,19 @@ function sortLinked(list) { q = q.nextZ; qSize--; } - if (tail) tail.nextZ = e;else list = e; e.prevZ = tail; tail = e; } - p = q; } - tail.nextZ = null; inSize *= 2; } while (numMerges > 1); - return list; -} // z-order of a point given coords and inverse of the longer side of data bbox - +} +// z-order of a point given coords and inverse of the longer side of data bbox function zOrder(x, y, minX, minY, invSize) { // coords are transformed into non-negative 15-bit integer range x = 32767 * (x - minX) * invSize; @@ -24853,45 +22028,46 @@ function zOrder(x, y, minX, minY, invSize) { y = (y | y << 2) & 0x33333333; y = (y | y << 1) & 0x55555555; return x | y << 1; -} // find the leftmost node of a polygon ring - +} +// find the leftmost node of a polygon ring function getLeftmost(start) { let p = start, - leftmost = start; - + leftmost = start; do { if (p.x < leftmost.x || p.x === leftmost.x && p.y < leftmost.y) leftmost = p; p = p.next; } while (p !== start); - return leftmost; -} // check if a point lies within a convex triangle - +} +// check if a point lies within a convex triangle function pointInTriangle(ax, ay, bx, by, cx, cy, px, py) { return (cx - px) * (ay - py) - (ax - px) * (cy - py) >= 0 && (ax - px) * (by - py) - (bx - px) * (ay - py) >= 0 && (bx - px) * (cy - py) - (cx - px) * (by - py) >= 0; -} // check if a diagonal between two polygon nodes is valid (lies in polygon interior) - +} +// check if a diagonal between two polygon nodes is valid (lies in polygon interior) function isValidDiagonal(a, b) { - return a.next.i !== b.i && a.prev.i !== b.i && !intersectsPolygon(a, b) && ( // dones't intersect other edges - locallyInside(a, b) && locallyInside(b, a) && middleInside(a, b) && ( // locally visible - area(a.prev, a, b.prev) || area(a, b.prev, b)) || // does not create opposite-facing sectors + return a.next.i !== b.i && a.prev.i !== b.i && !intersectsPolygon(a, b) && ( + // dones't intersect other edges + locallyInside(a, b) && locallyInside(b, a) && middleInside(a, b) && ( + // locally visible + area(a.prev, a, b.prev) || area(a, b.prev, b)) || + // does not create opposite-facing sectors equals(a, b) && area(a.prev, a, a.next) > 0 && area(b.prev, b, b.next) > 0); // special zero-length case -} // signed area of a triangle - +} +// signed area of a triangle function area(p, q, r) { return (q.y - p.y) * (r.x - q.x) - (q.x - p.x) * (r.y - q.y); -} // check if two points are equal - +} +// check if two points are equal function equals(p1, p2) { return p1.x === p2.x && p1.y === p2.y; -} // check if two segments intersect - +} +// check if two segments intersect function intersects(p1, q1, p2, q2) { const o1 = sign(area(p1, q1, p2)); const o2 = sign(area(p1, q1, q2)); @@ -24900,64 +22076,56 @@ function intersects(p1, q1, p2, q2) { if (o1 !== o2 && o3 !== o4) return true; // general case if (o1 === 0 && onSegment(p1, p2, q1)) return true; // p1, q1 and p2 are collinear and p2 lies on p1q1 - if (o2 === 0 && onSegment(p1, q2, q1)) return true; // p1, q1 and q2 are collinear and q2 lies on p1q1 - if (o3 === 0 && onSegment(p2, p1, q2)) return true; // p2, q2 and p1 are collinear and p1 lies on p2q2 - if (o4 === 0 && onSegment(p2, q1, q2)) return true; // p2, q2 and q1 are collinear and q1 lies on p2q2 return false; -} // for collinear points p, q, r, check if point q lies on segment pr - +} +// for collinear points p, q, r, check if point q lies on segment pr function onSegment(p, q, r) { return q.x <= Math.max(p.x, r.x) && q.x >= Math.min(p.x, r.x) && q.y <= Math.max(p.y, r.y) && q.y >= Math.min(p.y, r.y); } - function sign(num) { return num > 0 ? 1 : num < 0 ? -1 : 0; -} // check if a polygon diagonal intersects any polygon segments - +} +// check if a polygon diagonal intersects any polygon segments function intersectsPolygon(a, b) { let p = a; - do { if (p.i !== a.i && p.next.i !== a.i && p.i !== b.i && p.next.i !== b.i && intersects(p, p.next, a, b)) return true; p = p.next; } while (p !== a); - return false; -} // check if a polygon diagonal is locally inside the polygon - +} +// check if a polygon diagonal is locally inside the polygon function locallyInside(a, b) { return area(a.prev, a, a.next) < 0 ? area(a, b, a.next) >= 0 && area(a, a.prev, b) >= 0 : area(a, b, a.prev) < 0 || area(a, a.next, b) < 0; -} // check if the middle point of a polygon diagonal is inside the polygon - +} +// check if the middle point of a polygon diagonal is inside the polygon function middleInside(a, b) { let p = a, - inside = false; + inside = false; const px = (a.x + b.x) / 2, - py = (a.y + b.y) / 2; - + py = (a.y + b.y) / 2; do { if (p.y > py !== p.next.y > py && p.next.y !== p.y && px < (p.next.x - p.x) * (py - p.y) / (p.next.y - p.y) + p.x) inside = !inside; p = p.next; } while (p !== a); - return inside; -} // link two polygon vertices with a bridge; if the vertices belong to the same ring, it splits polygon into two; -// if one belongs to the outer ring and another to a hole, it merges it into a single ring - +} +// link two polygon vertices with a bridge; if the vertices belong to the same ring, it splits polygon into two; +// if one belongs to the outer ring and another to a hole, it merges it into a single ring function splitPolygon(a, b) { const a2 = new Node(a.i, a.x, a.y), - b2 = new Node(b.i, b.x, b.y), - an = a.next, - bp = b.prev; + b2 = new Node(b.i, b.x, b.y), + an = a.next, + bp = b.prev; a.next = b; b.prev = a; a2.next = an; @@ -24967,12 +22135,11 @@ function splitPolygon(a, b) { bp.next = b2; b2.prev = bp; return b2; -} // create a node and optionally link it with previous one (in a circular doubly linked list) - +} +// create a node and optionally link it with previous one (in a circular doubly linked list) function insertNode(i, x, y, last) { const p = new Node(i, x, y); - if (!last) { p.prev = p; p.next = p; @@ -24982,102 +22149,95 @@ function insertNode(i, x, y, last) { last.next.prev = p; last.next = p; } - return p; } - function removeNode(p) { p.next.prev = p.prev; p.prev.next = p.next; if (p.prevZ) p.prevZ.nextZ = p.nextZ; if (p.nextZ) p.nextZ.prevZ = p.prevZ; } - function Node(i, x, y) { // vertex index in coordinates array - this.i = i; // vertex coordinates + this.i = i; + // vertex coordinates this.x = x; - this.y = y; // previous and next vertex nodes in a polygon ring + this.y = y; + // previous and next vertex nodes in a polygon ring this.prev = null; - this.next = null; // z-order curve value + this.next = null; - this.z = null; // previous and next nodes in z-order + // z-order curve value + this.z = null; + // previous and next nodes in z-order this.prevZ = null; - this.nextZ = null; // indicates whether this is a steiner point + this.nextZ = null; + // indicates whether this is a steiner point this.steiner = false; } - function signedArea(data, start, end, dim) { let sum = 0; - for (let i = start, j = end - dim; i < end; i += dim) { sum += (data[j] - data[i]) * (data[i + 1] + data[j + 1]); j = i; } - return sum; } class ShapeUtils { // calculate area of the contour polygon + static area(contour) { const n = contour.length; let a = 0.0; - for (let p = n - 1, q = 0; q < n; p = q++) { a += contour[p].x * contour[q].y - contour[q].x * contour[p].y; } - return a * 0.5; } - static isClockWise(pts) { return ShapeUtils.area(pts) < 0; } - static triangulateShape(contour, holes) { const vertices = []; // flat array of vertices like [ x0,y0, x1,y1, x2,y2, ... ] - const holeIndices = []; // array of hole indices - const faces = []; // final array of vertex indices like [ [ a,b,d ], [ b,c,d ] ] removeDupEndPts(contour); - addContour(vertices, contour); // + addContour(vertices, contour); + + // let holeIndex = contour.length; holes.forEach(removeDupEndPts); - for (let i = 0; i < holes.length; i++) { holeIndices.push(holeIndex); holeIndex += holes[i].length; addContour(vertices, holes[i]); - } // + } + // - const triangles = Earcut.triangulate(vertices, holeIndices); // + const triangles = Earcut.triangulate(vertices, holeIndices); + + // for (let i = 0; i < triangles.length; i += 3) { faces.push(triangles.slice(i, i + 3)); } - return faces; } - } - function removeDupEndPts(points) { const l = points.length; - if (l > 2 && points[l - 1].equals(points[0])) { points.pop(); } } - function addContour(vertices, contour) { for (let i = 0; i < contour.length; i++) { vertices.push(contour[i].x); @@ -25106,7 +22266,6 @@ function addContour(vertices, contour) { * * } */ - class ExtrudeGeometry extends BufferGeometry { constructor(shapes = new Shape([new Vector2(0.5, 0.5), new Vector2(-0.5, 0.5), new Vector2(-0.5, -0.5), new Vector2(0.5, -0.5)]), options = {}) { super(); @@ -25119,19 +22278,23 @@ class ExtrudeGeometry extends BufferGeometry { const scope = this; const verticesArray = []; const uvArray = []; - for (let i = 0, l = shapes.length; i < l; i++) { const shape = shapes[i]; addShape(shape); - } // build geometry + } + // build geometry this.setAttribute('position', new Float32BufferAttribute(verticesArray, 3)); this.setAttribute('uv', new Float32BufferAttribute(uvArray, 2)); - this.computeVertexNormals(); // functions + this.computeVertexNormals(); + + // functions function addShape(shape) { - const placeholder = []; // options + const placeholder = []; + + // options const curveSegments = options.curveSegments !== undefined ? options.curveSegments : 12; const steps = options.steps !== undefined ? options.steps : 1; @@ -25142,59 +22305,67 @@ class ExtrudeGeometry extends BufferGeometry { let bevelOffset = options.bevelOffset !== undefined ? options.bevelOffset : 0; let bevelSegments = options.bevelSegments !== undefined ? options.bevelSegments : 3; const extrudePath = options.extrudePath; - const uvgen = options.UVGenerator !== undefined ? options.UVGenerator : WorldUVGenerator; // deprecated options + const uvgen = options.UVGenerator !== undefined ? options.UVGenerator : WorldUVGenerator; + + // deprecated options if (options.amount !== undefined) { console.warn('THREE.ExtrudeBufferGeometry: amount has been renamed to depth.'); depth = options.amount; - } // + } + // let extrudePts, - extrudeByPath = false; + extrudeByPath = false; let splineTube, binormal, normal, position2; - if (extrudePath) { extrudePts = extrudePath.getSpacedPoints(steps); extrudeByPath = true; bevelEnabled = false; // bevels not supported for path extrusion + // SETUP TNB variables + // TODO1 - have a .isClosed in spline? - splineTube = extrudePath.computeFrenetFrames(steps, false); // console.log(splineTube, 'splineTube', splineTube.normals.length, 'steps', steps, 'extrudePts', extrudePts.length); + splineTube = extrudePath.computeFrenetFrames(steps, false); + + // console.log(splineTube, 'splineTube', splineTube.normals.length, 'steps', steps, 'extrudePts', extrudePts.length); binormal = new Vector3(); normal = new Vector3(); position2 = new Vector3(); - } // Safeguards if bevels are not enabled + } + // Safeguards if bevels are not enabled if (!bevelEnabled) { bevelSegments = 0; bevelThickness = 0; bevelSize = 0; bevelOffset = 0; - } // Variables initialization + } + // Variables initialization const shapePoints = shape.extractPoints(curveSegments); let vertices = shapePoints.shape; const holes = shapePoints.holes; const reverse = !ShapeUtils.isClockWise(vertices); - if (reverse) { - vertices = vertices.reverse(); // Maybe we should also check if holes are in the opposite direction, just to be safe ... + vertices = vertices.reverse(); + + // Maybe we should also check if holes are in the opposite direction, just to be safe ... for (let h = 0, hl = holes.length; h < hl; h++) { const ahole = holes[h]; - if (ShapeUtils.isClockWise(ahole)) { holes[h] = ahole.reverse(); } } } - const faces = ShapeUtils.triangulateShape(vertices, holes); + /* Vertices */ const contour = vertices; // vertices has all points but contour has only points of circumference @@ -25203,14 +22374,14 @@ class ExtrudeGeometry extends BufferGeometry { const ahole = holes[h]; vertices = vertices.concat(ahole); } - function scalePt2(pt, vec, size) { if (!vec) console.error('THREE.ExtrudeGeometry: vec does not exist'); return vec.clone().multiplyScalar(size).add(pt); } - const vlen = vertices.length, - flen = faces.length; // Find directions for point movement + flen = faces.length; + + // Find directions for point movement function getBevelVec(inPt, inPrev, inNext) { // computes for inPt the corresponding point inPt' on a new contour @@ -25219,37 +22390,47 @@ class ExtrudeGeometry extends BufferGeometry { // // inPt' is the intersection of the two lines parallel to the two // adjacent edges of inPt at a distance of 1 unit on the left side. + let v_trans_x, v_trans_y, shrink_by; // resulting translation vector for inPt + // good reading for geometry algorithms (here: line-line intersection) // http://geomalgorithms.com/a05-_intersect-1.html const v_prev_x = inPt.x - inPrev.x, - v_prev_y = inPt.y - inPrev.y; + v_prev_y = inPt.y - inPrev.y; const v_next_x = inNext.x - inPt.x, - v_next_y = inNext.y - inPt.y; - const v_prev_lensq = v_prev_x * v_prev_x + v_prev_y * v_prev_y; // check for collinear edges + v_next_y = inNext.y - inPt.y; + const v_prev_lensq = v_prev_x * v_prev_x + v_prev_y * v_prev_y; + // check for collinear edges const collinear0 = v_prev_x * v_next_y - v_prev_y * v_next_x; - if (Math.abs(collinear0) > Number.EPSILON) { // not collinear + // length of vectors for normalizing + const v_prev_len = Math.sqrt(v_prev_lensq); - const v_next_len = Math.sqrt(v_next_x * v_next_x + v_next_y * v_next_y); // shift adjacent points by unit vectors to the left + const v_next_len = Math.sqrt(v_next_x * v_next_x + v_next_y * v_next_y); + + // shift adjacent points by unit vectors to the left const ptPrevShift_x = inPrev.x - v_prev_y / v_prev_len; const ptPrevShift_y = inPrev.y + v_prev_x / v_prev_len; const ptNextShift_x = inNext.x - v_next_y / v_next_len; - const ptNextShift_y = inNext.y + v_next_x / v_next_len; // scaling factor for v_prev to intersection point + const ptNextShift_y = inNext.y + v_next_x / v_next_len; + + // scaling factor for v_prev to intersection point - const sf = ((ptNextShift_x - ptPrevShift_x) * v_next_y - (ptNextShift_y - ptPrevShift_y) * v_next_x) / (v_prev_x * v_next_y - v_prev_y * v_next_x); // vector from inPt to intersection point + const sf = ((ptNextShift_x - ptPrevShift_x) * v_next_y - (ptNextShift_y - ptPrevShift_y) * v_next_x) / (v_prev_x * v_next_y - v_prev_y * v_next_x); + + // vector from inPt to intersection point v_trans_x = ptPrevShift_x + v_prev_x * sf - inPt.x; - v_trans_y = ptPrevShift_y + v_prev_y * sf - inPt.y; // Don't normalize!, otherwise sharp corners become ugly - // but prevent crazy spikes + v_trans_y = ptPrevShift_y + v_prev_y * sf - inPt.y; + // Don't normalize!, otherwise sharp corners become ugly + // but prevent crazy spikes const v_trans_lensq = v_trans_x * v_trans_x + v_trans_y * v_trans_y; - if (v_trans_lensq <= 2) { return new Vector2(v_trans_x, v_trans_y); } else { @@ -25257,6 +22438,7 @@ class ExtrudeGeometry extends BufferGeometry { } } else { // handle special case of collinear edges + let direction_eq = false; // assumes: opposite if (v_prev_x > Number.EPSILON) { @@ -25274,7 +22456,6 @@ class ExtrudeGeometry extends BufferGeometry { } } } - if (direction_eq) { // console.log("Warning: lines are a straight sequence"); v_trans_x = -v_prev_y; @@ -25287,117 +22468,121 @@ class ExtrudeGeometry extends BufferGeometry { shrink_by = Math.sqrt(v_prev_lensq / 2); } } - return new Vector2(v_trans_x / shrink_by, v_trans_y / shrink_by); } - const contourMovements = []; - for (let i = 0, il = contour.length, j = il - 1, k = i + 1; i < il; i++, j++, k++) { if (j === il) j = 0; - if (k === il) k = 0; // (j)---(i)---(k) + if (k === il) k = 0; + + // (j)---(i)---(k) // console.log('i,j,k', i, j , k) contourMovements[i] = getBevelVec(contour[i], contour[j], contour[k]); } - const holesMovements = []; let oneHoleMovements, - verticesMovements = contourMovements.concat(); - + verticesMovements = contourMovements.concat(); for (let h = 0, hl = holes.length; h < hl; h++) { const ahole = holes[h]; oneHoleMovements = []; - for (let i = 0, il = ahole.length, j = il - 1, k = i + 1; i < il; i++, j++, k++) { if (j === il) j = 0; - if (k === il) k = 0; // (j)---(i)---(k) + if (k === il) k = 0; + // (j)---(i)---(k) oneHoleMovements[i] = getBevelVec(ahole[i], ahole[j], ahole[k]); } - holesMovements.push(oneHoleMovements); verticesMovements = verticesMovements.concat(oneHoleMovements); - } // Loop bevelSegments, 1 for the front, 1 for the back + } + // Loop bevelSegments, 1 for the front, 1 for the back for (let b = 0; b < bevelSegments; b++) { //for ( b = bevelSegments; b > 0; b -- ) { + const t = b / bevelSegments; const z = bevelThickness * Math.cos(t * Math.PI / 2); - const bs = bevelSize * Math.sin(t * Math.PI / 2) + bevelOffset; // contract shape + const bs = bevelSize * Math.sin(t * Math.PI / 2) + bevelOffset; + + // contract shape for (let i = 0, il = contour.length; i < il; i++) { const vert = scalePt2(contour[i], contourMovements[i], bs); v(vert.x, vert.y, -z); - } // expand holes + } + // expand holes for (let h = 0, hl = holes.length; h < hl; h++) { const ahole = holes[h]; oneHoleMovements = holesMovements[h]; - for (let i = 0, il = ahole.length; i < il; i++) { const vert = scalePt2(ahole[i], oneHoleMovements[i], bs); v(vert.x, vert.y, -z); } } } + const bs = bevelSize + bevelOffset; - const bs = bevelSize + bevelOffset; // Back facing vertices + // Back facing vertices for (let i = 0; i < vlen; i++) { const vert = bevelEnabled ? scalePt2(vertices[i], verticesMovements[i], bs) : vertices[i]; - if (!extrudeByPath) { v(vert.x, vert.y, 0); } else { // v( vert.x, vert.y + extrudePts[ 0 ].y, extrudePts[ 0 ].x ); + normal.copy(splineTube.normals[0]).multiplyScalar(vert.x); binormal.copy(splineTube.binormals[0]).multiplyScalar(vert.y); position2.copy(extrudePts[0]).add(normal).add(binormal); v(position2.x, position2.y, position2.z); } - } // Add stepped vertices... - // Including front facing vertices + } + // Add stepped vertices... + // Including front facing vertices for (let s = 1; s <= steps; s++) { for (let i = 0; i < vlen; i++) { const vert = bevelEnabled ? scalePt2(vertices[i], verticesMovements[i], bs) : vertices[i]; - if (!extrudeByPath) { v(vert.x, vert.y, depth / steps * s); } else { // v( vert.x, vert.y + extrudePts[ s - 1 ].y, extrudePts[ s - 1 ].x ); + normal.copy(splineTube.normals[s]).multiplyScalar(vert.x); binormal.copy(splineTube.binormals[s]).multiplyScalar(vert.y); position2.copy(extrudePts[s]).add(normal).add(binormal); v(position2.x, position2.y, position2.z); } } - } // Add bevel segments planes - //for ( b = 1; b <= bevelSegments; b ++ ) { + } + // Add bevel segments planes + //for ( b = 1; b <= bevelSegments; b ++ ) { for (let b = bevelSegments - 1; b >= 0; b--) { const t = b / bevelSegments; const z = bevelThickness * Math.cos(t * Math.PI / 2); - const bs = bevelSize * Math.sin(t * Math.PI / 2) + bevelOffset; // contract shape + const bs = bevelSize * Math.sin(t * Math.PI / 2) + bevelOffset; + + // contract shape for (let i = 0, il = contour.length; i < il; i++) { const vert = scalePt2(contour[i], contourMovements[i], bs); v(vert.x, vert.y, depth + z); - } // expand holes + } + // expand holes for (let h = 0, hl = holes.length; h < hl; h++) { const ahole = holes[h]; oneHoleMovements = holesMovements[h]; - for (let i = 0, il = ahole.length; i < il; i++) { const vert = scalePt2(ahole[i], oneHoleMovements[i], bs); - if (!extrudeByPath) { v(vert.x, vert.y, depth + z); } else { @@ -25406,29 +22591,35 @@ class ExtrudeGeometry extends BufferGeometry { } } } + /* Faces */ + // Top and bottom faces + buildLidFaces(); + + // Sides faces - buildLidFaces(); // Sides faces + buildSideFaces(); - buildSideFaces(); ///// Internal functions + ///// Internal functions function buildLidFaces() { const start = verticesArray.length / 3; - if (bevelEnabled) { let layer = 0; // steps + 1 + let offset = vlen * layer; - let offset = vlen * layer; // Bottom faces + // Bottom faces for (let i = 0; i < flen; i++) { const face = faces[i]; f3(face[2] + offset, face[1] + offset, face[0] + offset); } - layer = steps + bevelSegments * 2; - offset = vlen * layer; // Top faces + offset = vlen * layer; + + // Top faces for (let i = 0; i < flen; i++) { const face = faces[i]; @@ -25436,64 +22627,63 @@ class ExtrudeGeometry extends BufferGeometry { } } else { // Bottom faces + for (let i = 0; i < flen; i++) { const face = faces[i]; f3(face[2], face[1], face[0]); - } // Top faces + } + // Top faces for (let i = 0; i < flen; i++) { const face = faces[i]; f3(face[0] + vlen * steps, face[1] + vlen * steps, face[2] + vlen * steps); } } - scope.addGroup(start, verticesArray.length / 3 - start, 0); - } // Create faces for the z-sides of the shape + } + // Create faces for the z-sides of the shape function buildSideFaces() { const start = verticesArray.length / 3; let layeroffset = 0; sidewalls(contour, layeroffset); layeroffset += contour.length; - for (let h = 0, hl = holes.length; h < hl; h++) { const ahole = holes[h]; - sidewalls(ahole, layeroffset); //, true + sidewalls(ahole, layeroffset); + //, true layeroffset += ahole.length; } - scope.addGroup(start, verticesArray.length / 3 - start, 1); } - function sidewalls(contour, layeroffset) { let i = contour.length; - while (--i >= 0) { const j = i; let k = i - 1; - if (k < 0) k = contour.length - 1; //console.log('b', i,j, i-1, k,vertices.length); + if (k < 0) k = contour.length - 1; + + //console.log('b', i,j, i-1, k,vertices.length); for (let s = 0, sl = steps + bevelSegments * 2; s < sl; s++) { const slen1 = vlen * s; const slen2 = vlen * (s + 1); const a = layeroffset + j + slen1, - b = layeroffset + k + slen1, - c = layeroffset + k + slen2, - d = layeroffset + j + slen2; + b = layeroffset + k + slen1, + c = layeroffset + k + slen2, + d = layeroffset + j + slen2; f4(a, b, c, d); } } } - function v(x, y, z) { placeholder.push(x); placeholder.push(y); placeholder.push(z); } - function f3(a, b, c) { addVertex(a); addVertex(b); @@ -25504,7 +22694,6 @@ class ExtrudeGeometry extends BufferGeometry { addUV(uvs[1]); addUV(uvs[2]); } - function f4(a, b, c, d) { addVertex(a); addVertex(b); @@ -25521,46 +22710,36 @@ class ExtrudeGeometry extends BufferGeometry { addUV(uvs[2]); addUV(uvs[3]); } - function addVertex(index) { verticesArray.push(placeholder[index * 3 + 0]); verticesArray.push(placeholder[index * 3 + 1]); verticesArray.push(placeholder[index * 3 + 2]); } - function addUV(vector2) { uvArray.push(vector2.x); uvArray.push(vector2.y); } } } - toJSON() { const data = super.toJSON(); const shapes = this.parameters.shapes; const options = this.parameters.options; return toJSON$1(shapes, options, data); } - static fromJSON(data, shapes) { const geometryShapes = []; - for (let j = 0, jl = data.shapes.length; j < jl; j++) { const shape = shapes[data.shapes[j]]; geometryShapes.push(shape); } - const extrudePath = data.options.extrudePath; - if (extrudePath !== undefined) { data.options.extrudePath = new Curves[extrudePath.type]().fromJSON(extrudePath); } - return new ExtrudeGeometry(geometryShapes, data.options); } - } - const WorldUVGenerator = { generateTopUV: function (geometry, vertices, indexA, indexB, indexC) { const a_x = vertices[indexA * 3]; @@ -25584,7 +22763,6 @@ const WorldUVGenerator = { const d_x = vertices[indexD * 3]; const d_y = vertices[indexD * 3 + 1]; const d_z = vertices[indexD * 3 + 2]; - if (Math.abs(a_y - b_y) < Math.abs(a_x - b_x)) { return [new Vector2(a_x, 1 - a_z), new Vector2(b_x, 1 - b_z), new Vector2(c_x, 1 - c_z), new Vector2(d_x, 1 - d_z)]; } else { @@ -25592,10 +22770,8 @@ const WorldUVGenerator = { } } }; - function toJSON$1(shapes, options, data) { data.shapes = []; - if (Array.isArray(shapes)) { for (let i = 0, l = shapes.length; i < l; i++) { const shape = shapes[i]; @@ -25604,7 +22780,6 @@ function toJSON$1(shapes, options, data) { } else { data.shapes.push(shapes.uuid); } - if (options.extrudePath !== undefined) data.options.extrudePath = options.extrudePath.toJSON(); return data; } @@ -25621,11 +22796,9 @@ class IcosahedronGeometry extends PolyhedronGeometry { detail: detail }; } - static fromJSON(data) { return new IcosahedronGeometry(data.radius, data.detail); } - } class LatheGeometry extends BufferGeometry { @@ -25638,15 +22811,21 @@ class LatheGeometry extends BufferGeometry { phiStart: phiStart, phiLength: phiLength }; - segments = Math.floor(segments); // clamp phiLength so it's in range of [ 0, 2PI ] + segments = Math.floor(segments); - phiLength = clamp(phiLength, 0, Math.PI * 2); // buffers + // clamp phiLength so it's in range of [ 0, 2PI ] + + phiLength = clamp(phiLength, 0, Math.PI * 2); + + // buffers const indices = []; const vertices = []; const uvs = []; const initNormals = []; - const normals = []; // helper variables + const normals = []; + + // helper variables const inverseSegments = 1.0 / segments; const vertex = new Vector3(); @@ -25655,12 +22834,15 @@ class LatheGeometry extends BufferGeometry { const curNormal = new Vector3(); const prevNormal = new Vector3(); let dx = 0; - let dy = 0; // pre-compute normals for initial "meridian" + let dy = 0; + + // pre-compute normals for initial "meridian" for (let j = 0; j <= points.length - 1; j++) { switch (j) { case 0: // special handling for 1st vertex on path + dx = points[j + 1].x - points[j].x; dy = points[j + 1].y - points[j].y; normal.x = dy * 1.0; @@ -25670,14 +22852,14 @@ class LatheGeometry extends BufferGeometry { normal.normalize(); initNormals.push(normal.x, normal.y, normal.z); break; - case points.length - 1: // special handling for last Vertex on path + initNormals.push(prevNormal.x, prevNormal.y, prevNormal.z); break; - default: // default handling for all vertices in between + dx = points[j + 1].x - points[j].x; dy = points[j + 1].y - points[j].y; normal.x = dy * 1.0; @@ -25691,32 +22873,38 @@ class LatheGeometry extends BufferGeometry { initNormals.push(normal.x, normal.y, normal.z); prevNormal.copy(curNormal); } - } // generate vertices, uvs and normals + } + // generate vertices, uvs and normals for (let i = 0; i <= segments; i++) { const phi = phiStart + i * inverseSegments * phiLength; const sin = Math.sin(phi); const cos = Math.cos(phi); - for (let j = 0; j <= points.length - 1; j++) { // vertex + vertex.x = points[j].x * sin; vertex.y = points[j].y; vertex.z = points[j].x * cos; - vertices.push(vertex.x, vertex.y, vertex.z); // uv + vertices.push(vertex.x, vertex.y, vertex.z); + + // uv uv.x = i / segments; uv.y = j / (points.length - 1); - uvs.push(uv.x, uv.y); // normal + uvs.push(uv.x, uv.y); + + // normal const x = initNormals[3 * j + 0] * sin; const y = initNormals[3 * j + 1]; const z = initNormals[3 * j + 0] * cos; normals.push(x, y, z); } - } // indices + } + // indices for (let i = 0; i < segments; i++) { for (let j = 0; j < points.length - 1; j++) { @@ -25724,24 +22912,25 @@ class LatheGeometry extends BufferGeometry { const a = base; const b = base + points.length; const c = base + points.length + 1; - const d = base + 1; // faces + const d = base + 1; + + // faces indices.push(a, b, d); indices.push(c, d, b); } - } // build geometry + } + // build geometry this.setIndex(indices); this.setAttribute('position', new Float32BufferAttribute(vertices, 3)); this.setAttribute('uv', new Float32BufferAttribute(uvs, 2)); this.setAttribute('normal', new Float32BufferAttribute(normals, 3)); } - static fromJSON(data) { return new LatheGeometry(data.points, data.segments, data.phiStart, data.phiLength); } - } class OctahedronGeometry extends PolyhedronGeometry { @@ -25755,11 +22944,9 @@ class OctahedronGeometry extends PolyhedronGeometry { detail: detail }; } - static fromJSON(data) { return new OctahedronGeometry(data.radius, data.detail); } - } class RingGeometry extends BufferGeometry { @@ -25775,65 +22962,80 @@ class RingGeometry extends BufferGeometry { thetaLength: thetaLength }; thetaSegments = Math.max(3, thetaSegments); - phiSegments = Math.max(1, phiSegments); // buffers + phiSegments = Math.max(1, phiSegments); + + // buffers const indices = []; const vertices = []; const normals = []; - const uvs = []; // some helper variables + const uvs = []; + + // some helper variables let radius = innerRadius; const radiusStep = (outerRadius - innerRadius) / phiSegments; const vertex = new Vector3(); - const uv = new Vector2(); // generate vertices, normals and uvs + const uv = new Vector2(); + + // generate vertices, normals and uvs for (let j = 0; j <= phiSegments; j++) { for (let i = 0; i <= thetaSegments; i++) { // values are generate from the inside of the ring to the outside - const segment = thetaStart + i / thetaSegments * thetaLength; // vertex + + const segment = thetaStart + i / thetaSegments * thetaLength; + + // vertex vertex.x = radius * Math.cos(segment); vertex.y = radius * Math.sin(segment); - vertices.push(vertex.x, vertex.y, vertex.z); // normal + vertices.push(vertex.x, vertex.y, vertex.z); + + // normal + + normals.push(0, 0, 1); - normals.push(0, 0, 1); // uv + // uv uv.x = (vertex.x / outerRadius + 1) / 2; uv.y = (vertex.y / outerRadius + 1) / 2; uvs.push(uv.x, uv.y); - } // increase the radius for next row of vertices + } + // increase the radius for next row of vertices radius += radiusStep; - } // indices + } + // indices for (let j = 0; j < phiSegments; j++) { const thetaSegmentLevel = j * (thetaSegments + 1); - for (let i = 0; i < thetaSegments; i++) { const segment = i + thetaSegmentLevel; const a = segment; const b = segment + thetaSegments + 1; const c = segment + thetaSegments + 2; - const d = segment + 1; // faces + const d = segment + 1; + + // faces indices.push(a, b, d); indices.push(b, c, d); } - } // build geometry + } + // build geometry this.setIndex(indices); this.setAttribute('position', new Float32BufferAttribute(vertices, 3)); this.setAttribute('normal', new Float32BufferAttribute(normals, 3)); this.setAttribute('uv', new Float32BufferAttribute(uvs, 2)); } - static fromJSON(data) { return new RingGeometry(data.innerRadius, data.outerRadius, data.thetaSegments, data.phiSegments, data.thetaStart, data.thetaLength); } - } class ShapeGeometry extends BufferGeometry { @@ -25843,15 +23045,21 @@ class ShapeGeometry extends BufferGeometry { this.parameters = { shapes: shapes, curveSegments: curveSegments - }; // buffers + }; + + // buffers const indices = []; const vertices = []; const normals = []; - const uvs = []; // helper variables + const uvs = []; + + // helper variables let groupStart = 0; - let groupCount = 0; // allow single and array values for "shapes" parameter + let groupCount = 0; + + // allow single and array values for "shapes" parameter if (Array.isArray(shapes) === false) { addShape(shapes); @@ -25863,47 +23071,53 @@ class ShapeGeometry extends BufferGeometry { groupStart += groupCount; groupCount = 0; } - } // build geometry + } + // build geometry this.setIndex(indices); this.setAttribute('position', new Float32BufferAttribute(vertices, 3)); this.setAttribute('normal', new Float32BufferAttribute(normals, 3)); - this.setAttribute('uv', new Float32BufferAttribute(uvs, 2)); // helper functions + this.setAttribute('uv', new Float32BufferAttribute(uvs, 2)); + + // helper functions function addShape(shape) { const indexOffset = vertices.length / 3; const points = shape.extractPoints(curveSegments); let shapeVertices = points.shape; - const shapeHoles = points.holes; // check direction of vertices + const shapeHoles = points.holes; + + // check direction of vertices if (ShapeUtils.isClockWise(shapeVertices) === false) { shapeVertices = shapeVertices.reverse(); } - for (let i = 0, l = shapeHoles.length; i < l; i++) { const shapeHole = shapeHoles[i]; - if (ShapeUtils.isClockWise(shapeHole) === true) { shapeHoles[i] = shapeHole.reverse(); } } + const faces = ShapeUtils.triangulateShape(shapeVertices, shapeHoles); - const faces = ShapeUtils.triangulateShape(shapeVertices, shapeHoles); // join vertices of inner and outer paths to a single array + // join vertices of inner and outer paths to a single array for (let i = 0, l = shapeHoles.length; i < l; i++) { const shapeHole = shapeHoles[i]; shapeVertices = shapeVertices.concat(shapeHole); - } // vertices, normals, uvs + } + // vertices, normals, uvs for (let i = 0, l = shapeVertices.length; i < l; i++) { const vertex = shapeVertices[i]; vertices.push(vertex.x, vertex.y, 0); normals.push(0, 0, 1); uvs.push(vertex.x, vertex.y); // world uvs - } // incides + } + // incides for (let i = 0, l = faces.length; i < l; i++) { const face = faces[i]; @@ -25915,29 +23129,22 @@ class ShapeGeometry extends BufferGeometry { } } } - toJSON() { const data = super.toJSON(); const shapes = this.parameters.shapes; return toJSON(shapes, data); } - static fromJSON(data, shapes) { const geometryShapes = []; - for (let j = 0, jl = data.shapes.length; j < jl; j++) { const shape = shapes[data.shapes[j]]; geometryShapes.push(shape); } - return new ShapeGeometry(geometryShapes, data.curveSegments); } - } - function toJSON(shapes, data) { data.shapes = []; - if (Array.isArray(shapes)) { for (let i = 0, l = shapes.length; i < l; i++) { const shape = shapes[i]; @@ -25946,7 +23153,6 @@ function toJSON(shapes, data) { } else { data.shapes.push(shapes.uuid); } - return data; } @@ -25969,43 +23175,53 @@ class SphereGeometry extends BufferGeometry { let index = 0; const grid = []; const vertex = new Vector3(); - const normal = new Vector3(); // buffers + const normal = new Vector3(); + + // buffers const indices = []; const vertices = []; const normals = []; - const uvs = []; // generate vertices, normals and uvs + const uvs = []; + + // generate vertices, normals and uvs for (let iy = 0; iy <= heightSegments; iy++) { const verticesRow = []; - const v = iy / heightSegments; // special case for the poles + const v = iy / heightSegments; - let uOffset = 0; + // special case for the poles + let uOffset = 0; if (iy == 0 && thetaStart == 0) { uOffset = 0.5 / widthSegments; } else if (iy == heightSegments && thetaEnd == Math.PI) { uOffset = -0.5 / widthSegments; } - for (let ix = 0; ix <= widthSegments; ix++) { - const u = ix / widthSegments; // vertex + const u = ix / widthSegments; + + // vertex vertex.x = -radius * Math.cos(phiStart + u * phiLength) * Math.sin(thetaStart + v * thetaLength); vertex.y = radius * Math.cos(thetaStart + v * thetaLength); vertex.z = radius * Math.sin(phiStart + u * phiLength) * Math.sin(thetaStart + v * thetaLength); - vertices.push(vertex.x, vertex.y, vertex.z); // normal + vertices.push(vertex.x, vertex.y, vertex.z); + + // normal normal.copy(vertex).normalize(); - normals.push(normal.x, normal.y, normal.z); // uv + normals.push(normal.x, normal.y, normal.z); + + // uv uvs.push(u + uOffset, 1 - v); verticesRow.push(index++); } - grid.push(verticesRow); - } // indices + } + // indices for (let iy = 0; iy < heightSegments; iy++) { for (let ix = 0; ix < widthSegments; ix++) { @@ -26016,19 +23232,18 @@ class SphereGeometry extends BufferGeometry { if (iy !== 0 || thetaStart > 0) indices.push(a, b, d); if (iy !== heightSegments - 1 || thetaEnd < Math.PI) indices.push(b, c, d); } - } // build geometry + } + // build geometry this.setIndex(indices); this.setAttribute('position', new Float32BufferAttribute(vertices, 3)); this.setAttribute('normal', new Float32BufferAttribute(normals, 3)); this.setAttribute('uv', new Float32BufferAttribute(uvs, 2)); } - static fromJSON(data) { return new SphereGeometry(data.radius, data.widthSegments, data.heightSegments, data.phiStart, data.phiLength, data.thetaStart, data.thetaLength); } - } class TetrahedronGeometry extends PolyhedronGeometry { @@ -26042,11 +23257,9 @@ class TetrahedronGeometry extends PolyhedronGeometry { detail: detail }; } - static fromJSON(data) { return new TetrahedronGeometry(data.radius, data.detail); } - } class TorusGeometry extends BufferGeometry { @@ -26061,62 +23274,77 @@ class TorusGeometry extends BufferGeometry { arc: arc }; radialSegments = Math.floor(radialSegments); - tubularSegments = Math.floor(tubularSegments); // buffers + tubularSegments = Math.floor(tubularSegments); + + // buffers const indices = []; const vertices = []; const normals = []; - const uvs = []; // helper variables + const uvs = []; + + // helper variables const center = new Vector3(); const vertex = new Vector3(); - const normal = new Vector3(); // generate vertices, normals and uvs + const normal = new Vector3(); + + // generate vertices, normals and uvs for (let j = 0; j <= radialSegments; j++) { for (let i = 0; i <= tubularSegments; i++) { const u = i / tubularSegments * arc; - const v = j / radialSegments * Math.PI * 2; // vertex + const v = j / radialSegments * Math.PI * 2; + + // vertex vertex.x = (radius + tube * Math.cos(v)) * Math.cos(u); vertex.y = (radius + tube * Math.cos(v)) * Math.sin(u); vertex.z = tube * Math.sin(v); - vertices.push(vertex.x, vertex.y, vertex.z); // normal + vertices.push(vertex.x, vertex.y, vertex.z); + + // normal center.x = radius * Math.cos(u); center.y = radius * Math.sin(u); normal.subVectors(vertex, center).normalize(); - normals.push(normal.x, normal.y, normal.z); // uv + normals.push(normal.x, normal.y, normal.z); + + // uv uvs.push(i / tubularSegments); uvs.push(j / radialSegments); } - } // generate indices + } + // generate indices for (let j = 1; j <= radialSegments; j++) { for (let i = 1; i <= tubularSegments; i++) { // indices + const a = (tubularSegments + 1) * j + i - 1; const b = (tubularSegments + 1) * (j - 1) + i - 1; const c = (tubularSegments + 1) * (j - 1) + i; - const d = (tubularSegments + 1) * j + i; // faces + const d = (tubularSegments + 1) * j + i; + + // faces indices.push(a, b, d); indices.push(b, c, d); } - } // build geometry + } + // build geometry this.setIndex(indices); this.setAttribute('position', new Float32BufferAttribute(vertices, 3)); this.setAttribute('normal', new Float32BufferAttribute(normals, 3)); this.setAttribute('uv', new Float32BufferAttribute(uvs, 2)); } - static fromJSON(data) { return new TorusGeometry(data.radius, data.tube, data.radialSegments, data.tubularSegments, data.arc); } - } class TorusKnotGeometry extends BufferGeometry { @@ -26132,12 +23360,16 @@ class TorusKnotGeometry extends BufferGeometry { q: q }; tubularSegments = Math.floor(tubularSegments); - radialSegments = Math.floor(radialSegments); // buffers + radialSegments = Math.floor(radialSegments); + + // buffers const indices = []; const vertices = []; const normals = []; - const uvs = []; // helper variables + const uvs = []; + + // helper variables const vertex = new Vector3(); const normal = new Vector3(); @@ -26145,64 +23377,86 @@ class TorusKnotGeometry extends BufferGeometry { const P2 = new Vector3(); const B = new Vector3(); const T = new Vector3(); - const N = new Vector3(); // generate vertices, normals and uvs + const N = new Vector3(); + + // generate vertices, normals and uvs for (let i = 0; i <= tubularSegments; ++i) { // the radian "u" is used to calculate the position on the torus curve of the current tubular segement - const u = i / tubularSegments * p * Math.PI * 2; // now we calculate two points. P1 is our current position on the curve, P2 is a little farther ahead. + + const u = i / tubularSegments * p * Math.PI * 2; + + // now we calculate two points. P1 is our current position on the curve, P2 is a little farther ahead. // these points are used to create a special "coordinate space", which is necessary to calculate the correct vertex positions calculatePositionOnCurve(u, p, q, radius, P1); - calculatePositionOnCurve(u + 0.01, p, q, radius, P2); // calculate orthonormal basis + calculatePositionOnCurve(u + 0.01, p, q, radius, P2); + + // calculate orthonormal basis T.subVectors(P2, P1); N.addVectors(P2, P1); B.crossVectors(T, N); - N.crossVectors(B, T); // normalize B, N. T can be ignored, we don't use it + N.crossVectors(B, T); + + // normalize B, N. T can be ignored, we don't use it B.normalize(); N.normalize(); - for (let j = 0; j <= radialSegments; ++j) { // now calculate the vertices. they are nothing more than an extrusion of the torus curve. // because we extrude a shape in the xy-plane, there is no need to calculate a z-value. + const v = j / radialSegments * Math.PI * 2; const cx = -tube * Math.cos(v); - const cy = tube * Math.sin(v); // now calculate the final vertex position. + const cy = tube * Math.sin(v); + + // now calculate the final vertex position. // first we orient the extrusion with our basis vectos, then we add it to the current position on the curve vertex.x = P1.x + (cx * N.x + cy * B.x); vertex.y = P1.y + (cx * N.y + cy * B.y); vertex.z = P1.z + (cx * N.z + cy * B.z); - vertices.push(vertex.x, vertex.y, vertex.z); // normal (P1 is always the center/origin of the extrusion, thus we can use it to calculate the normal) + vertices.push(vertex.x, vertex.y, vertex.z); + + // normal (P1 is always the center/origin of the extrusion, thus we can use it to calculate the normal) normal.subVectors(vertex, P1).normalize(); - normals.push(normal.x, normal.y, normal.z); // uv + normals.push(normal.x, normal.y, normal.z); + + // uv uvs.push(i / tubularSegments); uvs.push(j / radialSegments); } - } // generate indices + } + // generate indices for (let j = 1; j <= tubularSegments; j++) { for (let i = 1; i <= radialSegments; i++) { // indices + const a = (radialSegments + 1) * (j - 1) + (i - 1); const b = (radialSegments + 1) * j + (i - 1); const c = (radialSegments + 1) * j + i; - const d = (radialSegments + 1) * (j - 1) + i; // faces + const d = (radialSegments + 1) * (j - 1) + i; + + // faces indices.push(a, b, d); indices.push(b, c, d); } - } // build geometry + } + // build geometry this.setIndex(indices); this.setAttribute('position', new Float32BufferAttribute(vertices, 3)); this.setAttribute('normal', new Float32BufferAttribute(normals, 3)); - this.setAttribute('uv', new Float32BufferAttribute(uvs, 2)); // this function calculates the current position on the torus curve + this.setAttribute('uv', new Float32BufferAttribute(uvs, 2)); + + // this function calculates the current position on the torus curve function calculatePositionOnCurve(u, p, q, radius, position) { const cu = Math.cos(u); @@ -26214,11 +23468,9 @@ class TorusKnotGeometry extends BufferGeometry { position.z = radius * Math.sin(quOverP) * 0.5; } } - static fromJSON(data) { return new TorusKnotGeometry(data.radius, data.tube, data.tubularSegments, data.radialSegments, data.p, data.q); } - } class TubeGeometry extends BufferGeometry { @@ -26232,63 +23484,88 @@ class TubeGeometry extends BufferGeometry { radialSegments: radialSegments, closed: closed }; - const frames = path.computeFrenetFrames(tubularSegments, closed); // expose internals + const frames = path.computeFrenetFrames(tubularSegments, closed); + + // expose internals this.tangents = frames.tangents; this.normals = frames.normals; - this.binormals = frames.binormals; // helper variables + this.binormals = frames.binormals; + + // helper variables const vertex = new Vector3(); const normal = new Vector3(); const uv = new Vector2(); - let P = new Vector3(); // buffer + let P = new Vector3(); + + // buffer const vertices = []; const normals = []; const uvs = []; - const indices = []; // create buffer data + const indices = []; - generateBufferData(); // build geometry + // create buffer data + + generateBufferData(); + + // build geometry this.setIndex(indices); this.setAttribute('position', new Float32BufferAttribute(vertices, 3)); this.setAttribute('normal', new Float32BufferAttribute(normals, 3)); - this.setAttribute('uv', new Float32BufferAttribute(uvs, 2)); // functions + this.setAttribute('uv', new Float32BufferAttribute(uvs, 2)); + + // functions function generateBufferData() { for (let i = 0; i < tubularSegments; i++) { generateSegment(i); - } // if the geometry is not closed, generate the last row of vertices and normals + } + + // if the geometry is not closed, generate the last row of vertices and normals // at the regular position on the given path // // if the geometry is closed, duplicate the first row of vertices and normals (uvs will differ) + generateSegment(closed === false ? tubularSegments : 0); - generateSegment(closed === false ? tubularSegments : 0); // uvs are generated in a separate function. + // uvs are generated in a separate function. // this makes it easy compute correct values for closed geometries - generateUVs(); // finally create faces + generateUVs(); + + // finally create faces generateIndices(); } - function generateSegment(i) { // we use getPointAt to sample evenly distributed points from the given path - P = path.getPointAt(i / tubularSegments, P); // retrieve corresponding normal and binormal + + P = path.getPointAt(i / tubularSegments, P); + + // retrieve corresponding normal and binormal const N = frames.normals[i]; - const B = frames.binormals[i]; // generate normals and vertices for the current segment + const B = frames.binormals[i]; + + // generate normals and vertices for the current segment for (let j = 0; j <= radialSegments; j++) { const v = j / radialSegments * Math.PI * 2; const sin = Math.sin(v); - const cos = -Math.cos(v); // normal + const cos = -Math.cos(v); + + // normal normal.x = cos * N.x + sin * B.x; normal.y = cos * N.y + sin * B.y; normal.z = cos * N.z + sin * B.z; normal.normalize(); - normals.push(normal.x, normal.y, normal.z); // vertex + normals.push(normal.x, normal.y, normal.z); + + // vertex vertex.x = P.x + radius * normal.x; vertex.y = P.y + radius * normal.y; @@ -26296,21 +23573,21 @@ class TubeGeometry extends BufferGeometry { vertices.push(vertex.x, vertex.y, vertex.z); } } - function generateIndices() { for (let j = 1; j <= tubularSegments; j++) { for (let i = 1; i <= radialSegments; i++) { const a = (radialSegments + 1) * (j - 1) + (i - 1); const b = (radialSegments + 1) * j + (i - 1); const c = (radialSegments + 1) * j + i; - const d = (radialSegments + 1) * (j - 1) + i; // faces + const d = (radialSegments + 1) * (j - 1) + i; + + // faces indices.push(a, b, d); indices.push(b, c, d); } } } - function generateUVs() { for (let i = 0; i <= tubularSegments; i++) { for (let j = 0; j <= radialSegments; j++) { @@ -26321,19 +23598,16 @@ class TubeGeometry extends BufferGeometry { } } } - toJSON() { const data = super.toJSON(); data.path = this.parameters.path.toJSON(); return data; } - static fromJSON(data) { // This only works for built-in curves (e.g. CatmullRomCurve3). // User defined curves or instances of CurvePath will not be deserialized. return new TubeGeometry(new Curves[data.path.type]().fromJSON(data.path), data.tubularSegments, data.radius, data.radialSegments, data.closed); } - } class WireframeGeometry extends BufferGeometry { @@ -26343,42 +23617,42 @@ class WireframeGeometry extends BufferGeometry { this.parameters = { geometry: geometry }; - if (geometry !== null) { // buffer + const vertices = []; - const edges = new Set(); // helper variables + const edges = new Set(); + + // helper variables const start = new Vector3(); const end = new Vector3(); - if (geometry.index !== null) { // indexed BufferGeometry + const position = geometry.attributes.position; const indices = geometry.index; let groups = geometry.groups; - if (groups.length === 0) { groups = [{ start: 0, count: indices.count, materialIndex: 0 }]; - } // create a data structure that contains all eges without duplicates + } + // create a data structure that contains all eges without duplicates for (let o = 0, ol = groups.length; o < ol; ++o) { const group = groups[o]; const groupStart = group.start; const groupCount = group.count; - for (let i = groupStart, l = groupStart + groupCount; i < l; i += 3) { for (let j = 0; j < 3; j++) { const index1 = indices.getX(i + j); const index2 = indices.getX(i + (j + 1) % 3); start.fromBufferAttribute(position, index1); end.fromBufferAttribute(position, index2); - if (isUniqueEdge(start, end, edges) === true) { vertices.push(start.x, start.y, start.z); vertices.push(end.x, end.y, end.z); @@ -26388,32 +23662,31 @@ class WireframeGeometry extends BufferGeometry { } } else { // non-indexed BufferGeometry - const position = geometry.attributes.position; + const position = geometry.attributes.position; for (let i = 0, l = position.count / 3; i < l; i++) { for (let j = 0; j < 3; j++) { // three edges per triangle, an edge is represented as (index1, index2) // e.g. the first triangle has the following edges: (0,1),(1,2),(2,0) + const index1 = 3 * i + j; const index2 = 3 * i + (j + 1) % 3; start.fromBufferAttribute(position, index1); end.fromBufferAttribute(position, index2); - if (isUniqueEdge(start, end, edges) === true) { vertices.push(start.x, start.y, start.z); vertices.push(end.x, end.y, end.z); } } } - } // build geometry + } + // build geometry this.setAttribute('position', new Float32BufferAttribute(vertices, 3)); } } - } - function isUniqueEdge(start, end, edges) { const hash1 = `${start.x},${start.y},${start.z}-${end.x},${end.y},${end.z}`; const hash2 = `${end.x},${end.y},${end.z}-${start.x},${start.y},${start.z}`; // coincident edge @@ -26482,15 +23755,12 @@ class ShadowMaterial extends Material { this.transparent = true; this.setValues(parameters); } - copy(source) { super.copy(source); this.color.copy(source.color); return this; } - } - ShadowMaterial.prototype.isShadowMaterial = true; /** @@ -26549,17 +23819,14 @@ class MeshStandardMaterial extends Material { this.defines = { 'STANDARD': '' }; - if (Material.r115Compatible) { this.defines['MULTISCATTERRING_R115_COMPATABILITY'] = ''; this.defines['ALPHA_R115_COMPATABILITY'] = ''; this.defines['PERTURB_NORMAL_R115_COMPATABILITY'] = ''; this.defines['CLEARCOAT_R115_COMPATABILITY'] = ''; } - this.type = 'MeshStandardMaterial'; this.color = new Color(0xffffff); // diffuse - this.roughness = 1.0; this.metalness = 0.0; this.f90 = 1.0; @@ -26594,19 +23861,15 @@ class MeshStandardMaterial extends Material { this.flatShading = false; this.setValues(parameters); } - get refraction() { return this._refraction; } - set refraction(value) { if (this._refraction > 0 !== value > 0) { this.version++; } - this._refraction = value; } - copy(source) { super.copy(source); this.defines = source.defines; @@ -26645,9 +23908,7 @@ class MeshStandardMaterial extends Material { this.flatShading = source.flatShading; return this; } - } - MeshStandardMaterial.prototype.isMeshStandardMaterial = true; /** @@ -26720,43 +23981,33 @@ class MeshPhysicalMaterial extends MeshStandardMaterial { this._transmission = 0; this.setValues(parameters); } - get sheen() { return this._sheen; } - set sheen(value) { if (this._sheen > 0 !== value > 0) { this.version++; } - this._sheen = value; } - get clearcoat() { return this._clearcoat; } - set clearcoat(value) { if (this._clearcoat > 0 !== value > 0) { this.version++; } - this._clearcoat = value; } - get transmission() { return this._transmission; } - set transmission(value) { if (this._transmission > 0 !== value > 0) { this.version++; } - this._transmission = value; } - copy(source) { super.copy(source); this.defines = source.defines; @@ -26784,9 +24035,7 @@ class MeshPhysicalMaterial extends MeshStandardMaterial { this.specularColorMap = source.specularColorMap; return this; } - } - MeshPhysicalMaterial.prototype.isMeshPhysicalMaterial = true; /** @@ -26840,7 +24089,6 @@ class MeshPhongMaterial extends Material { super(); this.type = 'MeshPhongMaterial'; this.color = new Color(0xffffff); // diffuse - this.specular = new Color(0x111111); this.shininess = 30; this.map = null; @@ -26872,7 +24120,6 @@ class MeshPhongMaterial extends Material { this.flatShading = false; this.setValues(parameters); } - copy(source) { super.copy(source); this.color.copy(source.color); @@ -26907,9 +24154,7 @@ class MeshPhongMaterial extends Material { this.flatShading = source.flatShading; return this; } - } - MeshPhongMaterial.prototype.isMeshPhongMaterial = true; class MeshNoTonePhongMaterial extends MeshPhongMaterial { @@ -26923,7 +24168,6 @@ class MeshNoTonePhongMaterial extends MeshPhongMaterial { set: function () {} }); } - } /** @@ -26994,7 +24238,6 @@ class MeshToonMaterial extends Material { this.wireframeLinejoin = 'round'; this.setValues(parameters); } - copy(source) { super.copy(source); this.color.copy(source.color); @@ -27022,9 +24265,7 @@ class MeshToonMaterial extends Material { this.wireframeLinejoin = source.wireframeLinejoin; return this; } - } - MeshToonMaterial.prototype.isMeshToonMaterial = true; /** @@ -27067,7 +24308,6 @@ class MeshNormalMaterial extends Material { this.flatShading = false; this.setValues(parameters); } - copy(source) { super.copy(source); this.bumpMap = source.bumpMap; @@ -27083,9 +24323,7 @@ class MeshNormalMaterial extends Material { this.flatShading = source.flatShading; return this; } - } - MeshNormalMaterial.prototype.isMeshNormalMaterial = true; /** @@ -27146,7 +24384,6 @@ class MeshLambertMaterial extends Material { this.wireframeLinejoin = 'round'; this.setValues(parameters); } - copy(source) { super.copy(source); this.color.copy(source.color); @@ -27170,9 +24407,7 @@ class MeshLambertMaterial extends Material { this.wireframeLinejoin = source.wireframeLinejoin; return this; } - } - MeshLambertMaterial.prototype.isMeshLambertMaterial = true; /** @@ -27207,11 +24442,9 @@ class MeshMatcapMaterial extends Material { this.defines = { 'MATCAP': '' }; - if (Material.r115Compatible === true) { this.defines['PERTURB_NORMAL_R115_COMPATABILITY'] = ''; } - this.type = 'MeshMatcapMaterial'; this.color = new Color(0xffffff); // diffuse @@ -27229,7 +24462,6 @@ class MeshMatcapMaterial extends Material { this.flatShading = false; this.setValues(parameters); } - copy(source) { super.copy(source); this.defines = source.defines; @@ -27248,30 +24480,24 @@ class MeshMatcapMaterial extends Material { this.flatShading = source.flatShading; return this; } - } - MeshMatcapMaterial.prototype.isMeshMatcapMaterial = true; /** * Used in gltfloader, filp uv's v for matcap texture. */ - class OFTMatcapMaterial extends MeshMatcapMaterial { constructor(parameters) { super(parameters); this.type = 'OFTMatcapMaterial'; this.defines.OFT_MATCAP = ''; } - copy(source) { super.copy(source); this.defines = Object.assign({}, source.defines); return this; } - } - OFTMatcapMaterial.prototype.isOFTMatcapMaterial = true; /** @@ -27279,13 +24505,10 @@ OFTMatcapMaterial.prototype.isOFTMatcapMaterial = true; * * Specification: https://github.com/oppenfuture/glTF/tree/pointSprite/extensions/2.0/Vendor/OFT_materials_pointSprite */ - class OFTPointSpriteMaterial extends ShaderMaterial { constructor(params) { const localParams = { - vertexShader: - /* glsl */ - ` + vertexShader: /* glsl */` attribute float size; uniform float pointSize; @@ -27333,9 +24556,7 @@ class OFTPointSpriteMaterial extends ShaderMaterial { } `, - fragmentShader: - /* glsl */ - ` + fragmentShader: /* glsl */` precision highp float; #include @@ -27403,14 +24624,12 @@ class OFTPointSpriteMaterial extends ShaderMaterial { vertexColors: true }; super(localParams); - if (params != undefined) { this._pointSize = params.pointSize || 50; this._depthBias = params.depthBias || 0.001; this._pointTexture = params.pointTexture || null; this._depthTexture = params.depthTexture || null; } - this.uniforms = { pointSize: { value: this.pointSize @@ -27427,50 +24646,40 @@ class OFTPointSpriteMaterial extends ShaderMaterial { }; this.type = 'OFTPointSpriteMaterial'; } - get pointSize() { return this._pointSize; } - set pointSize(value) { this._pointSize = value; this.uniforms.pointSize.value = value; } - get depthBias() { return this._depthBias; } - set depthBias(value) { this._depthBias = value; this.uniforms.depthBias.value = value; - } // enable code injection: mapTexelToLinear - + } + // enable code injection: mapTexelToLinear get map() { return this._pointTexture; } - get pointTexture() { return this._pointTexture; } - set pointTexture(value) { this._pointTexture = value; this.uniforms.pointTexture.value = value; } - get depthTexture() { return this._depthTexture; } - set depthTexture(value) { this._depthTexture = value; this.uniforms.depthTexture.value = value; } - } - OFTPointSpriteMaterial.prototype.isOFTPointSpriteMaterial = true; /** @@ -27495,7 +24704,6 @@ class LineDashedMaterial extends LineBasicMaterial { this.gapSize = 1; this.setValues(parameters); } - copy(source) { super.copy(source); this.scale = source.scale; @@ -27503,9 +24711,7 @@ class LineDashedMaterial extends LineBasicMaterial { this.gapSize = source.gapSize; return this; } - } - LineDashedMaterial.prototype.isLineDashedMaterial = true; var Materials = /*#__PURE__*/Object.freeze({ @@ -27541,18 +24747,16 @@ const AnimationUtils = { // but array.subarray(from) or array.subarray(from, len) is correct return new array.constructor(array.subarray(from, to !== undefined ? to : array.length)); } - return array.slice(from, to); }, // converts an array to a specific type convertArray: function (array, type, forceClone) { - if (!array || // let 'undefined' and 'null' pass + if (!array || + // let 'undefined' and 'null' pass !forceClone && array.constructor === type) return array; - if (typeof type.BYTES_PER_ELEMENT === 'number') { return new type(array); // create typed array } - return Array.prototype.slice.call(array); // create Array }, isTypedArray: function (object) { @@ -27563,12 +24767,9 @@ const AnimationUtils = { function compareTime(i, j) { return times[i] - times[j]; } - const n = times.length; const result = new Array(n); - for (let i = 0; i !== n; ++i) result[i] = i; - result.sort(compareTime); return result; }, @@ -27576,26 +24777,21 @@ const AnimationUtils = { sortedArray: function (values, stride, order) { const nValues = values.length; const result = new values.constructor(nValues); - for (let i = 0, dstOffset = 0; dstOffset !== nValues; ++i) { const srcOffset = order[i] * stride; - for (let j = 0; j !== stride; ++j) { result[dstOffset++] = values[srcOffset + j]; } } - return result; }, // function for parsing AOS keyframe formats flattenJSON: function (jsonKeys, times, values, valuePropertyName) { let i = 1, - key = jsonKeys[0]; - + key = jsonKeys[0]; while (key !== undefined && key[valuePropertyName] === undefined) { key = jsonKeys[i++]; } - if (key === undefined) return; // no data let value = key[valuePropertyName]; @@ -27604,36 +24800,32 @@ const AnimationUtils = { if (Array.isArray(value)) { do { value = key[valuePropertyName]; - if (value !== undefined) { times.push(key.time); values.push.apply(values, value); // push all elements } - key = jsonKeys[i++]; } while (key !== undefined); } else if (value.toArray !== undefined) { // ...assume THREE.Math-ish + do { value = key[valuePropertyName]; - if (value !== undefined) { times.push(key.time); value.toArray(values, values.length); } - key = jsonKeys[i++]; } while (key !== undefined); } else { // otherwise push as-is + do { value = key[valuePropertyName]; - if (value !== undefined) { times.push(key.time); values.push(value); } - key = jsonKeys[i++]; } while (key !== undefined); } @@ -27642,79 +24834,75 @@ const AnimationUtils = { const clip = sourceClip.clone(); clip.name = name; const tracks = []; - for (let i = 0; i < clip.tracks.length; ++i) { const track = clip.tracks[i]; const valueSize = track.getValueSize(); const times = []; const values = []; - for (let j = 0; j < track.times.length; ++j) { const frame = track.times[j] * fps; if (frame < startFrame || frame >= endFrame) continue; times.push(track.times[j]); - for (let k = 0; k < valueSize; ++k) { values.push(track.values[j * valueSize + k]); } } - if (times.length === 0) continue; track.times = AnimationUtils.convertArray(times, track.times.constructor); track.values = AnimationUtils.convertArray(values, track.values.constructor); tracks.push(track); } + clip.tracks = tracks; - clip.tracks = tracks; // find minimum .times value across all tracks in the trimmed clip + // find minimum .times value across all tracks in the trimmed clip let minStartTime = Infinity; - for (let i = 0; i < clip.tracks.length; ++i) { if (minStartTime > clip.tracks[i].times[0]) { minStartTime = clip.tracks[i].times[0]; } - } // shift all tracks such that clip begins at t=0 + } + // shift all tracks such that clip begins at t=0 for (let i = 0; i < clip.tracks.length; ++i) { clip.tracks[i].shift(-1 * minStartTime); } - clip.resetDuration(); return clip; }, makeClipAdditive: function (targetClip, referenceFrame = 0, referenceClip = targetClip, fps = 30) { if (fps <= 0) fps = 30; const numTracks = referenceClip.tracks.length; - const referenceTime = referenceFrame / fps; // Make each track's values relative to the values at the reference frame + const referenceTime = referenceFrame / fps; + // Make each track's values relative to the values at the reference frame for (let i = 0; i < numTracks; ++i) { const referenceTrack = referenceClip.tracks[i]; - const referenceTrackType = referenceTrack.ValueTypeName; // Skip this track if it's non-numeric + const referenceTrackType = referenceTrack.ValueTypeName; - if (referenceTrackType === 'bool' || referenceTrackType === 'string') continue; // Find the track in the target clip whose name and type matches the reference track + // Skip this track if it's non-numeric + if (referenceTrackType === 'bool' || referenceTrackType === 'string') continue; + // Find the track in the target clip whose name and type matches the reference track const targetTrack = targetClip.tracks.find(function (track) { return track.name === referenceTrack.name && track.ValueTypeName === referenceTrackType; }); if (targetTrack === undefined) continue; let referenceOffset = 0; const referenceValueSize = referenceTrack.getValueSize(); - if (referenceTrack.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline) { referenceOffset = referenceValueSize / 3; } - let targetOffset = 0; const targetValueSize = targetTrack.getValueSize(); - if (targetTrack.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline) { targetOffset = targetValueSize / 3; } - const lastIndex = referenceTrack.times.length - 1; - let referenceValue; // Find the value to subtract out of the track + let referenceValue; + // Find the value to subtract out of the track if (referenceTime <= referenceTrack.times[0]) { // Reference frame is earlier than the first keyframe, so just use the first keyframe const startIndex = referenceOffset; @@ -27732,33 +24920,32 @@ const AnimationUtils = { const endIndex = referenceValueSize - referenceOffset; interpolant.evaluate(referenceTime); referenceValue = AnimationUtils.arraySlice(interpolant.resultBuffer, startIndex, endIndex); - } // Conjugate the quaternion - + } + // Conjugate the quaternion if (referenceTrackType === 'quaternion') { const referenceQuat = new Quaternion().fromArray(referenceValue).normalize().conjugate(); referenceQuat.toArray(referenceValue); - } // Subtract the reference value from all of the track values + } + // Subtract the reference value from all of the track values const numTimes = targetTrack.times.length; - for (let j = 0; j < numTimes; ++j) { const valueStart = j * targetValueSize + targetOffset; - if (referenceTrackType === 'quaternion') { // Multiply the conjugate for quaternion track types Quaternion.multiplyQuaternionsFlat(targetTrack.values, valueStart, referenceValue, 0, targetTrack.values, valueStart); } else { - const valueEnd = targetValueSize - targetOffset * 2; // Subtract each value for all other numeric track types + const valueEnd = targetValueSize - targetOffset * 2; + // Subtract each value for all other numeric track types for (let k = 0; k < valueEnd; ++k) { targetTrack.values[valueStart + k] -= referenceValue[k]; } } } } - targetClip.blendMode = AdditiveAnimationBlendMode; return targetClip; } @@ -27784,6 +24971,7 @@ const AnimationUtils = { * http://www.oodesign.com/template-method-pattern.html * */ + class Interpolant { constructor(parameterPositions, sampleValues, sampleSize, resultBuffer) { this.parameterPositions = parameterPositions; @@ -27794,17 +24982,14 @@ class Interpolant { this.settings = null; this.DefaultSettings_ = {}; } - evaluate(t) { const pp = this.parameterPositions; let i1 = this._cachedIndex, - t1 = pp[i1], - t0 = pp[i1 - 1]; - + t1 = pp[i1], + t0 = pp[i1 - 1]; validate_interval: { seek: { let right; - linear_scan: { //- See http://jsperf.com/comparison-to-undefined/3 //- slower code: @@ -27813,90 +24998,89 @@ class Interpolant { forward_scan: if (!(t < t1)) { for (let giveUpAt = i1 + 2;;) { if (t1 === undefined) { - if (t < t0) break forward_scan; // after end + if (t < t0) break forward_scan; + + // after end i1 = pp.length; this._cachedIndex = i1; return this.afterEnd_(i1 - 1, t, t0); } - if (i1 === giveUpAt) break; // this loop t0 = t1; t1 = pp[++i1]; - if (t < t1) { // we have arrived at the sought interval break seek; } - } // prepare binary search on the right side of the index - + } + // prepare binary search on the right side of the index right = pp.length; break linear_scan; - } //- slower code: - //- if ( t < t0 || t0 === undefined ) { - + } + //- slower code: + //- if ( t < t0 || t0 === undefined ) { if (!(t >= t0)) { // looping? - const t1global = pp[1]; + const t1global = pp[1]; if (t < t1global) { i1 = 2; // + 1, using the scan for the details - t0 = t1global; - } // linear reverse scan + } + // linear reverse scan for (let giveUpAt = i1 - 2;;) { if (t0 === undefined) { // before start + this._cachedIndex = 0; return this.beforeStart_(0, t, t1); } - if (i1 === giveUpAt) break; // this loop t1 = t0; t0 = pp[--i1 - 1]; - if (t >= t0) { // we have arrived at the sought interval break seek; } - } // prepare binary search on the left side of the index - + } + // prepare binary search on the left side of the index right = i1; i1 = 0; break linear_scan; - } // the interval is valid + } + // the interval is valid break validate_interval; } // linear scan - // binary search + // binary search while (i1 < right) { const mid = i1 + right >>> 1; - if (t < pp[mid]) { right = mid; } else { i1 = mid + 1; } } - t1 = pp[i1]; - t0 = pp[i1 - 1]; // check boundary cases, again + t0 = pp[i1 - 1]; + + // check boundary cases, again if (t0 === undefined) { this._cachedIndex = 0; return this.beforeStart_(0, t, t1); } - if (t1 === undefined) { i1 = pp.length; this._cachedIndex = i1; @@ -27904,43 +25088,43 @@ class Interpolant { } } // seek - this._cachedIndex = i1; this.intervalChanged_(i1, t0, t1); } // validate_interval - return this.interpolate_(i1, t0, t, t1); } - getSettings_() { return this.settings || this.DefaultSettings_; } - copySampleValue_(index) { // copies a sample value to the result buffer - const result = this.resultBuffer, - values = this.sampleValues, - stride = this.valueSize, - offset = index * stride; + const result = this.resultBuffer, + values = this.sampleValues, + stride = this.valueSize, + offset = index * stride; for (let i = 0; i !== stride; ++i) { result[i] = values[offset + i]; } - return result; - } // Template methods for derived classes: + } + // Template methods for derived classes: - interpolate_() { - throw new Error('call to abstract method'); // implementations shall return this.resultBuffer + interpolate_(/* i1, t0, t, t1 */ + ) { + throw new Error('call to abstract method'); + // implementations shall return this.resultBuffer } + intervalChanged_(/* i1, t0, t1 */ + ) { - intervalChanged_() {// empty + // empty } +} -} // ALIAS DEFINITIONS - +// ALIAS DEFINITIONS Interpolant.prototype.beforeStart_ = Interpolant.prototype.copySampleValue_; Interpolant.prototype.afterEnd_ = Interpolant.prototype.copySampleValue_; @@ -27965,14 +25149,12 @@ class CubicInterpolant extends Interpolant { endingEnd: ZeroCurvatureEnding }; } - intervalChanged_(i1, t0, t1) { const pp = this.parameterPositions; let iPrev = i1 - 2, - iNext = i1 + 1, - tPrev = pp[iPrev], - tNext = pp[iNext]; - + iNext = i1 + 1, + tPrev = pp[iPrev], + tNext = pp[iNext]; if (tPrev === undefined) { switch (this.getSettings_().endingStart) { case ZeroSlopeEnding: @@ -27980,21 +25162,19 @@ class CubicInterpolant extends Interpolant { iPrev = i1; tPrev = 2 * t0 - t1; break; - case WrapAroundEnding: // use the other end of the curve iPrev = pp.length - 2; tPrev = t0 + pp[iPrev] - pp[iPrev + 1]; break; - default: // ZeroCurvatureEnding + // f''(t0) = 0 a.k.a. Natural Spline iPrev = i1; tPrev = t1; } } - if (tNext === undefined) { switch (this.getSettings_().endingEnd) { case ZeroSlopeEnding: @@ -28002,78 +25182,73 @@ class CubicInterpolant extends Interpolant { iNext = i1; tNext = 2 * t1 - t0; break; - case WrapAroundEnding: // use the other end of the curve iNext = 1; tNext = t1 + pp[1] - pp[0]; break; - default: // ZeroCurvatureEnding + // f''(tN) = 0, a.k.a. Natural Spline iNext = i1 - 1; tNext = t0; } } - const halfDt = (t1 - t0) * 0.5, - stride = this.valueSize; + stride = this.valueSize; this._weightPrev = halfDt / (t0 - tPrev); this._weightNext = halfDt / (tNext - t1); this._offsetPrev = iPrev * stride; this._offsetNext = iNext * stride; } - interpolate_(i1, t0, t, t1) { const result = this.resultBuffer, - values = this.sampleValues, - stride = this.valueSize, - o1 = i1 * stride, - o0 = o1 - stride, - oP = this._offsetPrev, - oN = this._offsetNext, - wP = this._weightPrev, - wN = this._weightNext, - p = (t - t0) / (t1 - t0), - pp = p * p, - ppp = pp * p; // evaluate polynomials + values = this.sampleValues, + stride = this.valueSize, + o1 = i1 * stride, + o0 = o1 - stride, + oP = this._offsetPrev, + oN = this._offsetNext, + wP = this._weightPrev, + wN = this._weightNext, + p = (t - t0) / (t1 - t0), + pp = p * p, + ppp = pp * p; + + // evaluate polynomials const sP = -wP * ppp + 2 * wP * pp - wP * p; const s0 = (1 + wP) * ppp + (-1.5 - 2 * wP) * pp + (-0.5 + wP) * p + 1; const s1 = (-1 - wN) * ppp + (1.5 + wN) * pp + 0.5 * p; - const sN = wN * ppp - wN * pp; // combine data linearly + const sN = wN * ppp - wN * pp; + + // combine data linearly for (let i = 0; i !== stride; ++i) { result[i] = sP * values[oP + i] + s0 * values[o0 + i] + s1 * values[o1 + i] + sN * values[oN + i]; } - return result; } - } class LinearInterpolant extends Interpolant { constructor(parameterPositions, sampleValues, sampleSize, resultBuffer) { super(parameterPositions, sampleValues, sampleSize, resultBuffer); } - interpolate_(i1, t0, t, t1) { const result = this.resultBuffer, - values = this.sampleValues, - stride = this.valueSize, - offset1 = i1 * stride, - offset0 = offset1 - stride, - weight1 = (t - t0) / (t1 - t0), - weight0 = 1 - weight1; - + values = this.sampleValues, + stride = this.valueSize, + offset1 = i1 * stride, + offset0 = offset1 - stride, + weight1 = (t - t0) / (t1 - t0), + weight0 = 1 - weight1; for (let i = 0; i !== stride; ++i) { result[i] = values[offset0 + i] * weight0 + values[offset1 + i] * weight1; } - return result; } - } /** @@ -28086,13 +25261,9 @@ class DiscreteInterpolant extends Interpolant { constructor(parameterPositions, sampleValues, sampleSize, resultBuffer) { super(parameterPositions, sampleValues, sampleSize, resultBuffer); } - - interpolate_(i1 - /*, t0, t, t1 */ - ) { + interpolate_(i1 /*, t0, t, t1 */) { return this.copySampleValue_(i1 - 1); } - } class KeyframeTrack { @@ -28103,14 +25274,16 @@ class KeyframeTrack { this.times = AnimationUtils.convertArray(times, this.TimeBufferType); this.values = AnimationUtils.convertArray(values, this.ValueBufferType); this.setInterpolation(interpolation || this.DefaultInterpolation); - } // Serialization (in static context, because of constructor invocation - // and automatic invocation of .toJSON): + } + // Serialization (in static context, because of constructor invocation + // and automatic invocation of .toJSON): static toJSON(track) { const trackType = track.constructor; - let json; // derived classes can define a static toJSON method + let json; + // derived classes can define a static toJSON method if (trackType.toJSON !== this.toJSON) { json = trackType.toJSON(track); } else { @@ -28121,49 +25294,38 @@ class KeyframeTrack { 'values': AnimationUtils.convertArray(track.values, Array) }; const interpolation = track.getInterpolation(); - if (interpolation !== track.DefaultInterpolation) { json.interpolation = interpolation; } } - json.type = track.ValueTypeName; // mandatory return json; } - InterpolantFactoryMethodDiscrete(result) { return new DiscreteInterpolant(this.times, this.values, this.getValueSize(), result); } - InterpolantFactoryMethodLinear(result) { return new LinearInterpolant(this.times, this.values, this.getValueSize(), result); } - InterpolantFactoryMethodSmooth(result) { return new CubicInterpolant(this.times, this.values, this.getValueSize(), result); } - setInterpolation(interpolation) { let factoryMethod; - switch (interpolation) { case InterpolateDiscrete: factoryMethod = this.InterpolantFactoryMethodDiscrete; break; - case InterpolateLinear: factoryMethod = this.InterpolantFactoryMethodLinear; break; - case InterpolateSmooth: factoryMethod = this.InterpolantFactoryMethodSmooth; break; } - if (factoryMethod === undefined) { const message = 'unsupported interpolation for ' + this.ValueTypeName + ' keyframe track named ' + this.name; - if (this.createInterpolant === undefined) { // fall back to default, unless the default itself is messed up if (interpolation !== this.DefaultInterpolation) { @@ -28172,74 +25334,61 @@ class KeyframeTrack { throw new Error(message); // fatal, in this case } } - console.warn('THREE.KeyframeTrack:', message); return this; } - this.createInterpolant = factoryMethod; return this; } - getInterpolation() { switch (this.createInterpolant) { case this.InterpolantFactoryMethodDiscrete: return InterpolateDiscrete; - case this.InterpolantFactoryMethodLinear: return InterpolateLinear; - case this.InterpolantFactoryMethodSmooth: return InterpolateSmooth; } } - getValueSize() { return this.values.length / this.times.length; - } // move all keyframes either forwards or backwards in time - + } + // move all keyframes either forwards or backwards in time shift(timeOffset) { if (timeOffset !== 0.0) { const times = this.times; - for (let i = 0, n = times.length; i !== n; ++i) { times[i] += timeOffset; } } - return this; - } // scale all keyframe times by a factor (useful for frame <-> seconds conversions) - + } + // scale all keyframe times by a factor (useful for frame <-> seconds conversions) scale(timeScale) { if (timeScale !== 1.0) { const times = this.times; - for (let i = 0, n = times.length; i !== n; ++i) { times[i] *= timeScale; } } - return this; - } // removes keyframes before and after animation without changing any values within the range [startTime, endTime]. - // IMPORTANT: We do not shift around keys to the start of the track time, because for interpolated keys this will change their values - + } + // removes keyframes before and after animation without changing any values within the range [startTime, endTime]. + // IMPORTANT: We do not shift around keys to the start of the track time, because for interpolated keys this will change their values trim(startTime, endTime) { const times = this.times, - nKeys = times.length; + nKeys = times.length; let from = 0, - to = nKeys - 1; - + to = nKeys - 1; while (from !== nKeys && times[from] < startTime) { ++from; } - while (to !== -1 && times[to] > endTime) { --to; } - ++to; // inclusive -> exclusive bound if (from !== 0 || to !== nKeys) { @@ -28248,59 +25397,47 @@ class KeyframeTrack { to = Math.max(to, 1); from = to - 1; } - const stride = this.getValueSize(); this.times = AnimationUtils.arraySlice(times, from, to); this.values = AnimationUtils.arraySlice(this.values, from * stride, to * stride); } - return this; - } // ensure we do not get a GarbageInGarbageOut situation, make sure tracks are at least minimally viable - + } + // ensure we do not get a GarbageInGarbageOut situation, make sure tracks are at least minimally viable validate() { let valid = true; const valueSize = this.getValueSize(); - if (valueSize - Math.floor(valueSize) !== 0) { console.error('THREE.KeyframeTrack: Invalid value size in track.', this); valid = false; } - const times = this.times, - values = this.values, - nKeys = times.length; - + values = this.values, + nKeys = times.length; if (nKeys === 0) { console.error('THREE.KeyframeTrack: Track is empty.', this); valid = false; } - let prevTime = null; - for (let i = 0; i !== nKeys; i++) { const currTime = times[i]; - if (typeof currTime === 'number' && isNaN(currTime)) { console.error('THREE.KeyframeTrack: Time is not a valid number.', this, i, currTime); valid = false; break; } - if (prevTime !== null && prevTime > currTime) { console.error('THREE.KeyframeTrack: Out of order keys.', this, i, currTime, prevTime); valid = false; break; } - prevTime = currTime; } - if (values !== undefined) { if (AnimationUtils.isTypedArray(values)) { for (let i = 0, n = values.length; i !== n; ++i) { const value = values[i]; - if (isNaN(value)) { console.error('THREE.KeyframeTrack: Value is not a valid number.', this, i, value); valid = false; @@ -28309,36 +25446,35 @@ class KeyframeTrack { } } } - return valid; - } // removes equivalent sequential keys as common in morph target sequences - // (0,0,0,0,1,1,1,0,0,0,0,0,0,0) --> (0,0,1,1,0,0) - + } + // removes equivalent sequential keys as common in morph target sequences + // (0,0,0,0,1,1,1,0,0,0,0,0,0,0) --> (0,0,1,1,0,0) optimize() { // times or values may be shared with other tracks, so overwriting is unsafe const times = AnimationUtils.arraySlice(this.times), - values = AnimationUtils.arraySlice(this.values), - stride = this.getValueSize(), - smoothInterpolation = this.getInterpolation() === InterpolateSmooth, - lastIndex = times.length - 1; + values = AnimationUtils.arraySlice(this.values), + stride = this.getValueSize(), + smoothInterpolation = this.getInterpolation() === InterpolateSmooth, + lastIndex = times.length - 1; let writeIndex = 1; - for (let i = 1; i < lastIndex; ++i) { let keep = false; const time = times[i]; - const timeNext = times[i + 1]; // remove adjacent keyframes scheduled at the same time + const timeNext = times[i + 1]; + + // remove adjacent keyframes scheduled at the same time if (time !== timeNext && (i !== 1 || time !== times[0])) { if (!smoothInterpolation) { // remove unnecessary keyframes same as their neighbors - const offset = i * stride, - offsetP = offset - stride, - offsetN = offset + stride; + const offset = i * stride, + offsetP = offset - stride, + offsetN = offset + stride; for (let j = 0; j !== stride; ++j) { const value = values[offset + j]; - if (value !== values[offsetP + j] || value !== values[offsetN + j]) { keep = true; break; @@ -28347,35 +25483,32 @@ class KeyframeTrack { } else { keep = true; } - } // in-place compaction + } + // in-place compaction if (keep) { if (i !== writeIndex) { times[writeIndex] = times[i]; const readOffset = i * stride, - writeOffset = writeIndex * stride; - + writeOffset = writeIndex * stride; for (let j = 0; j !== stride; ++j) { values[writeOffset + j] = values[readOffset + j]; } } - ++writeIndex; } - } // flush last keyframe (compaction looks ahead) + } + // flush last keyframe (compaction looks ahead) if (lastIndex > 0) { times[writeIndex] = times[lastIndex]; - for (let readOffset = lastIndex * stride, writeOffset = writeIndex * stride, j = 0; j !== stride; ++j) { values[writeOffset + j] = values[readOffset + j]; } - ++writeIndex; } - if (writeIndex !== times.length) { this.times = AnimationUtils.arraySlice(times, 0, writeIndex); this.values = AnimationUtils.arraySlice(values, 0, writeIndex * stride); @@ -28383,22 +25516,19 @@ class KeyframeTrack { this.times = times; this.values = values; } - return this; } - clone() { const times = AnimationUtils.arraySlice(this.times, 0); const values = AnimationUtils.arraySlice(this.values, 0); const TypedKeyframeTrack = this.constructor; - const track = new TypedKeyframeTrack(this.name, times, values); // Interpolant argument to constructor is not saved, so copy the factory method directly. + const track = new TypedKeyframeTrack(this.name, times, values); + // Interpolant argument to constructor is not saved, so copy the factory method directly. track.createInterpolant = this.createInterpolant; return track; } - } - KeyframeTrack.prototype.TimeBufferType = Float32Array; KeyframeTrack.prototype.ValueBufferType = Float32Array; KeyframeTrack.prototype.DefaultInterpolation = InterpolateLinear; @@ -28406,30 +25536,24 @@ KeyframeTrack.prototype.DefaultInterpolation = InterpolateLinear; /** * A Track of Boolean keyframe values. */ - class BooleanKeyframeTrack extends KeyframeTrack {} - BooleanKeyframeTrack.prototype.ValueTypeName = 'bool'; BooleanKeyframeTrack.prototype.ValueBufferType = Array; BooleanKeyframeTrack.prototype.DefaultInterpolation = InterpolateDiscrete; BooleanKeyframeTrack.prototype.InterpolantFactoryMethodLinear = undefined; -BooleanKeyframeTrack.prototype.InterpolantFactoryMethodSmooth = undefined; // Note: Actually this track could have a optimized / compressed +BooleanKeyframeTrack.prototype.InterpolantFactoryMethodSmooth = undefined; /** * A Track of keyframe values that represent color. */ - class ColorKeyframeTrack extends KeyframeTrack {} - -ColorKeyframeTrack.prototype.ValueTypeName = 'color'; // ValueBufferType is inherited +ColorKeyframeTrack.prototype.ValueTypeName = 'color'; /** * A Track of numeric keyframe values. */ - class NumberKeyframeTrack extends KeyframeTrack {} - -NumberKeyframeTrack.prototype.ValueTypeName = 'number'; // ValueBufferType is inherited +NumberKeyframeTrack.prototype.ValueTypeName = 'number'; /** * Spherical linear unit quaternion interpolant. @@ -28439,45 +25563,36 @@ class QuaternionLinearInterpolant extends Interpolant { constructor(parameterPositions, sampleValues, sampleSize, resultBuffer) { super(parameterPositions, sampleValues, sampleSize, resultBuffer); } - interpolate_(i1, t0, t, t1) { const result = this.resultBuffer, - values = this.sampleValues, - stride = this.valueSize, - alpha = (t - t0) / (t1 - t0); + values = this.sampleValues, + stride = this.valueSize, + alpha = (t - t0) / (t1 - t0); let offset = i1 * stride; - for (let end = offset + stride; offset !== end; offset += 4) { Quaternion.slerpFlat(result, 0, values, offset - stride, values, offset, alpha); } - return result; } - } /** * A Track of quaternion keyframe values. */ - class QuaternionKeyframeTrack extends KeyframeTrack { InterpolantFactoryMethodLinear(result) { return new QuaternionLinearInterpolant(this.times, this.values, this.getValueSize(), result); } - } - -QuaternionKeyframeTrack.prototype.ValueTypeName = 'quaternion'; // ValueBufferType is inherited - +QuaternionKeyframeTrack.prototype.ValueTypeName = 'quaternion'; +// ValueBufferType is inherited QuaternionKeyframeTrack.prototype.DefaultInterpolation = InterpolateLinear; QuaternionKeyframeTrack.prototype.InterpolantFactoryMethodSmooth = undefined; /** * A Track that interpolates Strings */ - class StringKeyframeTrack extends KeyframeTrack {} - StringKeyframeTrack.prototype.ValueTypeName = 'string'; StringKeyframeTrack.prototype.ValueBufferType = Array; StringKeyframeTrack.prototype.DefaultInterpolation = InterpolateDiscrete; @@ -28487,10 +25602,8 @@ StringKeyframeTrack.prototype.InterpolantFactoryMethodSmooth = undefined; /** * A Track of vectored keyframe values. */ - class VectorKeyframeTrack extends KeyframeTrack {} - -VectorKeyframeTrack.prototype.ValueTypeName = 'vector'; // ValueBufferType is inherited +VectorKeyframeTrack.prototype.ValueTypeName = 'vector'; class AnimationClip { constructor(name, duration = -1, tracks, blendMode = NormalAnimationBlendMode) { @@ -28498,30 +25611,27 @@ class AnimationClip { this.tracks = tracks; this.duration = duration; this.blendMode = blendMode; - this.uuid = generateUUID(); // this means it should figure out its duration by scanning the tracks + this.uuid = generateUUID(); + // this means it should figure out its duration by scanning the tracks if (this.duration < 0) { this.resetDuration(); } } - static parse(json) { const tracks = [], - jsonTracks = json.tracks, - frameTime = 1.0 / (json.fps || 1.0); - + jsonTracks = json.tracks, + frameTime = 1.0 / (json.fps || 1.0); for (let i = 0, n = jsonTracks.length; i !== n; ++i) { tracks.push(parseKeyframeTrack(jsonTracks[i]).scale(frameTime)); } - const clip = new this(json.name, json.duration, tracks, json.blendMode); clip.uuid = json.uuid; return clip; } - static toJSON(clip) { const tracks = [], - clipTracks = clip.tracks; + clipTracks = clip.tracks; const json = { 'name': clip.name, 'duration': clip.duration, @@ -28529,18 +25639,14 @@ class AnimationClip { 'uuid': clip.uuid, 'blendMode': clip.blendMode }; - for (let i = 0, n = clipTracks.length; i !== n; ++i) { tracks.push(KeyframeTrack.toJSON(clipTracks[i])); } - return json; } - static CreateFromMorphTargetSequence(name, morphTargetSequence, fps, noLoop) { const numMorphTargets = morphTargetSequence.length; const tracks = []; - for (let i = 0; i < numMorphTargets; i++) { let times = []; let values = []; @@ -28548,204 +25654,174 @@ class AnimationClip { values.push(0, 1, 0); const order = AnimationUtils.getKeyframeOrder(times); times = AnimationUtils.sortedArray(times, 1, order); - values = AnimationUtils.sortedArray(values, 1, order); // if there is a key at the first frame, duplicate it as the - // last frame as well for perfect loop. + values = AnimationUtils.sortedArray(values, 1, order); + // if there is a key at the first frame, duplicate it as the + // last frame as well for perfect loop. if (!noLoop && times[0] === 0) { times.push(numMorphTargets); values.push(values[0]); } - tracks.push(new NumberKeyframeTrack('.morphTargetInfluences[' + morphTargetSequence[i].name + ']', times, values).scale(1.0 / fps)); } - return new this(name, -1, tracks); } - static findByName(objectOrClipArray, name) { let clipArray = objectOrClipArray; - if (!Array.isArray(objectOrClipArray)) { const o = objectOrClipArray; clipArray = o.geometry && o.geometry.animations || o.animations; } - for (let i = 0; i < clipArray.length; i++) { if (clipArray[i].name === name) { return clipArray[i]; } } - return null; } - static CreateClipsFromMorphTargetSequences(morphTargets, fps, noLoop) { - const animationToMorphTargets = {}; // tested with https://regex101.com/ on trick sequences + const animationToMorphTargets = {}; + + // tested with https://regex101.com/ on trick sequences // such flamingo_flyA_003, flamingo_run1_003, crdeath0059 + const pattern = /^([\w-]*?)([\d]+)$/; - const pattern = /^([\w-]*?)([\d]+)$/; // sort morph target names into animation groups based + // sort morph target names into animation groups based // patterns like Walk_001, Walk_002, Run_001, Run_002 - for (let i = 0, il = morphTargets.length; i < il; i++) { const morphTarget = morphTargets[i]; const parts = morphTarget.name.match(pattern); - if (parts && parts.length > 1) { const name = parts[1]; let animationMorphTargets = animationToMorphTargets[name]; - if (!animationMorphTargets) { animationToMorphTargets[name] = animationMorphTargets = []; } - animationMorphTargets.push(morphTarget); } } - const clips = []; - for (const name in animationToMorphTargets) { clips.push(this.CreateFromMorphTargetSequence(name, animationToMorphTargets[name], fps, noLoop)); } - return clips; - } // parse the animation.hierarchy format - + } + // parse the animation.hierarchy format static parseAnimation(animation, bones) { if (!animation) { console.error('THREE.AnimationClip: No animation in JSONLoader data.'); return null; } - const addNonemptyTrack = function (trackType, trackName, animationKeys, propertyName, destTracks) { // only return track if there are actually keys. if (animationKeys.length !== 0) { const times = []; const values = []; - AnimationUtils.flattenJSON(animationKeys, times, values, propertyName); // empty keys are filtered out, so check again + AnimationUtils.flattenJSON(animationKeys, times, values, propertyName); + // empty keys are filtered out, so check again if (times.length !== 0) { destTracks.push(new trackType(trackName, times, values)); } } }; - const tracks = []; const clipName = animation.name || 'default'; const fps = animation.fps || 30; - const blendMode = animation.blendMode; // automatic length determination in AnimationClip. + const blendMode = animation.blendMode; + // automatic length determination in AnimationClip. let duration = animation.length || -1; const hierarchyTracks = animation.hierarchy || []; - for (let h = 0; h < hierarchyTracks.length; h++) { - const animationKeys = hierarchyTracks[h].keys; // skip empty tracks + const animationKeys = hierarchyTracks[h].keys; - if (!animationKeys || animationKeys.length === 0) continue; // process morph targets + // skip empty tracks + if (!animationKeys || animationKeys.length === 0) continue; + // process morph targets if (animationKeys[0].morphTargets) { // figure out all morph targets used in this track const morphTargetNames = {}; let k; - for (k = 0; k < animationKeys.length; k++) { if (animationKeys[k].morphTargets) { for (let m = 0; m < animationKeys[k].morphTargets.length; m++) { morphTargetNames[animationKeys[k].morphTargets[m]] = -1; } } - } // create a track for each morph target with all zero + } + + // create a track for each morph target with all zero // morphTargetInfluences except for the keys in which // the morphTarget is named. - - for (const morphTargetName in morphTargetNames) { const times = []; const values = []; - for (let m = 0; m !== animationKeys[k].morphTargets.length; ++m) { const animationKey = animationKeys[k]; times.push(animationKey.time); values.push(animationKey.morphTarget === morphTargetName ? 1 : 0); } - tracks.push(new NumberKeyframeTrack('.morphTargetInfluence[' + morphTargetName + ']', times, values)); } - duration = morphTargetNames.length * (fps || 1.0); } else { // ...assume skeletal animation + const boneName = '.bones[' + bones[h].name + ']'; addNonemptyTrack(VectorKeyframeTrack, boneName + '.position', animationKeys, 'pos', tracks); addNonemptyTrack(QuaternionKeyframeTrack, boneName + '.quaternion', animationKeys, 'rot', tracks); addNonemptyTrack(VectorKeyframeTrack, boneName + '.scale', animationKeys, 'scl', tracks); } } - if (tracks.length === 0) { return null; } - const clip = new this(clipName, duration, tracks, blendMode); return clip; } - resetDuration() { const tracks = this.tracks; let duration = 0; - for (let i = 0, n = tracks.length; i !== n; ++i) { const track = this.tracks[i]; duration = Math.max(duration, track.times[track.times.length - 1]); } - this.duration = duration; return this; } - trim() { for (let i = 0; i < this.tracks.length; i++) { this.tracks[i].trim(0, this.duration); } - return this; } - validate() { let valid = true; - for (let i = 0; i < this.tracks.length; i++) { valid = valid && this.tracks[i].validate(); } - return valid; } - optimize() { for (let i = 0; i < this.tracks.length; i++) { this.tracks[i].optimize(); } - return this; } - clone() { const tracks = []; - for (let i = 0; i < this.tracks.length; i++) { tracks.push(this.tracks[i].clone()); } - return new this.constructor(this.name, this.duration, tracks, this.blendMode); } - toJSON() { return this.constructor.toJSON(this); } - } - function getTrackTypeForValueTypeName(typeName) { switch (typeName.toLowerCase()) { case 'scalar': @@ -28754,46 +25830,37 @@ function getTrackTypeForValueTypeName(typeName) { case 'number': case 'integer': return NumberKeyframeTrack; - case 'vector': case 'vector2': case 'vector3': case 'vector4': return VectorKeyframeTrack; - case 'color': return ColorKeyframeTrack; - case 'quaternion': return QuaternionKeyframeTrack; - case 'bool': case 'boolean': return BooleanKeyframeTrack; - case 'string': return StringKeyframeTrack; } - throw new Error('THREE.KeyframeTrack: Unsupported typeName: ' + typeName); } - function parseKeyframeTrack(json) { if (json.type === undefined) { throw new Error('THREE.KeyframeTrack: track type undefined, can not parse'); } - const trackType = getTrackTypeForValueTypeName(json.type); - if (json.times === undefined) { const times = [], - values = []; + values = []; AnimationUtils.flattenJSON(json.keys, times, values, 'value'); json.times = times; json.values = values; - } // derived classes can define a static parse method - + } + // derived classes can define a static parse method if (trackType.parse !== undefined) { return trackType.parse(json); } else { @@ -28806,12 +25873,16 @@ const Cache = { enabled: false, files: {}, add: function (key, file) { - if (this.enabled === false) return; // console.log( 'THREE.Cache', 'Adding key:', key ); + if (this.enabled === false) return; + + // console.log( 'THREE.Cache', 'Adding key:', key ); this.files[key] = file; }, get: function (key) { - if (this.enabled === false) return; // console.log( 'THREE.Cache', 'Checking key:', key ); + if (this.enabled === false) return; + + // console.log( 'THREE.Cache', 'Checking key:', key ); return this.files[key]; }, @@ -28830,76 +25901,62 @@ class LoadingManager { let itemsLoaded = 0; let itemsTotal = 0; let urlModifier = undefined; - const handlers = []; // Refer to #5689 for the reason why we don't set .onStart + const handlers = []; + + // Refer to #5689 for the reason why we don't set .onStart // in the constructor this.onStart = undefined; this.onLoad = onLoad; this.onProgress = onProgress; this.onError = onError; - this.itemStart = function (url) { itemsTotal++; - if (isLoading === false) { if (scope.onStart !== undefined) { scope.onStart(url, itemsLoaded, itemsTotal); } } - isLoading = true; }; - this.itemEnd = function (url) { itemsLoaded++; - if (scope.onProgress !== undefined) { scope.onProgress(url, itemsLoaded, itemsTotal); } - if (itemsLoaded === itemsTotal) { isLoading = false; - if (scope.onLoad !== undefined) { scope.onLoad(); } } }; - this.itemError = function (url) { if (scope.onError !== undefined) { scope.onError(url); } }; - this.resolveURL = function (url) { if (urlModifier) { return urlModifier(url); } - return url; }; - this.setURLModifier = function (transform) { urlModifier = transform; return this; }; - this.addHandler = function (regex, loader) { handlers.push(regex, loader); return this; }; - this.removeHandler = function (regex) { const index = handlers.indexOf(regex); - if (index !== -1) { handlers.splice(index, 2); } - return this; }; - this.getHandler = function (file) { for (let i = 0, l = handlers.length; i < l; i += 2) { const regex = handlers[i]; @@ -28910,13 +25967,10 @@ class LoadingManager { return loader; } } - return null; }; } - } - const DefaultLoadingManager = new LoadingManager(); class Loader { @@ -28928,58 +25982,46 @@ class Loader { this.resourcePath = ''; this.requestHeader = {}; } - - load() {} - + load(/* url, onLoad, onProgress, onError */) {} loadAsync(url, onProgress) { const scope = this; return new Promise(function (resolve, reject) { scope.load(url, resolve, onProgress, reject); }); } - - parse() {} - + parse(/* data */) {} setCrossOrigin(crossOrigin) { this.crossOrigin = crossOrigin; return this; } - setWithCredentials(value) { this.withCredentials = value; return this; } - setPath(path) { this.path = path; return this; } - setResourcePath(resourcePath) { this.resourcePath = resourcePath; return this; } - setRequestHeader(requestHeader) { this.requestHeader = requestHeader; return this; } - } const loading = {}; - class FileLoader extends Loader { constructor(manager) { super(manager); } - load(url, onLoad, onProgress, onError) { if (url === undefined) url = ''; if (this.path !== undefined) url = this.path + url; url = this.manager.resolveURL(url); const cached = Cache.get(url); - if (cached !== undefined) { this.manager.itemStart(url); setTimeout(() => { @@ -28987,8 +26029,9 @@ class FileLoader extends Loader { this.manager.itemEnd(url); }, 0); return cached; - } // Check if request is duplicate + } + // Check if request is duplicate if (loading[url] !== undefined) { loading[url].push({ @@ -28997,48 +26040,50 @@ class FileLoader extends Loader { onError: onError }); return; - } // Initialise array for duplicate requests - + } + // Initialise array for duplicate requests loading[url] = []; loading[url].push({ onLoad: onLoad, onProgress: onProgress, onError: onError - }); // create request + }); + // create request const req = new platform.Request(url, { headers: new platform.Headers(this.requestHeader), - credentials: this.withCredentials ? 'include' : 'same-origin' // An abort controller could be added within a future PR - - }); // record states ( avoid data race ) + credentials: this.withCredentials ? 'include' : 'same-origin' + // An abort controller could be added within a future PR + }); + // record states ( avoid data race ) const mimeType = this.mimeType; - const responseType = this.responseType; // start the fetch + const responseType = this.responseType; + // start the fetch platform.fetch(req).then(response => { if (response.status === 200 || response.status === 0) { // Some browsers return HTTP Status 0 when using non-http protocol // e.g. 'file://' or 'data://'. Handle as success. + if (response.status === 0) { console.warn('THREE.FileLoader: HTTP Status 0 received.'); } - if (typeof ReadableStream === 'undefined' || response.body === undefined || response.body.getReader === undefined) { return response; } - const callbacks = loading[url]; const reader = response.body.getReader(); const contentLength = response.headers.get('Content-Length'); const total = contentLength ? parseInt(contentLength) : 0; const lengthComputable = total !== 0; - let loaded = 0; // periodically read data into the new stream tracking while download progress + let loaded = 0; + // periodically read data into the new stream tracking while download progress const stream = new ReadableStream({ start(controller) { readData(); - function readData() { reader.read().then(({ done, @@ -29053,19 +26098,16 @@ class FileLoader extends Loader { loaded, total }); - for (let i = 0, il = callbacks.length; i < il; i++) { const callback = callbacks[i]; if (callback.onProgress) callback.onProgress(event); } - controller.enqueue(value); readData(); } }); } } - }); return new Response(stream); } else { @@ -29075,19 +26117,15 @@ class FileLoader extends Loader { switch (responseType) { case 'arraybuffer': return response.arrayBuffer(); - case 'blob': return response.blob(); - case 'document': return response.text().then(text => { const parser = new DOMParser(); return parser.parseFromString(text, mimeType); }); - case 'json': return response.json(); - default: if (mimeType === undefined) { return response.text(); @@ -29099,7 +26137,6 @@ class FileLoader extends Loader { const decoder = new TextDecoder(label); return response.arrayBuffer().then(ab => decoder.decode(ab)); } - } }).then(data => { // Add to cache only on HTTP success, so that we do not cache @@ -29107,52 +26144,44 @@ class FileLoader extends Loader { Cache.add(url, data); const callbacks = loading[url]; delete loading[url]; - for (let i = 0, il = callbacks.length; i < il; i++) { const callback = callbacks[i]; if (callback.onLoad) callback.onLoad(data); } }).catch(err => { // Abort errors and other errors are handled the same - const callbacks = loading[url]; + const callbacks = loading[url]; if (callbacks === undefined) { // When onLoad was called and url was deleted in `loading` this.manager.itemError(url); throw err; } - delete loading[url]; - for (let i = 0, il = callbacks.length; i < il; i++) { const callback = callbacks[i]; if (callback.onError) callback.onError(err); } - this.manager.itemError(url); }).finally(() => { this.manager.itemEnd(url); }); this.manager.itemStart(url); } - setResponseType(value) { this.responseType = value; return this; } - setMimeType(value) { this.mimeType = value; return this; } - } class AnimationLoader extends Loader { constructor(manager) { super(manager); } - load(url, onLoad, onProgress, onError) { const scope = this; const loader = new FileLoader(this.manager); @@ -29168,23 +26197,18 @@ class AnimationLoader extends Loader { } else { console.error(e); } - scope.manager.itemError(url); } }, onProgress, onError); } - parse(json) { const animations = []; - for (let i = 0; i < json.length; i++) { const clip = AnimationClip.parse(json[i]); animations.push(clip); } - return animations; } - } /** @@ -29197,7 +26221,6 @@ class CompressedTextureLoader extends Loader { constructor(manager) { super(manager); } - load(url, onLoad, onProgress, onError) { const scope = this; const images = []; @@ -29208,7 +26231,6 @@ class CompressedTextureLoader extends Loader { loader.setRequestHeader(this.requestHeader); loader.setWithCredentials(scope.withCredentials); let loaded = 0; - function loadTexture(i) { loader.load(url[i], function (buffer) { const texDatas = scope.parse(buffer, true); @@ -29219,7 +26241,6 @@ class CompressedTextureLoader extends Loader { mipmaps: texDatas.mipmaps }; loaded += 1; - if (loaded === 6) { if (texDatas.mipmapCount === 1) texture.minFilter = LinearFilter; texture.image = images; @@ -29229,24 +26250,21 @@ class CompressedTextureLoader extends Loader { } }, onProgress, onError); } - if (Array.isArray(url)) { for (let i = 0, il = url.length; i < il; ++i) { loadTexture(i); } } else { // compressed cubemap texture stored in a single DDS file + loader.load(url, function (buffer) { const texDatas = scope.parse(buffer, true); - if (texDatas.isCubemap) { const faces = texDatas.mipmaps.length / texDatas.mipmapCount; - for (let f = 0; f < faces; f++) { images[f] = { mipmaps: [] }; - for (let i = 0; i < texDatas.mipmapCount; i++) { images[f].mipmaps.push(texDatas.mipmaps[f * texDatas.mipmapCount + i]); images[f].format = texDatas.format; @@ -29254,40 +26272,33 @@ class CompressedTextureLoader extends Loader { images[f].height = texDatas.height; } } - texture.image = images; } else { texture.image.width = texDatas.width; texture.image.height = texDatas.height; texture.mipmaps = texDatas.mipmaps; } - if (texDatas.mipmapCount === 1) { texture.minFilter = LinearFilter; } - texture.format = texDatas.format; texture.needsUpdate = true; if (onLoad) onLoad(texture); }, onProgress, onError); } - return texture; } - } class ImageLoader extends Loader { constructor(manager) { super(manager); } - load(url, onLoad, onProgress, onError) { if (this.path !== undefined) url = this.path + url; url = this.manager.resolveURL(url); const scope = this; const cached = Cache.get(url); - if (cached !== undefined) { scope.manager.itemStart(url); setTimeout(function () { @@ -29296,73 +26307,59 @@ class ImageLoader extends Loader { }, 0); return cached; } - const image = createElementNS('img'); - function onImageLoad() { removeEventListeners(); Cache.add(url, this); if (onLoad) onLoad(this); scope.manager.itemEnd(url); } - function onImageError(event) { removeEventListeners(); if (onError) onError(event); scope.manager.itemError(url); scope.manager.itemEnd(url); } - function removeEventListeners() { image.removeEventListener('load', onImageLoad, false); image.removeEventListener('error', onImageError, false); } - image.addEventListener('load', onImageLoad, false); image.addEventListener('error', onImageError, false); - if (url.substr(0, 5) !== 'data:') { if (this.crossOrigin !== undefined) image.crossOrigin = this.crossOrigin; } - scope.manager.itemStart(url); image.src = url; return image; } - } class CubeTextureLoader extends Loader { constructor(manager) { super(manager); } - load(urls, onLoad, onProgress, onError) { const texture = new CubeTexture(); const loader = new ImageLoader(this.manager); loader.setCrossOrigin(this.crossOrigin); loader.setPath(this.path); let loaded = 0; - function loadTexture(i) { loader.load(urls[i], function (image) { texture.images[i] = image; loaded++; - if (loaded === 6) { texture.needsUpdate = true; if (onLoad) onLoad(texture); } }, undefined, onError); } - for (let i = 0; i < urls.length; ++i) { loadTexture(i); } - return texture; } - } /** @@ -29375,7 +26372,6 @@ class DataTextureLoader extends Loader { constructor(manager) { super(manager); } - load(url, onLoad, onProgress, onError) { const scope = this; const texture = new DataTexture(); @@ -29387,7 +26383,6 @@ class DataTextureLoader extends Loader { loader.load(url, function (buffer) { const texData = scope.parse(buffer); if (!texData) return; - if (texData.image !== undefined) { texture.image = texData.image; } else if (texData.data !== undefined) { @@ -29395,55 +26390,44 @@ class DataTextureLoader extends Loader { texture.image.height = texData.height; texture.image.data = texData.data; } - texture.wrapS = texData.wrapS !== undefined ? texData.wrapS : ClampToEdgeWrapping; texture.wrapT = texData.wrapT !== undefined ? texData.wrapT : ClampToEdgeWrapping; texture.magFilter = texData.magFilter !== undefined ? texData.magFilter : LinearFilter; texture.minFilter = texData.minFilter !== undefined ? texData.minFilter : LinearFilter; texture.anisotropy = texData.anisotropy !== undefined ? texData.anisotropy : 1; - if (texData.encoding !== undefined) { texture.encoding = texData.encoding; } - if (texData.flipY !== undefined) { texture.flipY = texData.flipY; } - if (texData.format !== undefined) { texture.format = texData.format; } - if (texData.type !== undefined) { texture.type = texData.type; } - if (texData.mipmaps !== undefined) { texture.mipmaps = texData.mipmaps; texture.minFilter = LinearMipmapLinearFilter; // presumably... } - if (texData.mipmapCount === 1) { texture.minFilter = LinearFilter; } - if (texData.generateMipmaps !== undefined) { texture.generateMipmaps = texData.generateMipmaps; } - texture.needsUpdate = true; if (onLoad) onLoad(texture, texData); }, onProgress, onError); return texture; } - } class TextureLoader extends Loader { constructor(manager) { super(manager); } - load(url, onLoad, onProgress, onError) { const texture = new Texture(); const loader = new ImageLoader(this.manager); @@ -29452,14 +26436,12 @@ class TextureLoader extends Loader { loader.load(url, function (image) { texture.image = image; texture.needsUpdate = true; - if (onLoad !== undefined) { onLoad(texture); } }, onProgress, onError); return texture; } - } class Light extends Object3D { @@ -29469,17 +26451,16 @@ class Light extends Object3D { this.color = new Color(color); this.intensity = intensity; } + dispose() { - dispose() {// Empty here in base class; some subclasses override. + // Empty here in base class; some subclasses override. } - copy(source) { super.copy(source); this.color.copy(source.color); this.intensity = source.intensity; return this; } - toJSON(meta) { const data = super.toJSON(meta); data.object.color = this.color.getHex(); @@ -29492,9 +26473,7 @@ class Light extends Object3D { if (this.shadow !== undefined) data.object.shadow = this.shadow.toJSON(); return data; } - } - Light.prototype.isLight = true; class HemisphereLight extends Light { @@ -29505,23 +26484,17 @@ class HemisphereLight extends Light { this.updateMatrix(); this.groundColor = new Color(groundColor); } - copy(source) { Light.prototype.copy.call(this, source); this.groundColor.copy(source.groundColor); return this; } - } - HemisphereLight.prototype.isHemisphereLight = true; const _projScreenMatrix$1 = /*@__PURE__*/new Matrix4(); - const _lightPositionWorld$1 = /*@__PURE__*/new Vector3(); - const _lookTarget$1 = /*@__PURE__*/new Vector3(); - class LightShadow { constructor(camera) { this.camera = camera; @@ -29540,55 +26513,40 @@ class LightShadow { this._viewportCount = 1; this._viewports = [new Vector4(0, 0, 1, 1)]; } - getViewportCount() { return this._viewportCount; } - getFrustum() { return this._frustum; } - updateMatrices(light) { const shadowCamera = this.camera; const shadowMatrix = this.matrix; - _lightPositionWorld$1.setFromMatrixPosition(light.matrixWorld); - shadowCamera.position.copy(_lightPositionWorld$1); - _lookTarget$1.setFromMatrixPosition(light.target.matrixWorld); - shadowCamera.lookAt(_lookTarget$1); shadowCamera.updateMatrixWorld(); - _projScreenMatrix$1.multiplyMatrices(shadowCamera.projectionMatrix, shadowCamera.matrixWorldInverse); - this._frustum.setFromProjectionMatrix(_projScreenMatrix$1); - shadowMatrix.set(0.5, 0.0, 0.0, 0.5, 0.0, 0.5, 0.0, 0.5, 0.0, 0.0, 0.5, 0.5, 0.0, 0.0, 0.0, 1.0); shadowMatrix.multiply(shadowCamera.projectionMatrix); shadowMatrix.multiply(shadowCamera.matrixWorldInverse); } - getViewport(viewportIndex) { return this._viewports[viewportIndex]; } - getFrameExtents() { return this._frameExtents; } - dispose() { if (this.map) { this.map.dispose(); } - if (this.mapPass) { this.mapPass.dispose(); } } - copy(source) { this.camera = source.camera.clone(); this.bias = source.bias; @@ -29596,11 +26554,9 @@ class LightShadow { this.mapSize.copy(source.mapSize); return this; } - clone() { return new this.constructor().copy(this); } - toJSON() { const object = {}; if (this.bias !== 0) object.bias = this.bias; @@ -29611,7 +26567,6 @@ class LightShadow { delete object.camera.matrix; return object; } - } class SpotLightShadow extends LightShadow { @@ -29619,31 +26574,25 @@ class SpotLightShadow extends LightShadow { super(new PerspectiveCamera(50, 1, 0.5, 500)); this.focus = 1; } - updateMatrices(light) { const camera = this.camera; const fov = RAD2DEG * 2 * light.angle * this.focus; const aspect = this.mapSize.width / this.mapSize.height; const far = light.distance || camera.far; - if (fov !== camera.fov || aspect !== camera.aspect || far !== camera.far) { camera.fov = fov; camera.aspect = aspect; camera.far = far; camera.updateProjectionMatrix(); } - super.updateMatrices(light); } - copy(source) { super.copy(source); this.focus = source.focus; return this; } - } - SpotLightShadow.prototype.isSpotLightShadow = true; class SpotLight extends Light { @@ -29660,22 +26609,18 @@ class SpotLight extends Light { this.shadow = new SpotLightShadow(); } - get power() { // compute the light's luminous power (in lumens) from its intensity (in candela) // by convention for a spotlight, luminous power (lm) = π * luminous intensity (cd) return this.intensity * Math.PI; } - set power(power) { // set the light's intensity (in candela) from the desired luminous power (in lumens) this.intensity = power / Math.PI; } - dispose() { this.shadow.dispose(); } - copy(source) { super.copy(source); this.distance = source.distance; @@ -29686,23 +26631,19 @@ class SpotLight extends Light { this.shadow = source.shadow.clone(); return this; } - } - SpotLight.prototype.isSpotLight = true; const _projScreenMatrix = /*@__PURE__*/new Matrix4(); - const _lightPositionWorld = /*@__PURE__*/new Vector3(); - const _lookTarget = /*@__PURE__*/new Vector3(); - class PointLightShadow extends LightShadow { constructor() { super(new PerspectiveCamera(90, 1, 0.5, 500)); this._frameExtents = new Vector2(4, 2); this._viewportCount = 6; - this._viewports = [// These viewports map a cube-map onto a 2D texture with the + this._viewports = [ + // These viewports map a cube-map onto a 2D texture with the // following orientation: // // xzXZ @@ -29714,47 +26655,42 @@ class PointLightShadow extends LightShadow { // y - Negative y direction // Z - Positive z direction // z - Negative z direction + // positive X - new Vector4(2, 1, 1, 1), // negative X - new Vector4(0, 1, 1, 1), // positive Z - new Vector4(3, 1, 1, 1), // negative Z - new Vector4(1, 1, 1, 1), // positive Y - new Vector4(3, 0, 1, 1), // negative Y + new Vector4(2, 1, 1, 1), + // negative X + new Vector4(0, 1, 1, 1), + // positive Z + new Vector4(3, 1, 1, 1), + // negative Z + new Vector4(1, 1, 1, 1), + // positive Y + new Vector4(3, 0, 1, 1), + // negative Y new Vector4(1, 0, 1, 1)]; this._cubeDirections = [new Vector3(1, 0, 0), new Vector3(-1, 0, 0), new Vector3(0, 0, 1), new Vector3(0, 0, -1), new Vector3(0, 1, 0), new Vector3(0, -1, 0)]; this._cubeUps = [new Vector3(0, 1, 0), new Vector3(0, 1, 0), new Vector3(0, 1, 0), new Vector3(0, 1, 0), new Vector3(0, 0, 1), new Vector3(0, 0, -1)]; } - updateMatrices(light, viewportIndex = 0) { const camera = this.camera; const shadowMatrix = this.matrix; const far = light.distance || camera.far; - if (far !== camera.far) { camera.far = far; camera.updateProjectionMatrix(); } - _lightPositionWorld.setFromMatrixPosition(light.matrixWorld); - camera.position.copy(_lightPositionWorld); - _lookTarget.copy(camera.position); - _lookTarget.add(this._cubeDirections[viewportIndex]); - camera.up.copy(this._cubeUps[viewportIndex]); camera.lookAt(_lookTarget); camera.updateMatrixWorld(); shadowMatrix.makeTranslation(-_lightPositionWorld.x, -_lightPositionWorld.y, -_lightPositionWorld.z); - _projScreenMatrix.multiplyMatrices(camera.projectionMatrix, camera.matrixWorldInverse); - this._frustum.setFromProjectionMatrix(_projScreenMatrix); } - } - PointLightShadow.prototype.isPointLightShadow = true; class PointLight extends Light { @@ -29766,22 +26702,18 @@ class PointLight extends Light { this.shadow = new PointLightShadow(); } - get power() { // compute the light's luminous power (in lumens) from its intensity (in candela) // for an isotropic light source, luminous power (lm) = 4 π luminous intensity (cd) return this.intensity * 4 * Math.PI; } - set power(power) { // set the light's intensity (in candela) from the desired luminous power (in lumens) this.intensity = power / (4 * Math.PI); } - dispose() { this.shadow.dispose(); } - copy(source) { super.copy(source); this.distance = source.distance; @@ -29789,18 +26721,14 @@ class PointLight extends Light { this.shadow = source.shadow.clone(); return this; } - } - PointLight.prototype.isPointLight = true; class DirectionalLightShadow extends LightShadow { constructor() { super(new OrthographicCamera(-5, 5, 5, -5, 0.5, 500)); } - } - DirectionalLightShadow.prototype.isDirectionalLightShadow = true; class DirectionalLight extends Light { @@ -29812,20 +26740,16 @@ class DirectionalLight extends Light { this.target = new Object3D(); this.shadow = new DirectionalLightShadow(); } - dispose() { this.shadow.dispose(); } - copy(source) { super.copy(source); this.target = source.target.clone(); this.shadow = source.shadow.clone(); return this; } - } - DirectionalLight.prototype.isDirectionalLight = true; class AmbientLight extends Light { @@ -29833,9 +26757,7 @@ class AmbientLight extends Light { super(color, intensity); this.type = 'AmbientLight'; } - } - AmbientLight.prototype.isAmbientLight = true; class RectAreaLight extends Light { @@ -29845,33 +26767,27 @@ class RectAreaLight extends Light { this.width = width; this.height = height; } - get power() { // compute the light's luminous power (in lumens) from its intensity (in nits) return this.intensity * this.width * this.height * Math.PI; } - set power(power) { // set the light's intensity (in nits) from the desired luminous power (in lumens) this.intensity = power / (this.width * this.height * Math.PI); } - copy(source) { super.copy(source); this.width = source.width; this.height = source.height; return this; } - toJSON(meta) { const data = super.toJSON(meta); data.object.width = this.width; data.object.height = this.height; return data; } - } - RectAreaLight.prototype.isRectAreaLight = true; /** @@ -29881,178 +26797,162 @@ RectAreaLight.prototype.isRectAreaLight = true; * Secondary reference: * https://www.ppsloan.org/publications/StupidSH36.pdf */ + // 3-band SH defined by 9 coefficients class SphericalHarmonics3 { constructor() { this.coefficients = []; - for (let i = 0; i < 9; i++) { this.coefficients.push(new Vector3()); } } - set(coefficients) { for (let i = 0; i < 9; i++) { this.coefficients[i].copy(coefficients[i]); } - return this; } - zero() { for (let i = 0; i < 9; i++) { this.coefficients[i].set(0, 0, 0); } - return this; - } // get the radiance in the direction of the normal - // target is a Vector3 - + } + // get the radiance in the direction of the normal + // target is a Vector3 getAt(normal, target) { // normal is assumed to be unit length + const x = normal.x, - y = normal.y, - z = normal.z; - const coeff = this.coefficients; // band 0 + y = normal.y, + z = normal.z; + const coeff = this.coefficients; - target.copy(coeff[0]).multiplyScalar(0.282095); // band 1 + // band 0 + target.copy(coeff[0]).multiplyScalar(0.282095); + // band 1 target.addScaledVector(coeff[1], 0.488603 * y); target.addScaledVector(coeff[2], 0.488603 * z); - target.addScaledVector(coeff[3], 0.488603 * x); // band 2 + target.addScaledVector(coeff[3], 0.488603 * x); + // band 2 target.addScaledVector(coeff[4], 1.092548 * (x * y)); target.addScaledVector(coeff[5], 1.092548 * (y * z)); target.addScaledVector(coeff[6], 0.315392 * (3.0 * z * z - 1.0)); target.addScaledVector(coeff[7], 1.092548 * (x * z)); target.addScaledVector(coeff[8], 0.546274 * (x * x - y * y)); return target; - } // get the irradiance (radiance convolved with cosine lobe) in the direction of the normal + } + + // get the irradiance (radiance convolved with cosine lobe) in the direction of the normal // target is a Vector3 // https://graphics.stanford.edu/papers/envmap/envmap.pdf - - getIrradianceAt(normal, target) { // normal is assumed to be unit length + const x = normal.x, - y = normal.y, - z = normal.z; - const coeff = this.coefficients; // band 0 + y = normal.y, + z = normal.z; + const coeff = this.coefficients; + // band 0 target.copy(coeff[0]).multiplyScalar(0.886227); // π * 0.282095 - // band 1 + // band 1 target.addScaledVector(coeff[1], 2.0 * 0.511664 * y); // ( 2 * π / 3 ) * 0.488603 - target.addScaledVector(coeff[2], 2.0 * 0.511664 * z); - target.addScaledVector(coeff[3], 2.0 * 0.511664 * x); // band 2 + target.addScaledVector(coeff[3], 2.0 * 0.511664 * x); + // band 2 target.addScaledVector(coeff[4], 2.0 * 0.429043 * x * y); // ( π / 4 ) * 1.092548 - target.addScaledVector(coeff[5], 2.0 * 0.429043 * y * z); target.addScaledVector(coeff[6], 0.743125 * z * z - 0.247708); // ( π / 4 ) * 0.315392 * 3 - target.addScaledVector(coeff[7], 2.0 * 0.429043 * x * z); target.addScaledVector(coeff[8], 0.429043 * (x * x - y * y)); // ( π / 4 ) * 0.546274 return target; } - add(sh) { for (let i = 0; i < 9; i++) { this.coefficients[i].add(sh.coefficients[i]); } - return this; } - addScaledSH(sh, s) { for (let i = 0; i < 9; i++) { this.coefficients[i].addScaledVector(sh.coefficients[i], s); } - return this; } - scale(s) { for (let i = 0; i < 9; i++) { this.coefficients[i].multiplyScalar(s); } - return this; } - lerp(sh, alpha) { for (let i = 0; i < 9; i++) { this.coefficients[i].lerp(sh.coefficients[i], alpha); } - return this; } - equals(sh) { for (let i = 0; i < 9; i++) { if (!this.coefficients[i].equals(sh.coefficients[i])) { return false; } } - return true; } - copy(sh) { return this.set(sh.coefficients); } - clone() { return new this.constructor().copy(this); } - fromArray(array, offset = 0) { const coefficients = this.coefficients; - for (let i = 0; i < 9; i++) { coefficients[i].fromArray(array, offset + i * 3); } - return this; } - toArray(array = [], offset = 0) { const coefficients = this.coefficients; - for (let i = 0; i < 9; i++) { coefficients[i].toArray(array, offset + i * 3); } - return array; - } // evaluate the basis functions - // shBasis is an Array[ 9 ] - + } + // evaluate the basis functions + // shBasis is an Array[ 9 ] static getBasisAt(normal, shBasis) { // normal is assumed to be unit length + const x = normal.x, - y = normal.y, - z = normal.z; // band 0 + y = normal.y, + z = normal.z; - shBasis[0] = 0.282095; // band 1 + // band 0 + shBasis[0] = 0.282095; + // band 1 shBasis[1] = 0.488603 * y; shBasis[2] = 0.488603 * z; - shBasis[3] = 0.488603 * x; // band 2 + shBasis[3] = 0.488603 * x; + // band 2 shBasis[4] = 1.092548 * x * y; shBasis[5] = 1.092548 * y * z; shBasis[6] = 0.315392 * (3 * z * z - 1); shBasis[7] = 1.092548 * x * z; shBasis[8] = 0.546274 * (x * x - y * y); } - } - SphericalHarmonics3.prototype.isSphericalHarmonics3 = true; class LightProbe extends Light { @@ -30060,28 +26960,22 @@ class LightProbe extends Light { super(undefined, intensity); this.sh = sh; } - copy(source) { super.copy(source); this.sh.copy(source.sh); return this; } - fromJSON(json) { this.intensity = json.intensity; // TODO: Move this bit to Light.fromJSON(); - this.sh.fromArray(json.sh); return this; } - toJSON(meta) { const data = super.toJSON(meta); data.object.sh = this.sh.toArray(); return data; } - } - LightProbe.prototype.isLightProbe = true; class MaterialLoader extends Loader { @@ -30089,7 +26983,6 @@ class MaterialLoader extends Loader { super(manager); this.textures = {}; } - load(url, onLoad, onProgress, onError) { const scope = this; const loader = new FileLoader(scope.manager); @@ -30105,23 +26998,18 @@ class MaterialLoader extends Loader { } else { console.error(e); } - scope.manager.itemError(url); } }, onProgress, onError); } - parse(json) { const textures = this.textures; - function getTexture(name) { if (textures[name] === undefined) { console.warn('THREE.MaterialLoader: Undefined texture', name); } - return textures[name]; } - const material = new Materials[json.type](); if (json.uuid !== undefined) material.uuid = json.uuid; if (json.name !== undefined) material.name = json.name; @@ -30180,72 +27068,66 @@ class MaterialLoader extends Loader { if (json.visible !== undefined) material.visible = json.visible; if (json.toneMapped !== undefined) material.toneMapped = json.toneMapped; if (json.userData !== undefined) material.userData = json.userData; - if (json.vertexColors !== undefined) { if (typeof json.vertexColors === 'number') { material.vertexColors = json.vertexColors > 0 ? true : false; } else { material.vertexColors = json.vertexColors; } - } // Shader Material + } + // Shader Material if (json.uniforms !== undefined) { for (const name in json.uniforms) { const uniform = json.uniforms[name]; material.uniforms[name] = {}; - switch (uniform.type) { case 't': material.uniforms[name].value = getTexture(uniform.value); break; - case 'c': material.uniforms[name].value = new Color().setHex(uniform.value); break; - case 'v2': material.uniforms[name].value = new Vector2().fromArray(uniform.value); break; - case 'v3': material.uniforms[name].value = new Vector3().fromArray(uniform.value); break; - case 'v4': material.uniforms[name].value = new Vector4().fromArray(uniform.value); break; - case 'm3': material.uniforms[name].value = new Matrix3().fromArray(uniform.value); break; - case 'm4': material.uniforms[name].value = new Matrix4().fromArray(uniform.value); break; - default: material.uniforms[name].value = uniform.value; } } } - if (json.defines !== undefined) material.defines = json.defines; if (json.vertexShader !== undefined) material.vertexShader = json.vertexShader; if (json.fragmentShader !== undefined) material.fragmentShader = json.fragmentShader; - if (json.extensions !== undefined) { for (const key in json.extensions) { material.extensions[key] = json.extensions[key]; } - } // Deprecated + } + // Deprecated if (json.shading !== undefined) material.flatShading = json.shading === 1; // THREE.FlatShading + // for PointsMaterial if (json.size !== undefined) material.size = json.size; - if (json.sizeAttenuation !== undefined) material.sizeAttenuation = json.sizeAttenuation; // maps + if (json.sizeAttenuation !== undefined) material.sizeAttenuation = json.sizeAttenuation; + + // maps if (json.map !== undefined) material.map = getTexture(json.map); if (json.matcap !== undefined) material.matcap = getTexture(json.matcap); @@ -30254,18 +27136,15 @@ class MaterialLoader extends Loader { if (json.bumpScale !== undefined) material.bumpScale = json.bumpScale; if (json.normalMap !== undefined) material.normalMap = getTexture(json.normalMap); if (json.normalMapType !== undefined) material.normalMapType = json.normalMapType; - if (json.normalScale !== undefined) { let normalScale = json.normalScale; - if (Array.isArray(normalScale) === false) { // Blender exporter used to export a scalar. See #7459 + normalScale = [normalScale, normalScale]; } - material.normalScale = new Vector2().fromArray(normalScale); } - if (json.displacementMap !== undefined) material.displacementMap = getTexture(json.displacementMap); if (json.displacementScale !== undefined) material.displacementScale = json.displacementScale; if (json.displacementBias !== undefined) material.displacementBias = json.displacementBias; @@ -30295,64 +27174,65 @@ class MaterialLoader extends Loader { if (json.sheenRoughnessMap !== undefined) material.sheenRoughnessMap = getTexture(json.sheenRoughnessMap); return material; } - setTextures(value) { this.textures = value; return this; } - } class LoaderUtils { static decodeText(array) { if (typeof TextDecoder !== 'undefined') { return new TextDecoder().decode(array); - } // Avoid the String.fromCharCode.apply(null, array) shortcut, which - // throws a "maximum call stack size exceeded" error for large arrays. + } + // Avoid the String.fromCharCode.apply(null, array) shortcut, which + // throws a "maximum call stack size exceeded" error for large arrays. let s = ''; - for (let i = 0, il = array.length; i < il; i++) { // Implicitly assumes little-endian. s += String.fromCharCode(array[i]); } - try { // merges multi-byte utf-8 characters. + return decodeURIComponent(escape(s)); } catch (e) { // see #16358 + return s; } } - static extractUrlBase(url) { const index = url.lastIndexOf('/'); if (index === -1) return './'; return url.substr(0, index + 1); } - static resolveURL(url, path) { // Invalid URL - if (typeof url !== 'string' || url === '') return ''; // Host Relative URL + if (typeof url !== 'string' || url === '') return ''; + // Host Relative URL if (/^https?:\/\//i.test(path) && /^\//.test(url)) { path = path.replace(/(^https?:\/\/[^\/]+).*/i, '$1'); - } // Absolute URL http://,https://,// - + } - if (/^(https?:)?\/\//i.test(url)) return url; // wxfile URL wxfile:// + // Absolute URL http://,https://,// + if (/^(https?:)?\/\//i.test(url)) return url; - if (/^wxfile:\/\//i.test(url)) return url; // Data URI + // wxfile URL wxfile:// + if (/^wxfile:\/\//i.test(url)) return url; - if (/^data:.*,.*$/i.test(url)) return url; // Blob URL + // Data URI + if (/^data:.*,.*$/i.test(url)) return url; - if (/^blob:.*$/i.test(url)) return url; // Relative URL + // Blob URL + if (/^blob:.*$/i.test(url)) return url; + // Relative URL return path + url; } - } class InstancedBufferGeometry extends BufferGeometry { @@ -30361,33 +27241,27 @@ class InstancedBufferGeometry extends BufferGeometry { this.type = 'InstancedBufferGeometry'; this.instanceCount = Infinity; } - copy(source) { super.copy(source); this.instanceCount = source.instanceCount; return this; } - clone() { return new this.constructor().copy(this); } - toJSON() { const data = super.toJSON(this); data.instanceCount = this.instanceCount; data.isInstancedBufferGeometry = true; return data; } - } - InstancedBufferGeometry.prototype.isInstancedBufferGeometry = true; class BufferGeometryLoader extends Loader { constructor(manager) { super(manager); } - load(url, onLoad, onProgress, onError) { const scope = this; const loader = new FileLoader(scope.manager); @@ -30403,16 +27277,13 @@ class BufferGeometryLoader extends Loader { } else { console.error(e); } - scope.manager.itemError(url); } }, onProgress, onError); } - parse(json) { const interleavedBufferMap = {}; const arrayBufferMap = {}; - function getInterleavedBuffer(json, uuid) { if (interleavedBufferMap[uuid] !== undefined) return interleavedBufferMap[uuid]; const interleavedBuffers = json.interleavedBuffers; @@ -30424,7 +27295,6 @@ class BufferGeometryLoader extends Loader { interleavedBufferMap[uuid] = ib; return ib; } - function getArrayBuffer(json, uuid) { if (arrayBufferMap[uuid] !== undefined) return arrayBufferMap[uuid]; const arrayBuffers = json.arrayBuffers; @@ -30433,21 +27303,16 @@ class BufferGeometryLoader extends Loader { arrayBufferMap[uuid] = ab; return ab; } - const geometry = json.isInstancedBufferGeometry ? new InstancedBufferGeometry() : new BufferGeometry(); const index = json.data.index; - if (index !== undefined) { const typedArray = getTypedArray(index.type, index.array); geometry.setIndex(new BufferAttribute(typedArray, 1)); } - const attributes = json.data.attributes; - for (const key in attributes) { const attribute = attributes[key]; let bufferAttribute; - if (attribute.isInterleavedBufferAttribute) { const interleavedBuffer = getInterleavedBuffer(json.data, attribute.data); bufferAttribute = new InterleavedBufferAttribute(interleavedBuffer, attribute.itemSize, attribute.offset, attribute.normalized); @@ -30456,29 +27321,22 @@ class BufferGeometryLoader extends Loader { const bufferAttributeConstr = attribute.isInstancedBufferAttribute ? InstancedBufferAttribute : BufferAttribute; bufferAttribute = new bufferAttributeConstr(typedArray, attribute.itemSize, attribute.normalized); } - if (attribute.name !== undefined) bufferAttribute.name = attribute.name; if (attribute.usage !== undefined) bufferAttribute.setUsage(attribute.usage); - if (attribute.updateRange !== undefined) { bufferAttribute.updateRange.offset = attribute.updateRange.offset; bufferAttribute.updateRange.count = attribute.updateRange.count; } - geometry.setAttribute(key, bufferAttribute); } - const morphAttributes = json.data.morphAttributes; - if (morphAttributes) { for (const key in morphAttributes) { const attributeArray = morphAttributes[key]; const array = []; - for (let i = 0, il = attributeArray.length; i < il; i++) { const attribute = attributeArray[i]; let bufferAttribute; - if (attribute.isInterleavedBufferAttribute) { const interleavedBuffer = getInterleavedBuffer(json.data, attribute.data); bufferAttribute = new InterleavedBufferAttribute(interleavedBuffer, attribute.itemSize, attribute.offset, attribute.normalized); @@ -30486,54 +27344,41 @@ class BufferGeometryLoader extends Loader { const typedArray = getTypedArray(attribute.type, attribute.array); bufferAttribute = new BufferAttribute(typedArray, attribute.itemSize, attribute.normalized); } - if (attribute.name !== undefined) bufferAttribute.name = attribute.name; array.push(bufferAttribute); } - geometry.morphAttributes[key] = array; } } - const morphTargetsRelative = json.data.morphTargetsRelative; - if (morphTargetsRelative) { geometry.morphTargetsRelative = true; } - const groups = json.data.groups || json.data.drawcalls || json.data.offsets; - if (groups !== undefined) { for (let i = 0, n = groups.length; i !== n; ++i) { const group = groups[i]; geometry.addGroup(group.start, group.count, group.materialIndex); } } - const boundingSphere = json.data.boundingSphere; - if (boundingSphere !== undefined) { const center = new Vector3(); - if (boundingSphere.center !== undefined) { center.fromArray(boundingSphere.center); } - geometry.boundingSphere = new Sphere(center, boundingSphere.radius); } - if (json.name) geometry.name = json.name; if (json.userData) geometry.userData = json.userData; return geometry; } - } class ObjectLoader extends Loader { constructor(manager) { super(manager); } - load(url, onLoad, onProgress, onError) { const scope = this; const path = this.path === '' ? LoaderUtils.extractUrlBase(url) : this.path; @@ -30544,7 +27389,6 @@ class ObjectLoader extends Loader { loader.setWithCredentials(this.withCredentials); loader.load(url, function (text) { let json = null; - try { json = JSON.parse(text); } catch (error) { @@ -30552,18 +27396,14 @@ class ObjectLoader extends Loader { console.error('THREE:ObjectLoader: Can\'t parse ' + url + '.', error.message); return; } - const metadata = json.metadata; - if (metadata === undefined || metadata.type === undefined || metadata.type.toLowerCase() === 'geometry') { console.error('THREE.ObjectLoader: Can\'t load ' + url); return; } - scope.parse(json, onLoad); }, onProgress, onError); } - async loadAsync(url, onProgress) { const scope = this; const path = this.path === '' ? LoaderUtils.extractUrlBase(url) : this.path; @@ -30575,14 +27415,11 @@ class ObjectLoader extends Loader { const text = await loader.loadAsync(url, onProgress); const json = JSON.parse(text); const metadata = json.metadata; - if (metadata === undefined || metadata.type === undefined || metadata.type.toLowerCase() === 'geometry') { throw new Error('THREE.ObjectLoader: Can\'t load ' + url); } - return await scope.parseAsync(json); } - parse(json, onLoad) { const animations = this.parseAnimations(json.animations); const shapes = this.parseShapes(json.shapes); @@ -30594,24 +27431,22 @@ class ObjectLoader extends Loader { const materials = this.parseMaterials(json.materials, textures); const object = this.parseObject(json.object, geometries, materials, textures, animations); const skeletons = this.parseSkeletons(json.skeletons, object); - this.bindSkeletons(object, skeletons); // + this.bindSkeletons(object, skeletons); + + // if (onLoad !== undefined) { let hasImages = false; - for (const uuid in images) { if (images[uuid] instanceof HTMLImageElement) { hasImages = true; break; } } - if (hasImages === false) onLoad(object); } - return object; } - async parseAsync(json) { const animations = this.parseAnimations(json.animations); const shapes = this.parseShapes(json.shapes); @@ -30624,27 +27459,27 @@ class ObjectLoader extends Loader { this.bindSkeletons(object, skeletons); return object; } - parseShapes(json) { const shapes = {}; - if (json !== undefined) { for (let i = 0, l = json.length; i < l; i++) { const shape = new Shape().fromJSON(json[i]); shapes[shape.uuid] = shape; } } - return shapes; } - parseSkeletons(json, object) { const skeletons = {}; - const bones = {}; // generate bone lookup table + const bones = {}; + + // generate bone lookup table object.traverse(function (child) { if (child.isBone) bones[child.uuid] = child; - }); // create skeletons + }); + + // create skeletons if (json !== undefined) { for (let i = 0, l = json.length; i < l; i++) { @@ -30652,92 +27487,70 @@ class ObjectLoader extends Loader { skeletons[skeleton.uuid] = skeleton; } } - return skeletons; } - parseGeometries(json, shapes) { const geometries = {}; - if (json !== undefined) { const bufferGeometryLoader = new BufferGeometryLoader(); - for (let i = 0, l = json.length; i < l; i++) { let geometry; const data = json[i]; - switch (data.type) { case 'BufferGeometry': case 'InstancedBufferGeometry': geometry = bufferGeometryLoader.parse(data); break; - case 'Geometry': console.error('THREE.ObjectLoader: The legacy Geometry type is no longer supported.'); break; - default: if (data.type in Geometries) { geometry = Geometries[data.type].fromJSON(data, shapes); } else { console.warn(`THREE.ObjectLoader: Unsupported geometry type "${data.type}"`); } - } - geometry.uuid = data.uuid; if (data.name !== undefined) geometry.name = data.name; if (geometry.isBufferGeometry === true && data.userData !== undefined) geometry.userData = data.userData; geometries[data.uuid] = geometry; } } - return geometries; } - parseMaterials(json, textures) { const cache = {}; // MultiMaterial - const materials = {}; - if (json !== undefined) { const loader = new MaterialLoader(); loader.setTextures(textures); - for (let i = 0, l = json.length; i < l; i++) { const data = json[i]; - if (data.type === 'MultiMaterial') { // Deprecated - const array = []; + const array = []; for (let j = 0; j < data.materials.length; j++) { const material = data.materials[j]; - if (cache[material.uuid] === undefined) { cache[material.uuid] = loader.parse(material); } - array.push(cache[material.uuid]); } - materials[data.uuid] = array; } else { if (cache[data.uuid] === undefined) { cache[data.uuid] = loader.parse(data); } - materials[data.uuid] = cache[data.uuid]; } } } - return materials; } - parseAnimations(json) { const animations = {}; - if (json !== undefined) { for (let i = 0; i < json.length; i++) { const data = json[i]; @@ -30745,15 +27558,12 @@ class ObjectLoader extends Loader { animations[clip.uuid] = clip; } } - return animations; } - parseImages(json, onLoad) { const scope = this; const images = {}; let loader; - function loadImage(url) { scope.manager.itemStart(url); return loader.load(url, function () { @@ -30763,7 +27573,6 @@ class ObjectLoader extends Loader { scope.manager.itemEnd(url); }); } - function deserializeImage(image) { if (typeof image === 'string') { const url = image; @@ -30781,52 +27590,46 @@ class ObjectLoader extends Loader { } } } - if (json !== undefined && json.length > 0) { const manager = new LoadingManager(onLoad); loader = new ImageLoader(manager); loader.setCrossOrigin(this.crossOrigin); - for (let i = 0, il = json.length; i < il; i++) { const image = json[i]; const url = image.url; - if (Array.isArray(url)) { // load array of images e.g CubeTexture - images[image.uuid] = []; + images[image.uuid] = []; for (let j = 0, jl = url.length; j < jl; j++) { const currentUrl = url[j]; const deserializedImage = deserializeImage(currentUrl); - if (deserializedImage !== null) { if (deserializedImage instanceof HTMLImageElement) { images[image.uuid].push(deserializedImage); } else { // special case: handle array of data textures for cube textures + images[image.uuid].push(new DataTexture(deserializedImage.data, deserializedImage.width, deserializedImage.height)); } } } } else { // load single image - const deserializedImage = deserializeImage(image.url); + const deserializedImage = deserializeImage(image.url); if (deserializedImage !== null) { images[image.uuid] = deserializedImage; } } } } - return images; } - async parseImagesAsync(json) { const scope = this; const images = {}; let loader; - async function deserializeImage(image) { if (typeof image === 'string') { const url = image; @@ -30844,70 +27647,59 @@ class ObjectLoader extends Loader { } } } - if (json !== undefined && json.length > 0) { loader = new ImageLoader(this.manager); loader.setCrossOrigin(this.crossOrigin); - for (let i = 0, il = json.length; i < il; i++) { const image = json[i]; const url = image.url; - if (Array.isArray(url)) { // load array of images e.g CubeTexture - images[image.uuid] = []; + images[image.uuid] = []; for (let j = 0, jl = url.length; j < jl; j++) { const currentUrl = url[j]; const deserializedImage = await deserializeImage(currentUrl); - if (deserializedImage !== null) { if (deserializedImage instanceof HTMLImageElement) { images[image.uuid].push(deserializedImage); } else { // special case: handle array of data textures for cube textures + images[image.uuid].push(new DataTexture(deserializedImage.data, deserializedImage.width, deserializedImage.height)); } } } } else { // load single image - const deserializedImage = await deserializeImage(image.url); + const deserializedImage = await deserializeImage(image.url); if (deserializedImage !== null) { images[image.uuid] = deserializedImage; } } } } - return images; } - parseTextures(json, images) { function parseConstant(value, type) { if (typeof value === 'number') return value; console.warn('THREE.ObjectLoader.parseTexture: Constant should be in numeric form.', value); return type[value]; } - const textures = {}; - if (json !== undefined) { for (let i = 0, l = json.length; i < l; i++) { const data = json[i]; - if (data.image === undefined) { console.warn('THREE.ObjectLoader: No "image" specified for', data.uuid); } - if (images[data.image] === undefined) { console.warn('THREE.ObjectLoader: Undefined image', data.image); } - let texture; const image = images[data.image]; - if (Array.isArray(image)) { texture = new CubeTexture(image); if (image.length === 6) texture.needsUpdate = true; @@ -30917,10 +27709,8 @@ class ObjectLoader extends Loader { } else { texture = new Texture(image); } - if (image) texture.needsUpdate = true; // textures can have undefined image data } - texture.uuid = data.uuid; if (data.name !== undefined) texture.name = data.name; if (data.mapping !== undefined) texture.mapping = parseConstant(data.mapping, TEXTURE_MAPPING); @@ -30928,12 +27718,10 @@ class ObjectLoader extends Loader { if (data.repeat !== undefined) texture.repeat.fromArray(data.repeat); if (data.center !== undefined) texture.center.fromArray(data.center); if (data.rotation !== undefined) texture.rotation = data.rotation; - if (data.wrap !== undefined) { texture.wrapS = parseConstant(data.wrap[0], TEXTURE_WRAPPING); texture.wrapT = parseConstant(data.wrap[1], TEXTURE_WRAPPING); } - if (data.format !== undefined) texture.format = data.format; if (data.type !== undefined) texture.type = data.type; if (data.encoding !== undefined) texture.encoding = data.encoding; @@ -30947,61 +27735,44 @@ class ObjectLoader extends Loader { textures[data.uuid] = texture; } } - return textures; } - parseObject(data, geometries, materials, textures, animations) { let object; - function getGeometry(name) { if (geometries[name] === undefined) { console.warn('THREE.ObjectLoader: Undefined geometry', name); } - return geometries[name]; } - function getMaterial(name) { if (name === undefined) return undefined; - if (Array.isArray(name)) { const array = []; - for (let i = 0, l = name.length; i < l; i++) { const uuid = name[i]; - if (materials[uuid] === undefined) { console.warn('THREE.ObjectLoader: Undefined material', uuid); } - array.push(materials[uuid]); } - return array; } - if (materials[name] === undefined) { console.warn('THREE.ObjectLoader: Undefined material', name); } - return materials[name]; } - function getTexture(uuid) { if (textures[uuid] === undefined) { console.warn('THREE.ObjectLoader: Undefined texture', uuid); } - return textures[uuid]; } - let geometry, material; - switch (data.type) { case 'Scene': object = new Scene(); - if (data.background !== undefined) { if (Number.isInteger(data.background)) { object.background = new Color(data.background); @@ -31009,11 +27780,9 @@ class ObjectLoader extends Loader { object.background = getTexture(data.background); } } - if (data.environment !== undefined) { object.environment = getTexture(data.environment); } - if (data.fog !== undefined) { if (data.fog.type === 'Fog') { object.fog = new Fog(data.fog.color, data.fog.near, data.fog.far); @@ -31021,9 +27790,7 @@ class ObjectLoader extends Loader { object.fog = new FogExp2(data.fog.color, data.fog.density); } } - break; - case 'PerspectiveCamera': object = new PerspectiveCamera(data.fov, data.aspect, data.near, data.far); if (data.focus !== undefined) object.focus = data.focus; @@ -31032,41 +27799,32 @@ class ObjectLoader extends Loader { if (data.filmOffset !== undefined) object.filmOffset = data.filmOffset; if (data.view !== undefined) object.view = Object.assign({}, data.view); break; - case 'OrthographicCamera': object = new OrthographicCamera(data.left, data.right, data.top, data.bottom, data.near, data.far); if (data.zoom !== undefined) object.zoom = data.zoom; if (data.view !== undefined) object.view = Object.assign({}, data.view); break; - case 'AmbientLight': object = new AmbientLight(data.color, data.intensity); break; - case 'DirectionalLight': object = new DirectionalLight(data.color, data.intensity); break; - case 'PointLight': object = new PointLight(data.color, data.intensity, data.distance, data.decay); break; - case 'RectAreaLight': object = new RectAreaLight(data.color, data.intensity, data.width, data.height); break; - case 'SpotLight': object = new SpotLight(data.color, data.intensity, data.distance, data.angle, data.penumbra, data.decay); break; - case 'HemisphereLight': object = new HemisphereLight(data.color, data.groundColor, data.intensity); break; - case 'LightProbe': object = new LightProbe().fromJSON(data); break; - case 'SkinnedMesh': geometry = getGeometry(data.geometry); material = getMaterial(data.material); @@ -31075,13 +27833,11 @@ class ObjectLoader extends Loader { if (data.bindMatrix !== undefined) object.bindMatrix.fromArray(data.bindMatrix); if (data.skeleton !== undefined) object.skeleton = data.skeleton; break; - case 'Mesh': geometry = getGeometry(data.geometry); material = getMaterial(data.material); object = new Mesh(geometry, material); break; - case 'InstancedMesh': geometry = getGeometry(data.geometry); material = getMaterial(data.material); @@ -31092,47 +27848,36 @@ class ObjectLoader extends Loader { object.instanceMatrix = new InstancedBufferAttribute(new Float32Array(instanceMatrix.array), 16); if (instanceColor !== undefined) object.instanceColor = new InstancedBufferAttribute(new Float32Array(instanceColor.array), instanceColor.itemSize); break; - case 'LOD': object = new LOD(); break; - case 'Line': object = new Line(getGeometry(data.geometry), getMaterial(data.material)); break; - case 'LineLoop': object = new LineLoop(getGeometry(data.geometry), getMaterial(data.material)); break; - case 'LineSegments': object = new LineSegments(getGeometry(data.geometry), getMaterial(data.material)); break; - case 'PointCloud': case 'Points': object = new Points(getGeometry(data.geometry), getMaterial(data.material)); break; - case 'Sprite': object = new Sprite(getMaterial(data.material)); break; - case 'Group': object = new Group(); break; - case 'Bone': object = new Bone(); break; - default: object = new Object3D(); } - object.uuid = data.uuid; if (data.name !== undefined) object.name = data.name; - if (data.matrix !== undefined) { object.matrix.fromArray(data.matrix); if (data.matrixAutoUpdate !== undefined) object.matrixAutoUpdate = data.matrixAutoUpdate; @@ -31143,10 +27888,8 @@ class ObjectLoader extends Loader { if (data.quaternion !== undefined) object.quaternion.fromArray(data.quaternion); if (data.scale !== undefined) object.scale.fromArray(data.scale); } - if (data.castShadow !== undefined) object.castShadow = data.castShadow; if (data.receiveShadow !== undefined) object.receiveShadow = data.receiveShadow; - if (data.shadow) { if (data.shadow.bias !== undefined) object.shadow.bias = data.shadow.bias; if (data.shadow.normalBias !== undefined) object.shadow.normalBias = data.shadow.normalBias; @@ -31154,53 +27897,42 @@ class ObjectLoader extends Loader { if (data.shadow.mapSize !== undefined) object.shadow.mapSize.fromArray(data.shadow.mapSize); if (data.shadow.camera !== undefined) object.shadow.camera = this.parseObject(data.shadow.camera); } - if (data.visible !== undefined) object.visible = data.visible; if (data.frustumCulled !== undefined) object.frustumCulled = data.frustumCulled; if (data.renderOrder !== undefined) object.renderOrder = data.renderOrder; if (data.userData !== undefined) object.userData = data.userData; if (data.layers !== undefined) object.layers.mask = data.layers; - if (data.children !== undefined) { const children = data.children; - for (let i = 0; i < children.length; i++) { object.add(this.parseObject(children[i], geometries, materials, textures, animations)); } } - if (data.animations !== undefined) { const objectAnimations = data.animations; - for (let i = 0; i < objectAnimations.length; i++) { const uuid = objectAnimations[i]; object.animations.push(animations[uuid]); } } - if (data.type === 'LOD') { if (data.autoUpdate !== undefined) object.autoUpdate = data.autoUpdate; const levels = data.levels; - for (let l = 0; l < levels.length; l++) { const level = levels[l]; const child = object.getObjectByProperty('uuid', level.object); - if (child !== undefined) { object.addLevel(child, level.distance); } } } - return object; } - bindSkeletons(object, skeletons) { if (Object.keys(skeletons).length === 0) return; object.traverse(function (child) { if (child.isSkinnedMesh === true && child.skeleton !== undefined) { const skeleton = skeletons[child.skeleton]; - if (skeleton === undefined) { console.warn('THREE.ObjectLoader: No skeleton found with UUID:', child.skeleton); } else { @@ -31209,16 +27941,14 @@ class ObjectLoader extends Loader { } }); } - /* DEPRECATED */ + /* DEPRECATED */ setTexturePath(value) { console.warn('THREE.ObjectLoader: .setTexturePath() has been renamed to .setResourcePath().'); return this.setResourcePath(value); } - } - const TEXTURE_MAPPING = { UVMapping: UVMapping, CubeReflectionMapping: CubeReflectionMapping, @@ -31245,32 +27975,26 @@ const TEXTURE_FILTER = { class ImageBitmapLoader extends Loader { constructor(manager) { super(manager); - if (typeof createImageBitmap === 'undefined') { console.warn('THREE.ImageBitmapLoader: createImageBitmap() not supported.'); } - if (typeof fetch === 'undefined') { console.warn('THREE.ImageBitmapLoader: fetch() not supported.'); } - this.options = { premultiplyAlpha: 'none' }; } - setOptions(options) { this.options = options; return this; } - load(url, onLoad, onProgress, onError) { if (url === undefined) url = ''; if (this.path !== undefined) url = this.path + url; url = this.manager.resolveURL(url); const scope = this; const cached = Cache.get(url); - if (cached !== undefined) { scope.manager.itemStart(url); setTimeout(function () { @@ -31279,7 +28003,6 @@ class ImageBitmapLoader extends Loader { }, 0); return cached; } - const fetchOptions = {}; fetchOptions.credentials = this.crossOrigin === 'anonymous' ? 'same-origin' : 'include'; fetchOptions.headers = this.requestHeader; @@ -31300,9 +28023,7 @@ class ImageBitmapLoader extends Loader { }); scope.manager.itemStart(url); } - } - ImageBitmapLoader.prototype.isImageBitmapLoader = true; let _context; @@ -31311,7 +28032,6 @@ const AudioContext = { if (_context === undefined) { _context = new platform.AudioContext(); } - return _context; }, setContext: function (value) { @@ -31323,7 +28043,6 @@ class AudioLoader extends Loader { constructor(manager) { super(manager); } - load(url, onLoad, onProgress, onError) { const scope = this; const loader = new FileLoader(this.manager); @@ -31346,12 +28065,10 @@ class AudioLoader extends Loader { } else { console.error(e); } - scope.manager.itemError(url); } }, onProgress, onError); } - } class HemisphereLightProbe extends LightProbe { @@ -31360,36 +28077,31 @@ class HemisphereLightProbe extends LightProbe { const color1 = new Color().set(skyColor); const color2 = new Color().set(groundColor); const sky = new Vector3(color1.r, color1.g, color1.b); - const ground = new Vector3(color2.r, color2.g, color2.b); // without extra factor of PI in the shader, should = 1 / Math.sqrt( Math.PI ); + const ground = new Vector3(color2.r, color2.g, color2.b); + // without extra factor of PI in the shader, should = 1 / Math.sqrt( Math.PI ); const c0 = Math.sqrt(Math.PI); const c1 = c0 * Math.sqrt(0.75); this.sh.coefficients[0].copy(sky).add(ground).multiplyScalar(c0); this.sh.coefficients[1].copy(sky).sub(ground).multiplyScalar(c1); } - } - HemisphereLightProbe.prototype.isHemisphereLightProbe = true; class AmbientLightProbe extends LightProbe { constructor(color, intensity = 1) { super(undefined, intensity); - const color1 = new Color().set(color); // without extra factor of PI in the shader, would be 2 / Math.sqrt( Math.PI ); + const color1 = new Color().set(color); + // without extra factor of PI in the shader, would be 2 / Math.sqrt( Math.PI ); this.sh.coefficients[0].set(color1.r, color1.g, color1.b).multiplyScalar(2 * Math.sqrt(Math.PI)); } - } - AmbientLightProbe.prototype.isAmbientLightProbe = true; const _eyeRight = /*@__PURE__*/new Matrix4(); - const _eyeLeft = /*@__PURE__*/new Matrix4(); - const _projectionMatrix = /*@__PURE__*/new Matrix4(); - class StereoCamera { constructor() { this.type = 'StereoCamera'; @@ -31411,11 +28123,9 @@ class StereoCamera { eyeSep: null }; } - update(camera) { const cache = this._cache; const needsUpdate = cache.focus !== camera.focus || cache.fov !== camera.fov || cache.aspect !== camera.aspect * this.aspect || cache.near !== camera.near || cache.far !== camera.far || cache.zoom !== camera.zoom || cache.eyeSep !== this.eyeSep; - if (needsUpdate) { cache.focus = camera.focus; cache.fov = camera.fov; @@ -31423,24 +28133,31 @@ class StereoCamera { cache.near = camera.near; cache.far = camera.far; cache.zoom = camera.zoom; - cache.eyeSep = this.eyeSep; // Off-axis stereoscopic effect based on + cache.eyeSep = this.eyeSep; + + // Off-axis stereoscopic effect based on // http://paulbourke.net/stereographics/stereorender/ _projectionMatrix.copy(camera.projectionMatrix); - const eyeSepHalf = cache.eyeSep / 2; const eyeSepOnProjection = eyeSepHalf * cache.near / cache.focus; const ymax = cache.near * Math.tan(DEG2RAD * cache.fov * 0.5) / cache.zoom; - let xmin, xmax; // translate xOffset + let xmin, xmax; + + // translate xOffset _eyeLeft.elements[12] = -eyeSepHalf; - _eyeRight.elements[12] = eyeSepHalf; // for left eye + _eyeRight.elements[12] = eyeSepHalf; + + // for left eye xmin = -ymax * cache.aspect + eyeSepOnProjection; xmax = ymax * cache.aspect + eyeSepOnProjection; _projectionMatrix.elements[0] = 2 * cache.near / (xmax - xmin); _projectionMatrix.elements[8] = (xmax + xmin) / (xmax - xmin); - this.cameraL.projectionMatrix.copy(_projectionMatrix); // for right eye + this.cameraL.projectionMatrix.copy(_projectionMatrix); + + // for right eye xmin = -ymax * cache.aspect - eyeSepOnProjection; xmax = ymax * cache.aspect - eyeSepOnProjection; @@ -31448,11 +28165,9 @@ class StereoCamera { _projectionMatrix.elements[8] = (xmax + xmin) / (xmax - xmin); this.cameraR.projectionMatrix.copy(_projectionMatrix); } - this.cameraL.matrixWorld.copy(camera.matrixWorld).multiply(_eyeLeft); this.cameraR.matrixWorld.copy(camera.matrixWorld).multiply(_eyeRight); } - } class Clock { @@ -31463,57 +28178,44 @@ class Clock { this.elapsedTime = 0; this.running = false; } - start() { this.startTime = now(); this.oldTime = this.startTime; this.elapsedTime = 0; this.running = true; } - stop() { this.getElapsedTime(); this.running = false; this.autoStart = false; } - getElapsedTime() { this.getDelta(); return this.elapsedTime; } - getDelta() { let diff = 0; - if (this.autoStart && !this.running) { this.start(); return 0; } - if (this.running) { const newTime = now(); diff = (newTime - this.oldTime) / 1000; this.oldTime = newTime; this.elapsedTime += diff; } - return diff; } - } - function now() { return (typeof performance === 'undefined' ? Date : performance).now(); // see #10732 } const _position$1 = /*@__PURE__*/new Vector3(); - const _quaternion$1 = /*@__PURE__*/new Quaternion(); - const _scale$1 = /*@__PURE__*/new Vector3(); - const _orientation$1 = /*@__PURE__*/new Vector3(); - class AudioListener extends Object3D { constructor() { super(); @@ -31522,15 +28224,15 @@ class AudioListener extends Object3D { this.gain = this.context.createGain(); this.gain.connect(this.context.destination); this.filter = null; - this.timeDelta = 0; // private + this.timeDelta = 0; + + // private this._clock = new Clock(); } - getInput() { return this.gain; } - removeFilter() { if (this.filter !== null) { this.gain.disconnect(this.filter); @@ -31538,14 +28240,11 @@ class AudioListener extends Object3D { this.gain.connect(this.context.destination); this.filter = null; } - return this; } - getFilter() { return this.filter; } - setFilter(value) { if (this.filter !== null) { this.gain.disconnect(this.filter); @@ -31553,33 +28252,28 @@ class AudioListener extends Object3D { } else { this.gain.disconnect(this.context.destination); } - this.filter = value; this.gain.connect(this.filter); this.filter.connect(this.context.destination); return this; } - getMasterVolume() { return this.gain.gain.value; } - setMasterVolume(value) { this.gain.gain.setTargetAtTime(value, this.context.currentTime, 0.01); return this; } - updateMatrixWorld(force) { super.updateMatrixWorld(force); const listener = this.context.listener; const up = this.up; this.timeDelta = this._clock.getDelta(); this.matrixWorld.decompose(_position$1, _quaternion$1, _scale$1); - _orientation$1.set(0, 0, -1).applyQuaternion(_quaternion$1); - if (listener.positionX) { // code path for Chrome (see #14393) + const endTime = this.context.currentTime + this.timeDelta; listener.positionX.linearRampToValueAtTime(_position$1.x, endTime); listener.positionY.linearRampToValueAtTime(_position$1.y, endTime); @@ -31595,7 +28289,6 @@ class AudioListener extends Object3D { listener.setOrientation(_orientation$1.x, _orientation$1.y, _orientation$1.z, up.x, up.y, up.z); } } - } class Audio extends Object3D { @@ -31624,11 +28317,9 @@ class Audio extends Object3D { this._connected = false; this.filters = []; } - getOutput() { return this.gain; } - setNodeSource(audioNode) { this.hasPlaybackControl = false; this.sourceType = 'audioNode'; @@ -31636,7 +28327,6 @@ class Audio extends Object3D { this.connect(); return this; } - setMediaElementSource(mediaElement) { this.hasPlaybackControl = false; this.sourceType = 'mediaNode'; @@ -31644,7 +28334,6 @@ class Audio extends Object3D { this.connect(); return this; } - setMediaStreamSource(mediaStream) { this.hasPlaybackControl = false; this.sourceType = 'mediaStreamNode'; @@ -31652,25 +28341,21 @@ class Audio extends Object3D { this.connect(); return this; } - setBuffer(audioBuffer) { this.buffer = audioBuffer; this.sourceType = 'buffer'; if (this.autoplay) this.play(); return this; } - play(delay = 0) { if (this.isPlaying === true) { console.warn('THREE.Audio: Audio is already playing.'); return; } - if (this.hasPlaybackControl === false) { console.warn('THREE.Audio: this Audio has no playback control.'); return; } - this._startedAt = this.context.currentTime + delay; const source = this.context.createBufferSource(); source.buffer = this.buffer; @@ -31685,84 +28370,68 @@ class Audio extends Object3D { this.setPlaybackRate(this.playbackRate); return this.connect(); } - pause() { if (this.hasPlaybackControl === false) { console.warn('THREE.Audio: this Audio has no playback control.'); return; } - if (this.isPlaying === true) { // update current progress - this._progress += Math.max(this.context.currentTime - this._startedAt, 0) * this.playbackRate; + this._progress += Math.max(this.context.currentTime - this._startedAt, 0) * this.playbackRate; if (this.loop === true) { // ensure _progress does not exceed duration with looped audios + this._progress = this._progress % (this.duration || this.buffer.duration); } - this.source.stop(); this.source.onended = null; this.isPlaying = false; } - return this; } - stop() { if (this.hasPlaybackControl === false) { console.warn('THREE.Audio: this Audio has no playback control.'); return; } - this._progress = 0; this.source.stop(); this.source.onended = null; this.isPlaying = false; return this; } - connect() { if (this.filters.length > 0) { this.source.connect(this.filters[0]); - for (let i = 1, l = this.filters.length; i < l; i++) { this.filters[i - 1].connect(this.filters[i]); } - this.filters[this.filters.length - 1].connect(this.getOutput()); } else { this.source.connect(this.getOutput()); } - this._connected = true; return this; } - disconnect() { if (this.filters.length > 0) { this.source.disconnect(this.filters[0]); - for (let i = 1, l = this.filters.length; i < l; i++) { this.filters[i - 1].disconnect(this.filters[i]); } - this.filters[this.filters.length - 1].disconnect(this.getOutput()); } else { this.source.disconnect(this.getOutput()); } - this._connected = false; return this; } - getFilters() { return this.filters; } - setFilters(value) { if (!value) value = []; - if (this._connected === true) { this.disconnect(); this.filters = value.slice(); @@ -31770,10 +28439,8 @@ class Audio extends Object3D { } else { this.filters = value.slice(); } - return this; } - setDetune(value) { this.detune = value; if (this.source.detune === undefined) return; // only set detune when available @@ -31781,98 +28448,73 @@ class Audio extends Object3D { if (this.isPlaying === true) { this.source.detune.setTargetAtTime(this.detune, this.context.currentTime, 0.01); } - return this; } - getDetune() { return this.detune; } - getFilter() { return this.getFilters()[0]; } - setFilter(filter) { return this.setFilters(filter ? [filter] : []); } - setPlaybackRate(value) { if (this.hasPlaybackControl === false) { console.warn('THREE.Audio: this Audio has no playback control.'); return; } - this.playbackRate = value; - if (this.isPlaying === true) { this.source.playbackRate.setTargetAtTime(this.playbackRate, this.context.currentTime, 0.01); } - return this; } - getPlaybackRate() { return this.playbackRate; } - onEnded() { this.isPlaying = false; } - getLoop() { if (this.hasPlaybackControl === false) { console.warn('THREE.Audio: this Audio has no playback control.'); return false; } - return this.loop; } - setLoop(value) { if (this.hasPlaybackControl === false) { console.warn('THREE.Audio: this Audio has no playback control.'); return; } - this.loop = value; - if (this.isPlaying === true) { this.source.loop = this.loop; } - return this; } - setLoopStart(value) { this.loopStart = value; return this; } - setLoopEnd(value) { this.loopEnd = value; return this; } - getVolume() { return this.gain.gain.value; } - setVolume(value) { this.gain.gain.setTargetAtTime(value, this.context.currentTime, 0.01); return this; } - } const _position = /*@__PURE__*/new Vector3(); - const _quaternion = /*@__PURE__*/new Quaternion(); - const _scale = /*@__PURE__*/new Vector3(); - const _orientation = /*@__PURE__*/new Vector3(); - class PositionalAudio extends Audio { constructor(listener) { super(listener); @@ -31880,65 +28522,52 @@ class PositionalAudio extends Audio { this.panner.panningModel = 'HRTF'; this.panner.connect(this.gain); } - getOutput() { return this.panner; } - getRefDistance() { return this.panner.refDistance; } - setRefDistance(value) { this.panner.refDistance = value; return this; } - getRolloffFactor() { return this.panner.rolloffFactor; } - setRolloffFactor(value) { this.panner.rolloffFactor = value; return this; } - getDistanceModel() { return this.panner.distanceModel; } - setDistanceModel(value) { this.panner.distanceModel = value; return this; } - getMaxDistance() { return this.panner.maxDistance; } - setMaxDistance(value) { this.panner.maxDistance = value; return this; } - setDirectionalCone(coneInnerAngle, coneOuterAngle, coneOuterGain) { this.panner.coneInnerAngle = coneInnerAngle; this.panner.coneOuterAngle = coneOuterAngle; this.panner.coneOuterGain = coneOuterGain; return this; } - updateMatrixWorld(force) { super.updateMatrixWorld(force); if (this.hasPlaybackControl === true && this.isPlaying === false) return; this.matrixWorld.decompose(_position, _quaternion, _scale); - _orientation.set(0, 0, 1).applyQuaternion(_quaternion); - const panner = this.panner; - if (panner.positionX) { // code path for Chrome and Firefox (see #14393) + const endTime = this.context.currentTime + this.listener.timeDelta; panner.positionX.linearRampToValueAtTime(_position.x, endTime); panner.positionY.linearRampToValueAtTime(_position.y, endTime); @@ -31951,7 +28580,6 @@ class PositionalAudio extends Audio { panner.setOrientation(_orientation.x, _orientation.y, _orientation.z); } } - } class AudioAnalyser { @@ -31961,30 +28589,27 @@ class AudioAnalyser { this.data = new Uint8Array(this.analyser.frequencyBinCount); audio.getOutput().connect(this.analyser); } - getFrequencyData() { this.analyser.getByteFrequencyData(this.data); return this.data; } - getAverageFrequency() { let value = 0; const data = this.getFrequencyData(); - for (let i = 0; i < data.length; i++) { value += data[i]; } - return value / data.length; } - } class PropertyMixer { constructor(binding, typeName, valueSize) { this.binding = binding; this.valueSize = valueSize; - let mixFunction, mixFunctionAdditive, setIdentity; // buffer layout: [ incoming | accu0 | accu1 | orig | addAccu | (optional work) ] + let mixFunction, mixFunctionAdditive, setIdentity; + + // buffer layout: [ incoming | accu0 | accu1 | orig | addAccu | (optional work) ] // // interpolators can use .buffer as their .result // the data then goes to 'incoming' @@ -32008,24 +28633,22 @@ class PropertyMixer { this.buffer = new Float64Array(valueSize * 6); this._workIndex = 5; break; - case 'string': case 'bool': - mixFunction = this._select; // Use the regular mix function and for additive on these types, - // additive is not relevant for non-numeric types + mixFunction = this._select; + // Use the regular mix function and for additive on these types, + // additive is not relevant for non-numeric types mixFunctionAdditive = this._select; setIdentity = this._setAdditiveIdentityOther; this.buffer = new Array(valueSize * 5); break; - default: mixFunction = this._lerp; mixFunctionAdditive = this._lerpAdditive; setIdentity = this._setAdditiveIdentityNumeric; this.buffer = new Float64Array(valueSize * 5); } - this._mixBufferRegion = mixFunction; this._mixBufferRegionAdditive = mixFunctionAdditive; this._setIdentity = setIdentity; @@ -32035,133 +28658,126 @@ class PropertyMixer { this.cumulativeWeightAdditive = 0; this.useCount = 0; this.referenceCount = 0; - } // accumulate data in the 'incoming' region into 'accu' - + } + // accumulate data in the 'incoming' region into 'accu' accumulate(accuIndex, weight) { // note: happily accumulating nothing when weight = 0, the caller knows // the weight and shouldn't have made the call in the first place + const buffer = this.buffer, - stride = this.valueSize, - offset = accuIndex * stride + stride; + stride = this.valueSize, + offset = accuIndex * stride + stride; let currentWeight = this.cumulativeWeight; - if (currentWeight === 0) { // accuN := incoming * weight + for (let i = 0; i !== stride; ++i) { buffer[offset + i] = buffer[i]; } - currentWeight = weight; } else { // accuN := accuN + incoming * weight + currentWeight += weight; const mix = weight / currentWeight; - this._mixBufferRegion(buffer, offset, 0, mix, stride); } - this.cumulativeWeight = currentWeight; - } // accumulate data in the 'incoming' region into 'add' - + } + // accumulate data in the 'incoming' region into 'add' accumulateAdditive(weight) { const buffer = this.buffer, - stride = this.valueSize, - offset = stride * this._addIndex; - + stride = this.valueSize, + offset = stride * this._addIndex; if (this.cumulativeWeightAdditive === 0) { // add = identity + this._setIdentity(); - } // add := add + incoming * weight + } + // add := add + incoming * weight this._mixBufferRegionAdditive(buffer, offset, 0, weight, stride); - this.cumulativeWeightAdditive += weight; - } // apply the state of 'accu' to the binding when accus differ - + } + // apply the state of 'accu' to the binding when accus differ apply(accuIndex) { const stride = this.valueSize, - buffer = this.buffer, - offset = accuIndex * stride + stride, - weight = this.cumulativeWeight, - weightAdditive = this.cumulativeWeightAdditive, - binding = this.binding; + buffer = this.buffer, + offset = accuIndex * stride + stride, + weight = this.cumulativeWeight, + weightAdditive = this.cumulativeWeightAdditive, + binding = this.binding; this.cumulativeWeight = 0; this.cumulativeWeightAdditive = 0; - if (weight < 1) { // accuN := accuN + original * ( 1 - cumulativeWeight ) - const originalValueOffset = stride * this._origIndex; + const originalValueOffset = stride * this._origIndex; this._mixBufferRegion(buffer, offset, originalValueOffset, 1 - weight, stride); } - if (weightAdditive > 0) { // accuN := accuN + additive accuN + this._mixBufferRegionAdditive(buffer, offset, this._addIndex * stride, 1, stride); } - for (let i = stride, e = stride + stride; i !== e; ++i) { if (buffer[i] !== buffer[i + stride]) { // value has changed -> update scene graph + binding.setValue(buffer, offset); break; } } - } // remember the state of the bound property and copy it to both accus - + } + // remember the state of the bound property and copy it to both accus saveOriginalState() { const binding = this.binding; const buffer = this.buffer, - stride = this.valueSize, - originalValueOffset = stride * this._origIndex; - binding.getValue(buffer, originalValueOffset); // accu[0..1] := orig -- initially detect changes against the original + stride = this.valueSize, + originalValueOffset = stride * this._origIndex; + binding.getValue(buffer, originalValueOffset); + // accu[0..1] := orig -- initially detect changes against the original for (let i = stride, e = originalValueOffset; i !== e; ++i) { buffer[i] = buffer[originalValueOffset + i % stride]; - } // Add to identity for additive - + } + // Add to identity for additive this._setIdentity(); - this.cumulativeWeight = 0; this.cumulativeWeightAdditive = 0; - } // apply the state previously taken via 'saveOriginalState' to the binding - + } + // apply the state previously taken via 'saveOriginalState' to the binding restoreOriginalState() { const originalValueOffset = this.valueSize * 3; this.binding.setValue(this.buffer, originalValueOffset); } - _setAdditiveIdentityNumeric() { const startIndex = this._addIndex * this.valueSize; const endIndex = startIndex + this.valueSize; - for (let i = startIndex; i < endIndex; i++) { this.buffer[i] = 0; } } - _setAdditiveIdentityQuaternion() { this._setAdditiveIdentityNumeric(); - this.buffer[this._addIndex * this.valueSize + 3] = 1; } - _setAdditiveIdentityOther() { const startIndex = this._origIndex * this.valueSize; const targetIndex = this._addIndex * this.valueSize; - for (let i = 0; i < this.valueSize; i++) { this.buffer[targetIndex + i] = this.buffer[startIndex + i]; } - } // mix functions + } + // mix functions _select(buffer, dstOffset, srcOffset, t, stride) { if (t >= 0.5) { @@ -32170,126 +28786,110 @@ class PropertyMixer { } } } - _slerp(buffer, dstOffset, srcOffset, t) { Quaternion.slerpFlat(buffer, dstOffset, buffer, dstOffset, buffer, srcOffset, t); } - _slerpAdditive(buffer, dstOffset, srcOffset, t, stride) { - const workOffset = this._workIndex * stride; // Store result in intermediate buffer offset + const workOffset = this._workIndex * stride; - Quaternion.multiplyQuaternionsFlat(buffer, workOffset, buffer, dstOffset, buffer, srcOffset); // Slerp to the intermediate result + // Store result in intermediate buffer offset + Quaternion.multiplyQuaternionsFlat(buffer, workOffset, buffer, dstOffset, buffer, srcOffset); + // Slerp to the intermediate result Quaternion.slerpFlat(buffer, dstOffset, buffer, dstOffset, buffer, workOffset, t); } - _lerp(buffer, dstOffset, srcOffset, t, stride) { const s = 1 - t; - for (let i = 0; i !== stride; ++i) { const j = dstOffset + i; buffer[j] = buffer[j] * s + buffer[srcOffset + i] * t; } } - _lerpAdditive(buffer, dstOffset, srcOffset, t, stride) { for (let i = 0; i !== stride; ++i) { const j = dstOffset + i; buffer[j] = buffer[j] + buffer[srcOffset + i] * t; } } - } // Characters [].:/ are reserved for track binding syntax. const _RESERVED_CHARS_RE = '\\[\\]\\.:\\/'; +const _reservedRe = new RegExp('[' + _RESERVED_CHARS_RE + ']', 'g'); -const _reservedRe = new RegExp('[' + _RESERVED_CHARS_RE + ']', 'g'); // Attempts to allow node names from any language. ES5's `\w` regexp matches +// Attempts to allow node names from any language. ES5's `\w` regexp matches // only latin characters, and the unicode \p{L} is not yet supported. So // instead, we exclude reserved characters and match everything else. - - const _wordChar = '[^' + _RESERVED_CHARS_RE + ']'; +const _wordCharOrDot = '[^' + _RESERVED_CHARS_RE.replace('\\.', '') + ']'; -const _wordCharOrDot = '[^' + _RESERVED_CHARS_RE.replace('\\.', '') + ']'; // Parent directories, delimited by '/' or ':'. Currently unused, but must +// Parent directories, delimited by '/' or ':'. Currently unused, but must // be matched to parse the rest of the track name. +const _directoryRe = /((?:WC+[\/:])*)/.source.replace('WC', _wordChar); +// Target node. May contain word characters (a-zA-Z0-9_) and '.' or '-'. +const _nodeRe = /(WCOD+)?/.source.replace('WCOD', _wordCharOrDot); -const _directoryRe = /((?:WC+[\/:])*)/.source.replace('WC', _wordChar); // Target node. May contain word characters (a-zA-Z0-9_) and '.' or '-'. - - -const _nodeRe = /(WCOD+)?/.source.replace('WCOD', _wordCharOrDot); // Object on target node, and accessor. May not contain reserved +// Object on target node, and accessor. May not contain reserved // characters. Accessor may contain any character except closing bracket. +const _objectRe = /(?:\.(WC+)(?:\[(.+)\])?)?/.source.replace('WC', _wordChar); - -const _objectRe = /(?:\.(WC+)(?:\[(.+)\])?)?/.source.replace('WC', _wordChar); // Property and accessor. May not contain reserved characters. Accessor may +// Property and accessor. May not contain reserved characters. Accessor may // contain any non-bracket characters. - - const _propertyRe = /\.(WC+)(?:\[(.+)\])?/.source.replace('WC', _wordChar); - const _trackRe = new RegExp('' + '^' + _directoryRe + _nodeRe + _objectRe + _propertyRe + '$'); - const _supportedObjectNames = ['material', 'materials', 'bones']; - class Composite { constructor(targetGroup, path, optionalParsedPath) { const parsedPath = optionalParsedPath || PropertyBinding.parseTrackName(path); this._targetGroup = targetGroup; this._bindings = targetGroup.subscribe_(path, parsedPath); } - getValue(array, offset) { this.bind(); // bind all binding const firstValidIndex = this._targetGroup.nCachedObjects_, - binding = this._bindings[firstValidIndex]; // and only call .getValue on the first + binding = this._bindings[firstValidIndex]; + // and only call .getValue on the first if (binding !== undefined) binding.getValue(array, offset); } - setValue(array, offset) { const bindings = this._bindings; - for (let i = this._targetGroup.nCachedObjects_, n = bindings.length; i !== n; ++i) { bindings[i].setValue(array, offset); } } - bind() { const bindings = this._bindings; - for (let i = this._targetGroup.nCachedObjects_, n = bindings.length; i !== n; ++i) { bindings[i].bind(); } } - unbind() { const bindings = this._bindings; - for (let i = this._targetGroup.nCachedObjects_, n = bindings.length; i !== n; ++i) { bindings[i].unbind(); } } +} -} // Note: This class uses a State pattern on a per-method basis: +// Note: This class uses a State pattern on a per-method basis: // 'bind' sets 'this.getValue' / 'setValue' and shadows the // prototype version of these methods with one that represents // the bound state. When the property is not found, the methods // become no-ops. - - class PropertyBinding { constructor(rootNode, path, parsedPath) { this.path = path; this.parsedPath = parsedPath || PropertyBinding.parseTrackName(path); this.node = PropertyBinding.findNode(rootNode, this.parsedPath.nodeName) || rootNode; - this.rootNode = rootNode; // initial state of these methods that calls 'bind' + this.rootNode = rootNode; + // initial state of these methods that calls 'bind' this.getValue = this._getValue_unbound; this.setValue = this._setValue_unbound; } - static create(root, path, parsedPath) { if (!(root && root.isAnimationObjectGroup)) { return new PropertyBinding(root, path, parsedPath); @@ -32297,6 +28897,7 @@ class PropertyBinding { return new PropertyBinding.Composite(root, path, parsedPath); } } + /** * Replaces spaces with underscores and removes unsupported characters from * node names, to ensure compatibility with parseTrackName(). @@ -32304,19 +28905,14 @@ class PropertyBinding { * @param {string} name Node name to be sanitized. * @return {string} */ - - static sanitizeNodeName(name) { return name.replace(/\s/g, '_').replace(_reservedRe, ''); } - static parseTrackName(trackName) { const matches = _trackRe.exec(trackName); - if (!matches) { throw new Error('PropertyBinding: Cannot parse trackName: ' + trackName); } - const results = { // directoryName: matches[ 1 ], // (tschw) currently unused nodeName: matches[2], @@ -32327,295 +28923,263 @@ class PropertyBinding { propertyIndex: matches[6] }; const lastDot = results.nodeName && results.nodeName.lastIndexOf('.'); - if (lastDot !== undefined && lastDot !== -1) { - const objectName = results.nodeName.substring(lastDot + 1); // Object names must be checked against an allowlist. Otherwise, there + const objectName = results.nodeName.substring(lastDot + 1); + + // Object names must be checked against an allowlist. Otherwise, there // is no way to parse 'foo.bar.baz': 'baz' must be a property, but // 'bar' could be the objectName, or part of a nodeName (which can // include '.' characters). - if (_supportedObjectNames.indexOf(objectName) !== -1) { results.nodeName = results.nodeName.substring(0, lastDot); results.objectName = objectName; } } - if (results.propertyName === null || results.propertyName.length === 0) { throw new Error('PropertyBinding: can not parse propertyName from trackName: ' + trackName); } - return results; } - static findNode(root, nodeName) { if (!nodeName || nodeName === '' || nodeName === '.' || nodeName === -1 || nodeName === root.name || nodeName === root.uuid || nodeName === root.uniqueName) { return root; - } // search into skeleton bones. - + } + // search into skeleton bones. if (root.skeleton) { const bone = root.skeleton.getBoneByName(nodeName); - if (bone !== undefined) { return bone; } - } // search into node subtree. - + } + // search into node subtree. if (root.children) { const searchNodeSubtree = function (children) { for (let i = 0; i < children.length; i++) { const childNode = children[i]; - if (childNode.name === nodeName || childNode.uuid === nodeName || childNode.uniqueName === nodeName) { return childNode; } - const result = searchNodeSubtree(childNode.children); if (result) return result; } - return null; }; - const subTreeNode = searchNodeSubtree(root.children); - if (subTreeNode) { return subTreeNode; } } - return null; - } // these are used to "bind" a nonexistent property - + } + // these are used to "bind" a nonexistent property _getValue_unavailable() {} + _setValue_unavailable() {} - _setValue_unavailable() {} // Getters - + // Getters _getValue_direct(buffer, offset) { buffer[offset] = this.targetObject[this.propertyName]; } - _getValue_array(buffer, offset) { const source = this.resolvedProperty; - for (let i = 0, n = source.length; i !== n; ++i) { buffer[offset++] = source[i]; } } - _getValue_arrayElement(buffer, offset) { buffer[offset] = this.resolvedProperty[this.propertyIndex]; } - _getValue_toArray(buffer, offset) { this.resolvedProperty.toArray(buffer, offset); - } // Direct + } + // Direct _setValue_direct(buffer, offset) { this.targetObject[this.propertyName] = buffer[offset]; } - _setValue_direct_setNeedsUpdate(buffer, offset) { this.targetObject[this.propertyName] = buffer[offset]; this.targetObject.needsUpdate = true; } - _setValue_direct_setMatrixWorldNeedsUpdate(buffer, offset) { this.targetObject[this.propertyName] = buffer[offset]; this.targetObject.matrixWorldNeedsUpdate = true; - } // EntireArray + } + // EntireArray _setValue_array(buffer, offset) { const dest = this.resolvedProperty; - for (let i = 0, n = dest.length; i !== n; ++i) { dest[i] = buffer[offset++]; } } - _setValue_array_setNeedsUpdate(buffer, offset) { const dest = this.resolvedProperty; - for (let i = 0, n = dest.length; i !== n; ++i) { dest[i] = buffer[offset++]; } - this.targetObject.needsUpdate = true; } - _setValue_array_setMatrixWorldNeedsUpdate(buffer, offset) { const dest = this.resolvedProperty; - for (let i = 0, n = dest.length; i !== n; ++i) { dest[i] = buffer[offset++]; } - this.targetObject.matrixWorldNeedsUpdate = true; - } // ArrayElement + } + // ArrayElement _setValue_arrayElement(buffer, offset) { this.resolvedProperty[this.propertyIndex] = buffer[offset]; } - _setValue_arrayElement_setNeedsUpdate(buffer, offset) { this.resolvedProperty[this.propertyIndex] = buffer[offset]; this.targetObject.needsUpdate = true; } - _setValue_arrayElement_setMatrixWorldNeedsUpdate(buffer, offset) { this.resolvedProperty[this.propertyIndex] = buffer[offset]; this.targetObject.matrixWorldNeedsUpdate = true; - } // HasToFromArray + } + // HasToFromArray _setValue_fromArray(buffer, offset) { this.resolvedProperty.fromArray(buffer, offset); } - _setValue_fromArray_setNeedsUpdate(buffer, offset) { this.resolvedProperty.fromArray(buffer, offset); this.targetObject.needsUpdate = true; } - _setValue_fromArray_setMatrixWorldNeedsUpdate(buffer, offset) { this.resolvedProperty.fromArray(buffer, offset); this.targetObject.matrixWorldNeedsUpdate = true; } - _getValue_unbound(targetArray, offset) { this.bind(); this.getValue(targetArray, offset); } - _setValue_unbound(sourceArray, offset) { this.bind(); this.setValue(sourceArray, offset); - } // create getter / setter pair for a property in the scene graph - + } + // create getter / setter pair for a property in the scene graph bind() { let targetObject = this.node; const parsedPath = this.parsedPath; const objectName = parsedPath.objectName; const propertyName = parsedPath.propertyName; let propertyIndex = parsedPath.propertyIndex; - if (!targetObject) { targetObject = PropertyBinding.findNode(this.rootNode, parsedPath.nodeName) || this.rootNode; this.node = targetObject; - } // set fail state so we can just 'return' on error - + } + // set fail state so we can just 'return' on error this.getValue = this._getValue_unavailable; - this.setValue = this._setValue_unavailable; // ensure there is a value node + this.setValue = this._setValue_unavailable; + // ensure there is a value node if (!targetObject) { console.error('THREE.PropertyBinding: Trying to update node for track: ' + this.path + ' but it wasn\'t found.'); return; } - if (objectName) { - let objectIndex = parsedPath.objectIndex; // special cases were we need to reach deeper into the hierarchy to get the face materials.... + let objectIndex = parsedPath.objectIndex; + // special cases were we need to reach deeper into the hierarchy to get the face materials.... switch (objectName) { case 'materials': if (!targetObject.material) { console.error('THREE.PropertyBinding: Can not bind to material as node does not have a material.', this); return; } - if (!targetObject.material.materials) { console.error('THREE.PropertyBinding: Can not bind to material.materials as node.material does not have a materials array.', this); return; } - targetObject = targetObject.material.materials; break; - case 'bones': if (!targetObject.skeleton) { console.error('THREE.PropertyBinding: Can not bind to bones as node does not have a skeleton.', this); return; - } // potential future optimization: skip this if propertyIndex is already an integer - // and convert the integer string to a true integer. + } + // potential future optimization: skip this if propertyIndex is already an integer + // and convert the integer string to a true integer. - targetObject = targetObject.skeleton.bones; // support resolving morphTarget names into indices. + targetObject = targetObject.skeleton.bones; + // support resolving morphTarget names into indices. for (let i = 0; i < targetObject.length; i++) { if (targetObject[i].name === objectIndex) { objectIndex = i; break; } } - break; - default: if (targetObject[objectName] === undefined) { console.error('THREE.PropertyBinding: Can not bind to objectName of node undefined.', this); return; } - targetObject = targetObject[objectName]; } - if (objectIndex !== undefined) { if (targetObject[objectIndex] === undefined) { console.error('THREE.PropertyBinding: Trying to bind to objectIndex of objectName, but is undefined.', this, targetObject); return; } - targetObject = targetObject[objectIndex]; } - } // resolve property - + } + // resolve property const nodeProperty = targetObject[propertyName]; - if (nodeProperty === undefined) { const nodeName = parsedPath.nodeName; console.error('THREE.PropertyBinding: Trying to update property for track: ' + nodeName + '.' + propertyName + ' but it wasn\'t found.', targetObject); return; - } // determine versioning scheme - + } + // determine versioning scheme let versioning = this.Versioning.None; this.targetObject = targetObject; - if (targetObject.needsUpdate !== undefined) { // material + versioning = this.Versioning.NeedsUpdate; } else if (targetObject.matrixWorldNeedsUpdate !== undefined) { // node transform - versioning = this.Versioning.MatrixWorldNeedsUpdate; - } // determine how the property gets bound + versioning = this.Versioning.MatrixWorldNeedsUpdate; + } + // determine how the property gets bound let bindingType = this.BindingType.Direct; - if (propertyIndex !== undefined) { // access a sub element of the property array (only primitives are supported right now) + if (propertyName === 'morphTargetInfluences') { // potential optimization, skip this if propertyIndex is already an integer, and convert the integer string to a true integer. + // support resolving morphTarget names into indices. if (!targetObject.geometry) { console.error('THREE.PropertyBinding: Can not bind to morphTargetInfluences because node does not have a geometry.', this); return; } - if (targetObject.geometry.isBufferGeometry) { if (!targetObject.geometry.morphAttributes) { console.error('THREE.PropertyBinding: Can not bind to morphTargetInfluences because node does not have a geometry.morphAttributes.', this); return; } - if (targetObject.morphTargetDictionary[propertyIndex] !== undefined) { propertyIndex = targetObject.morphTargetDictionary[propertyIndex]; } @@ -32624,12 +29188,12 @@ class PropertyBinding { return; } } - bindingType = this.BindingType.ArrayElement; this.resolvedProperty = nodeProperty; this.propertyIndex = propertyIndex; } else if (nodeProperty.fromArray !== undefined && nodeProperty.toArray !== undefined) { // must use copy for Object3D.Euler/Quaternion + bindingType = this.BindingType.HasFromToArray; this.resolvedProperty = nodeProperty; } else if (Array.isArray(nodeProperty)) { @@ -32637,23 +29201,21 @@ class PropertyBinding { this.resolvedProperty = nodeProperty; } else { this.propertyName = propertyName; - } // select getter / setter - + } + // select getter / setter this.getValue = this.GetterByBindingType[bindingType]; this.setValue = this.SetterByBindingTypeAndVersioning[bindingType][versioning]; } - unbind() { - this.node = null; // back to the prototype version of getValue / setValue - // note: avoiding to mutate the shape of 'this' via 'delete' + this.node = null; + // back to the prototype version of getValue / setValue + // note: avoiding to mutate the shape of 'this' via 'delete' this.getValue = this._getValue_unbound; this.setValue = this._setValue_unbound; } - } - PropertyBinding.Composite = Composite; PropertyBinding.prototype.BindingType = { Direct: 0, @@ -32667,10 +29229,15 @@ PropertyBinding.prototype.Versioning = { MatrixWorldNeedsUpdate: 2 }; PropertyBinding.prototype.GetterByBindingType = [PropertyBinding.prototype._getValue_direct, PropertyBinding.prototype._getValue_array, PropertyBinding.prototype._getValue_arrayElement, PropertyBinding.prototype._getValue_toArray]; -PropertyBinding.prototype.SetterByBindingTypeAndVersioning = [[// Direct -PropertyBinding.prototype._setValue_direct, PropertyBinding.prototype._setValue_direct_setNeedsUpdate, PropertyBinding.prototype._setValue_direct_setMatrixWorldNeedsUpdate], [// EntireArray -PropertyBinding.prototype._setValue_array, PropertyBinding.prototype._setValue_array_setNeedsUpdate, PropertyBinding.prototype._setValue_array_setMatrixWorldNeedsUpdate], [// ArrayElement -PropertyBinding.prototype._setValue_arrayElement, PropertyBinding.prototype._setValue_arrayElement_setNeedsUpdate, PropertyBinding.prototype._setValue_arrayElement_setMatrixWorldNeedsUpdate], [// HasToFromArray +PropertyBinding.prototype.SetterByBindingTypeAndVersioning = [[ +// Direct +PropertyBinding.prototype._setValue_direct, PropertyBinding.prototype._setValue_direct_setNeedsUpdate, PropertyBinding.prototype._setValue_direct_setMatrixWorldNeedsUpdate], [ +// EntireArray + +PropertyBinding.prototype._setValue_array, PropertyBinding.prototype._setValue_array_setNeedsUpdate, PropertyBinding.prototype._setValue_array_setMatrixWorldNeedsUpdate], [ +// ArrayElement +PropertyBinding.prototype._setValue_arrayElement, PropertyBinding.prototype._setValue_arrayElement_setNeedsUpdate, PropertyBinding.prototype._setValue_arrayElement_setMatrixWorldNeedsUpdate], [ +// HasToFromArray PropertyBinding.prototype._setValue_fromArray, PropertyBinding.prototype._setValue_fromArray_setNeedsUpdate, PropertyBinding.prototype._setValue_fromArray_setMatrixWorldNeedsUpdate]]; /** @@ -32704,8 +29271,9 @@ PropertyBinding.prototype._setValue_fromArray, PropertyBinding.prototype._setVal class AnimationObjectGroup { constructor() { - this.uuid = generateUUID(); // cached objects followed by the active ones + this.uuid = generateUUID(); + // cached objects followed by the active ones this._objects = Array.prototype.slice.call(arguments); this.nCachedObjects_ = 0; // threshold // note: read by PropertyBinding.Composite @@ -32716,13 +29284,9 @@ class AnimationObjectGroup { for (let i = 0, n = arguments.length; i !== n; ++i) { indices[arguments[i].uuid] = i; } - this._paths = []; // inside: string - this._parsedPaths = []; // inside: { we don't care, here } - this._bindings = []; // inside: Array< PropertyBinding > - this._bindingsIndicesByPath = {}; // inside: indices in these arrays const scope = this; @@ -32731,165 +29295,164 @@ class AnimationObjectGroup { get total() { return scope._objects.length; }, - get inUse() { return this.total - scope.nCachedObjects_; } - }, - get bindingsPerObject() { return scope._bindings.length; } - }; } - add() { const objects = this._objects, - indicesByUUID = this._indicesByUUID, - paths = this._paths, - parsedPaths = this._parsedPaths, - bindings = this._bindings, - nBindings = bindings.length; + indicesByUUID = this._indicesByUUID, + paths = this._paths, + parsedPaths = this._parsedPaths, + bindings = this._bindings, + nBindings = bindings.length; let knownObject = undefined, - nObjects = objects.length, - nCachedObjects = this.nCachedObjects_; - + nObjects = objects.length, + nCachedObjects = this.nCachedObjects_; for (let i = 0, n = arguments.length; i !== n; ++i) { const object = arguments[i], - uuid = object.uuid; + uuid = object.uuid; let index = indicesByUUID[uuid]; - if (index === undefined) { // unknown object -> add it to the ACTIVE region + index = nObjects++; indicesByUUID[uuid] = index; - objects.push(object); // accounting is done, now do the same for all bindings + objects.push(object); + + // accounting is done, now do the same for all bindings for (let j = 0, m = nBindings; j !== m; ++j) { bindings[j].push(new PropertyBinding(object, paths[j], parsedPaths[j])); } } else if (index < nCachedObjects) { - knownObject = objects[index]; // move existing object to the ACTIVE region + knownObject = objects[index]; + + // move existing object to the ACTIVE region const firstActiveIndex = --nCachedObjects, - lastCachedObject = objects[firstActiveIndex]; + lastCachedObject = objects[firstActiveIndex]; indicesByUUID[lastCachedObject.uuid] = index; objects[index] = lastCachedObject; indicesByUUID[uuid] = firstActiveIndex; - objects[firstActiveIndex] = object; // accounting is done, now do the same for all bindings + objects[firstActiveIndex] = object; + + // accounting is done, now do the same for all bindings for (let j = 0, m = nBindings; j !== m; ++j) { const bindingsForPath = bindings[j], - lastCached = bindingsForPath[firstActiveIndex]; + lastCached = bindingsForPath[firstActiveIndex]; let binding = bindingsForPath[index]; bindingsForPath[index] = lastCached; - if (binding === undefined) { // since we do not bother to create new bindings // for objects that are cached, the binding may // or may not exist + binding = new PropertyBinding(object, paths[j], parsedPaths[j]); } - bindingsForPath[firstActiveIndex] = binding; } } else if (objects[index] !== knownObject) { console.error('THREE.AnimationObjectGroup: Different objects with the same UUID ' + 'detected. Clean the caches or recreate your infrastructure when reloading scenes.'); } // else the object is already where we want it to be - } // for arguments - this.nCachedObjects_ = nCachedObjects; } - remove() { const objects = this._objects, - indicesByUUID = this._indicesByUUID, - bindings = this._bindings, - nBindings = bindings.length; + indicesByUUID = this._indicesByUUID, + bindings = this._bindings, + nBindings = bindings.length; let nCachedObjects = this.nCachedObjects_; - for (let i = 0, n = arguments.length; i !== n; ++i) { const object = arguments[i], - uuid = object.uuid, - index = indicesByUUID[uuid]; - + uuid = object.uuid, + index = indicesByUUID[uuid]; if (index !== undefined && index >= nCachedObjects) { // move existing object into the CACHED region + const lastCachedIndex = nCachedObjects++, - firstActiveObject = objects[lastCachedIndex]; + firstActiveObject = objects[lastCachedIndex]; indicesByUUID[firstActiveObject.uuid] = index; objects[index] = firstActiveObject; indicesByUUID[uuid] = lastCachedIndex; - objects[lastCachedIndex] = object; // accounting is done, now do the same for all bindings + objects[lastCachedIndex] = object; + + // accounting is done, now do the same for all bindings for (let j = 0, m = nBindings; j !== m; ++j) { const bindingsForPath = bindings[j], - firstActive = bindingsForPath[lastCachedIndex], - binding = bindingsForPath[index]; + firstActive = bindingsForPath[lastCachedIndex], + binding = bindingsForPath[index]; bindingsForPath[index] = firstActive; bindingsForPath[lastCachedIndex] = binding; } } } // for arguments - this.nCachedObjects_ = nCachedObjects; - } // remove & forget - + } + // remove & forget uncache() { const objects = this._objects, - indicesByUUID = this._indicesByUUID, - bindings = this._bindings, - nBindings = bindings.length; + indicesByUUID = this._indicesByUUID, + bindings = this._bindings, + nBindings = bindings.length; let nCachedObjects = this.nCachedObjects_, - nObjects = objects.length; - + nObjects = objects.length; for (let i = 0, n = arguments.length; i !== n; ++i) { const object = arguments[i], - uuid = object.uuid, - index = indicesByUUID[uuid]; - + uuid = object.uuid, + index = indicesByUUID[uuid]; if (index !== undefined) { delete indicesByUUID[uuid]; - if (index < nCachedObjects) { // object is cached, shrink the CACHED region + const firstActiveIndex = --nCachedObjects, - lastCachedObject = objects[firstActiveIndex], - lastIndex = --nObjects, - lastObject = objects[lastIndex]; // last cached object takes this object's place + lastCachedObject = objects[firstActiveIndex], + lastIndex = --nObjects, + lastObject = objects[lastIndex]; + // last cached object takes this object's place indicesByUUID[lastCachedObject.uuid] = index; - objects[index] = lastCachedObject; // last object goes to the activated slot and pop + objects[index] = lastCachedObject; + // last object goes to the activated slot and pop indicesByUUID[lastObject.uuid] = firstActiveIndex; objects[firstActiveIndex] = lastObject; - objects.pop(); // accounting is done, now do the same for all bindings + objects.pop(); + + // accounting is done, now do the same for all bindings for (let j = 0, m = nBindings; j !== m; ++j) { const bindingsForPath = bindings[j], - lastCached = bindingsForPath[firstActiveIndex], - last = bindingsForPath[lastIndex]; + lastCached = bindingsForPath[firstActiveIndex], + last = bindingsForPath[lastIndex]; bindingsForPath[index] = lastCached; bindingsForPath[firstActiveIndex] = last; bindingsForPath.pop(); } } else { // object is active, just swap with the last and pop - const lastIndex = --nObjects, - lastObject = objects[lastIndex]; + const lastIndex = --nObjects, + lastObject = objects[lastIndex]; if (lastIndex > 0) { indicesByUUID[lastObject.uuid] = index; } - objects[index] = lastObject; - objects.pop(); // accounting is done, now do the same for all bindings + objects.pop(); + + // accounting is done, now do the same for all bindings for (let j = 0, m = nBindings; j !== m; ++j) { const bindingsForPath = bindings[j]; @@ -32897,56 +29460,52 @@ class AnimationObjectGroup { bindingsForPath.pop(); } } // cached or active - } // if object is known - } // for arguments - this.nCachedObjects_ = nCachedObjects; - } // Internal interface used by befriended PropertyBinding.Composite: + } + // Internal interface used by befriended PropertyBinding.Composite: subscribe_(path, parsedPath) { // returns an array of bindings for the given path that is changed // according to the contained objects in the group + const indicesByPath = this._bindingsIndicesByPath; let index = indicesByPath[path]; const bindings = this._bindings; if (index !== undefined) return bindings[index]; const paths = this._paths, - parsedPaths = this._parsedPaths, - objects = this._objects, - nObjects = objects.length, - nCachedObjects = this.nCachedObjects_, - bindingsForPath = new Array(nObjects); + parsedPaths = this._parsedPaths, + objects = this._objects, + nObjects = objects.length, + nCachedObjects = this.nCachedObjects_, + bindingsForPath = new Array(nObjects); index = bindings.length; indicesByPath[path] = index; paths.push(path); parsedPaths.push(parsedPath); bindings.push(bindingsForPath); - for (let i = nCachedObjects, n = objects.length; i !== n; ++i) { const object = objects[i]; bindingsForPath[i] = new PropertyBinding(object, path, parsedPath); } - return bindingsForPath; } - unsubscribe_(path) { // tells the group to forget about a property path and no longer // update the array previously obtained with 'subscribe_' - const indicesByPath = this._bindingsIndicesByPath, - index = indicesByPath[path]; + const indicesByPath = this._bindingsIndicesByPath, + index = indicesByPath[path]; if (index !== undefined) { const paths = this._paths, - parsedPaths = this._parsedPaths, - bindings = this._bindings, - lastBindingsIndex = bindings.length - 1, - lastBindings = bindings[lastBindingsIndex], - lastBindingsPath = path[lastBindingsIndex]; + parsedPaths = this._parsedPaths, + bindings = this._bindings, + lastBindingsIndex = bindings.length - 1, + lastBindings = bindings[lastBindingsIndex], + lastBindingsPath = path[lastBindingsIndex]; indicesByPath[lastBindingsPath] = index; bindings[index] = lastBindings; bindings.pop(); @@ -32956,9 +29515,7 @@ class AnimationObjectGroup { paths.pop(); } } - } - AnimationObjectGroup.prototype.isAnimationObjectGroup = true; class AnimationAction { @@ -32968,37 +29525,36 @@ class AnimationAction { this._localRoot = localRoot; this.blendMode = blendMode; const tracks = clip.tracks, - nTracks = tracks.length, - interpolants = new Array(nTracks); + nTracks = tracks.length, + interpolants = new Array(nTracks); const interpolantSettings = { endingStart: ZeroCurvatureEnding, endingEnd: ZeroCurvatureEnding }; - for (let i = 0; i !== nTracks; ++i) { const interpolant = tracks[i].createInterpolant(null); interpolants[i] = interpolant; interpolant.settings = interpolantSettings; } - this._interpolantSettings = interpolantSettings; this._interpolants = interpolants; // bound by the mixer - // inside: PropertyMixer (managed by the mixer) + // inside: PropertyMixer (managed by the mixer) this._propertyBindings = new Array(nTracks); this._cacheIndex = null; // for the memory manager - this._byClipCacheIndex = null; // for the memory manager this._timeScaleInterpolant = null; this._weightInterpolant = null; this.loop = LoopRepeat; - this._loopCount = -1; // global mixer time when the action is to be started + this._loopCount = -1; + + // global mixer time when the action is to be started // it's set back to 'null' upon start of the action + this._startTime = null; - this._startTime = null; // scaled local time of the action + // scaled local time of the action // gets clamped or wrapped to 0..clip.duration according to loop - this.time = 0; this.timeScale = 1; this._effectiveTimeScale = 1; @@ -33007,265 +29563,228 @@ class AnimationAction { this.repetitions = Infinity; // no. of repetitions when looping this.paused = false; // true -> zero effective time scale - this.enabled = true; // false -> zero effective weight this.clampWhenFinished = false; // keep feeding the last frame? this.zeroSlopeAtStart = true; // for smooth interpolation w/o separate - this.zeroSlopeAtEnd = true; // clips for start, loop and end - } // State & Scheduling + } + // State & Scheduling play() { this._mixer._activateAction(this); - return this; } - stop() { this._mixer._deactivateAction(this); - return this.reset(); } - reset() { this.paused = false; this.enabled = true; this.time = 0; // restart clip - this._loopCount = -1; // forget previous loops - this._startTime = null; // forget scheduling return this.stopFading().stopWarping(); } - isRunning() { return this.enabled && !this.paused && this.timeScale !== 0 && this._startTime === null && this._mixer._isActiveAction(this); - } // return true when play has been called - + } + // return true when play has been called isScheduled() { return this._mixer._isActiveAction(this); } - startAt(time) { this._startTime = time; return this; } - setLoop(mode, repetitions) { this.loop = mode; this.repetitions = repetitions; return this; - } // Weight + } + + // Weight + // set the weight stopping any scheduled fading // although .enabled = false yields an effective weight of zero, this // method does *not* change .enabled, because it would be confusing - - setEffectiveWeight(weight) { - this.weight = weight; // note: same logic as when updated at runtime + this.weight = weight; + // note: same logic as when updated at runtime this._effectiveWeight = this.enabled ? weight : 0; return this.stopFading(); - } // return the weight considering fading and .enabled - + } + // return the weight considering fading and .enabled getEffectiveWeight() { return this._effectiveWeight; } - fadeIn(duration) { return this._scheduleFading(duration, 0, 1); } - fadeOut(duration) { return this._scheduleFading(duration, 1, 0); } - crossFadeFrom(fadeOutAction, duration, warp) { fadeOutAction.fadeOut(duration); this.fadeIn(duration); - if (warp) { const fadeInDuration = this._clip.duration, - fadeOutDuration = fadeOutAction._clip.duration, - startEndRatio = fadeOutDuration / fadeInDuration, - endStartRatio = fadeInDuration / fadeOutDuration; + fadeOutDuration = fadeOutAction._clip.duration, + startEndRatio = fadeOutDuration / fadeInDuration, + endStartRatio = fadeInDuration / fadeOutDuration; fadeOutAction.warp(1.0, startEndRatio, duration); this.warp(endStartRatio, 1.0, duration); } - return this; } - crossFadeTo(fadeInAction, duration, warp) { return fadeInAction.crossFadeFrom(this, duration, warp); } - stopFading() { const weightInterpolant = this._weightInterpolant; - if (weightInterpolant !== null) { this._weightInterpolant = null; - this._mixer._takeBackControlInterpolant(weightInterpolant); } - return this; - } // Time Scale Control + } + + // Time Scale Control + // set the time scale stopping any scheduled warping // although .paused = true yields an effective time scale of zero, this // method does *not* change .paused, because it would be confusing - - setEffectiveTimeScale(timeScale) { this.timeScale = timeScale; this._effectiveTimeScale = this.paused ? 0 : timeScale; return this.stopWarping(); - } // return the time scale considering warping and .paused - + } + // return the time scale considering warping and .paused getEffectiveTimeScale() { return this._effectiveTimeScale; } - setDuration(duration) { this.timeScale = this._clip.duration / duration; return this.stopWarping(); } - syncWith(action) { this.time = action.time; this.timeScale = action.timeScale; return this.stopWarping(); } - halt(duration) { return this.warp(this._effectiveTimeScale, 0, duration); } - warp(startTimeScale, endTimeScale, duration) { const mixer = this._mixer, - now = mixer.time, - timeScale = this.timeScale; + now = mixer.time, + timeScale = this.timeScale; let interpolant = this._timeScaleInterpolant; - if (interpolant === null) { interpolant = mixer._lendControlInterpolant(); this._timeScaleInterpolant = interpolant; } - const times = interpolant.parameterPositions, - values = interpolant.sampleValues; + values = interpolant.sampleValues; times[0] = now; times[1] = now + duration; values[0] = startTimeScale / timeScale; values[1] = endTimeScale / timeScale; return this; } - stopWarping() { const timeScaleInterpolant = this._timeScaleInterpolant; - if (timeScaleInterpolant !== null) { this._timeScaleInterpolant = null; - this._mixer._takeBackControlInterpolant(timeScaleInterpolant); } - return this; - } // Object Accessors + } + // Object Accessors getMixer() { return this._mixer; } - getClip() { return this._clip; } - getRoot() { return this._localRoot || this._mixer._root; - } // Interna + } + // Interna _update(time, deltaTime, timeDirection, accuIndex) { // called by the mixer + if (!this.enabled) { // call ._updateWeight() to update ._effectiveWeight - this._updateWeight(time); + this._updateWeight(time); return; } - const startTime = this._startTime; - if (startTime !== null) { // check for scheduled start of action - const timeRunning = (time - startTime) * timeDirection; + const timeRunning = (time - startTime) * timeDirection; if (timeRunning < 0 || timeDirection === 0) { return; // yet to come / don't decide when delta = 0 - } // start + } + // start this._startTime = null; // unschedule - deltaTime = timeDirection * timeRunning; - } // apply time scale and advance time + } + // apply time scale and advance time deltaTime *= this._updateTimeScale(time); + const clipTime = this._updateTime(deltaTime); - const clipTime = this._updateTime(deltaTime); // note: _updateTime may disable the action resulting in + // note: _updateTime may disable the action resulting in // an effective weight of 0 - const weight = this._updateWeight(time); - if (weight > 0) { const interpolants = this._interpolants; const propertyMixers = this._propertyBindings; - switch (this.blendMode) { case AdditiveAnimationBlendMode: for (let j = 0, m = interpolants.length; j !== m; ++j) { interpolants[j].evaluate(clipTime); propertyMixers[j].accumulateAdditive(weight); } - break; - case NormalAnimationBlendMode: default: for (let j = 0, m = interpolants.length; j !== m; ++j) { interpolants[j].evaluate(clipTime); propertyMixers[j].accumulate(accuIndex, weight); } - } } } - _updateWeight(time) { let weight = 0; - if (this.enabled) { weight = this.weight; const interpolant = this._weightInterpolant; - if (interpolant !== null) { const interpolantValue = interpolant.evaluate(time)[0]; weight *= interpolantValue; - if (time > interpolant.parameterPositions[1]) { this.stopFading(); - if (interpolantValue === 0) { // faded out, disable this.enabled = false; @@ -33273,25 +29792,19 @@ class AnimationAction { } } } - this._effectiveWeight = weight; return weight; } - _updateTimeScale(time) { let timeScale = 0; - if (!this.paused) { timeScale = this.timeScale; const interpolant = this._timeScaleInterpolant; - if (interpolant !== null) { const interpolantValue = interpolant.evaluate(time)[0]; timeScale *= interpolantValue; - if (time > interpolant.parameterPositions[1]) { this.stopWarping(); - if (timeScale === 0) { // motion has halted, pause this.paused = true; @@ -33302,31 +29815,26 @@ class AnimationAction { } } } - this._effectiveTimeScale = timeScale; return timeScale; } - _updateTime(deltaTime) { const duration = this._clip.duration; const loop = this.loop; let time = this.time + deltaTime; let loopCount = this._loopCount; const pingPong = loop === LoopPingPong; - if (deltaTime === 0) { if (loopCount === -1) return time; return pingPong && (loopCount & 1) === 1 ? duration - time : time; } - if (loop === LoopOnce) { if (loopCount === -1) { // just started - this._loopCount = 0; + this._loopCount = 0; this._setEndings(true, true, false); } - handle_stop: { if (time >= duration) { time = duration; @@ -33336,10 +29844,8 @@ class AnimationAction { this.time = time; break handle_stop; } - if (this.clampWhenFinished) this.paused = true;else this.enabled = false; this.time = time; - this._mixer.dispatchEvent({ type: 'finished', action: this, @@ -33348,34 +29854,34 @@ class AnimationAction { } } else { // repetitive Repeat or PingPong + if (loopCount === -1) { // just started + if (deltaTime >= 0) { loopCount = 0; - this._setEndings(true, this.repetitions === 0, pingPong); } else { // when looping in reverse direction, the initial // transition through zero counts as a repetition, // so leave loopCount at -1 + this._setEndings(this.repetitions === 0, true, pingPong); } } - if (time >= duration || time < 0) { // wrap around - const loopDelta = Math.floor(time / duration); // signed + const loopDelta = Math.floor(time / duration); // signed time -= duration * loopDelta; loopCount += Math.abs(loopDelta); const pending = this.repetitions - loopCount; - if (pending <= 0) { // have to stop (switch state, clamp time, fire event) + if (this.clampWhenFinished) this.paused = true;else this.enabled = false; time = deltaTime > 0 ? duration : 0; this.time = time; - this._mixer.dispatchEvent({ type: 'finished', action: this, @@ -33383,18 +29889,17 @@ class AnimationAction { }); } else { // keep running + if (pending === 1) { // entering the last round - const atStart = deltaTime < 0; + const atStart = deltaTime < 0; this._setEndings(atStart, !atStart, pingPong); } else { this._setEndings(false, false, pingPong); } - this._loopCount = loopCount; this.time = time; - this._mixer.dispatchEvent({ type: 'loop', action: this, @@ -33404,30 +29909,27 @@ class AnimationAction { } else { this.time = time; } - if (pingPong && (loopCount & 1) === 1) { // invert time for the "pong round" + return duration - time; } } - return time; } - _setEndings(atStart, atEnd, pingPong) { const settings = this._interpolantSettings; - if (pingPong) { settings.endingStart = ZeroSlopeEnding; settings.endingEnd = ZeroSlopeEnding; } else { // assuming for LoopOnce atStart == atEnd == true + if (atStart) { settings.endingStart = this.zeroSlopeAtStart ? ZeroSlopeEnding : ZeroCurvatureEnding; } else { settings.endingStart = WrapAroundEnding; } - if (atEnd) { settings.endingEnd = this.zeroSlopeAtEnd ? ZeroSlopeEnding : ZeroCurvatureEnding; } else { @@ -33435,156 +29937,131 @@ class AnimationAction { } } } - _scheduleFading(duration, weightNow, weightThen) { const mixer = this._mixer, - now = mixer.time; + now = mixer.time; let interpolant = this._weightInterpolant; - if (interpolant === null) { interpolant = mixer._lendControlInterpolant(); this._weightInterpolant = interpolant; } - const times = interpolant.parameterPositions, - values = interpolant.sampleValues; + values = interpolant.sampleValues; times[0] = now; values[0] = weightNow; times[1] = now + duration; values[1] = weightThen; return this; } - } class AnimationMixer extends EventDispatcher { constructor(root) { super(); this._root = root; - this._initMemoryManager(); - this._accuIndex = 0; this.time = 0; this.timeScale = 1.0; } - _bindAction(action, prototypeAction) { const root = action._localRoot || this._root, - tracks = action._clip.tracks, - nTracks = tracks.length, - bindings = action._propertyBindings, - interpolants = action._interpolants, - rootUuid = root.uuid, - bindingsByRoot = this._bindingsByRootAndName; + tracks = action._clip.tracks, + nTracks = tracks.length, + bindings = action._propertyBindings, + interpolants = action._interpolants, + rootUuid = root.uuid, + bindingsByRoot = this._bindingsByRootAndName; let bindingsByName = bindingsByRoot[rootUuid]; - if (bindingsByName === undefined) { bindingsByName = {}; bindingsByRoot[rootUuid] = bindingsByName; } - for (let i = 0; i !== nTracks; ++i) { const track = tracks[i], - trackName = track.name; + trackName = track.name; let binding = bindingsByName[trackName]; - if (binding !== undefined) { ++binding.referenceCount; bindings[i] = binding; } else { binding = bindings[i]; - if (binding !== undefined) { // existing binding, make sure the cache knows + if (binding._cacheIndex === null) { ++binding.referenceCount; - this._addInactiveBinding(binding, rootUuid, trackName); } - continue; } - const path = prototypeAction && prototypeAction._propertyBindings[i].binding.parsedPath; binding = new PropertyMixer(PropertyBinding.create(root, trackName, path), track.ValueTypeName, track.getValueSize()); ++binding.referenceCount; - this._addInactiveBinding(binding, rootUuid, trackName); - bindings[i] = binding; } - interpolants[i].resultBuffer = binding.buffer; } } - _activateAction(action) { if (!this._isActiveAction(action)) { if (action._cacheIndex === null) { // this action has been forgotten by the cache, but the user // appears to be still using it -> rebind - const rootUuid = (action._localRoot || this._root).uuid, - clipUuid = action._clip.uuid, - actionsForClip = this._actionsByClip[clipUuid]; + const rootUuid = (action._localRoot || this._root).uuid, + clipUuid = action._clip.uuid, + actionsForClip = this._actionsByClip[clipUuid]; this._bindAction(action, actionsForClip && actionsForClip.knownActions[0]); - this._addInactiveAction(action, clipUuid, rootUuid); } + const bindings = action._propertyBindings; - const bindings = action._propertyBindings; // increment reference counts / sort out state - + // increment reference counts / sort out state for (let i = 0, n = bindings.length; i !== n; ++i) { const binding = bindings[i]; - if (binding.useCount++ === 0) { this._lendBinding(binding); - binding.saveOriginalState(); } } - this._lendAction(action); } } - _deactivateAction(action) { if (this._isActiveAction(action)) { - const bindings = action._propertyBindings; // decrement reference counts / sort out state + const bindings = action._propertyBindings; + // decrement reference counts / sort out state for (let i = 0, n = bindings.length; i !== n; ++i) { const binding = bindings[i]; - if (--binding.useCount === 0) { binding.restoreOriginalState(); - this._takeBackBinding(binding); } } - this._takeBackAction(action); } - } // Memory manager + } + // Memory manager _initMemoryManager() { this._actions = []; // 'nActiveActions' followed by inactive ones - this._nActiveActions = 0; - this._actionsByClip = {}; // inside: + this._actionsByClip = {}; + // inside: // { // knownActions: Array< AnimationAction > - used as prototypes // actionByRoot: AnimationAction - lookup // } this._bindings = []; // 'nActiveBindings' followed by inactive ones - this._nActiveBindings = 0; this._bindingsByRootAndName = {}; // inside: Map< name, PropertyMixer > this._controlInterpolants = []; // same game as above - this._nActiveControlInterpolants = 0; const scope = this; this.stats = { @@ -33592,46 +30069,39 @@ class AnimationMixer extends EventDispatcher { get total() { return scope._actions.length; }, - get inUse() { return scope._nActiveActions; } - }, bindings: { get total() { return scope._bindings.length; }, - get inUse() { return scope._nActiveBindings; } - }, controlInterpolants: { get total() { return scope._controlInterpolants.length; }, - get inUse() { return scope._nActiveControlInterpolants; } - } }; - } // Memory management for AnimationAction objects + } + // Memory management for AnimationAction objects _isActiveAction(action) { const index = action._cacheIndex; return index !== null && index < this._nActiveActions; } - _addInactiveAction(action, clipUuid, rootUuid) { const actions = this._actions, - actionsByClip = this._actionsByClip; + actionsByClip = this._actionsByClip; let actionsForClip = actionsByClip[clipUuid]; - if (actionsForClip === undefined) { actionsForClip = { knownActions: [action], @@ -33644,179 +30114,164 @@ class AnimationMixer extends EventDispatcher { action._byClipCacheIndex = knownActions.length; knownActions.push(action); } - action._cacheIndex = actions.length; actions.push(action); actionsForClip.actionByRoot[rootUuid] = action; } - _removeInactiveAction(action) { const actions = this._actions, - lastInactiveAction = actions[actions.length - 1], - cacheIndex = action._cacheIndex; + lastInactiveAction = actions[actions.length - 1], + cacheIndex = action._cacheIndex; lastInactiveAction._cacheIndex = cacheIndex; actions[cacheIndex] = lastInactiveAction; actions.pop(); action._cacheIndex = null; const clipUuid = action._clip.uuid, - actionsByClip = this._actionsByClip, - actionsForClip = actionsByClip[clipUuid], - knownActionsForClip = actionsForClip.knownActions, - lastKnownAction = knownActionsForClip[knownActionsForClip.length - 1], - byClipCacheIndex = action._byClipCacheIndex; + actionsByClip = this._actionsByClip, + actionsForClip = actionsByClip[clipUuid], + knownActionsForClip = actionsForClip.knownActions, + lastKnownAction = knownActionsForClip[knownActionsForClip.length - 1], + byClipCacheIndex = action._byClipCacheIndex; lastKnownAction._byClipCacheIndex = byClipCacheIndex; knownActionsForClip[byClipCacheIndex] = lastKnownAction; knownActionsForClip.pop(); action._byClipCacheIndex = null; const actionByRoot = actionsForClip.actionByRoot, - rootUuid = (action._localRoot || this._root).uuid; + rootUuid = (action._localRoot || this._root).uuid; delete actionByRoot[rootUuid]; - if (knownActionsForClip.length === 0) { delete actionsByClip[clipUuid]; } - this._removeInactiveBindingsForAction(action); } - _removeInactiveBindingsForAction(action) { const bindings = action._propertyBindings; - for (let i = 0, n = bindings.length; i !== n; ++i) { const binding = bindings[i]; - if (--binding.referenceCount === 0) { this._removeInactiveBinding(binding); } } } - _lendAction(action) { // [ active actions | inactive actions ] // [ active actions >| inactive actions ] // s a // <-swap-> // a s + const actions = this._actions, - prevIndex = action._cacheIndex, - lastActiveIndex = this._nActiveActions++, - firstInactiveAction = actions[lastActiveIndex]; + prevIndex = action._cacheIndex, + lastActiveIndex = this._nActiveActions++, + firstInactiveAction = actions[lastActiveIndex]; action._cacheIndex = lastActiveIndex; actions[lastActiveIndex] = action; firstInactiveAction._cacheIndex = prevIndex; actions[prevIndex] = firstInactiveAction; } - _takeBackAction(action) { // [ active actions | inactive actions ] // [ active actions |< inactive actions ] // a s // <-swap-> // s a + const actions = this._actions, - prevIndex = action._cacheIndex, - firstInactiveIndex = --this._nActiveActions, - lastActiveAction = actions[firstInactiveIndex]; + prevIndex = action._cacheIndex, + firstInactiveIndex = --this._nActiveActions, + lastActiveAction = actions[firstInactiveIndex]; action._cacheIndex = firstInactiveIndex; actions[firstInactiveIndex] = action; lastActiveAction._cacheIndex = prevIndex; actions[prevIndex] = lastActiveAction; - } // Memory management for PropertyMixer objects + } + // Memory management for PropertyMixer objects _addInactiveBinding(binding, rootUuid, trackName) { const bindingsByRoot = this._bindingsByRootAndName, - bindings = this._bindings; + bindings = this._bindings; let bindingByName = bindingsByRoot[rootUuid]; - if (bindingByName === undefined) { bindingByName = {}; bindingsByRoot[rootUuid] = bindingByName; } - bindingByName[trackName] = binding; binding._cacheIndex = bindings.length; bindings.push(binding); } - _removeInactiveBinding(binding) { const bindings = this._bindings, - propBinding = binding.binding, - rootUuid = propBinding.rootNode.uuid, - trackName = propBinding.path, - bindingsByRoot = this._bindingsByRootAndName, - bindingByName = bindingsByRoot[rootUuid], - lastInactiveBinding = bindings[bindings.length - 1], - cacheIndex = binding._cacheIndex; + propBinding = binding.binding, + rootUuid = propBinding.rootNode.uuid, + trackName = propBinding.path, + bindingsByRoot = this._bindingsByRootAndName, + bindingByName = bindingsByRoot[rootUuid], + lastInactiveBinding = bindings[bindings.length - 1], + cacheIndex = binding._cacheIndex; lastInactiveBinding._cacheIndex = cacheIndex; bindings[cacheIndex] = lastInactiveBinding; bindings.pop(); delete bindingByName[trackName]; - if (Object.keys(bindingByName).length === 0) { delete bindingsByRoot[rootUuid]; } } - _lendBinding(binding) { const bindings = this._bindings, - prevIndex = binding._cacheIndex, - lastActiveIndex = this._nActiveBindings++, - firstInactiveBinding = bindings[lastActiveIndex]; + prevIndex = binding._cacheIndex, + lastActiveIndex = this._nActiveBindings++, + firstInactiveBinding = bindings[lastActiveIndex]; binding._cacheIndex = lastActiveIndex; bindings[lastActiveIndex] = binding; firstInactiveBinding._cacheIndex = prevIndex; bindings[prevIndex] = firstInactiveBinding; } - _takeBackBinding(binding) { const bindings = this._bindings, - prevIndex = binding._cacheIndex, - firstInactiveIndex = --this._nActiveBindings, - lastActiveBinding = bindings[firstInactiveIndex]; + prevIndex = binding._cacheIndex, + firstInactiveIndex = --this._nActiveBindings, + lastActiveBinding = bindings[firstInactiveIndex]; binding._cacheIndex = firstInactiveIndex; bindings[firstInactiveIndex] = binding; lastActiveBinding._cacheIndex = prevIndex; bindings[prevIndex] = lastActiveBinding; - } // Memory management of Interpolants for weight and time scale + } + // Memory management of Interpolants for weight and time scale _lendControlInterpolant() { const interpolants = this._controlInterpolants, - lastActiveIndex = this._nActiveControlInterpolants++; + lastActiveIndex = this._nActiveControlInterpolants++; let interpolant = interpolants[lastActiveIndex]; - if (interpolant === undefined) { interpolant = new LinearInterpolant(new Float32Array(2), new Float32Array(2), 1, this._controlInterpolantsResultBuffer); interpolant.__cacheIndex = lastActiveIndex; interpolants[lastActiveIndex] = interpolant; } - return interpolant; } - _takeBackControlInterpolant(interpolant) { const interpolants = this._controlInterpolants, - prevIndex = interpolant.__cacheIndex, - firstInactiveIndex = --this._nActiveControlInterpolants, - lastActiveInterpolant = interpolants[firstInactiveIndex]; + prevIndex = interpolant.__cacheIndex, + firstInactiveIndex = --this._nActiveControlInterpolants, + lastActiveInterpolant = interpolants[firstInactiveIndex]; interpolant.__cacheIndex = firstInactiveIndex; interpolants[firstInactiveIndex] = interpolant; lastActiveInterpolant.__cacheIndex = prevIndex; interpolants[prevIndex] = lastActiveInterpolant; - } // return an action for a clip optionally using a custom root target + } + + // return an action for a clip optionally using a custom root target // object (this method allocates a lot of dynamic memory in case a // previously unknown clip/root combination is specified) - - clipAction(clip, optionalRoot, blendMode) { const root = optionalRoot || this._root, - rootUuid = root.uuid; + rootUuid = root.uuid; let clipObject = typeof clip === 'string' ? AnimationClip.findByName(root, clip) : clip; const clipUuid = clipObject !== null ? clipObject.uuid : clip; const actionsForClip = this._actionsByClip[clipUuid]; let prototypeAction = null; - if (blendMode === undefined) { if (clipObject !== null) { blendMode = clipObject.blendMode; @@ -33824,178 +30279,155 @@ class AnimationMixer extends EventDispatcher { blendMode = NormalAnimationBlendMode; } } - if (actionsForClip !== undefined) { const existingAction = actionsForClip.actionByRoot[rootUuid]; - if (existingAction !== undefined && existingAction.blendMode === blendMode) { return existingAction; - } // we know the clip, so we don't have to parse all - // the bindings again but can just copy - + } - prototypeAction = actionsForClip.knownActions[0]; // also, take the clip from the prototype action + // we know the clip, so we don't have to parse all + // the bindings again but can just copy + prototypeAction = actionsForClip.knownActions[0]; + // also, take the clip from the prototype action if (clipObject === null) clipObject = prototypeAction._clip; - } // clip must be known when specified via string - + } - if (clipObject === null) return null; // allocate all resources required to run it + // clip must be known when specified via string + if (clipObject === null) return null; + // allocate all resources required to run it const newAction = new AnimationAction(this, clipObject, optionalRoot, blendMode); + this._bindAction(newAction, prototypeAction); - this._bindAction(newAction, prototypeAction); // and make the action known to the memory manager - - + // and make the action known to the memory manager this._addInactiveAction(newAction, clipUuid, rootUuid); - return newAction; - } // get an existing action - + } + // get an existing action existingAction(clip, optionalRoot) { const root = optionalRoot || this._root, - rootUuid = root.uuid, - clipObject = typeof clip === 'string' ? AnimationClip.findByName(root, clip) : clip, - clipUuid = clipObject ? clipObject.uuid : clip, - actionsForClip = this._actionsByClip[clipUuid]; - + rootUuid = root.uuid, + clipObject = typeof clip === 'string' ? AnimationClip.findByName(root, clip) : clip, + clipUuid = clipObject ? clipObject.uuid : clip, + actionsForClip = this._actionsByClip[clipUuid]; if (actionsForClip !== undefined) { return actionsForClip.actionByRoot[rootUuid] || null; } - return null; - } // deactivates all previously scheduled actions - + } + // deactivates all previously scheduled actions stopAllAction() { const actions = this._actions, - nActions = this._nActiveActions; - + nActions = this._nActiveActions; for (let i = nActions - 1; i >= 0; --i) { actions[i].stop(); } - return this; - } // advance the time and update apply the animation - + } + // advance the time and update apply the animation update(deltaTime) { deltaTime *= this.timeScale; const actions = this._actions, - nActions = this._nActiveActions, - time = this.time += deltaTime, - timeDirection = Math.sign(deltaTime), - accuIndex = this._accuIndex ^= 1; // run active actions + nActions = this._nActiveActions, + time = this.time += deltaTime, + timeDirection = Math.sign(deltaTime), + accuIndex = this._accuIndex ^= 1; + + // run active actions for (let i = 0; i !== nActions; ++i) { const action = actions[i]; - action._update(time, deltaTime, timeDirection, accuIndex); - } // update scene graph + } + // update scene graph const bindings = this._bindings, - nBindings = this._nActiveBindings; - + nBindings = this._nActiveBindings; for (let i = 0; i !== nBindings; ++i) { bindings[i].apply(accuIndex); } - return this; - } // Allows you to seek to a specific time in an animation. - + } + // Allows you to seek to a specific time in an animation. setTime(timeInSeconds) { this.time = 0; // Zero out time attribute for AnimationMixer object; - for (let i = 0; i < this._actions.length; i++) { this._actions[i].time = 0; // Zero out time attribute for all associated AnimationAction objects. } - return this.update(timeInSeconds); // Update used to set exact time. Returns "this" AnimationMixer object. - } // return this mixer's root target object - + } + // return this mixer's root target object getRoot() { return this._root; - } // free all resources specific to a particular clip - + } + // free all resources specific to a particular clip uncacheClip(clip) { const actions = this._actions, - clipUuid = clip.uuid, - actionsByClip = this._actionsByClip, - actionsForClip = actionsByClip[clipUuid]; - + clipUuid = clip.uuid, + actionsByClip = this._actionsByClip, + actionsForClip = actionsByClip[clipUuid]; if (actionsForClip !== undefined) { // note: just calling _removeInactiveAction would mess up the // iteration state and also require updating the state we can // just throw away - const actionsToRemove = actionsForClip.knownActions; + const actionsToRemove = actionsForClip.knownActions; for (let i = 0, n = actionsToRemove.length; i !== n; ++i) { const action = actionsToRemove[i]; - this._deactivateAction(action); - const cacheIndex = action._cacheIndex, - lastInactiveAction = actions[actions.length - 1]; + lastInactiveAction = actions[actions.length - 1]; action._cacheIndex = null; action._byClipCacheIndex = null; lastInactiveAction._cacheIndex = cacheIndex; actions[cacheIndex] = lastInactiveAction; actions.pop(); - this._removeInactiveBindingsForAction(action); } - delete actionsByClip[clipUuid]; } - } // free all resources specific to a particular root target object - + } + // free all resources specific to a particular root target object uncacheRoot(root) { const rootUuid = root.uuid, - actionsByClip = this._actionsByClip; - + actionsByClip = this._actionsByClip; for (const clipUuid in actionsByClip) { const actionByRoot = actionsByClip[clipUuid].actionByRoot, - action = actionByRoot[rootUuid]; - + action = actionByRoot[rootUuid]; if (action !== undefined) { this._deactivateAction(action); - this._removeInactiveAction(action); } } - const bindingsByRoot = this._bindingsByRootAndName, - bindingByName = bindingsByRoot[rootUuid]; - + bindingByName = bindingsByRoot[rootUuid]; if (bindingByName !== undefined) { for (const trackName in bindingByName) { const binding = bindingByName[trackName]; binding.restoreOriginalState(); - this._removeInactiveBinding(binding); } } - } // remove a targeted clip from the cache - + } + // remove a targeted clip from the cache uncacheAction(clip, optionalRoot) { const action = this.existingAction(clip, optionalRoot); - if (action !== null) { this._deactivateAction(action); - this._removeInactiveAction(action); } } - } - AnimationMixer.prototype._controlInterpolantsResultBuffer = new Float32Array(1); class Uniform { @@ -34004,14 +30436,11 @@ class Uniform { console.warn('THREE.Uniform: Type parameter is no longer needed.'); value = arguments[1]; } - this.value = value; } - clone() { return new Uniform(this.value.clone === undefined ? this.value : this.value.clone()); } - } class InstancedInterleavedBuffer extends InterleavedBuffer { @@ -34019,28 +30448,23 @@ class InstancedInterleavedBuffer extends InterleavedBuffer { super(array, stride); this.meshPerAttribute = meshPerAttribute; } - copy(source) { super.copy(source); this.meshPerAttribute = source.meshPerAttribute; return this; } - clone(data) { const ib = super.clone(data); ib.meshPerAttribute = this.meshPerAttribute; return ib; } - toJSON(data) { const json = super.toJSON(data); json.isInstancedInterleavedBuffer = true; json.meshPerAttribute = this.meshPerAttribute; return json; } - } - InstancedInterleavedBuffer.prototype.isInstancedInterleavedBuffer = true; class GLBufferAttribute { @@ -34052,39 +30476,33 @@ class GLBufferAttribute { this.count = count; this.version = 0; } - set needsUpdate(value) { if (value === true) this.version++; } - setBuffer(buffer) { this.buffer = buffer; return this; } - setType(type, elementSize) { this.type = type; this.elementSize = elementSize; return this; } - setItemSize(itemSize) { this.itemSize = itemSize; return this; } - setCount(count) { this.count = count; return this; } - } - GLBufferAttribute.prototype.isGLBufferAttribute = true; class Raycaster { constructor(origin, direction, near = 0, far = Infinity) { - this.ray = new Ray(origin, direction); // direction is assumed to be normalized (for accurate distance calculations) + this.ray = new Ray(origin, direction); + // direction is assumed to be normalized (for accurate distance calculations) this.near = near; this.far = far; @@ -34102,12 +30520,11 @@ class Raycaster { Sprite: {} }; } - set(origin, direction) { // direction is assumed to be normalized (for accurate distance calculations) + this.ray.set(origin, direction); } - setFromCamera(coords, camera) { if (camera && camera.isPerspectiveCamera) { this.ray.origin.setFromMatrixPosition(camera.matrixWorld); @@ -34115,43 +30532,34 @@ class Raycaster { this.camera = camera; } else if (camera && camera.isOrthographicCamera) { this.ray.origin.set(coords.x, coords.y, (camera.near + camera.far) / (camera.near - camera.far)).unproject(camera); // set origin in plane of camera - this.ray.direction.set(0, 0, -1).transformDirection(camera.matrixWorld); this.camera = camera; } else { console.error('THREE.Raycaster: Unsupported camera type: ' + camera.type); } } - intersectObject(object, recursive = true, intersects = []) { intersectObject(object, this, intersects, recursive); intersects.sort(ascSort); return intersects; } - intersectObjects(objects, recursive = true, intersects = []) { for (let i = 0, l = objects.length; i < l; i++) { intersectObject(objects[i], this, intersects, recursive); } - intersects.sort(ascSort); return intersects; } - } - function ascSort(a, b) { return a.distance - b.distance; } - function intersectObject(object, raycaster, intersects, recursive) { if (object.layers.test(raycaster.layers)) { object.raycast(raycaster, intersects); } - if (recursive === true) { const children = object.children; - for (let i = 0, l = children.length; i < l; i++) { intersectObject(children[i], raycaster, intersects, true); } @@ -34164,45 +30572,38 @@ function intersectObject(object, raycaster, intersects, recursive) { * The polar angle (phi) is measured from the positive y-axis. The positive y-axis is up. * The azimuthal angle (theta) is measured from the positive z-axis. */ - class Spherical { constructor(radius = 1, phi = 0, theta = 0) { this.radius = radius; this.phi = phi; // polar angle - this.theta = theta; // azimuthal angle return this; } - set(radius, phi, theta) { this.radius = radius; this.phi = phi; this.theta = theta; return this; } - copy(other) { this.radius = other.radius; this.phi = other.phi; this.theta = other.theta; return this; - } // restrict phi to be betwee EPS and PI-EPS - + } + // restrict phi to be betwee EPS and PI-EPS makeSafe() { const EPS = 0.000001; this.phi = Math.max(EPS, Math.min(Math.PI - EPS, this.phi)); return this; } - setFromVector3(v) { return this.setFromCartesianCoords(v.x, v.y, v.z); } - setFromCartesianCoords(x, y, z) { this.radius = Math.sqrt(x * x + y * y + z * z); - if (this.radius === 0) { this.theta = 0; this.phi = 0; @@ -34210,278 +30611,220 @@ class Spherical { this.theta = Math.atan2(x, z); this.phi = Math.acos(clamp(y / this.radius, -1, 1)); } - return this; } - clone() { return new this.constructor().copy(this); } - } /** * Ref: https://en.wikipedia.org/wiki/Cylindrical_coordinate_system */ + class Cylindrical { constructor(radius = 1, theta = 0, y = 0) { this.radius = radius; // distance from the origin to a point in the x-z plane - this.theta = theta; // counterclockwise angle in the x-z plane measured in radians from the positive z-axis - this.y = y; // height above the x-z plane return this; } - set(radius, theta, y) { this.radius = radius; this.theta = theta; this.y = y; return this; } - copy(other) { this.radius = other.radius; this.theta = other.theta; this.y = other.y; return this; } - setFromVector3(v) { return this.setFromCartesianCoords(v.x, v.y, v.z); } - setFromCartesianCoords(x, y, z) { this.radius = Math.sqrt(x * x + z * z); this.theta = Math.atan2(x, z); this.y = y; return this; } - clone() { return new this.constructor().copy(this); } - } const _vector$4 = /*@__PURE__*/new Vector2(); - class Box2 { constructor(min = new Vector2(+Infinity, +Infinity), max = new Vector2(-Infinity, -Infinity)) { this.min = min; this.max = max; } - set(min, max) { this.min.copy(min); this.max.copy(max); return this; } - setFromPoints(points) { this.makeEmpty(); - for (let i = 0, il = points.length; i < il; i++) { this.expandByPoint(points[i]); } - return this; } - setFromCenterAndSize(center, size) { const halfSize = _vector$4.copy(size).multiplyScalar(0.5); - this.min.copy(center).sub(halfSize); this.max.copy(center).add(halfSize); return this; } - clone() { return new this.constructor().copy(this); } - copy(box) { this.min.copy(box.min); this.max.copy(box.max); return this; } - makeEmpty() { this.min.x = this.min.y = +Infinity; this.max.x = this.max.y = -Infinity; return this; } - isEmpty() { // this is a more robust check for empty than ( volume <= 0 ) because volume can get positive with two negative axes + return this.max.x < this.min.x || this.max.y < this.min.y; } - getCenter(target) { return this.isEmpty() ? target.set(0, 0) : target.addVectors(this.min, this.max).multiplyScalar(0.5); } - getSize(target) { return this.isEmpty() ? target.set(0, 0) : target.subVectors(this.max, this.min); } - expandByPoint(point) { this.min.min(point); this.max.max(point); return this; } - expandByVector(vector) { this.min.sub(vector); this.max.add(vector); return this; } - expandByScalar(scalar) { this.min.addScalar(-scalar); this.max.addScalar(scalar); return this; } - containsPoint(point) { return point.x < this.min.x || point.x > this.max.x || point.y < this.min.y || point.y > this.max.y ? false : true; } - containsBox(box) { return this.min.x <= box.min.x && box.max.x <= this.max.x && this.min.y <= box.min.y && box.max.y <= this.max.y; } - getParameter(point, target) { // This can potentially have a divide by zero if the box // has a size dimension of 0. + return target.set((point.x - this.min.x) / (this.max.x - this.min.x), (point.y - this.min.y) / (this.max.y - this.min.y)); } - intersectsBox(box) { // using 4 splitting planes to rule out intersections + return box.max.x < this.min.x || box.min.x > this.max.x || box.max.y < this.min.y || box.min.y > this.max.y ? false : true; } - clampPoint(point, target) { return target.copy(point).clamp(this.min, this.max); } - distanceToPoint(point) { const clampedPoint = _vector$4.copy(point).clamp(this.min, this.max); - return clampedPoint.sub(point).length(); } - intersect(box) { this.min.max(box.min); this.max.min(box.max); return this; } - union(box) { this.min.min(box.min); this.max.max(box.max); return this; } - translate(offset) { this.min.add(offset); this.max.add(offset); return this; } - equals(box) { return box.min.equals(this.min) && box.max.equals(this.max); } - } - Box2.prototype.isBox2 = true; const _startP = /*@__PURE__*/new Vector3(); - const _startEnd = /*@__PURE__*/new Vector3(); - class Line3 { constructor(start = new Vector3(), end = new Vector3()) { this.start = start; this.end = end; } - set(start, end) { this.start.copy(start); this.end.copy(end); return this; } - copy(line) { this.start.copy(line.start); this.end.copy(line.end); return this; } - getCenter(target) { return target.addVectors(this.start, this.end).multiplyScalar(0.5); } - delta(target) { return target.subVectors(this.end, this.start); } - distanceSq() { return this.start.distanceToSquared(this.end); } - distance() { return this.start.distanceTo(this.end); } - at(t, target) { return this.delta(target).multiplyScalar(t).add(this.start); } - closestPointToPointParameter(point, clampToLine) { _startP.subVectors(point, this.start); - _startEnd.subVectors(this.end, this.start); - const startEnd2 = _startEnd.dot(_startEnd); - const startEnd_startP = _startEnd.dot(_startP); - let t = startEnd_startP / startEnd2; - if (clampToLine) { t = clamp(t, 0, 1); } - return t; } - closestPointToPoint(point, clampToLine, target) { const t = this.closestPointToPointParameter(point, clampToLine); return this.delta(target).multiplyScalar(t).add(this.start); } - applyMatrix4(matrix) { this.start.applyMatrix4(matrix); this.end.applyMatrix4(matrix); return this; } - equals(line) { return line.start.equals(this.start) && line.end.equals(this.end); } - clone() { return new this.constructor().copy(this); } - } const _vector$3 = /*@__PURE__*/new Vector3(); - class SpotLightHelper extends Object3D { constructor(light, color) { super(); @@ -34492,13 +30835,11 @@ class SpotLightHelper extends Object3D { this.color = color; const geometry = new BufferGeometry(); const positions = [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 i = 0, j = 1, l = 32; i < l; i++, j++) { const p1 = i / l * Math.PI * 2; const p2 = j / l * Math.PI * 2; positions.push(Math.cos(p1), Math.sin(p1), 1, Math.cos(p2), Math.sin(p2), 1); } - geometry.setAttribute('position', new Float32BufferAttribute(positions, 3)); const material = new LineBasicMaterial({ fog: false, @@ -34508,37 +30849,28 @@ class SpotLightHelper extends Object3D { this.add(this.cone); this.update(); } - dispose() { this.cone.geometry.dispose(); this.cone.material.dispose(); } - update() { this.light.updateMatrixWorld(); const coneLength = this.light.distance ? this.light.distance : 1000; const coneWidth = coneLength * Math.tan(this.light.angle); this.cone.scale.set(coneWidth, coneWidth, coneLength); - _vector$3.setFromMatrixPosition(this.light.target.matrixWorld); - this.cone.lookAt(_vector$3); - if (this.color !== undefined) { this.cone.material.color.set(this.color); } else { this.cone.material.color.copy(this.light.color); } } - } const _vector$2 = /*@__PURE__*/new Vector3(); - const _boneMatrix = /*@__PURE__*/new Matrix4(); - const _matrixWorldInv = /*@__PURE__*/new Matrix4(); - class SkeletonHelper extends LineSegments { constructor(object) { const bones = getBoneList(object); @@ -34547,10 +30879,8 @@ class SkeletonHelper extends LineSegments { const colors = []; const color1 = new Color(0, 0, 1); const color2 = new Color(0, 1, 0); - for (let i = 0; i < bones.length; i++) { const bone = bones[i]; - if (bone.parent && bone.parent.isBone) { vertices.push(0, 0, 0); vertices.push(0, 0, 0); @@ -34558,7 +30888,6 @@ class SkeletonHelper extends LineSegments { colors.push(color2.r, color2.g, color2.b); } } - geometry.setAttribute('position', new Float32BufferAttribute(vertices, 3)); geometry.setAttribute('color', new Float32BufferAttribute(colors, 3)); const material = new LineBasicMaterial({ @@ -34576,50 +30905,35 @@ class SkeletonHelper extends LineSegments { this.matrix = object.matrixWorld; this.matrixAutoUpdate = false; } - updateMatrixWorld(force) { const bones = this.bones; const geometry = this.geometry; const position = geometry.getAttribute('position'); - _matrixWorldInv.copy(this.root.matrixWorld).invert(); - for (let i = 0, j = 0; i < bones.length; i++) { const bone = bones[i]; - if (bone.parent && bone.parent.isBone) { _boneMatrix.multiplyMatrices(_matrixWorldInv, bone.matrixWorld); - _vector$2.setFromMatrixPosition(_boneMatrix); - position.setXYZ(j, _vector$2.x, _vector$2.y, _vector$2.z); - _boneMatrix.multiplyMatrices(_matrixWorldInv, bone.parent.matrixWorld); - _vector$2.setFromMatrixPosition(_boneMatrix); - position.setXYZ(j + 1, _vector$2.x, _vector$2.y, _vector$2.z); j += 2; } } - geometry.getAttribute('position').needsUpdate = true; super.updateMatrixWorld(force); } - } - function getBoneList(object) { const boneList = []; - if (object && object.isBone) { boneList.push(object); } - for (let i = 0; i < object.children.length; i++) { boneList.push.apply(boneList, getBoneList(object.children[i])); } - return boneList; } @@ -34639,53 +30953,48 @@ class PointLightHelper extends Mesh { this.matrix = this.light.matrixWorld; this.matrixAutoUpdate = false; this.update(); + /* // TODO: delete this comment? const distanceGeometry = new THREE.IcosahedronBufferGeometry( 1, 2 ); const distanceMaterial = new THREE.MeshBasicMaterial( { color: hexColor, fog: false, wireframe: true, opacity: 0.1, transparent: true } ); - this.lightSphere = new THREE.Mesh( bulbGeometry, bulbMaterial ); + this.lightSphere = new THREE.Mesh( bulbGeometry, bulbMaterial ); this.lightDistance = new THREE.Mesh( distanceGeometry, distanceMaterial ); - const d = light.distance; - if ( d === 0.0 ) { - this.lightDistance.visible = false; - } else { - this.lightDistance.scale.set( d, d, d ); - } - this.add( this.lightDistance ); + const d = light.distance; + if ( d === 0.0 ) { + this.lightDistance.visible = false; + } else { + this.lightDistance.scale.set( d, d, d ); + } + this.add( this.lightDistance ); */ } - dispose() { this.geometry.dispose(); this.material.dispose(); } - update() { if (this.color !== undefined) { this.material.color.set(this.color); } else { this.material.color.copy(this.light.color); } + /* const d = this.light.distance; - if ( d === 0.0 ) { - this.lightDistance.visible = false; - } else { - this.lightDistance.visible = true; + if ( d === 0.0 ) { + this.lightDistance.visible = false; + } else { + this.lightDistance.visible = true; this.lightDistance.scale.set( d, d, d ); - } + } */ - } - } const _vector$1 = /*@__PURE__*/new Vector3(); - const _color1 = /*@__PURE__*/new Color(); - const _color2 = /*@__PURE__*/new Color(); - class HemisphereLightHelper extends Object3D { constructor(light, size, color) { super(); @@ -34708,35 +31017,26 @@ class HemisphereLightHelper extends Object3D { this.add(new Mesh(geometry, this.material)); this.update(); } - dispose() { this.children[0].geometry.dispose(); this.children[0].material.dispose(); } - update() { const mesh = this.children[0]; - if (this.color !== undefined) { this.material.color.set(this.color); } else { const colors = mesh.geometry.getAttribute('color'); - _color1.copy(this.light.color); - _color2.copy(this.light.groundColor); - for (let i = 0, l = colors.count; i < l; i++) { const color = i < l / 2 ? _color1 : _color2; colors.setXYZ(i, color.r, color.g, color.b); } - colors.needsUpdate = true; } - mesh.lookAt(_vector$1.setFromMatrixPosition(this.light.matrixWorld).negate()); } - } class GridHelper extends LineSegments { @@ -34747,8 +31047,7 @@ class GridHelper extends LineSegments { const step = size / divisions; const halfSize = size / 2; const vertices = [], - colors = []; - + colors = []; for (let i = 0, j = 0, k = -halfSize; i <= divisions; i++, k += step) { vertices.push(-halfSize, 0, k, halfSize, 0, k); vertices.push(k, 0, -halfSize, k, 0, halfSize); @@ -34762,7 +31061,6 @@ class GridHelper extends LineSegments { color.toArray(colors, j); j += 3; } - const geometry = new BufferGeometry(); geometry.setAttribute('position', new Float32BufferAttribute(vertices, 3)); geometry.setAttribute('color', new Float32BufferAttribute(colors, 3)); @@ -34773,7 +31071,6 @@ class GridHelper extends LineSegments { super(geometry, material); this.type = 'GridHelper'; } - } class PolarGridHelper extends LineSegments { @@ -34781,7 +31078,9 @@ class PolarGridHelper extends LineSegments { color1 = new Color(color1); color2 = new Color(color2); const vertices = []; - const colors = []; // create the radials + const colors = []; + + // create the radials for (let i = 0; i <= radials; i++) { const v = i / radials * (Math.PI * 2); @@ -34792,20 +31091,23 @@ class PolarGridHelper extends LineSegments { const color = i & 1 ? color1 : color2; colors.push(color.r, color.g, color.b); colors.push(color.r, color.g, color.b); - } // create the circles + } + // create the circles for (let i = 0; i <= circles; i++) { const color = i & 1 ? color1 : color2; const r = radius - radius / circles * i; - for (let j = 0; j < divisions; j++) { // first vertex + let v = j / divisions * (Math.PI * 2); let x = Math.sin(v) * r; let z = Math.cos(v) * r; vertices.push(x, 0, z); - colors.push(color.r, color.g, color.b); // second vertex + colors.push(color.r, color.g, color.b); + + // second vertex v = (j + 1) / divisions * (Math.PI * 2); x = Math.sin(v) * r; @@ -34814,7 +31116,6 @@ class PolarGridHelper extends LineSegments { colors.push(color.r, color.g, color.b); } } - const geometry = new BufferGeometry(); geometry.setAttribute('position', new Float32BufferAttribute(vertices, 3)); geometry.setAttribute('color', new Float32BufferAttribute(colors, 3)); @@ -34825,15 +31126,11 @@ class PolarGridHelper extends LineSegments { super(geometry, material); this.type = 'PolarGridHelper'; } - } const _v1 = /*@__PURE__*/new Vector3(); - const _v2 = /*@__PURE__*/new Vector3(); - const _v3 = /*@__PURE__*/new Vector3(); - class DirectionalLightHelper extends Object3D { constructor(light, size, color) { super(); @@ -34857,23 +31154,17 @@ class DirectionalLightHelper extends Object3D { this.add(this.targetLine); this.update(); } - dispose() { this.lightPlane.geometry.dispose(); this.lightPlane.material.dispose(); this.targetLine.geometry.dispose(); this.targetLine.material.dispose(); } - update() { _v1.setFromMatrixPosition(this.light.matrixWorld); - _v2.setFromMatrixPosition(this.light.target.matrixWorld); - _v3.subVectors(_v2, _v1); - this.lightPlane.lookAt(_v2); - if (this.color !== undefined) { this.lightPlane.material.color.set(this.color); this.targetLine.material.color.set(this.color); @@ -34881,16 +31172,14 @@ class DirectionalLightHelper extends Object3D { this.lightPlane.material.color.copy(this.light.color); this.targetLine.material.color.copy(this.light.color); } - this.targetLine.lookAt(_v2); this.targetLine.scale.z = _v3.length(); } - } const _vector = /*@__PURE__*/new Vector3(); - const _camera = /*@__PURE__*/new Camera(); + /** * - shows frustum, line of sight and up of the camera * - suitable for fast updates @@ -34898,7 +31187,6 @@ const _camera = /*@__PURE__*/new Camera(); * https://github.com/evanw/lightgl.js/blob/master/tests/shadowmap.html */ - class CameraHelper extends LineSegments { constructor(camera) { const geometry = new BufferGeometry(); @@ -34909,62 +31197,73 @@ class CameraHelper extends LineSegments { }); const vertices = []; const colors = []; - const pointMap = {}; // colors + const pointMap = {}; + + // colors const colorFrustum = new Color(0xffaa00); const colorCone = new Color(0xff0000); const colorUp = new Color(0x00aaff); const colorTarget = new Color(0xffffff); - const colorCross = new Color(0x333333); // near + const colorCross = new Color(0x333333); + + // near addLine('n1', 'n2', colorFrustum); addLine('n2', 'n4', colorFrustum); addLine('n4', 'n3', colorFrustum); - addLine('n3', 'n1', colorFrustum); // far + addLine('n3', 'n1', colorFrustum); + + // far addLine('f1', 'f2', colorFrustum); addLine('f2', 'f4', colorFrustum); addLine('f4', 'f3', colorFrustum); - addLine('f3', 'f1', colorFrustum); // sides + addLine('f3', 'f1', colorFrustum); + + // sides addLine('n1', 'f1', colorFrustum); addLine('n2', 'f2', colorFrustum); addLine('n3', 'f3', colorFrustum); - addLine('n4', 'f4', colorFrustum); // cone + addLine('n4', 'f4', colorFrustum); + + // cone addLine('p', 'n1', colorCone); addLine('p', 'n2', colorCone); addLine('p', 'n3', colorCone); - addLine('p', 'n4', colorCone); // up + addLine('p', 'n4', colorCone); + + // up addLine('u1', 'u2', colorUp); addLine('u2', 'u3', colorUp); - addLine('u3', 'u1', colorUp); // target + addLine('u3', 'u1', colorUp); + + // target addLine('c', 't', colorTarget); - addLine('p', 'c', colorCross); // cross + addLine('p', 'c', colorCross); + + // cross addLine('cn1', 'cn2', colorCross); addLine('cn3', 'cn4', colorCross); addLine('cf1', 'cf2', colorCross); addLine('cf3', 'cf4', colorCross); - function addLine(a, b, color) { addPoint(a, color); addPoint(b, color); } - function addPoint(id, color) { vertices.push(0, 0, 0); colors.push(color.r, color.g, color.b); - if (pointMap[id] === undefined) { pointMap[id] = []; } - pointMap[id].push(vertices.length / 3 - 1); } - geometry.setAttribute('position', new Float32BufferAttribute(vertices, 3)); geometry.setAttribute('color', new Float32BufferAttribute(colors, 3)); super(geometry, material); @@ -34976,33 +31275,43 @@ class CameraHelper extends LineSegments { this.pointMap = pointMap; this.update(); } - update() { const geometry = this.geometry; const pointMap = this.pointMap; const w = 1, - h = 1; // we need just camera projection matrix inverse + h = 1; + + // we need just camera projection matrix inverse // world matrix must be identity - _camera.projectionMatrixInverse.copy(this.camera.projectionMatrixInverse); // center / target + _camera.projectionMatrixInverse.copy(this.camera.projectionMatrixInverse); + // center / target setPoint('c', pointMap, geometry, _camera, 0, 0, -1); - setPoint('t', pointMap, geometry, _camera, 0, 0, 1); // near + setPoint('t', pointMap, geometry, _camera, 0, 0, 1); + + // near setPoint('n1', pointMap, geometry, _camera, -w, -h, -1); setPoint('n2', pointMap, geometry, _camera, w, -h, -1); setPoint('n3', pointMap, geometry, _camera, -w, h, -1); - setPoint('n4', pointMap, geometry, _camera, w, h, -1); // far + setPoint('n4', pointMap, geometry, _camera, w, h, -1); + + // far setPoint('f1', pointMap, geometry, _camera, -w, -h, 1); setPoint('f2', pointMap, geometry, _camera, w, -h, 1); setPoint('f3', pointMap, geometry, _camera, -w, h, 1); - setPoint('f4', pointMap, geometry, _camera, w, h, 1); // up + setPoint('f4', pointMap, geometry, _camera, w, h, 1); + + // up setPoint('u1', pointMap, geometry, _camera, w * 0.7, h * 1.1, -1); setPoint('u2', pointMap, geometry, _camera, -w * 0.7, h * 1.1, -1); - setPoint('u3', pointMap, geometry, _camera, 0, h * 2, -1); // cross + setPoint('u3', pointMap, geometry, _camera, 0, h * 2, -1); + + // cross setPoint('cf1', pointMap, geometry, _camera, -w, 0, 1); setPoint('cf2', pointMap, geometry, _camera, w, 0, 1); @@ -35014,22 +31323,16 @@ class CameraHelper extends LineSegments { setPoint('cn4', pointMap, geometry, _camera, 0, h, -1); geometry.getAttribute('position').needsUpdate = true; } - dispose() { this.geometry.dispose(); this.material.dispose(); } - } - function setPoint(point, pointMap, geometry, camera, x, y, z) { _vector.set(x, y, z).unproject(camera); - const points = pointMap[point]; - if (points !== undefined) { const position = geometry.getAttribute('position'); - for (let i = 0, l = points.length; i < l; i++) { position.setXYZ(points[i], _vector.x, _vector.y, _vector.z); } @@ -35037,7 +31340,6 @@ function setPoint(point, pointMap, geometry, camera, x, y, z) { } const _box$1 = /*@__PURE__*/new Box3(); - class BoxHelper extends LineSegments { constructor(object, color = 0xffff00) { const indices = new Uint16Array([0, 1, 1, 2, 2, 3, 3, 0, 4, 5, 5, 6, 6, 7, 7, 4, 0, 4, 1, 5, 2, 6, 3, 7]); @@ -35054,25 +31356,23 @@ class BoxHelper extends LineSegments { this.matrixAutoUpdate = false; this.update(); } - update(object) { if (object !== undefined) { console.warn('THREE.BoxHelper: .update() has no longer arguments.'); } - if (this.object !== undefined) { _box$1.setFromObject(this.object); } - if (_box$1.isEmpty()) return; const min = _box$1.min; const max = _box$1.max; + /* 5____4 1/___0/| | 6__|_7 2/___3/ - 0: max.x, max.y, max.z + 0: max.x, max.y, max.z 1: min.x, max.y, max.z 2: min.x, min.y, max.z 3: max.x, min.y, max.z @@ -35111,19 +31411,16 @@ class BoxHelper extends LineSegments { position.needsUpdate = true; this.geometry.computeBoundingSphere(); } - setFromObject(object) { this.object = object; this.update(); return this; } - copy(source) { LineSegments.prototype.copy.call(this, source); this.object = source.object; return this; } - } class Box3Helper extends LineSegments { @@ -35141,7 +31438,6 @@ class Box3Helper extends LineSegments { this.type = 'Box3Helper'; this.geometry.computeBoundingSphere(); } - updateMatrixWorld(force) { const box = this.box; if (box.isEmpty()) return; @@ -35150,7 +31446,6 @@ class Box3Helper extends LineSegments { this.scale.multiplyScalar(0.5); super.updateMatrixWorld(force); } - } class PlaneHelper extends Line { @@ -35179,7 +31474,6 @@ class PlaneHelper extends Line { toneMapped: false }))); } - updateMatrixWorld(force) { let scale = -this.plane.constant; if (Math.abs(scale) < 1e-8) scale = 1e-8; // sign does not matter @@ -35190,29 +31484,22 @@ class PlaneHelper extends Line { this.lookAt(this.plane.normal); super.updateMatrixWorld(force); } - } const _axis = /*@__PURE__*/new Vector3(); - let _lineGeometry, _coneGeometry; - class ArrowHelper extends Object3D { // dir is assumed to be normalized + constructor(dir = new Vector3(0, 0, 1), origin = new Vector3(0, 0, 0), length = 1, color = 0xffff00, headLength = length * 0.2, headWidth = headLength * 0.2) { super(); this.type = 'ArrowHelper'; - if (_lineGeometry === undefined) { _lineGeometry = new BufferGeometry(); - _lineGeometry.setAttribute('position', new Float32BufferAttribute([0, 0, 0, 0, 1, 0], 3)); - _coneGeometry = new CylinderGeometry(0, 0.5, 1, 5, 1); - _coneGeometry.translate(0, -0.5, 0); } - this.position.copy(origin); this.line = new Line(_lineGeometry, new LineBasicMaterial({ color: color, @@ -35229,42 +31516,36 @@ class ArrowHelper extends Object3D { this.setDirection(dir); this.setLength(length, headLength, headWidth); } - setDirection(dir) { // dir is assumed to be normalized + if (dir.y > 0.99999) { this.quaternion.set(0, 0, 0, 1); } else if (dir.y < -0.99999) { this.quaternion.set(1, 0, 0, 0); } else { _axis.set(dir.z, 0, -dir.x).normalize(); - const radians = Math.acos(dir.y); this.quaternion.setFromAxisAngle(_axis, radians); } } - setLength(length, headLength = length * 0.2, headWidth = headLength * 0.2) { this.line.scale.set(1, Math.max(0.0001, length - headLength), 1); // see #17458 - this.line.updateMatrix(); this.cone.scale.set(headWidth, headLength, headWidth); this.cone.position.y = length; this.cone.updateMatrix(); } - setColor(color) { this.line.material.color.set(color); this.cone.material.color.set(color); } - copy(source) { super.copy(source, false); this.line.copy(source.line); this.cone.copy(source.cone); return this; } - } class AxesHelper extends LineSegments { @@ -35281,7 +31562,6 @@ class AxesHelper extends LineSegments { super(geometry, material); this.type = 'AxesHelper'; } - setColors(xAxisColor, yAxisColor, zAxisColor) { const color = new Color(); const array = this.geometry.attributes.color.array; @@ -35297,20 +31577,16 @@ class AxesHelper extends LineSegments { this.geometry.attributes.color.needsUpdate = true; return this; } - dispose() { this.geometry.dispose(); this.material.dispose(); } - } /** * @author chubei */ - const _box = /*@__PURE__*/new Box3(); - class SkinnedMeshBoxHelper extends LineSegments { constructor(mesh, color) { if (color === undefined) color = 0xffff00; @@ -35326,40 +31602,34 @@ class SkinnedMeshBoxHelper extends LineSegments { this.matrixAutoUpdate = false; this.update(); } - update(mesh) { if (mesh !== undefined) { console.warn('THREE.SkinnedMeshBoxHelper: .update() has no longer arguments.'); } - if (this.mesh !== undefined) { if (!this.mesh.geometry.boundingBox) { this.mesh.geometry.computeBoundingBox(); } - _box.copy(this.mesh.geometry.boundingBox); - const skeleton = this.mesh.skeleton; - if (skeleton && skeleton.rootMotionBone) { const rootMotion = skeleton.rootMotionBone.matrixWorld.clone(); rootMotion.multiply(skeleton.rootMotionBoneInitialMatrixInverse); - _box.applyMatrix4(rootMotion); } else { _box.applyMatrix4(this.mesh.matrixWorld); } } - if (_box.isEmpty()) return; var min = _box.min; var max = _box.max; + /* 5____4 1/___0/| | 6__|_7 2/___3/ - 0: max.x, max.y, max.z + 0: max.x, max.y, max.z 1: min.x, max.y, max.z 2: min.x, min.y, max.z 3: max.x, min.y, max.z @@ -35398,13 +31668,11 @@ class SkinnedMeshBoxHelper extends LineSegments { position.needsUpdate = true; this.geometry.computeBoundingSphere(); } - setFromMesh(mesh) { this.mesh = mesh; this.update(); return this; } - } class ShapePath { @@ -35414,62 +31682,52 @@ class ShapePath { this.subPaths = []; this.currentPath = null; } - moveTo(x, y) { this.currentPath = new Path(); this.subPaths.push(this.currentPath); this.currentPath.moveTo(x, y); return this; } - lineTo(x, y) { this.currentPath.lineTo(x, y); return this; } - quadraticCurveTo(aCPx, aCPy, aX, aY) { this.currentPath.quadraticCurveTo(aCPx, aCPy, aX, aY); return this; } - bezierCurveTo(aCP1x, aCP1y, aCP2x, aCP2y, aX, aY) { this.currentPath.bezierCurveTo(aCP1x, aCP1y, aCP2x, aCP2y, aX, aY); return this; } - splineThru(pts) { this.currentPath.splineThru(pts); return this; } - toShapes(isCCW, noHoles) { function toShapesNoHoles(inSubpaths) { const shapes = []; - for (let i = 0, l = inSubpaths.length; i < l; i++) { const tmpPath = inSubpaths[i]; const tmpShape = new Shape(); tmpShape.curves = tmpPath.curves; shapes.push(tmpShape); } - return shapes; } - function isPointInsidePolygon(inPt, inPolygon) { - const polyLen = inPolygon.length; // inPt on polygon contour => immediate success or + const polyLen = inPolygon.length; + + // inPt on polygon contour => immediate success or // toggling of inside/outside at every single! intersection point of an edge // with the horizontal line through inPt, left of inPt // not counting lowerY endpoints of edges and whole edges on that line - let inside = false; - for (let p = polyLen - 1, q = 0; q < polyLen; p = q++) { let edgeLowPt = inPolygon[p]; let edgeHighPt = inPolygon[q]; let edgeDx = edgeHighPt.x - edgeLowPt.x; let edgeDy = edgeHighPt.y - edgeLowPt.y; - if (Math.abs(edgeDy) > Number.EPSILON) { // not parallel if (edgeDy < 0) { @@ -35478,16 +31736,13 @@ class ShapePath { edgeHighPt = inPolygon[p]; edgeDy = -edgeDy; } - if (inPt.y < edgeLowPt.y || inPt.y > edgeHighPt.y) continue; - if (inPt.y === edgeLowPt.y) { if (inPt.x === edgeLowPt.x) return true; // inPt is on contour ? // continue; // no intersection or edgeLowPt => doesn't count !!! } else { const perpEdge = edgeDy * (inPt.x - edgeLowPt.x) - edgeDx * (inPt.y - edgeLowPt.y); if (perpEdge === 0) return true; // inPt is on contour ? - if (perpEdge < 0) continue; inside = !inside; // true intersection left of inPt } @@ -35495,22 +31750,18 @@ class ShapePath { // parallel or collinear if (inPt.y !== edgeLowPt.y) continue; // parallel // edge lies on the same horizontal line as inPt - if (edgeHighPt.x <= inPt.x && inPt.x <= edgeLowPt.x || edgeLowPt.x <= inPt.x && inPt.x <= edgeHighPt.x) return true; // inPt: Point on contour ! // continue; } } - return inside; } - const isClockWise = ShapeUtils.isClockWise; const subPaths = this.subPaths; if (subPaths.length === 0) return []; if (noHoles === true) return toShapesNoHoles(subPaths); let solid, tmpPath, tmpShape; const shapes = []; - if (subPaths.length === 1) { tmpPath = subPaths[0]; tmpShape = new Shape(); @@ -35518,9 +31769,10 @@ class ShapePath { shapes.push(tmpShape); return shapes; } - let holesFirst = !isClockWise(subPaths[0].getPoints()); - holesFirst = isCCW ? !holesFirst : holesFirst; // console.log("Holes first", holesFirst); + holesFirst = isCCW ? !holesFirst : holesFirst; + + // console.log("Holes first", holesFirst); const betterShapeHoles = []; const newShapes = []; @@ -35529,13 +31781,11 @@ class ShapePath { let tmpPoints; newShapes[mainIdx] = undefined; newShapeHoles[mainIdx] = []; - for (let i = 0, l = subPaths.length; i < l; i++) { tmpPath = subPaths[i]; tmpPoints = tmpPath.getPoints(); solid = isClockWise(tmpPoints); solid = isCCW ? !solid : solid; - if (solid) { if (!holesFirst && newShapes[mainIdx]) mainIdx++; newShapes[mainIdx] = { @@ -35544,33 +31794,32 @@ class ShapePath { }; newShapes[mainIdx].s.curves = tmpPath.curves; if (holesFirst) mainIdx++; - newShapeHoles[mainIdx] = []; //console.log('cw', i); + newShapeHoles[mainIdx] = []; + + //console.log('cw', i); } else { newShapeHoles[mainIdx].push({ h: tmpPath, p: tmpPoints[0] - }); //console.log('ccw', i); - } - } // only Holes? -> probably all Shapes with wrong orientation + }); + //console.log('ccw', i); + } + } + // only Holes? -> probably all Shapes with wrong orientation if (!newShapes[0]) return toShapesNoHoles(subPaths); - if (newShapes.length > 1) { let ambiguous = false; const toChange = []; - for (let sIdx = 0, sLen = newShapes.length; sIdx < sLen; sIdx++) { betterShapeHoles[sIdx] = []; } - for (let sIdx = 0, sLen = newShapes.length; sIdx < sLen; sIdx++) { const sho = newShapeHoles[sIdx]; - for (let hIdx = 0; hIdx < sho.length; hIdx++) { const ho = sho[hIdx]; let hole_unassigned = true; - for (let s2Idx = 0; s2Idx < newShapes.length; s2Idx++) { if (isPointInsidePolygon(ho.p, newShapes[s2Idx].p)) { if (sIdx !== s2Idx) toChange.push({ @@ -35578,7 +31827,6 @@ class ShapePath { tos: s2Idx, hole: hIdx }); - if (hole_unassigned) { hole_unassigned = false; betterShapeHoles[s2Idx].push(ho); @@ -35587,100 +31835,84 @@ class ShapePath { } } } - if (hole_unassigned) { betterShapeHoles[sIdx].push(ho); } } - } // console.log("ambiguous: ", ambiguous); - + } + // console.log("ambiguous: ", ambiguous); if (toChange.length > 0) { // console.log("to change: ", toChange); if (!ambiguous) newShapeHoles = betterShapeHoles; } } - let tmpHoles; - for (let i = 0, il = newShapes.length; i < il; i++) { tmpShape = newShapes[i].s; shapes.push(tmpShape); tmpHoles = newShapeHoles[i]; - for (let j = 0, jl = tmpHoles.length; j < jl; j++) { tmpShape.holes.push(tmpHoles[j].h); } - } //console.log("shape", shapes); + } + //console.log("shape", shapes); return shapes; } - } const _floatView = new Float32Array(1); - const _int32View = new Int32Array(_floatView.buffer); - class DataUtils { // Converts float32 to float16 (stored as uint16 value). + static toHalfFloat(val) { if (val > 65504) { console.warn('THREE.DataUtils.toHalfFloat(): value exceeds 65504.'); val = 65504; // maximum representable value in float16 - } // Source: http://gamedev.stackexchange.com/questions/17326/conversion-of-a-number-from-single-precision-floating-point-representation-to-a/17410#17410 + } + + // Source: http://gamedev.stackexchange.com/questions/17326/conversion-of-a-number-from-single-precision-floating-point-representation-to-a/17410#17410 /* This method is faster than the OpenEXR implementation (very often * used, eg. in Ogre), with the additional benefit of rounding, inspired * by James Tursa?s half-precision code. */ - _floatView[0] = val; const x = _int32View[0]; - let bits = x >> 16 & 0x8000; - /* Get the sign */ - - let m = x >> 12 & 0x07ff; - /* Keep one extra bit for rounding */ - - const e = x >> 23 & 0xff; - /* Using int is faster here */ + let bits = x >> 16 & 0x8000; /* Get the sign */ + let m = x >> 12 & 0x07ff; /* Keep one extra bit for rounding */ + const e = x >> 23 & 0xff; /* Using int is faster here */ /* If zero, or denormal, or exponent underflows too much for a denormal * half, return signed zero. */ - if (e < 103) return bits; - /* If NaN, return NaN. If Inf or exponent overflow, return Inf. */ + /* If NaN, return NaN. If Inf or exponent overflow, return Inf. */ if (e > 142) { bits |= 0x7c00; /* If exponent was 0xff and one mantissa bit was set, it means NaN, * not Inf, so make sure we set one mantissa bit too. */ - bits |= (e == 255 ? 0 : 1) && x & 0x007fffff; return bits; } - /* If exponent underflows but not too much, return a denormal */ - + /* If exponent underflows but not too much, return a denormal */ if (e < 113) { m |= 0x0800; /* Extra rounding may overflow and set mantissa to 0 and exponent * to 1, which is OK. */ - bits |= (m >> 114 - e) + (m >> 113 - e & 1); return bits; } - bits |= e - 112 << 10 | m >> 1; /* Extra rounding. An overflow will set mantissa to 0 and increment * the exponent, which is OK. */ - bits += m & 1; return bits; } - } const LineStrip = 0; @@ -35696,11 +31928,9 @@ function MultiMaterial(materials = []) { console.warn('THREE.MultiMaterial has been removed. Use an Array instead.'); materials.isMultiMaterial = true; materials.materials = materials; - materials.clone = function () { return materials.slice(); }; - return materials; } function PointCloud(geometry, material) { @@ -35730,7 +31960,9 @@ function ParticleSystemMaterial(parameters) { function Vertex(x, y, z) { console.warn('THREE.Vertex has been removed. Use THREE.Vector3 instead.'); return new Vector3(x, y, z); -} // +} + +// function DynamicBufferAttribute(array, itemSize) { console.warn('THREE.DynamicBufferAttribute has been removed. Use new THREE.BufferAttribute().setUsage( THREE.DynamicDrawUsage ) instead.'); @@ -35771,7 +32003,9 @@ function Float32Attribute(array, itemSize) { function Float64Attribute(array, itemSize) { console.warn('THREE.Float64Attribute has been removed. Use new THREE.Float64BufferAttribute() instead.'); return new Float64BufferAttribute(array, itemSize); -} // +} + +// Curve.create = function (construct, getPoint) { console.log('THREE.Curve.create() has been deprecated'); @@ -35779,14 +32013,16 @@ Curve.create = function (construct, getPoint) { construct.prototype.constructor = construct; construct.prototype.getPoint = getPoint; return construct; -}; // +}; +// Path.prototype.fromPoints = function (points) { console.warn('THREE.Path: .fromPoints() has been renamed to .setFromPoints().'); return this.setFromPoints(points); -}; // +}; +// function AxisHelper(size) { console.warn('THREE.AxisHelper has been renamed to THREE.AxesHelper.'); @@ -35802,35 +32038,31 @@ function EdgesHelper(object, hex) { color: hex !== undefined ? hex : 0xffffff })); } - GridHelper.prototype.setColors = function () { console.error('THREE.GridHelper: setColors() has been deprecated, pass them in the constructor instead.'); }; - SkeletonHelper.prototype.update = function () { console.error('THREE.SkeletonHelper: update() no longer needs to be called.'); }; - function WireframeHelper(object, hex) { console.warn('THREE.WireframeHelper has been removed. Use THREE.WireframeGeometry instead.'); return new LineSegments(new WireframeGeometry(object.geometry), new LineBasicMaterial({ color: hex !== undefined ? hex : 0xffffff })); -} // +} + +// Loader.prototype.extractUrlBase = function (url) { console.warn('THREE.Loader: .extractUrlBase() has been deprecated. Use THREE.LoaderUtils.extractUrlBase() instead.'); return LoaderUtils.extractUrlBase(url); }; - Loader.Handlers = { - add: function - /* regex, loader */ + add: function /* regex, loader */ () { console.error('THREE.Loader: Handlers.add() has been removed. Use LoadingManager.addHandler() instead.'); }, - get: function - /* file */ + get: function /* file */ () { console.error('THREE.Loader: Handlers.get() has been removed. Use LoadingManager.getHandler() instead.'); } @@ -35842,377 +32074,333 @@ function XHRLoader(manager) { function BinaryTextureLoader(manager) { console.warn('THREE.BinaryTextureLoader has been renamed to THREE.DataTextureLoader.'); return new DataTextureLoader(manager); -} // +} + +// Box2.prototype.center = function (optionalTarget) { console.warn('THREE.Box2: .center() has been renamed to .getCenter().'); return this.getCenter(optionalTarget); }; - Box2.prototype.empty = function () { console.warn('THREE.Box2: .empty() has been renamed to .isEmpty().'); return this.isEmpty(); }; - Box2.prototype.isIntersectionBox = function (box) { console.warn('THREE.Box2: .isIntersectionBox() has been renamed to .intersectsBox().'); return this.intersectsBox(box); }; - Box2.prototype.size = function (optionalTarget) { console.warn('THREE.Box2: .size() has been renamed to .getSize().'); return this.getSize(optionalTarget); -}; // +}; +// Box3.prototype.center = function (optionalTarget) { console.warn('THREE.Box3: .center() has been renamed to .getCenter().'); return this.getCenter(optionalTarget); }; - Box3.prototype.empty = function () { console.warn('THREE.Box3: .empty() has been renamed to .isEmpty().'); return this.isEmpty(); }; - Box3.prototype.isIntersectionBox = function (box) { console.warn('THREE.Box3: .isIntersectionBox() has been renamed to .intersectsBox().'); return this.intersectsBox(box); }; - Box3.prototype.isIntersectionSphere = function (sphere) { console.warn('THREE.Box3: .isIntersectionSphere() has been renamed to .intersectsSphere().'); return this.intersectsSphere(sphere); }; - Box3.prototype.size = function (optionalTarget) { console.warn('THREE.Box3: .size() has been renamed to .getSize().'); return this.getSize(optionalTarget); -}; // +}; +// Sphere.prototype.empty = function () { console.warn('THREE.Sphere: .empty() has been renamed to .isEmpty().'); return this.isEmpty(); -}; // +}; +// Frustum.prototype.setFromMatrix = function (m) { console.warn('THREE.Frustum: .setFromMatrix() has been renamed to .setFromProjectionMatrix().'); return this.setFromProjectionMatrix(m); -}; // +}; +// Line3.prototype.center = function (optionalTarget) { console.warn('THREE.Line3: .center() has been renamed to .getCenter().'); return this.getCenter(optionalTarget); -}; // +}; +// Matrix3.prototype.flattenToArrayOffset = function (array, offset) { console.warn('THREE.Matrix3: .flattenToArrayOffset() has been deprecated. Use .toArray() instead.'); return this.toArray(array, offset); }; - Matrix3.prototype.multiplyVector3 = function (vector) { console.warn('THREE.Matrix3: .multiplyVector3() has been removed. Use vector.applyMatrix3( matrix ) instead.'); return vector.applyMatrix3(this); }; - -Matrix3.prototype.multiplyVector3Array = function - /* a */ +Matrix3.prototype.multiplyVector3Array = function /* a */ () { console.error('THREE.Matrix3: .multiplyVector3Array() has been removed.'); }; - Matrix3.prototype.applyToBufferAttribute = function (attribute) { console.warn('THREE.Matrix3: .applyToBufferAttribute() has been removed. Use attribute.applyMatrix3( matrix ) instead.'); return attribute.applyMatrix3(this); }; - -Matrix3.prototype.applyToVector3Array = function - /* array, offset, length */ +Matrix3.prototype.applyToVector3Array = function /* array, offset, length */ () { console.error('THREE.Matrix3: .applyToVector3Array() has been removed.'); }; - Matrix3.prototype.getInverse = function (matrix) { console.warn('THREE.Matrix3: .getInverse() has been removed. Use matrixInv.copy( matrix ).invert(); instead.'); return this.copy(matrix).invert(); -}; // +}; +// Matrix4.prototype.extractPosition = function (m) { console.warn('THREE.Matrix4: .extractPosition() has been renamed to .copyPosition().'); return this.copyPosition(m); }; - Matrix4.prototype.flattenToArrayOffset = function (array, offset) { console.warn('THREE.Matrix4: .flattenToArrayOffset() has been deprecated. Use .toArray() instead.'); return this.toArray(array, offset); }; - Matrix4.prototype.getPosition = function () { console.warn('THREE.Matrix4: .getPosition() has been removed. Use Vector3.setFromMatrixPosition( matrix ) instead.'); return new Vector3().setFromMatrixColumn(this, 3); }; - Matrix4.prototype.setRotationFromQuaternion = function (q) { console.warn('THREE.Matrix4: .setRotationFromQuaternion() has been renamed to .makeRotationFromQuaternion().'); return this.makeRotationFromQuaternion(q); }; - Matrix4.prototype.multiplyToArray = function () { console.warn('THREE.Matrix4: .multiplyToArray() has been removed.'); }; - Matrix4.prototype.multiplyVector3 = function (vector) { console.warn('THREE.Matrix4: .multiplyVector3() has been removed. Use vector.applyMatrix4( matrix ) instead.'); return vector.applyMatrix4(this); }; - Matrix4.prototype.multiplyVector4 = function (vector) { console.warn('THREE.Matrix4: .multiplyVector4() has been removed. Use vector.applyMatrix4( matrix ) instead.'); return vector.applyMatrix4(this); }; - -Matrix4.prototype.multiplyVector3Array = function - /* a */ +Matrix4.prototype.multiplyVector3Array = function /* a */ () { console.error('THREE.Matrix4: .multiplyVector3Array() has been removed.'); }; - Matrix4.prototype.rotateAxis = function (v) { console.warn('THREE.Matrix4: .rotateAxis() has been removed. Use Vector3.transformDirection( matrix ) instead.'); v.transformDirection(this); }; - Matrix4.prototype.crossVector = function (vector) { console.warn('THREE.Matrix4: .crossVector() has been removed. Use vector.applyMatrix4( matrix ) instead.'); return vector.applyMatrix4(this); }; - Matrix4.prototype.translate = function () { console.error('THREE.Matrix4: .translate() has been removed.'); }; - Matrix4.prototype.rotateX = function () { console.error('THREE.Matrix4: .rotateX() has been removed.'); }; - Matrix4.prototype.rotateY = function () { console.error('THREE.Matrix4: .rotateY() has been removed.'); }; - Matrix4.prototype.rotateZ = function () { console.error('THREE.Matrix4: .rotateZ() has been removed.'); }; - Matrix4.prototype.rotateByAxis = function () { console.error('THREE.Matrix4: .rotateByAxis() has been removed.'); }; - Matrix4.prototype.applyToBufferAttribute = function (attribute) { console.warn('THREE.Matrix4: .applyToBufferAttribute() has been removed. Use attribute.applyMatrix4( matrix ) instead.'); return attribute.applyMatrix4(this); }; - -Matrix4.prototype.applyToVector3Array = function - /* array, offset, length */ +Matrix4.prototype.applyToVector3Array = function /* array, offset, length */ () { console.error('THREE.Matrix4: .applyToVector3Array() has been removed.'); }; - Matrix4.prototype.makeFrustum = function (left, right, bottom, top, near, far) { console.warn('THREE.Matrix4: .makeFrustum() has been removed. Use .makePerspective( left, right, top, bottom, near, far ) instead.'); return this.makePerspective(left, right, top, bottom, near, far); }; - Matrix4.prototype.getInverse = function (matrix) { console.warn('THREE.Matrix4: .getInverse() has been removed. Use matrixInv.copy( matrix ).invert(); instead.'); return this.copy(matrix).invert(); -}; // +}; +// Plane.prototype.isIntersectionLine = function (line) { console.warn('THREE.Plane: .isIntersectionLine() has been renamed to .intersectsLine().'); return this.intersectsLine(line); -}; // +}; +// Quaternion.prototype.multiplyVector3 = function (vector) { console.warn('THREE.Quaternion: .multiplyVector3() has been removed. Use is now vector.applyQuaternion( quaternion ) instead.'); return vector.applyQuaternion(this); }; - Quaternion.prototype.inverse = function () { console.warn('THREE.Quaternion: .inverse() has been renamed to invert().'); return this.invert(); -}; // +}; +// Ray.prototype.isIntersectionBox = function (box) { console.warn('THREE.Ray: .isIntersectionBox() has been renamed to .intersectsBox().'); return this.intersectsBox(box); }; - Ray.prototype.isIntersectionPlane = function (plane) { console.warn('THREE.Ray: .isIntersectionPlane() has been renamed to .intersectsPlane().'); return this.intersectsPlane(plane); }; - Ray.prototype.isIntersectionSphere = function (sphere) { console.warn('THREE.Ray: .isIntersectionSphere() has been renamed to .intersectsSphere().'); return this.intersectsSphere(sphere); -}; // +}; +// Triangle.prototype.area = function () { console.warn('THREE.Triangle: .area() has been renamed to .getArea().'); return this.getArea(); }; - Triangle.prototype.barycoordFromPoint = function (point, target) { console.warn('THREE.Triangle: .barycoordFromPoint() has been renamed to .getBarycoord().'); return this.getBarycoord(point, target); }; - Triangle.prototype.midpoint = function (target) { console.warn('THREE.Triangle: .midpoint() has been renamed to .getMidpoint().'); return this.getMidpoint(target); }; - Triangle.prototypenormal = function (target) { console.warn('THREE.Triangle: .normal() has been renamed to .getNormal().'); return this.getNormal(target); }; - Triangle.prototype.plane = function (target) { console.warn('THREE.Triangle: .plane() has been renamed to .getPlane().'); return this.getPlane(target); }; - Triangle.barycoordFromPoint = function (point, a, b, c, target) { console.warn('THREE.Triangle: .barycoordFromPoint() has been renamed to .getBarycoord().'); return Triangle.getBarycoord(point, a, b, c, target); }; - Triangle.normal = function (a, b, c, target) { console.warn('THREE.Triangle: .normal() has been renamed to .getNormal().'); return Triangle.getNormal(a, b, c, target); -}; // +}; +// Shape.prototype.extractAllPoints = function (divisions) { console.warn('THREE.Shape: .extractAllPoints() has been removed. Use .extractPoints() instead.'); return this.extractPoints(divisions); }; - Shape.prototype.extrude = function (options) { console.warn('THREE.Shape: .extrude() has been removed. Use ExtrudeGeometry() instead.'); return new ExtrudeGeometry(this, options); }; - Shape.prototype.makeGeometry = function (options) { console.warn('THREE.Shape: .makeGeometry() has been removed. Use ShapeGeometry() instead.'); return new ShapeGeometry(this, options); -}; // +}; +// Vector2.prototype.fromAttribute = function (attribute, index, offset) { console.warn('THREE.Vector2: .fromAttribute() has been renamed to .fromBufferAttribute().'); return this.fromBufferAttribute(attribute, index, offset); }; - Vector2.prototype.distanceToManhattan = function (v) { console.warn('THREE.Vector2: .distanceToManhattan() has been renamed to .manhattanDistanceTo().'); return this.manhattanDistanceTo(v); }; - Vector2.prototype.lengthManhattan = function () { console.warn('THREE.Vector2: .lengthManhattan() has been renamed to .manhattanLength().'); return this.manhattanLength(); -}; // +}; +// Vector3.prototype.setEulerFromRotationMatrix = function () { console.error('THREE.Vector3: .setEulerFromRotationMatrix() has been removed. Use Euler.setFromRotationMatrix() instead.'); }; - Vector3.prototype.setEulerFromQuaternion = function () { console.error('THREE.Vector3: .setEulerFromQuaternion() has been removed. Use Euler.setFromQuaternion() instead.'); }; - Vector3.prototype.getPositionFromMatrix = function (m) { console.warn('THREE.Vector3: .getPositionFromMatrix() has been renamed to .setFromMatrixPosition().'); return this.setFromMatrixPosition(m); }; - Vector3.prototype.getScaleFromMatrix = function (m) { console.warn('THREE.Vector3: .getScaleFromMatrix() has been renamed to .setFromMatrixScale().'); return this.setFromMatrixScale(m); }; - Vector3.prototype.getColumnFromMatrix = function (index, matrix) { console.warn('THREE.Vector3: .getColumnFromMatrix() has been renamed to .setFromMatrixColumn().'); return this.setFromMatrixColumn(matrix, index); }; - Vector3.prototype.applyProjection = function (m) { console.warn('THREE.Vector3: .applyProjection() has been removed. Use .applyMatrix4( m ) instead.'); return this.applyMatrix4(m); }; - Vector3.prototype.fromAttribute = function (attribute, index, offset) { console.warn('THREE.Vector3: .fromAttribute() has been renamed to .fromBufferAttribute().'); return this.fromBufferAttribute(attribute, index, offset); }; - Vector3.prototype.distanceToManhattan = function (v) { console.warn('THREE.Vector3: .distanceToManhattan() has been renamed to .manhattanDistanceTo().'); return this.manhattanDistanceTo(v); }; - Vector3.prototype.lengthManhattan = function () { console.warn('THREE.Vector3: .lengthManhattan() has been renamed to .manhattanLength().'); return this.manhattanLength(); -}; // +}; +// Vector4.prototype.fromAttribute = function (attribute, index, offset) { console.warn('THREE.Vector4: .fromAttribute() has been renamed to .fromBufferAttribute().'); return this.fromBufferAttribute(attribute, index, offset); }; - Vector4.prototype.lengthManhattan = function () { console.warn('THREE.Vector4: .lengthManhattan() has been renamed to .manhattanLength().'); return this.manhattanLength(); -}; // +}; +// Object3D.prototype.getChildByName = function (name) { console.warn('THREE.Object3D: .getChildByName() has been renamed to .getObjectByName().'); return this.getObjectByName(name); }; - Object3D.prototype.renderDepth = function () { console.warn('THREE.Object3D: .renderDepth has been removed. Use .renderOrder, instead.'); }; - Object3D.prototype.translate = function (distance, axis) { console.warn('THREE.Object3D: .translate() has been removed. Use .translateOnAxis( axis, distance ) instead.'); return this.translateOnAxis(axis, distance); }; - Object3D.prototype.getWorldRotation = function () { console.error('THREE.Object3D: .getWorldRotation() has been removed. Use THREE.Object3D.getWorldQuaternion( target ) instead.'); }; - Object3D.prototype.applyMatrix = function (matrix) { console.warn('THREE.Object3D: .applyMatrix() has been renamed to .applyMatrix4().'); return this.applyMatrix4(matrix); }; - Object.defineProperties(Object3D.prototype, { eulerOrder: { get: function () { @@ -36233,11 +32421,9 @@ Object.defineProperties(Object3D.prototype, { } } }); - Mesh.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(Mesh.prototype, { drawMode: { get: function () { @@ -36249,18 +32435,19 @@ Object.defineProperties(Mesh.prototype, { } } }); - SkinnedMesh.prototype.initBones = function () { console.error('THREE.SkinnedMesh: initBones() has been removed.'); -}; // +}; +// PerspectiveCamera.prototype.setLens = function (focalLength, filmGauge) { console.warn('THREE.PerspectiveCamera.setLens is deprecated. ' + 'Use .setFocalLength and .filmGauge for a photographic setup.'); if (filmGauge !== undefined) this.filmGauge = filmGauge; this.setFocalLength(focalLength); -}; // +}; +// Object.defineProperties(Light.prototype, { onlyShadow: { @@ -36338,7 +32525,9 @@ Object.defineProperties(Light.prototype, { this.shadow.mapSize.height = value; } } -}); // +}); + +// Object.defineProperties(BufferAttribute.prototype, { length: { @@ -36352,81 +32541,67 @@ Object.defineProperties(BufferAttribute.prototype, { console.warn('THREE.BufferAttribute: .dynamic has been deprecated. Use .usage instead.'); return this.usage === DynamicDrawUsage; }, - set: function - /* value */ + set: function /* value */ () { console.warn('THREE.BufferAttribute: .dynamic has been deprecated. Use .usage instead.'); this.setUsage(DynamicDrawUsage); } } }); - BufferAttribute.prototype.setDynamic = function (value) { console.warn('THREE.BufferAttribute: .setDynamic() has been deprecated. Use .setUsage() instead.'); this.setUsage(value === true ? DynamicDrawUsage : StaticDrawUsage); return this; }; - -BufferAttribute.prototype.copyIndicesArray = function - /* indices */ +BufferAttribute.prototype.copyIndicesArray = function /* indices */ () { console.error('THREE.BufferAttribute: .copyIndicesArray() has been removed.'); -}, BufferAttribute.prototype.setArray = function - /* array */ +}, BufferAttribute.prototype.setArray = function /* array */ () { console.error('THREE.BufferAttribute: .setArray has been removed. Use BufferGeometry .setAttribute to replace/resize attribute buffers'); -}; // +}; + +// BufferGeometry.prototype.addIndex = function (index) { console.warn('THREE.BufferGeometry: .addIndex() has been renamed to .setIndex().'); this.setIndex(index); }; - BufferGeometry.prototype.addAttribute = function (name, attribute) { console.warn('THREE.BufferGeometry: .addAttribute() has been renamed to .setAttribute().'); - if (!(attribute && attribute.isBufferAttribute) && !(attribute && attribute.isInterleavedBufferAttribute)) { console.warn('THREE.BufferGeometry: .addAttribute() now expects ( name, attribute ).'); return this.setAttribute(name, new BufferAttribute(arguments[1], arguments[2])); } - if (name === 'index') { console.warn('THREE.BufferGeometry.addAttribute: Use .setIndex() for index attribute.'); this.setIndex(attribute); return this; } - return this.setAttribute(name, attribute); }; - BufferGeometry.prototype.addDrawCall = function (start, count, indexOffset) { if (indexOffset !== undefined) { console.warn('THREE.BufferGeometry: .addDrawCall() no longer supports indexOffset.'); } - console.warn('THREE.BufferGeometry: .addDrawCall() is now .addGroup().'); this.addGroup(start, count); }; - BufferGeometry.prototype.clearDrawCalls = function () { console.warn('THREE.BufferGeometry: .clearDrawCalls() is now .clearGroups().'); this.clearGroups(); }; - BufferGeometry.prototype.computeOffsets = function () { console.warn('THREE.BufferGeometry: .computeOffsets() has been removed.'); }; - BufferGeometry.prototype.removeAttribute = function (name) { console.warn('THREE.BufferGeometry: .removeAttribute() has been renamed to .deleteAttribute().'); return this.deleteAttribute(name); }; - BufferGeometry.prototype.applyMatrix = function (matrix) { console.warn('THREE.BufferGeometry: .applyMatrix() has been renamed to .applyMatrix4().'); return this.applyMatrix4(matrix); }; - Object.defineProperties(BufferGeometry.prototype, { drawcalls: { get: function () { @@ -36441,43 +32616,42 @@ Object.defineProperties(BufferGeometry.prototype, { } } }); - InterleavedBuffer.prototype.setDynamic = function (value) { console.warn('THREE.InterleavedBuffer: .setDynamic() has been deprecated. Use .setUsage() instead.'); this.setUsage(value === true ? DynamicDrawUsage : StaticDrawUsage); return this; }; - -InterleavedBuffer.prototype.setArray = function - /* array */ +InterleavedBuffer.prototype.setArray = function /* array */ () { console.error('THREE.InterleavedBuffer: .setArray has been removed. Use BufferGeometry .setAttribute to replace/resize attribute buffers'); -}; // +}; +// ExtrudeGeometry.prototype.getArrays = function () { console.error('THREE.ExtrudeGeometry: .getArrays() has been removed.'); }; - ExtrudeGeometry.prototype.addShapeList = function () { console.error('THREE.ExtrudeGeometry: .addShapeList() has been removed.'); }; - ExtrudeGeometry.prototype.addShape = function () { console.error('THREE.ExtrudeGeometry: .addShape() has been removed.'); -}; // +}; +// Scene.prototype.dispose = function () { console.error('THREE.Scene: .dispose() has been removed.'); -}; // +}; +// Uniform.prototype.onUpdate = function () { console.warn('THREE.Uniform: .onUpdate() has been removed. Use object.onBeforeRender() instead.'); return this; -}; // +}; +// Object.defineProperties(Material.prototype, { wrapAround: { @@ -36541,125 +32715,102 @@ Object.defineProperties(ShaderMaterial.prototype, { this.extensions.derivatives = value; } } -}); // +}); + +// WebGLRenderer.prototype.clearTarget = function (renderTarget, color, depth, stencil) { console.warn('THREE.WebGLRenderer: .clearTarget() has been deprecated. Use .setRenderTarget() and .clear() instead.'); this.setRenderTarget(renderTarget); this.clear(color, depth, stencil); }; - WebGLRenderer.prototype.animate = function (callback) { console.warn('THREE.WebGLRenderer: .animate() is now .setAnimationLoop().'); this.setAnimationLoop(callback); }; - WebGLRenderer.prototype.getCurrentRenderTarget = function () { console.warn('THREE.WebGLRenderer: .getCurrentRenderTarget() is now .getRenderTarget().'); return this.getRenderTarget(); }; - WebGLRenderer.prototype.getMaxAnisotropy = function () { console.warn('THREE.WebGLRenderer: .getMaxAnisotropy() is now .capabilities.getMaxAnisotropy().'); return this.capabilities.getMaxAnisotropy(); }; - WebGLRenderer.prototype.getPrecision = function () { console.warn('THREE.WebGLRenderer: .getPrecision() is now .capabilities.precision.'); return this.capabilities.precision; }; - WebGLRenderer.prototype.resetGLState = function () { console.warn('THREE.WebGLRenderer: .resetGLState() is now .state.reset().'); return this.state.reset(); }; - WebGLRenderer.prototype.supportsFloatTextures = function () { console.warn('THREE.WebGLRenderer: .supportsFloatTextures() is now .extensions.get( \'OES_texture_float\' ).'); return this.extensions.get('OES_texture_float'); }; - WebGLRenderer.prototype.supportsHalfFloatTextures = function () { console.warn('THREE.WebGLRenderer: .supportsHalfFloatTextures() is now .extensions.get( \'OES_texture_half_float\' ).'); return this.extensions.get('OES_texture_half_float'); }; - WebGLRenderer.prototype.supportsStandardDerivatives = function () { console.warn('THREE.WebGLRenderer: .supportsStandardDerivatives() is now .extensions.get( \'OES_standard_derivatives\' ).'); return this.extensions.get('OES_standard_derivatives'); }; - WebGLRenderer.prototype.supportsCompressedTextureS3TC = function () { console.warn('THREE.WebGLRenderer: .supportsCompressedTextureS3TC() is now .extensions.get( \'WEBGL_compressed_texture_s3tc\' ).'); return this.extensions.get('WEBGL_compressed_texture_s3tc'); }; - WebGLRenderer.prototype.supportsCompressedTexturePVRTC = function () { console.warn('THREE.WebGLRenderer: .supportsCompressedTexturePVRTC() is now .extensions.get( \'WEBGL_compressed_texture_pvrtc\' ).'); return this.extensions.get('WEBGL_compressed_texture_pvrtc'); }; - WebGLRenderer.prototype.supportsBlendMinMax = function () { console.warn('THREE.WebGLRenderer: .supportsBlendMinMax() is now .extensions.get( \'EXT_blend_minmax\' ).'); return this.extensions.get('EXT_blend_minmax'); }; - WebGLRenderer.prototype.supportsVertexTextures = function () { console.warn('THREE.WebGLRenderer: .supportsVertexTextures() is now .capabilities.vertexTextures.'); return this.capabilities.vertexTextures; }; - WebGLRenderer.prototype.supportsInstancedArrays = function () { console.warn('THREE.WebGLRenderer: .supportsInstancedArrays() is now .extensions.get( \'ANGLE_instanced_arrays\' ).'); return this.extensions.get('ANGLE_instanced_arrays'); }; - WebGLRenderer.prototype.enableScissorTest = function (boolean) { console.warn('THREE.WebGLRenderer: .enableScissorTest() is now .setScissorTest().'); this.setScissorTest(boolean); }; - WebGLRenderer.prototype.initMaterial = function () { console.warn('THREE.WebGLRenderer: .initMaterial() has been removed.'); }; - WebGLRenderer.prototype.addPrePlugin = function () { console.warn('THREE.WebGLRenderer: .addPrePlugin() has been removed.'); }; - WebGLRenderer.prototype.addPostPlugin = function () { console.warn('THREE.WebGLRenderer: .addPostPlugin() has been removed.'); }; - WebGLRenderer.prototype.updateShadowMap = function () { console.warn('THREE.WebGLRenderer: .updateShadowMap() has been removed.'); }; - WebGLRenderer.prototype.setFaceCulling = function () { console.warn('THREE.WebGLRenderer: .setFaceCulling() has been removed.'); }; - WebGLRenderer.prototype.allocTextureUnit = function () { console.warn('THREE.WebGLRenderer: .allocTextureUnit() has been removed.'); }; - WebGLRenderer.prototype.setTexture = function () { console.warn('THREE.WebGLRenderer: .setTexture() has been removed.'); }; - WebGLRenderer.prototype.setTexture2D = function () { console.warn('THREE.WebGLRenderer: .setTexture2D() has been removed.'); }; - WebGLRenderer.prototype.setTextureCube = function () { console.warn('THREE.WebGLRenderer: .setTextureCube() has been removed.'); }; - WebGLRenderer.prototype.getActiveMipMapLevel = function () { console.warn('THREE.WebGLRenderer: .getActiveMipMapLevel() is now .getActiveMipmapLevel().'); return this.getActiveMipmapLevel(); }; - Object.defineProperties(WebGLRenderer.prototype, { shadowMapEnabled: { get: function () { @@ -36684,8 +32835,7 @@ Object.defineProperties(WebGLRenderer.prototype, { console.warn('THREE.WebGLRenderer: .shadowMapCullFace has been removed. Set Material.shadowSide instead.'); return undefined; }, - set: function - /* value */ + set: function /* value */ () { console.warn('THREE.WebGLRenderer: .shadowMapCullFace has been removed. Set Material.shadowSide instead.'); } @@ -36746,8 +32896,7 @@ Object.defineProperties(WebGLShadowMap.prototype, { console.warn('THREE.WebGLRenderer: .shadowMap.cullFace has been removed. Set Material.shadowSide instead.'); return undefined; }, - set: function - /* cullFace */ + set: function /* cullFace */ () { console.warn('THREE.WebGLRenderer: .shadowMap.cullFace has been removed. Set Material.shadowSide instead.'); } @@ -36774,7 +32923,9 @@ Object.defineProperties(WebGLShadowMap.prototype, { function WebGLRenderTargetCube(width, height, options) { console.warn('THREE.WebGLRenderTargetCube( width, height, options ) is now WebGLCubeRenderTarget( size, options ).'); return new WebGLCubeRenderTarget(width, options); -} // +} + +// Object.defineProperties(WebGLRenderTarget.prototype, { wrapS: { @@ -36877,7 +33028,9 @@ Object.defineProperties(WebGLRenderTarget.prototype, { this.texture.generateMipmaps = value; } } -}); // +}); + +// Audio.prototype.load = function (file) { console.warn('THREE.Audio: .load has been deprecated. Use THREE.AudioLoader instead.'); @@ -36888,25 +33041,22 @@ Audio.prototype.load = function (file) { }); return this; }; - AudioAnalyser.prototype.getData = function () { console.warn('THREE.AudioAnalyser: .getData() is now .getFrequencyData().'); return this.getFrequencyData(); -}; // +}; +// CubeCamera.prototype.updateCubeMap = function (renderer, scene) { console.warn('THREE.CubeCamera: .updateCubeMap() is now .update().'); return this.update(renderer, scene); }; - CubeCamera.prototype.clear = function (renderer, color, depth, stencil) { console.warn('THREE.CubeCamera: .clear() is now .renderTarget.clear().'); return this.renderTarget.clear(renderer, color, depth, stencil); }; - ImageUtils.crossOrigin = undefined; - ImageUtils.loadTexture = function (url, mapping, onLoad, onError) { console.warn('THREE.ImageUtils.loadTexture has been deprecated. Use THREE.TextureLoader() instead.'); const loader = new TextureLoader(); @@ -36915,7 +33065,6 @@ ImageUtils.loadTexture = function (url, mapping, onLoad, onError) { if (mapping) texture.mapping = mapping; return texture; }; - ImageUtils.loadTextureCube = function (urls, mapping, onLoad, onError) { console.warn('THREE.ImageUtils.loadTextureCube has been deprecated. Use THREE.CubeTextureLoader() instead.'); const loader = new CubeTextureLoader(); @@ -36924,45 +33073,49 @@ ImageUtils.loadTextureCube = function (urls, mapping, onLoad, onError) { if (mapping) texture.mapping = mapping; return texture; }; - ImageUtils.loadCompressedTexture = function () { console.error('THREE.ImageUtils.loadCompressedTexture has been removed. Use THREE.DDSLoader instead.'); }; - ImageUtils.loadCompressedTextureCube = function () { console.error('THREE.ImageUtils.loadCompressedTextureCube has been removed. Use THREE.DDSLoader instead.'); -}; // +}; +// function CanvasRenderer() { console.error('THREE.CanvasRenderer has been removed'); -} // +} + +// function JSONLoader() { console.error('THREE.JSONLoader has been removed.'); -} // +} + +// const SceneUtils = { - createMultiMaterialObject: function - /* geometry, materials */ + createMultiMaterialObject: function /* geometry, materials */ () { console.error('THREE.SceneUtils has been moved to /examples/jsm/utils/SceneUtils.js'); }, - detach: function - /* child, parent, scene */ + detach: function /* child, parent, scene */ () { console.error('THREE.SceneUtils has been moved to /examples/jsm/utils/SceneUtils.js'); }, - attach: function - /* child, scene, parent */ + attach: function /* child, scene, parent */ () { console.error('THREE.SceneUtils has been moved to /examples/jsm/utils/SceneUtils.js'); } -}; // +}; + +// function LensFlare() { console.error('THREE.LensFlare has been moved to /examples/jsm/objects/Lensflare.js'); -} // +} + +// function ParametricGeometry() { console.error('THREE.ParametricGeometry has been moved to /examples/jsm/geometries/ParametricGeometry.js'); @@ -36995,7 +33148,6 @@ if (typeof __THREE_DEVTOOLS__ !== 'undefined') { } })); } - if (typeof window !== 'undefined') { if (window.__THREE__) { console.warn('WARNING: Multiple instances of Three.js being imported.'); diff --git a/build/three.js b/build/three.js index e02288135b94f1..a96460d1bec183 100644 --- a/build/three.js +++ b/build/three.js @@ -208,13 +208,10 @@ }; this.devicePixelRatio = params.devicePixelRatio; }, - setProperties(properties) { this.properties = Object.assign(this.properties || {}, properties); } - }; - if (typeof window !== 'undefined' && typeof window.window !== 'undefined') { // When running three.js in a virtual dom environment like jsdom, the window object // may not contains all the members that are required by the platform, so we should @@ -239,182 +236,169 @@ /** * https://github.com/mrdoob/eventdispatcher.js/ */ + class EventDispatcher { addEventListener(type, listener) { if (this._listeners === undefined) this._listeners = {}; const listeners = this._listeners; - if (listeners[type] === undefined) { listeners[type] = []; } - if (listeners[type].indexOf(listener) === -1) { listeners[type].push(listener); } } - hasEventListener(type, listener) { if (this._listeners === undefined) return false; const listeners = this._listeners; return listeners[type] !== undefined && listeners[type].indexOf(listener) !== -1; } - removeEventListener(type, listener) { if (this._listeners === undefined) return; const listeners = this._listeners; const listenerArray = listeners[type]; - if (listenerArray !== undefined) { const index = listenerArray.indexOf(listener); - if (index !== -1) { listenerArray.splice(index, 1); } } } - dispatchEvent(event) { if (this._listeners === undefined) return; const listeners = this._listeners; const listenerArray = listeners[event.type]; - if (listenerArray !== undefined) { - event.target = this; // Make a copy, in case listeners are removed while iterating. + event.target = this; + // Make a copy, in case listeners are removed while iterating. const array = listenerArray.slice(0); - for (let i = 0, l = array.length; i < l; i++) { array[i].call(this, event); } - event.target = null; } } - } const _lut = []; - for (let i = 0; i < 256; i++) { _lut[i] = (i < 16 ? '0' : '') + i.toString(16); } - let _seed = 1234567; const DEG2RAD = Math.PI / 180; - const RAD2DEG = 180 / Math.PI; // http://stackoverflow.com/questions/105034/how-to-create-a-guid-uuid-in-javascript/21963136#21963136 + const RAD2DEG = 180 / Math.PI; + // http://stackoverflow.com/questions/105034/how-to-create-a-guid-uuid-in-javascript/21963136#21963136 function generateUUID() { const d0 = Math.random() * 0xffffffff | 0; const d1 = Math.random() * 0xffffffff | 0; const d2 = Math.random() * 0xffffffff | 0; const d3 = Math.random() * 0xffffffff | 0; - const uuid = _lut[d0 & 0xff] + _lut[d0 >> 8 & 0xff] + _lut[d0 >> 16 & 0xff] + _lut[d0 >> 24 & 0xff] + '-' + _lut[d1 & 0xff] + _lut[d1 >> 8 & 0xff] + '-' + _lut[d1 >> 16 & 0x0f | 0x40] + _lut[d1 >> 24 & 0xff] + '-' + _lut[d2 & 0x3f | 0x80] + _lut[d2 >> 8 & 0xff] + '-' + _lut[d2 >> 16 & 0xff] + _lut[d2 >> 24 & 0xff] + _lut[d3 & 0xff] + _lut[d3 >> 8 & 0xff] + _lut[d3 >> 16 & 0xff] + _lut[d3 >> 24 & 0xff]; // .toUpperCase() here flattens concatenated strings to save heap memory space. + const uuid = _lut[d0 & 0xff] + _lut[d0 >> 8 & 0xff] + _lut[d0 >> 16 & 0xff] + _lut[d0 >> 24 & 0xff] + '-' + _lut[d1 & 0xff] + _lut[d1 >> 8 & 0xff] + '-' + _lut[d1 >> 16 & 0x0f | 0x40] + _lut[d1 >> 24 & 0xff] + '-' + _lut[d2 & 0x3f | 0x80] + _lut[d2 >> 8 & 0xff] + '-' + _lut[d2 >> 16 & 0xff] + _lut[d2 >> 24 & 0xff] + _lut[d3 & 0xff] + _lut[d3 >> 8 & 0xff] + _lut[d3 >> 16 & 0xff] + _lut[d3 >> 24 & 0xff]; + // .toUpperCase() here flattens concatenated strings to save heap memory space. return uuid.toUpperCase(); } - function clamp(value, min, max) { return Math.max(min, Math.min(max, value)); - } // compute euclidian modulo of m % n - // https://en.wikipedia.org/wiki/Modulo_operation - + } + // compute euclidian modulo of m % n + // https://en.wikipedia.org/wiki/Modulo_operation function euclideanModulo(n, m) { return (n % m + m) % m; - } // Linear mapping from range to range - + } + // Linear mapping from range to range function mapLinear(x, a1, a2, b1, b2) { return b1 + (x - a1) * (b2 - b1) / (a2 - a1); - } // https://www.gamedev.net/tutorials/programming/general-and-gameplay-programming/inverse-lerp-a-super-useful-yet-often-overlooked-function-r5230/ - + } + // https://www.gamedev.net/tutorials/programming/general-and-gameplay-programming/inverse-lerp-a-super-useful-yet-often-overlooked-function-r5230/ function inverseLerp(x, y, value) { if (x !== y) { return (value - x) / (y - x); } else { return 0; } - } // https://en.wikipedia.org/wiki/Linear_interpolation - + } + // https://en.wikipedia.org/wiki/Linear_interpolation function lerp(x, y, t) { return (1 - t) * x + t * y; - } // http://www.rorydriscoll.com/2016/03/07/frame-rate-independent-damping-using-lerp/ - + } + // http://www.rorydriscoll.com/2016/03/07/frame-rate-independent-damping-using-lerp/ function damp(x, y, lambda, dt) { return lerp(x, y, 1 - Math.exp(-lambda * dt)); - } // https://www.desmos.com/calculator/vcsjnyz7x4 - + } + // https://www.desmos.com/calculator/vcsjnyz7x4 function pingpong(x, length = 1) { return length - Math.abs(euclideanModulo(x, length * 2) - length); - } // http://en.wikipedia.org/wiki/Smoothstep - + } + // http://en.wikipedia.org/wiki/Smoothstep function smoothstep(x, min, max) { if (x <= min) return 0; if (x >= max) return 1; x = (x - min) / (max - min); return x * x * (3 - 2 * x); } - function smootherstep(x, min, max) { if (x <= min) return 0; if (x >= max) return 1; x = (x - min) / (max - min); return x * x * x * (x * (x * 6 - 15) + 10); - } // Random integer from interval - + } + // Random integer from interval function randInt(low, high) { return low + Math.floor(Math.random() * (high - low + 1)); - } // Random float from interval - + } + // Random float from interval function randFloat(low, high) { return low + Math.random() * (high - low); - } // Random float from <-range/2, range/2> interval - + } + // Random float from <-range/2, range/2> interval function randFloatSpread(range) { return range * (0.5 - Math.random()); - } // Deterministic pseudo-random float in the interval [ 0, 1 ] - + } + // Deterministic pseudo-random float in the interval [ 0, 1 ] function seededRandom(s) { - if (s !== undefined) _seed = s % 2147483647; // Park-Miller algorithm + if (s !== undefined) _seed = s % 2147483647; + + // Park-Miller algorithm _seed = _seed * 16807 % 2147483647; return (_seed - 1) / 2147483646; } - function degToRad(degrees) { return degrees * DEG2RAD; } - function radToDeg(radians) { return radians * RAD2DEG; } - function isPowerOfTwo(value) { return (value & value - 1) === 0 && value !== 0; } - function ceilPowerOfTwo(value) { return Math.pow(2, Math.ceil(Math.log(value) / Math.LN2)); } - function floorPowerOfTwo(value) { return Math.pow(2, Math.floor(Math.log(value) / Math.LN2)); } - function setQuaternionFromProperEuler(q, a, b, c, order) { // Intrinsic Proper Euler Angles - see https://en.wikipedia.org/wiki/Euler_angles + // rotations are applied to the axes in the order specified by 'order' // rotation by angle 'a' is applied first, then by angle 'b', then by angle 'c' // angles are in radians + const cos = Math.cos; const sin = Math.sin; const c2 = cos(b / 2); @@ -425,32 +409,25 @@ const s1_3 = sin((a - c) / 2); const c3_1 = cos((c - a) / 2); const s3_1 = sin((c - a) / 2); - switch (order) { case 'XYX': q.set(c2 * s13, s2 * c1_3, s2 * s1_3, c2 * c13); break; - case 'YZY': q.set(s2 * s1_3, c2 * s13, s2 * c1_3, c2 * c13); break; - case 'ZXZ': q.set(s2 * c1_3, s2 * s1_3, c2 * s13, c2 * c13); break; - case 'XZX': q.set(c2 * s13, s2 * s3_1, s2 * c3_1, c2 * c13); break; - case 'YXY': q.set(s2 * c3_1, c2 * s13, s2 * s3_1, c2 * c13); break; - case 'ZYZ': q.set(s2 * s3_1, s2 * c3_1, c2 * s13, c2 * c13); break; - default: console.warn('THREE.MathUtils: .setQuaternionFromProperEuler() encountered an unknown order: ' + order); } @@ -487,348 +464,284 @@ this.x = x; this.y = y; } - get width() { return this.x; } - set width(value) { this.x = value; } - get height() { return this.y; } - set height(value) { this.y = value; } - set(x, y) { this.x = x; this.y = y; return this; } - setScalar(scalar) { this.x = scalar; this.y = scalar; return this; } - setX(x) { this.x = x; return this; } - setY(y) { this.y = y; return this; } - setComponent(index, value) { switch (index) { case 0: this.x = value; break; - case 1: this.y = value; break; - default: throw new Error('index is out of range: ' + index); } - return this; } - getComponent(index) { switch (index) { case 0: return this.x; - case 1: return this.y; - default: throw new Error('index is out of range: ' + index); } } - clone() { return new this.constructor(this.x, this.y); } - copy(v) { this.x = v.x; this.y = v.y; return this; } - add(v, w) { if (w !== undefined) { console.warn('THREE.Vector2: .add() now only accepts one argument. Use .addVectors( a, b ) instead.'); return this.addVectors(v, w); } - this.x += v.x; this.y += v.y; return this; } - addScalar(s) { this.x += s; this.y += s; return this; } - addVectors(a, b) { this.x = a.x + b.x; this.y = a.y + b.y; return this; } - addScaledVector(v, s) { this.x += v.x * s; this.y += v.y * s; return this; } - sub(v, w) { if (w !== undefined) { console.warn('THREE.Vector2: .sub() now only accepts one argument. Use .subVectors( a, b ) instead.'); return this.subVectors(v, w); } - this.x -= v.x; this.y -= v.y; return this; } - subScalar(s) { this.x -= s; this.y -= s; return this; } - subVectors(a, b) { this.x = a.x - b.x; this.y = a.y - b.y; return this; } - multiply(v) { this.x *= v.x; this.y *= v.y; return this; } - multiplyScalar(scalar) { this.x *= scalar; this.y *= scalar; return this; } - divide(v) { this.x /= v.x; this.y /= v.y; return this; } - divideScalar(scalar) { return this.multiplyScalar(1 / scalar); } - applyMatrix3(m) { const x = this.x, - y = this.y; + y = this.y; const e = m.elements; this.x = e[0] * x + e[3] * y + e[6]; this.y = e[1] * x + e[4] * y + e[7]; return this; } - min(v) { this.x = Math.min(this.x, v.x); this.y = Math.min(this.y, v.y); return this; } - max(v) { this.x = Math.max(this.x, v.x); this.y = Math.max(this.y, v.y); return this; } - clamp(min, max) { // assumes min < max, componentwise + this.x = Math.max(min.x, Math.min(max.x, this.x)); this.y = Math.max(min.y, Math.min(max.y, this.y)); return this; } - clampScalar(minVal, maxVal) { this.x = Math.max(minVal, Math.min(maxVal, this.x)); this.y = Math.max(minVal, Math.min(maxVal, this.y)); return this; } - clampLength(min, max) { const length = this.length(); return this.divideScalar(length || 1).multiplyScalar(Math.max(min, Math.min(max, length))); } - floor() { this.x = Math.floor(this.x); this.y = Math.floor(this.y); return this; } - ceil() { this.x = Math.ceil(this.x); this.y = Math.ceil(this.y); return this; } - round() { this.x = Math.round(this.x); this.y = Math.round(this.y); return this; } - roundToZero() { 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); return this; } - negate() { this.x = -this.x; this.y = -this.y; return this; } - dot(v) { return this.x * v.x + this.y * v.y; } - cross(v) { return this.x * v.y - this.y * v.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() { // computes the angle in radians with respect to the positive x-axis + const angle = Math.atan2(-this.y, -this.x) + Math.PI; return angle; } - distanceTo(v) { return Math.sqrt(this.distanceToSquared(v)); } - distanceToSquared(v) { const dx = this.x - v.x, - dy = this.y - v.y; + dy = this.y - v.y; return dx * dx + dy * dy; } - manhattanDistanceTo(v) { return Math.abs(this.x - v.x) + Math.abs(this.y - v.y); } - setLength(length) { return this.normalize().multiplyScalar(length); } - lerp(v, alpha) { this.x += (v.x - this.x) * alpha; this.y += (v.y - this.y) * alpha; return this; } - lerpVectors(v1, v2, alpha) { this.x = v1.x + (v2.x - v1.x) * alpha; this.y = v1.y + (v2.y - v1.y) * alpha; return this; } - equals(v) { return v.x === this.x && v.y === this.y; } - fromArray(array, offset = 0) { this.x = array[offset]; this.y = array[offset + 1]; return this; } - toArray(array = [], offset = 0) { array[offset] = this.x; array[offset + 1] = this.y; return array; } - fromBufferAttribute(attribute, index, offset) { if (offset !== undefined) { console.warn('THREE.Vector2: offset has been removed from .fromBufferAttribute().'); } - this.x = attribute.getX(index); this.y = attribute.getY(index); return this; } - rotateAround(center, angle) { const c = Math.cos(angle), - s = Math.sin(angle); + s = Math.sin(angle); const x = this.x - center.x; const y = this.y - center.y; this.x = x * c - y * s + center.x; this.y = x * s + y * c + center.y; return this; } - random() { this.x = Math.random(); this.y = Math.random(); return this; } - *[Symbol.iterator]() { yield this.x; yield this.y; } - } - Vector2.prototype.isVector2 = true; class Matrix3 { constructor() { this.elements = [1, 0, 0, 0, 1, 0, 0, 0, 1]; - if (arguments.length > 0) { console.error('THREE.Matrix3: the constructor no longer reads arguments. use .set() instead.'); } } - set(n11, n12, n13, n21, n22, n23, n31, n32, n33) { const te = this.elements; te[0] = n11; @@ -842,12 +755,10 @@ te[8] = n33; return this; } - identity() { this.set(1, 0, 0, 0, 1, 0, 0, 0, 1); return this; } - copy(m) { const te = this.elements; const me = m.elements; @@ -862,50 +773,45 @@ te[8] = me[8]; return this; } - extractBasis(xAxis, yAxis, zAxis) { xAxis.setFromMatrix3Column(this, 0); yAxis.setFromMatrix3Column(this, 1); zAxis.setFromMatrix3Column(this, 2); return this; } - setFromMatrix4(m) { const me = m.elements; this.set(me[0], me[4], me[8], me[1], me[5], me[9], me[2], me[6], me[10]); return this; } - multiply(m) { return this.multiplyMatrices(this, m); } - premultiply(m) { return this.multiplyMatrices(m, this); } - multiplyMatrices(a, b) { const ae = a.elements; const be = b.elements; const te = this.elements; const a11 = ae[0], - a12 = ae[3], - a13 = ae[6]; + a12 = ae[3], + a13 = ae[6]; const a21 = ae[1], - a22 = ae[4], - a23 = ae[7]; + a22 = ae[4], + a23 = ae[7]; const a31 = ae[2], - a32 = ae[5], - a33 = ae[8]; + a32 = ae[5], + a33 = ae[8]; const b11 = be[0], - b12 = be[3], - b13 = be[6]; + b12 = be[3], + b13 = be[6]; const b21 = be[1], - b22 = be[4], - b23 = be[7]; + b22 = be[4], + b23 = be[7]; const b31 = be[2], - b32 = be[5], - b33 = be[8]; + b32 = be[5], + b33 = be[8]; te[0] = a11 * b11 + a12 * b21 + a13 * b31; te[3] = a11 * b12 + a12 * b22 + a13 * b32; te[6] = a11 * b13 + a12 * b23 + a13 * b33; @@ -917,7 +823,6 @@ te[8] = a31 * b13 + a32 * b23 + a33 * b33; return this; } - multiplyScalar(s) { const te = this.elements; te[0] *= s; @@ -931,36 +836,34 @@ te[8] *= s; return this; } - determinant() { const te = this.elements; const a = te[0], - b = te[1], - c = te[2], - d = te[3], - e = te[4], - f = te[5], - g = te[6], - h = te[7], - i = te[8]; + b = te[1], + c = te[2], + d = te[3], + e = te[4], + f = te[5], + g = te[6], + h = te[7], + i = te[8]; return a * e * i - a * f * h - b * d * i + b * f * g + c * d * h - c * e * g; } - invert() { const te = this.elements, - n11 = te[0], - n21 = te[1], - n31 = te[2], - n12 = te[3], - n22 = te[4], - n32 = te[5], - n13 = te[6], - n23 = te[7], - n33 = te[8], - t11 = n33 * n22 - n32 * n23, - t12 = n32 * n13 - n33 * n12, - t13 = n23 * n12 - n22 * n13, - det = n11 * t11 + n21 * t12 + n31 * t13; + n11 = te[0], + n21 = te[1], + n31 = te[2], + n12 = te[3], + n22 = te[4], + n32 = te[5], + n13 = te[6], + n23 = te[7], + n33 = te[8], + t11 = n33 * n22 - n32 * n23, + t12 = n32 * n13 - n33 * n12, + t13 = n23 * n12 - n22 * n13, + det = n11 * t11 + n21 * t12 + n31 * t13; if (det === 0) return this.set(0, 0, 0, 0, 0, 0, 0, 0, 0); const detInv = 1 / det; te[0] = t11 * detInv; @@ -974,7 +877,6 @@ te[8] = (n22 * n11 - n21 * n12) * detInv; return this; } - transpose() { let tmp; const m = this.elements; @@ -989,11 +891,9 @@ m[7] = tmp; return this; } - getNormalMatrix(matrix4) { return this.setFromMatrix4(matrix4).invert().transpose(); } - transposeIntoArray(r) { const m = this.elements; r[0] = m[0]; @@ -1007,14 +907,12 @@ r[8] = m[8]; return this; } - setUvTransform(tx, ty, sx, sy, rotation, cx, cy) { const c = Math.cos(rotation); const s = Math.sin(rotation); this.set(sx * c, sx * s, -sx * (c * cx + s * cy) + cx + tx, -sy * s, sy * c, -sy * (-s * cx + c * cy) + cy + ty, 0, 0, 1); return this; } - scale(sx, sy) { const te = this.elements; te[0] *= sx; @@ -1025,17 +923,16 @@ te[7] *= sy; return this; } - rotate(theta) { const c = Math.cos(theta); const s = Math.sin(theta); const te = this.elements; const a11 = te[0], - a12 = te[3], - a13 = te[6]; + a12 = te[3], + a13 = te[6]; const a21 = te[1], - a22 = te[4], - a23 = te[7]; + a22 = te[4], + a23 = te[7]; te[0] = c * a11 + s * a21; te[3] = c * a12 + s * a22; te[6] = c * a13 + s * a23; @@ -1044,7 +941,6 @@ te[7] = -s * a13 + c * a23; return this; } - translate(tx, ty) { const te = this.elements; te[0] += tx * te[2]; @@ -1055,26 +951,20 @@ te[7] += ty * te[8]; return this; } - equals(matrix) { const te = this.elements; const me = matrix.elements; - for (let i = 0; i < 9; i++) { if (te[i] !== me[i]) return false; } - return true; } - fromArray(array, offset = 0) { for (let i = 0; i < 9; i++) { this.elements[i] = array[i + offset]; } - return this; } - toArray(array = [], offset = 0) { const te = this.elements; array[offset] = te[0]; @@ -1088,24 +978,20 @@ array[offset + 8] = te[8]; return array; } - clone() { return new this.constructor().fromArray(this.elements); } - } - Matrix3.prototype.isMatrix3 = true; function arrayNeedsUint32(array) { // assumes larger values usually on last + for (let i = array.length - 1; i >= 0; --i) { if (array[i] > 65535) return true; } - return false; } - const TYPED_ARRAYS = { Int8Array: Int8Array, Uint8Array: Uint8Array, @@ -1117,47 +1003,37 @@ Float32Array: Float32Array, Float64Array: Float64Array }; - function getTypedArray(type, buffer) { return new TYPED_ARRAYS[type](buffer); } - function createElementNS(name) { return platform.createElementNS('http://www.w3.org/1999/xhtml', name); } let _canvas; - class ImageUtils { static getDataURL(image) { if (/^data:/i.test(image.src)) { return image.src; } - if (typeof HTMLCanvasElement == 'undefined') { return image.src; } - let canvas; - if (image instanceof HTMLCanvasElement) { canvas = image; } else { if (_canvas === undefined) _canvas = createElementNS('canvas'); _canvas.width = image.width; _canvas.height = image.height; - const context = _canvas.getContext('2d'); - if (image instanceof ImageData) { context.putImageData(image, 0, 0); } else { context.drawImage(image, 0, 0, image.width, image.height); } - canvas = _canvas; } - if (canvas.width > 2048 || canvas.height > 2048) { console.warn('THREE.ImageUtils.getDataURL: Image converted to jpg for performance reasons', image); return canvas.toDataURL('image/jpeg', 0.6); @@ -1165,11 +1041,9 @@ return canvas.toDataURL('image/png'); } } - } let textureId = 0; - class Texture extends EventDispatcher { constructor(image = Texture.DEFAULT_IMAGE, mapping = Texture.DEFAULT_MAPPING, wrapS = ClampToEdgeWrapping, wrapT = ClampToEdgeWrapping, magFilter = LinearFilter, minFilter = LinearMipmapLinearFilter, format = RGBAFormat, type = UnsignedByteType, anisotropy = 1, encoding = LinearEncoding) { super(); @@ -1199,33 +1073,29 @@ this.premultiplyAlpha = false; this.flipY = true; this.unpackAlignment = 4; // valid values: 1, 2, 4, 8 (see http://www.khronos.org/opengles/sdk/docs/man/xhtml/glPixelStorei.xml) + // Values of encoding !== THREE.LinearEncoding only supported on map, envMap and emissiveMap. // // Also changing the encoding after already used by a Material will not automatically make the Material // update. You need to explicitly call Material.needsUpdate to trigger it to recompile. - this.encoding = encoding; this.userData = {}; this.version = 0; this.onUpdate = null; this.isRenderTargetTexture = false; // indicates whether a texture belongs to a render target or not - this.needsPMREMUpdate = false; // indicates whether this texture should be processed by PMREMGenerator or not (only relevant for render target textures) + // In WebGL2, sRGB textures can be trancoded to Linear automatically, but reference to this issue: https://github.com/mrdoob/three.js/issues/26183 // there're performance issues when doing this, so you can set the sRGBToLinearWithShader to false to transcode the sRGB texture to Linear with // shader, especially to those textures that are updated in each frame - this.sRGBToLinearWithShader = !Texture.useSrgbTextures; } - 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(source) { this.name = source.name; this.image = source.image; @@ -1253,14 +1123,11 @@ this.userData = JSON.parse(JSON.stringify(source.userData)); return this; } - toJSON(meta) { const isRootObject = meta === undefined || typeof meta === 'string'; - if (!isRootObject && meta.textures[this.uuid] !== undefined) { return meta.textures[this.uuid]; } - const output = { metadata: { version: 4.5, @@ -1285,24 +1152,22 @@ premultiplyAlpha: this.premultiplyAlpha, unpackAlignment: this.unpackAlignment }; - if (this.image !== undefined) { // TODO: Move to THREE.Image - const image = this.image; + const image = this.image; if (image.uuid === undefined) { image.uuid = generateUUID(); // UGH } - if (!isRootObject && meta.images[image.uuid] === undefined) { let url; - if (Array.isArray(image)) { // process array of images e.g. CubeTexture - url = []; + url = []; for (let i = 0, l = image.length; i < l; i++) { // check cube texture with data textures + if (image[i].isDataTexture) { url.push(serializeImage(image[i].image)); } else { @@ -1311,104 +1176,86 @@ } } else { // process single image + url = serializeImage(image); } - meta.images[image.uuid] = { uuid: image.uuid, url: url }; } - output.image = image.uuid; } - if (JSON.stringify(this.userData) !== '{}') output.userData = this.userData; - if (!isRootObject) { meta.textures[this.uuid] = output; } - return output; } - dispose() { this.dispatchEvent({ type: 'dispose' }); } - transformUv(uv) { if (this.mapping !== UVMapping) return uv; uv.applyMatrix3(this.matrix); - if (uv.x < 0 || uv.x > 1) { switch (this.wrapS) { case RepeatWrapping: uv.x = uv.x - Math.floor(uv.x); break; - case ClampToEdgeWrapping: uv.x = uv.x < 0 ? 0 : 1; break; - case MirroredRepeatWrapping: if (Math.abs(Math.floor(uv.x) % 2) === 1) { uv.x = Math.ceil(uv.x) - uv.x; } else { uv.x = uv.x - Math.floor(uv.x); } - break; } } - if (uv.y < 0 || uv.y > 1) { switch (this.wrapT) { case RepeatWrapping: uv.y = uv.y - Math.floor(uv.y); break; - case ClampToEdgeWrapping: uv.y = uv.y < 0 ? 0 : 1; break; - case MirroredRepeatWrapping: if (Math.abs(Math.floor(uv.y) % 2) === 1) { uv.y = Math.ceil(uv.y) - uv.y; } else { uv.y = uv.y - Math.floor(uv.y); } - break; } } - if (this.flipY) { uv.y = 1 - uv.y; } - return uv; } - set needsUpdate(value) { if (value === true) this.version++; } - } - Texture.DEFAULT_IMAGE = undefined; Texture.DEFAULT_MAPPING = UVMapping; Texture.useSrgbTextures = true; Texture.prototype.isTexture = true; - function serializeImage(image) { if (typeof HTMLImageElement !== 'undefined' && image instanceof HTMLImageElement || typeof HTMLCanvasElement !== 'undefined' && image instanceof HTMLCanvasElement || typeof ImageBitmap !== 'undefined' && image instanceof ImageBitmap) { // default images + return ImageUtils.getDataURL(image); } else { if (image.data) { // images of DataTexture + return { data: Array.prototype.slice.call(image.data), width: image.width, @@ -1429,23 +1276,18 @@ this.z = z; this.w = w; } - get width() { return this.z; } - set width(value) { this.z = value; } - get height() { return this.w; } - set height(value) { this.w = value; } - set(x, y, z, w) { this.x = x; this.y = y; @@ -1453,7 +1295,6 @@ this.w = w; return this; } - setScalar(scalar) { this.x = scalar; this.y = scalar; @@ -1461,75 +1302,58 @@ this.w = scalar; return this; } - setX(x) { this.x = x; return this; } - setY(y) { this.y = y; return this; } - setZ(z) { this.z = z; return this; } - setW(w) { this.w = w; return this; } - setComponent(index, value) { switch (index) { case 0: this.x = value; break; - case 1: this.y = value; break; - case 2: this.z = value; break; - case 3: this.w = value; break; - default: throw new Error('index is out of range: ' + index); } - return this; } - getComponent(index) { switch (index) { 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: ' + index); } } - clone() { return new this.constructor(this.x, this.y, this.z, this.w); } - copy(v) { this.x = v.x; this.y = v.y; @@ -1537,20 +1361,17 @@ this.w = v.w !== undefined ? v.w : 1; return this; } - add(v, w) { if (w !== undefined) { console.warn('THREE.Vector4: .add() now only accepts one argument. Use .addVectors( a, b ) instead.'); return this.addVectors(v, w); } - this.x += v.x; this.y += v.y; this.z += v.z; this.w += v.w; return this; } - addScalar(s) { this.x += s; this.y += s; @@ -1558,7 +1379,6 @@ this.w += s; return this; } - addVectors(a, b) { this.x = a.x + b.x; this.y = a.y + b.y; @@ -1566,7 +1386,6 @@ this.w = a.w + b.w; return this; } - addScaledVector(v, s) { this.x += v.x * s; this.y += v.y * s; @@ -1574,20 +1393,17 @@ this.w += v.w * s; return this; } - sub(v, w) { if (w !== undefined) { console.warn('THREE.Vector4: .sub() now only accepts one argument. Use .subVectors( a, b ) instead.'); return this.subVectors(v, w); } - this.x -= v.x; this.y -= v.y; this.z -= v.z; this.w -= v.w; return this; } - subScalar(s) { this.x -= s; this.y -= s; @@ -1595,7 +1411,6 @@ this.w -= s; return this; } - subVectors(a, b) { this.x = a.x - b.x; this.y = a.y - b.y; @@ -1603,7 +1418,6 @@ this.w = a.w - b.w; return this; } - multiply(v) { this.x *= v.x; this.y *= v.y; @@ -1611,7 +1425,6 @@ this.w *= v.w; return this; } - multiplyScalar(scalar) { this.x *= scalar; this.y *= scalar; @@ -1619,21 +1432,24 @@ this.w *= scalar; return this; } - applyQuaternion(q) { const x = this.x, - y = this.y, - z = this.z, - w = this.w; + y = this.y, + z = this.z, + w = this.w; const qx = q.x, - qy = q.y, - qz = q.z, - qw = q.w; // calculate quat * vector + qy = q.y, + qz = q.z, + qw = q.w; + + // calculate quat * vector const ix = qw * x + qy * z - qz * y; const iy = qw * y + qz * x - qx * z; const iz = qw * z + qx * y - qy * x; - const iw = -qx * x - qy * y - qz * z; // calculate result * inverse quat + const iw = -qx * x - qy * y - qz * z; + + // calculate result * inverse quat this.x = ix * qw + iw * -qx + iy * -qz - iz * -qy; this.y = iy * qw + iw * -qy + iz * -qx - ix * -qz; @@ -1641,12 +1457,11 @@ this.w = w; return this; } - applyMatrix4(m) { const x = this.x, - y = this.y, - z = this.z, - w = this.w; + y = this.y, + z = this.z, + w = this.w; const e = m.elements; this.x = e[0] * x + e[4] * y + e[8] * z + e[12] * w; this.y = e[1] * x + e[5] * y + e[9] * z + e[13] * w; @@ -1654,17 +1469,16 @@ this.w = e[3] * x + e[7] * y + e[11] * z + e[15] * w; return this; } - divideScalar(scalar) { return this.multiplyScalar(1 / scalar); } - setAxisAngleFromQuaternion(q) { // http://www.euclideanspace.com/maths/geometry/rotations/conversions/quaternionToAngle/index.htm + // q is assumed to be normalized + this.w = 2 * Math.acos(q.w); const s = Math.sqrt(1 - q.w * q.w); - if (s < 0.0001) { this.x = 1; this.y = 0; @@ -1674,40 +1488,42 @@ this.y = q.y / s; this.z = q.z / s; } - return this; } - setAxisAngleFromRotationMatrix(m) { // http://www.euclideanspace.com/maths/geometry/rotations/conversions/matrixToAngle/index.htm + // assumes the upper 3x3 of m is a pure rotation matrix (i.e, unscaled) - let angle, x, y, z; // variables for result + let angle, x, y, z; // variables for result const epsilon = 0.01, - // margin to allow for rounding errors - epsilon2 = 0.1, - // margin to distinguish between 0 and 180 degrees - te = m.elements, - m11 = te[0], - m12 = te[4], - m13 = te[8], - m21 = te[1], - m22 = te[5], - m23 = te[9], - m31 = te[2], - m32 = te[6], - m33 = te[10]; - + // margin to allow for rounding errors + epsilon2 = 0.1, + // margin to distinguish between 0 and 180 degrees + + te = m.elements, + m11 = te[0], + m12 = te[4], + m13 = te[8], + m21 = te[1], + m22 = te[5], + m23 = te[9], + m31 = te[2], + m32 = te[6], + m33 = te[10]; if (Math.abs(m12 - m21) < epsilon && Math.abs(m13 - m31) < epsilon && Math.abs(m23 - m32) < epsilon) { // singularity found // first check for identity matrix which must have +1 for all terms // in leading diagonal and zero in other terms + if (Math.abs(m12 + m21) < epsilon2 && Math.abs(m13 + m31) < epsilon2 && Math.abs(m23 + m32) < epsilon2 && Math.abs(m11 + m22 + m33 - 3) < epsilon2) { // this singularity is identity matrix so angle = 0 + this.set(1, 0, 0, 0); return this; // zero angle, arbitrary axis - } // otherwise this singularity is angle = 180 + } + // otherwise this singularity is angle = 180 angle = Math.PI; const xx = (m11 + 1) / 2; @@ -1716,9 +1532,9 @@ const xy = (m12 + m21) / 4; const xz = (m13 + m31) / 4; const yz = (m23 + m32) / 4; - if (xx > yy && xx > zz) { // m11 is the largest diagonal term + if (xx < epsilon) { x = 0; y = 0.707106781; @@ -1730,6 +1546,7 @@ } } else if (yy > zz) { // m22 is the largest diagonal term + if (yy < epsilon) { x = 0.707106781; y = 0; @@ -1741,6 +1558,7 @@ } } else { // m33 is the largest diagonal term so base result on this + if (zz < epsilon) { x = 0.707106781; y = 0.707106781; @@ -1751,15 +1569,17 @@ y = yz / z; } } - this.set(x, y, z, angle); return this; // return 180 deg rotation - } // as we have reached here there are no singularities so we can handle normally + } + // as we have reached here there are no singularities so we can handle normally let s = Math.sqrt((m32 - m23) * (m32 - m23) + (m13 - m31) * (m13 - m31) + (m21 - m12) * (m21 - m12)); // used to normalize - if (Math.abs(s) < 0.001) s = 1; // prevent divide by zero, should not happen if matrix is orthogonal and should be + if (Math.abs(s) < 0.001) s = 1; + + // prevent divide by zero, should not happen if matrix is orthogonal and should be // caught by singularity test above, but I've left it in just in case this.x = (m32 - m23) / s; @@ -1768,7 +1588,6 @@ this.w = Math.acos((m11 + m22 + m33 - 1) / 2); return this; } - min(v) { this.x = Math.min(this.x, v.x); this.y = Math.min(this.y, v.y); @@ -1776,7 +1595,6 @@ this.w = Math.min(this.w, v.w); return this; } - max(v) { this.x = Math.max(this.x, v.x); this.y = Math.max(this.y, v.y); @@ -1784,16 +1602,15 @@ this.w = Math.max(this.w, v.w); return this; } - clamp(min, max) { // assumes min < max, componentwise + this.x = Math.max(min.x, Math.min(max.x, this.x)); this.y = Math.max(min.y, Math.min(max.y, this.y)); this.z = Math.max(min.z, Math.min(max.z, this.z)); this.w = Math.max(min.w, Math.min(max.w, this.w)); return this; } - clampScalar(minVal, maxVal) { this.x = Math.max(minVal, Math.min(maxVal, this.x)); this.y = Math.max(minVal, Math.min(maxVal, this.y)); @@ -1801,12 +1618,10 @@ this.w = Math.max(minVal, Math.min(maxVal, this.w)); return this; } - clampLength(min, max) { const length = this.length(); return this.divideScalar(length || 1).multiplyScalar(Math.max(min, Math.min(max, length))); } - floor() { this.x = Math.floor(this.x); this.y = Math.floor(this.y); @@ -1814,7 +1629,6 @@ this.w = Math.floor(this.w); return this; } - ceil() { this.x = Math.ceil(this.x); this.y = Math.ceil(this.y); @@ -1822,7 +1636,6 @@ this.w = Math.ceil(this.w); return this; } - round() { this.x = Math.round(this.x); this.y = Math.round(this.y); @@ -1830,7 +1643,6 @@ this.w = Math.round(this.w); return this; } - roundToZero() { 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); @@ -1838,7 +1650,6 @@ this.w = this.w < 0 ? Math.ceil(this.w) : Math.floor(this.w); return this; } - negate() { this.x = -this.x; this.y = -this.y; @@ -1846,31 +1657,24 @@ this.w = -this.w; return this; } - dot(v) { return this.x * v.x + this.y * v.y + this.z * v.z + this.w * v.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(length) { return this.normalize().multiplyScalar(length); } - lerp(v, alpha) { this.x += (v.x - this.x) * alpha; this.y += (v.y - this.y) * alpha; @@ -1878,7 +1682,6 @@ this.w += (v.w - this.w) * alpha; return this; } - lerpVectors(v1, v2, alpha) { this.x = v1.x + (v2.x - v1.x) * alpha; this.y = v1.y + (v2.y - v1.y) * alpha; @@ -1886,11 +1689,9 @@ this.w = v1.w + (v2.w - v1.w) * alpha; return this; } - equals(v) { return v.x === this.x && v.y === this.y && v.z === this.z && v.w === this.w; } - fromArray(array, offset = 0) { this.x = array[offset]; this.y = array[offset + 1]; @@ -1898,7 +1699,6 @@ this.w = array[offset + 3]; return this; } - toArray(array = [], offset = 0) { array[offset] = this.x; array[offset + 1] = this.y; @@ -1906,19 +1706,16 @@ array[offset + 3] = this.w; return array; } - fromBufferAttribute(attribute, index, offset) { if (offset !== undefined) { console.warn('THREE.Vector4: offset has been removed from .fromBufferAttribute().'); } - this.x = attribute.getX(index); this.y = attribute.getY(index); this.z = attribute.getZ(index); this.w = attribute.getW(index); return this; } - random() { this.x = Math.random(); this.y = Math.random(); @@ -1926,16 +1723,13 @@ this.w = Math.random(); return this; } - *[Symbol.iterator]() { yield this.x; yield this.y; yield this.z; yield this.w; } - } - Vector4.prototype.isVector4 = true; /* @@ -1943,7 +1737,6 @@ * Texture parameters for an auto-generated target texture * depthBuffer/stencilBuffer: Booleans to indicate if we should generate these buffers */ - class WebGLRenderTarget extends EventDispatcher { constructor(width, height, options = {}) { super(); @@ -1966,16 +1759,15 @@ this.depthBuffer = options.depthBuffer !== undefined ? options.depthBuffer : true; this.stencilBuffer = options.stencilBuffer !== undefined ? options.stencilBuffer : false; this.depthTexture = options.depthTexture !== undefined ? options.depthTexture : null; + /** * ios16.4.1 gl.DEPTH_COMPONENT16 does not work well in rendertarget * it only works in depthBuffer true & stencilBuffer false & depthTexture null * see WebGlTextures.setupRenderBufferStorage * */ - platform.properties && (this.useDEPTH_COMPONENT24 = platform.properties.rendertargetUseDEPTH_COMPONENT24); this.samples = options.samples !== undefined ? options.samples : 0; } - setTexture(texture) { texture.image = { width: this.width, @@ -1984,7 +1776,6 @@ }; this.texture = texture; } - setSize(width, height, depth = 1) { if (this.width !== width || this.height !== height || this.depth !== depth) { this.width = width; @@ -1995,21 +1786,20 @@ this.texture.image.depth = depth; this.dispose(); } - this.viewport.set(0, 0, width, height); this.scissor.set(0, 0, width, height); } - clone() { return new this.constructor().copy(this); } - copy(source) { this.width = source.width; this.height = source.height; this.depth = source.depth; this.viewport.copy(source.viewport); - this.texture = source.texture.clone(); // ensure image object is not shared, see #20328 + this.texture = source.texture.clone(); + + // ensure image object is not shared, see #20328 this.texture.image = Object.assign({}, source.texture.image); this.depthBuffer = source.depthBuffer; @@ -2018,15 +1808,12 @@ this.samples = source.samples; return this; } - dispose() { this.dispatchEvent({ type: 'dispose' }); } - } - WebGLRenderTarget.prototype.isWebGLRenderTarget = true; class WebGLMultipleRenderTargets extends WebGLRenderTarget { @@ -2034,32 +1821,26 @@ super(width, height, options); const texture = this.texture; this.texture = []; - for (let i = 0; i < count; i++) { this.texture[i] = texture.clone(); } } - setSize(width, height, depth = 1) { if (this.width !== width || this.height !== height || this.depth !== depth) { this.width = width; this.height = height; this.depth = depth; - for (let i = 0, il = this.texture.length; i < il; i++) { this.texture[i].image.width = width; this.texture[i].image.height = height; this.texture[i].image.depth = depth; } - this.dispose(); } - this.viewport.set(0, 0, width, height); this.scissor.set(0, 0, width, height); return this; } - copy(source) { this.dispose(); this.width = source.width; @@ -2071,16 +1852,12 @@ this.stencilBuffer = source.stencilBuffer; this.depthTexture = source.depthTexture; this.texture.length = 0; - for (let i = 0, il = source.texture.length; i < il; i++) { this.texture[i] = source.texture[i].clone(); } - return this; } - } - WebGLMultipleRenderTargets.prototype.isWebGLMultipleRenderTargets = true; class Quaternion { @@ -2090,23 +1867,21 @@ this._z = z; this._w = w; } - static slerp(qa, qb, qm, t) { console.warn('THREE.Quaternion: Static .slerp() has been deprecated. Use qm.slerpQuaternions( qa, qb, t ) instead.'); return qm.slerpQuaternions(qa, qb, t); } - static slerpFlat(dst, dstOffset, src0, srcOffset0, src1, srcOffset1, t) { // fuzz-free, array-based Quaternion SLERP operation + let x0 = src0[srcOffset0 + 0], - y0 = src0[srcOffset0 + 1], - z0 = src0[srcOffset0 + 2], - w0 = src0[srcOffset0 + 3]; + y0 = src0[srcOffset0 + 1], + z0 = src0[srcOffset0 + 2], + w0 = src0[srcOffset0 + 3]; const x1 = src1[srcOffset1 + 0], - y1 = src1[srcOffset1 + 1], - z1 = src1[srcOffset1 + 2], - w1 = src1[srcOffset1 + 3]; - + y1 = src1[srcOffset1 + 1], + z1 = src1[srcOffset1 + 2], + w1 = src1[srcOffset1 + 3]; if (t === 0) { dst[dstOffset + 0] = x0; dst[dstOffset + 1] = y0; @@ -2114,7 +1889,6 @@ dst[dstOffset + 3] = w0; return; } - if (t === 1) { dst[dstOffset + 0] = x1; dst[dstOffset + 1] = y1; @@ -2122,26 +1896,26 @@ dst[dstOffset + 3] = w1; return; } - if (w0 !== w1 || x0 !== x1 || y0 !== y1 || z0 !== z1) { let s = 1 - t; const cos = x0 * x1 + y0 * y1 + z0 * z1 + w0 * w1, - dir = cos >= 0 ? 1 : -1, - sqrSin = 1 - cos * cos; // Skip the Slerp for tiny steps to avoid numeric problems: + dir = cos >= 0 ? 1 : -1, + sqrSin = 1 - cos * cos; + // Skip the Slerp for tiny steps to avoid numeric problems: if (sqrSin > Number.EPSILON) { const sin = Math.sqrt(sqrSin), - len = Math.atan2(sin, cos * dir); + len = Math.atan2(sin, cos * dir); s = Math.sin(s * len) / sin; t = Math.sin(t * len) / sin; } - const tDir = t * dir; x0 = x0 * s + x1 * tDir; y0 = y0 * s + y1 * tDir; z0 = z0 * s + z1 * tDir; - w0 = w0 * s + w1 * tDir; // Normalize in case we just did a lerp: + w0 = w0 * s + w1 * tDir; + // Normalize in case we just did a lerp: if (s === 1 - t) { const f = 1 / Math.sqrt(x0 * x0 + y0 * y0 + z0 * z0 + w0 * w0); x0 *= f; @@ -2150,13 +1924,11 @@ w0 *= f; } } - dst[dstOffset] = x0; dst[dstOffset + 1] = y0; dst[dstOffset + 2] = z0; dst[dstOffset + 3] = w0; } - static multiplyQuaternionsFlat(dst, dstOffset, src0, srcOffset0, src1, srcOffset1) { const x0 = src0[srcOffset0]; const y0 = src0[srcOffset0 + 1]; @@ -2172,82 +1944,63 @@ dst[dstOffset + 3] = w0 * w1 - x0 * x1 - y0 * y1 - z0 * z1; return dst; } - get x() { return this._x; } - set x(value) { this._x = value; - this._onChangeCallback(); } - get y() { return this._y; } - set y(value) { this._y = value; - this._onChangeCallback(); } - get z() { return this._z; } - set z(value) { this._z = value; - this._onChangeCallback(); } - get w() { return this._w; } - set w(value) { this._w = value; - this._onChangeCallback(); } - set(x, y, z, w) { this._x = x; this._y = y; this._z = z; this._w = w; - this._onChangeCallback(); - return this; } - clone() { return new this.constructor(this._x, this._y, this._z, this._w); } - copy(quaternion) { this._x = quaternion.x; this._y = quaternion.y; this._z = quaternion.z; this._w = quaternion.w; - this._onChangeCallback(); - return this; } - setFromEuler(euler, update) { if (!(euler && euler.isEuler)) { throw new Error('THREE.Quaternion: .setFromEuler() now expects an Euler rotation rather than a Vector3 and order.'); } - const x = euler._x, - y = euler._y, - z = euler._z, - order = euler._order; // http://www.mathworks.com/matlabcentral/fileexchange/ + y = euler._y, + z = euler._z, + order = euler._order; + + // http://www.mathworks.com/matlabcentral/fileexchange/ // 20696-function-to-convert-between-dcm-euler-angles-quaternions-and-euler-vectors/ // content/SpinCalc.m @@ -2259,7 +2012,6 @@ const s1 = sin(x / 2); const s2 = sin(y / 2); const s3 = sin(z / 2); - switch (order) { case 'XYZ': this._x = s1 * c2 * c3 + c1 * s2 * s3; @@ -2267,80 +2019,72 @@ this._z = c1 * c2 * s3 + s1 * s2 * c3; this._w = c1 * c2 * c3 - s1 * s2 * s3; break; - case 'YXZ': this._x = s1 * c2 * c3 + c1 * s2 * s3; this._y = c1 * s2 * c3 - s1 * c2 * s3; this._z = c1 * c2 * s3 - s1 * s2 * c3; this._w = c1 * c2 * c3 + s1 * s2 * s3; break; - case 'ZXY': this._x = s1 * c2 * c3 - c1 * s2 * s3; this._y = c1 * s2 * c3 + s1 * c2 * s3; this._z = c1 * c2 * s3 + s1 * s2 * c3; this._w = c1 * c2 * c3 - s1 * s2 * s3; break; - case 'ZYX': this._x = s1 * c2 * c3 - c1 * s2 * s3; this._y = c1 * s2 * c3 + s1 * c2 * s3; this._z = c1 * c2 * s3 - s1 * s2 * c3; this._w = c1 * c2 * c3 + s1 * s2 * s3; break; - case 'YZX': this._x = s1 * c2 * c3 + c1 * s2 * s3; this._y = c1 * s2 * c3 + s1 * c2 * s3; this._z = c1 * c2 * s3 - s1 * s2 * c3; this._w = c1 * c2 * c3 - s1 * s2 * s3; break; - case 'XZY': this._x = s1 * c2 * c3 - c1 * s2 * s3; this._y = c1 * s2 * c3 - s1 * c2 * s3; this._z = c1 * c2 * s3 + s1 * s2 * c3; this._w = c1 * c2 * c3 + s1 * s2 * s3; break; - default: console.warn('THREE.Quaternion: .setFromEuler() encountered an unknown order: ' + order); } - if (update !== false) this._onChangeCallback(); return this; } - setFromAxisAngle(axis, angle) { // http://www.euclideanspace.com/maths/geometry/rotations/conversions/angleToQuaternion/index.htm + // assumes axis is normalized + const halfAngle = angle / 2, - s = Math.sin(halfAngle); + s = Math.sin(halfAngle); this._x = axis.x * s; this._y = axis.y * s; this._z = axis.z * s; this._w = Math.cos(halfAngle); - this._onChangeCallback(); - return this; } - setFromRotationMatrix(m) { // http://www.euclideanspace.com/maths/geometry/rotations/conversions/matrixToQuaternion/index.htm + // assumes the upper 3x3 of m is a pure rotation matrix (i.e, unscaled) - const te = m.elements, - m11 = te[0], - m12 = te[4], - m13 = te[8], - m21 = te[1], - m22 = te[5], - m23 = te[9], - m31 = te[2], - m32 = te[6], - m33 = te[10], - trace = m11 + m22 + m33; + const te = m.elements, + m11 = te[0], + m12 = te[4], + m13 = te[8], + m21 = te[1], + m22 = te[5], + m23 = te[9], + m31 = te[2], + m32 = te[6], + m33 = te[10], + trace = m11 + m22 + m33; if (trace > 0) { const s = 0.5 / Math.sqrt(trace + 1.0); this._w = 0.25 / s; @@ -2366,20 +2110,17 @@ this._y = (m23 + m32) / s; this._z = 0.25 * s; } - this._onChangeCallback(); - return this; } - setFromUnitVectors(vFrom, vTo) { // assumes direction vectors vFrom and vTo are normalized - let r = vFrom.dot(vTo) + 1; + let r = vFrom.dot(vTo) + 1; if (r < Number.EPSILON) { // vFrom and vTo point in opposite directions - r = 0; + r = 0; if (Math.abs(vFrom.x) > Math.abs(vFrom.z)) { this._x = -vFrom.y; this._y = vFrom.x; @@ -2393,19 +2134,17 @@ } } else { // crossVectors( vFrom, vTo ); // inlined to avoid cyclic dependency on Vector3 + this._x = vFrom.y * vTo.z - vFrom.z * vTo.y; this._y = vFrom.z * vTo.x - vFrom.x * vTo.z; this._z = vFrom.x * vTo.y - vFrom.y * vTo.x; this._w = r; } - return this.normalize(); } - angleTo(q) { return 2 * Math.acos(Math.abs(clamp(this.dot(q), -1, 1))); } - rotateTowards(q, step) { const angle = this.angleTo(q); if (angle === 0) return this; @@ -2413,41 +2152,32 @@ this.slerp(q, t); return this; } - identity() { return this.set(0, 0, 0, 1); } - invert() { // quaternion is assumed to have unit length + return this.conjugate(); } - conjugate() { this._x *= -1; this._y *= -1; this._z *= -1; - this._onChangeCallback(); - return this; } - dot(v) { return this._x * v._x + this._y * v._y + this._z * v._z + this._w * v._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 l = this.length(); - if (l === 0) { this._x = 0; this._y = 0; @@ -2460,55 +2190,48 @@ this._z = this._z * l; this._w = this._w * l; } - this._onChangeCallback(); - return this; } - multiply(q, p) { if (p !== undefined) { console.warn('THREE.Quaternion: .multiply() now only accepts one argument. Use .multiplyQuaternions( a, b ) instead.'); return this.multiplyQuaternions(q, p); } - return this.multiplyQuaternions(this, q); } - premultiply(q) { return this.multiplyQuaternions(q, this); } - multiplyQuaternions(a, b) { // from http://www.euclideanspace.com/maths/algebra/realNormedAlgebra/quaternions/code/index.htm + const qax = a._x, - qay = a._y, - qaz = a._z, - qaw = a._w; + qay = a._y, + qaz = a._z, + qaw = a._w; const qbx = b._x, - qby = b._y, - qbz = b._z, - qbw = b._w; + qby = b._y, + qbz = b._z, + qbw = b._w; this._x = qax * qbw + qaw * qbx + qay * qbz - qaz * qby; this._y = qay * qbw + qaw * qby + qaz * qbx - qax * qbz; this._z = qaz * qbw + qaw * qbz + qax * qby - qay * qbx; this._w = qaw * qbw - qax * qbx - qay * qby - qaz * qbz; - this._onChangeCallback(); - return this; } - slerp(qb, t) { if (t === 0) return this; if (t === 1) return this.copy(qb); const x = this._x, - y = this._y, - z = this._z, - w = this._w; // http://www.euclideanspace.com/maths/algebra/realNormedAlgebra/quaternions/slerp/ + y = this._y, + z = this._z, + w = this._w; - let cosHalfTheta = w * qb._w + x * qb._x + y * qb._y + z * qb._z; + // http://www.euclideanspace.com/maths/algebra/realNormedAlgebra/quaternions/slerp/ + let cosHalfTheta = w * qb._w + x * qb._x + y * qb._y + z * qb._z; if (cosHalfTheta < 0) { this._w = -qb._w; this._x = -qb._x; @@ -2518,7 +2241,6 @@ } else { this.copy(qb); } - if (cosHalfTheta >= 1.0) { this._w = w; this._x = x; @@ -2526,9 +2248,7 @@ this._z = z; return this; } - const sqrSinHalfTheta = 1.0 - cosHalfTheta * cosHalfTheta; - if (sqrSinHalfTheta <= Number.EPSILON) { const s = 1 - t; this._w = s * w + t * this._w; @@ -2536,34 +2256,28 @@ this._y = s * y + t * this._y; this._z = s * z + t * this._z; this.normalize(); - this._onChangeCallback(); - return this; } - const sinHalfTheta = Math.sqrt(sqrSinHalfTheta); const halfTheta = Math.atan2(sinHalfTheta, cosHalfTheta); const ratioA = Math.sin((1 - t) * halfTheta) / sinHalfTheta, - ratioB = Math.sin(t * halfTheta) / sinHalfTheta; + ratioB = Math.sin(t * halfTheta) / sinHalfTheta; this._w = w * ratioA + this._w * ratioB; this._x = x * ratioA + this._x * ratioB; this._y = y * ratioA + this._y * ratioB; this._z = z * ratioA + this._z * ratioB; - this._onChangeCallback(); - return this; } - slerpQuaternions(qa, qb, t) { return this.copy(qa).slerp(qb, t); } - random() { // Derived from http://planning.cs.uiuc.edu/node198.html // Note, this source uses w, x, y, z ordering, // so we swap the order below. + const u1 = Math.random(); const sqrt1u1 = Math.sqrt(1 - u1); const sqrtu1 = Math.sqrt(u1); @@ -2571,22 +2285,17 @@ const u3 = 2 * Math.PI * Math.random(); return this.set(sqrt1u1 * Math.cos(u2), sqrtu1 * Math.sin(u3), sqrtu1 * Math.cos(u3), sqrt1u1 * Math.sin(u2)); } - equals(quaternion) { return quaternion._x === this._x && quaternion._y === this._y && quaternion._z === this._z && quaternion._w === this._w; } - fromArray(array, offset = 0) { this._x = array[offset]; this._y = array[offset + 1]; this._z = array[offset + 2]; this._w = array[offset + 3]; - this._onChangeCallback(); - return this; } - toArray(array = [], offset = 0) { array[offset] = this._x; array[offset + 1] = this._y; @@ -2594,7 +2303,6 @@ array[offset + 3] = this._w; return array; } - fromBufferAttribute(attribute, index) { this._x = attribute.getX(index); this._y = attribute.getY(index); @@ -2602,16 +2310,12 @@ this._w = attribute.getW(index); return this; } - _onChange(callback) { this._onChangeCallback = callback; return this; } - _onChangeCallback() {} - } - Quaternion.prototype.isQuaternion = true; class Vector3 { @@ -2620,7 +2324,6 @@ this.y = y; this.z = z; } - set(x, y, z) { if (z === undefined) z = this.z; // sprite.scale.set(x,y) @@ -2629,193 +2332,159 @@ this.z = z; return this; } - setScalar(scalar) { this.x = scalar; this.y = scalar; this.z = scalar; return this; } - setX(x) { this.x = x; return this; } - setY(y) { this.y = y; return this; } - setZ(z) { this.z = z; return this; } - setComponent(index, value) { switch (index) { case 0: this.x = value; break; - case 1: this.y = value; break; - case 2: this.z = value; break; - default: throw new Error('index is out of range: ' + index); } - return this; } - getComponent(index) { switch (index) { case 0: return this.x; - case 1: return this.y; - case 2: return this.z; - default: throw new Error('index is out of range: ' + index); } } - clone() { return new this.constructor(this.x, this.y, this.z); } - copy(v) { this.x = v.x; this.y = v.y; this.z = v.z; return this; } - add(v, w) { if (w !== undefined) { console.warn('THREE.Vector3: .add() now only accepts one argument. Use .addVectors( a, b ) instead.'); return this.addVectors(v, w); } - this.x += v.x; this.y += v.y; this.z += v.z; return this; } - addScalar(s) { this.x += s; this.y += s; this.z += s; return this; } - addVectors(a, b) { this.x = a.x + b.x; this.y = a.y + b.y; this.z = a.z + b.z; return this; } - addScaledVector(v, s) { this.x += v.x * s; this.y += v.y * s; this.z += v.z * s; return this; } - sub(v, w) { if (w !== undefined) { console.warn('THREE.Vector3: .sub() now only accepts one argument. Use .subVectors( a, b ) instead.'); return this.subVectors(v, w); } - this.x -= v.x; this.y -= v.y; this.z -= v.z; return this; } - subScalar(s) { this.x -= s; this.y -= s; this.z -= s; return this; } - subVectors(a, b) { this.x = a.x - b.x; this.y = a.y - b.y; this.z = a.z - b.z; return this; } - multiply(v, w) { if (w !== undefined) { console.warn('THREE.Vector3: .multiply() now only accepts one argument. Use .multiplyVectors( a, b ) instead.'); return this.multiplyVectors(v, w); } - this.x *= v.x; this.y *= v.y; this.z *= v.z; return this; } - multiplyScalar(scalar) { this.x *= scalar; this.y *= scalar; this.z *= scalar; return this; } - multiplyVectors(a, b) { this.x = a.x * b.x; this.y = a.y * b.y; this.z = a.z * b.z; return this; } - applyEuler(euler) { if (!(euler && euler.isEuler)) { console.error('THREE.Vector3: .applyEuler() now expects an Euler rotation rather than a Vector3 and order.'); } - return this.applyQuaternion(_quaternion$4.setFromEuler(euler)); } - applyAxisAngle(axis, angle) { return this.applyQuaternion(_quaternion$4.setFromAxisAngle(axis, angle)); } - applyMatrix3(m) { const x = this.x, - y = this.y, - z = this.z; + y = this.y, + z = this.z; const e = m.elements; this.x = e[0] * x + e[3] * y + e[6] * z; this.y = e[1] * x + e[4] * y + e[7] * z; this.z = e[2] * x + e[5] * y + e[8] * z; return this; } - applyNormalMatrix(m) { return this.applyMatrix3(m).normalize(); } - applyMatrix4(m) { const x = this.x, - y = this.y, - z = this.z; + y = this.y, + z = this.z; const e = m.elements; const w = 1 / (e[3] * x + e[7] * y + e[11] * z + e[15]); this.x = (e[0] * x + e[4] * y + e[8] * z + e[12]) * w; @@ -2823,235 +2492,209 @@ this.z = (e[2] * x + e[6] * y + e[10] * z + e[14]) * w; return this; } - applyQuaternion(q) { const x = this.x, - y = this.y, - z = this.z; + y = this.y, + z = this.z; const qx = q.x, - qy = q.y, - qz = q.z, - qw = q.w; // calculate quat * vector + qy = q.y, + qz = q.z, + qw = q.w; + + // calculate quat * vector const ix = qw * x + qy * z - qz * y; const iy = qw * y + qz * x - qx * z; const iz = qw * z + qx * y - qy * x; - const iw = -qx * x - qy * y - qz * z; // calculate result * inverse quat + const iw = -qx * x - qy * y - qz * z; + + // calculate result * inverse quat this.x = ix * qw + iw * -qx + iy * -qz - iz * -qy; this.y = iy * qw + iw * -qy + iz * -qx - ix * -qz; this.z = iz * qw + iw * -qz + ix * -qy - iy * -qx; return this; } - project(camera) { return this.applyMatrix4(camera.matrixWorldInverse).applyMatrix4(camera.projectionMatrix); } - unproject(camera) { return this.applyMatrix4(camera.projectionMatrixInverse).applyMatrix4(camera.matrixWorld); } - transformDirection(m) { // input: THREE.Matrix4 affine matrix // vector interpreted as a direction + const x = this.x, - y = this.y, - z = this.z; + y = this.y, + z = this.z; const e = m.elements; this.x = e[0] * x + e[4] * y + e[8] * z; this.y = e[1] * x + e[5] * y + e[9] * z; this.z = e[2] * x + e[6] * y + e[10] * z; return this.normalize(); } - divide(v) { this.x /= v.x; this.y /= v.y; this.z /= v.z; return this; } - divideScalar(scalar) { return this.multiplyScalar(1 / scalar); } - min(v) { this.x = Math.min(this.x, v.x); this.y = Math.min(this.y, v.y); this.z = Math.min(this.z, v.z); return this; } - max(v) { this.x = Math.max(this.x, v.x); this.y = Math.max(this.y, v.y); this.z = Math.max(this.z, v.z); return this; } - clamp(min, max) { // assumes min < max, componentwise + this.x = Math.max(min.x, Math.min(max.x, this.x)); this.y = Math.max(min.y, Math.min(max.y, this.y)); this.z = Math.max(min.z, Math.min(max.z, this.z)); return this; } - clampScalar(minVal, maxVal) { this.x = Math.max(minVal, Math.min(maxVal, this.x)); this.y = Math.max(minVal, Math.min(maxVal, this.y)); this.z = Math.max(minVal, Math.min(maxVal, this.z)); return this; } - clampLength(min, max) { const length = this.length(); return this.divideScalar(length || 1).multiplyScalar(Math.max(min, Math.min(max, length))); } - floor() { this.x = Math.floor(this.x); this.y = Math.floor(this.y); this.z = Math.floor(this.z); return this; } - ceil() { this.x = Math.ceil(this.x); this.y = Math.ceil(this.y); this.z = Math.ceil(this.z); return this; } - round() { this.x = Math.round(this.x); this.y = Math.round(this.y); this.z = Math.round(this.z); return this; } - roundToZero() { 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); return this; } - negate() { this.x = -this.x; this.y = -this.y; this.z = -this.z; return this; } - dot(v) { return this.x * v.x + this.y * v.y + this.z * v.z; - } // TODO lengthSquared? + } + // TODO lengthSquared? 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(length) { return this.normalize().multiplyScalar(length); } - lerp(v, alpha) { this.x += (v.x - this.x) * alpha; this.y += (v.y - this.y) * alpha; this.z += (v.z - this.z) * alpha; return this; } - lerpVectors(v1, v2, alpha) { this.x = v1.x + (v2.x - v1.x) * alpha; this.y = v1.y + (v2.y - v1.y) * alpha; this.z = v1.z + (v2.z - v1.z) * alpha; return this; } - cross(v, w) { if (w !== undefined) { console.warn('THREE.Vector3: .cross() now only accepts one argument. Use .crossVectors( a, b ) instead.'); return this.crossVectors(v, w); } - return this.crossVectors(this, v); } - crossVectors(a, b) { const ax = a.x, - ay = a.y, - az = a.z; + ay = a.y, + az = a.z; const bx = b.x, - by = b.y, - bz = b.z; + by = b.y, + bz = b.z; this.x = ay * bz - az * by; this.y = az * bx - ax * bz; this.z = ax * by - ay * bx; return this; } - projectOnVector(v) { const denominator = v.lengthSq(); if (denominator === 0) return this.set(0, 0, 0); const scalar = v.dot(this) / denominator; return this.copy(v).multiplyScalar(scalar); } - projectOnPlane(planeNormal) { _vector$c.copy(this).projectOnVector(planeNormal); - return this.sub(_vector$c); } - reflect(normal) { // reflect incident vector off plane orthogonal to normal // normal is assumed to have unit length + return this.sub(_vector$c.copy(normal).multiplyScalar(2 * this.dot(normal))); } - angleTo(v) { const denominator = Math.sqrt(this.lengthSq() * v.lengthSq()); if (denominator === 0) return Math.PI / 2; - const theta = this.dot(v) / denominator; // clamp, to handle numerical problems + const theta = this.dot(v) / denominator; + + // clamp, to handle numerical problems return Math.acos(clamp(theta, -1, 1)); } - distanceTo(v) { return Math.sqrt(this.distanceToSquared(v)); } - distanceToSquared(v) { const dx = this.x - v.x, - dy = this.y - v.y, - dz = this.z - v.z; + dy = this.y - v.y, + dz = this.z - v.z; return dx * dx + dy * dy + dz * dz; } - manhattanDistanceTo(v) { return Math.abs(this.x - v.x) + Math.abs(this.y - v.y) + Math.abs(this.z - v.z); } - setFromSpherical(s) { return this.setFromSphericalCoords(s.radius, s.phi, s.theta); } - setFromSphericalCoords(radius, phi, theta) { const sinPhiRadius = Math.sin(phi) * radius; this.x = sinPhiRadius * Math.sin(theta); @@ -3059,18 +2702,15 @@ this.z = sinPhiRadius * Math.cos(theta); return this; } - setFromCylindrical(c) { return this.setFromCylindricalCoords(c.radius, c.theta, c.y); } - setFromCylindricalCoords(radius, theta, y) { this.x = radius * Math.sin(theta); this.y = y; this.z = radius * Math.cos(theta); return this; } - setFromMatrixPosition(m) { const e = m.elements; this.x = e[12]; @@ -3078,7 +2718,6 @@ this.z = e[14]; return this; } - setFromMatrixScale(m) { const sx = this.setFromMatrixColumn(m, 0).length(); const sy = this.setFromMatrixColumn(m, 1).length(); @@ -3088,53 +2727,45 @@ this.z = sz; return this; } - setFromMatrixColumn(m, index) { return this.fromArray(m.elements, index * 4); } - setFromMatrix3Column(m, index) { return this.fromArray(m.elements, index * 3); } - equals(v) { return v.x === this.x && v.y === this.y && v.z === this.z; } - fromArray(array, offset = 0) { this.x = array[offset]; this.y = array[offset + 1]; this.z = array[offset + 2]; return this; } - toArray(array = [], offset = 0) { array[offset] = this.x; array[offset + 1] = this.y; array[offset + 2] = this.z; return array; } - fromBufferAttribute(attribute, index, offset) { if (offset !== undefined) { console.warn('THREE.Vector3: offset has been removed from .fromBufferAttribute().'); } - this.x = attribute.getX(index); this.y = attribute.getY(index); this.z = attribute.getZ(index); return this; } - random() { this.x = Math.random(); this.y = Math.random(); this.z = Math.random(); return this; } - randomDirection() { // Derived from https://mathworld.wolfram.com/SpherePointPicking.html + const u = (Math.random() - 0.5) * 2; const t = Math.random() * Math.PI * 2; const f = Math.sqrt(1 - u ** 2); @@ -3143,19 +2774,14 @@ this.z = u; return this; } - *[Symbol.iterator]() { yield this.x; yield this.y; yield this.z; } - } - Vector3.prototype.isVector3 = true; - const _vector$c = /*@__PURE__*/new Vector3(); - const _quaternion$4 = /*@__PURE__*/new Quaternion(); class Box3 { @@ -3163,13 +2789,11 @@ this.min = min; this.max = max; } - set(min, max) { this.min.copy(min); this.max.copy(max); return this; } - setFromArray(array) { let minX = +Infinity; let minY = +Infinity; @@ -3177,7 +2801,6 @@ let maxX = -Infinity; let maxY = -Infinity; let maxZ = -Infinity; - for (let i = 0, l = array.length; i < l; i += 3) { const x = array[i]; const y = array[i + 1]; @@ -3189,12 +2812,10 @@ if (y > maxY) maxY = y; if (z > maxZ) maxZ = z; } - this.min.set(minX, minY, minZ); this.max.set(maxX, maxY, maxZ); return this; } - setFromBufferAttribute(attribute) { let minX = +Infinity; let minY = +Infinity; @@ -3202,7 +2823,6 @@ let maxX = -Infinity; let maxY = -Infinity; let maxZ = -Infinity; - for (let i = 0, l = attribute.count; i < l; i++) { const x = attribute.getX(i); const y = attribute.getY(i); @@ -3214,150 +2834,122 @@ if (y > maxY) maxY = y; if (z > maxZ) maxZ = z; } - this.min.set(minX, minY, minZ); this.max.set(maxX, maxY, maxZ); return this; } - setFromPoints(points) { this.makeEmpty(); - for (let i = 0, il = points.length; i < il; i++) { this.expandByPoint(points[i]); } - return this; } - setFromCenterAndSize(center, size) { const halfSize = _vector$b.copy(size).multiplyScalar(0.5); - this.min.copy(center).sub(halfSize); this.max.copy(center).add(halfSize); return this; } - setFromObject(object, precise = false) { this.makeEmpty(); return this.expandByObject(object, precise); } - clone() { return new this.constructor().copy(this); } - copy(box) { this.min.copy(box.min); this.max.copy(box.max); return this; } - makeEmpty() { this.min.x = this.min.y = this.min.z = +Infinity; this.max.x = this.max.y = this.max.z = -Infinity; return this; } - isEmpty() { // this is a more robust check for empty than ( volume <= 0 ) because volume can get positive with two negative axes + return this.max.x < this.min.x || this.max.y < this.min.y || this.max.z < this.min.z; } - getCenter(target) { return this.isEmpty() ? target.set(0, 0, 0) : target.addVectors(this.min, this.max).multiplyScalar(0.5); } - getSize(target) { return this.isEmpty() ? target.set(0, 0, 0) : target.subVectors(this.max, this.min); } - expandByPoint(point) { this.min.min(point); this.max.max(point); return this; } - expandByVector(vector) { this.min.sub(vector); this.max.add(vector); return this; } - expandByScalar(scalar) { this.min.addScalar(-scalar); this.max.addScalar(scalar); return this; } - expandByObject(object, precise = false) { // Computes the world-axis-aligned bounding box of an object (including its children), // accounting for both the object's, and children's, world transforms + object.updateWorldMatrix(false, false); const geometry = object.geometry; - if (geometry !== undefined) { if (precise && geometry.attributes != undefined && geometry.attributes.position !== undefined) { const position = geometry.attributes.position; - for (let i = 0, l = position.count; i < l; i++) { _vector$b.fromBufferAttribute(position, i).applyMatrix4(object.matrixWorld); - this.expandByPoint(_vector$b); } } else { if (geometry.boundingBox === null) { geometry.computeBoundingBox(); } - _box$4.copy(geometry.boundingBox); - _box$4.applyMatrix4(object.matrixWorld); - this.union(_box$4); } } - const children = object.children; - for (let i = 0, l = children.length; i < l; i++) { this.expandByObject(children[i], precise); } - return this; } - containsPoint(point) { return point.x < this.min.x || point.x > this.max.x || point.y < this.min.y || point.y > this.max.y || point.z < this.min.z || point.z > this.max.z ? false : true; } - containsBox(box) { return this.min.x <= box.min.x && box.max.x <= this.max.x && this.min.y <= box.min.y && box.max.y <= this.max.y && this.min.z <= box.min.z && box.max.z <= this.max.z; } - getParameter(point, target) { // This can potentially have a divide by zero if the box // has a size dimension of 0. + return target.set((point.x - this.min.x) / (this.max.x - this.min.x), (point.y - this.min.y) / (this.max.y - this.min.y), (point.z - this.min.z) / (this.max.z - this.min.z)); } - intersectsBox(box) { // using 6 splitting planes to rule out intersections. return box.max.x < this.min.x || box.min.x > this.max.x || box.max.y < this.min.y || box.min.y > this.max.y || box.max.z < this.min.z || box.min.z > this.max.z ? false : true; } - intersectsSphere(sphere) { // Find the point on the AABB closest to the sphere center. - this.clampPoint(sphere.center, _vector$b); // If that point is inside the sphere, the AABB and sphere intersect. + this.clampPoint(sphere.center, _vector$b); + // If that point is inside the sphere, the AABB and sphere intersect. return _vector$b.distanceToSquared(sphere.center) <= sphere.radius * sphere.radius; } - intersectsPlane(plane) { // We compute the minimum and maximum dot product values. If those values // are on the same side (back or front) of the plane, then there is no intersection. - let min, max; + let min, max; if (plane.normal.x > 0) { min = plane.normal.x * this.min.x; max = plane.normal.x * this.max.x; @@ -3365,7 +2957,6 @@ min = plane.normal.x * this.max.x; max = plane.normal.x * this.min.x; } - if (plane.normal.y > 0) { min += plane.normal.y * this.min.y; max += plane.normal.y * this.max.y; @@ -3373,7 +2964,6 @@ min += plane.normal.y * this.max.y; max += plane.normal.y * this.min.y; } - if (plane.normal.z > 0) { min += plane.normal.z * this.min.z; max += plane.normal.z * this.max.z; @@ -3381,412 +2971,319 @@ min += plane.normal.z * this.max.z; max += plane.normal.z * this.min.z; } - return min <= -plane.constant && max >= -plane.constant; } - intersectsTriangle(triangle) { if (this.isEmpty()) { return false; - } // compute box center and extents - + } + // compute box center and extents this.getCenter(_center); + _extents.subVectors(this.max, _center); - _extents.subVectors(this.max, _center); // translate triangle to aabb origin - - + // translate triangle to aabb origin _v0$2.subVectors(triangle.a, _center); - _v1$7.subVectors(triangle.b, _center); + _v2$3.subVectors(triangle.c, _center); - _v2$3.subVectors(triangle.c, _center); // compute edge vectors for triangle - - + // compute edge vectors for triangle _f0.subVectors(_v1$7, _v0$2); - _f1.subVectors(_v2$3, _v1$7); + _f2.subVectors(_v0$2, _v2$3); - _f2.subVectors(_v0$2, _v2$3); // test against axes that are given by cross product combinations of the edges of the triangle and the edges of the aabb + // test against axes that are given by cross product combinations of the edges of the triangle and the edges of the aabb // make an axis testing of each of the 3 sides of the aabb against each of the 3 sides of the triangle = 9 axis of separation // axis_ij = u_i x f_j (u0, u1, u2 = face normals of aabb = x,y,z axes vectors since aabb is axis aligned) - - let axes = [0, -_f0.z, _f0.y, 0, -_f1.z, _f1.y, 0, -_f2.z, _f2.y, _f0.z, 0, -_f0.x, _f1.z, 0, -_f1.x, _f2.z, 0, -_f2.x, -_f0.y, _f0.x, 0, -_f1.y, _f1.x, 0, -_f2.y, _f2.x, 0]; - if (!satForAxes(axes, _v0$2, _v1$7, _v2$3, _extents)) { return false; - } // test 3 face normals from the aabb - + } + // test 3 face normals from the aabb axes = [1, 0, 0, 0, 1, 0, 0, 0, 1]; - if (!satForAxes(axes, _v0$2, _v1$7, _v2$3, _extents)) { return false; - } // finally testing the face normal of the triangle - // use already existing triangle edge vectors here - + } + // finally testing the face normal of the triangle + // use already existing triangle edge vectors here _triangleNormal.crossVectors(_f0, _f1); - axes = [_triangleNormal.x, _triangleNormal.y, _triangleNormal.z]; return satForAxes(axes, _v0$2, _v1$7, _v2$3, _extents); } - clampPoint(point, target) { return target.copy(point).clamp(this.min, this.max); } - distanceToPoint(point) { const clampedPoint = _vector$b.copy(point).clamp(this.min, this.max); - return clampedPoint.sub(point).length(); } - getBoundingSphere(target) { this.getCenter(target.center); target.radius = this.getSize(_vector$b).length() * 0.5; return target; } - intersect(box) { this.min.max(box.min); - this.max.min(box.max); // ensure that if there is no overlap, the result is fully empty, not slightly empty with non-inf/+inf values that will cause subsequence intersects to erroneously return valid values. + this.max.min(box.max); + // ensure that if there is no overlap, the result is fully empty, not slightly empty with non-inf/+inf values that will cause subsequence intersects to erroneously return valid values. if (this.isEmpty()) this.makeEmpty(); return this; } - union(box) { this.min.min(box.min); this.max.max(box.max); return this; } - applyMatrix4(matrix) { // transform of empty box is an empty box. - if (this.isEmpty()) return this; // NOTE: I am using a binary pattern to specify all 2^3 combinations below + if (this.isEmpty()) return this; + // NOTE: I am using a binary pattern to specify all 2^3 combinations below _points[0].set(this.min.x, this.min.y, this.min.z).applyMatrix4(matrix); // 000 - - _points[1].set(this.min.x, this.min.y, this.max.z).applyMatrix4(matrix); // 001 - - _points[2].set(this.min.x, this.max.y, this.min.z).applyMatrix4(matrix); // 010 - - _points[3].set(this.min.x, this.max.y, this.max.z).applyMatrix4(matrix); // 011 - - _points[4].set(this.max.x, this.min.y, this.min.z).applyMatrix4(matrix); // 100 - - _points[5].set(this.max.x, this.min.y, this.max.z).applyMatrix4(matrix); // 101 - - _points[6].set(this.max.x, this.max.y, this.min.z).applyMatrix4(matrix); // 110 - - _points[7].set(this.max.x, this.max.y, this.max.z).applyMatrix4(matrix); // 111 - this.setFromPoints(_points); return this; } - translate(offset) { this.min.add(offset); this.max.add(offset); return this; } - equals(box) { return box.min.equals(this.min) && box.max.equals(this.max); } - } - Box3.prototype.isBox3 = true; const _points = [/*@__PURE__*/new Vector3(), /*@__PURE__*/new Vector3(), /*@__PURE__*/new Vector3(), /*@__PURE__*/new Vector3(), /*@__PURE__*/new Vector3(), /*@__PURE__*/new Vector3(), /*@__PURE__*/new Vector3(), /*@__PURE__*/new Vector3()]; - const _vector$b = /*@__PURE__*/new Vector3(); + const _box$4 = /*@__PURE__*/new Box3(); - const _box$4 = /*@__PURE__*/new Box3(); // triangle centered vertices - + // triangle centered vertices const _v0$2 = /*@__PURE__*/new Vector3(); - const _v1$7 = /*@__PURE__*/new Vector3(); + const _v2$3 = /*@__PURE__*/new Vector3(); - const _v2$3 = /*@__PURE__*/new Vector3(); // triangle edge vectors - + // triangle edge vectors const _f0 = /*@__PURE__*/new Vector3(); - const _f1 = /*@__PURE__*/new Vector3(); - const _f2 = /*@__PURE__*/new Vector3(); - const _center = /*@__PURE__*/new Vector3(); - const _extents = /*@__PURE__*/new Vector3(); - const _triangleNormal = /*@__PURE__*/new Vector3(); - const _testAxis = /*@__PURE__*/new Vector3(); - function satForAxes(axes, v0, v1, v2, extents) { for (let i = 0, j = axes.length - 3; i <= j; i += 3) { - _testAxis.fromArray(axes, i); // project the aabb onto the seperating axis - - - const r = extents.x * Math.abs(_testAxis.x) + extents.y * Math.abs(_testAxis.y) + extents.z * Math.abs(_testAxis.z); // project all 3 vertices of the triangle onto the seperating axis - + _testAxis.fromArray(axes, i); + // project the aabb onto the seperating axis + const r = extents.x * Math.abs(_testAxis.x) + extents.y * Math.abs(_testAxis.y) + extents.z * Math.abs(_testAxis.z); + // project all 3 vertices of the triangle onto the seperating axis const p0 = v0.dot(_testAxis); const p1 = v1.dot(_testAxis); - const p2 = v2.dot(_testAxis); // actual test, basically see if either of the most extreme of the triangle points intersects r - + const p2 = v2.dot(_testAxis); + // actual test, basically see if either of the most extreme of the triangle points intersects r if (Math.max(-Math.max(p0, p1, p2), Math.min(p0, p1, p2)) > r) { // points of the projected triangle are outside the projected half-length of the aabb // the axis is seperating and we can exit return false; } } - return true; } const _box$3 = /*@__PURE__*/new Box3(); - const _v1$6 = /*@__PURE__*/new Vector3(); - const _toFarthestPoint = /*@__PURE__*/new Vector3(); - const _toPoint = /*@__PURE__*/new Vector3(); - class Sphere { constructor(center = new Vector3(), radius = -1) { this.center = center; this.radius = radius; } - set(center, radius) { this.center.copy(center); this.radius = radius; return this; } - setFromPoints(points, optionalCenter) { const center = this.center; - if (optionalCenter !== undefined) { center.copy(optionalCenter); } else { _box$3.setFromPoints(points).getCenter(center); } - let maxRadiusSq = 0; - for (let i = 0, il = points.length; i < il; i++) { maxRadiusSq = Math.max(maxRadiusSq, center.distanceToSquared(points[i])); } - this.radius = Math.sqrt(maxRadiusSq); return this; } - copy(sphere) { this.center.copy(sphere.center); this.radius = sphere.radius; return this; } - isEmpty() { return this.radius < 0; } - makeEmpty() { this.center.set(0, 0, 0); this.radius = -1; return this; } - containsPoint(point) { return point.distanceToSquared(this.center) <= this.radius * this.radius; } - distanceToPoint(point) { return point.distanceTo(this.center) - this.radius; } - intersectsSphere(sphere) { const radiusSum = this.radius + sphere.radius; return sphere.center.distanceToSquared(this.center) <= radiusSum * radiusSum; } - intersectsBox(box) { return box.intersectsSphere(this); } - intersectsPlane(plane) { return Math.abs(plane.distanceToPoint(this.center)) <= this.radius; } - clampPoint(point, target) { const deltaLengthSq = this.center.distanceToSquared(point); target.copy(point); - if (deltaLengthSq > this.radius * this.radius) { target.sub(this.center).normalize(); target.multiplyScalar(this.radius).add(this.center); } - return target; } - getBoundingBox(target) { if (this.isEmpty()) { // Empty sphere produces empty bounding box target.makeEmpty(); return target; } - target.set(this.center, this.center); target.expandByScalar(this.radius); return target; } - applyMatrix4(matrix) { this.center.applyMatrix4(matrix); this.radius = this.radius * matrix.getMaxScaleOnAxis(); return this; } - translate(offset) { this.center.add(offset); return this; } - expandByPoint(point) { // from https://github.com/juj/MathGeoLib/blob/2940b99b99cfe575dd45103ef20f4019dee15b54/src/Geometry/Sphere.cpp#L649-L671 - _toPoint.subVectors(point, this.center); + _toPoint.subVectors(point, this.center); const lengthSq = _toPoint.lengthSq(); - if (lengthSq > this.radius * this.radius) { const length = Math.sqrt(lengthSq); - const missingRadiusHalf = (length - this.radius) * 0.5; // Nudge this sphere towards the target point. Add half the missing distance to radius, + const missingRadiusHalf = (length - this.radius) * 0.5; + + // Nudge this sphere towards the target point. Add half the missing distance to radius, // and the other half to position. This gives a tighter enclosure, instead of if // the whole missing distance were just added to radius. this.center.add(_toPoint.multiplyScalar(missingRadiusHalf / length)); this.radius += missingRadiusHalf; } - return this; } - union(sphere) { // from https://github.com/juj/MathGeoLib/blob/2940b99b99cfe575dd45103ef20f4019dee15b54/src/Geometry/Sphere.cpp#L759-L769 + // To enclose another sphere into this sphere, we only need to enclose two points: // 1) Enclose the farthest point on the other sphere into this sphere. // 2) Enclose the opposite point of the farthest point into this sphere. + if (this.center.equals(sphere.center) === true) { _toFarthestPoint.set(0, 0, 1).multiplyScalar(sphere.radius); } else { _toFarthestPoint.subVectors(sphere.center, this.center).normalize().multiplyScalar(sphere.radius); } - this.expandByPoint(_v1$6.copy(sphere.center).add(_toFarthestPoint)); this.expandByPoint(_v1$6.copy(sphere.center).sub(_toFarthestPoint)); return this; } - equals(sphere) { return sphere.center.equals(this.center) && sphere.radius === this.radius; } - clone() { return new this.constructor().copy(this); } - } const _vector$a = /*@__PURE__*/new Vector3(); - const _segCenter = /*@__PURE__*/new Vector3(); - const _segDir = /*@__PURE__*/new Vector3(); - const _diff = /*@__PURE__*/new Vector3(); - const _edge1 = /*@__PURE__*/new Vector3(); - const _edge2 = /*@__PURE__*/new Vector3(); - const _normal$1 = /*@__PURE__*/new Vector3(); - class Ray { constructor(origin = new Vector3(), direction = new Vector3(0, 0, -1)) { this.origin = origin; this.direction = direction; } - set(origin, direction) { this.origin.copy(origin); this.direction.copy(direction); return this; } - copy(ray) { this.origin.copy(ray.origin); this.direction.copy(ray.direction); return this; } - at(t, target) { return target.copy(this.direction).multiplyScalar(t).add(this.origin); } - lookAt(v) { this.direction.copy(v).sub(this.origin).normalize(); return this; } - recast(t) { this.origin.copy(this.at(t, _vector$a)); return this; } - closestPointToPoint(point, target) { target.subVectors(point, this.origin); const directionDistance = target.dot(this.direction); - if (directionDistance < 0) { return target.copy(this.origin); } - return target.copy(this.direction).multiplyScalar(directionDistance).add(this.origin); } - distanceToPoint(point) { return Math.sqrt(this.distanceSqToPoint(point)); } - distanceSqToPoint(point) { - const directionDistance = _vector$a.subVectors(point, this.origin).dot(this.direction); // point behind the ray + const directionDistance = _vector$a.subVectors(point, this.origin).dot(this.direction); + // point behind the ray if (directionDistance < 0) { return this.origin.distanceToSquared(point); } - _vector$a.copy(this.direction).multiplyScalar(directionDistance).add(this.origin); - return _vector$a.distanceToSquared(point); } - distanceSqToSegment(v0, v1, optionalPointOnRay, optionalPointOnSegment) { // from https://github.com/pmjoniak/GeometricTools/blob/master/GTEngine/Include/Mathematics/GteDistRaySegment.h // It returns the min distance between the ray and the segment @@ -3794,47 +3291,43 @@ // It can also set two optional targets : // - The closest point on the ray // - The closest point on the segment - _segCenter.copy(v0).add(v1).multiplyScalar(0.5); + _segCenter.copy(v0).add(v1).multiplyScalar(0.5); _segDir.copy(v1).sub(v0).normalize(); - _diff.copy(this.origin).sub(_segCenter); - const segExtent = v0.distanceTo(v1) * 0.5; const a01 = -this.direction.dot(_segDir); - const b0 = _diff.dot(this.direction); - const b1 = -_diff.dot(_segDir); - const c = _diff.lengthSq(); - const det = Math.abs(1 - a01 * a01); let s0, s1, sqrDist, extDet; - if (det > 0) { // The ray and segment are not parallel. + s0 = a01 * b1 - b0; s1 = a01 * b0 - b1; extDet = segExtent * det; - if (s0 >= 0) { if (s1 >= -extDet) { if (s1 <= extDet) { // region 0 // Minimum at interior points of ray and segment. + const invDet = 1 / det; s0 *= invDet; s1 *= invDet; sqrDist = s0 * (s0 + a01 * s1 + 2 * b0) + s1 * (a01 * s0 + s1 + 2 * b1) + c; } else { // region 1 + s1 = segExtent; s0 = Math.max(0, -(a01 * s1 + b0)); sqrDist = -s0 * s0 + s1 * (s1 + 2 * b1) + c; } } else { // region 5 + s1 = -segExtent; s0 = Math.max(0, -(a01 * s1 + b0)); sqrDist = -s0 * s0 + s1 * (s1 + 2 * b1) + c; @@ -3842,16 +3335,19 @@ } else { if (s1 <= -extDet) { // region 4 + s0 = Math.max(0, -(-a01 * segExtent + b0)); s1 = s0 > 0 ? -segExtent : Math.min(Math.max(-segExtent, -b1), segExtent); sqrDist = -s0 * s0 + s1 * (s1 + 2 * b1) + c; } else if (s1 <= extDet) { // region 3 + s0 = 0; s1 = Math.min(Math.max(-segExtent, -b1), segExtent); sqrDist = s1 * (s1 + 2 * b1) + c; } else { // region 2 + s0 = Math.max(0, -(a01 * segExtent + b0)); s1 = s0 > 0 ? segExtent : Math.min(Math.max(-segExtent, -b1), segExtent); sqrDist = -s0 * s0 + s1 * (s1 + 2 * b1) + c; @@ -3859,102 +3355,94 @@ } } else { // Ray and segment are parallel. + s1 = a01 > 0 ? -segExtent : segExtent; s0 = Math.max(0, -(a01 * s1 + b0)); sqrDist = -s0 * s0 + s1 * (s1 + 2 * b1) + c; } - if (optionalPointOnRay) { optionalPointOnRay.copy(this.direction).multiplyScalar(s0).add(this.origin); } - if (optionalPointOnSegment) { optionalPointOnSegment.copy(_segDir).multiplyScalar(s1).add(_segCenter); } - return sqrDist; } - intersectSphere(sphere, target) { _vector$a.subVectors(sphere.center, this.origin); - const tca = _vector$a.dot(this.direction); - const d2 = _vector$a.dot(_vector$a) - tca * tca; const radius2 = sphere.radius * sphere.radius; if (d2 > radius2) return null; - const thc = Math.sqrt(radius2 - d2); // t0 = first intersect point - entrance on front of sphere + const thc = Math.sqrt(radius2 - d2); + + // t0 = first intersect point - entrance on front of sphere + const t0 = tca - thc; - const t0 = tca - thc; // t1 = second intersect point - exit point on back of sphere + // t1 = second intersect point - exit point on back of sphere + const t1 = tca + thc; - const t1 = tca + thc; // test to see if both t0 and t1 are behind the ray - if so, return null + // test to see if both t0 and t1 are behind the ray - if so, return null + if (t0 < 0 && t1 < 0) return null; - if (t0 < 0 && t1 < 0) return null; // test to see if t0 is behind the ray: + // test to see if t0 is behind the ray: // if it is, the ray is inside the sphere, so return the second exit point scaled by t1, // in order to always return an intersect point that is in front of the ray. + if (t0 < 0) return this.at(t1, target); - if (t0 < 0) return this.at(t1, target); // else t0 is in front of the ray, so return the first collision point scaled by t0 - + // else t0 is in front of the ray, so return the first collision point scaled by t0 return this.at(t0, target); } - intersectsSphere(sphere) { return this.distanceSqToPoint(sphere.center) <= sphere.radius * sphere.radius; } - distanceToPlane(plane) { const denominator = plane.normal.dot(this.direction); - if (denominator === 0) { // line is coplanar, return origin if (plane.distanceToPoint(this.origin) === 0) { return 0; - } // Null is preferable to undefined since undefined means.... it is undefined + } + // Null is preferable to undefined since undefined means.... it is undefined return null; } + const t = -(this.origin.dot(plane.normal) + plane.constant) / denominator; - const t = -(this.origin.dot(plane.normal) + plane.constant) / denominator; // Return if the ray never intersects the plane + // Return if the ray never intersects the plane return t >= 0 ? t : null; } - intersectPlane(plane, target) { const t = this.distanceToPlane(plane); - if (t === null) { return null; } - return this.at(t, target); } - intersectsPlane(plane) { // check if the ray lies on the plane first - const distToPoint = plane.distanceToPoint(this.origin); + const distToPoint = plane.distanceToPoint(this.origin); if (distToPoint === 0) { return true; } - const denominator = plane.normal.dot(this.direction); - if (denominator * distToPoint < 0) { return true; - } // ray origin is behind the plane (and is pointing behind it) + } + // ray origin is behind the plane (and is pointing behind it) return false; } - intersectBox(box, target) { let tmin, tmax, tymin, tymax, tzmin, tzmax; const invdirx = 1 / this.direction.x, - invdiry = 1 / this.direction.y, - invdirz = 1 / this.direction.z; + invdiry = 1 / this.direction.y, + invdirz = 1 / this.direction.z; const origin = this.origin; - if (invdirx >= 0) { tmin = (box.min.x - origin.x) * invdirx; tmax = (box.max.x - origin.x) * invdirx; @@ -3962,7 +3450,6 @@ tmin = (box.max.x - origin.x) * invdirx; tmax = (box.min.x - origin.x) * invdirx; } - if (invdiry >= 0) { tymin = (box.min.y - origin.y) * invdiry; tymax = (box.max.y - origin.y) * invdiry; @@ -3970,13 +3457,13 @@ tymin = (box.max.y - origin.y) * invdiry; tymax = (box.min.y - origin.y) * invdiry; } + if (tmin > tymax || tymin > tmax) return null; - if (tmin > tymax || tymin > tmax) return null; // These lines also handle the case where tmin or tmax is NaN + // These lines also handle the case where tmin or tmax is NaN // (result of 0 * Infinity). x !== x returns true if x is NaN if (tymin > tmin || tmin !== tmin) tmin = tymin; if (tymax < tmax || tmax !== tmax) tmax = tymax; - if (invdirz >= 0) { tzmin = (box.min.z - origin.z) * invdirz; tzmax = (box.max.z - origin.z) * invdirz; @@ -3984,36 +3471,34 @@ tzmin = (box.max.z - origin.z) * invdirz; tzmax = (box.min.z - origin.z) * invdirz; } - if (tmin > tzmax || tzmin > tmax) return null; if (tzmin > tmin || tmin !== tmin) tmin = tzmin; - if (tzmax < tmax || tmax !== tmax) tmax = tzmax; //return point closest to the ray (positive side) + if (tzmax < tmax || tmax !== tmax) tmax = tzmax; + + //return point closest to the ray (positive side) if (tmax < 0) return null; return this.at(tmin >= 0 ? tmin : tmax, target); } - intersectsBox(box) { return this.intersectBox(box, _vector$a) !== null; } - intersectTriangle(a, b, c, backfaceCulling, target) { // Compute the offset origin, edges, and normal. + // from https://github.com/pmjoniak/GeometricTools/blob/master/GTEngine/Include/Mathematics/GteIntrRay3Triangle3.h - _edge1.subVectors(b, a); + _edge1.subVectors(b, a); _edge2.subVectors(c, a); + _normal$1.crossVectors(_edge1, _edge2); - _normal$1.crossVectors(_edge1, _edge2); // Solve Q + t*D = b1*E1 + b2*E2 (Q = kDiff, D = ray direction, + // Solve Q + t*D = b1*E1 + b2*E2 (Q = kDiff, D = ray direction, // E1 = kEdge1, E2 = kEdge2, N = Cross(E1,E2)) by // |Dot(D,N)|*b1 = sign(Dot(D,N))*Dot(D,Cross(Q,E2)) // |Dot(D,N)|*b2 = sign(Dot(D,N))*Dot(D,Cross(E1,Q)) // |Dot(D,N)|*t = -sign(Dot(D,N))*Dot(Q,N) - - let DdN = this.direction.dot(_normal$1); let sign; - if (DdN > 0) { if (backfaceCulling) return null; sign = 1; @@ -4023,63 +3508,56 @@ } else { return null; } - _diff.subVectors(this.origin, a); + const DdQxE2 = sign * this.direction.dot(_edge2.crossVectors(_diff, _edge2)); - const DdQxE2 = sign * this.direction.dot(_edge2.crossVectors(_diff, _edge2)); // b1 < 0, no intersection - + // b1 < 0, no intersection if (DdQxE2 < 0) { return null; } + const DdE1xQ = sign * this.direction.dot(_edge1.cross(_diff)); - const DdE1xQ = sign * this.direction.dot(_edge1.cross(_diff)); // b2 < 0, no intersection - + // b2 < 0, no intersection if (DdE1xQ < 0) { return null; - } // b1+b2 > 1, no intersection - + } + // b1+b2 > 1, no intersection if (DdQxE2 + DdE1xQ > DdN) { return null; - } // Line intersects triangle, check if ray does. - - - const QdN = -sign * _diff.dot(_normal$1); // t < 0, no intersection + } + // Line intersects triangle, check if ray does. + const QdN = -sign * _diff.dot(_normal$1); + // t < 0, no intersection if (QdN < 0) { return null; - } // Ray intersects triangle. - + } + // Ray intersects triangle. return this.at(QdN / DdN, target); } - applyMatrix4(matrix4) { this.origin.applyMatrix4(matrix4); this.direction.transformDirection(matrix4); return this; } - equals(ray) { return ray.origin.equals(this.origin) && ray.direction.equals(this.direction); } - clone() { return new this.constructor().copy(this); } - } class Matrix4 { constructor() { this.elements = [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1]; - if (arguments.length > 0) { console.error('THREE.Matrix4: the constructor no longer reads arguments. use .set() instead.'); } } - set(n11, n12, n13, n14, n21, n22, n23, n24, n31, n32, n33, n34, n41, n42, n43, n44) { const te = this.elements; te[0] = n11; @@ -4100,16 +3578,13 @@ te[15] = n44; return this; } - identity() { this.set(1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1); return this; } - clone() { return new Matrix4().fromArray(this.elements); } - copy(m) { const te = this.elements; const me = m.elements; @@ -4131,45 +3606,37 @@ te[15] = me[15]; return this; } - copyPosition(m) { const te = this.elements, - me = m.elements; + me = m.elements; te[12] = me[12]; te[13] = me[13]; te[14] = me[14]; return this; } - setFromMatrix3(m) { const me = m.elements; this.set(me[0], me[3], me[6], 0, me[1], me[4], me[7], 0, me[2], me[5], me[8], 0, 0, 0, 0, 1); return this; } - extractBasis(xAxis, yAxis, zAxis) { xAxis.setFromMatrixColumn(this, 0); yAxis.setFromMatrixColumn(this, 1); zAxis.setFromMatrixColumn(this, 2); return this; } - makeBasis(xAxis, yAxis, zAxis) { this.set(xAxis.x, yAxis.x, zAxis.x, 0, xAxis.y, yAxis.y, zAxis.y, 0, xAxis.z, yAxis.z, zAxis.z, 0, 0, 0, 0, 1); return this; } - extractRotation(m) { // this method does not support reflection matrices + const te = this.elements; const me = m.elements; - const scaleX = 1 / _v1$5.setFromMatrixColumn(m, 0).length(); - const scaleY = 1 / _v1$5.setFromMatrixColumn(m, 1).length(); - const scaleZ = 1 / _v1$5.setFromMatrixColumn(m, 2).length(); - te[0] = me[0] * scaleX; te[1] = me[1] * scaleX; te[2] = me[2] * scaleX; @@ -4188,28 +3655,25 @@ te[15] = 1; return this; } - makeRotationFromEuler(euler) { if (!(euler && euler.isEuler)) { console.error('THREE.Matrix4: .makeRotationFromEuler() now expects a Euler rotation rather than a Vector3 and order.'); } - const te = this.elements; const x = euler.x, - y = euler.y, - z = euler.z; + y = euler.y, + z = euler.z; const a = Math.cos(x), - b = Math.sin(x); + b = Math.sin(x); const c = Math.cos(y), - d = Math.sin(y); + d = Math.sin(y); const e = Math.cos(z), - f = Math.sin(z); - + f = Math.sin(z); if (euler.order === 'XYZ') { const ae = a * e, - af = a * f, - be = b * e, - bf = b * f; + af = a * f, + be = b * e, + bf = b * f; te[0] = c * e; te[4] = -c * f; te[8] = d; @@ -4221,9 +3685,9 @@ te[10] = a * c; } else if (euler.order === 'YXZ') { const ce = c * e, - cf = c * f, - de = d * e, - df = d * f; + cf = c * f, + de = d * e, + df = d * f; te[0] = ce + df * b; te[4] = de * b - cf; te[8] = a * d; @@ -4235,9 +3699,9 @@ te[10] = a * c; } else if (euler.order === 'ZXY') { const ce = c * e, - cf = c * f, - de = d * e, - df = d * f; + cf = c * f, + de = d * e, + df = d * f; te[0] = ce - df * b; te[4] = -a * f; te[8] = de + cf * b; @@ -4249,9 +3713,9 @@ te[10] = a * c; } else if (euler.order === 'ZYX') { const ae = a * e, - af = a * f, - be = b * e, - bf = b * f; + af = a * f, + be = b * e, + bf = b * f; te[0] = c * e; te[4] = be * d - af; te[8] = ae * d + bf; @@ -4263,9 +3727,9 @@ te[10] = a * c; } else if (euler.order === 'YZX') { const ac = a * c, - ad = a * d, - bc = b * c, - bd = b * d; + ad = a * d, + bc = b * c, + bd = b * d; te[0] = c * e; te[4] = bd - ac * f; te[8] = bc * f + ad; @@ -4277,9 +3741,9 @@ te[10] = ac - bd * f; } else if (euler.order === 'XZY') { const ac = a * c, - ad = a * d, - bc = b * c, - bd = b * d; + ad = a * d, + bc = b * c, + bd = b * d; te[0] = c * e; te[4] = -f; te[8] = d * e; @@ -4289,55 +3753,46 @@ te[2] = bc * f - ad; te[6] = b * e; te[10] = bd * f + ac; - } // bottom row - + } + // bottom row te[3] = 0; te[7] = 0; - te[11] = 0; // last column + te[11] = 0; + // last column te[12] = 0; te[13] = 0; te[14] = 0; te[15] = 1; return this; } - makeRotationFromQuaternion(q) { return this.compose(_zero, q, _one); } - lookAt(eye, target, up) { const te = this.elements; - _z.subVectors(eye, target); - if (_z.lengthSq() === 0) { // eye and target are in the same position + _z.z = 1; } - _z.normalize(); - _x.crossVectors(up, _z); - if (_x.lengthSq() === 0) { // up and z are parallel + if (Math.abs(up.z) === 1) { _z.x += 0.0001; } else { _z.z += 0.0001; } - _z.normalize(); - _x.crossVectors(up, _z); } - _x.normalize(); - _y.crossVectors(_z, _x); - te[0] = _x.x; te[4] = _y.x; te[8] = _z.x; @@ -4349,56 +3804,52 @@ te[10] = _z.z; return this; } - multiply(m, n) { if (n !== undefined) { console.warn('THREE.Matrix4: .multiply() now only accepts one argument. Use .multiplyMatrices( a, b ) instead.'); return this.multiplyMatrices(m, n); } - return this.multiplyMatrices(this, m); } - premultiply(m) { return this.multiplyMatrices(m, this); } - multiplyMatrices(a, b) { const ae = a.elements; const be = b.elements; const te = this.elements; const a11 = ae[0], - a12 = ae[4], - a13 = ae[8], - a14 = ae[12]; + a12 = ae[4], + a13 = ae[8], + a14 = ae[12]; const a21 = ae[1], - a22 = ae[5], - a23 = ae[9], - a24 = ae[13]; + a22 = ae[5], + a23 = ae[9], + a24 = ae[13]; const a31 = ae[2], - a32 = ae[6], - a33 = ae[10], - a34 = ae[14]; + a32 = ae[6], + a33 = ae[10], + a34 = ae[14]; const a41 = ae[3], - a42 = ae[7], - a43 = ae[11], - a44 = ae[15]; + a42 = ae[7], + a43 = ae[11], + a44 = ae[15]; const b11 = be[0], - b12 = be[4], - b13 = be[8], - b14 = be[12]; + b12 = be[4], + b13 = be[8], + b14 = be[12]; const b21 = be[1], - b22 = be[5], - b23 = be[9], - b24 = be[13]; + b22 = be[5], + b23 = be[9], + b24 = be[13]; const b31 = be[2], - b32 = be[6], - b33 = be[10], - b34 = be[14]; + b32 = be[6], + b33 = be[10], + b34 = be[14]; const b41 = be[3], - b42 = be[7], - b43 = be[11], - b44 = be[15]; + b42 = be[7], + b43 = be[11], + b44 = be[15]; te[0] = a11 * b11 + a12 * b21 + a13 * b31 + a14 * b41; te[4] = a11 * b12 + a12 * b22 + a13 * b32 + a14 * b42; te[8] = a11 * b13 + a12 * b23 + a13 * b33 + a14 * b43; @@ -4417,7 +3868,6 @@ te[15] = a41 * b14 + a42 * b24 + a43 * b34 + a44 * b44; return this; } - multiplyScalar(s) { const te = this.elements; te[0] *= s; @@ -4438,30 +3888,30 @@ te[15] *= s; return this; } - determinant() { const te = this.elements; const n11 = te[0], - n12 = te[4], - n13 = te[8], - n14 = te[12]; + n12 = te[4], + n13 = te[8], + n14 = te[12]; const n21 = te[1], - n22 = te[5], - n23 = te[9], - n24 = te[13]; + n22 = te[5], + n23 = te[9], + n24 = te[13]; const n31 = te[2], - n32 = te[6], - n33 = te[10], - n34 = te[14]; + n32 = te[6], + n33 = te[10], + n34 = te[14]; const n41 = te[3], - n42 = te[7], - n43 = te[11], - n44 = te[15]; //TODO: make this more efficient + n42 = te[7], + n43 = te[11], + n44 = te[15]; + + //TODO: make this more efficient //( based on http://www.euclideanspace.com/maths/algebra/matrix/functions/inverse/fourD/index.htm ) return n41 * (+n14 * n23 * n32 - n13 * n24 * n32 - n14 * n22 * n33 + n12 * n24 * n33 + n13 * n22 * n34 - n12 * n23 * n34) + n42 * (+n11 * n23 * n34 - n11 * n24 * n33 + n14 * n21 * n33 - n13 * n21 * n34 + n13 * n24 * n31 - n14 * n23 * n31) + n43 * (+n11 * n24 * n32 - n11 * n22 * n34 - n14 * n21 * n32 + n12 * n21 * n34 + n14 * n22 * n31 - n12 * n24 * n31) + n44 * (-n13 * n22 * n31 - n11 * n23 * n32 + n11 * n22 * n33 + n13 * n21 * n32 - n12 * n21 * n33 + n12 * n23 * n31); } - transpose() { const te = this.elements; let tmp; @@ -4485,10 +3935,8 @@ te[14] = tmp; return this; } - setPosition(x, y, z) { const te = this.elements; - if (x.isVector3) { te[12] = x.x; te[13] = x.y; @@ -4498,33 +3946,31 @@ te[13] = y; te[14] = z; } - return this; } - invert() { // based on http://www.euclideanspace.com/maths/algebra/matrix/functions/inverse/fourD/index.htm const te = this.elements, - n11 = te[0], - n21 = te[1], - n31 = te[2], - n41 = te[3], - n12 = te[4], - n22 = te[5], - n32 = te[6], - n42 = te[7], - n13 = te[8], - n23 = te[9], - n33 = te[10], - n43 = te[11], - n14 = te[12], - n24 = te[13], - n34 = te[14], - n44 = te[15], - t11 = n23 * n34 * n42 - n24 * n33 * n42 + n24 * n32 * n43 - n22 * n34 * n43 - n23 * n32 * n44 + n22 * n33 * n44, - t12 = n14 * n33 * n42 - n13 * n34 * n42 - n14 * n32 * n43 + n12 * n34 * n43 + n13 * n32 * n44 - n12 * n33 * n44, - t13 = n13 * n24 * n42 - n14 * n23 * n42 + n14 * n22 * n43 - n12 * n24 * n43 - n13 * n22 * n44 + n12 * n23 * n44, - t14 = n14 * n23 * n32 - n13 * n24 * n32 - n14 * n22 * n33 + n12 * n24 * n33 + n13 * n22 * n34 - n12 * n23 * n34; + n11 = te[0], + n21 = te[1], + n31 = te[2], + n41 = te[3], + n12 = te[4], + n22 = te[5], + n32 = te[6], + n42 = te[7], + n13 = te[8], + n23 = te[9], + n33 = te[10], + n43 = te[11], + n14 = te[12], + n24 = te[13], + n34 = te[14], + n44 = te[15], + t11 = n23 * n34 * n42 - n24 * n33 * n42 + n24 * n32 * n43 - n22 * n34 * n43 - n23 * n32 * n44 + n22 * n33 * n44, + t12 = n14 * n33 * n42 - n13 * n34 * n42 - n14 * n32 * n43 + n12 * n34 * n43 + n13 * n32 * n44 - n12 * n33 * n44, + t13 = n13 * n24 * n42 - n14 * n23 * n42 + n14 * n22 * n43 - n12 * n24 * n43 - n13 * n22 * n44 + n12 * n23 * n44, + t14 = n14 * n23 * n32 - n13 * n24 * n32 - n14 * n22 * n33 + n12 * n24 * n33 + n13 * n22 * n34 - n12 * n23 * n34; const det = n11 * t11 + n21 * t12 + n31 * t13 + n41 * t14; if (det === 0) return this.set(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0); const detInv = 1 / det; @@ -4546,12 +3992,11 @@ te[15] = (n12 * n23 * n31 - n13 * n22 * n31 + n13 * n21 * n32 - n11 * n23 * n32 - n12 * n21 * n33 + n11 * n22 * n33) * detInv; return this; } - scale(v) { const te = this.elements; const x = v.x, - y = v.y, - z = v.z; + y = v.y, + z = v.z; te[0] *= x; te[4] *= y; te[8] *= z; @@ -4566,7 +4011,6 @@ te[11] *= z; return this; } - getMaxScaleOnAxis() { const te = this.elements; const scaleXSq = te[0] * te[0] + te[1] * te[1] + te[2] * te[2]; @@ -4574,78 +4018,71 @@ const scaleZSq = te[8] * te[8] + te[9] * te[9] + te[10] * te[10]; return Math.sqrt(Math.max(scaleXSq, scaleYSq, scaleZSq)); } - makeTranslation(x, y, z) { this.set(1, 0, 0, x, 0, 1, 0, y, 0, 0, 1, z, 0, 0, 0, 1); return this; } - makeRotationX(theta) { const c = Math.cos(theta), - s = Math.sin(theta); + s = Math.sin(theta); this.set(1, 0, 0, 0, 0, c, -s, 0, 0, s, c, 0, 0, 0, 0, 1); return this; } - makeRotationY(theta) { const c = Math.cos(theta), - s = Math.sin(theta); + s = Math.sin(theta); this.set(c, 0, s, 0, 0, 1, 0, 0, -s, 0, c, 0, 0, 0, 0, 1); return this; } - makeRotationZ(theta) { const c = Math.cos(theta), - s = Math.sin(theta); + s = Math.sin(theta); this.set(c, -s, 0, 0, s, c, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1); return this; } - makeRotationAxis(axis, angle) { // Based on http://www.gamedev.net/reference/articles/article1199.asp + const c = Math.cos(angle); const s = Math.sin(angle); const t = 1 - c; const x = axis.x, - y = axis.y, - z = axis.z; + y = axis.y, + z = axis.z; const tx = t * x, - ty = t * y; + ty = t * y; this.set(tx * x + c, tx * y - s * z, tx * z + s * y, 0, tx * y + s * z, ty * y + c, ty * z - s * x, 0, tx * z - s * y, ty * z + s * x, t * z * z + c, 0, 0, 0, 0, 1); return this; } - makeScale(x, y, z) { this.set(x, 0, 0, 0, 0, y, 0, 0, 0, 0, z, 0, 0, 0, 0, 1); return this; } - makeShear(xy, xz, yx, yz, zx, zy) { this.set(1, yx, zx, 0, xy, 1, zy, 0, xz, yz, 1, 0, 0, 0, 0, 1); return this; } - compose(position, quaternion, scale) { const te = this.elements; const x = quaternion._x, - y = quaternion._y, - z = quaternion._z, - w = quaternion._w; + y = quaternion._y, + z = quaternion._z, + w = quaternion._w; const x2 = x + x, - y2 = y + y, - z2 = z + z; + y2 = y + y, + z2 = z + z; const xx = x * x2, - xy = x * y2, - xz = x * z2; + xy = x * y2, + xz = x * z2; const yy = y * y2, - yz = y * z2, - zz = z * z2; + yz = y * z2, + zz = z * z2; const wx = w * x2, - wy = w * y2, - wz = w * z2; + wy = w * y2, + wz = w * z2; const sx = scale.x, - sy = scale.y, - sz = scale.z; + sy = scale.y, + sz = scale.z; te[0] = (1 - (yy + zz)) * sx; te[1] = (xy + wz) * sx; te[2] = (xz - wy) * sx; @@ -4664,25 +4101,21 @@ te[15] = 1; return this; } - decompose(position, quaternion, scale) { const te = this.elements; - let sx = _v1$5.set(te[0], te[1], te[2]).length(); - const sy = _v1$5.set(te[4], te[5], te[6]).length(); + const sz = _v1$5.set(te[8], te[9], te[10]).length(); - const sz = _v1$5.set(te[8], te[9], te[10]).length(); // if determine is negative, we need to invert one scale - - + // if determine is negative, we need to invert one scale const det = this.determinant(); if (det < 0) sx = -sx; position.x = te[12]; position.y = te[13]; - position.z = te[14]; // scale the rotation part + position.z = te[14]; + // scale the rotation part _m1$2.copy(this); - const invSX = 1 / sx; const invSY = 1 / sy; const invSZ = 1 / sz; @@ -4701,12 +4134,10 @@ scale.z = sz; return this; } - makePerspective(left, right, top, bottom, near, far) { if (far === undefined) { console.warn('THREE.Matrix4: .makePerspective() has been redefined and has a new signature. Please check the docs.'); } - const te = this.elements; const x = 2 * near / (right - left); const y = 2 * near / (top - bottom); @@ -4732,7 +4163,6 @@ te[15] = 0; return this; } - makeOrthographic(left, right, top, bottom, near, far) { const te = this.elements; const w = 1.0 / (right - left); @@ -4759,26 +4189,20 @@ te[15] = 1; return this; } - equals(matrix) { const te = this.elements; const me = matrix.elements; - for (let i = 0; i < 16; i++) { if (te[i] !== me[i]) return false; } - return true; } - fromArray(array, offset = 0) { for (let i = 0; i < 16; i++) { this.elements[i] = array[i + offset]; } - return this; } - toArray(array = [], offset = 0) { const te = this.elements; array[offset] = te[0]; @@ -4799,29 +4223,18 @@ array[offset + 15] = te[15]; return array; } - } - Matrix4.prototype.isMatrix4 = true; - const _v1$5 = /*@__PURE__*/new Vector3(); - const _m1$2 = /*@__PURE__*/new Matrix4(); - const _zero = /*@__PURE__*/new Vector3(0, 0, 0); - const _one = /*@__PURE__*/new Vector3(1, 1, 1); - const _x = /*@__PURE__*/new Vector3(); - const _y = /*@__PURE__*/new Vector3(); - const _z = /*@__PURE__*/new Vector3(); const _matrix$1 = /*@__PURE__*/new Matrix4(); - const _quaternion$3 = /*@__PURE__*/new Quaternion(); - class Euler { constructor(x = 0, y = 0, z = 0, order = Euler.DefaultOrder) { this._x = x; @@ -4829,90 +4242,69 @@ this._z = z; this._order = order; } - get x() { return this._x; } - set x(value) { this._x = value; - this._onChangeCallback(); } - get y() { return this._y; } - set y(value) { this._y = value; - this._onChangeCallback(); } - get z() { return this._z; } - set z(value) { this._z = value; - this._onChangeCallback(); } - get order() { return this._order; } - set order(value) { this._order = value; - this._onChangeCallback(); } - set(x, y, z, order = this._order) { this._x = x; this._y = y; this._z = z; this._order = order; - this._onChangeCallback(); - return this; } - clone() { return new this.constructor(this._x, this._y, this._z, this._order); } - copy(euler) { this._x = euler._x; this._y = euler._y; this._z = euler._z; this._order = euler._order; - this._onChangeCallback(); - return this; } - setFromRotationMatrix(m, order = this._order, update = true) { // assumes the upper 3x3 of m is a pure rotation matrix (i.e, unscaled) + const te = m.elements; const m11 = te[0], - m12 = te[4], - m13 = te[8]; + m12 = te[4], + m13 = te[8]; const m21 = te[1], - m22 = te[5], - m23 = te[9]; + m22 = te[5], + m23 = te[9]; const m31 = te[2], - m32 = te[6], - m33 = te[10]; - + m32 = te[6], + m33 = te[10]; switch (order) { case 'XYZ': this._y = Math.asin(clamp(m13, -1, 1)); - if (Math.abs(m13) < 0.9999999) { this._x = Math.atan2(-m23, m33); this._z = Math.atan2(-m12, m11); @@ -4920,12 +4312,9 @@ this._x = Math.atan2(m32, m22); this._z = 0; } - break; - case 'YXZ': this._x = Math.asin(-clamp(m23, -1, 1)); - if (Math.abs(m23) < 0.9999999) { this._y = Math.atan2(m13, m33); this._z = Math.atan2(m21, m22); @@ -4933,12 +4322,9 @@ this._y = Math.atan2(-m31, m11); this._z = 0; } - break; - case 'ZXY': this._x = Math.asin(clamp(m32, -1, 1)); - if (Math.abs(m32) < 0.9999999) { this._y = Math.atan2(-m31, m33); this._z = Math.atan2(-m12, m22); @@ -4946,12 +4332,9 @@ this._y = 0; this._z = Math.atan2(m21, m11); } - break; - case 'ZYX': this._y = Math.asin(-clamp(m31, -1, 1)); - if (Math.abs(m31) < 0.9999999) { this._x = Math.atan2(m32, m33); this._z = Math.atan2(m21, m11); @@ -4959,12 +4342,9 @@ this._x = 0; this._z = Math.atan2(-m12, m22); } - break; - case 'YZX': this._z = Math.asin(clamp(m21, -1, 1)); - if (Math.abs(m21) < 0.9999999) { this._x = Math.atan2(-m23, m22); this._y = Math.atan2(-m31, m11); @@ -4972,12 +4352,9 @@ this._x = 0; this._y = Math.atan2(m13, m33); } - break; - case 'XZY': this._z = Math.asin(-clamp(m12, -1, 1)); - if (Math.abs(m12) < 0.9999999) { this._x = Math.atan2(m32, m22); this._y = Math.atan2(m13, m11); @@ -4985,50 +4362,38 @@ this._x = Math.atan2(-m23, m33); this._y = 0; } - break; - default: console.warn('THREE.Euler: .setFromRotationMatrix() encountered an unknown order: ' + order); } - this._order = order; if (update === true) this._onChangeCallback(); return this; } - setFromQuaternion(q, order, update) { _matrix$1.makeRotationFromQuaternion(q); - return this.setFromRotationMatrix(_matrix$1, order, update); } - setFromVector3(v, order = this._order) { return this.set(v.x, v.y, v.z, order); } - reorder(newOrder) { // WARNING: this discards revolution information -bhouston - _quaternion$3.setFromEuler(this); + _quaternion$3.setFromEuler(this); return this.setFromQuaternion(_quaternion$3, newOrder); } - equals(euler) { return euler._x === this._x && euler._y === this._y && euler._z === this._z && euler._order === this._order; } - fromArray(array) { this._x = array[0]; this._y = array[1]; this._z = array[2]; if (array[3] !== undefined) this._order = array[3]; - this._onChangeCallback(); - return this; } - toArray(array = [], offset = 0) { array[offset] = this._x; array[offset + 1] = this._y; @@ -5036,7 +4401,6 @@ array[offset + 3] = this._order; return array; } - toVector3(optionalResult) { if (optionalResult) { return optionalResult.set(this._x, this._y, this._z); @@ -5044,16 +4408,12 @@ return new Vector3(this._x, this._y, this._z); } } - _onChange(callback) { this._onChangeCallback = callback; return this; } - _onChangeCallback() {} - } - Euler.prototype.isEuler = true; Euler.DefaultOrder = 'XYZ'; Euler.RotationOrders = ['XYZ', 'YZX', 'ZXY', 'XZY', 'YXZ', 'ZYX']; @@ -5062,70 +4422,49 @@ constructor() { this.mask = 1 | 0; } - set(channel) { this.mask = (1 << channel | 0) >>> 0; } - enable(channel) { this.mask |= 1 << channel | 0; } - enableAll() { this.mask = 0xffffffff | 0; } - toggle(channel) { this.mask ^= 1 << channel | 0; } - disable(channel) { this.mask &= ~(1 << channel | 0); } - disableAll() { this.mask = 0; } - test(layers) { return (this.mask & layers.mask) !== 0; } - isEnabled(channel) { return (this.mask & (1 << channel | 0)) !== 0; } - } let _object3DId = 0; - const _v1$4 = /*@__PURE__*/new Vector3(); - const _q1 = /*@__PURE__*/new Quaternion(); - const _m1$1 = /*@__PURE__*/new Matrix4(); - const _target = /*@__PURE__*/new Vector3(); - const _position$3 = /*@__PURE__*/new Vector3(); - const _scale$2 = /*@__PURE__*/new Vector3(); - const _quaternion$2 = /*@__PURE__*/new Quaternion(); - const _xAxis = /*@__PURE__*/new Vector3(1, 0, 0); - const _yAxis = /*@__PURE__*/new Vector3(0, 1, 0); - const _zAxis = /*@__PURE__*/new Vector3(0, 0, 1); - const _addedEvent = { type: 'added' }; const _removedEvent = { type: 'removed' }; - class Object3D extends EventDispatcher { constructor() { super(); @@ -5142,19 +4481,14 @@ const rotation = new Euler(); const quaternion = new Quaternion(); const scale = new Vector3(1, 1, 1); - function onRotationChange() { quaternion.setFromEuler(rotation, false); } - function onQuaternionChange() { rotation.setFromQuaternion(quaternion, undefined, false); } - rotation._onChange(onRotationChange); - quaternion._onChange(onQuaternionChange); - Object.defineProperties(this, { position: { configurable: true, @@ -5196,355 +4530,288 @@ this.animations = []; this.userData = {}; } - - onBeforeRender() {} - - onAfterRender() {} - + onBeforeRender(/* renderer, scene, camera, geometry, material, group */) {} + onAfterRender(/* renderer, scene, camera, geometry, material, group */) {} applyMatrix4(matrix) { if (this.matrixAutoUpdate) this.updateMatrix(); this.matrix.premultiply(matrix); this.matrix.decompose(this.position, this.quaternion, this.scale); } - applyQuaternion(q) { this.quaternion.premultiply(q); return this; } - setRotationFromAxisAngle(axis, angle) { // assumes axis is normalized + this.quaternion.setFromAxisAngle(axis, angle); } - setRotationFromEuler(euler) { this.quaternion.setFromEuler(euler, true); } - setRotationFromMatrix(m) { // assumes the upper 3x3 of m is a pure rotation matrix (i.e, unscaled) + this.quaternion.setFromRotationMatrix(m); } - setRotationFromQuaternion(q) { // assumes q is normalized + this.quaternion.copy(q); } - rotateOnAxis(axis, angle) { // rotate object on axis in object space // axis is assumed to be normalized - _q1.setFromAxisAngle(axis, angle); + _q1.setFromAxisAngle(axis, angle); this.quaternion.multiply(_q1); return this; } - rotateOnWorldAxis(axis, angle) { // rotate object on axis in world space // axis is assumed to be normalized // method assumes no rotated parent - _q1.setFromAxisAngle(axis, angle); + _q1.setFromAxisAngle(axis, angle); this.quaternion.premultiply(_q1); return this; } - rotateX(angle) { return this.rotateOnAxis(_xAxis, angle); } - rotateY(angle) { return this.rotateOnAxis(_yAxis, angle); } - rotateZ(angle) { return this.rotateOnAxis(_zAxis, angle); } - translateOnAxis(axis, distance) { // translate object by distance along axis in object space // axis is assumed to be normalized - _v1$4.copy(axis).applyQuaternion(this.quaternion); + _v1$4.copy(axis).applyQuaternion(this.quaternion); this.position.add(_v1$4.multiplyScalar(distance)); return this; } - translateX(distance) { return this.translateOnAxis(_xAxis, distance); } - translateY(distance) { return this.translateOnAxis(_yAxis, distance); } - translateZ(distance) { return this.translateOnAxis(_zAxis, distance); } - localToWorld(vector) { return vector.applyMatrix4(this.matrixWorld); } - worldToLocal(vector) { return vector.applyMatrix4(_m1$1.copy(this.matrixWorld).invert()); } - lookAt(x, y, z) { // This method does not support objects having non-uniformly-scaled parent(s) + if (x.isVector3) { _target.copy(x); } else { _target.set(x, y, z); } - const parent = this.parent; this.updateWorldMatrix(true, false); - _position$3.setFromMatrixPosition(this.matrixWorld); - if (this.isCamera || this.isLight) { _m1$1.lookAt(_position$3, _target, this.up); } else { _m1$1.lookAt(_target, _position$3, this.up); } - this.quaternion.setFromRotationMatrix(_m1$1); - if (parent) { _m1$1.extractRotation(parent.matrixWorld); - _q1.setFromRotationMatrix(_m1$1); - this.quaternion.premultiply(_q1.invert()); } } - add(object) { if (arguments.length > 1) { for (let i = 0; i < arguments.length; i++) { this.add(arguments[i]); } - return this; } - if (object === this) { console.error('THREE.Object3D.add: object can\'t be added as a child of itself.', object); return this; } - if (object && object.isObject3D) { if (object.parent !== null) { object.parent.remove(object); } - object.parent = this; this.children.push(object); object.dispatchEvent(_addedEvent); } else { console.error('THREE.Object3D.add: object not an instance of THREE.Object3D.', object); } - return this; } - remove(object) { if (arguments.length > 1) { for (let i = 0; i < arguments.length; i++) { this.remove(arguments[i]); } - return this; } - const index = this.children.indexOf(object); - if (index !== -1) { object.parent = null; this.children.splice(index, 1); object.dispatchEvent(_removedEvent); } - return this; } - removeFromParent() { const parent = this.parent; - if (parent !== null) { parent.remove(this); } - return this; } - clear() { for (let i = 0; i < this.children.length; i++) { const object = this.children[i]; object.parent = null; object.dispatchEvent(_removedEvent); } - this.children.length = 0; return this; } - attach(object) { // adds object as a child of this, while maintaining the object's world transform + // Note: This method does not support scene graphs having non-uniformly-scaled nodes(s) - this.updateWorldMatrix(true, false); + this.updateWorldMatrix(true, false); _m1$1.copy(this.matrixWorld).invert(); - if (object.parent !== null) { object.parent.updateWorldMatrix(true, false); - _m1$1.multiply(object.parent.matrixWorld); } - object.applyMatrix4(_m1$1); this.add(object); object.updateWorldMatrix(false, true); return this; } - getObjectById(id) { return this.getObjectByProperty('id', id); } - getObjectByName(name) { return this.getObjectByProperty('name', name); } - getObjectByProperty(name, value) { if (this[name] === value) return this; - for (let i = 0, l = this.children.length; i < l; i++) { const child = this.children[i]; const object = child.getObjectByProperty(name, value); - if (object !== undefined) { return object; } } - return undefined; } - getWorldPosition(target) { this.updateWorldMatrix(true, false); return target.setFromMatrixPosition(this.matrixWorld); } - getWorldQuaternion(target) { this.updateWorldMatrix(true, false); this.matrixWorld.decompose(_position$3, target, _scale$2); return target; } - getWorldScale(target) { this.updateWorldMatrix(true, false); this.matrixWorld.decompose(_position$3, _quaternion$2, target); return target; } - getWorldDirection(target) { this.updateWorldMatrix(true, false); const e = this.matrixWorld.elements; return target.set(e[8], e[9], e[10]).normalize(); } - - raycast() {} - + raycast(/* raycaster, intersects */) {} traverse(callback) { callback(this); const children = this.children; - for (let i = 0, l = children.length; i < l; i++) { children[i].traverse(callback); } } - traverseVisible(callback) { if (this.visible === false) return; callback(this); const children = this.children; - for (let i = 0, l = children.length; i < l; i++) { children[i].traverseVisible(callback); } } - traverseAncestors(callback) { const parent = this.parent; - if (parent !== null) { callback(parent); parent.traverseAncestors(callback); } } - updateMatrix() { this.matrix.compose(this.position, this.quaternion, this.scale); this.matrixWorldNeedsUpdate = true; } - updateMatrixWorld(force) { if (this.matrixAutoUpdate) this.updateMatrix(); - if (this.matrixWorldNeedsUpdate || force) { if (this.parent === null) { this.matrixWorld.copy(this.matrix); } else { this.matrixWorld.multiplyMatrices(this.parent.matrixWorld, this.matrix); } - this.matrixWorldNeedsUpdate = false; force = true; - } // update children + } + // update children const children = this.children; - for (let i = 0, l = children.length; i < l; i++) { children[i].updateMatrixWorld(force); } } - updateWorldMatrix(updateParents, updateChildren) { const parent = this.parent; - if (updateParents === true && parent !== null) { parent.updateWorldMatrix(true, false); } - if (this.matrixAutoUpdate) this.updateMatrix(); - if (this.parent === null) { this.matrixWorld.copy(this.matrix); } else { this.matrixWorld.multiplyMatrices(this.parent.matrixWorld, this.matrix); - } // update children + } + // update children if (updateChildren === true) { const children = this.children; - for (let i = 0, l = children.length; i < l; i++) { children[i].updateWorldMatrix(false, true); } } } - toJSON(meta) { // meta is a string when called from JSON.stringify const isRootObject = meta === undefined || typeof meta === 'string'; - const output = {}; // meta is a hash used to collect geometries, materials. + const output = {}; + + // meta is a hash used to collect geometries, materials. // not providing it implies that this is the root object // being serialized. - if (isRootObject) { // initialize meta obj meta = { @@ -5561,8 +4828,9 @@ type: 'Object', generator: 'Object3D.toJSON' }; - } // standard Object3D serialization + } + // standard Object3D serialization const object = {}; object.uuid = this.uuid; @@ -5576,24 +4844,25 @@ if (JSON.stringify(this.userData) !== '{}') object.userData = this.userData; object.layers = this.layers.mask; object.matrix = this.matrix.toArray(); - if (this.matrixAutoUpdate === false) object.matrixAutoUpdate = false; // object specific properties + if (this.matrixAutoUpdate === false) object.matrixAutoUpdate = false; + + // object specific properties if (this.isInstancedMesh) { object.type = 'InstancedMesh'; object.count = this.count; object.instanceMatrix = this.instanceMatrix.toJSON(); if (this.instanceColor !== null) object.instanceColor = this.instanceColor.toJSON(); - } // + } + // function serialize(library, element) { if (library[element.uuid] === undefined) { library[element.uuid] = element.toJSON(meta); } - return element.uuid; } - if (this.isScene) { if (this.background) { if (this.background.isColor) { @@ -5602,17 +4871,14 @@ object.background = this.background.toJSON(meta).uuid; } } - if (this.environment && this.environment.isTexture) { object.environment = this.environment.toJSON(meta).uuid; } } else if (this.isMesh || this.isLine || this.isPoints) { object.geometry = serialize(meta.geometries, this.geometry); const parameters = this.geometry.parameters; - if (parameters !== undefined && parameters.shapes !== undefined) { const shapes = parameters.shapes; - if (Array.isArray(shapes)) { for (let i = 0, l = shapes.length; i < l; i++) { const shape = shapes[i]; @@ -5623,50 +4889,44 @@ } } } - if (this.isSkinnedMesh) { object.bindMode = this.bindMode; object.bindMatrix = this.bindMatrix.toArray(); - if (this.skeleton !== undefined) { serialize(meta.skeletons, this.skeleton); object.skeleton = this.skeleton.uuid; } } - if (this.material !== undefined) { if (Array.isArray(this.material)) { const uuids = []; - for (let i = 0, l = this.material.length; i < l; i++) { uuids.push(serialize(meta.materials, this.material[i])); } - object.material = uuids; } else { object.material = serialize(meta.materials, this.material); } - } // + } + // if (this.children.length > 0) { object.children = []; - for (let i = 0; i < this.children.length; i++) { object.children.push(this.children[i].toJSON(meta).object); } - } // + } + // if (this.animations.length > 0) { object.animations = []; - for (let i = 0; i < this.animations.length; i++) { const animation = this.animations[i]; object.animations.push(serialize(meta.animations, animation)); } } - if (isRootObject) { const geometries = extractFromCache(meta.geometries); const materials = extractFromCache(meta.materials); @@ -5683,29 +4943,25 @@ if (skeletons.length > 0) output.skeletons = skeletons; if (animations.length > 0) output.animations = animations; } - output.object = object; - return output; // extract data from the cache hash + return output; + + // extract data from the cache hash // remove metadata on each item // and return as array - function extractFromCache(cache) { const values = []; - for (const key in cache) { const data = cache[key]; delete data.metadata; values.push(data); } - return values; } } - clone(recursive) { return new this.constructor().copy(this, recursive); } - copy(source, recursive = true) { this.name = source.name; this.up.copy(source.up); @@ -5724,104 +4980,76 @@ this.frustumCulled = source.frustumCulled; this.renderOrder = source.renderOrder; this.userData = JSON.parse(JSON.stringify(source.userData)); - if (recursive === true) { for (let i = 0; i < source.children.length; i++) { const child = source.children[i]; this.add(child.clone()); } } - return this; } - } - Object3D.DefaultUp = new Vector3(0, 1, 0); Object3D.DefaultMatrixAutoUpdate = true; Object3D.prototype.isObject3D = true; const _v0$1 = /*@__PURE__*/new Vector3(); - const _v1$3 = /*@__PURE__*/new Vector3(); - const _v2$2 = /*@__PURE__*/new Vector3(); - const _v3$1 = /*@__PURE__*/new Vector3(); - const _vab = /*@__PURE__*/new Vector3(); - const _vac = /*@__PURE__*/new Vector3(); - const _vbc = /*@__PURE__*/new Vector3(); - const _vap = /*@__PURE__*/new Vector3(); - const _vbp = /*@__PURE__*/new Vector3(); - const _vcp = /*@__PURE__*/new Vector3(); - class Triangle { constructor(a = new Vector3(), b = new Vector3(), c = new Vector3()) { this.a = a; this.b = b; this.c = c; } - static getNormal(a, b, c, target) { target.subVectors(c, b); - _v0$1.subVectors(a, b); - target.cross(_v0$1); const targetLengthSq = target.lengthSq(); - if (targetLengthSq > 0) { return target.multiplyScalar(1 / Math.sqrt(targetLengthSq)); } - return target.set(0, 0, 0); - } // static/instance method to calculate barycentric coordinates - // based on: http://www.blackpawn.com/texts/pointinpoly/default.html - + } + // static/instance method to calculate barycentric coordinates + // based on: http://www.blackpawn.com/texts/pointinpoly/default.html static getBarycoord(point, a, b, c, target) { _v0$1.subVectors(c, a); - _v1$3.subVectors(b, a); - _v2$2.subVectors(point, a); - const dot00 = _v0$1.dot(_v0$1); - const dot01 = _v0$1.dot(_v1$3); - const dot02 = _v0$1.dot(_v2$2); - const dot11 = _v1$3.dot(_v1$3); - const dot12 = _v1$3.dot(_v2$2); + const denom = dot00 * dot11 - dot01 * dot01; - const denom = dot00 * dot11 - dot01 * dot01; // collinear or singular triangle - + // collinear or singular triangle if (denom === 0) { // arbitrary location outside of triangle? // not sure if this is the best idea, maybe should be returning undefined return target.set(-2, -1, -1); } - const invDenom = 1 / denom; const u = (dot11 * dot02 - dot01 * dot12) * invDenom; - const v = (dot00 * dot12 - dot01 * dot02) * invDenom; // barycentric coordinates must always sum to 1 + const v = (dot00 * dot12 - dot01 * dot02) * invDenom; + // barycentric coordinates must always sum to 1 return target.set(1 - u - v, v, u); } - static containsPoint(point, a, b, c) { this.getBarycoord(point, a, b, c, _v3$1); return _v3$1.x >= 0 && _v3$1.y >= 0 && _v3$1.x + _v3$1.y <= 1; } - static getUV(point, p1, p2, p3, uv1, uv2, uv3, target) { this.getBarycoord(point, p1, p2, p3, _v3$1); target.set(0, 0); @@ -5830,177 +5058,137 @@ target.addScaledVector(uv3, _v3$1.z); return target; } - static isFrontFacing(a, b, c, direction) { _v0$1.subVectors(c, b); + _v1$3.subVectors(a, b); - _v1$3.subVectors(a, b); // strictly front facing - - + // strictly front facing return _v0$1.cross(_v1$3).dot(direction) < 0 ? true : false; } - set(a, b, c) { this.a.copy(a); this.b.copy(b); this.c.copy(c); return this; } - setFromPointsAndIndices(points, i0, i1, i2) { this.a.copy(points[i0]); this.b.copy(points[i1]); this.c.copy(points[i2]); return this; } - setFromAttributeAndIndices(attribute, i0, i1, i2) { this.a.fromBufferAttribute(attribute, i0); this.b.fromBufferAttribute(attribute, i1); this.c.fromBufferAttribute(attribute, i2); return this; } - clone() { return new this.constructor().copy(this); } - copy(triangle) { this.a.copy(triangle.a); this.b.copy(triangle.b); this.c.copy(triangle.c); return this; } - getArea() { _v0$1.subVectors(this.c, this.b); - _v1$3.subVectors(this.a, this.b); - return _v0$1.cross(_v1$3).length() * 0.5; } - getMidpoint(target) { return target.addVectors(this.a, this.b).add(this.c).multiplyScalar(1 / 3); } - getNormal(target) { return Triangle.getNormal(this.a, this.b, this.c, target); } - getPlane(target) { return target.setFromCoplanarPoints(this.a, this.b, this.c); } - getBarycoord(point, target) { return Triangle.getBarycoord(point, this.a, this.b, this.c, target); } - getUV(point, uv1, uv2, uv3, target) { return Triangle.getUV(point, this.a, this.b, this.c, uv1, uv2, uv3, target); } - containsPoint(point) { return Triangle.containsPoint(point, this.a, this.b, this.c); } - isFrontFacing(direction) { return Triangle.isFrontFacing(this.a, this.b, this.c, direction); } - intersectsBox(box) { return box.intersectsTriangle(this); } - closestPointToPoint(p, target) { const a = this.a, - b = this.b, - c = this.c; - let v, w; // algorithm thanks to Real-Time Collision Detection by Christer Ericson, + b = this.b, + c = this.c; + let v, w; + + // algorithm thanks to Real-Time Collision Detection by Christer Ericson, // published by Morgan Kaufmann Publishers, (c) 2005 Elsevier Inc., // under the accompanying license; see chapter 5.1.5 for detailed explanation. // basically, we're distinguishing which of the voronoi regions of the triangle // the point lies in with the minimum amount of redundant computation. _vab.subVectors(b, a); - _vac.subVectors(c, a); - _vap.subVectors(p, a); - const d1 = _vab.dot(_vap); - const d2 = _vac.dot(_vap); - if (d1 <= 0 && d2 <= 0) { // vertex region of A; barycentric coords (1, 0, 0) return target.copy(a); } - _vbp.subVectors(p, b); - const d3 = _vab.dot(_vbp); - const d4 = _vac.dot(_vbp); - if (d3 >= 0 && d4 <= d3) { // vertex region of B; barycentric coords (0, 1, 0) return target.copy(b); } - const vc = d1 * d4 - d3 * d2; - if (vc <= 0 && d1 >= 0 && d3 <= 0) { - v = d1 / (d1 - d3); // edge region of AB; barycentric coords (1-v, v, 0) - + v = d1 / (d1 - d3); + // edge region of AB; barycentric coords (1-v, v, 0) return target.copy(a).addScaledVector(_vab, v); } - _vcp.subVectors(p, c); - const d5 = _vab.dot(_vcp); - const d6 = _vac.dot(_vcp); - if (d6 >= 0 && d5 <= d6) { // vertex region of C; barycentric coords (0, 0, 1) return target.copy(c); } - const vb = d5 * d2 - d1 * d6; - if (vb <= 0 && d2 >= 0 && d6 <= 0) { - w = d2 / (d2 - d6); // edge region of AC; barycentric coords (1-w, 0, w) - + w = d2 / (d2 - d6); + // edge region of AC; barycentric coords (1-w, 0, w) return target.copy(a).addScaledVector(_vac, w); } - const va = d3 * d6 - d5 * d4; - if (va <= 0 && d4 - d3 >= 0 && d5 - d6 >= 0) { _vbc.subVectors(c, b); - - w = (d4 - d3) / (d4 - d3 + (d5 - d6)); // edge region of BC; barycentric coords (0, 1-w, w) - + w = (d4 - d3) / (d4 - d3 + (d5 - d6)); + // edge region of BC; barycentric coords (0, 1-w, w) return target.copy(b).addScaledVector(_vbc, w); // edge region of BC - } // face region - - - const denom = 1 / (va + vb + vc); // u = va * denom + } + // face region + const denom = 1 / (va + vb + vc); + // u = va * denom v = vb * denom; w = vc * denom; return target.copy(a).addScaledVector(_vab, v).addScaledVector(_vac, w); } - equals(triangle) { return triangle.a.equals(this.a) && triangle.b.equals(this.b) && triangle.c.equals(this.c); } - } let materialId = 0; - class Material extends EventDispatcher { constructor() { super(); @@ -6052,54 +5240,41 @@ this.version = 0; this._alphaTest = 0; } - get alphaTest() { return this._alphaTest; } - set alphaTest(value) { if (this._alphaTest > 0 !== value > 0) { this.version++; } - this._alphaTest = value; } - - onBuild() {} - - onBeforeRender() {} - - onBeforeCompile() {} - + onBuild(/* shaderobject, renderer */) {} + onBeforeRender(/* renderer, scene, camera, geometry, object, group */) {} + onBeforeCompile(/* shaderobject, renderer */) {} customProgramCacheKey() { return this.onBeforeCompile.toString(); } - setValues(values) { if (values === undefined) return; - for (const key in values) { const newValue = values[key]; - if (newValue === undefined) { console.warn('THREE.Material: \'' + key + '\' parameter is undefined.'); continue; - } // for backward compatability if shading is set in the constructor - + } + // for backward compatability if shading is set in the constructor if (key === 'shading') { console.warn('THREE.' + this.type + ': .shading has been removed. Use the boolean .flatShading instead.'); this.flatShading = newValue === FlatShading ? true : false; continue; } - const currentValue = this[key]; - if (currentValue === undefined) { console.warn('THREE.' + this.type + ': \'' + key + '\' is not a property of this material.'); continue; } - if (currentValue && currentValue.isColor) { currentValue.set(newValue); } else if (currentValue && currentValue.isVector3 && newValue && newValue.isVector3) { @@ -6109,25 +5284,23 @@ } } } - toJSON(meta) { const isRoot = meta === undefined || typeof meta === 'string'; - if (isRoot) { meta = { textures: {}, images: {} }; } - const data = { metadata: { version: 4.5, type: 'Material', generator: 'Material.toJSON' } - }; // standard Material serialization + }; + // standard Material serialization data.uuid = this.uuid; data.type = this.type; if (this.name !== '') data.name = this.name; @@ -6145,71 +5318,57 @@ if (this.shininess !== undefined) data.shininess = this.shininess; if (this.clearcoat !== undefined) data.clearcoat = this.clearcoat; if (this.clearcoatRoughness !== undefined) data.clearcoatRoughness = this.clearcoatRoughness; - if (this.clearcoatMap && this.clearcoatMap.isTexture) { data.clearcoatMap = this.clearcoatMap.toJSON(meta).uuid; } - if (this.clearcoatRoughnessMap && this.clearcoatRoughnessMap.isTexture) { data.clearcoatRoughnessMap = this.clearcoatRoughnessMap.toJSON(meta).uuid; } - if (this.clearcoatNormalMap && this.clearcoatNormalMap.isTexture) { data.clearcoatNormalMap = this.clearcoatNormalMap.toJSON(meta).uuid; data.clearcoatNormalScale = this.clearcoatNormalScale.toArray(); } - if (this.map && this.map.isTexture) data.map = this.map.toJSON(meta).uuid; if (this.matcap && this.matcap.isTexture) data.matcap = this.matcap.toJSON(meta).uuid; if (this.alphaMap && this.alphaMap.isTexture) data.alphaMap = this.alphaMap.toJSON(meta).uuid; - if (this.lightMap && this.lightMap.isTexture) { data.lightMap = this.lightMap.toJSON(meta).uuid; data.lightMapIntensity = this.lightMapIntensity; } - if (this.aoMap && this.aoMap.isTexture) { data.aoMap = this.aoMap.toJSON(meta).uuid; data.aoMapIntensity = this.aoMapIntensity; } - if (this.bumpMap && this.bumpMap.isTexture) { data.bumpMap = this.bumpMap.toJSON(meta).uuid; data.bumpScale = this.bumpScale; } - if (this.normalMap && this.normalMap.isTexture) { data.normalMap = this.normalMap.toJSON(meta).uuid; data.normalMapType = this.normalMapType; data.normalScale = this.normalScale.toArray(); } - if (this.displacementMap && this.displacementMap.isTexture) { data.displacementMap = this.displacementMap.toJSON(meta).uuid; data.displacementScale = this.displacementScale; data.displacementBias = this.displacementBias; } - if (this.roughnessMap && this.roughnessMap.isTexture) data.roughnessMap = this.roughnessMap.toJSON(meta).uuid; if (this.metalnessMap && this.metalnessMap.isTexture) data.metalnessMap = this.metalnessMap.toJSON(meta).uuid; if (this.emissiveMap && this.emissiveMap.isTexture) data.emissiveMap = this.emissiveMap.toJSON(meta).uuid; if (this.specularMap && this.specularMap.isTexture) data.specularMap = this.specularMap.toJSON(meta).uuid; if (this.specularIntensityMap && this.specularIntensityMap.isTexture) data.specularIntensityMap = this.specularIntensityMap.toJSON(meta).uuid; if (this.specularColorMap && this.specularColorMap.isTexture) data.specularColorMap = this.specularColorMap.toJSON(meta).uuid; - if (this.envMap && this.envMap.isTexture) { data.envMap = this.envMap.toJSON(meta).uuid; if (this.combine !== undefined) data.combine = this.combine; } - if (this.envMapIntensity !== undefined) data.envMapIntensity = this.envMapIntensity; if (this.reflectivity !== undefined) data.reflectivity = this.reflectivity; if (this.refractionRatio !== undefined) data.refractionRatio = this.refractionRatio; - if (this.gradientMap && this.gradientMap.isTexture) { data.gradientMap = this.gradientMap.toJSON(meta).uuid; } - if (this.transmission !== undefined) data.transmission = this.transmission; if (this.transmissionMap && this.transmissionMap.isTexture) data.transmissionMap = this.transmissionMap.toJSON(meta).uuid; if (this.thickness !== undefined) data.thickness = this.thickness; @@ -6235,8 +5394,9 @@ data.stencilFuncMask = this.stencilFuncMask; data.stencilFail = this.stencilFail; data.stencilZFail = this.stencilZFail; - data.stencilZPass = this.stencilZPass; // rotation (SpriteMaterial) + data.stencilZPass = this.stencilZPass; + // rotation (SpriteMaterial) if (this.rotation && this.rotation !== 0) data.rotation = this.rotation; if (this.polygonOffset === true) data.polygonOffset = true; if (this.polygonOffsetFactor !== 0) data.polygonOffsetFactor = this.polygonOffsetFactor; @@ -6256,34 +5416,30 @@ if (this.flatShading === true) data.flatShading = this.flatShading; if (this.visible === false) data.visible = false; if (this.toneMapped === false) data.toneMapped = false; - if (JSON.stringify(this.userData) !== '{}') data.userData = this.userData; // TODO: Copied from Object3D.toJSON + if (JSON.stringify(this.userData) !== '{}') data.userData = this.userData; + + // TODO: Copied from Object3D.toJSON function extractFromCache(cache) { const values = []; - for (const key in cache) { const data = cache[key]; delete data.metadata; values.push(data); } - return values; } - if (isRoot) { const textures = extractFromCache(meta.textures); const images = extractFromCache(meta.images); if (textures.length > 0) data.textures = textures; if (images.length > 0) data.images = images; } - return data; } - clone() { return new this.constructor().copy(this); } - copy(source) { this.name = source.name; this.fog = source.fog; @@ -6311,16 +5467,13 @@ this.stencilWrite = source.stencilWrite; const srcPlanes = source.clippingPlanes; let dstPlanes = null; - if (srcPlanes !== null) { const n = srcPlanes.length; dstPlanes = new Array(n); - for (let i = 0; i !== n; ++i) { dstPlanes[i] = srcPlanes[i].clone(); } } - this.clippingPlanes = dstPlanes; this.clipIntersection = source.clipIntersection; this.clipShadows = source.clipShadows; @@ -6339,19 +5492,15 @@ this.userData = JSON.parse(JSON.stringify(source.userData)); return this; } - dispose() { this.dispatchEvent({ type: 'dispose' }); } - set needsUpdate(value) { if (value === true) this.version++; } - } - Material.r115Compatible = false; Material.prototype.isMaterial = true; @@ -6515,7 +5664,6 @@ s: 0, l: 0 }; - function hue2rgb(p, q, t) { if (t < 0) t += 1; if (t > 1) t -= 1; @@ -6524,25 +5672,20 @@ if (t < 2 / 3) return p + (q - p) * 6 * (2 / 3 - t); return p; } - function SRGBToLinear(c) { return c < 0.04045 ? c * 0.0773993808 : Math.pow(c * 0.9478672986 + 0.0521327014, 2.4); } - function LinearToSRGB(c) { return c < 0.0031308 ? c * 12.92 : 1.055 * Math.pow(c, 0.41666) - 0.055; } - class Color { constructor(r, g, b) { if (g === undefined && b === undefined) { // r is THREE.Color, hex or string return this.set(r); } - return this.setRGB(r, g, b); } - set(value) { if (value && value.isColor) { this.copy(value); @@ -6551,17 +5694,14 @@ } else if (typeof value === 'string') { this.setStyle(value); } - return this; } - setScalar(scalar) { this.r = scalar; this.g = scalar; this.b = scalar; return this; } - setHex(hex) { hex = Math.floor(hex); this.r = (hex >> 16 & 255) / 255; @@ -6569,20 +5709,17 @@ this.b = (hex & 255) / 255; return this; } - setRGB(r, g, b) { this.r = r; this.g = g; this.b = b; return this; } - setHSL(h, s, l) { // h,s,l ranges are in 0.0 - 1.0 h = euclideanModulo(h, 1); s = clamp(s, 0, 1); l = clamp(l, 0, 1); - if (s === 0) { this.r = this.g = this.b = l; } else { @@ -6592,27 +5729,22 @@ this.g = hue2rgb(q, p, h); this.b = hue2rgb(q, p, h - 1 / 3); } - return this; } - setStyle(style) { function handleAlpha(string) { if (string === undefined) return; - if (parseFloat(string) < 1) { console.warn('THREE.Color: Alpha component of ' + style + ' will be ignored.'); } } - let m; - if (m = /^((?:rgb|hsl)a?)\(([^\)]*)\)/.exec(style)) { // rgb / hsl + let color; const name = m[1]; const components = m[2]; - switch (name) { case 'rgb': case 'rgba': @@ -6624,7 +5756,6 @@ handleAlpha(color[4]); return this; } - if (color = /^\s*(\d+)\%\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(components)) { // rgb(100%,0%,0%) rgba(100%,0%,0%,0.5) this.r = Math.min(100, parseInt(color[1], 10)) / 100; @@ -6633,9 +5764,7 @@ handleAlpha(color[4]); return this; } - break; - case 'hsl': case 'hsla': if (color = /^\s*(\d*\.?\d+)\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(components)) { @@ -6646,14 +5775,13 @@ handleAlpha(color[4]); return this.setHSL(h, s, l); } - break; } } else if (m = /^\#([A-Fa-f\d]+)$/.exec(style)) { // hex color + const hex = m[1]; const size = hex.length; - if (size === 3) { // #ff0 this.r = parseInt(hex.charAt(0) + hex.charAt(0), 16) / 255; @@ -6668,18 +5796,14 @@ return this; } } - if (style && style.length > 0) { return this.setColorName(style); } - return this; } - setColorName(style) { // color keywords const hex = _colorKeywords[style.toLowerCase()]; - if (hex !== undefined) { // red this.setHex(hex); @@ -6687,97 +5811,80 @@ // unknown color console.warn('THREE.Color: Unknown color ' + style); } - return this; } - clone() { return new this.constructor(this.r, this.g, this.b); } - copy(color) { this.r = color.r; this.g = color.g; this.b = color.b; return this; } - copySRGBToLinear(color) { this.r = SRGBToLinear(color.r); this.g = SRGBToLinear(color.g); this.b = SRGBToLinear(color.b); return this; } - copyLinearToSRGB(color) { this.r = LinearToSRGB(color.r); this.g = LinearToSRGB(color.g); this.b = LinearToSRGB(color.b); return this; } - convertSRGBToLinear() { this.copySRGBToLinear(this); return this; } - convertLinearToSRGB() { this.copyLinearToSRGB(this); return this; } - getHex() { return this.r * 255 << 16 ^ this.g * 255 << 8 ^ this.b * 255 << 0; } - getHexString() { return ('000000' + this.getHex().toString(16)).slice(-6); } - getHSL(target) { // h,s,l ranges are in 0.0 - 1.0 + const r = this.r, - g = this.g, - b = this.b; + g = this.g, + b = this.b; const max = Math.max(r, g, b); const min = Math.min(r, g, b); let hue, saturation; const lightness = (min + max) / 2.0; - if (min === max) { hue = 0; saturation = 0; } else { const delta = max - min; saturation = lightness <= 0.5 ? delta / (max + min) : delta / (2 - max - min); - switch (max) { case r: hue = (g - b) / delta + (g < b ? 6 : 0); break; - case g: hue = (b - r) / delta + 2; break; - case b: hue = (r - g) / delta + 4; break; } - hue /= 6; } - target.h = hue; target.s = saturation; target.l = lightness; return target; } - getStyle() { return 'rgb(' + (this.r * 255 | 0) + ',' + (this.g * 255 | 0) + ',' + (this.b * 255 | 0) + ')'; } - offsetHSL(h, s, l) { this.getHSL(_hslA); _hslA.h += h; @@ -6786,63 +5893,54 @@ this.setHSL(_hslA.h, _hslA.s, _hslA.l); return this; } - add(color) { this.r += color.r; this.g += color.g; this.b += color.b; return this; } - addColors(color1, color2) { this.r = color1.r + color2.r; this.g = color1.g + color2.g; this.b = color1.b + color2.b; return this; } - addScalar(s) { this.r += s; this.g += s; this.b += s; return this; } - sub(color) { this.r = Math.max(0, this.r - color.r); this.g = Math.max(0, this.g - color.g); this.b = Math.max(0, this.b - color.b); return this; } - multiply(color) { this.r *= color.r; this.g *= color.g; this.b *= color.b; return this; } - multiplyScalar(s) { this.r *= s; this.g *= s; this.b *= s; return this; } - lerp(color, alpha) { this.r += (color.r - this.r) * alpha; this.g += (color.g - this.g) * alpha; this.b += (color.b - this.b) * alpha; return this; } - lerpColors(color1, color2, alpha) { this.r = color1.r + (color2.r - color1.r) * alpha; this.g = color1.g + (color2.g - color1.g) * alpha; this.b = color1.b + (color2.b - color1.b) * alpha; return this; } - lerpHSL(color, alpha) { this.getHSL(_hslA); color.getHSL(_hslB); @@ -6852,46 +5950,38 @@ this.setHSL(h, s, l); return this; } - equals(c) { return c.r === this.r && c.g === this.g && c.b === this.b; } - fromArray(array, offset = 0) { this.r = array[offset]; this.g = array[offset + 1]; this.b = array[offset + 2]; return this; } - toArray(array = [], offset = 0) { array[offset] = this.r; array[offset + 1] = this.g; array[offset + 2] = this.b; return array; } - fromBufferAttribute(attribute, index) { this.r = attribute.getX(index); this.g = attribute.getY(index); this.b = attribute.getZ(index); - if (attribute.normalized === true) { // assuming Uint8Array + this.r /= 255; this.g /= 255; this.b /= 255; } - return this; } - toJSON() { return this.getHex(); } - } - Color.NAMES = _colorKeywords; Color.prototype.isColor = true; Color.prototype.r = 1; @@ -6950,7 +6040,6 @@ this.wireframeLinejoin = 'round'; this.setValues(parameters); } - copy(source) { super.copy(source); this.color.copy(source.color); @@ -6971,21 +6060,16 @@ this.wireframeLinejoin = source.wireframeLinejoin; return this; } - } - MeshBasicMaterial.prototype.isMeshBasicMaterial = true; const _vector$9 = /*@__PURE__*/new Vector3(); - const _vector2$1 = /*@__PURE__*/new Vector2(); - class BufferAttribute { constructor(array, itemSize, normalized) { if (Array.isArray(array)) { throw new TypeError('THREE.BufferAttribute: array should be a Typed Array.'); } - this.name = ''; this.array = array; this.itemSize = itemSize; @@ -6998,18 +6082,14 @@ }; this.version = 0; } - onUploadCallback() {} - set needsUpdate(value) { if (value === true) this.version++; } - setUsage(value) { this.usage = value; return this; } - copy(source) { this.name = source.name; this.array = new source.array.constructor(source.array); @@ -7019,215 +6099,162 @@ this.usage = source.usage; return this; } - copyAt(index1, attribute, index2) { index1 *= this.itemSize; index2 *= attribute.itemSize; - for (let i = 0, l = this.itemSize; i < l; i++) { this.array[index1 + i] = attribute.array[index2 + i]; } - return this; } - copyArray(array) { this.array.set(array); return this; } - copyColorsArray(colors) { const array = this.array; let offset = 0; - for (let i = 0, l = colors.length; i < l; i++) { let color = colors[i]; - if (color === undefined) { console.warn('THREE.BufferAttribute.copyColorsArray(): color is undefined', i); color = new Color(); } - array[offset++] = color.r; array[offset++] = color.g; array[offset++] = color.b; } - return this; } - copyVector2sArray(vectors) { const array = this.array; let offset = 0; - for (let i = 0, l = vectors.length; i < l; i++) { let vector = vectors[i]; - if (vector === undefined) { console.warn('THREE.BufferAttribute.copyVector2sArray(): vector is undefined', i); vector = new Vector2(); } - array[offset++] = vector.x; array[offset++] = vector.y; } - return this; } - copyVector3sArray(vectors) { const array = this.array; let offset = 0; - for (let i = 0, l = vectors.length; i < l; i++) { let vector = vectors[i]; - if (vector === undefined) { console.warn('THREE.BufferAttribute.copyVector3sArray(): vector is undefined', i); vector = new Vector3(); } - array[offset++] = vector.x; array[offset++] = vector.y; array[offset++] = vector.z; } - return this; } - copyVector4sArray(vectors) { const array = this.array; let offset = 0; - for (let i = 0, l = vectors.length; i < l; i++) { let vector = vectors[i]; - if (vector === undefined) { console.warn('THREE.BufferAttribute.copyVector4sArray(): vector is undefined', i); vector = new Vector4(); } - array[offset++] = vector.x; array[offset++] = vector.y; array[offset++] = vector.z; array[offset++] = vector.w; } - return this; } - applyMatrix3(m) { if (this.itemSize === 2) { for (let i = 0, l = this.count; i < l; i++) { _vector2$1.fromBufferAttribute(this, i); - _vector2$1.applyMatrix3(m); - this.setXY(i, _vector2$1.x, _vector2$1.y); } } else if (this.itemSize === 3) { for (let i = 0, l = this.count; i < l; i++) { _vector$9.fromBufferAttribute(this, i); - _vector$9.applyMatrix3(m); - this.setXYZ(i, _vector$9.x, _vector$9.y, _vector$9.z); } } - return this; } - applyMatrix4(m) { for (let i = 0, l = this.count; i < l; i++) { _vector$9.x = this.getX(i); _vector$9.y = this.getY(i); _vector$9.z = this.getZ(i); - _vector$9.applyMatrix4(m); - this.setXYZ(i, _vector$9.x, _vector$9.y, _vector$9.z); } - return this; } - applyNormalMatrix(m) { for (let i = 0, l = this.count; i < l; i++) { _vector$9.x = this.getX(i); _vector$9.y = this.getY(i); _vector$9.z = this.getZ(i); - _vector$9.applyNormalMatrix(m); - this.setXYZ(i, _vector$9.x, _vector$9.y, _vector$9.z); } - return this; } - transformDirection(m) { for (let i = 0, l = this.count; i < l; i++) { _vector$9.x = this.getX(i); _vector$9.y = this.getY(i); _vector$9.z = this.getZ(i); - _vector$9.transformDirection(m); - this.setXYZ(i, _vector$9.x, _vector$9.y, _vector$9.z); } - return this; } - set(value, offset = 0) { this.array.set(value, offset); return this; } - getX(index) { return this.array[index * this.itemSize]; } - setX(index, x) { this.array[index * this.itemSize] = x; return this; } - getY(index) { return this.array[index * this.itemSize + 1]; } - setY(index, y) { this.array[index * this.itemSize + 1] = y; return this; } - getZ(index) { return this.array[index * this.itemSize + 2]; } - setZ(index, z) { this.array[index * this.itemSize + 2] = z; return this; } - getW(index) { return this.array[index * this.itemSize + 3]; } - setW(index, w) { this.array[index * this.itemSize + 3] = w; return this; } - setXY(index, x, y) { index *= this.itemSize; this.array[index + 0] = x; this.array[index + 1] = y; return this; } - setXYZ(index, x, y, z) { index *= this.itemSize; this.array[index + 0] = x; @@ -7235,7 +6262,6 @@ this.array[index + 2] = z; return this; } - setXYZW(index, x, y, z, w) { index *= this.itemSize; this.array[index + 0] = x; @@ -7244,16 +6270,13 @@ this.array[index + 3] = w; return this; } - onUpload(callback) { this.onUploadCallback = callback; return this; } - clone() { return new this.constructor(this.array, this.itemSize).copy(this); } - toJSON() { const data = { itemSize: this.itemSize, @@ -7266,97 +6289,70 @@ if (this.updateRange.offset !== 0 || this.updateRange.count !== -1) data.updateRange = this.updateRange; return data; } - } + BufferAttribute.prototype.isBufferAttribute = true; - BufferAttribute.prototype.isBufferAttribute = true; // + // class Int8BufferAttribute extends BufferAttribute { constructor(array, itemSize, normalized) { super(new Int8Array(array), itemSize, normalized); } - } - class Uint8BufferAttribute extends BufferAttribute { constructor(array, itemSize, normalized) { super(new Uint8Array(array), itemSize, normalized); } - } - class Uint8ClampedBufferAttribute extends BufferAttribute { constructor(array, itemSize, normalized) { super(new Uint8ClampedArray(array), itemSize, normalized); } - } - class Int16BufferAttribute extends BufferAttribute { constructor(array, itemSize, normalized) { super(new Int16Array(array), itemSize, normalized); } - } - class Uint16BufferAttribute extends BufferAttribute { constructor(array, itemSize, normalized) { super(new Uint16Array(array), itemSize, normalized); } - } - class Int32BufferAttribute extends BufferAttribute { constructor(array, itemSize, normalized) { super(new Int32Array(array), itemSize, normalized); } - } - class Uint32BufferAttribute extends BufferAttribute { constructor(array, itemSize, normalized) { super(new Uint32Array(array), itemSize, normalized); } - } - class Float16BufferAttribute extends BufferAttribute { constructor(array, itemSize, normalized) { super(new Uint16Array(array), itemSize, normalized); } - } - Float16BufferAttribute.prototype.isFloat16BufferAttribute = true; - class Float32BufferAttribute extends BufferAttribute { constructor(array, itemSize, normalized) { super(new Float32Array(array), itemSize, normalized); } - } - class Float64BufferAttribute extends BufferAttribute { constructor(array, itemSize, normalized) { super(new Float64Array(array), itemSize, normalized); } - - } // + } let _id$1 = 0; - const _m1 = /*@__PURE__*/new Matrix4(); - const _obj = /*@__PURE__*/new Object3D(); - const _offset = /*@__PURE__*/new Vector3(); - const _box$2 = /*@__PURE__*/new Box3(); - const _boxMorphTargets = /*@__PURE__*/new Box3(); - const _vector$8 = /*@__PURE__*/new Vector3(); - class BufferGeometry extends EventDispatcher { constructor() { super(); @@ -7379,39 +6375,31 @@ }; this.userData = {}; } - getIndex() { return this.index; } - setIndex(index) { if (Array.isArray(index)) { this.index = new (arrayNeedsUint32(index) ? Uint32BufferAttribute : Uint16BufferAttribute)(index, 1); } else { this.index = index; } - return this; } - getAttribute(name) { return this.attributes[name]; } - setAttribute(name, attribute) { this.attributes[name] = attribute; return this; } - deleteAttribute(name) { delete this.attributes[name]; return this; } - hasAttribute(name) { return this.attributes[name] !== undefined; } - addGroup(start, count, materialIndex = 0) { this.groups.push({ start: start, @@ -7419,155 +6407,123 @@ materialIndex: materialIndex }); } - clearGroups() { this.groups = []; } - setDrawRange(start, count) { this.drawRange.start = start; this.drawRange.count = count; } - applyMatrix4(matrix) { const position = this.attributes.position; - if (position !== undefined) { position.applyMatrix4(matrix); position.needsUpdate = true; } - const normal = this.attributes.normal; - if (normal !== undefined) { const normalMatrix = new Matrix3().getNormalMatrix(matrix); normal.applyNormalMatrix(normalMatrix); normal.needsUpdate = true; } - const tangent = this.attributes.tangent; - if (tangent !== undefined) { tangent.transformDirection(matrix); tangent.needsUpdate = true; } - if (this.boundingBox !== null) { this.computeBoundingBox(); } - if (this.boundingSphere !== null) { this.computeBoundingSphere(); } - return this; } - applyQuaternion(q) { _m1.makeRotationFromQuaternion(q); - this.applyMatrix4(_m1); return this; } - rotateX(angle) { // rotate geometry around world x-axis - _m1.makeRotationX(angle); + _m1.makeRotationX(angle); this.applyMatrix4(_m1); return this; } - rotateY(angle) { // rotate geometry around world y-axis - _m1.makeRotationY(angle); + _m1.makeRotationY(angle); this.applyMatrix4(_m1); return this; } - rotateZ(angle) { // rotate geometry around world z-axis - _m1.makeRotationZ(angle); + _m1.makeRotationZ(angle); this.applyMatrix4(_m1); return this; } - translate(x, y, z) { // translate geometry - _m1.makeTranslation(x, y, z); + _m1.makeTranslation(x, y, z); this.applyMatrix4(_m1); return this; } - scale(x, y, z) { // scale geometry - _m1.makeScale(x, y, z); + _m1.makeScale(x, y, z); this.applyMatrix4(_m1); return this; } - lookAt(vector) { _obj.lookAt(vector); - _obj.updateMatrix(); - this.applyMatrix4(_obj.matrix); return this; } - center() { this.computeBoundingBox(); this.boundingBox.getCenter(_offset).negate(); this.translate(_offset.x, _offset.y, _offset.z); return this; } - setFromPoints(points) { const position = []; - for (let i = 0, l = points.length; i < l; i++) { const point = points[i]; position.push(point.x, point.y, point.z || 0); } - this.setAttribute('position', new Float32BufferAttribute(position, 3)); return this; } - computeBoundingBox() { if (this.boundingBox === null) { this.boundingBox = new Box3(); } - const position = this.attributes.position; const morphAttributesPosition = this.morphAttributes.position; - if (position && position.isGLBufferAttribute) { console.error('THREE.BufferGeometry.computeBoundingBox(): GLBufferAttribute requires a manual bounding box. Alternatively set "mesh.frustumCulled" to "false".', this); this.boundingBox.set(new Vector3(-Infinity, -Infinity, -Infinity), new Vector3(+Infinity, +Infinity, +Infinity)); return; } - if (position !== undefined) { - this.boundingBox.setFromBufferAttribute(position); // process morph attributes if present + this.boundingBox.setFromBufferAttribute(position); + + // process morph attributes if present if (morphAttributesPosition) { for (let i = 0, il = morphAttributesPosition.length; i < il; i++) { const morphAttribute = morphAttributesPosition[i]; - _box$2.setFromBufferAttribute(morphAttribute); - if (this.morphTargetsRelative) { _vector$8.addVectors(this.boundingBox.min, _box$2.min); - this.boundingBox.expandByPoint(_vector$8); - _vector$8.addVectors(this.boundingBox.max, _box$2.max); - this.boundingBox.expandByPoint(_vector$8); } else { this.boundingBox.expandByPoint(_box$2.min); @@ -7578,133 +6534,111 @@ } else { this.boundingBox.makeEmpty(); } - if (isNaN(this.boundingBox.min.x) || isNaN(this.boundingBox.min.y) || isNaN(this.boundingBox.min.z)) { console.error('THREE.BufferGeometry.computeBoundingBox(): Computed min/max have NaN values. The "position" attribute is likely to have NaN values.', this); } } - computeBoundingSphere() { if (this.boundingSphere === null) { this.boundingSphere = new Sphere(); } - const position = this.attributes.position; const morphAttributesPosition = this.morphAttributes.position; - if (position && position.isGLBufferAttribute) { console.error('THREE.BufferGeometry.computeBoundingSphere(): GLBufferAttribute requires a manual bounding sphere. Alternatively set "mesh.frustumCulled" to "false".', this); this.boundingSphere.set(new Vector3(), Infinity); return; } - if (position) { // first, find the center of the bounding sphere - const center = this.boundingSphere.center; - _box$2.setFromBufferAttribute(position); // process morph attributes if present + const center = this.boundingSphere.center; + _box$2.setFromBufferAttribute(position); + // process morph attributes if present if (morphAttributesPosition) { for (let i = 0, il = morphAttributesPosition.length; i < il; i++) { const morphAttribute = morphAttributesPosition[i]; - _boxMorphTargets.setFromBufferAttribute(morphAttribute); - if (this.morphTargetsRelative) { _vector$8.addVectors(_box$2.min, _boxMorphTargets.min); - _box$2.expandByPoint(_vector$8); - _vector$8.addVectors(_box$2.max, _boxMorphTargets.max); - _box$2.expandByPoint(_vector$8); } else { _box$2.expandByPoint(_boxMorphTargets.min); - _box$2.expandByPoint(_boxMorphTargets.max); } } } + _box$2.getCenter(center); - _box$2.getCenter(center); // second, try to find a boundingSphere with a radius smaller than the + // second, try to find a boundingSphere with a radius smaller than the // boundingSphere of the boundingBox: sqrt(3) smaller in the best case - let maxRadiusSq = 0; - for (let i = 0, il = position.count; i < il; i++) { _vector$8.fromBufferAttribute(position, i); - maxRadiusSq = Math.max(maxRadiusSq, center.distanceToSquared(_vector$8)); - } // process morph attributes if present + } + // process morph attributes if present if (morphAttributesPosition) { for (let i = 0, il = morphAttributesPosition.length; i < il; i++) { const morphAttribute = morphAttributesPosition[i]; const morphTargetsRelative = this.morphTargetsRelative; - for (let j = 0, jl = morphAttribute.count; j < jl; j++) { _vector$8.fromBufferAttribute(morphAttribute, j); - if (morphTargetsRelative) { _offset.fromBufferAttribute(position, j); - _vector$8.add(_offset); } - maxRadiusSq = Math.max(maxRadiusSq, center.distanceToSquared(_vector$8)); } } } - this.boundingSphere.radius = Math.sqrt(maxRadiusSq); - if (isNaN(this.boundingSphere.radius)) { console.error('THREE.BufferGeometry.computeBoundingSphere(): Computed radius is NaN. The "position" attribute is likely to have NaN values.', this); } } } - computeTangents() { const index = this.index; - const attributes = this.attributes; // based on http://www.terathon.com/code/tangent.html + const attributes = this.attributes; + + // based on http://www.terathon.com/code/tangent.html // (per vertex tangents) if (index === null || attributes.position === undefined || attributes.normal === undefined || attributes.uv === undefined) { console.error('THREE.BufferGeometry: .computeTangents() failed. Missing required attributes (index, position, normal or uv)'); return; } - const indices = index.array; const positions = attributes.position.array; const normals = attributes.normal.array; const uvs = attributes.uv.array; const nVertices = positions.length / 3; - if (attributes.tangent === undefined) { this.setAttribute('tangent', new BufferAttribute(new Float32Array(4 * nVertices), 4)); } - const tangents = attributes.tangent.array; const tan1 = [], - tan2 = []; - + tan2 = []; for (let i = 0; i < nVertices; i++) { tan1[i] = new Vector3(); tan2[i] = new Vector3(); } - const vA = new Vector3(), - vB = new Vector3(), - vC = new Vector3(), - uvA = new Vector2(), - uvB = new Vector2(), - uvC = new Vector2(), - sdir = new Vector3(), - tdir = new Vector3(); - + vB = new Vector3(), + vC = new Vector3(), + uvA = new Vector2(), + uvB = new Vector2(), + uvC = new Vector2(), + sdir = new Vector3(), + tdir = new Vector3(); function handleTriangle(a, b, c) { vA.fromArray(positions, a * 3); vB.fromArray(positions, b * 3); @@ -7716,7 +6650,9 @@ vC.sub(vA); uvB.sub(uvA); uvC.sub(uvA); - const r = 1.0 / (uvB.x * uvC.y - uvC.x * uvB.y); // silently ignore degenerate uv triangles having coincident or colinear vertices + const r = 1.0 / (uvB.x * uvC.y - uvC.x * uvB.y); + + // silently ignore degenerate uv triangles having coincident or colinear vertices if (!isFinite(r)) return; sdir.copy(vB).multiplyScalar(uvC.y).addScaledVector(vC, -uvB.y).multiplyScalar(r); @@ -7728,38 +6664,36 @@ tan2[b].add(tdir); tan2[c].add(tdir); } - let groups = this.groups; - if (groups.length === 0) { groups = [{ start: 0, count: indices.length }]; } - for (let i = 0, il = groups.length; i < il; ++i) { const group = groups[i]; const start = group.start; const count = group.count; - for (let j = start, jl = start + count; j < jl; j += 3) { handleTriangle(indices[j + 0], indices[j + 1], indices[j + 2]); } } - const tmp = new Vector3(), - tmp2 = new Vector3(); + tmp2 = new Vector3(); const n = new Vector3(), - n2 = new Vector3(); - + n2 = new Vector3(); function handleVertex(v) { n.fromArray(normals, v * 3); n2.copy(n); - const t = tan1[v]; // Gram-Schmidt orthogonalize + const t = tan1[v]; + + // Gram-Schmidt orthogonalize tmp.copy(t); - tmp.sub(n.multiplyScalar(n.dot(t))).normalize(); // Calculate handedness + tmp.sub(n.multiplyScalar(n.dot(t))).normalize(); + + // Calculate handedness tmp2.crossVectors(n2, t); const test = tmp2.dot(tan2[v]); @@ -7769,12 +6703,10 @@ tangents[v * 4 + 2] = tmp.z; tangents[v * 4 + 3] = w; } - for (let i = 0, il = groups.length; i < il; ++i) { const group = groups[i]; const start = group.start; const count = group.count; - for (let j = start, jl = start + count; j < jl; j += 3) { handleVertex(indices[j + 0]); handleVertex(indices[j + 1]); @@ -7782,32 +6714,31 @@ } } } - computeVertexNormals() { const index = this.index; const positionAttribute = this.getAttribute('position'); - if (positionAttribute !== undefined) { let normalAttribute = this.getAttribute('normal'); - if (normalAttribute === undefined) { normalAttribute = new BufferAttribute(new Float32Array(positionAttribute.count * 3), 3); this.setAttribute('normal', normalAttribute); } else { // reset existing normals to zero + for (let i = 0, il = normalAttribute.count; i < il; i++) { normalAttribute.setXYZ(i, 0, 0, 0); } } - const pA = new Vector3(), - pB = new Vector3(), - pC = new Vector3(); + pB = new Vector3(), + pC = new Vector3(); const nA = new Vector3(), - nB = new Vector3(), - nC = new Vector3(); + nB = new Vector3(), + nC = new Vector3(); const cb = new Vector3(), - ab = new Vector3(); // indexed elements + ab = new Vector3(); + + // indexed elements if (index) { for (let i = 0, il = index.count; i < il; i += 3) { @@ -7832,6 +6763,7 @@ } } else { // non-indexed elements (unconnected triangle soup) + for (let i = 0, il = positionAttribute.count; i < il; i += 3) { pA.fromBufferAttribute(positionAttribute, i + 0); pB.fromBufferAttribute(positionAttribute, i + 1); @@ -7844,25 +6776,20 @@ normalAttribute.setXYZ(i + 2, cb.x, cb.y, cb.z); } } - this.normalizeNormals(); normalAttribute.needsUpdate = true; } } - merge(geometry, offset) { if (!(geometry && geometry.isBufferGeometry)) { console.error('THREE.BufferGeometry.merge(): geometry not an instance of THREE.BufferGeometry.', geometry); return; } - if (offset === undefined) { offset = 0; console.warn('THREE.BufferGeometry.merge(): Overwriting original geometry, starting at offset=0. ' + 'Use BufferGeometryUtils.mergeBufferGeometries() for lossless merge.'); } - const attributes = this.attributes; - for (const key in attributes) { if (geometry.attributes[key] === undefined) continue; const attribute1 = attributes[key]; @@ -7871,27 +6798,20 @@ const attributeArray2 = attribute2.array; const attributeOffset = attribute2.itemSize * offset; const length = Math.min(attributeArray2.length, attributeArray1.length - attributeOffset); - for (let i = 0, j = attributeOffset; i < length; i++, j++) { attributeArray1[j] = attributeArray2[i]; } } - return this; } - normalizeNormals() { const normals = this.attributes.normal; - for (let i = 0, il = normals.count; i < il; i++) { _vector$8.fromBufferAttribute(normals, i); - _vector$8.normalize(); - normals.setXYZ(i, _vector$8.x, _vector$8.y, _vector$8.z); } } - toNonIndexed() { function convertBufferAttribute(attribute, indices) { const array = attribute.array; @@ -7899,42 +6819,41 @@ const normalized = attribute.normalized; const array2 = new array.constructor(indices.length * itemSize); let index = 0, - index2 = 0; - + index2 = 0; for (let i = 0, l = indices.length; i < l; i++) { if (attribute.isInterleavedBufferAttribute) { index = indices[i] * attribute.data.stride + attribute.offset; } else { index = indices[i] * itemSize; } - for (let j = 0; j < itemSize; j++) { array2[index2++] = array[index++]; } } - return new BufferAttribute(array2, itemSize, normalized); - } // + } + // if (this.index === null) { console.warn('THREE.BufferGeometry.toNonIndexed(): BufferGeometry is already non-indexed.'); return this; } - const geometry2 = new BufferGeometry(); const indices = this.index.array; - const attributes = this.attributes; // attributes + const attributes = this.attributes; + + // attributes for (const name in attributes) { const attribute = attributes[name]; const newAttribute = convertBufferAttribute(attribute, indices); geometry2.setAttribute(name, newAttribute); - } // morph attributes + } + // morph attributes const morphAttributes = this.morphAttributes; - for (const name in morphAttributes) { const morphArray = []; const morphAttribute = morphAttributes[name]; // morphAttribute: array of Float32BufferAttributes @@ -7944,22 +6863,19 @@ const newAttribute = convertBufferAttribute(attribute, indices); morphArray.push(newAttribute); } - geometry2.morphAttributes[name] = morphArray; } + geometry2.morphTargetsRelative = this.morphTargetsRelative; - geometry2.morphTargetsRelative = this.morphTargetsRelative; // groups + // groups const groups = this.groups; - for (let i = 0, l = groups.length; i < l; i++) { const group = groups[i]; geometry2.addGroup(group.start, group.count, group.materialIndex); } - return geometry2; } - toJSON() { const data = { metadata: { @@ -7967,118 +6883,109 @@ type: 'BufferGeometry', generator: 'BufferGeometry.toJSON' } - }; // standard BufferGeometry serialization + }; + + // standard BufferGeometry serialization data.uuid = this.uuid; data.type = this.type; if (this.name !== '') data.name = this.name; if (Object.keys(this.userData).length > 0) data.userData = this.userData; - if (this.parameters !== undefined) { const parameters = this.parameters; - for (const key in parameters) { if (parameters[key] !== undefined) data[key] = parameters[key]; } - return data; - } // for simplicity the code assumes attributes are not shared across geometries, see #15811 + } + // for simplicity the code assumes attributes are not shared across geometries, see #15811 data.data = { attributes: {} }; const index = this.index; - if (index !== null) { data.data.index = { type: index.array.constructor.name, array: Array.prototype.slice.call(index.array) }; } - const attributes = this.attributes; - for (const key in attributes) { const attribute = attributes[key]; data.data.attributes[key] = attribute.toJSON(data.data); } - const morphAttributes = {}; let hasMorphAttributes = false; - for (const key in this.morphAttributes) { const attributeArray = this.morphAttributes[key]; const array = []; - for (let i = 0, il = attributeArray.length; i < il; i++) { const attribute = attributeArray[i]; array.push(attribute.toJSON(data.data)); } - if (array.length > 0) { morphAttributes[key] = array; hasMorphAttributes = true; } } - if (hasMorphAttributes) { data.data.morphAttributes = morphAttributes; data.data.morphTargetsRelative = this.morphTargetsRelative; } - const groups = this.groups; - if (groups.length > 0) { data.data.groups = JSON.parse(JSON.stringify(groups)); } - const boundingSphere = this.boundingSphere; - if (boundingSphere !== null) { data.data.boundingSphere = { center: boundingSphere.center.toArray(), radius: boundingSphere.radius }; } - return data; } - clone() { return new this.constructor().copy(this); } - copy(source) { // reset + this.index = null; this.attributes = {}; this.morphAttributes = {}; this.groups = []; this.boundingBox = null; - this.boundingSphere = null; // used for storing cloned, shared data + this.boundingSphere = null; - const data = {}; // name + // used for storing cloned, shared data - this.name = source.name; // index + const data = {}; - const index = source.index; + // name + + this.name = source.name; + // index + + const index = source.index; if (index !== null) { this.setIndex(index.clone(data)); - } // attributes + } + // attributes const attributes = source.attributes; - for (const name in attributes) { const attribute = attributes[name]; this.setAttribute(name, attribute.clone(data)); - } // morph attributes + } + // morph attributes const morphAttributes = source.morphAttributes; - for (const name in morphAttributes) { const array = []; const morphAttribute = morphAttributes[name]; // morphAttribute: array of Float32BufferAttributes @@ -8086,87 +6993,71 @@ for (let i = 0, l = morphAttribute.length; i < l; i++) { array.push(morphAttribute[i].clone(data)); } - this.morphAttributes[name] = array; } + this.morphTargetsRelative = source.morphTargetsRelative; - this.morphTargetsRelative = source.morphTargetsRelative; // groups + // groups const groups = source.groups; - for (let i = 0, l = groups.length; i < l; i++) { const group = groups[i]; this.addGroup(group.start, group.count, group.materialIndex); - } // bounding box + } + // bounding box const boundingBox = source.boundingBox; - if (boundingBox !== null) { this.boundingBox = boundingBox.clone(); - } // bounding sphere + } + // bounding sphere const boundingSphere = source.boundingSphere; - if (boundingSphere !== null) { this.boundingSphere = boundingSphere.clone(); - } // draw range + } + // draw range this.drawRange.start = source.drawRange.start; - this.drawRange.count = source.drawRange.count; // user data + this.drawRange.count = source.drawRange.count; + + // user data - this.userData = source.userData; // geometry generator parameters + this.userData = source.userData; + + // geometry generator parameters if (source.parameters !== undefined) this.parameters = Object.assign({}, source.parameters); return this; } - dispose() { this.dispatchEvent({ type: 'dispose' }); } - } - BufferGeometry.prototype.isBufferGeometry = true; const _inverseMatrix$2 = /*@__PURE__*/new Matrix4(); - const _ray$2 = /*@__PURE__*/new Ray(); - const _sphere$3 = /*@__PURE__*/new Sphere(); - const _vA$1 = /*@__PURE__*/new Vector3(); - const _vB$1 = /*@__PURE__*/new Vector3(); - const _vC$1 = /*@__PURE__*/new Vector3(); - const _tempA = /*@__PURE__*/new Vector3(); - const _tempB = /*@__PURE__*/new Vector3(); - const _tempC = /*@__PURE__*/new Vector3(); - const _morphA = /*@__PURE__*/new Vector3(); - const _morphB = /*@__PURE__*/new Vector3(); - const _morphC = /*@__PURE__*/new Vector3(); - const _uvA$1 = /*@__PURE__*/new Vector2(); - const _uvB$1 = /*@__PURE__*/new Vector2(); - const _uvC$1 = /*@__PURE__*/new Vector2(); - const _intersectionPoint = /*@__PURE__*/new Vector3(); - const _intersectionPointWorld = /*@__PURE__*/new Vector3(); - class Mesh extends Object3D { constructor(geometry = new BufferGeometry(), material = new MeshBasicMaterial()) { super(); @@ -8175,37 +7066,28 @@ this.material = material; this.updateMorphTargets(); } - copy(source) { super.copy(source); - if (source.morphTargetInfluences !== undefined) { this.morphTargetInfluences = source.morphTargetInfluences.slice(); } - if (source.morphTargetDictionary !== undefined) { this.morphTargetDictionary = Object.assign({}, source.morphTargetDictionary); } - this.material = source.material; this.geometry = source.geometry; return this; } - updateMorphTargets() { const geometry = this.geometry; - if (geometry.isBufferGeometry) { const morphAttributes = geometry.morphAttributes; const keys = Object.keys(morphAttributes); - if (keys.length > 0) { const morphAttribute = morphAttributes[keys[0]]; - if (morphAttribute !== undefined) { this.morphTargetInfluences = []; this.morphTargetDictionary = {}; - for (let m = 0, ml = morphAttribute.length; m < ml; m++) { const name = morphAttribute[m].name || String(m); this.morphTargetInfluences.push(0); @@ -8215,38 +7097,35 @@ } } else { const morphTargets = geometry.morphTargets; - if (morphTargets !== undefined && morphTargets.length > 0) { console.error('THREE.Mesh.updateMorphTargets() no longer supports THREE.Geometry. Use THREE.BufferGeometry instead.'); } } } - raycast(raycaster, intersects) { const geometry = this.geometry; const material = this.material; const matrixWorld = this.matrixWorld; - if (material === undefined) return; // Checking boundingSphere distance to ray + if (material === undefined) return; - if (geometry.boundingSphere === null) geometry.computeBoundingSphere(); + // Checking boundingSphere distance to ray + if (geometry.boundingSphere === null) geometry.computeBoundingSphere(); _sphere$3.copy(geometry.boundingSphere); - _sphere$3.applyMatrix4(matrixWorld); + if (raycaster.ray.intersectsSphere(_sphere$3) === false) return; - if (raycaster.ray.intersectsSphere(_sphere$3) === false) return; // + // _inverseMatrix$2.copy(matrixWorld).invert(); + _ray$2.copy(raycaster.ray).applyMatrix4(_inverseMatrix$2); - _ray$2.copy(raycaster.ray).applyMatrix4(_inverseMatrix$2); // Check boundingBox before continuing - + // Check boundingBox before continuing if (geometry.boundingBox !== null) { if (_ray$2.intersectsBox(geometry.boundingBox) === false) return; } - let intersection; - if (geometry.isBufferGeometry) { const index = geometry.index; const position = geometry.attributes.position; @@ -8256,25 +7135,22 @@ const uv2 = geometry.attributes.uv2; const groups = geometry.groups; const drawRange = geometry.drawRange; - if (index !== null) { // indexed buffer geometry + if (Array.isArray(material)) { for (let i = 0, il = groups.length; i < il; i++) { const group = groups[i]; const groupMaterial = material[group.materialIndex]; const start = Math.max(group.start, drawRange.start); const end = Math.min(index.count, Math.min(group.start + group.count, drawRange.start + drawRange.count)); - for (let j = start, jl = end; j < jl; j += 3) { const a = index.getX(j); const b = index.getX(j + 1); const c = index.getX(j + 2); intersection = checkBufferGeometryIntersection(this, groupMaterial, raycaster, _ray$2, position, morphPosition, morphTargetsRelative, uv, uv2, a, b, c); - if (intersection) { intersection.faceIndex = Math.floor(j / 3); // triangle number in indexed buffer semantics - intersection.face.materialIndex = group.materialIndex; intersects.push(intersection); } @@ -8283,38 +7159,33 @@ } else { const start = Math.max(0, drawRange.start); const end = Math.min(index.count, drawRange.start + drawRange.count); - for (let i = start, il = end; i < il; i += 3) { const a = index.getX(i); const b = index.getX(i + 1); const c = index.getX(i + 2); intersection = checkBufferGeometryIntersection(this, material, raycaster, _ray$2, position, morphPosition, morphTargetsRelative, uv, uv2, a, b, c); - if (intersection) { intersection.faceIndex = Math.floor(i / 3); // triangle number in indexed buffer semantics - intersects.push(intersection); } } } } else if (position !== undefined) { // non-indexed buffer geometry + if (Array.isArray(material)) { for (let i = 0, il = groups.length; i < il; i++) { const group = groups[i]; const groupMaterial = material[group.materialIndex]; const start = Math.max(group.start, drawRange.start); const end = Math.min(position.count, Math.min(group.start + group.count, drawRange.start + drawRange.count)); - for (let j = start, jl = end; j < jl; j += 3) { const a = j; const b = j + 1; const c = j + 2; intersection = checkBufferGeometryIntersection(this, groupMaterial, raycaster, _ray$2, position, morphPosition, morphTargetsRelative, uv, uv2, a, b, c); - if (intersection) { intersection.faceIndex = Math.floor(j / 3); // triangle number in non-indexed buffer semantics - intersection.face.materialIndex = group.materialIndex; intersects.push(intersection); } @@ -8323,16 +7194,13 @@ } else { const start = Math.max(0, drawRange.start); const end = Math.min(position.count, drawRange.start + drawRange.count); - for (let i = start, il = end; i < il; i += 3) { const a = i; const b = i + 1; const c = i + 2; intersection = checkBufferGeometryIntersection(this, material, raycaster, _ray$2, position, morphPosition, morphTargetsRelative, uv, uv2, a, b, c); - if (intersection) { intersection.faceIndex = Math.floor(i / 3); // triangle number in non-indexed buffer semantics - intersects.push(intersection); } } @@ -8342,26 +7210,18 @@ console.error('THREE.Mesh.raycast() no longer supports THREE.Geometry. Use THREE.BufferGeometry instead.'); } } - } - Mesh.prototype.isMesh = true; - function checkIntersection(object, material, raycaster, ray, pA, pB, pC, point) { let intersect; - if (material.side === BackSide) { intersect = ray.intersectTriangle(pC, pB, pA, true, point); } else { intersect = ray.intersectTriangle(pA, pB, pC, material.side !== DoubleSide, point); } - if (intersect === null) return null; - _intersectionPointWorld.copy(point); - _intersectionPointWorld.applyMatrix4(object.matrixWorld); - const distance = raycaster.ray.origin.distanceTo(_intersectionPointWorld); if (distance < raycaster.near || distance > raycaster.far) return null; return { @@ -8370,85 +7230,55 @@ object: object }; } - function checkBufferGeometryIntersection(object, material, raycaster, ray, position, morphPosition, morphTargetsRelative, uv, uv2, a, b, c) { _vA$1.fromBufferAttribute(position, a); - _vB$1.fromBufferAttribute(position, b); - _vC$1.fromBufferAttribute(position, c); - const morphInfluences = object.morphTargetInfluences; - if (morphPosition && morphInfluences) { _morphA.set(0, 0, 0); - _morphB.set(0, 0, 0); - _morphC.set(0, 0, 0); - for (let i = 0, il = morphPosition.length; i < il; i++) { const influence = morphInfluences[i]; const morphAttribute = morphPosition[i]; if (influence === 0) continue; - _tempA.fromBufferAttribute(morphAttribute, a); - _tempB.fromBufferAttribute(morphAttribute, b); - _tempC.fromBufferAttribute(morphAttribute, c); - if (morphTargetsRelative) { _morphA.addScaledVector(_tempA, influence); - _morphB.addScaledVector(_tempB, influence); - _morphC.addScaledVector(_tempC, influence); } else { _morphA.addScaledVector(_tempA.sub(_vA$1), influence); - _morphB.addScaledVector(_tempB.sub(_vB$1), influence); - _morphC.addScaledVector(_tempC.sub(_vC$1), influence); } } - _vA$1.add(_morphA); - _vB$1.add(_morphB); - _vC$1.add(_morphC); } - if (object.isSkinnedMesh) { object.boneTransform(a, _vA$1); object.boneTransform(b, _vB$1); object.boneTransform(c, _vC$1); } - const intersection = checkIntersection(object, material, raycaster, ray, _vA$1, _vB$1, _vC$1, _intersectionPoint); - if (intersection) { if (uv) { _uvA$1.fromBufferAttribute(uv, a); - _uvB$1.fromBufferAttribute(uv, b); - _uvC$1.fromBufferAttribute(uv, c); - intersection.uv = Triangle.getUV(_intersectionPoint, _vA$1, _vB$1, _vC$1, _uvA$1, _uvB$1, _uvC$1, new Vector2()); } - if (uv2) { _uvA$1.fromBufferAttribute(uv2, a); - _uvB$1.fromBufferAttribute(uv2, b); - _uvC$1.fromBufferAttribute(uv2, c); - intersection.uv2 = Triangle.getUV(_intersectionPoint, _vA$1, _vB$1, _vC$1, _uvA$1, _uvB$1, _uvC$1, new Vector2()); } - const face = { a: a, b: b, @@ -8459,7 +7289,6 @@ Triangle.getNormal(_vA$1, _vB$1, _vC$1, face.normal); intersection.face = face; } - return intersection; } @@ -8475,38 +7304,41 @@ heightSegments: heightSegments, depthSegments: depthSegments }; - const scope = this; // segments + const scope = this; + + // segments widthSegments = Math.floor(widthSegments); heightSegments = Math.floor(heightSegments); - depthSegments = Math.floor(depthSegments); // buffers + depthSegments = Math.floor(depthSegments); + + // buffers const indices = []; const vertices = []; const normals = []; - const uvs = []; // helper variables + const uvs = []; + + // helper variables let numberOfVertices = 0; - let groupStart = 0; // build each side of the box geometry + let groupStart = 0; - buildPlane('z', 'y', 'x', -1, -1, depth, height, width, depthSegments, heightSegments, 0); // px + // build each side of the box geometry + buildPlane('z', 'y', 'x', -1, -1, depth, height, width, depthSegments, heightSegments, 0); // px buildPlane('z', 'y', 'x', 1, -1, depth, height, -width, depthSegments, heightSegments, 1); // nx - buildPlane('x', 'z', 'y', 1, 1, width, depth, height, widthSegments, depthSegments, 2); // py - buildPlane('x', 'z', 'y', 1, -1, width, depth, -height, widthSegments, depthSegments, 3); // ny - buildPlane('x', 'y', 'z', 1, -1, width, height, depth, widthSegments, heightSegments, 4); // pz - buildPlane('x', 'y', 'z', -1, -1, width, height, -depth, widthSegments, heightSegments, 5); // nz + // build geometry this.setIndex(indices); this.setAttribute('position', new Float32BufferAttribute(vertices, 3)); this.setAttribute('normal', new Float32BufferAttribute(normals, 3)); this.setAttribute('uv', new Float32BufferAttribute(uvs, 2)); - function buildPlane(u, v, w, udir, vdir, width, height, depth, gridX, gridY, materialIndex) { const segmentWidth = width / gridX; const segmentHeight = height / gridY; @@ -8517,78 +7349,98 @@ const gridY1 = gridY + 1; let vertexCounter = 0; let groupCount = 0; - const vector = new Vector3(); // generate vertices, normals and uvs + const vector = new Vector3(); + + // generate vertices, normals and uvs for (let iy = 0; iy < gridY1; iy++) { const y = iy * segmentHeight - heightHalf; - for (let ix = 0; ix < gridX1; ix++) { - const x = ix * segmentWidth - widthHalf; // set values to correct vector component + const x = ix * segmentWidth - widthHalf; + + // set values to correct vector component vector[u] = x * udir; vector[v] = y * vdir; - vector[w] = depthHalf; // now apply vector to vertex buffer + vector[w] = depthHalf; - vertices.push(vector.x, vector.y, vector.z); // set values to correct vector component + // now apply vector to vertex buffer + + vertices.push(vector.x, vector.y, vector.z); + + // set values to correct vector component vector[u] = 0; vector[v] = 0; - vector[w] = depth > 0 ? 1 : -1; // now apply vector to normal buffer + vector[w] = depth > 0 ? 1 : -1; + + // now apply vector to normal buffer + + normals.push(vector.x, vector.y, vector.z); - normals.push(vector.x, vector.y, vector.z); // uvs + // uvs uvs.push(ix / gridX); - uvs.push(1 - iy / gridY); // counters + uvs.push(1 - iy / gridY); + + // counters vertexCounter += 1; } - } // indices + } + + // indices + // 1. you need three indices to draw a single face // 2. a single segment consists of two faces // 3. so we need to generate six (2*3) indices per segment - for (let iy = 0; iy < gridY; iy++) { for (let ix = 0; ix < gridX; ix++) { const a = numberOfVertices + ix + gridX1 * iy; const b = numberOfVertices + ix + gridX1 * (iy + 1); const c = numberOfVertices + (ix + 1) + gridX1 * (iy + 1); - const d = numberOfVertices + (ix + 1) + gridX1 * iy; // faces + const d = numberOfVertices + (ix + 1) + gridX1 * iy; + + // faces indices.push(a, b, d); - indices.push(b, c, d); // increase counter + indices.push(b, c, d); + + // increase counter groupCount += 6; } - } // add a group to the geometry. this will ensure multi material support + } + + // add a group to the geometry. this will ensure multi material support + scope.addGroup(groupStart, groupCount, materialIndex); - scope.addGroup(groupStart, groupCount, materialIndex); // calculate new start value for groups + // calculate new start value for groups + + groupStart += groupCount; - groupStart += groupCount; // update total number of vertices + // update total number of vertices numberOfVertices += vertexCounter; } } - static fromJSON(data) { return new BoxGeometry(data.width, data.height, data.depth, data.widthSegments, data.heightSegments, data.depthSegments); } - } /** * Uniform Utilities */ + function cloneUniforms(src) { const dst = {}; - for (const u in src) { dst[u] = {}; - for (const p in src[u]) { const property = src[u][p]; - if (property && (property.isColor || property.isMatrix3 || property.isMatrix4 || property.isVector2 || property.isVector3 || property.isVector4 || property.isTexture || property.isQuaternion)) { dst[u][p] = property.clone(); } else if (Array.isArray(property)) { @@ -8598,22 +7450,20 @@ } } } - return dst; } function mergeUniforms(uniforms) { const merged = {}; - for (let u = 0; u < uniforms.length; u++) { const tmp = cloneUniforms(uniforms[u]); - for (const p in tmp) { merged[p] = tmp[p]; } } - return merged; - } // Legacy + } + + // Legacy const UniformsUtils = { clone: cloneUniforms, @@ -8651,9 +7501,7 @@ this.wireframe = false; this.wireframeLinewidth = 1; this.fog = false; // set to use scene fog - this.lights = false; // set to use scene lights - this.clipping = false; // set to use user-defined clipping planes this.extensions = { @@ -8664,10 +7512,10 @@ drawBuffers: false, // set to use draw buffers shaderTextureLOD: false // set to use shader texture LOD + }; - }; // When rendered geometry doesn't include these attributes but the material does, + // When rendered geometry doesn't include these attributes but the material does, // use these default values in WebGL. This avoids errors when buffer data is missing. - this.defaultAttributeValues = { 'color': [1, 1, 1], 'uv': [0, 0], @@ -8676,16 +7524,13 @@ this.index0AttributeName = undefined; this.uniformsNeedUpdate = false; this.glslVersion = null; - if (parameters !== undefined) { if (parameters.attributes !== undefined) { console.error('THREE.ShaderMaterial: attributes should now be defined in THREE.BufferGeometry instead.'); } - this.setValues(parameters); } } - copy(source) { super.copy(source); this.fragmentShader = source.fragmentShader; @@ -8700,16 +7545,13 @@ this.glslVersion = source.glslVersion; return this; } - toJSON(meta) { const data = super.toJSON(meta); data.glslVersion = this.glslVersion; data.uniforms = {}; - for (const name in this.uniforms) { const uniform = this.uniforms[name]; const value = uniform.value; - if (value && value.isTexture) { data.uniforms[name] = { type: 't', @@ -8748,25 +7590,22 @@ } else { data.uniforms[name] = { value: value - }; // note: the array variants v2v, v3v, v4v, m4v and tv are not supported so far + }; + + // note: the array variants v2v, v3v, v4v, m4v and tv are not supported so far } } - if (Object.keys(this.defines).length > 0) data.defines = this.defines; data.vertexShader = this.vertexShader; data.fragmentShader = this.fragmentShader; const extensions = {}; - for (const key in this.extensions) { if (this.extensions[key] === true) extensions[key] = true; } - if (Object.keys(extensions).length > 0) data.extensions = extensions; return data; } - } - ShaderMaterial.prototype.isShaderMaterial = true; class Camera extends Object3D { @@ -8777,7 +7616,6 @@ this.projectionMatrix = new Matrix4(); this.projectionMatrixInverse = new Matrix4(); } - copy(source, recursive) { super.copy(source, recursive); this.matrixWorldInverse.copy(source.matrixWorldInverse); @@ -8785,29 +7623,23 @@ this.projectionMatrixInverse.copy(source.projectionMatrixInverse); return this; } - getWorldDirection(target) { this.updateWorldMatrix(true, false); const e = this.matrixWorld.elements; return target.set(-e[8], -e[9], -e[10]).normalize(); } - updateMatrixWorld(force) { super.updateMatrixWorld(force); this.matrixWorldInverse.copy(this.matrixWorld).invert(); } - updateWorldMatrix(updateParents, updateChildren) { super.updateWorldMatrix(updateParents, updateChildren); this.matrixWorldInverse.copy(this.matrixWorld).invert(); } - clone() { return new this.constructor().copy(this); } - } - Camera.prototype.isCamera = true; class PerspectiveCamera extends Camera { @@ -8822,12 +7654,10 @@ this.aspect = aspect; this.view = null; this.filmGauge = 35; // width of the film (default in millimeters) - this.filmOffset = 0; // horizontal film offset (same unit as gauge) this.updateProjectionMatrix(); } - copy(source, recursive) { super.copy(source, recursive); this.fov = source.fov; @@ -8841,6 +7671,7 @@ this.filmOffset = source.filmOffset; return this; } + /** * Sets the FOV by focal length in respect to the current .filmGauge. * @@ -8849,37 +7680,32 @@ * * Values for focal length and film gauge must have the same unit. */ - - setFocalLength(focalLength) { /** see {@link http://www.bobatkins.com/photography/technical/field_of_view.html} */ const vExtentSlope = 0.5 * this.getFilmHeight() / focalLength; this.fov = RAD2DEG * 2 * Math.atan(vExtentSlope); this.updateProjectionMatrix(); } + /** * Calculates the focal length from the current .fov and .filmGauge. */ - - getFocalLength() { const vExtentSlope = Math.tan(DEG2RAD * 0.5 * this.fov); return 0.5 * this.getFilmHeight() / vExtentSlope; } - getEffectiveFOV() { return RAD2DEG * 2 * Math.atan(Math.tan(DEG2RAD * 0.5 * this.fov) / this.zoom); } - getFilmWidth() { // film not completely covered in portrait format (aspect < 1) return this.filmGauge * Math.min(this.aspect, 1); } - getFilmHeight() { // film not completely covered in landscape format (aspect > 1) return this.filmGauge / Math.max(this.aspect, 1); } + /** * Sets an offset in a larger frustum. This is useful for multi-window or * multi-monitor/multi-machine setups. @@ -8915,11 +7741,8 @@ * * Note there is no reason monitors have to be the same size or in a grid. */ - - setViewOffset(fullWidth, fullHeight, x, y, width, height) { this.aspect = fullWidth / fullHeight; - if (this.view === null) { this.view = { enabled: true, @@ -8931,7 +7754,6 @@ height: 1 }; } - this.view.enabled = true; this.view.fullWidth = fullWidth; this.view.fullHeight = fullHeight; @@ -8941,15 +7763,12 @@ this.view.height = height; this.updateProjectionMatrix(); } - clearViewOffset() { if (this.view !== null) { this.view.enabled = false; } - this.updateProjectionMatrix(); } - updateProjectionMatrix() { const near = this.near; let top = near * Math.tan(DEG2RAD * 0.5 * this.fov) / this.zoom; @@ -8957,22 +7776,19 @@ let width = this.aspect * height; let left = -0.5 * width; const view = this.view; - if (this.view !== null && this.view.enabled) { const fullWidth = view.fullWidth, - fullHeight = view.fullHeight; + fullHeight = view.fullHeight; left += view.offsetX * width / fullWidth; top -= view.offsetY * height / fullHeight; width *= view.width / fullWidth; height *= view.height / fullHeight; } - const skew = this.filmOffset; if (skew !== 0) left += near * skew / this.getFilmWidth(); this.projectionMatrix.makePerspective(left, left + width, top, top - height, near, this.far); this.projectionMatrixInverse.copy(this.projectionMatrix).invert(); } - toJSON(meta) { const data = super.toJSON(meta); data.object.fov = this.fov; @@ -8986,24 +7802,19 @@ data.object.filmOffset = this.filmOffset; return data; } - } - PerspectiveCamera.prototype.isPerspectiveCamera = true; const fov = 90, - aspect = 1; - + aspect = 1; class CubeCamera extends Object3D { constructor(near, far, renderTarget) { super(); this.type = 'CubeCamera'; - if (renderTarget.isWebGLCubeRenderTarget !== true) { console.error('THREE.CubeCamera: The constructor now expects an instance of WebGLCubeRenderTarget as third parameter.'); return; } - this.renderTarget = renderTarget; const cameraPX = new PerspectiveCamera(fov, aspect, near, far); cameraPX.layers = this.layers; @@ -9036,7 +7847,6 @@ cameraNZ.lookAt(new Vector3(0, 0, -1)); this.add(cameraNZ); } - update(renderer, scene) { if (this.parent === null) this.updateMatrixWorld(); const renderTarget = this.renderTarget; @@ -9063,7 +7873,6 @@ renderer.xr.enabled = currentXrEnabled; renderTarget.texture.needsPMREMUpdate = true; } - } class CubeTexture extends Texture { @@ -9073,17 +7882,13 @@ super(images, mapping, wrapS, wrapT, magFilter, minFilter, format, type, anisotropy, encoding); this.flipY = false; } - get images() { return this.image; } - set images(value) { this.image = value; } - } - CubeTexture.prototype.isCubeTexture = true; class WebGLCubeRenderTarget extends WebGLRenderTarget { @@ -9092,11 +7897,13 @@ console.warn('THREE.WebGLCubeRenderTarget: constructor signature is now WebGLCubeRenderTarget( size, options )'); options = dummy; } - super(size, size, options); - options = options || {}; // By convention -- likely based on the RenderMan spec from the 1990's -- cube maps are specified by WebGL (and three.js) + options = options || {}; + + // By convention -- likely based on the RenderMan spec from the 1990's -- cube maps are specified by WebGL (and three.js) // in a coordinate system in which positive-x is to the right when looking up the positive-z axis -- in other words, // in a left-handed coordinate system. By continuing this convention, preexisting cube maps continued to render correctly. + // three.js uses a right-handed coordinate system. So environment maps used in three.js appear to have px and nx swapped // and the flag isRenderTargetTexture controls this conversion. The flip is not required when using WebGLCubeRenderTarget.texture // as a cube texture (this is detected when isRenderTargetTexture is set to true for cube textures). @@ -9106,11 +7913,9 @@ this.texture.generateMipmaps = options.generateMipmaps !== undefined ? options.generateMipmaps : false; this.texture.minFilter = options.minFilter !== undefined ? options.minFilter : LinearFilter; } - fromEquirectangularTexture(renderer, texture) { this.texture.type = texture.type; this.texture.format = RGBAFormat; // see #18859 - this.texture.encoding = texture.encoding; this.texture.generateMipmaps = texture.generateMipmaps; this.texture.minFilter = texture.minFilter; @@ -9121,9 +7926,7 @@ value: null } }, - vertexShader: - /* glsl */ - ` + vertexShader: /* glsl */` varying vec3 vWorldDirection; @@ -9142,9 +7945,7 @@ } `, - fragmentShader: - /* glsl */ - ` + fragmentShader: /* glsl */` uniform sampler2D tEquirect; @@ -9174,8 +7975,9 @@ }); material.uniforms.tEquirect.value = texture; const mesh = new Mesh(geometry, material); - const currentMinFilter = texture.minFilter; // Avoid blurred poles + const currentMinFilter = texture.minFilter; + // Avoid blurred poles if (texture.minFilter === LinearMipmapLinearFilter) texture.minFilter = LinearFilter; const camera = new CubeCamera(1, 10, this); camera.update(renderer, mesh); @@ -9184,170 +7986,137 @@ mesh.material.dispose(); return this; } - clear(renderer, color, depth, stencil) { const currentRenderTarget = renderer.getRenderTarget(); - for (let i = 0; i < 6; i++) { renderer.setRenderTarget(this, i); renderer.clear(color, depth, stencil); } - renderer.setRenderTarget(currentRenderTarget); } - } - WebGLCubeRenderTarget.prototype.isWebGLCubeRenderTarget = true; const _vector1 = /*@__PURE__*/new Vector3(); - const _vector2 = /*@__PURE__*/new Vector3(); - const _normalMatrix = /*@__PURE__*/new Matrix3(); - class Plane { constructor(normal = new Vector3(1, 0, 0), constant = 0) { // normal is assumed to be normalized + this.normal = normal; this.constant = constant; } - set(normal, constant) { this.normal.copy(normal); this.constant = constant; return this; } - setComponents(x, y, z, w) { this.normal.set(x, y, z); this.constant = w; return this; } - setFromNormalAndCoplanarPoint(normal, point) { this.normal.copy(normal); this.constant = -point.dot(this.normal); return this; } - setFromCoplanarPoints(a, b, c) { - const normal = _vector1.subVectors(c, b).cross(_vector2.subVectors(a, b)).normalize(); // Q: should an error be thrown if normal is zero (e.g. degenerate plane)? + const normal = _vector1.subVectors(c, b).cross(_vector2.subVectors(a, b)).normalize(); + // Q: should an error be thrown if normal is zero (e.g. degenerate plane)? this.setFromNormalAndCoplanarPoint(normal, a); return this; } - copy(plane) { this.normal.copy(plane.normal); this.constant = plane.constant; return this; } - normalize() { // Note: will lead to a divide by zero if the plane is invalid. + const inverseNormalLength = 1.0 / this.normal.length(); this.normal.multiplyScalar(inverseNormalLength); this.constant *= inverseNormalLength; return this; } - negate() { this.constant *= -1; this.normal.negate(); return this; } - distanceToPoint(point) { return this.normal.dot(point) + this.constant; } - distanceToSphere(sphere) { return this.distanceToPoint(sphere.center) - sphere.radius; } - projectPoint(point, target) { return target.copy(this.normal).multiplyScalar(-this.distanceToPoint(point)).add(point); } - intersectLine(line, target) { const direction = line.delta(_vector1); const denominator = this.normal.dot(direction); - if (denominator === 0) { // line is coplanar, return origin if (this.distanceToPoint(line.start) === 0) { return target.copy(line.start); - } // Unsure if this is the correct method to handle this case. - + } + // Unsure if this is the correct method to handle this case. return null; } - const t = -(line.start.dot(this.normal) + this.constant) / denominator; - if (t < 0 || t > 1) { return null; } - return target.copy(direction).multiplyScalar(t).add(line.start); } - intersectsLine(line) { // Note: this tests if a line intersects the plane, not whether it (or its end-points) are coplanar with it. + const startSign = this.distanceToPoint(line.start); const endSign = this.distanceToPoint(line.end); return startSign < 0 && endSign > 0 || endSign < 0 && startSign > 0; } - intersectsBox(box) { return box.intersectsPlane(this); } - intersectsSphere(sphere) { return sphere.intersectsPlane(this); } - coplanarPoint(target) { return target.copy(this.normal).multiplyScalar(-this.constant); } - applyMatrix4(matrix, optionalNormalMatrix) { const normalMatrix = optionalNormalMatrix || _normalMatrix.getNormalMatrix(matrix); - const referencePoint = this.coplanarPoint(_vector1).applyMatrix4(matrix); const normal = this.normal.applyMatrix3(normalMatrix).normalize(); this.constant = -referencePoint.dot(normal); return this; } - translate(offset) { this.constant -= offset.dot(this.normal); return this; } - equals(plane) { return plane.normal.equals(this.normal) && plane.constant === this.constant; } - clone() { return new this.constructor().copy(this); } - } - Plane.prototype.isPlane = true; const _sphere$2 = /*@__PURE__*/new Sphere(); - const _vector$7 = /*@__PURE__*/new Vector3(); - class Frustum { constructor(p0 = new Plane(), p1 = new Plane(), p2 = new Plane(), p3 = new Plane(), p4 = new Plane(), p5 = new Plane()) { this.planes = [p0, p1, p2, p3, p4, p5]; } - set(p0, p1, p2, p3, p4, p5) { const planes = this.planes; planes[0].copy(p0); @@ -9358,36 +8127,32 @@ planes[5].copy(p5); return this; } - copy(frustum) { const planes = this.planes; - for (let i = 0; i < 6; i++) { planes[i].copy(frustum.planes[i]); } - return this; } - setFromProjectionMatrix(m) { const planes = this.planes; const me = m.elements; const me0 = me[0], - me1 = me[1], - me2 = me[2], - me3 = me[3]; + me1 = me[1], + me2 = me[2], + me3 = me[3]; const me4 = me[4], - me5 = me[5], - me6 = me[6], - me7 = me[7]; + me5 = me[5], + me6 = me[6], + me7 = me[7]; const me8 = me[8], - me9 = me[9], - me10 = me[10], - me11 = me[11]; + me9 = me[9], + me10 = me[10], + me11 = me[11]; const me12 = me[12], - me13 = me[13], - me14 = me[14], - me15 = me[15]; + me13 = me[13], + me14 = me[14], + me15 = me[15]; planes[0].setComponents(me3 - me0, me7 - me4, me11 - me8, me15 - me12).normalize(); planes[1].setComponents(me3 + me0, me7 + me4, me11 + me8, me15 + me12).normalize(); planes[2].setComponents(me3 + me1, me7 + me5, me11 + me9, me15 + me13).normalize(); @@ -9396,85 +8161,65 @@ planes[5].setComponents(me3 + me2, me7 + me6, me11 + me10, me15 + me14).normalize(); return this; } - intersectsObject(object) { const geometry = object.geometry; if (geometry.boundingSphere === null) geometry.computeBoundingSphere(); - _sphere$2.copy(geometry.boundingSphere); - if (object.skeleton && object.skeleton.rootMotionBone) { const rootMotion = object.skeleton.rootMotionBone.matrixWorld.clone(); rootMotion.multiply(object.skeleton.rootMotionBoneInitialMatrixInverse); - _sphere$2.applyMatrix4(rootMotion); } else { _sphere$2.applyMatrix4(object.matrixWorld); } - return this.intersectsSphere(_sphere$2); } - intersectsSprite(sprite) { _sphere$2.center.set(0, 0, 0); - _sphere$2.radius = 0.7071067811865476; - _sphere$2.applyMatrix4(sprite.matrixWorld); - return this.intersectsSphere(_sphere$2); } - intersectsSphere(sphere) { const planes = this.planes; const center = sphere.center; const negRadius = -sphere.radius; - for (let i = 0; i < 6; i++) { const distance = planes[i].distanceToPoint(center); - if (distance < negRadius) { return false; } } - return true; } - intersectsBox(box) { const planes = this.planes; - for (let i = 0; i < 6; i++) { - const plane = planes[i]; // corner at max distance + const plane = planes[i]; + + // corner at max distance _vector$7.x = plane.normal.x > 0 ? box.max.x : box.min.x; _vector$7.y = plane.normal.y > 0 ? box.max.y : box.min.y; _vector$7.z = plane.normal.z > 0 ? box.max.z : box.min.z; - if (plane.distanceToPoint(_vector$7) < 0) { return false; } } - return true; } - containsPoint(point) { const planes = this.planes; - for (let i = 0; i < 6; i++) { if (planes[i].distanceToPoint(point) < 0) { return false; } } - return true; } - clone() { return new this.constructor().copy(this); } - } function WebGLAnimation() { @@ -9482,12 +8227,10 @@ let isAnimating = false; let animationLoop = null; let requestId = null; - function onAnimationFrame(time, frame) { animationLoop(time, frame); requestId = context.requestAnimationFrame(onAnimationFrame); } - return { start: function () { if (isAnimating === true) return; @@ -9511,7 +8254,6 @@ function WebGLAttributes(gl, capabilities) { const isWebGL2 = capabilities.isWebGL2; const buffers = new WeakMap(); - function createBuffer(attribute, bufferType) { const array = attribute.array; const usage = attribute.usage; @@ -9520,7 +8262,6 @@ gl.bufferData(bufferType, array, usage); attribute.onUploadCallback(); let type = gl.FLOAT; - if (array instanceof Float32Array) { type = gl.FLOAT; } else if (array instanceof Float64Array) { @@ -9548,7 +8289,6 @@ } else if (array instanceof Uint8ClampedArray) { type = gl.UNSIGNED_BYTE; } - return { buffer: buffer, type: type, @@ -9556,14 +8296,13 @@ version: attribute.version }; } - function updateBuffer(buffer, attribute, bufferType) { const array = attribute.array; const updateRange = attribute.updateRange; gl.bindBuffer(bufferType, buffer); - if (updateRange.count === -1) { // Not using update ranges + gl.bufferSubData(bufferType, 0, array); } else { if (isWebGL2) { @@ -9571,31 +8310,27 @@ } else { gl.bufferSubData(bufferType, updateRange.offset * array.BYTES_PER_ELEMENT, array.subarray(updateRange.offset, updateRange.offset + updateRange.count)); } - updateRange.count = -1; // reset range } - } // + } + // function get(attribute) { if (attribute.isInterleavedBufferAttribute) attribute = attribute.data; return buffers.get(attribute); } - function remove(attribute) { if (attribute.isInterleavedBufferAttribute) attribute = attribute.data; const data = buffers.get(attribute); - if (data) { gl.deleteBuffer(data.buffer); buffers.delete(attribute); } } - function update(attribute, bufferType) { if (attribute.isGLBufferAttribute) { const cached = buffers.get(attribute); - if (!cached || cached.version < attribute.version) { buffers.set(attribute, { buffer: attribute.buffer, @@ -9604,13 +8339,10 @@ version: attribute.version }); } - return; } - if (attribute.isInterleavedBufferAttribute) attribute = attribute.data; const data = buffers.get(attribute); - if (data === undefined) { buffers.set(attribute, createBuffer(attribute, bufferType)); } else if (data.version < attribute.version) { @@ -9618,7 +8350,6 @@ data.version = attribute.version; } } - return { get: get, remove: remove, @@ -9643,16 +8374,16 @@ const gridX1 = gridX + 1; const gridY1 = gridY + 1; const segment_width = width / gridX; - const segment_height = height / gridY; // + const segment_height = height / gridY; + + // const indices = []; const vertices = []; const normals = []; const uvs = []; - for (let iy = 0; iy < gridY1; iy++) { const y = iy * segment_height - height_half; - for (let ix = 0; ix < gridX1; ix++) { const x = ix * segment_width - width_half; vertices.push(x, -y, 0); @@ -9661,7 +8392,6 @@ uvs.push(1 - iy / gridY); } } - for (let iy = 0; iy < gridY; iy++) { for (let ix = 0; ix < gridX; ix++) { const a = ix + gridX1 * iy; @@ -9672,17 +8402,14 @@ indices.push(b, c, d); } } - this.setIndex(indices); this.setAttribute('position', new Float32BufferAttribute(vertices, 3)); this.setAttribute('normal', new Float32BufferAttribute(normals, 3)); this.setAttribute('uv', new Float32BufferAttribute(uvs, 2)); } - static fromJSON(data) { return new PlaneGeometry(data.width, data.height, data.widthSegments, data.heightSegments); } - } var alphamap_fragment = "#ifdef USE_ALPHAMAP\n\tdiffuseColor.a *= texture2D( alphaMap, vUv ).g;\n#endif"; @@ -10491,10 +9218,10 @@ vertexShader: ShaderChunk.background_vert, fragmentShader: ShaderChunk.background_frag }, - /* ------------------------------------------------------------------------- // Cube map shader ------------------------------------------------------------------------- */ + cube: { uniforms: mergeUniforms([UniformsLib.envmap, { opacity: { @@ -10626,52 +9353,45 @@ let currentBackgroundVersion = 0; let currentTonemapping = null; let currentBgToneMapped = null; - function render(renderList, scene, renderTarget) { let forceClear = false; let background = scene.isScene === true ? scene.background : null; const bgToneMapped = scene.isScene === true ? scene.bgToneMapped : false; - if (background && background.isTexture) { background = cubemaps.get(background); - } // Ignore background in AR - // TODO: Reconsider this. + } + // Ignore background in AR + // TODO: Reconsider this. const xr = renderer.xr; const session = xr.getSession && xr.getSession(); - if (session && session.environmentBlendMode === 'additive') { background = null; } - const color = clearColor.clone(); let alpha = clearAlpha; - if (background && background.isColor) { color.set(background); alpha = 1.0; forceClear = true; } - if (background === null || background.isColor) { - const outputEncoding = renderTarget !== null ? renderer.getTextureEncodingFromMap(renderTarget.texture) : renderer.outputEncoding; // Assume background color is in sRGB color space. + const outputEncoding = renderTarget !== null ? renderer.getTextureEncodingFromMap(renderTarget.texture) : renderer.outputEncoding; + // Assume background color is in sRGB color space. if (outputEncoding === LinearEncoding) { color.convertSRGBToLinear(); } else if (outputEncoding === RGBEEncoding) { color.convertSRGBToLinear(); alpha = 128.0 / 255.0; // Exponent will be 0. } - const premultiplyAlpha = renderTarget != null ? renderTarget.texture.premultiplyAlpha : premultipliedAlpha; setClear(color, alpha, premultiplyAlpha); } - if (renderer.autoClear || forceClear) { renderer.clear(renderer.autoClearColor, renderer.autoClearDepth, renderer.autoClearStencil); } - if (background && (background.isCubeTexture || background.mapping === CubeUVReflectionMapping)) { if (boxMesh === undefined) { boxMesh = new Mesh(new BoxGeometry(1, 1, 1), new ShaderMaterial({ @@ -10687,12 +9407,11 @@ boxMesh.layers.enableAll(); boxMesh.geometry.deleteAttribute('normal'); boxMesh.geometry.deleteAttribute('uv'); - boxMesh.onBeforeRender = function (renderer, scene, camera) { this.matrixWorld.copyPosition(camera.matrixWorld); - }; // enable code injection for non-built-in material - + }; + // enable code injection for non-built-in material Object.defineProperty(boxMesh.material, 'envMap', { get: function () { return this.uniforms.envMap.value; @@ -10700,20 +9419,18 @@ }); objects.update(boxMesh); } - boxMesh.material.toneMapped = bgToneMapped; boxMesh.material.uniforms.envMap.value = background; boxMesh.material.uniforms.flipEnvMap.value = background.isCubeTexture && background.isRenderTargetTexture === false ? -1 : 1; - if (currentBackground !== background || currentBackgroundVersion !== background.version || currentTonemapping !== renderer.toneMapping || currentBgToneMapped !== bgToneMapped) { boxMesh.material.needsUpdate = true; currentBackground = background; currentBackgroundVersion = background.version; currentTonemapping = renderer.toneMapping; currentBgToneMapped = bgToneMapped; - } // push to the pre-sorted opaque render list - + } + // push to the pre-sorted opaque render list renderList.unshift(boxMesh, boxMesh.geometry, boxMesh.material, 0, 0, null); } else if (background && background.isTexture) { if (planeMesh === undefined) { @@ -10728,8 +9445,9 @@ fog: false })); planeMesh.layers.enableAll(); - planeMesh.geometry.deleteAttribute('normal'); // enable code injection for non-built-in material + planeMesh.geometry.deleteAttribute('normal'); + // enable code injection for non-built-in material Object.defineProperty(planeMesh.material, 'map', { get: function () { return this.uniforms.t2D.value; @@ -10737,33 +9455,27 @@ }); objects.update(planeMesh); } - planeMesh.material.toneMapped = bgToneMapped; planeMesh.material.uniforms.t2D.value = background; - if (background.matrixAutoUpdate === true) { background.updateMatrix(); } - planeMesh.material.uniforms.uvTransform.value.copy(background.matrix); - if (currentBackground !== background || currentBackgroundVersion !== background.version || currentTonemapping !== renderer.toneMapping || currentBgToneMapped !== bgToneMapped) { planeMesh.material.needsUpdate = true; currentBackground = background; currentBackgroundVersion = background.version; currentTonemapping = renderer.toneMapping; currentBgToneMapped = bgToneMapped; - } // push to the pre-sorted opaque render list - + } + // push to the pre-sorted opaque render list renderList.unshift(planeMesh, planeMesh.geometry, planeMesh.material, 0, 0, null); } } - function setClear(color, alpha, premultiplyAlpha) { state.buffers.color.setClear(color.r, color.g, color.b, alpha, premultiplyAlpha); } - return { getClearColor: function () { return clearColor; @@ -10791,23 +9503,18 @@ const bindingStates = {}; const defaultState = createBindingState(null); let currentState = defaultState; - function setup(object, material, program, geometry, index) { let updateBuffers = false; - if (vaoAvailable) { const state = getBindingState(geometry, program, material); - if (currentState !== state) { currentState = state; bindVertexArrayObject(currentState.object); } - updateBuffers = needsUpdate(geometry, index); if (updateBuffers) saveCache(geometry, index); } else { const wireframe = material.wireframe === true; - if (currentState.geometry !== geometry.id || currentState.program !== program.id || currentState.wireframe !== wireframe) { currentState.geometry = geometry.id; currentState.program = program.id; @@ -10815,76 +9522,59 @@ updateBuffers = true; } } - if (object.isInstancedMesh === true) { updateBuffers = true; } - if (index !== null) { attributes.update(index, gl.ELEMENT_ARRAY_BUFFER); } - if (updateBuffers) { setupVertexAttributes(object, material, program, geometry); - if (index !== null) { gl.bindBuffer(gl.ELEMENT_ARRAY_BUFFER, attributes.get(index).buffer); } } } - function createVertexArrayObject() { if (capabilities.isWebGL2) return gl.createVertexArray(); return extension.createVertexArrayOES(); } - function bindVertexArrayObject(vao) { if (capabilities.isWebGL2) return gl.bindVertexArray(vao); return extension.bindVertexArrayOES(vao); } - function deleteVertexArrayObject(vao) { if (capabilities.isWebGL2) return gl.deleteVertexArray(vao); return extension.deleteVertexArrayOES(vao); } - function getBindingState(geometry, program, material) { const wireframe = material.wireframe === true; let programMap = bindingStates[geometry.id]; - if (programMap === undefined) { programMap = {}; bindingStates[geometry.id] = programMap; } - let stateMap = programMap[program.id]; - if (stateMap === undefined) { stateMap = {}; programMap[program.id] = stateMap; } - let state = stateMap[wireframe]; - if (state === undefined) { state = createBindingState(createVertexArrayObject()); stateMap[wireframe] = state; } - return state; } - function createBindingState(vao) { const newAttributes = []; const enabledAttributes = []; const attributeDivisors = []; - for (let i = 0; i < maxVertexAttributes; i++) { newAttributes[i] = 0; enabledAttributes[i] = 0; attributeDivisors[i] = 0; } - return { // for backward compatibility on non-VAO support browser geometry: null, @@ -10898,12 +9588,10 @@ index: null }; } - function needsUpdate(geometry, index) { const cachedAttributes = currentState.attributes; const geometryAttributes = geometry.attributes; let attributesNum = 0; - for (const key in geometryAttributes) { const cachedAttribute = cachedAttributes[key]; const geometryAttribute = geometryAttributes[key]; @@ -10912,69 +9600,55 @@ if (cachedAttribute.data !== geometryAttribute.data) return true; attributesNum++; } - if (currentState.attributesNum !== attributesNum) return true; if (currentState.index !== index) return true; return false; } - function saveCache(geometry, index) { const cache = {}; const attributes = geometry.attributes; let attributesNum = 0; - for (const key in attributes) { const attribute = attributes[key]; const data = {}; data.attribute = attribute; - if (attribute.data) { data.data = attribute.data; } - cache[key] = data; attributesNum++; } - currentState.attributes = cache; currentState.attributesNum = attributesNum; currentState.index = index; } - function initAttributes() { const newAttributes = currentState.newAttributes; - for (let i = 0, il = newAttributes.length; i < il; i++) { newAttributes[i] = 0; } } - function enableAttribute(attribute) { enableAttributeAndDivisor(attribute, 0); } - function enableAttributeAndDivisor(attribute, meshPerAttribute) { const newAttributes = currentState.newAttributes; const enabledAttributes = currentState.enabledAttributes; const attributeDivisors = currentState.attributeDivisors; newAttributes[attribute] = 1; - if (enabledAttributes[attribute] === 0) { gl.enableVertexAttribArray(attribute); enabledAttributes[attribute] = 1; } - if (attributeDivisors[attribute] !== meshPerAttribute) { const extension = capabilities.isWebGL2 ? gl : extensions.get('ANGLE_instanced_arrays'); extension[capabilities.isWebGL2 ? 'vertexAttribDivisor' : 'vertexAttribDivisorANGLE'](attribute, meshPerAttribute); attributeDivisors[attribute] = meshPerAttribute; } } - function disableUnusedAttributes() { const newAttributes = currentState.newAttributes; const enabledAttributes = currentState.enabledAttributes; - for (let i = 0, il = enabledAttributes.length; i < il; i++) { if (enabledAttributes[i] !== newAttributes[i]) { gl.disableVertexAttribArray(i); @@ -10982,7 +9656,6 @@ } } } - function vertexAttribPointer(index, size, type, normalized, stride, offset) { if (capabilities.isWebGL2 === true && (type === gl.INT || type === gl.UNSIGNED_INT)) { gl.vertexAttribIPointer(index, size, type, stride, offset); @@ -10990,48 +9663,41 @@ gl.vertexAttribPointer(index, size, type, normalized, stride, offset); } } - function setupVertexAttributes(object, material, program, geometry) { if (capabilities.isWebGL2 === false && (object.isInstancedMesh || geometry.isInstancedBufferGeometry)) { if (extensions.get('ANGLE_instanced_arrays') === null) return; } - initAttributes(); const geometryAttributes = geometry.attributes; const programAttributes = program.getAttributes(); const materialDefaultAttributeValues = material.defaultAttributeValues; - for (const name in programAttributes) { const programAttribute = programAttributes[name]; - if (programAttribute.location >= 0) { let geometryAttribute = geometryAttributes[name]; - if (geometryAttribute === undefined) { if (name === 'instanceMatrix' && object.instanceMatrix) geometryAttribute = object.instanceMatrix; if (name === 'instanceColor' && object.instanceColor) geometryAttribute = object.instanceColor; } - if (geometryAttribute !== undefined) { const normalized = geometryAttribute.normalized; const size = geometryAttribute.itemSize; - const attribute = attributes.get(geometryAttribute); // TODO Attribute may not be available on context restore + const attribute = attributes.get(geometryAttribute); + + // TODO Attribute may not be available on context restore if (attribute === undefined) continue; const buffer = attribute.buffer; const type = attribute.type; const bytesPerElement = attribute.bytesPerElement; - if (geometryAttribute.isInterleavedBufferAttribute) { const data = geometryAttribute.data; const stride = data.stride; const offset = geometryAttribute.offset; - if (data && data.isInstancedInterleavedBuffer) { for (let i = 0; i < programAttribute.locationSize; i++) { enableAttributeAndDivisor(programAttribute.location + i, data.meshPerAttribute); } - if (object.isInstancedMesh !== true && geometry._maxInstanceCount === undefined) { geometry._maxInstanceCount = data.meshPerAttribute * data.count; } @@ -11040,9 +9706,7 @@ enableAttribute(programAttribute.location + i); } } - gl.bindBuffer(gl.ARRAY_BUFFER, buffer); - for (let i = 0; i < programAttribute.locationSize; i++) { vertexAttribPointer(programAttribute.location + i, size / programAttribute.locationSize, type, normalized, stride * bytesPerElement, (offset + size / programAttribute.locationSize * i) * bytesPerElement); } @@ -11051,7 +9715,6 @@ for (let i = 0; i < programAttribute.locationSize; i++) { enableAttributeAndDivisor(programAttribute.location + i, geometryAttribute.meshPerAttribute); } - if (object.isInstancedMesh !== true && geometry._maxInstanceCount === undefined) { geometry._maxInstanceCount = geometryAttribute.meshPerAttribute * geometryAttribute.count; } @@ -11060,30 +9723,24 @@ enableAttribute(programAttribute.location + i); } } - gl.bindBuffer(gl.ARRAY_BUFFER, buffer); - for (let i = 0; i < programAttribute.locationSize; i++) { vertexAttribPointer(programAttribute.location + i, size / programAttribute.locationSize, type, normalized, size * bytesPerElement, size / programAttribute.locationSize * i * bytesPerElement); } } } else if (materialDefaultAttributeValues !== undefined) { const value = materialDefaultAttributeValues[name]; - if (value !== undefined) { switch (value.length) { case 2: gl.vertexAttrib2fv(programAttribute.location, value); break; - case 3: gl.vertexAttrib3fv(programAttribute.location, value); break; - case 4: gl.vertexAttrib4fv(programAttribute.location, value); break; - default: gl.vertexAttrib1fv(programAttribute.location, value); } @@ -11091,78 +9748,62 @@ } } } - disableUnusedAttributes(); } - function dispose() { reset(); - for (const geometryId in bindingStates) { const programMap = bindingStates[geometryId]; - for (const programId in programMap) { const stateMap = programMap[programId]; - for (const wireframe in stateMap) { deleteVertexArrayObject(stateMap[wireframe].object); delete stateMap[wireframe]; } - delete programMap[programId]; } - delete bindingStates[geometryId]; } } - function releaseStatesOfGeometry(geometry) { if (bindingStates[geometry.id] === undefined) return; const programMap = bindingStates[geometry.id]; - for (const programId in programMap) { const stateMap = programMap[programId]; - for (const wireframe in stateMap) { deleteVertexArrayObject(stateMap[wireframe].object); delete stateMap[wireframe]; } - delete programMap[programId]; } - delete bindingStates[geometry.id]; } - function releaseStatesOfProgram(program) { for (const geometryId in bindingStates) { const programMap = bindingStates[geometryId]; if (programMap[program.id] === undefined) continue; const stateMap = programMap[program.id]; - for (const wireframe in stateMap) { deleteVertexArrayObject(stateMap[wireframe].object); delete stateMap[wireframe]; } - delete programMap[program.id]; } } - function reset() { resetDefaultState(); if (currentState === defaultState) return; currentState = defaultState; bindVertexArrayObject(currentState.object); - } // for backward-compatilibity + } + // for backward-compatilibity function resetDefaultState() { defaultState.geometry = null; defaultState.program = null; defaultState.wireframe = false; } - return { setup: setup, reset: reset, @@ -11179,37 +9820,32 @@ function WebGLBufferRenderer(gl, extensions, info, capabilities) { const isWebGL2 = capabilities.isWebGL2; let mode; - function setMode(value) { mode = value; } - function render(start, count) { gl.drawArrays(mode, start, count); info.update(count, mode, 1); } - function renderInstances(start, count, primcount) { if (primcount === 0) return; let extension, methodName; - if (isWebGL2) { extension = gl; methodName = 'drawArraysInstanced'; } else { extension = extensions.get('ANGLE_instanced_arrays'); methodName = 'drawArraysInstancedANGLE'; - if (extension === null) { console.error('THREE.WebGLBufferRenderer: using THREE.InstancedBufferGeometry but hardware does not support extension ANGLE_instanced_arrays.'); return; } } - extension[methodName](mode, start, count, primcount); info.update(count, mode, primcount); - } // + } + // this.setMode = setMode; this.render = render; @@ -11218,47 +9854,37 @@ function WebGLCapabilities(gl, extensions, parameters) { let maxAnisotropy; - function getMaxAnisotropy() { if (maxAnisotropy !== undefined) return maxAnisotropy; - if (extensions.has('EXT_texture_filter_anisotropic') === true) { const extension = extensions.get('EXT_texture_filter_anisotropic'); maxAnisotropy = gl.getParameter(extension.MAX_TEXTURE_MAX_ANISOTROPY_EXT); } else { maxAnisotropy = 0; } - return maxAnisotropy; } - function getMaxPrecision(precision) { if (precision === 'highp') { if (gl.getShaderPrecisionFormat(gl.VERTEX_SHADER, gl.HIGH_FLOAT).precision > 0 && gl.getShaderPrecisionFormat(gl.FRAGMENT_SHADER, gl.HIGH_FLOAT).precision > 0) { return 'highp'; } - precision = 'mediump'; } - if (precision === 'mediump') { if (gl.getShaderPrecisionFormat(gl.VERTEX_SHADER, gl.MEDIUM_FLOAT).precision > 0 && gl.getShaderPrecisionFormat(gl.FRAGMENT_SHADER, gl.MEDIUM_FLOAT).precision > 0) { return 'mediump'; } } - return 'lowp'; } - const isWebGL2 = typeof WebGL2RenderingContext !== 'undefined' && gl instanceof WebGL2RenderingContext || typeof WebGL2ComputeRenderingContext !== 'undefined' && gl instanceof WebGL2ComputeRenderingContext; let precision = parameters.precision !== undefined ? parameters.precision : 'highp'; const maxPrecision = getMaxPrecision(precision); - if (maxPrecision !== precision) { console.warn('THREE.WebGLRenderer:', precision, 'not supported, using', maxPrecision, 'instead.'); precision = maxPrecision; } - const drawBuffers = isWebGL2 || extensions.has('WEBGL_draw_buffers'); const logarithmicDepthBuffer = parameters.logarithmicDepthBuffer === true; const maxTextures = gl.getParameter(gl.MAX_TEXTURE_IMAGE_UNITS); @@ -11298,21 +9924,21 @@ function WebGLClipping(properties) { const scope = this; let globalState = null, - numGlobalPlanes = 0, - localClippingEnabled = false, - renderingShadows = false; + numGlobalPlanes = 0, + localClippingEnabled = false, + renderingShadows = false; const plane = new Plane(), - viewNormalMatrix = new Matrix3(), - uniform = { - value: null, - needsUpdate: false - }; + viewNormalMatrix = new Matrix3(), + uniform = { + value: null, + needsUpdate: false + }; this.uniform = uniform; this.numPlanes = 0; this.numIntersection = 0; - this.init = function (planes, enableLocalClipping, camera) { - const enabled = planes.length !== 0 || enableLocalClipping || // enable state of previous frame - the clipping code has to + const enabled = planes.length !== 0 || enableLocalClipping || + // enable state of previous frame - the clipping code has to // run another frame in order to reset the state: numGlobalPlanes !== 0 || localClippingEnabled; localClippingEnabled = enableLocalClipping; @@ -11320,86 +9946,73 @@ numGlobalPlanes = planes.length; return enabled; }; - this.beginShadows = function () { renderingShadows = true; projectPlanes(null); }; - this.endShadows = function () { renderingShadows = false; resetGlobalState(); }; - this.setState = function (material, camera, useCache) { const planes = material.clippingPlanes, - clipIntersection = material.clipIntersection, - clipShadows = material.clipShadows; + clipIntersection = material.clipIntersection, + clipShadows = material.clipShadows; const materialProperties = properties.get(material); - if (!localClippingEnabled || planes === null || planes.length === 0 || renderingShadows && !clipShadows) { // there's no local clipping + if (renderingShadows) { // there's no global clipping + projectPlanes(null); } else { resetGlobalState(); } } else { const nGlobal = renderingShadows ? 0 : numGlobalPlanes, - lGlobal = nGlobal * 4; + lGlobal = nGlobal * 4; let dstArray = materialProperties.clippingState || null; uniform.value = dstArray; // ensure unique state dstArray = projectPlanes(planes, camera, lGlobal, useCache); - for (let i = 0; i !== lGlobal; ++i) { dstArray[i] = globalState[i]; } - materialProperties.clippingState = dstArray; this.numIntersection = clipIntersection ? this.numPlanes : 0; this.numPlanes += nGlobal; } }; - function resetGlobalState() { if (uniform.value !== globalState) { uniform.value = globalState; uniform.needsUpdate = numGlobalPlanes > 0; } - scope.numPlanes = numGlobalPlanes; scope.numIntersection = 0; } - function projectPlanes(planes, camera, dstOffset, skipTransform) { const nPlanes = planes !== null ? planes.length : 0; let dstArray = null; - if (nPlanes !== 0) { dstArray = uniform.value; - if (skipTransform !== true || dstArray === null) { const flatSize = dstOffset + nPlanes * 4, - viewMatrix = camera.matrixWorldInverse; + viewMatrix = camera.matrixWorldInverse; viewNormalMatrix.getNormalMatrix(viewMatrix); - if (dstArray === null || dstArray.length < flatSize) { dstArray = new Float32Array(flatSize); } - for (let i = 0, i4 = dstOffset; i !== nPlanes; ++i, i4 += 4) { plane.copy(planes[i]).applyMatrix4(viewMatrix, viewNormalMatrix); plane.normal.toArray(dstArray, i4); dstArray[i4 + 3] = plane.constant; } } - uniform.value = dstArray; uniform.needsUpdate = true; } - scope.numPlanes = nPlanes; scope.numIntersection = 0; return dstArray; @@ -11408,28 +10021,23 @@ function WebGLCubeMaps(renderer) { let cubemaps = new WeakMap(); - function mapTextureMapping(texture, mapping) { if (mapping === EquirectangularReflectionMapping) { texture.mapping = CubeReflectionMapping; } else if (mapping === EquirectangularRefractionMapping) { texture.mapping = CubeRefractionMapping; } - return texture; } - function get(texture) { if (texture && texture.isTexture && texture.isRenderTargetTexture === false) { const mapping = texture.mapping; - if (mapping === EquirectangularReflectionMapping || mapping === EquirectangularRefractionMapping) { if (cubemaps.has(texture)) { const cubemap = cubemaps.get(texture).texture; return mapTextureMapping(cubemap, texture.mapping); } else { const image = texture.image; - if (image && image.height > 0) { const renderTarget = new WebGLCubeRenderTarget(image.height / 2); renderTarget.fromEquirectangularTexture(renderer, texture); @@ -11438,30 +10046,26 @@ return mapTextureMapping(renderTarget.texture, texture.mapping); } else { // image not yet ready. try the conversion next frame + return null; } } } } - return texture; } - function onTextureDispose(event) { const texture = event.target; texture.removeEventListener('dispose', onTextureDispose); const cubemap = cubemaps.get(texture); - if (cubemap !== undefined) { cubemaps.delete(texture); cubemap.dispose(); } } - function dispose() { cubemaps = new WeakMap(); } - return { get: get, dispose: dispose @@ -11482,7 +10086,6 @@ this.far = far; this.updateProjectionMatrix(); } - copy(source, recursive) { super.copy(source, recursive); this.left = source.left; @@ -11495,7 +10098,6 @@ this.view = source.view === null ? null : Object.assign({}, source.view); return this; } - setViewOffset(fullWidth, fullHeight, x, y, width, height) { if (this.view === null) { this.view = { @@ -11508,7 +10110,6 @@ height: 1 }; } - this.view.enabled = true; this.view.fullWidth = fullWidth; this.view.fullHeight = fullHeight; @@ -11518,15 +10119,12 @@ this.view.height = height; this.updateProjectionMatrix(); } - clearViewOffset() { if (this.view !== null) { this.view.enabled = false; } - this.updateProjectionMatrix(); } - updateProjectionMatrix() { const dx = (this.right - this.left) / (2 * this.zoom); const dy = (this.top - this.bottom) / (2 * this.zoom); @@ -11536,7 +10134,6 @@ let right = cx + dx; let top = cy + dy; let bottom = cy - dy; - if (this.view !== null && this.view.enabled) { const scaleW = (this.right - this.left) / this.view.fullWidth / this.zoom; const scaleH = (this.top - this.bottom) / this.view.fullHeight / this.zoom; @@ -11545,11 +10142,9 @@ top -= scaleH * this.view.offsetY; bottom = top - scaleH * this.view.height; } - this.projectionMatrix.makeOrthographic(left, right, top, bottom, this.near, this.far); this.projectionMatrixInverse.copy(this.projectionMatrix).invert(); } - toJSON(meta) { const data = super.toJSON(meta); data.object.zoom = this.zoom; @@ -11562,9 +10157,7 @@ if (this.view !== null) data.object.view = Object.assign({}, this.view); return data; } - } - OrthographicCamera.prototype.isOrthographicCamera = true; class RawShaderMaterial extends ShaderMaterial { @@ -11572,46 +10165,45 @@ super(parameters); this.type = 'RawShaderMaterial'; } - } - RawShaderMaterial.prototype.isRawShaderMaterial = true; const LOD_MIN = 4; const LOD_MAX = 8; - const SIZE_MAX = Math.pow(2, LOD_MAX); // The standard deviations (radians) associated with the extra mips. These are + const SIZE_MAX = Math.pow(2, LOD_MAX); + + // The standard deviations (radians) associated with the extra mips. These are // chosen to approximate a Trowbridge-Reitz distribution function times the // geometric shadowing function. These sigma values squared must match the // variance #defines in cube_uv_reflection_fragment.glsl.js. - const EXTRA_LOD_SIGMA = [0.125, 0.215, 0.35, 0.446, 0.526, 0.582]; - const TOTAL_LODS = LOD_MAX - LOD_MIN + 1 + EXTRA_LOD_SIGMA.length; // The maximum length of the blur for loop. Smaller sigmas will use fewer - // samples and exit early, but not recompile the shader. + const TOTAL_LODS = LOD_MAX - LOD_MIN + 1 + EXTRA_LOD_SIGMA.length; + // The maximum length of the blur for loop. Smaller sigmas will use fewer + // samples and exit early, but not recompile the shader. const MAX_SAMPLES = 20; const ENCODINGS = { [LinearEncoding]: 0, [sRGBEncoding]: 1, [RGBEEncoding]: 2 }; - const _flatCamera = /*@__PURE__*/new OrthographicCamera(); - const { _lodPlanes, _sizeLods, _sigmas } = /*@__PURE__*/_createPlanes(); - const _clearColor = /*@__PURE__*/new Color(); + let _oldTarget = null; - let _oldTarget = null; // Golden Ratio - + // Golden Ratio const PHI = (1 + Math.sqrt(5)) / 2; - const INV_PHI = 1 / PHI; // Vertices of a dodecahedron (except the opposites, which represent the - // same axis), used as axis directions evenly spread on a sphere. + const INV_PHI = 1 / PHI; + // Vertices of a dodecahedron (except the opposites, which represent the + // same axis), used as axis directions evenly spread on a sphere. const _axisDirections = [/*@__PURE__*/new Vector3(1, 1, 1), /*@__PURE__*/new Vector3(-1, 1, 1), /*@__PURE__*/new Vector3(1, 1, -1), /*@__PURE__*/new Vector3(-1, 1, -1), /*@__PURE__*/new Vector3(0, PHI, INV_PHI), /*@__PURE__*/new Vector3(0, PHI, -INV_PHI), /*@__PURE__*/new Vector3(INV_PHI, 0, PHI), /*@__PURE__*/new Vector3(-INV_PHI, 0, PHI), /*@__PURE__*/new Vector3(PHI, INV_PHI, 0), /*@__PURE__*/new Vector3(-PHI, INV_PHI, 0)]; + /** * This class generates a Prefiltered, Mipmapped Radiance Environment Map * (PMREM) from a cubeMap environment texture. This allows different levels of @@ -11635,9 +10227,9 @@ this._flipCubeUVMaxLevelTileShader = null; this._equirectShader = null; this._cubemapShader = null; - this._compileMaterial(this._blurMaterial); } + /** * Generates a PMREM from a supplied Scene, which can be faster than using an * image if networking bandwidth is low. Optional sigma specifies a blur radius @@ -11645,118 +10237,93 @@ * and far planes ensure the scene is rendered in its entirety (the cubeCamera * is placed at the origin). */ - - fromScene(scene, sigma = 0, near = 0.1, far = 100) { _oldTarget = this._renderer.getRenderTarget(); - const cubeUVRenderTarget = this._allocateTargets(); - this._sceneToCubeUV(scene, near, far, this._pingPongRenderTarget); - this._flipCubeUVMaxLevelTile(this._pingPongRenderTarget, cubeUVRenderTarget); - if (sigma > 0) { this._blur(cubeUVRenderTarget, 0, 0, sigma); } - this._applyPMREM(cubeUVRenderTarget); - this._cleanup(cubeUVRenderTarget); - return cubeUVRenderTarget; } + /** * Generates a PMREM from an equirectangular texture, which can be either LDR * (RGBFormat) or HDR (RGBEFormat). The ideal input image size is 1k (1024 x 512), * as this matches best with the 256 x 256 cubemap output. */ - - fromEquirectangular(equirectangular, renderTarget = null) { return this._fromTexture(equirectangular, renderTarget); } + /** * Generates a PMREM from an cubemap texture, which can be either LDR * (RGBFormat) or HDR (RGBEFormat). The ideal input cube size is 256 x 256, * as this matches best with the 256 x 256 cubemap output. */ - - fromCubemap(cubemap, renderTarget = null) { return this._fromTexture(cubemap, renderTarget); } + /** * Pre-compiles the cubemap shader. You can get faster start-up by invoking this method during * your texture's network fetch for increased concurrency. */ - - compileCubemapShader() { if (this._cubemapShader === null) { this._cubemapShader = _getCubemapShader(); - this._compileMaterial(this._cubemapShader); } } + /** * Pre-compiles the equirectangular shader. You can get faster start-up by invoking this method during * your texture's network fetch for increased concurrency. */ - - compileEquirectangularShader() { if (this._equirectShader === null) { this._equirectShader = _getEquirectShader(); - this._compileMaterial(this._equirectShader); } } + /** * Disposes of the PMREMGenerator's internal memory. Note that PMREMGenerator is a static class, * so you should not need more than one PMREMGenerator object. If you do, calling dispose() on * one of them will cause any others to also become unusable. */ - - dispose() { this._blurMaterial.dispose(); - if (this._pingPongRenderTarget !== null) this._pingPongRenderTarget.dispose(); if (this._flipCubeUVMaxLevelTileShader !== null) this._flipCubeUVMaxLevelTileShader.dispose(); if (this._cubemapShader !== null) this._cubemapShader.dispose(); if (this._equirectShader !== null) this._equirectShader.dispose(); - for (let i = 0; i < _lodPlanes.length; i++) { _lodPlanes[i].dispose(); } - } // private interface + } + // private interface _cleanup(outputTarget) { this._renderer.setRenderTarget(_oldTarget); - outputTarget.scissorTest = false; - _setViewport(outputTarget, 0, 0, outputTarget.width, outputTarget.height); } - _fromTexture(texture, renderTarget) { _oldTarget = this._renderer.getRenderTarget(); - const cubeUVRenderTarget = renderTarget || this._allocateTargets(texture); - this._textureToCubeUV(texture, cubeUVRenderTarget); - this._applyPMREM(cubeUVRenderTarget); - this._cleanup(cubeUVRenderTarget); - return cubeUVRenderTarget; } - _allocateTargets(texture) { // warning: null texture is valid + const params = { magFilter: NearestFilter, minFilter: NearestFilter, @@ -11766,24 +10333,17 @@ encoding: RGBEEncoding, depthBuffer: false }; - const cubeUVRenderTarget = _createRenderTarget(params); - cubeUVRenderTarget.depthBuffer = texture ? false : true; - if (this._pingPongRenderTarget === null) { this._pingPongRenderTarget = _createRenderTarget(params); } - return cubeUVRenderTarget; } - _compileMaterial(material) { const tmpMesh = new Mesh(_lodPlanes[0], material); - this._renderer.compile(tmpMesh, _flatCamera); } - _sceneToCubeUV(scene, near, far, cubeUVRenderTarget) { const fov = 90; const aspect = 1; @@ -11807,7 +10367,6 @@ const backgroundBox = new Mesh(new BoxGeometry(), backgroundMaterial); let useSolidColor = false; const background = scene.background; - if (background) { if (background.isColor) { backgroundMaterial.color.copy(background); @@ -11818,10 +10377,8 @@ backgroundMaterial.color.copy(_clearColor); useSolidColor = true; } - for (let i = 0; i < 6; i++) { const col = i % 3; - if (col === 0) { cubeCamera.up.set(0, upSign[i], 0); cubeCamera.lookAt(forwardSign[i], 0, 0); @@ -11832,18 +10389,13 @@ cubeCamera.up.set(0, upSign[i], 0); cubeCamera.lookAt(0, 0, forwardSign[i]); } - _setViewport(cubeUVRenderTarget, col * SIZE_MAX, i > 2 ? SIZE_MAX : 0, SIZE_MAX, SIZE_MAX); - renderer.setRenderTarget(cubeUVRenderTarget); - if (useSolidColor) { renderer.render(backgroundBox, cubeCamera); } - renderer.render(scene, cubeCamera); } - backgroundBox.geometry.dispose(); backgroundBox.material.dispose(); renderer.toneMapping = toneMapping; @@ -11851,60 +10403,47 @@ renderer.autoClear = originalAutoClear; scene.background = background; } - _setEncoding(uniform, texture) { uniform.value = ENCODINGS[this._renderer.getTextureEncodingFromMap(texture)]; } - _textureToCubeUV(texture, cubeUVRenderTarget) { const renderer = this._renderer; const isCubeTexture = texture.mapping === CubeReflectionMapping || texture.mapping === CubeRefractionMapping; - if (isCubeTexture) { if (this._cubemapShader === null) { this._cubemapShader = _getCubemapShader(); } - this._cubemapShader.uniforms.flipEnvMap.value = texture.isRenderTargetTexture === false ? -1 : 1; } else { if (this._equirectShader === null) { this._equirectShader = _getEquirectShader(); } } - const material = isCubeTexture ? this._cubemapShader : this._equirectShader; const mesh = new Mesh(_lodPlanes[0], material); const uniforms = material.uniforms; uniforms['envMap'].value = texture; - if (!isCubeTexture) { uniforms['texelSize'].value.set(1.0 / texture.image.width, 1.0 / texture.image.height); } - this._setEncoding(uniforms['inputEncoding'], texture); - this._setEncoding(uniforms['outputEncoding'], cubeUVRenderTarget.texture); - _setViewport(cubeUVRenderTarget, 0, 0, 3 * SIZE_MAX, 2 * SIZE_MAX); - renderer.setRenderTarget(cubeUVRenderTarget); renderer.render(mesh, _flatCamera); } - _applyPMREM(cubeUVRenderTarget) { const renderer = this._renderer; const autoClear = renderer.autoClear; renderer.autoClear = false; - for (let i = 1; i < TOTAL_LODS; i++) { const sigma = Math.sqrt(_sigmas[i] * _sigmas[i] - _sigmas[i - 1] * _sigmas[i - 1]); const poleAxis = _axisDirections[(i - 1) % _axisDirections.length]; - this._blur(cubeUVRenderTarget, i - 1, i, sigma, poleAxis); } - renderer.autoClear = autoClear; } + /** * This is a two-pass Gaussian blur for a cubemap. Normally this is done * vertically and horizontally, but this breaks down on a cube. Here we apply @@ -11912,25 +10451,19 @@ * the poles) to approximate the orthogonally-separable blur. It is least * accurate at the poles, but still does a decent job. */ - - _blur(cubeUVRenderTarget, lodIn, lodOut, sigma, poleAxis) { const pingPongRenderTarget = this._pingPongRenderTarget; - this._halfBlur(cubeUVRenderTarget, pingPongRenderTarget, lodIn, lodOut, sigma, 'latitudinal', poleAxis); - this._halfBlur(pingPongRenderTarget, cubeUVRenderTarget, lodOut, lodOut, sigma, 'longitudinal', poleAxis); } - _halfBlur(targetIn, targetOut, lodIn, lodOut, sigmaRadians, direction, poleAxis) { const renderer = this._renderer; const blurMaterial = this._blurMaterial; - if (direction !== 'latitudinal' && direction !== 'longitudinal') { console.error('blur direction must be either latitudinal or longitudinal!'); - } // Number of standard deviations at which to cut off the discrete approximation. - + } + // Number of standard deviations at which to cut off the discrete approximation. const STANDARD_DEVIATIONS = 3; const blurMesh = new Mesh(_lodPlanes[lodOut], blurMaterial); const blurUniforms = blurMaterial.uniforms; @@ -11938,101 +10471,73 @@ const radiansPerPixel = isFinite(sigmaRadians) ? Math.PI / (2 * pixels) : 2 * Math.PI / (2 * MAX_SAMPLES - 1); const sigmaPixels = sigmaRadians / radiansPerPixel; const samples = isFinite(sigmaRadians) ? 1 + Math.floor(STANDARD_DEVIATIONS * sigmaPixels) : MAX_SAMPLES; - if (samples > MAX_SAMPLES) { console.warn(`sigmaRadians, ${sigmaRadians}, is too large and will clip, as it requested ${samples} samples when the maximum is set to ${MAX_SAMPLES}`); } - const weights = []; let sum = 0; - for (let i = 0; i < MAX_SAMPLES; ++i) { const x = i / sigmaPixels; const weight = Math.exp(-x * x / 2); weights.push(weight); - if (i === 0) { sum += weight; } else if (i < samples) { sum += 2 * weight; } } - for (let i = 0; i < weights.length; i++) { weights[i] = weights[i] / sum; } - blurUniforms['envMap'].value = targetIn.texture; blurUniforms['samples'].value = samples; blurUniforms['weights'].value = weights; blurUniforms['latitudinal'].value = direction === 'latitudinal'; - if (poleAxis) { blurUniforms['poleAxis'].value = poleAxis; } - blurUniforms['dTheta'].value = radiansPerPixel; blurUniforms['mipInt'].value = LOD_MAX - lodIn; - this._setEncoding(blurUniforms['inputEncoding'], targetIn.texture); - this._setEncoding(blurUniforms['outputEncoding'], targetIn.texture); - const outputSize = _sizeLods[lodOut]; const x = 3 * Math.max(0, SIZE_MAX - 2 * outputSize); const y = (lodOut === 0 ? 0 : 2 * SIZE_MAX) + 2 * outputSize * (lodOut > LOD_MAX - LOD_MIN ? lodOut - LOD_MAX + LOD_MIN : 0); - _setViewport(targetOut, x, y, 3 * outputSize, 2 * outputSize); - renderer.setRenderTarget(targetOut); renderer.render(blurMesh, _flatCamera); } - _flipCubeUVMaxLevelTile(targetIn, targetOut) { const renderer = this._renderer; - if (this._flipCubeUVMaxLevelTileShader === null) { this._flipCubeUVMaxLevelTileShader = _getFlipCubeUVMaxLevelTileShader(); } - const flipMaterial = this._flipCubeUVMaxLevelTileShader; const flipMesh = new Mesh(_lodPlanes[0], flipMaterial); const flipUniforms = flipMaterial.uniforms; flipUniforms['envMap'].value = targetIn.texture; - this._setEncoding(flipUniforms['inputEncoding'], targetIn.texture); - this._setEncoding(flipUniforms['outputEncoding'], targetIn.texture); - _setViewport(targetOut, 0, 0, 3 * SIZE_MAX, 2 * SIZE_MAX); - renderer.setRenderTarget(targetOut); renderer.render(flipMesh, _flatCamera); } - } - function _createPlanes() { const _lodPlanes = []; const _sizeLods = []; const _sigmas = []; let lod = LOD_MAX; - for (let i = 0; i < TOTAL_LODS; i++) { const sizeLod = Math.pow(2, lod); - _sizeLods.push(sizeLod); - let sigma = 1.0 / sizeLod; - if (i > LOD_MAX - LOD_MIN) { sigma = EXTRA_LOD_SIGMA[i - LOD_MAX + LOD_MIN - 1]; } else if (i === 0) { sigma = 0; } - _sigmas.push(sigma); - const texelSize = 1.0 / (sizeLod - 1); const min = -texelSize / 2; const max = 1 + texelSize / 2; @@ -12045,7 +10550,6 @@ const position = new Float32Array(positionSize * vertices * cubeFaces); const uv = new Float32Array(uvSize * vertices * cubeFaces); const faceIndex = new Float32Array(faceIndexSize * vertices * cubeFaces); - for (let face = 0; face < cubeFaces; face++) { const x = face % 3 * 2 / 3 - 1; const y = face > 2 ? 0 : -1; @@ -12055,26 +10559,21 @@ const fill = [face, face, face, face, face, face]; faceIndex.set(fill, faceIndexSize * vertices * face); } - const planes = new BufferGeometry(); planes.setAttribute('position', new BufferAttribute(position, positionSize)); planes.setAttribute('uv', new BufferAttribute(uv, uvSize)); planes.setAttribute('faceIndex', new BufferAttribute(faceIndex, faceIndexSize)); - _lodPlanes.push(planes); - if (lod > LOD_MIN) { lod--; } } - return { _lodPlanes, _sizeLods, _sigmas }; } - function _createRenderTarget(params) { const cubeUVRenderTarget = new WebGLRenderTarget(3 * SIZE_MAX, 3 * SIZE_MAX, params); cubeUVRenderTarget.texture.mapping = CubeUVReflectionMapping; @@ -12082,12 +10581,10 @@ cubeUVRenderTarget.scissorTest = true; return cubeUVRenderTarget; } - function _setViewport(target, x, y, width, height) { target.viewport.set(x, y, width, height); target.scissor.set(x, y, width, height); } - function _getBlurShader(maxSamples) { const weights = new Float32Array(maxSamples); const poleAxis = new Vector3(0, 1, 0); @@ -12126,9 +10623,7 @@ } }, vertexShader: _getCommonVertexShader(), - fragmentShader: - /* glsl */ - ` + fragmentShader: /* glsl */` precision mediump float; precision mediump int; @@ -12199,7 +10694,6 @@ }); return shaderMaterial; } - function _getFlipCubeUVMaxLevelTileShader() { const shaderMaterial = new RawShaderMaterial({ name: 'FlipCubeUVMaxLevelTile', @@ -12215,9 +10709,7 @@ } }, vertexShader: _getCommonVertexShader(), - fragmentShader: - /* glsl */ - ` + fragmentShader: /* glsl */` precision mediump float; precision mediump int; @@ -12256,7 +10748,6 @@ }); return shaderMaterial; } - function _getEquirectShader() { const texelSize = new Vector2(1, 1); const shaderMaterial = new RawShaderMaterial({ @@ -12276,9 +10767,7 @@ } }, vertexShader: _getCommonVertexShader(), - fragmentShader: - /* glsl */ - ` + fragmentShader: /* glsl */` precision mediump float; precision mediump int; @@ -12323,7 +10812,6 @@ }); return shaderMaterial; } - function _getCubemapShader() { const shaderMaterial = new RawShaderMaterial({ name: 'CubemapToCubeUV', @@ -12342,9 +10830,7 @@ } }, vertexShader: _getCommonVertexShader(), - fragmentShader: - /* glsl */ - ` + fragmentShader: /* glsl */` precision mediump float; precision mediump int; @@ -12371,11 +10857,8 @@ }); return shaderMaterial; } - function _getCommonVertexShader() { - return ( - /* glsl */ - ` + return /* glsl */` precision mediump float; precision mediump int; @@ -12428,14 +10911,10 @@ gl_Position = vec4( position, 1.0 ); } - ` - ); + `; } - function _getEncodings() { - return ( - /* glsl */ - ` + return /* glsl */` uniform int inputEncoding; uniform int outputEncoding; @@ -12483,19 +10962,19 @@ return inputTexelToLinear( color ); } - ` - ); + `; } function WebGLCubeUVMaps(renderer) { let cubeUVmaps = new WeakMap(); let pmremGenerator = null; - function get(texture) { if (texture && texture.isTexture) { const mapping = texture.mapping; const isEquirectMap = mapping === EquirectangularReflectionMapping || mapping === EquirectangularRefractionMapping; - const isCubeMap = mapping === CubeReflectionMapping || mapping === CubeRefractionMapping; // equirect/cube map to cubeUV conversion + const isCubeMap = mapping === CubeReflectionMapping || mapping === CubeRefractionMapping; + + // equirect/cube map to cubeUV conversion if (isEquirectMap || isCubeMap) { if (texture.isRenderTargetTexture && texture.needsPMREMUpdate === true) { @@ -12510,7 +10989,6 @@ return cubeUVmaps.get(texture).texture; } else { const image = texture.image; - if (isEquirectMap && image && image.height > 0 || isCubeMap && image && isCubeTextureComplete(image)) { if (pmremGenerator === null) pmremGenerator = new PMREMGenerator(renderer); const renderTarget = isEquirectMap ? pmremGenerator.fromEquirectangular(texture) : pmremGenerator.fromCubemap(texture); @@ -12519,47 +10997,39 @@ return renderTarget.texture; } else { // image not yet ready. try the conversion next frame + return null; } } } } } - return texture; } - function isCubeTextureComplete(image) { let count = 0; const length = 6; - for (let i = 0; i < length; i++) { if (image[i] !== undefined) count++; } - return count === length; } - function onTextureDispose(event) { const texture = event.target; texture.removeEventListener('dispose', onTextureDispose); const cubemapUV = cubeUVmaps.get(texture); - if (cubemapUV !== undefined) { cubeUVmaps.delete(texture); cubemapUV.dispose(); } } - function dispose() { cubeUVmaps = new WeakMap(); - if (pmremGenerator !== null) { pmremGenerator.dispose(); pmremGenerator = null; } } - return { get: get, dispose: dispose @@ -12569,14 +11039,11 @@ function WebGLExtensions(gl, parameters) { const extensions = {}; const _allowedExtensions = parameters.allowedExtensions; - function getExtension(name) { if (extensions[name] !== undefined) { return extensions[name]; } - let extension; - if (_allowedExtensions !== undefined && _allowedExtensions.indexOf(name) === -1) { console.warn('THREE.WebGLRenderer: Attempt to use extension ' + name + ' which is not allowed.'); extension = null; @@ -12585,28 +11052,22 @@ case 'WEBGL_depth_texture': extension = gl.getExtension('WEBGL_depth_texture') || gl.getExtension('MOZ_WEBGL_depth_texture') || gl.getExtension('WEBKIT_WEBGL_depth_texture'); break; - case 'EXT_texture_filter_anisotropic': extension = gl.getExtension('EXT_texture_filter_anisotropic') || gl.getExtension('MOZ_EXT_texture_filter_anisotropic') || gl.getExtension('WEBKIT_EXT_texture_filter_anisotropic'); break; - case 'WEBGL_compressed_texture_s3tc': extension = gl.getExtension('WEBGL_compressed_texture_s3tc') || gl.getExtension('MOZ_WEBGL_compressed_texture_s3tc') || gl.getExtension('WEBKIT_WEBGL_compressed_texture_s3tc'); break; - case 'WEBGL_compressed_texture_pvrtc': extension = gl.getExtension('WEBGL_compressed_texture_pvrtc') || gl.getExtension('WEBKIT_WEBGL_compressed_texture_pvrtc'); break; - default: extension = gl.getExtension(name); } } - extensions[name] = extension; return extension; } - return { has: function (name) { return getExtension(name) !== null; @@ -12624,18 +11085,15 @@ getExtension('OES_vertex_array_object'); getExtension('ANGLE_instanced_arrays'); } - getExtension('OES_texture_float_linear'); getExtension('EXT_color_buffer_half_float'); getExtension('WEBGL_multisampled_render_to_texture'); }, get: function (name) { const extension = getExtension(name); - if (extension === null) { console.warn('THREE.WebGLRenderer: ' + name + ' extension not supported.'); } - return extension; } }; @@ -12644,37 +11102,30 @@ function WebGLGeometries(gl, attributes, info, bindingStates) { const geometries = {}; const wireframeAttributes = new WeakMap(); - function onGeometryDispose(event) { const geometry = event.target; - if (geometry.index !== null) { attributes.remove(geometry.index); } - for (const name in geometry.attributes) { attributes.remove(geometry.attributes[name]); } - geometry.removeEventListener('dispose', onGeometryDispose); delete geometries[geometry.id]; const attribute = wireframeAttributes.get(geometry); - if (attribute) { attributes.remove(attribute); wireframeAttributes.delete(geometry); } - bindingStates.releaseStatesOfGeometry(geometry); - if (geometry.isInstancedBufferGeometry === true) { delete geometry._maxInstanceCount; - } // + } + // info.memory.geometries--; } - function get(object, geometry) { if (geometries[geometry.id] === true) return geometry; geometry.addEventListener('dispose', onGeometryDispose); @@ -12682,36 +11133,33 @@ info.memory.geometries++; return geometry; } - function update(geometry) { - const geometryAttributes = geometry.attributes; // Updating index buffer in VAO now. See WebGLBindingStates. + const geometryAttributes = geometry.attributes; + + // Updating index buffer in VAO now. See WebGLBindingStates. for (const name in geometryAttributes) { attributes.update(geometryAttributes[name], gl.ARRAY_BUFFER); - } // morph targets + } + // morph targets const morphAttributes = geometry.morphAttributes; - for (const name in morphAttributes) { const array = morphAttributes[name]; - for (let i = 0, l = array.length; i < l; i++) { attributes.update(array[i], gl.ARRAY_BUFFER); } } } - function updateWireframeAttribute(geometry) { const indices = []; const geometryIndex = geometry.index; const geometryPosition = geometry.attributes.position; let version = 0; - if (geometryIndex !== null) { const array = geometryIndex.array; version = geometryIndex.version; - for (let i = 0, l = array.length; i < l; i += 3) { const a = array[i + 0]; const b = array[i + 1]; @@ -12721,7 +11169,6 @@ } else { const array = geometryPosition.array; version = geometryPosition.version; - for (let i = 0, l = array.length / 3 - 1; i < l; i += 3) { const a = i + 0; const b = i + 1; @@ -12729,25 +11176,27 @@ indices.push(a, b, b, c, c, a); } } - const attribute = new (arrayNeedsUint32(indices) ? Uint32BufferAttribute : Uint16BufferAttribute)(indices, 1); - attribute.version = version; // Updating index buffer in VAO now. See WebGLBindingStates + attribute.version = version; + + // Updating index buffer in VAO now. See WebGLBindingStates + // const previousAttribute = wireframeAttributes.get(geometry); - if (previousAttribute) attributes.remove(previousAttribute); // + if (previousAttribute) attributes.remove(previousAttribute); + + // wireframeAttributes.set(geometry, attribute); } - function getWireframeAttribute(geometry) { const currentAttribute = wireframeAttributes.get(geometry); - if (currentAttribute) { const geometryIndex = geometry.index; - if (geometryIndex !== null) { // if the attribute is obsolete, create a new one + if (currentAttribute.version < geometryIndex.version) { updateWireframeAttribute(geometry); } @@ -12755,10 +11204,8 @@ } else { updateWireframeAttribute(geometry); } - return wireframeAttributes.get(geometry); } - return { get: get, update: update, @@ -12769,44 +11216,37 @@ function WebGLIndexedBufferRenderer(gl, extensions, info, capabilities) { const isWebGL2 = capabilities.isWebGL2; let mode; - function setMode(value) { mode = value; } - let type, bytesPerElement; - function setIndex(value) { type = value.type; bytesPerElement = value.bytesPerElement; } - function render(start, count) { gl.drawElements(mode, count, type, start * bytesPerElement); info.update(count, mode, 1); } - function renderInstances(start, count, primcount) { if (primcount === 0) return; let extension, methodName; - if (isWebGL2) { extension = gl; methodName = 'drawElementsInstanced'; } else { extension = extensions.get('ANGLE_instanced_arrays'); methodName = 'drawElementsInstancedANGLE'; - if (extension === null) { console.error('THREE.WebGLIndexedBufferRenderer: using THREE.InstancedBufferGeometry but hardware does not support extension ANGLE_instanced_arrays.'); return; } } - extension[methodName](mode, count, type, start * bytesPerElement, primcount); info.update(count, mode, primcount); - } // + } + // this.setMode = setMode; this.setIndex = setIndex; @@ -12826,37 +11266,29 @@ points: 0, lines: 0 }; - function update(count, mode, instanceCount) { render.calls++; - switch (mode) { case gl.TRIANGLES: render.triangles += instanceCount * (count / 3); break; - case gl.LINES: render.lines += instanceCount * (count / 2); break; - case gl.LINE_STRIP: render.lines += instanceCount * (count - 1); break; - case gl.LINE_LOOP: render.lines += instanceCount * count; break; - case gl.POINTS: render.points += instanceCount * count; break; - default: console.error('THREE.WebGLInfo: Unknown draw mode:', mode); break; } } - function reset() { render.frame++; render.calls = 0; @@ -12864,7 +11296,6 @@ render.points = 0; render.lines = 0; } - return { memory: memory, render: render, @@ -12891,46 +11322,38 @@ this.flipY = false; this.unpackAlignment = 1; } - } - DataTexture2DArray.prototype.isDataTexture2DArray = true; function numericalSort(a, b) { return a[0] - b[0]; } - function absNumericalSort(a, b) { return Math.abs(b[1]) - Math.abs(a[1]); } - function denormalize(morph, attribute) { let denominator = 1; const array = attribute.isInterleavedBufferAttribute ? attribute.data.array : attribute.array; if (array instanceof Int8Array) denominator = 127;else if (array instanceof Int16Array) denominator = 32767;else if (array instanceof Int32Array) denominator = 2147483647;else console.error('THREE.WebGLMorphtargets: Unsupported morph attribute data type: ', array); morph.divideScalar(denominator); } - function WebGLMorphtargets(gl, capabilities, textures) { const influencesList = {}; const morphInfluences = new Float32Array(8); const morphTextures = new WeakMap(); const morph = new Vector3(); const workInfluences = []; - for (let i = 0; i < 8; i++) { workInfluences[i] = [i, 0]; } - function update(object, geometry, material, program) { const objectInfluences = object.morphTargetInfluences; - if (capabilities.isWebGL2 === true) { // instead of using attributes, the WebGL 2 code path encodes morph targets // into an array of data textures. Each layer represents a single morph target. + const numberOfMorphTargets = geometry.morphAttributes.position.length; let entry = morphTextures.get(geometry); - if (entry === undefined || entry.count !== numberOfMorphTargets) { if (entry !== undefined) entry.texture.dispose(); const hasMorphNormals = geometry.morphAttributes.normal !== undefined; @@ -12941,26 +11364,23 @@ let width = numberOfVertices * numberOfVertexData; let height = 1; - if (width > capabilities.maxTextureSize) { height = Math.ceil(width / capabilities.maxTextureSize); width = capabilities.maxTextureSize; } - const buffer = new Float32Array(width * height * 4 * numberOfMorphTargets); const texture = new DataTexture2DArray(buffer, width, height, numberOfMorphTargets); texture.format = RGBAFormat; // using RGBA since RGB might be emulated (and is thus slower) - texture.type = FloatType; - texture.needsUpdate = true; // fill buffer + texture.needsUpdate = true; - const vertexDataStride = numberOfVertexData * 4; + // fill buffer + const vertexDataStride = numberOfVertexData * 4; for (let i = 0; i < numberOfMorphTargets; i++) { const morphTarget = morphTargets[i]; const morphNormal = morphNormals[i]; const offset = width * height * 4 * i; - for (let j = 0; j < morphTarget.count; j++) { morph.fromBufferAttribute(morphTarget, j); if (morphTarget.normalized === true) denormalize(morph, morphTarget); @@ -12969,7 +11389,6 @@ buffer[offset + stride + 1] = morph.y; buffer[offset + stride + 2] = morph.z; buffer[offset + stride + 3] = 0; - if (hasMorphNormals === true) { morph.fromBufferAttribute(morphNormal, j); if (morphNormal.normalized === true) denormalize(morph, morphNormal); @@ -12980,30 +11399,26 @@ } } } - entry = { count: numberOfMorphTargets, texture: texture, size: new Vector2(width, height) }; morphTextures.set(geometry, entry); - function disposeTexture() { texture.dispose(); morphTextures.delete(geometry); geometry.removeEventListener('dispose', disposeTexture); } - geometry.addEventListener('dispose', disposeTexture); - } // + } + // let morphInfluencesSum = 0; - for (let i = 0; i < objectInfluences.length; i++) { morphInfluencesSum += objectInfluences[i]; } - const morphBaseInfluence = geometry.morphTargetsRelative ? 1 : 1 - morphInfluencesSum; program.getUniforms().setValue(gl, 'morphTargetBaseInfluence', morphBaseInfluence); program.getUniforms().setValue(gl, 'morphTargetInfluences', objectInfluences); @@ -13012,29 +11427,27 @@ } else { // When object doesn't have morph target influences defined, we treat it as a 0-length array // This is important to make sure we set up morphTargetBaseInfluence / morphTargetInfluences + const length = objectInfluences === undefined ? 0 : objectInfluences.length; let influences = influencesList[geometry.id]; - if (influences === undefined || influences.length !== length) { // initialise list - influences = []; + influences = []; for (let i = 0; i < length; i++) { influences[i] = [i, 0]; } - influencesList[geometry.id] = influences; - } // Collect influences + } + // Collect influences for (let i = 0; i < length; i++) { const influence = influences[i]; influence[0] = i; influence[1] = objectInfluences[i]; } - influences.sort(absNumericalSort); - for (let i = 0; i < 8; i++) { if (i < length && influences[i][1]) { workInfluences[i][0] = influences[i][0]; @@ -13044,50 +11457,42 @@ workInfluences[i][1] = 0; } } - workInfluences.sort(numericalSort); const morphTargets = geometry.morphAttributes.position; const morphNormals = geometry.morphAttributes.normal; let morphInfluencesSum = 0; - for (let i = 0; i < 8; i++) { const influence = workInfluences[i]; const index = influence[0]; const value = influence[1]; - if (index !== Number.MAX_SAFE_INTEGER && value) { if (morphTargets && geometry.getAttribute('morphTarget' + i) !== morphTargets[index]) { geometry.setAttribute('morphTarget' + i, morphTargets[index]); } - if (morphNormals && geometry.getAttribute('morphNormal' + i) !== morphNormals[index]) { geometry.setAttribute('morphNormal' + i, morphNormals[index]); } - morphInfluences[i] = value; morphInfluencesSum += value; } else { if (morphTargets && geometry.hasAttribute('morphTarget' + i) === true) { geometry.deleteAttribute('morphTarget' + i); } - if (morphNormals && geometry.hasAttribute('morphNormal' + i) === true) { geometry.deleteAttribute('morphNormal' + i); } - morphInfluences[i] = 0; } - } // GLSL shader uses formula baseinfluence * base + sum(target * influence) + } + + // GLSL shader uses formula baseinfluence * base + sum(target * influence) // This allows us to switch between absolute morphs and relative morphs without changing shader code // When baseinfluence = 1 - sum(influence), the above is equivalent to sum((target - base) * influence) - - const morphBaseInfluence = geometry.morphTargetsRelative ? 1 : 1 - morphInfluencesSum; program.getUniforms().setValue(gl, 'morphTargetBaseInfluence', morphBaseInfluence); program.getUniforms().setValue(gl, 'morphTargetInfluences', morphInfluences); } } - return { update: update }; @@ -13095,43 +11500,37 @@ function WebGLObjects(gl, geometries, attributes, info) { let updateMap = new WeakMap(); - function update(object) { const frame = info.render.frame; const geometry = object.geometry; - const buffergeometry = geometries.get(object, geometry); // Update once per frame + const buffergeometry = geometries.get(object, geometry); + + // Update once per frame if (updateMap.get(buffergeometry) !== frame) { geometries.update(buffergeometry); updateMap.set(buffergeometry, frame); } - if (object.isInstancedMesh) { if (object.hasEventListener('dispose', onInstancedMeshDispose) === false) { object.addEventListener('dispose', onInstancedMeshDispose); } - attributes.update(object.instanceMatrix, gl.ARRAY_BUFFER); - if (object.instanceColor !== null) { attributes.update(object.instanceColor, gl.ARRAY_BUFFER); } } - return buffergeometry; } - function dispose() { updateMap = new WeakMap(); } - function onInstancedMeshDispose(event) { const instancedMesh = event.target; instancedMesh.removeEventListener('dispose', onInstancedMeshDispose); attributes.remove(instancedMesh.instanceMatrix); if (instancedMesh.instanceColor !== null) attributes.remove(instancedMesh.instanceColor); } - return { update: update, dispose: dispose @@ -13147,6 +11546,7 @@ // texture.anisotropy = 16; // // See #14839 + super(null); this.image = { data, @@ -13161,9 +11561,7 @@ this.flipY = false; this.unpackAlignment = 1; } - } - DataTexture3D.prototype.isDataTexture3D = true; /** @@ -13211,88 +11609,89 @@ const emptyTexture = new Texture(); const emptyTexture2dArray = new DataTexture2DArray(); const emptyTexture3d = new DataTexture3D(); - const emptyCubeTexture = new CubeTexture(); // --- Utilities --- + const emptyCubeTexture = new CubeTexture(); + + // --- Utilities --- + // Array Caches (provide typed arrays for temporary by size) const arrayCacheF32 = []; - const arrayCacheI32 = []; // Float32Array caches used for uploading Matrix uniforms + const arrayCacheI32 = []; + + // Float32Array caches used for uploading Matrix uniforms const mat4array = new Float32Array(16); const mat3array = new Float32Array(9); - const mat2array = new Float32Array(4); // Flattening for arrays of vectors and matrices + const mat2array = new Float32Array(4); + + // Flattening for arrays of vectors and matrices function flatten(array, nBlocks, blockSize) { const firstElem = array[0]; - if (firstElem <= 0 || firstElem > 0) return array; // unoptimized: ! isNaN( firstElem ) + if (firstElem <= 0 || firstElem > 0) return array; + // unoptimized: ! isNaN( firstElem ) // see http://jacksondunstan.com/articles/983 const n = nBlocks * blockSize; let r = arrayCacheF32[n]; - if (r === undefined) { r = new Float32Array(n); arrayCacheF32[n] = r; } - if (nBlocks !== 0) { firstElem.toArray(r, 0); - for (let i = 1, offset = 0; i !== nBlocks; ++i) { offset += blockSize; array[i].toArray(r, offset); } } - return r; } - function arraysEqual(a, b) { if (a.length !== b.length) return false; - for (let i = 0, l = a.length; i < l; i++) { if (a[i] !== b[i]) return false; } - return true; } - function copyArray(a, b) { for (let i = 0, l = b.length; i < l; i++) { a[i] = b[i]; } - } // Texture unit allocation + } + // Texture unit allocation function allocTexUnits(textures, n) { let r = arrayCacheI32[n]; - if (r === undefined) { r = new Int32Array(n); arrayCacheI32[n] = r; } - for (let i = 0; i !== n; ++i) { r[i] = textures.allocateTextureUnit(); } - return r; - } // --- Setters --- + } + + // --- Setters --- + // Note: Defining these methods externally, because they come in a bunch // and this way their names minify. - // Single scalar + // Single scalar function setValueV1f(gl, v) { const cache = this.cache; if (cache[0] === v) return; gl.uniform1f(this.addr, v); cache[0] = v; - } // Single float vector (from flat array or THREE.VectorN) + } + // Single float vector (from flat array or THREE.VectorN) function setValueV2f(gl, v) { const cache = this.cache; - if (v.x !== undefined) { if (cache[0] !== v.x || cache[1] !== v.y) { gl.uniform2f(this.addr, v.x, v.y); @@ -13305,10 +11704,8 @@ copyArray(cache, v); } } - function setValueV3f(gl, v) { const cache = this.cache; - if (v.x !== undefined) { if (cache[0] !== v.x || cache[1] !== v.y || cache[2] !== v.z) { gl.uniform3f(this.addr, v.x, v.y, v.z); @@ -13329,10 +11726,8 @@ copyArray(cache, v); } } - function setValueV4f(gl, v) { const cache = this.cache; - if (v.x !== undefined) { if (cache[0] !== v.x || cache[1] !== v.y || cache[2] !== v.z || cache[3] !== v.w) { gl.uniform4f(this.addr, v.x, v.y, v.z, v.w); @@ -13346,13 +11741,13 @@ gl.uniform4fv(this.addr, v); copyArray(cache, v); } - } // Single matrix (from flat array or THREE.MatrixN) + } + // Single matrix (from flat array or THREE.MatrixN) function setValueM2(gl, v) { const cache = this.cache; const elements = v.elements; - if (elements === undefined) { if (arraysEqual(cache, v)) return; gl.uniformMatrix2fv(this.addr, false, v); @@ -13364,11 +11759,9 @@ copyArray(cache, elements); } } - function setValueM3(gl, v) { const cache = this.cache; const elements = v.elements; - if (elements === undefined) { if (arraysEqual(cache, v)) return; gl.uniformMatrix3fv(this.addr, false, v); @@ -13380,11 +11773,9 @@ copyArray(cache, elements); } } - function setValueM4(gl, v) { const cache = this.cache; const elements = v.elements; - if (elements === undefined) { if (arraysEqual(cache, v)) return; gl.uniformMatrix4fv(this.addr, false, v); @@ -13395,16 +11786,18 @@ gl.uniformMatrix4fv(this.addr, false, mat4array); copyArray(cache, elements); } - } // Single integer / boolean + } + // Single integer / boolean function setValueV1i(gl, v) { const cache = this.cache; if (cache[0] === v) return; gl.uniform1i(this.addr, v); cache[0] = v; - } // Single integer / boolean vector (from flat array) + } + // Single integer / boolean vector (from flat array) function setValueV2i(gl, v) { const cache = this.cache; @@ -13412,29 +11805,29 @@ gl.uniform2iv(this.addr, v); copyArray(cache, v); } - function setValueV3i(gl, v) { const cache = this.cache; if (arraysEqual(cache, v)) return; gl.uniform3iv(this.addr, v); copyArray(cache, v); } - function setValueV4i(gl, v) { const cache = this.cache; if (arraysEqual(cache, v)) return; gl.uniform4iv(this.addr, v); copyArray(cache, v); - } // Single unsigned integer + } + // Single unsigned integer function setValueV1ui(gl, v) { const cache = this.cache; if (cache[0] === v) return; gl.uniform1ui(this.addr, v); cache[0] = v; - } // Single unsigned integer vector (from flat array) + } + // Single unsigned integer vector (from flat array) function setValueV2ui(gl, v) { const cache = this.cache; @@ -13442,85 +11835,71 @@ gl.uniform2uiv(this.addr, v); copyArray(cache, v); } - function setValueV3ui(gl, v) { const cache = this.cache; if (arraysEqual(cache, v)) return; gl.uniform3uiv(this.addr, v); copyArray(cache, v); } - function setValueV4ui(gl, v) { const cache = this.cache; if (arraysEqual(cache, v)) return; gl.uniform4uiv(this.addr, v); copyArray(cache, v); - } // Single texture (2D / Cube) + } + // Single texture (2D / Cube) function setValueT1(gl, v, textures) { const cache = this.cache; const unit = textures.allocateTextureUnit(); - if (cache[0] !== unit) { gl.uniform1i(this.addr, unit); cache[0] = unit; } - textures.safeSetTexture2D(v || emptyTexture, unit); } - function setValueT3D1(gl, v, textures) { const cache = this.cache; const unit = textures.allocateTextureUnit(); - if (cache[0] !== unit) { gl.uniform1i(this.addr, unit); cache[0] = unit; } - textures.setTexture3D(v || emptyTexture3d, unit); } - function setValueT6(gl, v, textures) { const cache = this.cache; const unit = textures.allocateTextureUnit(); - if (cache[0] !== unit) { gl.uniform1i(this.addr, unit); cache[0] = unit; } - textures.safeSetTextureCube(v || emptyCubeTexture, unit); } - function setValueT2DArray1(gl, v, textures) { const cache = this.cache; const unit = textures.allocateTextureUnit(); - if (cache[0] !== unit) { gl.uniform1i(this.addr, unit); cache[0] = unit; } - textures.setTexture2DArray(v || emptyTexture2dArray, unit); - } // Helper to pick the right setter for the singular case + } + // Helper to pick the right setter for the singular case function getSingularSetter(type) { switch (type) { case 0x1406: return setValueV1f; // FLOAT - case 0x8b50: return setValueV2f; // _VEC2 - case 0x8b51: return setValueV3f; // _VEC3 - case 0x8b52: return setValueV4f; // _VEC4 @@ -13528,11 +11907,9 @@ case 0x8b5a: return setValueM2; // _MAT2 - case 0x8b5b: return setValueM3; // _MAT3 - case 0x8b5c: return setValueM4; // _MAT4 @@ -13541,17 +11918,14 @@ case 0x8b56: return setValueV1i; // INT, BOOL - case 0x8b53: case 0x8b57: return setValueV2i; // _VEC2 - case 0x8b54: case 0x8b58: return setValueV3i; // _VEC3 - case 0x8b55: case 0x8b59: return setValueV4i; @@ -13560,190 +11934,163 @@ case 0x1405: return setValueV1ui; // UINT - case 0x8dc6: return setValueV2ui; // _VEC2 - case 0x8dc7: return setValueV3ui; // _VEC3 - case 0x8dc8: return setValueV4ui; // _VEC4 case 0x8b5e: // SAMPLER_2D - case 0x8d66: // SAMPLER_EXTERNAL_OES - case 0x8dca: // INT_SAMPLER_2D - case 0x8dd2: // UNSIGNED_INT_SAMPLER_2D - case 0x8b62: // SAMPLER_2D_SHADOW return setValueT1; - case 0x8b5f: // SAMPLER_3D - case 0x8dcb: // INT_SAMPLER_3D - case 0x8dd3: // UNSIGNED_INT_SAMPLER_3D return setValueT3D1; - case 0x8b60: // SAMPLER_CUBE - case 0x8dcc: // INT_SAMPLER_CUBE - case 0x8dd4: // UNSIGNED_INT_SAMPLER_CUBE - case 0x8dc5: // SAMPLER_CUBE_SHADOW return setValueT6; - case 0x8dc1: // SAMPLER_2D_ARRAY - case 0x8dcf: // INT_SAMPLER_2D_ARRAY - case 0x8dd7: // UNSIGNED_INT_SAMPLER_2D_ARRAY - case 0x8dc4: // SAMPLER_2D_ARRAY_SHADOW return setValueT2DArray1; } - } // Array of scalars + } + // Array of scalars function setValueV1fArray(gl, v) { gl.uniform1fv(this.addr, v); - } // Array of vectors (from flat array or array of THREE.VectorN) + } + // Array of vectors (from flat array or array of THREE.VectorN) function setValueV2fArray(gl, v) { const data = flatten(v, this.size, 2); gl.uniform2fv(this.addr, data); } - function setValueV3fArray(gl, v) { const data = flatten(v, this.size, 3); gl.uniform3fv(this.addr, data); } - function setValueV4fArray(gl, v) { const data = flatten(v, this.size, 4); gl.uniform4fv(this.addr, data); - } // Array of matrices (from flat array or array of THREE.MatrixN) + } + // Array of matrices (from flat array or array of THREE.MatrixN) function setValueM2Array(gl, v) { const data = flatten(v, this.size, 4); gl.uniformMatrix2fv(this.addr, false, data); } - function setValueM3Array(gl, v) { const data = flatten(v, this.size, 9); gl.uniformMatrix3fv(this.addr, false, data); } - function setValueM4Array(gl, v) { const data = flatten(v, this.size, 16); gl.uniformMatrix4fv(this.addr, false, data); - } // Array of integer / boolean + } + // Array of integer / boolean function setValueV1iArray(gl, v) { gl.uniform1iv(this.addr, v); - } // Array of integer / boolean vectors (from flat array) + } + // Array of integer / boolean vectors (from flat array) function setValueV2iArray(gl, v) { gl.uniform2iv(this.addr, v); } - function setValueV3iArray(gl, v) { gl.uniform3iv(this.addr, v); } - function setValueV4iArray(gl, v) { gl.uniform4iv(this.addr, v); - } // Array of unsigned integer + } + // Array of unsigned integer function setValueV1uiArray(gl, v) { gl.uniform1uiv(this.addr, v); - } // Array of unsigned integer vectors (from flat array) + } + // Array of unsigned integer vectors (from flat array) function setValueV2uiArray(gl, v) { gl.uniform2uiv(this.addr, v); } - function setValueV3uiArray(gl, v) { gl.uniform3uiv(this.addr, v); } - function setValueV4uiArray(gl, v) { gl.uniform4uiv(this.addr, v); - } // Array of textures (2D / 3D / Cube / 2DArray) + } + // Array of textures (2D / 3D / Cube / 2DArray) function setValueT1Array(gl, v, textures) { const n = v.length; const units = allocTexUnits(textures, n); gl.uniform1iv(this.addr, units); - for (let i = 0; i !== n; ++i) { textures.safeSetTexture2D(v[i] || emptyTexture, units[i]); } } - function setValueT3DArray(gl, v, textures) { const n = v.length; const units = allocTexUnits(textures, n); gl.uniform1iv(this.addr, units); - for (let i = 0; i !== n; ++i) { textures.setTexture3D(v[i] || emptyTexture3d, units[i]); } } - function setValueT6Array(gl, v, textures) { const n = v.length; const units = allocTexUnits(textures, n); gl.uniform1iv(this.addr, units); - for (let i = 0; i !== n; ++i) { textures.safeSetTextureCube(v[i] || emptyCubeTexture, units[i]); } } - function setValueT2DArrayArray(gl, v, textures) { const n = v.length; const units = allocTexUnits(textures, n); gl.uniform1iv(this.addr, units); - for (let i = 0; i !== n; ++i) { textures.setTexture2DArray(v[i] || emptyTexture2dArray, units[i]); } - } // Helper to pick the right setter for a pure (bottom-level) array + } + // Helper to pick the right setter for a pure (bottom-level) array function getPureArraySetter(type) { switch (type) { case 0x1406: return setValueV1fArray; // FLOAT - case 0x8b50: return setValueV2fArray; // _VEC2 - case 0x8b51: return setValueV3fArray; // _VEC3 - case 0x8b52: return setValueV4fArray; // _VEC4 @@ -13751,11 +12098,9 @@ case 0x8b5a: return setValueM2Array; // _MAT2 - case 0x8b5b: return setValueM3Array; // _MAT3 - case 0x8b5c: return setValueM4Array; // _MAT4 @@ -13764,17 +12109,14 @@ case 0x8b56: return setValueV1iArray; // INT, BOOL - case 0x8b53: case 0x8b57: return setValueV2iArray; // _VEC2 - case 0x8b54: case 0x8b58: return setValueV3iArray; // _VEC3 - case 0x8b55: case 0x8b59: return setValueV4iArray; @@ -13783,105 +12125,89 @@ case 0x1405: return setValueV1uiArray; // UINT - case 0x8dc6: return setValueV2uiArray; // _VEC2 - case 0x8dc7: return setValueV3uiArray; // _VEC3 - case 0x8dc8: return setValueV4uiArray; // _VEC4 case 0x8b5e: // SAMPLER_2D - case 0x8d66: // SAMPLER_EXTERNAL_OES - case 0x8dca: // INT_SAMPLER_2D - case 0x8dd2: // UNSIGNED_INT_SAMPLER_2D - case 0x8b62: // SAMPLER_2D_SHADOW return setValueT1Array; - case 0x8b5f: // SAMPLER_3D - case 0x8dcb: // INT_SAMPLER_3D - case 0x8dd3: // UNSIGNED_INT_SAMPLER_3D return setValueT3DArray; - case 0x8b60: // SAMPLER_CUBE - case 0x8dcc: // INT_SAMPLER_CUBE - case 0x8dd4: // UNSIGNED_INT_SAMPLER_CUBE - case 0x8dc5: // SAMPLER_CUBE_SHADOW return setValueT6Array; - case 0x8dc1: // SAMPLER_2D_ARRAY - case 0x8dcf: // INT_SAMPLER_2D_ARRAY - case 0x8dd7: // UNSIGNED_INT_SAMPLER_2D_ARRAY - case 0x8dc4: // SAMPLER_2D_ARRAY_SHADOW return setValueT2DArrayArray; } - } // --- Uniform Classes --- + } + // --- Uniform Classes --- function SingleUniform(id, activeInfo, addr) { this.id = id; this.addr = addr; this.cache = []; - this.setValue = getSingularSetter(activeInfo.type); // this.path = activeInfo.name; // DEBUG - } + this.setValue = getSingularSetter(activeInfo.type); + // this.path = activeInfo.name; // DEBUG + } function PureArrayUniform(id, activeInfo, addr) { this.id = id; this.addr = addr; this.cache = []; this.size = activeInfo.size; - this.setValue = getPureArraySetter(activeInfo.type); // this.path = activeInfo.name; // DEBUG - } + this.setValue = getPureArraySetter(activeInfo.type); + // this.path = activeInfo.name; // DEBUG + } PureArrayUniform.prototype.updateCache = function (data) { const cache = this.cache; - if (data instanceof Float32Array && cache.length !== data.length) { this.cache = new Float32Array(data.length); } - copyArray(cache, data); }; - function StructuredUniform(id) { this.id = id; this.seq = []; this.map = {}; } - StructuredUniform.prototype.setValue = function (gl, value, textures) { const seq = this.seq; - for (let i = 0, n = seq.length; i !== n; ++i) { const u = seq[i]; u.setValue(gl, value[u.id], textures); } - }; // --- Top-level --- + }; + + // --- Top-level --- + // Parser - builds up the property tree from the path strings + const RePathPart = /(\w+)(\])?(\[|\.)?/g; - const RePathPart = /(\w+)(\])?(\[|\.)?/g; // extracts + // extracts // - the identifier (member name or array index) // - followed by an optional right bracket (found when array index) // - followed by an optional left bracket or dot (type of subscript) @@ -13894,84 +12220,78 @@ container.seq.push(uniformObject); container.map[uniformObject.id] = uniformObject; } - function parseUniform(activeInfo, addr, container) { const path = activeInfo.name, - pathLength = path.length; // reset RegExp object, because of the early exit of a previous run + pathLength = path.length; + // reset RegExp object, because of the early exit of a previous run RePathPart.lastIndex = 0; - while (true) { const match = RePathPart.exec(path), - matchEnd = RePathPart.lastIndex; + matchEnd = RePathPart.lastIndex; let id = match[1]; const idIsIndex = match[2] === ']', - subscript = match[3]; + subscript = match[3]; if (idIsIndex) id = id | 0; // convert to integer if (subscript === undefined || subscript === '[' && matchEnd + 2 === pathLength) { // bare name or "pure" bottom-level array "[0]" suffix + addUniform(container, subscript === undefined ? new SingleUniform(id, activeInfo, addr) : new PureArrayUniform(id, activeInfo, addr)); break; } else { // step into inner node / create it in case it doesn't exist + const map = container.map; let next = map[id]; - if (next === undefined) { next = new StructuredUniform(id); addUniform(container, next); } - container = next; } } - } // Root Container + } + // Root Container function WebGLUniforms(gl, program) { this.seq = []; this.map = {}; const n = gl.getProgramParameter(program, gl.ACTIVE_UNIFORMS); - for (let i = 0; i < n; ++i) { const info = gl.getActiveUniform(program, i), - addr = gl.getUniformLocation(program, info.name); + addr = gl.getUniformLocation(program, info.name); parseUniform(info, addr, this); } } - WebGLUniforms.prototype.setValue = function (gl, name, value, textures) { const u = this.map[name]; if (u !== undefined) u.setValue(gl, value, textures); }; - WebGLUniforms.prototype.setOptional = function (gl, object, name) { const v = object[name]; if (v !== undefined) this.setValue(gl, name, v); - }; // Static interface + }; + // Static interface WebGLUniforms.upload = function (gl, seq, values, textures) { for (let i = 0, n = seq.length; i !== n; ++i) { const u = seq[i], - v = values[u.id]; - + v = values[u.id]; if (v.needsUpdate !== false) { // note: always updating when .needsUpdate is undefined u.setValue(gl, v.value, textures); } } }; - WebGLUniforms.seqWithValue = function (seq, values) { const r = []; - for (let i = 0, n = seq.length; i !== n; ++i) { const u = seq[i]; if (u.id in values) r.push(u); } - return r; }; @@ -13983,113 +12303,93 @@ } let programIdCount = 0; - function addLineNumbers(string) { const lines = string.split('\n'); - for (let i = 0; i < lines.length; i++) { lines[i] = i + 1 + ': ' + lines[i]; } - return lines.join('\n'); } - function getEncodingComponents(encoding) { switch (encoding) { case LinearEncoding: return ['Linear', '( value )']; - case sRGBEncoding: return ['sRGB', '( value )']; - case RGBEEncoding: return ['RGBE', '( value )']; - default: console.warn('THREE.WebGLProgram: Unsupported encoding:', encoding); return ['Linear', '( value )']; } } - function getShaderErrors(gl, shader, type) { const status = gl.getShaderParameter(shader, gl.COMPILE_STATUS); const errors = gl.getShaderInfoLog(shader).trim(); - if (status && errors === '') return ''; // --enable-privileged-webgl-extension + if (status && errors === '') return ''; + + // --enable-privileged-webgl-extension // console.log( '**' + type + '**', gl.getExtension( 'WEBGL_debug_shaders' ).getTranslatedShaderSource( shader ) ); return type.toUpperCase() + '\n\n' + errors + '\n\n' + addLineNumbers(gl.getShaderSource(shader)); } - function getTexelDecodingFunction(functionName, encoding) { const components = getEncodingComponents(encoding); return 'vec4 ' + functionName + '( vec4 value ) { return ' + components[0] + 'ToLinear' + components[1] + '; }'; } - function getTexelEncodingFunction(functionName, encoding) { const components = getEncodingComponents(encoding); return 'vec4 ' + functionName + '( vec4 value ) { return LinearTo' + components[0] + components[1] + '; }'; } - function getToneMappingFunction(functionName, toneMapping) { let toneMappingName; - switch (toneMapping) { case LinearToneMapping: toneMappingName = 'Linear'; break; - case ReinhardToneMapping: toneMappingName = 'Reinhard'; break; - case CineonToneMapping: toneMappingName = 'OptimizedCineon'; break; - case ACESFilmicToneMapping: toneMappingName = 'ACESFilmic'; break; - case CustomToneMapping: toneMappingName = 'Custom'; break; - default: console.warn('THREE.WebGLProgram: Unsupported toneMapping:', toneMapping); toneMappingName = 'Linear'; } - return 'vec3 ' + functionName + '( vec3 color ) { return ' + toneMappingName + 'ToneMapping( color ); }'; } - function generateExtensions(parameters) { const chunks = [parameters.extensionDerivatives || parameters.envMapCubeUV || parameters.bumpMap || parameters.tangentSpaceNormalMap || parameters.clearcoatNormalMap || parameters.flatShading || parameters.shaderID === 'physical' ? '#extension GL_OES_standard_derivatives : enable' : '', (parameters.extensionFragDepth || parameters.logarithmicDepthBuffer) && parameters.rendererExtensionFragDepth ? '#extension GL_EXT_frag_depth : enable' : '', parameters.extensionDrawBuffers && parameters.rendererExtensionDrawBuffers ? '#extension GL_EXT_draw_buffers : require' : '', (parameters.extensionShaderTextureLOD || parameters.envMap || parameters.transmission) && parameters.rendererExtensionShaderTextureLod ? '#extension GL_EXT_shader_texture_lod : enable' : '']; return chunks.filter(filterEmptyLine).join('\n'); } - function generateDefines(defines) { const chunks = []; - for (const name in defines) { const value = defines[name]; if (value === false) continue; chunks.push('#define ' + name + ' ' + value); } - return chunks.join('\n'); } - function fetchAttributeLocations(gl, program) { const attributes = {}; const n = gl.getProgramParameter(program, gl.ACTIVE_ATTRIBUTES); - for (let i = 0; i < n; i++) { const info = gl.getActiveAttrib(program, i); const name = info.name; let locationSize = 1; if (info.type === gl.FLOAT_MAT2) locationSize = 2; if (info.type === gl.FLOAT_MAT3) locationSize = 3; - if (info.type === gl.FLOAT_MAT4) locationSize = 4; // console.log( 'THREE.WebGLProgram: ACTIVE VERTEX ATTRIBUTE:', name, i ); + if (info.type === gl.FLOAT_MAT4) locationSize = 4; + + // console.log( 'THREE.WebGLProgram: ACTIVE VERTEX ATTRIBUTE:', name, i ); attributes[name] = { type: info.type, @@ -14097,66 +12397,55 @@ locationSize: locationSize }; } - return attributes; } - function filterEmptyLine(string) { return string !== ''; } - function replaceLightNums(string, parameters) { return string.replace(/NUM_DIR_LIGHTS/g, parameters.numDirLights).replace(/NUM_SPOT_LIGHTS/g, parameters.numSpotLights).replace(/NUM_RECT_AREA_LIGHTS/g, parameters.numRectAreaLights).replace(/NUM_POINT_LIGHTS/g, parameters.numPointLights).replace(/NUM_HEMI_LIGHTS/g, parameters.numHemiLights).replace(/NUM_DIR_LIGHT_SHADOWS/g, parameters.numDirLightShadows).replace(/NUM_SPOT_LIGHT_SHADOWS/g, parameters.numSpotLightShadows).replace(/NUM_POINT_LIGHT_SHADOWS/g, parameters.numPointLightShadows); } - function replaceClippingPlaneNums(string, parameters) { return string.replace(/NUM_CLIPPING_PLANES/g, parameters.numClippingPlanes).replace(/UNION_CLIPPING_PLANES/g, parameters.numClippingPlanes - parameters.numClipIntersection); - } // Resolve Includes + } + // Resolve Includes const includePattern = /^[ \t]*#include +<([\w\d./]+)>/gm; - function resolveIncludes(string) { return string.replace(includePattern, includeReplacer); } - function includeReplacer(match, include) { const string = ShaderChunk[include]; - if (string === undefined) { throw new Error('Can not resolve #include <' + include + '>'); } - return resolveIncludes(string); - } // Unroll Loops + } + // Unroll Loops const deprecatedUnrollLoopPattern = /#pragma unroll_loop[\s]+?for \( int i \= (\d+)\; i < (\d+)\; i \+\+ \) \{([\s\S]+?)(?=\})\}/g; const unrollLoopPattern = /#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 unrollLoops(string) { return string.replace(unrollLoopPattern, loopReplacer).replace(deprecatedUnrollLoopPattern, deprecatedLoopReplacer); } - function deprecatedLoopReplacer(match, start, end, snippet) { console.warn('WebGLProgram: #pragma unroll_loop shader syntax is deprecated. Please use #pragma unroll_loop_start syntax instead.'); return loopReplacer(match, start, end, snippet); } - function loopReplacer(match, start, end, snippet) { let string = ''; - for (let i = parseInt(start); i < parseInt(end); i++) { string += snippet.replace(/\[\s*i\s*\]/g, '[ ' + i + ' ]').replace(/UNROLLED_LOOP_INDEX/g, i); } - return string; - } // + } + // function generatePrecision(parameters) { let precisionstring = 'precision ' + parameters.precision + ' float;\nprecision ' + parameters.precision + ' int;'; - if (parameters.precision === 'highp') { precisionstring += '\n#define HIGH_PRECISION'; } else if (parameters.precision === 'mediump') { @@ -14164,13 +12453,10 @@ } else if (parameters.precision === 'lowp') { precisionstring += '\n#define LOW_PRECISION'; } - return precisionstring; } - function generateShadowMapTypeDefine(parameters) { let shadowMapTypeDefine = 'SHADOWMAP_TYPE_BASIC'; - if (parameters.shadowMapType === PCFShadowMap) { shadowMapTypeDefine = 'SHADOWMAP_TYPE_PCF'; } else if (parameters.shadowMapType === PCFSoftShadowMap) { @@ -14178,33 +12464,26 @@ } else if (parameters.shadowMapType === VSMShadowMap) { shadowMapTypeDefine = 'SHADOWMAP_TYPE_VSM'; } - return shadowMapTypeDefine; } - function generateEnvMapTypeDefine(parameters) { let envMapTypeDefine = 'ENVMAP_TYPE_CUBE'; - if (parameters.envMap) { switch (parameters.envMapMode) { case CubeReflectionMapping: case CubeRefractionMapping: envMapTypeDefine = 'ENVMAP_TYPE_CUBE'; break; - case CubeUVReflectionMapping: case CubeUVRefractionMapping: envMapTypeDefine = 'ENVMAP_TYPE_CUBE_UV'; break; } } - return envMapTypeDefine; } - function generateEnvMapModeDefine(parameters) { let envMapModeDefine = 'ENVMAP_MODE_REFLECTION'; - if (parameters.envMap) { switch (parameters.envMapMode) { case CubeRefractionMapping: @@ -14213,35 +12492,29 @@ break; } } - return envMapModeDefine; } - function generateEnvMapBlendingDefine(parameters) { let envMapBlendingDefine = 'ENVMAP_BLENDING_NONE'; - if (parameters.envMap) { switch (parameters.combine) { case MultiplyOperation: envMapBlendingDefine = 'ENVMAP_BLENDING_MULTIPLY'; break; - case MixOperation: envMapBlendingDefine = 'ENVMAP_BLENDING_MIX'; break; - case AddOperation: envMapBlendingDefine = 'ENVMAP_BLENDING_ADD'; break; } } - return envMapBlendingDefine; } - function WebGLProgram(renderer, cacheKey, parameters, bindingStates) { // TODO Send this event to Three.js DevTools // console.log( 'WebGLProgram', cacheKey ); + const gl = renderer.getContext(); const defines = parameters.defines; let vertexShader = parameters.vertexShader; @@ -14255,26 +12528,23 @@ const program = gl.createProgram(); let prefixVertex, prefixFragment; let versionString = parameters.glslVersion ? '#version ' + parameters.glslVersion + '\n' : ''; - if (parameters.isRawShaderMaterial) { prefixVertex = [customDefines].filter(filterEmptyLine).join('\n'); - if (prefixVertex.length > 0) { prefixVertex += '\n'; } - prefixFragment = [customExtensions, customDefines].filter(filterEmptyLine).join('\n'); - if (prefixFragment.length > 0) { prefixFragment += '\n'; } } else { prefixVertex = [generatePrecision(parameters), '#define SHADER_NAME ' + parameters.shaderName, customDefines, parameters.instancing ? '#define USE_INSTANCING' : '', parameters.instancingColor ? '#define USE_INSTANCING_COLOR' : '', parameters.supportsVertexTextures ? '#define VERTEX_TEXTURES' : '', '#define MAX_BONES ' + parameters.maxBones, parameters.useFog && parameters.fog ? '#define USE_FOG' : '', parameters.useFog && parameters.fogExp2 ? '#define FOG_EXP2' : '', parameters.map ? '#define USE_MAP' : '', parameters.envMap ? '#define USE_ENVMAP' : '', parameters.envMap ? '#define ' + envMapModeDefine : '', parameters.lightMap ? '#define USE_LIGHTMAP' : '', parameters.aoMap ? '#define USE_AOMAP' : '', parameters.emissiveMap ? '#define USE_EMISSIVEMAP' : '', parameters.bumpMap ? '#define USE_BUMPMAP' : '', parameters.normalMap ? '#define USE_NORMALMAP' : '', parameters.lowerNormalMap ? '#define USE_LOWER_8_BIT_NORMALMAP' : '', parameters.normalMap && parameters.objectSpaceNormalMap ? '#define OBJECTSPACE_NORMALMAP' : '', parameters.normalMap && parameters.tangentSpaceNormalMap ? '#define TANGENTSPACE_NORMALMAP' : '', parameters.clearcoatMap ? '#define USE_CLEARCOATMAP' : '', parameters.clearcoatRoughnessMap ? '#define USE_CLEARCOAT_ROUGHNESSMAP' : '', parameters.clearcoatNormalMap ? '#define USE_CLEARCOAT_NORMALMAP' : '', parameters.displacementMap && parameters.supportsVertexTextures ? '#define USE_DISPLACEMENTMAP' : '', parameters.specularMap ? '#define USE_SPECULARMAP' : '', parameters.specularIntensityMap ? '#define USE_SPECULARINTENSITYMAP' : '', parameters.specularColorMap ? '#define USE_SPECULARCOLORMAP' : '', parameters.roughnessMap ? '#define USE_ROUGHNESSMAP' : '', parameters.metalnessMap ? '#define USE_METALNESSMAP' : '', parameters.alphaMap ? '#define USE_ALPHAMAP' : '', parameters.transmission ? '#define USE_TRANSMISSION' : '', parameters.transmissionMap ? '#define USE_TRANSMISSIONMAP' : '', parameters.thicknessMap ? '#define USE_THICKNESSMAP' : '', parameters.sheenColorMap ? '#define USE_SHEENCOLORMAP' : '', parameters.sheenRoughnessMap ? '#define USE_SHEENROUGHNESSMAP' : '', parameters.vertexTangents ? '#define USE_TANGENT' : '', parameters.vertexColors ? '#define USE_COLOR' : '', parameters.vertexAlphas ? '#define USE_COLOR_ALPHA' : '', parameters.vertexUvs ? '#define USE_UV' : '', parameters.uvsVertexOnly ? '#define UVS_VERTEX_ONLY' : '', parameters.flatShading ? '#define FLAT_SHADED' : '', parameters.skinning ? '#define USE_SKINNING' : '', parameters.useVertexTexture ? '#define BONE_TEXTURE' : '', parameters.morphTargets ? '#define USE_MORPHTARGETS' : '', parameters.morphNormals && parameters.flatShading === false ? '#define USE_MORPHNORMALS' : '', parameters.morphTargets && parameters.isWebGL2 ? '#define MORPHTARGETS_TEXTURE' : '', parameters.morphTargets && parameters.isWebGL2 ? '#define MORPHTARGETS_COUNT ' + parameters.morphTargetsCount : '', parameters.doubleSided ? '#define DOUBLE_SIDED' : '', parameters.flipSided ? '#define FLIP_SIDED' : '', parameters.shadowMapEnabled ? '#define USE_SHADOWMAP' : '', parameters.shadowMapEnabled ? '#define ' + shadowMapTypeDefine : '', parameters.sizeAttenuation ? '#define USE_SIZEATTENUATION' : '', parameters.logarithmicDepthBuffer ? '#define USE_LOGDEPTHBUF' : '', parameters.logarithmicDepthBuffer && parameters.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', ' attribute mat4 instanceMatrix;', '#endif', '#ifdef USE_INSTANCING_COLOR', ' attribute vec3 instanceColor;', '#endif', 'attribute vec3 position;', 'attribute vec3 normal;', 'attribute vec2 uv;', '#ifdef USE_TANGENT', ' attribute vec4 tangent;', '#endif', '#if defined( USE_COLOR_ALPHA )', ' attribute vec4 color;', '#elif defined( USE_COLOR )', ' attribute vec3 color;', '#endif', '#if ( defined( USE_MORPHTARGETS ) && ! defined( MORPHTARGETS_TEXTURE ) )', ' attribute vec3 morphTarget0;', ' attribute vec3 morphTarget1;', ' attribute vec3 morphTarget2;', ' attribute vec3 morphTarget3;', ' #ifdef USE_MORPHNORMALS', ' attribute vec3 morphNormal0;', ' attribute vec3 morphNormal1;', ' attribute vec3 morphNormal2;', ' attribute vec3 morphNormal3;', ' #else', ' attribute vec3 morphTarget4;', ' attribute vec3 morphTarget5;', ' attribute vec3 morphTarget6;', ' attribute vec3 morphTarget7;', ' #endif', '#endif', '#ifdef USE_SKINNING', ' attribute vec4 skinIndex;', ' attribute vec4 skinWeight;', '#endif', '\n'].filter(filterEmptyLine).join('\n'); - prefixFragment = [customExtensions, generatePrecision(parameters), '#define SHADER_NAME ' + parameters.shaderName, customDefines, parameters.useFog && parameters.fog ? '#define USE_FOG' : '', parameters.useFog && parameters.fogExp2 ? '#define FOG_EXP2' : '', parameters.map ? '#define USE_MAP' : '', parameters.matcap ? '#define USE_MATCAP' : '', parameters.envMap ? '#define USE_ENVMAP' : '', parameters.envMap ? '#define ' + envMapTypeDefine : '', parameters.envMap ? '#define ' + envMapModeDefine : '', parameters.envMap ? '#define ' + envMapBlendingDefine : '', parameters.lightMap ? '#define USE_LIGHTMAP' : '', parameters.aoMap ? '#define USE_AOMAP' : '', parameters.emissiveMap ? '#define USE_EMISSIVEMAP' : '', parameters.bumpMap ? '#define USE_BUMPMAP' : '', parameters.normalMap ? '#define USE_NORMALMAP' : '', parameters.lowerNormalMap ? '#define USE_LOWER_8_BIT_NORMALMAP' : '', parameters.normalMap && parameters.objectSpaceNormalMap ? '#define OBJECTSPACE_NORMALMAP' : '', parameters.normalMap && parameters.tangentSpaceNormalMap ? '#define TANGENTSPACE_NORMALMAP' : '', parameters.clearcoat ? '#define USE_CLEARCOAT' : '', parameters.clearcoatMap ? '#define USE_CLEARCOATMAP' : '', parameters.clearcoatRoughnessMap ? '#define USE_CLEARCOAT_ROUGHNESSMAP' : '', parameters.clearcoatNormalMap ? '#define USE_CLEARCOAT_NORMALMAP' : '', parameters.specularMap ? '#define USE_SPECULARMAP' : '', parameters.specularIntensityMap ? '#define USE_SPECULARINTENSITYMAP' : '', parameters.specularColorMap ? '#define USE_SPECULARCOLORMAP' : '', parameters.roughnessMap ? '#define USE_ROUGHNESSMAP' : '', parameters.metalnessMap ? '#define USE_METALNESSMAP' : '', parameters.alphaMap ? '#define USE_ALPHAMAP' : '', parameters.alphaTest ? '#define USE_ALPHATEST' : '', parameters.sheen ? '#define USE_SHEEN' : '', parameters.sheenColorMap ? '#define USE_SHEENCOLORMAP' : '', parameters.sheenRoughnessMap ? '#define USE_SHEENROUGHNESSMAP' : '', parameters.transmission ? '#define USE_TRANSMISSION' : '', parameters.transmissionMap ? '#define USE_TRANSMISSIONMAP' : '', parameters.thicknessMap ? '#define USE_THICKNESSMAP' : '', parameters.refraction ? '#define USE_REFRACTION' : '', parameters.vertexTangents ? '#define USE_TANGENT' : '', parameters.vertexColors || parameters.instancingColor ? '#define USE_COLOR' : '', parameters.vertexAlphas ? '#define USE_COLOR_ALPHA' : '', parameters.vertexUvs ? '#define USE_UV' : '', parameters.uvsVertexOnly ? '#define UVS_VERTEX_ONLY' : '', parameters.gradientMap ? '#define USE_GRADIENTMAP' : '', parameters.flatShading ? '#define FLAT_SHADED' : '', parameters.doubleSided ? '#define DOUBLE_SIDED' : '', parameters.flipSided ? '#define FLIP_SIDED' : '', parameters.shadowMapEnabled ? '#define USE_SHADOWMAP' : '', parameters.shadowMapEnabled ? '#define ' + shadowMapTypeDefine : '', parameters.premultipliedAlpha ? '#define PREMULTIPLIED_ALPHA' : '', parameters.physicallyCorrectLights ? '#define PHYSICALLY_CORRECT_LIGHTS' : '', parameters.logarithmicDepthBuffer ? '#define USE_LOGDEPTHBUF' : '', parameters.logarithmicDepthBuffer && parameters.rendererExtensionFragDepth ? '#define USE_LOGDEPTHBUF_EXT' : '', (parameters.extensionShaderTextureLOD || parameters.envMap) && parameters.rendererExtensionShaderTextureLod ? '#define TEXTURE_LOD_EXT' : '', 'uniform mat4 viewMatrix;', 'uniform vec3 cameraPosition;', 'uniform bool isOrthographic;', parameters.toneMapping !== NoToneMapping ? '#define TONE_MAPPING' : '', parameters.toneMapping !== NoToneMapping ? ShaderChunk['tonemapping_pars_fragment'] : '', // this code is required here because it is used by the toneMapping() function defined below - parameters.toneMapping !== NoToneMapping ? getToneMappingFunction('toneMapping', parameters.toneMapping) : '', parameters.dithering ? '#define DITHERING' : '', parameters.transparent ? '' : '#define OPAQUE', ShaderChunk['encodings_pars_fragment'], // this code is required here because it is used by the various encoding/decoding function defined below + prefixFragment = [customExtensions, generatePrecision(parameters), '#define SHADER_NAME ' + parameters.shaderName, customDefines, parameters.useFog && parameters.fog ? '#define USE_FOG' : '', parameters.useFog && parameters.fogExp2 ? '#define FOG_EXP2' : '', parameters.map ? '#define USE_MAP' : '', parameters.matcap ? '#define USE_MATCAP' : '', parameters.envMap ? '#define USE_ENVMAP' : '', parameters.envMap ? '#define ' + envMapTypeDefine : '', parameters.envMap ? '#define ' + envMapModeDefine : '', parameters.envMap ? '#define ' + envMapBlendingDefine : '', parameters.lightMap ? '#define USE_LIGHTMAP' : '', parameters.aoMap ? '#define USE_AOMAP' : '', parameters.emissiveMap ? '#define USE_EMISSIVEMAP' : '', parameters.bumpMap ? '#define USE_BUMPMAP' : '', parameters.normalMap ? '#define USE_NORMALMAP' : '', parameters.lowerNormalMap ? '#define USE_LOWER_8_BIT_NORMALMAP' : '', parameters.normalMap && parameters.objectSpaceNormalMap ? '#define OBJECTSPACE_NORMALMAP' : '', parameters.normalMap && parameters.tangentSpaceNormalMap ? '#define TANGENTSPACE_NORMALMAP' : '', parameters.clearcoat ? '#define USE_CLEARCOAT' : '', parameters.clearcoatMap ? '#define USE_CLEARCOATMAP' : '', parameters.clearcoatRoughnessMap ? '#define USE_CLEARCOAT_ROUGHNESSMAP' : '', parameters.clearcoatNormalMap ? '#define USE_CLEARCOAT_NORMALMAP' : '', parameters.specularMap ? '#define USE_SPECULARMAP' : '', parameters.specularIntensityMap ? '#define USE_SPECULARINTENSITYMAP' : '', parameters.specularColorMap ? '#define USE_SPECULARCOLORMAP' : '', parameters.roughnessMap ? '#define USE_ROUGHNESSMAP' : '', parameters.metalnessMap ? '#define USE_METALNESSMAP' : '', parameters.alphaMap ? '#define USE_ALPHAMAP' : '', parameters.alphaTest ? '#define USE_ALPHATEST' : '', parameters.sheen ? '#define USE_SHEEN' : '', parameters.sheenColorMap ? '#define USE_SHEENCOLORMAP' : '', parameters.sheenRoughnessMap ? '#define USE_SHEENROUGHNESSMAP' : '', parameters.transmission ? '#define USE_TRANSMISSION' : '', parameters.transmissionMap ? '#define USE_TRANSMISSIONMAP' : '', parameters.thicknessMap ? '#define USE_THICKNESSMAP' : '', parameters.refraction ? '#define USE_REFRACTION' : '', parameters.vertexTangents ? '#define USE_TANGENT' : '', parameters.vertexColors || parameters.instancingColor ? '#define USE_COLOR' : '', parameters.vertexAlphas ? '#define USE_COLOR_ALPHA' : '', parameters.vertexUvs ? '#define USE_UV' : '', parameters.uvsVertexOnly ? '#define UVS_VERTEX_ONLY' : '', parameters.gradientMap ? '#define USE_GRADIENTMAP' : '', parameters.flatShading ? '#define FLAT_SHADED' : '', parameters.doubleSided ? '#define DOUBLE_SIDED' : '', parameters.flipSided ? '#define FLIP_SIDED' : '', parameters.shadowMapEnabled ? '#define USE_SHADOWMAP' : '', parameters.shadowMapEnabled ? '#define ' + shadowMapTypeDefine : '', parameters.premultipliedAlpha ? '#define PREMULTIPLIED_ALPHA' : '', parameters.physicallyCorrectLights ? '#define PHYSICALLY_CORRECT_LIGHTS' : '', parameters.logarithmicDepthBuffer ? '#define USE_LOGDEPTHBUF' : '', parameters.logarithmicDepthBuffer && parameters.rendererExtensionFragDepth ? '#define USE_LOGDEPTHBUF_EXT' : '', (parameters.extensionShaderTextureLOD || parameters.envMap) && parameters.rendererExtensionShaderTextureLod ? '#define TEXTURE_LOD_EXT' : '', 'uniform mat4 viewMatrix;', 'uniform vec3 cameraPosition;', 'uniform bool isOrthographic;', parameters.toneMapping !== NoToneMapping ? '#define TONE_MAPPING' : '', parameters.toneMapping !== NoToneMapping ? ShaderChunk['tonemapping_pars_fragment'] : '', + // this code is required here because it is used by the toneMapping() function defined below + parameters.toneMapping !== NoToneMapping ? getToneMappingFunction('toneMapping', parameters.toneMapping) : '', parameters.dithering ? '#define DITHERING' : '', parameters.transparent ? '' : '#define OPAQUE', ShaderChunk['encodings_pars_fragment'], + // this code is required here because it is used by the various encoding/decoding function defined below parameters.map ? getTexelDecodingFunction('mapTexelToLinear', parameters.mapEncoding) : '', parameters.matcap ? getTexelDecodingFunction('matcapTexelToLinear', parameters.matcapEncoding) : '', parameters.envMap ? getTexelDecodingFunction('envMapTexelToLinear', parameters.envMapEncoding) : '', parameters.emissiveMap ? getTexelDecodingFunction('emissiveMapTexelToLinear', parameters.emissiveMapEncoding) : '', parameters.specularColorMap ? getTexelDecodingFunction('specularColorMapTexelToLinear', parameters.specularColorMapEncoding) : '', parameters.sheenColorMap ? getTexelDecodingFunction('sheenColorMapTexelToLinear', parameters.sheenColorMapEncoding) : '', parameters.lightMap ? getTexelDecodingFunction('lightMapTexelToLinear', parameters.lightMapEncoding) : '', getTexelEncodingFunction('linearToOutputTexel', parameters.outputEncoding), parameters.depthPacking ? '#define DEPTH_PACKING ' + parameters.depthPacking : '', '\n'].filter(filterEmptyLine).join('\n'); } - vertexShader = resolveIncludes(vertexShader); vertexShader = replaceLightNums(vertexShader, parameters); vertexShader = replaceClippingPlaneNums(vertexShader, parameters); @@ -14283,22 +12553,25 @@ fragmentShader = replaceClippingPlaneNums(fragmentShader, parameters); vertexShader = unrollLoops(vertexShader); fragmentShader = unrollLoops(fragmentShader); - if (parameters.isWebGL2 && parameters.isRawShaderMaterial !== true) { // GLSL 3.0 conversion for built-in materials and ShaderMaterial + versionString = '#version 300 es\n'; prefixVertex = ['precision mediump sampler2DArray;', '#define attribute in', '#define varying out', '#define texture2D texture'].join('\n') + '\n' + prefixVertex; prefixFragment = ['#define varying in', parameters.glslVersion === GLSL3 ? '' : 'layout(location = 0) out highp vec4 pc_fragColor;', parameters.glslVersion === GLSL3 ? '' : '#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' + prefixFragment; } - const vertexGlsl = versionString + prefixVertex + vertexShader; - const fragmentGlsl = versionString + prefixFragment + fragmentShader; // console.log( '*VERTEX*', vertexGlsl ); + const fragmentGlsl = versionString + prefixFragment + fragmentShader; + + // console.log( '*VERTEX*', vertexGlsl ); // console.log( '*FRAGMENT*', fragmentGlsl ); const glVertexShader = WebGLShader(gl, gl.VERTEX_SHADER, vertexGlsl); const glFragmentShader = WebGLShader(gl, gl.FRAGMENT_SHADER, fragmentGlsl); gl.attachShader(program, glVertexShader); - gl.attachShader(program, glFragmentShader); // Force a particular attribute to index 0. + gl.attachShader(program, glFragmentShader); + + // Force a particular attribute to index 0. if (parameters.index0AttributeName !== undefined) { gl.bindAttribLocation(program, 0, parameters.index0AttributeName); @@ -14306,16 +12579,15 @@ // programs with morphTargets displace position out of attribute 0 gl.bindAttribLocation(program, 0, 'position'); } + gl.linkProgram(program); - gl.linkProgram(program); // check for link errors - + // check for link errors if (renderer.debug.checkShaderErrors) { const programLog = gl.getProgramInfoLog(program).trim(); const vertexLog = gl.getShaderInfoLog(glVertexShader).trim(); const fragmentLog = gl.getShaderInfoLog(glFragmentShader).trim(); let runnable = true; let haveDiagnostics = true; - if (gl.getProgramParameter(program, gl.LINK_STATUS) === false) { runnable = false; const vertexErrors = getShaderErrors(gl, glVertexShader, 'vertex'); @@ -14326,7 +12598,6 @@ } else if (vertexLog === '' || fragmentLog === '') { haveDiagnostics = false; } - if (haveDiagnostics) { this.diagnostics = { runnable: runnable, @@ -14341,43 +12612,46 @@ } }; } - } // Clean up + } + + // Clean up + // Crashes in iOS9 and iOS10. #18402 // gl.detachShader( program, glVertexShader ); // gl.detachShader( program, glFragmentShader ); - gl.deleteShader(glVertexShader); - gl.deleteShader(glFragmentShader); // set up caching for uniform locations + gl.deleteShader(glFragmentShader); - let cachedUniforms; + // set up caching for uniform locations + let cachedUniforms; this.getUniforms = function () { if (cachedUniforms === undefined) { cachedUniforms = new WebGLUniforms(gl, program); } - return cachedUniforms; - }; // set up caching for attribute locations + }; + // set up caching for attribute locations let cachedAttributes; - this.getAttributes = function () { if (cachedAttributes === undefined) { cachedAttributes = fetchAttributeLocations(gl, program); } - return cachedAttributes; - }; // free resource + }; + // free resource this.destroy = function () { bindingStates.releaseStatesOfProgram(this); gl.deleteProgram(program); this.program = undefined; - }; // + }; + // this.name = parameters.shaderName; this.id = programIdCount++; @@ -14390,97 +12664,72 @@ } let _id = 0; - class WebGLShaderCache { constructor() { this.shaderCache = new Map(); this.materialCache = new Map(); } - update(material) { const vertexShader = material.vertexShader; const fragmentShader = material.fragmentShader; - const vertexShaderStage = this._getShaderStage(vertexShader); - const fragmentShaderStage = this._getShaderStage(fragmentShader); - const materialShaders = this._getShaderCacheForMaterial(material); - if (materialShaders.has(vertexShaderStage) === false) { materialShaders.add(vertexShaderStage); vertexShaderStage.usedTimes++; } - if (materialShaders.has(fragmentShaderStage) === false) { materialShaders.add(fragmentShaderStage); fragmentShaderStage.usedTimes++; } - return this; } - remove(material) { const materialShaders = this.materialCache.get(material); - for (const shaderStage of materialShaders) { shaderStage.usedTimes--; if (shaderStage.usedTimes === 0) this.shaderCache.delete(shaderStage); } - this.materialCache.delete(material); return this; } - getVertexShaderID(material) { return this._getShaderStage(material.vertexShader).id; } - getFragmentShaderID(material) { return this._getShaderStage(material.fragmentShader).id; } - dispose() { this.shaderCache.clear(); this.materialCache.clear(); } - _getShaderCacheForMaterial(material) { const cache = this.materialCache; - if (cache.has(material) === false) { cache.set(material, new Set()); } - return cache.get(material); } - _getShaderStage(code) { const cache = this.shaderCache; - if (cache.has(code) === false) { const stage = new WebGLShaderStage(); cache.set(code, stage); } - return cache.get(code); } - } - class WebGLShaderStage { constructor() { this.id = _id++; this.usedTimes = 0; } - } function WebGLPrograms(renderer, cubemaps, cubeuvmaps, extensions, capabilities, bindingStates, clipping) { const _programLayers = new Layers(); - const _customShaders = new WebGLShaderCache(); - const programs = []; const isWebGL2 = capabilities.isWebGL2; const logarithmicDepthBuffer = capabilities.logarithmicDepthBuffer; @@ -14507,11 +12756,9 @@ ShadowMaterial: 'shadow', SpriteMaterial: 'sprite' }; - function getMaxBones(object) { const skeleton = object.skeleton; const bones = skeleton.bones; - if (floatVertexTextures) { return 1024; } else { @@ -14521,39 +12768,35 @@ // - leave some extra space for other uniforms // - limit here is ANGLE's 254 max uniform vectors // (up to 54 should be safe) + const nVertexUniforms = maxVertexUniforms; const nVertexMatrices = Math.floor((nVertexUniforms - 20) / 4); const maxBones = Math.min(nVertexMatrices, bones.length); - if (maxBones < bones.length) { console.warn('THREE.WebGLRenderer: Skeleton has ' + bones.length + ' bones. This GPU supports ' + maxBones + '.'); return 0; } - return maxBones; } } - function getParameters(material, lights, shadows, scene, object) { const fog = scene.fog; const environment = material.isMeshStandardMaterial ? scene.environment : null; const envMap = (material.isMeshStandardMaterial ? cubeuvmaps : cubemaps).get(material.envMap || environment); - const shaderID = shaderIDs[material.type]; // heuristics to create shader parameters according to lights in the scene + const shaderID = shaderIDs[material.type]; + + // heuristics to create shader parameters according to lights in the scene // (not to blow over maxLights budget) const maxBones = object.isSkinnedMesh ? getMaxBones(object) : 0; - if (material.precision !== null) { precision = capabilities.getMaxPrecision(material.precision); - if (precision !== material.precision) { console.warn('THREE.WebGLProgram.getParameters:', material.precision, 'not supported, using', precision, 'instead.'); } } - let vertexShader, fragmentShader; let customVertexShaderID, customFragmentShaderID; - if (shaderID) { const shader = ShaderLib[shaderID]; vertexShader = shader.vertexShader; @@ -14561,13 +12804,10 @@ } else { vertexShader = material.vertexShader; fragmentShader = material.fragmentShader; - _customShaders.update(material); - customVertexShaderID = _customShaders.getVertexShaderID(material); customFragmentShaderID = _customShaders.getFragmentShaderID(material); } - const currentRenderTarget = renderer.getRenderTarget(); const useAlphaTest = material.alphaTest > 0; const useClearcoat = material.clearcoat > 0; @@ -14677,34 +12917,28 @@ }; return parameters; } - function getProgramCacheKey(parameters) { const array = []; - if (parameters.shaderID) { array.push(parameters.shaderID); } else { array.push(parameters.customVertexShaderID); array.push(parameters.customFragmentShaderID); } - if (parameters.defines !== undefined) { for (const name in parameters.defines) { array.push(name); array.push(parameters.defines[name]); } } - if (parameters.isRawShaderMaterial === false) { getProgramCacheKeyParameters(array, parameters); getProgramCacheKeyBooleans(array, parameters); array.push(renderer.outputEncoding); } - array.push(parameters.customProgramCacheKey); return array.join(); } - function getProgramCacheKeyParameters(array, parameters) { array.push(parameters.precision); array.push(parameters.outputEncoding); @@ -14735,10 +12969,8 @@ array.push(parameters.specularColorMapEncoding); array.push(parameters.sheenColorMapEncoding); } - function getProgramCacheKeyBooleans(array, parameters) { _programLayers.disableAll(); - if (parameters.isWebGL2) _programLayers.enable(0); if (parameters.supportsVertexTextures) _programLayers.enable(1); if (parameters.instancing) _programLayers.enable(2); @@ -14772,9 +13004,7 @@ if (parameters.uvsVertexOnly) _programLayers.enable(30); if (parameters.fog) _programLayers.enable(31); array.push(_programLayers.mask); - _programLayers.disableAll(); - if (parameters.useFog) _programLayers.enable(0); if (parameters.flatShading) _programLayers.enable(1); if (parameters.logarithmicDepthBuffer) _programLayers.enable(2); @@ -14802,61 +13032,52 @@ if (parameters.refraction) _programLayers.enable(24); array.push(_programLayers.mask); } - function getUniforms(material) { const shaderID = shaderIDs[material.type]; let uniforms; - if (shaderID) { const shader = ShaderLib[shaderID]; uniforms = UniformsUtils.clone(shader.uniforms); } else { uniforms = material.uniforms; } - return uniforms; } - function acquireProgram(parameters, cacheKey) { - let program; // Check if code has been already compiled + let program; + // Check if code has been already compiled for (let p = 0, pl = programs.length; p < pl; p++) { const preexistingProgram = programs[p]; - if (preexistingProgram.cacheKey === cacheKey) { program = preexistingProgram; ++program.usedTimes; break; } } - if (program === undefined) { program = new WebGLProgram(renderer, cacheKey, parameters, bindingStates); programs.push(program); } - return program; } - function releaseProgram(program) { if (--program.usedTimes === 0) { // Remove from unordered set const i = programs.indexOf(program); programs[i] = programs[programs.length - 1]; - programs.pop(); // Free WebGL resources + programs.pop(); + // Free WebGL resources program.destroy(); } } - function releaseShaderCache(material) { _customShaders.remove(material); } - function dispose() { _customShaders.dispose(); } - return { getParameters: getParameters, getProgramCacheKey: getProgramCacheKey, @@ -14872,30 +13093,23 @@ function WebGLProperties() { let properties = new WeakMap(); - function get(object) { let map = properties.get(object); - if (map === undefined) { map = {}; properties.set(object, map); } - return map; } - function remove(object) { properties.delete(object); } - function update(object, key, value) { properties.get(object)[key] = value; } - function dispose() { properties = new WeakMap(); } - return { get: get, remove: remove, @@ -14917,7 +13131,6 @@ return a.id - b.id; } } - function reversePainterSortStable(a, b) { if (a.groupOrder !== b.groupOrder) { return a.groupOrder - b.groupOrder; @@ -14929,24 +13142,20 @@ return a.id - b.id; } } - function WebGLRenderList() { const renderItems = []; let renderItemsIndex = 0; const opaque = []; const transmissive = []; const transparent = []; - function init() { renderItemsIndex = 0; opaque.length = 0; transmissive.length = 0; transparent.length = 0; } - function getNextRenderItem(object, geometry, material, groupOrder, z, group) { let renderItem = renderItems[renderItemsIndex]; - if (renderItem === undefined) { renderItem = { id: object.id, @@ -14969,14 +13178,11 @@ renderItem.z = z; renderItem.group = group; } - renderItemsIndex++; return renderItem; } - function push(object, geometry, material, groupOrder, z, group) { const renderItem = getNextRenderItem(object, geometry, material, groupOrder, z, group); - if (material.transmission > 0.0) { transmissive.push(renderItem); } else if (material.transparent === true) { @@ -14985,10 +13191,8 @@ opaque.push(renderItem); } } - function unshift(object, geometry, material, groupOrder, z, group) { const renderItem = getNextRenderItem(object, geometry, material, groupOrder, z, group); - if (material.transmission > 0.0) { transmissive.unshift(renderItem); } else if (material.transparent === true) { @@ -14997,15 +13201,14 @@ opaque.unshift(renderItem); } } - function sort(customOpaqueSort, customTransparentSort) { if (opaque.length > 1) opaque.sort(customOpaqueSort || painterSortStable); if (transmissive.length > 1) transmissive.sort(customTransparentSort || reversePainterSortStable); if (transparent.length > 1) transparent.sort(customTransparentSort || reversePainterSortStable); } - function finish() { // Clear references from inactive renderItems in the list + for (let i = renderItemsIndex, il = renderItems.length; i < il; i++) { const renderItem = renderItems[i]; if (renderItem.id === null) break; @@ -15016,7 +13219,6 @@ renderItem.group = null; } } - return { opaque: opaque, transmissive: transmissive, @@ -15028,13 +13230,10 @@ sort: sort }; } - function WebGLRenderLists() { let lists = new WeakMap(); - function get(scene, renderCallDepth) { let list; - if (lists.has(scene) === false) { list = new WebGLRenderList(); lists.set(scene, [list]); @@ -15046,14 +13245,11 @@ list = lists.get(scene)[renderCallDepth]; } } - return list; } - function dispose() { lists = new WeakMap(); } - return { get: get, dispose: dispose @@ -15067,9 +13263,7 @@ if (lights[light.id] !== undefined) { return lights[light.id]; } - let uniforms; - switch (light.type) { case 'DirectionalLight': uniforms = { @@ -15077,7 +13271,6 @@ color: new Color() }; break; - case 'SpotLight': uniforms = { position: new Vector3(), @@ -15089,7 +13282,6 @@ decay: 0 }; break; - case 'PointLight': uniforms = { position: new Vector3(), @@ -15098,7 +13290,6 @@ decay: 0 }; break; - case 'HemisphereLight': uniforms = { direction: new Vector3(), @@ -15106,7 +13297,6 @@ groundColor: new Color() }; break; - case 'RectAreaLight': uniforms = { color: new Color(), @@ -15116,13 +13306,11 @@ }; break; } - lights[light.id] = uniforms; return uniforms; } }; } - function ShadowUniformsCache() { const lights = {}; return { @@ -15130,9 +13318,7 @@ if (lights[light.id] !== undefined) { return lights[light.id]; } - let uniforms; - switch (light.type) { case 'DirectionalLight': uniforms = { @@ -15142,7 +13328,6 @@ shadowMapSize: new Vector2() }; break; - case 'SpotLight': uniforms = { shadowBias: 0, @@ -15151,7 +13336,6 @@ shadowMapSize: new Vector2() }; break; - case 'PointLight': uniforms = { shadowBias: 0, @@ -15162,21 +13346,18 @@ shadowCameraFar: 1000 }; break; + // TODO (abelnation): set RectAreaLight shadow uniforms } - lights[light.id] = uniforms; return uniforms; } }; } - let nextVersion = 0; - function shadowCastingLightsFirst(lightA, lightB) { return (lightB.castShadow ? 1 : 0) - (lightA.castShadow ? 1 : 0); } - function WebGLLights(extensions, capabilities) { const cache = new UniformsCache(); const shadowCache = ShadowUniformsCache(); @@ -15211,20 +13392,15 @@ pointShadowMatrix: [], hemi: [] }; - for (let i = 0; i < 9; i++) state.probe.push(new Vector3()); - const vector3 = new Vector3(); const matrix4 = new Matrix4(); const matrix42 = new Matrix4(); - function setup(lights, physicallyCorrectLights) { let r = 0, - g = 0, - b = 0; - + g = 0, + b = 0; for (let i = 0; i < 9; i++) state.probe[i].set(0, 0, 0); - let directionalLength = 0; let pointLength = 0; let spotLength = 0; @@ -15233,17 +13409,16 @@ let numDirectionalShadows = 0; let numPointShadows = 0; let numSpotShadows = 0; - lights.sort(shadowCastingLightsFirst); // artist-friendly light intensity scaling factor + lights.sort(shadowCastingLightsFirst); + // artist-friendly light intensity scaling factor const scaleFactor = physicallyCorrectLights !== true ? Math.PI : 1; - for (let i = 0, l = lights.length; i < l; i++) { const light = lights[i]; const color = light.color; const intensity = light.intensity; const distance = light.distance; const shadowMap = light.shadow && light.shadow.map ? light.shadow.map.texture : null; - if (light.isAmbientLight) { r += color.r * intensity * scaleFactor; g += color.g * intensity * scaleFactor; @@ -15255,7 +13430,6 @@ } else if (light.isDirectionalLight) { const uniforms = cache.get(light); uniforms.color.copy(light.color).multiplyScalar(light.intensity * scaleFactor); - if (light.castShadow) { const shadow = light.shadow; const shadowUniforms = shadowCache.get(light); @@ -15268,7 +13442,6 @@ state.directionalShadowMatrix[directionalLength] = light.shadow.matrix; numDirectionalShadows++; } - state.directional[directionalLength] = uniforms; directionalLength++; } else if (light.isSpotLight) { @@ -15279,7 +13452,6 @@ uniforms.coneCos = Math.cos(light.angle); uniforms.penumbraCos = Math.cos(light.angle * (1 - light.penumbra)); uniforms.decay = light.decay; - if (light.castShadow) { const shadow = light.shadow; const shadowUniforms = shadowCache.get(light); @@ -15292,14 +13464,15 @@ state.spotShadowMatrix[spotLength] = light.shadow.matrix; numSpotShadows++; } - state.spot[spotLength] = uniforms; spotLength++; } else if (light.isRectAreaLight) { - const uniforms = cache.get(light); // (a) intensity is the total visible light emitted + const uniforms = cache.get(light); + + // (a) intensity is the total visible light emitted //uniforms.color.copy( color ).multiplyScalar( intensity / ( light.width * light.height * Math.PI ) ); - // (b) intensity is the brightness of the light + // (b) intensity is the brightness of the light uniforms.color.copy(color).multiplyScalar(intensity); uniforms.halfWidth.set(light.width * 0.5, 0.0, 0.0); uniforms.halfHeight.set(0.0, light.height * 0.5, 0.0); @@ -15310,7 +13483,6 @@ uniforms.color.copy(light.color).multiplyScalar(light.intensity * scaleFactor); uniforms.distance = light.distance; uniforms.decay = light.decay; - if (light.castShadow) { const shadow = light.shadow; const shadowUniforms = shadowCache.get(light); @@ -15325,7 +13497,6 @@ state.pointShadowMatrix[pointLength] = light.shadow.matrix; numPointShadows++; } - state.point[pointLength] = uniforms; pointLength++; } else if (light.isHemisphereLight) { @@ -15336,14 +13507,15 @@ hemiLength++; } } - if (rectAreaLength > 0) { if (capabilities.isWebGL2) { // WebGL 2 + state.rectAreaLTC1 = UniformsLib.LTC_FLOAT_1; state.rectAreaLTC2 = UniformsLib.LTC_FLOAT_2; } else { // WebGL 1 + if (extensions.has('OES_texture_float_linear') === true) { state.rectAreaLTC1 = UniformsLib.LTC_FLOAT_1; state.rectAreaLTC2 = UniformsLib.LTC_FLOAT_2; @@ -15355,12 +13527,10 @@ } } } - state.ambient[0] = r; state.ambient[1] = g; state.ambient[2] = b; const hash = state.hash; - if (hash.directionalLength !== directionalLength || hash.pointLength !== pointLength || hash.spotLength !== spotLength || hash.rectAreaLength !== rectAreaLength || hash.hemiLength !== hemiLength || hash.numDirectionalShadows !== numDirectionalShadows || hash.numPointShadows !== numPointShadows || hash.numSpotShadows !== numSpotShadows) { state.directional.length = directionalLength; state.spot.length = spotLength; @@ -15387,7 +13557,6 @@ state.version = nextVersion++; } } - function setupView(lights, camera) { let directionalLength = 0; let pointLength = 0; @@ -15395,10 +13564,8 @@ let rectAreaLength = 0; let hemiLength = 0; const viewMatrix = camera.matrixWorldInverse; - for (let i = 0, l = lights.length; i < l; i++) { const light = lights[i]; - if (light.isDirectionalLight) { const uniforms = state.directional[directionalLength]; uniforms.direction.setFromMatrixPosition(light.matrixWorld); @@ -15418,8 +13585,9 @@ } else if (light.isRectAreaLight) { const uniforms = state.rectArea[rectAreaLength]; uniforms.position.setFromMatrixPosition(light.matrixWorld); - uniforms.position.applyMatrix4(viewMatrix); // extract local rotation of light to derive width/height half vectors + uniforms.position.applyMatrix4(viewMatrix); + // extract local rotation of light to derive width/height half vectors matrix42.identity(); matrix4.copy(light.matrixWorld); matrix4.premultiply(viewMatrix); @@ -15443,7 +13611,6 @@ } } } - return { setup: setup, setupView: setupView, @@ -15455,28 +13622,22 @@ const lights = new WebGLLights(extensions, capabilities); const lightsArray = []; const shadowsArray = []; - function init() { lightsArray.length = 0; shadowsArray.length = 0; } - function pushLight(light) { lightsArray.push(light); } - function pushShadow(shadowLight) { shadowsArray.push(shadowLight); } - function setupLights(physicallyCorrectLights) { lights.setup(lightsArray, physicallyCorrectLights); } - function setupLightsView(camera) { lights.setupView(lightsArray, camera); } - const state = { lightsArray: lightsArray, shadowsArray: shadowsArray, @@ -15491,13 +13652,10 @@ pushShadow: pushShadow }; } - function WebGLRenderStates(extensions, capabilities) { let renderStates = new WeakMap(); - function get(scene, renderCallDepth = 0) { let renderState; - if (renderStates.has(scene) === false) { renderState = new WebGLRenderState(extensions, capabilities); renderStates.set(scene, [renderState]); @@ -15509,14 +13667,11 @@ renderState = renderStates.get(scene)[renderCallDepth]; } } - return renderState; } - function dispose() { renderStates = new WeakMap(); } - return { get: get, dispose: dispose @@ -15556,7 +13711,6 @@ this.fog = false; this.setValues(parameters); } - copy(source) { super.copy(source); this.depthPacking = source.depthPacking; @@ -15569,9 +13723,7 @@ this.wireframeLinewidth = source.wireframeLinewidth; return this; } - } - MeshDepthMaterial.prototype.isMeshDepthMaterial = true; /** @@ -15607,7 +13759,6 @@ this.fog = false; this.setValues(parameters); } - copy(source) { super.copy(source); this.referencePosition.copy(source.referencePosition); @@ -15620,9 +13771,7 @@ this.displacementBias = source.displacementBias; return this; } - } - MeshDistanceMaterial.prototype.isMeshDistanceMaterial = true; const vertex = "void main() {\n\tgl_Position = vec4( position, 1.0 );\n}"; @@ -15630,17 +13779,15 @@ function WebGLShadowMap(_renderer, _objects, _capabilities) { let _frustum = new Frustum(); - const _shadowMapSize = new Vector2(), - _viewportSize = new Vector2(), - _viewport = new Vector4(), - _depthMaterial = new MeshDepthMaterial({ - depthPacking: RGBADepthPacking - }), - _distanceMaterial = new MeshDistanceMaterial(), - _materialCache = {}, - _maxTextureSize = _capabilities.maxTextureSize; - + _viewportSize = new Vector2(), + _viewport = new Vector4(), + _depthMaterial = new MeshDepthMaterial({ + depthPacking: RGBADepthPacking + }), + _distanceMaterial = new MeshDistanceMaterial(), + _materialCache = {}, + _maxTextureSize = _capabilities.maxTextureSize; const shadowSide = { 0: BackSide, 1: FrontSide, @@ -15674,62 +13821,47 @@ this.autoUpdate = true; this.needsUpdate = false; this.type = PCFShadowMap; - this.render = function (lights, scene, camera) { if (scope.enabled === false) return; if (scope.autoUpdate === false && scope.needsUpdate === false) return; if (lights.length === 0) return; - const currentRenderTarget = _renderer.getRenderTarget(); - const activeCubeFace = _renderer.getActiveCubeFace(); - const activeMipmapLevel = _renderer.getActiveMipmapLevel(); + const _state = _renderer.state; - const _state = _renderer.state; // Set GL state for depth map. - + // Set GL state for depth map. _state.setBlending(NoBlending); - _state.buffers.color.setClear(1, 1, 1, 1); - _state.buffers.depth.setTest(true); + _state.setScissorTest(false); - _state.setScissorTest(false); // render depth map - + // render depth map for (let i = 0, il = lights.length; i < il; i++) { const light = lights[i]; const shadow = light.shadow; - if (shadow === undefined) { console.warn('THREE.WebGLShadowMap:', light, 'has no shadow.'); continue; } - if (shadow.autoUpdate === false && shadow.needsUpdate === false) continue; - _shadowMapSize.copy(shadow.mapSize); - const shadowFrameExtents = shadow.getFrameExtents(); - _shadowMapSize.multiply(shadowFrameExtents); - _viewportSize.copy(shadow.mapSize); - if (_shadowMapSize.x > _maxTextureSize || _shadowMapSize.y > _maxTextureSize) { if (_shadowMapSize.x > _maxTextureSize) { _viewportSize.x = Math.floor(_maxTextureSize / shadowFrameExtents.x); _shadowMapSize.x = _viewportSize.x * shadowFrameExtents.x; shadow.mapSize.x = _viewportSize.x; } - if (_shadowMapSize.y > _maxTextureSize) { _viewportSize.y = Math.floor(_maxTextureSize / shadowFrameExtents.y); _shadowMapSize.y = _viewportSize.y * shadowFrameExtents.y; shadow.mapSize.y = _viewportSize.y; } } - if (shadow.map === null && !shadow.isPointLightShadow && this.type === VSMShadowMap) { const pars = { minFilter: LinearFilter, @@ -15741,7 +13873,6 @@ shadow.mapPass = new WebGLRenderTarget(_shadowMapSize.x, _shadowMapSize.y, pars); shadow.camera.updateProjectionMatrix(); } - if (shadow.map === null) { const pars = { minFilter: NearestFilter, @@ -15752,112 +13883,88 @@ shadow.map.texture.name = light.name + '.shadowMap'; shadow.camera.updateProjectionMatrix(); } - _renderer.setRenderTarget(shadow.map); - _renderer.clear(); - const viewportCount = shadow.getViewportCount(); - for (let vp = 0; vp < viewportCount; vp++) { const viewport = shadow.getViewport(vp); - _viewport.set(_viewportSize.x * viewport.x, _viewportSize.y * viewport.y, _viewportSize.x * viewport.z, _viewportSize.y * viewport.w); - _state.viewport(_viewport); - shadow.updateMatrices(light, vp); _frustum = shadow.getFrustum(); renderObject(scene, camera, shadow.camera, light, this.type); - } // do blur pass for VSM + } + // do blur pass for VSM if (!shadow.isPointLightShadow && this.type === VSMShadowMap) { VSMPass(shadow, camera); } - shadow.needsUpdate = false; } - scope.needsUpdate = false; - _renderer.setRenderTarget(currentRenderTarget, activeCubeFace, activeMipmapLevel); }; - function VSMPass(shadow, camera) { const geometry = _objects.update(fullScreenMesh); - if (shadowMaterialVertical.defines.VSM_SAMPLES !== shadow.blurSamples) { shadowMaterialVertical.defines.VSM_SAMPLES = shadow.blurSamples; shadowMaterialHorizontal.defines.VSM_SAMPLES = shadow.blurSamples; shadowMaterialVertical.needsUpdate = true; shadowMaterialHorizontal.needsUpdate = true; - } // vertical pass + } + // vertical pass shadowMaterialVertical.uniforms.shadow_pass.value = shadow.map.texture; shadowMaterialVertical.uniforms.resolution.value = shadow.mapSize; shadowMaterialVertical.uniforms.radius.value = shadow.radius; - _renderer.setRenderTarget(shadow.mapPass); - _renderer.clear(); + _renderer.renderBufferDirect(camera, null, geometry, shadowMaterialVertical, fullScreenMesh, null); - _renderer.renderBufferDirect(camera, null, geometry, shadowMaterialVertical, fullScreenMesh, null); // horizontal pass - + // horizontal pass shadowMaterialHorizontal.uniforms.shadow_pass.value = shadow.mapPass.texture; shadowMaterialHorizontal.uniforms.resolution.value = shadow.mapSize; shadowMaterialHorizontal.uniforms.radius.value = shadow.radius; - _renderer.setRenderTarget(shadow.map); - _renderer.clear(); - _renderer.renderBufferDirect(camera, null, geometry, shadowMaterialHorizontal, fullScreenMesh, null); } - function getDepthMaterial(object, geometry, material, light, shadowCameraNear, shadowCameraFar, type) { let result = null; const customMaterial = light.isPointLight === true ? object.customDistanceMaterial : object.customDepthMaterial; - if (customMaterial !== undefined) { result = customMaterial; } else { result = light.isPointLight === true ? _distanceMaterial : _depthMaterial; } - if (_renderer.localClippingEnabled && material.clipShadows === true && material.clippingPlanes.length !== 0 || material.displacementMap && material.displacementScale !== 0 || material.alphaMap && material.alphaTest > 0) { // in this case we need a unique material instance reflecting the // appropriate state + const keyA = result.uuid, - keyB = material.uuid; + keyB = material.uuid; let materialsForVariant = _materialCache[keyA]; - if (materialsForVariant === undefined) { materialsForVariant = {}; _materialCache[keyA] = materialsForVariant; } - let cachedMaterial = materialsForVariant[keyB]; - if (cachedMaterial === undefined) { cachedMaterial = result.clone(); materialsForVariant[keyB] = cachedMaterial; } - result = cachedMaterial; } - result.visible = material.visible; result.wireframe = material.wireframe; - if (type === VSMShadowMap) { result.side = material.shadowSide !== null ? material.shadowSide : material.side; } else { result.side = material.shadowSide !== null ? material.shadowSide : shadowSide[material.side]; } - result.alphaMap = material.alphaMap; result.alphaTest = material.alphaTest; result.clipShadows = material.clipShadows; @@ -15868,51 +13975,38 @@ result.displacementBias = material.displacementBias; result.wireframeLinewidth = material.wireframeLinewidth; result.linewidth = material.linewidth; - if (light.isPointLight === true && result.isMeshDistanceMaterial === true) { result.referencePosition.setFromMatrixPosition(light.matrixWorld); result.nearDistance = shadowCameraNear; result.farDistance = shadowCameraFar; } - return result; } - function renderObject(object, camera, shadowCamera, light, type) { if (object.visible === false) return; const visible = object.layers.test(camera.layers); - if (visible && (object.isMesh || object.isLine || object.isPoints)) { if ((object.castShadow || object.receiveShadow && type === VSMShadowMap) && (!object.frustumCulled || _frustum.intersectsObject(object))) { object.modelViewMatrix.multiplyMatrices(shadowCamera.matrixWorldInverse, object.matrixWorld); - const geometry = _objects.update(object); - const material = object.material; - if (Array.isArray(material)) { const groups = geometry.groups; - for (let k = 0, kl = groups.length; k < kl; k++) { const group = groups[k]; const groupMaterial = material[group.materialIndex]; - if (groupMaterial && groupMaterial.visible) { const depthMaterial = getDepthMaterial(object, geometry, groupMaterial, light, shadowCamera.near, shadowCamera.far, type); - _renderer.renderBufferDirect(shadowCamera, null, geometry, depthMaterial, object, group); } } } else if (material.visible) { const depthMaterial = getDepthMaterial(object, geometry, material, light, shadowCamera.near, shadowCamera.far, type); - _renderer.renderBufferDirect(shadowCamera, null, geometry, depthMaterial, object, null); } } } - const children = object.children; - for (let i = 0, l = children.length; i < l; i++) { renderObject(children[i], camera, shadowCamera, light, type); } @@ -15921,7 +14015,6 @@ function WebGLState(gl, extensions, capabilities) { const isWebGL2 = capabilities.isWebGL2; - function ColorBuffer() { let locked = false; const color = new Vector4(); @@ -15943,9 +14036,7 @@ g *= a; b *= a; } - color.set(r, g, b, a); - if (currentColorClear.equals(color) === false) { gl.clearColor(r, g, b, a); currentColorClear.copy(color); @@ -15958,7 +14049,6 @@ } }; } - function DepthBuffer() { let locked = false; let currentDepthMask = null; @@ -15985,42 +14075,33 @@ case NeverDepth: gl.depthFunc(gl.NEVER); break; - case AlwaysDepth: gl.depthFunc(gl.ALWAYS); break; - case LessDepth: gl.depthFunc(gl.LESS); break; - case LessEqualDepth: gl.depthFunc(gl.LEQUAL); break; - case EqualDepth: gl.depthFunc(gl.EQUAL); break; - case GreaterEqualDepth: gl.depthFunc(gl.GEQUAL); break; - case GreaterDepth: gl.depthFunc(gl.GREATER); break; - case NotEqualDepth: gl.depthFunc(gl.NOTEQUAL); break; - default: gl.depthFunc(gl.LEQUAL); } } else { gl.depthFunc(gl.LEQUAL); } - currentDepthFunc = depthFunc; } }, @@ -16041,7 +14122,6 @@ } }; } - function StencilBuffer() { let locked = false; let currentStencilMask = null; @@ -16105,8 +14185,9 @@ currentStencilClear = null; } }; - } // + } + // const colorBuffer = new ColorBuffer(); const depthBuffer = new DepthBuffer(); @@ -16134,7 +14215,6 @@ let lineWidthAvailable = false; let version = 0; const glVersion = gl.getParameter(gl.VERSION); - if (glVersion.indexOf('WebGL') !== -1) { version = parseFloat(/^WebGL (\d)/.exec(glVersion)[1]); lineWidthAvailable = version >= 1.0; @@ -16142,32 +14222,28 @@ version = parseFloat(/^OpenGL ES (\d)/.exec(glVersion)[1]); lineWidthAvailable = version >= 2.0; } - let currentTextureSlot = null; let currentBoundTextures = {}; const scissorParam = gl.getParameter(gl.SCISSOR_BOX); const viewportParam = gl.getParameter(gl.VIEWPORT); const currentScissor = new Vector4().fromArray(scissorParam); const currentViewport = new Vector4().fromArray(viewportParam); - function createTexture(type, target, count) { const data = new Uint8Array(4); // 4 is required to match default unpack alignment of 4. - const texture = gl.createTexture(); gl.bindTexture(type, texture); gl.texParameteri(type, gl.TEXTURE_MIN_FILTER, gl.NEAREST); gl.texParameteri(type, gl.TEXTURE_MAG_FILTER, gl.NEAREST); - for (let i = 0; i < count; i++) { gl.texImage2D(target + i, 0, gl.RGBA, 1, 1, 0, gl.RGBA, gl.UNSIGNED_BYTE, data); } - return texture; } - const emptyTextures = {}; emptyTextures[gl.TEXTURE_2D] = createTexture(gl.TEXTURE_2D, gl.TEXTURE_2D, 1); - emptyTextures[gl.TEXTURE_CUBE_MAP] = createTexture(gl.TEXTURE_CUBE_MAP, gl.TEXTURE_CUBE_MAP_POSITIVE_X, 6); // init + emptyTextures[gl.TEXTURE_CUBE_MAP] = createTexture(gl.TEXTURE_CUBE_MAP, gl.TEXTURE_CUBE_MAP_POSITIVE_X, 6); + + // init colorBuffer.setClear(0, 0, 0, 1); depthBuffer.setClear(1); @@ -16177,7 +14253,9 @@ setFlipSided(false); setCullFace(CullFaceBack); enable(gl.CULL_FACE); - setBlending(NoBlending); // + setBlending(NoBlending); + + // function enable(id) { if (enabledCapabilities[id] !== true) { @@ -16185,56 +14263,45 @@ enabledCapabilities[id] = true; } } - function disable(id) { if (enabledCapabilities[id] !== false) { gl.disable(id); enabledCapabilities[id] = false; } } - function bindFramebuffer(target, framebuffer) { if (currentBoundFramebuffers[target] !== framebuffer) { gl.bindFramebuffer(target, framebuffer); currentBoundFramebuffers[target] = framebuffer; - if (isWebGL2) { // gl.DRAW_FRAMEBUFFER is equivalent to gl.FRAMEBUFFER + if (target === gl.DRAW_FRAMEBUFFER) { currentBoundFramebuffers[gl.FRAMEBUFFER] = framebuffer; } - if (target === gl.FRAMEBUFFER) { currentBoundFramebuffers[gl.DRAW_FRAMEBUFFER] = framebuffer; } } - return true; } - return false; } - function drawBuffers(renderTarget, framebuffer) { let drawBuffers = defaultDrawbuffers; let needsUpdate = false; - if (renderTarget) { drawBuffers = currentDrawbuffers.get(framebuffer); - if (drawBuffers === undefined) { drawBuffers = []; currentDrawbuffers.set(framebuffer, drawBuffers); } - if (renderTarget.isWebGLMultipleRenderTargets) { const textures = renderTarget.texture; - if (drawBuffers.length !== textures.length || drawBuffers[0] !== gl.COLOR_ATTACHMENT0) { for (let i = 0, il = textures.length; i < il; i++) { drawBuffers[i] = gl.COLOR_ATTACHMENT0 + i; } - drawBuffers.length = textures.length; needsUpdate = true; } @@ -16250,7 +14317,6 @@ needsUpdate = true; } } - if (needsUpdate) { if (capabilities.isWebGL2) { gl.drawBuffers(drawBuffers); @@ -16259,35 +14325,29 @@ } } } - function useProgram(program) { if (currentProgram !== program) { gl.useProgram(program); currentProgram = program; return true; } - return false; } - const equationToGL = { [AddEquation]: gl.FUNC_ADD, [SubtractEquation]: gl.FUNC_SUBTRACT, [ReverseSubtractEquation]: gl.FUNC_REVERSE_SUBTRACT }; - if (isWebGL2) { equationToGL[MinEquation] = gl.MIN; equationToGL[MaxEquation] = gl.MAX; } else { const extension = extensions.get('EXT_blend_minmax'); - if (extension !== null) { equationToGL[MinEquation] = extension.MIN_EXT; equationToGL[MaxEquation] = extension.MAX_EXT; } } - const factorToGL = { [ZeroFactor]: gl.ZERO, [OneFactor]: gl.ONE, @@ -16301,22 +14361,18 @@ [OneMinusDstColorFactor]: gl.ONE_MINUS_DST_COLOR, [OneMinusDstAlphaFactor]: gl.ONE_MINUS_DST_ALPHA }; - function setBlending(blending, blendEquation, blendSrc, blendDst, blendEquationAlpha, blendSrcAlpha, blendDstAlpha, premultipliedAlpha) { if (blending === NoBlending) { if (currentBlendingEnabled === true) { disable(gl.BLEND); currentBlendingEnabled = false; } - return; } - if (currentBlendingEnabled === false) { enable(gl.BLEND); currentBlendingEnabled = true; } - if (blending !== CustomBlending) { if (blending !== currentBlending || premultipliedAlpha !== currentPremultipledAlpha) { if (currentBlendEquation !== AddEquation || currentBlendEquationAlpha !== AddEquation) { @@ -16324,25 +14380,20 @@ currentBlendEquation = AddEquation; currentBlendEquationAlpha = AddEquation; } - if (premultipliedAlpha) { switch (blending) { case NormalBlending: gl.blendFuncSeparate(gl.ONE, gl.ONE_MINUS_SRC_ALPHA, gl.ONE, gl.ONE_MINUS_SRC_ALPHA); break; - case AdditiveBlending: gl.blendFunc(gl.ONE, gl.ONE); break; - case SubtractiveBlending: gl.blendFuncSeparate(gl.ZERO, gl.ONE_MINUS_SRC_COLOR, gl.ZERO, gl.ONE); break; - case MultiplyBlending: gl.blendFuncSeparate(gl.ZERO, gl.SRC_COLOR, gl.ZERO, gl.SRC_ALPHA); break; - default: console.error('THREE.WebGLState: Invalid blending: ', blending); break; @@ -16352,25 +14403,20 @@ case NormalBlending: gl.blendFuncSeparate(gl.SRC_ALPHA, gl.ONE_MINUS_SRC_ALPHA, gl.ONE, gl.ONE_MINUS_SRC_ALPHA); break; - case AdditiveBlending: gl.blendFunc(gl.SRC_ALPHA, gl.ONE); break; - case SubtractiveBlending: gl.blendFuncSeparate(gl.ZERO, gl.ONE_MINUS_SRC_COLOR, gl.ZERO, gl.ONE); break; - case MultiplyBlending: gl.blendFunc(gl.ZERO, gl.SRC_COLOR); break; - default: console.error('THREE.WebGLState: Invalid blending: ', blending); break; } } - currentBlendSrc = null; currentBlendDst = null; currentBlendSrcAlpha = null; @@ -16378,21 +14424,19 @@ currentBlending = blending; currentPremultipledAlpha = premultipliedAlpha; } - return; - } // custom blending + } + // custom blending blendEquationAlpha = blendEquationAlpha || blendEquation; blendSrcAlpha = blendSrcAlpha || blendSrc; blendDstAlpha = blendDstAlpha || blendDst; - if (blendEquation !== currentBlendEquation || blendEquationAlpha !== currentBlendEquationAlpha) { gl.blendEquationSeparate(equationToGL[blendEquation], equationToGL[blendEquationAlpha]); currentBlendEquation = blendEquation; currentBlendEquationAlpha = blendEquationAlpha; } - if (blendSrc !== currentBlendSrc || blendDst !== currentBlendDst || blendSrcAlpha !== currentBlendSrcAlpha || blendDstAlpha !== currentBlendDstAlpha) { gl.blendFuncSeparate(factorToGL[blendSrc], factorToGL[blendDst], factorToGL[blendSrcAlpha], factorToGL[blendDstAlpha]); currentBlendSrc = blendSrc; @@ -16400,11 +14444,9 @@ currentBlendSrcAlpha = blendSrcAlpha; currentBlendDstAlpha = blendDstAlpha; } - currentBlending = blending; currentPremultipledAlpha = null; } - function setMaterial(material, frontFaceCW) { material.side === DoubleSide ? disable(gl.CULL_FACE) : enable(gl.CULL_FACE); let flipSided = material.side === BackSide; @@ -16417,17 +14459,16 @@ colorBuffer.setMask(material.colorWrite); const stencilWrite = material.stencilWrite; stencilBuffer.setTest(stencilWrite); - if (stencilWrite) { stencilBuffer.setMask(material.stencilWriteMask); stencilBuffer.setFunc(material.stencilFunc, material.stencilRef, material.stencilFuncMask); stencilBuffer.setOp(material.stencilFail, material.stencilZFail, material.stencilZPass); } - setPolygonOffset(material.polygonOffset, material.polygonOffsetFactor, material.polygonOffsetUnits); material.alphaToCoverage === true ? enable(gl.SAMPLE_ALPHA_TO_COVERAGE) : disable(gl.SAMPLE_ALPHA_TO_COVERAGE); - } // + } + // function setFlipSided(flipSided) { if (currentFlipSided !== flipSided) { @@ -16436,15 +14477,12 @@ } else { gl.frontFace(gl.CCW); } - currentFlipSided = flipSided; } } - function setCullFace(cullFace) { if (cullFace !== CullFaceNone) { enable(gl.CULL_FACE); - if (cullFace !== currentCullFace) { if (cullFace === CullFaceBack) { gl.cullFace(gl.BACK); @@ -16457,21 +14495,17 @@ } else { disable(gl.CULL_FACE); } - currentCullFace = cullFace; } - function setLineWidth(width) { if (width !== currentLineWidth) { if (lineWidthAvailable) gl.lineWidth(width); currentLineWidth = width; } } - function setPolygonOffset(polygonOffset, factor, units) { if (polygonOffset) { enable(gl.POLYGON_OFFSET_FILL); - if (currentPolygonOffsetFactor !== factor || currentPolygonOffsetUnits !== units) { gl.polygonOffset(factor, units); currentPolygonOffsetFactor = factor; @@ -16481,32 +14515,28 @@ disable(gl.POLYGON_OFFSET_FILL); } } - function setScissorTest(scissorTest) { if (scissorTest) { enable(gl.SCISSOR_TEST); } else { disable(gl.SCISSOR_TEST); } - } // texture + } + // texture function activeTexture(webglSlot) { if (webglSlot === undefined) webglSlot = gl.TEXTURE0 + maxTextures - 1; - if (currentTextureSlot !== webglSlot) { gl.activeTexture(webglSlot); currentTextureSlot = webglSlot; } } - function bindTexture(webglType, webglTexture) { if (currentTextureSlot === null) { activeTexture(); } - let boundTexture = currentBoundTextures[currentTextureSlot]; - if (boundTexture === undefined) { boundTexture = { type: undefined, @@ -16514,24 +14544,20 @@ }; currentBoundTextures[currentTextureSlot] = boundTexture; } - if (boundTexture.type !== webglType || boundTexture.texture !== webglTexture) { gl.bindTexture(webglType, webglTexture || emptyTextures[webglType]); boundTexture.type = webglType; boundTexture.texture = webglTexture; } } - function unbindTexture() { const boundTexture = currentBoundTextures[currentTextureSlot]; - if (boundTexture !== undefined && boundTexture.type !== undefined) { gl.bindTexture(boundTexture.type, null); boundTexture.type = undefined; boundTexture.texture = undefined; } } - function compressedTexImage2D() { try { gl.compressedTexImage2D.apply(gl, arguments); @@ -16539,7 +14565,6 @@ console.error('THREE.WebGLState:', error); } } - function texSubImage2D() { try { gl.texSubImage2D.apply(gl, arguments); @@ -16547,7 +14572,6 @@ console.error('THREE.WebGLState:', error); } } - function texSubImage3D() { try { gl.texSubImage3D.apply(gl, arguments); @@ -16555,7 +14579,6 @@ console.error('THREE.WebGLState:', error); } } - function compressedTexSubImage2D() { try { gl.compressedTexSubImage2D.apply(gl, arguments); @@ -16563,7 +14586,6 @@ console.error('THREE.WebGLState:', error); } } - function texStorage2D() { try { gl.texStorage2D.apply(gl, arguments); @@ -16571,7 +14593,6 @@ console.error('THREE.WebGLState:', error); } } - function texStorage3D() { try { gl.texStorage3D.apply(gl, arguments); @@ -16579,7 +14600,6 @@ console.error('THREE.WebGLState:', error); } } - function texImage2D() { try { gl.texImage2D.apply(gl, arguments); @@ -16587,15 +14607,15 @@ console.error('THREE.WebGLState:', error); } } - function texImage3D() { try { gl.texImage3D.apply(gl, arguments); } catch (error) { console.error('THREE.WebGLState:', error); } - } // + } + // function scissor(scissor) { if (currentScissor.equals(scissor) === false) { @@ -16603,17 +14623,18 @@ currentScissor.copy(scissor); } } - function viewport(viewport) { if (currentViewport.equals(viewport) === false) { gl.viewport(viewport.x, viewport.y, viewport.z, viewport.w); currentViewport.copy(viewport); } - } // + } + // function reset() { // reset state + gl.disable(gl.BLEND); gl.disable(gl.CULL_FACE); gl.disable(gl.DEPTH_TEST); @@ -16638,16 +14659,16 @@ gl.polygonOffset(0, 0); gl.activeTexture(gl.TEXTURE0); gl.bindFramebuffer(gl.FRAMEBUFFER, null); - if (isWebGL2 === true) { gl.bindFramebuffer(gl.DRAW_FRAMEBUFFER, null); gl.bindFramebuffer(gl.READ_FRAMEBUFFER, null); } - gl.useProgram(null); gl.lineWidth(1); gl.scissor(0, 0, gl.canvas.width, gl.canvas.height); - gl.viewport(0, 0, gl.canvas.width, gl.canvas.height); // reset internals + gl.viewport(0, 0, gl.canvas.width, gl.canvas.height); + + // reset internals enabledCapabilities = {}; currentTextureSlot = null; @@ -16676,12 +14697,10 @@ depthBuffer.reset(); stencilBuffer.reset(); } - function clearTextureBindingState() { currentTextureSlot = null; currentBoundTextures = {}; } - return { buffers: { color: colorBuffer, @@ -16726,41 +14745,46 @@ const maxSamples = capabilities.maxSamples; const MultisampledRenderToTextureExtension = extensions.has('WEBGL_multisampled_render_to_texture') ? extensions.get('WEBGL_multisampled_render_to_texture') : null; const supportsInvalidateFramebuffer = typeof navigator === 'undefined' ? false : /OculusBrowser/g.test(navigator.userAgent); - const _videoTextures = new WeakMap(); + let _canvas; - let _canvas; // cordova iOS (as of 5.0) still uses UIWebView, which provides OffscreenCanvas, + // cordova iOS (as of 5.0) still uses UIWebView, which provides OffscreenCanvas, // also OffscreenCanvas.getContext("webgl"), but not OffscreenCanvas.getContext("2d")! // Some implementations may only implement OffscreenCanvas partially (e.g. lacking 2d). - let useOffscreenCanvas = false; - try { useOffscreenCanvas = typeof OffscreenCanvas !== 'undefined' && new OffscreenCanvas(1, 1).getContext('2d') !== null; - } catch (err) {// Ignore any errors - } + } catch (err) { + // Ignore any errors + } function createCanvas(width, height) { // Use OffscreenCanvas when available. Specially needed in web workers + return useOffscreenCanvas ? new OffscreenCanvas(width, height) : createElementNS('canvas'); } - function resizeImage(image, needsPowerOfTwo, needsNewCanvas, maxSize) { - let scale = 1; // handle case if texture exceeds max size + let scale = 1; + + // handle case if texture exceeds max size if (image.width > maxSize || image.height > maxSize) { scale = maxSize / Math.max(image.width, image.height); - } // only perform resize if necessary + } + // only perform resize if necessary if (scale < 1 || needsPowerOfTwo === true) { // only perform resize for certain image types + if (typeof HTMLImageElement !== 'undefined' && image instanceof HTMLImageElement || typeof HTMLCanvasElement !== 'undefined' && image instanceof HTMLCanvasElement || typeof ImageBitmap !== 'undefined' && image instanceof ImageBitmap) { const floor = needsPowerOfTwo ? floorPowerOfTwo : Math.floor; const width = floor(scale * image.width); const height = floor(scale * image.height); - if (_canvas === undefined) _canvas = createCanvas(width, height); // cube textures can't reuse the same canvas + if (_canvas === undefined) _canvas = createCanvas(width, height); + + // cube textures can't reuse the same canvas const canvas = needsNewCanvas ? createCanvas(width, height) : _canvas; canvas.width = width; @@ -16773,53 +14797,41 @@ if ('data' in image) { console.warn('THREE.WebGLRenderer: Image in DataTexture is too big (' + image.width + 'x' + image.height + ').'); } - return image; } } - return image; } - function isPowerOfTwo$1(image) { return isPowerOfTwo(image.width) && isPowerOfTwo(image.height); } - function textureNeedsPowerOfTwo(texture) { if (isWebGL2) return false; return texture.wrapS !== ClampToEdgeWrapping || texture.wrapT !== ClampToEdgeWrapping || texture.minFilter !== NearestFilter && texture.minFilter !== LinearFilter; } - function textureNeedsGenerateMipmaps(texture, supportsMips) { return texture.generateMipmaps && supportsMips && texture.minFilter !== NearestFilter && texture.minFilter !== LinearFilter; } - function generateMipmap(target) { _gl.generateMipmap(target); } - function getInternalFormat(internalFormatName, glFormat, glType, encoding, sRGBToLinearWithShader = !Texture.useSrgbTextures) { if (isWebGL2 === false) return glFormat; - if (internalFormatName !== null) { if (_gl[internalFormatName] !== undefined) return _gl[internalFormatName]; console.warn('THREE.WebGLRenderer: Attempt to use non-existing WebGL internal format \'' + internalFormatName + '\''); } - let internalFormat = glFormat; - if (glFormat === _gl.RED) { if (glType === _gl.FLOAT) internalFormat = _gl.R32F; if (glType === _gl.HALF_FLOAT) internalFormat = _gl.R16F; if (glType === _gl.UNSIGNED_BYTE) internalFormat = _gl.R8; } - if (glFormat === _gl.RG) { if (glType === _gl.FLOAT) internalFormat = _gl.RG32F; if (glType === _gl.HALF_FLOAT) internalFormat = _gl.RG16F; if (glType === _gl.UNSIGNED_BYTE) internalFormat = _gl.RG8; } - if (glFormat === _gl.RGBA) { if (glType === _gl.FLOAT) internalFormat = _gl.RGBA32F; if (glType === _gl.HALF_FLOAT) internalFormat = _gl.RGBA16F; @@ -16827,144 +14839,124 @@ if (glType === _gl.UNSIGNED_SHORT_4_4_4_4) internalFormat = _gl.RGBA4; if (glType === _gl.UNSIGNED_SHORT_5_5_5_1) internalFormat = _gl.RGB5_A1; } - if (internalFormat === _gl.R16F || internalFormat === _gl.R32F || internalFormat === _gl.RG16F || internalFormat === _gl.RG32F || internalFormat === _gl.RGBA16F || internalFormat === _gl.RGBA32F) { extensions.get('EXT_color_buffer_float'); } - return internalFormat; } - function getMipLevels(texture, image, supportsMips) { if (textureNeedsGenerateMipmaps(texture, supportsMips) === true || texture.isFramebufferTexture && texture.minFilter !== NearestFilter && texture.minFilter !== LinearFilter) { return Math.log2(Math.max(image.width, image.height)) + 1; } else if (texture.mipmaps !== undefined && texture.mipmaps.length > 0) { // user-defined mipmaps + return texture.mipmaps.length; } else if (texture.isCompressedTexture && Array.isArray(texture.image)) { return image.mipmaps.length; } else { // texture without mipmaps (only base level) + return 1; } - } // Fallback filters for non-power-of-2 textures + } + // Fallback filters for non-power-of-2 textures function filterFallback(f) { if (f === NearestFilter || f === NearestMipmapNearestFilter || f === NearestMipmapLinearFilter) { return _gl.NEAREST; } - return _gl.LINEAR; - } // + } + // function onTextureDispose(event) { const texture = event.target; texture.removeEventListener('dispose', onTextureDispose); deallocateTexture(texture); - if (texture.isVideoTexture) { _videoTextures.delete(texture); } - info.memory.textures--; } - function onRenderTargetDispose(event) { const renderTarget = event.target; renderTarget.removeEventListener('dispose', onRenderTargetDispose); deallocateRenderTarget(renderTarget); - } // + } + // function deallocateTexture(texture) { const textureProperties = properties.get(texture); if (textureProperties.__webglInit === undefined) return; - _gl.deleteTexture(textureProperties.__webglTexture); - delete textureProperties.__webglTexture; properties.remove(texture); } - function deallocateRenderTarget(renderTarget) { const texture = renderTarget.texture; const renderTargetProperties = properties.get(renderTarget); const textureProperties = properties.get(texture); if (!renderTarget) return; - if (textureProperties.__webglTexture !== undefined) { _gl.deleteTexture(textureProperties.__webglTexture); - delete textureProperties.__webglTexture; info.memory.textures--; } - if (renderTarget.depthTexture) { renderTarget.depthTexture.dispose(); } - if (renderTarget.isWebGLCubeRenderTarget) { for (let i = 0; i < 6; i++) { _gl.deleteFramebuffer(renderTargetProperties.__webglFramebuffer[i]); - if (renderTargetProperties.__webglDepthbuffer) _gl.deleteRenderbuffer(renderTargetProperties.__webglDepthbuffer[i]); } } else { _gl.deleteFramebuffer(renderTargetProperties.__webglFramebuffer); - if (renderTargetProperties.__webglDepthbuffer) _gl.deleteRenderbuffer(renderTargetProperties.__webglDepthbuffer); if (renderTargetProperties.__webglMultisampledFramebuffer) _gl.deleteFramebuffer(renderTargetProperties.__webglMultisampledFramebuffer); if (renderTargetProperties.__webglColorRenderbuffer) _gl.deleteRenderbuffer(renderTargetProperties.__webglColorRenderbuffer); if (renderTargetProperties.__webglDepthRenderbuffer) _gl.deleteRenderbuffer(renderTargetProperties.__webglDepthRenderbuffer); } - if (renderTarget.isWebGLMultipleRenderTargets) { for (let i = 0, il = texture.length; i < il; i++) { const attachmentProperties = properties.get(texture[i]); - if (attachmentProperties.__webglTexture) { _gl.deleteTexture(attachmentProperties.__webglTexture); - info.memory.textures--; } - properties.remove(texture[i]); } } - properties.remove(texture); properties.remove(renderTarget); - } // + } + // let textureUnits = 0; - function resetTextureUnits() { textureUnits = 0; } - function allocateTextureUnit() { const textureUnit = textureUnits; - if (textureUnit >= maxTextures) { console.warn('THREE.WebGLTextures: Trying to use ' + textureUnit + ' texture units while this GPU supports only ' + maxTextures); } - textureUnits += 1; return textureUnit; - } // + } + // function setTexture2D(texture, slot) { const textureProperties = properties.get(texture); if (texture.isExternalTexture2D) textureProperties.__webglTexture = texture.webglTexture; if (texture.isVideoTexture) updateVideoTexture(texture); - if (texture.version > 0 && textureProperties.__version !== texture.version) { const image = texture.image; - if (image === undefined) { console.warn('THREE.WebGLRenderer: Texture marked for update but image is undefined'); } else if (image.complete === false) { @@ -16974,47 +14966,36 @@ return; } } - state.activeTexture(_gl.TEXTURE0 + slot); state.bindTexture(_gl.TEXTURE_2D, textureProperties.__webglTexture); } - function setTexture2DArray(texture, slot) { const textureProperties = properties.get(texture); - if (texture.version > 0 && textureProperties.__version !== texture.version) { uploadTexture(textureProperties, texture, slot); return; } - state.activeTexture(_gl.TEXTURE0 + slot); state.bindTexture(_gl.TEXTURE_2D_ARRAY, textureProperties.__webglTexture); } - function setTexture3D(texture, slot) { const textureProperties = properties.get(texture); - if (texture.version > 0 && textureProperties.__version !== texture.version) { uploadTexture(textureProperties, texture, slot); return; } - state.activeTexture(_gl.TEXTURE0 + slot); state.bindTexture(_gl.TEXTURE_3D, textureProperties.__webglTexture); } - function setTextureCube(texture, slot) { const textureProperties = properties.get(texture); - if (texture.version > 0 && textureProperties.__version !== texture.version) { uploadCubeTexture(textureProperties, texture, slot); return; } - state.activeTexture(_gl.TEXTURE0 + slot); state.bindTexture(_gl.TEXTURE_CUBE_MAP, textureProperties.__webglTexture); } - const wrappingToGL = { [RepeatWrapping]: _gl.REPEAT, [ClampToEdgeWrapping]: _gl.CLAMP_TO_EDGE, @@ -17028,56 +15009,41 @@ [LinearMipmapNearestFilter]: _gl.LINEAR_MIPMAP_NEAREST, [LinearMipmapLinearFilter]: _gl.LINEAR_MIPMAP_LINEAR }; - function setTextureParameters(textureType, texture, supportsMips) { if (supportsMips) { _gl.texParameteri(textureType, _gl.TEXTURE_WRAP_S, wrappingToGL[texture.wrapS]); - _gl.texParameteri(textureType, _gl.TEXTURE_WRAP_T, wrappingToGL[texture.wrapT]); - if (textureType === _gl.TEXTURE_3D || textureType === _gl.TEXTURE_2D_ARRAY) { _gl.texParameteri(textureType, _gl.TEXTURE_WRAP_R, wrappingToGL[texture.wrapR]); } - _gl.texParameteri(textureType, _gl.TEXTURE_MAG_FILTER, filterToGL[texture.magFilter]); - _gl.texParameteri(textureType, _gl.TEXTURE_MIN_FILTER, filterToGL[texture.minFilter]); } else { _gl.texParameteri(textureType, _gl.TEXTURE_WRAP_S, _gl.CLAMP_TO_EDGE); - _gl.texParameteri(textureType, _gl.TEXTURE_WRAP_T, _gl.CLAMP_TO_EDGE); - if (textureType === _gl.TEXTURE_3D || textureType === _gl.TEXTURE_2D_ARRAY) { _gl.texParameteri(textureType, _gl.TEXTURE_WRAP_R, _gl.CLAMP_TO_EDGE); } - if (texture.wrapS !== ClampToEdgeWrapping || texture.wrapT !== ClampToEdgeWrapping) { console.warn('THREE.WebGLRenderer: Texture is not power of two. Texture.wrapS and Texture.wrapT should be set to THREE.ClampToEdgeWrapping.'); } - _gl.texParameteri(textureType, _gl.TEXTURE_MAG_FILTER, filterFallback(texture.magFilter)); - _gl.texParameteri(textureType, _gl.TEXTURE_MIN_FILTER, filterFallback(texture.minFilter)); - if (texture.minFilter !== NearestFilter && texture.minFilter !== LinearFilter) { console.warn('THREE.WebGLRenderer: Texture is not power of two. Texture.minFilter should be set to THREE.NearestFilter or THREE.LinearFilter.'); } } - if (extensions.has('EXT_texture_filter_anisotropic') === true) { const extension = extensions.get('EXT_texture_filter_anisotropic'); if (texture.type === FloatType && extensions.has('OES_texture_float_linear') === false) return; // verify extension for WebGL 1 and WebGL 2 - if (isWebGL2 === false && texture.type === HalfFloatType && extensions.has('OES_texture_half_float_linear') === false) return; // verify extension for WebGL 1 only if (texture.anisotropy > 1 || properties.get(texture).__currentAnisotropy) { _gl.texParameterf(textureType, extension.TEXTURE_MAX_ANISOTROPY_EXT, Math.min(texture.anisotropy, capabilities.getMaxAnisotropy())); - properties.get(texture).__currentAnisotropy = texture.anisotropy; } } } - function initTexture(textureProperties, texture) { if (textureProperties.__webglInit === undefined) { textureProperties.__webglInit = true; @@ -17086,7 +15052,6 @@ info.memory.textures++; } } - function uploadTexture(textureProperties, texture, slot) { let textureType = _gl.TEXTURE_2D; if (texture.isDataTexture2DArray) textureType = _gl.TEXTURE_2D_ARRAY; @@ -17094,32 +15059,26 @@ initTexture(textureProperties, texture); state.activeTexture(_gl.TEXTURE0 + slot); state.bindTexture(textureType, textureProperties.__webglTexture); - _gl.pixelStorei(_gl.UNPACK_FLIP_Y_WEBGL, texture.flipY); - _gl.pixelStorei(_gl.UNPACK_PREMULTIPLY_ALPHA_WEBGL, texture.premultiplyAlpha); - _gl.pixelStorei(_gl.UNPACK_ALIGNMENT, texture.unpackAlignment); - _gl.pixelStorei(_gl.UNPACK_COLORSPACE_CONVERSION_WEBGL, _gl.NONE); - const needsPowerOfTwo = textureNeedsPowerOfTwo(texture) && isPowerOfTwo$1(texture.image) === false; const image = resizeImage(texture.image, needsPowerOfTwo, false, maxTextureSize); const supportsMips = isPowerOfTwo$1(image) || isWebGL2, - glFormat = utils.convert(texture.format, texture.encoding); + glFormat = utils.convert(texture.format, texture.encoding); let glType = utils.convert(texture.type), - glInternalFormat = getInternalFormat(texture.internalFormat, glFormat, glType, texture.encoding, texture.sRGBToLinearWithShader); + glInternalFormat = getInternalFormat(texture.internalFormat, glFormat, glType, texture.encoding, texture.sRGBToLinearWithShader); setTextureParameters(textureType, texture, supportsMips); let mipmap; const mipmaps = texture.mipmaps; const useTexStorage = isWebGL2 && texture.isVideoTexture !== true; const allocateMemory = textureProperties.__version === undefined; const levels = getMipLevels(texture, image, supportsMips); - if (texture.isDepthTexture) { // populate depth texture with dummy data - glInternalFormat = _gl.DEPTH_COMPONENT; + glInternalFormat = _gl.DEPTH_COMPONENT; if (isWebGL2) { if (texture.type === FloatType) { glInternalFormat = _gl.DEPTH_COMPONENT32F; @@ -17134,8 +15093,9 @@ if (texture.type === FloatType) { console.error('WebGLRenderer: Floating point depth texture requires WebGL2.'); } - } // validation checks for WebGL 1 + } + // validation checks for WebGL 1 if (texture.format === DepthFormat && glInternalFormat === _gl.DEPTH_COMPONENT) { // The error INVALID_OPERATION is generated by texImage2D if format and internalformat are @@ -17147,21 +15107,22 @@ glType = utils.convert(texture.type); } } - if (texture.format === DepthStencilFormat && glInternalFormat === _gl.DEPTH_COMPONENT) { // Depth stencil textures need the DEPTH_STENCIL internal format // (https://www.khronos.org/registry/webgl/extensions/WEBGL_depth_texture/) - glInternalFormat = _gl.DEPTH_STENCIL; // The error INVALID_OPERATION is generated by texImage2D if format and internalformat are + glInternalFormat = _gl.DEPTH_STENCIL; + + // The error INVALID_OPERATION is generated by texImage2D if format and internalformat are // DEPTH_STENCIL and type is not UNSIGNED_INT_24_8_WEBGL. // (https://www.khronos.org/registry/webgl/extensions/WEBGL_depth_texture/) - if (texture.type !== UnsignedInt248Type) { console.warn('THREE.WebGLRenderer: Use UnsignedInt248Type for DepthStencilFormat DepthTexture.'); texture.type = UnsignedInt248Type; glType = utils.convert(texture.type); } - } // + } + // if (useTexStorage && allocateMemory) { state.texStorage2D(_gl.TEXTURE_2D, 1, glInternalFormat, image.width, image.height); @@ -17172,28 +15133,25 @@ // use manually created mipmaps if available // if there are no manual mipmaps // set 0 level mipmap and then use GL to generate other mipmap levels + if (mipmaps.length > 0 && supportsMips) { if (useTexStorage && allocateMemory) { state.texStorage2D(_gl.TEXTURE_2D, levels, glInternalFormat, mipmaps[0].width, mipmaps[0].height); } - for (let i = 0, il = mipmaps.length; i < il; i++) { mipmap = mipmaps[i]; - if (useTexStorage) { state.texSubImage2D(_gl.TEXTURE_2D, 0, 0, 0, mipmap.width, mipmap.height, glFormat, glType, mipmap.data); } else { state.texImage2D(_gl.TEXTURE_2D, i, glInternalFormat, mipmap.width, mipmap.height, 0, glFormat, glType, mipmap.data); } } - texture.generateMipmaps = false; } else { if (useTexStorage) { if (allocateMemory) { state.texStorage2D(_gl.TEXTURE_2D, levels, glInternalFormat, image.width, image.height); } - state.texSubImage2D(_gl.TEXTURE_2D, 0, 0, 0, image.width, image.height, glFormat, glType, image.data); } else { state.texImage2D(_gl.TEXTURE_2D, 0, glInternalFormat, image.width, image.height, 0, glFormat, glType, image.data); @@ -17203,10 +15161,8 @@ if (useTexStorage && allocateMemory) { state.texStorage2D(_gl.TEXTURE_2D, levels, glInternalFormat, mipmaps[0].width, mipmaps[0].height); } - for (let i = 0, il = mipmaps.length; i < il; i++) { mipmap = mipmaps[i]; - if (texture.format !== RGBAFormat) { if (glFormat !== null) { if (useTexStorage) { @@ -17230,7 +15186,6 @@ if (allocateMemory) { state.texStorage3D(_gl.TEXTURE_2D_ARRAY, levels, glInternalFormat, image.width, image.height, image.depth); } - state.texSubImage3D(_gl.TEXTURE_2D_ARRAY, 0, 0, 0, 0, image.width, image.height, image.depth, glFormat, glType, image.data); } else { state.texImage3D(_gl.TEXTURE_2D_ARRAY, 0, glInternalFormat, image.width, image.height, image.depth, 0, glFormat, glType, image.data); @@ -17240,7 +15195,6 @@ if (allocateMemory) { state.texStorage3D(_gl.TEXTURE_3D, levels, glInternalFormat, image.width, image.height, image.depth); } - state.texSubImage3D(_gl.TEXTURE_3D, 0, 0, 0, 0, image.width, image.height, image.depth, glFormat, glType, image.data); } else { state.texImage3D(_gl.TEXTURE_3D, 0, glInternalFormat, image.width, image.height, image.depth, 0, glFormat, glType, image.data); @@ -17250,8 +15204,7 @@ state.texStorage2D(_gl.TEXTURE_2D, levels, glInternalFormat, image.width, image.height); } else if (allocateMemory) { let width = image.width, - height = image.height; - + height = image.height; for (let i = 0; i < levels; i++) { state.texImage2D(_gl.TEXTURE_2D, i, glInternalFormat, width, height, 0, glFormat, glType, null); width >>= 1; @@ -17260,64 +15213,53 @@ } } else { // regular Texture (image, video, canvas) + // use manually created mipmaps if available // if there are no manual mipmaps // set 0 level mipmap and then use GL to generate other mipmap levels + if (mipmaps.length > 0 && supportsMips) { if (useTexStorage && allocateMemory) { state.texStorage2D(_gl.TEXTURE_2D, levels, glInternalFormat, mipmaps[0].width, mipmaps[0].height); } - for (let i = 0, il = mipmaps.length; i < il; i++) { mipmap = mipmaps[i]; - if (useTexStorage) { state.texSubImage2D(_gl.TEXTURE_2D, i, 0, 0, glFormat, glType, mipmap); } else { state.texImage2D(_gl.TEXTURE_2D, i, glInternalFormat, glFormat, glType, mipmap); } } - texture.generateMipmaps = false; } else { if (useTexStorage) { if (allocateMemory) { state.texStorage2D(_gl.TEXTURE_2D, levels, glInternalFormat, image.width, image.height); } - state.texSubImage2D(_gl.TEXTURE_2D, 0, 0, 0, glFormat, glType, image); } else { state.texImage2D(_gl.TEXTURE_2D, 0, glInternalFormat, glFormat, glType, image); } } } - if (textureNeedsGenerateMipmaps(texture, supportsMips)) { generateMipmap(textureType); } - textureProperties.__version = texture.version; if (texture.onUpdate) texture.onUpdate(texture); } - function uploadCubeTexture(textureProperties, texture, slot) { if (texture.image.length !== 6) return; initTexture(textureProperties, texture); state.activeTexture(_gl.TEXTURE0 + slot); state.bindTexture(_gl.TEXTURE_CUBE_MAP, textureProperties.__webglTexture); - _gl.pixelStorei(_gl.UNPACK_FLIP_Y_WEBGL, texture.flipY); - _gl.pixelStorei(_gl.UNPACK_PREMULTIPLY_ALPHA_WEBGL, texture.premultiplyAlpha); - _gl.pixelStorei(_gl.UNPACK_ALIGNMENT, texture.unpackAlignment); - _gl.pixelStorei(_gl.UNPACK_COLORSPACE_CONVERSION_WEBGL, _gl.NONE); - const isCompressed = texture && (texture.isCompressedTexture || texture.image[0].isCompressedTexture); const isDataTexture = texture.image[0] && texture.image[0].isDataTexture; const cubeImage = []; - for (let i = 0; i < 6; i++) { if (!isCompressed && !isDataTexture) { cubeImage[i] = resizeImage(texture.image[i], false, true, maxCubemapSize); @@ -17325,29 +15267,24 @@ cubeImage[i] = isDataTexture ? texture.image[i].image : texture.image[i]; } } - const image = cubeImage[0], - supportsMips = isPowerOfTwo$1(image) || isWebGL2, - glFormat = utils.convert(texture.format, texture.encoding), - glType = utils.convert(texture.type), - glInternalFormat = getInternalFormat(texture.internalFormat, glFormat, glType, texture.encoding, texture.sRGBToLinearWithShader); + supportsMips = isPowerOfTwo$1(image) || isWebGL2, + glFormat = utils.convert(texture.format, texture.encoding), + glType = utils.convert(texture.type), + glInternalFormat = getInternalFormat(texture.internalFormat, glFormat, glType, texture.encoding, texture.sRGBToLinearWithShader); const useTexStorage = isWebGL2 && texture.isVideoTexture !== true; const allocateMemory = textureProperties.__version === undefined; let levels = getMipLevels(texture, image, supportsMips); setTextureParameters(_gl.TEXTURE_CUBE_MAP, texture, supportsMips); let mipmaps; - if (isCompressed) { if (useTexStorage && allocateMemory) { state.texStorage2D(_gl.TEXTURE_CUBE_MAP, levels, glInternalFormat, image.width, image.height); } - for (let i = 0; i < 6; i++) { mipmaps = cubeImage[i].mipmaps; - for (let j = 0; j < mipmaps.length; j++) { const mipmap = mipmaps[j]; - if (texture.format !== RGBAFormat) { if (glFormat !== null) { if (useTexStorage) { @@ -17369,15 +15306,14 @@ } } else { mipmaps = texture.mipmaps; - if (useTexStorage && allocateMemory) { // TODO: Uniformly handle mipmap definitions // Normal textures and compressed cube textures define base level + mips with their mipmap array // Uncompressed cube textures use their mipmap array only for mips (no base level) + if (mipmaps.length > 0) levels++; state.texStorage2D(_gl.TEXTURE_CUBE_MAP, levels, glInternalFormat, cubeImage[0].width, cubeImage[0].height); } - for (let i = 0; i < 6; i++) { if (isDataTexture) { if (useTexStorage) { @@ -17385,11 +15321,9 @@ } else { state.texImage2D(_gl.TEXTURE_CUBE_MAP_POSITIVE_X + i, 0, glInternalFormat, cubeImage[i].width, cubeImage[i].height, 0, glFormat, glType, cubeImage[i].data); } - for (let j = 0; j < mipmaps.length; j++) { const mipmap = mipmaps[j]; const mipmapImage = mipmap.image[i].image; - if (useTexStorage) { state.texSubImage2D(_gl.TEXTURE_CUBE_MAP_POSITIVE_X + i, j + 1, 0, 0, mipmapImage.width, mipmapImage.height, glFormat, glType, mipmapImage.data); } else { @@ -17402,10 +15336,8 @@ } else { state.texImage2D(_gl.TEXTURE_CUBE_MAP_POSITIVE_X + i, 0, glInternalFormat, glFormat, glType, cubeImage[i]); } - for (let j = 0; j < mipmaps.length; j++) { const mipmap = mipmaps[j]; - if (useTexStorage) { state.texSubImage2D(_gl.TEXTURE_CUBE_MAP_POSITIVE_X + i, j + 1, 0, 0, glFormat, glType, mipmap.image[i]); } else { @@ -17415,24 +15347,22 @@ } } } - if (textureNeedsGenerateMipmaps(texture, supportsMips)) { // We assume images for cube map have the same size. generateMipmap(_gl.TEXTURE_CUBE_MAP); } - textureProperties.__version = texture.version; if (texture.onUpdate) texture.onUpdate(texture); - } // Render targets - // Setup storage for target texture and bind it to correct framebuffer + } + // Render targets + // Setup storage for target texture and bind it to correct framebuffer function setupFrameBufferTexture(framebuffer, renderTarget, texture, attachment, textureTarget) { const glFormat = utils.convert(texture.format, texture.encoding); const glType = utils.convert(texture.type); const glInternalFormat = getInternalFormat(texture.internalFormat, glFormat, glType, texture.encoding, texture.sRGBToLinearWithShader); const renderTargetProperties = properties.get(renderTarget); - if (!renderTargetProperties.__hasExternalTextures) { if (textureTarget === _gl.TEXTURE_3D || textureTarget === _gl.TEXTURE_2D_ARRAY) { state.texImage3D(textureTarget, 0, glInternalFormat, renderTarget.width, renderTarget.height, renderTarget.depth, 0, glFormat, glType, null); @@ -17440,28 +15370,22 @@ state.texImage2D(textureTarget, 0, glInternalFormat, renderTarget.width, renderTarget.height, 0, glFormat, glType, null); } } - state.bindFramebuffer(_gl.FRAMEBUFFER, framebuffer); - if (useMultisampledRenderToTexture(renderTarget)) { MultisampledRenderToTextureExtension.framebufferTexture2DMultisampleEXT(_gl.FRAMEBUFFER, attachment, textureTarget, properties.get(texture).__webglTexture, 0, getRenderTargetSamples(renderTarget)); } else { _gl.framebufferTexture2D(_gl.FRAMEBUFFER, attachment, textureTarget, properties.get(texture).__webglTexture, 0); } - state.bindFramebuffer(_gl.FRAMEBUFFER, null); - } // Setup storage for internal depth/stencil buffers and bind to correct framebuffer - + } + // Setup storage for internal depth/stencil buffers and bind to correct framebuffer function setupRenderBufferStorage(renderbuffer, renderTarget, isMultisample) { _gl.bindRenderbuffer(_gl.RENDERBUFFER, renderbuffer); - if (renderTarget.depthBuffer && !renderTarget.stencilBuffer) { let glInternalFormat = renderTarget.useDEPTH_COMPONENT24 ? _gl.DEPTH_COMPONENT24 : _gl.DEPTH_COMPONENT16; - if (isMultisample || useMultisampledRenderToTexture(renderTarget)) { const depthTexture = renderTarget.depthTexture; - if (depthTexture && depthTexture.isDepthTexture) { if (depthTexture.type === FloatType) { glInternalFormat = _gl.DEPTH_COMPONENT32F; @@ -17469,9 +15393,7 @@ glInternalFormat = _gl.DEPTH_COMPONENT24; } } - const samples = getRenderTargetSamples(renderTarget); - if (useMultisampledRenderToTexture(renderTarget)) { MultisampledRenderToTextureExtension.renderbufferStorageMultisampleEXT(_gl.RENDERBUFFER, samples, glInternalFormat, renderTarget.width, renderTarget.height); } else { @@ -17480,11 +15402,9 @@ } else { _gl.renderbufferStorage(_gl.RENDERBUFFER, glInternalFormat, renderTarget.width, renderTarget.height); } - _gl.framebufferRenderbuffer(_gl.FRAMEBUFFER, _gl.DEPTH_ATTACHMENT, _gl.RENDERBUFFER, renderbuffer); } else if (renderTarget.depthBuffer && renderTarget.stencilBuffer) { const samples = getRenderTargetSamples(renderTarget); - if (isMultisample && useMultisampledRenderToTexture(renderTarget) === false) { _gl.renderbufferStorageMultisample(_gl.RENDERBUFFER, samples, _gl.DEPTH24_STENCIL8, renderTarget.width, renderTarget.height); } else if (useMultisampledRenderToTexture(renderTarget)) { @@ -17492,7 +15412,6 @@ } else { _gl.renderbufferStorage(_gl.RENDERBUFFER, _gl.DEPTH_STENCIL, renderTarget.width, renderTarget.height); } - _gl.framebufferRenderbuffer(_gl.FRAMEBUFFER, _gl.DEPTH_STENCIL_ATTACHMENT, _gl.RENDERBUFFER, renderbuffer); } else { // Use the first texture for MRT so far @@ -17501,7 +15420,6 @@ const glType = utils.convert(texture.type); const glInternalFormat = getInternalFormat(texture.internalFormat, glFormat, glType, texture.encoding, texture.sRGBToLinearWithShader); const samples = getRenderTargetSamples(renderTarget); - if (isMultisample && useMultisampledRenderToTexture(renderTarget) === false) { _gl.renderbufferStorageMultisample(_gl.RENDERBUFFER, samples, glInternalFormat, renderTarget.width, renderTarget.height); } else if (useMultisampledRenderToTexture(renderTarget)) { @@ -17510,33 +15428,27 @@ _gl.renderbufferStorage(_gl.RENDERBUFFER, glInternalFormat, renderTarget.width, renderTarget.height); } } - _gl.bindRenderbuffer(_gl.RENDERBUFFER, null); - } // Setup resources for a Depth Texture for a FBO (needs an extension) - + } + // Setup resources for a Depth Texture for a FBO (needs an extension) function setupDepthTexture(framebuffer, renderTarget) { const isCube = renderTarget && renderTarget.isWebGLCubeRenderTarget; if (isCube) throw new Error('Depth Texture with cube render targets is not supported'); state.bindFramebuffer(_gl.FRAMEBUFFER, framebuffer); - if (!(renderTarget.depthTexture && renderTarget.depthTexture.isDepthTexture)) { throw new Error('renderTarget.depthTexture must be an instance of THREE.DepthTexture'); - } // upload an empty depth texture with framebuffer size - + } + // upload an empty depth texture with framebuffer size if (!properties.get(renderTarget.depthTexture).__webglTexture || renderTarget.depthTexture.image.width !== renderTarget.width || renderTarget.depthTexture.image.height !== renderTarget.height) { renderTarget.depthTexture.image.width = renderTarget.width; renderTarget.depthTexture.image.height = renderTarget.height; renderTarget.depthTexture.needsUpdate = true; } - setTexture2D(renderTarget.depthTexture, 0); - const webglDepthTexture = properties.get(renderTarget.depthTexture).__webglTexture; - const samples = getRenderTargetSamples(renderTarget); - if (renderTarget.depthTexture.format === DepthFormat) { if (useMultisampledRenderToTexture(renderTarget)) { MultisampledRenderToTextureExtension.framebufferTexture2DMultisampleEXT(_gl.FRAMEBUFFER, _gl.DEPTH_ATTACHMENT, _gl.TEXTURE_2D, webglDepthTexture, 0, samples); @@ -17552,20 +15464,18 @@ } else { throw new Error('Unknown depthTexture format'); } - } // Setup GL resources for a non-texture depth buffer - + } + // Setup GL resources for a non-texture depth buffer function setupDepthRenderbuffer(renderTarget) { const renderTargetProperties = properties.get(renderTarget); const isCube = renderTarget.isWebGLCubeRenderTarget === true; - if (renderTarget.depthTexture && !renderTargetProperties.__autoAllocateDepthBuffer) { if (isCube) throw new Error('target.depthTexture not supported in Cube render targets'); setupDepthTexture(renderTargetProperties.__webglFramebuffer, renderTarget); } else { if (isCube) { renderTargetProperties.__webglDepthbuffer = []; - for (let i = 0; i < 6; i++) { state.bindFramebuffer(_gl.FRAMEBUFFER, renderTargetProperties.__webglFramebuffer[i]); renderTargetProperties.__webglDepthbuffer[i] = _gl.createRenderbuffer(); @@ -17577,60 +15487,52 @@ setupRenderBufferStorage(renderTargetProperties.__webglDepthbuffer, renderTarget, false); } } - state.bindFramebuffer(_gl.FRAMEBUFFER, null); - } // rebind framebuffer with external textures - + } + // rebind framebuffer with external textures function rebindTextures(renderTarget, colorTexture, depthTexture) { const renderTargetProperties = properties.get(renderTarget); - if (colorTexture !== undefined) { setupFrameBufferTexture(renderTargetProperties.__webglFramebuffer, renderTarget, renderTarget.texture, _gl.COLOR_ATTACHMENT0, _gl.TEXTURE_2D); } - if (depthTexture !== undefined) { setupDepthRenderbuffer(renderTarget); } - } // Set up GL resources for the render target - + } + // Set up GL resources for the render target function setupRenderTarget(renderTarget) { const texture = renderTarget.texture; const renderTargetProperties = properties.get(renderTarget); const textureProperties = properties.get(texture); renderTarget.addEventListener('dispose', onRenderTargetDispose); - if (renderTarget.isWebGLMultipleRenderTargets !== true) { if (textureProperties.__webglTexture === undefined) { textureProperties.__webglTexture = _gl.createTexture(); } - textureProperties.__version = texture.version; info.memory.textures++; } - const isCube = renderTarget.isWebGLCubeRenderTarget === true; const isMultipleRenderTargets = renderTarget.isWebGLMultipleRenderTargets === true; const isRenderTarget3D = texture.isDataTexture3D || texture.isDataTexture2DArray; - const supportsMips = isPowerOfTwo$1(renderTarget) || isWebGL2; // Setup framebuffer + const supportsMips = isPowerOfTwo$1(renderTarget) || isWebGL2; + + // Setup framebuffer if (isCube) { renderTargetProperties.__webglFramebuffer = []; - for (let i = 0; i < 6; i++) { renderTargetProperties.__webglFramebuffer[i] = _gl.createFramebuffer(); } } else { renderTargetProperties.__webglFramebuffer = _gl.createFramebuffer(); - if (isMultipleRenderTargets) { if (capabilities.drawBuffers) { const textures = renderTarget.texture; - for (let i = 0, il = textures.length; i < il; i++) { const attachmentProperties = properties.get(textures[i]); - if (attachmentProperties.__webglTexture === undefined) { attachmentProperties.__webglTexture = _gl.createTexture(); info.memory.textures++; @@ -17642,66 +15544,53 @@ } else if (isWebGL2 && renderTarget.samples > 0 && useMultisampledRenderToTexture(renderTarget) === false) { renderTargetProperties.__webglMultisampledFramebuffer = _gl.createFramebuffer(); renderTargetProperties.__webglColorRenderbuffer = _gl.createRenderbuffer(); - _gl.bindRenderbuffer(_gl.RENDERBUFFER, renderTargetProperties.__webglColorRenderbuffer); - const glFormat = utils.convert(texture.format, texture.encoding); const glType = utils.convert(texture.type); const glInternalFormat = getInternalFormat(texture.internalFormat, glFormat, glType, texture.encoding); const samples = getRenderTargetSamples(renderTarget); - _gl.renderbufferStorageMultisample(_gl.RENDERBUFFER, samples, glInternalFormat, renderTarget.width, renderTarget.height); - state.bindFramebuffer(_gl.FRAMEBUFFER, renderTargetProperties.__webglMultisampledFramebuffer); - _gl.framebufferRenderbuffer(_gl.FRAMEBUFFER, _gl.COLOR_ATTACHMENT0, _gl.RENDERBUFFER, renderTargetProperties.__webglColorRenderbuffer); - _gl.bindRenderbuffer(_gl.RENDERBUFFER, null); - if (renderTarget.depthBuffer) { renderTargetProperties.__webglDepthRenderbuffer = _gl.createRenderbuffer(); setupRenderBufferStorage(renderTargetProperties.__webglDepthRenderbuffer, renderTarget, true); } - state.bindFramebuffer(_gl.FRAMEBUFFER, null); } - } // Setup color buffer + } + // Setup color buffer if (isCube) { state.bindTexture(_gl.TEXTURE_CUBE_MAP, textureProperties.__webglTexture); setTextureParameters(_gl.TEXTURE_CUBE_MAP, texture, supportsMips); - for (let i = 0; i < 6; i++) { setupFrameBufferTexture(renderTargetProperties.__webglFramebuffer[i], renderTarget, texture, _gl.COLOR_ATTACHMENT0, _gl.TEXTURE_CUBE_MAP_POSITIVE_X + i); } - if (textureNeedsGenerateMipmaps(texture, supportsMips)) { generateMipmap(_gl.TEXTURE_CUBE_MAP); } - state.unbindTexture(); } else if (isMultipleRenderTargets) { const textures = renderTarget.texture; - for (let i = 0, il = textures.length; i < il; i++) { const attachment = textures[i]; const attachmentProperties = properties.get(attachment); state.bindTexture(_gl.TEXTURE_2D, attachmentProperties.__webglTexture); setTextureParameters(_gl.TEXTURE_2D, attachment, supportsMips); setupFrameBufferTexture(renderTargetProperties.__webglFramebuffer, renderTarget, attachment, _gl.COLOR_ATTACHMENT0 + i, _gl.TEXTURE_2D); - if (textureNeedsGenerateMipmaps(attachment, supportsMips)) { generateMipmap(_gl.TEXTURE_2D); } } - state.unbindTexture(); } else { let glTextureType = _gl.TEXTURE_2D; - if (isRenderTarget3D) { // Render targets containing layers, i.e: Texture 3D and 2d arrays + if (isWebGL2) { const isTexture3D = texture.isDataTexture3D; glTextureType = isTexture3D ? _gl.TEXTURE_3D : _gl.TEXTURE_2D_ARRAY; @@ -17709,43 +15598,35 @@ console.warn('THREE.DataTexture3D and THREE.DataTexture2DArray only supported with WebGL2.'); } } - state.bindTexture(glTextureType, textureProperties.__webglTexture); setTextureParameters(glTextureType, texture, supportsMips); setupFrameBufferTexture(renderTargetProperties.__webglFramebuffer, renderTarget, texture, _gl.COLOR_ATTACHMENT0, glTextureType); - if (textureNeedsGenerateMipmaps(texture, supportsMips)) { generateMipmap(glTextureType); } - state.unbindTexture(); - } // Setup depth and stencil buffers + } + // Setup depth and stencil buffers if (renderTarget.depthBuffer) { setupDepthRenderbuffer(renderTarget); } } - function updateRenderTargetMipmap(renderTarget) { const supportsMips = isPowerOfTwo$1(renderTarget) || isWebGL2; const textures = renderTarget.isWebGLMultipleRenderTargets === true ? renderTarget.texture : [renderTarget.texture]; - for (let i = 0, il = textures.length; i < il; i++) { const texture = textures[i]; - if (textureNeedsGenerateMipmaps(texture, supportsMips)) { const target = renderTarget.isWebGLCubeRenderTarget ? _gl.TEXTURE_CUBE_MAP : _gl.TEXTURE_2D; - const webglTexture = properties.get(texture).__webglTexture; - state.bindTexture(target, webglTexture); generateMipmap(target); state.unbindTexture(); } } } - function updateMultisampleRenderTarget(renderTarget) { if (isWebGL2 && renderTarget.samples > 0 && useMultisampledRenderToTexture(renderTarget) === false) { const width = renderTarget.width; @@ -17753,89 +15634,75 @@ let mask = _gl.COLOR_BUFFER_BIT; const invalidationArray = [_gl.COLOR_ATTACHMENT0]; const depthStyle = renderTarget.stencilBuffer ? _gl.DEPTH_STENCIL_ATTACHMENT : _gl.DEPTH_ATTACHMENT; - if (renderTarget.depthBuffer) { invalidationArray.push(depthStyle); } - const renderTargetProperties = properties.get(renderTarget); const ignoreDepthValues = renderTargetProperties.__ignoreDepthValues !== undefined ? renderTargetProperties.__ignoreDepthValues : false; - if (ignoreDepthValues === false) { if (renderTarget.depthBuffer) mask |= _gl.DEPTH_BUFFER_BIT; if (renderTarget.stencilBuffer) mask |= _gl.STENCIL_BUFFER_BIT; } - state.bindFramebuffer(_gl.READ_FRAMEBUFFER, renderTargetProperties.__webglMultisampledFramebuffer); state.bindFramebuffer(_gl.DRAW_FRAMEBUFFER, renderTargetProperties.__webglFramebuffer); - if (ignoreDepthValues === true) { _gl.invalidateFramebuffer(_gl.READ_FRAMEBUFFER, [depthStyle]); - _gl.invalidateFramebuffer(_gl.DRAW_FRAMEBUFFER, [depthStyle]); } + _gl.blitFramebuffer(0, 0, width, height, 0, 0, width, height, mask, _gl.NEAREST); - _gl.blitFramebuffer(0, 0, width, height, 0, 0, width, height, mask, _gl.NEAREST); // https://github.com/mrdoob/three.js/pull/23692 - - + // https://github.com/mrdoob/three.js/pull/23692 if (supportsInvalidateFramebuffer) { _gl.invalidateFramebuffer(_gl.READ_FRAMEBUFFER, invalidationArray); } - state.bindFramebuffer(_gl.READ_FRAMEBUFFER, null); state.bindFramebuffer(_gl.DRAW_FRAMEBUFFER, renderTargetProperties.__webglMultisampledFramebuffer); } } - function getRenderTargetSamples(renderTarget) { return Math.min(maxSamples, renderTarget.samples); } - function useMultisampledRenderToTexture(renderTarget) { const renderTargetProperties = properties.get(renderTarget); return isWebGL2 && renderTarget.samples > 0 && extensions.has('WEBGL_multisampled_render_to_texture') === true && renderTargetProperties.__useRenderToTexture !== false; } - function updateVideoTexture(texture) { - const frame = info.render.frame; // Check the last frame we updated the VideoTexture + const frame = info.render.frame; + + // Check the last frame we updated the VideoTexture if (_videoTextures.get(texture) !== frame) { _videoTextures.set(texture, frame); - texture.update(); } - } // backwards compatibility + } + // backwards compatibility let warnedTexture2D = false; let warnedTextureCube = false; - function safeSetTexture2D(texture, slot) { if (texture && texture.isWebGLRenderTarget) { if (warnedTexture2D === false) { console.warn('THREE.WebGLTextures.safeSetTexture2D: don\'t use render targets as textures. Use their .texture property instead.'); warnedTexture2D = true; } - texture = texture.texture; } - setTexture2D(texture, slot); } - function safeSetTextureCube(texture, slot) { if (texture && texture.isWebGLCubeRenderTarget) { if (warnedTextureCube === false) { console.warn('THREE.WebGLTextures.safeSetTextureCube: don\'t use cube render targets as textures. Use their .texture property instead.'); warnedTextureCube = true; } - texture = texture.texture; } - setTextureCube(texture, slot); - } // + } + // this.allocateTextureUnit = allocateTextureUnit; this.resetTextureUnits = resetTextureUnits; @@ -17856,7 +15723,6 @@ function WebGLUtils(gl, extensions, capabilities) { const isWebGL2 = capabilities.isWebGL2; - function convert(p, encoding = null) { let extension; if (p === UnsignedByteType) return gl.UNSIGNED_BYTE; @@ -17868,35 +15734,35 @@ if (p === IntType) return gl.INT; if (p === UnsignedIntType) return gl.UNSIGNED_INT; if (p === FloatType) return gl.FLOAT; - if (p === HalfFloatType) { if (isWebGL2) return gl.HALF_FLOAT; extension = extensions.get('OES_texture_half_float'); - if (extension !== null) { return extension.HALF_FLOAT_OES; } else { return null; } } - if (p === AlphaFormat) return gl.ALPHA; if (p === RGBAFormat) return gl.RGBA; if (p === LuminanceFormat) return gl.LUMINANCE; if (p === LuminanceAlphaFormat) return gl.LUMINANCE_ALPHA; if (p === DepthFormat) return gl.DEPTH_COMPONENT; if (p === DepthStencilFormat) return gl.DEPTH_STENCIL; - if (p === RedFormat) return gl.RED; // WebGL2 formats. + if (p === RedFormat) return gl.RED; + + // WebGL2 formats. if (p === RedIntegerFormat) return gl.RED_INTEGER; if (p === RGFormat) return gl.RG; if (p === RGIntegerFormat) return gl.RG_INTEGER; - if (p === RGBAIntegerFormat) return gl.RGBA_INTEGER; // S3TC + if (p === RGBAIntegerFormat) return gl.RGBA_INTEGER; + + // S3TC if (p === RGB_S3TC_DXT1_Format || p === RGBA_S3TC_DXT1_Format || p === RGBA_S3TC_DXT3_Format || p === RGBA_S3TC_DXT5_Format) { if (encoding === sRGBEncoding) { extension = extensions.get('WEBGL_compressed_texture_s3tc_srgb'); - if (extension !== null) { if (p === RGB_S3TC_DXT1_Format) return extension.COMPRESSED_SRGB_S3TC_DXT1_EXT; if (p === RGBA_S3TC_DXT1_Format) return extension.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT; @@ -17907,7 +15773,6 @@ } } else { extension = extensions.get('WEBGL_compressed_texture_s3tc'); - if (extension !== null) { if (p === RGB_S3TC_DXT1_Format) return extension.COMPRESSED_RGB_S3TC_DXT1_EXT; if (p === RGBA_S3TC_DXT1_Format) return extension.COMPRESSED_RGBA_S3TC_DXT1_EXT; @@ -17917,12 +15782,12 @@ return null; } } - } // PVRTC + } + // PVRTC if (p === RGB_PVRTC_4BPPV1_Format || p === RGB_PVRTC_2BPPV1_Format || p === RGBA_PVRTC_4BPPV1_Format || p === RGBA_PVRTC_2BPPV1_Format) { extension = extensions.get('WEBGL_compressed_texture_pvrtc'); - if (extension !== null) { if (p === RGB_PVRTC_4BPPV1_Format) return extension.COMPRESSED_RGB_PVRTC_4BPPV1_IMG; if (p === RGB_PVRTC_2BPPV1_Format) return extension.COMPRESSED_RGB_PVRTC_2BPPV1_IMG; @@ -17931,35 +15796,35 @@ } else { return null; } - } // ETC1 + } + // ETC1 if (p === RGB_ETC1_Format) { extension = extensions.get('WEBGL_compressed_texture_etc1'); - if (extension !== null) { return extension.COMPRESSED_RGB_ETC1_WEBGL; } else { return null; } - } // ETC2 + } + // ETC2 if (p === RGB_ETC2_Format || p === RGBA_ETC2_EAC_Format) { extension = extensions.get('WEBGL_compressed_texture_etc'); - if (extension !== null) { if (p === RGB_ETC2_Format) return encoding === sRGBEncoding ? extension.COMPRESSED_SRGB8_ETC2 : extension.COMPRESSED_RGB8_ETC2; if (p === RGBA_ETC2_EAC_Format) return encoding === sRGBEncoding ? extension.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC : extension.COMPRESSED_RGBA8_ETC2_EAC; } else { return null; } - } // ASTC + } + // ASTC if (p === RGBA_ASTC_4x4_Format || p === RGBA_ASTC_5x4_Format || p === RGBA_ASTC_5x5_Format || p === RGBA_ASTC_6x5_Format || p === RGBA_ASTC_6x6_Format || p === RGBA_ASTC_8x5_Format || p === RGBA_ASTC_8x6_Format || p === RGBA_ASTC_8x8_Format || p === RGBA_ASTC_10x5_Format || p === RGBA_ASTC_10x6_Format || p === RGBA_ASTC_10x8_Format || p === RGBA_ASTC_10x10_Format || p === RGBA_ASTC_12x10_Format || p === RGBA_ASTC_12x12_Format) { extension = extensions.get('WEBGL_compressed_texture_astc'); - if (extension !== null) { if (p === RGBA_ASTC_4x4_Format) return encoding === sRGBEncoding ? extension.COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR : extension.COMPRESSED_RGBA_ASTC_4x4_KHR; if (p === RGBA_ASTC_5x4_Format) return encoding === sRGBEncoding ? extension.COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR : extension.COMPRESSED_RGBA_ASTC_5x4_KHR; @@ -17978,24 +15843,24 @@ } else { return null; } - } // BPTC + } + // BPTC if (p === RGBA_BPTC_Format) { extension = extensions.get('EXT_texture_compression_bptc'); - if (extension !== null) { if (p === RGBA_BPTC_Format) return encoding === sRGBEncoding ? extension.COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT : extension.COMPRESSED_RGBA_BPTC_UNORM_EXT; } else { return null; } - } // + } + // if (p === UnsignedInt248Type) { if (isWebGL2) return gl.UNSIGNED_INT_24_8; extension = extensions.get('WEBGL_depth_texture'); - if (extension !== null) { return extension.UNSIGNED_INT_24_8_WEBGL; } else { @@ -18003,7 +15868,6 @@ } } } - return { convert: convert }; @@ -18014,9 +15878,7 @@ super(); this.cameras = array; } - } - ArrayCamera.prototype.isArrayCamera = true; class Group extends Object3D { @@ -18024,22 +15886,18 @@ super(); this.type = 'Group'; } - } - Group.prototype.isGroup = true; const _moveEvent = { type: 'move' }; - class WebXRController { constructor() { this._targetRay = null; this._grip = null; this._hand = null; } - getHandSpace() { if (this._hand === null) { this._hand = new Group(); @@ -18050,10 +15908,8 @@ pinching: false }; } - return this._hand; } - getTargetRaySpace() { if (this._targetRay === null) { this._targetRay = new Group(); @@ -18064,10 +15920,8 @@ this._targetRay.hasAngularVelocity = false; this._targetRay.angularVelocity = new Vector3(); } - return this._targetRay; } - getGripSpace() { if (this._grip === null) { this._grip = new Group(); @@ -18078,47 +15932,36 @@ this._grip.hasAngularVelocity = false; this._grip.angularVelocity = new Vector3(); } - return this._grip; } - dispatchEvent(event) { if (this._targetRay !== null) { this._targetRay.dispatchEvent(event); } - if (this._grip !== null) { this._grip.dispatchEvent(event); } - if (this._hand !== null) { this._hand.dispatchEvent(event); } - return this; } - disconnect(inputSource) { this.dispatchEvent({ type: 'disconnected', data: inputSource }); - if (this._targetRay !== null) { this._targetRay.visible = false; } - if (this._grip !== null) { this._grip.visible = false; } - if (this._hand !== null) { this._hand.visible = false; } - return this; } - update(inputSource, frame, referenceSpace) { let inputPose = null; let gripPose = null; @@ -18126,69 +15969,58 @@ const targetRay = this._targetRay; const grip = this._grip; const hand = this._hand; - if (inputSource && frame.session.visibilityState !== 'visible-blurred') { if (targetRay !== null) { inputPose = frame.getPose(inputSource.targetRaySpace, referenceSpace); - if (inputPose !== null) { targetRay.matrix.fromArray(inputPose.transform.matrix); targetRay.matrix.decompose(targetRay.position, targetRay.rotation, targetRay.scale); - if (inputPose.linearVelocity) { targetRay.hasLinearVelocity = true; targetRay.linearVelocity.copy(inputPose.linearVelocity); } else { targetRay.hasLinearVelocity = false; } - if (inputPose.angularVelocity) { targetRay.hasAngularVelocity = true; targetRay.angularVelocity.copy(inputPose.angularVelocity); } else { targetRay.hasAngularVelocity = false; } - this.dispatchEvent(_moveEvent); } } - if (hand && inputSource.hand) { handPose = true; - for (const inputjoint of inputSource.hand.values()) { // Update the joints groups with the XRJoint poses const jointPose = frame.getJointPose(inputjoint, referenceSpace); - if (hand.joints[inputjoint.jointName] === undefined) { // The transform of this joint will be updated with the joint pose on each frame const joint = new Group(); joint.matrixAutoUpdate = false; joint.visible = false; - hand.joints[inputjoint.jointName] = joint; // ?? - + hand.joints[inputjoint.jointName] = joint; + // ?? hand.add(joint); } - const joint = hand.joints[inputjoint.jointName]; - if (jointPose !== null) { joint.matrix.fromArray(jointPose.transform.matrix); joint.matrix.decompose(joint.position, joint.rotation, joint.scale); joint.jointRadius = jointPose.radius; } - joint.visible = jointPose !== null; - } // Custom events - // Check pinchz + } + // Custom events + // Check pinchz const indexTip = hand.joints['index-finger-tip']; const thumbTip = hand.joints['thumb-tip']; const distance = indexTip.position.distanceTo(thumbTip.position); const distanceToPinch = 0.02; const threshold = 0.005; - if (hand.inputState.pinching && distance > distanceToPinch + threshold) { hand.inputState.pinching = false; this.dispatchEvent({ @@ -18207,18 +16039,15 @@ } else { if (grip !== null && inputSource.gripSpace) { gripPose = frame.getPose(inputSource.gripSpace, referenceSpace); - if (gripPose !== null) { grip.matrix.fromArray(gripPose.transform.matrix); grip.matrix.decompose(grip.position, grip.rotation, grip.scale); - if (gripPose.linearVelocity) { grip.hasLinearVelocity = true; grip.linearVelocity.copy(gripPose.linearVelocity); } else { grip.hasLinearVelocity = false; } - if (gripPose.angularVelocity) { grip.hasAngularVelocity = true; grip.angularVelocity.copy(gripPose.angularVelocity); @@ -18229,32 +16058,25 @@ } } } - if (targetRay !== null) { targetRay.visible = inputPose !== null; } - if (grip !== null) { grip.visible = gripPose !== null; } - if (hand !== null) { hand.visible = handPose !== null; } - return this; } - } class DepthTexture extends Texture { constructor(width, height, type, mapping, wrapS, wrapT, magFilter, minFilter, anisotropy, format) { format = format !== undefined ? format : DepthFormat; - if (format !== DepthFormat && format !== DepthStencilFormat) { throw new Error('DepthTexture format must be either THREE.DepthFormat or THREE.DepthStencilFormat'); } - if (type === undefined && format === DepthFormat) type = UnsignedShortType; if (type === undefined && format === DepthStencilFormat) type = UnsignedInt248Type; super(null, mapping, wrapS, wrapT, magFilter, minFilter, format, type, anisotropy); @@ -18267,9 +16089,7 @@ this.flipY = false; this.generateMipmaps = false; } - } - DepthTexture.prototype.isDepthTexture = true; class WebXRManager extends EventDispatcher { @@ -18289,7 +16109,9 @@ let initialRenderTarget = null; let newRenderTarget = null; const controllers = []; - const inputSourcesMap = new Map(); // + const inputSourcesMap = new Map(); + + // const cameraL = new PerspectiveCamera(); cameraL.layers.enable(1); @@ -18302,49 +16124,42 @@ cameraVR.layers.enable(1); cameraVR.layers.enable(2); let _currentDepthNear = null; - let _currentDepthFar = null; // + let _currentDepthFar = null; + + // this.cameraAutoUpdate = true; this.enabled = false; this.isPresenting = false; - this.getController = function (index) { let controller = controllers[index]; - if (controller === undefined) { controller = new WebXRController(); controllers[index] = controller; } - return controller.getTargetRaySpace(); }; - this.getControllerGrip = function (index) { let controller = controllers[index]; - if (controller === undefined) { controller = new WebXRController(); controllers[index] = controller; } - return controller.getGripSpace(); }; - this.getHand = function (index) { let controller = controllers[index]; - if (controller === undefined) { controller = new WebXRController(); controllers[index] = controller; } - return controller.getHandSpace(); - }; // + }; + // function onSessionEvent(event) { const controller = inputSourcesMap.get(event.inputSource); - if (controller) { controller.dispatchEvent({ type: event.type, @@ -18352,21 +16167,24 @@ }); } } - function onSessionEnd() { inputSourcesMap.forEach(function (controller, inputSource) { controller.disconnect(inputSource); }); inputSourcesMap.clear(); _currentDepthNear = null; - _currentDepthFar = null; // restore framebuffer/rendering state + _currentDepthFar = null; + + // restore framebuffer/rendering state renderer.setRenderTarget(initialRenderTarget); glBaseLayer = null; glProjLayer = null; glBinding = null; session = null; - newRenderTarget = null; // + newRenderTarget = null; + + // animation.stop(); scope.isPresenting = false; @@ -18374,46 +16192,35 @@ type: 'sessionend' }); } - this.setFramebufferScaleFactor = function (value) { framebufferScaleFactor = value; - if (scope.isPresenting === true) { console.warn('THREE.WebXRManager: Cannot change framebuffer scale while presenting.'); } }; - this.setReferenceSpaceType = function (value) { referenceSpaceType = value; - if (scope.isPresenting === true) { console.warn('THREE.WebXRManager: Cannot change reference space type while presenting.'); } }; - this.getReferenceSpace = function () { return referenceSpace; }; - this.getBaseLayer = function () { return glProjLayer !== null ? glProjLayer : glBaseLayer; }; - this.getBinding = function () { return glBinding; }; - this.getFrame = function () { return xrFrame; }; - this.getSession = function () { return session; }; - this.setSession = async function (value) { session = value; - if (session !== null) { initialRenderTarget = renderer.getRenderTarget(); session.addEventListener('select', onSessionEvent); @@ -18424,11 +16231,9 @@ session.addEventListener('squeezeend', onSessionEvent); session.addEventListener('end', onSessionEnd); session.addEventListener('inputsourceschange', onInputSourcesChange); - if (attributes.xrCompatible !== true) { await gl.makeXRCompatible(); } - if (session.renderState.layers === undefined || renderer.capabilities.isWebGL2 === false) { const layerInit = { antialias: session.renderState.layers === undefined ? attributes.antialias : true, @@ -18450,13 +16255,11 @@ let depthFormat = null; let depthType = null; let glDepthFormat = null; - if (attributes.depth) { glDepthFormat = attributes.stencil ? gl.DEPTH24_STENCIL8 : gl.DEPTH_COMPONENT24; depthFormat = attributes.stencil ? DepthStencilFormat : DepthFormat; depthType = attributes.stencil ? UnsignedInt248Type : UnsignedShortType; } - const projectionlayerInit = { colorFormat: renderer.outputEncoding === sRGBEncoding ? gl.SRGB8_ALPHA8 : gl.RGBA8, depthFormat: glDepthFormat, @@ -18478,10 +16281,9 @@ const renderTargetProperties = renderer.properties.get(newRenderTarget); renderTargetProperties.__ignoreDepthValues = glProjLayer.ignoreDepthValues; } - newRenderTarget.isXRRenderTarget = true; // TODO Remove this when possible, see #23278 - // Set foveation to maximum. + // Set foveation to maximum. this.setFoveation(1.0); referenceSpace = await session.requestReferenceSpace(referenceSpaceType); animation.setContext(session); @@ -18492,19 +16294,20 @@ }); } }; - function onInputSourcesChange(event) { - const inputSources = session.inputSources; // Assign inputSources to available controllers + const inputSources = session.inputSources; + + // Assign inputSources to available controllers for (let i = 0; i < controllers.length; i++) { inputSourcesMap.set(inputSources[i], controllers[i]); - } // Notify disconnected + } + // Notify disconnected for (let i = 0; i < event.removed.length; i++) { const inputSource = event.removed[i]; const controller = inputSourcesMap.get(inputSource); - if (controller) { controller.dispatchEvent({ type: 'disconnected', @@ -18512,13 +16315,13 @@ }); inputSourcesMap.delete(inputSource); } - } // Notify connected + } + // Notify connected for (let i = 0; i < event.added.length; i++) { const inputSource = event.added[i]; const controller = inputSourcesMap.get(inputSource); - if (controller) { controller.dispatchEvent({ type: 'connected', @@ -18526,27 +16329,29 @@ }); } } - } // + } + // const cameraLPos = new Vector3(); const cameraRPos = new Vector3(); + /** * Assumes 2 cameras that are parallel and share an X-axis, and that * the cameras' projection and world matrices have already been set. * And that near and far planes are identical for both cameras. * Visualization of this technique: https://computergraphics.stackexchange.com/a/4765 */ - function setProjectionFromUnion(camera, cameraL, cameraR) { cameraLPos.setFromMatrixPosition(cameraL.matrixWorld); cameraRPos.setFromMatrixPosition(cameraR.matrixWorld); const ipd = cameraLPos.distanceTo(cameraRPos); const projL = cameraL.projectionMatrix.elements; - const projR = cameraR.projectionMatrix.elements; // VR systems will have identical far and near planes, and + const projR = cameraR.projectionMatrix.elements; + + // VR systems will have identical far and near planes, and // most likely identical top and bottom frustum extents. // Use the left camera for these values. - const near = projL[14] / (projL[10] - 1); const far = projL[14] / (projL[10] + 1); const topFov = (projL[9] + 1) / projL[5]; @@ -18554,20 +16359,23 @@ const leftFov = (projL[8] - 1) / projL[0]; const rightFov = (projR[8] + 1) / projR[0]; const left = near * leftFov; - const right = near * rightFov; // Calculate the new camera's position offset from the - // left camera. xOffset should be roughly half `ipd`. + const right = near * rightFov; + // Calculate the new camera's position offset from the + // left camera. xOffset should be roughly half `ipd`. const zOffset = ipd / (-leftFov + rightFov); - const xOffset = zOffset * -leftFov; // TODO: Better way to apply this offset? + const xOffset = zOffset * -leftFov; + // TODO: Better way to apply this offset? cameraL.matrixWorld.decompose(camera.position, camera.quaternion, camera.scale); camera.translateX(xOffset); camera.translateZ(zOffset); camera.matrixWorld.compose(camera.position, camera.quaternion, camera.scale); - camera.matrixWorldInverse.copy(camera.matrixWorld).invert(); // Find the union of the frustum values of the cameras and scale + camera.matrixWorldInverse.copy(camera.matrixWorld).invert(); + + // Find the union of the frustum values of the cameras and scale // the values so that the near plane's position does not change in world space, // although must now be relative to the new union camera. - const near2 = near + zOffset; const far2 = far + zOffset; const left2 = left - xOffset; @@ -18576,24 +16384,21 @@ const bottom2 = bottomFov * far / far2 * near2; camera.projectionMatrix.makePerspective(left2, right2, top2, bottom2, near2, far2); } - function updateCamera(camera, parent) { if (parent === null) { camera.matrixWorld.copy(camera.matrix); } else { camera.matrixWorld.multiplyMatrices(parent.matrixWorld, camera.matrix); } - camera.matrixWorldInverse.copy(camera.matrixWorld).invert(); } - this.updateCamera = function (camera) { if (session === null) return; cameraVR.near = cameraR.near = cameraL.near = camera.near; cameraVR.far = cameraR.far = cameraL.far = camera.far; - if (_currentDepthNear !== cameraVR.near || _currentDepthFar !== cameraVR.far) { // Note that the new renderState won't apply until the next frame. See #18320 + session.updateRenderState({ depthNear: cameraVR.near, depthFar: cameraVR.far @@ -18601,16 +16406,15 @@ _currentDepthNear = cameraVR.near; _currentDepthFar = cameraVR.far; } - const parent = camera.parent; const cameras = cameraVR.cameras; updateCamera(cameraVR, parent); - for (let i = 0; i < cameras.length; i++) { updateCamera(cameras[i], parent); } + cameraVR.matrixWorld.decompose(cameraVR.position, cameraVR.quaternion, cameraVR.scale); - cameraVR.matrixWorld.decompose(cameraVR.position, cameraVR.quaternion, cameraVR.scale); // update user camera and its children + // update user camera and its children camera.position.copy(cameraVR.position); camera.quaternion.copy(cameraVR.quaternion); @@ -18618,130 +16422,121 @@ camera.matrix.copy(cameraVR.matrix); camera.matrixWorld.copy(cameraVR.matrixWorld); const children = camera.children; - for (let i = 0, l = children.length; i < l; i++) { children[i].updateMatrixWorld(true); - } // update projection matrix for proper view frustum culling + } + // update projection matrix for proper view frustum culling if (cameras.length === 2) { setProjectionFromUnion(cameraVR, cameraL, cameraR); } else { // assume single camera setup (AR) + cameraVR.projectionMatrix.copy(cameraL.projectionMatrix); } }; - this.getCamera = function () { return cameraVR; }; - this.getFoveation = function () { if (glProjLayer !== null) { return glProjLayer.fixedFoveation; } - if (glBaseLayer !== null) { return glBaseLayer.fixedFoveation; } - return undefined; }; - this.setFoveation = function (foveation) { // 0 = no foveation = full resolution // 1 = maximum foveation = the edges render at lower resolution + if (glProjLayer !== null) { glProjLayer.fixedFoveation = foveation; } - if (glBaseLayer !== null && glBaseLayer.fixedFoveation !== undefined) { glBaseLayer.fixedFoveation = foveation; } - }; // Animation Loop + }; + // Animation Loop let onAnimationFrameCallback = null; - function onAnimationFrame(time, frame) { pose = frame.getViewerPose(referenceSpace); xrFrame = frame; - if (pose !== null) { const views = pose.views; - if (glBaseLayer !== null) { renderer.setRenderTargetFramebuffer(newRenderTarget, glBaseLayer.framebuffer); renderer.setRenderTarget(newRenderTarget); } + let cameraVRNeedsUpdate = false; - let cameraVRNeedsUpdate = false; // check if it's necessary to rebuild cameraVR's camera list + // check if it's necessary to rebuild cameraVR's camera list if (views.length !== cameraVR.cameras.length) { cameraVR.cameras.length = 0; cameraVRNeedsUpdate = true; } - for (let i = 0; i < views.length; i++) { const view = views[i]; let viewport = null; - if (glBaseLayer !== null) { viewport = glBaseLayer.getViewport(view); } else { const glSubImage = glBinding.getViewSubImage(glProjLayer, view); - viewport = glSubImage.viewport; // For side-by-side projection, we only produce a single texture for both eyes. + viewport = glSubImage.viewport; + // For side-by-side projection, we only produce a single texture for both eyes. if (i === 0) { renderer.setRenderTargetTextures(newRenderTarget, glSubImage.colorTexture, glProjLayer.ignoreDepthValues ? undefined : glSubImage.depthStencilTexture); renderer.setRenderTarget(newRenderTarget); } } - - const camera = cameras[i]; + let camera = cameras[i]; + if (camera === undefined) { + camera = new PerspectiveCamera(); + camera.layers.enable(i); + camera.viewport = new Vector4(); + cameras[i] = camera; + } camera.matrix.fromArray(view.transform.matrix); camera.projectionMatrix.fromArray(view.projectionMatrix); camera.viewport.set(viewport.x, viewport.y, viewport.width, viewport.height); - if (i === 0) { cameraVR.matrix.copy(camera.matrix); } - if (cameraVRNeedsUpdate === true) { cameraVR.cameras.push(camera); } } - } // + } + // const inputSources = session.inputSources; - for (let i = 0; i < controllers.length; i++) { const controller = controllers[i]; const inputSource = inputSources[i]; controller.update(inputSource, frame, referenceSpace); } - if (onAnimationFrameCallback) onAnimationFrameCallback(time, frame); xrFrame = null; } - const animation = new WebGLAnimation(); animation.setAnimationLoop(onAnimationFrame); - this.setAnimationLoop = function (callback) { onAnimationFrameCallback = callback; }; - this.dispose = function () {}; } - } function WebGLMaterials(properties) { function refreshFogUniforms(uniforms, fog) { uniforms.fogColor.value.copy(fog.color); - if (fog.isFog) { uniforms.fogNear.value = fog.near; uniforms.fogFar.value = fog.far; @@ -18749,7 +16544,6 @@ uniforms.fogDensity.value = fog.density; } } - function refreshMaterialUniforms(uniforms, material, pixelRatio, height, transmissionRenderTarget) { if (material.isMeshBasicMaterial) { refreshUniformsCommon(uniforms, material); @@ -18764,7 +16558,6 @@ refreshUniformsPhong(uniforms, material); } else if (material.isMeshStandardMaterial) { refreshUniformsCommon(uniforms, material); - if (material.isMeshPhysicalMaterial) { refreshUniformsPhysical(uniforms, material, transmissionRenderTarget); } else { @@ -18784,7 +16577,6 @@ refreshUniformsNormal(uniforms, material); } else if (material.isLineBasicMaterial) { refreshUniformsLine(uniforms, material); - if (material.isLineDashedMaterial) { refreshUniformsDash(uniforms, material); } @@ -18799,36 +16591,27 @@ material.uniformsNeedUpdate = false; // #15581 } } - function refreshUniformsCommon(uniforms, material) { uniforms.opacity.value = material.opacity; - if (material.color) { uniforms.diffuse.value.copy(material.color); } - if (material.emissive) { uniforms.emissive.value.copy(material.emissive).multiplyScalar(material.emissiveIntensity); } - if (material.map) { uniforms.map.value = material.map; } - if (material.alphaMap) { uniforms.alphaMap.value = material.alphaMap; } - if (material.specularMap) { uniforms.specularMap.value = material.specularMap; } - if (material.alphaTest > 0) { uniforms.alphaTest.value = material.alphaTest; } - const envMap = properties.get(material).envMap; - if (envMap) { uniforms.envMap.value = envMap; uniforms.flipEnvMap.value = envMap.isCubeTexture && envMap.isRenderTargetTexture === false ? -1 : 1; @@ -18836,16 +16619,16 @@ uniforms.ior.value = material.ior; uniforms.refractionRatio.value = material.refractionRatio; } - if (material.lightMap) { uniforms.lightMap.value = material.lightMap; uniforms.lightMapIntensity.value = material.lightMapIntensity; } - if (material.aoMap) { uniforms.aoMap.value = material.aoMap; uniforms.aoMapIntensity.value = material.aoMapIntensity; - } // uv repeat and offset setting priorities + } + + // uv repeat and offset setting priorities // 1. color map // 2. specular map // 3. displacementMap map @@ -18863,9 +16646,7 @@ // 15. transmission map // 16. thickness map - let uvScaleMap; - if (material.map) { uvScaleMap = material.map; } else if (material.specularMap) { @@ -18903,137 +16684,115 @@ } else if (material.sheenRoughnessMap) { uvScaleMap = material.sheenRoughnessMap; } - if (uvScaleMap !== undefined) { // backwards compatibility if (uvScaleMap.isWebGLRenderTarget) { uvScaleMap = uvScaleMap.texture; } - if (uvScaleMap.matrixAutoUpdate === true) { uvScaleMap.updateMatrix(); } - uniforms.uvTransform.value.copy(uvScaleMap.matrix); - } // uv repeat and offset setting priorities for uv2 + } + + // uv repeat and offset setting priorities for uv2 // 1. ao map // 2. light map - let uv2ScaleMap; - if (material.aoMap) { uv2ScaleMap = material.aoMap; } else if (material.lightMap) { uv2ScaleMap = material.lightMap; } - if (uv2ScaleMap !== undefined) { // backwards compatibility if (uv2ScaleMap.isWebGLRenderTarget) { uv2ScaleMap = uv2ScaleMap.texture; } - if (uv2ScaleMap.matrixAutoUpdate === true) { uv2ScaleMap.updateMatrix(); } - uniforms.uv2Transform.value.copy(uv2ScaleMap.matrix); } } - function refreshUniformsLine(uniforms, material) { uniforms.diffuse.value.copy(material.color); uniforms.opacity.value = material.opacity; } - function refreshUniformsDash(uniforms, material) { uniforms.dashSize.value = material.dashSize; uniforms.totalSize.value = material.dashSize + material.gapSize; uniforms.scale.value = material.scale; } - function refreshUniformsPoints(uniforms, material, pixelRatio, height) { uniforms.diffuse.value.copy(material.color); uniforms.opacity.value = material.opacity; uniforms.size.value = material.size * pixelRatio; uniforms.scale.value = height * 0.5; - if (material.map) { uniforms.map.value = material.map; } - if (material.alphaMap) { uniforms.alphaMap.value = material.alphaMap; } - if (material.alphaTest > 0) { uniforms.alphaTest.value = material.alphaTest; - } // uv repeat and offset setting priorities + } + + // uv repeat and offset setting priorities // 1. color map // 2. alpha map - let uvScaleMap; - if (material.map) { uvScaleMap = material.map; } else if (material.alphaMap) { uvScaleMap = material.alphaMap; } - if (uvScaleMap !== undefined) { if (uvScaleMap.matrixAutoUpdate === true) { uvScaleMap.updateMatrix(); } - uniforms.uvTransform.value.copy(uvScaleMap.matrix); } } - function refreshUniformsSprites(uniforms, material) { uniforms.diffuse.value.copy(material.color); uniforms.opacity.value = material.opacity; uniforms.rotation.value = material.rotation; - if (material.map) { uniforms.map.value = material.map; } - if (material.alphaMap) { uniforms.alphaMap.value = material.alphaMap; } - if (material.alphaTest > 0) { uniforms.alphaTest.value = material.alphaTest; - } // uv repeat and offset setting priorities + } + + // uv repeat and offset setting priorities // 1. color map // 2. alpha map - let uvScaleMap; - if (material.map) { uvScaleMap = material.map; } else if (material.alphaMap) { uvScaleMap = material.alphaMap; } - if (uvScaleMap !== undefined) { if (uvScaleMap.matrixAutoUpdate === true) { uvScaleMap.updateMatrix(); } - uniforms.uvTransform.value.copy(uvScaleMap.matrix); } } - function refreshUniformsLambert(uniforms, material) { if (material.emissiveMap) { uniforms.emissiveMap.value = material.emissiveMap; } } - function refreshUniformsPhong(uniforms, material) { uniforms.specular.value.copy(material.specular); uniforms.shininess.value = Math.max(material.shininess, 1e-4); // to prevent pow( 0.0, 0.0 ) @@ -19041,102 +16800,83 @@ if (material.emissiveMap) { uniforms.emissiveMap.value = material.emissiveMap; } - if (material.bumpMap) { uniforms.bumpMap.value = material.bumpMap; uniforms.bumpScale.value = material.bumpScale; if (material.side === BackSide) uniforms.bumpScale.value *= -1; } - if (material.normalMap) { uniforms.normalMap.value = material.normalMap; uniforms.normalScale.value.copy(material.normalScale); if (material.side === BackSide) uniforms.normalScale.value.negate(); } - if (material.displacementMap) { uniforms.displacementMap.value = material.displacementMap; uniforms.displacementScale.value = material.displacementScale; uniforms.displacementBias.value = material.displacementBias; } } - function refreshUniformsToon(uniforms, material) { if (material.gradientMap) { uniforms.gradientMap.value = material.gradientMap; } - if (material.emissiveMap) { uniforms.emissiveMap.value = material.emissiveMap; } - if (material.bumpMap) { uniforms.bumpMap.value = material.bumpMap; uniforms.bumpScale.value = material.bumpScale; if (material.side === BackSide) uniforms.bumpScale.value *= -1; } - if (material.normalMap) { uniforms.normalMap.value = material.normalMap; uniforms.normalScale.value.copy(material.normalScale); if (material.side === BackSide) uniforms.normalScale.value.negate(); } - if (material.displacementMap) { uniforms.displacementMap.value = material.displacementMap; uniforms.displacementScale.value = material.displacementScale; uniforms.displacementBias.value = material.displacementBias; } } - function refreshUniformsStandard(uniforms, material) { uniforms.roughness.value = material.roughness; uniforms.metalness.value = material.metalness; uniforms.f90_r115_compatability.value = material.f90; - if (material.refraction > 0) { uniforms.refraction.value = material.refraction; } - if (material.roughnessMap) { uniforms.roughnessMap.value = material.roughnessMap; } - if (material.metalnessMap) { uniforms.metalnessMap.value = material.metalnessMap; } - if (material.emissiveMap) { uniforms.emissiveMap.value = material.emissiveMap; } - if (material.bumpMap) { uniforms.bumpMap.value = material.bumpMap; uniforms.bumpScale.value = material.bumpScale; if (material.side === BackSide) uniforms.bumpScale.value *= -1; } - if (material.normalMap) { uniforms.normalMap.value = material.normalMap; uniforms.normalScale.value.copy(material.normalScale); if (material.lowerNormalMap) uniforms.lowerNormalMap.value = material.lowerNormalMap; if (material.side === BackSide) uniforms.normalScale.value.negate(); } - if (material.displacementMap) { uniforms.displacementMap.value = material.displacementMap; uniforms.displacementScale.value = material.displacementScale; uniforms.displacementBias.value = material.displacementBias; } - const envMap = properties.get(material).envMap; - if (envMap) { //uniforms.envMap.value = material.envMap; // part of uniforms common uniforms.envMapIntensity.value = material.envMapIntensity; } } - function refreshUniformsPhysical(uniforms, material, transmissionRenderTarget) { refreshUniformsStandard(uniforms, material); uniforms.ior.value = material.ior; // also part of uniforms common @@ -19144,93 +16884,73 @@ if (material.sheen > 0) { uniforms.sheenColor.value.copy(material.sheenColor).multiplyScalar(material.sheen); uniforms.sheenRoughness.value = material.sheenRoughness; - if (material.sheenColorMap) { uniforms.sheenColorMap.value = material.sheenColorMap; } - if (material.sheenRoughnessMap) { uniforms.sheenRoughnessMap.value = material.sheenRoughnessMap; } } - if (material.clearcoat > 0) { uniforms.clearcoat.value = material.clearcoat; uniforms.clearcoatRoughness.value = material.clearcoatRoughness; - if (material.clearcoatMap) { uniforms.clearcoatMap.value = material.clearcoatMap; } - if (material.clearcoatRoughnessMap) { uniforms.clearcoatRoughnessMap.value = material.clearcoatRoughnessMap; } - if (material.clearcoatNormalMap) { uniforms.clearcoatNormalScale.value.copy(material.clearcoatNormalScale); uniforms.clearcoatNormalMap.value = material.clearcoatNormalMap; - if (material.side === BackSide) { uniforms.clearcoatNormalScale.value.negate(); } } } - if (material.transmission > 0) { uniforms.transmission.value = material.transmission; uniforms.transmissionSamplerMap.value = transmissionRenderTarget.texture; uniforms.transmissionSamplerSize.value.set(transmissionRenderTarget.width, transmissionRenderTarget.height); - if (material.transmissionMap) { uniforms.transmissionMap.value = material.transmissionMap; } - uniforms.thickness.value = material.thickness; - if (material.thicknessMap) { uniforms.thicknessMap.value = material.thicknessMap; } - uniforms.attenuationDistance.value = material.attenuationDistance; uniforms.attenuationColor.value.copy(material.attenuationColor); } - uniforms.specularIntensity.value = material.specularIntensity; uniforms.specularColor.value.copy(material.specularColor); - if (material.specularIntensityMap) { uniforms.specularIntensityMap.value = material.specularIntensityMap; } - if (material.specularColorMap) { uniforms.specularColorMap.value = material.specularColorMap; } } - function refreshUniformsMatcap(uniforms, material) { if (material.matcap) { uniforms.matcap.value = material.matcap; } - if (material.bumpMap) { uniforms.bumpMap.value = material.bumpMap; uniforms.bumpScale.value = material.bumpScale; if (material.side === BackSide) uniforms.bumpScale.value *= -1; } - if (material.normalMap) { uniforms.normalMap.value = material.normalMap; uniforms.normalScale.value.copy(material.normalScale); if (material.side === BackSide) uniforms.normalScale.value.negate(); } - if (material.displacementMap) { uniforms.displacementMap.value = material.displacementMap; uniforms.displacementScale.value = material.displacementScale; uniforms.displacementBias.value = material.displacementBias; } } - function refreshUniformsDepth(uniforms, material) { if (material.displacementMap) { uniforms.displacementMap.value = material.displacementMap; @@ -19238,39 +16958,33 @@ uniforms.displacementBias.value = material.displacementBias; } } - function refreshUniformsDistance(uniforms, material) { if (material.displacementMap) { uniforms.displacementMap.value = material.displacementMap; uniforms.displacementScale.value = material.displacementScale; uniforms.displacementBias.value = material.displacementBias; } - uniforms.referencePosition.value.copy(material.referencePosition); uniforms.nearDistance.value = material.nearDistance; uniforms.farDistance.value = material.farDistance; } - function refreshUniformsNormal(uniforms, material) { if (material.bumpMap) { uniforms.bumpMap.value = material.bumpMap; uniforms.bumpScale.value = material.bumpScale; if (material.side === BackSide) uniforms.bumpScale.value *= -1; } - if (material.normalMap) { uniforms.normalMap.value = material.normalMap; uniforms.normalScale.value.copy(material.normalScale); if (material.side === BackSide) uniforms.normalScale.value.negate(); } - if (material.displacementMap) { uniforms.displacementMap.value = material.displacementMap; uniforms.displacementScale.value = material.displacementScale; uniforms.displacementBias.value = material.displacementBias; } } - return { refreshFogUniforms: refreshFogUniforms, refreshMaterialUniforms: refreshMaterialUniforms @@ -19282,97 +16996,113 @@ canvas.style.display = 'block'; return canvas; } - function WebGLRenderer(parameters = {}) { const _canvas = parameters.canvas !== undefined ? parameters.canvas : createCanvasElement(), - _context = parameters.context !== undefined ? parameters.context : null, - _alpha = parameters.alpha !== undefined ? parameters.alpha : false, - _depth = parameters.depth !== undefined ? parameters.depth : true, - _stencil = parameters.stencil !== undefined ? parameters.stencil : true, - _antialias = parameters.antialias !== undefined ? parameters.antialias : false, - _premultipliedAlpha = parameters.premultipliedAlpha !== undefined ? parameters.premultipliedAlpha : true, - _preserveDrawingBuffer = parameters.preserveDrawingBuffer !== undefined ? parameters.preserveDrawingBuffer : false, - _powerPreference = parameters.powerPreference !== undefined ? parameters.powerPreference : 'default', - _failIfMajorPerformanceCaveat = parameters.failIfMajorPerformanceCaveat !== undefined ? parameters.failIfMajorPerformanceCaveat : false; - + _context = parameters.context !== undefined ? parameters.context : null, + _alpha = parameters.alpha !== undefined ? parameters.alpha : false, + _depth = parameters.depth !== undefined ? parameters.depth : true, + _stencil = parameters.stencil !== undefined ? parameters.stencil : true, + _antialias = parameters.antialias !== undefined ? parameters.antialias : false, + _premultipliedAlpha = parameters.premultipliedAlpha !== undefined ? parameters.premultipliedAlpha : true, + _preserveDrawingBuffer = parameters.preserveDrawingBuffer !== undefined ? parameters.preserveDrawingBuffer : false, + _powerPreference = parameters.powerPreference !== undefined ? parameters.powerPreference : 'default', + _failIfMajorPerformanceCaveat = parameters.failIfMajorPerformanceCaveat !== undefined ? parameters.failIfMajorPerformanceCaveat : false; let currentRenderList = null; - let currentRenderState = null; // render() can be called from within a callback triggered by another render. + let currentRenderState = null; + + // render() can be called from within a callback triggered by another render. // We track this so that the nested render call gets its list and state isolated from the parent render call. const renderListStack = []; - const renderStateStack = []; // public properties + const renderStateStack = []; + + // public properties - this.domElement = _canvas; // Debug configuration container + this.domElement = _canvas; + // Debug configuration container this.debug = { /** * Enables error checking and reporting when shader programs are being compiled * @type {boolean} */ checkShaderErrors: true - }; // clearing + }; + + // clearing this.autoClear = true; this.autoClearColor = true; this.autoClearDepth = true; - this.autoClearStencil = true; // scene graph + this.autoClearStencil = true; + + // scene graph + + this.sortObjects = true; - this.sortObjects = true; // user-defined clipping + // user-defined clipping this.clippingPlanes = []; - this.localClippingEnabled = false; // physically based shading + this.localClippingEnabled = false; - this.outputEncoding = LinearEncoding; // physical lights + // physically based shading - this.physicallyCorrectLights = false; // tone mapping + this.outputEncoding = LinearEncoding; + + // physical lights + + this.physicallyCorrectLights = false; + + // tone mapping this.toneMapping = NoToneMapping; - this.toneMappingExposure = 1.0; // internal properties + this.toneMappingExposure = 1.0; + + // internal properties const _this = this; + let _isContextLost = false; - let _isContextLost = false; // internal state cache + // internal state cache let _currentActiveCubeFace = 0; let _currentActiveMipmapLevel = 0; let _currentRenderTarget = null; - let _currentMaterialId = -1; - let _currentCamera = null; - const _currentViewport = new Vector4(); - const _currentScissor = new Vector4(); + let _currentScissorTest = null; - let _currentScissorTest = null; // + // let _width = _canvas.width; let _height = _canvas.height; let _pixelRatio = 1; let _opaqueSort = null; let _transparentSort = null; - const _viewport = new Vector4(0, 0, _width, _height); - const _scissor = new Vector4(0, 0, _width, _height); + let _scissorTest = false; - let _scissorTest = false; // frustum + // frustum - const _frustum = new Frustum(); // clipping + const _frustum = new Frustum(); + // clipping let _clippingEnabled = false; - let _localClippingEnabled = false; // transmission + let _localClippingEnabled = false; - let _transmissionRenderTarget = null; // camera matrices cache + // transmission - const _projScreenMatrix = new Matrix4(); + let _transmissionRenderTarget = null; - const _vector3 = new Vector3(); + // camera matrices cache + const _projScreenMatrix = new Matrix4(); + const _vector3 = new Vector3(); const _vector2 = new Vector2(); - const _emptyScene = { background: null, fog: null, @@ -19391,26 +17121,21 @@ projectionMatrix: new Matrix4(), matrixWorldInverse: new Matrix4() }; - function getTargetPixelRatio() { return _currentRenderTarget === null ? _pixelRatio : 1; - } // initialize + } + // initialize let _gl = _context; - function getContext(contextNames, contextAttributes) { for (let i = 0; i < contextNames.length; i++) { const contextName = contextNames[i]; - const context = _canvas.getContext(contextName, contextAttributes); - if (context !== null) return context; } - return null; } - try { const contextAttributes = { alpha: true, @@ -19421,23 +17146,20 @@ preserveDrawingBuffer: _preserveDrawingBuffer, powerPreference: _powerPreference, failIfMajorPerformanceCaveat: _failIfMajorPerformanceCaveat - }; // OffscreenCanvas does not have setAttribute, see #22811 + }; - if ('setAttribute' in _canvas) _canvas.setAttribute('data-engine', `three.js r${REVISION}`); // event listeners must be registered before WebGL context is created, see #12753 + // OffscreenCanvas does not have setAttribute, see #22811 + if ('setAttribute' in _canvas) _canvas.setAttribute('data-engine', `three.js r${REVISION}`); + // event listeners must be registered before WebGL context is created, see #12753 _canvas.addEventListener('webglcontextlost', onContextLost, false); - _canvas.addEventListener('webglcontextrestored', onContextRestore, false); - if (_gl === null) { const contextNames = ['webgl2', 'webgl', 'experimental-webgl']; - if (_this.isWebGL1Renderer === true) { contextNames.shift(); } - _gl = getContext(contextNames, contextAttributes); - if (_gl === null) { if (getContext(contextNames)) { throw new Error('Error creating WebGL context with your selected attributes.'); @@ -19445,8 +17167,9 @@ throw new Error('Error creating WebGL context.'); } } - } // Some experimental-webgl implementations do not have getShaderPrecisionFormat + } + // Some experimental-webgl implementations do not have getShaderPrecisionFormat if (_gl.getShaderPrecisionFormat === undefined) { _gl.getShaderPrecisionFormat = function () { @@ -19461,13 +17184,11 @@ console.error('THREE.WebGLRenderer: ' + error.message); throw error; } - let extensions, capabilities, state, info; let properties, textures, cubemaps, cubeuvmaps, attributes, geometries, objects; let programCache, materials, renderLists, renderStates, clipping, shadowMap; let background, morphtargets, bufferRenderer, indexedBufferRenderer; let utils, bindingStates; - function initGLContext() { extensions = new WebGLExtensions(_gl, parameters); capabilities = new WebGLCapabilities(_gl, extensions, parameters); @@ -19502,67 +17223,58 @@ _this.state = state; _this.info = info; } + initGLContext(); - initGLContext(); // xr + // xr const xr = new WebXRManager(_this, _gl); - this.xr = xr; // API + this.xr = xr; + + // API this.getContext = function () { return _gl; }; - this.getContextAttributes = function () { return _gl.getContextAttributes(); }; - this.forceContextLoss = function () { const extension = extensions.get('WEBGL_lose_context'); if (extension) extension.loseContext(); }; - this.forceContextRestore = function () { const extension = extensions.get('WEBGL_lose_context'); if (extension) extension.restoreContext(); }; - this.getPixelRatio = function () { return _pixelRatio; }; - this.setPixelRatio = function (value) { if (value === undefined) return; _pixelRatio = value; this.setSize(_width, _height, false); }; - this.getSize = function (target) { return target.set(_width, _height); }; - this.setSize = function (width, height, updateStyle) { if (xr.isPresenting) { console.warn('THREE.WebGLRenderer: Can\'t change size while VR device is presenting.'); return; } - _width = width; _height = height; _canvas.width = Math.floor(width * _pixelRatio); _canvas.height = Math.floor(height * _pixelRatio); - if (updateStyle !== false) { _canvas.style.width = width + 'px'; _canvas.style.height = height + 'px'; } - this.setViewport(0, 0, width, height); }; - this.getDrawingBufferSize = function (target) { return target.set(_width * _pixelRatio, _height * _pixelRatio).floor(); }; - this.setDrawingBufferSize = function (width, height, pixelRatio) { _width = width; _height = height; @@ -19571,81 +17283,65 @@ _canvas.height = Math.floor(height * pixelRatio); this.setViewport(0, 0, width, height); }; - this.getCurrentViewport = function (target) { return target.copy(_currentViewport); }; - this.getViewport = function (target) { return target.copy(_viewport); }; - this.setViewport = function (x, y, width, height) { if (x.isVector4) { _viewport.set(x.x, x.y, x.z, x.w); } else { _viewport.set(x, y, width, height); } - state.viewport(_currentViewport.copy(_viewport).multiplyScalar(_pixelRatio).floor()); }; - this.getScissor = function (target) { return target.copy(_scissor); }; - this.setScissor = function (x, y, width, height) { if (x.isVector4) { _scissor.set(x.x, x.y, x.z, x.w); } else { _scissor.set(x, y, width, height); } - state.scissor(_currentScissor.copy(_scissor).multiplyScalar(_pixelRatio).floor()); }; - this.getScissorTest = function () { return _scissorTest; }; - this.setScissorTest = function (boolean) { state.setScissorTest(_scissorTest = boolean); }; - this.setOpaqueSort = function (method) { _opaqueSort = method; }; - this.setTransparentSort = function (method) { _transparentSort = method; - }; // Clearing + }; + // Clearing this.getClearColor = function (target) { return target.copy(background.getClearColor()); }; - this.setClearColor = function () { background.setClearColor.apply(background, arguments); }; - this.getClearAlpha = function () { return background.getClearAlpha(); }; - this.setClearAlpha = function () { background.setClearAlpha.apply(background, arguments); }; - this.clear = function (color, depth, stencil) { let bits = 0; if (color === undefined || color) bits |= _gl.COLOR_BUFFER_BIT; if (depth === undefined || depth) bits |= _gl.DEPTH_BUFFER_BIT; if (stencil === undefined || stencil) bits |= _gl.STENCIL_BUFFER_BIT; - _gl.clear(bits); }; - this.clearEncodingAware = function (color, depth, stencil) { const savedAutoClear = this.autoClear; const savedAutoClearColor = this.autoClearColor; @@ -19661,25 +17357,21 @@ this.autoClearDepth = savedAutoClearDepth; this.autoClearStencil = savedAutoClearStencil; }; - this.clearColor = function () { this.clear(true, false, false); }; - this.clearDepth = function () { this.clear(false, true, false); }; - this.clearStencil = function () { this.clear(false, false, true); - }; // Returns the actual encoding that should be used to read from or write to the map in shaders. + }; + + // Returns the actual encoding that should be used to read from or write to the map in shaders. // It can be different from map.encoding because usage of SRGB8_ALPHA8 textures. // This function's implementation should be kept in sync with WebGLTextures.getInternalFormat. - - this.getTextureEncodingFromMap = function (map) { let encoding; - if (map && map.isTexture) { encoding = map.encoding; } else if (map && map.isWebGLRenderTarget) { @@ -19688,24 +17380,20 @@ } else { encoding = LinearEncoding; } - if (capabilities.isWebGL2 && map && map.isTexture && map.format === RGBAFormat && map.type === UnsignedByteType && map.encoding === sRGBEncoding && !map.sRGBToLinearWithShader) { encoding = LinearEncoding; // disable inline decode for sRGB textures in WebGL 2 } - if (map && map.isCompressedTexture) { encoding = LinearEncoding; // disable inline decode for sRGB compressed textures } - return encoding; - }; // + }; + // this.dispose = function () { _canvas.removeEventListener('webglcontextlost', onContextLost, false); - _canvas.removeEventListener('webglcontextrestored', onContextRestore, false); - renderLists.dispose(); renderStates.dispose(); properties.dispose(); @@ -19717,26 +17405,22 @@ xr.dispose(); xr.removeEventListener('sessionstart', onXRSessionStart); xr.removeEventListener('sessionend', onXRSessionEnd); - if (_transmissionRenderTarget) { _transmissionRenderTarget.dispose(); - _transmissionRenderTarget = null; } - animation.stop(); - }; // Events + }; + // Events function onContextLost(event) { event.preventDefault(); console.log('THREE.WebGLRenderer: Context Lost.'); _isContextLost = true; } - - function - /* event */ - onContextRestore() { + function onContextRestore(/* event */ + ) { console.log('THREE.WebGLRenderer: Context Restored.'); _isContextLost = false; const infoAutoReset = info.autoReset; @@ -19751,68 +17435,69 @@ shadowMap.needsUpdate = shadowMapNeedsUpdate; shadowMap.type = shadowMapType; } - function onMaterialDispose(event) { const material = event.target; material.removeEventListener('dispose', onMaterialDispose); deallocateMaterial(material); - } // Buffer deallocation + } + // Buffer deallocation function deallocateMaterial(material) { releaseMaterialProgramReferences(material); properties.remove(material); } - function releaseMaterialProgramReferences(material) { const programs = properties.get(material).programs; - if (programs !== undefined) { programs.forEach(function (program) { programCache.releaseProgram(program); }); - if (material.isShaderMaterial) { programCache.releaseShaderCache(material); } } - } // Buffer rendering + } + // Buffer rendering this.renderBufferDirect = function (camera, scene, geometry, material, object, group) { if (scene === null) scene = _emptyScene; // renderBufferDirect second parameter used to be fog (could be null) const frontFaceCW = object.isMesh && object.matrixWorld.determinant() < 0; const program = setProgram(camera, scene, geometry, material, object); - state.setMaterial(material, frontFaceCW); // + state.setMaterial(material, frontFaceCW); + + // let index = geometry.index; - const position = geometry.attributes.position; // + const position = geometry.attributes.position; + + // if (index === null) { if (position === undefined || position.count === 0) return; } else if (index.count === 0) { return; - } // + } + // let rangeFactor = 1; - if (material.wireframe === true) { index = geometries.getWireframeAttribute(geometry); rangeFactor = 2; } - bindingStates.setup(object, material, program, geometry, index); let attribute; let renderer = bufferRenderer; - if (index !== null) { attribute = attributes.get(index); renderer = indexedBufferRenderer; renderer.setIndex(attribute); - } // + } + // const dataCount = index !== null ? index.count : position.count; const rangeStart = geometry.drawRange.start * rangeFactor; @@ -19822,7 +17507,9 @@ const drawStart = Math.max(rangeStart, groupStart); const drawEnd = Math.min(dataCount, rangeStart + rangeCount, groupStart + groupCount) - 1; const drawCount = Math.max(0, drawEnd - drawStart + 1); - if (drawCount === 0) return; // + if (drawCount === 0) return; + + // if (object.isMesh) { if (material.wireframe === true) { @@ -19836,7 +17523,6 @@ if (lineWidth === undefined) lineWidth = 1; // Not using Line*Material state.setLineWidth(lineWidth * getTargetPixelRatio()); - if (object.isLineSegments) { renderer.setMode(_gl.LINES); } else if (object.isLineLoop) { @@ -19846,14 +17532,12 @@ } } else if (object.isPoints) { renderer.setMode(_gl.POINTS); - if (material.isOFTPointSpriteMaterial) { material.uniforms.pointSize.value = material.pointSize * getTargetPixelRatio(); } } else if (object.isSprite) { renderer.setMode(_gl.TRIANGLES); } - if (object.isInstancedMesh) { renderer.renderInstances(drawStart, drawCount, object.count); } else if (geometry.isInstancedBufferGeometry) { @@ -19862,8 +17546,9 @@ } else { renderer.render(drawStart, drawCount); } - }; // Compile + }; + // Compile this.compile = function (scene, camera) { currentRenderState = renderStates.get(scene); @@ -19872,7 +17557,6 @@ scene.traverseVisible(function (object) { if (object.isLight && object.layers.test(camera.layers)) { currentRenderState.pushLight(object); - if (object.castShadow) { currentRenderState.pushShadow(object); } @@ -19881,7 +17565,6 @@ currentRenderState.setupLights(_this.physicallyCorrectLights); scene.traverse(function (object) { const material = object.material; - if (material) { if (Array.isArray(material)) { for (let i = 0; i < material.length; i++) { @@ -19895,63 +17578,59 @@ }); renderStateStack.pop(); currentRenderState = null; - }; // Animation Loop + }; + // Animation Loop let onAnimationFrameCallback = null; - function onAnimationFrame(time) { if (onAnimationFrameCallback) onAnimationFrameCallback(time); } - function onXRSessionStart() { animation.stop(); } - function onXRSessionEnd() { animation.start(); } - const animation = new WebGLAnimation(); animation.setAnimationLoop(onAnimationFrame); animation.setContext(platform.animationContext); - this.setAnimationLoop = function (callback) { onAnimationFrameCallback = callback; xr.setAnimationLoop(callback); callback === null ? animation.stop() : animation.start(); }; - xr.addEventListener('sessionstart', onXRSessionStart); - xr.addEventListener('sessionend', onXRSessionEnd); // Rendering + xr.addEventListener('sessionend', onXRSessionEnd); + + // Rendering this.render = function (scene, camera) { if (camera !== undefined && camera.isCamera !== true) { console.error('THREE.WebGLRenderer.render: camera is not an instance of THREE.Camera.'); return; } + if (_isContextLost === true) return; - if (_isContextLost === true) return; // update scene graph + // update scene graph - if (scene.autoUpdate === true) scene.updateMatrixWorld(); // update camera matrices and frustum + if (scene.autoUpdate === true) scene.updateMatrixWorld(); - if (camera.parent === null) camera.updateMatrixWorld(); + // update camera matrices and frustum + if (camera.parent === null) camera.updateMatrixWorld(); if (xr.enabled === true && xr.isPresenting === true) { if (xr.cameraAutoUpdate === true) xr.updateCamera(camera); camera = xr.getCamera(); // use XR camera for rendering - } // - + } + // if (scene.isScene === true) scene.onBeforeRender(_this, scene, camera, _currentRenderTarget); currentRenderState = renderStates.get(scene, renderStateStack.length); currentRenderState.init(); renderStateStack.push(currentRenderState); - _projScreenMatrix.multiplyMatrices(camera.projectionMatrix, camera.matrixWorldInverse); - _frustum.setFromProjectionMatrix(_projScreenMatrix); - _localClippingEnabled = this.localClippingEnabled; _clippingEnabled = clipping.init(this.clippingPlanes, _localClippingEnabled, camera); currentRenderList = renderLists.get(scene, renderListStack.length); @@ -19959,74 +17638,82 @@ renderListStack.push(currentRenderList); projectObject(scene, camera, 0, _this.sortObjects); currentRenderList.finish(); - if (_this.sortObjects === true) { currentRenderList.sort(_opaqueSort, _transparentSort); - } // + } + // if (_clippingEnabled === true) clipping.beginShadows(); const shadowsArray = currentRenderState.state.shadowsArray; shadowMap.render(shadowsArray, scene, camera); - if (_clippingEnabled === true) clipping.endShadows(); // + if (_clippingEnabled === true) clipping.endShadows(); - if (this.info.autoReset === true) this.info.reset(); // + // - background.render(currentRenderList, scene, _currentRenderTarget); // render scene + if (this.info.autoReset === true) this.info.reset(); - currentRenderState.setupLights(_this.physicallyCorrectLights); + // + background.render(currentRenderList, scene, _currentRenderTarget); + + // render scene + + currentRenderState.setupLights(_this.physicallyCorrectLights); if (camera.isArrayCamera) { const cameras = camera.cameras; - for (let i = 0, l = cameras.length; i < l; i++) { const camera2 = cameras[i]; renderScene(currentRenderList, scene, camera2, camera2.viewport); } } else { renderScene(currentRenderList, scene, camera); - } // + } + // if (_currentRenderTarget !== null) { // resolve multisample renderbuffers to a single-sample texture if necessary - textures.updateMultisampleRenderTarget(_currentRenderTarget); // Generate mipmap if we're using any kind of mipmap filtering + + textures.updateMultisampleRenderTarget(_currentRenderTarget); + + // Generate mipmap if we're using any kind of mipmap filtering textures.updateRenderTargetMipmap(_currentRenderTarget); - } // + } + + // + if (scene.isScene === true) scene.onAfterRender(_this, scene, camera); - if (scene.isScene === true) scene.onAfterRender(_this, scene, camera); // Ensure depth buffer writing is enabled so it can be cleared on next render + // Ensure depth buffer writing is enabled so it can be cleared on next render state.buffers.depth.setTest(true); state.buffers.depth.setMask(true); state.buffers.color.setMask(true); - state.setPolygonOffset(false); // _gl.finish(); + state.setPolygonOffset(false); + + // _gl.finish(); bindingStates.resetDefaultState(); _currentMaterialId = -1; _currentCamera = null; renderStateStack.pop(); - if (renderStateStack.length > 0) { currentRenderState = renderStateStack[renderStateStack.length - 1]; } else { currentRenderState = null; } - renderListStack.pop(); - if (renderListStack.length > 0) { currentRenderList = renderListStack[renderListStack.length - 1]; } else { currentRenderList = null; } }; - function projectObject(object, camera, groupOrder, sortObjects) { if (object.visible === false) return; const visible = object.layers.test(camera.layers); - if (visible) { if (object.isGroup) { groupOrder = object.renderOrder; @@ -20034,7 +17721,6 @@ if (object.autoUpdate === true) object.update(camera); } else if (object.isLight) { currentRenderState.pushLight(object); - if (object.castShadow) { currentRenderState.pushShadow(object); } @@ -20043,10 +17729,8 @@ if (sortObjects) { _vector3.setFromMatrixPosition(object.matrixWorld).applyMatrix4(_projScreenMatrix); } - const geometry = objects.update(object); const material = object.material; - if (material.visible) { currentRenderList.push(object, geometry, material, groupOrder, _vector3.z, null); } @@ -20054,27 +17738,23 @@ } else if (object.isMesh || object.isLine || object.isPoints) { if (object.isSkinnedMesh) { // update skeleton only once in a frame + if (object.skeleton.frame !== info.render.frame) { object.skeleton.update(); object.skeleton.frame = info.render.frame; } } - if (!object.frustumCulled || _frustum.intersectsObject(object)) { if (sortObjects) { _vector3.setFromMatrixPosition(object.matrixWorld).applyMatrix4(_projScreenMatrix); } - const geometry = objects.update(object); const material = object.material; - if (Array.isArray(material)) { const groups = geometry.groups; - for (let i = 0, l = groups.length; i < l; i++) { const group = groups[i]; const groupMaterial = material[group.materialIndex]; - if (groupMaterial && groupMaterial.visible) { currentRenderList.push(object, geometry, groupMaterial, groupOrder, _vector3.z, group); } @@ -20085,14 +17765,11 @@ } } } - const children = object.children; - for (let i = 0, l = children.length; i < l; i++) { projectObject(children[i], camera, groupOrder, sortObjects); } } - function renderScene(currentRenderList, scene, camera, viewport) { const opaqueObjects = currentRenderList.opaque; const transmissiveObjects = currentRenderList.transmissive; @@ -20104,7 +17781,6 @@ if (transmissiveObjects.length > 0) renderObjects(transmissiveObjects, scene, camera); if (transparentObjects.length > 0) renderObjects(transparentObjects, scene, camera); } - function renderTransmissionPass(opaqueObjects, scene, camera) { if (_transmissionRenderTarget === null) { const needsAntialias = _antialias === true && capabilities.isWebGL2 === true; @@ -20116,70 +17792,53 @@ samples: needsAntialias ? 4 : 0 }); } - _this.getDrawingBufferSize(_vector2); - _transmissionRenderTarget.setSize(_vector2.x, _vector2.y); - const currentRenderTarget = _this.getRenderTarget(); - _this.setRenderTarget(_transmissionRenderTarget); + _this.clear(); - _this.clear(); // Turn off the features which can affect the frag color for opaque objects pass. + // Turn off the features which can affect the frag color for opaque objects pass. // Otherwise they are applied twice in opaque objects pass and transmission objects pass. - - const currentToneMapping = _this.toneMapping; _this.toneMapping = NoToneMapping; renderObjects(opaqueObjects, scene, camera); _this.toneMapping = currentToneMapping; textures.updateMultisampleRenderTarget(_transmissionRenderTarget); textures.updateRenderTargetMipmap(_transmissionRenderTarget); - _this.setRenderTarget(currentRenderTarget); } - function renderObjects(renderList, scene, camera) { const overrideMaterial = scene.isScene === true ? scene.overrideMaterial : null; - for (let i = 0, l = renderList.length; i < l; i++) { const renderItem = renderList[i]; const object = renderItem.object; const geometry = renderItem.geometry; const material = overrideMaterial === null ? renderItem.material : overrideMaterial; const group = renderItem.group; - if (object.layers.test(camera.layers)) { renderObject(object, scene, camera, geometry, material, group); } } } - function renderObject(object, scene, camera, geometry, material, group) { object.onBeforeRender(_this, scene, camera, geometry, material, group); object.modelViewMatrix.multiplyMatrices(camera.matrixWorldInverse, object.matrixWorld); object.normalMatrix.getNormalMatrix(object.modelViewMatrix); material.onBeforeRender(_this, scene, camera, geometry, object, group); - if (material.transparent === true && material.side === DoubleSide) { material.side = BackSide; material.needsUpdate = true; - _this.renderBufferDirect(camera, scene, geometry, material, object, group); - material.side = FrontSide; material.needsUpdate = true; - _this.renderBufferDirect(camera, scene, geometry, material, object, group); - material.side = DoubleSide; } else { _this.renderBufferDirect(camera, scene, geometry, material, object, group); } - object.onAfterRender(_this, scene, camera, geometry, material, group); } - function getProgram(material, scene, object) { if (scene.isScene !== true) scene = _emptyScene; // scene could be a Mesh, Line, Points, ... @@ -20189,23 +17848,24 @@ const lightsStateVersion = lights.state.version; const parameters = programCache.getParameters(material, lights.state, shadowsArray, scene, object); const programCacheKey = programCache.getProgramCacheKey(parameters); - let programs = materialProperties.programs; // always update environment and fog - changing these trigger an getProgram call, but it's possible that the program doesn't change + let programs = materialProperties.programs; + + // always update environment and fog - changing these trigger an getProgram call, but it's possible that the program doesn't change materialProperties.environment = material.isMeshStandardMaterial ? scene.environment : null; materialProperties.fog = scene.fog; materialProperties.envMap = (material.isMeshStandardMaterial ? cubeuvmaps : cubemaps).get(material.envMap || materialProperties.environment); - if (programs === undefined) { // new material + material.addEventListener('dispose', onMaterialDispose); programs = new Map(); materialProperties.programs = programs; } - let program = programs.get(programCacheKey); - if (program !== undefined) { // early out if program and light state is identical + if (materialProperties.currentProgram === program && materialProperties.lightsStateVersion === lightsStateVersion) { updateCommonMaterialProperties(material, parameters); return program; @@ -20218,20 +17878,19 @@ programs.set(programCacheKey, program); materialProperties.uniforms = parameters.uniforms; } - const uniforms = materialProperties.uniforms; - if (!material.isShaderMaterial && !material.isRawShaderMaterial || material.clipping === true) { uniforms.clippingPlanes = clipping.uniform; } + updateCommonMaterialProperties(material, parameters); - updateCommonMaterialProperties(material, parameters); // store the light setup it was created for + // store the light setup it was created for materialProperties.needsLights = materialNeedsLights(material); materialProperties.lightsStateVersion = lightsStateVersion; - if (materialProperties.needsLights) { // wire up the material to this renderer's lighting state + uniforms.ambientLightColor.value = lights.state.ambient; uniforms.lightProbe.value = lights.state.probe; uniforms.directionalLights.value = lights.state.directional; @@ -20249,16 +17908,15 @@ uniforms.spotShadowMap.value = lights.state.spotShadowMap; uniforms.spotShadowMatrix.value = lights.state.spotShadowMatrix; uniforms.pointShadowMap.value = lights.state.pointShadowMap; - uniforms.pointShadowMatrix.value = lights.state.pointShadowMatrix; // TODO (abelnation): add area lights shadow info to uniforms + uniforms.pointShadowMatrix.value = lights.state.pointShadowMatrix; + // TODO (abelnation): add area lights shadow info to uniforms } - const progUniforms = program.getUniforms(); const uniformsList = WebGLUniforms.seqWithValue(progUniforms.seq, uniforms); materialProperties.currentProgram = program; materialProperties.uniformsList = uniformsList; return program; } - function updateCommonMaterialProperties(material, parameters) { const materialProperties = properties.get(material); materialProperties.outputEncoding = parameters.outputEncoding; @@ -20272,7 +17930,6 @@ materialProperties.vertexAlphas = parameters.vertexAlphas; materialProperties.vertexTangents = parameters.vertexTangents; } - function setProgram(camera, scene, geometry, material, object) { if (scene.isScene !== true) scene = _emptyScene; // scene could be a Mesh, Line, Points, ... @@ -20288,20 +17945,20 @@ const morphTargetsCount = !!geometry.morphAttributes.position ? geometry.morphAttributes.position.length : 0; const materialProperties = properties.get(material); const lights = currentRenderState.state.lights; - if (_clippingEnabled === true) { if (_localClippingEnabled === true || camera !== _currentCamera) { - const useCache = camera === _currentCamera && material.id === _currentMaterialId; // we might want to call this function with some ClippingGroup + const useCache = camera === _currentCamera && material.id === _currentMaterialId; + + // we might want to call this function with some ClippingGroup // object instead of the material, once it becomes feasible // (#8465, #8379) - clipping.setState(material, camera, useCache); } - } // + } + // let needsProgramChange = false; - if (material.version === materialProperties.__version) { if (materialProperties.needsLights && materialProperties.lightsStateVersion !== lights.state.version) { needsProgramChange = true; @@ -20335,76 +17992,69 @@ } else { needsProgramChange = true; materialProperties.__version = material.version; - } // + } + // let program = materialProperties.currentProgram; - if (needsProgramChange === true) { program = getProgram(material, scene, object); } - let refreshProgram = false; let refreshMaterial = false; let refreshLights = false; const p_uniforms = program.getUniforms(), - m_uniforms = materialProperties.uniforms; - + m_uniforms = materialProperties.uniforms; if (state.useProgram(program.program)) { refreshProgram = true; refreshMaterial = true; refreshLights = true; } - if (material.id !== _currentMaterialId) { _currentMaterialId = material.id; refreshMaterial = true; } - if (refreshProgram || _currentCamera !== camera) { p_uniforms.setValue(_gl, 'projectionMatrix', camera.projectionMatrix); - if (capabilities.logarithmicDepthBuffer) { p_uniforms.setValue(_gl, 'logDepthBufFC', 2.0 / (Math.log(camera.far + 1.0) / Math.LN2)); } - if (_currentCamera !== camera) { - _currentCamera = camera; // lighting uniforms depend on the camera so enforce an update + _currentCamera = camera; + + // lighting uniforms depend on the camera so enforce an update // now, in case this material supports lights - or later, when // the next material that does gets activated: refreshMaterial = true; // set to true on material change - refreshLights = true; // remains set until update done - } // load material specific uniforms - // (shader material also gets them for the sake of genericity) + } + // load material specific uniforms + // (shader material also gets them for the sake of genericity) if (material.isShaderMaterial || material.isMeshPhongMaterial || material.isMeshToonMaterial || material.isMeshStandardMaterial || material.envMap) { const uCamPos = p_uniforms.map.cameraPosition; - if (uCamPos !== undefined) { uCamPos.setValue(_gl, _vector3.setFromMatrixPosition(camera.matrixWorld)); } } - if (material.isMeshPhongMaterial || material.isMeshToonMaterial || material.isMeshLambertMaterial || material.isMeshBasicMaterial || material.isMeshStandardMaterial || material.isShaderMaterial) { p_uniforms.setValue(_gl, 'isOrthographic', camera.isOrthographicCamera === true); } - if (material.isMeshPhongMaterial || material.isMeshToonMaterial || material.isMeshLambertMaterial || material.isMeshBasicMaterial || material.isMeshStandardMaterial || material.isShaderMaterial || material.isShadowMaterial || object.isSkinnedMesh) { p_uniforms.setValue(_gl, 'viewMatrix', camera.matrixWorldInverse); } - } // skinning and morph target uniforms must be set even if material didn't change + } + + // skinning and morph target uniforms must be set even if material didn't change // auto-setting of texture unit for bone and morph texture must go before other textures // otherwise textures used for skinning and morphing can take over texture units reserved for other material textures - if (object.isSkinnedMesh) { p_uniforms.setOptional(_gl, object, 'bindMatrix'); p_uniforms.setOptional(_gl, object, 'bindMatrixInverse'); const skeleton = object.skeleton; - if (skeleton) { if (capabilities.floatVertexTextures) { if (skeleton.boneTexture === null) skeleton.computeBoneTexture(); @@ -20415,55 +18065,53 @@ } } } - if (!!geometry && (geometry.morphAttributes.position !== undefined || geometry.morphAttributes.normal !== undefined)) { morphtargets.update(object, geometry, material, program); } - if (refreshMaterial || materialProperties.receiveShadow !== object.receiveShadow) { materialProperties.receiveShadow = object.receiveShadow; p_uniforms.setValue(_gl, 'receiveShadow', object.receiveShadow); } - if (refreshMaterial) { p_uniforms.setValue(_gl, 'toneMappingExposure', _this.toneMappingExposure); - if (materialProperties.needsLights) { // the current material requires lighting info + // note: all lighting uniforms are always set correctly // they simply reference the renderer's state for their // values // // use the current material's .needsUpdate flags to set // the GL state when required + markUniformsLightsNeedsUpdate(m_uniforms, refreshLights); - } // refresh uniforms common to several materials + } + // refresh uniforms common to several materials if (fog && material.fog) { materials.refreshFogUniforms(m_uniforms, fog); } - materials.refreshMaterialUniforms(m_uniforms, material, _pixelRatio, _height, _transmissionRenderTarget); WebGLUniforms.upload(_gl, materialProperties.uniformsList, m_uniforms, textures); } - if (material.isShaderMaterial && material.uniformsNeedUpdate === true) { WebGLUniforms.upload(_gl, materialProperties.uniformsList, m_uniforms, textures); material.uniformsNeedUpdate = false; } - if (material.isSpriteMaterial) { p_uniforms.setValue(_gl, 'center', object.center); - } // common matrices + } + // common matrices p_uniforms.setValue(_gl, 'modelViewMatrix', object.modelViewMatrix); p_uniforms.setValue(_gl, 'normalMatrix', object.normalMatrix); p_uniforms.setValue(_gl, 'modelMatrix', object.matrixWorld); return program; - } // If uniforms are marked as clean, they don't need to be loaded to the GPU. + } + // If uniforms are marked as clean, they don't need to be loaded to the GPU. function markUniformsLightsNeedsUpdate(uniforms, value) { uniforms.ambientLightColor.needsUpdate = value; @@ -20477,32 +18125,25 @@ uniforms.rectAreaLights.needsUpdate = value; uniforms.hemisphereLights.needsUpdate = value; } - function materialNeedsLights(material) { return material.isMeshLambertMaterial || material.isMeshToonMaterial || material.isMeshPhongMaterial || material.isMeshStandardMaterial || material.isShadowMaterial || material.isShaderMaterial && material.lights === true; } - this.getActiveCubeFace = function () { return _currentActiveCubeFace; }; - this.getActiveMipmapLevel = function () { return _currentActiveMipmapLevel; }; - this.getRenderTarget = function () { return _currentRenderTarget; }; - this.setRenderTargetTextures = function (renderTarget, colorTexture, depthTexture) { properties.get(renderTarget.texture).__webglTexture = colorTexture; properties.get(renderTarget.depthTexture).__webglTexture = depthTexture; const renderTargetProperties = properties.get(renderTarget); renderTargetProperties.__hasExternalTextures = true; - if (renderTargetProperties.__hasExternalTextures) { renderTargetProperties.__autoAllocateDepthBuffer = depthTexture === undefined; - if (!renderTargetProperties.__autoAllocateDepthBuffer) { // The multisample_render_to_texture extension doesn't work properly if there // are midframe flushes and an external depth buffer. Disable use of the extension. @@ -20513,22 +18154,18 @@ } } }; - this.setRenderTargetFramebuffer = function (renderTarget, defaultFramebuffer) { const renderTargetProperties = properties.get(renderTarget); renderTargetProperties.__webglFramebuffer = defaultFramebuffer; renderTargetProperties.__useDefaultFramebuffer = defaultFramebuffer === undefined; }; - this.setRenderTarget = function (renderTarget, activeCubeFace = 0, activeMipmapLevel = 0) { _currentRenderTarget = renderTarget; _currentActiveCubeFace = activeCubeFace; _currentActiveMipmapLevel = activeMipmapLevel; let useDefaultFramebuffer = true; - if (renderTarget) { const renderTargetProperties = properties.get(renderTarget); - if (renderTargetProperties.__useDefaultFramebuffer !== undefined) { // We need to make sure to rebind the framebuffer. state.bindFramebuffer(_gl.FRAMEBUFFER, null); @@ -20540,20 +18177,15 @@ textures.rebindTextures(renderTarget, properties.get(renderTarget.texture).__webglTexture, properties.get(renderTarget.depthTexture).__webglTexture); } } - let framebuffer = null; let isCube = false; let isRenderTarget3D = false; - if (renderTarget) { const texture = renderTarget.texture; - if (texture.isDataTexture3D || texture.isDataTexture2DArray) { isRenderTarget3D = true; } - const __webglFramebuffer = properties.get(renderTarget).__webglFramebuffer; - if (renderTarget.isWebGLCubeRenderTarget) { framebuffer = __webglFramebuffer[activeCubeFace]; isCube = true; @@ -20562,80 +18194,62 @@ } else { framebuffer = __webglFramebuffer; } - _currentViewport.copy(renderTarget.viewport); - _currentScissor.copy(renderTarget.scissor); - _currentScissorTest = renderTarget.scissorTest; } else { _currentViewport.copy(_viewport).multiplyScalar(_pixelRatio).floor(); - _currentScissor.copy(_scissor).multiplyScalar(_pixelRatio).floor(); - _currentScissorTest = _scissorTest; } - const framebufferBound = state.bindFramebuffer(_gl.FRAMEBUFFER, framebuffer); - if (framebufferBound && capabilities.drawBuffers && useDefaultFramebuffer) { state.drawBuffers(renderTarget, framebuffer); } - state.viewport(_currentViewport); state.scissor(_currentScissor); state.setScissorTest(_currentScissorTest); - if (isCube) { const textureProperties = properties.get(renderTarget.texture); - _gl.framebufferTexture2D(_gl.FRAMEBUFFER, _gl.COLOR_ATTACHMENT0, _gl.TEXTURE_CUBE_MAP_POSITIVE_X + activeCubeFace, textureProperties.__webglTexture, activeMipmapLevel); } else if (isRenderTarget3D) { const textureProperties = properties.get(renderTarget.texture); const layer = activeCubeFace || 0; - _gl.framebufferTextureLayer(_gl.FRAMEBUFFER, _gl.COLOR_ATTACHMENT0, textureProperties.__webglTexture, activeMipmapLevel || 0, layer); } - _currentMaterialId = -1; // reset current material to ensure correct uniform bindings }; - this.readRenderTargetPixels = function (renderTarget, x, y, width, height, buffer, activeCubeFaceIndex) { if (!(renderTarget && renderTarget.isWebGLRenderTarget)) { console.error('THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.'); return; } - let framebuffer = properties.get(renderTarget).__webglFramebuffer; - if (renderTarget.isWebGLCubeRenderTarget && activeCubeFaceIndex !== undefined) { framebuffer = framebuffer[activeCubeFaceIndex]; } - if (framebuffer) { state.bindFramebuffer(_gl.FRAMEBUFFER, framebuffer); - try { const texture = renderTarget.texture; const textureFormat = texture.format; const textureType = texture.type; - if (textureFormat !== RGBAFormat && utils.convert(textureFormat) !== _gl.getParameter(_gl.IMPLEMENTATION_COLOR_READ_FORMAT)) { console.error('THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in RGBA or implementation defined format.'); return; } - const halfFloatSupportedByExt = textureType === HalfFloatType && (extensions.has('EXT_color_buffer_half_float') || capabilities.isWebGL2 && extensions.has('EXT_color_buffer_float')); - - if (textureType !== UnsignedByteType && utils.convert(textureType) !== _gl.getParameter(_gl.IMPLEMENTATION_COLOR_READ_TYPE) && // Edge and Chrome Mac < 52 (#9513) - !(textureType === FloatType && (capabilities.isWebGL2 || extensions.has('OES_texture_float') || extensions.has('WEBGL_color_buffer_float'))) && // Chrome Mac >= 52 and Firefox + if (textureType !== UnsignedByteType && utils.convert(textureType) !== _gl.getParameter(_gl.IMPLEMENTATION_COLOR_READ_TYPE) && + // Edge and Chrome Mac < 52 (#9513) + !(textureType === FloatType && (capabilities.isWebGL2 || extensions.has('OES_texture_float') || extensions.has('WEBGL_color_buffer_float'))) && + // Chrome Mac >= 52 and Firefox !halfFloatSupportedByExt) { console.error('THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in UnsignedByteType or implementation defined type.'); return; } - if (_gl.checkFramebufferStatus(_gl.FRAMEBUFFER) === _gl.FRAMEBUFFER_COMPLETE) { // the following if statement ensures valid read requests (no out-of-bounds pixels, see #8604) + if (x >= 0 && x <= renderTarget.width - width && y >= 0 && y <= renderTarget.height - height) { _gl.readPixels(x, y, width, height, utils.convert(textureFormat), utils.convert(textureType), buffer); } @@ -20644,37 +18258,32 @@ } } finally { // restore framebuffer of current render target if necessary + const framebuffer = _currentRenderTarget !== null ? properties.get(_currentRenderTarget).__webglFramebuffer : null; state.bindFramebuffer(_gl.FRAMEBUFFER, framebuffer); } } }; - this.copyFramebufferToTexture = function (position, texture, level = 0) { const levelScale = Math.pow(2, -level); const width = Math.floor(texture.image.width * levelScale); const height = Math.floor(texture.image.height * levelScale); textures.setTexture2D(texture, 0); - _gl.copyTexSubImage2D(_gl.TEXTURE_2D, level, 0, 0, position.x, position.y, width, height); - state.unbindTexture(); }; - this.copyTextureToTexture = function (position, srcTexture, dstTexture, level = 0) { const width = srcTexture.image.width; const height = srcTexture.image.height; const glFormat = utils.convert(dstTexture.format); const glType = utils.convert(dstTexture.type); - textures.setTexture2D(dstTexture, 0); // As another texture upload may have changed pixelStorei - // parameters, make sure they are correct for the dstTexture + textures.setTexture2D(dstTexture, 0); + // As another texture upload may have changed pixelStorei + // parameters, make sure they are correct for the dstTexture _gl.pixelStorei(_gl.UNPACK_FLIP_Y_WEBGL, dstTexture.flipY); - _gl.pixelStorei(_gl.UNPACK_PREMULTIPLY_ALPHA_WEBGL, dstTexture.premultiplyAlpha); - _gl.pixelStorei(_gl.UNPACK_ALIGNMENT, dstTexture.unpackAlignment); - if (srcTexture.isDataTexture) { _gl.texSubImage2D(_gl.TEXTURE_2D, level, position.x, position.y, width, height, glFormat, glType, srcTexture.image.data); } else { @@ -20683,26 +18292,23 @@ } else { _gl.texSubImage2D(_gl.TEXTURE_2D, level, position.x, position.y, glFormat, glType, srcTexture.image); } - } // Generate mipmaps only when copying level 0 - + } + // Generate mipmaps only when copying level 0 if (level === 0 && dstTexture.generateMipmaps) _gl.generateMipmap(_gl.TEXTURE_2D); state.unbindTexture(); }; - this.copyTextureToTexture3D = function (sourceBox, position, srcTexture, dstTexture, level = 0) { if (_this.isWebGL1Renderer) { console.warn('THREE.WebGLRenderer.copyTextureToTexture3D: can only be used with WebGL2.'); return; } - const width = sourceBox.max.x - sourceBox.min.x + 1; const height = sourceBox.max.y - sourceBox.min.y + 1; const depth = sourceBox.max.z - sourceBox.min.z + 1; const glFormat = utils.convert(dstTexture.format); const glType = utils.convert(dstTexture.type); let glTarget; - if (dstTexture.isDataTexture3D) { textures.setTexture3D(dstTexture, 0); glTarget = _gl.TEXTURE_3D; @@ -20713,67 +18319,44 @@ console.warn('THREE.WebGLRenderer.copyTextureToTexture3D: only supports THREE.DataTexture3D and THREE.DataTexture2DArray.'); return; } - _gl.pixelStorei(_gl.UNPACK_FLIP_Y_WEBGL, dstTexture.flipY); - _gl.pixelStorei(_gl.UNPACK_PREMULTIPLY_ALPHA_WEBGL, dstTexture.premultiplyAlpha); - _gl.pixelStorei(_gl.UNPACK_ALIGNMENT, dstTexture.unpackAlignment); - const unpackRowLen = _gl.getParameter(_gl.UNPACK_ROW_LENGTH); - const unpackImageHeight = _gl.getParameter(_gl.UNPACK_IMAGE_HEIGHT); - const unpackSkipPixels = _gl.getParameter(_gl.UNPACK_SKIP_PIXELS); - const unpackSkipRows = _gl.getParameter(_gl.UNPACK_SKIP_ROWS); - const unpackSkipImages = _gl.getParameter(_gl.UNPACK_SKIP_IMAGES); - const image = srcTexture.isCompressedTexture ? srcTexture.mipmaps[0] : srcTexture.image; - _gl.pixelStorei(_gl.UNPACK_ROW_LENGTH, image.width); - _gl.pixelStorei(_gl.UNPACK_IMAGE_HEIGHT, image.height); - _gl.pixelStorei(_gl.UNPACK_SKIP_PIXELS, sourceBox.min.x); - _gl.pixelStorei(_gl.UNPACK_SKIP_ROWS, sourceBox.min.y); - _gl.pixelStorei(_gl.UNPACK_SKIP_IMAGES, sourceBox.min.z); - if (srcTexture.isDataTexture || srcTexture.isDataTexture3D) { _gl.texSubImage3D(glTarget, level, position.x, position.y, position.z, width, height, depth, glFormat, glType, image.data); } else { if (srcTexture.isCompressedTexture) { console.warn('THREE.WebGLRenderer.copyTextureToTexture3D: untested support for compressed srcTexture.'); - _gl.compressedTexSubImage3D(glTarget, level, position.x, position.y, position.z, width, height, depth, glFormat, image.data); } else { _gl.texSubImage3D(glTarget, level, position.x, position.y, position.z, width, height, depth, glFormat, glType, image); } } - _gl.pixelStorei(_gl.UNPACK_ROW_LENGTH, unpackRowLen); - _gl.pixelStorei(_gl.UNPACK_IMAGE_HEIGHT, unpackImageHeight); - _gl.pixelStorei(_gl.UNPACK_SKIP_PIXELS, unpackSkipPixels); - _gl.pixelStorei(_gl.UNPACK_SKIP_ROWS, unpackSkipRows); + _gl.pixelStorei(_gl.UNPACK_SKIP_IMAGES, unpackSkipImages); - _gl.pixelStorei(_gl.UNPACK_SKIP_IMAGES, unpackSkipImages); // Generate mipmaps only when copying level 0 - - + // Generate mipmaps only when copying level 0 if (level === 0 && dstTexture.generateMipmaps) _gl.generateMipmap(glTarget); state.unbindTexture(); }; - this.initTexture = function (texture) { textures.setTexture2D(texture, 0); state.unbindTexture(); }; - this.resetState = function () { _currentActiveCubeFace = 0; _currentActiveMipmapLevel = 0; @@ -20781,18 +18364,15 @@ state.reset(); bindingStates.reset(); }; - if (typeof __THREE_DEVTOOLS__ !== 'undefined') { __THREE_DEVTOOLS__.dispatchEvent(new CustomEvent('observe', { detail: this })); } } - WebGLRenderer.prototype.isWebGLRenderer = true; class WebGL1Renderer extends WebGLRenderer {} - WebGL1Renderer.prototype.isWebGL1Renderer = true; class FogExp2 { @@ -20801,21 +18381,18 @@ this.color = new Color(color); this.density = density; } - clone() { return new FogExp2(this.color, this.density); } - - toJSON() { + toJSON(/* meta */ + ) { return { type: 'FogExp2', color: this.color.getHex(), density: this.density }; } - } - FogExp2.prototype.isFogExp2 = true; class Fog { @@ -20825,12 +18402,11 @@ this.near = near; this.far = far; } - clone() { return new Fog(this.color, this.near, this.far); } - - toJSON() { + toJSON(/* meta */ + ) { return { type: 'Fog', color: this.color.getHex(), @@ -20838,9 +18414,7 @@ far: this.far }; } - } - Fog.prototype.isFog = true; class Scene extends Object3D { @@ -20860,7 +18434,6 @@ })); } } - copy(source, recursive) { super.copy(source, recursive); this.bgToneMapped = source.bgToneMapped; @@ -20872,16 +18445,13 @@ this.matrixAutoUpdate = source.matrixAutoUpdate; return this; } - toJSON(meta) { const data = super.toJSON(meta); if (this.fog !== null) data.object.fog = this.fog.toJSON(); data.object.bgToneMapped = this.bgToneMapped.toJSON(); return data; } - } - Scene.prototype.isScene = true; class InterleavedBuffer { @@ -20897,18 +18467,14 @@ this.version = 0; this.uuid = generateUUID(); } - onUploadCallback() {} - set needsUpdate(value) { if (value === true) this.version++; } - setUsage(value) { this.usage = value; return this; } - copy(source) { this.array = new source.array.constructor(source.array); this.count = source.count; @@ -20916,61 +18482,52 @@ this.usage = source.usage; return this; } - copyAt(index1, attribute, index2) { index1 *= this.stride; index2 *= attribute.stride; - for (let i = 0, l = this.stride; i < l; i++) { this.array[index1 + i] = attribute.array[index2 + i]; } - return this; } - set(value, offset = 0) { this.array.set(value, offset); return this; } - clone(data) { if (data.arrayBuffers === undefined) { data.arrayBuffers = {}; } - if (this.array.buffer._uuid === undefined) { this.array.buffer._uuid = generateUUID(); } - if (data.arrayBuffers[this.array.buffer._uuid] === undefined) { data.arrayBuffers[this.array.buffer._uuid] = this.array.slice(0).buffer; } - const array = new this.array.constructor(data.arrayBuffers[this.array.buffer._uuid]); const ib = new this.constructor(array, this.stride); ib.setUsage(this.usage); return ib; } - onUpload(callback) { this.onUploadCallback = callback; return this; } - toJSON(data) { if (data.arrayBuffers === undefined) { data.arrayBuffers = {}; - } // generate UUID for array buffer if necessary + } + // generate UUID for array buffer if necessary if (this.array.buffer._uuid === undefined) { this.array.buffer._uuid = generateUUID(); } - if (data.arrayBuffers[this.array.buffer._uuid] === undefined) { data.arrayBuffers[this.array.buffer._uuid] = Array.prototype.slice.call(new Uint32Array(this.array.buffer)); - } // + } + // return { uuid: this.uuid, @@ -20979,13 +18536,10 @@ stride: this.stride }; } - } - InterleavedBuffer.prototype.isInterleavedBuffer = true; const _vector$6 = /*@__PURE__*/new Vector3(); - class InterleavedBufferAttribute { constructor(interleavedBuffer, itemSize, offset, normalized = false) { this.name = ''; @@ -20994,104 +18548,79 @@ this.offset = offset; this.normalized = normalized === true; } - get count() { return this.data.count; } - get array() { return this.data.array; } - set needsUpdate(value) { this.data.needsUpdate = value; } - applyMatrix4(m) { for (let i = 0, l = this.data.count; i < l; i++) { _vector$6.x = this.getX(i); _vector$6.y = this.getY(i); _vector$6.z = this.getZ(i); - _vector$6.applyMatrix4(m); - this.setXYZ(i, _vector$6.x, _vector$6.y, _vector$6.z); } - return this; } - applyNormalMatrix(m) { for (let i = 0, l = this.count; i < l; i++) { _vector$6.x = this.getX(i); _vector$6.y = this.getY(i); _vector$6.z = this.getZ(i); - _vector$6.applyNormalMatrix(m); - this.setXYZ(i, _vector$6.x, _vector$6.y, _vector$6.z); } - return this; } - transformDirection(m) { for (let i = 0, l = this.count; i < l; i++) { _vector$6.x = this.getX(i); _vector$6.y = this.getY(i); _vector$6.z = this.getZ(i); - _vector$6.transformDirection(m); - this.setXYZ(i, _vector$6.x, _vector$6.y, _vector$6.z); } - return this; } - setX(index, x) { this.data.array[index * this.data.stride + this.offset] = x; return this; } - setY(index, y) { this.data.array[index * this.data.stride + this.offset + 1] = y; return this; } - setZ(index, z) { this.data.array[index * this.data.stride + this.offset + 2] = z; return this; } - setW(index, w) { this.data.array[index * this.data.stride + this.offset + 3] = w; return this; } - getX(index) { return this.data.array[index * this.data.stride + this.offset]; } - getY(index) { return this.data.array[index * this.data.stride + this.offset + 1]; } - getZ(index) { return this.data.array[index * this.data.stride + this.offset + 2]; } - getW(index) { return this.data.array[index * this.data.stride + this.offset + 3]; } - setXY(index, x, y) { index = index * this.data.stride + this.offset; this.data.array[index + 0] = x; this.data.array[index + 1] = y; return this; } - setXYZ(index, x, y, z) { index = index * this.data.stride + this.offset; this.data.array[index + 0] = x; @@ -21099,7 +18628,6 @@ this.data.array[index + 2] = z; return this; } - setXYZW(index, x, y, z, w) { index = index * this.data.stride + this.offset; this.data.array[index + 0] = x; @@ -21108,47 +18636,39 @@ this.data.array[index + 3] = w; return this; } - clone(data) { if (data === undefined) { console.log('THREE.InterleavedBufferAttribute.clone(): Cloning an interlaved buffer attribute will deinterleave buffer data.'); const array = []; - for (let i = 0; i < this.count; i++) { const index = i * this.data.stride + this.offset; - for (let j = 0; j < this.itemSize; j++) { array.push(this.data.array[index + j]); } } - return new BufferAttribute(new this.array.constructor(array), this.itemSize, this.normalized); } else { if (data.interleavedBuffers === undefined) { data.interleavedBuffers = {}; } - if (data.interleavedBuffers[this.data.uuid] === undefined) { data.interleavedBuffers[this.data.uuid] = this.data.clone(data); } - return new InterleavedBufferAttribute(data.interleavedBuffers[this.data.uuid], this.itemSize, this.offset, this.normalized); } } - toJSON(data) { if (data === undefined) { console.log('THREE.InterleavedBufferAttribute.toJSON(): Serializing an interlaved buffer attribute will deinterleave buffer data.'); const array = []; - for (let i = 0; i < this.count; i++) { const index = i * this.data.stride + this.offset; - for (let j = 0; j < this.itemSize; j++) { array.push(this.data.array[index + j]); } - } // deinterleave data and save it as an ordinary buffer attribute for now + } + // deinterleave data and save it as an ordinary buffer attribute for now return { itemSize: this.itemSize, @@ -21158,14 +18678,13 @@ }; } else { // save as true interlaved attribtue + if (data.interleavedBuffers === undefined) { data.interleavedBuffers = {}; } - if (data.interleavedBuffers[this.data.uuid] === undefined) { data.interleavedBuffers[this.data.uuid] = this.data.toJSON(data); } - return { isInterleavedBufferAttribute: true, itemSize: this.itemSize, @@ -21175,9 +18694,7 @@ }; } } - } - InterleavedBufferAttribute.prototype.isInterleavedBufferAttribute = true; /** @@ -21202,7 +18719,6 @@ this.transparent = true; this.setValues(parameters); } - copy(source) { super.copy(source); this.color.copy(source.color); @@ -21212,111 +18728,74 @@ this.sizeAttenuation = source.sizeAttenuation; return this; } - } - SpriteMaterial.prototype.isSpriteMaterial = true; let _geometry; - const _intersectPoint = /*@__PURE__*/new Vector3(); - const _worldScale = /*@__PURE__*/new Vector3(); - const _mvPosition = /*@__PURE__*/new Vector3(); - const _alignedPosition = /*@__PURE__*/new Vector2(); - const _rotatedPosition = /*@__PURE__*/new Vector2(); - const _viewWorldMatrix = /*@__PURE__*/new Matrix4(); - const _vA = /*@__PURE__*/new Vector3(); - const _vB = /*@__PURE__*/new Vector3(); - const _vC = /*@__PURE__*/new Vector3(); - const _uvA = /*@__PURE__*/new Vector2(); - const _uvB = /*@__PURE__*/new Vector2(); - const _uvC = /*@__PURE__*/new Vector2(); - class Sprite extends Object3D { constructor(material) { super(); this.type = 'Sprite'; - if (_geometry === undefined) { _geometry = new BufferGeometry(); const float32Array = new Float32Array([-0.5, -0.5, 0, 0, 0, 0.5, -0.5, 0, 1, 0, 0.5, 0.5, 0, 1, 1, -0.5, 0.5, 0, 0, 1]); const interleavedBuffer = new InterleavedBuffer(float32Array, 5); - _geometry.setIndex([0, 1, 2, 0, 2, 3]); - _geometry.setAttribute('position', new InterleavedBufferAttribute(interleavedBuffer, 3, 0, false)); - _geometry.setAttribute('uv', new InterleavedBufferAttribute(interleavedBuffer, 2, 3, false)); } - this.geometry = _geometry; this.material = material !== undefined ? material : new SpriteMaterial(); this.center = new Vector2(0.5, 0.5); } - raycast(raycaster, intersects) { if (raycaster.camera === null) { console.error('THREE.Sprite: "Raycaster.camera" needs to be set in order to raycast against sprites.'); } - _worldScale.setFromMatrixScale(this.matrixWorld); - _viewWorldMatrix.copy(raycaster.camera.matrixWorld); - this.modelViewMatrix.multiplyMatrices(raycaster.camera.matrixWorldInverse, this.matrixWorld); - _mvPosition.setFromMatrixPosition(this.modelViewMatrix); - if (raycaster.camera.isPerspectiveCamera && this.material.sizeAttenuation === false) { _worldScale.multiplyScalar(-_mvPosition.z); } - const rotation = this.material.rotation; let sin, cos; - if (rotation !== 0) { cos = Math.cos(rotation); sin = Math.sin(rotation); } - const center = this.center; transformVertex(_vA.set(-0.5, -0.5, 0), _mvPosition, center, _worldScale, sin, cos); transformVertex(_vB.set(0.5, -0.5, 0), _mvPosition, center, _worldScale, sin, cos); transformVertex(_vC.set(0.5, 0.5, 0), _mvPosition, center, _worldScale, sin, cos); - _uvA.set(0, 0); - _uvB.set(1, 0); + _uvC.set(1, 1); - _uvC.set(1, 1); // check first triangle - - + // check first triangle let intersect = raycaster.ray.intersectTriangle(_vA, _vB, _vC, false, _intersectPoint); - if (intersect === null) { // check second triangle transformVertex(_vB.set(-0.5, 0.5, 0), _mvPosition, center, _worldScale, sin, cos); - _uvB.set(0, 1); - intersect = raycaster.ray.intersectTriangle(_vA, _vC, _vB, false, _intersectPoint); - if (intersect === null) { return; } } - const distance = raycaster.ray.origin.distanceTo(_intersectPoint); if (distance < raycaster.near || distance > raycaster.far) return; intersects.push({ @@ -21327,41 +18806,35 @@ object: this }); } - copy(source) { super.copy(source); if (source.center !== undefined) this.center.copy(source.center); this.material = source.material; return this; } - } - Sprite.prototype.isSprite = true; - function transformVertex(vertexPosition, mvPosition, center, scale, sin, cos) { // compute position in camera space - _alignedPosition.subVectors(vertexPosition, center).addScalar(0.5).multiply(scale); // to check if rotation is not zero - + _alignedPosition.subVectors(vertexPosition, center).addScalar(0.5).multiply(scale); + // to check if rotation is not zero if (sin !== undefined) { _rotatedPosition.x = cos * _alignedPosition.x - sin * _alignedPosition.y; _rotatedPosition.y = sin * _alignedPosition.x + cos * _alignedPosition.y; } else { _rotatedPosition.copy(_alignedPosition); } - vertexPosition.copy(mvPosition); vertexPosition.x += _rotatedPosition.x; - vertexPosition.y += _rotatedPosition.y; // transform to world space + vertexPosition.y += _rotatedPosition.y; + // transform to world space vertexPosition.applyMatrix4(_viewWorldMatrix); } const _v1$2 = /*@__PURE__*/new Vector3(); - const _v2$1 = /*@__PURE__*/new Vector3(); - class LOD extends Object3D { constructor() { super(); @@ -21378,31 +18851,25 @@ }); this.autoUpdate = true; } - copy(source) { super.copy(source, false); const levels = source.levels; - for (let i = 0, l = levels.length; i < l; i++) { const level = levels[i]; this.addLevel(level.object.clone(), level.distance); } - this.autoUpdate = source.autoUpdate; return this; } - addLevel(object, distance = 0) { distance = Math.abs(distance); const levels = this.levels; let l; - for (l = 0; l < levels.length; l++) { if (distance < levels[l].distance) { break; } } - levels.splice(l, 0, { distance: distance, object: object @@ -21410,52 +18877,38 @@ this.add(object); return this; } - getCurrentLevel() { return this._currentLevel; } - getObjectForDistance(distance) { const levels = this.levels; - if (levels.length > 0) { let i, l; - for (i = 1, l = levels.length; i < l; i++) { if (distance < levels[i].distance) { break; } } - return levels[i - 1].object; } - return null; } - raycast(raycaster, intersects) { const levels = this.levels; - if (levels.length > 0) { _v1$2.setFromMatrixPosition(this.matrixWorld); - const distance = raycaster.ray.origin.distanceTo(_v1$2); this.getObjectForDistance(distance).raycast(raycaster, intersects); } } - update(camera) { const levels = this.levels; - if (levels.length > 1) { _v1$2.setFromMatrixPosition(camera.matrixWorld); - _v2$1.setFromMatrixPosition(this.matrixWorld); - const distance = _v1$2.distanceTo(_v2$1) / camera.zoom; levels[0].object.visible = true; let i, l; - for (i = 1, l = levels.length; i < l; i++) { if (distance >= levels[i].distance) { levels[i - 1].object.visible = false; @@ -21464,21 +18917,17 @@ break; } } - this._currentLevel = i - 1; - for (; i < l; i++) { levels[i].object.visible = false; } } } - toJSON(meta) { const data = super.toJSON(meta); if (this.autoUpdate === false) data.object.autoUpdate = false; data.object.levels = []; const levels = this.levels; - for (let i = 0, l = levels.length; i < l; i++) { const level = levels[i]; data.object.levels.push({ @@ -21486,22 +18935,15 @@ distance: level.distance }); } - return data; } - } const _basePosition = /*@__PURE__*/new Vector3(); - const _skinIndex = /*@__PURE__*/new Vector4(); - const _skinWeight = /*@__PURE__*/new Vector4(); - const _vector$5 = /*@__PURE__*/new Vector3(); - const _matrix = /*@__PURE__*/new Matrix4(); - class SkinnedMesh extends Mesh { constructor(geometry, material) { super(geometry, material); @@ -21510,7 +18952,6 @@ this.bindMatrix = new Matrix4(); this.bindMatrixInverse = new Matrix4(); } - copy(source) { super.copy(source); this.bindMode = source.bindMode; @@ -21519,48 +18960,38 @@ this.skeleton = source.skeleton; return this; } - bind(skeleton, bindMatrix) { this.skeleton = skeleton; - if (bindMatrix === undefined) { this.updateMatrixWorld(true); this.skeleton.calculateInverses(); bindMatrix = this.matrixWorld; } - this.bindMatrix.copy(bindMatrix); this.bindMatrixInverse.copy(bindMatrix).invert(); } - pose() { this.skeleton.pose(); } - normalizeSkinWeights() { const vector = new Vector4(); const skinWeight = this.geometry.attributes.skinWeight; - for (let i = 0, l = skinWeight.count; i < l; i++) { vector.x = skinWeight.getX(i); vector.y = skinWeight.getY(i); vector.z = skinWeight.getZ(i); vector.w = skinWeight.getW(i); const scale = 1.0 / vector.manhattanLength(); - if (scale !== Infinity) { vector.multiplyScalar(scale); } else { vector.set(1, 0, 0, 0); // do something reasonable } - skinWeight.setXYZW(i, vector.x, vector.y, vector.z, vector.w); } } - updateMatrixWorld(force) { super.updateMatrixWorld(force); - if (this.bindMode === 'attached') { this.bindMatrixInverse.copy(this.matrixWorld).invert(); } else if (this.bindMode === 'detached') { @@ -21569,36 +19000,24 @@ console.warn('THREE.SkinnedMesh: Unrecognized bindMode: ' + this.bindMode); } } - boneTransform(index, target) { const skeleton = this.skeleton; const geometry = this.geometry; - _skinIndex.fromBufferAttribute(geometry.attributes.skinIndex, index); - _skinWeight.fromBufferAttribute(geometry.attributes.skinWeight, index); - _basePosition.copy(target).applyMatrix4(this.bindMatrix); - target.set(0, 0, 0); - for (let i = 0; i < 4; i++) { const weight = _skinWeight.getComponent(i); - if (weight !== 0) { const boneIndex = _skinIndex.getComponent(i); - _matrix.multiplyMatrices(skeleton.bones[boneIndex].matrixWorld, skeleton.boneInverses[boneIndex]); - target.addScaledVector(_vector$5.copy(_basePosition).applyMatrix4(_matrix), weight); } } - return target.applyMatrix4(this.bindMatrixInverse); } - } - SkinnedMesh.prototype.isSkinnedMesh = true; class Bone extends Object3D { @@ -21606,9 +19025,7 @@ super(); this.type = 'Bone'; } - } - Bone.prototype.isBone = true; class DataTexture extends Texture { @@ -21625,15 +19042,11 @@ this.flipY = false; this.unpackAlignment = 1; } - } - DataTexture.prototype.isDataTexture = true; const _offsetMatrix = /*@__PURE__*/new Matrix4(); - const _identityMatrix = /*@__PURE__*/new Matrix4(); - class Skeleton { constructor(bones = [], boneInverses = []) { this.uuid = generateUUID(); @@ -21646,55 +19059,51 @@ this.frame = -1; this.init(); } - init() { const bones = this.bones; const boneInverses = this.boneInverses; - this.boneMatrices = new Float32Array(bones.length * 16); // calculate inverse bone matrices if necessary + this.boneMatrices = new Float32Array(bones.length * 16); + + // calculate inverse bone matrices if necessary if (boneInverses.length === 0) { this.calculateInverses(); } else { // handle special case + if (bones.length !== boneInverses.length) { console.warn('THREE.Skeleton: Number of inverse bone matrices does not match amount of bones.'); this.boneInverses = []; - for (let i = 0, il = this.bones.length; i < il; i++) { this.boneInverses.push(new Matrix4()); } } } } - calculateInverses() { this.boneInverses.length = 0; - for (let i = 0, il = this.bones.length; i < il; i++) { const inverse = new Matrix4(); - if (this.bones[i]) { inverse.copy(this.bones[i].matrixWorld).invert(); } - this.boneInverses.push(inverse); } } - pose() { // recover the bind-time world matrices + for (let i = 0, il = this.bones.length; i < il; i++) { const bone = this.bones[i]; - if (bone) { bone.matrixWorld.copy(this.boneInverses[i]).invert(); } - } // compute the local matrices, positions, rotations and scales + } + // compute the local matrices, positions, rotations and scales for (let i = 0, il = this.bones.length; i < il; i++) { const bone = this.bones[i]; - if (bone) { if (bone.parent && bone.parent.isBone) { bone.matrix.copy(bone.parent.matrixWorld).invert(); @@ -21702,36 +19111,32 @@ } else { bone.matrix.copy(bone.matrixWorld); } - bone.matrix.decompose(bone.position, bone.quaternion, bone.scale); } } } - update() { const bones = this.bones; const boneInverses = this.boneInverses; const boneMatrices = this.boneMatrices; - const boneTexture = this.boneTexture; // flatten bone matrices to array + const boneTexture = this.boneTexture; + + // flatten bone matrices to array for (let i = 0, il = bones.length; i < il; i++) { // compute the offset between the current and the original transform - const matrix = bones[i] ? bones[i].matrixWorld : _identityMatrix; + const matrix = bones[i] ? bones[i].matrixWorld : _identityMatrix; _offsetMatrix.multiplyMatrices(matrix, boneInverses[i]); - _offsetMatrix.toArray(boneMatrices, i * 16); } - if (boneTexture !== null) { boneTexture.needsUpdate = true; } } - clone() { return new Skeleton(this.bones, this.boneInverses); } - computeBoneTexture() { // layout (1 matrix = 4 pixels) // RGBA RGBA RGBA RGBA (=> column1, column2, column3, column4) @@ -21739,12 +19144,11 @@ // 16x16 pixel texture max 64 bones * 4 pixels = (16 * 16) // 32x32 pixel texture max 256 bones * 4 pixels = (32 * 32) // 64x64 pixel texture max 1024 bones * 4 pixels = (64 * 64) - let size = Math.sqrt(this.bones.length * 4); // 4 pixels needed for 1 matrix + let size = Math.sqrt(this.bones.length * 4); // 4 pixels needed for 1 matrix size = ceilPowerOfTwo(size); size = Math.max(size, 4); const boneMatrices = new Float32Array(size * size * 4); // 4 floats per RGBA pixel - boneMatrices.set(this.boneMatrices); // copy current values const boneTexture = new DataTexture(boneMatrices, size, size, RGBAFormat, FloatType); @@ -21754,46 +19158,36 @@ this.boneTextureSize = size; return this; } - getBoneByName(name) { for (let i = 0, il = this.bones.length; i < il; i++) { const bone = this.bones[i]; - if (bone.name === name) { return bone; } } - return undefined; } - dispose() { if (this.boneTexture !== null) { this.boneTexture.dispose(); this.boneTexture = null; } } - fromJSON(json, bones) { this.uuid = json.uuid; - for (let i = 0, l = json.bones.length; i < l; i++) { const uuid = json.bones[i]; let bone = bones[uuid]; - if (bone === undefined) { console.warn('THREE.Skeleton: No bone found with UUID:', uuid); bone = new Bone(); } - this.bones.push(bone); this.boneInverses.push(new Matrix4().fromArray(json.boneInverses[i])); } - this.init(); return this; } - setRootMotionBone(bone) { if (typeof bone == 'object') { if (bone.type == 'Bone') { @@ -21807,13 +19201,11 @@ } } } - if (this.rootMotionBone) { this.rootMotionBoneInitialMatrixInverse = this.rootMotionBone.matrixWorld.clone(); this.rootMotionBoneInitialMatrixInverse.invert(); } } - toJSON() { const data = { metadata: { @@ -21827,17 +19219,14 @@ data.uuid = this.uuid; const bones = this.bones; const boneInverses = this.boneInverses; - for (let i = 0, l = bones.length; i < l; i++) { const bone = bones[i]; data.bones.push(bone.uuid); const boneInverse = boneInverses[i]; data.boneInverses.push(boneInverse.toArray()); } - return data; } - } class InstancedBufferAttribute extends BufferAttribute { @@ -21847,36 +19236,27 @@ normalized = false; console.error('THREE.InstancedBufferAttribute: The constructor now expects normalized as the third argument.'); } - super(array, itemSize, normalized); this.meshPerAttribute = meshPerAttribute; } - copy(source) { super.copy(source); this.meshPerAttribute = source.meshPerAttribute; return this; } - toJSON() { const data = super.toJSON(); data.meshPerAttribute = this.meshPerAttribute; data.isInstancedBufferAttribute = true; return data; } - } - InstancedBufferAttribute.prototype.isInstancedBufferAttribute = true; const _instanceLocalMatrix = /*@__PURE__*/new Matrix4(); - const _instanceWorldMatrix = /*@__PURE__*/new Matrix4(); - const _instanceIntersects = []; - const _mesh = /*@__PURE__*/new Mesh(); - class InstancedMesh extends Mesh { constructor(geometry, material, count) { super(geometry, material); @@ -21885,7 +19265,6 @@ this.count = count; this.frustumCulled = false; } - copy(source) { super.copy(source); this.instanceMatrix.copy(source.instanceMatrix); @@ -21893,33 +19272,30 @@ this.count = source.count; return this; } - getColorAt(index, color) { color.fromArray(this.instanceColor.array, index * 3); } - getMatrixAt(index, matrix) { matrix.fromArray(this.instanceMatrix.array, index * 16); } - raycast(raycaster, intersects) { const matrixWorld = this.matrixWorld; const raycastTimes = this.count; _mesh.geometry = this.geometry; _mesh.material = this.material; if (_mesh.material === undefined) return; - for (let instanceId = 0; instanceId < raycastTimes; instanceId++) { // calculate the world matrix for each instance - this.getMatrixAt(instanceId, _instanceLocalMatrix); - _instanceWorldMatrix.multiplyMatrices(matrixWorld, _instanceLocalMatrix); // the mesh represents this single instance + this.getMatrixAt(instanceId, _instanceLocalMatrix); + _instanceWorldMatrix.multiplyMatrices(matrixWorld, _instanceLocalMatrix); + // the mesh represents this single instance _mesh.matrixWorld = _instanceWorldMatrix; + _mesh.raycast(raycaster, _instanceIntersects); - _mesh.raycast(raycaster, _instanceIntersects); // process the result of raycast - + // process the result of raycast for (let i = 0, l = _instanceIntersects.length; i < l; i++) { const intersect = _instanceIntersects[i]; @@ -21927,33 +19303,25 @@ intersect.object = this; intersects.push(intersect); } - _instanceIntersects.length = 0; } } - setColorAt(index, color) { if (this.instanceColor === null) { this.instanceColor = new InstancedBufferAttribute(new Float32Array(this.instanceMatrix.count * 3), 3); } - color.toArray(this.instanceColor.array, index * 3); } - setMatrixAt(index, matrix) { matrix.toArray(this.instanceMatrix.array, index * 16); } - updateMorphTargets() {} - dispose() { this.dispatchEvent({ type: 'dispose' }); } - } - InstancedMesh.prototype.isInstancedMesh = true; /** @@ -21977,7 +19345,6 @@ this.linejoin = 'round'; this.setValues(parameters); } - copy(source) { super.copy(source); this.color.copy(source.color); @@ -21986,21 +19353,14 @@ this.linejoin = source.linejoin; return this; } - } - LineBasicMaterial.prototype.isLineBasicMaterial = true; const _start$1 = /*@__PURE__*/new Vector3(); - const _end$1 = /*@__PURE__*/new Vector3(); - const _inverseMatrix$1 = /*@__PURE__*/new Matrix4(); - const _ray$1 = /*@__PURE__*/new Ray(); - const _sphere$1 = /*@__PURE__*/new Sphere(); - class Line extends Object3D { constructor(geometry = new BufferGeometry(), material = new LineBasicMaterial()) { super(); @@ -22009,32 +19369,26 @@ this.material = material; this.updateMorphTargets(); } - copy(source) { super.copy(source); this.material = source.material; this.geometry = source.geometry; return this; } - computeLineDistances() { const geometry = this.geometry; - if (geometry.isBufferGeometry) { // we assume non-indexed geometry + if (geometry.index === null) { const positionAttribute = geometry.attributes.position; const lineDistances = [0]; - for (let i = 1, l = positionAttribute.count; i < l; i++) { _start$1.fromBufferAttribute(positionAttribute, i - 1); - _end$1.fromBufferAttribute(positionAttribute, i); - lineDistances[i] = lineDistances[i - 1]; lineDistances[i] += _start$1.distanceTo(_end$1); } - geometry.setAttribute('lineDistance', new Float32BufferAttribute(lineDistances, 1)); } else { console.warn('THREE.Line.computeLineDistances(): Computation only possible with non-indexed BufferGeometry.'); @@ -22042,29 +19396,26 @@ } else if (geometry.isGeometry) { console.error('THREE.Line.computeLineDistances() no longer supports THREE.Geometry. Use THREE.BufferGeometry instead.'); } - return this; } - raycast(raycaster, intersects) { const geometry = this.geometry; const matrixWorld = this.matrixWorld; const threshold = raycaster.params.Line.threshold; - const drawRange = geometry.drawRange; // Checking boundingSphere distance to ray + const drawRange = geometry.drawRange; - if (geometry.boundingSphere === null) geometry.computeBoundingSphere(); + // Checking boundingSphere distance to ray + if (geometry.boundingSphere === null) geometry.computeBoundingSphere(); _sphere$1.copy(geometry.boundingSphere); - _sphere$1.applyMatrix4(matrixWorld); - _sphere$1.radius += threshold; - if (raycaster.ray.intersectsSphere(_sphere$1) === false) return; // + if (raycaster.ray.intersectsSphere(_sphere$1) === false) return; - _inverseMatrix$1.copy(matrixWorld).invert(); + // + _inverseMatrix$1.copy(matrixWorld).invert(); _ray$1.copy(raycaster.ray).applyMatrix4(_inverseMatrix$1); - const localThreshold = threshold / ((this.scale.x + this.scale.y + this.scale.z) / 3); const localThresholdSq = localThreshold * localThreshold; const vStart = new Vector3(); @@ -22072,24 +19423,19 @@ const interSegment = new Vector3(); const interRay = new Vector3(); const step = this.isLineSegments ? 2 : 1; - if (geometry.isBufferGeometry) { const index = geometry.index; const attributes = geometry.attributes; const positionAttribute = attributes.position; - if (index !== null) { const start = Math.max(0, drawRange.start); const end = Math.min(index.count, drawRange.start + drawRange.count); - for (let i = start, l = end - 1; i < l; i += step) { const a = index.getX(i); const b = index.getX(i + 1); vStart.fromBufferAttribute(positionAttribute, a); vEnd.fromBufferAttribute(positionAttribute, b); - const distSq = _ray$1.distanceSqToSegment(vStart, vEnd, interRay, interSegment); - if (distSq > localThresholdSq) continue; interRay.applyMatrix4(this.matrixWorld); //Move back to world space for distance calculation @@ -22109,13 +19455,10 @@ } else { const start = Math.max(0, drawRange.start); const end = Math.min(positionAttribute.count, drawRange.start + drawRange.count); - for (let i = start, l = end - 1; i < l; i += step) { vStart.fromBufferAttribute(positionAttribute, i); vEnd.fromBufferAttribute(positionAttribute, i + 1); - const distSq = _ray$1.distanceSqToSegment(vStart, vEnd, interRay, interSegment); - if (distSq > localThresholdSq) continue; interRay.applyMatrix4(this.matrixWorld); //Move back to world space for distance calculation @@ -22137,21 +19480,16 @@ console.error('THREE.Line.raycast() no longer supports THREE.Geometry. Use THREE.BufferGeometry instead.'); } } - updateMorphTargets() { const geometry = this.geometry; - if (geometry.isBufferGeometry) { const morphAttributes = geometry.morphAttributes; const keys = Object.keys(morphAttributes); - if (keys.length > 0) { const morphAttribute = morphAttributes[keys[0]]; - if (morphAttribute !== undefined) { this.morphTargetInfluences = []; this.morphTargetDictionary = {}; - for (let m = 0, ml = morphAttribute.length; m < ml; m++) { const name = morphAttribute[m].name || String(m); this.morphTargetInfluences.push(0); @@ -22161,45 +19499,35 @@ } } else { const morphTargets = geometry.morphTargets; - if (morphTargets !== undefined && morphTargets.length > 0) { console.error('THREE.Line.updateMorphTargets() does not support THREE.Geometry. Use THREE.BufferGeometry instead.'); } } } - } - Line.prototype.isLine = true; const _start = /*@__PURE__*/new Vector3(); - const _end = /*@__PURE__*/new Vector3(); - class LineSegments extends Line { constructor(geometry, material) { super(geometry, material); this.type = 'LineSegments'; } - computeLineDistances() { const geometry = this.geometry; - if (geometry.isBufferGeometry) { // we assume non-indexed geometry + if (geometry.index === null) { const positionAttribute = geometry.attributes.position; const lineDistances = []; - for (let i = 0, l = positionAttribute.count; i < l; i += 2) { _start.fromBufferAttribute(positionAttribute, i); - _end.fromBufferAttribute(positionAttribute, i + 1); - lineDistances[i] = i === 0 ? 0 : lineDistances[i - 1]; lineDistances[i + 1] = lineDistances[i] + _start.distanceTo(_end); } - geometry.setAttribute('lineDistance', new Float32BufferAttribute(lineDistances, 1)); } else { console.warn('THREE.LineSegments.computeLineDistances(): Computation only possible with non-indexed BufferGeometry.'); @@ -22207,12 +19535,9 @@ } else if (geometry.isGeometry) { console.error('THREE.LineSegments.computeLineDistances() no longer supports THREE.Geometry. Use THREE.BufferGeometry instead.'); } - return this; } - } - LineSegments.prototype.isLineSegments = true; class LineLoop extends Line { @@ -22220,9 +19545,7 @@ super(geometry, material); this.type = 'LineLoop'; } - } - LineLoop.prototype.isLineLoop = true; /** @@ -22249,7 +19572,6 @@ this.sizeAttenuation = true; this.setValues(parameters); } - copy(source) { super.copy(source); this.color.copy(source.color); @@ -22259,19 +19581,13 @@ this.sizeAttenuation = source.sizeAttenuation; return this; } - } - PointsMaterial.prototype.isPointsMaterial = true; const _inverseMatrix = /*@__PURE__*/new Matrix4(); - const _ray = /*@__PURE__*/new Ray(); - const _sphere = /*@__PURE__*/new Sphere(); - const _position$2 = /*@__PURE__*/new Vector3(); - class Points extends Object3D { constructor(geometry = new BufferGeometry(), material = new PointsMaterial()) { super(); @@ -22280,59 +19596,49 @@ this.material = material; this.updateMorphTargets(); } - copy(source) { super.copy(source); this.material = source.material; this.geometry = source.geometry; return this; } - raycast(raycaster, intersects) { const geometry = this.geometry; const matrixWorld = this.matrixWorld; const threshold = raycaster.params.Points.threshold; - const drawRange = geometry.drawRange; // Checking boundingSphere distance to ray + const drawRange = geometry.drawRange; - if (geometry.boundingSphere === null) geometry.computeBoundingSphere(); + // Checking boundingSphere distance to ray + if (geometry.boundingSphere === null) geometry.computeBoundingSphere(); _sphere.copy(geometry.boundingSphere); - _sphere.applyMatrix4(matrixWorld); - _sphere.radius += threshold; - if (raycaster.ray.intersectsSphere(_sphere) === false) return; // + if (raycaster.ray.intersectsSphere(_sphere) === false) return; - _inverseMatrix.copy(matrixWorld).invert(); + // + _inverseMatrix.copy(matrixWorld).invert(); _ray.copy(raycaster.ray).applyMatrix4(_inverseMatrix); - const localThreshold = threshold / ((this.scale.x + this.scale.y + this.scale.z) / 3); const localThresholdSq = localThreshold * localThreshold; - if (geometry.isBufferGeometry) { const index = geometry.index; const attributes = geometry.attributes; const positionAttribute = attributes.position; - if (index !== null) { const start = Math.max(0, drawRange.start); const end = Math.min(index.count, drawRange.start + drawRange.count); - for (let i = start, il = end; i < il; i++) { const a = index.getX(i); - _position$2.fromBufferAttribute(positionAttribute, a); - testPoint(_position$2, a, localThresholdSq, matrixWorld, raycaster, intersects, this); } } else { const start = Math.max(0, drawRange.start); const end = Math.min(positionAttribute.count, drawRange.start + drawRange.count); - for (let i = start, l = end; i < l; i++) { _position$2.fromBufferAttribute(positionAttribute, i); - testPoint(_position$2, i, localThresholdSq, matrixWorld, raycaster, intersects, this); } } @@ -22340,21 +19646,16 @@ console.error('THREE.Points.raycast() no longer supports THREE.Geometry. Use THREE.BufferGeometry instead.'); } } - updateMorphTargets() { const geometry = this.geometry; - if (geometry.isBufferGeometry) { const morphAttributes = geometry.morphAttributes; const keys = Object.keys(morphAttributes); - if (keys.length > 0) { const morphAttribute = morphAttributes[keys[0]]; - if (morphAttribute !== undefined) { this.morphTargetInfluences = []; this.morphTargetDictionary = {}; - for (let m = 0, ml = morphAttribute.length; m < ml; m++) { const name = morphAttribute[m].name || String(m); this.morphTargetInfluences.push(0); @@ -22364,25 +19665,18 @@ } } else { const morphTargets = geometry.morphTargets; - if (morphTargets !== undefined && morphTargets.length > 0) { console.error('THREE.Points.updateMorphTargets() does not support THREE.Geometry. Use THREE.BufferGeometry instead.'); } } } - } - Points.prototype.isPoints = true; - function testPoint(point, index, localThresholdSq, matrixWorld, raycaster, intersects, object) { const rayPointDistanceSq = _ray.distanceSqToPoint(point); - if (rayPointDistanceSq < localThresholdSq) { const intersectPoint = new Vector3(); - _ray.closestPointToPoint(point, intersectPoint); - intersectPoint.applyMatrix4(matrixWorld); const distance = raycaster.ray.origin.distanceTo(intersectPoint); if (distance < raycaster.near || distance > raycaster.far) return; @@ -22404,32 +19698,25 @@ this.magFilter = magFilter !== undefined ? magFilter : LinearFilter; this.generateMipmaps = false; const scope = this; - function updateVideo() { scope.needsUpdate = true; video.requestVideoFrameCallback(updateVideo); } - if ('requestVideoFrameCallback' in video) { video.requestVideoFrameCallback(updateVideo); } } - clone() { return new this.constructor(this.image).copy(this); } - update() { const video = this.image; - const hasVideoFrameCallback = ('requestVideoFrameCallback' in video); - + const hasVideoFrameCallback = 'requestVideoFrameCallback' in video; if (hasVideoFrameCallback === false && video.readyState >= video.HAVE_CURRENT_DATA) { this.needsUpdate = true; } } - } - VideoTexture.prototype.isVideoTexture = true; class FramebufferTexture extends Texture { @@ -22444,9 +19731,7 @@ this.generateMipmaps = false; this.needsUpdate = true; } - } - FramebufferTexture.prototype.isFramebufferTexture = true; class CompressedTexture extends Texture { @@ -22456,17 +19741,19 @@ width: width, height: height }; - this.mipmaps = mipmaps; // no flipping for cube textures + this.mipmaps = mipmaps; + + // no flipping for cube textures // (also flipping doesn't work for compressed textures ) - this.flipY = false; // can't generate mipmaps for compressed textures + this.flipY = false; + + // can't generate mipmaps for compressed textures // mips must be embedded in DDS files this.generateMipmaps = false; } - } - CompressedTexture.prototype.isCompressedTexture = true; class CanvasTexture extends Texture { @@ -22474,21 +19761,18 @@ super(canvas, mapping, wrapS, wrapT, magFilter, minFilter, format, type, anisotropy); this.needsUpdate = true; } - } - CanvasTexture.prototype.isCanvasTexture = true; // A External 2d texture is a 2d texture that's created out of three.js. // We have no control over it's type, format, parameters, etc..., // and can only use it as a shader uniform. + class ExternalTexture2D { constructor() { this.webglTexture = null; } - } - ExternalTexture2D.prototype.isExternalTexture2D = true; class CircleGeometry extends BufferGeometry { @@ -22501,50 +19785,61 @@ thetaStart: thetaStart, thetaLength: thetaLength }; - segments = Math.max(3, segments); // buffers + segments = Math.max(3, segments); + + // buffers const indices = []; const vertices = []; const normals = []; - const uvs = []; // helper variables + const uvs = []; + + // helper variables const vertex = new Vector3(); - const uv = new Vector2(); // center point + const uv = new Vector2(); + + // center point vertices.push(0, 0, 0); normals.push(0, 0, 1); uvs.push(0.5, 0.5); - for (let s = 0, i = 3; s <= segments; s++, i += 3) { - const segment = thetaStart + s / segments * thetaLength; // vertex + const segment = thetaStart + s / segments * thetaLength; + + // vertex vertex.x = radius * Math.cos(segment); vertex.y = radius * Math.sin(segment); - vertices.push(vertex.x, vertex.y, vertex.z); // normal + vertices.push(vertex.x, vertex.y, vertex.z); + + // normal - normals.push(0, 0, 1); // uvs + normals.push(0, 0, 1); + + // uvs uv.x = (vertices[i] / radius + 1) / 2; uv.y = (vertices[i + 1] / radius + 1) / 2; uvs.push(uv.x, uv.y); - } // indices + } + // indices for (let i = 1; i <= segments; i++) { indices.push(i, i + 1, 0); - } // build geometry + } + // build geometry this.setIndex(indices); this.setAttribute('position', new Float32BufferAttribute(vertices, 3)); this.setAttribute('normal', new Float32BufferAttribute(normals, 3)); this.setAttribute('uv', new Float32BufferAttribute(uvs, 2)); } - static fromJSON(data) { return new CircleGeometry(data.radius, data.segments, data.thetaStart, data.thetaLength); } - } class CylinderGeometry extends BufferGeometry { @@ -22563,89 +19858,115 @@ }; const scope = this; radialSegments = Math.floor(radialSegments); - heightSegments = Math.floor(heightSegments); // buffers + heightSegments = Math.floor(heightSegments); + + // buffers const indices = []; const vertices = []; const normals = []; - const uvs = []; // helper variables + const uvs = []; + + // helper variables let index = 0; const indexArray = []; const halfHeight = height / 2; - let groupStart = 0; // generate geometry + let groupStart = 0; - generateTorso(); + // generate geometry + generateTorso(); if (openEnded === false) { if (radiusTop > 0) generateCap(true); if (radiusBottom > 0) generateCap(false); - } // build geometry + } + // build geometry this.setIndex(indices); this.setAttribute('position', new Float32BufferAttribute(vertices, 3)); this.setAttribute('normal', new Float32BufferAttribute(normals, 3)); this.setAttribute('uv', new Float32BufferAttribute(uvs, 2)); - function generateTorso() { const normal = new Vector3(); const vertex = new Vector3(); - let groupCount = 0; // this will be used to calculate the normal + let groupCount = 0; + + // this will be used to calculate the normal + const slope = (radiusBottom - radiusTop) / height; - const slope = (radiusBottom - radiusTop) / height; // generate vertices, normals and uvs + // generate vertices, normals and uvs for (let y = 0; y <= heightSegments; y++) { const indexRow = []; - const v = y / heightSegments; // calculate the radius of the current row + const v = y / heightSegments; - const radius = v * (radiusBottom - radiusTop) + radiusTop; + // calculate the radius of the current row + const radius = v * (radiusBottom - radiusTop) + radiusTop; for (let x = 0; x <= radialSegments; x++) { const u = x / radialSegments; const theta = u * thetaLength + thetaStart; const sinTheta = Math.sin(theta); - const cosTheta = Math.cos(theta); // vertex + const cosTheta = Math.cos(theta); + + // vertex vertex.x = radius * sinTheta; vertex.y = -v * height + halfHeight; vertex.z = radius * cosTheta; - vertices.push(vertex.x, vertex.y, vertex.z); // normal + vertices.push(vertex.x, vertex.y, vertex.z); + + // normal normal.set(sinTheta, slope, cosTheta).normalize(); - normals.push(normal.x, normal.y, normal.z); // uv + normals.push(normal.x, normal.y, normal.z); + + // uv + + uvs.push(u, 1 - v); - uvs.push(u, 1 - v); // save index of vertex in respective row + // save index of vertex in respective row indexRow.push(index++); - } // now save vertices of the row in our index array + } + // now save vertices of the row in our index array indexArray.push(indexRow); - } // generate indices + } + // generate indices for (let x = 0; x < radialSegments; x++) { for (let y = 0; y < heightSegments; y++) { // we use the index array to access the correct indices + const a = indexArray[y][x]; const b = indexArray[y + 1][x]; const c = indexArray[y + 1][x + 1]; - const d = indexArray[y][x + 1]; // faces + const d = indexArray[y][x + 1]; + + // faces indices.push(a, b, d); - indices.push(b, c, d); // update group counter + indices.push(b, c, d); + + // update group counter groupCount += 6; } - } // add a group to the geometry. this will ensure multi material support + } + // add a group to the geometry. this will ensure multi material support - scope.addGroup(groupStart, groupCount, 0); // calculate new start value for groups + scope.addGroup(groupStart, groupCount, 0); + + // calculate new start value for groups groupStart += groupCount; } - function generateCap(top) { // save the index of the first center vertex const centerIndexStart = index; @@ -22653,71 +19974,92 @@ const vertex = new Vector3(); let groupCount = 0; const radius = top === true ? radiusTop : radiusBottom; - const sign = top === true ? 1 : -1; // first we generate the center vertex data of the cap. + const sign = top === true ? 1 : -1; + + // first we generate the center vertex data of the cap. // because the geometry needs one set of uvs per face, // we must generate a center vertex per face/segment for (let x = 1; x <= radialSegments; x++) { // vertex - vertices.push(0, halfHeight * sign, 0); // normal - normals.push(0, sign, 0); // uv + vertices.push(0, halfHeight * sign, 0); + + // normal - uvs.push(0.5, 0.5); // increase index + normals.push(0, sign, 0); + + // uv + + uvs.push(0.5, 0.5); + + // increase index index++; - } // save the index of the last center vertex + } + // save the index of the last center vertex + const centerIndexEnd = index; - const centerIndexEnd = index; // now we generate the surrounding vertices, normals and uvs + // now we generate the surrounding vertices, normals and uvs for (let x = 0; x <= radialSegments; x++) { const u = x / radialSegments; const theta = u * thetaLength + thetaStart; const cosTheta = Math.cos(theta); - const sinTheta = Math.sin(theta); // vertex + const sinTheta = Math.sin(theta); + + // vertex vertex.x = radius * sinTheta; vertex.y = halfHeight * sign; vertex.z = radius * cosTheta; - vertices.push(vertex.x, vertex.y, vertex.z); // normal + vertices.push(vertex.x, vertex.y, vertex.z); + + // normal - normals.push(0, sign, 0); // uv + normals.push(0, sign, 0); + + // uv uv.x = cosTheta * 0.5 + 0.5; uv.y = sinTheta * 0.5 * sign + 0.5; - uvs.push(uv.x, uv.y); // increase index + uvs.push(uv.x, uv.y); + + // increase index index++; - } // generate indices + } + // generate indices for (let x = 0; x < radialSegments; x++) { const c = centerIndexStart + x; const i = centerIndexEnd + x; - if (top === true) { // face top + indices.push(i, i + 1, c); } else { // face bottom + indices.push(i + 1, i, c); } - groupCount += 3; - } // add a group to the geometry. this will ensure multi material support + } + + // add a group to the geometry. this will ensure multi material support + scope.addGroup(groupStart, groupCount, top === true ? 1 : 2); - scope.addGroup(groupStart, groupCount, top === true ? 1 : 2); // calculate new start value for groups + // calculate new start value for groups groupStart += groupCount; } } - static fromJSON(data) { return new CylinderGeometry(data.radiusTop, data.radiusBottom, data.height, data.radialSegments, data.heightSegments, data.openEnded, data.thetaStart, data.thetaLength); } - } class ConeGeometry extends CylinderGeometry { @@ -22734,11 +20076,9 @@ thetaLength: thetaLength }; } - static fromJSON(data) { return new ConeGeometry(data.radius, data.height, data.radialSegments, data.heightSegments, data.openEnded, data.thetaStart, data.thetaLength); } - } class PolyhedronGeometry extends BufferGeometry { @@ -22750,54 +20090,71 @@ indices: indices, radius: radius, detail: detail - }; // default buffer data + }; + + // default buffer data const vertexBuffer = []; - const uvBuffer = []; // the subdivision creates the vertex buffer data + const uvBuffer = []; + + // the subdivision creates the vertex buffer data - subdivide(detail); // all vertices should lie on a conceptual sphere with a given radius + subdivide(detail); - applyRadius(radius); // finally, create the uv data + // all vertices should lie on a conceptual sphere with a given radius - generateUVs(); // build non-indexed geometry + applyRadius(radius); + + // finally, create the uv data + + generateUVs(); + + // build non-indexed geometry this.setAttribute('position', new Float32BufferAttribute(vertexBuffer, 3)); this.setAttribute('normal', new Float32BufferAttribute(vertexBuffer.slice(), 3)); this.setAttribute('uv', new Float32BufferAttribute(uvBuffer, 2)); - if (detail === 0) { this.computeVertexNormals(); // flat normals } else { this.normalizeNormals(); // smooth normals - } // helper functions + } + // helper functions function subdivide(detail) { const a = new Vector3(); const b = new Vector3(); - const c = new Vector3(); // iterate over all faces and apply a subdivison with the given detail value + const c = new Vector3(); + + // iterate over all faces and apply a subdivison with the given detail value for (let i = 0; i < indices.length; i += 3) { // get the vertices of the face + getVertexByIndex(indices[i + 0], a); getVertexByIndex(indices[i + 1], b); - getVertexByIndex(indices[i + 2], c); // perform subdivision + getVertexByIndex(indices[i + 2], c); + + // perform subdivision subdivideFace(a, b, c, detail); } } - function subdivideFace(a, b, c, detail) { - const cols = detail + 1; // we use this multidimensional array as a data structure for creating the subdivision + const cols = detail + 1; - const v = []; // construct all of the vertices for this subdivision + // we use this multidimensional array as a data structure for creating the subdivision + + const v = []; + + // construct all of the vertices for this subdivision for (let i = 0; i <= cols; i++) { v[i] = []; const aj = a.clone().lerp(c, i / cols); const bj = b.clone().lerp(c, i / cols); const rows = cols - i; - for (let j = 0; j <= rows; j++) { if (j === 0 && i === cols) { v[i][j] = aj; @@ -22805,13 +20162,13 @@ v[i][j] = aj.clone().lerp(bj, j / rows); } } - } // construct all of the faces + } + // construct all of the faces for (let i = 0; i < cols; i++) { for (let j = 0; j < 2 * (cols - i) - 1; j++) { const k = Math.floor(j / 2); - if (j % 2 === 0) { pushVertex(v[i][k + 1]); pushVertex(v[i + 1][k]); @@ -22824,9 +20181,10 @@ } } } - function applyRadius(radius) { - const vertex = new Vector3(); // iterate over the entire buffer and apply the radius to each vertex + const vertex = new Vector3(); + + // iterate over the entire buffer and apply the radius to each vertex for (let i = 0; i < vertexBuffer.length; i += 3) { vertex.x = vertexBuffer[i + 0]; @@ -22838,10 +20196,8 @@ vertexBuffer[i + 2] = vertex.z; } } - function generateUVs() { const vertex = new Vector3(); - for (let i = 0; i < vertexBuffer.length; i += 3) { vertex.x = vertexBuffer[i + 0]; vertex.y = vertexBuffer[i + 1]; @@ -22850,20 +20206,22 @@ const v = inclination(vertex) / Math.PI + 0.5; uvBuffer.push(u, 1 - v); } - correctUVs(); correctSeam(); } - function correctSeam() { // handle case when face straddles the seam, see #3269 + for (let i = 0; i < uvBuffer.length; i += 6) { // uv data of a single face + const x0 = uvBuffer[i + 0]; const x1 = uvBuffer[i + 2]; const x2 = uvBuffer[i + 4]; const max = Math.max(x0, x1, x2); - const min = Math.min(x0, x1, x2); // 0.9 is somewhat arbitrary + const min = Math.min(x0, x1, x2); + + // 0.9 is somewhat arbitrary if (max > 0.9 && min < 0.1) { if (x0 < 0.2) uvBuffer[i + 0] += 1; @@ -22872,18 +20230,15 @@ } } } - function pushVertex(vertex) { vertexBuffer.push(vertex.x, vertex.y, vertex.z); } - function getVertexByIndex(index, vertex) { const stride = index * 3; vertex.x = vertices[stride + 0]; vertex.y = vertices[stride + 1]; vertex.z = vertices[stride + 2]; } - function correctUVs() { const a = new Vector3(); const b = new Vector3(); @@ -22892,7 +20247,6 @@ const uvA = new Vector2(); const uvB = new Vector2(); const uvC = new Vector2(); - for (let i = 0, j = 0; i < vertexBuffer.length; i += 9, j += 6) { a.set(vertexBuffer[i + 0], vertexBuffer[i + 1], vertexBuffer[i + 2]); b.set(vertexBuffer[i + 3], vertexBuffer[i + 4], vertexBuffer[i + 5]); @@ -22907,42 +20261,44 @@ correctUV(uvC, j + 4, c, azi); } } - function correctUV(uv, stride, vector, azimuth) { if (azimuth < 0 && uv.x === 1) { uvBuffer[stride] = uv.x - 1; } - if (vector.x === 0 && vector.z === 0) { uvBuffer[stride] = azimuth / 2 / Math.PI + 0.5; } - } // Angle around the Y axis, counter-clockwise when looking from above. + } + // Angle around the Y axis, counter-clockwise when looking from above. function azimuth(vector) { return Math.atan2(vector.z, -vector.x); - } // Angle above the XZ plane. + } + // Angle above the XZ plane. function inclination(vector) { return Math.atan2(-vector.y, Math.sqrt(vector.x * vector.x + vector.z * vector.z)); } } - static fromJSON(data) { return new PolyhedronGeometry(data.vertices, data.indices, data.radius, data.details); } - } class DodecahedronGeometry extends PolyhedronGeometry { constructor(radius = 1, detail = 0) { const t = (1 + Math.sqrt(5)) / 2; const r = 1 / t; - const vertices = [// (±1, ±1, ±1) - -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, ±1/φ, ±φ) - 0, -r, -t, 0, -r, t, 0, r, -t, 0, r, t, // (±1/φ, ±φ, 0) - -r, -t, 0, -r, t, 0, r, -t, 0, r, t, 0, // (±φ, 0, ±1/φ) + const vertices = [ + // (±1, ±1, ±1) + -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, ±1/φ, ±φ) + 0, -r, -t, 0, -r, t, 0, r, -t, 0, r, t, + // (±1/φ, ±φ, 0) + -r, -t, 0, -r, t, 0, r, -t, 0, r, t, 0, + // (±φ, 0, ±1/φ) -t, 0, -r, t, 0, -r, -t, 0, r, t, 0, r]; const indices = [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]; super(vertices, indices, radius, detail); @@ -22952,21 +20308,15 @@ detail: detail }; } - static fromJSON(data) { return new DodecahedronGeometry(data.radius, data.detail); } - } const _v0 = new Vector3(); - const _v1$1 = new Vector3(); - const _normal = new Vector3(); - const _triangle = new Triangle(); - class EdgesGeometry extends BufferGeometry { constructor(geometry = null, thresholdAngle = 1) { super(); @@ -22975,7 +20325,6 @@ geometry: geometry, thresholdAngle: thresholdAngle }; - if (geometry !== null) { const precisionPoints = 4; const precision = Math.pow(10, precisionPoints); @@ -22988,7 +20337,6 @@ const hashes = new Array(3); const edgeData = {}; const vertices = []; - for (let i = 0; i < indexCount; i += 3) { if (indexAttr) { indexArr[0] = indexAttr.getX(i); @@ -22999,7 +20347,6 @@ indexArr[1] = i + 1; indexArr[2] = i + 2; } - const { a, b, @@ -23008,19 +20355,19 @@ a.fromBufferAttribute(positionAttr, indexArr[0]); b.fromBufferAttribute(positionAttr, indexArr[1]); c.fromBufferAttribute(positionAttr, indexArr[2]); + _triangle.getNormal(_normal); - _triangle.getNormal(_normal); // create hashes for the edge from the vertices - - + // create hashes for the edge from the vertices hashes[0] = `${Math.round(a.x * precision)},${Math.round(a.y * precision)},${Math.round(a.z * precision)}`; hashes[1] = `${Math.round(b.x * precision)},${Math.round(b.y * precision)},${Math.round(b.z * precision)}`; - hashes[2] = `${Math.round(c.x * precision)},${Math.round(c.y * precision)},${Math.round(c.z * precision)}`; // skip degenerate triangles + hashes[2] = `${Math.round(c.x * precision)},${Math.round(c.y * precision)},${Math.round(c.z * precision)}`; + // skip degenerate triangles if (hashes[0] === hashes[1] || hashes[1] === hashes[2] || hashes[2] === hashes[0]) { continue; - } // iterate over every edge - + } + // iterate over every edge for (let j = 0; j < 3; j++) { // get the first and next vertex making up the edge const jNext = (j + 1) % 3; @@ -23030,7 +20377,6 @@ const v1 = _triangle[vertKeys[jNext]]; const hash = `${vecHash0}_${vecHash1}`; const reverseHash = `${vecHash1}_${vecHash0}`; - if (reverseHash in edgeData && edgeData[reverseHash]) { // if we found a sibling edge add it into the vertex array if // it meets the angle threshold and delete the edge from the map. @@ -23038,7 +20384,6 @@ vertices.push(v0.x, v0.y, v0.z); vertices.push(v1.x, v1.y, v1.z); } - edgeData[reverseHash] = null; } else if (!(hash in edgeData)) { // if we've already got an edge here then skip adding a new one @@ -23049,29 +20394,24 @@ }; } } - } // iterate over all remaining, unmatched edges and add them to the vertex array - + } + // iterate over all remaining, unmatched edges and add them to the vertex array for (const key in edgeData) { if (edgeData[key]) { const { index0, index1 } = edgeData[key]; - _v0.fromBufferAttribute(positionAttr, index0); - _v1$1.fromBufferAttribute(positionAttr, index1); - vertices.push(_v0.x, _v0.y, _v0.z); vertices.push(_v1$1.x, _v1$1.y, _v1$1.z); } } - this.setAttribute('position', new Float32BufferAttribute(vertices, 3)); } } - } /** @@ -23108,79 +20448,79 @@ constructor() { this.type = 'Curve'; this.arcLengthDivisions = 200; - } // Virtual base class method to overwrite and implement in subclasses - // - t [0 .. 1] + } + // Virtual base class method to overwrite and implement in subclasses + // - t [0 .. 1] - getPoint() { + getPoint(/* t, optionalTarget */ + ) { console.warn('THREE.Curve: .getPoint() not implemented.'); return null; - } // Get point at relative position in curve according to arc length - // - u [0 .. 1] + } + // Get point at relative position in curve according to arc length + // - u [0 .. 1] getPointAt(u, optionalTarget) { const t = this.getUtoTmapping(u); return this.getPoint(t, optionalTarget); - } // Get sequence of points using getPoint( t ) + } + // Get sequence of points using getPoint( t ) getPoints(divisions = 5) { const points = []; - for (let d = 0; d <= divisions; d++) { points.push(this.getPoint(d / divisions)); } - return points; - } // Get sequence of points using getPointAt( u ) + } + // Get sequence of points using getPointAt( u ) getSpacedPoints(divisions = 5) { const points = []; - for (let d = 0; d <= divisions; d++) { points.push(this.getPointAt(d / divisions)); } - return points; - } // Get total curve arc length + } + // Get total curve arc length getLength() { const lengths = this.getLengths(); return lengths[lengths.length - 1]; - } // Get list of cumulative segment lengths + } + // Get list of cumulative segment lengths getLengths(divisions = this.arcLengthDivisions) { if (this.cacheArcLengths && this.cacheArcLengths.length === divisions + 1 && !this.needsUpdate) { return this.cacheArcLengths; } - this.needsUpdate = false; const cache = []; let current, - last = this.getPoint(0); + last = this.getPoint(0); let sum = 0; cache.push(0); - for (let p = 1; p <= divisions; p++) { current = this.getPoint(p / divisions); sum += current.distanceTo(last); cache.push(sum); last = current; } - this.cacheArcLengths = cache; return cache; // { sums: cache, sum: sum }; Sum is in the last element. } - updateArcLengths() { this.needsUpdate = true; this.getLengths(); - } // Given u ( 0 .. 1 ), get a t to find p. This gives you points which are equidistant + } + // Given u ( 0 .. 1 ), get a t to find p. This gives you points which are equidistant getUtoTmapping(u, distance) { const arcLengths = this.getLengths(); @@ -23192,53 +20532,60 @@ targetArcLength = distance; } else { targetArcLength = u * arcLengths[il - 1]; - } // binary search for the index with largest value smaller than target u distance + } + // binary search for the index with largest value smaller than target u distance let low = 0, - high = il - 1, - comparison; - + high = il - 1, + comparison; while (low <= high) { i = Math.floor(low + (high - low) / 2); // less likely to overflow, though probably not issue here, JS doesn't really have integers, all numbers are floats comparison = arcLengths[i] - targetArcLength; - if (comparison < 0) { low = i + 1; } else if (comparison > 0) { high = i - 1; } else { high = i; - break; // DONE + break; + + // DONE } } - i = high; - if (arcLengths[i] === targetArcLength) { return i / (il - 1); - } // we could get finer grain at lengths, or use simple interpolation between two points + } + // we could get finer grain at lengths, or use simple interpolation between two points const lengthBefore = arcLengths[i]; const lengthAfter = arcLengths[i + 1]; - const segmentLength = lengthAfter - lengthBefore; // determine where we are between the 'before' and 'after' points + const segmentLength = lengthAfter - lengthBefore; + + // determine where we are between the 'before' and 'after' points - const segmentFraction = (targetArcLength - lengthBefore) / segmentLength; // add that fractional amount to t + const segmentFraction = (targetArcLength - lengthBefore) / segmentLength; + + // add that fractional amount to t const t = (i + segmentFraction) / (il - 1); return t; - } // Returns a unit vector tangent at t + } + + // Returns a unit vector tangent at t // In case any sub curve does not implement its tangent derivation, // 2 points a small delta apart will be used to find its gradient // which seems to give a reasonable approximation - getTangent(t, optionalTarget) { const delta = 0.0001; let t1 = t - delta; - let t2 = t + delta; // Capping in case of danger + let t2 = t + delta; + + // Capping in case of danger if (t1 < 0) t1 = 0; if (t2 > 1) t2 = 1; @@ -23248,27 +20595,29 @@ tangent.copy(pt2).sub(pt1).normalize(); return tangent; } - getTangentAt(u, optionalTarget) { const t = this.getUtoTmapping(u); return this.getTangent(t, optionalTarget); } - computeFrenetFrames(segments, closed) { // see http://www.cs.indiana.edu/pub/techreports/TR425.pdf + const normal = new Vector3(); const tangents = []; const normals = []; const binormals = []; const vec = new Vector3(); - const mat = new Matrix4(); // compute the tangent vectors for each segment on the curve + const mat = new Matrix4(); + + // compute the tangent vectors for each segment on the curve for (let i = 0; i <= segments; i++) { const u = i / segments; tangents[i] = this.getTangentAt(u, new Vector3()); - } // select an initial normal vector perpendicular to the first tangent vector, - // and in the direction of the minimum tangent xyz component + } + // select an initial normal vector perpendicular to the first tangent vector, + // and in the direction of the minimum tangent xyz component normals[0] = new Vector3(); binormals[0] = new Vector3(); @@ -23276,72 +20625,63 @@ const tx = Math.abs(tangents[0].x); const ty = Math.abs(tangents[0].y); const tz = Math.abs(tangents[0].z); - if (tx <= min) { min = tx; normal.set(1, 0, 0); } - if (ty <= min) { min = ty; normal.set(0, 1, 0); } - if (tz <= min) { normal.set(0, 0, 1); } - vec.crossVectors(tangents[0], normal).normalize(); normals[0].crossVectors(tangents[0], vec); - binormals[0].crossVectors(tangents[0], normals[0]); // compute the slowly-varying normal and binormal vectors for each segment on the curve + binormals[0].crossVectors(tangents[0], normals[0]); + + // compute the slowly-varying normal and binormal vectors for each segment on the curve for (let i = 1; i <= segments; i++) { normals[i] = normals[i - 1].clone(); binormals[i] = binormals[i - 1].clone(); vec.crossVectors(tangents[i - 1], tangents[i]); - if (vec.length() > Number.EPSILON) { vec.normalize(); const theta = Math.acos(clamp(tangents[i - 1].dot(tangents[i]), -1, 1)); // clamp for floating pt errors normals[i].applyMatrix4(mat.makeRotationAxis(vec, theta)); } - binormals[i].crossVectors(tangents[i], normals[i]); - } // if the curve is closed, postprocess the vectors so the first and last normal vectors are the same + } + // if the curve is closed, postprocess the vectors so the first and last normal vectors are the same if (closed === true) { let theta = Math.acos(clamp(normals[0].dot(normals[segments]), -1, 1)); theta /= segments; - if (tangents[0].dot(vec.crossVectors(normals[0], normals[segments])) > 0) { theta = -theta; } - for (let i = 1; i <= segments; i++) { // twist a little... normals[i].applyMatrix4(mat.makeRotationAxis(tangents[i], theta * i)); binormals[i].crossVectors(tangents[i], normals[i]); } } - return { tangents: tangents, normals: normals, binormals: binormals }; } - clone() { return new this.constructor().copy(this); } - copy(source) { this.arcLengthDivisions = source.arcLengthDivisions; return this; } - toJSON() { const data = { metadata: { @@ -23354,12 +20694,10 @@ data.type = this.type; return data; } - fromJSON(json) { this.arcLengthDivisions = json.arcLengthDivisions; return this; } - } class EllipseCurve extends Curve { @@ -23375,17 +20713,15 @@ this.aClockwise = aClockwise; this.aRotation = aRotation; } - getPoint(t, optionalTarget) { const point = optionalTarget || new Vector2(); const twoPi = Math.PI * 2; let deltaAngle = this.aEndAngle - this.aStartAngle; - const samePoints = Math.abs(deltaAngle) < Number.EPSILON; // ensures that deltaAngle is 0 .. 2 PI + const samePoints = Math.abs(deltaAngle) < Number.EPSILON; + // ensures that deltaAngle is 0 .. 2 PI while (deltaAngle < 0) deltaAngle += twoPi; - while (deltaAngle > twoPi) deltaAngle -= twoPi; - if (deltaAngle < Number.EPSILON) { if (samePoints) { deltaAngle = 0; @@ -23393,7 +20729,6 @@ deltaAngle = twoPi; } } - if (this.aClockwise === true && !samePoints) { if (deltaAngle === twoPi) { deltaAngle = -twoPi; @@ -23401,24 +20736,21 @@ deltaAngle = deltaAngle - twoPi; } } - const angle = this.aStartAngle + t * deltaAngle; let x = this.aX + this.xRadius * Math.cos(angle); let y = this.aY + this.yRadius * Math.sin(angle); - if (this.aRotation !== 0) { const cos = Math.cos(this.aRotation); const sin = Math.sin(this.aRotation); const tx = x - this.aX; - const ty = y - this.aY; // Rotate the point about the center of the ellipse. + const ty = y - this.aY; + // Rotate the point about the center of the ellipse. x = tx * cos - ty * sin + this.aX; y = tx * sin + ty * cos + this.aY; } - return point.set(x, y); } - copy(source) { super.copy(source); this.aX = source.aX; @@ -23431,7 +20763,6 @@ this.aRotation = source.aRotation; return this; } - toJSON() { const data = super.toJSON(); data.aX = this.aX; @@ -23444,7 +20775,6 @@ data.aRotation = this.aRotation; return data; } - fromJSON(json) { super.fromJSON(json); this.aX = json.aX; @@ -23457,9 +20787,7 @@ this.aRotation = json.aRotation; return this; } - } - EllipseCurve.prototype.isEllipseCurve = true; class ArcCurve extends EllipseCurve { @@ -23467,9 +20795,7 @@ super(aX, aY, aRadius, aRadius, aStartAngle, aEndAngle, aClockwise); this.type = 'ArcCurve'; } - } - ArcCurve.prototype.isArcCurve = true; /** @@ -23493,9 +20819,10 @@ function CubicPoly() { let c0 = 0, - c1 = 0, - c2 = 0, - c3 = 0; + c1 = 0, + c2 = 0, + c3 = 0; + /* * Compute coefficients for a cubic polynomial * p(s) = c0 + c1*s + c2*s^2 + c3*s^3 @@ -23504,14 +20831,12 @@ * and * p'(0) = t0, p'(1) = t1. */ - function init(x0, x1, t0, t1) { c0 = x0; c1 = t0; c2 = -3 * x0 + 3 * x1 - 2 * t0 - t1; c3 = 2 * x0 - 2 * x1 + t0 + t1; } - return { initCatmullRom: function (x0, x1, x2, x3, tension) { init(x1, x2, tension * (x2 - x0), tension * (x3 - x1)); @@ -23519,8 +20844,9 @@ initNonuniformCatmullRom: function (x0, x1, x2, x3, dt0, dt1, dt2) { // compute tangents when parameterized in [t1,t2] let t1 = (x1 - x0) / dt0 - (x2 - x0) / (dt0 + dt1) + (x2 - x1) / dt1; - let t2 = (x2 - x1) / dt1 - (x3 - x1) / (dt1 + dt2) + (x3 - x2) / dt2; // rescale tangents for parametrization in [0,1] + let t2 = (x2 - x1) / dt1 - (x3 - x1) / (dt1 + dt2) + (x3 - x2) / dt2; + // rescale tangents for parametrization in [0,1] t1 *= dt1; t2 *= dt1; init(x1, x2, t1, t2); @@ -23531,14 +20857,14 @@ return c0 + c1 * t + c2 * t2 + c3 * t3; } }; - } // + } + // const tmp = new Vector3(); const px = new CubicPoly(), - py = new CubicPoly(), - pz = new CubicPoly(); - + py = new CubicPoly(), + pz = new CubicPoly(); class CatmullRomCurve3 extends Curve { constructor(points = [], closed = false, curveType = 'centripetal', tension = 0.5) { super(); @@ -23548,7 +20874,6 @@ this.curveType = curveType; this.tension = tension; } - getPoint(t, optionalTarget = new Vector3()) { const point = optionalTarget; const points = this.points; @@ -23556,14 +20881,12 @@ const p = (l - (this.closed ? 0 : 1)) * t; let intPoint = Math.floor(p); let weight = p - intPoint; - if (this.closed) { intPoint += intPoint > 0 ? 0 : (Math.floor(Math.abs(intPoint) / l) + 1) * l; } else if (weight === 0 && intPoint === l - 1) { intPoint = l - 2; weight = 1; } - let p0, p3; // 4 points (p1 & p2 defined below) if (this.closed || intPoint > 0) { @@ -23573,10 +20896,8 @@ tmp.subVectors(points[0], points[1]).add(points[0]); p0 = tmp; } - const p1 = points[intPoint % l]; const p2 = points[(intPoint + 1) % l]; - if (this.closed || intPoint + 2 < l) { p3 = points[(intPoint + 2) % l]; } else { @@ -23584,14 +20905,14 @@ tmp.subVectors(points[l - 1], points[l - 2]).add(points[l - 1]); p3 = tmp; } - if (this.curveType === 'centripetal' || this.curveType === 'chordal') { // init Centripetal / Chordal Catmull-Rom const pow = this.curveType === 'chordal' ? 0.5 : 0.25; let dt0 = Math.pow(p0.distanceToSquared(p1), pow); let dt1 = Math.pow(p1.distanceToSquared(p2), pow); - let dt2 = Math.pow(p2.distanceToSquared(p3), pow); // safety check for repeated points + let dt2 = Math.pow(p2.distanceToSquared(p3), pow); + // safety check for repeated points if (dt1 < 1e-4) dt1 = 1.0; if (dt0 < 1e-4) dt0 = dt1; if (dt2 < 1e-4) dt2 = dt1; @@ -23603,109 +20924,93 @@ py.initCatmullRom(p0.y, p1.y, p2.y, p3.y, this.tension); pz.initCatmullRom(p0.z, p1.z, p2.z, p3.z, this.tension); } - point.set(px.calc(weight), py.calc(weight), pz.calc(weight)); return point; } - copy(source) { super.copy(source); this.points = []; - for (let i = 0, l = source.points.length; i < l; i++) { const point = source.points[i]; this.points.push(point.clone()); } - this.closed = source.closed; this.curveType = source.curveType; this.tension = source.tension; return this; } - toJSON() { const data = super.toJSON(); data.points = []; - for (let i = 0, l = this.points.length; i < l; i++) { const point = this.points[i]; data.points.push(point.toArray()); } - data.closed = this.closed; data.curveType = this.curveType; data.tension = this.tension; return data; } - fromJSON(json) { super.fromJSON(json); this.points = []; - for (let i = 0, l = json.points.length; i < l; i++) { const point = json.points[i]; this.points.push(new Vector3().fromArray(point)); } - this.closed = json.closed; this.curveType = json.curveType; this.tension = json.tension; return this; } - } - CatmullRomCurve3.prototype.isCatmullRomCurve3 = true; /** * Bezier Curves formulas obtained from * https://en.wikipedia.org/wiki/B%C3%A9zier_curve */ + function CatmullRom(t, p0, p1, p2, p3) { const v0 = (p2 - p0) * 0.5; const v1 = (p3 - p1) * 0.5; const t2 = t * t; const t3 = t * t2; return (2 * p1 - 2 * p2 + v0 + v1) * t3 + (-3 * p1 + 3 * p2 - 2 * v0 - v1) * t2 + v0 * t + p1; - } // + } + // function QuadraticBezierP0(t, p) { const k = 1 - t; return k * k * p; } - function QuadraticBezierP1(t, p) { return 2 * (1 - t) * t * p; } - function QuadraticBezierP2(t, p) { return t * t * p; } - function QuadraticBezier(t, p0, p1, p2) { return QuadraticBezierP0(t, p0) + QuadraticBezierP1(t, p1) + QuadraticBezierP2(t, p2); - } // + } + // function CubicBezierP0(t, p) { const k = 1 - t; return k * k * k * p; } - function CubicBezierP1(t, p) { const k = 1 - t; return 3 * k * k * t * p; } - function CubicBezierP2(t, p) { return 3 * (1 - t) * t * t * p; } - function CubicBezierP3(t, p) { return t * t * t * p; } - function CubicBezier(t, p0, p1, p2, p3) { return CubicBezierP0(t, p0) + CubicBezierP1(t, p1) + CubicBezierP2(t, p2) + CubicBezierP3(t, p3); } @@ -23719,17 +21024,15 @@ this.v2 = v2; this.v3 = v3; } - getPoint(t, optionalTarget = new Vector2()) { const point = optionalTarget; const v0 = this.v0, - v1 = this.v1, - v2 = this.v2, - v3 = this.v3; + v1 = this.v1, + v2 = this.v2, + v3 = this.v3; point.set(CubicBezier(t, v0.x, v1.x, v2.x, v3.x), CubicBezier(t, v0.y, v1.y, v2.y, v3.y)); return point; } - copy(source) { super.copy(source); this.v0.copy(source.v0); @@ -23738,7 +21041,6 @@ this.v3.copy(source.v3); return this; } - toJSON() { const data = super.toJSON(); data.v0 = this.v0.toArray(); @@ -23747,7 +21049,6 @@ data.v3 = this.v3.toArray(); return data; } - fromJSON(json) { super.fromJSON(json); this.v0.fromArray(json.v0); @@ -23756,9 +21057,7 @@ this.v3.fromArray(json.v3); return this; } - } - CubicBezierCurve.prototype.isCubicBezierCurve = true; class CubicBezierCurve3 extends Curve { @@ -23770,17 +21069,15 @@ this.v2 = v2; this.v3 = v3; } - getPoint(t, optionalTarget = new Vector3()) { const point = optionalTarget; const v0 = this.v0, - v1 = this.v1, - v2 = this.v2, - v3 = this.v3; + v1 = this.v1, + v2 = this.v2, + v3 = this.v3; point.set(CubicBezier(t, v0.x, v1.x, v2.x, v3.x), CubicBezier(t, v0.y, v1.y, v2.y, v3.y), CubicBezier(t, v0.z, v1.z, v2.z, v3.z)); return point; } - copy(source) { super.copy(source); this.v0.copy(source.v0); @@ -23789,7 +21086,6 @@ this.v3.copy(source.v3); return this; } - toJSON() { const data = super.toJSON(); data.v0 = this.v0.toArray(); @@ -23798,7 +21094,6 @@ data.v3 = this.v3.toArray(); return data; } - fromJSON(json) { super.fromJSON(json); this.v0.fromArray(json.v0); @@ -23807,9 +21102,7 @@ this.v3.fromArray(json.v3); return this; } - } - CubicBezierCurve3.prototype.isCubicBezierCurve3 = true; class LineCurve extends Curve { @@ -23819,54 +21112,45 @@ this.v1 = v1; this.v2 = v2; } - getPoint(t, optionalTarget = new Vector2()) { const point = optionalTarget; - if (t === 1) { point.copy(this.v2); } else { point.copy(this.v2).sub(this.v1); point.multiplyScalar(t).add(this.v1); } - return point; - } // Line curve is linear, so we can overwrite default getPointAt - + } + // Line curve is linear, so we can overwrite default getPointAt getPointAt(u, optionalTarget) { return this.getPoint(u, optionalTarget); } - getTangent(t, optionalTarget) { const tangent = optionalTarget || new Vector2(); tangent.copy(this.v2).sub(this.v1).normalize(); return tangent; } - copy(source) { super.copy(source); this.v1.copy(source.v1); this.v2.copy(source.v2); return this; } - toJSON() { const data = super.toJSON(); data.v1 = this.v1.toArray(); data.v2 = this.v2.toArray(); return data; } - fromJSON(json) { super.fromJSON(json); this.v1.fromArray(json.v1); this.v2.fromArray(json.v2); return this; } - } - LineCurve.prototype.isLineCurve = true; class LineCurve3 extends Curve { @@ -23877,46 +21161,38 @@ this.v1 = v1; this.v2 = v2; } - getPoint(t, optionalTarget = new Vector3()) { const point = optionalTarget; - if (t === 1) { point.copy(this.v2); } else { point.copy(this.v2).sub(this.v1); point.multiplyScalar(t).add(this.v1); } - return point; - } // Line curve is linear, so we can overwrite default getPointAt - - + } + // Line curve is linear, so we can overwrite default getPointAt getPointAt(u, optionalTarget) { return this.getPoint(u, optionalTarget); } - copy(source) { super.copy(source); this.v1.copy(source.v1); this.v2.copy(source.v2); return this; } - toJSON() { const data = super.toJSON(); data.v1 = this.v1.toArray(); data.v2 = this.v2.toArray(); return data; } - fromJSON(json) { super.fromJSON(json); this.v1.fromArray(json.v1); this.v2.fromArray(json.v2); return this; } - } class QuadraticBezierCurve extends Curve { @@ -23927,16 +21203,14 @@ this.v1 = v1; this.v2 = v2; } - getPoint(t, optionalTarget = new Vector2()) { const point = optionalTarget; const v0 = this.v0, - v1 = this.v1, - v2 = this.v2; + v1 = this.v1, + v2 = this.v2; point.set(QuadraticBezier(t, v0.x, v1.x, v2.x), QuadraticBezier(t, v0.y, v1.y, v2.y)); return point; } - copy(source) { super.copy(source); this.v0.copy(source.v0); @@ -23944,7 +21218,6 @@ this.v2.copy(source.v2); return this; } - toJSON() { const data = super.toJSON(); data.v0 = this.v0.toArray(); @@ -23952,7 +21225,6 @@ data.v2 = this.v2.toArray(); return data; } - fromJSON(json) { super.fromJSON(json); this.v0.fromArray(json.v0); @@ -23960,9 +21232,7 @@ this.v2.fromArray(json.v2); return this; } - } - QuadraticBezierCurve.prototype.isQuadraticBezierCurve = true; class QuadraticBezierCurve3 extends Curve { @@ -23973,16 +21243,14 @@ this.v1 = v1; this.v2 = v2; } - getPoint(t, optionalTarget = new Vector3()) { const point = optionalTarget; const v0 = this.v0, - v1 = this.v1, - v2 = this.v2; + v1 = this.v1, + v2 = this.v2; point.set(QuadraticBezier(t, v0.x, v1.x, v2.x), QuadraticBezier(t, v0.y, v1.y, v2.y), QuadraticBezier(t, v0.z, v1.z, v2.z)); return point; } - copy(source) { super.copy(source); this.v0.copy(source.v0); @@ -23990,7 +21258,6 @@ this.v2.copy(source.v2); return this; } - toJSON() { const data = super.toJSON(); data.v0 = this.v0.toArray(); @@ -23998,7 +21265,6 @@ data.v2 = this.v2.toArray(); return data; } - fromJSON(json) { super.fromJSON(json); this.v0.fromArray(json.v0); @@ -24006,9 +21272,7 @@ this.v2.fromArray(json.v2); return this; } - } - QuadraticBezierCurve3.prototype.isQuadraticBezierCurve3 = true; class SplineCurve extends Curve { @@ -24017,7 +21281,6 @@ this.type = 'SplineCurve'; this.points = points; } - getPoint(t, optionalTarget = new Vector2()) { const point = optionalTarget; const points = this.points; @@ -24031,45 +21294,34 @@ point.set(CatmullRom(weight, p0.x, p1.x, p2.x, p3.x), CatmullRom(weight, p0.y, p1.y, p2.y, p3.y)); return point; } - copy(source) { super.copy(source); this.points = []; - for (let i = 0, l = source.points.length; i < l; i++) { const point = source.points[i]; this.points.push(point.clone()); } - return this; } - toJSON() { const data = super.toJSON(); data.points = []; - for (let i = 0, l = this.points.length; i < l; i++) { const point = this.points[i]; data.points.push(point.toArray()); } - return data; } - fromJSON(json) { super.fromJSON(json); this.points = []; - for (let i = 0, l = json.points.length; i < l; i++) { const point = json.points[i]; this.points.push(new Vector2().fromArray(point)); } - return this; } - } - SplineCurve.prototype.isSplineCurve = true; var Curves = /*#__PURE__*/Object.freeze({ @@ -24098,32 +21350,33 @@ this.curves = []; this.autoClose = false; // Automatically closes the path } - add(curve) { this.curves.push(curve); } - closePath() { // Add a line curve if start and end of lines are not connected const startPoint = this.curves[0].getPoint(0); const endPoint = this.curves[this.curves.length - 1].getPoint(1); - if (!startPoint.equals(endPoint)) { this.curves.push(new LineCurve(endPoint, startPoint)); } - } // To get accurate point with reference to + } + + // To get accurate point with reference to // entire path distance at time t, // following has to be done: + // 1. Length of each sub path have to be known // 2. Locate and identify type of curve // 3. Get t for the curve // 4. Return curve.getPointAt(t') - getPoint(t, optionalTarget) { const d = t * this.getLength(); const curveLengths = this.getCurveLengths(); - let i = 0; // To think about boundaries points. + let i = 0; + + // To think about boundaries points. while (i < curveLengths.length) { if (curveLengths[i] >= d) { @@ -24133,73 +21386,68 @@ const u = segmentLength === 0 ? 0 : 1 - diff / segmentLength; return curve.getPointAt(u, optionalTarget); } - i++; } + return null; - return null; // loop where sum != 0, sum > d , sum+1 d , sum+1 1 && !points[points.length - 1].equals(points[0])) { points.push(points[0]); } - return points; } - copy(source) { super.copy(source); this.curves = []; - for (let i = 0, l = source.curves.length; i < l; i++) { const curve = source.curves[i]; this.curves.push(curve.clone()); } - this.autoClose = source.autoClose; return this; } - toJSON() { const data = super.toJSON(); data.autoClose = this.autoClose; data.curves = []; - for (let i = 0, l = this.curves.length; i < l; i++) { const curve = this.curves[i]; data.curves.push(curve.toJSON()); } - return data; } - fromJSON(json) { super.fromJSON(json); this.autoClose = json.autoClose; this.curves = []; - for (let i = 0, l = json.curves.length; i < l; i++) { const curve = json.curves[i]; this.curves.push(new Curves[curve.type]().fromJSON(curve)); } - return this; } - } class Path extends CurvePath { @@ -24262,114 +21498,92 @@ super(); this.type = 'Path'; this.currentPoint = new Vector2(); - if (points) { this.setFromPoints(points); } } - setFromPoints(points) { this.moveTo(points[0].x, points[0].y); - for (let i = 1, l = points.length; i < l; i++) { this.lineTo(points[i].x, points[i].y); } - return this; } - moveTo(x, y) { this.currentPoint.set(x, y); // TODO consider referencing vectors instead of copying? return this; } - lineTo(x, y) { const curve = new LineCurve(this.currentPoint.clone(), new Vector2(x, y)); this.curves.push(curve); this.currentPoint.set(x, y); return this; } - quadraticCurveTo(aCPx, aCPy, aX, aY) { const curve = new QuadraticBezierCurve(this.currentPoint.clone(), new Vector2(aCPx, aCPy), new Vector2(aX, aY)); this.curves.push(curve); this.currentPoint.set(aX, aY); return this; } - bezierCurveTo(aCP1x, aCP1y, aCP2x, aCP2y, aX, aY) { const curve = new CubicBezierCurve(this.currentPoint.clone(), new Vector2(aCP1x, aCP1y), new Vector2(aCP2x, aCP2y), new Vector2(aX, aY)); this.curves.push(curve); this.currentPoint.set(aX, aY); return this; } - - splineThru(pts - /*Array of Vector*/ - ) { + splineThru(pts /*Array of Vector*/) { const npts = [this.currentPoint.clone()].concat(pts); const curve = new SplineCurve(npts); this.curves.push(curve); this.currentPoint.copy(pts[pts.length - 1]); return this; } - arc(aX, aY, aRadius, aStartAngle, aEndAngle, aClockwise) { const x0 = this.currentPoint.x; const y0 = this.currentPoint.y; this.absarc(aX + x0, aY + y0, aRadius, aStartAngle, aEndAngle, aClockwise); return this; } - absarc(aX, aY, aRadius, aStartAngle, aEndAngle, aClockwise) { this.absellipse(aX, aY, aRadius, aRadius, aStartAngle, aEndAngle, aClockwise); return this; } - ellipse(aX, aY, xRadius, yRadius, aStartAngle, aEndAngle, aClockwise, aRotation) { const x0 = this.currentPoint.x; const y0 = this.currentPoint.y; this.absellipse(aX + x0, aY + y0, xRadius, yRadius, aStartAngle, aEndAngle, aClockwise, aRotation); return this; } - absellipse(aX, aY, xRadius, yRadius, aStartAngle, aEndAngle, aClockwise, aRotation) { const curve = new EllipseCurve(aX, aY, xRadius, yRadius, aStartAngle, aEndAngle, aClockwise, aRotation); - if (this.curves.length > 0) { // if a previous curve is present, attempt to join const firstPoint = curve.getPoint(0); - if (!firstPoint.equals(this.currentPoint)) { this.lineTo(firstPoint.x, firstPoint.y); } } - this.curves.push(curve); const lastPoint = curve.getPoint(1); this.currentPoint.copy(lastPoint); return this; } - copy(source) { super.copy(source); this.currentPoint.copy(source.currentPoint); return this; } - toJSON() { const data = super.toJSON(); data.currentPoint = this.currentPoint.toArray(); return data; } - fromJSON(json) { super.fromJSON(json); this.currentPoint.fromArray(json.currentPoint); return this; } - } class Shape extends Path { @@ -24379,17 +21593,15 @@ this.type = 'Shape'; this.holes = []; } - getPointsHoles(divisions) { const holesPts = []; - for (let i = 0, l = this.holes.length; i < l; i++) { holesPts[i] = this.holes[i].getPoints(divisions); } - return holesPts; - } // get points of shape and holes (keypoints based on segments parameter) + } + // get points of shape and holes (keypoints based on segments parameter) extractPoints(divisions) { return { @@ -24397,50 +21609,41 @@ holes: this.getPointsHoles(divisions) }; } - copy(source) { super.copy(source); this.holes = []; - for (let i = 0, l = source.holes.length; i < l; i++) { const hole = source.holes[i]; this.holes.push(hole.clone()); } - return this; } - toJSON() { const data = super.toJSON(); data.uuid = this.uuid; data.holes = []; - for (let i = 0, l = this.holes.length; i < l; i++) { const hole = this.holes[i]; data.holes.push(hole.toJSON()); } - return data; } - fromJSON(json) { super.fromJSON(json); this.uuid = json.uuid; this.holes = []; - for (let i = 0, l = json.holes.length; i < l; i++) { const hole = json.holes[i]; this.holes.push(new Path().fromJSON(hole)); } - return this; } - } /** * Port from https://github.com/mapbox/earcut (v2.2.2) */ + const Earcut = { triangulate: function (data, holeIndices, dim = 2) { const hasHoles = holeIndices && holeIndices.length; @@ -24449,12 +21652,12 @@ const triangles = []; if (!outerNode || outerNode.next === outerNode.prev) return triangles; let minX, minY, maxX, maxY, x, y, invSize; - if (hasHoles) outerNode = eliminateHoles(data, holeIndices, outerNode, dim); // if the shape is not too simple, we'll use z-order curve hash later; calculate polygon bbox + if (hasHoles) outerNode = eliminateHoles(data, holeIndices, outerNode, dim); + // if the shape is not too simple, we'll use z-order curve hash later; calculate polygon bbox if (data.length > 80 * dim) { minX = maxX = data[0]; minY = maxY = data[1]; - for (let i = dim; i < outerLen; i += dim) { x = data[i]; y = data[i + 1]; @@ -24462,45 +21665,40 @@ if (y < minY) minY = y; if (x > maxX) maxX = x; if (y > maxY) maxY = y; - } // minX, minY and invSize are later used to transform coords into integers for z-order calculation - + } + // minX, minY and invSize are later used to transform coords into integers for z-order calculation invSize = Math.max(maxX - minX, maxY - minY); invSize = invSize !== 0 ? 1 / invSize : 0; } - earcutLinked(outerNode, triangles, dim, minX, minY, invSize); return triangles; } - }; // create a circular doubly linked list from polygon points in the specified winding order + }; + // create a circular doubly linked list from polygon points in the specified winding order function linkedList(data, start, end, dim, clockwise) { let i, last; - if (clockwise === signedArea(data, start, end, dim) > 0) { for (i = start; i < end; i += dim) last = insertNode(i, data[i], data[i + 1], last); } else { for (i = end - dim; i >= start; i -= dim) last = insertNode(i, data[i], data[i + 1], last); } - if (last && equals(last, last.next)) { removeNode(last); last = last.next; } - return last; - } // eliminate colinear or duplicate points - + } + // eliminate colinear or duplicate points function filterPoints(start, end) { if (!start) return start; if (!end) end = start; let p = start, - again; - + again; do { again = false; - if (!p.steiner && (equals(p, p.next) || area(p.prev, p, p.next) === 0)) { removeNode(p); p = end = p.prev; @@ -24510,167 +21708,163 @@ p = p.next; } } while (again || p !== end); - return end; - } // main ear slicing loop which triangulates a polygon (given as a linked list) - + } + // main ear slicing loop which triangulates a polygon (given as a linked list) function earcutLinked(ear, triangles, dim, minX, minY, invSize, pass) { - if (!ear) return; // interlink polygon nodes in z-order + if (!ear) return; + // interlink polygon nodes in z-order if (!pass && invSize) indexCurve(ear, minX, minY, invSize); let stop = ear, - prev, - next; // iterate through ears, slicing them one by one + prev, + next; + // iterate through ears, slicing them one by one while (ear.prev !== ear.next) { prev = ear.prev; next = ear.next; - if (invSize ? isEarHashed(ear, minX, minY, invSize) : isEar(ear)) { // cut off the triangle triangles.push(prev.i / dim); triangles.push(ear.i / dim); triangles.push(next.i / dim); - removeNode(ear); // skipping the next vertex leads to less sliver triangles + removeNode(ear); + // skipping the next vertex leads to less sliver triangles ear = next.next; stop = next.next; continue; } + ear = next; - ear = next; // if we looped through the whole remaining polygon and can't find any more ears - + // if we looped through the whole remaining polygon and can't find any more ears if (ear === stop) { // try filtering points and slicing again if (!pass) { - earcutLinked(filterPoints(ear), triangles, dim, minX, minY, invSize, 1); // if this didn't work, try curing all small self-intersections locally + earcutLinked(filterPoints(ear), triangles, dim, minX, minY, invSize, 1); + + // if this didn't work, try curing all small self-intersections locally } else if (pass === 1) { ear = cureLocalIntersections(filterPoints(ear), triangles, dim); - earcutLinked(ear, triangles, dim, minX, minY, invSize, 2); // as a last resort, try splitting the remaining polygon into two + earcutLinked(ear, triangles, dim, minX, minY, invSize, 2); + + // as a last resort, try splitting the remaining polygon into two } else if (pass === 2) { splitEarcut(ear, triangles, dim, minX, minY, invSize); } - break; } } - } // check whether a polygon node forms a valid ear with adjacent nodes - + } + // check whether a polygon node forms a valid ear with adjacent nodes function isEar(ear) { const a = ear.prev, - b = ear, - c = ear.next; + b = ear, + c = ear.next; if (area(a, b, c) >= 0) return false; // reflex, can't be an ear - // now make sure we don't have other points inside the potential ear + // now make sure we don't have other points inside the potential ear let p = ear.next.next; - while (p !== ear.prev) { if (pointInTriangle(a.x, a.y, b.x, b.y, c.x, c.y, p.x, p.y) && area(p.prev, p, p.next) >= 0) return false; p = p.next; } - return true; } - function isEarHashed(ear, minX, minY, invSize) { const a = ear.prev, - b = ear, - c = ear.next; + b = ear, + c = ear.next; if (area(a, b, c) >= 0) return false; // reflex, can't be an ear - // triangle bbox; min & max are calculated like this for speed + // triangle bbox; min & max are calculated like this for speed const minTX = a.x < b.x ? a.x < c.x ? a.x : c.x : b.x < c.x ? b.x : c.x, - minTY = a.y < b.y ? a.y < c.y ? a.y : c.y : b.y < c.y ? b.y : c.y, - maxTX = a.x > b.x ? a.x > c.x ? a.x : c.x : b.x > c.x ? b.x : c.x, - maxTY = a.y > b.y ? a.y > c.y ? a.y : c.y : b.y > c.y ? b.y : c.y; // z-order range for the current triangle bbox; + minTY = a.y < b.y ? a.y < c.y ? a.y : c.y : b.y < c.y ? b.y : c.y, + maxTX = a.x > b.x ? a.x > c.x ? a.x : c.x : b.x > c.x ? b.x : c.x, + maxTY = a.y > b.y ? a.y > c.y ? a.y : c.y : b.y > c.y ? b.y : c.y; + // z-order range for the current triangle bbox; const minZ = zOrder(minTX, minTY, minX, minY, invSize), - maxZ = zOrder(maxTX, maxTY, minX, minY, invSize); + maxZ = zOrder(maxTX, maxTY, minX, minY, invSize); let p = ear.prevZ, - n = ear.nextZ; // look for points inside the triangle in both directions + n = ear.nextZ; + // look for points inside the triangle in both directions while (p && p.z >= minZ && n && n.z <= maxZ) { if (p !== ear.prev && p !== ear.next && pointInTriangle(a.x, a.y, b.x, b.y, c.x, c.y, p.x, p.y) && area(p.prev, p, p.next) >= 0) return false; p = p.prevZ; if (n !== ear.prev && n !== ear.next && pointInTriangle(a.x, a.y, b.x, b.y, c.x, c.y, n.x, n.y) && area(n.prev, n, n.next) >= 0) return false; n = n.nextZ; - } // look for remaining points in decreasing z-order - + } + // look for remaining points in decreasing z-order while (p && p.z >= minZ) { if (p !== ear.prev && p !== ear.next && pointInTriangle(a.x, a.y, b.x, b.y, c.x, c.y, p.x, p.y) && area(p.prev, p, p.next) >= 0) return false; p = p.prevZ; - } // look for remaining points in increasing z-order - + } + // look for remaining points in increasing z-order while (n && n.z <= maxZ) { if (n !== ear.prev && n !== ear.next && pointInTriangle(a.x, a.y, b.x, b.y, c.x, c.y, n.x, n.y) && area(n.prev, n, n.next) >= 0) return false; n = n.nextZ; } - return true; - } // go through all polygon nodes and cure small local self-intersections - + } + // go through all polygon nodes and cure small local self-intersections function cureLocalIntersections(start, triangles, dim) { let p = start; - do { const a = p.prev, - b = p.next.next; - + b = p.next.next; if (!equals(a, b) && intersects(a, p, p.next, b) && locallyInside(a, b) && locallyInside(b, a)) { triangles.push(a.i / dim); triangles.push(p.i / dim); - triangles.push(b.i / dim); // remove two nodes involved + triangles.push(b.i / dim); + // remove two nodes involved removeNode(p); removeNode(p.next); p = start = b; } - p = p.next; } while (p !== start); - return filterPoints(p); - } // try splitting polygon into two and triangulate them independently - + } + // try splitting polygon into two and triangulate them independently function splitEarcut(start, triangles, dim, minX, minY, invSize) { // look for a valid diagonal that divides the polygon into two let a = start; - do { let b = a.next.next; - while (b !== a.prev) { if (a.i !== b.i && isValidDiagonal(a, b)) { // split the polygon in two by the diagonal - let c = splitPolygon(a, b); // filter colinear points around the cuts + let c = splitPolygon(a, b); + // filter colinear points around the cuts a = filterPoints(a, a.next); - c = filterPoints(c, c.next); // run earcut on each half + c = filterPoints(c, c.next); + // run earcut on each half earcutLinked(a, triangles, dim, minX, minY, invSize); earcutLinked(c, triangles, dim, minX, minY, invSize); return; } - b = b.next; } - a = a.next; } while (a !== start); - } // link every hole into the outer loop, producing a single-ring polygon without holes - + } + // link every hole into the outer loop, producing a single-ring polygon without holes function eliminateHoles(data, holeIndices, outerNode, dim) { const queue = []; let i, len, start, end, list; - for (i = 0, len = holeIndices.length; i < len; i++) { start = holeIndices[i] * dim; end = i < len - 1 ? holeIndices[i + 1] * dim : data.length; @@ -24678,74 +21872,68 @@ if (list === list.next) list.steiner = true; queue.push(getLeftmost(list)); } + queue.sort(compareX); - queue.sort(compareX); // process holes from left to right - + // process holes from left to right for (i = 0; i < queue.length; i++) { eliminateHole(queue[i], outerNode); outerNode = filterPoints(outerNode, outerNode.next); } - return outerNode; } - function compareX(a, b) { return a.x - b.x; - } // find a bridge between vertices that connects hole with an outer ring and and link it - + } + // find a bridge between vertices that connects hole with an outer ring and and link it function eliminateHole(hole, outerNode) { outerNode = findHoleBridge(hole, outerNode); - if (outerNode) { - const b = splitPolygon(outerNode, hole); // filter collinear points around the cuts + const b = splitPolygon(outerNode, hole); + // filter collinear points around the cuts filterPoints(outerNode, outerNode.next); filterPoints(b, b.next); } - } // David Eberly's algorithm for finding a bridge between hole and outer polygon - + } + // David Eberly's algorithm for finding a bridge between hole and outer polygon function findHoleBridge(hole, outerNode) { let p = outerNode; const hx = hole.x; const hy = hole.y; let qx = -Infinity, - m; // find a segment intersected by a ray from the hole's leftmost point to the left; - // segment's endpoint with lesser x will be potential connection point + m; + // find a segment intersected by a ray from the hole's leftmost point to the left; + // segment's endpoint with lesser x will be potential connection point do { if (hy <= p.y && hy >= p.next.y && p.next.y !== p.y) { const x = p.x + (hy - p.y) * (p.next.x - p.x) / (p.next.y - p.y); - if (x <= hx && x > qx) { qx = x; - if (x === hx) { if (hy === p.y) return p; if (hy === p.next.y) return p.next; } - m = p.x < p.next.x ? p : p.next; } } - p = p.next; } while (p !== outerNode); - if (!m) return null; if (hx === qx) return m; // hole touches outer segment; pick leftmost endpoint + // look for points inside the triangle of hole point, segment intersection and endpoint; // if there are no points found, we have a valid connection; // otherwise choose the point of the minimum angle with the ray as connection point const stop = m, - mx = m.x, - my = m.y; + mx = m.x, + my = m.y; let tanMin = Infinity, - tan; + tan; p = m; - do { if (hx >= p.x && p.x >= mx && hx !== p.x && pointInTriangle(hy < my ? hx : qx, hy, mx, my, hy < my ? qx : hx, hy, p.x, p.y)) { tan = Math.abs(hy - p.y) / (hx - p.x); // tangential @@ -24755,66 +21943,57 @@ tanMin = tan; } } - p = p.next; } while (p !== stop); - return m; - } // whether sector in vertex m contains sector in vertex p in the same coordinates - + } + // whether sector in vertex m contains sector in vertex p in the same coordinates function sectorContainsSector(m, p) { return area(m.prev, m, p.prev) < 0 && area(p.next, m, m.next) < 0; - } // interlink polygon nodes in z-order - + } + // interlink polygon nodes in z-order function indexCurve(start, minX, minY, invSize) { let p = start; - do { if (p.z === null) p.z = zOrder(p.x, p.y, minX, minY, invSize); p.prevZ = p.prev; p.nextZ = p.next; p = p.next; } while (p !== start); - p.prevZ.nextZ = null; p.prevZ = null; sortLinked(p); - } // Simon Tatham's linked list merge sort algorithm - // http://www.chiark.greenend.org.uk/~sgtatham/algorithms/listsort.html - + } + // Simon Tatham's linked list merge sort algorithm + // http://www.chiark.greenend.org.uk/~sgtatham/algorithms/listsort.html function sortLinked(list) { let i, - p, - q, - e, - tail, - numMerges, - pSize, - qSize, - inSize = 1; - + p, + q, + e, + tail, + numMerges, + pSize, + qSize, + inSize = 1; do { p = list; list = null; tail = null; numMerges = 0; - while (p) { numMerges++; q = p; pSize = 0; - for (i = 0; i < inSize; i++) { pSize++; q = q.nextZ; if (!q) break; } - qSize = inSize; - while (pSize > 0 || qSize > 0 && q) { if (pSize !== 0 && (qSize === 0 || !q || p.z <= q.z)) { e = p; @@ -24825,23 +22004,19 @@ q = q.nextZ; qSize--; } - if (tail) tail.nextZ = e;else list = e; e.prevZ = tail; tail = e; } - p = q; } - tail.nextZ = null; inSize *= 2; } while (numMerges > 1); - return list; - } // z-order of a point given coords and inverse of the longer side of data bbox - + } + // z-order of a point given coords and inverse of the longer side of data bbox function zOrder(x, y, minX, minY, invSize) { // coords are transformed into non-negative 15-bit integer range x = 32767 * (x - minX) * invSize; @@ -24855,45 +22030,46 @@ y = (y | y << 2) & 0x33333333; y = (y | y << 1) & 0x55555555; return x | y << 1; - } // find the leftmost node of a polygon ring - + } + // find the leftmost node of a polygon ring function getLeftmost(start) { let p = start, - leftmost = start; - + leftmost = start; do { if (p.x < leftmost.x || p.x === leftmost.x && p.y < leftmost.y) leftmost = p; p = p.next; } while (p !== start); - return leftmost; - } // check if a point lies within a convex triangle - + } + // check if a point lies within a convex triangle function pointInTriangle(ax, ay, bx, by, cx, cy, px, py) { return (cx - px) * (ay - py) - (ax - px) * (cy - py) >= 0 && (ax - px) * (by - py) - (bx - px) * (ay - py) >= 0 && (bx - px) * (cy - py) - (cx - px) * (by - py) >= 0; - } // check if a diagonal between two polygon nodes is valid (lies in polygon interior) - + } + // check if a diagonal between two polygon nodes is valid (lies in polygon interior) function isValidDiagonal(a, b) { - return a.next.i !== b.i && a.prev.i !== b.i && !intersectsPolygon(a, b) && ( // dones't intersect other edges - locallyInside(a, b) && locallyInside(b, a) && middleInside(a, b) && ( // locally visible - area(a.prev, a, b.prev) || area(a, b.prev, b)) || // does not create opposite-facing sectors + return a.next.i !== b.i && a.prev.i !== b.i && !intersectsPolygon(a, b) && ( + // dones't intersect other edges + locallyInside(a, b) && locallyInside(b, a) && middleInside(a, b) && ( + // locally visible + area(a.prev, a, b.prev) || area(a, b.prev, b)) || + // does not create opposite-facing sectors equals(a, b) && area(a.prev, a, a.next) > 0 && area(b.prev, b, b.next) > 0); // special zero-length case - } // signed area of a triangle - + } + // signed area of a triangle function area(p, q, r) { return (q.y - p.y) * (r.x - q.x) - (q.x - p.x) * (r.y - q.y); - } // check if two points are equal - + } + // check if two points are equal function equals(p1, p2) { return p1.x === p2.x && p1.y === p2.y; - } // check if two segments intersect - + } + // check if two segments intersect function intersects(p1, q1, p2, q2) { const o1 = sign(area(p1, q1, p2)); const o2 = sign(area(p1, q1, q2)); @@ -24902,64 +22078,56 @@ if (o1 !== o2 && o3 !== o4) return true; // general case if (o1 === 0 && onSegment(p1, p2, q1)) return true; // p1, q1 and p2 are collinear and p2 lies on p1q1 - if (o2 === 0 && onSegment(p1, q2, q1)) return true; // p1, q1 and q2 are collinear and q2 lies on p1q1 - if (o3 === 0 && onSegment(p2, p1, q2)) return true; // p2, q2 and p1 are collinear and p1 lies on p2q2 - if (o4 === 0 && onSegment(p2, q1, q2)) return true; // p2, q2 and q1 are collinear and q1 lies on p2q2 return false; - } // for collinear points p, q, r, check if point q lies on segment pr - + } + // for collinear points p, q, r, check if point q lies on segment pr function onSegment(p, q, r) { return q.x <= Math.max(p.x, r.x) && q.x >= Math.min(p.x, r.x) && q.y <= Math.max(p.y, r.y) && q.y >= Math.min(p.y, r.y); } - function sign(num) { return num > 0 ? 1 : num < 0 ? -1 : 0; - } // check if a polygon diagonal intersects any polygon segments - + } + // check if a polygon diagonal intersects any polygon segments function intersectsPolygon(a, b) { let p = a; - do { if (p.i !== a.i && p.next.i !== a.i && p.i !== b.i && p.next.i !== b.i && intersects(p, p.next, a, b)) return true; p = p.next; } while (p !== a); - return false; - } // check if a polygon diagonal is locally inside the polygon - + } + // check if a polygon diagonal is locally inside the polygon function locallyInside(a, b) { return area(a.prev, a, a.next) < 0 ? area(a, b, a.next) >= 0 && area(a, a.prev, b) >= 0 : area(a, b, a.prev) < 0 || area(a, a.next, b) < 0; - } // check if the middle point of a polygon diagonal is inside the polygon - + } + // check if the middle point of a polygon diagonal is inside the polygon function middleInside(a, b) { let p = a, - inside = false; + inside = false; const px = (a.x + b.x) / 2, - py = (a.y + b.y) / 2; - + py = (a.y + b.y) / 2; do { if (p.y > py !== p.next.y > py && p.next.y !== p.y && px < (p.next.x - p.x) * (py - p.y) / (p.next.y - p.y) + p.x) inside = !inside; p = p.next; } while (p !== a); - return inside; - } // link two polygon vertices with a bridge; if the vertices belong to the same ring, it splits polygon into two; - // if one belongs to the outer ring and another to a hole, it merges it into a single ring - + } + // link two polygon vertices with a bridge; if the vertices belong to the same ring, it splits polygon into two; + // if one belongs to the outer ring and another to a hole, it merges it into a single ring function splitPolygon(a, b) { const a2 = new Node(a.i, a.x, a.y), - b2 = new Node(b.i, b.x, b.y), - an = a.next, - bp = b.prev; + b2 = new Node(b.i, b.x, b.y), + an = a.next, + bp = b.prev; a.next = b; b.prev = a; a2.next = an; @@ -24969,12 +22137,11 @@ bp.next = b2; b2.prev = bp; return b2; - } // create a node and optionally link it with previous one (in a circular doubly linked list) - + } + // create a node and optionally link it with previous one (in a circular doubly linked list) function insertNode(i, x, y, last) { const p = new Node(i, x, y); - if (!last) { p.prev = p; p.next = p; @@ -24984,102 +22151,95 @@ last.next.prev = p; last.next = p; } - return p; } - function removeNode(p) { p.next.prev = p.prev; p.prev.next = p.next; if (p.prevZ) p.prevZ.nextZ = p.nextZ; if (p.nextZ) p.nextZ.prevZ = p.prevZ; } - function Node(i, x, y) { // vertex index in coordinates array - this.i = i; // vertex coordinates + this.i = i; + // vertex coordinates this.x = x; - this.y = y; // previous and next vertex nodes in a polygon ring + this.y = y; + // previous and next vertex nodes in a polygon ring this.prev = null; - this.next = null; // z-order curve value + this.next = null; - this.z = null; // previous and next nodes in z-order + // z-order curve value + this.z = null; + // previous and next nodes in z-order this.prevZ = null; - this.nextZ = null; // indicates whether this is a steiner point + this.nextZ = null; + // indicates whether this is a steiner point this.steiner = false; } - function signedArea(data, start, end, dim) { let sum = 0; - for (let i = start, j = end - dim; i < end; i += dim) { sum += (data[j] - data[i]) * (data[i + 1] + data[j + 1]); j = i; } - return sum; } class ShapeUtils { // calculate area of the contour polygon + static area(contour) { const n = contour.length; let a = 0.0; - for (let p = n - 1, q = 0; q < n; p = q++) { a += contour[p].x * contour[q].y - contour[q].x * contour[p].y; } - return a * 0.5; } - static isClockWise(pts) { return ShapeUtils.area(pts) < 0; } - static triangulateShape(contour, holes) { const vertices = []; // flat array of vertices like [ x0,y0, x1,y1, x2,y2, ... ] - const holeIndices = []; // array of hole indices - const faces = []; // final array of vertex indices like [ [ a,b,d ], [ b,c,d ] ] removeDupEndPts(contour); - addContour(vertices, contour); // + addContour(vertices, contour); + + // let holeIndex = contour.length; holes.forEach(removeDupEndPts); - for (let i = 0; i < holes.length; i++) { holeIndices.push(holeIndex); holeIndex += holes[i].length; addContour(vertices, holes[i]); - } // + } + // - const triangles = Earcut.triangulate(vertices, holeIndices); // + const triangles = Earcut.triangulate(vertices, holeIndices); + + // for (let i = 0; i < triangles.length; i += 3) { faces.push(triangles.slice(i, i + 3)); } - return faces; } - } - function removeDupEndPts(points) { const l = points.length; - if (l > 2 && points[l - 1].equals(points[0])) { points.pop(); } } - function addContour(vertices, contour) { for (let i = 0; i < contour.length; i++) { vertices.push(contour[i].x); @@ -25108,7 +22268,6 @@ * * } */ - class ExtrudeGeometry extends BufferGeometry { constructor(shapes = new Shape([new Vector2(0.5, 0.5), new Vector2(-0.5, 0.5), new Vector2(-0.5, -0.5), new Vector2(0.5, -0.5)]), options = {}) { super(); @@ -25121,19 +22280,23 @@ const scope = this; const verticesArray = []; const uvArray = []; - for (let i = 0, l = shapes.length; i < l; i++) { const shape = shapes[i]; addShape(shape); - } // build geometry + } + // build geometry this.setAttribute('position', new Float32BufferAttribute(verticesArray, 3)); this.setAttribute('uv', new Float32BufferAttribute(uvArray, 2)); - this.computeVertexNormals(); // functions + this.computeVertexNormals(); + + // functions function addShape(shape) { - const placeholder = []; // options + const placeholder = []; + + // options const curveSegments = options.curveSegments !== undefined ? options.curveSegments : 12; const steps = options.steps !== undefined ? options.steps : 1; @@ -25144,59 +22307,67 @@ let bevelOffset = options.bevelOffset !== undefined ? options.bevelOffset : 0; let bevelSegments = options.bevelSegments !== undefined ? options.bevelSegments : 3; const extrudePath = options.extrudePath; - const uvgen = options.UVGenerator !== undefined ? options.UVGenerator : WorldUVGenerator; // deprecated options + const uvgen = options.UVGenerator !== undefined ? options.UVGenerator : WorldUVGenerator; + + // deprecated options if (options.amount !== undefined) { console.warn('THREE.ExtrudeBufferGeometry: amount has been renamed to depth.'); depth = options.amount; - } // + } + // let extrudePts, - extrudeByPath = false; + extrudeByPath = false; let splineTube, binormal, normal, position2; - if (extrudePath) { extrudePts = extrudePath.getSpacedPoints(steps); extrudeByPath = true; bevelEnabled = false; // bevels not supported for path extrusion + // SETUP TNB variables + // TODO1 - have a .isClosed in spline? - splineTube = extrudePath.computeFrenetFrames(steps, false); // console.log(splineTube, 'splineTube', splineTube.normals.length, 'steps', steps, 'extrudePts', extrudePts.length); + splineTube = extrudePath.computeFrenetFrames(steps, false); + + // console.log(splineTube, 'splineTube', splineTube.normals.length, 'steps', steps, 'extrudePts', extrudePts.length); binormal = new Vector3(); normal = new Vector3(); position2 = new Vector3(); - } // Safeguards if bevels are not enabled + } + // Safeguards if bevels are not enabled if (!bevelEnabled) { bevelSegments = 0; bevelThickness = 0; bevelSize = 0; bevelOffset = 0; - } // Variables initialization + } + // Variables initialization const shapePoints = shape.extractPoints(curveSegments); let vertices = shapePoints.shape; const holes = shapePoints.holes; const reverse = !ShapeUtils.isClockWise(vertices); - if (reverse) { - vertices = vertices.reverse(); // Maybe we should also check if holes are in the opposite direction, just to be safe ... + vertices = vertices.reverse(); + + // Maybe we should also check if holes are in the opposite direction, just to be safe ... for (let h = 0, hl = holes.length; h < hl; h++) { const ahole = holes[h]; - if (ShapeUtils.isClockWise(ahole)) { holes[h] = ahole.reverse(); } } } - const faces = ShapeUtils.triangulateShape(vertices, holes); + /* Vertices */ const contour = vertices; // vertices has all points but contour has only points of circumference @@ -25205,14 +22376,14 @@ const ahole = holes[h]; vertices = vertices.concat(ahole); } - function scalePt2(pt, vec, size) { if (!vec) console.error('THREE.ExtrudeGeometry: vec does not exist'); return vec.clone().multiplyScalar(size).add(pt); } - const vlen = vertices.length, - flen = faces.length; // Find directions for point movement + flen = faces.length; + + // Find directions for point movement function getBevelVec(inPt, inPrev, inNext) { // computes for inPt the corresponding point inPt' on a new contour @@ -25221,37 +22392,47 @@ // // inPt' is the intersection of the two lines parallel to the two // adjacent edges of inPt at a distance of 1 unit on the left side. + let v_trans_x, v_trans_y, shrink_by; // resulting translation vector for inPt + // good reading for geometry algorithms (here: line-line intersection) // http://geomalgorithms.com/a05-_intersect-1.html const v_prev_x = inPt.x - inPrev.x, - v_prev_y = inPt.y - inPrev.y; + v_prev_y = inPt.y - inPrev.y; const v_next_x = inNext.x - inPt.x, - v_next_y = inNext.y - inPt.y; - const v_prev_lensq = v_prev_x * v_prev_x + v_prev_y * v_prev_y; // check for collinear edges + v_next_y = inNext.y - inPt.y; + const v_prev_lensq = v_prev_x * v_prev_x + v_prev_y * v_prev_y; + // check for collinear edges const collinear0 = v_prev_x * v_next_y - v_prev_y * v_next_x; - if (Math.abs(collinear0) > Number.EPSILON) { // not collinear + // length of vectors for normalizing + const v_prev_len = Math.sqrt(v_prev_lensq); - const v_next_len = Math.sqrt(v_next_x * v_next_x + v_next_y * v_next_y); // shift adjacent points by unit vectors to the left + const v_next_len = Math.sqrt(v_next_x * v_next_x + v_next_y * v_next_y); + + // shift adjacent points by unit vectors to the left const ptPrevShift_x = inPrev.x - v_prev_y / v_prev_len; const ptPrevShift_y = inPrev.y + v_prev_x / v_prev_len; const ptNextShift_x = inNext.x - v_next_y / v_next_len; - const ptNextShift_y = inNext.y + v_next_x / v_next_len; // scaling factor for v_prev to intersection point + const ptNextShift_y = inNext.y + v_next_x / v_next_len; + + // scaling factor for v_prev to intersection point - const sf = ((ptNextShift_x - ptPrevShift_x) * v_next_y - (ptNextShift_y - ptPrevShift_y) * v_next_x) / (v_prev_x * v_next_y - v_prev_y * v_next_x); // vector from inPt to intersection point + const sf = ((ptNextShift_x - ptPrevShift_x) * v_next_y - (ptNextShift_y - ptPrevShift_y) * v_next_x) / (v_prev_x * v_next_y - v_prev_y * v_next_x); + + // vector from inPt to intersection point v_trans_x = ptPrevShift_x + v_prev_x * sf - inPt.x; - v_trans_y = ptPrevShift_y + v_prev_y * sf - inPt.y; // Don't normalize!, otherwise sharp corners become ugly - // but prevent crazy spikes + v_trans_y = ptPrevShift_y + v_prev_y * sf - inPt.y; + // Don't normalize!, otherwise sharp corners become ugly + // but prevent crazy spikes const v_trans_lensq = v_trans_x * v_trans_x + v_trans_y * v_trans_y; - if (v_trans_lensq <= 2) { return new Vector2(v_trans_x, v_trans_y); } else { @@ -25259,6 +22440,7 @@ } } else { // handle special case of collinear edges + let direction_eq = false; // assumes: opposite if (v_prev_x > Number.EPSILON) { @@ -25276,7 +22458,6 @@ } } } - if (direction_eq) { // console.log("Warning: lines are a straight sequence"); v_trans_x = -v_prev_y; @@ -25289,117 +22470,121 @@ shrink_by = Math.sqrt(v_prev_lensq / 2); } } - return new Vector2(v_trans_x / shrink_by, v_trans_y / shrink_by); } - const contourMovements = []; - for (let i = 0, il = contour.length, j = il - 1, k = i + 1; i < il; i++, j++, k++) { if (j === il) j = 0; - if (k === il) k = 0; // (j)---(i)---(k) + if (k === il) k = 0; + + // (j)---(i)---(k) // console.log('i,j,k', i, j , k) contourMovements[i] = getBevelVec(contour[i], contour[j], contour[k]); } - const holesMovements = []; let oneHoleMovements, - verticesMovements = contourMovements.concat(); - + verticesMovements = contourMovements.concat(); for (let h = 0, hl = holes.length; h < hl; h++) { const ahole = holes[h]; oneHoleMovements = []; - for (let i = 0, il = ahole.length, j = il - 1, k = i + 1; i < il; i++, j++, k++) { if (j === il) j = 0; - if (k === il) k = 0; // (j)---(i)---(k) + if (k === il) k = 0; + // (j)---(i)---(k) oneHoleMovements[i] = getBevelVec(ahole[i], ahole[j], ahole[k]); } - holesMovements.push(oneHoleMovements); verticesMovements = verticesMovements.concat(oneHoleMovements); - } // Loop bevelSegments, 1 for the front, 1 for the back + } + // Loop bevelSegments, 1 for the front, 1 for the back for (let b = 0; b < bevelSegments; b++) { //for ( b = bevelSegments; b > 0; b -- ) { + const t = b / bevelSegments; const z = bevelThickness * Math.cos(t * Math.PI / 2); - const bs = bevelSize * Math.sin(t * Math.PI / 2) + bevelOffset; // contract shape + const bs = bevelSize * Math.sin(t * Math.PI / 2) + bevelOffset; + + // contract shape for (let i = 0, il = contour.length; i < il; i++) { const vert = scalePt2(contour[i], contourMovements[i], bs); v(vert.x, vert.y, -z); - } // expand holes + } + // expand holes for (let h = 0, hl = holes.length; h < hl; h++) { const ahole = holes[h]; oneHoleMovements = holesMovements[h]; - for (let i = 0, il = ahole.length; i < il; i++) { const vert = scalePt2(ahole[i], oneHoleMovements[i], bs); v(vert.x, vert.y, -z); } } } + const bs = bevelSize + bevelOffset; - const bs = bevelSize + bevelOffset; // Back facing vertices + // Back facing vertices for (let i = 0; i < vlen; i++) { const vert = bevelEnabled ? scalePt2(vertices[i], verticesMovements[i], bs) : vertices[i]; - if (!extrudeByPath) { v(vert.x, vert.y, 0); } else { // v( vert.x, vert.y + extrudePts[ 0 ].y, extrudePts[ 0 ].x ); + normal.copy(splineTube.normals[0]).multiplyScalar(vert.x); binormal.copy(splineTube.binormals[0]).multiplyScalar(vert.y); position2.copy(extrudePts[0]).add(normal).add(binormal); v(position2.x, position2.y, position2.z); } - } // Add stepped vertices... - // Including front facing vertices + } + // Add stepped vertices... + // Including front facing vertices for (let s = 1; s <= steps; s++) { for (let i = 0; i < vlen; i++) { const vert = bevelEnabled ? scalePt2(vertices[i], verticesMovements[i], bs) : vertices[i]; - if (!extrudeByPath) { v(vert.x, vert.y, depth / steps * s); } else { // v( vert.x, vert.y + extrudePts[ s - 1 ].y, extrudePts[ s - 1 ].x ); + normal.copy(splineTube.normals[s]).multiplyScalar(vert.x); binormal.copy(splineTube.binormals[s]).multiplyScalar(vert.y); position2.copy(extrudePts[s]).add(normal).add(binormal); v(position2.x, position2.y, position2.z); } } - } // Add bevel segments planes - //for ( b = 1; b <= bevelSegments; b ++ ) { + } + // Add bevel segments planes + //for ( b = 1; b <= bevelSegments; b ++ ) { for (let b = bevelSegments - 1; b >= 0; b--) { const t = b / bevelSegments; const z = bevelThickness * Math.cos(t * Math.PI / 2); - const bs = bevelSize * Math.sin(t * Math.PI / 2) + bevelOffset; // contract shape + const bs = bevelSize * Math.sin(t * Math.PI / 2) + bevelOffset; + + // contract shape for (let i = 0, il = contour.length; i < il; i++) { const vert = scalePt2(contour[i], contourMovements[i], bs); v(vert.x, vert.y, depth + z); - } // expand holes + } + // expand holes for (let h = 0, hl = holes.length; h < hl; h++) { const ahole = holes[h]; oneHoleMovements = holesMovements[h]; - for (let i = 0, il = ahole.length; i < il; i++) { const vert = scalePt2(ahole[i], oneHoleMovements[i], bs); - if (!extrudeByPath) { v(vert.x, vert.y, depth + z); } else { @@ -25408,29 +22593,35 @@ } } } + /* Faces */ + // Top and bottom faces + buildLidFaces(); + + // Sides faces - buildLidFaces(); // Sides faces + buildSideFaces(); - buildSideFaces(); ///// Internal functions + ///// Internal functions function buildLidFaces() { const start = verticesArray.length / 3; - if (bevelEnabled) { let layer = 0; // steps + 1 + let offset = vlen * layer; - let offset = vlen * layer; // Bottom faces + // Bottom faces for (let i = 0; i < flen; i++) { const face = faces[i]; f3(face[2] + offset, face[1] + offset, face[0] + offset); } - layer = steps + bevelSegments * 2; - offset = vlen * layer; // Top faces + offset = vlen * layer; + + // Top faces for (let i = 0; i < flen; i++) { const face = faces[i]; @@ -25438,64 +22629,63 @@ } } else { // Bottom faces + for (let i = 0; i < flen; i++) { const face = faces[i]; f3(face[2], face[1], face[0]); - } // Top faces + } + // Top faces for (let i = 0; i < flen; i++) { const face = faces[i]; f3(face[0] + vlen * steps, face[1] + vlen * steps, face[2] + vlen * steps); } } - scope.addGroup(start, verticesArray.length / 3 - start, 0); - } // Create faces for the z-sides of the shape + } + // Create faces for the z-sides of the shape function buildSideFaces() { const start = verticesArray.length / 3; let layeroffset = 0; sidewalls(contour, layeroffset); layeroffset += contour.length; - for (let h = 0, hl = holes.length; h < hl; h++) { const ahole = holes[h]; - sidewalls(ahole, layeroffset); //, true + sidewalls(ahole, layeroffset); + //, true layeroffset += ahole.length; } - scope.addGroup(start, verticesArray.length / 3 - start, 1); } - function sidewalls(contour, layeroffset) { let i = contour.length; - while (--i >= 0) { const j = i; let k = i - 1; - if (k < 0) k = contour.length - 1; //console.log('b', i,j, i-1, k,vertices.length); + if (k < 0) k = contour.length - 1; + + //console.log('b', i,j, i-1, k,vertices.length); for (let s = 0, sl = steps + bevelSegments * 2; s < sl; s++) { const slen1 = vlen * s; const slen2 = vlen * (s + 1); const a = layeroffset + j + slen1, - b = layeroffset + k + slen1, - c = layeroffset + k + slen2, - d = layeroffset + j + slen2; + b = layeroffset + k + slen1, + c = layeroffset + k + slen2, + d = layeroffset + j + slen2; f4(a, b, c, d); } } } - function v(x, y, z) { placeholder.push(x); placeholder.push(y); placeholder.push(z); } - function f3(a, b, c) { addVertex(a); addVertex(b); @@ -25506,7 +22696,6 @@ addUV(uvs[1]); addUV(uvs[2]); } - function f4(a, b, c, d) { addVertex(a); addVertex(b); @@ -25523,46 +22712,36 @@ addUV(uvs[2]); addUV(uvs[3]); } - function addVertex(index) { verticesArray.push(placeholder[index * 3 + 0]); verticesArray.push(placeholder[index * 3 + 1]); verticesArray.push(placeholder[index * 3 + 2]); } - function addUV(vector2) { uvArray.push(vector2.x); uvArray.push(vector2.y); } } } - toJSON() { const data = super.toJSON(); const shapes = this.parameters.shapes; const options = this.parameters.options; return toJSON$1(shapes, options, data); } - static fromJSON(data, shapes) { const geometryShapes = []; - for (let j = 0, jl = data.shapes.length; j < jl; j++) { const shape = shapes[data.shapes[j]]; geometryShapes.push(shape); } - const extrudePath = data.options.extrudePath; - if (extrudePath !== undefined) { data.options.extrudePath = new Curves[extrudePath.type]().fromJSON(extrudePath); } - return new ExtrudeGeometry(geometryShapes, data.options); } - } - const WorldUVGenerator = { generateTopUV: function (geometry, vertices, indexA, indexB, indexC) { const a_x = vertices[indexA * 3]; @@ -25586,7 +22765,6 @@ const d_x = vertices[indexD * 3]; const d_y = vertices[indexD * 3 + 1]; const d_z = vertices[indexD * 3 + 2]; - if (Math.abs(a_y - b_y) < Math.abs(a_x - b_x)) { return [new Vector2(a_x, 1 - a_z), new Vector2(b_x, 1 - b_z), new Vector2(c_x, 1 - c_z), new Vector2(d_x, 1 - d_z)]; } else { @@ -25594,10 +22772,8 @@ } } }; - function toJSON$1(shapes, options, data) { data.shapes = []; - if (Array.isArray(shapes)) { for (let i = 0, l = shapes.length; i < l; i++) { const shape = shapes[i]; @@ -25606,7 +22782,6 @@ } else { data.shapes.push(shapes.uuid); } - if (options.extrudePath !== undefined) data.options.extrudePath = options.extrudePath.toJSON(); return data; } @@ -25623,11 +22798,9 @@ detail: detail }; } - static fromJSON(data) { return new IcosahedronGeometry(data.radius, data.detail); } - } class LatheGeometry extends BufferGeometry { @@ -25640,15 +22813,21 @@ phiStart: phiStart, phiLength: phiLength }; - segments = Math.floor(segments); // clamp phiLength so it's in range of [ 0, 2PI ] + segments = Math.floor(segments); - phiLength = clamp(phiLength, 0, Math.PI * 2); // buffers + // clamp phiLength so it's in range of [ 0, 2PI ] + + phiLength = clamp(phiLength, 0, Math.PI * 2); + + // buffers const indices = []; const vertices = []; const uvs = []; const initNormals = []; - const normals = []; // helper variables + const normals = []; + + // helper variables const inverseSegments = 1.0 / segments; const vertex = new Vector3(); @@ -25657,12 +22836,15 @@ const curNormal = new Vector3(); const prevNormal = new Vector3(); let dx = 0; - let dy = 0; // pre-compute normals for initial "meridian" + let dy = 0; + + // pre-compute normals for initial "meridian" for (let j = 0; j <= points.length - 1; j++) { switch (j) { case 0: // special handling for 1st vertex on path + dx = points[j + 1].x - points[j].x; dy = points[j + 1].y - points[j].y; normal.x = dy * 1.0; @@ -25672,14 +22854,14 @@ normal.normalize(); initNormals.push(normal.x, normal.y, normal.z); break; - case points.length - 1: // special handling for last Vertex on path + initNormals.push(prevNormal.x, prevNormal.y, prevNormal.z); break; - default: // default handling for all vertices in between + dx = points[j + 1].x - points[j].x; dy = points[j + 1].y - points[j].y; normal.x = dy * 1.0; @@ -25693,32 +22875,38 @@ initNormals.push(normal.x, normal.y, normal.z); prevNormal.copy(curNormal); } - } // generate vertices, uvs and normals + } + // generate vertices, uvs and normals for (let i = 0; i <= segments; i++) { const phi = phiStart + i * inverseSegments * phiLength; const sin = Math.sin(phi); const cos = Math.cos(phi); - for (let j = 0; j <= points.length - 1; j++) { // vertex + vertex.x = points[j].x * sin; vertex.y = points[j].y; vertex.z = points[j].x * cos; - vertices.push(vertex.x, vertex.y, vertex.z); // uv + vertices.push(vertex.x, vertex.y, vertex.z); + + // uv uv.x = i / segments; uv.y = j / (points.length - 1); - uvs.push(uv.x, uv.y); // normal + uvs.push(uv.x, uv.y); + + // normal const x = initNormals[3 * j + 0] * sin; const y = initNormals[3 * j + 1]; const z = initNormals[3 * j + 0] * cos; normals.push(x, y, z); } - } // indices + } + // indices for (let i = 0; i < segments; i++) { for (let j = 0; j < points.length - 1; j++) { @@ -25726,24 +22914,25 @@ const a = base; const b = base + points.length; const c = base + points.length + 1; - const d = base + 1; // faces + const d = base + 1; + + // faces indices.push(a, b, d); indices.push(c, d, b); } - } // build geometry + } + // build geometry this.setIndex(indices); this.setAttribute('position', new Float32BufferAttribute(vertices, 3)); this.setAttribute('uv', new Float32BufferAttribute(uvs, 2)); this.setAttribute('normal', new Float32BufferAttribute(normals, 3)); } - static fromJSON(data) { return new LatheGeometry(data.points, data.segments, data.phiStart, data.phiLength); } - } class OctahedronGeometry extends PolyhedronGeometry { @@ -25757,11 +22946,9 @@ detail: detail }; } - static fromJSON(data) { return new OctahedronGeometry(data.radius, data.detail); } - } class RingGeometry extends BufferGeometry { @@ -25777,65 +22964,80 @@ thetaLength: thetaLength }; thetaSegments = Math.max(3, thetaSegments); - phiSegments = Math.max(1, phiSegments); // buffers + phiSegments = Math.max(1, phiSegments); + + // buffers const indices = []; const vertices = []; const normals = []; - const uvs = []; // some helper variables + const uvs = []; + + // some helper variables let radius = innerRadius; const radiusStep = (outerRadius - innerRadius) / phiSegments; const vertex = new Vector3(); - const uv = new Vector2(); // generate vertices, normals and uvs + const uv = new Vector2(); + + // generate vertices, normals and uvs for (let j = 0; j <= phiSegments; j++) { for (let i = 0; i <= thetaSegments; i++) { // values are generate from the inside of the ring to the outside - const segment = thetaStart + i / thetaSegments * thetaLength; // vertex + + const segment = thetaStart + i / thetaSegments * thetaLength; + + // vertex vertex.x = radius * Math.cos(segment); vertex.y = radius * Math.sin(segment); - vertices.push(vertex.x, vertex.y, vertex.z); // normal + vertices.push(vertex.x, vertex.y, vertex.z); + + // normal + + normals.push(0, 0, 1); - normals.push(0, 0, 1); // uv + // uv uv.x = (vertex.x / outerRadius + 1) / 2; uv.y = (vertex.y / outerRadius + 1) / 2; uvs.push(uv.x, uv.y); - } // increase the radius for next row of vertices + } + // increase the radius for next row of vertices radius += radiusStep; - } // indices + } + // indices for (let j = 0; j < phiSegments; j++) { const thetaSegmentLevel = j * (thetaSegments + 1); - for (let i = 0; i < thetaSegments; i++) { const segment = i + thetaSegmentLevel; const a = segment; const b = segment + thetaSegments + 1; const c = segment + thetaSegments + 2; - const d = segment + 1; // faces + const d = segment + 1; + + // faces indices.push(a, b, d); indices.push(b, c, d); } - } // build geometry + } + // build geometry this.setIndex(indices); this.setAttribute('position', new Float32BufferAttribute(vertices, 3)); this.setAttribute('normal', new Float32BufferAttribute(normals, 3)); this.setAttribute('uv', new Float32BufferAttribute(uvs, 2)); } - static fromJSON(data) { return new RingGeometry(data.innerRadius, data.outerRadius, data.thetaSegments, data.phiSegments, data.thetaStart, data.thetaLength); } - } class ShapeGeometry extends BufferGeometry { @@ -25845,15 +23047,21 @@ this.parameters = { shapes: shapes, curveSegments: curveSegments - }; // buffers + }; + + // buffers const indices = []; const vertices = []; const normals = []; - const uvs = []; // helper variables + const uvs = []; + + // helper variables let groupStart = 0; - let groupCount = 0; // allow single and array values for "shapes" parameter + let groupCount = 0; + + // allow single and array values for "shapes" parameter if (Array.isArray(shapes) === false) { addShape(shapes); @@ -25865,47 +23073,53 @@ groupStart += groupCount; groupCount = 0; } - } // build geometry + } + // build geometry this.setIndex(indices); this.setAttribute('position', new Float32BufferAttribute(vertices, 3)); this.setAttribute('normal', new Float32BufferAttribute(normals, 3)); - this.setAttribute('uv', new Float32BufferAttribute(uvs, 2)); // helper functions + this.setAttribute('uv', new Float32BufferAttribute(uvs, 2)); + + // helper functions function addShape(shape) { const indexOffset = vertices.length / 3; const points = shape.extractPoints(curveSegments); let shapeVertices = points.shape; - const shapeHoles = points.holes; // check direction of vertices + const shapeHoles = points.holes; + + // check direction of vertices if (ShapeUtils.isClockWise(shapeVertices) === false) { shapeVertices = shapeVertices.reverse(); } - for (let i = 0, l = shapeHoles.length; i < l; i++) { const shapeHole = shapeHoles[i]; - if (ShapeUtils.isClockWise(shapeHole) === true) { shapeHoles[i] = shapeHole.reverse(); } } + const faces = ShapeUtils.triangulateShape(shapeVertices, shapeHoles); - const faces = ShapeUtils.triangulateShape(shapeVertices, shapeHoles); // join vertices of inner and outer paths to a single array + // join vertices of inner and outer paths to a single array for (let i = 0, l = shapeHoles.length; i < l; i++) { const shapeHole = shapeHoles[i]; shapeVertices = shapeVertices.concat(shapeHole); - } // vertices, normals, uvs + } + // vertices, normals, uvs for (let i = 0, l = shapeVertices.length; i < l; i++) { const vertex = shapeVertices[i]; vertices.push(vertex.x, vertex.y, 0); normals.push(0, 0, 1); uvs.push(vertex.x, vertex.y); // world uvs - } // incides + } + // incides for (let i = 0, l = faces.length; i < l; i++) { const face = faces[i]; @@ -25917,29 +23131,22 @@ } } } - toJSON() { const data = super.toJSON(); const shapes = this.parameters.shapes; return toJSON(shapes, data); } - static fromJSON(data, shapes) { const geometryShapes = []; - for (let j = 0, jl = data.shapes.length; j < jl; j++) { const shape = shapes[data.shapes[j]]; geometryShapes.push(shape); } - return new ShapeGeometry(geometryShapes, data.curveSegments); } - } - function toJSON(shapes, data) { data.shapes = []; - if (Array.isArray(shapes)) { for (let i = 0, l = shapes.length; i < l; i++) { const shape = shapes[i]; @@ -25948,7 +23155,6 @@ } else { data.shapes.push(shapes.uuid); } - return data; } @@ -25971,43 +23177,53 @@ let index = 0; const grid = []; const vertex = new Vector3(); - const normal = new Vector3(); // buffers + const normal = new Vector3(); + + // buffers const indices = []; const vertices = []; const normals = []; - const uvs = []; // generate vertices, normals and uvs + const uvs = []; + + // generate vertices, normals and uvs for (let iy = 0; iy <= heightSegments; iy++) { const verticesRow = []; - const v = iy / heightSegments; // special case for the poles + const v = iy / heightSegments; - let uOffset = 0; + // special case for the poles + let uOffset = 0; if (iy == 0 && thetaStart == 0) { uOffset = 0.5 / widthSegments; } else if (iy == heightSegments && thetaEnd == Math.PI) { uOffset = -0.5 / widthSegments; } - for (let ix = 0; ix <= widthSegments; ix++) { - const u = ix / widthSegments; // vertex + const u = ix / widthSegments; + + // vertex vertex.x = -radius * Math.cos(phiStart + u * phiLength) * Math.sin(thetaStart + v * thetaLength); vertex.y = radius * Math.cos(thetaStart + v * thetaLength); vertex.z = radius * Math.sin(phiStart + u * phiLength) * Math.sin(thetaStart + v * thetaLength); - vertices.push(vertex.x, vertex.y, vertex.z); // normal + vertices.push(vertex.x, vertex.y, vertex.z); + + // normal normal.copy(vertex).normalize(); - normals.push(normal.x, normal.y, normal.z); // uv + normals.push(normal.x, normal.y, normal.z); + + // uv uvs.push(u + uOffset, 1 - v); verticesRow.push(index++); } - grid.push(verticesRow); - } // indices + } + // indices for (let iy = 0; iy < heightSegments; iy++) { for (let ix = 0; ix < widthSegments; ix++) { @@ -26018,19 +23234,18 @@ if (iy !== 0 || thetaStart > 0) indices.push(a, b, d); if (iy !== heightSegments - 1 || thetaEnd < Math.PI) indices.push(b, c, d); } - } // build geometry + } + // build geometry this.setIndex(indices); this.setAttribute('position', new Float32BufferAttribute(vertices, 3)); this.setAttribute('normal', new Float32BufferAttribute(normals, 3)); this.setAttribute('uv', new Float32BufferAttribute(uvs, 2)); } - static fromJSON(data) { return new SphereGeometry(data.radius, data.widthSegments, data.heightSegments, data.phiStart, data.phiLength, data.thetaStart, data.thetaLength); } - } class TetrahedronGeometry extends PolyhedronGeometry { @@ -26044,11 +23259,9 @@ detail: detail }; } - static fromJSON(data) { return new TetrahedronGeometry(data.radius, data.detail); } - } class TorusGeometry extends BufferGeometry { @@ -26063,62 +23276,77 @@ arc: arc }; radialSegments = Math.floor(radialSegments); - tubularSegments = Math.floor(tubularSegments); // buffers + tubularSegments = Math.floor(tubularSegments); + + // buffers const indices = []; const vertices = []; const normals = []; - const uvs = []; // helper variables + const uvs = []; + + // helper variables const center = new Vector3(); const vertex = new Vector3(); - const normal = new Vector3(); // generate vertices, normals and uvs + const normal = new Vector3(); + + // generate vertices, normals and uvs for (let j = 0; j <= radialSegments; j++) { for (let i = 0; i <= tubularSegments; i++) { const u = i / tubularSegments * arc; - const v = j / radialSegments * Math.PI * 2; // vertex + const v = j / radialSegments * Math.PI * 2; + + // vertex vertex.x = (radius + tube * Math.cos(v)) * Math.cos(u); vertex.y = (radius + tube * Math.cos(v)) * Math.sin(u); vertex.z = tube * Math.sin(v); - vertices.push(vertex.x, vertex.y, vertex.z); // normal + vertices.push(vertex.x, vertex.y, vertex.z); + + // normal center.x = radius * Math.cos(u); center.y = radius * Math.sin(u); normal.subVectors(vertex, center).normalize(); - normals.push(normal.x, normal.y, normal.z); // uv + normals.push(normal.x, normal.y, normal.z); + + // uv uvs.push(i / tubularSegments); uvs.push(j / radialSegments); } - } // generate indices + } + // generate indices for (let j = 1; j <= radialSegments; j++) { for (let i = 1; i <= tubularSegments; i++) { // indices + const a = (tubularSegments + 1) * j + i - 1; const b = (tubularSegments + 1) * (j - 1) + i - 1; const c = (tubularSegments + 1) * (j - 1) + i; - const d = (tubularSegments + 1) * j + i; // faces + const d = (tubularSegments + 1) * j + i; + + // faces indices.push(a, b, d); indices.push(b, c, d); } - } // build geometry + } + // build geometry this.setIndex(indices); this.setAttribute('position', new Float32BufferAttribute(vertices, 3)); this.setAttribute('normal', new Float32BufferAttribute(normals, 3)); this.setAttribute('uv', new Float32BufferAttribute(uvs, 2)); } - static fromJSON(data) { return new TorusGeometry(data.radius, data.tube, data.radialSegments, data.tubularSegments, data.arc); } - } class TorusKnotGeometry extends BufferGeometry { @@ -26134,12 +23362,16 @@ q: q }; tubularSegments = Math.floor(tubularSegments); - radialSegments = Math.floor(radialSegments); // buffers + radialSegments = Math.floor(radialSegments); + + // buffers const indices = []; const vertices = []; const normals = []; - const uvs = []; // helper variables + const uvs = []; + + // helper variables const vertex = new Vector3(); const normal = new Vector3(); @@ -26147,64 +23379,86 @@ const P2 = new Vector3(); const B = new Vector3(); const T = new Vector3(); - const N = new Vector3(); // generate vertices, normals and uvs + const N = new Vector3(); + + // generate vertices, normals and uvs for (let i = 0; i <= tubularSegments; ++i) { // the radian "u" is used to calculate the position on the torus curve of the current tubular segement - const u = i / tubularSegments * p * Math.PI * 2; // now we calculate two points. P1 is our current position on the curve, P2 is a little farther ahead. + + const u = i / tubularSegments * p * Math.PI * 2; + + // now we calculate two points. P1 is our current position on the curve, P2 is a little farther ahead. // these points are used to create a special "coordinate space", which is necessary to calculate the correct vertex positions calculatePositionOnCurve(u, p, q, radius, P1); - calculatePositionOnCurve(u + 0.01, p, q, radius, P2); // calculate orthonormal basis + calculatePositionOnCurve(u + 0.01, p, q, radius, P2); + + // calculate orthonormal basis T.subVectors(P2, P1); N.addVectors(P2, P1); B.crossVectors(T, N); - N.crossVectors(B, T); // normalize B, N. T can be ignored, we don't use it + N.crossVectors(B, T); + + // normalize B, N. T can be ignored, we don't use it B.normalize(); N.normalize(); - for (let j = 0; j <= radialSegments; ++j) { // now calculate the vertices. they are nothing more than an extrusion of the torus curve. // because we extrude a shape in the xy-plane, there is no need to calculate a z-value. + const v = j / radialSegments * Math.PI * 2; const cx = -tube * Math.cos(v); - const cy = tube * Math.sin(v); // now calculate the final vertex position. + const cy = tube * Math.sin(v); + + // now calculate the final vertex position. // first we orient the extrusion with our basis vectos, then we add it to the current position on the curve vertex.x = P1.x + (cx * N.x + cy * B.x); vertex.y = P1.y + (cx * N.y + cy * B.y); vertex.z = P1.z + (cx * N.z + cy * B.z); - vertices.push(vertex.x, vertex.y, vertex.z); // normal (P1 is always the center/origin of the extrusion, thus we can use it to calculate the normal) + vertices.push(vertex.x, vertex.y, vertex.z); + + // normal (P1 is always the center/origin of the extrusion, thus we can use it to calculate the normal) normal.subVectors(vertex, P1).normalize(); - normals.push(normal.x, normal.y, normal.z); // uv + normals.push(normal.x, normal.y, normal.z); + + // uv uvs.push(i / tubularSegments); uvs.push(j / radialSegments); } - } // generate indices + } + // generate indices for (let j = 1; j <= tubularSegments; j++) { for (let i = 1; i <= radialSegments; i++) { // indices + const a = (radialSegments + 1) * (j - 1) + (i - 1); const b = (radialSegments + 1) * j + (i - 1); const c = (radialSegments + 1) * j + i; - const d = (radialSegments + 1) * (j - 1) + i; // faces + const d = (radialSegments + 1) * (j - 1) + i; + + // faces indices.push(a, b, d); indices.push(b, c, d); } - } // build geometry + } + // build geometry this.setIndex(indices); this.setAttribute('position', new Float32BufferAttribute(vertices, 3)); this.setAttribute('normal', new Float32BufferAttribute(normals, 3)); - this.setAttribute('uv', new Float32BufferAttribute(uvs, 2)); // this function calculates the current position on the torus curve + this.setAttribute('uv', new Float32BufferAttribute(uvs, 2)); + + // this function calculates the current position on the torus curve function calculatePositionOnCurve(u, p, q, radius, position) { const cu = Math.cos(u); @@ -26216,11 +23470,9 @@ position.z = radius * Math.sin(quOverP) * 0.5; } } - static fromJSON(data) { return new TorusKnotGeometry(data.radius, data.tube, data.tubularSegments, data.radialSegments, data.p, data.q); } - } class TubeGeometry extends BufferGeometry { @@ -26234,63 +23486,88 @@ radialSegments: radialSegments, closed: closed }; - const frames = path.computeFrenetFrames(tubularSegments, closed); // expose internals + const frames = path.computeFrenetFrames(tubularSegments, closed); + + // expose internals this.tangents = frames.tangents; this.normals = frames.normals; - this.binormals = frames.binormals; // helper variables + this.binormals = frames.binormals; + + // helper variables const vertex = new Vector3(); const normal = new Vector3(); const uv = new Vector2(); - let P = new Vector3(); // buffer + let P = new Vector3(); + + // buffer const vertices = []; const normals = []; const uvs = []; - const indices = []; // create buffer data + const indices = []; - generateBufferData(); // build geometry + // create buffer data + + generateBufferData(); + + // build geometry this.setIndex(indices); this.setAttribute('position', new Float32BufferAttribute(vertices, 3)); this.setAttribute('normal', new Float32BufferAttribute(normals, 3)); - this.setAttribute('uv', new Float32BufferAttribute(uvs, 2)); // functions + this.setAttribute('uv', new Float32BufferAttribute(uvs, 2)); + + // functions function generateBufferData() { for (let i = 0; i < tubularSegments; i++) { generateSegment(i); - } // if the geometry is not closed, generate the last row of vertices and normals + } + + // if the geometry is not closed, generate the last row of vertices and normals // at the regular position on the given path // // if the geometry is closed, duplicate the first row of vertices and normals (uvs will differ) + generateSegment(closed === false ? tubularSegments : 0); - generateSegment(closed === false ? tubularSegments : 0); // uvs are generated in a separate function. + // uvs are generated in a separate function. // this makes it easy compute correct values for closed geometries - generateUVs(); // finally create faces + generateUVs(); + + // finally create faces generateIndices(); } - function generateSegment(i) { // we use getPointAt to sample evenly distributed points from the given path - P = path.getPointAt(i / tubularSegments, P); // retrieve corresponding normal and binormal + + P = path.getPointAt(i / tubularSegments, P); + + // retrieve corresponding normal and binormal const N = frames.normals[i]; - const B = frames.binormals[i]; // generate normals and vertices for the current segment + const B = frames.binormals[i]; + + // generate normals and vertices for the current segment for (let j = 0; j <= radialSegments; j++) { const v = j / radialSegments * Math.PI * 2; const sin = Math.sin(v); - const cos = -Math.cos(v); // normal + const cos = -Math.cos(v); + + // normal normal.x = cos * N.x + sin * B.x; normal.y = cos * N.y + sin * B.y; normal.z = cos * N.z + sin * B.z; normal.normalize(); - normals.push(normal.x, normal.y, normal.z); // vertex + normals.push(normal.x, normal.y, normal.z); + + // vertex vertex.x = P.x + radius * normal.x; vertex.y = P.y + radius * normal.y; @@ -26298,21 +23575,21 @@ vertices.push(vertex.x, vertex.y, vertex.z); } } - function generateIndices() { for (let j = 1; j <= tubularSegments; j++) { for (let i = 1; i <= radialSegments; i++) { const a = (radialSegments + 1) * (j - 1) + (i - 1); const b = (radialSegments + 1) * j + (i - 1); const c = (radialSegments + 1) * j + i; - const d = (radialSegments + 1) * (j - 1) + i; // faces + const d = (radialSegments + 1) * (j - 1) + i; + + // faces indices.push(a, b, d); indices.push(b, c, d); } } } - function generateUVs() { for (let i = 0; i <= tubularSegments; i++) { for (let j = 0; j <= radialSegments; j++) { @@ -26323,19 +23600,16 @@ } } } - toJSON() { const data = super.toJSON(); data.path = this.parameters.path.toJSON(); return data; } - static fromJSON(data) { // This only works for built-in curves (e.g. CatmullRomCurve3). // User defined curves or instances of CurvePath will not be deserialized. return new TubeGeometry(new Curves[data.path.type]().fromJSON(data.path), data.tubularSegments, data.radius, data.radialSegments, data.closed); } - } class WireframeGeometry extends BufferGeometry { @@ -26345,42 +23619,42 @@ this.parameters = { geometry: geometry }; - if (geometry !== null) { // buffer + const vertices = []; - const edges = new Set(); // helper variables + const edges = new Set(); + + // helper variables const start = new Vector3(); const end = new Vector3(); - if (geometry.index !== null) { // indexed BufferGeometry + const position = geometry.attributes.position; const indices = geometry.index; let groups = geometry.groups; - if (groups.length === 0) { groups = [{ start: 0, count: indices.count, materialIndex: 0 }]; - } // create a data structure that contains all eges without duplicates + } + // create a data structure that contains all eges without duplicates for (let o = 0, ol = groups.length; o < ol; ++o) { const group = groups[o]; const groupStart = group.start; const groupCount = group.count; - for (let i = groupStart, l = groupStart + groupCount; i < l; i += 3) { for (let j = 0; j < 3; j++) { const index1 = indices.getX(i + j); const index2 = indices.getX(i + (j + 1) % 3); start.fromBufferAttribute(position, index1); end.fromBufferAttribute(position, index2); - if (isUniqueEdge(start, end, edges) === true) { vertices.push(start.x, start.y, start.z); vertices.push(end.x, end.y, end.z); @@ -26390,32 +23664,31 @@ } } else { // non-indexed BufferGeometry - const position = geometry.attributes.position; + const position = geometry.attributes.position; for (let i = 0, l = position.count / 3; i < l; i++) { for (let j = 0; j < 3; j++) { // three edges per triangle, an edge is represented as (index1, index2) // e.g. the first triangle has the following edges: (0,1),(1,2),(2,0) + const index1 = 3 * i + j; const index2 = 3 * i + (j + 1) % 3; start.fromBufferAttribute(position, index1); end.fromBufferAttribute(position, index2); - if (isUniqueEdge(start, end, edges) === true) { vertices.push(start.x, start.y, start.z); vertices.push(end.x, end.y, end.z); } } } - } // build geometry + } + // build geometry this.setAttribute('position', new Float32BufferAttribute(vertices, 3)); } } - } - function isUniqueEdge(start, end, edges) { const hash1 = `${start.x},${start.y},${start.z}-${end.x},${end.y},${end.z}`; const hash2 = `${end.x},${end.y},${end.z}-${start.x},${start.y},${start.z}`; // coincident edge @@ -26484,15 +23757,12 @@ this.transparent = true; this.setValues(parameters); } - copy(source) { super.copy(source); this.color.copy(source.color); return this; } - } - ShadowMaterial.prototype.isShadowMaterial = true; /** @@ -26551,17 +23821,14 @@ this.defines = { 'STANDARD': '' }; - if (Material.r115Compatible) { this.defines['MULTISCATTERRING_R115_COMPATABILITY'] = ''; this.defines['ALPHA_R115_COMPATABILITY'] = ''; this.defines['PERTURB_NORMAL_R115_COMPATABILITY'] = ''; this.defines['CLEARCOAT_R115_COMPATABILITY'] = ''; } - this.type = 'MeshStandardMaterial'; this.color = new Color(0xffffff); // diffuse - this.roughness = 1.0; this.metalness = 0.0; this.f90 = 1.0; @@ -26596,19 +23863,15 @@ this.flatShading = false; this.setValues(parameters); } - get refraction() { return this._refraction; } - set refraction(value) { if (this._refraction > 0 !== value > 0) { this.version++; } - this._refraction = value; } - copy(source) { super.copy(source); this.defines = source.defines; @@ -26647,9 +23910,7 @@ this.flatShading = source.flatShading; return this; } - } - MeshStandardMaterial.prototype.isMeshStandardMaterial = true; /** @@ -26722,43 +23983,33 @@ this._transmission = 0; this.setValues(parameters); } - get sheen() { return this._sheen; } - set sheen(value) { if (this._sheen > 0 !== value > 0) { this.version++; } - this._sheen = value; } - get clearcoat() { return this._clearcoat; } - set clearcoat(value) { if (this._clearcoat > 0 !== value > 0) { this.version++; } - this._clearcoat = value; } - get transmission() { return this._transmission; } - set transmission(value) { if (this._transmission > 0 !== value > 0) { this.version++; } - this._transmission = value; } - copy(source) { super.copy(source); this.defines = source.defines; @@ -26786,9 +24037,7 @@ this.specularColorMap = source.specularColorMap; return this; } - } - MeshPhysicalMaterial.prototype.isMeshPhysicalMaterial = true; /** @@ -26842,7 +24091,6 @@ super(); this.type = 'MeshPhongMaterial'; this.color = new Color(0xffffff); // diffuse - this.specular = new Color(0x111111); this.shininess = 30; this.map = null; @@ -26874,7 +24122,6 @@ this.flatShading = false; this.setValues(parameters); } - copy(source) { super.copy(source); this.color.copy(source.color); @@ -26909,9 +24156,7 @@ this.flatShading = source.flatShading; return this; } - } - MeshPhongMaterial.prototype.isMeshPhongMaterial = true; class MeshNoTonePhongMaterial extends MeshPhongMaterial { @@ -26925,7 +24170,6 @@ set: function () {} }); } - } /** @@ -26996,7 +24240,6 @@ this.wireframeLinejoin = 'round'; this.setValues(parameters); } - copy(source) { super.copy(source); this.color.copy(source.color); @@ -27024,9 +24267,7 @@ this.wireframeLinejoin = source.wireframeLinejoin; return this; } - } - MeshToonMaterial.prototype.isMeshToonMaterial = true; /** @@ -27069,7 +24310,6 @@ this.flatShading = false; this.setValues(parameters); } - copy(source) { super.copy(source); this.bumpMap = source.bumpMap; @@ -27085,9 +24325,7 @@ this.flatShading = source.flatShading; return this; } - } - MeshNormalMaterial.prototype.isMeshNormalMaterial = true; /** @@ -27148,7 +24386,6 @@ this.wireframeLinejoin = 'round'; this.setValues(parameters); } - copy(source) { super.copy(source); this.color.copy(source.color); @@ -27172,9 +24409,7 @@ this.wireframeLinejoin = source.wireframeLinejoin; return this; } - } - MeshLambertMaterial.prototype.isMeshLambertMaterial = true; /** @@ -27209,11 +24444,9 @@ this.defines = { 'MATCAP': '' }; - if (Material.r115Compatible === true) { this.defines['PERTURB_NORMAL_R115_COMPATABILITY'] = ''; } - this.type = 'MeshMatcapMaterial'; this.color = new Color(0xffffff); // diffuse @@ -27231,7 +24464,6 @@ this.flatShading = false; this.setValues(parameters); } - copy(source) { super.copy(source); this.defines = source.defines; @@ -27250,30 +24482,24 @@ this.flatShading = source.flatShading; return this; } - } - MeshMatcapMaterial.prototype.isMeshMatcapMaterial = true; /** * Used in gltfloader, filp uv's v for matcap texture. */ - class OFTMatcapMaterial extends MeshMatcapMaterial { constructor(parameters) { super(parameters); this.type = 'OFTMatcapMaterial'; this.defines.OFT_MATCAP = ''; } - copy(source) { super.copy(source); this.defines = Object.assign({}, source.defines); return this; } - } - OFTMatcapMaterial.prototype.isOFTMatcapMaterial = true; /** @@ -27281,13 +24507,10 @@ * * Specification: https://github.com/oppenfuture/glTF/tree/pointSprite/extensions/2.0/Vendor/OFT_materials_pointSprite */ - class OFTPointSpriteMaterial extends ShaderMaterial { constructor(params) { const localParams = { - vertexShader: - /* glsl */ - ` + vertexShader: /* glsl */` attribute float size; uniform float pointSize; @@ -27335,9 +24558,7 @@ } `, - fragmentShader: - /* glsl */ - ` + fragmentShader: /* glsl */` precision highp float; #include @@ -27405,14 +24626,12 @@ vertexColors: true }; super(localParams); - if (params != undefined) { this._pointSize = params.pointSize || 50; this._depthBias = params.depthBias || 0.001; this._pointTexture = params.pointTexture || null; this._depthTexture = params.depthTexture || null; } - this.uniforms = { pointSize: { value: this.pointSize @@ -27429,50 +24648,40 @@ }; this.type = 'OFTPointSpriteMaterial'; } - get pointSize() { return this._pointSize; } - set pointSize(value) { this._pointSize = value; this.uniforms.pointSize.value = value; } - get depthBias() { return this._depthBias; } - set depthBias(value) { this._depthBias = value; this.uniforms.depthBias.value = value; - } // enable code injection: mapTexelToLinear - + } + // enable code injection: mapTexelToLinear get map() { return this._pointTexture; } - get pointTexture() { return this._pointTexture; } - set pointTexture(value) { this._pointTexture = value; this.uniforms.pointTexture.value = value; } - get depthTexture() { return this._depthTexture; } - set depthTexture(value) { this._depthTexture = value; this.uniforms.depthTexture.value = value; } - } - OFTPointSpriteMaterial.prototype.isOFTPointSpriteMaterial = true; /** @@ -27497,7 +24706,6 @@ this.gapSize = 1; this.setValues(parameters); } - copy(source) { super.copy(source); this.scale = source.scale; @@ -27505,9 +24713,7 @@ this.gapSize = source.gapSize; return this; } - } - LineDashedMaterial.prototype.isLineDashedMaterial = true; var Materials = /*#__PURE__*/Object.freeze({ @@ -27543,18 +24749,16 @@ // but array.subarray(from) or array.subarray(from, len) is correct return new array.constructor(array.subarray(from, to !== undefined ? to : array.length)); } - return array.slice(from, to); }, // converts an array to a specific type convertArray: function (array, type, forceClone) { - if (!array || // let 'undefined' and 'null' pass + if (!array || + // let 'undefined' and 'null' pass !forceClone && array.constructor === type) return array; - if (typeof type.BYTES_PER_ELEMENT === 'number') { return new type(array); // create typed array } - return Array.prototype.slice.call(array); // create Array }, isTypedArray: function (object) { @@ -27565,12 +24769,9 @@ function compareTime(i, j) { return times[i] - times[j]; } - const n = times.length; const result = new Array(n); - for (let i = 0; i !== n; ++i) result[i] = i; - result.sort(compareTime); return result; }, @@ -27578,26 +24779,21 @@ sortedArray: function (values, stride, order) { const nValues = values.length; const result = new values.constructor(nValues); - for (let i = 0, dstOffset = 0; dstOffset !== nValues; ++i) { const srcOffset = order[i] * stride; - for (let j = 0; j !== stride; ++j) { result[dstOffset++] = values[srcOffset + j]; } } - return result; }, // function for parsing AOS keyframe formats flattenJSON: function (jsonKeys, times, values, valuePropertyName) { let i = 1, - key = jsonKeys[0]; - + key = jsonKeys[0]; while (key !== undefined && key[valuePropertyName] === undefined) { key = jsonKeys[i++]; } - if (key === undefined) return; // no data let value = key[valuePropertyName]; @@ -27606,36 +24802,32 @@ if (Array.isArray(value)) { do { value = key[valuePropertyName]; - if (value !== undefined) { times.push(key.time); values.push.apply(values, value); // push all elements } - key = jsonKeys[i++]; } while (key !== undefined); } else if (value.toArray !== undefined) { // ...assume THREE.Math-ish + do { value = key[valuePropertyName]; - if (value !== undefined) { times.push(key.time); value.toArray(values, values.length); } - key = jsonKeys[i++]; } while (key !== undefined); } else { // otherwise push as-is + do { value = key[valuePropertyName]; - if (value !== undefined) { times.push(key.time); values.push(value); } - key = jsonKeys[i++]; } while (key !== undefined); } @@ -27644,79 +24836,75 @@ const clip = sourceClip.clone(); clip.name = name; const tracks = []; - for (let i = 0; i < clip.tracks.length; ++i) { const track = clip.tracks[i]; const valueSize = track.getValueSize(); const times = []; const values = []; - for (let j = 0; j < track.times.length; ++j) { const frame = track.times[j] * fps; if (frame < startFrame || frame >= endFrame) continue; times.push(track.times[j]); - for (let k = 0; k < valueSize; ++k) { values.push(track.values[j * valueSize + k]); } } - if (times.length === 0) continue; track.times = AnimationUtils.convertArray(times, track.times.constructor); track.values = AnimationUtils.convertArray(values, track.values.constructor); tracks.push(track); } + clip.tracks = tracks; - clip.tracks = tracks; // find minimum .times value across all tracks in the trimmed clip + // find minimum .times value across all tracks in the trimmed clip let minStartTime = Infinity; - for (let i = 0; i < clip.tracks.length; ++i) { if (minStartTime > clip.tracks[i].times[0]) { minStartTime = clip.tracks[i].times[0]; } - } // shift all tracks such that clip begins at t=0 + } + // shift all tracks such that clip begins at t=0 for (let i = 0; i < clip.tracks.length; ++i) { clip.tracks[i].shift(-1 * minStartTime); } - clip.resetDuration(); return clip; }, makeClipAdditive: function (targetClip, referenceFrame = 0, referenceClip = targetClip, fps = 30) { if (fps <= 0) fps = 30; const numTracks = referenceClip.tracks.length; - const referenceTime = referenceFrame / fps; // Make each track's values relative to the values at the reference frame + const referenceTime = referenceFrame / fps; + // Make each track's values relative to the values at the reference frame for (let i = 0; i < numTracks; ++i) { const referenceTrack = referenceClip.tracks[i]; - const referenceTrackType = referenceTrack.ValueTypeName; // Skip this track if it's non-numeric + const referenceTrackType = referenceTrack.ValueTypeName; - if (referenceTrackType === 'bool' || referenceTrackType === 'string') continue; // Find the track in the target clip whose name and type matches the reference track + // Skip this track if it's non-numeric + if (referenceTrackType === 'bool' || referenceTrackType === 'string') continue; + // Find the track in the target clip whose name and type matches the reference track const targetTrack = targetClip.tracks.find(function (track) { return track.name === referenceTrack.name && track.ValueTypeName === referenceTrackType; }); if (targetTrack === undefined) continue; let referenceOffset = 0; const referenceValueSize = referenceTrack.getValueSize(); - if (referenceTrack.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline) { referenceOffset = referenceValueSize / 3; } - let targetOffset = 0; const targetValueSize = targetTrack.getValueSize(); - if (targetTrack.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline) { targetOffset = targetValueSize / 3; } - const lastIndex = referenceTrack.times.length - 1; - let referenceValue; // Find the value to subtract out of the track + let referenceValue; + // Find the value to subtract out of the track if (referenceTime <= referenceTrack.times[0]) { // Reference frame is earlier than the first keyframe, so just use the first keyframe const startIndex = referenceOffset; @@ -27734,33 +24922,32 @@ const endIndex = referenceValueSize - referenceOffset; interpolant.evaluate(referenceTime); referenceValue = AnimationUtils.arraySlice(interpolant.resultBuffer, startIndex, endIndex); - } // Conjugate the quaternion - + } + // Conjugate the quaternion if (referenceTrackType === 'quaternion') { const referenceQuat = new Quaternion().fromArray(referenceValue).normalize().conjugate(); referenceQuat.toArray(referenceValue); - } // Subtract the reference value from all of the track values + } + // Subtract the reference value from all of the track values const numTimes = targetTrack.times.length; - for (let j = 0; j < numTimes; ++j) { const valueStart = j * targetValueSize + targetOffset; - if (referenceTrackType === 'quaternion') { // Multiply the conjugate for quaternion track types Quaternion.multiplyQuaternionsFlat(targetTrack.values, valueStart, referenceValue, 0, targetTrack.values, valueStart); } else { - const valueEnd = targetValueSize - targetOffset * 2; // Subtract each value for all other numeric track types + const valueEnd = targetValueSize - targetOffset * 2; + // Subtract each value for all other numeric track types for (let k = 0; k < valueEnd; ++k) { targetTrack.values[valueStart + k] -= referenceValue[k]; } } } } - targetClip.blendMode = AdditiveAnimationBlendMode; return targetClip; } @@ -27786,6 +24973,7 @@ * http://www.oodesign.com/template-method-pattern.html * */ + class Interpolant { constructor(parameterPositions, sampleValues, sampleSize, resultBuffer) { this.parameterPositions = parameterPositions; @@ -27796,17 +24984,14 @@ this.settings = null; this.DefaultSettings_ = {}; } - evaluate(t) { const pp = this.parameterPositions; let i1 = this._cachedIndex, - t1 = pp[i1], - t0 = pp[i1 - 1]; - + t1 = pp[i1], + t0 = pp[i1 - 1]; validate_interval: { seek: { let right; - linear_scan: { //- See http://jsperf.com/comparison-to-undefined/3 //- slower code: @@ -27815,90 +25000,89 @@ forward_scan: if (!(t < t1)) { for (let giveUpAt = i1 + 2;;) { if (t1 === undefined) { - if (t < t0) break forward_scan; // after end + if (t < t0) break forward_scan; + + // after end i1 = pp.length; this._cachedIndex = i1; return this.afterEnd_(i1 - 1, t, t0); } - if (i1 === giveUpAt) break; // this loop t0 = t1; t1 = pp[++i1]; - if (t < t1) { // we have arrived at the sought interval break seek; } - } // prepare binary search on the right side of the index - + } + // prepare binary search on the right side of the index right = pp.length; break linear_scan; - } //- slower code: - //- if ( t < t0 || t0 === undefined ) { - + } + //- slower code: + //- if ( t < t0 || t0 === undefined ) { if (!(t >= t0)) { // looping? - const t1global = pp[1]; + const t1global = pp[1]; if (t < t1global) { i1 = 2; // + 1, using the scan for the details - t0 = t1global; - } // linear reverse scan + } + // linear reverse scan for (let giveUpAt = i1 - 2;;) { if (t0 === undefined) { // before start + this._cachedIndex = 0; return this.beforeStart_(0, t, t1); } - if (i1 === giveUpAt) break; // this loop t1 = t0; t0 = pp[--i1 - 1]; - if (t >= t0) { // we have arrived at the sought interval break seek; } - } // prepare binary search on the left side of the index - + } + // prepare binary search on the left side of the index right = i1; i1 = 0; break linear_scan; - } // the interval is valid + } + // the interval is valid break validate_interval; } // linear scan - // binary search + // binary search while (i1 < right) { const mid = i1 + right >>> 1; - if (t < pp[mid]) { right = mid; } else { i1 = mid + 1; } } - t1 = pp[i1]; - t0 = pp[i1 - 1]; // check boundary cases, again + t0 = pp[i1 - 1]; + + // check boundary cases, again if (t0 === undefined) { this._cachedIndex = 0; return this.beforeStart_(0, t, t1); } - if (t1 === undefined) { i1 = pp.length; this._cachedIndex = i1; @@ -27906,43 +25090,43 @@ } } // seek - this._cachedIndex = i1; this.intervalChanged_(i1, t0, t1); } // validate_interval - return this.interpolate_(i1, t0, t, t1); } - getSettings_() { return this.settings || this.DefaultSettings_; } - copySampleValue_(index) { // copies a sample value to the result buffer - const result = this.resultBuffer, - values = this.sampleValues, - stride = this.valueSize, - offset = index * stride; + const result = this.resultBuffer, + values = this.sampleValues, + stride = this.valueSize, + offset = index * stride; for (let i = 0; i !== stride; ++i) { result[i] = values[offset + i]; } - return result; - } // Template methods for derived classes: + } + // Template methods for derived classes: - interpolate_() { - throw new Error('call to abstract method'); // implementations shall return this.resultBuffer + interpolate_(/* i1, t0, t, t1 */ + ) { + throw new Error('call to abstract method'); + // implementations shall return this.resultBuffer } + intervalChanged_(/* i1, t0, t1 */ + ) { - intervalChanged_() {// empty + // empty } + } - } // ALIAS DEFINITIONS - + // ALIAS DEFINITIONS Interpolant.prototype.beforeStart_ = Interpolant.prototype.copySampleValue_; Interpolant.prototype.afterEnd_ = Interpolant.prototype.copySampleValue_; @@ -27967,14 +25151,12 @@ endingEnd: ZeroCurvatureEnding }; } - intervalChanged_(i1, t0, t1) { const pp = this.parameterPositions; let iPrev = i1 - 2, - iNext = i1 + 1, - tPrev = pp[iPrev], - tNext = pp[iNext]; - + iNext = i1 + 1, + tPrev = pp[iPrev], + tNext = pp[iNext]; if (tPrev === undefined) { switch (this.getSettings_().endingStart) { case ZeroSlopeEnding: @@ -27982,21 +25164,19 @@ iPrev = i1; tPrev = 2 * t0 - t1; break; - case WrapAroundEnding: // use the other end of the curve iPrev = pp.length - 2; tPrev = t0 + pp[iPrev] - pp[iPrev + 1]; break; - default: // ZeroCurvatureEnding + // f''(t0) = 0 a.k.a. Natural Spline iPrev = i1; tPrev = t1; } } - if (tNext === undefined) { switch (this.getSettings_().endingEnd) { case ZeroSlopeEnding: @@ -28004,78 +25184,73 @@ iNext = i1; tNext = 2 * t1 - t0; break; - case WrapAroundEnding: // use the other end of the curve iNext = 1; tNext = t1 + pp[1] - pp[0]; break; - default: // ZeroCurvatureEnding + // f''(tN) = 0, a.k.a. Natural Spline iNext = i1 - 1; tNext = t0; } } - const halfDt = (t1 - t0) * 0.5, - stride = this.valueSize; + stride = this.valueSize; this._weightPrev = halfDt / (t0 - tPrev); this._weightNext = halfDt / (tNext - t1); this._offsetPrev = iPrev * stride; this._offsetNext = iNext * stride; } - interpolate_(i1, t0, t, t1) { const result = this.resultBuffer, - values = this.sampleValues, - stride = this.valueSize, - o1 = i1 * stride, - o0 = o1 - stride, - oP = this._offsetPrev, - oN = this._offsetNext, - wP = this._weightPrev, - wN = this._weightNext, - p = (t - t0) / (t1 - t0), - pp = p * p, - ppp = pp * p; // evaluate polynomials + values = this.sampleValues, + stride = this.valueSize, + o1 = i1 * stride, + o0 = o1 - stride, + oP = this._offsetPrev, + oN = this._offsetNext, + wP = this._weightPrev, + wN = this._weightNext, + p = (t - t0) / (t1 - t0), + pp = p * p, + ppp = pp * p; + + // evaluate polynomials const sP = -wP * ppp + 2 * wP * pp - wP * p; const s0 = (1 + wP) * ppp + (-1.5 - 2 * wP) * pp + (-0.5 + wP) * p + 1; const s1 = (-1 - wN) * ppp + (1.5 + wN) * pp + 0.5 * p; - const sN = wN * ppp - wN * pp; // combine data linearly + const sN = wN * ppp - wN * pp; + + // combine data linearly for (let i = 0; i !== stride; ++i) { result[i] = sP * values[oP + i] + s0 * values[o0 + i] + s1 * values[o1 + i] + sN * values[oN + i]; } - return result; } - } class LinearInterpolant extends Interpolant { constructor(parameterPositions, sampleValues, sampleSize, resultBuffer) { super(parameterPositions, sampleValues, sampleSize, resultBuffer); } - interpolate_(i1, t0, t, t1) { const result = this.resultBuffer, - values = this.sampleValues, - stride = this.valueSize, - offset1 = i1 * stride, - offset0 = offset1 - stride, - weight1 = (t - t0) / (t1 - t0), - weight0 = 1 - weight1; - + values = this.sampleValues, + stride = this.valueSize, + offset1 = i1 * stride, + offset0 = offset1 - stride, + weight1 = (t - t0) / (t1 - t0), + weight0 = 1 - weight1; for (let i = 0; i !== stride; ++i) { result[i] = values[offset0 + i] * weight0 + values[offset1 + i] * weight1; } - return result; } - } /** @@ -28088,13 +25263,9 @@ constructor(parameterPositions, sampleValues, sampleSize, resultBuffer) { super(parameterPositions, sampleValues, sampleSize, resultBuffer); } - - interpolate_(i1 - /*, t0, t, t1 */ - ) { + interpolate_(i1 /*, t0, t, t1 */) { return this.copySampleValue_(i1 - 1); } - } class KeyframeTrack { @@ -28105,14 +25276,16 @@ this.times = AnimationUtils.convertArray(times, this.TimeBufferType); this.values = AnimationUtils.convertArray(values, this.ValueBufferType); this.setInterpolation(interpolation || this.DefaultInterpolation); - } // Serialization (in static context, because of constructor invocation - // and automatic invocation of .toJSON): + } + // Serialization (in static context, because of constructor invocation + // and automatic invocation of .toJSON): static toJSON(track) { const trackType = track.constructor; - let json; // derived classes can define a static toJSON method + let json; + // derived classes can define a static toJSON method if (trackType.toJSON !== this.toJSON) { json = trackType.toJSON(track); } else { @@ -28123,49 +25296,38 @@ 'values': AnimationUtils.convertArray(track.values, Array) }; const interpolation = track.getInterpolation(); - if (interpolation !== track.DefaultInterpolation) { json.interpolation = interpolation; } } - json.type = track.ValueTypeName; // mandatory return json; } - InterpolantFactoryMethodDiscrete(result) { return new DiscreteInterpolant(this.times, this.values, this.getValueSize(), result); } - InterpolantFactoryMethodLinear(result) { return new LinearInterpolant(this.times, this.values, this.getValueSize(), result); } - InterpolantFactoryMethodSmooth(result) { return new CubicInterpolant(this.times, this.values, this.getValueSize(), result); } - setInterpolation(interpolation) { let factoryMethod; - switch (interpolation) { case InterpolateDiscrete: factoryMethod = this.InterpolantFactoryMethodDiscrete; break; - case InterpolateLinear: factoryMethod = this.InterpolantFactoryMethodLinear; break; - case InterpolateSmooth: factoryMethod = this.InterpolantFactoryMethodSmooth; break; } - if (factoryMethod === undefined) { const message = 'unsupported interpolation for ' + this.ValueTypeName + ' keyframe track named ' + this.name; - if (this.createInterpolant === undefined) { // fall back to default, unless the default itself is messed up if (interpolation !== this.DefaultInterpolation) { @@ -28174,74 +25336,61 @@ throw new Error(message); // fatal, in this case } } - console.warn('THREE.KeyframeTrack:', message); return this; } - this.createInterpolant = factoryMethod; return this; } - getInterpolation() { switch (this.createInterpolant) { case this.InterpolantFactoryMethodDiscrete: return InterpolateDiscrete; - case this.InterpolantFactoryMethodLinear: return InterpolateLinear; - case this.InterpolantFactoryMethodSmooth: return InterpolateSmooth; } } - getValueSize() { return this.values.length / this.times.length; - } // move all keyframes either forwards or backwards in time - + } + // move all keyframes either forwards or backwards in time shift(timeOffset) { if (timeOffset !== 0.0) { const times = this.times; - for (let i = 0, n = times.length; i !== n; ++i) { times[i] += timeOffset; } } - return this; - } // scale all keyframe times by a factor (useful for frame <-> seconds conversions) - + } + // scale all keyframe times by a factor (useful for frame <-> seconds conversions) scale(timeScale) { if (timeScale !== 1.0) { const times = this.times; - for (let i = 0, n = times.length; i !== n; ++i) { times[i] *= timeScale; } } - return this; - } // removes keyframes before and after animation without changing any values within the range [startTime, endTime]. - // IMPORTANT: We do not shift around keys to the start of the track time, because for interpolated keys this will change their values - + } + // removes keyframes before and after animation without changing any values within the range [startTime, endTime]. + // IMPORTANT: We do not shift around keys to the start of the track time, because for interpolated keys this will change their values trim(startTime, endTime) { const times = this.times, - nKeys = times.length; + nKeys = times.length; let from = 0, - to = nKeys - 1; - + to = nKeys - 1; while (from !== nKeys && times[from] < startTime) { ++from; } - while (to !== -1 && times[to] > endTime) { --to; } - ++to; // inclusive -> exclusive bound if (from !== 0 || to !== nKeys) { @@ -28250,59 +25399,47 @@ to = Math.max(to, 1); from = to - 1; } - const stride = this.getValueSize(); this.times = AnimationUtils.arraySlice(times, from, to); this.values = AnimationUtils.arraySlice(this.values, from * stride, to * stride); } - return this; - } // ensure we do not get a GarbageInGarbageOut situation, make sure tracks are at least minimally viable - + } + // ensure we do not get a GarbageInGarbageOut situation, make sure tracks are at least minimally viable validate() { let valid = true; const valueSize = this.getValueSize(); - if (valueSize - Math.floor(valueSize) !== 0) { console.error('THREE.KeyframeTrack: Invalid value size in track.', this); valid = false; } - const times = this.times, - values = this.values, - nKeys = times.length; - + values = this.values, + nKeys = times.length; if (nKeys === 0) { console.error('THREE.KeyframeTrack: Track is empty.', this); valid = false; } - let prevTime = null; - for (let i = 0; i !== nKeys; i++) { const currTime = times[i]; - if (typeof currTime === 'number' && isNaN(currTime)) { console.error('THREE.KeyframeTrack: Time is not a valid number.', this, i, currTime); valid = false; break; } - if (prevTime !== null && prevTime > currTime) { console.error('THREE.KeyframeTrack: Out of order keys.', this, i, currTime, prevTime); valid = false; break; } - prevTime = currTime; } - if (values !== undefined) { if (AnimationUtils.isTypedArray(values)) { for (let i = 0, n = values.length; i !== n; ++i) { const value = values[i]; - if (isNaN(value)) { console.error('THREE.KeyframeTrack: Value is not a valid number.', this, i, value); valid = false; @@ -28311,36 +25448,35 @@ } } } - return valid; - } // removes equivalent sequential keys as common in morph target sequences - // (0,0,0,0,1,1,1,0,0,0,0,0,0,0) --> (0,0,1,1,0,0) - + } + // removes equivalent sequential keys as common in morph target sequences + // (0,0,0,0,1,1,1,0,0,0,0,0,0,0) --> (0,0,1,1,0,0) optimize() { // times or values may be shared with other tracks, so overwriting is unsafe const times = AnimationUtils.arraySlice(this.times), - values = AnimationUtils.arraySlice(this.values), - stride = this.getValueSize(), - smoothInterpolation = this.getInterpolation() === InterpolateSmooth, - lastIndex = times.length - 1; + values = AnimationUtils.arraySlice(this.values), + stride = this.getValueSize(), + smoothInterpolation = this.getInterpolation() === InterpolateSmooth, + lastIndex = times.length - 1; let writeIndex = 1; - for (let i = 1; i < lastIndex; ++i) { let keep = false; const time = times[i]; - const timeNext = times[i + 1]; // remove adjacent keyframes scheduled at the same time + const timeNext = times[i + 1]; + + // remove adjacent keyframes scheduled at the same time if (time !== timeNext && (i !== 1 || time !== times[0])) { if (!smoothInterpolation) { // remove unnecessary keyframes same as their neighbors - const offset = i * stride, - offsetP = offset - stride, - offsetN = offset + stride; + const offset = i * stride, + offsetP = offset - stride, + offsetN = offset + stride; for (let j = 0; j !== stride; ++j) { const value = values[offset + j]; - if (value !== values[offsetP + j] || value !== values[offsetN + j]) { keep = true; break; @@ -28349,35 +25485,32 @@ } else { keep = true; } - } // in-place compaction + } + // in-place compaction if (keep) { if (i !== writeIndex) { times[writeIndex] = times[i]; const readOffset = i * stride, - writeOffset = writeIndex * stride; - + writeOffset = writeIndex * stride; for (let j = 0; j !== stride; ++j) { values[writeOffset + j] = values[readOffset + j]; } } - ++writeIndex; } - } // flush last keyframe (compaction looks ahead) + } + // flush last keyframe (compaction looks ahead) if (lastIndex > 0) { times[writeIndex] = times[lastIndex]; - for (let readOffset = lastIndex * stride, writeOffset = writeIndex * stride, j = 0; j !== stride; ++j) { values[writeOffset + j] = values[readOffset + j]; } - ++writeIndex; } - if (writeIndex !== times.length) { this.times = AnimationUtils.arraySlice(times, 0, writeIndex); this.values = AnimationUtils.arraySlice(values, 0, writeIndex * stride); @@ -28385,22 +25518,19 @@ this.times = times; this.values = values; } - return this; } - clone() { const times = AnimationUtils.arraySlice(this.times, 0); const values = AnimationUtils.arraySlice(this.values, 0); const TypedKeyframeTrack = this.constructor; - const track = new TypedKeyframeTrack(this.name, times, values); // Interpolant argument to constructor is not saved, so copy the factory method directly. + const track = new TypedKeyframeTrack(this.name, times, values); + // Interpolant argument to constructor is not saved, so copy the factory method directly. track.createInterpolant = this.createInterpolant; return track; } - } - KeyframeTrack.prototype.TimeBufferType = Float32Array; KeyframeTrack.prototype.ValueBufferType = Float32Array; KeyframeTrack.prototype.DefaultInterpolation = InterpolateLinear; @@ -28408,30 +25538,24 @@ /** * A Track of Boolean keyframe values. */ - class BooleanKeyframeTrack extends KeyframeTrack {} - BooleanKeyframeTrack.prototype.ValueTypeName = 'bool'; BooleanKeyframeTrack.prototype.ValueBufferType = Array; BooleanKeyframeTrack.prototype.DefaultInterpolation = InterpolateDiscrete; BooleanKeyframeTrack.prototype.InterpolantFactoryMethodLinear = undefined; - BooleanKeyframeTrack.prototype.InterpolantFactoryMethodSmooth = undefined; // Note: Actually this track could have a optimized / compressed + BooleanKeyframeTrack.prototype.InterpolantFactoryMethodSmooth = undefined; /** * A Track of keyframe values that represent color. */ - class ColorKeyframeTrack extends KeyframeTrack {} - - ColorKeyframeTrack.prototype.ValueTypeName = 'color'; // ValueBufferType is inherited + ColorKeyframeTrack.prototype.ValueTypeName = 'color'; /** * A Track of numeric keyframe values. */ - class NumberKeyframeTrack extends KeyframeTrack {} - - NumberKeyframeTrack.prototype.ValueTypeName = 'number'; // ValueBufferType is inherited + NumberKeyframeTrack.prototype.ValueTypeName = 'number'; /** * Spherical linear unit quaternion interpolant. @@ -28441,45 +25565,36 @@ constructor(parameterPositions, sampleValues, sampleSize, resultBuffer) { super(parameterPositions, sampleValues, sampleSize, resultBuffer); } - interpolate_(i1, t0, t, t1) { const result = this.resultBuffer, - values = this.sampleValues, - stride = this.valueSize, - alpha = (t - t0) / (t1 - t0); + values = this.sampleValues, + stride = this.valueSize, + alpha = (t - t0) / (t1 - t0); let offset = i1 * stride; - for (let end = offset + stride; offset !== end; offset += 4) { Quaternion.slerpFlat(result, 0, values, offset - stride, values, offset, alpha); } - return result; } - } /** * A Track of quaternion keyframe values. */ - class QuaternionKeyframeTrack extends KeyframeTrack { InterpolantFactoryMethodLinear(result) { return new QuaternionLinearInterpolant(this.times, this.values, this.getValueSize(), result); } - } - - QuaternionKeyframeTrack.prototype.ValueTypeName = 'quaternion'; // ValueBufferType is inherited - + QuaternionKeyframeTrack.prototype.ValueTypeName = 'quaternion'; + // ValueBufferType is inherited QuaternionKeyframeTrack.prototype.DefaultInterpolation = InterpolateLinear; QuaternionKeyframeTrack.prototype.InterpolantFactoryMethodSmooth = undefined; /** * A Track that interpolates Strings */ - class StringKeyframeTrack extends KeyframeTrack {} - StringKeyframeTrack.prototype.ValueTypeName = 'string'; StringKeyframeTrack.prototype.ValueBufferType = Array; StringKeyframeTrack.prototype.DefaultInterpolation = InterpolateDiscrete; @@ -28489,10 +25604,8 @@ /** * A Track of vectored keyframe values. */ - class VectorKeyframeTrack extends KeyframeTrack {} - - VectorKeyframeTrack.prototype.ValueTypeName = 'vector'; // ValueBufferType is inherited + VectorKeyframeTrack.prototype.ValueTypeName = 'vector'; class AnimationClip { constructor(name, duration = -1, tracks, blendMode = NormalAnimationBlendMode) { @@ -28500,30 +25613,27 @@ this.tracks = tracks; this.duration = duration; this.blendMode = blendMode; - this.uuid = generateUUID(); // this means it should figure out its duration by scanning the tracks + this.uuid = generateUUID(); + // this means it should figure out its duration by scanning the tracks if (this.duration < 0) { this.resetDuration(); } } - static parse(json) { const tracks = [], - jsonTracks = json.tracks, - frameTime = 1.0 / (json.fps || 1.0); - + jsonTracks = json.tracks, + frameTime = 1.0 / (json.fps || 1.0); for (let i = 0, n = jsonTracks.length; i !== n; ++i) { tracks.push(parseKeyframeTrack(jsonTracks[i]).scale(frameTime)); } - const clip = new this(json.name, json.duration, tracks, json.blendMode); clip.uuid = json.uuid; return clip; } - static toJSON(clip) { const tracks = [], - clipTracks = clip.tracks; + clipTracks = clip.tracks; const json = { 'name': clip.name, 'duration': clip.duration, @@ -28531,18 +25641,14 @@ 'uuid': clip.uuid, 'blendMode': clip.blendMode }; - for (let i = 0, n = clipTracks.length; i !== n; ++i) { tracks.push(KeyframeTrack.toJSON(clipTracks[i])); } - return json; } - static CreateFromMorphTargetSequence(name, morphTargetSequence, fps, noLoop) { const numMorphTargets = morphTargetSequence.length; const tracks = []; - for (let i = 0; i < numMorphTargets; i++) { let times = []; let values = []; @@ -28550,204 +25656,174 @@ values.push(0, 1, 0); const order = AnimationUtils.getKeyframeOrder(times); times = AnimationUtils.sortedArray(times, 1, order); - values = AnimationUtils.sortedArray(values, 1, order); // if there is a key at the first frame, duplicate it as the - // last frame as well for perfect loop. + values = AnimationUtils.sortedArray(values, 1, order); + // if there is a key at the first frame, duplicate it as the + // last frame as well for perfect loop. if (!noLoop && times[0] === 0) { times.push(numMorphTargets); values.push(values[0]); } - tracks.push(new NumberKeyframeTrack('.morphTargetInfluences[' + morphTargetSequence[i].name + ']', times, values).scale(1.0 / fps)); } - return new this(name, -1, tracks); } - static findByName(objectOrClipArray, name) { let clipArray = objectOrClipArray; - if (!Array.isArray(objectOrClipArray)) { const o = objectOrClipArray; clipArray = o.geometry && o.geometry.animations || o.animations; } - for (let i = 0; i < clipArray.length; i++) { if (clipArray[i].name === name) { return clipArray[i]; } } - return null; } - static CreateClipsFromMorphTargetSequences(morphTargets, fps, noLoop) { - const animationToMorphTargets = {}; // tested with https://regex101.com/ on trick sequences + const animationToMorphTargets = {}; + + // tested with https://regex101.com/ on trick sequences // such flamingo_flyA_003, flamingo_run1_003, crdeath0059 + const pattern = /^([\w-]*?)([\d]+)$/; - const pattern = /^([\w-]*?)([\d]+)$/; // sort morph target names into animation groups based + // sort morph target names into animation groups based // patterns like Walk_001, Walk_002, Run_001, Run_002 - for (let i = 0, il = morphTargets.length; i < il; i++) { const morphTarget = morphTargets[i]; const parts = morphTarget.name.match(pattern); - if (parts && parts.length > 1) { const name = parts[1]; let animationMorphTargets = animationToMorphTargets[name]; - if (!animationMorphTargets) { animationToMorphTargets[name] = animationMorphTargets = []; } - animationMorphTargets.push(morphTarget); } } - const clips = []; - for (const name in animationToMorphTargets) { clips.push(this.CreateFromMorphTargetSequence(name, animationToMorphTargets[name], fps, noLoop)); } - return clips; - } // parse the animation.hierarchy format - + } + // parse the animation.hierarchy format static parseAnimation(animation, bones) { if (!animation) { console.error('THREE.AnimationClip: No animation in JSONLoader data.'); return null; } - const addNonemptyTrack = function (trackType, trackName, animationKeys, propertyName, destTracks) { // only return track if there are actually keys. if (animationKeys.length !== 0) { const times = []; const values = []; - AnimationUtils.flattenJSON(animationKeys, times, values, propertyName); // empty keys are filtered out, so check again + AnimationUtils.flattenJSON(animationKeys, times, values, propertyName); + // empty keys are filtered out, so check again if (times.length !== 0) { destTracks.push(new trackType(trackName, times, values)); } } }; - const tracks = []; const clipName = animation.name || 'default'; const fps = animation.fps || 30; - const blendMode = animation.blendMode; // automatic length determination in AnimationClip. + const blendMode = animation.blendMode; + // automatic length determination in AnimationClip. let duration = animation.length || -1; const hierarchyTracks = animation.hierarchy || []; - for (let h = 0; h < hierarchyTracks.length; h++) { - const animationKeys = hierarchyTracks[h].keys; // skip empty tracks + const animationKeys = hierarchyTracks[h].keys; - if (!animationKeys || animationKeys.length === 0) continue; // process morph targets + // skip empty tracks + if (!animationKeys || animationKeys.length === 0) continue; + // process morph targets if (animationKeys[0].morphTargets) { // figure out all morph targets used in this track const morphTargetNames = {}; let k; - for (k = 0; k < animationKeys.length; k++) { if (animationKeys[k].morphTargets) { for (let m = 0; m < animationKeys[k].morphTargets.length; m++) { morphTargetNames[animationKeys[k].morphTargets[m]] = -1; } } - } // create a track for each morph target with all zero + } + + // create a track for each morph target with all zero // morphTargetInfluences except for the keys in which // the morphTarget is named. - - for (const morphTargetName in morphTargetNames) { const times = []; const values = []; - for (let m = 0; m !== animationKeys[k].morphTargets.length; ++m) { const animationKey = animationKeys[k]; times.push(animationKey.time); values.push(animationKey.morphTarget === morphTargetName ? 1 : 0); } - tracks.push(new NumberKeyframeTrack('.morphTargetInfluence[' + morphTargetName + ']', times, values)); } - duration = morphTargetNames.length * (fps || 1.0); } else { // ...assume skeletal animation + const boneName = '.bones[' + bones[h].name + ']'; addNonemptyTrack(VectorKeyframeTrack, boneName + '.position', animationKeys, 'pos', tracks); addNonemptyTrack(QuaternionKeyframeTrack, boneName + '.quaternion', animationKeys, 'rot', tracks); addNonemptyTrack(VectorKeyframeTrack, boneName + '.scale', animationKeys, 'scl', tracks); } } - if (tracks.length === 0) { return null; } - const clip = new this(clipName, duration, tracks, blendMode); return clip; } - resetDuration() { const tracks = this.tracks; let duration = 0; - for (let i = 0, n = tracks.length; i !== n; ++i) { const track = this.tracks[i]; duration = Math.max(duration, track.times[track.times.length - 1]); } - this.duration = duration; return this; } - trim() { for (let i = 0; i < this.tracks.length; i++) { this.tracks[i].trim(0, this.duration); } - return this; } - validate() { let valid = true; - for (let i = 0; i < this.tracks.length; i++) { valid = valid && this.tracks[i].validate(); } - return valid; } - optimize() { for (let i = 0; i < this.tracks.length; i++) { this.tracks[i].optimize(); } - return this; } - clone() { const tracks = []; - for (let i = 0; i < this.tracks.length; i++) { tracks.push(this.tracks[i].clone()); } - return new this.constructor(this.name, this.duration, tracks, this.blendMode); } - toJSON() { return this.constructor.toJSON(this); } - } - function getTrackTypeForValueTypeName(typeName) { switch (typeName.toLowerCase()) { case 'scalar': @@ -28756,46 +25832,37 @@ case 'number': case 'integer': return NumberKeyframeTrack; - case 'vector': case 'vector2': case 'vector3': case 'vector4': return VectorKeyframeTrack; - case 'color': return ColorKeyframeTrack; - case 'quaternion': return QuaternionKeyframeTrack; - case 'bool': case 'boolean': return BooleanKeyframeTrack; - case 'string': return StringKeyframeTrack; } - throw new Error('THREE.KeyframeTrack: Unsupported typeName: ' + typeName); } - function parseKeyframeTrack(json) { if (json.type === undefined) { throw new Error('THREE.KeyframeTrack: track type undefined, can not parse'); } - const trackType = getTrackTypeForValueTypeName(json.type); - if (json.times === undefined) { const times = [], - values = []; + values = []; AnimationUtils.flattenJSON(json.keys, times, values, 'value'); json.times = times; json.values = values; - } // derived classes can define a static parse method - + } + // derived classes can define a static parse method if (trackType.parse !== undefined) { return trackType.parse(json); } else { @@ -28808,12 +25875,16 @@ enabled: false, files: {}, add: function (key, file) { - if (this.enabled === false) return; // console.log( 'THREE.Cache', 'Adding key:', key ); + if (this.enabled === false) return; + + // console.log( 'THREE.Cache', 'Adding key:', key ); this.files[key] = file; }, get: function (key) { - if (this.enabled === false) return; // console.log( 'THREE.Cache', 'Checking key:', key ); + if (this.enabled === false) return; + + // console.log( 'THREE.Cache', 'Checking key:', key ); return this.files[key]; }, @@ -28832,76 +25903,62 @@ let itemsLoaded = 0; let itemsTotal = 0; let urlModifier = undefined; - const handlers = []; // Refer to #5689 for the reason why we don't set .onStart + const handlers = []; + + // Refer to #5689 for the reason why we don't set .onStart // in the constructor this.onStart = undefined; this.onLoad = onLoad; this.onProgress = onProgress; this.onError = onError; - this.itemStart = function (url) { itemsTotal++; - if (isLoading === false) { if (scope.onStart !== undefined) { scope.onStart(url, itemsLoaded, itemsTotal); } } - isLoading = true; }; - this.itemEnd = function (url) { itemsLoaded++; - if (scope.onProgress !== undefined) { scope.onProgress(url, itemsLoaded, itemsTotal); } - if (itemsLoaded === itemsTotal) { isLoading = false; - if (scope.onLoad !== undefined) { scope.onLoad(); } } }; - this.itemError = function (url) { if (scope.onError !== undefined) { scope.onError(url); } }; - this.resolveURL = function (url) { if (urlModifier) { return urlModifier(url); } - return url; }; - this.setURLModifier = function (transform) { urlModifier = transform; return this; }; - this.addHandler = function (regex, loader) { handlers.push(regex, loader); return this; }; - this.removeHandler = function (regex) { const index = handlers.indexOf(regex); - if (index !== -1) { handlers.splice(index, 2); } - return this; }; - this.getHandler = function (file) { for (let i = 0, l = handlers.length; i < l; i += 2) { const regex = handlers[i]; @@ -28912,13 +25969,10 @@ return loader; } } - return null; }; } - } - const DefaultLoadingManager = new LoadingManager(); class Loader { @@ -28930,58 +25984,46 @@ this.resourcePath = ''; this.requestHeader = {}; } - - load() {} - + load(/* url, onLoad, onProgress, onError */) {} loadAsync(url, onProgress) { const scope = this; return new Promise(function (resolve, reject) { scope.load(url, resolve, onProgress, reject); }); } - - parse() {} - + parse(/* data */) {} setCrossOrigin(crossOrigin) { this.crossOrigin = crossOrigin; return this; } - setWithCredentials(value) { this.withCredentials = value; return this; } - setPath(path) { this.path = path; return this; } - setResourcePath(resourcePath) { this.resourcePath = resourcePath; return this; } - setRequestHeader(requestHeader) { this.requestHeader = requestHeader; return this; } - } const loading = {}; - class FileLoader extends Loader { constructor(manager) { super(manager); } - load(url, onLoad, onProgress, onError) { if (url === undefined) url = ''; if (this.path !== undefined) url = this.path + url; url = this.manager.resolveURL(url); const cached = Cache.get(url); - if (cached !== undefined) { this.manager.itemStart(url); setTimeout(() => { @@ -28989,8 +26031,9 @@ this.manager.itemEnd(url); }, 0); return cached; - } // Check if request is duplicate + } + // Check if request is duplicate if (loading[url] !== undefined) { loading[url].push({ @@ -28999,48 +26042,50 @@ onError: onError }); return; - } // Initialise array for duplicate requests - + } + // Initialise array for duplicate requests loading[url] = []; loading[url].push({ onLoad: onLoad, onProgress: onProgress, onError: onError - }); // create request + }); + // create request const req = new platform.Request(url, { headers: new platform.Headers(this.requestHeader), - credentials: this.withCredentials ? 'include' : 'same-origin' // An abort controller could be added within a future PR - - }); // record states ( avoid data race ) + credentials: this.withCredentials ? 'include' : 'same-origin' + // An abort controller could be added within a future PR + }); + // record states ( avoid data race ) const mimeType = this.mimeType; - const responseType = this.responseType; // start the fetch + const responseType = this.responseType; + // start the fetch platform.fetch(req).then(response => { if (response.status === 200 || response.status === 0) { // Some browsers return HTTP Status 0 when using non-http protocol // e.g. 'file://' or 'data://'. Handle as success. + if (response.status === 0) { console.warn('THREE.FileLoader: HTTP Status 0 received.'); } - if (typeof ReadableStream === 'undefined' || response.body === undefined || response.body.getReader === undefined) { return response; } - const callbacks = loading[url]; const reader = response.body.getReader(); const contentLength = response.headers.get('Content-Length'); const total = contentLength ? parseInt(contentLength) : 0; const lengthComputable = total !== 0; - let loaded = 0; // periodically read data into the new stream tracking while download progress + let loaded = 0; + // periodically read data into the new stream tracking while download progress const stream = new ReadableStream({ start(controller) { readData(); - function readData() { reader.read().then(({ done, @@ -29055,19 +26100,16 @@ loaded, total }); - for (let i = 0, il = callbacks.length; i < il; i++) { const callback = callbacks[i]; if (callback.onProgress) callback.onProgress(event); } - controller.enqueue(value); readData(); } }); } } - }); return new Response(stream); } else { @@ -29077,19 +26119,15 @@ switch (responseType) { case 'arraybuffer': return response.arrayBuffer(); - case 'blob': return response.blob(); - case 'document': return response.text().then(text => { const parser = new DOMParser(); return parser.parseFromString(text, mimeType); }); - case 'json': return response.json(); - default: if (mimeType === undefined) { return response.text(); @@ -29101,7 +26139,6 @@ const decoder = new TextDecoder(label); return response.arrayBuffer().then(ab => decoder.decode(ab)); } - } }).then(data => { // Add to cache only on HTTP success, so that we do not cache @@ -29109,52 +26146,44 @@ Cache.add(url, data); const callbacks = loading[url]; delete loading[url]; - for (let i = 0, il = callbacks.length; i < il; i++) { const callback = callbacks[i]; if (callback.onLoad) callback.onLoad(data); } }).catch(err => { // Abort errors and other errors are handled the same - const callbacks = loading[url]; + const callbacks = loading[url]; if (callbacks === undefined) { // When onLoad was called and url was deleted in `loading` this.manager.itemError(url); throw err; } - delete loading[url]; - for (let i = 0, il = callbacks.length; i < il; i++) { const callback = callbacks[i]; if (callback.onError) callback.onError(err); } - this.manager.itemError(url); }).finally(() => { this.manager.itemEnd(url); }); this.manager.itemStart(url); } - setResponseType(value) { this.responseType = value; return this; } - setMimeType(value) { this.mimeType = value; return this; } - } class AnimationLoader extends Loader { constructor(manager) { super(manager); } - load(url, onLoad, onProgress, onError) { const scope = this; const loader = new FileLoader(this.manager); @@ -29170,23 +26199,18 @@ } else { console.error(e); } - scope.manager.itemError(url); } }, onProgress, onError); } - parse(json) { const animations = []; - for (let i = 0; i < json.length; i++) { const clip = AnimationClip.parse(json[i]); animations.push(clip); } - return animations; } - } /** @@ -29199,7 +26223,6 @@ constructor(manager) { super(manager); } - load(url, onLoad, onProgress, onError) { const scope = this; const images = []; @@ -29210,7 +26233,6 @@ loader.setRequestHeader(this.requestHeader); loader.setWithCredentials(scope.withCredentials); let loaded = 0; - function loadTexture(i) { loader.load(url[i], function (buffer) { const texDatas = scope.parse(buffer, true); @@ -29221,7 +26243,6 @@ mipmaps: texDatas.mipmaps }; loaded += 1; - if (loaded === 6) { if (texDatas.mipmapCount === 1) texture.minFilter = LinearFilter; texture.image = images; @@ -29231,24 +26252,21 @@ } }, onProgress, onError); } - if (Array.isArray(url)) { for (let i = 0, il = url.length; i < il; ++i) { loadTexture(i); } } else { // compressed cubemap texture stored in a single DDS file + loader.load(url, function (buffer) { const texDatas = scope.parse(buffer, true); - if (texDatas.isCubemap) { const faces = texDatas.mipmaps.length / texDatas.mipmapCount; - for (let f = 0; f < faces; f++) { images[f] = { mipmaps: [] }; - for (let i = 0; i < texDatas.mipmapCount; i++) { images[f].mipmaps.push(texDatas.mipmaps[f * texDatas.mipmapCount + i]); images[f].format = texDatas.format; @@ -29256,40 +26274,33 @@ images[f].height = texDatas.height; } } - texture.image = images; } else { texture.image.width = texDatas.width; texture.image.height = texDatas.height; texture.mipmaps = texDatas.mipmaps; } - if (texDatas.mipmapCount === 1) { texture.minFilter = LinearFilter; } - texture.format = texDatas.format; texture.needsUpdate = true; if (onLoad) onLoad(texture); }, onProgress, onError); } - return texture; } - } class ImageLoader extends Loader { constructor(manager) { super(manager); } - load(url, onLoad, onProgress, onError) { if (this.path !== undefined) url = this.path + url; url = this.manager.resolveURL(url); const scope = this; const cached = Cache.get(url); - if (cached !== undefined) { scope.manager.itemStart(url); setTimeout(function () { @@ -29298,73 +26309,59 @@ }, 0); return cached; } - const image = createElementNS('img'); - function onImageLoad() { removeEventListeners(); Cache.add(url, this); if (onLoad) onLoad(this); scope.manager.itemEnd(url); } - function onImageError(event) { removeEventListeners(); if (onError) onError(event); scope.manager.itemError(url); scope.manager.itemEnd(url); } - function removeEventListeners() { image.removeEventListener('load', onImageLoad, false); image.removeEventListener('error', onImageError, false); } - image.addEventListener('load', onImageLoad, false); image.addEventListener('error', onImageError, false); - if (url.substr(0, 5) !== 'data:') { if (this.crossOrigin !== undefined) image.crossOrigin = this.crossOrigin; } - scope.manager.itemStart(url); image.src = url; return image; } - } class CubeTextureLoader extends Loader { constructor(manager) { super(manager); } - load(urls, onLoad, onProgress, onError) { const texture = new CubeTexture(); const loader = new ImageLoader(this.manager); loader.setCrossOrigin(this.crossOrigin); loader.setPath(this.path); let loaded = 0; - function loadTexture(i) { loader.load(urls[i], function (image) { texture.images[i] = image; loaded++; - if (loaded === 6) { texture.needsUpdate = true; if (onLoad) onLoad(texture); } }, undefined, onError); } - for (let i = 0; i < urls.length; ++i) { loadTexture(i); } - return texture; } - } /** @@ -29377,7 +26374,6 @@ constructor(manager) { super(manager); } - load(url, onLoad, onProgress, onError) { const scope = this; const texture = new DataTexture(); @@ -29389,7 +26385,6 @@ loader.load(url, function (buffer) { const texData = scope.parse(buffer); if (!texData) return; - if (texData.image !== undefined) { texture.image = texData.image; } else if (texData.data !== undefined) { @@ -29397,55 +26392,44 @@ texture.image.height = texData.height; texture.image.data = texData.data; } - texture.wrapS = texData.wrapS !== undefined ? texData.wrapS : ClampToEdgeWrapping; texture.wrapT = texData.wrapT !== undefined ? texData.wrapT : ClampToEdgeWrapping; texture.magFilter = texData.magFilter !== undefined ? texData.magFilter : LinearFilter; texture.minFilter = texData.minFilter !== undefined ? texData.minFilter : LinearFilter; texture.anisotropy = texData.anisotropy !== undefined ? texData.anisotropy : 1; - if (texData.encoding !== undefined) { texture.encoding = texData.encoding; } - if (texData.flipY !== undefined) { texture.flipY = texData.flipY; } - if (texData.format !== undefined) { texture.format = texData.format; } - if (texData.type !== undefined) { texture.type = texData.type; } - if (texData.mipmaps !== undefined) { texture.mipmaps = texData.mipmaps; texture.minFilter = LinearMipmapLinearFilter; // presumably... } - if (texData.mipmapCount === 1) { texture.minFilter = LinearFilter; } - if (texData.generateMipmaps !== undefined) { texture.generateMipmaps = texData.generateMipmaps; } - texture.needsUpdate = true; if (onLoad) onLoad(texture, texData); }, onProgress, onError); return texture; } - } class TextureLoader extends Loader { constructor(manager) { super(manager); } - load(url, onLoad, onProgress, onError) { const texture = new Texture(); const loader = new ImageLoader(this.manager); @@ -29454,14 +26438,12 @@ loader.load(url, function (image) { texture.image = image; texture.needsUpdate = true; - if (onLoad !== undefined) { onLoad(texture); } }, onProgress, onError); return texture; } - } class Light extends Object3D { @@ -29471,17 +26453,16 @@ this.color = new Color(color); this.intensity = intensity; } + dispose() { - dispose() {// Empty here in base class; some subclasses override. + // Empty here in base class; some subclasses override. } - copy(source) { super.copy(source); this.color.copy(source.color); this.intensity = source.intensity; return this; } - toJSON(meta) { const data = super.toJSON(meta); data.object.color = this.color.getHex(); @@ -29494,9 +26475,7 @@ if (this.shadow !== undefined) data.object.shadow = this.shadow.toJSON(); return data; } - } - Light.prototype.isLight = true; class HemisphereLight extends Light { @@ -29507,23 +26486,17 @@ this.updateMatrix(); this.groundColor = new Color(groundColor); } - copy(source) { Light.prototype.copy.call(this, source); this.groundColor.copy(source.groundColor); return this; } - } - HemisphereLight.prototype.isHemisphereLight = true; const _projScreenMatrix$1 = /*@__PURE__*/new Matrix4(); - const _lightPositionWorld$1 = /*@__PURE__*/new Vector3(); - const _lookTarget$1 = /*@__PURE__*/new Vector3(); - class LightShadow { constructor(camera) { this.camera = camera; @@ -29542,55 +26515,40 @@ this._viewportCount = 1; this._viewports = [new Vector4(0, 0, 1, 1)]; } - getViewportCount() { return this._viewportCount; } - getFrustum() { return this._frustum; } - updateMatrices(light) { const shadowCamera = this.camera; const shadowMatrix = this.matrix; - _lightPositionWorld$1.setFromMatrixPosition(light.matrixWorld); - shadowCamera.position.copy(_lightPositionWorld$1); - _lookTarget$1.setFromMatrixPosition(light.target.matrixWorld); - shadowCamera.lookAt(_lookTarget$1); shadowCamera.updateMatrixWorld(); - _projScreenMatrix$1.multiplyMatrices(shadowCamera.projectionMatrix, shadowCamera.matrixWorldInverse); - this._frustum.setFromProjectionMatrix(_projScreenMatrix$1); - shadowMatrix.set(0.5, 0.0, 0.0, 0.5, 0.0, 0.5, 0.0, 0.5, 0.0, 0.0, 0.5, 0.5, 0.0, 0.0, 0.0, 1.0); shadowMatrix.multiply(shadowCamera.projectionMatrix); shadowMatrix.multiply(shadowCamera.matrixWorldInverse); } - getViewport(viewportIndex) { return this._viewports[viewportIndex]; } - getFrameExtents() { return this._frameExtents; } - dispose() { if (this.map) { this.map.dispose(); } - if (this.mapPass) { this.mapPass.dispose(); } } - copy(source) { this.camera = source.camera.clone(); this.bias = source.bias; @@ -29598,11 +26556,9 @@ this.mapSize.copy(source.mapSize); return this; } - clone() { return new this.constructor().copy(this); } - toJSON() { const object = {}; if (this.bias !== 0) object.bias = this.bias; @@ -29613,7 +26569,6 @@ delete object.camera.matrix; return object; } - } class SpotLightShadow extends LightShadow { @@ -29621,31 +26576,25 @@ super(new PerspectiveCamera(50, 1, 0.5, 500)); this.focus = 1; } - updateMatrices(light) { const camera = this.camera; const fov = RAD2DEG * 2 * light.angle * this.focus; const aspect = this.mapSize.width / this.mapSize.height; const far = light.distance || camera.far; - if (fov !== camera.fov || aspect !== camera.aspect || far !== camera.far) { camera.fov = fov; camera.aspect = aspect; camera.far = far; camera.updateProjectionMatrix(); } - super.updateMatrices(light); } - copy(source) { super.copy(source); this.focus = source.focus; return this; } - } - SpotLightShadow.prototype.isSpotLightShadow = true; class SpotLight extends Light { @@ -29662,22 +26611,18 @@ this.shadow = new SpotLightShadow(); } - get power() { // compute the light's luminous power (in lumens) from its intensity (in candela) // by convention for a spotlight, luminous power (lm) = π * luminous intensity (cd) return this.intensity * Math.PI; } - set power(power) { // set the light's intensity (in candela) from the desired luminous power (in lumens) this.intensity = power / Math.PI; } - dispose() { this.shadow.dispose(); } - copy(source) { super.copy(source); this.distance = source.distance; @@ -29688,23 +26633,19 @@ this.shadow = source.shadow.clone(); return this; } - } - SpotLight.prototype.isSpotLight = true; const _projScreenMatrix = /*@__PURE__*/new Matrix4(); - const _lightPositionWorld = /*@__PURE__*/new Vector3(); - const _lookTarget = /*@__PURE__*/new Vector3(); - class PointLightShadow extends LightShadow { constructor() { super(new PerspectiveCamera(90, 1, 0.5, 500)); this._frameExtents = new Vector2(4, 2); this._viewportCount = 6; - this._viewports = [// These viewports map a cube-map onto a 2D texture with the + this._viewports = [ + // These viewports map a cube-map onto a 2D texture with the // following orientation: // // xzXZ @@ -29716,47 +26657,42 @@ // y - Negative y direction // Z - Positive z direction // z - Negative z direction + // positive X - new Vector4(2, 1, 1, 1), // negative X - new Vector4(0, 1, 1, 1), // positive Z - new Vector4(3, 1, 1, 1), // negative Z - new Vector4(1, 1, 1, 1), // positive Y - new Vector4(3, 0, 1, 1), // negative Y + new Vector4(2, 1, 1, 1), + // negative X + new Vector4(0, 1, 1, 1), + // positive Z + new Vector4(3, 1, 1, 1), + // negative Z + new Vector4(1, 1, 1, 1), + // positive Y + new Vector4(3, 0, 1, 1), + // negative Y new Vector4(1, 0, 1, 1)]; this._cubeDirections = [new Vector3(1, 0, 0), new Vector3(-1, 0, 0), new Vector3(0, 0, 1), new Vector3(0, 0, -1), new Vector3(0, 1, 0), new Vector3(0, -1, 0)]; this._cubeUps = [new Vector3(0, 1, 0), new Vector3(0, 1, 0), new Vector3(0, 1, 0), new Vector3(0, 1, 0), new Vector3(0, 0, 1), new Vector3(0, 0, -1)]; } - updateMatrices(light, viewportIndex = 0) { const camera = this.camera; const shadowMatrix = this.matrix; const far = light.distance || camera.far; - if (far !== camera.far) { camera.far = far; camera.updateProjectionMatrix(); } - _lightPositionWorld.setFromMatrixPosition(light.matrixWorld); - camera.position.copy(_lightPositionWorld); - _lookTarget.copy(camera.position); - _lookTarget.add(this._cubeDirections[viewportIndex]); - camera.up.copy(this._cubeUps[viewportIndex]); camera.lookAt(_lookTarget); camera.updateMatrixWorld(); shadowMatrix.makeTranslation(-_lightPositionWorld.x, -_lightPositionWorld.y, -_lightPositionWorld.z); - _projScreenMatrix.multiplyMatrices(camera.projectionMatrix, camera.matrixWorldInverse); - this._frustum.setFromProjectionMatrix(_projScreenMatrix); } - } - PointLightShadow.prototype.isPointLightShadow = true; class PointLight extends Light { @@ -29768,22 +26704,18 @@ this.shadow = new PointLightShadow(); } - get power() { // compute the light's luminous power (in lumens) from its intensity (in candela) // for an isotropic light source, luminous power (lm) = 4 π luminous intensity (cd) return this.intensity * 4 * Math.PI; } - set power(power) { // set the light's intensity (in candela) from the desired luminous power (in lumens) this.intensity = power / (4 * Math.PI); } - dispose() { this.shadow.dispose(); } - copy(source) { super.copy(source); this.distance = source.distance; @@ -29791,18 +26723,14 @@ this.shadow = source.shadow.clone(); return this; } - } - PointLight.prototype.isPointLight = true; class DirectionalLightShadow extends LightShadow { constructor() { super(new OrthographicCamera(-5, 5, 5, -5, 0.5, 500)); } - } - DirectionalLightShadow.prototype.isDirectionalLightShadow = true; class DirectionalLight extends Light { @@ -29814,20 +26742,16 @@ this.target = new Object3D(); this.shadow = new DirectionalLightShadow(); } - dispose() { this.shadow.dispose(); } - copy(source) { super.copy(source); this.target = source.target.clone(); this.shadow = source.shadow.clone(); return this; } - } - DirectionalLight.prototype.isDirectionalLight = true; class AmbientLight extends Light { @@ -29835,9 +26759,7 @@ super(color, intensity); this.type = 'AmbientLight'; } - } - AmbientLight.prototype.isAmbientLight = true; class RectAreaLight extends Light { @@ -29847,33 +26769,27 @@ this.width = width; this.height = height; } - get power() { // compute the light's luminous power (in lumens) from its intensity (in nits) return this.intensity * this.width * this.height * Math.PI; } - set power(power) { // set the light's intensity (in nits) from the desired luminous power (in lumens) this.intensity = power / (this.width * this.height * Math.PI); } - copy(source) { super.copy(source); this.width = source.width; this.height = source.height; return this; } - toJSON(meta) { const data = super.toJSON(meta); data.object.width = this.width; data.object.height = this.height; return data; } - } - RectAreaLight.prototype.isRectAreaLight = true; /** @@ -29883,178 +26799,162 @@ * Secondary reference: * https://www.ppsloan.org/publications/StupidSH36.pdf */ + // 3-band SH defined by 9 coefficients class SphericalHarmonics3 { constructor() { this.coefficients = []; - for (let i = 0; i < 9; i++) { this.coefficients.push(new Vector3()); } } - set(coefficients) { for (let i = 0; i < 9; i++) { this.coefficients[i].copy(coefficients[i]); } - return this; } - zero() { for (let i = 0; i < 9; i++) { this.coefficients[i].set(0, 0, 0); } - return this; - } // get the radiance in the direction of the normal - // target is a Vector3 - + } + // get the radiance in the direction of the normal + // target is a Vector3 getAt(normal, target) { // normal is assumed to be unit length + const x = normal.x, - y = normal.y, - z = normal.z; - const coeff = this.coefficients; // band 0 + y = normal.y, + z = normal.z; + const coeff = this.coefficients; - target.copy(coeff[0]).multiplyScalar(0.282095); // band 1 + // band 0 + target.copy(coeff[0]).multiplyScalar(0.282095); + // band 1 target.addScaledVector(coeff[1], 0.488603 * y); target.addScaledVector(coeff[2], 0.488603 * z); - target.addScaledVector(coeff[3], 0.488603 * x); // band 2 + target.addScaledVector(coeff[3], 0.488603 * x); + // band 2 target.addScaledVector(coeff[4], 1.092548 * (x * y)); target.addScaledVector(coeff[5], 1.092548 * (y * z)); target.addScaledVector(coeff[6], 0.315392 * (3.0 * z * z - 1.0)); target.addScaledVector(coeff[7], 1.092548 * (x * z)); target.addScaledVector(coeff[8], 0.546274 * (x * x - y * y)); return target; - } // get the irradiance (radiance convolved with cosine lobe) in the direction of the normal + } + + // get the irradiance (radiance convolved with cosine lobe) in the direction of the normal // target is a Vector3 // https://graphics.stanford.edu/papers/envmap/envmap.pdf - - getIrradianceAt(normal, target) { // normal is assumed to be unit length + const x = normal.x, - y = normal.y, - z = normal.z; - const coeff = this.coefficients; // band 0 + y = normal.y, + z = normal.z; + const coeff = this.coefficients; + // band 0 target.copy(coeff[0]).multiplyScalar(0.886227); // π * 0.282095 - // band 1 + // band 1 target.addScaledVector(coeff[1], 2.0 * 0.511664 * y); // ( 2 * π / 3 ) * 0.488603 - target.addScaledVector(coeff[2], 2.0 * 0.511664 * z); - target.addScaledVector(coeff[3], 2.0 * 0.511664 * x); // band 2 + target.addScaledVector(coeff[3], 2.0 * 0.511664 * x); + // band 2 target.addScaledVector(coeff[4], 2.0 * 0.429043 * x * y); // ( π / 4 ) * 1.092548 - target.addScaledVector(coeff[5], 2.0 * 0.429043 * y * z); target.addScaledVector(coeff[6], 0.743125 * z * z - 0.247708); // ( π / 4 ) * 0.315392 * 3 - target.addScaledVector(coeff[7], 2.0 * 0.429043 * x * z); target.addScaledVector(coeff[8], 0.429043 * (x * x - y * y)); // ( π / 4 ) * 0.546274 return target; } - add(sh) { for (let i = 0; i < 9; i++) { this.coefficients[i].add(sh.coefficients[i]); } - return this; } - addScaledSH(sh, s) { for (let i = 0; i < 9; i++) { this.coefficients[i].addScaledVector(sh.coefficients[i], s); } - return this; } - scale(s) { for (let i = 0; i < 9; i++) { this.coefficients[i].multiplyScalar(s); } - return this; } - lerp(sh, alpha) { for (let i = 0; i < 9; i++) { this.coefficients[i].lerp(sh.coefficients[i], alpha); } - return this; } - equals(sh) { for (let i = 0; i < 9; i++) { if (!this.coefficients[i].equals(sh.coefficients[i])) { return false; } } - return true; } - copy(sh) { return this.set(sh.coefficients); } - clone() { return new this.constructor().copy(this); } - fromArray(array, offset = 0) { const coefficients = this.coefficients; - for (let i = 0; i < 9; i++) { coefficients[i].fromArray(array, offset + i * 3); } - return this; } - toArray(array = [], offset = 0) { const coefficients = this.coefficients; - for (let i = 0; i < 9; i++) { coefficients[i].toArray(array, offset + i * 3); } - return array; - } // evaluate the basis functions - // shBasis is an Array[ 9 ] - + } + // evaluate the basis functions + // shBasis is an Array[ 9 ] static getBasisAt(normal, shBasis) { // normal is assumed to be unit length + const x = normal.x, - y = normal.y, - z = normal.z; // band 0 + y = normal.y, + z = normal.z; - shBasis[0] = 0.282095; // band 1 + // band 0 + shBasis[0] = 0.282095; + // band 1 shBasis[1] = 0.488603 * y; shBasis[2] = 0.488603 * z; - shBasis[3] = 0.488603 * x; // band 2 + shBasis[3] = 0.488603 * x; + // band 2 shBasis[4] = 1.092548 * x * y; shBasis[5] = 1.092548 * y * z; shBasis[6] = 0.315392 * (3 * z * z - 1); shBasis[7] = 1.092548 * x * z; shBasis[8] = 0.546274 * (x * x - y * y); } - } - SphericalHarmonics3.prototype.isSphericalHarmonics3 = true; class LightProbe extends Light { @@ -30062,28 +26962,22 @@ super(undefined, intensity); this.sh = sh; } - copy(source) { super.copy(source); this.sh.copy(source.sh); return this; } - fromJSON(json) { this.intensity = json.intensity; // TODO: Move this bit to Light.fromJSON(); - this.sh.fromArray(json.sh); return this; } - toJSON(meta) { const data = super.toJSON(meta); data.object.sh = this.sh.toArray(); return data; } - } - LightProbe.prototype.isLightProbe = true; class MaterialLoader extends Loader { @@ -30091,7 +26985,6 @@ super(manager); this.textures = {}; } - load(url, onLoad, onProgress, onError) { const scope = this; const loader = new FileLoader(scope.manager); @@ -30107,23 +27000,18 @@ } else { console.error(e); } - scope.manager.itemError(url); } }, onProgress, onError); } - parse(json) { const textures = this.textures; - function getTexture(name) { if (textures[name] === undefined) { console.warn('THREE.MaterialLoader: Undefined texture', name); } - return textures[name]; } - const material = new Materials[json.type](); if (json.uuid !== undefined) material.uuid = json.uuid; if (json.name !== undefined) material.name = json.name; @@ -30182,72 +27070,66 @@ if (json.visible !== undefined) material.visible = json.visible; if (json.toneMapped !== undefined) material.toneMapped = json.toneMapped; if (json.userData !== undefined) material.userData = json.userData; - if (json.vertexColors !== undefined) { if (typeof json.vertexColors === 'number') { material.vertexColors = json.vertexColors > 0 ? true : false; } else { material.vertexColors = json.vertexColors; } - } // Shader Material + } + // Shader Material if (json.uniforms !== undefined) { for (const name in json.uniforms) { const uniform = json.uniforms[name]; material.uniforms[name] = {}; - switch (uniform.type) { case 't': material.uniforms[name].value = getTexture(uniform.value); break; - case 'c': material.uniforms[name].value = new Color().setHex(uniform.value); break; - case 'v2': material.uniforms[name].value = new Vector2().fromArray(uniform.value); break; - case 'v3': material.uniforms[name].value = new Vector3().fromArray(uniform.value); break; - case 'v4': material.uniforms[name].value = new Vector4().fromArray(uniform.value); break; - case 'm3': material.uniforms[name].value = new Matrix3().fromArray(uniform.value); break; - case 'm4': material.uniforms[name].value = new Matrix4().fromArray(uniform.value); break; - default: material.uniforms[name].value = uniform.value; } } } - if (json.defines !== undefined) material.defines = json.defines; if (json.vertexShader !== undefined) material.vertexShader = json.vertexShader; if (json.fragmentShader !== undefined) material.fragmentShader = json.fragmentShader; - if (json.extensions !== undefined) { for (const key in json.extensions) { material.extensions[key] = json.extensions[key]; } - } // Deprecated + } + // Deprecated if (json.shading !== undefined) material.flatShading = json.shading === 1; // THREE.FlatShading + // for PointsMaterial if (json.size !== undefined) material.size = json.size; - if (json.sizeAttenuation !== undefined) material.sizeAttenuation = json.sizeAttenuation; // maps + if (json.sizeAttenuation !== undefined) material.sizeAttenuation = json.sizeAttenuation; + + // maps if (json.map !== undefined) material.map = getTexture(json.map); if (json.matcap !== undefined) material.matcap = getTexture(json.matcap); @@ -30256,18 +27138,15 @@ if (json.bumpScale !== undefined) material.bumpScale = json.bumpScale; if (json.normalMap !== undefined) material.normalMap = getTexture(json.normalMap); if (json.normalMapType !== undefined) material.normalMapType = json.normalMapType; - if (json.normalScale !== undefined) { let normalScale = json.normalScale; - if (Array.isArray(normalScale) === false) { // Blender exporter used to export a scalar. See #7459 + normalScale = [normalScale, normalScale]; } - material.normalScale = new Vector2().fromArray(normalScale); } - if (json.displacementMap !== undefined) material.displacementMap = getTexture(json.displacementMap); if (json.displacementScale !== undefined) material.displacementScale = json.displacementScale; if (json.displacementBias !== undefined) material.displacementBias = json.displacementBias; @@ -30297,64 +27176,65 @@ if (json.sheenRoughnessMap !== undefined) material.sheenRoughnessMap = getTexture(json.sheenRoughnessMap); return material; } - setTextures(value) { this.textures = value; return this; } - } class LoaderUtils { static decodeText(array) { if (typeof TextDecoder !== 'undefined') { return new TextDecoder().decode(array); - } // Avoid the String.fromCharCode.apply(null, array) shortcut, which - // throws a "maximum call stack size exceeded" error for large arrays. + } + // Avoid the String.fromCharCode.apply(null, array) shortcut, which + // throws a "maximum call stack size exceeded" error for large arrays. let s = ''; - for (let i = 0, il = array.length; i < il; i++) { // Implicitly assumes little-endian. s += String.fromCharCode(array[i]); } - try { // merges multi-byte utf-8 characters. + return decodeURIComponent(escape(s)); } catch (e) { // see #16358 + return s; } } - static extractUrlBase(url) { const index = url.lastIndexOf('/'); if (index === -1) return './'; return url.substr(0, index + 1); } - static resolveURL(url, path) { // Invalid URL - if (typeof url !== 'string' || url === '') return ''; // Host Relative URL + if (typeof url !== 'string' || url === '') return ''; + // Host Relative URL if (/^https?:\/\//i.test(path) && /^\//.test(url)) { path = path.replace(/(^https?:\/\/[^\/]+).*/i, '$1'); - } // Absolute URL http://,https://,// - + } - if (/^(https?:)?\/\//i.test(url)) return url; // wxfile URL wxfile:// + // Absolute URL http://,https://,// + if (/^(https?:)?\/\//i.test(url)) return url; - if (/^wxfile:\/\//i.test(url)) return url; // Data URI + // wxfile URL wxfile:// + if (/^wxfile:\/\//i.test(url)) return url; - if (/^data:.*,.*$/i.test(url)) return url; // Blob URL + // Data URI + if (/^data:.*,.*$/i.test(url)) return url; - if (/^blob:.*$/i.test(url)) return url; // Relative URL + // Blob URL + if (/^blob:.*$/i.test(url)) return url; + // Relative URL return path + url; } - } class InstancedBufferGeometry extends BufferGeometry { @@ -30363,33 +27243,27 @@ this.type = 'InstancedBufferGeometry'; this.instanceCount = Infinity; } - copy(source) { super.copy(source); this.instanceCount = source.instanceCount; return this; } - clone() { return new this.constructor().copy(this); } - toJSON() { const data = super.toJSON(this); data.instanceCount = this.instanceCount; data.isInstancedBufferGeometry = true; return data; } - } - InstancedBufferGeometry.prototype.isInstancedBufferGeometry = true; class BufferGeometryLoader extends Loader { constructor(manager) { super(manager); } - load(url, onLoad, onProgress, onError) { const scope = this; const loader = new FileLoader(scope.manager); @@ -30405,16 +27279,13 @@ } else { console.error(e); } - scope.manager.itemError(url); } }, onProgress, onError); } - parse(json) { const interleavedBufferMap = {}; const arrayBufferMap = {}; - function getInterleavedBuffer(json, uuid) { if (interleavedBufferMap[uuid] !== undefined) return interleavedBufferMap[uuid]; const interleavedBuffers = json.interleavedBuffers; @@ -30426,7 +27297,6 @@ interleavedBufferMap[uuid] = ib; return ib; } - function getArrayBuffer(json, uuid) { if (arrayBufferMap[uuid] !== undefined) return arrayBufferMap[uuid]; const arrayBuffers = json.arrayBuffers; @@ -30435,21 +27305,16 @@ arrayBufferMap[uuid] = ab; return ab; } - const geometry = json.isInstancedBufferGeometry ? new InstancedBufferGeometry() : new BufferGeometry(); const index = json.data.index; - if (index !== undefined) { const typedArray = getTypedArray(index.type, index.array); geometry.setIndex(new BufferAttribute(typedArray, 1)); } - const attributes = json.data.attributes; - for (const key in attributes) { const attribute = attributes[key]; let bufferAttribute; - if (attribute.isInterleavedBufferAttribute) { const interleavedBuffer = getInterleavedBuffer(json.data, attribute.data); bufferAttribute = new InterleavedBufferAttribute(interleavedBuffer, attribute.itemSize, attribute.offset, attribute.normalized); @@ -30458,29 +27323,22 @@ const bufferAttributeConstr = attribute.isInstancedBufferAttribute ? InstancedBufferAttribute : BufferAttribute; bufferAttribute = new bufferAttributeConstr(typedArray, attribute.itemSize, attribute.normalized); } - if (attribute.name !== undefined) bufferAttribute.name = attribute.name; if (attribute.usage !== undefined) bufferAttribute.setUsage(attribute.usage); - if (attribute.updateRange !== undefined) { bufferAttribute.updateRange.offset = attribute.updateRange.offset; bufferAttribute.updateRange.count = attribute.updateRange.count; } - geometry.setAttribute(key, bufferAttribute); } - const morphAttributes = json.data.morphAttributes; - if (morphAttributes) { for (const key in morphAttributes) { const attributeArray = morphAttributes[key]; const array = []; - for (let i = 0, il = attributeArray.length; i < il; i++) { const attribute = attributeArray[i]; let bufferAttribute; - if (attribute.isInterleavedBufferAttribute) { const interleavedBuffer = getInterleavedBuffer(json.data, attribute.data); bufferAttribute = new InterleavedBufferAttribute(interleavedBuffer, attribute.itemSize, attribute.offset, attribute.normalized); @@ -30488,54 +27346,41 @@ const typedArray = getTypedArray(attribute.type, attribute.array); bufferAttribute = new BufferAttribute(typedArray, attribute.itemSize, attribute.normalized); } - if (attribute.name !== undefined) bufferAttribute.name = attribute.name; array.push(bufferAttribute); } - geometry.morphAttributes[key] = array; } } - const morphTargetsRelative = json.data.morphTargetsRelative; - if (morphTargetsRelative) { geometry.morphTargetsRelative = true; } - const groups = json.data.groups || json.data.drawcalls || json.data.offsets; - if (groups !== undefined) { for (let i = 0, n = groups.length; i !== n; ++i) { const group = groups[i]; geometry.addGroup(group.start, group.count, group.materialIndex); } } - const boundingSphere = json.data.boundingSphere; - if (boundingSphere !== undefined) { const center = new Vector3(); - if (boundingSphere.center !== undefined) { center.fromArray(boundingSphere.center); } - geometry.boundingSphere = new Sphere(center, boundingSphere.radius); } - if (json.name) geometry.name = json.name; if (json.userData) geometry.userData = json.userData; return geometry; } - } class ObjectLoader extends Loader { constructor(manager) { super(manager); } - load(url, onLoad, onProgress, onError) { const scope = this; const path = this.path === '' ? LoaderUtils.extractUrlBase(url) : this.path; @@ -30546,7 +27391,6 @@ loader.setWithCredentials(this.withCredentials); loader.load(url, function (text) { let json = null; - try { json = JSON.parse(text); } catch (error) { @@ -30554,18 +27398,14 @@ console.error('THREE:ObjectLoader: Can\'t parse ' + url + '.', error.message); return; } - const metadata = json.metadata; - if (metadata === undefined || metadata.type === undefined || metadata.type.toLowerCase() === 'geometry') { console.error('THREE.ObjectLoader: Can\'t load ' + url); return; } - scope.parse(json, onLoad); }, onProgress, onError); } - async loadAsync(url, onProgress) { const scope = this; const path = this.path === '' ? LoaderUtils.extractUrlBase(url) : this.path; @@ -30577,14 +27417,11 @@ const text = await loader.loadAsync(url, onProgress); const json = JSON.parse(text); const metadata = json.metadata; - if (metadata === undefined || metadata.type === undefined || metadata.type.toLowerCase() === 'geometry') { throw new Error('THREE.ObjectLoader: Can\'t load ' + url); } - return await scope.parseAsync(json); } - parse(json, onLoad) { const animations = this.parseAnimations(json.animations); const shapes = this.parseShapes(json.shapes); @@ -30596,24 +27433,22 @@ const materials = this.parseMaterials(json.materials, textures); const object = this.parseObject(json.object, geometries, materials, textures, animations); const skeletons = this.parseSkeletons(json.skeletons, object); - this.bindSkeletons(object, skeletons); // + this.bindSkeletons(object, skeletons); + + // if (onLoad !== undefined) { let hasImages = false; - for (const uuid in images) { if (images[uuid] instanceof HTMLImageElement) { hasImages = true; break; } } - if (hasImages === false) onLoad(object); } - return object; } - async parseAsync(json) { const animations = this.parseAnimations(json.animations); const shapes = this.parseShapes(json.shapes); @@ -30626,27 +27461,27 @@ this.bindSkeletons(object, skeletons); return object; } - parseShapes(json) { const shapes = {}; - if (json !== undefined) { for (let i = 0, l = json.length; i < l; i++) { const shape = new Shape().fromJSON(json[i]); shapes[shape.uuid] = shape; } } - return shapes; } - parseSkeletons(json, object) { const skeletons = {}; - const bones = {}; // generate bone lookup table + const bones = {}; + + // generate bone lookup table object.traverse(function (child) { if (child.isBone) bones[child.uuid] = child; - }); // create skeletons + }); + + // create skeletons if (json !== undefined) { for (let i = 0, l = json.length; i < l; i++) { @@ -30654,92 +27489,70 @@ skeletons[skeleton.uuid] = skeleton; } } - return skeletons; } - parseGeometries(json, shapes) { const geometries = {}; - if (json !== undefined) { const bufferGeometryLoader = new BufferGeometryLoader(); - for (let i = 0, l = json.length; i < l; i++) { let geometry; const data = json[i]; - switch (data.type) { case 'BufferGeometry': case 'InstancedBufferGeometry': geometry = bufferGeometryLoader.parse(data); break; - case 'Geometry': console.error('THREE.ObjectLoader: The legacy Geometry type is no longer supported.'); break; - default: if (data.type in Geometries) { geometry = Geometries[data.type].fromJSON(data, shapes); } else { console.warn(`THREE.ObjectLoader: Unsupported geometry type "${data.type}"`); } - } - geometry.uuid = data.uuid; if (data.name !== undefined) geometry.name = data.name; if (geometry.isBufferGeometry === true && data.userData !== undefined) geometry.userData = data.userData; geometries[data.uuid] = geometry; } } - return geometries; } - parseMaterials(json, textures) { const cache = {}; // MultiMaterial - const materials = {}; - if (json !== undefined) { const loader = new MaterialLoader(); loader.setTextures(textures); - for (let i = 0, l = json.length; i < l; i++) { const data = json[i]; - if (data.type === 'MultiMaterial') { // Deprecated - const array = []; + const array = []; for (let j = 0; j < data.materials.length; j++) { const material = data.materials[j]; - if (cache[material.uuid] === undefined) { cache[material.uuid] = loader.parse(material); } - array.push(cache[material.uuid]); } - materials[data.uuid] = array; } else { if (cache[data.uuid] === undefined) { cache[data.uuid] = loader.parse(data); } - materials[data.uuid] = cache[data.uuid]; } } } - return materials; } - parseAnimations(json) { const animations = {}; - if (json !== undefined) { for (let i = 0; i < json.length; i++) { const data = json[i]; @@ -30747,15 +27560,12 @@ animations[clip.uuid] = clip; } } - return animations; } - parseImages(json, onLoad) { const scope = this; const images = {}; let loader; - function loadImage(url) { scope.manager.itemStart(url); return loader.load(url, function () { @@ -30765,7 +27575,6 @@ scope.manager.itemEnd(url); }); } - function deserializeImage(image) { if (typeof image === 'string') { const url = image; @@ -30783,52 +27592,46 @@ } } } - if (json !== undefined && json.length > 0) { const manager = new LoadingManager(onLoad); loader = new ImageLoader(manager); loader.setCrossOrigin(this.crossOrigin); - for (let i = 0, il = json.length; i < il; i++) { const image = json[i]; const url = image.url; - if (Array.isArray(url)) { // load array of images e.g CubeTexture - images[image.uuid] = []; + images[image.uuid] = []; for (let j = 0, jl = url.length; j < jl; j++) { const currentUrl = url[j]; const deserializedImage = deserializeImage(currentUrl); - if (deserializedImage !== null) { if (deserializedImage instanceof HTMLImageElement) { images[image.uuid].push(deserializedImage); } else { // special case: handle array of data textures for cube textures + images[image.uuid].push(new DataTexture(deserializedImage.data, deserializedImage.width, deserializedImage.height)); } } } } else { // load single image - const deserializedImage = deserializeImage(image.url); + const deserializedImage = deserializeImage(image.url); if (deserializedImage !== null) { images[image.uuid] = deserializedImage; } } } } - return images; } - async parseImagesAsync(json) { const scope = this; const images = {}; let loader; - async function deserializeImage(image) { if (typeof image === 'string') { const url = image; @@ -30846,70 +27649,59 @@ } } } - if (json !== undefined && json.length > 0) { loader = new ImageLoader(this.manager); loader.setCrossOrigin(this.crossOrigin); - for (let i = 0, il = json.length; i < il; i++) { const image = json[i]; const url = image.url; - if (Array.isArray(url)) { // load array of images e.g CubeTexture - images[image.uuid] = []; + images[image.uuid] = []; for (let j = 0, jl = url.length; j < jl; j++) { const currentUrl = url[j]; const deserializedImage = await deserializeImage(currentUrl); - if (deserializedImage !== null) { if (deserializedImage instanceof HTMLImageElement) { images[image.uuid].push(deserializedImage); } else { // special case: handle array of data textures for cube textures + images[image.uuid].push(new DataTexture(deserializedImage.data, deserializedImage.width, deserializedImage.height)); } } } } else { // load single image - const deserializedImage = await deserializeImage(image.url); + const deserializedImage = await deserializeImage(image.url); if (deserializedImage !== null) { images[image.uuid] = deserializedImage; } } } } - return images; } - parseTextures(json, images) { function parseConstant(value, type) { if (typeof value === 'number') return value; console.warn('THREE.ObjectLoader.parseTexture: Constant should be in numeric form.', value); return type[value]; } - const textures = {}; - if (json !== undefined) { for (let i = 0, l = json.length; i < l; i++) { const data = json[i]; - if (data.image === undefined) { console.warn('THREE.ObjectLoader: No "image" specified for', data.uuid); } - if (images[data.image] === undefined) { console.warn('THREE.ObjectLoader: Undefined image', data.image); } - let texture; const image = images[data.image]; - if (Array.isArray(image)) { texture = new CubeTexture(image); if (image.length === 6) texture.needsUpdate = true; @@ -30919,10 +27711,8 @@ } else { texture = new Texture(image); } - if (image) texture.needsUpdate = true; // textures can have undefined image data } - texture.uuid = data.uuid; if (data.name !== undefined) texture.name = data.name; if (data.mapping !== undefined) texture.mapping = parseConstant(data.mapping, TEXTURE_MAPPING); @@ -30930,12 +27720,10 @@ if (data.repeat !== undefined) texture.repeat.fromArray(data.repeat); if (data.center !== undefined) texture.center.fromArray(data.center); if (data.rotation !== undefined) texture.rotation = data.rotation; - if (data.wrap !== undefined) { texture.wrapS = parseConstant(data.wrap[0], TEXTURE_WRAPPING); texture.wrapT = parseConstant(data.wrap[1], TEXTURE_WRAPPING); } - if (data.format !== undefined) texture.format = data.format; if (data.type !== undefined) texture.type = data.type; if (data.encoding !== undefined) texture.encoding = data.encoding; @@ -30949,61 +27737,44 @@ textures[data.uuid] = texture; } } - return textures; } - parseObject(data, geometries, materials, textures, animations) { let object; - function getGeometry(name) { if (geometries[name] === undefined) { console.warn('THREE.ObjectLoader: Undefined geometry', name); } - return geometries[name]; } - function getMaterial(name) { if (name === undefined) return undefined; - if (Array.isArray(name)) { const array = []; - for (let i = 0, l = name.length; i < l; i++) { const uuid = name[i]; - if (materials[uuid] === undefined) { console.warn('THREE.ObjectLoader: Undefined material', uuid); } - array.push(materials[uuid]); } - return array; } - if (materials[name] === undefined) { console.warn('THREE.ObjectLoader: Undefined material', name); } - return materials[name]; } - function getTexture(uuid) { if (textures[uuid] === undefined) { console.warn('THREE.ObjectLoader: Undefined texture', uuid); } - return textures[uuid]; } - let geometry, material; - switch (data.type) { case 'Scene': object = new Scene(); - if (data.background !== undefined) { if (Number.isInteger(data.background)) { object.background = new Color(data.background); @@ -31011,11 +27782,9 @@ object.background = getTexture(data.background); } } - if (data.environment !== undefined) { object.environment = getTexture(data.environment); } - if (data.fog !== undefined) { if (data.fog.type === 'Fog') { object.fog = new Fog(data.fog.color, data.fog.near, data.fog.far); @@ -31023,9 +27792,7 @@ object.fog = new FogExp2(data.fog.color, data.fog.density); } } - break; - case 'PerspectiveCamera': object = new PerspectiveCamera(data.fov, data.aspect, data.near, data.far); if (data.focus !== undefined) object.focus = data.focus; @@ -31034,41 +27801,32 @@ if (data.filmOffset !== undefined) object.filmOffset = data.filmOffset; if (data.view !== undefined) object.view = Object.assign({}, data.view); break; - case 'OrthographicCamera': object = new OrthographicCamera(data.left, data.right, data.top, data.bottom, data.near, data.far); if (data.zoom !== undefined) object.zoom = data.zoom; if (data.view !== undefined) object.view = Object.assign({}, data.view); break; - case 'AmbientLight': object = new AmbientLight(data.color, data.intensity); break; - case 'DirectionalLight': object = new DirectionalLight(data.color, data.intensity); break; - case 'PointLight': object = new PointLight(data.color, data.intensity, data.distance, data.decay); break; - case 'RectAreaLight': object = new RectAreaLight(data.color, data.intensity, data.width, data.height); break; - case 'SpotLight': object = new SpotLight(data.color, data.intensity, data.distance, data.angle, data.penumbra, data.decay); break; - case 'HemisphereLight': object = new HemisphereLight(data.color, data.groundColor, data.intensity); break; - case 'LightProbe': object = new LightProbe().fromJSON(data); break; - case 'SkinnedMesh': geometry = getGeometry(data.geometry); material = getMaterial(data.material); @@ -31077,13 +27835,11 @@ if (data.bindMatrix !== undefined) object.bindMatrix.fromArray(data.bindMatrix); if (data.skeleton !== undefined) object.skeleton = data.skeleton; break; - case 'Mesh': geometry = getGeometry(data.geometry); material = getMaterial(data.material); object = new Mesh(geometry, material); break; - case 'InstancedMesh': geometry = getGeometry(data.geometry); material = getMaterial(data.material); @@ -31094,47 +27850,36 @@ object.instanceMatrix = new InstancedBufferAttribute(new Float32Array(instanceMatrix.array), 16); if (instanceColor !== undefined) object.instanceColor = new InstancedBufferAttribute(new Float32Array(instanceColor.array), instanceColor.itemSize); break; - case 'LOD': object = new LOD(); break; - case 'Line': object = new Line(getGeometry(data.geometry), getMaterial(data.material)); break; - case 'LineLoop': object = new LineLoop(getGeometry(data.geometry), getMaterial(data.material)); break; - case 'LineSegments': object = new LineSegments(getGeometry(data.geometry), getMaterial(data.material)); break; - case 'PointCloud': case 'Points': object = new Points(getGeometry(data.geometry), getMaterial(data.material)); break; - case 'Sprite': object = new Sprite(getMaterial(data.material)); break; - case 'Group': object = new Group(); break; - case 'Bone': object = new Bone(); break; - default: object = new Object3D(); } - object.uuid = data.uuid; if (data.name !== undefined) object.name = data.name; - if (data.matrix !== undefined) { object.matrix.fromArray(data.matrix); if (data.matrixAutoUpdate !== undefined) object.matrixAutoUpdate = data.matrixAutoUpdate; @@ -31145,10 +27890,8 @@ if (data.quaternion !== undefined) object.quaternion.fromArray(data.quaternion); if (data.scale !== undefined) object.scale.fromArray(data.scale); } - if (data.castShadow !== undefined) object.castShadow = data.castShadow; if (data.receiveShadow !== undefined) object.receiveShadow = data.receiveShadow; - if (data.shadow) { if (data.shadow.bias !== undefined) object.shadow.bias = data.shadow.bias; if (data.shadow.normalBias !== undefined) object.shadow.normalBias = data.shadow.normalBias; @@ -31156,53 +27899,42 @@ if (data.shadow.mapSize !== undefined) object.shadow.mapSize.fromArray(data.shadow.mapSize); if (data.shadow.camera !== undefined) object.shadow.camera = this.parseObject(data.shadow.camera); } - if (data.visible !== undefined) object.visible = data.visible; if (data.frustumCulled !== undefined) object.frustumCulled = data.frustumCulled; if (data.renderOrder !== undefined) object.renderOrder = data.renderOrder; if (data.userData !== undefined) object.userData = data.userData; if (data.layers !== undefined) object.layers.mask = data.layers; - if (data.children !== undefined) { const children = data.children; - for (let i = 0; i < children.length; i++) { object.add(this.parseObject(children[i], geometries, materials, textures, animations)); } } - if (data.animations !== undefined) { const objectAnimations = data.animations; - for (let i = 0; i < objectAnimations.length; i++) { const uuid = objectAnimations[i]; object.animations.push(animations[uuid]); } } - if (data.type === 'LOD') { if (data.autoUpdate !== undefined) object.autoUpdate = data.autoUpdate; const levels = data.levels; - for (let l = 0; l < levels.length; l++) { const level = levels[l]; const child = object.getObjectByProperty('uuid', level.object); - if (child !== undefined) { object.addLevel(child, level.distance); } } } - return object; } - bindSkeletons(object, skeletons) { if (Object.keys(skeletons).length === 0) return; object.traverse(function (child) { if (child.isSkinnedMesh === true && child.skeleton !== undefined) { const skeleton = skeletons[child.skeleton]; - if (skeleton === undefined) { console.warn('THREE.ObjectLoader: No skeleton found with UUID:', child.skeleton); } else { @@ -31211,16 +27943,14 @@ } }); } - /* DEPRECATED */ + /* DEPRECATED */ setTexturePath(value) { console.warn('THREE.ObjectLoader: .setTexturePath() has been renamed to .setResourcePath().'); return this.setResourcePath(value); } - } - const TEXTURE_MAPPING = { UVMapping: UVMapping, CubeReflectionMapping: CubeReflectionMapping, @@ -31247,32 +27977,26 @@ class ImageBitmapLoader extends Loader { constructor(manager) { super(manager); - if (typeof createImageBitmap === 'undefined') { console.warn('THREE.ImageBitmapLoader: createImageBitmap() not supported.'); } - if (typeof fetch === 'undefined') { console.warn('THREE.ImageBitmapLoader: fetch() not supported.'); } - this.options = { premultiplyAlpha: 'none' }; } - setOptions(options) { this.options = options; return this; } - load(url, onLoad, onProgress, onError) { if (url === undefined) url = ''; if (this.path !== undefined) url = this.path + url; url = this.manager.resolveURL(url); const scope = this; const cached = Cache.get(url); - if (cached !== undefined) { scope.manager.itemStart(url); setTimeout(function () { @@ -31281,7 +28005,6 @@ }, 0); return cached; } - const fetchOptions = {}; fetchOptions.credentials = this.crossOrigin === 'anonymous' ? 'same-origin' : 'include'; fetchOptions.headers = this.requestHeader; @@ -31302,9 +28025,7 @@ }); scope.manager.itemStart(url); } - } - ImageBitmapLoader.prototype.isImageBitmapLoader = true; let _context; @@ -31313,7 +28034,6 @@ if (_context === undefined) { _context = new platform.AudioContext(); } - return _context; }, setContext: function (value) { @@ -31325,7 +28045,6 @@ constructor(manager) { super(manager); } - load(url, onLoad, onProgress, onError) { const scope = this; const loader = new FileLoader(this.manager); @@ -31348,12 +28067,10 @@ } else { console.error(e); } - scope.manager.itemError(url); } }, onProgress, onError); } - } class HemisphereLightProbe extends LightProbe { @@ -31362,36 +28079,31 @@ const color1 = new Color().set(skyColor); const color2 = new Color().set(groundColor); const sky = new Vector3(color1.r, color1.g, color1.b); - const ground = new Vector3(color2.r, color2.g, color2.b); // without extra factor of PI in the shader, should = 1 / Math.sqrt( Math.PI ); + const ground = new Vector3(color2.r, color2.g, color2.b); + // without extra factor of PI in the shader, should = 1 / Math.sqrt( Math.PI ); const c0 = Math.sqrt(Math.PI); const c1 = c0 * Math.sqrt(0.75); this.sh.coefficients[0].copy(sky).add(ground).multiplyScalar(c0); this.sh.coefficients[1].copy(sky).sub(ground).multiplyScalar(c1); } - } - HemisphereLightProbe.prototype.isHemisphereLightProbe = true; class AmbientLightProbe extends LightProbe { constructor(color, intensity = 1) { super(undefined, intensity); - const color1 = new Color().set(color); // without extra factor of PI in the shader, would be 2 / Math.sqrt( Math.PI ); + const color1 = new Color().set(color); + // without extra factor of PI in the shader, would be 2 / Math.sqrt( Math.PI ); this.sh.coefficients[0].set(color1.r, color1.g, color1.b).multiplyScalar(2 * Math.sqrt(Math.PI)); } - } - AmbientLightProbe.prototype.isAmbientLightProbe = true; const _eyeRight = /*@__PURE__*/new Matrix4(); - const _eyeLeft = /*@__PURE__*/new Matrix4(); - const _projectionMatrix = /*@__PURE__*/new Matrix4(); - class StereoCamera { constructor() { this.type = 'StereoCamera'; @@ -31413,11 +28125,9 @@ eyeSep: null }; } - update(camera) { const cache = this._cache; const needsUpdate = cache.focus !== camera.focus || cache.fov !== camera.fov || cache.aspect !== camera.aspect * this.aspect || cache.near !== camera.near || cache.far !== camera.far || cache.zoom !== camera.zoom || cache.eyeSep !== this.eyeSep; - if (needsUpdate) { cache.focus = camera.focus; cache.fov = camera.fov; @@ -31425,24 +28135,31 @@ cache.near = camera.near; cache.far = camera.far; cache.zoom = camera.zoom; - cache.eyeSep = this.eyeSep; // Off-axis stereoscopic effect based on + cache.eyeSep = this.eyeSep; + + // Off-axis stereoscopic effect based on // http://paulbourke.net/stereographics/stereorender/ _projectionMatrix.copy(camera.projectionMatrix); - const eyeSepHalf = cache.eyeSep / 2; const eyeSepOnProjection = eyeSepHalf * cache.near / cache.focus; const ymax = cache.near * Math.tan(DEG2RAD * cache.fov * 0.5) / cache.zoom; - let xmin, xmax; // translate xOffset + let xmin, xmax; + + // translate xOffset _eyeLeft.elements[12] = -eyeSepHalf; - _eyeRight.elements[12] = eyeSepHalf; // for left eye + _eyeRight.elements[12] = eyeSepHalf; + + // for left eye xmin = -ymax * cache.aspect + eyeSepOnProjection; xmax = ymax * cache.aspect + eyeSepOnProjection; _projectionMatrix.elements[0] = 2 * cache.near / (xmax - xmin); _projectionMatrix.elements[8] = (xmax + xmin) / (xmax - xmin); - this.cameraL.projectionMatrix.copy(_projectionMatrix); // for right eye + this.cameraL.projectionMatrix.copy(_projectionMatrix); + + // for right eye xmin = -ymax * cache.aspect - eyeSepOnProjection; xmax = ymax * cache.aspect - eyeSepOnProjection; @@ -31450,11 +28167,9 @@ _projectionMatrix.elements[8] = (xmax + xmin) / (xmax - xmin); this.cameraR.projectionMatrix.copy(_projectionMatrix); } - this.cameraL.matrixWorld.copy(camera.matrixWorld).multiply(_eyeLeft); this.cameraR.matrixWorld.copy(camera.matrixWorld).multiply(_eyeRight); } - } class Clock { @@ -31465,57 +28180,44 @@ this.elapsedTime = 0; this.running = false; } - start() { this.startTime = now(); this.oldTime = this.startTime; this.elapsedTime = 0; this.running = true; } - stop() { this.getElapsedTime(); this.running = false; this.autoStart = false; } - getElapsedTime() { this.getDelta(); return this.elapsedTime; } - getDelta() { let diff = 0; - if (this.autoStart && !this.running) { this.start(); return 0; } - if (this.running) { const newTime = now(); diff = (newTime - this.oldTime) / 1000; this.oldTime = newTime; this.elapsedTime += diff; } - return diff; } - } - function now() { return (typeof performance === 'undefined' ? Date : performance).now(); // see #10732 } const _position$1 = /*@__PURE__*/new Vector3(); - const _quaternion$1 = /*@__PURE__*/new Quaternion(); - const _scale$1 = /*@__PURE__*/new Vector3(); - const _orientation$1 = /*@__PURE__*/new Vector3(); - class AudioListener extends Object3D { constructor() { super(); @@ -31524,15 +28226,15 @@ this.gain = this.context.createGain(); this.gain.connect(this.context.destination); this.filter = null; - this.timeDelta = 0; // private + this.timeDelta = 0; + + // private this._clock = new Clock(); } - getInput() { return this.gain; } - removeFilter() { if (this.filter !== null) { this.gain.disconnect(this.filter); @@ -31540,14 +28242,11 @@ this.gain.connect(this.context.destination); this.filter = null; } - return this; } - getFilter() { return this.filter; } - setFilter(value) { if (this.filter !== null) { this.gain.disconnect(this.filter); @@ -31555,33 +28254,28 @@ } else { this.gain.disconnect(this.context.destination); } - this.filter = value; this.gain.connect(this.filter); this.filter.connect(this.context.destination); return this; } - getMasterVolume() { return this.gain.gain.value; } - setMasterVolume(value) { this.gain.gain.setTargetAtTime(value, this.context.currentTime, 0.01); return this; } - updateMatrixWorld(force) { super.updateMatrixWorld(force); const listener = this.context.listener; const up = this.up; this.timeDelta = this._clock.getDelta(); this.matrixWorld.decompose(_position$1, _quaternion$1, _scale$1); - _orientation$1.set(0, 0, -1).applyQuaternion(_quaternion$1); - if (listener.positionX) { // code path for Chrome (see #14393) + const endTime = this.context.currentTime + this.timeDelta; listener.positionX.linearRampToValueAtTime(_position$1.x, endTime); listener.positionY.linearRampToValueAtTime(_position$1.y, endTime); @@ -31597,7 +28291,6 @@ listener.setOrientation(_orientation$1.x, _orientation$1.y, _orientation$1.z, up.x, up.y, up.z); } } - } class Audio extends Object3D { @@ -31626,11 +28319,9 @@ this._connected = false; this.filters = []; } - getOutput() { return this.gain; } - setNodeSource(audioNode) { this.hasPlaybackControl = false; this.sourceType = 'audioNode'; @@ -31638,7 +28329,6 @@ this.connect(); return this; } - setMediaElementSource(mediaElement) { this.hasPlaybackControl = false; this.sourceType = 'mediaNode'; @@ -31646,7 +28336,6 @@ this.connect(); return this; } - setMediaStreamSource(mediaStream) { this.hasPlaybackControl = false; this.sourceType = 'mediaStreamNode'; @@ -31654,25 +28343,21 @@ this.connect(); return this; } - setBuffer(audioBuffer) { this.buffer = audioBuffer; this.sourceType = 'buffer'; if (this.autoplay) this.play(); return this; } - play(delay = 0) { if (this.isPlaying === true) { console.warn('THREE.Audio: Audio is already playing.'); return; } - if (this.hasPlaybackControl === false) { console.warn('THREE.Audio: this Audio has no playback control.'); return; } - this._startedAt = this.context.currentTime + delay; const source = this.context.createBufferSource(); source.buffer = this.buffer; @@ -31687,84 +28372,68 @@ this.setPlaybackRate(this.playbackRate); return this.connect(); } - pause() { if (this.hasPlaybackControl === false) { console.warn('THREE.Audio: this Audio has no playback control.'); return; } - if (this.isPlaying === true) { // update current progress - this._progress += Math.max(this.context.currentTime - this._startedAt, 0) * this.playbackRate; + this._progress += Math.max(this.context.currentTime - this._startedAt, 0) * this.playbackRate; if (this.loop === true) { // ensure _progress does not exceed duration with looped audios + this._progress = this._progress % (this.duration || this.buffer.duration); } - this.source.stop(); this.source.onended = null; this.isPlaying = false; } - return this; } - stop() { if (this.hasPlaybackControl === false) { console.warn('THREE.Audio: this Audio has no playback control.'); return; } - this._progress = 0; this.source.stop(); this.source.onended = null; this.isPlaying = false; return this; } - connect() { if (this.filters.length > 0) { this.source.connect(this.filters[0]); - for (let i = 1, l = this.filters.length; i < l; i++) { this.filters[i - 1].connect(this.filters[i]); } - this.filters[this.filters.length - 1].connect(this.getOutput()); } else { this.source.connect(this.getOutput()); } - this._connected = true; return this; } - disconnect() { if (this.filters.length > 0) { this.source.disconnect(this.filters[0]); - for (let i = 1, l = this.filters.length; i < l; i++) { this.filters[i - 1].disconnect(this.filters[i]); } - this.filters[this.filters.length - 1].disconnect(this.getOutput()); } else { this.source.disconnect(this.getOutput()); } - this._connected = false; return this; } - getFilters() { return this.filters; } - setFilters(value) { if (!value) value = []; - if (this._connected === true) { this.disconnect(); this.filters = value.slice(); @@ -31772,10 +28441,8 @@ } else { this.filters = value.slice(); } - return this; } - setDetune(value) { this.detune = value; if (this.source.detune === undefined) return; // only set detune when available @@ -31783,98 +28450,73 @@ if (this.isPlaying === true) { this.source.detune.setTargetAtTime(this.detune, this.context.currentTime, 0.01); } - return this; } - getDetune() { return this.detune; } - getFilter() { return this.getFilters()[0]; } - setFilter(filter) { return this.setFilters(filter ? [filter] : []); } - setPlaybackRate(value) { if (this.hasPlaybackControl === false) { console.warn('THREE.Audio: this Audio has no playback control.'); return; } - this.playbackRate = value; - if (this.isPlaying === true) { this.source.playbackRate.setTargetAtTime(this.playbackRate, this.context.currentTime, 0.01); } - return this; } - getPlaybackRate() { return this.playbackRate; } - onEnded() { this.isPlaying = false; } - getLoop() { if (this.hasPlaybackControl === false) { console.warn('THREE.Audio: this Audio has no playback control.'); return false; } - return this.loop; } - setLoop(value) { if (this.hasPlaybackControl === false) { console.warn('THREE.Audio: this Audio has no playback control.'); return; } - this.loop = value; - if (this.isPlaying === true) { this.source.loop = this.loop; } - return this; } - setLoopStart(value) { this.loopStart = value; return this; } - setLoopEnd(value) { this.loopEnd = value; return this; } - getVolume() { return this.gain.gain.value; } - setVolume(value) { this.gain.gain.setTargetAtTime(value, this.context.currentTime, 0.01); return this; } - } const _position = /*@__PURE__*/new Vector3(); - const _quaternion = /*@__PURE__*/new Quaternion(); - const _scale = /*@__PURE__*/new Vector3(); - const _orientation = /*@__PURE__*/new Vector3(); - class PositionalAudio extends Audio { constructor(listener) { super(listener); @@ -31882,65 +28524,52 @@ this.panner.panningModel = 'HRTF'; this.panner.connect(this.gain); } - getOutput() { return this.panner; } - getRefDistance() { return this.panner.refDistance; } - setRefDistance(value) { this.panner.refDistance = value; return this; } - getRolloffFactor() { return this.panner.rolloffFactor; } - setRolloffFactor(value) { this.panner.rolloffFactor = value; return this; } - getDistanceModel() { return this.panner.distanceModel; } - setDistanceModel(value) { this.panner.distanceModel = value; return this; } - getMaxDistance() { return this.panner.maxDistance; } - setMaxDistance(value) { this.panner.maxDistance = value; return this; } - setDirectionalCone(coneInnerAngle, coneOuterAngle, coneOuterGain) { this.panner.coneInnerAngle = coneInnerAngle; this.panner.coneOuterAngle = coneOuterAngle; this.panner.coneOuterGain = coneOuterGain; return this; } - updateMatrixWorld(force) { super.updateMatrixWorld(force); if (this.hasPlaybackControl === true && this.isPlaying === false) return; this.matrixWorld.decompose(_position, _quaternion, _scale); - _orientation.set(0, 0, 1).applyQuaternion(_quaternion); - const panner = this.panner; - if (panner.positionX) { // code path for Chrome and Firefox (see #14393) + const endTime = this.context.currentTime + this.listener.timeDelta; panner.positionX.linearRampToValueAtTime(_position.x, endTime); panner.positionY.linearRampToValueAtTime(_position.y, endTime); @@ -31953,7 +28582,6 @@ panner.setOrientation(_orientation.x, _orientation.y, _orientation.z); } } - } class AudioAnalyser { @@ -31963,30 +28591,27 @@ this.data = new Uint8Array(this.analyser.frequencyBinCount); audio.getOutput().connect(this.analyser); } - getFrequencyData() { this.analyser.getByteFrequencyData(this.data); return this.data; } - getAverageFrequency() { let value = 0; const data = this.getFrequencyData(); - for (let i = 0; i < data.length; i++) { value += data[i]; } - return value / data.length; } - } class PropertyMixer { constructor(binding, typeName, valueSize) { this.binding = binding; this.valueSize = valueSize; - let mixFunction, mixFunctionAdditive, setIdentity; // buffer layout: [ incoming | accu0 | accu1 | orig | addAccu | (optional work) ] + let mixFunction, mixFunctionAdditive, setIdentity; + + // buffer layout: [ incoming | accu0 | accu1 | orig | addAccu | (optional work) ] // // interpolators can use .buffer as their .result // the data then goes to 'incoming' @@ -32010,24 +28635,22 @@ this.buffer = new Float64Array(valueSize * 6); this._workIndex = 5; break; - case 'string': case 'bool': - mixFunction = this._select; // Use the regular mix function and for additive on these types, - // additive is not relevant for non-numeric types + mixFunction = this._select; + // Use the regular mix function and for additive on these types, + // additive is not relevant for non-numeric types mixFunctionAdditive = this._select; setIdentity = this._setAdditiveIdentityOther; this.buffer = new Array(valueSize * 5); break; - default: mixFunction = this._lerp; mixFunctionAdditive = this._lerpAdditive; setIdentity = this._setAdditiveIdentityNumeric; this.buffer = new Float64Array(valueSize * 5); } - this._mixBufferRegion = mixFunction; this._mixBufferRegionAdditive = mixFunctionAdditive; this._setIdentity = setIdentity; @@ -32037,133 +28660,126 @@ this.cumulativeWeightAdditive = 0; this.useCount = 0; this.referenceCount = 0; - } // accumulate data in the 'incoming' region into 'accu' - + } + // accumulate data in the 'incoming' region into 'accu' accumulate(accuIndex, weight) { // note: happily accumulating nothing when weight = 0, the caller knows // the weight and shouldn't have made the call in the first place + const buffer = this.buffer, - stride = this.valueSize, - offset = accuIndex * stride + stride; + stride = this.valueSize, + offset = accuIndex * stride + stride; let currentWeight = this.cumulativeWeight; - if (currentWeight === 0) { // accuN := incoming * weight + for (let i = 0; i !== stride; ++i) { buffer[offset + i] = buffer[i]; } - currentWeight = weight; } else { // accuN := accuN + incoming * weight + currentWeight += weight; const mix = weight / currentWeight; - this._mixBufferRegion(buffer, offset, 0, mix, stride); } - this.cumulativeWeight = currentWeight; - } // accumulate data in the 'incoming' region into 'add' - + } + // accumulate data in the 'incoming' region into 'add' accumulateAdditive(weight) { const buffer = this.buffer, - stride = this.valueSize, - offset = stride * this._addIndex; - + stride = this.valueSize, + offset = stride * this._addIndex; if (this.cumulativeWeightAdditive === 0) { // add = identity + this._setIdentity(); - } // add := add + incoming * weight + } + // add := add + incoming * weight this._mixBufferRegionAdditive(buffer, offset, 0, weight, stride); - this.cumulativeWeightAdditive += weight; - } // apply the state of 'accu' to the binding when accus differ - + } + // apply the state of 'accu' to the binding when accus differ apply(accuIndex) { const stride = this.valueSize, - buffer = this.buffer, - offset = accuIndex * stride + stride, - weight = this.cumulativeWeight, - weightAdditive = this.cumulativeWeightAdditive, - binding = this.binding; + buffer = this.buffer, + offset = accuIndex * stride + stride, + weight = this.cumulativeWeight, + weightAdditive = this.cumulativeWeightAdditive, + binding = this.binding; this.cumulativeWeight = 0; this.cumulativeWeightAdditive = 0; - if (weight < 1) { // accuN := accuN + original * ( 1 - cumulativeWeight ) - const originalValueOffset = stride * this._origIndex; + const originalValueOffset = stride * this._origIndex; this._mixBufferRegion(buffer, offset, originalValueOffset, 1 - weight, stride); } - if (weightAdditive > 0) { // accuN := accuN + additive accuN + this._mixBufferRegionAdditive(buffer, offset, this._addIndex * stride, 1, stride); } - for (let i = stride, e = stride + stride; i !== e; ++i) { if (buffer[i] !== buffer[i + stride]) { // value has changed -> update scene graph + binding.setValue(buffer, offset); break; } } - } // remember the state of the bound property and copy it to both accus - + } + // remember the state of the bound property and copy it to both accus saveOriginalState() { const binding = this.binding; const buffer = this.buffer, - stride = this.valueSize, - originalValueOffset = stride * this._origIndex; - binding.getValue(buffer, originalValueOffset); // accu[0..1] := orig -- initially detect changes against the original + stride = this.valueSize, + originalValueOffset = stride * this._origIndex; + binding.getValue(buffer, originalValueOffset); + // accu[0..1] := orig -- initially detect changes against the original for (let i = stride, e = originalValueOffset; i !== e; ++i) { buffer[i] = buffer[originalValueOffset + i % stride]; - } // Add to identity for additive - + } + // Add to identity for additive this._setIdentity(); - this.cumulativeWeight = 0; this.cumulativeWeightAdditive = 0; - } // apply the state previously taken via 'saveOriginalState' to the binding - + } + // apply the state previously taken via 'saveOriginalState' to the binding restoreOriginalState() { const originalValueOffset = this.valueSize * 3; this.binding.setValue(this.buffer, originalValueOffset); } - _setAdditiveIdentityNumeric() { const startIndex = this._addIndex * this.valueSize; const endIndex = startIndex + this.valueSize; - for (let i = startIndex; i < endIndex; i++) { this.buffer[i] = 0; } } - _setAdditiveIdentityQuaternion() { this._setAdditiveIdentityNumeric(); - this.buffer[this._addIndex * this.valueSize + 3] = 1; } - _setAdditiveIdentityOther() { const startIndex = this._origIndex * this.valueSize; const targetIndex = this._addIndex * this.valueSize; - for (let i = 0; i < this.valueSize; i++) { this.buffer[targetIndex + i] = this.buffer[startIndex + i]; } - } // mix functions + } + // mix functions _select(buffer, dstOffset, srcOffset, t, stride) { if (t >= 0.5) { @@ -32172,126 +28788,110 @@ } } } - _slerp(buffer, dstOffset, srcOffset, t) { Quaternion.slerpFlat(buffer, dstOffset, buffer, dstOffset, buffer, srcOffset, t); } - _slerpAdditive(buffer, dstOffset, srcOffset, t, stride) { - const workOffset = this._workIndex * stride; // Store result in intermediate buffer offset + const workOffset = this._workIndex * stride; - Quaternion.multiplyQuaternionsFlat(buffer, workOffset, buffer, dstOffset, buffer, srcOffset); // Slerp to the intermediate result + // Store result in intermediate buffer offset + Quaternion.multiplyQuaternionsFlat(buffer, workOffset, buffer, dstOffset, buffer, srcOffset); + // Slerp to the intermediate result Quaternion.slerpFlat(buffer, dstOffset, buffer, dstOffset, buffer, workOffset, t); } - _lerp(buffer, dstOffset, srcOffset, t, stride) { const s = 1 - t; - for (let i = 0; i !== stride; ++i) { const j = dstOffset + i; buffer[j] = buffer[j] * s + buffer[srcOffset + i] * t; } } - _lerpAdditive(buffer, dstOffset, srcOffset, t, stride) { for (let i = 0; i !== stride; ++i) { const j = dstOffset + i; buffer[j] = buffer[j] + buffer[srcOffset + i] * t; } } - } // Characters [].:/ are reserved for track binding syntax. const _RESERVED_CHARS_RE = '\\[\\]\\.:\\/'; + const _reservedRe = new RegExp('[' + _RESERVED_CHARS_RE + ']', 'g'); - const _reservedRe = new RegExp('[' + _RESERVED_CHARS_RE + ']', 'g'); // Attempts to allow node names from any language. ES5's `\w` regexp matches + // Attempts to allow node names from any language. ES5's `\w` regexp matches // only latin characters, and the unicode \p{L} is not yet supported. So // instead, we exclude reserved characters and match everything else. - - const _wordChar = '[^' + _RESERVED_CHARS_RE + ']'; + const _wordCharOrDot = '[^' + _RESERVED_CHARS_RE.replace('\\.', '') + ']'; - const _wordCharOrDot = '[^' + _RESERVED_CHARS_RE.replace('\\.', '') + ']'; // Parent directories, delimited by '/' or ':'. Currently unused, but must + // Parent directories, delimited by '/' or ':'. Currently unused, but must // be matched to parse the rest of the track name. + const _directoryRe = /((?:WC+[\/:])*)/.source.replace('WC', _wordChar); + // Target node. May contain word characters (a-zA-Z0-9_) and '.' or '-'. + const _nodeRe = /(WCOD+)?/.source.replace('WCOD', _wordCharOrDot); - const _directoryRe = /((?:WC+[\/:])*)/.source.replace('WC', _wordChar); // Target node. May contain word characters (a-zA-Z0-9_) and '.' or '-'. - - - const _nodeRe = /(WCOD+)?/.source.replace('WCOD', _wordCharOrDot); // Object on target node, and accessor. May not contain reserved + // Object on target node, and accessor. May not contain reserved // characters. Accessor may contain any character except closing bracket. + const _objectRe = /(?:\.(WC+)(?:\[(.+)\])?)?/.source.replace('WC', _wordChar); - - const _objectRe = /(?:\.(WC+)(?:\[(.+)\])?)?/.source.replace('WC', _wordChar); // Property and accessor. May not contain reserved characters. Accessor may + // Property and accessor. May not contain reserved characters. Accessor may // contain any non-bracket characters. - - const _propertyRe = /\.(WC+)(?:\[(.+)\])?/.source.replace('WC', _wordChar); - const _trackRe = new RegExp('' + '^' + _directoryRe + _nodeRe + _objectRe + _propertyRe + '$'); - const _supportedObjectNames = ['material', 'materials', 'bones']; - class Composite { constructor(targetGroup, path, optionalParsedPath) { const parsedPath = optionalParsedPath || PropertyBinding.parseTrackName(path); this._targetGroup = targetGroup; this._bindings = targetGroup.subscribe_(path, parsedPath); } - getValue(array, offset) { this.bind(); // bind all binding const firstValidIndex = this._targetGroup.nCachedObjects_, - binding = this._bindings[firstValidIndex]; // and only call .getValue on the first + binding = this._bindings[firstValidIndex]; + // and only call .getValue on the first if (binding !== undefined) binding.getValue(array, offset); } - setValue(array, offset) { const bindings = this._bindings; - for (let i = this._targetGroup.nCachedObjects_, n = bindings.length; i !== n; ++i) { bindings[i].setValue(array, offset); } } - bind() { const bindings = this._bindings; - for (let i = this._targetGroup.nCachedObjects_, n = bindings.length; i !== n; ++i) { bindings[i].bind(); } } - unbind() { const bindings = this._bindings; - for (let i = this._targetGroup.nCachedObjects_, n = bindings.length; i !== n; ++i) { bindings[i].unbind(); } } + } - } // Note: This class uses a State pattern on a per-method basis: + // Note: This class uses a State pattern on a per-method basis: // 'bind' sets 'this.getValue' / 'setValue' and shadows the // prototype version of these methods with one that represents // the bound state. When the property is not found, the methods // become no-ops. - - class PropertyBinding { constructor(rootNode, path, parsedPath) { this.path = path; this.parsedPath = parsedPath || PropertyBinding.parseTrackName(path); this.node = PropertyBinding.findNode(rootNode, this.parsedPath.nodeName) || rootNode; - this.rootNode = rootNode; // initial state of these methods that calls 'bind' + this.rootNode = rootNode; + // initial state of these methods that calls 'bind' this.getValue = this._getValue_unbound; this.setValue = this._setValue_unbound; } - static create(root, path, parsedPath) { if (!(root && root.isAnimationObjectGroup)) { return new PropertyBinding(root, path, parsedPath); @@ -32299,6 +28899,7 @@ return new PropertyBinding.Composite(root, path, parsedPath); } } + /** * Replaces spaces with underscores and removes unsupported characters from * node names, to ensure compatibility with parseTrackName(). @@ -32306,19 +28907,14 @@ * @param {string} name Node name to be sanitized. * @return {string} */ - - static sanitizeNodeName(name) { return name.replace(/\s/g, '_').replace(_reservedRe, ''); } - static parseTrackName(trackName) { const matches = _trackRe.exec(trackName); - if (!matches) { throw new Error('PropertyBinding: Cannot parse trackName: ' + trackName); } - const results = { // directoryName: matches[ 1 ], // (tschw) currently unused nodeName: matches[2], @@ -32329,295 +28925,263 @@ propertyIndex: matches[6] }; const lastDot = results.nodeName && results.nodeName.lastIndexOf('.'); - if (lastDot !== undefined && lastDot !== -1) { - const objectName = results.nodeName.substring(lastDot + 1); // Object names must be checked against an allowlist. Otherwise, there + const objectName = results.nodeName.substring(lastDot + 1); + + // Object names must be checked against an allowlist. Otherwise, there // is no way to parse 'foo.bar.baz': 'baz' must be a property, but // 'bar' could be the objectName, or part of a nodeName (which can // include '.' characters). - if (_supportedObjectNames.indexOf(objectName) !== -1) { results.nodeName = results.nodeName.substring(0, lastDot); results.objectName = objectName; } } - if (results.propertyName === null || results.propertyName.length === 0) { throw new Error('PropertyBinding: can not parse propertyName from trackName: ' + trackName); } - return results; } - static findNode(root, nodeName) { if (!nodeName || nodeName === '' || nodeName === '.' || nodeName === -1 || nodeName === root.name || nodeName === root.uuid || nodeName === root.uniqueName) { return root; - } // search into skeleton bones. - + } + // search into skeleton bones. if (root.skeleton) { const bone = root.skeleton.getBoneByName(nodeName); - if (bone !== undefined) { return bone; } - } // search into node subtree. - + } + // search into node subtree. if (root.children) { const searchNodeSubtree = function (children) { for (let i = 0; i < children.length; i++) { const childNode = children[i]; - if (childNode.name === nodeName || childNode.uuid === nodeName || childNode.uniqueName === nodeName) { return childNode; } - const result = searchNodeSubtree(childNode.children); if (result) return result; } - return null; }; - const subTreeNode = searchNodeSubtree(root.children); - if (subTreeNode) { return subTreeNode; } } - return null; - } // these are used to "bind" a nonexistent property - + } + // these are used to "bind" a nonexistent property _getValue_unavailable() {} + _setValue_unavailable() {} - _setValue_unavailable() {} // Getters - + // Getters _getValue_direct(buffer, offset) { buffer[offset] = this.targetObject[this.propertyName]; } - _getValue_array(buffer, offset) { const source = this.resolvedProperty; - for (let i = 0, n = source.length; i !== n; ++i) { buffer[offset++] = source[i]; } } - _getValue_arrayElement(buffer, offset) { buffer[offset] = this.resolvedProperty[this.propertyIndex]; } - _getValue_toArray(buffer, offset) { this.resolvedProperty.toArray(buffer, offset); - } // Direct + } + // Direct _setValue_direct(buffer, offset) { this.targetObject[this.propertyName] = buffer[offset]; } - _setValue_direct_setNeedsUpdate(buffer, offset) { this.targetObject[this.propertyName] = buffer[offset]; this.targetObject.needsUpdate = true; } - _setValue_direct_setMatrixWorldNeedsUpdate(buffer, offset) { this.targetObject[this.propertyName] = buffer[offset]; this.targetObject.matrixWorldNeedsUpdate = true; - } // EntireArray + } + // EntireArray _setValue_array(buffer, offset) { const dest = this.resolvedProperty; - for (let i = 0, n = dest.length; i !== n; ++i) { dest[i] = buffer[offset++]; } } - _setValue_array_setNeedsUpdate(buffer, offset) { const dest = this.resolvedProperty; - for (let i = 0, n = dest.length; i !== n; ++i) { dest[i] = buffer[offset++]; } - this.targetObject.needsUpdate = true; } - _setValue_array_setMatrixWorldNeedsUpdate(buffer, offset) { const dest = this.resolvedProperty; - for (let i = 0, n = dest.length; i !== n; ++i) { dest[i] = buffer[offset++]; } - this.targetObject.matrixWorldNeedsUpdate = true; - } // ArrayElement + } + // ArrayElement _setValue_arrayElement(buffer, offset) { this.resolvedProperty[this.propertyIndex] = buffer[offset]; } - _setValue_arrayElement_setNeedsUpdate(buffer, offset) { this.resolvedProperty[this.propertyIndex] = buffer[offset]; this.targetObject.needsUpdate = true; } - _setValue_arrayElement_setMatrixWorldNeedsUpdate(buffer, offset) { this.resolvedProperty[this.propertyIndex] = buffer[offset]; this.targetObject.matrixWorldNeedsUpdate = true; - } // HasToFromArray + } + // HasToFromArray _setValue_fromArray(buffer, offset) { this.resolvedProperty.fromArray(buffer, offset); } - _setValue_fromArray_setNeedsUpdate(buffer, offset) { this.resolvedProperty.fromArray(buffer, offset); this.targetObject.needsUpdate = true; } - _setValue_fromArray_setMatrixWorldNeedsUpdate(buffer, offset) { this.resolvedProperty.fromArray(buffer, offset); this.targetObject.matrixWorldNeedsUpdate = true; } - _getValue_unbound(targetArray, offset) { this.bind(); this.getValue(targetArray, offset); } - _setValue_unbound(sourceArray, offset) { this.bind(); this.setValue(sourceArray, offset); - } // create getter / setter pair for a property in the scene graph - + } + // create getter / setter pair for a property in the scene graph bind() { let targetObject = this.node; const parsedPath = this.parsedPath; const objectName = parsedPath.objectName; const propertyName = parsedPath.propertyName; let propertyIndex = parsedPath.propertyIndex; - if (!targetObject) { targetObject = PropertyBinding.findNode(this.rootNode, parsedPath.nodeName) || this.rootNode; this.node = targetObject; - } // set fail state so we can just 'return' on error - + } + // set fail state so we can just 'return' on error this.getValue = this._getValue_unavailable; - this.setValue = this._setValue_unavailable; // ensure there is a value node + this.setValue = this._setValue_unavailable; + // ensure there is a value node if (!targetObject) { console.error('THREE.PropertyBinding: Trying to update node for track: ' + this.path + ' but it wasn\'t found.'); return; } - if (objectName) { - let objectIndex = parsedPath.objectIndex; // special cases were we need to reach deeper into the hierarchy to get the face materials.... + let objectIndex = parsedPath.objectIndex; + // special cases were we need to reach deeper into the hierarchy to get the face materials.... switch (objectName) { case 'materials': if (!targetObject.material) { console.error('THREE.PropertyBinding: Can not bind to material as node does not have a material.', this); return; } - if (!targetObject.material.materials) { console.error('THREE.PropertyBinding: Can not bind to material.materials as node.material does not have a materials array.', this); return; } - targetObject = targetObject.material.materials; break; - case 'bones': if (!targetObject.skeleton) { console.error('THREE.PropertyBinding: Can not bind to bones as node does not have a skeleton.', this); return; - } // potential future optimization: skip this if propertyIndex is already an integer - // and convert the integer string to a true integer. + } + // potential future optimization: skip this if propertyIndex is already an integer + // and convert the integer string to a true integer. - targetObject = targetObject.skeleton.bones; // support resolving morphTarget names into indices. + targetObject = targetObject.skeleton.bones; + // support resolving morphTarget names into indices. for (let i = 0; i < targetObject.length; i++) { if (targetObject[i].name === objectIndex) { objectIndex = i; break; } } - break; - default: if (targetObject[objectName] === undefined) { console.error('THREE.PropertyBinding: Can not bind to objectName of node undefined.', this); return; } - targetObject = targetObject[objectName]; } - if (objectIndex !== undefined) { if (targetObject[objectIndex] === undefined) { console.error('THREE.PropertyBinding: Trying to bind to objectIndex of objectName, but is undefined.', this, targetObject); return; } - targetObject = targetObject[objectIndex]; } - } // resolve property - + } + // resolve property const nodeProperty = targetObject[propertyName]; - if (nodeProperty === undefined) { const nodeName = parsedPath.nodeName; console.error('THREE.PropertyBinding: Trying to update property for track: ' + nodeName + '.' + propertyName + ' but it wasn\'t found.', targetObject); return; - } // determine versioning scheme - + } + // determine versioning scheme let versioning = this.Versioning.None; this.targetObject = targetObject; - if (targetObject.needsUpdate !== undefined) { // material + versioning = this.Versioning.NeedsUpdate; } else if (targetObject.matrixWorldNeedsUpdate !== undefined) { // node transform - versioning = this.Versioning.MatrixWorldNeedsUpdate; - } // determine how the property gets bound + versioning = this.Versioning.MatrixWorldNeedsUpdate; + } + // determine how the property gets bound let bindingType = this.BindingType.Direct; - if (propertyIndex !== undefined) { // access a sub element of the property array (only primitives are supported right now) + if (propertyName === 'morphTargetInfluences') { // potential optimization, skip this if propertyIndex is already an integer, and convert the integer string to a true integer. + // support resolving morphTarget names into indices. if (!targetObject.geometry) { console.error('THREE.PropertyBinding: Can not bind to morphTargetInfluences because node does not have a geometry.', this); return; } - if (targetObject.geometry.isBufferGeometry) { if (!targetObject.geometry.morphAttributes) { console.error('THREE.PropertyBinding: Can not bind to morphTargetInfluences because node does not have a geometry.morphAttributes.', this); return; } - if (targetObject.morphTargetDictionary[propertyIndex] !== undefined) { propertyIndex = targetObject.morphTargetDictionary[propertyIndex]; } @@ -32626,12 +29190,12 @@ return; } } - bindingType = this.BindingType.ArrayElement; this.resolvedProperty = nodeProperty; this.propertyIndex = propertyIndex; } else if (nodeProperty.fromArray !== undefined && nodeProperty.toArray !== undefined) { // must use copy for Object3D.Euler/Quaternion + bindingType = this.BindingType.HasFromToArray; this.resolvedProperty = nodeProperty; } else if (Array.isArray(nodeProperty)) { @@ -32639,23 +29203,21 @@ this.resolvedProperty = nodeProperty; } else { this.propertyName = propertyName; - } // select getter / setter - + } + // select getter / setter this.getValue = this.GetterByBindingType[bindingType]; this.setValue = this.SetterByBindingTypeAndVersioning[bindingType][versioning]; } - unbind() { - this.node = null; // back to the prototype version of getValue / setValue - // note: avoiding to mutate the shape of 'this' via 'delete' + this.node = null; + // back to the prototype version of getValue / setValue + // note: avoiding to mutate the shape of 'this' via 'delete' this.getValue = this._getValue_unbound; this.setValue = this._setValue_unbound; } - } - PropertyBinding.Composite = Composite; PropertyBinding.prototype.BindingType = { Direct: 0, @@ -32669,10 +29231,15 @@ MatrixWorldNeedsUpdate: 2 }; PropertyBinding.prototype.GetterByBindingType = [PropertyBinding.prototype._getValue_direct, PropertyBinding.prototype._getValue_array, PropertyBinding.prototype._getValue_arrayElement, PropertyBinding.prototype._getValue_toArray]; - PropertyBinding.prototype.SetterByBindingTypeAndVersioning = [[// Direct - PropertyBinding.prototype._setValue_direct, PropertyBinding.prototype._setValue_direct_setNeedsUpdate, PropertyBinding.prototype._setValue_direct_setMatrixWorldNeedsUpdate], [// EntireArray - PropertyBinding.prototype._setValue_array, PropertyBinding.prototype._setValue_array_setNeedsUpdate, PropertyBinding.prototype._setValue_array_setMatrixWorldNeedsUpdate], [// ArrayElement - PropertyBinding.prototype._setValue_arrayElement, PropertyBinding.prototype._setValue_arrayElement_setNeedsUpdate, PropertyBinding.prototype._setValue_arrayElement_setMatrixWorldNeedsUpdate], [// HasToFromArray + PropertyBinding.prototype.SetterByBindingTypeAndVersioning = [[ + // Direct + PropertyBinding.prototype._setValue_direct, PropertyBinding.prototype._setValue_direct_setNeedsUpdate, PropertyBinding.prototype._setValue_direct_setMatrixWorldNeedsUpdate], [ + // EntireArray + + PropertyBinding.prototype._setValue_array, PropertyBinding.prototype._setValue_array_setNeedsUpdate, PropertyBinding.prototype._setValue_array_setMatrixWorldNeedsUpdate], [ + // ArrayElement + PropertyBinding.prototype._setValue_arrayElement, PropertyBinding.prototype._setValue_arrayElement_setNeedsUpdate, PropertyBinding.prototype._setValue_arrayElement_setMatrixWorldNeedsUpdate], [ + // HasToFromArray PropertyBinding.prototype._setValue_fromArray, PropertyBinding.prototype._setValue_fromArray_setNeedsUpdate, PropertyBinding.prototype._setValue_fromArray_setMatrixWorldNeedsUpdate]]; /** @@ -32706,8 +29273,9 @@ class AnimationObjectGroup { constructor() { - this.uuid = generateUUID(); // cached objects followed by the active ones + this.uuid = generateUUID(); + // cached objects followed by the active ones this._objects = Array.prototype.slice.call(arguments); this.nCachedObjects_ = 0; // threshold // note: read by PropertyBinding.Composite @@ -32718,13 +29286,9 @@ for (let i = 0, n = arguments.length; i !== n; ++i) { indices[arguments[i].uuid] = i; } - this._paths = []; // inside: string - this._parsedPaths = []; // inside: { we don't care, here } - this._bindings = []; // inside: Array< PropertyBinding > - this._bindingsIndicesByPath = {}; // inside: indices in these arrays const scope = this; @@ -32733,165 +29297,164 @@ get total() { return scope._objects.length; }, - get inUse() { return this.total - scope.nCachedObjects_; } - }, - get bindingsPerObject() { return scope._bindings.length; } - }; } - add() { const objects = this._objects, - indicesByUUID = this._indicesByUUID, - paths = this._paths, - parsedPaths = this._parsedPaths, - bindings = this._bindings, - nBindings = bindings.length; + indicesByUUID = this._indicesByUUID, + paths = this._paths, + parsedPaths = this._parsedPaths, + bindings = this._bindings, + nBindings = bindings.length; let knownObject = undefined, - nObjects = objects.length, - nCachedObjects = this.nCachedObjects_; - + nObjects = objects.length, + nCachedObjects = this.nCachedObjects_; for (let i = 0, n = arguments.length; i !== n; ++i) { const object = arguments[i], - uuid = object.uuid; + uuid = object.uuid; let index = indicesByUUID[uuid]; - if (index === undefined) { // unknown object -> add it to the ACTIVE region + index = nObjects++; indicesByUUID[uuid] = index; - objects.push(object); // accounting is done, now do the same for all bindings + objects.push(object); + + // accounting is done, now do the same for all bindings for (let j = 0, m = nBindings; j !== m; ++j) { bindings[j].push(new PropertyBinding(object, paths[j], parsedPaths[j])); } } else if (index < nCachedObjects) { - knownObject = objects[index]; // move existing object to the ACTIVE region + knownObject = objects[index]; + + // move existing object to the ACTIVE region const firstActiveIndex = --nCachedObjects, - lastCachedObject = objects[firstActiveIndex]; + lastCachedObject = objects[firstActiveIndex]; indicesByUUID[lastCachedObject.uuid] = index; objects[index] = lastCachedObject; indicesByUUID[uuid] = firstActiveIndex; - objects[firstActiveIndex] = object; // accounting is done, now do the same for all bindings + objects[firstActiveIndex] = object; + + // accounting is done, now do the same for all bindings for (let j = 0, m = nBindings; j !== m; ++j) { const bindingsForPath = bindings[j], - lastCached = bindingsForPath[firstActiveIndex]; + lastCached = bindingsForPath[firstActiveIndex]; let binding = bindingsForPath[index]; bindingsForPath[index] = lastCached; - if (binding === undefined) { // since we do not bother to create new bindings // for objects that are cached, the binding may // or may not exist + binding = new PropertyBinding(object, paths[j], parsedPaths[j]); } - bindingsForPath[firstActiveIndex] = binding; } } else if (objects[index] !== knownObject) { console.error('THREE.AnimationObjectGroup: Different objects with the same UUID ' + 'detected. Clean the caches or recreate your infrastructure when reloading scenes.'); } // else the object is already where we want it to be - } // for arguments - this.nCachedObjects_ = nCachedObjects; } - remove() { const objects = this._objects, - indicesByUUID = this._indicesByUUID, - bindings = this._bindings, - nBindings = bindings.length; + indicesByUUID = this._indicesByUUID, + bindings = this._bindings, + nBindings = bindings.length; let nCachedObjects = this.nCachedObjects_; - for (let i = 0, n = arguments.length; i !== n; ++i) { const object = arguments[i], - uuid = object.uuid, - index = indicesByUUID[uuid]; - + uuid = object.uuid, + index = indicesByUUID[uuid]; if (index !== undefined && index >= nCachedObjects) { // move existing object into the CACHED region + const lastCachedIndex = nCachedObjects++, - firstActiveObject = objects[lastCachedIndex]; + firstActiveObject = objects[lastCachedIndex]; indicesByUUID[firstActiveObject.uuid] = index; objects[index] = firstActiveObject; indicesByUUID[uuid] = lastCachedIndex; - objects[lastCachedIndex] = object; // accounting is done, now do the same for all bindings + objects[lastCachedIndex] = object; + + // accounting is done, now do the same for all bindings for (let j = 0, m = nBindings; j !== m; ++j) { const bindingsForPath = bindings[j], - firstActive = bindingsForPath[lastCachedIndex], - binding = bindingsForPath[index]; + firstActive = bindingsForPath[lastCachedIndex], + binding = bindingsForPath[index]; bindingsForPath[index] = firstActive; bindingsForPath[lastCachedIndex] = binding; } } } // for arguments - this.nCachedObjects_ = nCachedObjects; - } // remove & forget - + } + // remove & forget uncache() { const objects = this._objects, - indicesByUUID = this._indicesByUUID, - bindings = this._bindings, - nBindings = bindings.length; + indicesByUUID = this._indicesByUUID, + bindings = this._bindings, + nBindings = bindings.length; let nCachedObjects = this.nCachedObjects_, - nObjects = objects.length; - + nObjects = objects.length; for (let i = 0, n = arguments.length; i !== n; ++i) { const object = arguments[i], - uuid = object.uuid, - index = indicesByUUID[uuid]; - + uuid = object.uuid, + index = indicesByUUID[uuid]; if (index !== undefined) { delete indicesByUUID[uuid]; - if (index < nCachedObjects) { // object is cached, shrink the CACHED region + const firstActiveIndex = --nCachedObjects, - lastCachedObject = objects[firstActiveIndex], - lastIndex = --nObjects, - lastObject = objects[lastIndex]; // last cached object takes this object's place + lastCachedObject = objects[firstActiveIndex], + lastIndex = --nObjects, + lastObject = objects[lastIndex]; + // last cached object takes this object's place indicesByUUID[lastCachedObject.uuid] = index; - objects[index] = lastCachedObject; // last object goes to the activated slot and pop + objects[index] = lastCachedObject; + // last object goes to the activated slot and pop indicesByUUID[lastObject.uuid] = firstActiveIndex; objects[firstActiveIndex] = lastObject; - objects.pop(); // accounting is done, now do the same for all bindings + objects.pop(); + + // accounting is done, now do the same for all bindings for (let j = 0, m = nBindings; j !== m; ++j) { const bindingsForPath = bindings[j], - lastCached = bindingsForPath[firstActiveIndex], - last = bindingsForPath[lastIndex]; + lastCached = bindingsForPath[firstActiveIndex], + last = bindingsForPath[lastIndex]; bindingsForPath[index] = lastCached; bindingsForPath[firstActiveIndex] = last; bindingsForPath.pop(); } } else { // object is active, just swap with the last and pop - const lastIndex = --nObjects, - lastObject = objects[lastIndex]; + const lastIndex = --nObjects, + lastObject = objects[lastIndex]; if (lastIndex > 0) { indicesByUUID[lastObject.uuid] = index; } - objects[index] = lastObject; - objects.pop(); // accounting is done, now do the same for all bindings + objects.pop(); + + // accounting is done, now do the same for all bindings for (let j = 0, m = nBindings; j !== m; ++j) { const bindingsForPath = bindings[j]; @@ -32899,56 +29462,52 @@ bindingsForPath.pop(); } } // cached or active - } // if object is known - } // for arguments - this.nCachedObjects_ = nCachedObjects; - } // Internal interface used by befriended PropertyBinding.Composite: + } + // Internal interface used by befriended PropertyBinding.Composite: subscribe_(path, parsedPath) { // returns an array of bindings for the given path that is changed // according to the contained objects in the group + const indicesByPath = this._bindingsIndicesByPath; let index = indicesByPath[path]; const bindings = this._bindings; if (index !== undefined) return bindings[index]; const paths = this._paths, - parsedPaths = this._parsedPaths, - objects = this._objects, - nObjects = objects.length, - nCachedObjects = this.nCachedObjects_, - bindingsForPath = new Array(nObjects); + parsedPaths = this._parsedPaths, + objects = this._objects, + nObjects = objects.length, + nCachedObjects = this.nCachedObjects_, + bindingsForPath = new Array(nObjects); index = bindings.length; indicesByPath[path] = index; paths.push(path); parsedPaths.push(parsedPath); bindings.push(bindingsForPath); - for (let i = nCachedObjects, n = objects.length; i !== n; ++i) { const object = objects[i]; bindingsForPath[i] = new PropertyBinding(object, path, parsedPath); } - return bindingsForPath; } - unsubscribe_(path) { // tells the group to forget about a property path and no longer // update the array previously obtained with 'subscribe_' - const indicesByPath = this._bindingsIndicesByPath, - index = indicesByPath[path]; + const indicesByPath = this._bindingsIndicesByPath, + index = indicesByPath[path]; if (index !== undefined) { const paths = this._paths, - parsedPaths = this._parsedPaths, - bindings = this._bindings, - lastBindingsIndex = bindings.length - 1, - lastBindings = bindings[lastBindingsIndex], - lastBindingsPath = path[lastBindingsIndex]; + parsedPaths = this._parsedPaths, + bindings = this._bindings, + lastBindingsIndex = bindings.length - 1, + lastBindings = bindings[lastBindingsIndex], + lastBindingsPath = path[lastBindingsIndex]; indicesByPath[lastBindingsPath] = index; bindings[index] = lastBindings; bindings.pop(); @@ -32958,9 +29517,7 @@ paths.pop(); } } - } - AnimationObjectGroup.prototype.isAnimationObjectGroup = true; class AnimationAction { @@ -32970,37 +29527,36 @@ this._localRoot = localRoot; this.blendMode = blendMode; const tracks = clip.tracks, - nTracks = tracks.length, - interpolants = new Array(nTracks); + nTracks = tracks.length, + interpolants = new Array(nTracks); const interpolantSettings = { endingStart: ZeroCurvatureEnding, endingEnd: ZeroCurvatureEnding }; - for (let i = 0; i !== nTracks; ++i) { const interpolant = tracks[i].createInterpolant(null); interpolants[i] = interpolant; interpolant.settings = interpolantSettings; } - this._interpolantSettings = interpolantSettings; this._interpolants = interpolants; // bound by the mixer - // inside: PropertyMixer (managed by the mixer) + // inside: PropertyMixer (managed by the mixer) this._propertyBindings = new Array(nTracks); this._cacheIndex = null; // for the memory manager - this._byClipCacheIndex = null; // for the memory manager this._timeScaleInterpolant = null; this._weightInterpolant = null; this.loop = LoopRepeat; - this._loopCount = -1; // global mixer time when the action is to be started + this._loopCount = -1; + + // global mixer time when the action is to be started // it's set back to 'null' upon start of the action + this._startTime = null; - this._startTime = null; // scaled local time of the action + // scaled local time of the action // gets clamped or wrapped to 0..clip.duration according to loop - this.time = 0; this.timeScale = 1; this._effectiveTimeScale = 1; @@ -33009,265 +29565,228 @@ this.repetitions = Infinity; // no. of repetitions when looping this.paused = false; // true -> zero effective time scale - this.enabled = true; // false -> zero effective weight this.clampWhenFinished = false; // keep feeding the last frame? this.zeroSlopeAtStart = true; // for smooth interpolation w/o separate - this.zeroSlopeAtEnd = true; // clips for start, loop and end - } // State & Scheduling + } + // State & Scheduling play() { this._mixer._activateAction(this); - return this; } - stop() { this._mixer._deactivateAction(this); - return this.reset(); } - reset() { this.paused = false; this.enabled = true; this.time = 0; // restart clip - this._loopCount = -1; // forget previous loops - this._startTime = null; // forget scheduling return this.stopFading().stopWarping(); } - isRunning() { return this.enabled && !this.paused && this.timeScale !== 0 && this._startTime === null && this._mixer._isActiveAction(this); - } // return true when play has been called - + } + // return true when play has been called isScheduled() { return this._mixer._isActiveAction(this); } - startAt(time) { this._startTime = time; return this; } - setLoop(mode, repetitions) { this.loop = mode; this.repetitions = repetitions; return this; - } // Weight + } + + // Weight + // set the weight stopping any scheduled fading // although .enabled = false yields an effective weight of zero, this // method does *not* change .enabled, because it would be confusing - - setEffectiveWeight(weight) { - this.weight = weight; // note: same logic as when updated at runtime + this.weight = weight; + // note: same logic as when updated at runtime this._effectiveWeight = this.enabled ? weight : 0; return this.stopFading(); - } // return the weight considering fading and .enabled - + } + // return the weight considering fading and .enabled getEffectiveWeight() { return this._effectiveWeight; } - fadeIn(duration) { return this._scheduleFading(duration, 0, 1); } - fadeOut(duration) { return this._scheduleFading(duration, 1, 0); } - crossFadeFrom(fadeOutAction, duration, warp) { fadeOutAction.fadeOut(duration); this.fadeIn(duration); - if (warp) { const fadeInDuration = this._clip.duration, - fadeOutDuration = fadeOutAction._clip.duration, - startEndRatio = fadeOutDuration / fadeInDuration, - endStartRatio = fadeInDuration / fadeOutDuration; + fadeOutDuration = fadeOutAction._clip.duration, + startEndRatio = fadeOutDuration / fadeInDuration, + endStartRatio = fadeInDuration / fadeOutDuration; fadeOutAction.warp(1.0, startEndRatio, duration); this.warp(endStartRatio, 1.0, duration); } - return this; } - crossFadeTo(fadeInAction, duration, warp) { return fadeInAction.crossFadeFrom(this, duration, warp); } - stopFading() { const weightInterpolant = this._weightInterpolant; - if (weightInterpolant !== null) { this._weightInterpolant = null; - this._mixer._takeBackControlInterpolant(weightInterpolant); } - return this; - } // Time Scale Control + } + + // Time Scale Control + // set the time scale stopping any scheduled warping // although .paused = true yields an effective time scale of zero, this // method does *not* change .paused, because it would be confusing - - setEffectiveTimeScale(timeScale) { this.timeScale = timeScale; this._effectiveTimeScale = this.paused ? 0 : timeScale; return this.stopWarping(); - } // return the time scale considering warping and .paused - + } + // return the time scale considering warping and .paused getEffectiveTimeScale() { return this._effectiveTimeScale; } - setDuration(duration) { this.timeScale = this._clip.duration / duration; return this.stopWarping(); } - syncWith(action) { this.time = action.time; this.timeScale = action.timeScale; return this.stopWarping(); } - halt(duration) { return this.warp(this._effectiveTimeScale, 0, duration); } - warp(startTimeScale, endTimeScale, duration) { const mixer = this._mixer, - now = mixer.time, - timeScale = this.timeScale; + now = mixer.time, + timeScale = this.timeScale; let interpolant = this._timeScaleInterpolant; - if (interpolant === null) { interpolant = mixer._lendControlInterpolant(); this._timeScaleInterpolant = interpolant; } - const times = interpolant.parameterPositions, - values = interpolant.sampleValues; + values = interpolant.sampleValues; times[0] = now; times[1] = now + duration; values[0] = startTimeScale / timeScale; values[1] = endTimeScale / timeScale; return this; } - stopWarping() { const timeScaleInterpolant = this._timeScaleInterpolant; - if (timeScaleInterpolant !== null) { this._timeScaleInterpolant = null; - this._mixer._takeBackControlInterpolant(timeScaleInterpolant); } - return this; - } // Object Accessors + } + // Object Accessors getMixer() { return this._mixer; } - getClip() { return this._clip; } - getRoot() { return this._localRoot || this._mixer._root; - } // Interna + } + // Interna _update(time, deltaTime, timeDirection, accuIndex) { // called by the mixer + if (!this.enabled) { // call ._updateWeight() to update ._effectiveWeight - this._updateWeight(time); + this._updateWeight(time); return; } - const startTime = this._startTime; - if (startTime !== null) { // check for scheduled start of action - const timeRunning = (time - startTime) * timeDirection; + const timeRunning = (time - startTime) * timeDirection; if (timeRunning < 0 || timeDirection === 0) { return; // yet to come / don't decide when delta = 0 - } // start + } + // start this._startTime = null; // unschedule - deltaTime = timeDirection * timeRunning; - } // apply time scale and advance time + } + // apply time scale and advance time deltaTime *= this._updateTimeScale(time); + const clipTime = this._updateTime(deltaTime); - const clipTime = this._updateTime(deltaTime); // note: _updateTime may disable the action resulting in + // note: _updateTime may disable the action resulting in // an effective weight of 0 - const weight = this._updateWeight(time); - if (weight > 0) { const interpolants = this._interpolants; const propertyMixers = this._propertyBindings; - switch (this.blendMode) { case AdditiveAnimationBlendMode: for (let j = 0, m = interpolants.length; j !== m; ++j) { interpolants[j].evaluate(clipTime); propertyMixers[j].accumulateAdditive(weight); } - break; - case NormalAnimationBlendMode: default: for (let j = 0, m = interpolants.length; j !== m; ++j) { interpolants[j].evaluate(clipTime); propertyMixers[j].accumulate(accuIndex, weight); } - } } } - _updateWeight(time) { let weight = 0; - if (this.enabled) { weight = this.weight; const interpolant = this._weightInterpolant; - if (interpolant !== null) { const interpolantValue = interpolant.evaluate(time)[0]; weight *= interpolantValue; - if (time > interpolant.parameterPositions[1]) { this.stopFading(); - if (interpolantValue === 0) { // faded out, disable this.enabled = false; @@ -33275,25 +29794,19 @@ } } } - this._effectiveWeight = weight; return weight; } - _updateTimeScale(time) { let timeScale = 0; - if (!this.paused) { timeScale = this.timeScale; const interpolant = this._timeScaleInterpolant; - if (interpolant !== null) { const interpolantValue = interpolant.evaluate(time)[0]; timeScale *= interpolantValue; - if (time > interpolant.parameterPositions[1]) { this.stopWarping(); - if (timeScale === 0) { // motion has halted, pause this.paused = true; @@ -33304,31 +29817,26 @@ } } } - this._effectiveTimeScale = timeScale; return timeScale; } - _updateTime(deltaTime) { const duration = this._clip.duration; const loop = this.loop; let time = this.time + deltaTime; let loopCount = this._loopCount; const pingPong = loop === LoopPingPong; - if (deltaTime === 0) { if (loopCount === -1) return time; return pingPong && (loopCount & 1) === 1 ? duration - time : time; } - if (loop === LoopOnce) { if (loopCount === -1) { // just started - this._loopCount = 0; + this._loopCount = 0; this._setEndings(true, true, false); } - handle_stop: { if (time >= duration) { time = duration; @@ -33338,10 +29846,8 @@ this.time = time; break handle_stop; } - if (this.clampWhenFinished) this.paused = true;else this.enabled = false; this.time = time; - this._mixer.dispatchEvent({ type: 'finished', action: this, @@ -33350,34 +29856,34 @@ } } else { // repetitive Repeat or PingPong + if (loopCount === -1) { // just started + if (deltaTime >= 0) { loopCount = 0; - this._setEndings(true, this.repetitions === 0, pingPong); } else { // when looping in reverse direction, the initial // transition through zero counts as a repetition, // so leave loopCount at -1 + this._setEndings(this.repetitions === 0, true, pingPong); } } - if (time >= duration || time < 0) { // wrap around - const loopDelta = Math.floor(time / duration); // signed + const loopDelta = Math.floor(time / duration); // signed time -= duration * loopDelta; loopCount += Math.abs(loopDelta); const pending = this.repetitions - loopCount; - if (pending <= 0) { // have to stop (switch state, clamp time, fire event) + if (this.clampWhenFinished) this.paused = true;else this.enabled = false; time = deltaTime > 0 ? duration : 0; this.time = time; - this._mixer.dispatchEvent({ type: 'finished', action: this, @@ -33385,18 +29891,17 @@ }); } else { // keep running + if (pending === 1) { // entering the last round - const atStart = deltaTime < 0; + const atStart = deltaTime < 0; this._setEndings(atStart, !atStart, pingPong); } else { this._setEndings(false, false, pingPong); } - this._loopCount = loopCount; this.time = time; - this._mixer.dispatchEvent({ type: 'loop', action: this, @@ -33406,30 +29911,27 @@ } else { this.time = time; } - if (pingPong && (loopCount & 1) === 1) { // invert time for the "pong round" + return duration - time; } } - return time; } - _setEndings(atStart, atEnd, pingPong) { const settings = this._interpolantSettings; - if (pingPong) { settings.endingStart = ZeroSlopeEnding; settings.endingEnd = ZeroSlopeEnding; } else { // assuming for LoopOnce atStart == atEnd == true + if (atStart) { settings.endingStart = this.zeroSlopeAtStart ? ZeroSlopeEnding : ZeroCurvatureEnding; } else { settings.endingStart = WrapAroundEnding; } - if (atEnd) { settings.endingEnd = this.zeroSlopeAtEnd ? ZeroSlopeEnding : ZeroCurvatureEnding; } else { @@ -33437,156 +29939,131 @@ } } } - _scheduleFading(duration, weightNow, weightThen) { const mixer = this._mixer, - now = mixer.time; + now = mixer.time; let interpolant = this._weightInterpolant; - if (interpolant === null) { interpolant = mixer._lendControlInterpolant(); this._weightInterpolant = interpolant; } - const times = interpolant.parameterPositions, - values = interpolant.sampleValues; + values = interpolant.sampleValues; times[0] = now; values[0] = weightNow; times[1] = now + duration; values[1] = weightThen; return this; } - } class AnimationMixer extends EventDispatcher { constructor(root) { super(); this._root = root; - this._initMemoryManager(); - this._accuIndex = 0; this.time = 0; this.timeScale = 1.0; } - _bindAction(action, prototypeAction) { const root = action._localRoot || this._root, - tracks = action._clip.tracks, - nTracks = tracks.length, - bindings = action._propertyBindings, - interpolants = action._interpolants, - rootUuid = root.uuid, - bindingsByRoot = this._bindingsByRootAndName; + tracks = action._clip.tracks, + nTracks = tracks.length, + bindings = action._propertyBindings, + interpolants = action._interpolants, + rootUuid = root.uuid, + bindingsByRoot = this._bindingsByRootAndName; let bindingsByName = bindingsByRoot[rootUuid]; - if (bindingsByName === undefined) { bindingsByName = {}; bindingsByRoot[rootUuid] = bindingsByName; } - for (let i = 0; i !== nTracks; ++i) { const track = tracks[i], - trackName = track.name; + trackName = track.name; let binding = bindingsByName[trackName]; - if (binding !== undefined) { ++binding.referenceCount; bindings[i] = binding; } else { binding = bindings[i]; - if (binding !== undefined) { // existing binding, make sure the cache knows + if (binding._cacheIndex === null) { ++binding.referenceCount; - this._addInactiveBinding(binding, rootUuid, trackName); } - continue; } - const path = prototypeAction && prototypeAction._propertyBindings[i].binding.parsedPath; binding = new PropertyMixer(PropertyBinding.create(root, trackName, path), track.ValueTypeName, track.getValueSize()); ++binding.referenceCount; - this._addInactiveBinding(binding, rootUuid, trackName); - bindings[i] = binding; } - interpolants[i].resultBuffer = binding.buffer; } } - _activateAction(action) { if (!this._isActiveAction(action)) { if (action._cacheIndex === null) { // this action has been forgotten by the cache, but the user // appears to be still using it -> rebind - const rootUuid = (action._localRoot || this._root).uuid, - clipUuid = action._clip.uuid, - actionsForClip = this._actionsByClip[clipUuid]; + const rootUuid = (action._localRoot || this._root).uuid, + clipUuid = action._clip.uuid, + actionsForClip = this._actionsByClip[clipUuid]; this._bindAction(action, actionsForClip && actionsForClip.knownActions[0]); - this._addInactiveAction(action, clipUuid, rootUuid); } + const bindings = action._propertyBindings; - const bindings = action._propertyBindings; // increment reference counts / sort out state - + // increment reference counts / sort out state for (let i = 0, n = bindings.length; i !== n; ++i) { const binding = bindings[i]; - if (binding.useCount++ === 0) { this._lendBinding(binding); - binding.saveOriginalState(); } } - this._lendAction(action); } } - _deactivateAction(action) { if (this._isActiveAction(action)) { - const bindings = action._propertyBindings; // decrement reference counts / sort out state + const bindings = action._propertyBindings; + // decrement reference counts / sort out state for (let i = 0, n = bindings.length; i !== n; ++i) { const binding = bindings[i]; - if (--binding.useCount === 0) { binding.restoreOriginalState(); - this._takeBackBinding(binding); } } - this._takeBackAction(action); } - } // Memory manager + } + // Memory manager _initMemoryManager() { this._actions = []; // 'nActiveActions' followed by inactive ones - this._nActiveActions = 0; - this._actionsByClip = {}; // inside: + this._actionsByClip = {}; + // inside: // { // knownActions: Array< AnimationAction > - used as prototypes // actionByRoot: AnimationAction - lookup // } this._bindings = []; // 'nActiveBindings' followed by inactive ones - this._nActiveBindings = 0; this._bindingsByRootAndName = {}; // inside: Map< name, PropertyMixer > this._controlInterpolants = []; // same game as above - this._nActiveControlInterpolants = 0; const scope = this; this.stats = { @@ -33594,46 +30071,39 @@ get total() { return scope._actions.length; }, - get inUse() { return scope._nActiveActions; } - }, bindings: { get total() { return scope._bindings.length; }, - get inUse() { return scope._nActiveBindings; } - }, controlInterpolants: { get total() { return scope._controlInterpolants.length; }, - get inUse() { return scope._nActiveControlInterpolants; } - } }; - } // Memory management for AnimationAction objects + } + // Memory management for AnimationAction objects _isActiveAction(action) { const index = action._cacheIndex; return index !== null && index < this._nActiveActions; } - _addInactiveAction(action, clipUuid, rootUuid) { const actions = this._actions, - actionsByClip = this._actionsByClip; + actionsByClip = this._actionsByClip; let actionsForClip = actionsByClip[clipUuid]; - if (actionsForClip === undefined) { actionsForClip = { knownActions: [action], @@ -33646,179 +30116,164 @@ action._byClipCacheIndex = knownActions.length; knownActions.push(action); } - action._cacheIndex = actions.length; actions.push(action); actionsForClip.actionByRoot[rootUuid] = action; } - _removeInactiveAction(action) { const actions = this._actions, - lastInactiveAction = actions[actions.length - 1], - cacheIndex = action._cacheIndex; + lastInactiveAction = actions[actions.length - 1], + cacheIndex = action._cacheIndex; lastInactiveAction._cacheIndex = cacheIndex; actions[cacheIndex] = lastInactiveAction; actions.pop(); action._cacheIndex = null; const clipUuid = action._clip.uuid, - actionsByClip = this._actionsByClip, - actionsForClip = actionsByClip[clipUuid], - knownActionsForClip = actionsForClip.knownActions, - lastKnownAction = knownActionsForClip[knownActionsForClip.length - 1], - byClipCacheIndex = action._byClipCacheIndex; + actionsByClip = this._actionsByClip, + actionsForClip = actionsByClip[clipUuid], + knownActionsForClip = actionsForClip.knownActions, + lastKnownAction = knownActionsForClip[knownActionsForClip.length - 1], + byClipCacheIndex = action._byClipCacheIndex; lastKnownAction._byClipCacheIndex = byClipCacheIndex; knownActionsForClip[byClipCacheIndex] = lastKnownAction; knownActionsForClip.pop(); action._byClipCacheIndex = null; const actionByRoot = actionsForClip.actionByRoot, - rootUuid = (action._localRoot || this._root).uuid; + rootUuid = (action._localRoot || this._root).uuid; delete actionByRoot[rootUuid]; - if (knownActionsForClip.length === 0) { delete actionsByClip[clipUuid]; } - this._removeInactiveBindingsForAction(action); } - _removeInactiveBindingsForAction(action) { const bindings = action._propertyBindings; - for (let i = 0, n = bindings.length; i !== n; ++i) { const binding = bindings[i]; - if (--binding.referenceCount === 0) { this._removeInactiveBinding(binding); } } } - _lendAction(action) { // [ active actions | inactive actions ] // [ active actions >| inactive actions ] // s a // <-swap-> // a s + const actions = this._actions, - prevIndex = action._cacheIndex, - lastActiveIndex = this._nActiveActions++, - firstInactiveAction = actions[lastActiveIndex]; + prevIndex = action._cacheIndex, + lastActiveIndex = this._nActiveActions++, + firstInactiveAction = actions[lastActiveIndex]; action._cacheIndex = lastActiveIndex; actions[lastActiveIndex] = action; firstInactiveAction._cacheIndex = prevIndex; actions[prevIndex] = firstInactiveAction; } - _takeBackAction(action) { // [ active actions | inactive actions ] // [ active actions |< inactive actions ] // a s // <-swap-> // s a + const actions = this._actions, - prevIndex = action._cacheIndex, - firstInactiveIndex = --this._nActiveActions, - lastActiveAction = actions[firstInactiveIndex]; + prevIndex = action._cacheIndex, + firstInactiveIndex = --this._nActiveActions, + lastActiveAction = actions[firstInactiveIndex]; action._cacheIndex = firstInactiveIndex; actions[firstInactiveIndex] = action; lastActiveAction._cacheIndex = prevIndex; actions[prevIndex] = lastActiveAction; - } // Memory management for PropertyMixer objects + } + // Memory management for PropertyMixer objects _addInactiveBinding(binding, rootUuid, trackName) { const bindingsByRoot = this._bindingsByRootAndName, - bindings = this._bindings; + bindings = this._bindings; let bindingByName = bindingsByRoot[rootUuid]; - if (bindingByName === undefined) { bindingByName = {}; bindingsByRoot[rootUuid] = bindingByName; } - bindingByName[trackName] = binding; binding._cacheIndex = bindings.length; bindings.push(binding); } - _removeInactiveBinding(binding) { const bindings = this._bindings, - propBinding = binding.binding, - rootUuid = propBinding.rootNode.uuid, - trackName = propBinding.path, - bindingsByRoot = this._bindingsByRootAndName, - bindingByName = bindingsByRoot[rootUuid], - lastInactiveBinding = bindings[bindings.length - 1], - cacheIndex = binding._cacheIndex; + propBinding = binding.binding, + rootUuid = propBinding.rootNode.uuid, + trackName = propBinding.path, + bindingsByRoot = this._bindingsByRootAndName, + bindingByName = bindingsByRoot[rootUuid], + lastInactiveBinding = bindings[bindings.length - 1], + cacheIndex = binding._cacheIndex; lastInactiveBinding._cacheIndex = cacheIndex; bindings[cacheIndex] = lastInactiveBinding; bindings.pop(); delete bindingByName[trackName]; - if (Object.keys(bindingByName).length === 0) { delete bindingsByRoot[rootUuid]; } } - _lendBinding(binding) { const bindings = this._bindings, - prevIndex = binding._cacheIndex, - lastActiveIndex = this._nActiveBindings++, - firstInactiveBinding = bindings[lastActiveIndex]; + prevIndex = binding._cacheIndex, + lastActiveIndex = this._nActiveBindings++, + firstInactiveBinding = bindings[lastActiveIndex]; binding._cacheIndex = lastActiveIndex; bindings[lastActiveIndex] = binding; firstInactiveBinding._cacheIndex = prevIndex; bindings[prevIndex] = firstInactiveBinding; } - _takeBackBinding(binding) { const bindings = this._bindings, - prevIndex = binding._cacheIndex, - firstInactiveIndex = --this._nActiveBindings, - lastActiveBinding = bindings[firstInactiveIndex]; + prevIndex = binding._cacheIndex, + firstInactiveIndex = --this._nActiveBindings, + lastActiveBinding = bindings[firstInactiveIndex]; binding._cacheIndex = firstInactiveIndex; bindings[firstInactiveIndex] = binding; lastActiveBinding._cacheIndex = prevIndex; bindings[prevIndex] = lastActiveBinding; - } // Memory management of Interpolants for weight and time scale + } + // Memory management of Interpolants for weight and time scale _lendControlInterpolant() { const interpolants = this._controlInterpolants, - lastActiveIndex = this._nActiveControlInterpolants++; + lastActiveIndex = this._nActiveControlInterpolants++; let interpolant = interpolants[lastActiveIndex]; - if (interpolant === undefined) { interpolant = new LinearInterpolant(new Float32Array(2), new Float32Array(2), 1, this._controlInterpolantsResultBuffer); interpolant.__cacheIndex = lastActiveIndex; interpolants[lastActiveIndex] = interpolant; } - return interpolant; } - _takeBackControlInterpolant(interpolant) { const interpolants = this._controlInterpolants, - prevIndex = interpolant.__cacheIndex, - firstInactiveIndex = --this._nActiveControlInterpolants, - lastActiveInterpolant = interpolants[firstInactiveIndex]; + prevIndex = interpolant.__cacheIndex, + firstInactiveIndex = --this._nActiveControlInterpolants, + lastActiveInterpolant = interpolants[firstInactiveIndex]; interpolant.__cacheIndex = firstInactiveIndex; interpolants[firstInactiveIndex] = interpolant; lastActiveInterpolant.__cacheIndex = prevIndex; interpolants[prevIndex] = lastActiveInterpolant; - } // return an action for a clip optionally using a custom root target + } + + // return an action for a clip optionally using a custom root target // object (this method allocates a lot of dynamic memory in case a // previously unknown clip/root combination is specified) - - clipAction(clip, optionalRoot, blendMode) { const root = optionalRoot || this._root, - rootUuid = root.uuid; + rootUuid = root.uuid; let clipObject = typeof clip === 'string' ? AnimationClip.findByName(root, clip) : clip; const clipUuid = clipObject !== null ? clipObject.uuid : clip; const actionsForClip = this._actionsByClip[clipUuid]; let prototypeAction = null; - if (blendMode === undefined) { if (clipObject !== null) { blendMode = clipObject.blendMode; @@ -33826,178 +30281,155 @@ blendMode = NormalAnimationBlendMode; } } - if (actionsForClip !== undefined) { const existingAction = actionsForClip.actionByRoot[rootUuid]; - if (existingAction !== undefined && existingAction.blendMode === blendMode) { return existingAction; - } // we know the clip, so we don't have to parse all - // the bindings again but can just copy - + } - prototypeAction = actionsForClip.knownActions[0]; // also, take the clip from the prototype action + // we know the clip, so we don't have to parse all + // the bindings again but can just copy + prototypeAction = actionsForClip.knownActions[0]; + // also, take the clip from the prototype action if (clipObject === null) clipObject = prototypeAction._clip; - } // clip must be known when specified via string - + } - if (clipObject === null) return null; // allocate all resources required to run it + // clip must be known when specified via string + if (clipObject === null) return null; + // allocate all resources required to run it const newAction = new AnimationAction(this, clipObject, optionalRoot, blendMode); + this._bindAction(newAction, prototypeAction); - this._bindAction(newAction, prototypeAction); // and make the action known to the memory manager - - + // and make the action known to the memory manager this._addInactiveAction(newAction, clipUuid, rootUuid); - return newAction; - } // get an existing action - + } + // get an existing action existingAction(clip, optionalRoot) { const root = optionalRoot || this._root, - rootUuid = root.uuid, - clipObject = typeof clip === 'string' ? AnimationClip.findByName(root, clip) : clip, - clipUuid = clipObject ? clipObject.uuid : clip, - actionsForClip = this._actionsByClip[clipUuid]; - + rootUuid = root.uuid, + clipObject = typeof clip === 'string' ? AnimationClip.findByName(root, clip) : clip, + clipUuid = clipObject ? clipObject.uuid : clip, + actionsForClip = this._actionsByClip[clipUuid]; if (actionsForClip !== undefined) { return actionsForClip.actionByRoot[rootUuid] || null; } - return null; - } // deactivates all previously scheduled actions - + } + // deactivates all previously scheduled actions stopAllAction() { const actions = this._actions, - nActions = this._nActiveActions; - + nActions = this._nActiveActions; for (let i = nActions - 1; i >= 0; --i) { actions[i].stop(); } - return this; - } // advance the time and update apply the animation - + } + // advance the time and update apply the animation update(deltaTime) { deltaTime *= this.timeScale; const actions = this._actions, - nActions = this._nActiveActions, - time = this.time += deltaTime, - timeDirection = Math.sign(deltaTime), - accuIndex = this._accuIndex ^= 1; // run active actions + nActions = this._nActiveActions, + time = this.time += deltaTime, + timeDirection = Math.sign(deltaTime), + accuIndex = this._accuIndex ^= 1; + + // run active actions for (let i = 0; i !== nActions; ++i) { const action = actions[i]; - action._update(time, deltaTime, timeDirection, accuIndex); - } // update scene graph + } + // update scene graph const bindings = this._bindings, - nBindings = this._nActiveBindings; - + nBindings = this._nActiveBindings; for (let i = 0; i !== nBindings; ++i) { bindings[i].apply(accuIndex); } - return this; - } // Allows you to seek to a specific time in an animation. - + } + // Allows you to seek to a specific time in an animation. setTime(timeInSeconds) { this.time = 0; // Zero out time attribute for AnimationMixer object; - for (let i = 0; i < this._actions.length; i++) { this._actions[i].time = 0; // Zero out time attribute for all associated AnimationAction objects. } - return this.update(timeInSeconds); // Update used to set exact time. Returns "this" AnimationMixer object. - } // return this mixer's root target object - + } + // return this mixer's root target object getRoot() { return this._root; - } // free all resources specific to a particular clip - + } + // free all resources specific to a particular clip uncacheClip(clip) { const actions = this._actions, - clipUuid = clip.uuid, - actionsByClip = this._actionsByClip, - actionsForClip = actionsByClip[clipUuid]; - + clipUuid = clip.uuid, + actionsByClip = this._actionsByClip, + actionsForClip = actionsByClip[clipUuid]; if (actionsForClip !== undefined) { // note: just calling _removeInactiveAction would mess up the // iteration state and also require updating the state we can // just throw away - const actionsToRemove = actionsForClip.knownActions; + const actionsToRemove = actionsForClip.knownActions; for (let i = 0, n = actionsToRemove.length; i !== n; ++i) { const action = actionsToRemove[i]; - this._deactivateAction(action); - const cacheIndex = action._cacheIndex, - lastInactiveAction = actions[actions.length - 1]; + lastInactiveAction = actions[actions.length - 1]; action._cacheIndex = null; action._byClipCacheIndex = null; lastInactiveAction._cacheIndex = cacheIndex; actions[cacheIndex] = lastInactiveAction; actions.pop(); - this._removeInactiveBindingsForAction(action); } - delete actionsByClip[clipUuid]; } - } // free all resources specific to a particular root target object - + } + // free all resources specific to a particular root target object uncacheRoot(root) { const rootUuid = root.uuid, - actionsByClip = this._actionsByClip; - + actionsByClip = this._actionsByClip; for (const clipUuid in actionsByClip) { const actionByRoot = actionsByClip[clipUuid].actionByRoot, - action = actionByRoot[rootUuid]; - + action = actionByRoot[rootUuid]; if (action !== undefined) { this._deactivateAction(action); - this._removeInactiveAction(action); } } - const bindingsByRoot = this._bindingsByRootAndName, - bindingByName = bindingsByRoot[rootUuid]; - + bindingByName = bindingsByRoot[rootUuid]; if (bindingByName !== undefined) { for (const trackName in bindingByName) { const binding = bindingByName[trackName]; binding.restoreOriginalState(); - this._removeInactiveBinding(binding); } } - } // remove a targeted clip from the cache - + } + // remove a targeted clip from the cache uncacheAction(clip, optionalRoot) { const action = this.existingAction(clip, optionalRoot); - if (action !== null) { this._deactivateAction(action); - this._removeInactiveAction(action); } } - } - AnimationMixer.prototype._controlInterpolantsResultBuffer = new Float32Array(1); class Uniform { @@ -34006,14 +30438,11 @@ console.warn('THREE.Uniform: Type parameter is no longer needed.'); value = arguments[1]; } - this.value = value; } - clone() { return new Uniform(this.value.clone === undefined ? this.value : this.value.clone()); } - } class InstancedInterleavedBuffer extends InterleavedBuffer { @@ -34021,28 +30450,23 @@ super(array, stride); this.meshPerAttribute = meshPerAttribute; } - copy(source) { super.copy(source); this.meshPerAttribute = source.meshPerAttribute; return this; } - clone(data) { const ib = super.clone(data); ib.meshPerAttribute = this.meshPerAttribute; return ib; } - toJSON(data) { const json = super.toJSON(data); json.isInstancedInterleavedBuffer = true; json.meshPerAttribute = this.meshPerAttribute; return json; } - } - InstancedInterleavedBuffer.prototype.isInstancedInterleavedBuffer = true; class GLBufferAttribute { @@ -34054,39 +30478,33 @@ this.count = count; this.version = 0; } - set needsUpdate(value) { if (value === true) this.version++; } - setBuffer(buffer) { this.buffer = buffer; return this; } - setType(type, elementSize) { this.type = type; this.elementSize = elementSize; return this; } - setItemSize(itemSize) { this.itemSize = itemSize; return this; } - setCount(count) { this.count = count; return this; } - } - GLBufferAttribute.prototype.isGLBufferAttribute = true; class Raycaster { constructor(origin, direction, near = 0, far = Infinity) { - this.ray = new Ray(origin, direction); // direction is assumed to be normalized (for accurate distance calculations) + this.ray = new Ray(origin, direction); + // direction is assumed to be normalized (for accurate distance calculations) this.near = near; this.far = far; @@ -34104,12 +30522,11 @@ Sprite: {} }; } - set(origin, direction) { // direction is assumed to be normalized (for accurate distance calculations) + this.ray.set(origin, direction); } - setFromCamera(coords, camera) { if (camera && camera.isPerspectiveCamera) { this.ray.origin.setFromMatrixPosition(camera.matrixWorld); @@ -34117,43 +30534,34 @@ this.camera = camera; } else if (camera && camera.isOrthographicCamera) { this.ray.origin.set(coords.x, coords.y, (camera.near + camera.far) / (camera.near - camera.far)).unproject(camera); // set origin in plane of camera - this.ray.direction.set(0, 0, -1).transformDirection(camera.matrixWorld); this.camera = camera; } else { console.error('THREE.Raycaster: Unsupported camera type: ' + camera.type); } } - intersectObject(object, recursive = true, intersects = []) { intersectObject(object, this, intersects, recursive); intersects.sort(ascSort); return intersects; } - intersectObjects(objects, recursive = true, intersects = []) { for (let i = 0, l = objects.length; i < l; i++) { intersectObject(objects[i], this, intersects, recursive); } - intersects.sort(ascSort); return intersects; } - } - function ascSort(a, b) { return a.distance - b.distance; } - function intersectObject(object, raycaster, intersects, recursive) { if (object.layers.test(raycaster.layers)) { object.raycast(raycaster, intersects); } - if (recursive === true) { const children = object.children; - for (let i = 0, l = children.length; i < l; i++) { intersectObject(children[i], raycaster, intersects, true); } @@ -34166,45 +30574,38 @@ * The polar angle (phi) is measured from the positive y-axis. The positive y-axis is up. * The azimuthal angle (theta) is measured from the positive z-axis. */ - class Spherical { constructor(radius = 1, phi = 0, theta = 0) { this.radius = radius; this.phi = phi; // polar angle - this.theta = theta; // azimuthal angle return this; } - set(radius, phi, theta) { this.radius = radius; this.phi = phi; this.theta = theta; return this; } - copy(other) { this.radius = other.radius; this.phi = other.phi; this.theta = other.theta; return this; - } // restrict phi to be betwee EPS and PI-EPS - + } + // restrict phi to be betwee EPS and PI-EPS makeSafe() { const EPS = 0.000001; this.phi = Math.max(EPS, Math.min(Math.PI - EPS, this.phi)); return this; } - setFromVector3(v) { return this.setFromCartesianCoords(v.x, v.y, v.z); } - setFromCartesianCoords(x, y, z) { this.radius = Math.sqrt(x * x + y * y + z * z); - if (this.radius === 0) { this.theta = 0; this.phi = 0; @@ -34212,278 +30613,220 @@ this.theta = Math.atan2(x, z); this.phi = Math.acos(clamp(y / this.radius, -1, 1)); } - return this; } - clone() { return new this.constructor().copy(this); } - } /** * Ref: https://en.wikipedia.org/wiki/Cylindrical_coordinate_system */ + class Cylindrical { constructor(radius = 1, theta = 0, y = 0) { this.radius = radius; // distance from the origin to a point in the x-z plane - this.theta = theta; // counterclockwise angle in the x-z plane measured in radians from the positive z-axis - this.y = y; // height above the x-z plane return this; } - set(radius, theta, y) { this.radius = radius; this.theta = theta; this.y = y; return this; } - copy(other) { this.radius = other.radius; this.theta = other.theta; this.y = other.y; return this; } - setFromVector3(v) { return this.setFromCartesianCoords(v.x, v.y, v.z); } - setFromCartesianCoords(x, y, z) { this.radius = Math.sqrt(x * x + z * z); this.theta = Math.atan2(x, z); this.y = y; return this; } - clone() { return new this.constructor().copy(this); } - } const _vector$4 = /*@__PURE__*/new Vector2(); - class Box2 { constructor(min = new Vector2(+Infinity, +Infinity), max = new Vector2(-Infinity, -Infinity)) { this.min = min; this.max = max; } - set(min, max) { this.min.copy(min); this.max.copy(max); return this; } - setFromPoints(points) { this.makeEmpty(); - for (let i = 0, il = points.length; i < il; i++) { this.expandByPoint(points[i]); } - return this; } - setFromCenterAndSize(center, size) { const halfSize = _vector$4.copy(size).multiplyScalar(0.5); - this.min.copy(center).sub(halfSize); this.max.copy(center).add(halfSize); return this; } - clone() { return new this.constructor().copy(this); } - copy(box) { this.min.copy(box.min); this.max.copy(box.max); return this; } - makeEmpty() { this.min.x = this.min.y = +Infinity; this.max.x = this.max.y = -Infinity; return this; } - isEmpty() { // this is a more robust check for empty than ( volume <= 0 ) because volume can get positive with two negative axes + return this.max.x < this.min.x || this.max.y < this.min.y; } - getCenter(target) { return this.isEmpty() ? target.set(0, 0) : target.addVectors(this.min, this.max).multiplyScalar(0.5); } - getSize(target) { return this.isEmpty() ? target.set(0, 0) : target.subVectors(this.max, this.min); } - expandByPoint(point) { this.min.min(point); this.max.max(point); return this; } - expandByVector(vector) { this.min.sub(vector); this.max.add(vector); return this; } - expandByScalar(scalar) { this.min.addScalar(-scalar); this.max.addScalar(scalar); return this; } - containsPoint(point) { return point.x < this.min.x || point.x > this.max.x || point.y < this.min.y || point.y > this.max.y ? false : true; } - containsBox(box) { return this.min.x <= box.min.x && box.max.x <= this.max.x && this.min.y <= box.min.y && box.max.y <= this.max.y; } - getParameter(point, target) { // This can potentially have a divide by zero if the box // has a size dimension of 0. + return target.set((point.x - this.min.x) / (this.max.x - this.min.x), (point.y - this.min.y) / (this.max.y - this.min.y)); } - intersectsBox(box) { // using 4 splitting planes to rule out intersections + return box.max.x < this.min.x || box.min.x > this.max.x || box.max.y < this.min.y || box.min.y > this.max.y ? false : true; } - clampPoint(point, target) { return target.copy(point).clamp(this.min, this.max); } - distanceToPoint(point) { const clampedPoint = _vector$4.copy(point).clamp(this.min, this.max); - return clampedPoint.sub(point).length(); } - intersect(box) { this.min.max(box.min); this.max.min(box.max); return this; } - union(box) { this.min.min(box.min); this.max.max(box.max); return this; } - translate(offset) { this.min.add(offset); this.max.add(offset); return this; } - equals(box) { return box.min.equals(this.min) && box.max.equals(this.max); } - } - Box2.prototype.isBox2 = true; const _startP = /*@__PURE__*/new Vector3(); - const _startEnd = /*@__PURE__*/new Vector3(); - class Line3 { constructor(start = new Vector3(), end = new Vector3()) { this.start = start; this.end = end; } - set(start, end) { this.start.copy(start); this.end.copy(end); return this; } - copy(line) { this.start.copy(line.start); this.end.copy(line.end); return this; } - getCenter(target) { return target.addVectors(this.start, this.end).multiplyScalar(0.5); } - delta(target) { return target.subVectors(this.end, this.start); } - distanceSq() { return this.start.distanceToSquared(this.end); } - distance() { return this.start.distanceTo(this.end); } - at(t, target) { return this.delta(target).multiplyScalar(t).add(this.start); } - closestPointToPointParameter(point, clampToLine) { _startP.subVectors(point, this.start); - _startEnd.subVectors(this.end, this.start); - const startEnd2 = _startEnd.dot(_startEnd); - const startEnd_startP = _startEnd.dot(_startP); - let t = startEnd_startP / startEnd2; - if (clampToLine) { t = clamp(t, 0, 1); } - return t; } - closestPointToPoint(point, clampToLine, target) { const t = this.closestPointToPointParameter(point, clampToLine); return this.delta(target).multiplyScalar(t).add(this.start); } - applyMatrix4(matrix) { this.start.applyMatrix4(matrix); this.end.applyMatrix4(matrix); return this; } - equals(line) { return line.start.equals(this.start) && line.end.equals(this.end); } - clone() { return new this.constructor().copy(this); } - } const _vector$3 = /*@__PURE__*/new Vector3(); - class SpotLightHelper extends Object3D { constructor(light, color) { super(); @@ -34494,13 +30837,11 @@ this.color = color; const geometry = new BufferGeometry(); const positions = [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 i = 0, j = 1, l = 32; i < l; i++, j++) { const p1 = i / l * Math.PI * 2; const p2 = j / l * Math.PI * 2; positions.push(Math.cos(p1), Math.sin(p1), 1, Math.cos(p2), Math.sin(p2), 1); } - geometry.setAttribute('position', new Float32BufferAttribute(positions, 3)); const material = new LineBasicMaterial({ fog: false, @@ -34510,37 +30851,28 @@ this.add(this.cone); this.update(); } - dispose() { this.cone.geometry.dispose(); this.cone.material.dispose(); } - update() { this.light.updateMatrixWorld(); const coneLength = this.light.distance ? this.light.distance : 1000; const coneWidth = coneLength * Math.tan(this.light.angle); this.cone.scale.set(coneWidth, coneWidth, coneLength); - _vector$3.setFromMatrixPosition(this.light.target.matrixWorld); - this.cone.lookAt(_vector$3); - if (this.color !== undefined) { this.cone.material.color.set(this.color); } else { this.cone.material.color.copy(this.light.color); } } - } const _vector$2 = /*@__PURE__*/new Vector3(); - const _boneMatrix = /*@__PURE__*/new Matrix4(); - const _matrixWorldInv = /*@__PURE__*/new Matrix4(); - class SkeletonHelper extends LineSegments { constructor(object) { const bones = getBoneList(object); @@ -34549,10 +30881,8 @@ const colors = []; const color1 = new Color(0, 0, 1); const color2 = new Color(0, 1, 0); - for (let i = 0; i < bones.length; i++) { const bone = bones[i]; - if (bone.parent && bone.parent.isBone) { vertices.push(0, 0, 0); vertices.push(0, 0, 0); @@ -34560,7 +30890,6 @@ colors.push(color2.r, color2.g, color2.b); } } - geometry.setAttribute('position', new Float32BufferAttribute(vertices, 3)); geometry.setAttribute('color', new Float32BufferAttribute(colors, 3)); const material = new LineBasicMaterial({ @@ -34578,50 +30907,35 @@ this.matrix = object.matrixWorld; this.matrixAutoUpdate = false; } - updateMatrixWorld(force) { const bones = this.bones; const geometry = this.geometry; const position = geometry.getAttribute('position'); - _matrixWorldInv.copy(this.root.matrixWorld).invert(); - for (let i = 0, j = 0; i < bones.length; i++) { const bone = bones[i]; - if (bone.parent && bone.parent.isBone) { _boneMatrix.multiplyMatrices(_matrixWorldInv, bone.matrixWorld); - _vector$2.setFromMatrixPosition(_boneMatrix); - position.setXYZ(j, _vector$2.x, _vector$2.y, _vector$2.z); - _boneMatrix.multiplyMatrices(_matrixWorldInv, bone.parent.matrixWorld); - _vector$2.setFromMatrixPosition(_boneMatrix); - position.setXYZ(j + 1, _vector$2.x, _vector$2.y, _vector$2.z); j += 2; } } - geometry.getAttribute('position').needsUpdate = true; super.updateMatrixWorld(force); } - } - function getBoneList(object) { const boneList = []; - if (object && object.isBone) { boneList.push(object); } - for (let i = 0; i < object.children.length; i++) { boneList.push.apply(boneList, getBoneList(object.children[i])); } - return boneList; } @@ -34641,53 +30955,48 @@ this.matrix = this.light.matrixWorld; this.matrixAutoUpdate = false; this.update(); + /* // TODO: delete this comment? const distanceGeometry = new THREE.IcosahedronBufferGeometry( 1, 2 ); const distanceMaterial = new THREE.MeshBasicMaterial( { color: hexColor, fog: false, wireframe: true, opacity: 0.1, transparent: true } ); - this.lightSphere = new THREE.Mesh( bulbGeometry, bulbMaterial ); + this.lightSphere = new THREE.Mesh( bulbGeometry, bulbMaterial ); this.lightDistance = new THREE.Mesh( distanceGeometry, distanceMaterial ); - const d = light.distance; - if ( d === 0.0 ) { - this.lightDistance.visible = false; - } else { - this.lightDistance.scale.set( d, d, d ); - } - this.add( this.lightDistance ); + const d = light.distance; + if ( d === 0.0 ) { + this.lightDistance.visible = false; + } else { + this.lightDistance.scale.set( d, d, d ); + } + this.add( this.lightDistance ); */ } - dispose() { this.geometry.dispose(); this.material.dispose(); } - update() { if (this.color !== undefined) { this.material.color.set(this.color); } else { this.material.color.copy(this.light.color); } + /* const d = this.light.distance; - if ( d === 0.0 ) { - this.lightDistance.visible = false; - } else { - this.lightDistance.visible = true; + if ( d === 0.0 ) { + this.lightDistance.visible = false; + } else { + this.lightDistance.visible = true; this.lightDistance.scale.set( d, d, d ); - } + } */ - } - } const _vector$1 = /*@__PURE__*/new Vector3(); - const _color1 = /*@__PURE__*/new Color(); - const _color2 = /*@__PURE__*/new Color(); - class HemisphereLightHelper extends Object3D { constructor(light, size, color) { super(); @@ -34710,35 +31019,26 @@ this.add(new Mesh(geometry, this.material)); this.update(); } - dispose() { this.children[0].geometry.dispose(); this.children[0].material.dispose(); } - update() { const mesh = this.children[0]; - if (this.color !== undefined) { this.material.color.set(this.color); } else { const colors = mesh.geometry.getAttribute('color'); - _color1.copy(this.light.color); - _color2.copy(this.light.groundColor); - for (let i = 0, l = colors.count; i < l; i++) { const color = i < l / 2 ? _color1 : _color2; colors.setXYZ(i, color.r, color.g, color.b); } - colors.needsUpdate = true; } - mesh.lookAt(_vector$1.setFromMatrixPosition(this.light.matrixWorld).negate()); } - } class GridHelper extends LineSegments { @@ -34749,8 +31049,7 @@ const step = size / divisions; const halfSize = size / 2; const vertices = [], - colors = []; - + colors = []; for (let i = 0, j = 0, k = -halfSize; i <= divisions; i++, k += step) { vertices.push(-halfSize, 0, k, halfSize, 0, k); vertices.push(k, 0, -halfSize, k, 0, halfSize); @@ -34764,7 +31063,6 @@ color.toArray(colors, j); j += 3; } - const geometry = new BufferGeometry(); geometry.setAttribute('position', new Float32BufferAttribute(vertices, 3)); geometry.setAttribute('color', new Float32BufferAttribute(colors, 3)); @@ -34775,7 +31073,6 @@ super(geometry, material); this.type = 'GridHelper'; } - } class PolarGridHelper extends LineSegments { @@ -34783,7 +31080,9 @@ color1 = new Color(color1); color2 = new Color(color2); const vertices = []; - const colors = []; // create the radials + const colors = []; + + // create the radials for (let i = 0; i <= radials; i++) { const v = i / radials * (Math.PI * 2); @@ -34794,20 +31093,23 @@ const color = i & 1 ? color1 : color2; colors.push(color.r, color.g, color.b); colors.push(color.r, color.g, color.b); - } // create the circles + } + // create the circles for (let i = 0; i <= circles; i++) { const color = i & 1 ? color1 : color2; const r = radius - radius / circles * i; - for (let j = 0; j < divisions; j++) { // first vertex + let v = j / divisions * (Math.PI * 2); let x = Math.sin(v) * r; let z = Math.cos(v) * r; vertices.push(x, 0, z); - colors.push(color.r, color.g, color.b); // second vertex + colors.push(color.r, color.g, color.b); + + // second vertex v = (j + 1) / divisions * (Math.PI * 2); x = Math.sin(v) * r; @@ -34816,7 +31118,6 @@ colors.push(color.r, color.g, color.b); } } - const geometry = new BufferGeometry(); geometry.setAttribute('position', new Float32BufferAttribute(vertices, 3)); geometry.setAttribute('color', new Float32BufferAttribute(colors, 3)); @@ -34827,15 +31128,11 @@ super(geometry, material); this.type = 'PolarGridHelper'; } - } const _v1 = /*@__PURE__*/new Vector3(); - const _v2 = /*@__PURE__*/new Vector3(); - const _v3 = /*@__PURE__*/new Vector3(); - class DirectionalLightHelper extends Object3D { constructor(light, size, color) { super(); @@ -34859,23 +31156,17 @@ this.add(this.targetLine); this.update(); } - dispose() { this.lightPlane.geometry.dispose(); this.lightPlane.material.dispose(); this.targetLine.geometry.dispose(); this.targetLine.material.dispose(); } - update() { _v1.setFromMatrixPosition(this.light.matrixWorld); - _v2.setFromMatrixPosition(this.light.target.matrixWorld); - _v3.subVectors(_v2, _v1); - this.lightPlane.lookAt(_v2); - if (this.color !== undefined) { this.lightPlane.material.color.set(this.color); this.targetLine.material.color.set(this.color); @@ -34883,16 +31174,14 @@ this.lightPlane.material.color.copy(this.light.color); this.targetLine.material.color.copy(this.light.color); } - this.targetLine.lookAt(_v2); this.targetLine.scale.z = _v3.length(); } - } const _vector = /*@__PURE__*/new Vector3(); - const _camera = /*@__PURE__*/new Camera(); + /** * - shows frustum, line of sight and up of the camera * - suitable for fast updates @@ -34900,7 +31189,6 @@ * https://github.com/evanw/lightgl.js/blob/master/tests/shadowmap.html */ - class CameraHelper extends LineSegments { constructor(camera) { const geometry = new BufferGeometry(); @@ -34911,62 +31199,73 @@ }); const vertices = []; const colors = []; - const pointMap = {}; // colors + const pointMap = {}; + + // colors const colorFrustum = new Color(0xffaa00); const colorCone = new Color(0xff0000); const colorUp = new Color(0x00aaff); const colorTarget = new Color(0xffffff); - const colorCross = new Color(0x333333); // near + const colorCross = new Color(0x333333); + + // near addLine('n1', 'n2', colorFrustum); addLine('n2', 'n4', colorFrustum); addLine('n4', 'n3', colorFrustum); - addLine('n3', 'n1', colorFrustum); // far + addLine('n3', 'n1', colorFrustum); + + // far addLine('f1', 'f2', colorFrustum); addLine('f2', 'f4', colorFrustum); addLine('f4', 'f3', colorFrustum); - addLine('f3', 'f1', colorFrustum); // sides + addLine('f3', 'f1', colorFrustum); + + // sides addLine('n1', 'f1', colorFrustum); addLine('n2', 'f2', colorFrustum); addLine('n3', 'f3', colorFrustum); - addLine('n4', 'f4', colorFrustum); // cone + addLine('n4', 'f4', colorFrustum); + + // cone addLine('p', 'n1', colorCone); addLine('p', 'n2', colorCone); addLine('p', 'n3', colorCone); - addLine('p', 'n4', colorCone); // up + addLine('p', 'n4', colorCone); + + // up addLine('u1', 'u2', colorUp); addLine('u2', 'u3', colorUp); - addLine('u3', 'u1', colorUp); // target + addLine('u3', 'u1', colorUp); + + // target addLine('c', 't', colorTarget); - addLine('p', 'c', colorCross); // cross + addLine('p', 'c', colorCross); + + // cross addLine('cn1', 'cn2', colorCross); addLine('cn3', 'cn4', colorCross); addLine('cf1', 'cf2', colorCross); addLine('cf3', 'cf4', colorCross); - function addLine(a, b, color) { addPoint(a, color); addPoint(b, color); } - function addPoint(id, color) { vertices.push(0, 0, 0); colors.push(color.r, color.g, color.b); - if (pointMap[id] === undefined) { pointMap[id] = []; } - pointMap[id].push(vertices.length / 3 - 1); } - geometry.setAttribute('position', new Float32BufferAttribute(vertices, 3)); geometry.setAttribute('color', new Float32BufferAttribute(colors, 3)); super(geometry, material); @@ -34978,33 +31277,43 @@ this.pointMap = pointMap; this.update(); } - update() { const geometry = this.geometry; const pointMap = this.pointMap; const w = 1, - h = 1; // we need just camera projection matrix inverse + h = 1; + + // we need just camera projection matrix inverse // world matrix must be identity - _camera.projectionMatrixInverse.copy(this.camera.projectionMatrixInverse); // center / target + _camera.projectionMatrixInverse.copy(this.camera.projectionMatrixInverse); + // center / target setPoint('c', pointMap, geometry, _camera, 0, 0, -1); - setPoint('t', pointMap, geometry, _camera, 0, 0, 1); // near + setPoint('t', pointMap, geometry, _camera, 0, 0, 1); + + // near setPoint('n1', pointMap, geometry, _camera, -w, -h, -1); setPoint('n2', pointMap, geometry, _camera, w, -h, -1); setPoint('n3', pointMap, geometry, _camera, -w, h, -1); - setPoint('n4', pointMap, geometry, _camera, w, h, -1); // far + setPoint('n4', pointMap, geometry, _camera, w, h, -1); + + // far setPoint('f1', pointMap, geometry, _camera, -w, -h, 1); setPoint('f2', pointMap, geometry, _camera, w, -h, 1); setPoint('f3', pointMap, geometry, _camera, -w, h, 1); - setPoint('f4', pointMap, geometry, _camera, w, h, 1); // up + setPoint('f4', pointMap, geometry, _camera, w, h, 1); + + // up setPoint('u1', pointMap, geometry, _camera, w * 0.7, h * 1.1, -1); setPoint('u2', pointMap, geometry, _camera, -w * 0.7, h * 1.1, -1); - setPoint('u3', pointMap, geometry, _camera, 0, h * 2, -1); // cross + setPoint('u3', pointMap, geometry, _camera, 0, h * 2, -1); + + // cross setPoint('cf1', pointMap, geometry, _camera, -w, 0, 1); setPoint('cf2', pointMap, geometry, _camera, w, 0, 1); @@ -35016,22 +31325,16 @@ setPoint('cn4', pointMap, geometry, _camera, 0, h, -1); geometry.getAttribute('position').needsUpdate = true; } - dispose() { this.geometry.dispose(); this.material.dispose(); } - } - function setPoint(point, pointMap, geometry, camera, x, y, z) { _vector.set(x, y, z).unproject(camera); - const points = pointMap[point]; - if (points !== undefined) { const position = geometry.getAttribute('position'); - for (let i = 0, l = points.length; i < l; i++) { position.setXYZ(points[i], _vector.x, _vector.y, _vector.z); } @@ -35039,7 +31342,6 @@ } const _box$1 = /*@__PURE__*/new Box3(); - class BoxHelper extends LineSegments { constructor(object, color = 0xffff00) { const indices = new Uint16Array([0, 1, 1, 2, 2, 3, 3, 0, 4, 5, 5, 6, 6, 7, 7, 4, 0, 4, 1, 5, 2, 6, 3, 7]); @@ -35056,25 +31358,23 @@ this.matrixAutoUpdate = false; this.update(); } - update(object) { if (object !== undefined) { console.warn('THREE.BoxHelper: .update() has no longer arguments.'); } - if (this.object !== undefined) { _box$1.setFromObject(this.object); } - if (_box$1.isEmpty()) return; const min = _box$1.min; const max = _box$1.max; + /* 5____4 1/___0/| | 6__|_7 2/___3/ - 0: max.x, max.y, max.z + 0: max.x, max.y, max.z 1: min.x, max.y, max.z 2: min.x, min.y, max.z 3: max.x, min.y, max.z @@ -35113,19 +31413,16 @@ position.needsUpdate = true; this.geometry.computeBoundingSphere(); } - setFromObject(object) { this.object = object; this.update(); return this; } - copy(source) { LineSegments.prototype.copy.call(this, source); this.object = source.object; return this; } - } class Box3Helper extends LineSegments { @@ -35143,7 +31440,6 @@ this.type = 'Box3Helper'; this.geometry.computeBoundingSphere(); } - updateMatrixWorld(force) { const box = this.box; if (box.isEmpty()) return; @@ -35152,7 +31448,6 @@ this.scale.multiplyScalar(0.5); super.updateMatrixWorld(force); } - } class PlaneHelper extends Line { @@ -35181,7 +31476,6 @@ toneMapped: false }))); } - updateMatrixWorld(force) { let scale = -this.plane.constant; if (Math.abs(scale) < 1e-8) scale = 1e-8; // sign does not matter @@ -35192,29 +31486,22 @@ this.lookAt(this.plane.normal); super.updateMatrixWorld(force); } - } const _axis = /*@__PURE__*/new Vector3(); - let _lineGeometry, _coneGeometry; - class ArrowHelper extends Object3D { // dir is assumed to be normalized + constructor(dir = new Vector3(0, 0, 1), origin = new Vector3(0, 0, 0), length = 1, color = 0xffff00, headLength = length * 0.2, headWidth = headLength * 0.2) { super(); this.type = 'ArrowHelper'; - if (_lineGeometry === undefined) { _lineGeometry = new BufferGeometry(); - _lineGeometry.setAttribute('position', new Float32BufferAttribute([0, 0, 0, 0, 1, 0], 3)); - _coneGeometry = new CylinderGeometry(0, 0.5, 1, 5, 1); - _coneGeometry.translate(0, -0.5, 0); } - this.position.copy(origin); this.line = new Line(_lineGeometry, new LineBasicMaterial({ color: color, @@ -35231,42 +31518,36 @@ this.setDirection(dir); this.setLength(length, headLength, headWidth); } - setDirection(dir) { // dir is assumed to be normalized + if (dir.y > 0.99999) { this.quaternion.set(0, 0, 0, 1); } else if (dir.y < -0.99999) { this.quaternion.set(1, 0, 0, 0); } else { _axis.set(dir.z, 0, -dir.x).normalize(); - const radians = Math.acos(dir.y); this.quaternion.setFromAxisAngle(_axis, radians); } } - setLength(length, headLength = length * 0.2, headWidth = headLength * 0.2) { this.line.scale.set(1, Math.max(0.0001, length - headLength), 1); // see #17458 - this.line.updateMatrix(); this.cone.scale.set(headWidth, headLength, headWidth); this.cone.position.y = length; this.cone.updateMatrix(); } - setColor(color) { this.line.material.color.set(color); this.cone.material.color.set(color); } - copy(source) { super.copy(source, false); this.line.copy(source.line); this.cone.copy(source.cone); return this; } - } class AxesHelper extends LineSegments { @@ -35283,7 +31564,6 @@ super(geometry, material); this.type = 'AxesHelper'; } - setColors(xAxisColor, yAxisColor, zAxisColor) { const color = new Color(); const array = this.geometry.attributes.color.array; @@ -35299,20 +31579,16 @@ this.geometry.attributes.color.needsUpdate = true; return this; } - dispose() { this.geometry.dispose(); this.material.dispose(); } - } /** * @author chubei */ - const _box = /*@__PURE__*/new Box3(); - class SkinnedMeshBoxHelper extends LineSegments { constructor(mesh, color) { if (color === undefined) color = 0xffff00; @@ -35328,40 +31604,34 @@ this.matrixAutoUpdate = false; this.update(); } - update(mesh) { if (mesh !== undefined) { console.warn('THREE.SkinnedMeshBoxHelper: .update() has no longer arguments.'); } - if (this.mesh !== undefined) { if (!this.mesh.geometry.boundingBox) { this.mesh.geometry.computeBoundingBox(); } - _box.copy(this.mesh.geometry.boundingBox); - const skeleton = this.mesh.skeleton; - if (skeleton && skeleton.rootMotionBone) { const rootMotion = skeleton.rootMotionBone.matrixWorld.clone(); rootMotion.multiply(skeleton.rootMotionBoneInitialMatrixInverse); - _box.applyMatrix4(rootMotion); } else { _box.applyMatrix4(this.mesh.matrixWorld); } } - if (_box.isEmpty()) return; var min = _box.min; var max = _box.max; + /* 5____4 1/___0/| | 6__|_7 2/___3/ - 0: max.x, max.y, max.z + 0: max.x, max.y, max.z 1: min.x, max.y, max.z 2: min.x, min.y, max.z 3: max.x, min.y, max.z @@ -35400,13 +31670,11 @@ position.needsUpdate = true; this.geometry.computeBoundingSphere(); } - setFromMesh(mesh) { this.mesh = mesh; this.update(); return this; } - } class ShapePath { @@ -35416,62 +31684,52 @@ this.subPaths = []; this.currentPath = null; } - moveTo(x, y) { this.currentPath = new Path(); this.subPaths.push(this.currentPath); this.currentPath.moveTo(x, y); return this; } - lineTo(x, y) { this.currentPath.lineTo(x, y); return this; } - quadraticCurveTo(aCPx, aCPy, aX, aY) { this.currentPath.quadraticCurveTo(aCPx, aCPy, aX, aY); return this; } - bezierCurveTo(aCP1x, aCP1y, aCP2x, aCP2y, aX, aY) { this.currentPath.bezierCurveTo(aCP1x, aCP1y, aCP2x, aCP2y, aX, aY); return this; } - splineThru(pts) { this.currentPath.splineThru(pts); return this; } - toShapes(isCCW, noHoles) { function toShapesNoHoles(inSubpaths) { const shapes = []; - for (let i = 0, l = inSubpaths.length; i < l; i++) { const tmpPath = inSubpaths[i]; const tmpShape = new Shape(); tmpShape.curves = tmpPath.curves; shapes.push(tmpShape); } - return shapes; } - function isPointInsidePolygon(inPt, inPolygon) { - const polyLen = inPolygon.length; // inPt on polygon contour => immediate success or + const polyLen = inPolygon.length; + + // inPt on polygon contour => immediate success or // toggling of inside/outside at every single! intersection point of an edge // with the horizontal line through inPt, left of inPt // not counting lowerY endpoints of edges and whole edges on that line - let inside = false; - for (let p = polyLen - 1, q = 0; q < polyLen; p = q++) { let edgeLowPt = inPolygon[p]; let edgeHighPt = inPolygon[q]; let edgeDx = edgeHighPt.x - edgeLowPt.x; let edgeDy = edgeHighPt.y - edgeLowPt.y; - if (Math.abs(edgeDy) > Number.EPSILON) { // not parallel if (edgeDy < 0) { @@ -35480,16 +31738,13 @@ edgeHighPt = inPolygon[p]; edgeDy = -edgeDy; } - if (inPt.y < edgeLowPt.y || inPt.y > edgeHighPt.y) continue; - if (inPt.y === edgeLowPt.y) { if (inPt.x === edgeLowPt.x) return true; // inPt is on contour ? // continue; // no intersection or edgeLowPt => doesn't count !!! } else { const perpEdge = edgeDy * (inPt.x - edgeLowPt.x) - edgeDx * (inPt.y - edgeLowPt.y); if (perpEdge === 0) return true; // inPt is on contour ? - if (perpEdge < 0) continue; inside = !inside; // true intersection left of inPt } @@ -35497,22 +31752,18 @@ // parallel or collinear if (inPt.y !== edgeLowPt.y) continue; // parallel // edge lies on the same horizontal line as inPt - if (edgeHighPt.x <= inPt.x && inPt.x <= edgeLowPt.x || edgeLowPt.x <= inPt.x && inPt.x <= edgeHighPt.x) return true; // inPt: Point on contour ! // continue; } } - return inside; } - const isClockWise = ShapeUtils.isClockWise; const subPaths = this.subPaths; if (subPaths.length === 0) return []; if (noHoles === true) return toShapesNoHoles(subPaths); let solid, tmpPath, tmpShape; const shapes = []; - if (subPaths.length === 1) { tmpPath = subPaths[0]; tmpShape = new Shape(); @@ -35520,9 +31771,10 @@ shapes.push(tmpShape); return shapes; } - let holesFirst = !isClockWise(subPaths[0].getPoints()); - holesFirst = isCCW ? !holesFirst : holesFirst; // console.log("Holes first", holesFirst); + holesFirst = isCCW ? !holesFirst : holesFirst; + + // console.log("Holes first", holesFirst); const betterShapeHoles = []; const newShapes = []; @@ -35531,13 +31783,11 @@ let tmpPoints; newShapes[mainIdx] = undefined; newShapeHoles[mainIdx] = []; - for (let i = 0, l = subPaths.length; i < l; i++) { tmpPath = subPaths[i]; tmpPoints = tmpPath.getPoints(); solid = isClockWise(tmpPoints); solid = isCCW ? !solid : solid; - if (solid) { if (!holesFirst && newShapes[mainIdx]) mainIdx++; newShapes[mainIdx] = { @@ -35546,33 +31796,32 @@ }; newShapes[mainIdx].s.curves = tmpPath.curves; if (holesFirst) mainIdx++; - newShapeHoles[mainIdx] = []; //console.log('cw', i); + newShapeHoles[mainIdx] = []; + + //console.log('cw', i); } else { newShapeHoles[mainIdx].push({ h: tmpPath, p: tmpPoints[0] - }); //console.log('ccw', i); - } - } // only Holes? -> probably all Shapes with wrong orientation + }); + //console.log('ccw', i); + } + } + // only Holes? -> probably all Shapes with wrong orientation if (!newShapes[0]) return toShapesNoHoles(subPaths); - if (newShapes.length > 1) { let ambiguous = false; const toChange = []; - for (let sIdx = 0, sLen = newShapes.length; sIdx < sLen; sIdx++) { betterShapeHoles[sIdx] = []; } - for (let sIdx = 0, sLen = newShapes.length; sIdx < sLen; sIdx++) { const sho = newShapeHoles[sIdx]; - for (let hIdx = 0; hIdx < sho.length; hIdx++) { const ho = sho[hIdx]; let hole_unassigned = true; - for (let s2Idx = 0; s2Idx < newShapes.length; s2Idx++) { if (isPointInsidePolygon(ho.p, newShapes[s2Idx].p)) { if (sIdx !== s2Idx) toChange.push({ @@ -35580,7 +31829,6 @@ tos: s2Idx, hole: hIdx }); - if (hole_unassigned) { hole_unassigned = false; betterShapeHoles[s2Idx].push(ho); @@ -35589,100 +31837,84 @@ } } } - if (hole_unassigned) { betterShapeHoles[sIdx].push(ho); } } - } // console.log("ambiguous: ", ambiguous); - + } + // console.log("ambiguous: ", ambiguous); if (toChange.length > 0) { // console.log("to change: ", toChange); if (!ambiguous) newShapeHoles = betterShapeHoles; } } - let tmpHoles; - for (let i = 0, il = newShapes.length; i < il; i++) { tmpShape = newShapes[i].s; shapes.push(tmpShape); tmpHoles = newShapeHoles[i]; - for (let j = 0, jl = tmpHoles.length; j < jl; j++) { tmpShape.holes.push(tmpHoles[j].h); } - } //console.log("shape", shapes); + } + //console.log("shape", shapes); return shapes; } - } const _floatView = new Float32Array(1); - const _int32View = new Int32Array(_floatView.buffer); - class DataUtils { // Converts float32 to float16 (stored as uint16 value). + static toHalfFloat(val) { if (val > 65504) { console.warn('THREE.DataUtils.toHalfFloat(): value exceeds 65504.'); val = 65504; // maximum representable value in float16 - } // Source: http://gamedev.stackexchange.com/questions/17326/conversion-of-a-number-from-single-precision-floating-point-representation-to-a/17410#17410 + } + + // Source: http://gamedev.stackexchange.com/questions/17326/conversion-of-a-number-from-single-precision-floating-point-representation-to-a/17410#17410 /* This method is faster than the OpenEXR implementation (very often * used, eg. in Ogre), with the additional benefit of rounding, inspired * by James Tursa?s half-precision code. */ - _floatView[0] = val; const x = _int32View[0]; - let bits = x >> 16 & 0x8000; - /* Get the sign */ - - let m = x >> 12 & 0x07ff; - /* Keep one extra bit for rounding */ - - const e = x >> 23 & 0xff; - /* Using int is faster here */ + let bits = x >> 16 & 0x8000; /* Get the sign */ + let m = x >> 12 & 0x07ff; /* Keep one extra bit for rounding */ + const e = x >> 23 & 0xff; /* Using int is faster here */ /* If zero, or denormal, or exponent underflows too much for a denormal * half, return signed zero. */ - if (e < 103) return bits; - /* If NaN, return NaN. If Inf or exponent overflow, return Inf. */ + /* If NaN, return NaN. If Inf or exponent overflow, return Inf. */ if (e > 142) { bits |= 0x7c00; /* If exponent was 0xff and one mantissa bit was set, it means NaN, * not Inf, so make sure we set one mantissa bit too. */ - bits |= (e == 255 ? 0 : 1) && x & 0x007fffff; return bits; } - /* If exponent underflows but not too much, return a denormal */ - + /* If exponent underflows but not too much, return a denormal */ if (e < 113) { m |= 0x0800; /* Extra rounding may overflow and set mantissa to 0 and exponent * to 1, which is OK. */ - bits |= (m >> 114 - e) + (m >> 113 - e & 1); return bits; } - bits |= e - 112 << 10 | m >> 1; /* Extra rounding. An overflow will set mantissa to 0 and increment * the exponent, which is OK. */ - bits += m & 1; return bits; } - } const LineStrip = 0; @@ -35698,11 +31930,9 @@ console.warn('THREE.MultiMaterial has been removed. Use an Array instead.'); materials.isMultiMaterial = true; materials.materials = materials; - materials.clone = function () { return materials.slice(); }; - return materials; } function PointCloud(geometry, material) { @@ -35732,7 +31962,9 @@ function Vertex(x, y, z) { console.warn('THREE.Vertex has been removed. Use THREE.Vector3 instead.'); return new Vector3(x, y, z); - } // + } + + // function DynamicBufferAttribute(array, itemSize) { console.warn('THREE.DynamicBufferAttribute has been removed. Use new THREE.BufferAttribute().setUsage( THREE.DynamicDrawUsage ) instead.'); @@ -35773,7 +32005,9 @@ function Float64Attribute(array, itemSize) { console.warn('THREE.Float64Attribute has been removed. Use new THREE.Float64BufferAttribute() instead.'); return new Float64BufferAttribute(array, itemSize); - } // + } + + // Curve.create = function (construct, getPoint) { console.log('THREE.Curve.create() has been deprecated'); @@ -35781,14 +32015,16 @@ construct.prototype.constructor = construct; construct.prototype.getPoint = getPoint; return construct; - }; // + }; + // Path.prototype.fromPoints = function (points) { console.warn('THREE.Path: .fromPoints() has been renamed to .setFromPoints().'); return this.setFromPoints(points); - }; // + }; + // function AxisHelper(size) { console.warn('THREE.AxisHelper has been renamed to THREE.AxesHelper.'); @@ -35804,35 +32040,31 @@ color: hex !== undefined ? hex : 0xffffff })); } - GridHelper.prototype.setColors = function () { console.error('THREE.GridHelper: setColors() has been deprecated, pass them in the constructor instead.'); }; - SkeletonHelper.prototype.update = function () { console.error('THREE.SkeletonHelper: update() no longer needs to be called.'); }; - function WireframeHelper(object, hex) { console.warn('THREE.WireframeHelper has been removed. Use THREE.WireframeGeometry instead.'); return new LineSegments(new WireframeGeometry(object.geometry), new LineBasicMaterial({ color: hex !== undefined ? hex : 0xffffff })); - } // + } + + // Loader.prototype.extractUrlBase = function (url) { console.warn('THREE.Loader: .extractUrlBase() has been deprecated. Use THREE.LoaderUtils.extractUrlBase() instead.'); return LoaderUtils.extractUrlBase(url); }; - Loader.Handlers = { - add: function - /* regex, loader */ + add: function /* regex, loader */ () { console.error('THREE.Loader: Handlers.add() has been removed. Use LoadingManager.addHandler() instead.'); }, - get: function - /* file */ + get: function /* file */ () { console.error('THREE.Loader: Handlers.get() has been removed. Use LoadingManager.getHandler() instead.'); } @@ -35844,377 +32076,333 @@ function BinaryTextureLoader(manager) { console.warn('THREE.BinaryTextureLoader has been renamed to THREE.DataTextureLoader.'); return new DataTextureLoader(manager); - } // + } + + // Box2.prototype.center = function (optionalTarget) { console.warn('THREE.Box2: .center() has been renamed to .getCenter().'); return this.getCenter(optionalTarget); }; - Box2.prototype.empty = function () { console.warn('THREE.Box2: .empty() has been renamed to .isEmpty().'); return this.isEmpty(); }; - Box2.prototype.isIntersectionBox = function (box) { console.warn('THREE.Box2: .isIntersectionBox() has been renamed to .intersectsBox().'); return this.intersectsBox(box); }; - Box2.prototype.size = function (optionalTarget) { console.warn('THREE.Box2: .size() has been renamed to .getSize().'); return this.getSize(optionalTarget); - }; // + }; + // Box3.prototype.center = function (optionalTarget) { console.warn('THREE.Box3: .center() has been renamed to .getCenter().'); return this.getCenter(optionalTarget); }; - Box3.prototype.empty = function () { console.warn('THREE.Box3: .empty() has been renamed to .isEmpty().'); return this.isEmpty(); }; - Box3.prototype.isIntersectionBox = function (box) { console.warn('THREE.Box3: .isIntersectionBox() has been renamed to .intersectsBox().'); return this.intersectsBox(box); }; - Box3.prototype.isIntersectionSphere = function (sphere) { console.warn('THREE.Box3: .isIntersectionSphere() has been renamed to .intersectsSphere().'); return this.intersectsSphere(sphere); }; - Box3.prototype.size = function (optionalTarget) { console.warn('THREE.Box3: .size() has been renamed to .getSize().'); return this.getSize(optionalTarget); - }; // + }; + // Sphere.prototype.empty = function () { console.warn('THREE.Sphere: .empty() has been renamed to .isEmpty().'); return this.isEmpty(); - }; // + }; + // Frustum.prototype.setFromMatrix = function (m) { console.warn('THREE.Frustum: .setFromMatrix() has been renamed to .setFromProjectionMatrix().'); return this.setFromProjectionMatrix(m); - }; // + }; + // Line3.prototype.center = function (optionalTarget) { console.warn('THREE.Line3: .center() has been renamed to .getCenter().'); return this.getCenter(optionalTarget); - }; // + }; + // Matrix3.prototype.flattenToArrayOffset = function (array, offset) { console.warn('THREE.Matrix3: .flattenToArrayOffset() has been deprecated. Use .toArray() instead.'); return this.toArray(array, offset); }; - Matrix3.prototype.multiplyVector3 = function (vector) { console.warn('THREE.Matrix3: .multiplyVector3() has been removed. Use vector.applyMatrix3( matrix ) instead.'); return vector.applyMatrix3(this); }; - - Matrix3.prototype.multiplyVector3Array = function - /* a */ + Matrix3.prototype.multiplyVector3Array = function /* a */ () { console.error('THREE.Matrix3: .multiplyVector3Array() has been removed.'); }; - Matrix3.prototype.applyToBufferAttribute = function (attribute) { console.warn('THREE.Matrix3: .applyToBufferAttribute() has been removed. Use attribute.applyMatrix3( matrix ) instead.'); return attribute.applyMatrix3(this); }; - - Matrix3.prototype.applyToVector3Array = function - /* array, offset, length */ + Matrix3.prototype.applyToVector3Array = function /* array, offset, length */ () { console.error('THREE.Matrix3: .applyToVector3Array() has been removed.'); }; - Matrix3.prototype.getInverse = function (matrix) { console.warn('THREE.Matrix3: .getInverse() has been removed. Use matrixInv.copy( matrix ).invert(); instead.'); return this.copy(matrix).invert(); - }; // + }; + // Matrix4.prototype.extractPosition = function (m) { console.warn('THREE.Matrix4: .extractPosition() has been renamed to .copyPosition().'); return this.copyPosition(m); }; - Matrix4.prototype.flattenToArrayOffset = function (array, offset) { console.warn('THREE.Matrix4: .flattenToArrayOffset() has been deprecated. Use .toArray() instead.'); return this.toArray(array, offset); }; - Matrix4.prototype.getPosition = function () { console.warn('THREE.Matrix4: .getPosition() has been removed. Use Vector3.setFromMatrixPosition( matrix ) instead.'); return new Vector3().setFromMatrixColumn(this, 3); }; - Matrix4.prototype.setRotationFromQuaternion = function (q) { console.warn('THREE.Matrix4: .setRotationFromQuaternion() has been renamed to .makeRotationFromQuaternion().'); return this.makeRotationFromQuaternion(q); }; - Matrix4.prototype.multiplyToArray = function () { console.warn('THREE.Matrix4: .multiplyToArray() has been removed.'); }; - Matrix4.prototype.multiplyVector3 = function (vector) { console.warn('THREE.Matrix4: .multiplyVector3() has been removed. Use vector.applyMatrix4( matrix ) instead.'); return vector.applyMatrix4(this); }; - Matrix4.prototype.multiplyVector4 = function (vector) { console.warn('THREE.Matrix4: .multiplyVector4() has been removed. Use vector.applyMatrix4( matrix ) instead.'); return vector.applyMatrix4(this); }; - - Matrix4.prototype.multiplyVector3Array = function - /* a */ + Matrix4.prototype.multiplyVector3Array = function /* a */ () { console.error('THREE.Matrix4: .multiplyVector3Array() has been removed.'); }; - Matrix4.prototype.rotateAxis = function (v) { console.warn('THREE.Matrix4: .rotateAxis() has been removed. Use Vector3.transformDirection( matrix ) instead.'); v.transformDirection(this); }; - Matrix4.prototype.crossVector = function (vector) { console.warn('THREE.Matrix4: .crossVector() has been removed. Use vector.applyMatrix4( matrix ) instead.'); return vector.applyMatrix4(this); }; - Matrix4.prototype.translate = function () { console.error('THREE.Matrix4: .translate() has been removed.'); }; - Matrix4.prototype.rotateX = function () { console.error('THREE.Matrix4: .rotateX() has been removed.'); }; - Matrix4.prototype.rotateY = function () { console.error('THREE.Matrix4: .rotateY() has been removed.'); }; - Matrix4.prototype.rotateZ = function () { console.error('THREE.Matrix4: .rotateZ() has been removed.'); }; - Matrix4.prototype.rotateByAxis = function () { console.error('THREE.Matrix4: .rotateByAxis() has been removed.'); }; - Matrix4.prototype.applyToBufferAttribute = function (attribute) { console.warn('THREE.Matrix4: .applyToBufferAttribute() has been removed. Use attribute.applyMatrix4( matrix ) instead.'); return attribute.applyMatrix4(this); }; - - Matrix4.prototype.applyToVector3Array = function - /* array, offset, length */ + Matrix4.prototype.applyToVector3Array = function /* array, offset, length */ () { console.error('THREE.Matrix4: .applyToVector3Array() has been removed.'); }; - Matrix4.prototype.makeFrustum = function (left, right, bottom, top, near, far) { console.warn('THREE.Matrix4: .makeFrustum() has been removed. Use .makePerspective( left, right, top, bottom, near, far ) instead.'); return this.makePerspective(left, right, top, bottom, near, far); }; - Matrix4.prototype.getInverse = function (matrix) { console.warn('THREE.Matrix4: .getInverse() has been removed. Use matrixInv.copy( matrix ).invert(); instead.'); return this.copy(matrix).invert(); - }; // + }; + // Plane.prototype.isIntersectionLine = function (line) { console.warn('THREE.Plane: .isIntersectionLine() has been renamed to .intersectsLine().'); return this.intersectsLine(line); - }; // + }; + // Quaternion.prototype.multiplyVector3 = function (vector) { console.warn('THREE.Quaternion: .multiplyVector3() has been removed. Use is now vector.applyQuaternion( quaternion ) instead.'); return vector.applyQuaternion(this); }; - Quaternion.prototype.inverse = function () { console.warn('THREE.Quaternion: .inverse() has been renamed to invert().'); return this.invert(); - }; // + }; + // Ray.prototype.isIntersectionBox = function (box) { console.warn('THREE.Ray: .isIntersectionBox() has been renamed to .intersectsBox().'); return this.intersectsBox(box); }; - Ray.prototype.isIntersectionPlane = function (plane) { console.warn('THREE.Ray: .isIntersectionPlane() has been renamed to .intersectsPlane().'); return this.intersectsPlane(plane); }; - Ray.prototype.isIntersectionSphere = function (sphere) { console.warn('THREE.Ray: .isIntersectionSphere() has been renamed to .intersectsSphere().'); return this.intersectsSphere(sphere); - }; // + }; + // Triangle.prototype.area = function () { console.warn('THREE.Triangle: .area() has been renamed to .getArea().'); return this.getArea(); }; - Triangle.prototype.barycoordFromPoint = function (point, target) { console.warn('THREE.Triangle: .barycoordFromPoint() has been renamed to .getBarycoord().'); return this.getBarycoord(point, target); }; - Triangle.prototype.midpoint = function (target) { console.warn('THREE.Triangle: .midpoint() has been renamed to .getMidpoint().'); return this.getMidpoint(target); }; - Triangle.prototypenormal = function (target) { console.warn('THREE.Triangle: .normal() has been renamed to .getNormal().'); return this.getNormal(target); }; - Triangle.prototype.plane = function (target) { console.warn('THREE.Triangle: .plane() has been renamed to .getPlane().'); return this.getPlane(target); }; - Triangle.barycoordFromPoint = function (point, a, b, c, target) { console.warn('THREE.Triangle: .barycoordFromPoint() has been renamed to .getBarycoord().'); return Triangle.getBarycoord(point, a, b, c, target); }; - Triangle.normal = function (a, b, c, target) { console.warn('THREE.Triangle: .normal() has been renamed to .getNormal().'); return Triangle.getNormal(a, b, c, target); - }; // + }; + // Shape.prototype.extractAllPoints = function (divisions) { console.warn('THREE.Shape: .extractAllPoints() has been removed. Use .extractPoints() instead.'); return this.extractPoints(divisions); }; - Shape.prototype.extrude = function (options) { console.warn('THREE.Shape: .extrude() has been removed. Use ExtrudeGeometry() instead.'); return new ExtrudeGeometry(this, options); }; - Shape.prototype.makeGeometry = function (options) { console.warn('THREE.Shape: .makeGeometry() has been removed. Use ShapeGeometry() instead.'); return new ShapeGeometry(this, options); - }; // + }; + // Vector2.prototype.fromAttribute = function (attribute, index, offset) { console.warn('THREE.Vector2: .fromAttribute() has been renamed to .fromBufferAttribute().'); return this.fromBufferAttribute(attribute, index, offset); }; - Vector2.prototype.distanceToManhattan = function (v) { console.warn('THREE.Vector2: .distanceToManhattan() has been renamed to .manhattanDistanceTo().'); return this.manhattanDistanceTo(v); }; - Vector2.prototype.lengthManhattan = function () { console.warn('THREE.Vector2: .lengthManhattan() has been renamed to .manhattanLength().'); return this.manhattanLength(); - }; // + }; + // Vector3.prototype.setEulerFromRotationMatrix = function () { console.error('THREE.Vector3: .setEulerFromRotationMatrix() has been removed. Use Euler.setFromRotationMatrix() instead.'); }; - Vector3.prototype.setEulerFromQuaternion = function () { console.error('THREE.Vector3: .setEulerFromQuaternion() has been removed. Use Euler.setFromQuaternion() instead.'); }; - Vector3.prototype.getPositionFromMatrix = function (m) { console.warn('THREE.Vector3: .getPositionFromMatrix() has been renamed to .setFromMatrixPosition().'); return this.setFromMatrixPosition(m); }; - Vector3.prototype.getScaleFromMatrix = function (m) { console.warn('THREE.Vector3: .getScaleFromMatrix() has been renamed to .setFromMatrixScale().'); return this.setFromMatrixScale(m); }; - Vector3.prototype.getColumnFromMatrix = function (index, matrix) { console.warn('THREE.Vector3: .getColumnFromMatrix() has been renamed to .setFromMatrixColumn().'); return this.setFromMatrixColumn(matrix, index); }; - Vector3.prototype.applyProjection = function (m) { console.warn('THREE.Vector3: .applyProjection() has been removed. Use .applyMatrix4( m ) instead.'); return this.applyMatrix4(m); }; - Vector3.prototype.fromAttribute = function (attribute, index, offset) { console.warn('THREE.Vector3: .fromAttribute() has been renamed to .fromBufferAttribute().'); return this.fromBufferAttribute(attribute, index, offset); }; - Vector3.prototype.distanceToManhattan = function (v) { console.warn('THREE.Vector3: .distanceToManhattan() has been renamed to .manhattanDistanceTo().'); return this.manhattanDistanceTo(v); }; - Vector3.prototype.lengthManhattan = function () { console.warn('THREE.Vector3: .lengthManhattan() has been renamed to .manhattanLength().'); return this.manhattanLength(); - }; // + }; + // Vector4.prototype.fromAttribute = function (attribute, index, offset) { console.warn('THREE.Vector4: .fromAttribute() has been renamed to .fromBufferAttribute().'); return this.fromBufferAttribute(attribute, index, offset); }; - Vector4.prototype.lengthManhattan = function () { console.warn('THREE.Vector4: .lengthManhattan() has been renamed to .manhattanLength().'); return this.manhattanLength(); - }; // + }; + // Object3D.prototype.getChildByName = function (name) { console.warn('THREE.Object3D: .getChildByName() has been renamed to .getObjectByName().'); return this.getObjectByName(name); }; - Object3D.prototype.renderDepth = function () { console.warn('THREE.Object3D: .renderDepth has been removed. Use .renderOrder, instead.'); }; - Object3D.prototype.translate = function (distance, axis) { console.warn('THREE.Object3D: .translate() has been removed. Use .translateOnAxis( axis, distance ) instead.'); return this.translateOnAxis(axis, distance); }; - Object3D.prototype.getWorldRotation = function () { console.error('THREE.Object3D: .getWorldRotation() has been removed. Use THREE.Object3D.getWorldQuaternion( target ) instead.'); }; - Object3D.prototype.applyMatrix = function (matrix) { console.warn('THREE.Object3D: .applyMatrix() has been renamed to .applyMatrix4().'); return this.applyMatrix4(matrix); }; - Object.defineProperties(Object3D.prototype, { eulerOrder: { get: function () { @@ -36235,11 +32423,9 @@ } } }); - Mesh.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(Mesh.prototype, { drawMode: { get: function () { @@ -36251,18 +32437,19 @@ } } }); - SkinnedMesh.prototype.initBones = function () { console.error('THREE.SkinnedMesh: initBones() has been removed.'); - }; // + }; + // PerspectiveCamera.prototype.setLens = function (focalLength, filmGauge) { console.warn('THREE.PerspectiveCamera.setLens is deprecated. ' + 'Use .setFocalLength and .filmGauge for a photographic setup.'); if (filmGauge !== undefined) this.filmGauge = filmGauge; this.setFocalLength(focalLength); - }; // + }; + // Object.defineProperties(Light.prototype, { onlyShadow: { @@ -36340,7 +32527,9 @@ this.shadow.mapSize.height = value; } } - }); // + }); + + // Object.defineProperties(BufferAttribute.prototype, { length: { @@ -36354,81 +32543,67 @@ console.warn('THREE.BufferAttribute: .dynamic has been deprecated. Use .usage instead.'); return this.usage === DynamicDrawUsage; }, - set: function - /* value */ + set: function /* value */ () { console.warn('THREE.BufferAttribute: .dynamic has been deprecated. Use .usage instead.'); this.setUsage(DynamicDrawUsage); } } }); - BufferAttribute.prototype.setDynamic = function (value) { console.warn('THREE.BufferAttribute: .setDynamic() has been deprecated. Use .setUsage() instead.'); this.setUsage(value === true ? DynamicDrawUsage : StaticDrawUsage); return this; }; - - BufferAttribute.prototype.copyIndicesArray = function - /* indices */ + BufferAttribute.prototype.copyIndicesArray = function /* indices */ () { console.error('THREE.BufferAttribute: .copyIndicesArray() has been removed.'); - }, BufferAttribute.prototype.setArray = function - /* array */ + }, BufferAttribute.prototype.setArray = function /* array */ () { console.error('THREE.BufferAttribute: .setArray has been removed. Use BufferGeometry .setAttribute to replace/resize attribute buffers'); - }; // + }; + + // BufferGeometry.prototype.addIndex = function (index) { console.warn('THREE.BufferGeometry: .addIndex() has been renamed to .setIndex().'); this.setIndex(index); }; - BufferGeometry.prototype.addAttribute = function (name, attribute) { console.warn('THREE.BufferGeometry: .addAttribute() has been renamed to .setAttribute().'); - if (!(attribute && attribute.isBufferAttribute) && !(attribute && attribute.isInterleavedBufferAttribute)) { console.warn('THREE.BufferGeometry: .addAttribute() now expects ( name, attribute ).'); return this.setAttribute(name, new BufferAttribute(arguments[1], arguments[2])); } - if (name === 'index') { console.warn('THREE.BufferGeometry.addAttribute: Use .setIndex() for index attribute.'); this.setIndex(attribute); return this; } - return this.setAttribute(name, attribute); }; - BufferGeometry.prototype.addDrawCall = function (start, count, indexOffset) { if (indexOffset !== undefined) { console.warn('THREE.BufferGeometry: .addDrawCall() no longer supports indexOffset.'); } - console.warn('THREE.BufferGeometry: .addDrawCall() is now .addGroup().'); this.addGroup(start, count); }; - BufferGeometry.prototype.clearDrawCalls = function () { console.warn('THREE.BufferGeometry: .clearDrawCalls() is now .clearGroups().'); this.clearGroups(); }; - BufferGeometry.prototype.computeOffsets = function () { console.warn('THREE.BufferGeometry: .computeOffsets() has been removed.'); }; - BufferGeometry.prototype.removeAttribute = function (name) { console.warn('THREE.BufferGeometry: .removeAttribute() has been renamed to .deleteAttribute().'); return this.deleteAttribute(name); }; - BufferGeometry.prototype.applyMatrix = function (matrix) { console.warn('THREE.BufferGeometry: .applyMatrix() has been renamed to .applyMatrix4().'); return this.applyMatrix4(matrix); }; - Object.defineProperties(BufferGeometry.prototype, { drawcalls: { get: function () { @@ -36443,43 +32618,42 @@ } } }); - InterleavedBuffer.prototype.setDynamic = function (value) { console.warn('THREE.InterleavedBuffer: .setDynamic() has been deprecated. Use .setUsage() instead.'); this.setUsage(value === true ? DynamicDrawUsage : StaticDrawUsage); return this; }; - - InterleavedBuffer.prototype.setArray = function - /* array */ + InterleavedBuffer.prototype.setArray = function /* array */ () { console.error('THREE.InterleavedBuffer: .setArray has been removed. Use BufferGeometry .setAttribute to replace/resize attribute buffers'); - }; // + }; + // ExtrudeGeometry.prototype.getArrays = function () { console.error('THREE.ExtrudeGeometry: .getArrays() has been removed.'); }; - ExtrudeGeometry.prototype.addShapeList = function () { console.error('THREE.ExtrudeGeometry: .addShapeList() has been removed.'); }; - ExtrudeGeometry.prototype.addShape = function () { console.error('THREE.ExtrudeGeometry: .addShape() has been removed.'); - }; // + }; + // Scene.prototype.dispose = function () { console.error('THREE.Scene: .dispose() has been removed.'); - }; // + }; + // Uniform.prototype.onUpdate = function () { console.warn('THREE.Uniform: .onUpdate() has been removed. Use object.onBeforeRender() instead.'); return this; - }; // + }; + // Object.defineProperties(Material.prototype, { wrapAround: { @@ -36543,125 +32717,102 @@ this.extensions.derivatives = value; } } - }); // + }); + + // WebGLRenderer.prototype.clearTarget = function (renderTarget, color, depth, stencil) { console.warn('THREE.WebGLRenderer: .clearTarget() has been deprecated. Use .setRenderTarget() and .clear() instead.'); this.setRenderTarget(renderTarget); this.clear(color, depth, stencil); }; - WebGLRenderer.prototype.animate = function (callback) { console.warn('THREE.WebGLRenderer: .animate() is now .setAnimationLoop().'); this.setAnimationLoop(callback); }; - WebGLRenderer.prototype.getCurrentRenderTarget = function () { console.warn('THREE.WebGLRenderer: .getCurrentRenderTarget() is now .getRenderTarget().'); return this.getRenderTarget(); }; - WebGLRenderer.prototype.getMaxAnisotropy = function () { console.warn('THREE.WebGLRenderer: .getMaxAnisotropy() is now .capabilities.getMaxAnisotropy().'); return this.capabilities.getMaxAnisotropy(); }; - WebGLRenderer.prototype.getPrecision = function () { console.warn('THREE.WebGLRenderer: .getPrecision() is now .capabilities.precision.'); return this.capabilities.precision; }; - WebGLRenderer.prototype.resetGLState = function () { console.warn('THREE.WebGLRenderer: .resetGLState() is now .state.reset().'); return this.state.reset(); }; - WebGLRenderer.prototype.supportsFloatTextures = function () { console.warn('THREE.WebGLRenderer: .supportsFloatTextures() is now .extensions.get( \'OES_texture_float\' ).'); return this.extensions.get('OES_texture_float'); }; - WebGLRenderer.prototype.supportsHalfFloatTextures = function () { console.warn('THREE.WebGLRenderer: .supportsHalfFloatTextures() is now .extensions.get( \'OES_texture_half_float\' ).'); return this.extensions.get('OES_texture_half_float'); }; - WebGLRenderer.prototype.supportsStandardDerivatives = function () { console.warn('THREE.WebGLRenderer: .supportsStandardDerivatives() is now .extensions.get( \'OES_standard_derivatives\' ).'); return this.extensions.get('OES_standard_derivatives'); }; - WebGLRenderer.prototype.supportsCompressedTextureS3TC = function () { console.warn('THREE.WebGLRenderer: .supportsCompressedTextureS3TC() is now .extensions.get( \'WEBGL_compressed_texture_s3tc\' ).'); return this.extensions.get('WEBGL_compressed_texture_s3tc'); }; - WebGLRenderer.prototype.supportsCompressedTexturePVRTC = function () { console.warn('THREE.WebGLRenderer: .supportsCompressedTexturePVRTC() is now .extensions.get( \'WEBGL_compressed_texture_pvrtc\' ).'); return this.extensions.get('WEBGL_compressed_texture_pvrtc'); }; - WebGLRenderer.prototype.supportsBlendMinMax = function () { console.warn('THREE.WebGLRenderer: .supportsBlendMinMax() is now .extensions.get( \'EXT_blend_minmax\' ).'); return this.extensions.get('EXT_blend_minmax'); }; - WebGLRenderer.prototype.supportsVertexTextures = function () { console.warn('THREE.WebGLRenderer: .supportsVertexTextures() is now .capabilities.vertexTextures.'); return this.capabilities.vertexTextures; }; - WebGLRenderer.prototype.supportsInstancedArrays = function () { console.warn('THREE.WebGLRenderer: .supportsInstancedArrays() is now .extensions.get( \'ANGLE_instanced_arrays\' ).'); return this.extensions.get('ANGLE_instanced_arrays'); }; - WebGLRenderer.prototype.enableScissorTest = function (boolean) { console.warn('THREE.WebGLRenderer: .enableScissorTest() is now .setScissorTest().'); this.setScissorTest(boolean); }; - WebGLRenderer.prototype.initMaterial = function () { console.warn('THREE.WebGLRenderer: .initMaterial() has been removed.'); }; - WebGLRenderer.prototype.addPrePlugin = function () { console.warn('THREE.WebGLRenderer: .addPrePlugin() has been removed.'); }; - WebGLRenderer.prototype.addPostPlugin = function () { console.warn('THREE.WebGLRenderer: .addPostPlugin() has been removed.'); }; - WebGLRenderer.prototype.updateShadowMap = function () { console.warn('THREE.WebGLRenderer: .updateShadowMap() has been removed.'); }; - WebGLRenderer.prototype.setFaceCulling = function () { console.warn('THREE.WebGLRenderer: .setFaceCulling() has been removed.'); }; - WebGLRenderer.prototype.allocTextureUnit = function () { console.warn('THREE.WebGLRenderer: .allocTextureUnit() has been removed.'); }; - WebGLRenderer.prototype.setTexture = function () { console.warn('THREE.WebGLRenderer: .setTexture() has been removed.'); }; - WebGLRenderer.prototype.setTexture2D = function () { console.warn('THREE.WebGLRenderer: .setTexture2D() has been removed.'); }; - WebGLRenderer.prototype.setTextureCube = function () { console.warn('THREE.WebGLRenderer: .setTextureCube() has been removed.'); }; - WebGLRenderer.prototype.getActiveMipMapLevel = function () { console.warn('THREE.WebGLRenderer: .getActiveMipMapLevel() is now .getActiveMipmapLevel().'); return this.getActiveMipmapLevel(); }; - Object.defineProperties(WebGLRenderer.prototype, { shadowMapEnabled: { get: function () { @@ -36686,8 +32837,7 @@ console.warn('THREE.WebGLRenderer: .shadowMapCullFace has been removed. Set Material.shadowSide instead.'); return undefined; }, - set: function - /* value */ + set: function /* value */ () { console.warn('THREE.WebGLRenderer: .shadowMapCullFace has been removed. Set Material.shadowSide instead.'); } @@ -36748,8 +32898,7 @@ console.warn('THREE.WebGLRenderer: .shadowMap.cullFace has been removed. Set Material.shadowSide instead.'); return undefined; }, - set: function - /* cullFace */ + set: function /* cullFace */ () { console.warn('THREE.WebGLRenderer: .shadowMap.cullFace has been removed. Set Material.shadowSide instead.'); } @@ -36776,7 +32925,9 @@ function WebGLRenderTargetCube(width, height, options) { console.warn('THREE.WebGLRenderTargetCube( width, height, options ) is now WebGLCubeRenderTarget( size, options ).'); return new WebGLCubeRenderTarget(width, options); - } // + } + + // Object.defineProperties(WebGLRenderTarget.prototype, { wrapS: { @@ -36879,7 +33030,9 @@ this.texture.generateMipmaps = value; } } - }); // + }); + + // Audio.prototype.load = function (file) { console.warn('THREE.Audio: .load has been deprecated. Use THREE.AudioLoader instead.'); @@ -36890,25 +33043,22 @@ }); return this; }; - AudioAnalyser.prototype.getData = function () { console.warn('THREE.AudioAnalyser: .getData() is now .getFrequencyData().'); return this.getFrequencyData(); - }; // + }; + // CubeCamera.prototype.updateCubeMap = function (renderer, scene) { console.warn('THREE.CubeCamera: .updateCubeMap() is now .update().'); return this.update(renderer, scene); }; - CubeCamera.prototype.clear = function (renderer, color, depth, stencil) { console.warn('THREE.CubeCamera: .clear() is now .renderTarget.clear().'); return this.renderTarget.clear(renderer, color, depth, stencil); }; - ImageUtils.crossOrigin = undefined; - ImageUtils.loadTexture = function (url, mapping, onLoad, onError) { console.warn('THREE.ImageUtils.loadTexture has been deprecated. Use THREE.TextureLoader() instead.'); const loader = new TextureLoader(); @@ -36917,7 +33067,6 @@ if (mapping) texture.mapping = mapping; return texture; }; - ImageUtils.loadTextureCube = function (urls, mapping, onLoad, onError) { console.warn('THREE.ImageUtils.loadTextureCube has been deprecated. Use THREE.CubeTextureLoader() instead.'); const loader = new CubeTextureLoader(); @@ -36926,45 +33075,49 @@ if (mapping) texture.mapping = mapping; return texture; }; - ImageUtils.loadCompressedTexture = function () { console.error('THREE.ImageUtils.loadCompressedTexture has been removed. Use THREE.DDSLoader instead.'); }; - ImageUtils.loadCompressedTextureCube = function () { console.error('THREE.ImageUtils.loadCompressedTextureCube has been removed. Use THREE.DDSLoader instead.'); - }; // + }; + // function CanvasRenderer() { console.error('THREE.CanvasRenderer has been removed'); - } // + } + + // function JSONLoader() { console.error('THREE.JSONLoader has been removed.'); - } // + } + + // const SceneUtils = { - createMultiMaterialObject: function - /* geometry, materials */ + createMultiMaterialObject: function /* geometry, materials */ () { console.error('THREE.SceneUtils has been moved to /examples/jsm/utils/SceneUtils.js'); }, - detach: function - /* child, parent, scene */ + detach: function /* child, parent, scene */ () { console.error('THREE.SceneUtils has been moved to /examples/jsm/utils/SceneUtils.js'); }, - attach: function - /* child, scene, parent */ + attach: function /* child, scene, parent */ () { console.error('THREE.SceneUtils has been moved to /examples/jsm/utils/SceneUtils.js'); } - }; // + }; + + // function LensFlare() { console.error('THREE.LensFlare has been moved to /examples/jsm/objects/Lensflare.js'); - } // + } + + // function ParametricGeometry() { console.error('THREE.ParametricGeometry has been moved to /examples/jsm/geometries/ParametricGeometry.js'); @@ -36997,7 +33150,6 @@ } })); } - if (typeof window !== 'undefined') { if (window.__THREE__) { console.warn('WARNING: Multiple instances of Three.js being imported.'); diff --git a/build/three.min.js b/build/three.min.js index 8a09b397566896..a40cc57475388d 100644 --- a/build/three.min.js +++ b/build/three.min.js @@ -3,4 +3,4 @@ * Copyright 2010-2022 Three.js Authors * SPDX-License-Identifier: MIT */ -!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports):"function"==typeof define&&define.amd?define(["exports"],e):e((t="undefined"!=typeof globalThis?globalThis:t||self).THREE={})}(this,(function(t){"use strict";const e="137",n=100,i=300,r=301,s=302,a=303,o=304,l=306,c=307,h=1e3,u=1001,d=1002,p=1003,m=1004,f=1005,g=1006,v=1007,x=1008,y=1009,_=1012,M=1014,b=1015,w=1016,S=1020,T=1023,E=1026,A=1027,R=33776,C=33777,L=33778,P=33779,I=35840,D=35841,N=35842,O=35843,B=37492,z=37496,F=37808,U=37809,H=37810,G=37811,V=37812,k=37813,W=37814,j=37815,q=37816,X=37817,Y=37818,J=37819,Z=37820,K=37821,Q=36492,$=2300,tt=2301,et=2302,nt=2400,it=2401,rt=2402,st=2500,at=2501,ot=3e3,lt=3001,ct=3002,ht=7680,ut=35044,dt=35048,pt="300 es",mt={updateplatform(t){this.AudioContext=t.AudioContext,this.fetch=t.fetch,this.Request=t.Request,this.Headers=t.Headers,this.createElementNS=t.createElementNS,this.animationContext={requestAnimationFrame:t.requestAnimationFrame,cancelAnimationFrame:t.cancelAnimationFrame},this.devicePixelRatio=t.devicePixelRatio},setProperties(t){this.properties=Object.assign(this.properties||{},t)}};"undefined"!=typeof window&&void 0!==window.window&&(window.AudioContext||window.webkitAudioContext)&&window.fetch&&window.Request&&window.Headers&&document.createElementNS&&window.requestAnimationFrame&&window.cancelAnimationFrame&&void 0!==window.devicePixelRatio&&mt.updateplatform({AudioContext:(window.AudioContext||window.webkitAudioContext).bind(window),fetch:window.fetch.bind(window),Request:window.Request.bind(window),Headers:window.Headers.bind(window),createElementNS:document.createElementNS.bind(document),requestAnimationFrame:window.requestAnimationFrame.bind(window),cancelAnimationFrame:window.cancelAnimationFrame.bind(window),devicePixelRatio:()=>window.devicePixelRatio});class ft{addEventListener(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(t,e){if(void 0===this._listeners)return!1;const n=this._listeners;return void 0!==n[t]&&-1!==n[t].indexOf(e)}removeEventListener(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(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,i=n.length;e>8&255]+gt[t>>16&255]+gt[t>>24&255]+"-"+gt[255&e]+gt[e>>8&255]+"-"+gt[e>>16&15|64]+gt[e>>24&255]+"-"+gt[63&n|128]+gt[n>>8&255]+"-"+gt[n>>16&255]+gt[n>>24&255]+gt[255&i]+gt[i>>8&255]+gt[i>>16&255]+gt[i>>24&255]).toUpperCase()}function Mt(t,e,n){return Math.max(e,Math.min(n,t))}function bt(t,e){return(t%e+e)%e}function wt(t,e,n){return(1-n)*t+n*e}function St(t){return 0==(t&t-1)&&0!==t}function Tt(t){return Math.pow(2,Math.ceil(Math.log(t)/Math.LN2))}function Et(t){return Math.pow(2,Math.floor(Math.log(t)/Math.LN2))}var At=Object.freeze({__proto__:null,DEG2RAD:xt,RAD2DEG:yt,generateUUID:_t,clamp:Mt,euclideanModulo:bt,mapLinear:function(t,e,n,i,r){return i+(t-e)*(r-i)/(n-e)},inverseLerp:function(t,e,n){return t!==e?(n-t)/(e-t):0},lerp:wt,damp:function(t,e,n,i){return wt(t,e,1-Math.exp(-n*i))},pingpong:function(t,e=1){return e-Math.abs(bt(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&&(vt=t%2147483647),vt=16807*vt%2147483647,(vt-1)/2147483646},degToRad:function(t){return t*xt},radToDeg:function(t){return t*yt},isPowerOfTwo:St,ceilPowerOfTwo:Tt,floorPowerOfTwo:Et,setQuaternionFromProperEuler:function(t,e,n,i,r){const s=Math.cos,a=Math.sin,o=s(n/2),l=a(n/2),c=s((e+i)/2),h=a((e+i)/2),u=s((e-i)/2),d=a((e-i)/2),p=s((i-e)/2),m=a((i-e)/2);switch(r){case"XYX":t.set(o*h,l*u,l*d,o*c);break;case"YZY":t.set(l*d,o*h,l*u,o*c);break;case"ZXZ":t.set(l*u,l*d,o*h,o*c);break;case"XZX":t.set(o*h,l*m,l*p,o*c);break;case"YXY":t.set(l*p,o*h,l*m,o*c);break;case"ZYZ":t.set(l*m,l*p,o*h,o*c);break;default:console.warn("THREE.MathUtils: .setQuaternionFromProperEuler() encountered an unknown order: "+r)}}});class Rt{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,i=t.elements;return this.x=i[0]*e+i[3]*n+i[6],this.y=i[1]*e+i[4]*n+i[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),i=Math.sin(e),r=this.x-t.x,s=this.y-t.y;return this.x=r*n-s*i+t.x,this.y=r*i+s*n+t.y,this}random(){return this.x=Math.random(),this.y=Math.random(),this}*[Symbol.iterator](){yield this.x,yield this.y}}Rt.prototype.isVector2=!0;class Ct{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,i,r,s,a,o,l){const c=this.elements;return c[0]=t,c[1]=i,c[2]=a,c[3]=e,c[4]=r,c[5]=o,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,i=e.elements,r=this.elements,s=n[0],a=n[3],o=n[6],l=n[1],c=n[4],h=n[7],u=n[2],d=n[5],p=n[8],m=i[0],f=i[3],g=i[6],v=i[1],x=i[4],y=i[7],_=i[2],M=i[5],b=i[8];return r[0]=s*m+a*v+o*_,r[3]=s*f+a*x+o*M,r[6]=s*g+a*y+o*b,r[1]=l*m+c*v+h*_,r[4]=l*f+c*x+h*M,r[7]=l*g+c*y+h*b,r[2]=u*m+d*v+p*_,r[5]=u*f+d*x+p*M,r[8]=u*g+d*y+p*b,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],i=t[2],r=t[3],s=t[4],a=t[5],o=t[6],l=t[7],c=t[8];return e*s*c-e*a*l-n*r*c+n*a*o+i*r*l-i*s*o}invert(){const t=this.elements,e=t[0],n=t[1],i=t[2],r=t[3],s=t[4],a=t[5],o=t[6],l=t[7],c=t[8],h=c*s-a*l,u=a*o-c*r,d=l*r-s*o,p=e*h+n*u+i*d;if(0===p)return this.set(0,0,0,0,0,0,0,0,0);const m=1/p;return t[0]=h*m,t[1]=(i*l-c*n)*m,t[2]=(a*n-i*s)*m,t[3]=u*m,t[4]=(c*e-i*o)*m,t[5]=(i*r-a*e)*m,t[6]=d*m,t[7]=(n*o-l*e)*m,t[8]=(s*e-n*r)*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,i,r,s,a){const o=Math.cos(r),l=Math.sin(r);return this.set(n*o,n*l,-n*(o*s+l*a)+s+t,-i*l,i*o,-i*(-l*s+o*a)+a+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),i=this.elements,r=i[0],s=i[3],a=i[6],o=i[1],l=i[4],c=i[7];return i[0]=e*r+n*o,i[3]=e*s+n*l,i[6]=e*a+n*c,i[1]=-n*r+e*o,i[4]=-n*s+e*l,i[7]=-n*a+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 t=0;t<9;t++)if(e[t]!==n[t])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)}}function Lt(t){for(let e=t.length-1;e>=0;--e)if(t[e]>65535)return!0;return!1}Ct.prototype.isMatrix3=!0;const Pt={Int8Array:Int8Array,Uint8Array:Uint8Array,Uint8ClampedArray:Uint8ClampedArray,Int16Array:Int16Array,Uint16Array:Uint16Array,Int32Array:Int32Array,Uint32Array:Uint32Array,Float32Array:Float32Array,Float64Array:Float64Array};function It(t,e){return new Pt[t](e)}function Dt(t){return mt.createElementNS("http://www.w3.org/1999/xhtml",t)}let Nt;class Ot{static getDataURL(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===Nt&&(Nt=Dt("canvas")),Nt.width=t.width,Nt.height=t.height;const n=Nt.getContext("2d");t instanceof ImageData?n.putImageData(t,0,0):n.drawImage(t,0,0,t.width,t.height),e=Nt}return e.width>2048||e.height>2048?(console.warn("THREE.ImageUtils.getDataURL: Image converted to jpg for performance reasons",t),e.toDataURL("image/jpeg",.6)):e.toDataURL("image/png")}}let Bt=0;class zt extends ft{constructor(t=zt.DEFAULT_IMAGE,e=zt.DEFAULT_MAPPING,n=1001,i=1001,r=1006,s=1008,a=1023,o=1009,l=1,c=3e3){super(),Object.defineProperty(this,"id",{value:Bt++}),this.uuid=_t(),this.name="",this.image=t,this.mipmaps=[],this.mapping=e,this.wrapS=n,this.wrapT=i,this.magFilter=r,this.minFilter=s,this.anisotropy=l,this.format=a,this.internalFormat=null,this.type=o,this.offset=new Rt(0,0),this.repeat=new Rt(1,1),this.center=new Rt(0,0),this.rotation=0,this.matrixAutoUpdate=!0,this.matrix=new Ct,this.generateMipmaps=!0,this.premultiplyAlpha=!1,this.flipY=!0,this.unpackAlignment=4,this.encoding=c,this.userData={},this.version=0,this.onUpdate=null,this.isRenderTargetTexture=!1,this.needsPMREMUpdate=!1,this.sRGBToLinearWithShader=!zt.useSrgbTextures}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.userData=JSON.parse(JSON.stringify(t.userData)),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 i=this.image;if(void 0===i.uuid&&(i.uuid=_t()),!e&&void 0===t.images[i.uuid]){let e;if(Array.isArray(i)){e=[];for(let t=0,n=i.length;t1)switch(this.wrapS){case h:t.x=t.x-Math.floor(t.x);break;case u:t.x=t.x<0?0:1;break;case d: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 h:t.y=t.y-Math.floor(t.y);break;case u:t.y=t.y<0?0:1;break;case d: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 Ft(t){return"undefined"!=typeof HTMLImageElement&&t instanceof HTMLImageElement||"undefined"!=typeof HTMLCanvasElement&&t instanceof HTMLCanvasElement||"undefined"!=typeof ImageBitmap&&t instanceof ImageBitmap?Ot.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."),{})}zt.DEFAULT_IMAGE=void 0,zt.DEFAULT_MAPPING=i,zt.useSrgbTextures=!0,zt.prototype.isTexture=!0;class Ut{constructor(t=0,e=0,n=0,i=1){this.x=t,this.y=e,this.z=n,this.w=i}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,i){return this.x=t,this.y=e,this.z=n,this.w=i,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}applyQuaternion(t){const e=this.x,n=this.y,i=this.z,r=this.w,s=t.x,a=t.y,o=t.z,l=t.w,c=l*e+a*i-o*n,h=l*n+o*e-s*i,u=l*i+s*n-a*e,d=-s*e-a*n-o*i;return this.x=c*l+d*-s+h*-o-u*-a,this.y=h*l+d*-a+u*-s-c*-o,this.z=u*l+d*-o+c*-a-h*-s,this.w=r,this}applyMatrix4(t){const e=this.x,n=this.y,i=this.z,r=this.w,s=t.elements;return this.x=s[0]*e+s[4]*n+s[8]*i+s[12]*r,this.y=s[1]*e+s[5]*n+s[9]*i+s[13]*r,this.z=s[2]*e+s[6]*n+s[10]*i+s[14]*r,this.w=s[3]*e+s[7]*n+s[11]*i+s[15]*r,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,i,r;const s=.01,a=.1,o=t.elements,l=o[0],c=o[4],h=o[8],u=o[1],d=o[5],p=o[9],m=o[2],f=o[6],g=o[10];if(Math.abs(c-u)o&&t>v?tv?o=0?1:-1,i=1-e*e;if(i>Number.EPSILON){const r=Math.sqrt(i),s=Math.atan2(r,e*n);t=Math.sin(t*s)/r,a=Math.sin(a*s)/r}const r=a*n;if(o=o*t+u*r,l=l*t+d*r,c=c*t+p*r,h=h*t+m*r,t===1-a){const t=1/Math.sqrt(o*o+l*l+c*c+h*h);o*=t,l*=t,c*=t,h*=t}}t[e]=o,t[e+1]=l,t[e+2]=c,t[e+3]=h}static multiplyQuaternionsFlat(t,e,n,i,r,s){const a=n[i],o=n[i+1],l=n[i+2],c=n[i+3],h=r[s],u=r[s+1],d=r[s+2],p=r[s+3];return t[e]=a*p+c*h+o*d-l*u,t[e+1]=o*p+c*u+l*h-a*d,t[e+2]=l*p+c*d+a*u-o*h,t[e+3]=c*p-a*h-o*u-l*d,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,i){return this._x=t,this._y=e,this._z=n,this._w=i,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,i=t._y,r=t._z,s=t._order,a=Math.cos,o=Math.sin,l=a(n/2),c=a(i/2),h=a(r/2),u=o(n/2),d=o(i/2),p=o(r/2);switch(s){case"XYZ":this._x=u*c*h+l*d*p,this._y=l*d*h-u*c*p,this._z=l*c*p+u*d*h,this._w=l*c*h-u*d*p;break;case"YXZ":this._x=u*c*h+l*d*p,this._y=l*d*h-u*c*p,this._z=l*c*p-u*d*h,this._w=l*c*h+u*d*p;break;case"ZXY":this._x=u*c*h-l*d*p,this._y=l*d*h+u*c*p,this._z=l*c*p+u*d*h,this._w=l*c*h-u*d*p;break;case"ZYX":this._x=u*c*h-l*d*p,this._y=l*d*h+u*c*p,this._z=l*c*p-u*d*h,this._w=l*c*h+u*d*p;break;case"YZX":this._x=u*c*h+l*d*p,this._y=l*d*h+u*c*p,this._z=l*c*p-u*d*h,this._w=l*c*h-u*d*p;break;case"XZY":this._x=u*c*h-l*d*p,this._y=l*d*h-u*c*p,this._z=l*c*p+u*d*h,this._w=l*c*h+u*d*p;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,i=Math.sin(n);return this._x=t.x*i,this._y=t.y*i,this._z=t.z*i,this._w=Math.cos(n),this._onChangeCallback(),this}setFromRotationMatrix(t){const e=t.elements,n=e[0],i=e[4],r=e[8],s=e[1],a=e[5],o=e[9],l=e[2],c=e[6],h=e[10],u=n+a+h;if(u>0){const t=.5/Math.sqrt(u+1);this._w=.25/t,this._x=(c-o)*t,this._y=(r-l)*t,this._z=(s-i)*t}else if(n>a&&n>h){const t=2*Math.sqrt(1+n-a-h);this._w=(c-o)/t,this._x=.25*t,this._y=(i+s)/t,this._z=(r+l)/t}else if(a>h){const t=2*Math.sqrt(1+a-n-h);this._w=(r-l)/t,this._x=(i+s)/t,this._y=.25*t,this._z=(o+c)/t}else{const t=2*Math.sqrt(1+h-n-a);this._w=(s-i)/t,this._x=(r+l)/t,this._y=(o+c)/t,this._z=.25*t}return this._onChangeCallback(),this}setFromUnitVectors(t,e){let n=t.dot(e)+1;return nMath.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(Mt(this.dot(t),-1,1)))}rotateTowards(t,e){const n=this.angleTo(t);if(0===n)return this;const i=Math.min(1,e/n);return this.slerp(t,i),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,i=t._y,r=t._z,s=t._w,a=e._x,o=e._y,l=e._z,c=e._w;return this._x=n*c+s*a+i*l-r*o,this._y=i*c+s*o+r*a-n*l,this._z=r*c+s*l+n*o-i*a,this._w=s*c-n*a-i*o-r*l,this._onChangeCallback(),this}slerp(t,e){if(0===e)return this;if(1===e)return this.copy(t);const n=this._x,i=this._y,r=this._z,s=this._w;let a=s*t._w+n*t._x+i*t._y+r*t._z;if(a<0?(this._w=-t._w,this._x=-t._x,this._y=-t._y,this._z=-t._z,a=-a):this.copy(t),a>=1)return this._w=s,this._x=n,this._y=i,this._z=r,this;const o=1-a*a;if(o<=Number.EPSILON){const t=1-e;return this._w=t*s+e*this._w,this._x=t*n+e*this._x,this._y=t*i+e*this._y,this._z=t*r+e*this._z,this.normalize(),this._onChangeCallback(),this}const l=Math.sqrt(o),c=Math.atan2(l,a),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=i*h+this._y*u,this._z=r*h+this._z*u,this._onChangeCallback(),this}slerpQuaternions(t,e,n){return this.copy(t).slerp(e,n)}random(){const t=Math.random(),e=Math.sqrt(1-t),n=Math.sqrt(t),i=2*Math.PI*Math.random(),r=2*Math.PI*Math.random();return this.set(e*Math.cos(i),n*Math.sin(r),n*Math.cos(r),e*Math.sin(i))}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(){}}Vt.prototype.isQuaternion=!0;class kt{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(jt.setFromEuler(t))}applyAxisAngle(t,e){return this.applyQuaternion(jt.setFromAxisAngle(t,e))}applyMatrix3(t){const e=this.x,n=this.y,i=this.z,r=t.elements;return this.x=r[0]*e+r[3]*n+r[6]*i,this.y=r[1]*e+r[4]*n+r[7]*i,this.z=r[2]*e+r[5]*n+r[8]*i,this}applyNormalMatrix(t){return this.applyMatrix3(t).normalize()}applyMatrix4(t){const e=this.x,n=this.y,i=this.z,r=t.elements,s=1/(r[3]*e+r[7]*n+r[11]*i+r[15]);return this.x=(r[0]*e+r[4]*n+r[8]*i+r[12])*s,this.y=(r[1]*e+r[5]*n+r[9]*i+r[13])*s,this.z=(r[2]*e+r[6]*n+r[10]*i+r[14])*s,this}applyQuaternion(t){const e=this.x,n=this.y,i=this.z,r=t.x,s=t.y,a=t.z,o=t.w,l=o*e+s*i-a*n,c=o*n+a*e-r*i,h=o*i+r*n-s*e,u=-r*e-s*n-a*i;return this.x=l*o+u*-r+c*-a-h*-s,this.y=c*o+u*-s+h*-r-l*-a,this.z=h*o+u*-a+l*-s-c*-r,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,i=this.z,r=t.elements;return this.x=r[0]*e+r[4]*n+r[8]*i,this.y=r[1]*e+r[5]*n+r[9]*i,this.z=r[2]*e+r[6]*n+r[10]*i,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,i=t.y,r=t.z,s=e.x,a=e.y,o=e.z;return this.x=i*o-r*a,this.y=r*s-n*o,this.z=n*a-i*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 Wt.copy(this).projectOnVector(t),this.sub(Wt)}reflect(t){return this.sub(Wt.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(Mt(n,-1,1))}distanceTo(t){return Math.sqrt(this.distanceToSquared(t))}distanceToSquared(t){const e=this.x-t.x,n=this.y-t.y,i=this.z-t.z;return e*e+n*n+i*i}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 i=Math.sin(e)*t;return this.x=i*Math.sin(n),this.y=Math.cos(e)*t,this.z=i*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(),i=this.setFromMatrixColumn(t,2).length();return this.x=e,this.y=n,this.z=i,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}randomDirection(){const t=2*(Math.random()-.5),e=Math.random()*Math.PI*2,n=Math.sqrt(1-t**2);return this.x=n*Math.cos(e),this.y=n*Math.sin(e),this.z=t,this}*[Symbol.iterator](){yield this.x,yield this.y,yield this.z}}kt.prototype.isVector3=!0;const Wt=new kt,jt=new Vt;class qt{constructor(t=new kt(1/0,1/0,1/0),e=new kt(-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,i=1/0,r=-1/0,s=-1/0,a=-1/0;for(let o=0,l=t.length;or&&(r=l),c>s&&(s=c),h>a&&(a=h)}return this.min.set(e,n,i),this.max.set(r,s,a),this}setFromBufferAttribute(t){let e=1/0,n=1/0,i=1/0,r=-1/0,s=-1/0,a=-1/0;for(let o=0,l=t.count;or&&(r=l),c>s&&(s=c),h>a&&(a=h)}return this.min.set(e,n,i),this.max.set(r,s,a),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 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,Yt),Yt.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(ne),ie.subVectors(this.max,ne),Zt.subVectors(t.a,ne),Kt.subVectors(t.b,ne),Qt.subVectors(t.c,ne),$t.subVectors(Kt,Zt),te.subVectors(Qt,Kt),ee.subVectors(Zt,Qt);let e=[0,-$t.z,$t.y,0,-te.z,te.y,0,-ee.z,ee.y,$t.z,0,-$t.x,te.z,0,-te.x,ee.z,0,-ee.x,-$t.y,$t.x,0,-te.y,te.x,0,-ee.y,ee.x,0];return!!ae(e,Zt,Kt,Qt,ie)&&(e=[1,0,0,0,1,0,0,0,1],!!ae(e,Zt,Kt,Qt,ie)&&(re.crossVectors($t,te),e=[re.x,re.y,re.z],ae(e,Zt,Kt,Qt,ie)))}clampPoint(t,e){return e.copy(t).clamp(this.min,this.max)}distanceToPoint(t){return Yt.copy(t).clamp(this.min,this.max).sub(t).length()}getBoundingSphere(t){return this.getCenter(t.center),t.radius=.5*this.getSize(Yt).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()||(Xt[0].set(this.min.x,this.min.y,this.min.z).applyMatrix4(t),Xt[1].set(this.min.x,this.min.y,this.max.z).applyMatrix4(t),Xt[2].set(this.min.x,this.max.y,this.min.z).applyMatrix4(t),Xt[3].set(this.min.x,this.max.y,this.max.z).applyMatrix4(t),Xt[4].set(this.max.x,this.min.y,this.min.z).applyMatrix4(t),Xt[5].set(this.max.x,this.min.y,this.max.z).applyMatrix4(t),Xt[6].set(this.max.x,this.max.y,this.min.z).applyMatrix4(t),Xt[7].set(this.max.x,this.max.y,this.max.z).applyMatrix4(t),this.setFromPoints(Xt)),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)}}qt.prototype.isBox3=!0;const Xt=[new kt,new kt,new kt,new kt,new kt,new kt,new kt,new kt],Yt=new kt,Jt=new qt,Zt=new kt,Kt=new kt,Qt=new kt,$t=new kt,te=new kt,ee=new kt,ne=new kt,ie=new kt,re=new kt,se=new kt;function ae(t,e,n,i,r){for(let s=0,a=t.length-3;s<=a;s+=3){se.fromArray(t,s);const a=r.x*Math.abs(se.x)+r.y*Math.abs(se.y)+r.z*Math.abs(se.z),o=e.dot(se),l=n.dot(se),c=i.dot(se);if(Math.max(-Math.max(o,l,c),Math.min(o,l,c))>a)return!1}return!0}const oe=new qt,le=new kt,ce=new kt,he=new kt;class ue{constructor(t=new kt,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):oe.setFromPoints(t).getCenter(n);let i=0;for(let e=0,r=t.length;ethis.radius*this.radius&&(e.sub(this.center).normalize(),e.multiplyScalar(this.radius).add(this.center)),e}getBoundingBox(t){return 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}expandByPoint(t){he.subVectors(t,this.center);const e=he.lengthSq();if(e>this.radius*this.radius){const t=Math.sqrt(e),n=.5*(t-this.radius);this.center.add(he.multiplyScalar(n/t)),this.radius+=n}return this}union(t){return!0===this.center.equals(t.center)?ce.set(0,0,1).multiplyScalar(t.radius):ce.subVectors(t.center,this.center).normalize().multiplyScalar(t.radius),this.expandByPoint(le.copy(t.center).add(ce)),this.expandByPoint(le.copy(t.center).sub(ce)),this}equals(t){return t.center.equals(this.center)&&t.radius===this.radius}clone(){return(new this.constructor).copy(this)}}const de=new kt,pe=new kt,me=new kt,fe=new kt,ge=new kt,ve=new kt,xe=new kt;class ye{constructor(t=new kt,e=new kt(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 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,de)),this}closestPointToPoint(t,e){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=de.subVectors(t,this.origin).dot(this.direction);return e<0?this.origin.distanceToSquared(t):(de.copy(this.direction).multiplyScalar(e).add(this.origin),de.distanceToSquared(t))}distanceSqToSegment(t,e,n,i){pe.copy(t).add(e).multiplyScalar(.5),me.copy(e).sub(t).normalize(),fe.copy(this.origin).sub(pe);const r=.5*t.distanceTo(e),s=-this.direction.dot(me),a=fe.dot(this.direction),o=-fe.dot(me),l=fe.lengthSq(),c=Math.abs(1-s*s);let h,u,d,p;if(c>0)if(h=s*o-a,u=s*a-o,p=r*c,h>=0)if(u>=-p)if(u<=p){const t=1/c;h*=t,u*=t,d=h*(h+s*u+2*a)+u*(s*h+u+2*o)+l}else u=r,h=Math.max(0,-(s*u+a)),d=-h*h+u*(u+2*o)+l;else u=-r,h=Math.max(0,-(s*u+a)),d=-h*h+u*(u+2*o)+l;else u<=-p?(h=Math.max(0,-(-s*r+a)),u=h>0?-r:Math.min(Math.max(-r,-o),r),d=-h*h+u*(u+2*o)+l):u<=p?(h=0,u=Math.min(Math.max(-r,-o),r),d=u*(u+2*o)+l):(h=Math.max(0,-(s*r+a)),u=h>0?r:Math.min(Math.max(-r,-o),r),d=-h*h+u*(u+2*o)+l);else u=s>0?-r:r,h=Math.max(0,-(s*u+a)),d=-h*h+u*(u+2*o)+l;return n&&n.copy(this.direction).multiplyScalar(h).add(this.origin),i&&i.copy(me).multiplyScalar(u).add(pe),d}intersectSphere(t,e){de.subVectors(t.center,this.origin);const n=de.dot(this.direction),i=de.dot(de)-n*n,r=t.radius*t.radius;if(i>r)return null;const s=Math.sqrt(r-i),a=n-s,o=n+s;return a<0&&o<0?null:a<0?this.at(o,e):this.at(a,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);if(0===e)return!0;return t.normal.dot(this.direction)*e<0}intersectBox(t,e){let n,i,r,s,a,o;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,i=(t.max.x-u.x)*l):(n=(t.max.x-u.x)*l,i=(t.min.x-u.x)*l),c>=0?(r=(t.min.y-u.y)*c,s=(t.max.y-u.y)*c):(r=(t.max.y-u.y)*c,s=(t.min.y-u.y)*c),n>s||r>i?null:((r>n||n!=n)&&(n=r),(s=0?(a=(t.min.z-u.z)*h,o=(t.max.z-u.z)*h):(a=(t.max.z-u.z)*h,o=(t.min.z-u.z)*h),n>o||a>i?null:((a>n||n!=n)&&(n=a),(o=0?n:i,e)))}intersectsBox(t){return null!==this.intersectBox(t,de)}intersectTriangle(t,e,n,i,r){ge.subVectors(e,t),ve.subVectors(n,t),xe.crossVectors(ge,ve);let s,a=this.direction.dot(xe);if(a>0){if(i)return null;s=1}else{if(!(a<0))return null;s=-1,a=-a}fe.subVectors(this.origin,t);const o=s*this.direction.dot(ve.crossVectors(fe,ve));if(o<0)return null;const l=s*this.direction.dot(ge.cross(fe));if(l<0)return null;if(o+l>a)return null;const c=-s*fe.dot(xe);return c<0?null:this.at(c/a,r)}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)}}class _e{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,i,r,s,a,o,l,c,h,u,d,p,m,f){const g=this.elements;return g[0]=t,g[4]=e,g[8]=n,g[12]=i,g[1]=r,g[5]=s,g[9]=a,g[13]=o,g[2]=l,g[6]=c,g[10]=h,g[14]=u,g[3]=d,g[7]=p,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 _e).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,i=1/Me.setFromMatrixColumn(t,0).length(),r=1/Me.setFromMatrixColumn(t,1).length(),s=1/Me.setFromMatrixColumn(t,2).length();return e[0]=n[0]*i,e[1]=n[1]*i,e[2]=n[2]*i,e[3]=0,e[4]=n[4]*r,e[5]=n[5]*r,e[6]=n[6]*r,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,i=t.y,r=t.z,s=Math.cos(n),a=Math.sin(n),o=Math.cos(i),l=Math.sin(i),c=Math.cos(r),h=Math.sin(r);if("XYZ"===t.order){const t=s*c,n=s*h,i=a*c,r=a*h;e[0]=o*c,e[4]=-o*h,e[8]=l,e[1]=n+i*l,e[5]=t-r*l,e[9]=-a*o,e[2]=r-t*l,e[6]=i+n*l,e[10]=s*o}else if("YXZ"===t.order){const t=o*c,n=o*h,i=l*c,r=l*h;e[0]=t+r*a,e[4]=i*a-n,e[8]=s*l,e[1]=s*h,e[5]=s*c,e[9]=-a,e[2]=n*a-i,e[6]=r+t*a,e[10]=s*o}else if("ZXY"===t.order){const t=o*c,n=o*h,i=l*c,r=l*h;e[0]=t-r*a,e[4]=-s*h,e[8]=i+n*a,e[1]=n+i*a,e[5]=s*c,e[9]=r-t*a,e[2]=-s*l,e[6]=a,e[10]=s*o}else if("ZYX"===t.order){const t=s*c,n=s*h,i=a*c,r=a*h;e[0]=o*c,e[4]=i*l-n,e[8]=t*l+r,e[1]=o*h,e[5]=r*l+t,e[9]=n*l-i,e[2]=-l,e[6]=a*o,e[10]=s*o}else if("YZX"===t.order){const t=s*o,n=s*l,i=a*o,r=a*l;e[0]=o*c,e[4]=r-t*h,e[8]=i*h+n,e[1]=h,e[5]=s*c,e[9]=-a*c,e[2]=-l*c,e[6]=n*h+i,e[10]=t-r*h}else if("XZY"===t.order){const t=s*o,n=s*l,i=a*o,r=a*l;e[0]=o*c,e[4]=-h,e[8]=l*c,e[1]=t*h+r,e[5]=s*c,e[9]=n*h-i,e[2]=i*h-n,e[6]=a*c,e[10]=r*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(we,t,Se)}lookAt(t,e,n){const i=this.elements;return Ae.subVectors(t,e),0===Ae.lengthSq()&&(Ae.z=1),Ae.normalize(),Te.crossVectors(n,Ae),0===Te.lengthSq()&&(1===Math.abs(n.z)?Ae.x+=1e-4:Ae.z+=1e-4,Ae.normalize(),Te.crossVectors(n,Ae)),Te.normalize(),Ee.crossVectors(Ae,Te),i[0]=Te.x,i[4]=Ee.x,i[8]=Ae.x,i[1]=Te.y,i[5]=Ee.y,i[9]=Ae.y,i[2]=Te.z,i[6]=Ee.z,i[10]=Ae.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,i=e.elements,r=this.elements,s=n[0],a=n[4],o=n[8],l=n[12],c=n[1],h=n[5],u=n[9],d=n[13],p=n[2],m=n[6],f=n[10],g=n[14],v=n[3],x=n[7],y=n[11],_=n[15],M=i[0],b=i[4],w=i[8],S=i[12],T=i[1],E=i[5],A=i[9],R=i[13],C=i[2],L=i[6],P=i[10],I=i[14],D=i[3],N=i[7],O=i[11],B=i[15];return r[0]=s*M+a*T+o*C+l*D,r[4]=s*b+a*E+o*L+l*N,r[8]=s*w+a*A+o*P+l*O,r[12]=s*S+a*R+o*I+l*B,r[1]=c*M+h*T+u*C+d*D,r[5]=c*b+h*E+u*L+d*N,r[9]=c*w+h*A+u*P+d*O,r[13]=c*S+h*R+u*I+d*B,r[2]=p*M+m*T+f*C+g*D,r[6]=p*b+m*E+f*L+g*N,r[10]=p*w+m*A+f*P+g*O,r[14]=p*S+m*R+f*I+g*B,r[3]=v*M+x*T+y*C+_*D,r[7]=v*b+x*E+y*L+_*N,r[11]=v*w+x*A+y*P+_*O,r[15]=v*S+x*R+y*I+_*B,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],i=t[8],r=t[12],s=t[1],a=t[5],o=t[9],l=t[13],c=t[2],h=t[6],u=t[10],d=t[14];return t[3]*(+r*o*h-i*l*h-r*a*u+n*l*u+i*a*d-n*o*d)+t[7]*(+e*o*d-e*l*u+r*s*u-i*s*d+i*l*c-r*o*c)+t[11]*(+e*l*h-e*a*d-r*s*h+n*s*d+r*a*c-n*l*c)+t[15]*(-i*a*c-e*o*h+e*a*u+i*s*h-n*s*u+n*o*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 i=this.elements;return t.isVector3?(i[12]=t.x,i[13]=t.y,i[14]=t.z):(i[12]=t,i[13]=e,i[14]=n),this}invert(){const t=this.elements,e=t[0],n=t[1],i=t[2],r=t[3],s=t[4],a=t[5],o=t[6],l=t[7],c=t[8],h=t[9],u=t[10],d=t[11],p=t[12],m=t[13],f=t[14],g=t[15],v=h*f*l-m*u*l+m*o*d-a*f*d-h*o*g+a*u*g,x=p*u*l-c*f*l-p*o*d+s*f*d+c*o*g-s*u*g,y=c*m*l-p*h*l+p*a*d-s*m*d-c*a*g+s*h*g,_=p*h*o-c*m*o-p*a*u+s*m*u+c*a*f-s*h*f,M=e*v+n*x+i*y+r*_;if(0===M)return this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);const b=1/M;return t[0]=v*b,t[1]=(m*u*r-h*f*r-m*i*d+n*f*d+h*i*g-n*u*g)*b,t[2]=(a*f*r-m*o*r+m*i*l-n*f*l-a*i*g+n*o*g)*b,t[3]=(h*o*r-a*u*r-h*i*l+n*u*l+a*i*d-n*o*d)*b,t[4]=x*b,t[5]=(c*f*r-p*u*r+p*i*d-e*f*d-c*i*g+e*u*g)*b,t[6]=(p*o*r-s*f*r-p*i*l+e*f*l+s*i*g-e*o*g)*b,t[7]=(s*u*r-c*o*r+c*i*l-e*u*l-s*i*d+e*o*d)*b,t[8]=y*b,t[9]=(p*h*r-c*m*r-p*n*d+e*m*d+c*n*g-e*h*g)*b,t[10]=(s*m*r-p*a*r+p*n*l-e*m*l-s*n*g+e*a*g)*b,t[11]=(c*a*r-s*h*r-c*n*l+e*h*l+s*n*d-e*a*d)*b,t[12]=_*b,t[13]=(c*m*i-p*h*i+p*n*u-e*m*u-c*n*f+e*h*f)*b,t[14]=(p*a*i-s*m*i-p*n*o+e*m*o+s*n*f-e*a*f)*b,t[15]=(s*h*i-c*a*i+c*n*o-e*h*o-s*n*u+e*a*u)*b,this}scale(t){const e=this.elements,n=t.x,i=t.y,r=t.z;return e[0]*=n,e[4]*=i,e[8]*=r,e[1]*=n,e[5]*=i,e[9]*=r,e[2]*=n,e[6]*=i,e[10]*=r,e[3]*=n,e[7]*=i,e[11]*=r,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],i=t[8]*t[8]+t[9]*t[9]+t[10]*t[10];return Math.sqrt(Math.max(e,n,i))}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),i=Math.sin(e),r=1-n,s=t.x,a=t.y,o=t.z,l=r*s,c=r*a;return this.set(l*s+n,l*a-i*o,l*o+i*a,0,l*a+i*o,c*a+n,c*o-i*s,0,l*o-i*a,c*o+i*s,r*o*o+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,i,r,s){return this.set(1,n,r,0,t,1,s,0,e,i,1,0,0,0,0,1),this}compose(t,e,n){const i=this.elements,r=e._x,s=e._y,a=e._z,o=e._w,l=r+r,c=s+s,h=a+a,u=r*l,d=r*c,p=r*h,m=s*c,f=s*h,g=a*h,v=o*l,x=o*c,y=o*h,_=n.x,M=n.y,b=n.z;return i[0]=(1-(m+g))*_,i[1]=(d+y)*_,i[2]=(p-x)*_,i[3]=0,i[4]=(d-y)*M,i[5]=(1-(u+g))*M,i[6]=(f+v)*M,i[7]=0,i[8]=(p+x)*b,i[9]=(f-v)*b,i[10]=(1-(u+m))*b,i[11]=0,i[12]=t.x,i[13]=t.y,i[14]=t.z,i[15]=1,this}decompose(t,e,n){const i=this.elements;let r=Me.set(i[0],i[1],i[2]).length();const s=Me.set(i[4],i[5],i[6]).length(),a=Me.set(i[8],i[9],i[10]).length();this.determinant()<0&&(r=-r),t.x=i[12],t.y=i[13],t.z=i[14],be.copy(this);const o=1/r,l=1/s,c=1/a;return be.elements[0]*=o,be.elements[1]*=o,be.elements[2]*=o,be.elements[4]*=l,be.elements[5]*=l,be.elements[6]*=l,be.elements[8]*=c,be.elements[9]*=c,be.elements[10]*=c,e.setFromRotationMatrix(be),n.x=r,n.y=s,n.z=a,this}makePerspective(t,e,n,i,r,s){void 0===s&&console.warn("THREE.Matrix4: .makePerspective() has been redefined and has a new signature. Please check the docs.");const a=this.elements,o=2*r/(e-t),l=2*r/(n-i),c=(e+t)/(e-t),h=(n+i)/(n-i),u=-(s+r)/(s-r),d=-2*s*r/(s-r);return a[0]=o,a[4]=0,a[8]=c,a[12]=0,a[1]=0,a[5]=l,a[9]=h,a[13]=0,a[2]=0,a[6]=0,a[10]=u,a[14]=d,a[3]=0,a[7]=0,a[11]=-1,a[15]=0,this}makeOrthographic(t,e,n,i,r,s){const a=this.elements,o=1/(e-t),l=1/(n-i),c=1/(s-r),h=(e+t)*o,u=(n+i)*l,d=(s+r)*c;return a[0]=2*o,a[4]=0,a[8]=0,a[12]=-h,a[1]=0,a[5]=2*l,a[9]=0,a[13]=-u,a[2]=0,a[6]=0,a[10]=-2*c,a[14]=-d,a[3]=0,a[7]=0,a[11]=0,a[15]=1,this}equals(t){const e=this.elements,n=t.elements;for(let t=0;t<16;t++)if(e[t]!==n[t])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}}_e.prototype.isMatrix4=!0;const Me=new kt,be=new _e,we=new kt(0,0,0),Se=new kt(1,1,1),Te=new kt,Ee=new kt,Ae=new kt,Re=new _e,Ce=new Vt;class Le{constructor(t=0,e=0,n=0,i=Le.DefaultOrder){this._x=t,this._y=e,this._z=n,this._order=i}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,i=this._order){return this._x=t,this._y=e,this._z=n,this._order=i,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=this._order,n=!0){const i=t.elements,r=i[0],s=i[4],a=i[8],o=i[1],l=i[5],c=i[9],h=i[2],u=i[6],d=i[10];switch(e){case"XYZ":this._y=Math.asin(Mt(a,-1,1)),Math.abs(a)<.9999999?(this._x=Math.atan2(-c,d),this._z=Math.atan2(-s,r)):(this._x=Math.atan2(u,l),this._z=0);break;case"YXZ":this._x=Math.asin(-Mt(c,-1,1)),Math.abs(c)<.9999999?(this._y=Math.atan2(a,d),this._z=Math.atan2(o,l)):(this._y=Math.atan2(-h,r),this._z=0);break;case"ZXY":this._x=Math.asin(Mt(u,-1,1)),Math.abs(u)<.9999999?(this._y=Math.atan2(-h,d),this._z=Math.atan2(-s,l)):(this._y=0,this._z=Math.atan2(o,r));break;case"ZYX":this._y=Math.asin(-Mt(h,-1,1)),Math.abs(h)<.9999999?(this._x=Math.atan2(u,d),this._z=Math.atan2(o,r)):(this._x=0,this._z=Math.atan2(-s,l));break;case"YZX":this._z=Math.asin(Mt(o,-1,1)),Math.abs(o)<.9999999?(this._x=Math.atan2(-c,l),this._y=Math.atan2(-h,r)):(this._x=0,this._y=Math.atan2(a,d));break;case"XZY":this._z=Math.asin(-Mt(s,-1,1)),Math.abs(s)<.9999999?(this._x=Math.atan2(u,l),this._y=Math.atan2(a,r)):(this._x=Math.atan2(-c,d),this._y=0);break;default:console.warn("THREE.Euler: .setFromRotationMatrix() encountered an unknown order: "+e)}return this._order=e,!0===n&&this._onChangeCallback(),this}setFromQuaternion(t,e,n){return Re.makeRotationFromQuaternion(t),this.setFromRotationMatrix(Re,e,n)}setFromVector3(t,e=this._order){return this.set(t.x,t.y,t.z,e)}reorder(t){return Ce.setFromEuler(this),this.setFromQuaternion(Ce,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 kt(this._x,this._y,this._z)}_onChange(t){return this._onChangeCallback=t,this}_onChangeCallback(){}}Le.prototype.isEuler=!0,Le.DefaultOrder="XYZ",Le.RotationOrders=["XYZ","YZX","ZXY","XZY","YXZ","ZYX"];class Pe{constructor(){this.mask=1}set(t){this.mask=(1<>>0}enable(t){this.mask|=1<1){for(let t=0;t1){for(let t=0;t0){i.children=[];for(let e=0;e0){i.animations=[];for(let e=0;e0&&(n.geometries=e),i.length>0&&(n.materials=i),r.length>0&&(n.textures=r),a.length>0&&(n.images=a),o.length>0&&(n.shapes=o),l.length>0&&(n.skeletons=l),c.length>0&&(n.animations=c)}return n.object=i,n;function s(t){const e=[];for(const n in t){const i=t[n];delete i.metadata,e.push(i)}return e}}clone(t){return(new this.constructor).copy(this,t)}copy(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 e=0;e0?i.multiplyScalar(1/Math.sqrt(r)):i.set(0,0,0)}static getBarycoord(t,e,n,i,r){qe.subVectors(i,e),Xe.subVectors(n,e),Ye.subVectors(t,e);const s=qe.dot(qe),a=qe.dot(Xe),o=qe.dot(Ye),l=Xe.dot(Xe),c=Xe.dot(Ye),h=s*l-a*a;if(0===h)return r.set(-2,-1,-1);const u=1/h,d=(l*o-a*c)*u,p=(s*c-a*o)*u;return r.set(1-d-p,p,d)}static containsPoint(t,e,n,i){return this.getBarycoord(t,e,n,i,Je),Je.x>=0&&Je.y>=0&&Je.x+Je.y<=1}static getUV(t,e,n,i,r,s,a,o){return this.getBarycoord(t,e,n,i,Je),o.set(0,0),o.addScaledVector(r,Je.x),o.addScaledVector(s,Je.y),o.addScaledVector(a,Je.z),o}static isFrontFacing(t,e,n,i){return qe.subVectors(n,e),Xe.subVectors(t,e),qe.cross(Xe).dot(i)<0}set(t,e,n){return this.a.copy(t),this.b.copy(e),this.c.copy(n),this}setFromPointsAndIndices(t,e,n,i){return this.a.copy(t[e]),this.b.copy(t[n]),this.c.copy(t[i]),this}setFromAttributeAndIndices(t,e,n,i){return this.a.fromBufferAttribute(t,e),this.b.fromBufferAttribute(t,n),this.c.fromBufferAttribute(t,i),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 qe.subVectors(this.c,this.b),Xe.subVectors(this.a,this.b),.5*qe.cross(Xe).length()}getMidpoint(t){return t.addVectors(this.a,this.b).add(this.c).multiplyScalar(1/3)}getNormal(t){return nn.getNormal(this.a,this.b,this.c,t)}getPlane(t){return t.setFromCoplanarPoints(this.a,this.b,this.c)}getBarycoord(t,e){return nn.getBarycoord(t,this.a,this.b,this.c,e)}getUV(t,e,n,i,r){return nn.getUV(t,this.a,this.b,this.c,e,n,i,r)}containsPoint(t){return nn.containsPoint(t,this.a,this.b,this.c)}isFrontFacing(t){return nn.isFrontFacing(this.a,this.b,this.c,t)}intersectsBox(t){return t.intersectsTriangle(this)}closestPointToPoint(t,e){const n=this.a,i=this.b,r=this.c;let s,a;Ze.subVectors(i,n),Ke.subVectors(r,n),$e.subVectors(t,n);const o=Ze.dot($e),l=Ke.dot($e);if(o<=0&&l<=0)return e.copy(n);tn.subVectors(t,i);const c=Ze.dot(tn),h=Ke.dot(tn);if(c>=0&&h<=c)return e.copy(i);const u=o*h-c*l;if(u<=0&&o>=0&&c<=0)return s=o/(o-c),e.copy(n).addScaledVector(Ze,s);en.subVectors(t,r);const d=Ze.dot(en),p=Ke.dot(en);if(p>=0&&d<=p)return e.copy(r);const m=d*l-o*p;if(m<=0&&l>=0&&p<=0)return a=l/(l-p),e.copy(n).addScaledVector(Ke,a);const f=c*p-d*h;if(f<=0&&h-c>=0&&d-p>=0)return Qe.subVectors(r,i),a=(h-c)/(h-c+(d-p)),e.copy(i).addScaledVector(Qe,a);const g=1/(f+m+u);return s=m*g,a=u*g,e.copy(n).addScaledVector(Ze,s).addScaledVector(Ke,a)}equals(t){return t.a.equals(this.a)&&t.b.equals(this.b)&&t.c.equals(this.c)}}let rn=0;class sn extends ft{constructor(){super(),Object.defineProperty(this,"id",{value:rn++}),this.uuid=_t(),this.name="",this.type="Material",this.fog=!0,this.blending=1,this.side=0,this.vertexColors=!1,this.opacity=1,this.transparent=!1,this.blendSrc=204,this.blendDst=205,this.blendEquation=n,this.blendSrcAlpha=null,this.blendDstAlpha=null,this.blendEquationAlpha=null,this.depthFunc=3,this.depthTest=!0,this.depthWrite=!0,this.stencilWriteMask=255,this.stencilFunc=519,this.stencilRef=0,this.stencilFuncMask=255,this.stencilFail=ht,this.stencilZFail=ht,this.stencilZPass=ht,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.alphaToCoverage=!1,this.premultipliedAlpha=!1,this.visible=!0,this.toneMapped=!0,this.userData={},this.version=0,this._alphaTest=0}get alphaTest(){return this._alphaTest}set alphaTest(t){this._alphaTest>0!=t>0&&this.version++,this._alphaTest=t}onBuild(){}onBeforeRender(){}onBeforeCompile(){}customProgramCacheKey(){return this.onBeforeCompile.toString()}setValues(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 i=this[e];void 0!==i?i&&i.isColor?i.set(n):i&&i.isVector3&&n&&n.isVector3?i.copy(n):this[e]=n:console.warn("THREE."+this.type+": '"+e+"' is not a property of this material.")}}toJSON(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 i(t){const e=[];for(const n in t){const i=t[n];delete i.metadata,e.push(i)}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),void 0!==this.sheen&&(n.sheen=this.sheen),this.sheenColor&&this.sheenColor.isColor&&(n.sheenColor=this.sheenColor.getHex()),void 0!==this.sheenRoughness&&(n.sheenRoughness=this.sheenRoughness),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.specularIntensity&&(n.specularIntensity=this.specularIntensity),this.specularColor&&this.specularColor.isColor&&(n.specularColor=this.specularColor.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.specularIntensityMap&&this.specularIntensityMap.isTexture&&(n.specularIntensityMap=this.specularIntensityMap.toJSON(t).uuid),this.specularColorMap&&this.specularColorMap.isTexture&&(n.specularColorMap=this.specularColorMap.toJSON(t).uuid),this.envMap&&this.envMap.isTexture&&(n.envMap=this.envMap.toJSON(t).uuid,void 0!==this.combine&&(n.combine=this.combine)),void 0!==this.envMapIntensity&&(n.envMapIntensity=this.envMapIntensity),void 0!==this.reflectivity&&(n.reflectivity=this.reflectivity),void 0!==this.refractionRatio&&(n.refractionRatio=this.refractionRatio),this.gradientMap&&this.gradientMap.isTexture&&(n.gradientMap=this.gradientMap.toJSON(t).uuid),void 0!==this.transmission&&(n.transmission=this.transmission),this.transmissionMap&&this.transmissionMap.isTexture&&(n.transmissionMap=this.transmissionMap.toJSON(t).uuid),void 0!==this.thickness&&(n.thickness=this.thickness),this.thicknessMap&&this.thicknessMap.isTexture&&(n.thicknessMap=this.thicknessMap.toJSON(t).uuid),void 0!==this.attenuationDistance&&(n.attenuationDistance=this.attenuationDistance),void 0!==this.attenuationColor&&(n.attenuationColor=this.attenuationColor.getHex()),void 0!==this.size&&(n.size=this.size),null!==this.shadowSide&&(n.shadowSide=this.shadowSide),void 0!==this.sizeAttenuation&&(n.sizeAttenuation=this.sizeAttenuation),1!==this.blending&&(n.blending=this.blending),0!==this.side&&(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.colorWrite=this.colorWrite,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.alphaToCoverage&&(n.alphaToCoverage=this.alphaToCoverage),!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.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=i(t.textures),r=i(t.images);e.length>0&&(n.textures=e),r.length>0&&(n.images=r)}return n}clone(){return(new this.constructor).copy(this)}copy(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 i=0;i!==t;++i)n[i]=e[i].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.alphaToCoverage=t.alphaToCoverage,this.premultipliedAlpha=t.premultipliedAlpha,this.visible=t.visible,this.toneMapped=t.toneMapped,this.userData=JSON.parse(JSON.stringify(t.userData)),this}dispose(){this.dispatchEvent({type:"dispose"})}set needsUpdate(t){!0===t&&this.version++}}sn.r115Compatible=!1,sn.prototype.isMaterial=!0;const an={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},on={h:0,s:0,l:0},ln={h:0,s:0,l:0};function cn(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 hn(t){return t<.04045?.0773993808*t:Math.pow(.9478672986*t+.0521327014,2.4)}function un(t){return t<.0031308?12.92*t:1.055*Math.pow(t,.41666)-.055}class dn{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=bt(t,1),e=Mt(e,0,1),n=Mt(n,0,1),0===e)this.r=this.g=this.b=n;else{const i=n<=.5?n*(1+e):n+e-n*e,r=2*n-i;this.r=cn(r,i,t+1/3),this.g=cn(r,i,t),this.b=cn(r,i,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 i=n[1],r=n[2];switch(i){case"rgb":case"rgba":if(t=/^\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(r))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(r))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(r)){const n=parseFloat(t[1])/360,i=parseInt(t[2],10)/100,r=parseInt(t[3],10)/100;return e(t[4]),this.setHSL(n,i,r)}}}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=an[t.toLowerCase()];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}copySRGBToLinear(t){return this.r=hn(t.r),this.g=hn(t.g),this.b=hn(t.b),this}copyLinearToSRGB(t){return this.r=un(t.r),this.g=un(t.g),this.b=un(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){const e=this.r,n=this.g,i=this.b,r=Math.max(e,n,i),s=Math.min(e,n,i);let a,o;const l=(s+r)/2;if(s===r)a=0,o=0;else{const t=r-s;switch(o=l<=.5?t/(r+s):t/(2-r-s),r){case e:a=(n-i)/t+(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 e in n){const i=n[e];t.data.attributes[e]=i.toJSON(t.data)}const i={};let r=!1;for(const e in this.morphAttributes){const n=this.morphAttributes[e],s=[];for(let e=0,i=n.length;e0&&(i[e]=s,r=!0)}r&&(t.data.morphAttributes=i,t.data.morphTargetsRelative=this.morphTargetsRelative);const s=this.groups;s.length>0&&(t.data.groups=JSON.parse(JSON.stringify(s)));const a=this.boundingSphere;return null!==a&&(t.data.boundingSphere={center:a.center.toArray(),radius:a.radius}),t}clone(){return(new this.constructor).copy(this)}copy(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 i=t.attributes;for(const t in i){const n=i[t];this.setAttribute(t,n.clone(e))}const r=t.morphAttributes;for(const t in r){const n=[],i=r[t];for(let t=0,r=i.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(t,e){const n=this.geometry,i=this.material,r=this.matrixWorld;if(void 0===i)return;if(null===n.boundingSphere&&n.computeBoundingSphere(),zn.copy(n.boundingSphere),zn.applyMatrix4(r),!1===t.ray.intersectsSphere(zn))return;if(On.copy(r).invert(),Bn.copy(t.ray).applyMatrix4(On),null!==n.boundingBox&&!1===Bn.intersectsBox(n.boundingBox))return;let s;if(n.isBufferGeometry){const r=n.index,a=n.attributes.position,o=n.morphAttributes.position,l=n.morphTargetsRelative,c=n.attributes.uv,h=n.attributes.uv2,u=n.groups,d=n.drawRange;if(null!==r)if(Array.isArray(i))for(let n=0,p=u.length;nn.far?null:{distance:c,point:Kn.clone(),object:t}}(t,e,n,i,Fn,Un,Hn,Zn);if(p){o&&(Xn.fromBufferAttribute(o,c),Yn.fromBufferAttribute(o,h),Jn.fromBufferAttribute(o,u),p.uv=nn.getUV(Zn,Fn,Un,Hn,Xn,Yn,Jn,new Rt)),l&&(Xn.fromBufferAttribute(l,c),Yn.fromBufferAttribute(l,h),Jn.fromBufferAttribute(l,u),p.uv2=nn.getUV(Zn,Fn,Un,Hn,Xn,Yn,Jn,new Rt));const t={a:c,b:h,c:u,normal:new kt,materialIndex:0};nn.getNormal(Fn,Un,Hn,t.normal),p.face=t}return p}Qn.prototype.isMesh=!0;class ti extends Nn{constructor(t=1,e=1,n=1,i=1,r=1,s=1){super(),this.type="BoxGeometry",this.parameters={width:t,height:e,depth:n,widthSegments:i,heightSegments:r,depthSegments:s};const a=this;i=Math.floor(i),r=Math.floor(r),s=Math.floor(s);const o=[],l=[],c=[],h=[];let u=0,d=0;function p(t,e,n,i,r,s,p,m,f,g,v){const x=s/f,y=p/g,_=s/2,M=p/2,b=m/2,w=f+1,S=g+1;let T=0,E=0;const A=new kt;for(let s=0;s0?1:-1,c.push(A.x,A.y,A.z),h.push(o/f),h.push(1-s/g),T+=1}}for(let t=0;t0&&(e.defines=this.defines),e.vertexShader=this.vertexShader,e.fragmentShader=this.fragmentShader;const n={};for(const t in this.extensions)!0===this.extensions[t]&&(n[t]=!0);return Object.keys(n).length>0&&(e.extensions=n),e}}ri.prototype.isShaderMaterial=!0;class si extends je{constructor(){super(),this.type="Camera",this.matrixWorldInverse=new _e,this.projectionMatrix=new _e,this.projectionMatrixInverse=new _e}copy(t,e){return super.copy(t,e),this.matrixWorldInverse.copy(t.matrixWorldInverse),this.projectionMatrix.copy(t.projectionMatrix),this.projectionMatrixInverse.copy(t.projectionMatrixInverse),this}getWorldDirection(t){this.updateWorldMatrix(!0,!1);const e=this.matrixWorld.elements;return t.set(-e[8],-e[9],-e[10]).normalize()}updateMatrixWorld(t){super.updateMatrixWorld(t),this.matrixWorldInverse.copy(this.matrixWorld).invert()}updateWorldMatrix(t,e){super.updateWorldMatrix(t,e),this.matrixWorldInverse.copy(this.matrixWorld).invert()}clone(){return(new this.constructor).copy(this)}}si.prototype.isCamera=!0;class ai extends si{constructor(t=50,e=1,n=.1,i=2e3){super(),this.type="PerspectiveCamera",this.fov=t,this.zoom=1,this.near=n,this.far=i,this.focus=10,this.aspect=e,this.view=null,this.filmGauge=35,this.filmOffset=0,this.updateProjectionMatrix()}copy(t,e){return super.copy(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(t){const e=.5*this.getFilmHeight()/t;this.fov=2*yt*Math.atan(e),this.updateProjectionMatrix()}getFocalLength(){const t=Math.tan(.5*xt*this.fov);return.5*this.getFilmHeight()/t}getEffectiveFOV(){return 2*yt*Math.atan(Math.tan(.5*xt*this.fov)/this.zoom)}getFilmWidth(){return this.filmGauge*Math.min(this.aspect,1)}getFilmHeight(){return this.filmGauge/Math.max(this.aspect,1)}setViewOffset(t,e,n,i,r,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=i,this.view.width=r,this.view.height=s,this.updateProjectionMatrix()}clearViewOffset(){null!==this.view&&(this.view.enabled=!1),this.updateProjectionMatrix()}updateProjectionMatrix(){const t=this.near;let e=t*Math.tan(.5*xt*this.fov)/this.zoom,n=2*e,i=this.aspect*n,r=-.5*i;const s=this.view;if(null!==this.view&&this.view.enabled){const t=s.fullWidth,a=s.fullHeight;r+=s.offsetX*i/t,e-=s.offsetY*n/a,i*=s.width/t,n*=s.height/a}const a=this.filmOffset;0!==a&&(r+=t*a/this.getFilmWidth()),this.projectionMatrix.makePerspective(r,r+i,e,e-n,t,this.far),this.projectionMatrixInverse.copy(this.projectionMatrix).invert()}toJSON(t){const e=super.toJSON(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}}ai.prototype.isPerspectiveCamera=!0;const oi=90;class li extends je{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 i=new ai(oi,1,t,e);i.layers=this.layers,i.up.set(0,-1,0),i.lookAt(new kt(1,0,0)),this.add(i);const r=new ai(oi,1,t,e);r.layers=this.layers,r.up.set(0,-1,0),r.lookAt(new kt(-1,0,0)),this.add(r);const s=new ai(oi,1,t,e);s.layers=this.layers,s.up.set(0,0,1),s.lookAt(new kt(0,1,0)),this.add(s);const a=new ai(oi,1,t,e);a.layers=this.layers,a.up.set(0,0,-1),a.lookAt(new kt(0,-1,0)),this.add(a);const o=new ai(oi,1,t,e);o.layers=this.layers,o.up.set(0,-1,0),o.lookAt(new kt(0,0,1)),this.add(o);const l=new ai(oi,1,t,e);l.layers=this.layers,l.up.set(0,-1,0),l.lookAt(new kt(0,0,-1)),this.add(l)}update(t,e){null===this.parent&&this.updateMatrixWorld();const n=this.renderTarget,[i,r,s,a,o,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,i),t.setRenderTarget(n,1),t.render(e,r),t.setRenderTarget(n,2),t.render(e,s),t.setRenderTarget(n,3),t.render(e,a),t.setRenderTarget(n,4),t.render(e,o),n.texture.generateMipmaps=u,t.setRenderTarget(n,5),t.render(e,l),t.setRenderTarget(h),t.xr.enabled=c,n.texture.needsPMREMUpdate=!0}}class ci extends zt{constructor(t,e,n,i,s,a,o,l,c,h){super(t=void 0!==t?t:[],e=void 0!==e?e:r,n,i,s,a,o,l,c,h),this.flipY=!1}get images(){return this.image}set images(t){this.image=t}}ci.prototype.isCubeTexture=!0;class hi extends Ht{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 ci(void 0,e.mapping,e.wrapS,e.wrapT,e.magFilter,e.minFilter,e.format,e.type,e.anisotropy,e.encoding),this.texture.isRenderTargetTexture=!0,this.texture.generateMipmaps=void 0!==e.generateMipmaps&&e.generateMipmaps,this.texture.minFilter=void 0!==e.minFilter?e.minFilter:g}fromEquirectangularTexture(t,e){this.texture.type=e.type,this.texture.format=T,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"},i=new ti(5,5,5),r=new ri({name:"CubemapFromEquirect",uniforms:ei(n.uniforms),vertexShader:n.vertexShader,fragmentShader:n.fragmentShader,side:1,blending:0});r.uniforms.tEquirect.value=e;const s=new Qn(i,r),a=e.minFilter;e.minFilter===x&&(e.minFilter=g);return new li(1,10,this).update(t,s),e.minFilter=a,s.geometry.dispose(),s.material.dispose(),this}clear(t,e,n,i){const r=t.getRenderTarget();for(let r=0;r<6;r++)t.setRenderTarget(this,r),t.clear(e,n,i);t.setRenderTarget(r)}}hi.prototype.isWebGLCubeRenderTarget=!0;const ui=new kt,di=new kt,pi=new Ct;class mi{constructor(t=new kt(1,0,0),e=0){this.normal=t,this.constant=e}set(t,e){return this.normal.copy(t),this.constant=e,this}setComponents(t,e,n,i){return this.normal.set(t,e,n),this.constant=i,this}setFromNormalAndCoplanarPoint(t,e){return this.normal.copy(t),this.constant=-e.dot(this.normal),this}setFromCoplanarPoints(t,e,n){const i=ui.subVectors(n,e).cross(di.subVectors(t,e)).normalize();return this.setFromNormalAndCoplanarPoint(i,t),this}copy(t){return this.normal.copy(t.normal),this.constant=t.constant,this}normalize(){const t=1/this.normal.length();return this.normal.multiplyScalar(t),this.constant*=t,this}negate(){return this.constant*=-1,this.normal.negate(),this}distanceToPoint(t){return this.normal.dot(t)+this.constant}distanceToSphere(t){return this.distanceToPoint(t.center)-t.radius}projectPoint(t,e){return e.copy(this.normal).multiplyScalar(-this.distanceToPoint(t)).add(t)}intersectLine(t,e){const n=t.delta(ui),i=this.normal.dot(n);if(0===i)return 0===this.distanceToPoint(t.start)?e.copy(t.start):null;const r=-(t.start.dot(this.normal)+this.constant)/i;return r<0||r>1?null:e.copy(n).multiplyScalar(r).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 t.copy(this.normal).multiplyScalar(-this.constant)}applyMatrix4(t,e){const n=e||pi.getNormalMatrix(t),i=this.coplanarPoint(ui).applyMatrix4(t),r=this.normal.applyMatrix3(n).normalize();return this.constant=-i.dot(r),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)}}mi.prototype.isPlane=!0;const fi=new ue,gi=new kt;class vi{constructor(t=new mi,e=new mi,n=new mi,i=new mi,r=new mi,s=new mi){this.planes=[t,e,n,i,r,s]}set(t,e,n,i,r,s){const a=this.planes;return a[0].copy(t),a[1].copy(e),a[2].copy(n),a[3].copy(i),a[4].copy(r),a[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,i=n[0],r=n[1],s=n[2],a=n[3],o=n[4],l=n[5],c=n[6],h=n[7],u=n[8],d=n[9],p=n[10],m=n[11],f=n[12],g=n[13],v=n[14],x=n[15];return e[0].setComponents(a-i,h-o,m-u,x-f).normalize(),e[1].setComponents(a+i,h+o,m+u,x+f).normalize(),e[2].setComponents(a+r,h+l,m+d,x+g).normalize(),e[3].setComponents(a-r,h-l,m-d,x-g).normalize(),e[4].setComponents(a-s,h-c,m-p,x-v).normalize(),e[5].setComponents(a+s,h+c,m+p,x+v).normalize(),this}intersectsObject(t){const e=t.geometry;if(null===e.boundingSphere&&e.computeBoundingSphere(),fi.copy(e.boundingSphere),t.skeleton&&t.skeleton.rootMotionBone){const e=t.skeleton.rootMotionBone.matrixWorld.clone();e.multiply(t.skeleton.rootMotionBoneInitialMatrixInverse),fi.applyMatrix4(e)}else fi.applyMatrix4(t.matrixWorld);return this.intersectsSphere(fi)}intersectsSprite(t){return fi.center.set(0,0,0),fi.radius=.7071067811865476,fi.applyMatrix4(t.matrixWorld),this.intersectsSphere(fi)}intersectsSphere(t){const e=this.planes,n=t.center,i=-t.radius;for(let t=0;t<6;t++){if(e[t].distanceToPoint(n)0?t.max.x:t.min.x,gi.y=i.normal.y>0?t.max.y:t.min.y,gi.z=i.normal.z>0?t.max.z:t.min.z,i.distanceToPoint(gi)<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 xi(){let t=null,e=!1,n=null,i=null;function r(e,s){n(e,s),i=t.requestAnimationFrame(r)}return{start:function(){!0!==e&&null!==n&&(i=t.requestAnimationFrame(r),e=!0)},stop:function(){t.cancelAnimationFrame(i),e=!1},setAnimationLoop:function(t){n=t},setContext:function(e){t=e}}}function yi(t,e){const n=e.isWebGL2,i=new WeakMap;return{get:function(t){return t.isInterleavedBufferAttribute&&(t=t.data),i.get(t)},remove:function(e){e.isInterleavedBufferAttribute&&(e=e.data);const n=i.get(e);n&&(t.deleteBuffer(n.buffer),i.delete(e))},update:function(e,r){if(e.isGLBufferAttribute){const t=i.get(e);return void((!t||t.version 0.0 ) ? v : 0.5 * inversesqrt( max( 1.0 - x * x, 1e-7 ) ) - v;\n\treturn cross( v1, v2 ) * theta_sintheta;\n}\nvec3 LTC_Evaluate( const in vec3 N, const in vec3 V, const in vec3 P, const in mat3 mInv, const in vec3 rectCoords[ 4 ] ) {\n\tvec3 v1 = rectCoords[ 1 ] - rectCoords[ 0 ];\n\tvec3 v2 = rectCoords[ 3 ] - rectCoords[ 0 ];\n\tvec3 lightNormal = cross( v1, v2 );\n\tif( dot( lightNormal, P - rectCoords[ 0 ] ) < 0.0 ) return vec3( 0.0 );\n\tvec3 T1, T2;\n\tT1 = normalize( V - N * dot( V, N ) );\n\tT2 = - cross( N, T1 );\n\tmat3 mat = mInv * transposeMat3( mat3( T1, T2, N ) );\n\tvec3 coords[ 4 ];\n\tcoords[ 0 ] = mat * ( rectCoords[ 0 ] - P );\n\tcoords[ 1 ] = mat * ( rectCoords[ 1 ] - P );\n\tcoords[ 2 ] = mat * ( rectCoords[ 2 ] - P );\n\tcoords[ 3 ] = mat * ( rectCoords[ 3 ] - P );\n\tcoords[ 0 ] = normalize( coords[ 0 ] );\n\tcoords[ 1 ] = normalize( coords[ 1 ] );\n\tcoords[ 2 ] = normalize( coords[ 2 ] );\n\tcoords[ 3 ] = normalize( coords[ 3 ] );\n\tvec3 vectorFormFactor = vec3( 0.0 );\n\tvectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 0 ], coords[ 1 ] );\n\tvectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 1 ], coords[ 2 ] );\n\tvectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 2 ], coords[ 3 ] );\n\tvectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 3 ], coords[ 0 ] );\n\tfloat result = LTC_ClippedSphereFormFactor( vectorFormFactor );\n\treturn vec3( result );\n}\nfloat G_BlinnPhong_Implicit( ) {\n\treturn 0.25;\n}\nfloat D_BlinnPhong( const in float shininess, const in float dotNH ) {\n\treturn RECIPROCAL_PI * ( shininess * 0.5 + 1.0 ) * pow( dotNH, shininess );\n}\nvec3 BRDF_BlinnPhong( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in vec3 specularColor, const in float shininess ) {\n\tvec3 halfDir = normalize( lightDir + viewDir );\n\tfloat dotNH = saturate( dot( normal, halfDir ) );\n\tfloat dotVH = saturate( dot( viewDir, halfDir ) );\n\tvec3 F = F_Schlick( specularColor, 1.0, dotVH );\n\tfloat G = G_BlinnPhong_Implicit( );\n\tfloat D = D_BlinnPhong( shininess, dotNH );\n\treturn F * ( G * D );\n}\n#if defined( USE_SHEEN )\nfloat D_Charlie( float roughness, float dotNH ) {\n\tfloat alpha = pow2( roughness );\n\tfloat invAlpha = 1.0 / alpha;\n\tfloat cos2h = dotNH * dotNH;\n\tfloat sin2h = max( 1.0 - cos2h, 0.0078125 );\n\treturn ( 2.0 + invAlpha ) * pow( sin2h, invAlpha * 0.5 ) / ( 2.0 * PI );\n}\nfloat V_Neubelt( float dotNV, float dotNL ) {\n\treturn saturate( 1.0 / ( 4.0 * ( dotNL + dotNV - dotNL * dotNV ) ) );\n}\nvec3 BRDF_Sheen( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, vec3 sheenColor, const in float sheenRoughness ) {\n\tvec3 halfDir = normalize( lightDir + viewDir );\n\tfloat dotNL = saturate( dot( normal, lightDir ) );\n\tfloat dotNV = saturate( dot( normal, viewDir ) );\n\tfloat dotNH = saturate( dot( normal, halfDir ) );\n\tfloat D = D_Charlie( sheenRoughness, dotNH );\n\tfloat V = V_Neubelt( dotNV, dotNL );\n\treturn sheenColor * ( D * V );\n}\n#endif",bumpmap_pars_fragment:"#ifdef USE_BUMPMAP\n\tuniform sampler2D bumpMap;\n\tuniform float bumpScale;\n\tvec2 dHdxy_fwd() {\n\t\tvec2 dSTdx = dFdx( vUv );\n\t\tvec2 dSTdy = dFdy( vUv );\n\t\tfloat Hll = bumpScale * texture2D( bumpMap, vUv ).x;\n\t\tfloat dBx = bumpScale * texture2D( bumpMap, vUv + dSTdx ).x - Hll;\n\t\tfloat dBy = bumpScale * texture2D( bumpMap, vUv + dSTdy ).x - Hll;\n\t\treturn vec2( dBx, dBy );\n\t}\n\tvec3 perturbNormalArb( vec3 surf_pos, vec3 surf_norm, vec2 dHdxy, float faceDirection ) {\n\t\tvec3 vSigmaX = vec3( dFdx( surf_pos.x ), dFdx( surf_pos.y ), dFdx( surf_pos.z ) );\n\t\tvec3 vSigmaY = vec3( dFdy( surf_pos.x ), dFdy( surf_pos.y ), dFdy( surf_pos.z ) );\n\t\tvec3 vN = surf_norm;\n\t\tvec3 R1 = cross( vSigmaY, vN );\n\t\tvec3 R2 = cross( vN, vSigmaX );\n\t\tfloat fDet = dot( vSigmaX, R1 ) * faceDirection;\n\t\tvec3 vGrad = sign( fDet ) * ( dHdxy.x * R1 + dHdxy.y * R2 );\n\t\treturn normalize( abs( fDet ) * surf_norm - vGrad );\n\t}\n#endif",clipping_planes_fragment:"#if NUM_CLIPPING_PLANES > 0\n\tvec4 plane;\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < UNION_CLIPPING_PLANES; i ++ ) {\n\t\tplane = clippingPlanes[ i ];\n\t\tif ( dot( vClipPosition, plane.xyz ) > plane.w ) discard;\n\t}\n\t#pragma unroll_loop_end\n\t#if UNION_CLIPPING_PLANES < NUM_CLIPPING_PLANES\n\t\tbool clipped = true;\n\t\t#pragma unroll_loop_start\n\t\tfor ( int i = UNION_CLIPPING_PLANES; i < NUM_CLIPPING_PLANES; i ++ ) {\n\t\t\tplane = clippingPlanes[ i ];\n\t\t\tclipped = ( dot( vClipPosition, plane.xyz ) > plane.w ) && clipped;\n\t\t}\n\t\t#pragma unroll_loop_end\n\t\tif ( clipped ) discard;\n\t#endif\n#endif",clipping_planes_pars_fragment:"#if NUM_CLIPPING_PLANES > 0\n\tvarying vec3 vClipPosition;\n\tuniform vec4 clippingPlanes[ NUM_CLIPPING_PLANES ];\n#endif",clipping_planes_pars_vertex:"#if NUM_CLIPPING_PLANES > 0\n\tvarying vec3 vClipPosition;\n#endif",clipping_planes_vertex:"#if NUM_CLIPPING_PLANES > 0\n\tvClipPosition = - mvPosition.xyz;\n#endif",color_fragment:"#if defined( USE_COLOR_ALPHA )\n\tdiffuseColor *= vColor;\n#elif defined( USE_COLOR )\n\tdiffuseColor.rgb *= vColor;\n#endif",color_pars_fragment:"#if defined( USE_COLOR_ALPHA )\n\tvarying vec4 vColor;\n#elif defined( USE_COLOR )\n\tvarying vec3 vColor;\n#endif",color_pars_vertex:"#if defined( USE_COLOR_ALPHA )\n\tvarying vec4 vColor;\n#elif defined( USE_COLOR ) || defined( USE_INSTANCING_COLOR )\n\tvarying vec3 vColor;\n#endif",color_vertex:"#if defined( USE_COLOR_ALPHA )\n\tvColor = vec4( 1.0 );\n#elif defined( USE_COLOR ) || defined( USE_INSTANCING_COLOR )\n\tvColor = vec3( 1.0 );\n#endif\n#ifdef USE_COLOR\n\tvColor *= color;\n#endif\n#ifdef USE_INSTANCING_COLOR\n\tvColor.xyz *= instanceColor.xyz;\n#endif",common:"#define PI 3.141592653589793\n#define PI2 6.283185307179586\n#define PI_HALF 1.5707963267948966\n#define RECIPROCAL_PI 0.3183098861837907\n#define RECIPROCAL_PI2 0.15915494309189535\n#define EPSILON 1e-6\n#ifndef saturate\n#define saturate( a ) clamp( a, 0.0, 1.0 )\n#endif\n#define whiteComplement( a ) ( 1.0 - saturate( a ) )\nfloat pow2( const in float x ) { return x*x; }\nfloat pow3( const in float x ) { return x*x*x; }\nfloat pow4( const in float x ) { float x2 = x*x; return x2*x2; }\nfloat max3( const in vec3 v ) { return max( max( v.x, v.y ), v.z ); }\nfloat average( const in vec3 color ) { return dot( color, vec3( 0.3333 ) ); }\nhighp float rand( const in vec2 uv ) {\n\tconst highp float a = 12.9898, b = 78.233, c = 43758.5453;\n\thighp float dt = dot( uv.xy, vec2( a,b ) ), sn = mod( dt, PI );\n\treturn fract( sin( sn ) * c );\n}\n#ifdef HIGH_PRECISION\n\tfloat precisionSafeLength( vec3 v ) { return length( v ); }\n#else\n\tfloat precisionSafeLength( vec3 v ) {\n\t\tfloat maxComponent = max3( abs( v ) );\n\t\treturn length( v / maxComponent ) * maxComponent;\n\t}\n#endif\nstruct IncidentLight {\n\tvec3 color;\n\tvec3 direction;\n\tbool visible;\n};\nstruct ReflectedLight {\n\tvec3 directDiffuse;\n\tvec3 directSpecular;\n\tvec3 indirectDiffuse;\n\tvec3 indirectSpecular;\n};\nstruct GeometricContext {\n\tvec3 position;\n\tvec3 viewDir;\n};\nvec3 transformDirection( in vec3 dir, in mat4 matrix ) {\n\treturn normalize( ( matrix * vec4( dir, 0.0 ) ).xyz );\n}\nvec3 inverseTransformDirection( in vec3 dir, in mat4 matrix ) {\n\treturn normalize( ( vec4( dir, 0.0 ) * matrix ).xyz );\n}\nmat3 transposeMat3( const in mat3 m ) {\n\tmat3 tmp;\n\ttmp[ 0 ] = vec3( m[ 0 ].x, m[ 1 ].x, m[ 2 ].x );\n\ttmp[ 1 ] = vec3( m[ 0 ].y, m[ 1 ].y, m[ 2 ].y );\n\ttmp[ 2 ] = vec3( m[ 0 ].z, m[ 1 ].z, m[ 2 ].z );\n\treturn tmp;\n}\nfloat linearToRelativeLuminance( const in vec3 color ) {\n\tvec3 weights = vec3( 0.2126, 0.7152, 0.0722 );\n\treturn dot( weights, color.rgb );\n}\nbool isPerspectiveMatrix( mat4 m ) {\n\treturn m[ 2 ][ 3 ] == - 1.0;\n}\nvec2 equirectUv( in vec3 dir ) {\n\tfloat u = atan( dir.z, dir.x ) * RECIPROCAL_PI2 + 0.5;\n\tfloat v = asin( clamp( dir.y, - 1.0, 1.0 ) ) * RECIPROCAL_PI + 0.5;\n\treturn vec2( u, v );\n}",cube_uv_reflection_fragment:"#ifdef ENVMAP_TYPE_CUBE_UV\n\t#define cubeUV_maxMipLevel 8.0\n\t#define cubeUV_minMipLevel 4.0\n\t#define cubeUV_maxTileSize 256.0\n\t#define cubeUV_minTileSize 16.0\n\tfloat getFace( vec3 direction ) {\n\t\tvec3 absDirection = abs( direction );\n\t\tfloat face = - 1.0;\n\t\tif ( absDirection.x > absDirection.z ) {\n\t\t\tif ( absDirection.x > absDirection.y )\n\t\t\t\tface = direction.x > 0.0 ? 0.0 : 3.0;\n\t\t\telse\n\t\t\t\tface = direction.y > 0.0 ? 1.0 : 4.0;\n\t\t} else {\n\t\t\tif ( absDirection.z > absDirection.y )\n\t\t\t\tface = direction.z > 0.0 ? 2.0 : 5.0;\n\t\t\telse\n\t\t\t\tface = direction.y > 0.0 ? 1.0 : 4.0;\n\t\t}\n\t\treturn face;\n\t}\n\tvec2 getUV( vec3 direction, float face ) {\n\t\tvec2 uv;\n\t\tif ( face == 0.0 ) {\n\t\t\tuv = vec2(-direction.z, direction.y) / abs(direction.x);\n\t\t} else if ( face == 1.0 ) {\n\t\t\tuv = vec2(direction.x, -direction.z) / abs(direction.y);\n\t\t} else if ( face == 2.0 ) {\n\t\t\tuv = direction.xy / abs(direction.z);\n\t\t} else if ( face == 3.0 ) {\n\t\t\tuv = vec2(direction.z, direction.y) / abs(direction.x);\n\t\t} else if ( face == 4.0 ) {\n\t\t\tuv = direction.xz / abs(direction.y);\n\t\t} else {\n\t\t\tuv = vec2(-direction.x, direction.y) / abs(direction.z);\n\t\t}\n\t\treturn 0.5 * ( uv + 1.0 );\n\t}\n\tvec3 bilinearCubeUV( sampler2D envMap, vec3 direction, float mipInt ) {\n\t\tfloat face = getFace( direction );\n\t\tfloat filterInt = max( cubeUV_minMipLevel - mipInt, 0.0 );\n\t\tmipInt = max( mipInt, cubeUV_minMipLevel );\n\t\tfloat faceSize = exp2( mipInt );\n\t\tfloat texelSize = 1.0 / ( 3.0 * cubeUV_maxTileSize );\n\t\tvec2 uv = getUV( direction, face ) * ( faceSize - 1.0 );\n\t\tvec2 f = fract( uv );\n\t\tuv += 0.5 - f;\n\t\tif ( face > 2.0 ) {\n\t\t\tuv.y += faceSize;\n\t\t\tface -= 3.0;\n\t\t}\n\t\tuv.x += face * faceSize;\n\t\tif ( mipInt < cubeUV_maxMipLevel ) {\n\t\t\tuv.y += 2.0 * cubeUV_maxTileSize;\n\t\t}\n\t\tuv.y += filterInt * 2.0 * cubeUV_minTileSize;\n\t\tuv.x += 3.0 * max( 0.0, cubeUV_maxTileSize - 2.0 * faceSize );\n\t\tuv *= texelSize;\n\t\tvec3 tl = envMapTexelToLinear( texture2D( envMap, uv ) ).rgb;\n\t\tuv.x += texelSize;\n\t\tvec3 tr = envMapTexelToLinear( texture2D( envMap, uv ) ).rgb;\n\t\tuv.y += texelSize;\n\t\tvec3 br = envMapTexelToLinear( texture2D( envMap, uv ) ).rgb;\n\t\tuv.x -= texelSize;\n\t\tvec3 bl = envMapTexelToLinear( texture2D( envMap, uv ) ).rgb;\n\t\tvec3 tm = mix( tl, tr, f.x );\n\t\tvec3 bm = mix( bl, br, f.x );\n\t\treturn mix( tm, bm, f.y );\n\t}\n\t#define r0 1.0\n\t#define v0 0.339\n\t#define m0 - 2.0\n\t#define r1 0.8\n\t#define v1 0.276\n\t#define m1 - 1.0\n\t#define r4 0.4\n\t#define v4 0.046\n\t#define m4 2.0\n\t#define r5 0.305\n\t#define v5 0.016\n\t#define m5 3.0\n\t#define r6 0.21\n\t#define v6 0.0038\n\t#define m6 4.0\n\tfloat roughnessToMip( float roughness ) {\n\t\tfloat mip = 0.0;\n\t\tif ( roughness >= r1 ) {\n\t\t\tmip = ( r0 - roughness ) * ( m1 - m0 ) / ( r0 - r1 ) + m0;\n\t\t} else if ( roughness >= r4 ) {\n\t\t\tmip = ( r1 - roughness ) * ( m4 - m1 ) / ( r1 - r4 ) + m1;\n\t\t} else if ( roughness >= r5 ) {\n\t\t\tmip = ( r4 - roughness ) * ( m5 - m4 ) / ( r4 - r5 ) + m4;\n\t\t} else if ( roughness >= r6 ) {\n\t\t\tmip = ( r5 - roughness ) * ( m6 - m5 ) / ( r5 - r6 ) + m5;\n\t\t} else {\n\t\t\tmip = - 2.0 * log2( 1.16 * roughness );\t\t}\n\t\treturn mip;\n\t}\n\tvec4 textureCubeUV( sampler2D envMap, vec3 sampleDir, float roughness ) {\n\t\tfloat mip = clamp( roughnessToMip( roughness ), m0, cubeUV_maxMipLevel );\n\t\tfloat mipF = fract( mip );\n\t\tfloat mipInt = floor( mip );\n\t\tvec3 color0 = bilinearCubeUV( envMap, sampleDir, mipInt );\n\t\tif ( mipF == 0.0 ) {\n\t\t\treturn vec4( color0, 1.0 );\n\t\t} else {\n\t\t\tvec3 color1 = bilinearCubeUV( envMap, sampleDir, mipInt + 1.0 );\n\t\t\treturn vec4( mix( color0, color1, mipF ), 1.0 );\n\t\t}\n\t}\n#endif",defaultnormal_vertex:"vec3 transformedNormal = objectNormal;\n#ifdef USE_INSTANCING\n\tmat3 m = mat3( instanceMatrix );\n\ttransformedNormal /= vec3( dot( m[ 0 ], m[ 0 ] ), dot( m[ 1 ], m[ 1 ] ), dot( m[ 2 ], m[ 2 ] ) );\n\ttransformedNormal = m * transformedNormal;\n#endif\ntransformedNormal = normalMatrix * transformedNormal;\n#ifdef FLIP_SIDED\n\ttransformedNormal = - transformedNormal;\n#endif\n#ifdef USE_TANGENT\n\tvec3 transformedTangent = ( modelViewMatrix * vec4( objectTangent, 0.0 ) ).xyz;\n\t#ifdef FLIP_SIDED\n\t\ttransformedTangent = - transformedTangent;\n\t#endif\n#endif",displacementmap_pars_vertex:"#ifdef USE_DISPLACEMENTMAP\n\tuniform sampler2D displacementMap;\n\tuniform float displacementScale;\n\tuniform float displacementBias;\n#endif",displacementmap_vertex:"#ifdef USE_DISPLACEMENTMAP\n\ttransformed += normalize( objectNormal ) * ( texture2D( displacementMap, vUv ).x * displacementScale + displacementBias );\n#endif",emissivemap_fragment:"#ifdef USE_EMISSIVEMAP\n\tvec4 emissiveColor = texture2D( emissiveMap, vUv );\n\temissiveColor.rgb = emissiveMapTexelToLinear( emissiveColor ).rgb;\n\ttotalEmissiveRadiance *= emissiveColor.rgb;\n#endif",emissivemap_pars_fragment:"#ifdef USE_EMISSIVEMAP\n\tuniform sampler2D emissiveMap;\n#endif",encodings_fragment:"gl_FragColor = linearToOutputTexel( gl_FragColor );",encodings_pars_fragment:"vec4 LinearToLinear( in vec4 value ) {\n\treturn value;\n}\nvec4 sRGBToLinear( in vec4 value ) {\n\treturn vec4( mix( pow( value.rgb * 0.9478672986 + vec3( 0.0521327014 ), vec3( 2.4 ) ), value.rgb * 0.0773993808, vec3( lessThanEqual( value.rgb, vec3( 0.04045 ) ) ) ), value.a );\n}\nvec4 LinearTosRGB( in vec4 value ) {\n\treturn vec4( mix( pow( value.rgb, vec3( 0.41666 ) ) * 1.055 - vec3( 0.055 ), value.rgb * 12.92, vec3( lessThanEqual( value.rgb, vec3( 0.0031308 ) ) ) ), value.a );\n}\nvec4 RGBEToLinear( in vec4 value ) {\n\treturn vec4( value.rgb * exp2( value.a * 255.0 - 128.0 ), 1.0 );\n}\nvec4 LinearToRGBE( in vec4 value ) {\n\tfloat maxComponent = max( max( value.r, value.g ), value.b );\n\tfloat fExp = clamp( ceil( log2( maxComponent ) ), -128.0, 127.0 );\n\treturn vec4( value.rgb / exp2( fExp ), ( fExp + 128.0 ) / 255.0 );\n}",envmap_fragment:"#ifdef USE_ENVMAP\n\t#ifdef ENV_WORLDPOS\n\t\tvec3 cameraToFrag;\n\t\tif ( isOrthographic ) {\n\t\t\tcameraToFrag = normalize( vec3( - viewMatrix[ 0 ][ 2 ], - viewMatrix[ 1 ][ 2 ], - viewMatrix[ 2 ][ 2 ] ) );\n\t\t} else {\n\t\t\tcameraToFrag = normalize( vWorldPosition - cameraPosition );\n\t\t}\n\t\tvec3 worldNormal = inverseTransformDirection( normal, viewMatrix );\n\t\t#ifdef ENVMAP_MODE_REFLECTION\n\t\t\tvec3 reflectVec = reflect( cameraToFrag, worldNormal );\n\t\t#else\n\t\t\tvec3 reflectVec = refract( cameraToFrag, worldNormal, refractionRatio );\n\t\t#endif\n\t#else\n\t\tvec3 reflectVec = vReflect;\n\t#endif\n\t#ifdef ENVMAP_TYPE_CUBE\n\t\tvec4 envColor = textureCube( envMap, vec3( flipEnvMap * reflectVec.x, reflectVec.yz ) );\n\t\tenvColor = envMapTexelToLinear( envColor );\n\t#elif defined( ENVMAP_TYPE_CUBE_UV )\n\t\tvec4 envColor = textureCubeUV( envMap, reflectVec, 0.0 );\n\t#else\n\t\tvec4 envColor = vec4( 0.0 );\n\t#endif\n\t#ifdef ENVMAP_BLENDING_MULTIPLY\n\t\toutgoingLight = mix( outgoingLight, outgoingLight * envColor.xyz, specularStrength * reflectivity );\n\t#elif defined( ENVMAP_BLENDING_MIX )\n\t\toutgoingLight = mix( outgoingLight, envColor.xyz, specularStrength * reflectivity );\n\t#elif defined( ENVMAP_BLENDING_ADD )\n\t\toutgoingLight += envColor.xyz * specularStrength * reflectivity;\n\t#endif\n#endif",envmap_common_pars_fragment:"#ifdef USE_ENVMAP\n\tuniform float envMapIntensity;\n\tuniform float flipEnvMap;\n\t#ifdef ENVMAP_TYPE_CUBE\n\t\tuniform samplerCube envMap;\n\t#else\n\t\tuniform sampler2D envMap;\n\t#endif\n\t\n#endif",envmap_pars_fragment:"#ifdef USE_ENVMAP\n\tuniform float reflectivity;\n\t#if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG )\n\t\t#define ENV_WORLDPOS\n\t#endif\n\t#ifdef ENV_WORLDPOS\n\t\tvarying vec3 vWorldPosition;\n\t\tuniform float refractionRatio;\n\t#else\n\t\tvarying vec3 vReflect;\n\t#endif\n#endif",envmap_pars_vertex:"#ifdef USE_ENVMAP\n\t#if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) ||defined( PHONG )\n\t\t#define ENV_WORLDPOS\n\t#endif\n\t#ifdef ENV_WORLDPOS\n\t\t\n\t\tvarying vec3 vWorldPosition;\n\t#else\n\t\tvarying vec3 vReflect;\n\t\tuniform float refractionRatio;\n\t#endif\n#endif",envmap_physical_pars_fragment:"#if defined( USE_ENVMAP )\n\tuniform float refractionRatio;\n\tvec3 getIBLIrradiance( const in vec3 normal ) {\n\t\t#if defined( ENVMAP_TYPE_CUBE_UV )\n\t\t\tvec3 worldNormal = inverseTransformDirection( normal, viewMatrix );\n\t\t\tvec4 envMapColor = textureCubeUV( envMap, worldNormal, 1.0 );\n\t\t\treturn PI * envMapColor.rgb * envMapIntensity;\n\t\t#else\n\t\t\treturn vec3( 0.0 );\n\t\t#endif\n\t}\n\tvec3 getIBLRadiance( const in vec3 outVec, const in float roughness ) {\n\t\t#if defined( ENVMAP_TYPE_CUBE_UV )\n\t\t\tvec3 worldOutVec = inverseTransformDirection( outVec, viewMatrix );\n\t\t\tvec4 envMapColor = textureCubeUV( envMap, worldOutVec, roughness );\n\t\t\treturn envMapColor.rgb * envMapIntensity;\n\t\t#else\n\t\t\treturn vec3( 0.0 );\n\t\t#endif\n\t}\n\tvec3 getIBLRadianceReflection( const in vec3 viewDir, const in vec3 normal, const in float roughness ) {\n\t\tvec3 reflectVec = reflect( -viewDir, normal );\n\t\treflectVec = normalize( mix( reflectVec, normal, roughness * roughness) );\n\t\treturn getIBLRadiance(reflectVec, roughness);\n\t}\n\tvec3 refract2(vec3 viewVec, vec3 Normal, float ior) {\n\t\tfloat vn = dot(viewVec, Normal);\n\t\tfloat k = 1.0 - ior * ior * (1.0 - vn * vn);\n\t\tvec3 refrVec = ior * viewVec - (ior * vn + sqrt(k)) * Normal;\n\t\treturn refrVec;\n\t}\n\tvec3 getIBLRadianceRefraction( const in vec3 viewDir, const in vec3 normal, const in float roughness ) {\n\t\tvec3 refractVec = refract2( -viewDir, normal, refractionRatio );\n\t\treturn getIBLRadiance(refractVec, roughness);\n\t}\n#endif",envmap_vertex:"#ifdef USE_ENVMAP\n\t#ifdef ENV_WORLDPOS\n\t\tvWorldPosition = worldPosition.xyz;\n\t#else\n\t\tvec3 cameraToVertex;\n\t\tif ( isOrthographic ) {\n\t\t\tcameraToVertex = normalize( vec3( - viewMatrix[ 0 ][ 2 ], - viewMatrix[ 1 ][ 2 ], - viewMatrix[ 2 ][ 2 ] ) );\n\t\t} else {\n\t\t\tcameraToVertex = normalize( worldPosition.xyz - cameraPosition );\n\t\t}\n\t\tvec3 worldNormal = inverseTransformDirection( transformedNormal, viewMatrix );\n\t\t#ifdef ENVMAP_MODE_REFLECTION\n\t\t\tvReflect = reflect( cameraToVertex, worldNormal );\n\t\t#else\n\t\t\tvReflect = refract( cameraToVertex, worldNormal, refractionRatio );\n\t\t#endif\n\t#endif\n#endif",fog_vertex:"#ifdef USE_FOG\n\tvFogDepth = - mvPosition.z;\n#endif",fog_pars_vertex:"#ifdef USE_FOG\n\tvarying float vFogDepth;\n#endif",fog_fragment:"#ifdef USE_FOG\n\t#ifdef FOG_EXP2\n\t\tfloat fogFactor = 1.0 - exp( - fogDensity * fogDensity * vFogDepth * vFogDepth );\n\t#else\n\t\tfloat fogFactor = smoothstep( fogNear, fogFar, vFogDepth );\n\t#endif\n\tgl_FragColor.rgb = mix( gl_FragColor.rgb, fogColor, fogFactor );\n#endif",fog_pars_fragment:"#ifdef USE_FOG\n\tuniform vec3 fogColor;\n\tvarying float vFogDepth;\n\t#ifdef FOG_EXP2\n\t\tuniform float fogDensity;\n\t#else\n\t\tuniform float fogNear;\n\t\tuniform float fogFar;\n\t#endif\n#endif",gradientmap_pars_fragment:"#ifdef USE_GRADIENTMAP\n\tuniform sampler2D gradientMap;\n#endif\nvec3 getGradientIrradiance( vec3 normal, vec3 lightDirection ) {\n\tfloat dotNL = dot( normal, lightDirection );\n\tvec2 coord = vec2( dotNL * 0.5 + 0.5, 0.0 );\n\t#ifdef USE_GRADIENTMAP\n\t\treturn vec3( texture2D( gradientMap, coord ).r );\n\t#else\n\t\treturn ( coord.x < 0.7 ) ? vec3( 0.7 ) : vec3( 1.0 );\n\t#endif\n}",lightmap_fragment:"#ifdef USE_LIGHTMAP\n\tvec4 lightMapTexel = texture2D( lightMap, vUv2 );\n\tvec3 lightMapIrradiance = lightMapTexelToLinear( lightMapTexel ).rgb * lightMapIntensity;\n\t#ifndef PHYSICALLY_CORRECT_LIGHTS\n\t\tlightMapIrradiance *= PI;\n\t#endif\n\treflectedLight.indirectDiffuse += lightMapIrradiance;\n#endif",lightmap_pars_fragment:"#ifdef USE_LIGHTMAP\n\tuniform sampler2D lightMap;\n\tuniform float lightMapIntensity;\n#endif",lights_lambert_vertex:"vec3 diffuse = vec3( 1.0 );\nGeometricContext geometry;\ngeometry.position = mvPosition.xyz;\ngeometry.viewDir = ( isOrthographic ) ? vec3( 0, 0, 1 ) : normalize( -mvPosition.xyz );\nvec3 normal = normalize( transformedNormal );\nGeometricContext backGeometry;\nbackGeometry.position = geometry.position;\nbackGeometry.viewDir = geometry.viewDir;\nvec3 backNormal = -normal;\nvLightFront = vec3( 0.0 );\nvIndirectFront = vec3( 0.0 );\n#ifdef DOUBLE_SIDED\n\tvLightBack = vec3( 0.0 );\n\tvIndirectBack = vec3( 0.0 );\n#endif\nIncidentLight directLight;\nfloat dotNL;\nvec3 directLightColor_Diffuse;\nvIndirectFront += getAmbientLightIrradiance( ambientLightColor );\nvIndirectFront += getLightProbeIrradiance( lightProbe, normal );\n#ifdef DOUBLE_SIDED\n\tvIndirectBack += getAmbientLightIrradiance( ambientLightColor );\n\tvIndirectBack += getLightProbeIrradiance( lightProbe, backNormal );\n#endif\n#if NUM_POINT_LIGHTS > 0\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) {\n\t\tgetPointLightInfo( pointLights[ i ], geometry, directLight );\n\t\tdotNL = dot( normal, directLight.direction );\n\t\tdirectLightColor_Diffuse = directLight.color;\n\t\tvLightFront += saturate( dotNL ) * directLightColor_Diffuse;\n\t\t#ifdef DOUBLE_SIDED\n\t\t\tvLightBack += saturate( - dotNL ) * directLightColor_Diffuse;\n\t\t#endif\n\t}\n\t#pragma unroll_loop_end\n#endif\n#if NUM_SPOT_LIGHTS > 0\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_SPOT_LIGHTS; i ++ ) {\n\t\tgetSpotLightInfo( spotLights[ i ], geometry, directLight );\n\t\tdotNL = dot( normal, directLight.direction );\n\t\tdirectLightColor_Diffuse = directLight.color;\n\t\tvLightFront += saturate( dotNL ) * directLightColor_Diffuse;\n\t\t#ifdef DOUBLE_SIDED\n\t\t\tvLightBack += saturate( - dotNL ) * directLightColor_Diffuse;\n\t\t#endif\n\t}\n\t#pragma unroll_loop_end\n#endif\n#if NUM_DIR_LIGHTS > 0\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) {\n\t\tgetDirectionalLightInfo( directionalLights[ i ], geometry, directLight );\n\t\tdotNL = dot( normal, directLight.direction );\n\t\tdirectLightColor_Diffuse = directLight.color;\n\t\tvLightFront += saturate( dotNL ) * directLightColor_Diffuse;\n\t\t#ifdef DOUBLE_SIDED\n\t\t\tvLightBack += saturate( - dotNL ) * directLightColor_Diffuse;\n\t\t#endif\n\t}\n\t#pragma unroll_loop_end\n#endif\n#if NUM_HEMI_LIGHTS > 0\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_HEMI_LIGHTS; i ++ ) {\n\t\tvIndirectFront += getHemisphereLightIrradiance( hemisphereLights[ i ], normal );\n\t\t#ifdef DOUBLE_SIDED\n\t\t\tvIndirectBack += getHemisphereLightIrradiance( hemisphereLights[ i ], backNormal );\n\t\t#endif\n\t}\n\t#pragma unroll_loop_end\n#endif",lights_pars_begin:"uniform bool receiveShadow;\nuniform vec3 ambientLightColor;\nuniform vec3 lightProbe[ 9 ];\nvec3 shGetIrradianceAt( in vec3 normal, in vec3 shCoefficients[ 9 ] ) {\n\tfloat x = normal.x, y = normal.y, z = normal.z;\n\tvec3 result = shCoefficients[ 0 ] * 0.886227;\n\tresult += shCoefficients[ 1 ] * 2.0 * 0.511664 * y;\n\tresult += shCoefficients[ 2 ] * 2.0 * 0.511664 * z;\n\tresult += shCoefficients[ 3 ] * 2.0 * 0.511664 * x;\n\tresult += shCoefficients[ 4 ] * 2.0 * 0.429043 * x * y;\n\tresult += shCoefficients[ 5 ] * 2.0 * 0.429043 * y * z;\n\tresult += shCoefficients[ 6 ] * ( 0.743125 * z * z - 0.247708 );\n\tresult += shCoefficients[ 7 ] * 2.0 * 0.429043 * x * z;\n\tresult += shCoefficients[ 8 ] * 0.429043 * ( x * x - y * y );\n\treturn result;\n}\nvec3 getLightProbeIrradiance( const in vec3 lightProbe[ 9 ], const in vec3 normal ) {\n\tvec3 worldNormal = inverseTransformDirection( normal, viewMatrix );\n\tvec3 irradiance = shGetIrradianceAt( worldNormal, lightProbe );\n\treturn irradiance;\n}\nvec3 getAmbientLightIrradiance( const in vec3 ambientLightColor ) {\n\tvec3 irradiance = ambientLightColor;\n\treturn irradiance;\n}\nfloat getDistanceAttenuation( const in float lightDistance, const in float cutoffDistance, const in float decayExponent ) {\n\t#if defined ( PHYSICALLY_CORRECT_LIGHTS )\n\t\tfloat distanceFalloff = 1.0 / max( pow( lightDistance, decayExponent ), 0.01 );\n\t\tif ( cutoffDistance > 0.0 ) {\n\t\t\tdistanceFalloff *= pow2( saturate( 1.0 - pow4( lightDistance / cutoffDistance ) ) );\n\t\t}\n\t\treturn distanceFalloff;\n\t#else\n\t\tif ( cutoffDistance > 0.0 && decayExponent > 0.0 ) {\n\t\t\treturn pow( saturate( - lightDistance / cutoffDistance + 1.0 ), decayExponent );\n\t\t}\n\t\treturn 1.0;\n\t#endif\n}\nfloat getSpotAttenuation( const in float coneCosine, const in float penumbraCosine, const in float angleCosine ) {\n\treturn smoothstep( coneCosine, penumbraCosine, angleCosine );\n}\n#if NUM_DIR_LIGHTS > 0\n\tstruct DirectionalLight {\n\t\tvec3 direction;\n\t\tvec3 color;\n\t};\n\tuniform DirectionalLight directionalLights[ NUM_DIR_LIGHTS ];\n\tvoid getDirectionalLightInfo( const in DirectionalLight directionalLight, const in GeometricContext geometry, out IncidentLight light ) {\n\t\tlight.color = directionalLight.color;\n\t\tlight.direction = directionalLight.direction;\n\t\tlight.visible = true;\n\t}\n#endif\n#if NUM_POINT_LIGHTS > 0\n\tstruct PointLight {\n\t\tvec3 position;\n\t\tvec3 color;\n\t\tfloat distance;\n\t\tfloat decay;\n\t};\n\tuniform PointLight pointLights[ NUM_POINT_LIGHTS ];\n\tvoid getPointLightInfo( const in PointLight pointLight, const in GeometricContext geometry, out IncidentLight light ) {\n\t\tvec3 lVector = pointLight.position - geometry.position;\n\t\tlight.direction = normalize( lVector );\n\t\tfloat lightDistance = length( lVector );\n\t\tlight.color = pointLight.color;\n\t\tlight.color *= getDistanceAttenuation( lightDistance, pointLight.distance, pointLight.decay );\n\t\tlight.visible = ( light.color != vec3( 0.0 ) );\n\t}\n#endif\n#if NUM_SPOT_LIGHTS > 0\n\tstruct SpotLight {\n\t\tvec3 position;\n\t\tvec3 direction;\n\t\tvec3 color;\n\t\tfloat distance;\n\t\tfloat decay;\n\t\tfloat coneCos;\n\t\tfloat penumbraCos;\n\t};\n\tuniform SpotLight spotLights[ NUM_SPOT_LIGHTS ];\n\tvoid getSpotLightInfo( const in SpotLight spotLight, const in GeometricContext geometry, out IncidentLight light ) {\n\t\tvec3 lVector = spotLight.position - geometry.position;\n\t\tlight.direction = normalize( lVector );\n\t\tfloat angleCos = dot( light.direction, spotLight.direction );\n\t\tfloat spotAttenuation = getSpotAttenuation( spotLight.coneCos, spotLight.penumbraCos, angleCos );\n\t\tif ( spotAttenuation > 0.0 ) {\n\t\t\tfloat lightDistance = length( lVector );\n\t\t\tlight.color = spotLight.color * spotAttenuation;\n\t\t\tlight.color *= getDistanceAttenuation( lightDistance, spotLight.distance, spotLight.decay );\n\t\t\tlight.visible = ( light.color != vec3( 0.0 ) );\n\t\t} else {\n\t\t\tlight.color = vec3( 0.0 );\n\t\t\tlight.visible = false;\n\t\t}\n\t}\n#endif\n#if NUM_RECT_AREA_LIGHTS > 0\n\tstruct RectAreaLight {\n\t\tvec3 color;\n\t\tvec3 position;\n\t\tvec3 halfWidth;\n\t\tvec3 halfHeight;\n\t};\n\tuniform sampler2D ltc_1;\tuniform sampler2D ltc_2;\n\tuniform RectAreaLight rectAreaLights[ NUM_RECT_AREA_LIGHTS ];\n#endif\n#if NUM_HEMI_LIGHTS > 0\n\tstruct HemisphereLight {\n\t\tvec3 direction;\n\t\tvec3 skyColor;\n\t\tvec3 groundColor;\n\t};\n\tuniform HemisphereLight hemisphereLights[ NUM_HEMI_LIGHTS ];\n\tvec3 getHemisphereLightIrradiance( const in HemisphereLight hemiLight, const in vec3 normal ) {\n\t\tfloat dotNL = dot( normal, hemiLight.direction );\n\t\tfloat hemiDiffuseWeight = 0.5 * dotNL + 0.5;\n\t\tvec3 irradiance = mix( hemiLight.groundColor, hemiLight.skyColor, hemiDiffuseWeight );\n\t\treturn irradiance;\n\t}\n#endif",lights_toon_fragment:"ToonMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb;",lights_toon_pars_fragment:"varying vec3 vViewPosition;\nstruct ToonMaterial {\n\tvec3 diffuseColor;\n};\nvoid RE_Direct_Toon(\n\tconst in IncidentLight directLight,\n\tconst in vec3 normal,\n#ifdef USE_CLEARCOAT\n\tconst in vec3 ccNormal,\n#endif\n\tconst in GeometricContext geometry,\n\tconst in ToonMaterial material,\n\tinout ReflectedLight reflectedLight\n) {\n\tvec3 irradiance = getGradientIrradiance( normal, directLight.direction ) * directLight.color;\n\treflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n}\nvoid RE_IndirectDiffuse_Toon( const in vec3 irradiance, const in GeometricContext geometry, const in ToonMaterial material, inout ReflectedLight reflectedLight ) {\n\treflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n}\n#define RE_Direct\t\t\t\tRE_Direct_Toon\n#define RE_IndirectDiffuse\t\tRE_IndirectDiffuse_Toon\n#define Material_LightProbeLOD( material )\t(0)",lights_phong_fragment:"BlinnPhongMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb;\nmaterial.specularColor = specular;\nmaterial.specularShininess = shininess;\nmaterial.specularStrength = specularStrength;",lights_phong_pars_fragment:"varying vec3 vViewPosition;\nstruct BlinnPhongMaterial {\n\tvec3 diffuseColor;\n\tvec3 specularColor;\n\tfloat specularShininess;\n\tfloat specularStrength;\n};\nvoid RE_Direct_BlinnPhong(\n\tconst in IncidentLight directLight,\n\tconst in vec3 normal,\n#ifdef USE_CLEARCOAT\n\tconst in vec3 ccNormal,\n#endif\n\tconst in GeometricContext geometry,\n\tconst in BlinnPhongMaterial material,\n\tinout ReflectedLight reflectedLight\n) {\n\tfloat dotNL = saturate( dot( normal, directLight.direction ) );\n\tvec3 irradiance = dotNL * directLight.color;\n\treflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n\treflectedLight.directSpecular += irradiance * BRDF_BlinnPhong( directLight.direction, geometry.viewDir, normal, material.specularColor, material.specularShininess ) * material.specularStrength;\n}\nvoid RE_IndirectDiffuse_BlinnPhong( const in vec3 irradiance, const in GeometricContext geometry, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight ) {\n\treflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n}\n#define RE_Direct\t\t\t\tRE_Direct_BlinnPhong\n#define RE_IndirectDiffuse\t\tRE_IndirectDiffuse_BlinnPhong\n#define Material_LightProbeLOD( material )\t(0)",lights_physical_fragment:"PhysicalMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb * ( 1.0 - metalnessFactor );\nvec3 dxy = max( abs( dFdx( geometryNormal ) ), abs( dFdy( geometryNormal ) ) );\nfloat geometryRoughness = max( max( dxy.x, dxy.y ), dxy.z );\nmaterial.roughness = max( roughnessFactor, 0.0525 );material.roughness += geometryRoughness;\nmaterial.roughness = min( material.roughness, 1.0 );\n#ifdef IOR\n\t#ifdef SPECULAR\n\t\tfloat specularIntensityFactor = specularIntensity;\n\t\tvec3 specularColorFactor = specularColor;\n\t\t#ifdef USE_SPECULARINTENSITYMAP\n\t\t\tspecularIntensityFactor *= texture2D( specularIntensityMap,\n\t\t\t\t#if defined( USE_LIGHTMAP ) || defined( USE_AOMAP )\n\t\t\t\t\tvUv2\n\t\t\t\t#else\n\t\t\t\t\tvUv\n\t\t\t\t#endif\n\t\t\t).a;\n\t\t#endif\n\t\t#ifdef USE_SPECULARCOLORMAP\n\t\t\tspecularColorFactor *= specularColorMapTexelToLinear( texture2D( specularColorMap, vUv ) ).rgb;\n\t\t#endif\n\t\tmaterial.specularF90 = mix( specularIntensityFactor, 1.0, metalnessFactor );\n\t#else\n\t\tfloat specularIntensityFactor = 1.0;\n\t\tvec3 specularColorFactor = vec3( 1.0 );\n\t\tmaterial.specularF90 = 1.0;\n\t#endif\n\tmaterial.specularColor = mix( min( pow2( ( ior - 1.0 ) / ( ior + 1.0 ) ) * specularColorFactor, vec3( 1.0 ) ) * specularIntensityFactor, diffuseColor.rgb, metalnessFactor );\n#else\n\tmaterial.specularColor = mix( vec3( 0.04 ), diffuseColor.rgb, metalnessFactor );\n\tmaterial.specularF90 = 1.0;\n#endif\n#ifdef USE_CLEARCOAT\n\tmaterial.clearcoat = clearcoat;\n\tmaterial.clearcoatRoughness = clearcoatRoughness;\n\tmaterial.clearcoatF0 = vec3( 0.04 );\n\tmaterial.clearcoatF90 = 1.0;\n\t#ifdef USE_CLEARCOATMAP\n\t\tmaterial.clearcoat *= texture2D( clearcoatMap, vUv ).x;\n\t#endif\n\t#ifdef USE_CLEARCOAT_ROUGHNESSMAP\n\t\tmaterial.clearcoatRoughness *= texture2D( clearcoatRoughnessMap, vUv ).y;\n\t#endif\n\tmaterial.clearcoat = saturate( material.clearcoat );\tmaterial.clearcoatRoughness = max( material.clearcoatRoughness, 0.0525 );\n\tmaterial.clearcoatRoughness += geometryRoughness;\n\tmaterial.clearcoatRoughness = min( material.clearcoatRoughness, 1.0 );\n#endif\n#ifdef USE_SHEEN\n\tmaterial.sheenColor = sheenColor;\n\t#ifdef USE_SHEENCOLORMAP\n\t\tmaterial.sheenColor *= sheenColorMapTexelToLinear( texture2D( sheenColorMap, vUv ) ).rgb;\n\t#endif\n\tmaterial.sheenRoughness = clamp( sheenRoughness, 0.07, 1.0 );\n\t#ifdef USE_SHEENROUGHNESSMAP\n\t\tmaterial.sheenRoughness *= texture2D( sheenRoughnessMap, vUv ).a;\n\t#endif\n#endif\n#ifdef USE_REFRACTION\n\tmaterial.refraction = refraction;\n#endif",lights_physical_pars_fragment:"struct PhysicalMaterial {\n\tvec3 diffuseColor;\n\tfloat roughness;\n\tvec3 specularColor;\n\tfloat specularF90;\n\t#ifdef USE_CLEARCOAT\n\t\tfloat clearcoat;\n\t\tfloat clearcoatRoughness;\n\t\tvec3 clearcoatF0;\n\t\tfloat clearcoatF90;\n\t#endif\n\t#ifdef USE_SHEEN\n\t\tvec3 sheenColor;\n\t\tfloat sheenRoughness;\n\t#endif\n\t#ifdef USE_REFRACTION\n\t\tfloat refraction;\n\t#endif\n};\n#ifndef CLEARCOAT_R115_COMPATABILITY\nvec3 clearcoatSpecular = vec3( 0.0 );\nvec3 sheenSpecular = vec3( 0.0 );\n#endif\nfloat IBLSheenBRDF( const in vec3 normal, const in vec3 viewDir, const in float roughness) {\n\tfloat dotNV = saturate( dot( normal, viewDir ) );\n\tfloat r2 = roughness * roughness;\n\tfloat a = roughness < 0.25 ? -339.2 * r2 + 161.4 * roughness - 25.9 : -8.48 * r2 + 14.3 * roughness - 9.95;\n\tfloat b = roughness < 0.25 ? 44.0 * r2 - 23.7 * roughness + 3.26 : 1.97 * r2 - 3.27 * roughness + 0.72;\n\tfloat DG = exp( a * dotNV + b ) + ( roughness < 0.25 ? 0.0 : 0.1 * ( roughness - 0.25 ) );\n\treturn saturate( DG * RECIPROCAL_PI );\n}\nvec2 DFGApprox( const in vec3 normal, const in vec3 viewDir, const in float roughness ) {\n\tfloat dotNV = saturate( dot( normal, viewDir ) );\n\tconst vec4 c0 = vec4( - 1, - 0.0275, - 0.572, 0.022 );\n\tconst vec4 c1 = vec4( 1, 0.0425, 1.04, - 0.04 );\n\tvec4 r = roughness * c0 + c1;\n\tfloat a004 = min( r.x * r.x, exp2( - 9.28 * dotNV ) ) * r.x + r.y;\n\tvec2 fab = vec2( - 1.04, 1.04 ) * a004 + r.zw;\n\treturn fab;\n}\nvec3 EnvironmentBRDF( const in vec3 normal, const in vec3 viewDir, const in vec3 specularColor, const in float specularF90, const in float roughness ) {\n\tvec2 fab = DFGApprox( normal, viewDir, roughness );\n\treturn specularColor * fab.x + specularF90 * fab.y;\n}\nvoid computeMultiscattering( const in vec3 normal, const in vec3 viewDir, const in vec3 specularColor, const in float specularF90, const in float roughness, inout vec3 singleScatter, inout vec3 multiScatter ) {\n\tvec2 fab = DFGApprox( normal, viewDir, roughness );\n#ifdef MULTISCATTERRING_R115_COMPATABILITY\n\tfloat dotNV = saturate( dot( normal, viewDir ) );\n\tfloat fresnel = exp2( ( -5.55473 * dotNV - 6.98316 ) * dotNV );\n\tvec3 Fr = max( vec3( 1.0 - roughness ), specularColor ) - specularColor;\n\tvec3 F = f90_r115_compatability * Fr * fresnel + specularColor;\n\tvec3 FssEss = F * fab.x + specularF90 * fab.y;\n#else\n\tvec3 FssEss = specularColor * fab.x + specularF90 * fab.y;\n#endif\n\tfloat Ess = fab.x + fab.y;\n\tfloat Ems = 1.0 - Ess;\n\tvec3 Favg = specularColor + ( 1.0 - specularColor ) * 0.047619;\tvec3 Fms = FssEss * Favg / ( 1.0 - Ems * Favg );\n\tsingleScatter += FssEss;\n\tmultiScatter += Fms * Ems;\n}\n#if NUM_RECT_AREA_LIGHTS > 0\n\tvoid RE_Direct_RectArea_Physical( const in RectAreaLight rectAreaLight, const in vec3 normal, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {\n\t\tvec3 viewDir = geometry.viewDir;\n\t\tvec3 position = geometry.position;\n\t\tvec3 lightPos = rectAreaLight.position;\n\t\tvec3 halfWidth = rectAreaLight.halfWidth;\n\t\tvec3 halfHeight = rectAreaLight.halfHeight;\n\t\tvec3 lightColor = rectAreaLight.color;\n\t\tfloat roughness = material.roughness;\n\t\tvec3 rectCoords[ 4 ];\n\t\trectCoords[ 0 ] = lightPos + halfWidth - halfHeight;\t\trectCoords[ 1 ] = lightPos - halfWidth - halfHeight;\n\t\trectCoords[ 2 ] = lightPos - halfWidth + halfHeight;\n\t\trectCoords[ 3 ] = lightPos + halfWidth + halfHeight;\n\t\tvec2 uv = LTC_Uv( normal, viewDir, roughness );\n\t\tvec4 t1 = texture2D( ltc_1, uv );\n\t\tvec4 t2 = texture2D( ltc_2, uv );\n\t\tmat3 mInv = mat3(\n\t\t\tvec3( t1.x, 0, t1.y ),\n\t\t\tvec3(\t\t0, 1,\t\t0 ),\n\t\t\tvec3( t1.z, 0, t1.w )\n\t\t);\n\t\tvec3 fresnel = ( material.specularColor * t2.x + ( vec3( 1.0 ) - material.specularColor ) * t2.y );\n\t\treflectedLight.directSpecular += lightColor * fresnel * LTC_Evaluate( normal, viewDir, position, mInv, rectCoords );\n\t\treflectedLight.directDiffuse += lightColor * material.diffuseColor * LTC_Evaluate( normal, viewDir, position, mat3( 1.0 ), rectCoords );\n\t}\n#endif\n#define DEFAULT_SPECULAR_COEFFICIENT 0.04\nfloat clearcoatDHRApprox( const in float roughness, const in float dotNL ) {\n\treturn DEFAULT_SPECULAR_COEFFICIENT + ( 1.0 - DEFAULT_SPECULAR_COEFFICIENT ) * ( pow( 1.0 - dotNL, 5.0 ) * pow( 1.0 - roughness, 2.0 ) );\n}\nvoid RE_Direct_Physical(\n\tconst in IncidentLight directLight,\n\tconst in vec3 normal,\n#ifdef USE_CLEARCOAT\n\tconst in vec3 ccNormal,\n#endif\n\tconst in GeometricContext geometry,\n\tconst in PhysicalMaterial material,\n\tinout ReflectedLight reflectedLight\n) {\n\tfloat dotNL = saturate( dot( normal, directLight.direction ) );\n\tvec3 irradiance = dotNL * directLight.color;\n\t#ifdef USE_CLEARCOAT\n\t\tfloat dotNLcc = saturate( dot( ccNormal, directLight.direction ) );\n\t\tvec3 ccIrradiance = dotNLcc * directLight.color;\n\t\tvec3 ccSpecular = ccIrradiance * BRDF_GGX( directLight.direction, geometry.viewDir, ccNormal, material.clearcoatF0, material.clearcoatF90, material.clearcoatRoughness );\n\t#ifdef CLEARCOAT_R115_COMPATABILITY\n\t\tfloat clearcoatDHR = material.clearcoat * clearcoatDHRApprox( material.clearcoatRoughness, dotNLcc );\n\t\treflectedLight.directSpecular += material.clearcoat * ccSpecular;\n\t\n\t#else\n\t\tclearcoatSpecular += ccSpecular;\n\t#endif\n\t#else\n\t#ifdef CLEARCOAT_R115_COMPATABILITY\n\t\tfloat clearcoatDHR = 0.0;\n\t#endif\n\t#endif\n\t#ifdef CLEARCOAT_R115_COMPATABILITY\n\tfloat clearcoatInv = 1.0 - clearcoatDHR;\n\t#else\n\tfloat clearcoatInv = 1.0;\n\t#endif\n\t#ifdef USE_SHEEN\n\t\tvec3 snSpecular = irradiance * BRDF_Sheen( directLight.direction, geometry.viewDir, normal, material.sheenColor, material.sheenRoughness );\n\t#ifdef CLEARCOAT_R115_COMPATABILITY\n\t\treflectedLight.directSpecular += clearcoatInv * snSpecular;\n\t#else\n\t\tsheenSpecular += snSpecular;\n\t#endif\n\t#endif\n\treflectedLight.directSpecular += clearcoatInv * irradiance * BRDF_GGX( directLight.direction, geometry.viewDir, normal, material.specularColor, material.specularF90, material.roughness );\n\treflectedLight.directDiffuse += clearcoatInv * irradiance * BRDF_Lambert( material.diffuseColor );\n}\nvoid RE_IndirectDiffuse_Physical( const in vec3 irradiance, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {\n\treflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n}\nvoid RE_IndirectSpecular_Physical(\n\tconst in vec3 radiance,\n#ifdef USE_REFRACTION\n\tconst in vec3 radianceRefraction,\n#endif\n\tconst in vec3 irradiance,\n\tconst in vec3 clearcoatRadiance,\n\tconst in vec3 normal,\n#ifdef USE_CLEARCOAT\n\tconst in vec3 ccNormal,\n#endif\n\tconst in GeometricContext geometry,\n\tconst in PhysicalMaterial material,\n\tinout ReflectedLight reflectedLight\n) {\n\t#ifdef USE_CLEARCOAT\n\t\tvec3 ccSpecular = clearcoatRadiance * EnvironmentBRDF( ccNormal, geometry.viewDir, material.clearcoatF0, material.clearcoatF90, material.clearcoatRoughness );\n\t#ifdef CLEARCOAT_R115_COMPATABILITY\n\t\tfloat dotNLcc = saturate( dot( ccNormal, geometry.viewDir ) );\n\t\tfloat clearcoatDHR = material.clearcoat * clearcoatDHRApprox( material.clearcoatRoughness, dotNLcc );\n\t\treflectedLight.indirectSpecular += material.clearcoat * ccSpecular;\n\t\n\t#else\n\t\tclearcoatSpecular += ccSpecular;\n\t#endif\n\t#else\n\t#ifdef CLEARCOAT_R115_COMPATABILITY\n\t\tfloat clearcoatDHR = 0.0;\n\t#endif\n\t#endif\n\t#ifdef USE_SHEEN\n\t#ifndef CLEARCOAT_R115_COMPATABILITY\n\t\tsheenSpecular += irradiance * material.sheenColor * IBLSheenBRDF( normal, geometry.viewDir, material.sheenRoughness );\n\t#endif\n\t#endif\n\t#ifdef CLEARCOAT_R115_COMPATABILITY\n\tfloat clearcoatInv = 1.0 - clearcoatDHR;\n\t#else\n\tfloat clearcoatInv = 1.0;\n\t#endif\n\tvec3 singleScattering = vec3( 0.0 );\n\tvec3 multiScattering = vec3( 0.0 );\n\tvec3 cosineWeightedIrradiance = irradiance * RECIPROCAL_PI;\n\tcomputeMultiscattering( normal, geometry.viewDir, material.specularColor, material.specularF90, material.roughness, singleScattering, multiScattering );\n\tvec3 diffuse = material.diffuseColor * ( 1.0 - ( singleScattering + multiScattering ) );\n\treflectedLight.indirectSpecular += clearcoatInv * radiance * singleScattering;\n\treflectedLight.indirectSpecular += multiScattering * cosineWeightedIrradiance;\n\treflectedLight.indirectDiffuse += diffuse * cosineWeightedIrradiance;\n\t#ifdef ENVMAP_MODE_REFLECTION\n\t\t#ifdef USE_REFRACTION\n\t\t\treflectedLight.indirectDiffuse = mix(reflectedLight.indirectDiffuse, radianceRefraction * material.diffuseColor, material.refraction);\n\t\t#endif\n\t#endif\n}\n#define RE_Direct\t\t\t\tRE_Direct_Physical\n#define RE_Direct_RectArea\t\tRE_Direct_RectArea_Physical\n#define RE_IndirectDiffuse\t\tRE_IndirectDiffuse_Physical\n#define RE_IndirectSpecular\t\tRE_IndirectSpecular_Physical\nfloat computeSpecularOcclusion( const in float dotNV, const in float ambientOcclusion, const in float roughness ) {\n\treturn saturate( pow( dotNV + ambientOcclusion, exp2( - 16.0 * roughness - 1.0 ) ) - 1.0 + ambientOcclusion );\n}",lights_fragment_begin:"\nGeometricContext geometry;\ngeometry.position = - vViewPosition;\ngeometry.viewDir = ( isOrthographic ) ? vec3( 0, 0, 1 ) : normalize( vViewPosition );\nvec3 splitGeoNormal = normal;\n#ifdef USE_CLEARCOAT\n\tvec3 splitGeoClearcoatNormal = clearcoatNormal;\n#endif\nIncidentLight directLight;\n#if ( NUM_POINT_LIGHTS > 0 ) && defined( RE_Direct )\n\tPointLight pointLight;\n\t#if defined( USE_SHADOWMAP ) && NUM_POINT_LIGHT_SHADOWS > 0\n\tPointLightShadow pointLightShadow;\n\t#endif\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) {\n\t\tpointLight = pointLights[ i ];\n\t\tgetPointLightInfo( pointLight, geometry, directLight );\n\t\t#if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_POINT_LIGHT_SHADOWS )\n\t\tpointLightShadow = pointLightShadows[ i ];\n\t\tdirectLight.color *= all( bvec2( directLight.visible, receiveShadow ) ) ? getPointShadow( pointShadowMap[ i ], pointLightShadow.shadowMapSize, pointLightShadow.shadowBias, pointLightShadow.shadowRadius, vPointShadowCoord[ i ], pointLightShadow.shadowCameraNear, pointLightShadow.shadowCameraFar ) : 1.0;\n\t\t#endif\n\t\tRE_Direct(\n\t\t\tdirectLight,\n\t\t\tsplitGeoNormal,\n#ifdef USE_CLEARCOAT\n\t\t\tsplitGeoClearcoatNormal,\n#endif\n\t\t\tgeometry,\n\t\t\tmaterial,\n\t\t\treflectedLight\n\t\t);\n\t}\n\t#pragma unroll_loop_end\n#endif\n#if ( NUM_SPOT_LIGHTS > 0 ) && defined( RE_Direct )\n\tSpotLight spotLight;\n\t#if defined( USE_SHADOWMAP ) && NUM_SPOT_LIGHT_SHADOWS > 0\n\tSpotLightShadow spotLightShadow;\n\t#endif\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_SPOT_LIGHTS; i ++ ) {\n\t\tspotLight = spotLights[ i ];\n\t\tgetSpotLightInfo( spotLight, geometry, directLight );\n\t\t#if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS )\n\t\tspotLightShadow = spotLightShadows[ i ];\n\t\tdirectLight.color *= all( bvec2( directLight.visible, receiveShadow ) ) ? getShadow( spotShadowMap[ i ], spotLightShadow.shadowMapSize, spotLightShadow.shadowBias, spotLightShadow.shadowRadius, vSpotShadowCoord[ i ] ) : 1.0;\n\t\t#endif\n\t\tRE_Direct(\n\t\t\tdirectLight,\n\t\t\tsplitGeoNormal,\n#ifdef USE_CLEARCOAT\n\t\t\tsplitGeoClearcoatNormal,\n#endif\n\t\t\tgeometry,\n\t\t\tmaterial,\n\t\t\treflectedLight\n\t\t);\n\t}\n\t#pragma unroll_loop_end\n#endif\n#if ( NUM_DIR_LIGHTS > 0 ) && defined( RE_Direct )\n\tDirectionalLight directionalLight;\n\t#if defined( USE_SHADOWMAP ) && NUM_DIR_LIGHT_SHADOWS > 0\n\tDirectionalLightShadow directionalLightShadow;\n\t#endif\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) {\n\t\tdirectionalLight = directionalLights[ i ];\n\t\tgetDirectionalLightInfo( directionalLight, geometry, directLight );\n\t\t#if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_DIR_LIGHT_SHADOWS )\n\t\tdirectionalLightShadow = directionalLightShadows[ i ];\n\t\tdirectLight.color *= all( bvec2( directLight.visible, receiveShadow ) ) ? getShadow( directionalShadowMap[ i ], directionalLightShadow.shadowMapSize, directionalLightShadow.shadowBias, directionalLightShadow.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0;\n\t\t#endif\n\t\tRE_Direct(\n\t\t\tdirectLight,\n\t\t\tsplitGeoNormal,\n#ifdef USE_CLEARCOAT\n\t\t\tsplitGeoClearcoatNormal,\n#endif\n\t\t\tgeometry,\n\t\t\tmaterial,\n\t\t\treflectedLight\n\t\t);\n\t}\n\t#pragma unroll_loop_end\n#endif\n#if ( NUM_RECT_AREA_LIGHTS > 0 ) && defined( RE_Direct_RectArea )\n\tRectAreaLight rectAreaLight;\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_RECT_AREA_LIGHTS; i ++ ) {\n\t\trectAreaLight = rectAreaLights[ i ];\n\t\tRE_Direct_RectArea( rectAreaLight, splitGeoNormal, geometry, material, reflectedLight );\n\t}\n\t#pragma unroll_loop_end\n#endif\n#if defined( RE_IndirectDiffuse )\n\tvec3 iblIrradiance = vec3( 0.0 );\n\tvec3 irradiance = getAmbientLightIrradiance( ambientLightColor );\n\tirradiance += getLightProbeIrradiance( lightProbe, splitGeoNormal );\n\t#if ( NUM_HEMI_LIGHTS > 0 )\n\t\t#pragma unroll_loop_start\n\t\tfor ( int i = 0; i < NUM_HEMI_LIGHTS; i ++ ) {\n\t\t\tirradiance += getHemisphereLightIrradiance( hemisphereLights[ i ], splitGeoNormal );\n\t\t}\n\t\t#pragma unroll_loop_end\n\t#endif\n#endif\n#if defined( RE_IndirectSpecular )\n\tvec3 radiance = vec3( 0.0 );\n\tvec3 clearcoatRadiance = vec3( 0.0 );\n\t#ifdef USE_REFRACTION\n\t\tvec3 radianceRefraction = vec3( 0.0 );\n\t#endif\n#endif",lights_fragment_maps:"#if defined( RE_IndirectDiffuse )\n\t#ifdef USE_LIGHTMAP\n\t\tvec4 lightMapTexel = texture2D( lightMap, vUv2 );\n\t\tvec3 lightMapIrradiance = lightMapTexelToLinear( lightMapTexel ).rgb * lightMapIntensity;\n\t\t#ifndef PHYSICALLY_CORRECT_LIGHTS\n\t\t\tlightMapIrradiance *= PI;\n\t\t#endif\n\t\tirradiance += lightMapIrradiance;\n\t#endif\n\t#if defined( USE_ENVMAP ) && defined( STANDARD ) && defined( ENVMAP_TYPE_CUBE_UV )\n\t\tiblIrradiance += getIBLIrradiance( splitGeoNormal );\n\t#endif\n#endif\n#if defined( USE_ENVMAP ) && defined( RE_IndirectSpecular )\n\t#ifdef ENVMAP_MODE_REFLECTION\n\t\tradiance += getIBLRadianceReflection( geometry.viewDir, splitGeoNormal, material.roughness );\n\t\t#ifdef USE_REFRACTION\n\t\t\tradianceRefraction += getIBLRadianceRefraction( geometry.viewDir, splitGeoNormal, material.roughness );\n\t\t#endif\n\t#else\n\t\tradiance += getIBLRadianceRefraction( geometry.viewDir, splitGeoNormal, material.roughness );\n\t#endif\n\t#ifdef USE_CLEARCOAT\n\t\t#ifdef ENVMAP_MODE_REFLECTION\n\t\t\tclearcoatRadiance += getIBLRadianceReflection( geometry.viewDir, splitGeoClearcoatNormal, material.clearcoatRoughness );\n\t\t#else\n\t\t\tclearcoatRadiance += getIBLRadianceRefraction( geometry.viewDir, splitGeoClearcoatNormal, material.clearcoatRoughness );\n\t\t#endif\n\t#endif\n#endif",lights_fragment_end:"#if defined( RE_IndirectDiffuse )\n\tRE_IndirectDiffuse( irradiance, geometry, material, reflectedLight );\n#endif\n#if defined( RE_IndirectSpecular )\n\tRE_IndirectSpecular(\n\t\tradiance,\n#ifdef USE_REFRACTION\n\t\tradianceRefraction,\n#endif\n\t\tiblIrradiance,\n\t\tclearcoatRadiance,\n\t\tsplitGeoNormal,\n#ifdef USE_CLEARCOAT\n\t\tsplitGeoClearcoatNormal,\n#endif\n\t\tgeometry,\n\t\tmaterial,\n\t\treflectedLight\n\t);\n#endif",logdepthbuf_fragment:"#if defined( USE_LOGDEPTHBUF ) && defined( USE_LOGDEPTHBUF_EXT )\n\tgl_FragDepthEXT = vIsPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5;\n#endif",logdepthbuf_pars_fragment:"#if defined( USE_LOGDEPTHBUF ) && defined( USE_LOGDEPTHBUF_EXT )\n\tuniform float logDepthBufFC;\n\tvarying float vFragDepth;\n\tvarying float vIsPerspective;\n#endif",logdepthbuf_pars_vertex:"#ifdef USE_LOGDEPTHBUF\n\t#ifdef USE_LOGDEPTHBUF_EXT\n\t\tvarying float vFragDepth;\n\t\tvarying float vIsPerspective;\n\t#else\n\t\tuniform float logDepthBufFC;\n\t#endif\n#endif",logdepthbuf_vertex:"#ifdef USE_LOGDEPTHBUF\n\t#ifdef USE_LOGDEPTHBUF_EXT\n\t\tvFragDepth = 1.0 + gl_Position.w;\n\t\tvIsPerspective = float( isPerspectiveMatrix( projectionMatrix ) );\n\t#else\n\t\tif ( isPerspectiveMatrix( projectionMatrix ) ) {\n\t\t\tgl_Position.z = log2( max( EPSILON, gl_Position.w + 1.0 ) ) * logDepthBufFC - 1.0;\n\t\t\tgl_Position.z *= gl_Position.w;\n\t\t}\n\t#endif\n#endif",map_fragment:"#ifdef USE_MAP\n\tvec4 texelColor = texture2D( map, vUv );\n\ttexelColor = mapTexelToLinear( texelColor );\n\tdiffuseColor *= texelColor;\n#endif",map_pars_fragment:"#ifdef USE_MAP\n\tuniform sampler2D map;\n#endif",map_particle_fragment:"#if defined( USE_MAP ) || defined( USE_ALPHAMAP )\n\tvec2 uv = ( uvTransform * vec3( gl_PointCoord.x, 1.0 - gl_PointCoord.y, 1 ) ).xy;\n#endif\n#ifdef USE_MAP\n\tvec4 mapTexel = texture2D( map, uv );\n\tdiffuseColor *= mapTexelToLinear( mapTexel );\n#endif\n#ifdef USE_ALPHAMAP\n\tdiffuseColor.a *= texture2D( alphaMap, uv ).g;\n#endif",map_particle_pars_fragment:"#if defined( USE_MAP ) || defined( USE_ALPHAMAP )\n\tuniform mat3 uvTransform;\n#endif\n#ifdef USE_MAP\n\tuniform sampler2D map;\n#endif\n#ifdef USE_ALPHAMAP\n\tuniform sampler2D alphaMap;\n#endif",metalnessmap_fragment:"float metalnessFactor = metalness;\n#ifdef USE_METALNESSMAP\n\tvec4 texelMetalness = texture2D( metalnessMap, vUv );\n\tmetalnessFactor *= texelMetalness.b;\n#endif",metalnessmap_pars_fragment:"#ifdef USE_METALNESSMAP\n\tuniform sampler2D metalnessMap;\n#endif",morphnormal_vertex:"#ifdef USE_MORPHNORMALS\n\tobjectNormal *= morphTargetBaseInfluence;\n\t#ifdef MORPHTARGETS_TEXTURE\n\t\tfor ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {\n\t\t\tif ( morphTargetInfluences[ i ] != 0.0 ) objectNormal += getMorph( gl_VertexID, i, 1, 2 ) * morphTargetInfluences[ i ];\n\t\t}\n\t#else\n\t\tobjectNormal += morphNormal0 * morphTargetInfluences[ 0 ];\n\t\tobjectNormal += morphNormal1 * morphTargetInfluences[ 1 ];\n\t\tobjectNormal += morphNormal2 * morphTargetInfluences[ 2 ];\n\t\tobjectNormal += morphNormal3 * morphTargetInfluences[ 3 ];\n\t#endif\n#endif",morphtarget_pars_vertex:"#ifdef USE_MORPHTARGETS\n\tuniform float morphTargetBaseInfluence;\n\t#ifdef MORPHTARGETS_TEXTURE\n\t\tuniform float morphTargetInfluences[ MORPHTARGETS_COUNT ];\n\t\tuniform sampler2DArray morphTargetsTexture;\n\t\tuniform ivec2 morphTargetsTextureSize;\n\t\tvec3 getMorph( const in int vertexIndex, const in int morphTargetIndex, const in int offset, const in int stride ) {\n\t\t\tint texelIndex = vertexIndex * stride + offset;\n\t\t\tint y = texelIndex / morphTargetsTextureSize.x;\n\t\t\tint x = texelIndex - y * morphTargetsTextureSize.x;\n\t\t\tivec3 morphUV = ivec3( x, y, morphTargetIndex );\n\t\t\treturn texelFetch( morphTargetsTexture, morphUV, 0 ).xyz;\n\t\t}\n\t#else\n\t\t#ifndef USE_MORPHNORMALS\n\t\t\tuniform float morphTargetInfluences[ 8 ];\n\t\t#else\n\t\t\tuniform float morphTargetInfluences[ 4 ];\n\t\t#endif\n\t#endif\n#endif",morphtarget_vertex:"#ifdef USE_MORPHTARGETS\n\ttransformed *= morphTargetBaseInfluence;\n\t#ifdef MORPHTARGETS_TEXTURE\n\t\tfor ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {\n\t\t\t#ifndef USE_MORPHNORMALS\n\t\t\t\tif ( morphTargetInfluences[ i ] != 0.0 ) transformed += getMorph( gl_VertexID, i, 0, 1 ) * morphTargetInfluences[ i ];\n\t\t\t#else\n\t\t\t\tif ( morphTargetInfluences[ i ] != 0.0 ) transformed += getMorph( gl_VertexID, i, 0, 2 ) * morphTargetInfluences[ i ];\n\t\t\t#endif\n\t\t}\n\t#else\n\t\ttransformed += morphTarget0 * morphTargetInfluences[ 0 ];\n\t\ttransformed += morphTarget1 * morphTargetInfluences[ 1 ];\n\t\ttransformed += morphTarget2 * morphTargetInfluences[ 2 ];\n\t\ttransformed += morphTarget3 * morphTargetInfluences[ 3 ];\n\t\t#ifndef USE_MORPHNORMALS\n\t\t\ttransformed += morphTarget4 * morphTargetInfluences[ 4 ];\n\t\t\ttransformed += morphTarget5 * morphTargetInfluences[ 5 ];\n\t\t\ttransformed += morphTarget6 * morphTargetInfluences[ 6 ];\n\t\t\ttransformed += morphTarget7 * morphTargetInfluences[ 7 ];\n\t\t#endif\n\t#endif\n#endif",normal_fragment_begin:"float faceDirection = gl_FrontFacing ? 1.0 : - 1.0;\n#ifdef FLAT_SHADED\n\tvec3 fdx = vec3( dFdx( vViewPosition.x ), dFdx( vViewPosition.y ), dFdx( vViewPosition.z ) );\n\tvec3 fdy = vec3( dFdy( vViewPosition.x ), dFdy( vViewPosition.y ), dFdy( vViewPosition.z ) );\n\tvec3 normal = normalize( cross( fdx, fdy ) );\n#else\n\tvec3 normal = normalize( vNormal );\n\t#ifdef DOUBLE_SIDED\n\t\tnormal = normal * faceDirection;\n\t#endif\n\t#ifdef USE_TANGENT\n\t\tvec3 tangent = normalize( vTangent );\n\t\tvec3 bitangent = normalize( vBitangent );\n\t\t#ifdef DOUBLE_SIDED\n\t\t\ttangent = tangent * faceDirection;\n\t\t\tbitangent = bitangent * faceDirection;\n\t\t#endif\n\t\t#if defined( TANGENTSPACE_NORMALMAP ) || defined( USE_CLEARCOAT_NORMALMAP )\n\t\t\tmat3 vTBN = mat3( tangent, bitangent, normal );\n\t\t#endif\n\t#endif\n#endif\nvec3 geometryNormal = normal;",normal_fragment_maps:"#ifdef OBJECTSPACE_NORMALMAP\n\tnormal = texture2D( normalMap, vUv ).xyz * 2.0 - 1.0;\n\t#ifdef FLIP_SIDED\n\t\tnormal = - normal;\n\t#endif\n\t#ifdef DOUBLE_SIDED\n\t\tnormal = normal * faceDirection;\n\t#endif\n\tnormal = normalize( normalMatrix * normal );\n#elif defined( TANGENTSPACE_NORMALMAP )\n\tvec3 mapN = texture2D( normalMap, vUv ).xyz * 2.0 - 1.0;\n\t#ifdef USE_LOWER_8_BIT_NORMALMAP\n\tvec3 lowerMapN = texture2D( lowerNormalMap, vUv ).xyz * 2.0 - 1.0;\n\tmapN = mapN * (256.0 / 257.0) + lowerMapN / 257.0;\n\t#endif\n\tmapN.xy *= normalScale;\n\t#ifdef USE_TANGENT\n\t\tnormal = normalize( vTBN * mapN );\n\t#else\n\t\tnormal = perturbNormal2Arb( - vViewPosition, normal, mapN, faceDirection );\n\t#endif\n#elif defined( USE_BUMPMAP )\n\tnormal = perturbNormalArb( - vViewPosition, normal, dHdxy_fwd(), faceDirection );\n#endif",normal_pars_fragment:"#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n\t#ifdef USE_TANGENT\n\t\tvarying vec3 vTangent;\n\t\tvarying vec3 vBitangent;\n\t#endif\n#endif",normal_pars_vertex:"#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n\t#ifdef USE_TANGENT\n\t\tvarying vec3 vTangent;\n\t\tvarying vec3 vBitangent;\n\t#endif\n#endif",normal_vertex:"#ifndef FLAT_SHADED\n\tvNormal = normalize( transformedNormal );\n\t#ifdef USE_TANGENT\n\t\tvTangent = normalize( transformedTangent );\n\t\tvBitangent = normalize( cross( vNormal, vTangent ) * tangent.w );\n\t#endif\n#endif",normalmap_pars_fragment:"#ifdef USE_NORMALMAP\n\tuniform sampler2D normalMap;\n\tuniform vec2 normalScale;\n\t#ifdef USE_LOWER_8_BIT_NORMALMAP\n\tuniform sampler2D lowerNormalMap;\n\t#endif\n#endif\n#ifdef OBJECTSPACE_NORMALMAP\n\tuniform mat3 normalMatrix;\n#endif\n#if ! defined ( USE_TANGENT ) && ( defined ( TANGENTSPACE_NORMALMAP ) || defined ( USE_CLEARCOAT_NORMALMAP ) )\n\tvec3 perturbNormal2Arb( vec3 eye_pos, vec3 surf_norm, vec3 mapN, float faceDirection ) {\n\t\tvec3 q0 = vec3( dFdx( eye_pos.x ), dFdx( eye_pos.y ), dFdx( eye_pos.z ) );\n\t\tvec3 q1 = vec3( dFdy( eye_pos.x ), dFdy( eye_pos.y ), dFdy( eye_pos.z ) );\n\t\tvec2 st0 = dFdx( vUv.st );\n\t\tvec2 st1 = dFdy( vUv.st );\n\t#ifdef PERTURB_NORMAL_R115_COMPATABILITY\n\t\tfloat scale = sign( st1.t * st0.s - st0.t * st1.s );\n\t\tvec3 S = normalize( ( q0 * st1.t - q1 * st0.t ) * scale );\n\t\tvec3 T = normalize( ( - q0 * st1.s + q1 * st0.s ) * scale );\n\t\tvec3 N = normalize( surf_norm );\n\t\tmat3 tsn = mat3( S, T, N );\n\t\tmapN.xy *= ( faceDirection * 2.0 - 1.0 );\n\t\treturn normalize( tsn * mapN );\n\t#else\n\t\tvec3 N = surf_norm;\n\t\tvec3 q1perp = cross( q1, N );\n\t\tvec3 q0perp = cross( N, q0 );\n\t\tvec3 T = q1perp * st0.x + q0perp * st1.x;\n\t\tvec3 B = q1perp * st0.y + q0perp * st1.y;\n\t\tfloat det = max( dot( T, T ), dot( B, B ) );\n\t\tfloat scale = ( det == 0.0 ) ? 0.0 : faceDirection * inversesqrt( det );\n\t\treturn normalize( T * ( mapN.x * scale ) + B * ( mapN.y * scale ) + N * mapN.z );\n\t#endif\n\t}\n#endif",clearcoat_normal_fragment_begin:"#ifdef USE_CLEARCOAT\n\tvec3 clearcoatNormal = geometryNormal;\n#endif",clearcoat_normal_fragment_maps:"#ifdef USE_CLEARCOAT_NORMALMAP\n\tvec3 clearcoatMapN = texture2D( clearcoatNormalMap, vUv ).xyz * 2.0 - 1.0;\n\tclearcoatMapN.xy *= clearcoatNormalScale;\n\t#ifdef USE_TANGENT\n\t\tclearcoatNormal = normalize( vTBN * clearcoatMapN );\n\t#else\n\t\tclearcoatNormal = perturbNormal2Arb( - vViewPosition, clearcoatNormal, clearcoatMapN, faceDirection );\n\t#endif\n#endif",clearcoat_pars_fragment:"#ifdef USE_CLEARCOATMAP\n\tuniform sampler2D clearcoatMap;\n#endif\n#ifdef USE_CLEARCOAT_ROUGHNESSMAP\n\tuniform sampler2D clearcoatRoughnessMap;\n#endif\n#ifdef USE_CLEARCOAT_NORMALMAP\n\tuniform sampler2D clearcoatNormalMap;\n\tuniform vec2 clearcoatNormalScale;\n#endif",output_fragment:"#ifndef ALPHA_R115_COMPATABILITY\n#ifdef OPAQUE\ndiffuseColor.a = 1.0;\n#endif\n#endif\n#ifdef USE_TRANSMISSION\ndiffuseColor.a *= transmissionAlpha + 0.1;\n#endif\ngl_FragColor = vec4( outgoingLight, diffuseColor.a );",packing:"vec3 packNormalToRGB( const in vec3 normal ) {\n\treturn normalize( normal ) * 0.5 + 0.5;\n}\nvec3 unpackRGBToNormal( const in vec3 rgb ) {\n\treturn 2.0 * rgb.xyz - 1.0;\n}\nconst float PackUpscale = 256. / 255.;const float UnpackDownscale = 255. / 256.;\nconst vec3 PackFactors = vec3( 256. * 256. * 256., 256. * 256., 256. );\nconst vec4 UnpackFactors = UnpackDownscale / vec4( PackFactors, 1. );\nconst float ShiftRight8 = 1. / 256.;\nvec4 packDepthToRGBA( const in float v ) {\n\tvec4 r = vec4( fract( v * PackFactors ), v );\n\tr.yzw -= r.xyz * ShiftRight8;\treturn r * PackUpscale;\n}\nfloat unpackRGBAToDepth( const in vec4 v ) {\n\treturn dot( v, UnpackFactors );\n}\nvec4 pack2HalfToRGBA( vec2 v ) {\n\tvec4 r = vec4( v.x, fract( v.x * 255.0 ), v.y, fract( v.y * 255.0 ) );\n\treturn vec4( r.x - r.y / 255.0, r.y, r.z - r.w / 255.0, r.w );\n}\nvec2 unpackRGBATo2Half( vec4 v ) {\n\treturn vec2( v.x + ( v.y / 255.0 ), v.z + ( v.w / 255.0 ) );\n}\nfloat viewZToOrthographicDepth( const in float viewZ, const in float near, const in float far ) {\n\treturn ( viewZ + near ) / ( near - far );\n}\nfloat orthographicDepthToViewZ( const in float linearClipZ, const in float near, const in float far ) {\n\treturn linearClipZ * ( near - far ) - near;\n}\nfloat viewZToPerspectiveDepth( const in float viewZ, const in float near, const in float far ) {\n\treturn ( ( near + viewZ ) * far ) / ( ( far - near ) * viewZ );\n}\nfloat perspectiveDepthToViewZ( const in float invClipZ, const in float near, const in float far ) {\n\treturn ( near * far ) / ( ( far - near ) * invClipZ - far );\n}",premultiplied_alpha_fragment:"#ifdef PREMULTIPLIED_ALPHA\n\tgl_FragColor.rgb *= gl_FragColor.a;\n#endif",project_vertex:"vec4 mvPosition = vec4( transformed, 1.0 );\n#ifdef USE_INSTANCING\n\tmvPosition = instanceMatrix * mvPosition;\n#endif\nmvPosition = modelViewMatrix * mvPosition;\ngl_Position = projectionMatrix * mvPosition;",dithering_fragment:"#ifdef DITHERING\n\tgl_FragColor.rgb = dithering( gl_FragColor.rgb );\n#endif",dithering_pars_fragment:"#ifdef DITHERING\n\tvec3 dithering( vec3 color ) {\n\t\tfloat grid_position = rand( gl_FragCoord.xy );\n\t\tvec3 dither_shift_RGB = vec3( 0.25 / 255.0, -0.25 / 255.0, 0.25 / 255.0 );\n\t\tdither_shift_RGB = mix( 2.0 * dither_shift_RGB, -2.0 * dither_shift_RGB, grid_position );\n\t\treturn color + dither_shift_RGB;\n\t}\n#endif",roughnessmap_fragment:"float roughnessFactor = roughness;\n#ifdef USE_ROUGHNESSMAP\n\tvec4 texelRoughness = texture2D( roughnessMap, vUv );\n\troughnessFactor *= texelRoughness.g;\n#endif",roughnessmap_pars_fragment:"#ifdef USE_ROUGHNESSMAP\n\tuniform sampler2D roughnessMap;\n#endif",shadowmap_pars_fragment:"#ifdef USE_SHADOWMAP\n\t#if NUM_DIR_LIGHT_SHADOWS > 0\n\t\tuniform sampler2D directionalShadowMap[ NUM_DIR_LIGHT_SHADOWS ];\n\t\tvarying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHT_SHADOWS ];\n\t\tstruct DirectionalLightShadow {\n\t\t\tfloat shadowBias;\n\t\t\tfloat shadowNormalBias;\n\t\t\tfloat shadowRadius;\n\t\t\tvec2 shadowMapSize;\n\t\t};\n\t\tuniform DirectionalLightShadow directionalLightShadows[ NUM_DIR_LIGHT_SHADOWS ];\n\t#endif\n\t#if NUM_SPOT_LIGHT_SHADOWS > 0\n\t\tuniform sampler2D spotShadowMap[ NUM_SPOT_LIGHT_SHADOWS ];\n\t\tvarying vec4 vSpotShadowCoord[ NUM_SPOT_LIGHT_SHADOWS ];\n\t\tstruct SpotLightShadow {\n\t\t\tfloat shadowBias;\n\t\t\tfloat shadowNormalBias;\n\t\t\tfloat shadowRadius;\n\t\t\tvec2 shadowMapSize;\n\t\t};\n\t\tuniform SpotLightShadow spotLightShadows[ NUM_SPOT_LIGHT_SHADOWS ];\n\t#endif\n\t#if NUM_POINT_LIGHT_SHADOWS > 0\n\t\tuniform sampler2D pointShadowMap[ NUM_POINT_LIGHT_SHADOWS ];\n\t\tvarying vec4 vPointShadowCoord[ NUM_POINT_LIGHT_SHADOWS ];\n\t\tstruct PointLightShadow {\n\t\t\tfloat shadowBias;\n\t\t\tfloat shadowNormalBias;\n\t\t\tfloat shadowRadius;\n\t\t\tvec2 shadowMapSize;\n\t\t\tfloat shadowCameraNear;\n\t\t\tfloat shadowCameraFar;\n\t\t};\n\t\tuniform PointLightShadow pointLightShadows[ NUM_POINT_LIGHT_SHADOWS ];\n\t#endif\n\tfloat texture2DCompare( sampler2D depths, vec2 uv, float compare ) {\n\t\treturn step( compare, unpackRGBAToDepth( texture2D( depths, uv ) ) );\n\t}\n\tvec2 texture2DDistribution( sampler2D shadow, vec2 uv ) {\n\t\treturn unpackRGBATo2Half( texture2D( shadow, uv ) );\n\t}\n\tfloat VSMShadow (sampler2D shadow, vec2 uv, float compare ){\n\t\tfloat occlusion = 1.0;\n\t\tvec2 distribution = texture2DDistribution( shadow, uv );\n\t\tfloat hard_shadow = step( compare , distribution.x );\n\t\tif (hard_shadow != 1.0 ) {\n\t\t\tfloat distance = compare - distribution.x ;\n\t\t\tfloat variance = max( 0.00000, distribution.y * distribution.y );\n\t\t\tfloat softness_probability = variance / (variance + distance * distance );\t\t\tsoftness_probability = clamp( ( softness_probability - 0.3 ) / ( 0.95 - 0.3 ), 0.0, 1.0 );\t\t\tocclusion = clamp( max( hard_shadow, softness_probability ), 0.0, 1.0 );\n\t\t}\n\t\treturn occlusion;\n\t}\n\tfloat getShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowBias, float shadowRadius, vec4 shadowCoord ) {\n\t\tfloat shadow = 1.0;\n\t\tshadowCoord.xyz /= shadowCoord.w;\n\t\tshadowCoord.z += shadowBias;\n\t\tbvec4 inFrustumVec = bvec4 ( shadowCoord.x >= 0.0, shadowCoord.x <= 1.0, shadowCoord.y >= 0.0, shadowCoord.y <= 1.0 );\n\t\tbool inFrustum = all( inFrustumVec );\n\t\tbvec2 frustumTestVec = bvec2( inFrustum, shadowCoord.z <= 1.0 );\n\t\tbool frustumTest = all( frustumTestVec );\n\t\tif ( frustumTest ) {\n\t\t#if defined( SHADOWMAP_TYPE_PCF )\n\t\t\tvec2 texelSize = vec2( 1.0 ) / shadowMapSize;\n\t\t\tfloat dx0 = - texelSize.x * shadowRadius;\n\t\t\tfloat dy0 = - texelSize.y * shadowRadius;\n\t\t\tfloat dx1 = + texelSize.x * shadowRadius;\n\t\t\tfloat dy1 = + texelSize.y * shadowRadius;\n\t\t\tfloat dx2 = dx0 / 2.0;\n\t\t\tfloat dy2 = dy0 / 2.0;\n\t\t\tfloat dx3 = dx1 / 2.0;\n\t\t\tfloat dy3 = dy1 / 2.0;\n\t\t\tshadow = (\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, dy0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, dy0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, dy2 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy2 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, dy2 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy, shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, dy3 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy3 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, dy3 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, dy1 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy1 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, dy1 ), shadowCoord.z )\n\t\t\t) * ( 1.0 / 17.0 );\n\t\t#elif defined( SHADOWMAP_TYPE_PCF_SOFT )\n\t\t\tvec2 texelSize = vec2( 1.0 ) / shadowMapSize;\n\t\t\tfloat dx = texelSize.x;\n\t\t\tfloat dy = texelSize.y;\n\t\t\tvec2 uv = shadowCoord.xy;\n\t\t\tvec2 f = fract( uv * shadowMapSize + 0.5 );\n\t\t\tuv -= f * texelSize;\n\t\t\tshadow = (\n\t\t\t\ttexture2DCompare( shadowMap, uv, shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, uv + vec2( dx, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, uv + vec2( 0.0, dy ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, uv + texelSize, shadowCoord.z ) +\n\t\t\t\tmix( texture2DCompare( shadowMap, uv + vec2( -dx, 0.0 ), shadowCoord.z ), \n\t\t\t\t\t texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, 0.0 ), shadowCoord.z ),\n\t\t\t\t\t f.x ) +\n\t\t\t\tmix( texture2DCompare( shadowMap, uv + vec2( -dx, dy ), shadowCoord.z ), \n\t\t\t\t\t texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, dy ), shadowCoord.z ),\n\t\t\t\t\t f.x ) +\n\t\t\t\tmix( texture2DCompare( shadowMap, uv + vec2( 0.0, -dy ), shadowCoord.z ), \n\t\t\t\t\t texture2DCompare( shadowMap, uv + vec2( 0.0, 2.0 * dy ), shadowCoord.z ),\n\t\t\t\t\t f.y ) +\n\t\t\t\tmix( texture2DCompare( shadowMap, uv + vec2( dx, -dy ), shadowCoord.z ), \n\t\t\t\t\t texture2DCompare( shadowMap, uv + vec2( dx, 2.0 * dy ), shadowCoord.z ),\n\t\t\t\t\t f.y ) +\n\t\t\t\tmix( mix( texture2DCompare( shadowMap, uv + vec2( -dx, -dy ), shadowCoord.z ), \n\t\t\t\t\t\t\ttexture2DCompare( shadowMap, uv + vec2( 2.0 * dx, -dy ), shadowCoord.z ),\n\t\t\t\t\t\t\tf.x ),\n\t\t\t\t\t mix( texture2DCompare( shadowMap, uv + vec2( -dx, 2.0 * dy ), shadowCoord.z ), \n\t\t\t\t\t\t\ttexture2DCompare( shadowMap, uv + vec2( 2.0 * dx, 2.0 * dy ), shadowCoord.z ),\n\t\t\t\t\t\t\tf.x ),\n\t\t\t\t\t f.y )\n\t\t\t) * ( 1.0 / 9.0 );\n\t\t#elif defined( SHADOWMAP_TYPE_VSM )\n\t\t\tshadow = VSMShadow( shadowMap, shadowCoord.xy, shadowCoord.z );\n\t\t#else\n\t\t\tshadow = texture2DCompare( shadowMap, shadowCoord.xy, shadowCoord.z );\n\t\t#endif\n\t\t}\n\t\treturn shadow;\n\t}\n\tvec2 cubeToUV( vec3 v, float texelSizeY ) {\n\t\tvec3 absV = abs( v );\n\t\tfloat scaleToCube = 1.0 / max( absV.x, max( absV.y, absV.z ) );\n\t\tabsV *= scaleToCube;\n\t\tv *= scaleToCube * ( 1.0 - 2.0 * texelSizeY );\n\t\tvec2 planar = v.xy;\n\t\tfloat almostATexel = 1.5 * texelSizeY;\n\t\tfloat almostOne = 1.0 - almostATexel;\n\t\tif ( absV.z >= almostOne ) {\n\t\t\tif ( v.z > 0.0 )\n\t\t\t\tplanar.x = 4.0 - v.x;\n\t\t} else if ( absV.x >= almostOne ) {\n\t\t\tfloat signX = sign( v.x );\n\t\t\tplanar.x = v.z * signX + 2.0 * signX;\n\t\t} else if ( absV.y >= almostOne ) {\n\t\t\tfloat signY = sign( v.y );\n\t\t\tplanar.x = v.x + 2.0 * signY + 2.0;\n\t\t\tplanar.y = v.z * signY - 2.0;\n\t\t}\n\t\treturn vec2( 0.125, 0.25 ) * planar + vec2( 0.375, 0.75 );\n\t}\n\tfloat getPointShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowBias, float shadowRadius, vec4 shadowCoord, float shadowCameraNear, float shadowCameraFar ) {\n\t\tvec2 texelSize = vec2( 1.0 ) / ( shadowMapSize * vec2( 4.0, 2.0 ) );\n\t\tvec3 lightToPosition = shadowCoord.xyz;\n\t\tfloat dp = ( length( lightToPosition ) - shadowCameraNear ) / ( shadowCameraFar - shadowCameraNear );\t\tdp += shadowBias;\n\t\tvec3 bd3D = normalize( lightToPosition );\n\t\t#if defined( SHADOWMAP_TYPE_PCF ) || defined( SHADOWMAP_TYPE_PCF_SOFT ) || defined( SHADOWMAP_TYPE_VSM )\n\t\t\tvec2 offset = vec2( - 1, 1 ) * shadowRadius * texelSize.y;\n\t\t\treturn (\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.xyy, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.yyy, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.xyx, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.yyx, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.xxy, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.yxy, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.xxx, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.yxx, texelSize.y ), dp )\n\t\t\t) * ( 1.0 / 9.0 );\n\t\t#else\n\t\t\treturn texture2DCompare( shadowMap, cubeToUV( bd3D, texelSize.y ), dp );\n\t\t#endif\n\t}\n#endif",shadowmap_pars_vertex:"#ifdef USE_SHADOWMAP\n\t#if NUM_DIR_LIGHT_SHADOWS > 0\n\t\tuniform mat4 directionalShadowMatrix[ NUM_DIR_LIGHT_SHADOWS ];\n\t\tvarying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHT_SHADOWS ];\n\t\tstruct DirectionalLightShadow {\n\t\t\tfloat shadowBias;\n\t\t\tfloat shadowNormalBias;\n\t\t\tfloat shadowRadius;\n\t\t\tvec2 shadowMapSize;\n\t\t};\n\t\tuniform DirectionalLightShadow directionalLightShadows[ NUM_DIR_LIGHT_SHADOWS ];\n\t#endif\n\t#if NUM_SPOT_LIGHT_SHADOWS > 0\n\t\tuniform mat4 spotShadowMatrix[ NUM_SPOT_LIGHT_SHADOWS ];\n\t\tvarying vec4 vSpotShadowCoord[ NUM_SPOT_LIGHT_SHADOWS ];\n\t\tstruct SpotLightShadow {\n\t\t\tfloat shadowBias;\n\t\t\tfloat shadowNormalBias;\n\t\t\tfloat shadowRadius;\n\t\t\tvec2 shadowMapSize;\n\t\t};\n\t\tuniform SpotLightShadow spotLightShadows[ NUM_SPOT_LIGHT_SHADOWS ];\n\t#endif\n\t#if NUM_POINT_LIGHT_SHADOWS > 0\n\t\tuniform mat4 pointShadowMatrix[ NUM_POINT_LIGHT_SHADOWS ];\n\t\tvarying vec4 vPointShadowCoord[ NUM_POINT_LIGHT_SHADOWS ];\n\t\tstruct PointLightShadow {\n\t\t\tfloat shadowBias;\n\t\t\tfloat shadowNormalBias;\n\t\t\tfloat shadowRadius;\n\t\t\tvec2 shadowMapSize;\n\t\t\tfloat shadowCameraNear;\n\t\t\tfloat shadowCameraFar;\n\t\t};\n\t\tuniform PointLightShadow pointLightShadows[ NUM_POINT_LIGHT_SHADOWS ];\n\t#endif\n#endif",shadowmap_vertex:"#ifdef USE_SHADOWMAP\n\t#if NUM_DIR_LIGHT_SHADOWS > 0 || NUM_SPOT_LIGHT_SHADOWS > 0 || NUM_POINT_LIGHT_SHADOWS > 0\n\t\tvec3 shadowWorldNormal = inverseTransformDirection( transformedNormal, viewMatrix );\n\t\tvec4 shadowWorldPosition;\n\t#endif\n\t#if NUM_DIR_LIGHT_SHADOWS > 0\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_DIR_LIGHT_SHADOWS; i ++ ) {\n\t\tshadowWorldPosition = worldPosition + vec4( shadowWorldNormal * directionalLightShadows[ i ].shadowNormalBias, 0 );\n\t\tvDirectionalShadowCoord[ i ] = directionalShadowMatrix[ i ] * shadowWorldPosition;\n\t}\n\t#pragma unroll_loop_end\n\t#endif\n\t#if NUM_SPOT_LIGHT_SHADOWS > 0\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_SPOT_LIGHT_SHADOWS; i ++ ) {\n\t\tshadowWorldPosition = worldPosition + vec4( shadowWorldNormal * spotLightShadows[ i ].shadowNormalBias, 0 );\n\t\tvSpotShadowCoord[ i ] = spotShadowMatrix[ i ] * shadowWorldPosition;\n\t}\n\t#pragma unroll_loop_end\n\t#endif\n\t#if NUM_POINT_LIGHT_SHADOWS > 0\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_POINT_LIGHT_SHADOWS; i ++ ) {\n\t\tshadowWorldPosition = worldPosition + vec4( shadowWorldNormal * pointLightShadows[ i ].shadowNormalBias, 0 );\n\t\tvPointShadowCoord[ i ] = pointShadowMatrix[ i ] * shadowWorldPosition;\n\t}\n\t#pragma unroll_loop_end\n\t#endif\n#endif",shadowmask_pars_fragment:"float getShadowMask() {\n\tfloat shadow = 1.0;\n\t#ifdef USE_SHADOWMAP\n\t#if NUM_DIR_LIGHT_SHADOWS > 0\n\tDirectionalLightShadow directionalLight;\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_DIR_LIGHT_SHADOWS; i ++ ) {\n\t\tdirectionalLight = directionalLightShadows[ i ];\n\t\tshadow *= receiveShadow ? getShadow( directionalShadowMap[ i ], directionalLight.shadowMapSize, directionalLight.shadowBias, directionalLight.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0;\n\t}\n\t#pragma unroll_loop_end\n\t#endif\n\t#if NUM_SPOT_LIGHT_SHADOWS > 0\n\tSpotLightShadow spotLight;\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_SPOT_LIGHT_SHADOWS; i ++ ) {\n\t\tspotLight = spotLightShadows[ i ];\n\t\tshadow *= receiveShadow ? getShadow( spotShadowMap[ i ], spotLight.shadowMapSize, spotLight.shadowBias, spotLight.shadowRadius, vSpotShadowCoord[ i ] ) : 1.0;\n\t}\n\t#pragma unroll_loop_end\n\t#endif\n\t#if NUM_POINT_LIGHT_SHADOWS > 0\n\tPointLightShadow pointLight;\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_POINT_LIGHT_SHADOWS; i ++ ) {\n\t\tpointLight = pointLightShadows[ i ];\n\t\tshadow *= receiveShadow ? getPointShadow( pointShadowMap[ i ], pointLight.shadowMapSize, pointLight.shadowBias, pointLight.shadowRadius, vPointShadowCoord[ i ], pointLight.shadowCameraNear, pointLight.shadowCameraFar ) : 1.0;\n\t}\n\t#pragma unroll_loop_end\n\t#endif\n\t#endif\n\treturn shadow;\n}",skinbase_vertex:"#ifdef USE_SKINNING\n\tmat4 boneMatX = getBoneMatrix( skinIndex.x );\n\tmat4 boneMatY = getBoneMatrix( skinIndex.y );\n\tmat4 boneMatZ = getBoneMatrix( skinIndex.z );\n\tmat4 boneMatW = getBoneMatrix( skinIndex.w );\n#endif",skinning_pars_vertex:"#ifdef USE_SKINNING\n\tuniform mat4 bindMatrix;\n\tuniform mat4 bindMatrixInverse;\n\t#ifdef BONE_TEXTURE\n\t\tuniform highp sampler2D boneTexture;\n\t\tuniform int boneTextureSize;\n\t\tmat4 getBoneMatrix( const in float i ) {\n\t\t\tfloat j = i * 4.0;\n\t\t\tfloat x = mod( j, float( boneTextureSize ) );\n\t\t\tfloat y = floor( j / float( boneTextureSize ) );\n\t\t\tfloat dx = 1.0 / float( boneTextureSize );\n\t\t\tfloat dy = 1.0 / float( boneTextureSize );\n\t\t\ty = dy * ( y + 0.5 );\n\t\t\tvec4 v1 = texture2D( boneTexture, vec2( dx * ( x + 0.5 ), y ) );\n\t\t\tvec4 v2 = texture2D( boneTexture, vec2( dx * ( x + 1.5 ), y ) );\n\t\t\tvec4 v3 = texture2D( boneTexture, vec2( dx * ( x + 2.5 ), y ) );\n\t\t\tvec4 v4 = texture2D( boneTexture, vec2( dx * ( x + 3.5 ), y ) );\n\t\t\tmat4 bone = mat4( v1, v2, v3, v4 );\n\t\t\treturn bone;\n\t\t}\n\t#else\n\t\tuniform mat4 boneMatrices[ MAX_BONES ];\n\t\tmat4 getBoneMatrix( const in float i ) {\n\t\t\tmat4 bone = boneMatrices[ int(i) ];\n\t\t\treturn bone;\n\t\t}\n\t#endif\n#endif",skinning_vertex:"#ifdef USE_SKINNING\n\tvec4 skinVertex = bindMatrix * vec4( transformed, 1.0 );\n\tvec4 skinned = vec4( 0.0 );\n\tskinned += boneMatX * skinVertex * skinWeight.x;\n\tskinned += boneMatY * skinVertex * skinWeight.y;\n\tskinned += boneMatZ * skinVertex * skinWeight.z;\n\tskinned += boneMatW * skinVertex * skinWeight.w;\n\ttransformed = ( bindMatrixInverse * skinned ).xyz;\n#endif",skinnormal_vertex:"#ifdef USE_SKINNING\n\tmat4 skinMatrix = mat4( 0.0 );\n\tskinMatrix += skinWeight.x * boneMatX;\n\tskinMatrix += skinWeight.y * boneMatY;\n\tskinMatrix += skinWeight.z * boneMatZ;\n\tskinMatrix += skinWeight.w * boneMatW;\n\tskinMatrix = bindMatrixInverse * skinMatrix * bindMatrix;\n\tobjectNormal = vec4( skinMatrix * vec4( objectNormal, 0.0 ) ).xyz;\n\t#ifdef USE_TANGENT\n\t\tobjectTangent = vec4( skinMatrix * vec4( objectTangent, 0.0 ) ).xyz;\n\t#endif\n#endif",specularmap_fragment:"float specularStrength;\n#ifdef USE_SPECULARMAP\n\tvec4 texelSpecular = texture2D( specularMap, vUv );\n\tspecularStrength = texelSpecular.r;\n#else\n\tspecularStrength = 1.0;\n#endif",specularmap_pars_fragment:"#ifdef USE_SPECULARMAP\n\tuniform sampler2D specularMap;\n#endif",tonemapping_fragment:"#if defined( TONE_MAPPING )\n\tgl_FragColor.rgb = toneMapping( gl_FragColor.rgb );\n#endif",tonemapping_pars_fragment:"#ifndef saturate\n#define saturate( a ) clamp( a, 0.0, 1.0 )\n#endif\nuniform float toneMappingExposure;\nvec3 LinearToneMapping( vec3 color ) {\n\treturn toneMappingExposure * color;\n}\nvec3 ReinhardToneMapping( vec3 color ) {\n\tcolor *= toneMappingExposure;\n\treturn saturate( color / ( vec3( 1.0 ) + color ) );\n}\nvec3 OptimizedCineonToneMapping( vec3 color ) {\n\tcolor *= toneMappingExposure;\n\tcolor = max( vec3( 0.0 ), color - 0.004 );\n\treturn pow( ( color * ( 6.2 * color + 0.5 ) ) / ( color * ( 6.2 * color + 1.7 ) + 0.06 ), vec3( 2.2 ) );\n}\nvec3 RRTAndODTFit( vec3 v ) {\n\tvec3 a = v * ( v + 0.0245786 ) - 0.000090537;\n\tvec3 b = v * ( 0.983729 * v + 0.4329510 ) + 0.238081;\n\treturn a / b;\n}\nvec3 ACESFilmicToneMapping( vec3 color ) {\n\tconst mat3 ACESInputMat = mat3(\n\t\tvec3( 0.59719, 0.07600, 0.02840 ),\t\tvec3( 0.35458, 0.90834, 0.13383 ),\n\t\tvec3( 0.04823, 0.01566, 0.83777 )\n\t);\n\tconst mat3 ACESOutputMat = mat3(\n\t\tvec3(\t1.60475, -0.10208, -0.00327 ),\t\tvec3( -0.53108,\t1.10813, -0.07276 ),\n\t\tvec3( -0.07367, -0.00605,\t1.07602 )\n\t);\n\tcolor *= toneMappingExposure / 0.6;\n\tcolor = ACESInputMat * color;\n\tcolor = RRTAndODTFit( color );\n\tcolor = ACESOutputMat * color;\n\treturn saturate( color );\n}\nvec3 CustomToneMapping( vec3 color ) {\n\tcolor *= toneMappingExposure;\n\treturn saturate( ( color * ( 2.51 * color + 0.03 ) ) / ( color * ( 2.43 * color + 0.59 ) + 0.14 ) );\n}",transmission_fragment:"#ifdef USE_TRANSMISSION\n\tfloat transmissionAlpha = 1.0;\n\tfloat transmissionFactor = transmission;\n\tfloat thicknessFactor = thickness;\n\t#ifdef USE_TRANSMISSIONMAP\n\t\ttransmissionFactor *= texture2D( transmissionMap, vUv ).r;\n\t#endif\n\t#ifdef USE_THICKNESSMAP\n\t\tthicknessFactor *= texture2D( thicknessMap, vUv ).g;\n\t#endif\n\tvec3 pos = vWorldPosition;\n\tvec3 v = normalize( cameraPosition - pos );\n\tvec3 n = inverseTransformDirection( normal, viewMatrix );\n\tvec4 transmission = getIBLVolumeRefraction(\n\t\tn, v, roughnessFactor, material.diffuseColor, material.specularColor, material.specularF90,\n\t\tpos, modelMatrix, viewMatrix, projectionMatrix, ior, thicknessFactor,\n\t\tattenuationColor, attenuationDistance );\n\ttotalDiffuse = mix( totalDiffuse, transmission.rgb, transmissionFactor );\n\ttransmissionAlpha = mix( transmissionAlpha, transmission.a, transmissionFactor );\n#endif",transmission_pars_fragment:"#ifdef USE_TRANSMISSION\n\tuniform float transmission;\n\tuniform float thickness;\n\tuniform float attenuationDistance;\n\tuniform vec3 attenuationColor;\n\t#ifdef USE_TRANSMISSIONMAP\n\t\tuniform sampler2D transmissionMap;\n\t#endif\n\t#ifdef USE_THICKNESSMAP\n\t\tuniform sampler2D thicknessMap;\n\t#endif\n\tuniform vec2 transmissionSamplerSize;\n\tuniform sampler2D transmissionSamplerMap;\n\tuniform mat4 modelMatrix;\n\tuniform mat4 projectionMatrix;\n\tvarying vec3 vWorldPosition;\n\tvec3 getVolumeTransmissionRay( const in vec3 n, const in vec3 v, const in float thickness, const in float ior, const in mat4 modelMatrix ) {\n\t\tvec3 refractionVector = refract( - v, normalize( n ), 1.0 / ior );\n\t\tvec3 modelScale;\n\t\tmodelScale.x = length( vec3( modelMatrix[ 0 ].xyz ) );\n\t\tmodelScale.y = length( vec3( modelMatrix[ 1 ].xyz ) );\n\t\tmodelScale.z = length( vec3( modelMatrix[ 2 ].xyz ) );\n\t\treturn normalize( refractionVector ) * thickness * modelScale;\n\t}\n\tfloat applyIorToRoughness( const in float roughness, const in float ior ) {\n\t\treturn roughness * clamp( ior * 2.0 - 2.0, 0.0, 1.0 );\n\t}\n\tvec4 getTransmissionSample( const in vec2 fragCoord, const in float roughness, const in float ior ) {\n\t\tfloat framebufferLod = log2( transmissionSamplerSize.x ) * applyIorToRoughness( roughness, ior );\n\t\t#ifdef TEXTURE_LOD_EXT\n\t\t\treturn texture2DLodEXT( transmissionSamplerMap, fragCoord.xy, framebufferLod );\n\t\t#else\n\t\t\treturn texture2D( transmissionSamplerMap, fragCoord.xy, framebufferLod );\n\t\t#endif\n\t}\n\tvec3 applyVolumeAttenuation( const in vec3 radiance, const in float transmissionDistance, const in vec3 attenuationColor, const in float attenuationDistance ) {\n\t\tif ( attenuationDistance == 0.0 ) {\n\t\t\treturn radiance;\n\t\t} else {\n\t\t\tvec3 attenuationCoefficient = -log( attenuationColor ) / attenuationDistance;\n\t\t\tvec3 transmittance = exp( - attenuationCoefficient * transmissionDistance );\t\t\treturn transmittance * radiance;\n\t\t}\n\t}\n\tvec4 getIBLVolumeRefraction( const in vec3 n, const in vec3 v, const in float roughness, const in vec3 diffuseColor,\n\t\tconst in vec3 specularColor, const in float specularF90, const in vec3 position, const in mat4 modelMatrix,\n\t\tconst in mat4 viewMatrix, const in mat4 projMatrix, const in float ior, const in float thickness,\n\t\tconst in vec3 attenuationColor, const in float attenuationDistance ) {\n\t\tvec3 transmissionRay = getVolumeTransmissionRay( n, v, thickness, ior, modelMatrix );\n\t\tvec3 refractedRayExit = position + transmissionRay;\n\t\tvec4 ndcPos = projMatrix * viewMatrix * vec4( refractedRayExit, 1.0 );\n\t\tvec2 refractionCoords = ndcPos.xy / ndcPos.w;\n\t\trefractionCoords += 1.0;\n\t\trefractionCoords /= 2.0;\n\t\tvec4 transmittedLight = getTransmissionSample( refractionCoords, roughness, ior );\n\t\tvec3 attenuatedColor = applyVolumeAttenuation( transmittedLight.rgb, length( transmissionRay ), attenuationColor, attenuationDistance );\n\t\tvec3 F = EnvironmentBRDF( n, v, specularColor, specularF90, roughness );\n\t\treturn vec4( ( 1.0 - F ) * attenuatedColor * diffuseColor, transmittedLight.a );\n\t}\n#endif",uv_pars_fragment:"#if ( defined( USE_UV ) && ! defined( UVS_VERTEX_ONLY ) )\n\tvarying vec2 vUv;\n#endif",uv_pars_vertex:"#ifdef USE_UV\n\t#ifdef UVS_VERTEX_ONLY\n\t\tvec2 vUv;\n\t#else\n\t\tvarying vec2 vUv;\n\t#endif\n\tuniform mat3 uvTransform;\n#endif",uv_vertex:"#ifdef USE_UV\n\tvUv = ( uvTransform * vec3( uv, 1 ) ).xy;\n#endif",uv2_pars_fragment:"#if defined( USE_LIGHTMAP ) || defined( USE_AOMAP )\n\tvarying vec2 vUv2;\n#endif",uv2_pars_vertex:"#if defined( USE_LIGHTMAP ) || defined( USE_AOMAP )\n\tattribute vec2 uv2;\n\tvarying vec2 vUv2;\n\tuniform mat3 uv2Transform;\n#endif",uv2_vertex:"#if defined( USE_LIGHTMAP ) || defined( USE_AOMAP )\n\tvUv2 = ( uv2Transform * vec3( uv2, 1 ) ).xy;\n#endif",worldpos_vertex:"#if defined( USE_ENVMAP ) || defined( DISTANCE ) || defined ( USE_SHADOWMAP ) || defined ( USE_TRANSMISSION )\n\tvec4 worldPosition = vec4( transformed, 1.0 );\n\t#ifdef USE_INSTANCING\n\t\tworldPosition = instanceMatrix * worldPosition;\n\t#endif\n\tworldPosition = modelMatrix * worldPosition;\n#endif",background_vert:"varying vec2 vUv;\nuniform mat3 uvTransform;\nvoid main() {\n\tvUv = ( uvTransform * vec3( uv, 1 ) ).xy;\n\tgl_Position = vec4( position.xy, 1.0, 1.0 );\n}",background_frag:"uniform sampler2D t2D;\nvarying vec2 vUv;\nvoid main() {\n\tvec4 texColor = texture2D( t2D, vUv );\n\tgl_FragColor = mapTexelToLinear( texColor );\n\t#include \n\t#include \n}",cube_vert:"varying vec3 vWorldDirection;\n#include \nvoid main() {\n\tvWorldDirection = transformDirection( position, modelMatrix );\n\t#include \n\t#include \n\tgl_Position.z = gl_Position.w;\n}",cube_frag:"#include \nuniform float opacity;\nvarying vec3 vWorldDirection;\n#include \nvoid main() {\n\tvec3 vReflect = vWorldDirection;\n\t#include \n\tgl_FragColor = envColor;\n\tgl_FragColor.a *= opacity;\n\t#include \n\t#include \n}",depth_vert:"#include \n#include \n#include \n#include \n#include \n#include \n#include \nvarying vec2 vHighPrecisionZW;\nvoid main() {\n\t#include \n\t#include \n\t#ifdef USE_DISPLACEMENTMAP\n\t\t#include \n\t\t#include \n\t\t#include \n\t#endif\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\tvHighPrecisionZW = gl_Position.zw;\n}",depth_frag:"#if DEPTH_PACKING == 3200\n\tuniform float opacity;\n#endif\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvarying vec2 vHighPrecisionZW;\nvoid main() {\n\t#include \n\tvec4 diffuseColor = vec4( 1.0 );\n\t#if DEPTH_PACKING == 3200\n\t\tdiffuseColor.a = opacity;\n\t#endif\n\t#include \n\t#include \n\t#include \n\t#include \n\tfloat fragCoordZ = 0.5 * vHighPrecisionZW[0] / vHighPrecisionZW[1] + 0.5;\n\t#if DEPTH_PACKING == 3200\n\t\tgl_FragColor = vec4( vec3( 1.0 - fragCoordZ ), opacity );\n\t#elif DEPTH_PACKING == 3201\n\t\tgl_FragColor = packDepthToRGBA( fragCoordZ );\n\t#endif\n}",distanceRGBA_vert:"#define DISTANCE\nvarying vec3 vWorldPosition;\n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\t#include \n\t#ifdef USE_DISPLACEMENTMAP\n\t\t#include \n\t\t#include \n\t\t#include \n\t#endif\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\tvWorldPosition = worldPosition.xyz;\n}",distanceRGBA_frag:"#define DISTANCE\nuniform vec3 referencePosition;\nuniform float nearDistance;\nuniform float farDistance;\nvarying vec3 vWorldPosition;\n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main () {\n\t#include \n\tvec4 diffuseColor = vec4( 1.0 );\n\t#include \n\t#include \n\t#include \n\tfloat dist = length( vWorldPosition - referencePosition );\n\tdist = ( dist - nearDistance ) / ( farDistance - nearDistance );\n\tdist = saturate( dist );\n\tgl_FragColor = packDepthToRGBA( dist );\n}",equirect_vert:"varying vec3 vWorldDirection;\n#include \nvoid main() {\n\tvWorldDirection = transformDirection( position, modelMatrix );\n\t#include \n\t#include \n}",equirect_frag:"uniform sampler2D tEquirect;\nvarying vec3 vWorldDirection;\n#include \nvoid main() {\n\tvec3 direction = normalize( vWorldDirection );\n\tvec2 sampleUV = equirectUv( direction );\n\tvec4 texColor = texture2D( tEquirect, sampleUV );\n\tgl_FragColor = mapTexelToLinear( texColor );\n\t#include \n\t#include \n}",linedashed_vert:"uniform float scale;\nattribute float lineDistance;\nvarying float vLineDistance;\n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\tvLineDistance = scale * lineDistance;\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n}",linedashed_frag:"uniform vec3 diffuse;\nuniform float opacity;\nuniform float dashSize;\nuniform float totalSize;\nvarying float vLineDistance;\n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\tif ( mod( vLineDistance, totalSize ) > dashSize ) {\n\t\tdiscard;\n\t}\n\tvec3 outgoingLight = vec3( 0.0 );\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include \n\t#include \n\toutgoingLight = diffuseColor.rgb;\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n}",meshbasic_vert:"#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\t#include \n\t#include \n\t#if defined ( USE_ENVMAP ) || defined ( USE_SKINNING )\n\t\t#include \n\t\t#include \n\t\t#include \n\t\t#include \n\t\t#include \n\t#endif\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n}",meshbasic_frag:"uniform vec3 diffuse;\nuniform float opacity;\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n#endif\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\t#ifdef USE_LIGHTMAP\n\t\tvec4 lightMapTexel= texture2D( lightMap, vUv2 );\n\t\treflectedLight.indirectDiffuse += lightMapTexelToLinear( lightMapTexel ).rgb * lightMapIntensity;\n\t#else\n\t\treflectedLight.indirectDiffuse += vec3( 1.0 );\n\t#endif\n\t#include \n\treflectedLight.indirectDiffuse *= diffuseColor.rgb;\n\tvec3 outgoingLight = reflectedLight.indirectDiffuse;\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n}",meshlambert_vert:"#define LAMBERT\nvarying vec3 vLightFront;\nvarying vec3 vIndirectFront;\n#ifdef DOUBLE_SIDED\n\tvarying vec3 vLightBack;\n\tvarying vec3 vIndirectBack;\n#endif\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n}",meshlambert_frag:"uniform vec3 diffuse;\nuniform vec3 emissive;\nuniform float opacity;\nvarying vec3 vLightFront;\nvarying vec3 vIndirectFront;\n#ifdef DOUBLE_SIDED\n\tvarying vec3 vLightBack;\n\tvarying vec3 vIndirectBack;\n#endif\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\tvec3 totalEmissiveRadiance = emissive;\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#ifdef DOUBLE_SIDED\n\t\treflectedLight.indirectDiffuse += ( gl_FrontFacing ) ? vIndirectFront : vIndirectBack;\n\t#else\n\t\treflectedLight.indirectDiffuse += vIndirectFront;\n\t#endif\n\t#include \n\treflectedLight.indirectDiffuse *= BRDF_Lambert( diffuseColor.rgb );\n\t#ifdef DOUBLE_SIDED\n\t\treflectedLight.directDiffuse = ( gl_FrontFacing ) ? vLightFront : vLightBack;\n\t#else\n\t\treflectedLight.directDiffuse = vLightFront;\n\t#endif\n\treflectedLight.directDiffuse *= BRDF_Lambert( diffuseColor.rgb ) * getShadowMask();\n\t#include \n\tvec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance;\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n}",meshmatcap_vert:"#define MATCAP\nvarying vec3 vViewPosition;\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\tvViewPosition = - mvPosition.xyz;\n}",meshmatcap_frag:"#define MATCAP\nuniform vec3 diffuse;\nuniform float opacity;\nuniform sampler2D matcap;\nvarying vec3 vViewPosition;\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\tvec3 viewDir = normalize( vViewPosition );\n\tvec3 x = normalize( vec3( viewDir.z, 0.0, - viewDir.x ) );\n\tvec3 y = cross( viewDir, x );\n\tvec2 uv = vec2( dot( x, normal ), dot( y, normal ) ) * 0.495 + 0.5;\n\t#ifdef OFT_MATCAP\n\tuv.y = 1.0 - uv.y;\n\t#endif\n\t#ifdef USE_MATCAP\n\t\tvec4 matcapColor = texture2D( matcap, uv );\n\t\tmatcapColor = matcapTexelToLinear( matcapColor );\n\t#else\n\t\tvec4 matcapColor = vec4( vec3( mix( 0.2, 0.8, uv.y ) ), 1.0 );\n\t#endif\n\tvec3 outgoingLight = diffuseColor.rgb * matcapColor.rgb;\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n}",meshnormal_vert:"#define NORMAL\n#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( TANGENTSPACE_NORMALMAP )\n\tvarying vec3 vViewPosition;\n#endif\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( TANGENTSPACE_NORMALMAP )\n\tvViewPosition = - mvPosition.xyz;\n#endif\n}",meshnormal_frag:"#define NORMAL\nuniform float opacity;\n#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( TANGENTSPACE_NORMALMAP )\n\tvarying vec3 vViewPosition;\n#endif\n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\t#include \n\t#include \n\t#include \n\tgl_FragColor = vec4( packNormalToRGB( normal ), opacity );\n\t#ifdef OPAQUE\n\t\tgl_FragColor.a = 1.0;\n\t#endif\n}",meshphong_vert:"#define PHONG\nvarying vec3 vViewPosition;\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\tvViewPosition = - mvPosition.xyz;\n\t#include \n\t#include \n\t#include \n\t#include \n}",meshphong_frag:"#define PHONG\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform vec3 specular;\nuniform float shininess;\nuniform float opacity;\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\tvec3 totalEmissiveRadiance = emissive;\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\tvec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + reflectedLight.directSpecular + reflectedLight.indirectSpecular + totalEmissiveRadiance;\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n}",meshphysical_vert:"#define STANDARD\nvarying vec3 vViewPosition;\n#ifdef USE_TRANSMISSION\n\tvarying vec3 vWorldPosition;\n#endif\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\tvViewPosition = - mvPosition.xyz;\n\t#include \n\t#include \n\t#include \n#ifdef USE_TRANSMISSION\n\tvWorldPosition = worldPosition.xyz;\n#endif\n}",meshphysical_frag:"#define STANDARD\n#ifdef PHYSICAL\n\t#define IOR\n\t#define SPECULAR\n#endif\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform float roughness;\nuniform float metalness;\nuniform float f90_r115_compatability;\nuniform float opacity;\n#ifdef IOR\n\tuniform float ior;\n#endif\n#ifdef SPECULAR\n\tuniform float specularIntensity;\n\tuniform vec3 specularColor;\n\t#ifdef USE_SPECULARINTENSITYMAP\n\t\tuniform sampler2D specularIntensityMap;\n\t#endif\n\t#ifdef USE_SPECULARCOLORMAP\n\t\tuniform sampler2D specularColorMap;\n\t#endif\n#endif\n#ifdef USE_CLEARCOAT\n\tuniform float clearcoat;\n\tuniform float clearcoatRoughness;\n#endif\n#ifdef USE_SHEEN\n\tuniform vec3 sheenColor;\n\tuniform float sheenRoughness;\n\t#ifdef USE_SHEENCOLORMAP\n\t\tuniform sampler2D sheenColorMap;\n\t#endif\n\t#ifdef USE_SHEENROUGHNESSMAP\n\t\tuniform sampler2D sheenRoughnessMap;\n\t#endif\n#endif\n#ifdef USE_REFRACTION\n\tuniform float refraction;\n#endif\nvarying vec3 vViewPosition;\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\tvec3 totalEmissiveRadiance = emissive;\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\tvec3 totalDiffuse = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse;\n\tvec3 totalSpecular = reflectedLight.directSpecular + reflectedLight.indirectSpecular;\n\t#include \n\tvec3 outgoingLight = totalDiffuse + totalSpecular + totalEmissiveRadiance;\n\t#ifndef CLEARCOAT_R115_COMPATABILITY\n\t#ifdef USE_SHEEN\n\t\tfloat sheenEnergyComp = 1.0 - 0.157 * max3( material.sheenColor );\n\t\toutgoingLight = outgoingLight * sheenEnergyComp + sheenSpecular;\n\t#endif\n\t#ifdef USE_CLEARCOAT\n\t\tfloat dotNVcc = saturate( dot( splitGeoClearcoatNormal, geometry.viewDir ) );\n\t\tvec3 Fcc = F_Schlick( material.clearcoatF0, material.clearcoatF90, dotNVcc );\n\t\toutgoingLight = outgoingLight * ( 1.0 - material.clearcoat * Fcc ) + clearcoatSpecular * material.clearcoat;\n\t#endif\n\t#endif\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n}",meshtoon_vert:"#define TOON\nvarying vec3 vViewPosition;\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\tvViewPosition = - mvPosition.xyz;\n\t#include \n\t#include \n\t#include \n}",meshtoon_frag:"#define TOON\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform float opacity;\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\tvec3 totalEmissiveRadiance = emissive;\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\tvec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance;\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n}",points_vert:"uniform float size;\nuniform float scale;\n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\t#include \n\t#include \n\t#include \n\tgl_PointSize = size;\n\t#ifdef USE_SIZEATTENUATION\n\t\tbool isPerspective = isPerspectiveMatrix( projectionMatrix );\n\t\tif ( isPerspective ) gl_PointSize *= ( scale / - mvPosition.z );\n\t#endif\n\t#include \n\t#include \n\t#include \n\t#include \n}",points_frag:"uniform vec3 diffuse;\nuniform float opacity;\n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\tvec3 outgoingLight = vec3( 0.0 );\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include \n\t#include \n\t#include \n\t#include \n\toutgoingLight = diffuseColor.rgb;\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n}",shadow_vert:"#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n}",shadow_frag:"uniform vec3 color;\nuniform float opacity;\n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\tgl_FragColor = vec4( color, opacity * ( 1.0 - getShadowMask() ) );\n\t#include \n\t#include \n\t#include \n}",sprite_vert:"uniform float rotation;\nuniform vec2 center;\n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\tvec4 mvPosition = modelViewMatrix * vec4( 0.0, 0.0, 0.0, 1.0 );\n\tvec2 scale;\n\tscale.x = length( vec3( modelMatrix[ 0 ].x, modelMatrix[ 0 ].y, modelMatrix[ 0 ].z ) );\n\tscale.y = length( vec3( modelMatrix[ 1 ].x, modelMatrix[ 1 ].y, modelMatrix[ 1 ].z ) );\n\t#ifndef USE_SIZEATTENUATION\n\t\tbool isPerspective = isPerspectiveMatrix( projectionMatrix );\n\t\tif ( isPerspective ) scale *= - mvPosition.z;\n\t#endif\n\tvec2 alignedPosition = ( position.xy - ( center - vec2( 0.5 ) ) ) * scale;\n\tvec2 rotatedPosition;\n\trotatedPosition.x = cos( rotation ) * alignedPosition.x - sin( rotation ) * alignedPosition.y;\n\trotatedPosition.y = sin( rotation ) * alignedPosition.x + cos( rotation ) * alignedPosition.y;\n\tmvPosition.xy += rotatedPosition;\n\tgl_Position = projectionMatrix * mvPosition;\n\t#include \n\t#include \n\t#include \n}",sprite_frag:"uniform vec3 diffuse;\nuniform float opacity;\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\tvec3 outgoingLight = vec3( 0.0 );\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include \n\t#include \n\t#include \n\t#include \n\toutgoingLight = diffuseColor.rgb;\n\t#include \n\t#include \n\t#include \n\t#include \n}"},bi={common:{diffuse:{value:new dn(16777215)},opacity:{value:1},map:{value:null},uvTransform:{value:new Ct},uv2Transform:{value:new Ct},alphaMap:{value:null},alphaTest:{value:0}},specularmap:{specularMap:{value:null}},envmap:{envMap:{value:null},flipEnvMap:{value:-1},reflectivity:{value:1},ior:{value:1.5},refractionRatio:{value:.98}},aomap:{aoMap:{value:null},aoMapIntensity:{value:1}},lightmap:{lightMap:{value:null},lightMapIntensity:{value:1}},emissivemap:{emissiveMap:{value:null}},bumpmap:{bumpMap:{value:null},bumpScale:{value:1}},normalmap:{normalMap:{value:null},lowerNormalMap:{value:null},normalScale:{value:new Rt(1,1)}},displacementmap:{displacementMap:{value:null},displacementScale:{value:1},displacementBias:{value:0}},roughnessmap:{roughnessMap:{value:null}},metalnessmap:{metalnessMap:{value:null}},gradientmap:{gradientMap:{value:null}},fog:{fogDensity:{value:25e-5},fogNear:{value:1},fogFar:{value:2e3},fogColor:{value:new dn(16777215)}},lights:{ambientLightColor:{value:[]},lightProbe:{value:[]},directionalLights:{value:[],properties:{direction:{},color:{}}},directionalLightShadows:{value:[],properties:{shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{}}},directionalShadowMap:{value:[]},directionalShadowMatrix:{value:[]},spotLights:{value:[],properties:{color:{},position:{},direction:{},distance:{},coneCos:{},penumbraCos:{},decay:{}}},spotLightShadows:{value:[],properties:{shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{}}},spotShadowMap:{value:[]},spotShadowMatrix:{value:[]},pointLights:{value:[],properties:{color:{},position:{},decay:{},distance:{}}},pointLightShadows:{value:[],properties:{shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{},shadowCameraNear:{},shadowCameraFar:{}}},pointShadowMap:{value:[]},pointShadowMatrix:{value:[]},hemisphereLights:{value:[],properties:{direction:{},skyColor:{},groundColor:{}}},rectAreaLights:{value:[],properties:{color:{},position:{},width:{},height:{}}},ltc_1:{value:null},ltc_2:{value:null}},points:{diffuse:{value:new dn(16777215)},opacity:{value:1},size:{value:1},scale:{value:1},map:{value:null},alphaMap:{value:null},alphaTest:{value:0},uvTransform:{value:new Ct}},sprite:{diffuse:{value:new dn(16777215)},opacity:{value:1},center:{value:new Rt(.5,.5)},rotation:{value:0},map:{value:null},alphaMap:{value:null},alphaTest:{value:0},uvTransform:{value:new Ct}}},wi={basic:{uniforms:ni([bi.common,bi.specularmap,bi.envmap,bi.aomap,bi.lightmap,bi.fog]),vertexShader:Mi.meshbasic_vert,fragmentShader:Mi.meshbasic_frag},lambert:{uniforms:ni([bi.common,bi.specularmap,bi.envmap,bi.aomap,bi.lightmap,bi.emissivemap,bi.fog,bi.lights,{emissive:{value:new dn(0)}}]),vertexShader:Mi.meshlambert_vert,fragmentShader:Mi.meshlambert_frag},phong:{uniforms:ni([bi.common,bi.specularmap,bi.envmap,bi.aomap,bi.lightmap,bi.emissivemap,bi.bumpmap,bi.normalmap,bi.displacementmap,bi.fog,bi.lights,{emissive:{value:new dn(0)},specular:{value:new dn(1118481)},shininess:{value:30}}]),vertexShader:Mi.meshphong_vert,fragmentShader:Mi.meshphong_frag},standard:{uniforms:ni([bi.common,bi.envmap,bi.aomap,bi.lightmap,bi.emissivemap,bi.bumpmap,bi.normalmap,bi.displacementmap,bi.roughnessmap,bi.metalnessmap,bi.fog,bi.lights,{emissive:{value:new dn(0)},roughness:{value:1},metalness:{value:0},refraction:{value:0},envMapIntensity:{value:1},f90_r115_compatability:{value:1}}]),vertexShader:Mi.meshphysical_vert,fragmentShader:Mi.meshphysical_frag},toon:{uniforms:ni([bi.common,bi.aomap,bi.lightmap,bi.emissivemap,bi.bumpmap,bi.normalmap,bi.displacementmap,bi.gradientmap,bi.fog,bi.lights,{emissive:{value:new dn(0)}}]),vertexShader:Mi.meshtoon_vert,fragmentShader:Mi.meshtoon_frag},matcap:{uniforms:ni([bi.common,bi.bumpmap,bi.normalmap,bi.displacementmap,bi.fog,{matcap:{value:null}}]),vertexShader:Mi.meshmatcap_vert,fragmentShader:Mi.meshmatcap_frag},points:{uniforms:ni([bi.points,bi.fog]),vertexShader:Mi.points_vert,fragmentShader:Mi.points_frag},dashed:{uniforms:ni([bi.common,bi.fog,{scale:{value:1},dashSize:{value:1},totalSize:{value:2}}]),vertexShader:Mi.linedashed_vert,fragmentShader:Mi.linedashed_frag},depth:{uniforms:ni([bi.common,bi.displacementmap]),vertexShader:Mi.depth_vert,fragmentShader:Mi.depth_frag},normal:{uniforms:ni([bi.common,bi.bumpmap,bi.normalmap,bi.displacementmap,{opacity:{value:1}}]),vertexShader:Mi.meshnormal_vert,fragmentShader:Mi.meshnormal_frag},sprite:{uniforms:ni([bi.sprite,bi.fog]),vertexShader:Mi.sprite_vert,fragmentShader:Mi.sprite_frag},background:{uniforms:{uvTransform:{value:new Ct},t2D:{value:null}},vertexShader:Mi.background_vert,fragmentShader:Mi.background_frag},cube:{uniforms:ni([bi.envmap,{opacity:{value:1}}]),vertexShader:Mi.cube_vert,fragmentShader:Mi.cube_frag},equirect:{uniforms:{tEquirect:{value:null}},vertexShader:Mi.equirect_vert,fragmentShader:Mi.equirect_frag},distanceRGBA:{uniforms:ni([bi.common,bi.displacementmap,{referencePosition:{value:new kt},nearDistance:{value:1},farDistance:{value:1e3}}]),vertexShader:Mi.distanceRGBA_vert,fragmentShader:Mi.distanceRGBA_frag},shadow:{uniforms:ni([bi.lights,bi.fog,{color:{value:new dn(0)},opacity:{value:1}}]),vertexShader:Mi.shadow_vert,fragmentShader:Mi.shadow_frag}};function Si(t,e,n,i,r,s){const a=new dn(0);let o,c,h=!0===r?0:1,u=null,d=0,p=null,m=null;function f(t,e,i){n.buffers.color.setClear(t.r,t.g,t.b,e,i)}return{getClearColor:function(){return a},setClearColor:function(t,e=1){a.set(t),h=e,f(a,h,s)},getClearAlpha:function(){return h},setClearAlpha:function(t){h=t,f(a,h,s)},render:function(n,r,g){let v=!1,x=!0===r.isScene?r.background:null;const y=!0===r.isScene&&r.bgToneMapped;x&&x.isTexture&&(x=e.get(x));const _=t.xr,M=_.getSession&&_.getSession();M&&"additive"===M.environmentBlendMode&&(x=null);const b=a.clone();let w=h;if(x&&x.isColor&&(b.set(x),w=1,v=!0),null===x||x.isColor){const e=null!==g?t.getTextureEncodingFromMap(g.texture):t.outputEncoding;e===ot?b.convertSRGBToLinear():e===ct&&(b.convertSRGBToLinear(),w=128/255);f(b,w,null!=g?g.texture.premultiplyAlpha:s)}(t.autoClear||v)&&t.clear(t.autoClearColor,t.autoClearDepth,t.autoClearStencil),x&&(x.isCubeTexture||x.mapping===l)?(void 0===c&&(c=new Qn(new ti(1,1,1),new ri({name:"BackgroundCubeMaterial",uniforms:ei(wi.cube.uniforms),vertexShader:wi.cube.vertexShader,fragmentShader:wi.cube.fragmentShader,side:1,depthTest:!1,depthWrite:!1,fog:!1})),c.layers.enableAll(),c.geometry.deleteAttribute("normal"),c.geometry.deleteAttribute("uv"),c.onBeforeRender=function(t,e,n){this.matrixWorld.copyPosition(n.matrixWorld)},Object.defineProperty(c.material,"envMap",{get:function(){return this.uniforms.envMap.value}}),i.update(c)),c.material.toneMapped=y,c.material.uniforms.envMap.value=x,c.material.uniforms.flipEnvMap.value=x.isCubeTexture&&!1===x.isRenderTargetTexture?-1:1,u===x&&d===x.version&&p===t.toneMapping&&m===y||(c.material.needsUpdate=!0,u=x,d=x.version,p=t.toneMapping,m=y),n.unshift(c,c.geometry,c.material,0,0,null)):x&&x.isTexture&&(void 0===o&&(o=new Qn(new _i(2,2),new ri({name:"BackgroundMaterial",uniforms:ei(wi.background.uniforms),vertexShader:wi.background.vertexShader,fragmentShader:wi.background.fragmentShader,side:0,depthTest:!1,depthWrite:!1,fog:!1})),o.layers.enableAll(),o.geometry.deleteAttribute("normal"),Object.defineProperty(o.material,"map",{get:function(){return this.uniforms.t2D.value}}),i.update(o)),o.material.toneMapped=y,o.material.uniforms.t2D.value=x,!0===x.matrixAutoUpdate&&x.updateMatrix(),o.material.uniforms.uvTransform.value.copy(x.matrix),u===x&&d===x.version&&p===t.toneMapping&&m===y||(o.material.needsUpdate=!0,u=x,d=x.version,p=t.toneMapping,m=y),n.unshift(o,o.geometry,o.material,0,0,null))}}}function Ti(t,e,n,i){const r=t.getParameter(34921),s=i.isWebGL2?null:e.get("OES_vertex_array_object"),a=i.isWebGL2||null!==s,o={},l=d(null);let c=l;function h(e){return i.isWebGL2?t.bindVertexArray(e):s.bindVertexArrayOES(e)}function u(e){return i.isWebGL2?t.deleteVertexArray(e):s.deleteVertexArrayOES(e)}function d(t){const e=[],n=[],i=[];for(let t=0;t=0){let s=l[e];if(void 0===s&&("instanceMatrix"===e&&r.instanceMatrix&&(s=r.instanceMatrix),"instanceColor"===e&&r.instanceColor&&(s=r.instanceColor)),void 0!==s){const e=s.normalized,a=s.itemSize,l=n.get(s);if(void 0===l)continue;const c=l.buffer,h=l.type,u=l.bytesPerElement;if(s.isInterleavedBufferAttribute){const n=s.data,l=n.stride,d=s.offset;if(n&&n.isInstancedInterleavedBuffer){for(let t=0;t0&&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 a=void 0!==n.precision?n.precision:"highp";const o=r(a);o!==a&&(console.warn("THREE.WebGLRenderer:",a,"not supported, using",o,"instead."),a=o);const l=s||e.has("WEBGL_draw_buffers"),c=!0===n.logarithmicDepthBuffer,h=t.getParameter(34930),u=t.getParameter(35660),d=t.getParameter(3379),p=t.getParameter(34076),m=t.getParameter(34921),f=t.getParameter(36347),g=t.getParameter(36348),v=t.getParameter(36349),x=u>0,y=s||e.has("OES_texture_float");return{isWebGL2:s,drawBuffers:l,getMaxAnisotropy:function(){if(void 0!==i)return i;if(!0===e.has("EXT_texture_filter_anisotropic")){const n=e.get("EXT_texture_filter_anisotropic");i=t.getParameter(n.MAX_TEXTURE_MAX_ANISOTROPY_EXT)}else i=0;return i},getMaxPrecision:r,precision:a,logarithmicDepthBuffer:c,maxTextures:h,maxVertexTextures:u,maxTextureSize:d,maxCubemapSize:p,maxAttributes:m,maxVertexUniforms:f,maxVaryings:g,maxFragmentUniforms:v,vertexTextures:x,floatFragmentTextures:y,floatVertexTextures:x&&y,maxSamples:s?t.getParameter(36183):0}}function Ri(t){const e=this;let n=null,i=0,r=!1,s=!1;const a=new mi,o=new Ct,l={value:null,needsUpdate:!1};function c(){l.value!==n&&(l.value=n,l.needsUpdate=i>0),e.numPlanes=i,e.numIntersection=0}function h(t,n,i,r){const s=null!==t?t.length:0;let c=null;if(0!==s){if(c=l.value,!0!==r||null===c){const e=i+4*s,r=n.matrixWorldInverse;o.getNormalMatrix(r),(null===c||c.length0){const a=new hi(s.height/2);return a.fromEquirectangularTexture(t,r),e.set(r,a),r.addEventListener("dispose",i),n(a.texture,r.mapping)}return null}}}return r},dispose:function(){e=new WeakMap}}}wi.physical={uniforms:ni([wi.standard.uniforms,{clearcoat:{value:0},clearcoatMap:{value:null},clearcoatRoughness:{value:0},clearcoatRoughnessMap:{value:null},clearcoatNormalScale:{value:new Rt(1,1)},clearcoatNormalMap:{value:null},sheen:{value:0},sheenColor:{value:new dn(0)},sheenColorMap:{value:null},sheenRoughness:{value:1},sheenRoughnessMap:{value:null},transmission:{value:0},transmissionMap:{value:null},transmissionSamplerSize:{value:new Rt},transmissionSamplerMap:{value:null},thickness:{value:0},thicknessMap:{value:null},attenuationDistance:{value:0},attenuationColor:{value:new dn(0)},specularIntensity:{value:1},specularIntensityMap:{value:null},specularColor:{value:new dn(1,1,1)},specularColorMap:{value:null}}]),vertexShader:Mi.meshphysical_vert,fragmentShader:Mi.meshphysical_frag};class Li extends si{constructor(t=-1,e=1,n=1,i=-1,r=.1,s=2e3){super(),this.type="OrthographicCamera",this.zoom=1,this.view=null,this.left=t,this.right=e,this.top=n,this.bottom=i,this.near=r,this.far=s,this.updateProjectionMatrix()}copy(t,e){return super.copy(t,e),this.left=t.left,this.right=t.right,this.top=t.top,this.bottom=t.bottom,this.near=t.near,this.far=t.far,this.zoom=t.zoom,this.view=null===t.view?null:Object.assign({},t.view),this}setViewOffset(t,e,n,i,r,s){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=i,this.view.width=r,this.view.height=s,this.updateProjectionMatrix()}clearViewOffset(){null!==this.view&&(this.view.enabled=!1),this.updateProjectionMatrix()}updateProjectionMatrix(){const t=(this.right-this.left)/(2*this.zoom),e=(this.top-this.bottom)/(2*this.zoom),n=(this.right+this.left)/2,i=(this.top+this.bottom)/2;let r=n-t,s=n+t,a=i+e,o=i-e;if(null!==this.view&&this.view.enabled){const t=(this.right-this.left)/this.view.fullWidth/this.zoom,e=(this.top-this.bottom)/this.view.fullHeight/this.zoom;r+=t*this.view.offsetX,s=r+t*this.view.width,a-=e*this.view.offsetY,o=a-e*this.view.height}this.projectionMatrix.makeOrthographic(r,s,a,o,this.near,this.far),this.projectionMatrixInverse.copy(this.projectionMatrix).invert()}toJSON(t){const e=super.toJSON(t);return e.object.zoom=this.zoom,e.object.left=this.left,e.object.right=this.right,e.object.top=this.top,e.object.bottom=this.bottom,e.object.near=this.near,e.object.far=this.far,null!==this.view&&(e.object.view=Object.assign({},this.view)),e}}Li.prototype.isOrthographicCamera=!0;class Pi extends ri{constructor(t){super(t),this.type="RawShaderMaterial"}}Pi.prototype.isRawShaderMaterial=!0;const Ii=Math.pow(2,8),Di=[.125,.215,.35,.446,.526,.582],Ni=5+Di.length,Oi=20,Bi={[ot]:0,[lt]:1,[ct]:2},zi=new Li,{_lodPlanes:Fi,_sizeLods:Ui,_sigmas:Hi}=Xi(),Gi=new dn;let Vi=null;const ki=(1+Math.sqrt(5))/2,Wi=1/ki,ji=[new kt(1,1,1),new kt(-1,1,1),new kt(1,1,-1),new kt(-1,1,-1),new kt(0,ki,Wi),new kt(0,ki,-Wi),new kt(Wi,0,ki),new kt(-Wi,0,ki),new kt(ki,Wi,0),new kt(-ki,Wi,0)];class qi{constructor(t){this._renderer=t,this._pingPongRenderTarget=null,this._blurMaterial=function(t){const e=new Float32Array(t),n=new kt(0,1,0);return new Pi({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:Bi[3e3]},outputEncoding:{value:Bi[3e3]}},vertexShader:Qi(),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${$i()}\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:0,depthTest:!1,depthWrite:!1})}(Oi),this._flipCubeUVMaxLevelTileShader=null,this._equirectShader=null,this._cubemapShader=null,this._compileMaterial(this._blurMaterial)}fromScene(t,e=0,n=.1,i=100){Vi=this._renderer.getRenderTarget();const r=this._allocateTargets();return this._sceneToCubeUV(t,n,i,this._pingPongRenderTarget),this._flipCubeUVMaxLevelTile(this._pingPongRenderTarget,r),e>0&&this._blur(r,0,0,e),this._applyPMREM(r),this._cleanup(r),r}fromEquirectangular(t,e=null){return this._fromTexture(t,e)}fromCubemap(t,e=null){return this._fromTexture(t,e)}compileCubemapShader(){null===this._cubemapShader&&(this._cubemapShader=Ki(),this._compileMaterial(this._cubemapShader))}compileEquirectangularShader(){null===this._equirectShader&&(this._equirectShader=Zi(),this._compileMaterial(this._equirectShader))}dispose(){this._blurMaterial.dispose(),null!==this._pingPongRenderTarget&&this._pingPongRenderTarget.dispose(),null!==this._flipCubeUVMaxLevelTileShader&&this._flipCubeUVMaxLevelTileShader.dispose(),null!==this._cubemapShader&&this._cubemapShader.dispose(),null!==this._equirectShader&&this._equirectShader.dispose();for(let t=0;t2?Ii:0,Ii,Ii),o.setRenderTarget(i),p&&o.render(d,r),o.render(t,r)}d.geometry.dispose(),d.material.dispose(),o.toneMapping=h,o.outputEncoding=c,o.autoClear=l,t.background=m}_setEncoding(t,e){t.value=Bi[this._renderer.getTextureEncodingFromMap(e)]}_textureToCubeUV(t,e){const n=this._renderer,i=t.mapping===r||t.mapping===s;i?(null===this._cubemapShader&&(this._cubemapShader=Ki()),this._cubemapShader.uniforms.flipEnvMap.value=!1===t.isRenderTargetTexture?-1:1):null===this._equirectShader&&(this._equirectShader=Zi());const a=i?this._cubemapShader:this._equirectShader,o=new Qn(Fi[0],a),l=a.uniforms;l.envMap.value=t,i||l.texelSize.value.set(1/t.image.width,1/t.image.height),this._setEncoding(l.inputEncoding,t),this._setEncoding(l.outputEncoding,e.texture),Ji(e,0,0,3*Ii,2*Ii),n.setRenderTarget(e),n.render(o,zi)}_applyPMREM(t){const e=this._renderer,n=e.autoClear;e.autoClear=!1;for(let e=1;eOi&&console.warn(`sigmaRadians, ${r}, is too large and will clip, as it requested ${m} samples when the maximum is set to 20`);const f=[];let g=0;for(let t=0;t4?i-8+4:0),3*v,2*v),o.setRenderTarget(e),o.render(c,zi)}_flipCubeUVMaxLevelTile(t,e){const n=this._renderer;null===this._flipCubeUVMaxLevelTileShader&&(this._flipCubeUVMaxLevelTileShader=new Pi({name:"FlipCubeUVMaxLevelTile",uniforms:{envMap:{value:null},inputEncoding:{value:Bi[3e3]},outputEncoding:{value:Bi[3e3]}},vertexShader:Qi(),fragmentShader:`\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\n\t\t\t${$i()}\n\n\t\t\t#define ENVMAP_TYPE_CUBE_UV\n\t\t\t#include \n\n\t\t\tvoid main() {\n\n\t\t\t\tvec3 direction = normalize( vOutputDirection );\n\t\t\t\tfloat face = getFace( direction );\n\n\t\t\t\tif ( face == 0.0 || face == 3.0 ) {\n\n\t\t\t\t\tdirection.z = - direction.z;\n\n\t\t\t\t} else {\n\n\t\t\t\t\tdirection.x = - direction.x;\n\n\t\t\t\t}\n\n\t\t\t\tgl_FragColor = vec4( bilinearCubeUV( envMap, direction, cubeUV_maxMipLevel ), 1.0 );\n\t\t\t\tgl_FragColor = linearToOutputTexel( gl_FragColor );\n\n\t\t\t}\n\t\t`,blending:0,depthTest:!1,depthWrite:!1}));const i=this._flipCubeUVMaxLevelTileShader,r=new Qn(Fi[0],i),s=i.uniforms;s.envMap.value=t.texture,this._setEncoding(s.inputEncoding,t.texture),this._setEncoding(s.outputEncoding,t.texture),Ji(e,0,0,3*Ii,2*Ii),n.setRenderTarget(e),n.render(r,zi)}}function Xi(){const t=[],e=[],n=[];let i=8;for(let r=0;r4?a=Di[r-8+4-1]:0===r&&(a=0),n.push(a);const o=1/(s-1),l=-o/2,c=1+o/2,h=[l,l,c,l,c,c,l,l,c,c,l,c],u=6,d=6,p=3,m=2,f=1,g=new Float32Array(p*d*u),v=new Float32Array(m*d*u),x=new Float32Array(f*d*u);for(let t=0;t2?0:-1,i=[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(i,p*d*t),v.set(h,m*d*t);const r=[t,t,t,t,t,t];x.set(r,f*d*t)}const y=new Nn;y.setAttribute("position",new gn(g,p)),y.setAttribute("uv",new gn(v,m)),y.setAttribute("faceIndex",new gn(x,f)),t.push(y),i>4&&i--}return{_lodPlanes:t,_sizeLods:e,_sigmas:n}}function Yi(t){const e=new Ht(3*Ii,3*Ii,t);return e.texture.mapping=l,e.texture.name="PMREM.cubeUv",e.scissorTest=!0,e}function Ji(t,e,n,i,r){t.viewport.set(e,n,i,r),t.scissor.set(e,n,i,r)}function Zi(){const t=new Rt(1,1);return new Pi({name:"EquirectangularToCubeUV",uniforms:{envMap:{value:null},texelSize:{value:t},inputEncoding:{value:Bi[3e3]},outputEncoding:{value:Bi[3e3]}},vertexShader:Qi(),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${$i()}\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:0,depthTest:!1,depthWrite:!1})}function Ki(){return new Pi({name:"CubemapToCubeUV",uniforms:{envMap:{value:null},flipEnvMap:{value:-1},inputEncoding:{value:Bi[3e3]},outputEncoding:{value:Bi[3e3]}},vertexShader:Qi(),fragmentShader:`\n\n\t\t\tprecision mediump float;\n\t\t\tprecision mediump int;\n\n\t\t\tuniform float flipEnvMap;\n\n\t\t\tvarying vec3 vOutputDirection;\n\n\t\t\tuniform samplerCube envMap;\n\n\t\t\t${$i()}\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( flipEnvMap * vOutputDirection.x, vOutputDirection.yz ) ) ).rgb;\n\t\t\t\tgl_FragColor = linearToOutputTexel( gl_FragColor );\n\n\t\t\t}\n\t\t`,blending:0,depthTest:!1,depthWrite:!1})}function Qi(){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\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;\n\t\t\t\tdirection.z *= -1.0;\n\n\t\t\t} else if ( face == 1.0 ) {\n\n\t\t\t\tdirection = direction.xzy;\n\t\t\t\tdirection.z *= -1.0;\n\n\t\t\t} else if ( face == 3.0 ) {\n\n\t\t\t\tdirection = direction.zyx;\n\t\t\t\tdirection.x *= -1.0;\n\n\t\t\t} else if ( face == 4.0 ) {\n\n\t\t\t\tdirection = direction.xzy;\n\t\t\t\tdirection.y *= -1.0;\n\n\t\t\t} else if ( face == 5.0 ) {\n\n\t\t\t\tdirection.xz *= -1.0;\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 $i(){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 == 2 ) {\n\n\t\t\t\treturn RGBEToLinear( value );\n\n\t\t\t} else {\n\n\t\t\t\treturn sRGBToLinear( value );\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}\n\n\t\t}\n\n\t\tvec4 envMapTexelToLinear( vec4 color ) {\n\n\t\t\treturn inputTexelToLinear( color );\n\n\t\t}\n\t"}function tr(t){let e=new WeakMap,n=null;function i(t){const n=t.target;n.removeEventListener("dispose",i);const r=e.get(n);void 0!==r&&(e.delete(n),r.dispose())}return{get:function(l){if(l&&l.isTexture){const c=l.mapping,h=c===a||c===o,u=c===r||c===s;if(h||u){if(l.isRenderTargetTexture&&!0===l.needsPMREMUpdate){l.needsPMREMUpdate=!1;let i=e.get(l);return null===n&&(n=new qi(t)),i=h?n.fromEquirectangular(l,i):n.fromCubemap(l,i),e.set(l,i),i.texture}if(e.has(l))return e.get(l).texture;{const r=l.image;if(h&&r&&r.height>0||u&&r&&function(t){let e=0;const n=6;for(let i=0;ie.maxTextureSize&&(u=Math.ceil(h/e.maxTextureSize),h=e.maxTextureSize);const d=new Float32Array(h*u*4*i),p=new sr(d,h,u,i);p.format=T,p.type=b,p.needsUpdate=!0;const m=4*l;for(let e=0;e0)return t;const r=e*n;let s=gr[r];if(void 0===s&&(s=new Float32Array(r),gr[r]=s),0!==e){i.toArray(s,0);for(let i=1,r=0;i!==e;++i)r+=n,t[i].toArray(s,r)}return s}function br(t,e){if(t.length!==e.length)return!1;for(let n=0,i=t.length;n/gm;function As(t){return t.replace(Es,Rs)}function Rs(t,e){const n=Mi[e];if(void 0===n)throw new Error("Can not resolve #include <"+e+">");return As(n)}const Cs=/#pragma unroll_loop[\s]+?for \( int i \= (\d+)\; i < (\d+)\; i \+\+ \) \{([\s\S]+?)(?=\})\}/g,Ls=/#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 Ps(t){return t.replace(Ls,Ds).replace(Cs,Is)}function Is(t,e,n,i){return console.warn("WebGLProgram: #pragma unroll_loop shader syntax is deprecated. Please use #pragma unroll_loop_start syntax instead."),Ds(t,e,n,i)}function Ds(t,e,n,i){let r="";for(let t=parseInt(e);t0&&(y+="\n"),_=[g,v].filter(ws).join("\n"),_.length>0&&(_+="\n")):(y=[Ns(n),"#define SHADER_NAME "+n.shaderName,v,n.instancing?"#define USE_INSTANCING":"",n.instancingColor?"#define USE_INSTANCING_COLOR":"",n.supportsVertexTextures?"#define VERTEX_TEXTURES":"","#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 "+m:"",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.lowerNormalMap?"#define USE_LOWER_8_BIT_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.specularIntensityMap?"#define USE_SPECULARINTENSITYMAP":"",n.specularColorMap?"#define USE_SPECULARCOLORMAP":"",n.roughnessMap?"#define USE_ROUGHNESSMAP":"",n.metalnessMap?"#define USE_METALNESSMAP":"",n.alphaMap?"#define USE_ALPHAMAP":"",n.transmission?"#define USE_TRANSMISSION":"",n.transmissionMap?"#define USE_TRANSMISSIONMAP":"",n.thicknessMap?"#define USE_THICKNESSMAP":"",n.sheenColorMap?"#define USE_SHEENCOLORMAP":"",n.sheenRoughnessMap?"#define USE_SHEENROUGHNESSMAP":"",n.vertexTangents?"#define USE_TANGENT":"",n.vertexColors?"#define USE_COLOR":"",n.vertexAlphas?"#define USE_COLOR_ALPHA":"",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.morphTargets&&n.isWebGL2?"#define MORPHTARGETS_TEXTURE":"",n.morphTargets&&n.isWebGL2?"#define MORPHTARGETS_COUNT "+n.morphTargetsCount:"",n.doubleSided?"#define DOUBLE_SIDED":"",n.flipSided?"#define FLIP_SIDED":"",n.shadowMapEnabled?"#define USE_SHADOWMAP":"",n.shadowMapEnabled?"#define "+d:"",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","#if defined( USE_COLOR_ALPHA )","\tattribute vec4 color;","#elif defined( USE_COLOR )","\tattribute vec3 color;","#endif","#if ( defined( USE_MORPHTARGETS ) && ! defined( MORPHTARGETS_TEXTURE ) )","\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(ws).join("\n"),_=[g,Ns(n),"#define SHADER_NAME "+n.shaderName,v,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 "+p:"",n.envMap?"#define "+m:"",n.envMap?"#define "+f:"",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.lowerNormalMap?"#define USE_LOWER_8_BIT_NORMALMAP":"",n.normalMap&&n.objectSpaceNormalMap?"#define OBJECTSPACE_NORMALMAP":"",n.normalMap&&n.tangentSpaceNormalMap?"#define TANGENTSPACE_NORMALMAP":"",n.clearcoat?"#define USE_CLEARCOAT":"",n.clearcoatMap?"#define USE_CLEARCOATMAP":"",n.clearcoatRoughnessMap?"#define USE_CLEARCOAT_ROUGHNESSMAP":"",n.clearcoatNormalMap?"#define USE_CLEARCOAT_NORMALMAP":"",n.specularMap?"#define USE_SPECULARMAP":"",n.specularIntensityMap?"#define USE_SPECULARINTENSITYMAP":"",n.specularColorMap?"#define USE_SPECULARCOLORMAP":"",n.roughnessMap?"#define USE_ROUGHNESSMAP":"",n.metalnessMap?"#define USE_METALNESSMAP":"",n.alphaMap?"#define USE_ALPHAMAP":"",n.alphaTest?"#define USE_ALPHATEST":"",n.sheen?"#define USE_SHEEN":"",n.sheenColorMap?"#define USE_SHEENCOLORMAP":"",n.sheenRoughnessMap?"#define USE_SHEENROUGHNESSMAP":"",n.transmission?"#define USE_TRANSMISSION":"",n.transmissionMap?"#define USE_TRANSMISSIONMAP":"",n.thicknessMap?"#define USE_THICKNESSMAP":"",n.refraction?"#define USE_REFRACTION":"",n.vertexTangents?"#define USE_TANGENT":"",n.vertexColors||n.instancingColor?"#define USE_COLOR":"",n.vertexAlphas?"#define USE_COLOR_ALPHA":"",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 "+d:"",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;",0!==n.toneMapping?"#define TONE_MAPPING":"",0!==n.toneMapping?Mi.tonemapping_pars_fragment:"",0!==n.toneMapping?bs("toneMapping",n.toneMapping):"",n.dithering?"#define DITHERING":"",n.transparent?"":"#define OPAQUE",Mi.encodings_pars_fragment,n.map?_s("mapTexelToLinear",n.mapEncoding):"",n.matcap?_s("matcapTexelToLinear",n.matcapEncoding):"",n.envMap?_s("envMapTexelToLinear",n.envMapEncoding):"",n.emissiveMap?_s("emissiveMapTexelToLinear",n.emissiveMapEncoding):"",n.specularColorMap?_s("specularColorMapTexelToLinear",n.specularColorMapEncoding):"",n.sheenColorMap?_s("sheenColorMapTexelToLinear",n.sheenColorMapEncoding):"",n.lightMap?_s("lightMapTexelToLinear",n.lightMapEncoding):"",Ms("linearToOutputTexel",n.outputEncoding),n.depthPacking?"#define DEPTH_PACKING "+n.depthPacking:"","\n"].filter(ws).join("\n")),h=As(h),h=Ss(h,n),h=Ts(h,n),u=As(u),u=Ss(u,n),u=Ts(u,n),h=Ps(h),u=Ps(u),n.isWebGL2&&!0!==n.isRawShaderMaterial&&(M="#version 300 es\n",y=["precision mediump sampler2DArray;","#define attribute in","#define varying out","#define texture2D texture"].join("\n")+"\n"+y,_=["#define varying in",n.glslVersion===pt?"":"layout(location = 0) out highp vec4 pc_fragColor;",n.glslVersion===pt?"":"#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"+_);const b=M+_+u,w=gs(a,35633,M+y+h),S=gs(a,35632,b);if(a.attachShader(x,w),a.attachShader(x,S),void 0!==n.index0AttributeName?a.bindAttribLocation(x,0,n.index0AttributeName):!0===n.morphTargets&&a.bindAttribLocation(x,0,"position"),a.linkProgram(x),t.debug.checkShaderErrors){const t=a.getProgramInfoLog(x).trim(),e=a.getShaderInfoLog(w).trim(),n=a.getShaderInfoLog(S).trim();let i=!0,r=!0;if(!1===a.getProgramParameter(x,35714)){i=!1;const e=ys(a,w,"vertex"),n=ys(a,S,"fragment");console.error("THREE.WebGLProgram: Shader Error "+a.getError()+" - VALIDATE_STATUS "+a.getProgramParameter(x,35715)+"\n\nProgram Info Log: "+t+"\n"+e+"\n"+n)}else""!==t?console.warn("THREE.WebGLProgram: Program Info Log:",t):""!==e&&""!==n||(r=!1);r&&(this.diagnostics={runnable:i,programLog:t,vertexShader:{log:e,prefix:y},fragmentShader:{log:n,prefix:_}})}let T,E;return a.deleteShader(w),a.deleteShader(S),this.getUniforms=function(){return void 0===T&&(T=new fs(a,x)),T},this.getAttributes=function(){return void 0===E&&(E=function(t,e){const n={},i=t.getProgramParameter(e,35721);for(let r=0;r0,I=s.clearcoat>0;return{isWebGL2:d,shaderID:S,shaderName:s.type,vertexShader:E,fragmentShader:A,defines:s.defines,customVertexShaderID:R,customFragmentShaderID:C,isRawShaderMaterial:!0===s.isRawShaderMaterial,glslVersion:s.glslVersion,precision:v,instancing:!0===_.isInstancedMesh,instancingColor:!0===_.isInstancedMesh&&null!==_.instanceColor,supportsVertexTextures:g,outputEncoding:null!==L?t.getTextureEncodingFromMap(L.texture):t.outputEncoding,map:!!s.map,mapEncoding:t.getTextureEncodingFromMap(s.map),matcap:!!s.matcap,matcapEncoding:t.getTextureEncodingFromMap(s.matcap),envMap:!!w,envMapMode:w&&w.mapping,envMapEncoding:t.getTextureEncodingFromMap(w),envMapCubeUV:!!w&&(w.mapping===l||w.mapping===c),lightMap:!!s.lightMap,lightMapEncoding:t.getTextureEncodingFromMap(s.lightMap),aoMap:!!s.aoMap,emissiveMap:!!s.emissiveMap,emissiveMapEncoding:t.getTextureEncodingFromMap(s.emissiveMap),bumpMap:!!s.bumpMap,normalMap:!!s.normalMap,lowerNormalMap:!!s.lowerNormalMap,objectSpaceNormalMap:1===s.normalMapType,tangentSpaceNormalMap:0===s.normalMapType,clearcoat:I,clearcoatMap:I&&!!s.clearcoatMap,clearcoatRoughnessMap:I&&!!s.clearcoatRoughnessMap,clearcoatNormalMap:I&&!!s.clearcoatNormalMap,displacementMap:!!s.displacementMap,roughnessMap:!!s.roughnessMap,metalnessMap:!!s.metalnessMap,specularMap:!!s.specularMap,specularIntensityMap:!!s.specularIntensityMap,specularColorMap:!!s.specularColorMap,specularColorMapEncoding:t.getTextureEncodingFromMap(s.specularColorMap),transparent:s.transparent,alphaMap:!!s.alphaMap,alphaTest:P,gradientMap:!!s.gradientMap,sheen:s.sheen>0,sheenColorMap:!!s.sheenColorMap,sheenColorMapEncoding:t.getTextureEncodingFromMap(s.sheenColorMap),sheenRoughnessMap:!!s.sheenRoughnessMap,transmission:s.transmission>0,transmissionMap:!!s.transmissionMap,thicknessMap:!!s.thicknessMap,refraction:s.refraction>0,combine:s.combine,vertexTangents:!!s.normalMap&&!!_.geometry&&!!_.geometry.attributes.tangent,vertexColors:s.vertexColors,vertexAlphas:!0===s.vertexColors&&!!_.geometry&&!!_.geometry.attributes.color&&4===_.geometry.attributes.color.itemSize,vertexUvs:!!(s.map||s.bumpMap||s.normalMap||s.specularMap||s.alphaMap||s.emissiveMap||s.roughnessMap||s.metalnessMap||s.clearcoatMap||s.clearcoatRoughnessMap||s.clearcoatNormalMap||s.displacementMap||s.transmissionMap||s.thicknessMap||s.specularIntensityMap||s.specularColorMap||s.sheenColorMap||s.sheenRoughnessMap),uvsVertexOnly:!(s.map||s.bumpMap||s.normalMap||s.specularMap||s.alphaMap||s.emissiveMap||s.roughnessMap||s.metalnessMap||s.clearcoatNormalMap||s.transmission>0||s.transmissionMap||s.thicknessMap||s.specularIntensityMap||s.specularColorMap||s.sheen>0||s.sheenColorMap||s.sheenRoughnessMap||!s.displacementMap),fog:!!M,useFog:s.fog,fogExp2:M&&M.isFogExp2,flatShading:!!s.flatShading,sizeAttenuation:s.sizeAttenuation,logarithmicDepthBuffer:p,skinning:!0===_.isSkinnedMesh&&T>0,maxBones:T,useVertexTexture:m,morphTargets:!!_.geometry&&!!_.geometry.morphAttributes.position,morphNormals:!!_.geometry&&!!_.geometry.morphAttributes.normal,morphTargetsCount:_.geometry&&_.geometry.morphAttributes.position?_.geometry.morphAttributes.position.length:0,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:a.numPlanes,numClipIntersection:a.numIntersection,dithering:s.dithering,shadowMapEnabled:t.shadowMap.enabled&&u.length>0,shadowMapType:t.shadowMap.type,toneMapping:s.toneMapped?t.toneMapping:0,physicallyCorrectLights:t.physicallyCorrectLights,premultipliedAlpha:s.premultipliedAlpha,doubleSided:2===s.side,flipSided:1===s.side,depthPacking:void 0!==s.depthPacking&&s.depthPacking,index0AttributeName:s.index0AttributeName,extensionDerivatives:s.extensions&&s.extensions.derivatives,extensionFragDepth:s.extensions&&s.extensions.fragDepth,extensionDrawBuffers:s.extensions&&s.extensions.drawBuffers,extensionShaderTextureLOD:s.extensions&&s.extensions.shaderTextureLOD,rendererExtensionFragDepth:d||i.has("EXT_frag_depth"),rendererExtensionDrawBuffers:d||i.has("WEBGL_draw_buffers"),rendererExtensionShaderTextureLod:d||i.has("EXT_shader_texture_lod"),customProgramCacheKey:s.customProgramCacheKey()}},getProgramCacheKey:function(e){const n=[];if(e.shaderID?n.push(e.shaderID):(n.push(e.customVertexShaderID),n.push(e.customFragmentShaderID)),void 0!==e.defines)for(const t in e.defines)n.push(t),n.push(e.defines[t]);return!1===e.isRawShaderMaterial&&(!function(t,e){t.push(e.precision),t.push(e.outputEncoding),t.push(e.mapEncoding),t.push(e.matcapEncoding),t.push(e.envMapMode),t.push(e.envMapEncoding),t.push(e.lightMapEncoding),t.push(e.emissiveMapEncoding),t.push(e.combine),t.push(e.vertexUvs),t.push(e.fogExp2),t.push(e.sizeAttenuation),t.push(e.maxBones),t.push(e.morphTargetsCount),t.push(e.numDirLights),t.push(e.numPointLights),t.push(e.numSpotLights),t.push(e.numHemiLights),t.push(e.numRectAreaLights),t.push(e.numDirLightShadows),t.push(e.numPointLightShadows),t.push(e.numSpotLightShadows),t.push(e.shadowMapType),t.push(e.toneMapping),t.push(e.numClippingPlanes),t.push(e.numClipIntersection),t.push(e.specularColorMapEncoding),t.push(e.sheenColorMapEncoding)}(n,e),function(t,e){o.disableAll(),e.isWebGL2&&o.enable(0);e.supportsVertexTextures&&o.enable(1);e.instancing&&o.enable(2);e.instancingColor&&o.enable(3);e.map&&o.enable(4);e.matcap&&o.enable(5);e.envMap&&o.enable(6);e.envMapCubeUV&&o.enable(7);e.lightMap&&o.enable(8);e.aoMap&&o.enable(9);e.emissiveMap&&o.enable(10);e.bumpMap&&o.enable(11);e.normalMap&&o.enable(12);e.objectSpaceNormalMap&&o.enable(13);e.tangentSpaceNormalMap&&o.enable(14);e.clearcoat&&o.enable(15);e.clearcoatMap&&o.enable(16);e.clearcoatRoughnessMap&&o.enable(17);e.clearcoatNormalMap&&o.enable(18);e.displacementMap&&o.enable(19);e.specularMap&&o.enable(20);e.roughnessMap&&o.enable(21);e.metalnessMap&&o.enable(22);e.gradientMap&&o.enable(23);e.alphaMap&&o.enable(24);e.alphaTest&&o.enable(25);e.vertexColors&&o.enable(26);e.vertexAlphas&&o.enable(27);e.vertexUvs&&o.enable(28);e.vertexTangents&&o.enable(29);e.uvsVertexOnly&&o.enable(30);e.fog&&o.enable(31);t.push(o.mask),o.disableAll(),e.useFog&&o.enable(0);e.flatShading&&o.enable(1);e.logarithmicDepthBuffer&&o.enable(2);e.skinning&&o.enable(3);e.useVertexTexture&&o.enable(4);e.morphTargets&&o.enable(5);e.morphNormals&&o.enable(6);e.premultipliedAlpha&&o.enable(7);e.shadowMapEnabled&&o.enable(8);e.physicallyCorrectLights&&o.enable(9);e.doubleSided&&o.enable(10);e.flipSided&&o.enable(11);e.depthPacking&&o.enable(12);e.dithering&&o.enable(13);e.specularIntensityMap&&o.enable(14);e.specularColorMap&&o.enable(15);e.transmission&&o.enable(16);e.transmissionMap&&o.enable(17);e.thicknessMap&&o.enable(18);e.sheen&&o.enable(19);e.sheenColorMap&&o.enable(20);e.sheenRoughnessMap&&o.enable(21);e.transparent&&o.enable(22);e.lowerNormalMap&&o.enable(23);e.refraction&&o.enable(24);t.push(o.mask)}(n,e),n.push(t.outputEncoding)),n.push(e.customProgramCacheKey),n.join()},getUniforms:function(t){const e=x[t.type];let n;if(e){const t=wi[e];n=ii.clone(t.uniforms)}else n=t.uniforms;return n},acquireProgram:function(e,n){let i;for(let t=0,e=u.length;t0?i.push(h):!0===a.transparent?r.push(h):n.push(h)},unshift:function(t,e,a,o,l,c){const h=s(t,e,a,o,l,c);a.transmission>0?i.unshift(h):!0===a.transparent?r.unshift(h):n.unshift(h)},finish:function(){for(let n=e,i=t.length;n1&&n.sort(t||Gs),i.length>1&&i.sort(e||Vs),r.length>1&&r.sort(e||Vs)}}}function Ws(){let t=new WeakMap;return{get:function(e,n){let i;return!1===t.has(e)?(i=new ks,t.set(e,[i])):n>=t.get(e).length?(i=new ks,t.get(e).push(i)):i=t.get(e)[n],i},dispose:function(){t=new WeakMap}}}function js(){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 kt,color:new dn};break;case"SpotLight":n={position:new kt,direction:new kt,color:new dn,distance:0,coneCos:0,penumbraCos:0,decay:0};break;case"PointLight":n={position:new kt,color:new dn,distance:0,decay:0};break;case"HemisphereLight":n={direction:new kt,skyColor:new dn,groundColor:new dn};break;case"RectAreaLight":n={color:new dn,position:new kt,halfWidth:new kt,halfHeight:new kt}}return t[e.id]=n,n}}}let qs=0;function Xs(t,e){return(e.castShadow?1:0)-(t.castShadow?1:0)}function Ys(t,e){const n=new js,i=function(){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 Rt};break;case"PointLight":n={shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new Rt,shadowCameraNear:1,shadowCameraFar:1e3}}return t[e.id]=n,n}}}(),r={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 t=0;t<9;t++)r.probe.push(new kt);const s=new kt,a=new _e,o=new _e;return{setup:function(s,a){let o=0,l=0,c=0;for(let t=0;t<9;t++)r.probe[t].set(0,0,0);let h=0,u=0,d=0,p=0,m=0,f=0,g=0,v=0;s.sort(Xs);const x=!0!==a?Math.PI:1;for(let t=0,e=s.length;t0&&(e.isWebGL2||!0===t.has("OES_texture_float_linear")?(r.rectAreaLTC1=bi.LTC_FLOAT_1,r.rectAreaLTC2=bi.LTC_FLOAT_2):!0===t.has("OES_texture_half_float_linear")?(r.rectAreaLTC1=bi.LTC_HALF_1,r.rectAreaLTC2=bi.LTC_HALF_2):console.error("THREE.WebGLRenderer: Unable to use RectAreaLight. Missing WebGL extensions.")),r.ambient[0]=o,r.ambient[1]=l,r.ambient[2]=c;const y=r.hash;y.directionalLength===h&&y.pointLength===u&&y.spotLength===d&&y.rectAreaLength===p&&y.hemiLength===m&&y.numDirectionalShadows===f&&y.numPointShadows===g&&y.numSpotShadows===v||(r.directional.length=h,r.spot.length=d,r.rectArea.length=p,r.point.length=u,r.hemi.length=m,r.directionalShadow.length=f,r.directionalShadowMap.length=f,r.pointShadow.length=g,r.pointShadowMap.length=g,r.spotShadow.length=v,r.spotShadowMap.length=v,r.directionalShadowMatrix.length=f,r.pointShadowMatrix.length=g,r.spotShadowMatrix.length=v,y.directionalLength=h,y.pointLength=u,y.spotLength=d,y.rectAreaLength=p,y.hemiLength=m,y.numDirectionalShadows=f,y.numPointShadows=g,y.numSpotShadows=v,r.version=qs++)},setupView:function(t,e){let n=0,i=0,l=0,c=0,h=0;const u=e.matrixWorldInverse;for(let e=0,d=t.length;e=n.get(i).length?(s=new Js(t,e),n.get(i).push(s)):s=n.get(i)[r],s},dispose:function(){n=new WeakMap}}}class Ks extends sn{constructor(t){super(),this.type="MeshDepthMaterial",this.depthPacking=3200,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.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}}Ks.prototype.isMeshDepthMaterial=!0;class Qs extends sn{constructor(t){super(),this.type="MeshDistanceMaterial",this.referencePosition=new kt,this.nearDistance=1,this.farDistance=1e3,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.map=t.map,this.alphaMap=t.alphaMap,this.displacementMap=t.displacementMap,this.displacementScale=t.displacementScale,this.displacementBias=t.displacementBias,this}}Qs.prototype.isMeshDistanceMaterial=!0;function $s(t,e,n){let i=new vi;const r=new Rt,s=new Rt,a=new Ut,o=new Ks({depthPacking:3201}),l=new Qs,c={},h=n.maxTextureSize,u={0:1,1:0,2:2},d=new ri({defines:{VSM_SAMPLES:8},uniforms:{shadow_pass:{value:null},resolution:{value:new Rt},radius:{value:4}},vertexShader:"void main() {\n\tgl_Position = vec4( position, 1.0 );\n}",fragmentShader:"uniform sampler2D shadow_pass;\nuniform vec2 resolution;\nuniform float radius;\n#include \nvoid main() {\n\tconst float samples = float( VSM_SAMPLES );\n\tfloat mean = 0.0;\n\tfloat squared_mean = 0.0;\n\tfloat uvStride = samples <= 1.0 ? 0.0 : 2.0 / ( samples - 1.0 );\n\tfloat uvStart = samples <= 1.0 ? 0.0 : - 1.0;\n\tfor ( float i = 0.0; i < samples; i ++ ) {\n\t\tfloat uvOffset = uvStart + i * uvStride;\n\t\t#ifdef HORIZONTAL_PASS\n\t\t\tvec2 distribution = unpackRGBATo2Half( texture2D( shadow_pass, ( gl_FragCoord.xy + vec2( uvOffset, 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, uvOffset ) * radius ) / resolution ) );\n\t\t\tmean += depth;\n\t\t\tsquared_mean += depth * depth;\n\t\t#endif\n\t}\n\tmean = mean / samples;\n\tsquared_mean = squared_mean / samples;\n\tfloat std_dev = sqrt( squared_mean - mean * mean );\n\tgl_FragColor = pack2HalfToRGBA( vec2( mean, std_dev ) );\n}"}),m=d.clone();m.defines.HORIZONTAL_PASS=1;const f=new Nn;f.setAttribute("position",new gn(new Float32Array([-1,-1,.5,3,-1,.5,-1,3,.5]),3));const v=new Qn(f,d),x=this;function y(n,i){const r=e.update(v);d.defines.VSM_SAMPLES!==n.blurSamples&&(d.defines.VSM_SAMPLES=n.blurSamples,m.defines.VSM_SAMPLES=n.blurSamples,d.needsUpdate=!0,m.needsUpdate=!0),d.uniforms.shadow_pass.value=n.map.texture,d.uniforms.resolution.value=n.mapSize,d.uniforms.radius.value=n.radius,t.setRenderTarget(n.mapPass),t.clear(),t.renderBufferDirect(i,null,r,d,v,null),m.uniforms.shadow_pass.value=n.mapPass.texture,m.uniforms.resolution.value=n.mapSize,m.uniforms.radius.value=n.radius,t.setRenderTarget(n.map),t.clear(),t.renderBufferDirect(i,null,r,m,v,null)}function _(e,n,i,r,s,a,h){let d=null;const p=!0===r.isPointLight?e.customDistanceMaterial:e.customDepthMaterial;if(d=void 0!==p?p:!0===r.isPointLight?l:o,t.localClippingEnabled&&!0===i.clipShadows&&0!==i.clippingPlanes.length||i.displacementMap&&0!==i.displacementScale||i.alphaMap&&i.alphaTest>0){const t=d.uuid,e=i.uuid;let n=c[t];void 0===n&&(n={},c[t]=n);let r=n[e];void 0===r&&(r=d.clone(),n[e]=r),d=r}return d.visible=i.visible,d.wireframe=i.wireframe,d.side=3===h?null!==i.shadowSide?i.shadowSide:i.side:null!==i.shadowSide?i.shadowSide:u[i.side],d.alphaMap=i.alphaMap,d.alphaTest=i.alphaTest,d.clipShadows=i.clipShadows,d.clippingPlanes=i.clippingPlanes,d.clipIntersection=i.clipIntersection,d.displacementMap=i.displacementMap,d.displacementScale=i.displacementScale,d.displacementBias=i.displacementBias,d.wireframeLinewidth=i.wireframeLinewidth,d.linewidth=i.linewidth,!0===r.isPointLight&&!0===d.isMeshDistanceMaterial&&(d.referencePosition.setFromMatrixPosition(r.matrixWorld),d.nearDistance=s,d.farDistance=a),d}function M(n,r,s,a,o){if(!1===n.visible)return;if(n.layers.test(r.layers)&&(n.isMesh||n.isLine||n.isPoints)&&(n.castShadow||n.receiveShadow&&3===o)&&(!n.frustumCulled||i.intersectsObject(n))){n.modelViewMatrix.multiplyMatrices(s.matrixWorldInverse,n.matrixWorld);const i=e.update(n),r=n.material;if(Array.isArray(r)){const e=i.groups;for(let l=0,c=e.length;lh||r.y>h)&&(r.x>h&&(s.x=Math.floor(h/m.x),r.x=s.x*m.x,u.mapSize.x=s.x),r.y>h&&(s.y=Math.floor(h/m.y),r.y=s.y*m.y,u.mapSize.y=s.y)),null===u.map&&!u.isPointLightShadow&&3===this.type){const t={minFilter:g,magFilter:g,format:T};u.map=new Ht(r.x,r.y,t),u.map.texture.name=c.name+".shadowMap",u.mapPass=new Ht(r.x,r.y,t),u.camera.updateProjectionMatrix()}if(null===u.map){const t={minFilter:p,magFilter:p,format:T};u.map=new Ht(r.x,r.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!==L.indexOf("OpenGL ES")&&(C=parseFloat(/^OpenGL ES (\d)/.exec(L)[1]),R=C>=2);let P=null,I={};const D=t.getParameter(3088),N=t.getParameter(2978),O=(new Ut).fromArray(D),B=(new Ut).fromArray(N);function z(e,n,i){const r=new Uint8Array(4),s=t.createTexture();t.bindTexture(e,s),t.texParameteri(e,10241,9728),t.texParameteri(e,10240,9728);for(let e=0;ei||t.height>i)&&(r=i/Math.max(t.width,t.height)),r<1||!0===e){if("undefined"!=typeof HTMLImageElement&&t instanceof HTMLImageElement||"undefined"!=typeof HTMLCanvasElement&&t instanceof HTMLCanvasElement||"undefined"!=typeof ImageBitmap&&t instanceof ImageBitmap){const i=e?Et:Math.floor,s=i(r*t.width),a=i(r*t.height);void 0===I&&(I=N(s,a));const o=n?N(s,a):I;o.width=s,o.height=a;return o.getContext("2d").drawImage(t,0,0,s,a),console.warn("THREE.WebGLRenderer: Texture has been resized from ("+t.width+"x"+t.height+") to ("+s+"x"+a+")."),o}return"data"in t&&console.warn("THREE.WebGLRenderer: Image in DataTexture is too big ("+t.width+"x"+t.height+")."),t}return t}function B(t){return St(t.width)&&St(t.height)}function z(t,e){return t.generateMipmaps&&e&&t.minFilter!==p&&t.minFilter!==g}function F(e){t.generateMipmap(e)}function U(n,i,r,s,a=!zt.useSrgbTextures){if(!1===o)return i;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 l=i;return 6403===i&&(5126===r&&(l=33326),5131===r&&(l=33325),5121===r&&(l=33321)),33319===i&&(5126===r&&(l=33328),5131===r&&(l=33327),5121===r&&(l=33323)),6408===i&&(5126===r&&(l=34836),5131===r&&(l=34842),5121===r&&(l=o&&s===lt&&!a?35907:32856),32819===r&&(l=32854),32820===r&&(l=32855)),33325!==l&&33326!==l&&33327!==l&&33328!==l&&34842!==l&&34836!==l||e.get("EXT_color_buffer_float"),l}function H(t,e,n){return!0===z(t,n)||t.isFramebufferTexture&&t.minFilter!==p&&t.minFilter!==g?Math.log2(Math.max(e.width,e.height))+1:void 0!==t.mipmaps&&t.mipmaps.length>0?t.mipmaps.length:t.isCompressedTexture&&Array.isArray(t.image)?e.mipmaps.length:1}function G(t){return t===p||t===m||t===f?9728:9729}function V(e){const n=e.target;n.removeEventListener("dispose",V),function(e){const n=i.get(e);if(void 0===n.__webglInit)return;t.deleteTexture(n.__webglTexture),delete n.__webglTexture,i.remove(e)}(n),n.isVideoTexture&&P.delete(n),a.memory.textures--}function k(e){const n=e.target;n.removeEventListener("dispose",k),function(e){const n=e.texture,r=i.get(e),s=i.get(n);if(!e)return;void 0!==s.__webglTexture&&(t.deleteTexture(s.__webglTexture),delete s.__webglTexture,a.memory.textures--);e.depthTexture&&e.depthTexture.dispose();if(e.isWebGLCubeRenderTarget)for(let e=0;e<6;e++)t.deleteFramebuffer(r.__webglFramebuffer[e]),r.__webglDepthbuffer&&t.deleteRenderbuffer(r.__webglDepthbuffer[e]);else t.deleteFramebuffer(r.__webglFramebuffer),r.__webglDepthbuffer&&t.deleteRenderbuffer(r.__webglDepthbuffer),r.__webglMultisampledFramebuffer&&t.deleteFramebuffer(r.__webglMultisampledFramebuffer),r.__webglColorRenderbuffer&&t.deleteRenderbuffer(r.__webglColorRenderbuffer),r.__webglDepthRenderbuffer&&t.deleteRenderbuffer(r.__webglDepthRenderbuffer);if(e.isWebGLMultipleRenderTargets)for(let e=0,r=n.length;e0&&r.__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 K(r,t,e);console.warn("THREE.WebGLRenderer: Texture marked for update but image is incomplete")}}n.activeTexture(33984+e),n.bindTexture(3553,r.__webglTexture)}function q(e,r){const a=i.get(e);e.version>0&&a.__version!==e.version?function(e,i,r){if(6!==i.image.length)return;Z(e,i),n.activeTexture(33984+r),n.bindTexture(34067,e.__webglTexture),t.pixelStorei(37440,i.flipY),t.pixelStorei(37441,i.premultiplyAlpha),t.pixelStorei(3317,i.unpackAlignment),t.pixelStorei(37443,0);const a=i&&(i.isCompressedTexture||i.image[0].isCompressedTexture),l=i.image[0]&&i.image[0].isDataTexture,h=[];for(let t=0;t<6;t++)h[t]=a||l?l?i.image[t].image:i.image[t]:O(i.image[t],!1,!0,c);const u=h[0],d=B(u)||o,p=s.convert(i.format,i.encoding),m=s.convert(i.type),f=U(i.internalFormat,p,m,i.encoding,i.sRGBToLinearWithShader),g=o&&!0!==i.isVideoTexture,v=void 0===e.__version;let x,y=H(i,u,d);if(J(34067,i,d),a){g&&v&&n.texStorage2D(34067,y,f,u.width,u.height);for(let t=0;t<6;t++){x=h[t].mipmaps;for(let e=0;e0&&y++,n.texStorage2D(34067,y,f,h[0].width,h[0].height));for(let t=0;t<6;t++)if(l){g?n.texSubImage2D(34069+t,0,0,0,h[t].width,h[t].height,p,m,h[t].data):n.texImage2D(34069+t,0,f,h[t].width,h[t].height,0,p,m,h[t].data);for(let e=0;e1||i.get(s).__currentAnisotropy)&&(t.texParameterf(n,a.TEXTURE_MAX_ANISOTROPY_EXT,Math.min(s.anisotropy,r.getMaxAnisotropy())),i.get(s).__currentAnisotropy=s.anisotropy)}}function Z(e,n){void 0===e.__webglInit&&(e.__webglInit=!0,n.addEventListener("dispose",V),e.__webglTexture=t.createTexture(),a.memory.textures++)}function K(e,i,r){let a=3553;i.isDataTexture2DArray&&(a=35866),i.isDataTexture3D&&(a=32879),Z(e,i),n.activeTexture(33984+r),n.bindTexture(a,e.__webglTexture),t.pixelStorei(37440,i.flipY),t.pixelStorei(37441,i.premultiplyAlpha),t.pixelStorei(3317,i.unpackAlignment),t.pixelStorei(37443,0);const l=function(t){return!o&&(t.wrapS!==u||t.wrapT!==u||t.minFilter!==p&&t.minFilter!==g)}(i)&&!1===B(i.image),c=O(i.image,l,!1,y),h=B(c)||o,d=s.convert(i.format,i.encoding);let m,f=s.convert(i.type),v=U(i.internalFormat,d,f,i.encoding,i.sRGBToLinearWithShader);J(a,i,h);const x=i.mipmaps,w=o&&!0!==i.isVideoTexture,R=void 0===e.__version,C=H(i,c,h);if(i.isDepthTexture)v=6402,o?v=i.type===b?36012:i.type===M?33190:i.type===S?35056:33189:i.type===b&&console.error("WebGLRenderer: Floating point depth texture requires WebGL2."),i.format===E&&6402===v&&i.type!==_&&i.type!==M&&(console.warn("THREE.WebGLRenderer: Use UnsignedShortType or UnsignedIntType for DepthFormat DepthTexture."),i.type=_,f=s.convert(i.type)),i.format===A&&6402===v&&(v=34041,i.type!==S&&(console.warn("THREE.WebGLRenderer: Use UnsignedInt248Type for DepthStencilFormat DepthTexture."),i.type=S,f=s.convert(i.type))),w&&R?n.texStorage2D(3553,1,v,c.width,c.height):R&&n.texImage2D(3553,0,v,c.width,c.height,0,d,f,null);else if(i.isDataTexture)if(x.length>0&&h){w&&R&&n.texStorage2D(3553,C,v,x[0].width,x[0].height);for(let t=0,e=x.length;t>=1,e>>=1}}else if(x.length>0&&h){w&&R&&n.texStorage2D(3553,C,v,x[0].width,x[0].height);for(let t=0,e=x.length;t0&&!0===e.has("WEBGL_multisampled_render_to_texture")&&!1!==n.__useRenderToTexture}let it=!1,rt=!1;this.allocateTextureUnit=function(){const t=W;return t>=l&&console.warn("THREE.WebGLTextures: Trying to use "+t+" texture units while this GPU supports only "+l),W+=1,t},this.resetTextureUnits=function(){W=0},this.setTexture2D=j,this.setTexture2DArray=function(t,e){const r=i.get(t);t.version>0&&r.__version!==t.version?K(r,t,e):(n.activeTexture(33984+e),n.bindTexture(35866,r.__webglTexture))},this.setTexture3D=function(t,e){const r=i.get(t);t.version>0&&r.__version!==t.version?K(r,t,e):(n.activeTexture(33984+e),n.bindTexture(32879,r.__webglTexture))},this.setTextureCube=q,this.rebindTextures=function(t,e,n){const r=i.get(t);void 0!==e&&Q(r.__webglFramebuffer,t,t.texture,36064,3553),void 0!==n&&tt(t)},this.setupRenderTarget=function(e){const l=e.texture,c=i.get(e),h=i.get(l);e.addEventListener("dispose",k),!0!==e.isWebGLMultipleRenderTargets&&(void 0===h.__webglTexture&&(h.__webglTexture=t.createTexture()),h.__version=l.version,a.memory.textures++);const u=!0===e.isWebGLCubeRenderTarget,d=!0===e.isWebGLMultipleRenderTargets,p=l.isDataTexture3D||l.isDataTexture2DArray,m=B(e)||o;if(u){c.__webglFramebuffer=[];for(let e=0;e<6;e++)c.__webglFramebuffer[e]=t.createFramebuffer()}else if(c.__webglFramebuffer=t.createFramebuffer(),d)if(r.drawBuffers){const n=e.texture;for(let e=0,r=n.length;e0&&!1===nt(e)){c.__webglMultisampledFramebuffer=t.createFramebuffer(),c.__webglColorRenderbuffer=t.createRenderbuffer(),t.bindRenderbuffer(36161,c.__webglColorRenderbuffer);const i=s.convert(l.format,l.encoding),r=s.convert(l.type),a=U(l.internalFormat,i,r,l.encoding),o=et(e);t.renderbufferStorageMultisample(36161,o,a,e.width,e.height),n.bindFramebuffer(36160,c.__webglMultisampledFramebuffer),t.framebufferRenderbuffer(36160,36064,36161,c.__webglColorRenderbuffer),t.bindRenderbuffer(36161,null),e.depthBuffer&&(c.__webglDepthRenderbuffer=t.createRenderbuffer(),$(c.__webglDepthRenderbuffer,e,!0)),n.bindFramebuffer(36160,null)}if(u){n.bindTexture(34067,h.__webglTexture),J(34067,l,m);for(let t=0;t<6;t++)Q(c.__webglFramebuffer[t],e,l,36064,34069+t);z(l,m)&&F(34067),n.unbindTexture()}else if(d){const t=e.texture;for(let r=0,s=t.length;r0&&!1===nt(e)){const r=e.width,s=e.height;let a=16384;const o=[36064],l=e.stencilBuffer?33306:36096;e.depthBuffer&&o.push(l);const c=i.get(e),h=void 0!==c.__ignoreDepthValues&&c.__ignoreDepthValues;!1===h&&(e.depthBuffer&&(a|=256),e.stencilBuffer&&(a|=1024)),n.bindFramebuffer(36008,c.__webglMultisampledFramebuffer),n.bindFramebuffer(36009,c.__webglFramebuffer),!0===h&&(t.invalidateFramebuffer(36008,[l]),t.invalidateFramebuffer(36009,[l])),t.blitFramebuffer(0,0,r,s,0,0,r,s,a,9728),L&&t.invalidateFramebuffer(36008,o),n.bindFramebuffer(36008,null),n.bindFramebuffer(36009,c.__webglMultisampledFramebuffer)}},this.setupDepthRenderbuffer=tt,this.setupFrameBufferTexture=Q,this.useMultisampledRenderToTexture=nt,this.safeSetTexture2D=function(t,e){t&&t.isWebGLRenderTarget&&(!1===it&&(console.warn("THREE.WebGLTextures.safeSetTexture2D: don't use render targets as textures. Use their .texture property instead."),it=!0),t=t.texture),j(t,e)},this.safeSetTextureCube=function(t,e){t&&t.isWebGLCubeRenderTarget&&(!1===rt&&(console.warn("THREE.WebGLTextures.safeSetTextureCube: don't use cube render targets as textures. Use their .texture property instead."),rt=!0),t=t.texture),q(t,e)}}function na(t,e,n){const i=n.isWebGL2;return{convert:function(t,n=null){let r;if(t===y)return 5121;if(1017===t)return 32819;if(1018===t)return 32820;if(1010===t)return 5120;if(1011===t)return 5122;if(t===_)return 5123;if(1013===t)return 5124;if(t===M)return 5125;if(t===b)return 5126;if(t===w)return i?5131:(r=e.get("OES_texture_half_float"),null!==r?r.HALF_FLOAT_OES:null);if(1021===t)return 6406;if(t===T)return 6408;if(1024===t)return 6409;if(1025===t)return 6410;if(t===E)return 6402;if(t===A)return 34041;if(1028===t)return 6403;if(1029===t)return 36244;if(1030===t)return 33319;if(1031===t)return 33320;if(1033===t)return 36249;if(t===R||t===C||t===L||t===P)if(n===lt){if(r=e.get("WEBGL_compressed_texture_s3tc_srgb"),null===r)return null;if(t===R)return r.COMPRESSED_SRGB_S3TC_DXT1_EXT;if(t===C)return r.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT;if(t===L)return r.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT;if(t===P)return r.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT}else{if(r=e.get("WEBGL_compressed_texture_s3tc"),null===r)return null;if(t===R)return r.COMPRESSED_RGB_S3TC_DXT1_EXT;if(t===C)return r.COMPRESSED_RGBA_S3TC_DXT1_EXT;if(t===L)return r.COMPRESSED_RGBA_S3TC_DXT3_EXT;if(t===P)return r.COMPRESSED_RGBA_S3TC_DXT5_EXT}if(t===I||t===D||t===N||t===O){if(r=e.get("WEBGL_compressed_texture_pvrtc"),null===r)return null;if(t===I)return r.COMPRESSED_RGB_PVRTC_4BPPV1_IMG;if(t===D)return r.COMPRESSED_RGB_PVRTC_2BPPV1_IMG;if(t===N)return r.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG;if(t===O)return r.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG}if(36196===t)return r=e.get("WEBGL_compressed_texture_etc1"),null!==r?r.COMPRESSED_RGB_ETC1_WEBGL:null;if(t===B||t===z){if(r=e.get("WEBGL_compressed_texture_etc"),null===r)return null;if(t===B)return n===lt?r.COMPRESSED_SRGB8_ETC2:r.COMPRESSED_RGB8_ETC2;if(t===z)return n===lt?r.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC:r.COMPRESSED_RGBA8_ETC2_EAC}if(t===F||t===U||t===H||t===G||t===V||t===k||t===W||t===j||t===q||t===X||t===Y||t===J||t===Z||t===K){if(r=e.get("WEBGL_compressed_texture_astc"),null===r)return null;if(t===F)return n===lt?r.COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR:r.COMPRESSED_RGBA_ASTC_4x4_KHR;if(t===U)return n===lt?r.COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR:r.COMPRESSED_RGBA_ASTC_5x4_KHR;if(t===H)return n===lt?r.COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR:r.COMPRESSED_RGBA_ASTC_5x5_KHR;if(t===G)return n===lt?r.COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR:r.COMPRESSED_RGBA_ASTC_6x5_KHR;if(t===V)return n===lt?r.COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR:r.COMPRESSED_RGBA_ASTC_6x6_KHR;if(t===k)return n===lt?r.COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR:r.COMPRESSED_RGBA_ASTC_8x5_KHR;if(t===W)return n===lt?r.COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR:r.COMPRESSED_RGBA_ASTC_8x6_KHR;if(t===j)return n===lt?r.COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR:r.COMPRESSED_RGBA_ASTC_8x8_KHR;if(t===q)return n===lt?r.COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR:r.COMPRESSED_RGBA_ASTC_10x5_KHR;if(t===X)return n===lt?r.COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR:r.COMPRESSED_RGBA_ASTC_10x6_KHR;if(t===Y)return n===lt?r.COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR:r.COMPRESSED_RGBA_ASTC_10x8_KHR;if(t===J)return n===lt?r.COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR:r.COMPRESSED_RGBA_ASTC_10x10_KHR;if(t===Z)return n===lt?r.COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR:r.COMPRESSED_RGBA_ASTC_12x10_KHR;if(t===K)return n===lt?r.COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR:r.COMPRESSED_RGBA_ASTC_12x12_KHR}if(t===Q){if(r=e.get("EXT_texture_compression_bptc"),null===r)return null;if(t===Q)return n===lt?r.COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT:r.COMPRESSED_RGBA_BPTC_UNORM_EXT}return t===S?i?34042:(r=e.get("WEBGL_depth_texture"),null!==r?r.UNSIGNED_INT_24_8_WEBGL:null):void 0}}}class ia extends ai{constructor(t=[]){super(),this.cameras=t}}ia.prototype.isArrayCamera=!0;class ra extends je{constructor(){super(),this.type="Group"}}ra.prototype.isGroup=!0;const sa={type:"move"};class aa{constructor(){this._targetRay=null,this._grip=null,this._hand=null}getHandSpace(){return null===this._hand&&(this._hand=new ra,this._hand.matrixAutoUpdate=!1,this._hand.visible=!1,this._hand.joints={},this._hand.inputState={pinching:!1}),this._hand}getTargetRaySpace(){return null===this._targetRay&&(this._targetRay=new ra,this._targetRay.matrixAutoUpdate=!1,this._targetRay.visible=!1,this._targetRay.hasLinearVelocity=!1,this._targetRay.linearVelocity=new kt,this._targetRay.hasAngularVelocity=!1,this._targetRay.angularVelocity=new kt),this._targetRay}getGripSpace(){return null===this._grip&&(this._grip=new ra,this._grip.matrixAutoUpdate=!1,this._grip.visible=!1,this._grip.hasLinearVelocity=!1,this._grip.linearVelocity=new kt,this._grip.hasAngularVelocity=!1,this._grip.angularVelocity=new kt),this._grip}dispatchEvent(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(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(t,e,n){let i=null,r=null,s=null;const a=this._targetRay,o=this._grip,l=this._hand;if(t&&"visible-blurred"!==e.session.visibilityState)if(null!==a&&(i=e.getPose(t.targetRaySpace,n),null!==i&&(a.matrix.fromArray(i.transform.matrix),a.matrix.decompose(a.position,a.rotation,a.scale),i.linearVelocity?(a.hasLinearVelocity=!0,a.linearVelocity.copy(i.linearVelocity)):a.hasLinearVelocity=!1,i.angularVelocity?(a.hasAngularVelocity=!0,a.angularVelocity.copy(i.angularVelocity)):a.hasAngularVelocity=!1,this.dispatchEvent(sa))),l&&t.hand){s=!0;for(const i of t.hand.values()){const t=e.getJointPose(i,n);if(void 0===l.joints[i.jointName]){const t=new ra;t.matrixAutoUpdate=!1,t.visible=!1,l.joints[i.jointName]=t,l.add(t)}const r=l.joints[i.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 i=l.joints["index-finger-tip"],r=l.joints["thumb-tip"],a=i.position.distanceTo(r.position),o=.02,c=.005;l.inputState.pinching&&a>o+c?(l.inputState.pinching=!1,this.dispatchEvent({type:"pinchend",handedness:t.handedness,target:this})):!l.inputState.pinching&&a<=o-c&&(l.inputState.pinching=!0,this.dispatchEvent({type:"pinchstart",handedness:t.handedness,target:this}))}else null!==o&&t.gripSpace&&(r=e.getPose(t.gripSpace,n),null!==r&&(o.matrix.fromArray(r.transform.matrix),o.matrix.decompose(o.position,o.rotation,o.scale),r.linearVelocity?(o.hasLinearVelocity=!0,o.linearVelocity.copy(r.linearVelocity)):o.hasLinearVelocity=!1,r.angularVelocity?(o.hasAngularVelocity=!0,o.angularVelocity.copy(r.angularVelocity)):o.hasAngularVelocity=!1));return null!==a&&(a.visible=null!==i),null!==o&&(o.visible=null!==r),null!==l&&(l.visible=null!==s),this}}class oa extends zt{constructor(t,e,n,i,r,s,a,o,l,c){if((c=void 0!==c?c:E)!==E&&c!==A)throw new Error("DepthTexture format must be either THREE.DepthFormat or THREE.DepthStencilFormat");void 0===n&&c===E&&(n=_),void 0===n&&c===A&&(n=S),super(null,i,r,s,a,o,c,n,l),this.image={width:t,height:e},this.magFilter=void 0!==a?a:p,this.minFilter=void 0!==o?o:p,this.flipY=!1,this.generateMipmaps=!1}}oa.prototype.isDepthTexture=!0;class la extends ft{constructor(t,e){super();const n=this;let i=null,r=1,s=null,a="local-floor",o=null,l=null,c=null,h=null,u=null;const d=e.getContextAttributes();let p=null,m=null;const f=[],g=new Map,v=new ai;v.layers.enable(1),v.viewport=new Ut;const x=new ai;x.layers.enable(2),x.viewport=new Ut;const M=[v,x],b=new ia;b.layers.enable(1),b.layers.enable(2);let w=null,R=null;function C(t){const e=g.get(t.inputSource);e&&e.dispatchEvent({type:t.type,data:t.inputSource})}function L(){g.forEach((function(t,e){t.disconnect(e)})),g.clear(),w=null,R=null,t.setRenderTarget(p),h=null,c=null,l=null,i=null,m=null,B.stop(),n.isPresenting=!1,n.dispatchEvent({type:"sessionend"})}function P(t){const e=i.inputSources;for(let t=0;t0&&(e.alphaTest.value=n.alphaTest);const i=t.get(n).envMap;let r,s;i&&(e.envMap.value=i,e.flipEnvMap.value=i.isCubeTexture&&!1===i.isRenderTargetTexture?-1:1,e.reflectivity.value=n.reflectivity,e.ior.value=n.ior,e.refractionRatio.value=n.refractionRatio),n.lightMap&&(e.lightMap.value=n.lightMap,e.lightMapIntensity.value=n.lightMapIntensity),n.aoMap&&(e.aoMap.value=n.aoMap,e.aoMapIntensity.value=n.aoMapIntensity),n.map?r=n.map:n.specularMap?r=n.specularMap:n.displacementMap?r=n.displacementMap:n.normalMap?r=n.normalMap:n.bumpMap?r=n.bumpMap:n.roughnessMap?r=n.roughnessMap:n.metalnessMap?r=n.metalnessMap:n.alphaMap?r=n.alphaMap:n.emissiveMap?r=n.emissiveMap:n.clearcoatMap?r=n.clearcoatMap:n.clearcoatNormalMap?r=n.clearcoatNormalMap:n.clearcoatRoughnessMap?r=n.clearcoatRoughnessMap:n.specularIntensityMap?r=n.specularIntensityMap:n.specularColorMap?r=n.specularColorMap:n.transmissionMap?r=n.transmissionMap:n.thicknessMap?r=n.thicknessMap:n.sheenColorMap?r=n.sheenColorMap:n.sheenRoughnessMap&&(r=n.sheenRoughnessMap),void 0!==r&&(r.isWebGLRenderTarget&&(r=r.texture),!0===r.matrixAutoUpdate&&r.updateMatrix(),e.uvTransform.value.copy(r.matrix)),n.aoMap?s=n.aoMap:n.lightMap&&(s=n.lightMap),void 0!==s&&(s.isWebGLRenderTarget&&(s=s.texture),!0===s.matrixAutoUpdate&&s.updateMatrix(),e.uv2Transform.value.copy(s.matrix))}function n(e,n){e.roughness.value=n.roughness,e.metalness.value=n.metalness,e.f90_r115_compatability.value=n.f90,n.refraction>0&&(e.refraction.value=n.refraction),n.roughnessMap&&(e.roughnessMap.value=n.roughnessMap),n.metalnessMap&&(e.metalnessMap.value=n.metalnessMap),n.emissiveMap&&(e.emissiveMap.value=n.emissiveMap),n.bumpMap&&(e.bumpMap.value=n.bumpMap,e.bumpScale.value=n.bumpScale,1===n.side&&(e.bumpScale.value*=-1)),n.normalMap&&(e.normalMap.value=n.normalMap,e.normalScale.value.copy(n.normalScale),n.lowerNormalMap&&(e.lowerNormalMap.value=n.lowerNormalMap),1===n.side&&e.normalScale.value.negate()),n.displacementMap&&(e.displacementMap.value=n.displacementMap,e.displacementScale.value=n.displacementScale,e.displacementBias.value=n.displacementBias);t.get(n).envMap&&(e.envMapIntensity.value=n.envMapIntensity)}return{refreshFogUniforms:function(t,e){t.fogColor.value.copy(e.color),e.isFog?(t.fogNear.value=e.near,t.fogFar.value=e.far):e.isFogExp2&&(t.fogDensity.value=e.density)},refreshMaterialUniforms:function(t,i,r,s,a){i.isMeshBasicMaterial?e(t,i):i.isMeshLambertMaterial?(e(t,i),function(t,e){e.emissiveMap&&(t.emissiveMap.value=e.emissiveMap)}(t,i)):i.isMeshToonMaterial?(e(t,i),function(t,e){e.gradientMap&&(t.gradientMap.value=e.gradientMap);e.emissiveMap&&(t.emissiveMap.value=e.emissiveMap);e.bumpMap&&(t.bumpMap.value=e.bumpMap,t.bumpScale.value=e.bumpScale,1===e.side&&(t.bumpScale.value*=-1));e.normalMap&&(t.normalMap.value=e.normalMap,t.normalScale.value.copy(e.normalScale),1===e.side&&t.normalScale.value.negate());e.displacementMap&&(t.displacementMap.value=e.displacementMap,t.displacementScale.value=e.displacementScale,t.displacementBias.value=e.displacementBias)}(t,i)):i.isMeshPhongMaterial?(e(t,i),function(t,e){t.specular.value.copy(e.specular),t.shininess.value=Math.max(e.shininess,1e-4),e.emissiveMap&&(t.emissiveMap.value=e.emissiveMap);e.bumpMap&&(t.bumpMap.value=e.bumpMap,t.bumpScale.value=e.bumpScale,1===e.side&&(t.bumpScale.value*=-1));e.normalMap&&(t.normalMap.value=e.normalMap,t.normalScale.value.copy(e.normalScale),1===e.side&&t.normalScale.value.negate());e.displacementMap&&(t.displacementMap.value=e.displacementMap,t.displacementScale.value=e.displacementScale,t.displacementBias.value=e.displacementBias)}(t,i)):i.isMeshStandardMaterial?(e(t,i),i.isMeshPhysicalMaterial?function(t,e,i){n(t,e),t.ior.value=e.ior,e.sheen>0&&(t.sheenColor.value.copy(e.sheenColor).multiplyScalar(e.sheen),t.sheenRoughness.value=e.sheenRoughness,e.sheenColorMap&&(t.sheenColorMap.value=e.sheenColorMap),e.sheenRoughnessMap&&(t.sheenRoughnessMap.value=e.sheenRoughnessMap));e.clearcoat>0&&(t.clearcoat.value=e.clearcoat,t.clearcoatRoughness.value=e.clearcoatRoughness,e.clearcoatMap&&(t.clearcoatMap.value=e.clearcoatMap),e.clearcoatRoughnessMap&&(t.clearcoatRoughnessMap.value=e.clearcoatRoughnessMap),e.clearcoatNormalMap&&(t.clearcoatNormalScale.value.copy(e.clearcoatNormalScale),t.clearcoatNormalMap.value=e.clearcoatNormalMap,1===e.side&&t.clearcoatNormalScale.value.negate()));e.transmission>0&&(t.transmission.value=e.transmission,t.transmissionSamplerMap.value=i.texture,t.transmissionSamplerSize.value.set(i.width,i.height),e.transmissionMap&&(t.transmissionMap.value=e.transmissionMap),t.thickness.value=e.thickness,e.thicknessMap&&(t.thicknessMap.value=e.thicknessMap),t.attenuationDistance.value=e.attenuationDistance,t.attenuationColor.value.copy(e.attenuationColor));t.specularIntensity.value=e.specularIntensity,t.specularColor.value.copy(e.specularColor),e.specularIntensityMap&&(t.specularIntensityMap.value=e.specularIntensityMap);e.specularColorMap&&(t.specularColorMap.value=e.specularColorMap)}(t,i,a):n(t,i)):i.isMeshMatcapMaterial?(e(t,i),function(t,e){e.matcap&&(t.matcap.value=e.matcap);e.bumpMap&&(t.bumpMap.value=e.bumpMap,t.bumpScale.value=e.bumpScale,1===e.side&&(t.bumpScale.value*=-1));e.normalMap&&(t.normalMap.value=e.normalMap,t.normalScale.value.copy(e.normalScale),1===e.side&&t.normalScale.value.negate());e.displacementMap&&(t.displacementMap.value=e.displacementMap,t.displacementScale.value=e.displacementScale,t.displacementBias.value=e.displacementBias)}(t,i)):i.isMeshDepthMaterial?(e(t,i),function(t,e){e.displacementMap&&(t.displacementMap.value=e.displacementMap,t.displacementScale.value=e.displacementScale,t.displacementBias.value=e.displacementBias)}(t,i)):i.isMeshDistanceMaterial?(e(t,i),function(t,e){e.displacementMap&&(t.displacementMap.value=e.displacementMap,t.displacementScale.value=e.displacementScale,t.displacementBias.value=e.displacementBias);t.referencePosition.value.copy(e.referencePosition),t.nearDistance.value=e.nearDistance,t.farDistance.value=e.farDistance}(t,i)):i.isMeshNormalMaterial?(e(t,i),function(t,e){e.bumpMap&&(t.bumpMap.value=e.bumpMap,t.bumpScale.value=e.bumpScale,1===e.side&&(t.bumpScale.value*=-1));e.normalMap&&(t.normalMap.value=e.normalMap,t.normalScale.value.copy(e.normalScale),1===e.side&&t.normalScale.value.negate());e.displacementMap&&(t.displacementMap.value=e.displacementMap,t.displacementScale.value=e.displacementScale,t.displacementBias.value=e.displacementBias)}(t,i)):i.isLineBasicMaterial?(function(t,e){t.diffuse.value.copy(e.color),t.opacity.value=e.opacity}(t,i),i.isLineDashedMaterial&&function(t,e){t.dashSize.value=e.dashSize,t.totalSize.value=e.dashSize+e.gapSize,t.scale.value=e.scale}(t,i)):i.isPointsMaterial?function(t,e,n,i){t.diffuse.value.copy(e.color),t.opacity.value=e.opacity,t.size.value=e.size*n,t.scale.value=.5*i,e.map&&(t.map.value=e.map);e.alphaMap&&(t.alphaMap.value=e.alphaMap);e.alphaTest>0&&(t.alphaTest.value=e.alphaTest);let r;e.map?r=e.map:e.alphaMap&&(r=e.alphaMap);void 0!==r&&(!0===r.matrixAutoUpdate&&r.updateMatrix(),t.uvTransform.value.copy(r.matrix))}(t,i,r,s):i.isSpriteMaterial?function(t,e){t.diffuse.value.copy(e.color),t.opacity.value=e.opacity,t.rotation.value=e.rotation,e.map&&(t.map.value=e.map);e.alphaMap&&(t.alphaMap.value=e.alphaMap);e.alphaTest>0&&(t.alphaTest.value=e.alphaTest);let n;e.map?n=e.map:e.alphaMap&&(n=e.alphaMap);void 0!==n&&(!0===n.matrixAutoUpdate&&n.updateMatrix(),t.uvTransform.value.copy(n.matrix))}(t,i):i.isShadowMaterial?(t.color.value.copy(i.color),t.opacity.value=i.opacity):i.isShaderMaterial&&(i.uniformsNeedUpdate=!1)}}}function ha(t={}){const e=void 0!==t.canvas?t.canvas:function(){const t=Dt("canvas");return t.style.display="block",t}(),n=void 0!==t.context?t.context:null,i=void 0!==t.alpha&&t.alpha,r=void 0===t.depth||t.depth,s=void 0===t.stencil||t.stencil,a=void 0!==t.antialias&&t.antialias,o=void 0===t.premultipliedAlpha||t.premultipliedAlpha,l=void 0!==t.preserveDrawingBuffer&&t.preserveDrawingBuffer,c=void 0!==t.powerPreference?t.powerPreference:"default",h=void 0!==t.failIfMajorPerformanceCaveat&&t.failIfMajorPerformanceCaveat;let u=null,d=null;const p=[],m=[];this.domElement=e,this.debug={checkShaderErrors:!0},this.autoClear=!0,this.autoClearColor=!0,this.autoClearDepth=!0,this.autoClearStencil=!0,this.sortObjects=!0,this.clippingPlanes=[],this.localClippingEnabled=!1,this.outputEncoding=ot,this.physicallyCorrectLights=!1,this.toneMapping=0,this.toneMappingExposure=1;const f=this;let g=!1,v=0,_=0,M=null,S=-1,E=null;const A=new Ut,R=new Ut;let C=null,L=e.width,P=e.height,I=1,D=null,N=null;const O=new Ut(0,0,L,P),B=new Ut(0,0,L,P);let z=!1;const F=new vi;let U=!1,H=!1,G=null;const V=new _e,k=new kt,W=new Rt,j={background:null,fog:null,environment:null,overrideMaterial:null,layers:{test:()=>!1},children:[],isScene:!0,onBeforeRender:function(){},onAfterRender:function(){}},q={isCamera:!0,projectionMatrix:new _e,matrixWorldInverse:new _e};function X(){return null===M?I:1}let Y,J,Z,K,Q,$,tt,et,nt,it,rt,st,at,ct,ht,ut,dt,pt,ft,gt,vt,xt,yt,_t=n;function Mt(t,n){for(let i=0;i0&&function(t,e,n){if(null===G){const t=!0===a&&!0===J.isWebGL2,e=Y.has("EXT_color_buffer_half_float")||J.isWebGL2&&Y.has("EXT_color_buffer_float");G=new Ht(1,1,{generateMipmaps:!0,type:e?w:y,minFilter:x,samples:t?4:0})}f.getDrawingBufferSize(W),G.setSize(W.x,W.y);const i=f.getRenderTarget();f.setRenderTarget(G),f.clear();const r=f.toneMapping;f.toneMapping=0,Ot(t,e,n),f.toneMapping=r,$.updateMultisampleRenderTarget(G),$.updateRenderTargetMipmap(G),f.setRenderTarget(i)}(r,e,n),i&&Z.viewport(A.copy(i)),r.length>0&&Ot(r,e,n),s.length>0&&Ot(s,e,n),o.length>0&&Ot(o,e,n)}function Ot(t,e,n){const i=!0===e.isScene?e.overrideMaterial:null;for(let r=0,s=t.length;r0?m[m.length-1]:null,p.pop(),u=p.length>0?p[p.length-1]:null},this.getActiveCubeFace=function(){return v},this.getActiveMipmapLevel=function(){return _},this.getRenderTarget=function(){return M},this.setRenderTargetTextures=function(t,e,n){Q.get(t.texture).__webglTexture=e,Q.get(t.depthTexture).__webglTexture=n;const i=Q.get(t);i.__hasExternalTextures=!0,i.__hasExternalTextures&&(i.__autoAllocateDepthBuffer=void 0===n,i.__autoAllocateDepthBuffer||!0===Y.has("WEBGL_multisampled_render_to_texture")&&(console.warn("THREE.WebGLRenderer: Render-to-texture extension was disabled because an external texture was provided"),i.__useRenderToTexture=!1))},this.setRenderTargetFramebuffer=function(t,e){const n=Q.get(t);n.__webglFramebuffer=e,n.__useDefaultFramebuffer=void 0===e},this.setRenderTarget=function(t,e=0,n=0){M=t,v=e,_=n;let i=!0;if(t){const e=Q.get(t);void 0!==e.__useDefaultFramebuffer?(Z.bindFramebuffer(36160,null),i=!1):void 0===e.__webglFramebuffer?$.setupRenderTarget(t):e.__hasExternalTextures&&$.rebindTextures(t,Q.get(t.texture).__webglTexture,Q.get(t.depthTexture).__webglTexture)}let r=null,s=!1,a=!1;if(t){const n=t.texture;(n.isDataTexture3D||n.isDataTexture2DArray)&&(a=!0);const i=Q.get(t).__webglFramebuffer;t.isWebGLCubeRenderTarget?(r=i[e],s=!0):r=J.isWebGL2&&t.samples>0&&!1===$.useMultisampledRenderToTexture(t)?Q.get(t).__webglMultisampledFramebuffer:i,A.copy(t.viewport),R.copy(t.scissor),C=t.scissorTest}else A.copy(O).multiplyScalar(I).floor(),R.copy(B).multiplyScalar(I).floor(),C=z;if(Z.bindFramebuffer(36160,r)&&J.drawBuffers&&i&&Z.drawBuffers(t,r),Z.viewport(A),Z.scissor(R),Z.setScissorTest(C),s){const i=Q.get(t.texture);_t.framebufferTexture2D(36160,36064,34069+e,i.__webglTexture,n)}else if(a){const i=Q.get(t.texture),r=e||0;_t.framebufferTextureLayer(36160,36064,i.__webglTexture,n||0,r)}S=-1},this.readRenderTargetPixels=function(t,e,n,i,r,s,a){if(!t||!t.isWebGLRenderTarget)return void console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");let o=Q.get(t).__webglFramebuffer;if(t.isWebGLCubeRenderTarget&&void 0!==a&&(o=o[a]),o){Z.bindFramebuffer(36160,o);try{const a=t.texture,o=a.format,l=a.type;if(o!==T&&xt.convert(o)!==_t.getParameter(35739))return void console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in RGBA or implementation defined format.");const c=l===w&&(Y.has("EXT_color_buffer_half_float")||J.isWebGL2&&Y.has("EXT_color_buffer_float"));if(!(l===y||xt.convert(l)===_t.getParameter(35738)||l===b&&(J.isWebGL2||Y.has("OES_texture_float")||Y.has("WEBGL_color_buffer_float"))||c))return void console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in UnsignedByteType or implementation defined type.");36053===_t.checkFramebufferStatus(36160)?e>=0&&e<=t.width-i&&n>=0&&n<=t.height-r&&_t.readPixels(e,n,i,r,xt.convert(o),xt.convert(l),s):console.error("THREE.WebGLRenderer.readRenderTargetPixels: readPixels from renderTarget failed. Framebuffer not complete.")}finally{const t=null!==M?Q.get(M).__webglFramebuffer:null;Z.bindFramebuffer(36160,t)}}},this.copyFramebufferToTexture=function(t,e,n=0){const i=Math.pow(2,-n),r=Math.floor(e.image.width*i),s=Math.floor(e.image.height*i);$.setTexture2D(e,0),_t.copyTexSubImage2D(3553,n,0,0,t.x,t.y,r,s),Z.unbindTexture()},this.copyTextureToTexture=function(t,e,n,i=0){const r=e.image.width,s=e.image.height,a=xt.convert(n.format),o=xt.convert(n.type);$.setTexture2D(n,0),_t.pixelStorei(37440,n.flipY),_t.pixelStorei(37441,n.premultiplyAlpha),_t.pixelStorei(3317,n.unpackAlignment),e.isDataTexture?_t.texSubImage2D(3553,i,t.x,t.y,r,s,a,o,e.image.data):e.isCompressedTexture?_t.compressedTexSubImage2D(3553,i,t.x,t.y,e.mipmaps[0].width,e.mipmaps[0].height,a,e.mipmaps[0].data):_t.texSubImage2D(3553,i,t.x,t.y,a,o,e.image),0===i&&n.generateMipmaps&&_t.generateMipmap(3553),Z.unbindTexture()},this.copyTextureToTexture3D=function(t,e,n,i,r=0){if(f.isWebGL1Renderer)return void console.warn("THREE.WebGLRenderer.copyTextureToTexture3D: can only be used with WebGL2.");const s=t.max.x-t.min.x+1,a=t.max.y-t.min.y+1,o=t.max.z-t.min.z+1,l=xt.convert(i.format),c=xt.convert(i.type);let h;if(i.isDataTexture3D)$.setTexture3D(i,0),h=32879;else{if(!i.isDataTexture2DArray)return void console.warn("THREE.WebGLRenderer.copyTextureToTexture3D: only supports THREE.DataTexture3D and THREE.DataTexture2DArray.");$.setTexture2DArray(i,0),h=35866}_t.pixelStorei(37440,i.flipY),_t.pixelStorei(37441,i.premultiplyAlpha),_t.pixelStorei(3317,i.unpackAlignment);const u=_t.getParameter(3314),d=_t.getParameter(32878),p=_t.getParameter(3316),m=_t.getParameter(3315),g=_t.getParameter(32877),v=n.isCompressedTexture?n.mipmaps[0]:n.image;_t.pixelStorei(3314,v.width),_t.pixelStorei(32878,v.height),_t.pixelStorei(3316,t.min.x),_t.pixelStorei(3315,t.min.y),_t.pixelStorei(32877,t.min.z),n.isDataTexture||n.isDataTexture3D?_t.texSubImage3D(h,r,e.x,e.y,e.z,s,a,o,l,c,v.data):n.isCompressedTexture?(console.warn("THREE.WebGLRenderer.copyTextureToTexture3D: untested support for compressed srcTexture."),_t.compressedTexSubImage3D(h,r,e.x,e.y,e.z,s,a,o,l,v.data)):_t.texSubImage3D(h,r,e.x,e.y,e.z,s,a,o,l,c,v),_t.pixelStorei(3314,u),_t.pixelStorei(32878,d),_t.pixelStorei(3316,p),_t.pixelStorei(3315,m),_t.pixelStorei(32877,g),0===r&&i.generateMipmaps&&_t.generateMipmap(h),Z.unbindTexture()},this.initTexture=function(t){$.setTexture2D(t,0),Z.unbindTexture()},this.resetState=function(){v=0,_=0,M=null,Z.reset(),yt.reset()},"undefined"!=typeof __THREE_DEVTOOLS__&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}ha.prototype.isWebGLRenderer=!0;class ua extends ha{}ua.prototype.isWebGL1Renderer=!0;class da{constructor(t,e=25e-5){this.name="",this.color=new dn(t),this.density=e}clone(){return new da(this.color,this.density)}toJSON(){return{type:"FogExp2",color:this.color.getHex(),density:this.density}}}da.prototype.isFogExp2=!0;class pa{constructor(t,e=1,n=1e3){this.name="",this.color=new dn(t),this.near=e,this.far=n}clone(){return new pa(this.color,this.near,this.far)}toJSON(){return{type:"Fog",color:this.color.getHex(),near:this.near,far:this.far}}}pa.prototype.isFog=!0;class ma extends je{constructor(){super(),this.type="Scene",this.bgToneMapped=!0,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),this.bgToneMapped=t.bgToneMapped,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.fog&&(e.object.fog=this.fog.toJSON()),e.object.bgToneMapped=this.bgToneMapped.toJSON(),e}}ma.prototype.isScene=!0;class fa{constructor(t,e){this.array=t,this.stride=e,this.count=void 0!==t?t.length/e:0,this.usage=ut,this.updateRange={offset:0,count:-1},this.version=0,this.uuid=_t()}onUploadCallback(){}set needsUpdate(t){!0===t&&this.version++}setUsage(t){return this.usage=t,this}copy(t){return this.array=new t.array.constructor(t.array),this.count=t.count,this.stride=t.stride,this.usage=t.usage,this}copyAt(t,e,n){t*=this.stride,n*=e.stride;for(let i=0,r=this.stride;it.far||e.push({distance:o,point:_a.clone(),uv:nn.getUV(_a,Ea,Aa,Ra,Ca,La,Pa,new Rt),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 Da(t,e,n,i,r,s){wa.subVectors(t,n).addScalar(.5).multiply(i),void 0!==r?(Sa.x=s*wa.x-r*wa.y,Sa.y=r*wa.x+s*wa.y):Sa.copy(wa),t.copy(e),t.x+=Sa.x,t.y+=Sa.y,t.applyMatrix4(Ta)}Ia.prototype.isSprite=!0;const Na=new kt,Oa=new kt;class Ba extends je{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 t=0,n=e.length;t0){let n,i;for(n=1,i=e.length;n0){Na.setFromMatrixPosition(this.matrixWorld);const n=t.ray.origin.distanceTo(Na);this.getObjectForDistance(n).raycast(t,e)}}update(t){const e=this.levels;if(e.length>1){Na.setFromMatrixPosition(t.matrixWorld),Oa.setFromMatrixPosition(this.matrixWorld);const n=Na.distanceTo(Oa)/t.zoom;let i,r;for(e[0].object.visible=!0,i=1,r=e.length;i=e[i].distance;i++)e[i-1].object.visible=!1,e[i].object.visible=!0;for(this._currentLevel=i-1;i=0){this.rootMotionBone=this.bones[e];break}this.rootMotionBone&&(this.rootMotionBoneInitialMatrixInverse=this.rootMotionBone.matrixWorld.clone(),this.rootMotionBoneInitialMatrixInverse.invert())}toJSON(){const t={metadata:{version:4.5,type:"Skeleton",generator:"Skeleton.toJSON"},bones:[],boneInverses:[]};t.uuid=this.uuid;const e=this.bones,n=this.boneInverses;for(let i=0,r=e.length;io)continue;u.applyMatrix4(this.matrixWorld);const d=t.ray.origin.distanceTo(u);dt.far||e.push({distance:d,point:h.clone().applyMatrix4(this.matrixWorld),index:n,face:null,faceIndex:null,object:this})}}else{for(let n=Math.max(0,s.start),i=Math.min(r.count,s.start+s.count)-1;no)continue;u.applyMatrix4(this.matrixWorld);const i=t.ray.origin.distanceTo(u);it.far||e.push({distance:i,point:h.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(){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.")}}}ao.prototype.isLine=!0;const oo=new kt,lo=new kt;class co extends ao{constructor(t,e){super(t,e),this.type="LineSegments"}computeLineDistances(){const t=this.geometry;if(t.isBufferGeometry)if(null===t.index){const e=t.attributes.position,n=[];for(let t=0,i=e.count;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.Points.updateMorphTargets() does not support THREE.Geometry. Use THREE.BufferGeometry instead.")}}}function xo(t,e,n,i,r,s,a){const o=mo.distanceSqToPoint(t);if(or.far)return;s.push({distance:l,distanceToRay:Math.sqrt(o),point:n,index:e,face:null,object:a})}}vo.prototype.isPoints=!0;class yo extends zt{constructor(t,e,n,i,r,s,a,o,l){super(t,e,n,i,r,s,a,o,l),this.minFilter=void 0!==s?s:g,this.magFilter=void 0!==r?r:g,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)}}yo.prototype.isVideoTexture=!0;class _o extends zt{constructor(t,e,n){super({width:t,height:e}),this.format=n,this.magFilter=p,this.minFilter=p,this.generateMipmaps=!1,this.needsUpdate=!0}}_o.prototype.isFramebufferTexture=!0;class Mo extends zt{constructor(t,e,n,i,r,s,a,o,l,c,h,u){super(null,s,a,o,l,c,i,r,h,u),this.image={width:e,height:n},this.mipmaps=t,this.flipY=!1,this.generateMipmaps=!1}}Mo.prototype.isCompressedTexture=!0;class bo extends zt{constructor(t,e,n,i,r,s,a,o,l){super(t,e,n,i,r,s,a,o,l),this.needsUpdate=!0}}bo.prototype.isCanvasTexture=!0;class wo{constructor(){this.webglTexture=null}}wo.prototype.isExternalTexture2D=!0;class So extends Nn{constructor(t=1,e=8,n=0,i=2*Math.PI){super(),this.type="CircleGeometry",this.parameters={radius:t,segments:e,thetaStart:n,thetaLength:i},e=Math.max(3,e);const r=[],s=[],a=[],o=[],l=new kt,c=new Rt;s.push(0,0,0),a.push(0,0,1),o.push(.5,.5);for(let r=0,h=3;r<=e;r++,h+=3){const u=n+r/e*i;l.x=t*Math.cos(u),l.y=t*Math.sin(u),s.push(l.x,l.y,l.z),a.push(0,0,1),c.x=(s[h]/t+1)/2,c.y=(s[h+1]/t+1)/2,o.push(c.x,c.y)}for(let t=1;t<=e;t++)r.push(t,t+1,0);this.setIndex(r),this.setAttribute("position",new Tn(s,3)),this.setAttribute("normal",new Tn(a,3)),this.setAttribute("uv",new Tn(o,2))}static fromJSON(t){return new So(t.radius,t.segments,t.thetaStart,t.thetaLength)}}class To extends Nn{constructor(t=1,e=1,n=1,i=8,r=1,s=!1,a=0,o=2*Math.PI){super(),this.type="CylinderGeometry",this.parameters={radiusTop:t,radiusBottom:e,height:n,radialSegments:i,heightSegments:r,openEnded:s,thetaStart:a,thetaLength:o};const l=this;i=Math.floor(i),r=Math.floor(r);const c=[],h=[],u=[],d=[];let p=0;const m=[],f=n/2;let g=0;function v(n){const r=p,s=new Rt,m=new kt;let v=0;const x=!0===n?t:e,y=!0===n?1:-1;for(let t=1;t<=i;t++)h.push(0,f*y,0),u.push(0,y,0),d.push(.5,.5),p++;const _=p;for(let t=0;t<=i;t++){const e=t/i*o+a,n=Math.cos(e),r=Math.sin(e);m.x=x*r,m.y=f*y,m.z=x*n,h.push(m.x,m.y,m.z),u.push(0,y,0),s.x=.5*n+.5,s.y=.5*r*y+.5,d.push(s.x,s.y),p++}for(let t=0;t0&&v(!0),e>0&&v(!1)),this.setIndex(c),this.setAttribute("position",new Tn(h,3)),this.setAttribute("normal",new Tn(u,3)),this.setAttribute("uv",new Tn(d,2))}static fromJSON(t){return new To(t.radiusTop,t.radiusBottom,t.height,t.radialSegments,t.heightSegments,t.openEnded,t.thetaStart,t.thetaLength)}}class Eo extends To{constructor(t=1,e=1,n=8,i=1,r=!1,s=0,a=2*Math.PI){super(0,t,e,n,i,r,s,a),this.type="ConeGeometry",this.parameters={radius:t,height:e,radialSegments:n,heightSegments:i,openEnded:r,thetaStart:s,thetaLength:a}}static fromJSON(t){return new Eo(t.radius,t.height,t.radialSegments,t.heightSegments,t.openEnded,t.thetaStart,t.thetaLength)}}class Ao extends Nn{constructor(t=[],e=[],n=1,i=0){super(),this.type="PolyhedronGeometry",this.parameters={vertices:t,indices:e,radius:n,detail:i};const r=[],s=[];function a(t,e,n,i){const r=i+1,s=[];for(let i=0;i<=r;i++){s[i]=[];const a=t.clone().lerp(n,i/r),o=e.clone().lerp(n,i/r),l=r-i;for(let t=0;t<=l;t++)s[i][t]=0===t&&i===r?a:a.clone().lerp(o,t/l)}for(let t=0;t.9&&a<.1&&(e<.2&&(s[t+0]+=1),n<.2&&(s[t+2]+=1),i<.2&&(s[t+4]+=1))}}()}(),this.setAttribute("position",new Tn(r,3)),this.setAttribute("normal",new Tn(r.slice(),3)),this.setAttribute("uv",new Tn(s,2)),0===i?this.computeVertexNormals():this.normalizeNormals()}static fromJSON(t){return new Ao(t.vertices,t.indices,t.radius,t.details)}}class Ro extends Ao{constructor(t=1,e=0){const n=(1+Math.sqrt(5))/2,i=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,-i,-n,0,-i,n,0,i,-n,0,i,n,-i,-n,0,-i,n,0,i,-n,0,i,n,0,-n,0,-i,n,0,-i,-n,0,i,n,0,i],[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}}static fromJSON(t){return new Ro(t.radius,t.detail)}}const Co=new kt,Lo=new kt,Po=new kt,Io=new nn;class Do extends Nn{constructor(t=null,e=1){if(super(),this.type="EdgesGeometry",this.parameters={geometry:t,thresholdAngle:e},null!==t){const n=4,i=Math.pow(10,n),r=Math.cos(xt*e),s=t.getIndex(),a=t.getAttribute("position"),o=s?s.count:a.count,l=[0,0,0],c=["a","b","c"],h=new Array(3),u={},d=[];for(let t=0;t0)){l=i;break}l=i-1}if(i=l,n[i]===s)return i/(r-1);const c=n[i];return(i+(s-c)/(n[i+1]-c))/(r-1)}getTangent(t,e){const n=1e-4;let i=t-n,r=t+n;i<0&&(i=0),r>1&&(r=1);const s=this.getPoint(i),a=this.getPoint(r),o=e||(s.isVector2?new Rt:new kt);return o.copy(a).sub(s).normalize(),o}getTangentAt(t,e){const n=this.getUtoTmapping(t);return this.getTangent(n,e)}computeFrenetFrames(t,e){const n=new kt,i=[],r=[],s=[],a=new kt,o=new _e;for(let e=0;e<=t;e++){const n=e/t;i[e]=this.getTangentAt(n,new kt)}r[0]=new kt,s[0]=new kt;let l=Number.MAX_VALUE;const c=Math.abs(i[0].x),h=Math.abs(i[0].y),u=Math.abs(i[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),a.crossVectors(i[0],n).normalize(),r[0].crossVectors(i[0],a),s[0].crossVectors(i[0],r[0]);for(let e=1;e<=t;e++){if(r[e]=r[e-1].clone(),s[e]=s[e-1].clone(),a.crossVectors(i[e-1],i[e]),a.length()>Number.EPSILON){a.normalize();const t=Math.acos(Mt(i[e-1].dot(i[e]),-1,1));r[e].applyMatrix4(o.makeRotationAxis(a,t))}s[e].crossVectors(i[e],r[e])}if(!0===e){let e=Math.acos(Mt(r[0].dot(r[t]),-1,1));e/=t,i[0].dot(a.crossVectors(r[0],r[t]))>0&&(e=-e);for(let n=1;n<=t;n++)r[n].applyMatrix4(o.makeRotationAxis(i[n],e*n)),s[n].crossVectors(i[n],r[n])}return{tangents:i,normals:r,binormals:s}}clone(){return(new this.constructor).copy(this)}copy(t){return this.arcLengthDivisions=t.arcLengthDivisions,this}toJSON(){const t={metadata:{version:4.5,type:"Curve",generator:"Curve.toJSON"}};return t.arcLengthDivisions=this.arcLengthDivisions,t.type=this.type,t}fromJSON(t){return this.arcLengthDivisions=t.arcLengthDivisions,this}}class Oo extends No{constructor(t=0,e=0,n=1,i=1,r=0,s=2*Math.PI,a=!1,o=0){super(),this.type="EllipseCurve",this.aX=t,this.aY=e,this.xRadius=n,this.yRadius=i,this.aStartAngle=r,this.aEndAngle=s,this.aClockwise=a,this.aRotation=o}getPoint(t,e){const n=e||new Rt,i=2*Math.PI;let r=this.aEndAngle-this.aStartAngle;const s=Math.abs(r)i;)r-=i;r0?0:(Math.floor(Math.abs(l)/r)+1)*r:0===c&&l===r-1&&(l=r-2,c=1),this.closed||l>0?a=i[(l-1)%r]:(Fo.subVectors(i[0],i[1]).add(i[0]),a=Fo);const h=i[l%r],u=i[(l+1)%r];if(this.closed||l+2i.length-2?i.length-1:s+1],h=i[s>i.length-3?i.length-1:s+2];return n.set(ko(a,o.x,l.x,c.x,h.x),ko(a,o.y,l.y,c.y,h.y)),n}copy(t){super.copy(t),this.points=[];for(let e=0,n=t.points.length;e=n){const t=i[r]-n,s=this.curves[r],a=s.getLength(),o=0===a?0:1-t/a;return s.getPointAt(o,e)}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,i=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}}class nl extends el{constructor(t){super(t),this.uuid=_t(),this.type="Shape",this.holes=[]}getPointsHoles(t){const e=[];for(let n=0,i=this.holes.length;n80*n){o=c=t[0],l=h=t[1];for(let e=n;ec&&(c=u),d>h&&(h=d);p=Math.max(c-o,h-l),p=0!==p?1/p:0}return al(s,a,n,o,l,p),a};function rl(t,e,n,i,r){let s,a;if(r===function(t,e,n,i){let r=0;for(let s=e,a=n-i;s0)for(s=e;s=e;s-=i)a=Tl(s,t[s],t[s+1],a);return a&&yl(a,a.next)&&(El(a),a=a.next),a}function sl(t,e){if(!t)return t;e||(e=t);let n,i=t;do{if(n=!1,i.steiner||!yl(i,i.next)&&0!==xl(i.prev,i,i.next))i=i.next;else{if(El(i),i=e=i.prev,i===i.next)break;n=!0}}while(n||i!==e);return e}function al(t,e,n,i,r,s,a){if(!t)return;!a&&s&&function(t,e,n,i){let r=t;do{null===r.z&&(r.z=ml(r.x,r.y,e,n,i)),r.prevZ=r.prev,r.nextZ=r.next,r=r.next}while(r!==t);r.prevZ.nextZ=null,r.prevZ=null,function(t){let e,n,i,r,s,a,o,l,c=1;do{for(n=t,t=null,s=null,a=0;n;){for(a++,i=n,o=0,e=0;e0||l>0&&i;)0!==o&&(0===l||!i||n.z<=i.z)?(r=n,n=n.nextZ,o--):(r=i,i=i.nextZ,l--),s?s.nextZ=r:t=r,r.prevZ=s,s=r;n=i}s.nextZ=null,c*=2}while(a>1)}(r)}(t,i,r,s);let o,l,c=t;for(;t.prev!==t.next;)if(o=t.prev,l=t.next,s?ll(t,i,r,s):ol(t))e.push(o.i/n),e.push(t.i/n),e.push(l.i/n),El(t),t=l.next,c=l.next;else if((t=l)===c){a?1===a?al(t=cl(sl(t),e,n),e,n,i,r,s,2):2===a&&hl(t,e,n,i,r,s):al(sl(t),e,n,i,r,s,1);break}}function ol(t){const e=t.prev,n=t,i=t.next;if(xl(e,n,i)>=0)return!1;let r=t.next.next;for(;r!==t.prev;){if(gl(e.x,e.y,n.x,n.y,i.x,i.y,r.x,r.y)&&xl(r.prev,r,r.next)>=0)return!1;r=r.next}return!0}function ll(t,e,n,i){const r=t.prev,s=t,a=t.next;if(xl(r,s,a)>=0)return!1;const o=r.xs.x?r.x>a.x?r.x:a.x:s.x>a.x?s.x:a.x,h=r.y>s.y?r.y>a.y?r.y:a.y:s.y>a.y?s.y:a.y,u=ml(o,l,e,n,i),d=ml(c,h,e,n,i);let p=t.prevZ,m=t.nextZ;for(;p&&p.z>=u&&m&&m.z<=d;){if(p!==t.prev&&p!==t.next&&gl(r.x,r.y,s.x,s.y,a.x,a.y,p.x,p.y)&&xl(p.prev,p,p.next)>=0)return!1;if(p=p.prevZ,m!==t.prev&&m!==t.next&&gl(r.x,r.y,s.x,s.y,a.x,a.y,m.x,m.y)&&xl(m.prev,m,m.next)>=0)return!1;m=m.nextZ}for(;p&&p.z>=u;){if(p!==t.prev&&p!==t.next&&gl(r.x,r.y,s.x,s.y,a.x,a.y,p.x,p.y)&&xl(p.prev,p,p.next)>=0)return!1;p=p.prevZ}for(;m&&m.z<=d;){if(m!==t.prev&&m!==t.next&&gl(r.x,r.y,s.x,s.y,a.x,a.y,m.x,m.y)&&xl(m.prev,m,m.next)>=0)return!1;m=m.nextZ}return!0}function cl(t,e,n){let i=t;do{const r=i.prev,s=i.next.next;!yl(r,s)&&_l(r,i,i.next,s)&&wl(r,s)&&wl(s,r)&&(e.push(r.i/n),e.push(i.i/n),e.push(s.i/n),El(i),El(i.next),i=t=s),i=i.next}while(i!==t);return sl(i)}function hl(t,e,n,i,r,s){let a=t;do{let t=a.next.next;for(;t!==a.prev;){if(a.i!==t.i&&vl(a,t)){let o=Sl(a,t);return a=sl(a,a.next),o=sl(o,o.next),al(a,e,n,i,r,s),void al(o,e,n,i,r,s)}t=t.next}a=a.next}while(a!==t)}function ul(t,e){return t.x-e.x}function dl(t,e){if(e=function(t,e){let n=e;const i=t.x,r=t.y;let s,a=-1/0;do{if(r<=n.y&&r>=n.next.y&&n.next.y!==n.y){const t=n.x+(r-n.y)*(n.next.x-n.x)/(n.next.y-n.y);if(t<=i&&t>a){if(a=t,t===i){if(r===n.y)return n;if(r===n.next.y)return n.next}s=n.x=n.x&&n.x>=l&&i!==n.x&&gl(rs.x||n.x===s.x&&pl(s,n)))&&(s=n,u=h)),n=n.next}while(n!==o);return s}(t,e),e){const n=Sl(e,t);sl(e,e.next),sl(n,n.next)}}function pl(t,e){return xl(t.prev,t,e.prev)<0&&xl(e.next,t,t.next)<0}function ml(t,e,n,i,r){return(t=1431655765&((t=858993459&((t=252645135&((t=16711935&((t=32767*(t-n)*r)|t<<8))|t<<4))|t<<2))|t<<1))|(e=1431655765&((e=858993459&((e=252645135&((e=16711935&((e=32767*(e-i)*r)|e<<8))|e<<4))|e<<2))|e<<1))<<1}function fl(t){let e=t,n=t;do{(e.x=0&&(t-a)*(i-o)-(n-a)*(e-o)>=0&&(n-a)*(s-o)-(r-a)*(i-o)>=0}function vl(t,e){return t.next.i!==e.i&&t.prev.i!==e.i&&!function(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&&_l(n,n.next,t,e))return!0;n=n.next}while(n!==t);return!1}(t,e)&&(wl(t,e)&&wl(e,t)&&function(t,e){let n=t,i=!1;const r=(t.x+e.x)/2,s=(t.y+e.y)/2;do{n.y>s!=n.next.y>s&&n.next.y!==n.y&&r<(n.next.x-n.x)*(s-n.y)/(n.next.y-n.y)+n.x&&(i=!i),n=n.next}while(n!==t);return i}(t,e)&&(xl(t.prev,t,e.prev)||xl(t,e.prev,e))||yl(t,e)&&xl(t.prev,t,t.next)>0&&xl(e.prev,e,e.next)>0)}function xl(t,e,n){return(e.y-t.y)*(n.x-e.x)-(e.x-t.x)*(n.y-e.y)}function yl(t,e){return t.x===e.x&&t.y===e.y}function _l(t,e,n,i){const r=bl(xl(t,e,n)),s=bl(xl(t,e,i)),a=bl(xl(n,i,t)),o=bl(xl(n,i,e));return r!==s&&a!==o||(!(0!==r||!Ml(t,n,e))||(!(0!==s||!Ml(t,i,e))||(!(0!==a||!Ml(n,t,i))||!(0!==o||!Ml(n,e,i)))))}function Ml(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 bl(t){return t>0?1:t<0?-1:0}function wl(t,e){return xl(t.prev,t,t.next)<0?xl(t,e,t.next)>=0&&xl(t,t.prev,e)>=0:xl(t,e,t.prev)<0||xl(t,t.next,e)<0}function Sl(t,e){const n=new Al(t.i,t.x,t.y),i=new Al(e.i,e.x,e.y),r=t.next,s=e.prev;return t.next=e,e.prev=t,n.next=r,r.prev=n,i.next=n,n.prev=i,s.next=i,i.prev=s,i}function Tl(t,e,n,i){const r=new Al(t,e,n);return i?(r.next=i.next,r.prev=i,i.next.prev=r,i.next=r):(r.prev=r,r.next=r),r}function El(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 Al(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}class Rl{static area(t){const e=t.length;let n=0;for(let i=e-1,r=0;r2&&t[e-1].equals(t[0])&&t.pop()}function Ll(t,e){for(let n=0;nNumber.EPSILON){const u=Math.sqrt(h),d=Math.sqrt(l*l+c*c),p=e.x-o/u,m=e.y+a/u,f=((n.x-c/d-p)*c-(n.y+l/d-m)*l)/(a*c-o*l);i=p+a*f-t.x,r=m+o*f-t.y;const g=i*i+r*r;if(g<=2)return new Rt(i,r);s=Math.sqrt(g/2)}else{let t=!1;a>Number.EPSILON?l>Number.EPSILON&&(t=!0):a<-Number.EPSILON?l<-Number.EPSILON&&(t=!0):Math.sign(o)===Math.sign(c)&&(t=!0),t?(i=-o,r=a,s=Math.sqrt(h)):(i=a,r=o,s=Math.sqrt(h/2))}return new Rt(i/s,r/s)}const P=[];for(let t=0,e=E.length,n=e-1,i=t+1;t=0;t--){const e=t/p,n=h*Math.cos(e*Math.PI/2),i=u*Math.sin(e*Math.PI/2)+d;for(let t=0,e=E.length;t=0;){const i=n;let r=n-1;r<0&&(r=t.length-1);for(let t=0,n=o+2*p;t0)&&d.push(e,r,l),(t!==n-1||o0!=t>0&&this.version++,this._refraction=t}copy(t){return super.copy(t),this.defines=t.defines,this.color.copy(t.color),this.roughness=t.roughness,this.metalness=t.metalness,this.f90=t.f90,this.map=t.map,this.lightMap=t.lightMap,this.lightMapIntensity=t.lightMapIntensity,this.aoMap=t.aoMap,this.aoMapIntensity=t.aoMapIntensity,this.emissive.copy(t.emissive),this.emissiveMap=t.emissiveMap,this.emissiveIntensity=t.emissiveIntensity,this.bumpMap=t.bumpMap,this.bumpScale=t.bumpScale,this.normalMap=t.normalMap,this.lowerNormalMap=t.lowerNormalMap,this.normalMapType=t.normalMapType,this.normalScale.copy(t.normalScale),this.displacementMap=t.displacementMap,this.displacementScale=t.displacementScale,this.displacementBias=t.displacementBias,this.roughnessMap=t.roughnessMap,this.metalnessMap=t.metalnessMap,this.alphaMap=t.alphaMap,this.envMap=t.envMap,this.envMapIntensity=t.envMapIntensity,this.refraction=t.refraction,this.refractionRatio=t.refractionRatio,this.wireframe=t.wireframe,this.wireframeLinewidth=t.wireframeLinewidth,this.wireframeLinecap=t.wireframeLinecap,this.wireframeLinejoin=t.wireframeLinejoin,this.flatShading=t.flatShading,this}}Xl.prototype.isMeshStandardMaterial=!0;class Yl extends Xl{constructor(t){super(),this.defines.PHYSICAL="",this.type="MeshPhysicalMaterial",this.clearcoatMap=null,this.clearcoatRoughness=0,this.clearcoatRoughnessMap=null,this.clearcoatNormalScale=new Rt(1,1),this.clearcoatNormalMap=null,this.ior=1.5,Object.defineProperty(this,"reflectivity",{get:function(){return Mt(2.5*(this.ior-1)/(this.ior+1),0,1)},set:function(t){this.ior=(1+.4*t)/(1-.4*t)}}),this.sheenColor=new dn(0),this.sheenColorMap=null,this.sheenRoughness=1,this.sheenRoughnessMap=null,this.transmissionMap=null,this.thickness=0,this.thicknessMap=null,this.attenuationDistance=0,this.attenuationColor=new dn(1,1,1),this.specularIntensity=1,this.specularIntensityMap=null,this.specularColor=new dn(1,1,1),this.specularColorMap=null,this._sheen=0,this._clearcoat=0,this._transmission=0,this.setValues(t)}get sheen(){return this._sheen}set sheen(t){this._sheen>0!=t>0&&this.version++,this._sheen=t}get clearcoat(){return this._clearcoat}set clearcoat(t){this._clearcoat>0!=t>0&&this.version++,this._clearcoat=t}get transmission(){return this._transmission}set transmission(t){this._transmission>0!=t>0&&this.version++,this._transmission=t}copy(t){return super.copy(t),this.defines=t.defines,this.clearcoat=t.clearcoat,this.clearcoatMap=t.clearcoatMap,this.clearcoatRoughness=t.clearcoatRoughness,this.clearcoatRoughnessMap=t.clearcoatRoughnessMap,this.clearcoatNormalMap=t.clearcoatNormalMap,this.clearcoatNormalScale.copy(t.clearcoatNormalScale),this.ior=t.ior,this.sheen=t.sheen,this.sheenColor.copy(t.sheenColor),this.sheenColorMap=t.sheenColorMap,this.sheenRoughness=t.sheenRoughness,this.sheenRoughnessMap=t.sheenRoughnessMap,this.transmission=t.transmission,this.transmissionMap=t.transmissionMap,this.thickness=t.thickness,this.thicknessMap=t.thicknessMap,this.attenuationDistance=t.attenuationDistance,this.attenuationColor.copy(t.attenuationColor),this.specularIntensity=t.specularIntensity,this.specularIntensityMap=t.specularIntensityMap,this.specularColor.copy(t.specularColor),this.specularColorMap=t.specularColorMap,this}}Yl.prototype.isMeshPhysicalMaterial=!0;class Jl extends sn{constructor(t){super(),this.type="MeshPhongMaterial",this.color=new dn(16777215),this.specular=new dn(1118481),this.shininess=30,this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new dn(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=0,this.normalScale=new Rt(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.combine=0,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.flatShading=!1,this.setValues(t)}copy(t){return super.copy(t),this.color.copy(t.color),this.specular.copy(t.specular),this.shininess=t.shininess,this.map=t.map,this.lightMap=t.lightMap,this.lightMapIntensity=t.lightMapIntensity,this.aoMap=t.aoMap,this.aoMapIntensity=t.aoMapIntensity,this.emissive.copy(t.emissive),this.emissiveMap=t.emissiveMap,this.emissiveIntensity=t.emissiveIntensity,this.bumpMap=t.bumpMap,this.bumpScale=t.bumpScale,this.normalMap=t.normalMap,this.normalMapType=t.normalMapType,this.normalScale.copy(t.normalScale),this.displacementMap=t.displacementMap,this.displacementScale=t.displacementScale,this.displacementBias=t.displacementBias,this.specularMap=t.specularMap,this.alphaMap=t.alphaMap,this.envMap=t.envMap,this.combine=t.combine,this.reflectivity=t.reflectivity,this.refractionRatio=t.refractionRatio,this.wireframe=t.wireframe,this.wireframeLinewidth=t.wireframeLinewidth,this.wireframeLinecap=t.wireframeLinecap,this.wireframeLinejoin=t.wireframeLinejoin,this.flatShading=t.flatShading,this}}Jl.prototype.isMeshPhongMaterial=!0;class Zl extends Jl{constructor(t){super(t),this.type="MeshNoTonePhongMaterial",Object.defineProperty(this,"toneMapped",{get:function(){return!1},set:function(){}})}}class Kl extends sn{constructor(t){super(),this.defines={TOON:""},this.type="MeshToonMaterial",this.color=new dn(16777215),this.map=null,this.gradientMap=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new dn(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=0,this.normalScale=new Rt(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.alphaMap=null,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.setValues(t)}copy(t){return super.copy(t),this.color.copy(t.color),this.map=t.map,this.gradientMap=t.gradientMap,this.lightMap=t.lightMap,this.lightMapIntensity=t.lightMapIntensity,this.aoMap=t.aoMap,this.aoMapIntensity=t.aoMapIntensity,this.emissive.copy(t.emissive),this.emissiveMap=t.emissiveMap,this.emissiveIntensity=t.emissiveIntensity,this.bumpMap=t.bumpMap,this.bumpScale=t.bumpScale,this.normalMap=t.normalMap,this.normalMapType=t.normalMapType,this.normalScale.copy(t.normalScale),this.displacementMap=t.displacementMap,this.displacementScale=t.displacementScale,this.displacementBias=t.displacementBias,this.alphaMap=t.alphaMap,this.wireframe=t.wireframe,this.wireframeLinewidth=t.wireframeLinewidth,this.wireframeLinecap=t.wireframeLinecap,this.wireframeLinejoin=t.wireframeLinejoin,this}}Kl.prototype.isMeshToonMaterial=!0;class Ql extends sn{constructor(t){super(),this.type="MeshNormalMaterial",this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=0,this.normalScale=new Rt(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.wireframe=!1,this.wireframeLinewidth=1,this.fog=!1,this.flatShading=!1,this.setValues(t)}copy(t){return super.copy(t),this.bumpMap=t.bumpMap,this.bumpScale=t.bumpScale,this.normalMap=t.normalMap,this.normalMapType=t.normalMapType,this.normalScale.copy(t.normalScale),this.displacementMap=t.displacementMap,this.displacementScale=t.displacementScale,this.displacementBias=t.displacementBias,this.wireframe=t.wireframe,this.wireframeLinewidth=t.wireframeLinewidth,this.flatShading=t.flatShading,this}}Ql.prototype.isMeshNormalMaterial=!0;class $l extends sn{constructor(t){super(),this.type="MeshLambertMaterial",this.color=new dn(16777215),this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new dn(0),this.emissiveIntensity=1,this.emissiveMap=null,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.combine=0,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.setValues(t)}copy(t){return super.copy(t),this.color.copy(t.color),this.map=t.map,this.lightMap=t.lightMap,this.lightMapIntensity=t.lightMapIntensity,this.aoMap=t.aoMap,this.aoMapIntensity=t.aoMapIntensity,this.emissive.copy(t.emissive),this.emissiveMap=t.emissiveMap,this.emissiveIntensity=t.emissiveIntensity,this.specularMap=t.specularMap,this.alphaMap=t.alphaMap,this.envMap=t.envMap,this.combine=t.combine,this.reflectivity=t.reflectivity,this.refractionRatio=t.refractionRatio,this.wireframe=t.wireframe,this.wireframeLinewidth=t.wireframeLinewidth,this.wireframeLinecap=t.wireframeLinecap,this.wireframeLinejoin=t.wireframeLinejoin,this}}$l.prototype.isMeshLambertMaterial=!0;class tc extends sn{constructor(t){super(),this.defines={MATCAP:""},!0===sn.r115Compatible&&(this.defines.PERTURB_NORMAL_R115_COMPATABILITY=""),this.type="MeshMatcapMaterial",this.color=new dn(16777215),this.matcap=null,this.map=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=0,this.normalScale=new Rt(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.alphaMap=null,this.flatShading=!1,this.setValues(t)}copy(t){return super.copy(t),this.defines=t.defines,this.color.copy(t.color),this.matcap=t.matcap,this.map=t.map,this.bumpMap=t.bumpMap,this.bumpScale=t.bumpScale,this.normalMap=t.normalMap,this.normalMapType=t.normalMapType,this.normalScale.copy(t.normalScale),this.displacementMap=t.displacementMap,this.displacementScale=t.displacementScale,this.displacementBias=t.displacementBias,this.alphaMap=t.alphaMap,this.flatShading=t.flatShading,this}}tc.prototype.isMeshMatcapMaterial=!0;class ec extends tc{constructor(t){super(t),this.type="OFTMatcapMaterial",this.defines.OFT_MATCAP=""}copy(t){return super.copy(t),this.defines=Object.assign({},t.defines),this}}ec.prototype.isOFTMatcapMaterial=!0;class nc extends ri{constructor(t){super({vertexShader:"\n\t\t\tattribute float size;\n\n\t\t\tuniform float pointSize;\n\n\t\t\tvarying vec4 vColor;\n\t\t\tvarying float vIntensity;\n\t\t\tvarying float vRandom;\n\t\t\tvarying vec4 vMvpPosition;\n\n\t\t\t#define PI 3.14159265359\n\t\t\t#define PI2 6.28318530718\n\n\t\t\tconst float Threshold = 0.65;\n\n\t\t\thighp float rand( const in vec2 uv ) {\n\t\t\t\tconst highp float a = 12.9898, b = 78.233, c = 43758.5453;\n\t\t\t\thighp float dt = dot( uv.xy, vec2( a, b ) ), sn = mod( dt, PI );\n\t\t\t\treturn fract(sin(sn) * c);\n\t\t\t}\n\n\t\t\tvoid main() {\n\n\t\t\t\tvColor.rgb = color.rgb;\n\n\t\t\t\tvRandom = rand(position.xy);\n\t\t\t\tvec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );\n\t\t\t\tvec3 ViewPosition = - mvPosition.xyz;\n\t\t\t\tvec3 viewDir = normalize(ViewPosition);\n\n\t\t\t\tvec3 n = normalize(normalMatrix * normal);\n\t\t\t\tfloat dotNV = dot(viewDir, n);\n\t\t\t\t// cos func to liner func\n\t\t\t\tvIntensity = 1.0 - acos(dotNV);\n\t\t\t\t// map Threshold ~ 1.0 to 0 ~ 1.0\n\t\t\t\tvIntensity = vIntensity < Threshold ? 0.0 : (vIntensity - Threshold) / (1.0 - Threshold);\n\t\t\t\t// sharp the curve\n\t\t\t\tvIntensity = pow(vIntensity, 1.1);\n\n\t\t\t\tvColor.a = 0.2 + vIntensity * 0.8;\n\n\t\t\t\tgl_Position = projectionMatrix * mvPosition;\n\n\t\t\t\tvMvpPosition = gl_Position;\n\t\t\t\tgl_PointSize = ((vRandom * 0.2 + 1.8) * pointSize) * vIntensity * (0.5/-mvPosition.z);\n\n\t\t\t}\n\t\t\t",fragmentShader:"\n\t\t\tprecision highp float;\n\t\t\t#include \n\n\t\t\t#define PI 3.14159265359\n\t\t\t#define PI2 6.28318530718\n\n\t\t\tuniform sampler2D pointTexture;\n\t\t\tuniform sampler2D depthTexture;\n\t\t\tuniform float depthBias;\n\n\t\t\tvarying vec4 vColor;\n\t\t\tvarying float vRandom;\n\t\t\tvarying float vDotNV;\n\t\t\tvarying float vIntensity;\n\t\t\tvarying vec4 vMvpPosition;\n\n\t\t\tvec2 rotateUV(vec2 uv, float rotation) {\n\t\t\t\tfloat mid = 0.5;\n\t\t\t\treturn vec2(\n\t\t\t\t\tcos(rotation) * (uv.x - mid) + sin(rotation) * (uv.y - mid) + mid,\n\t\t\t\t\tcos(rotation) * (uv.y - mid) - sin(rotation) * (uv.x - mid) + mid\n\t\t\t\t);\n\t\t\t}\n\n\t\t\tvec3 rgb2hsv(vec3 c) {\n\t\t\t\tvec4 K = vec4(0.0, -1.0 / 3.0, 2.0 / 3.0, -1.0);\n\t\t\t\tvec4 p = mix(vec4(c.bg, K.wz), vec4(c.gb, K.xy), step(c.b, c.g));\n\t\t\t\tvec4 q = mix(vec4(p.xyw, c.r), vec4(c.r, p.yzx), step(p.x, c.r));\n\n\t\t\t\tfloat d = q.x - min(q.w, q.y);\n\t\t\t\tfloat e = 1.0e-10;\n\t\t\t\treturn vec3(abs(q.z + (q.w - q.y) / (6.0 * d + e)), d / (q.x + e), q.x);\n\t\t\t}\n\n\t\t\tvec3 hsv2rgb(vec3 c) {\n\t\t\t\tvec4 K = vec4(1.0, 2.0 / 3.0, 1.0 / 3.0, 3.0);\n\t\t\t\tvec3 p = abs(fract(c.xxx + K.xyz) * 6.0 - K.www);\n\t\t\t\treturn c.z * mix(K.xxx, clamp(p - K.xxx, 0.0, 1.0), c.y);\n\t\t\t}\n\n\t\t\tfloat readDepth( sampler2D depthSampler, vec2 coord ) {\n\t\t\t\tfloat fragCoordZ = texture2D( depthSampler, coord ).x;\n\t\t\t\tfloat viewZ = perspectiveDepthToViewZ( fragCoordZ, 0.1, 2.0 );\n\t\t\t\treturn viewZToOrthographicDepth( viewZ, 0.1, 2.0 );\n\t\t\t}\n\n\t\t\tvoid main() {\n\t\t\t\tvec3 projCoords = vMvpPosition.xyz / vMvpPosition.w;\n\t\t\t\tprojCoords = projCoords * 0.5 + 0.5;\n\t\t\t\tfloat depth = unpackRGBAToDepth(texture2D(depthTexture, projCoords.xy));\n\t\t\t\tif (projCoords.z - depth >= depthBias) discard;\n\n\t\t\t\tif (vIntensity <= 0.0) discard;\n\t\t\t\tgl_FragColor = vColor;\n\t\t\t\tvec2 rotateUv = rotateUV(gl_PointCoord, vRandom * vIntensity * PI * 0.6);\n\t\t\t\trotateUv = clamp(rotateUv, 0.0, 1.0);\n\t\t\t\tgl_FragColor = gl_FragColor * mapTexelToLinear(texture2D( pointTexture, rotateUv ));\n\n\t\t\t\t#include \n\t\t\t}\n\t\t\t",blending:2,depthTest:!1,transparent:!0,vertexColors:!0}),null!=t&&(this._pointSize=t.pointSize||50,this._depthBias=t.depthBias||.001,this._pointTexture=t.pointTexture||null,this._depthTexture=t.depthTexture||null),this.uniforms={pointSize:{value:this.pointSize},pointTexture:{value:this.pointTexture},depthTexture:{value:this.depthTexture},depthBias:{value:this.depthBias}},this.type="OFTPointSpriteMaterial"}get pointSize(){return this._pointSize}set pointSize(t){this._pointSize=t,this.uniforms.pointSize.value=t}get depthBias(){return this._depthBias}set depthBias(t){this._depthBias=t,this.uniforms.depthBias.value=t}get map(){return this._pointTexture}get pointTexture(){return this._pointTexture}set pointTexture(t){this._pointTexture=t,this.uniforms.pointTexture.value=t}get depthTexture(){return this._depthTexture}set depthTexture(t){this._depthTexture=t,this.uniforms.depthTexture.value=t}}nc.prototype.isOFTPointSpriteMaterial=!0;class ic extends to{constructor(t){super(),this.type="LineDashedMaterial",this.scale=1,this.dashSize=3,this.gapSize=1,this.setValues(t)}copy(t){return super.copy(t),this.scale=t.scale,this.dashSize=t.dashSize,this.gapSize=t.gapSize,this}}ic.prototype.isLineDashedMaterial=!0;var rc=Object.freeze({__proto__:null,ShadowMaterial:ql,SpriteMaterial:xa,RawShaderMaterial:Pi,ShaderMaterial:ri,PointsMaterial:uo,MeshPhysicalMaterial:Yl,MeshStandardMaterial:Xl,MeshPhongMaterial:Jl,MeshNoTonePhongMaterial:Zl,MeshToonMaterial:Kl,MeshNormalMaterial:Ql,MeshLambertMaterial:$l,MeshDepthMaterial:Ks,MeshDistanceMaterial:Qs,MeshBasicMaterial:pn,MeshMatcapMaterial:tc,OFTMatcapMaterial:ec,OFTPointSpriteMaterial:nc,LineDashedMaterial:ic,LineBasicMaterial:to,Material:sn});const sc={arraySlice:function(t,e,n){return sc.isTypedArray(t)?new t.constructor(t.subarray(e,void 0!==n?n:t.length)):t.slice(e,n)},convertArray:function(t,e,n){return!t||!n&&t.constructor===e?t:"number"==typeof e.BYTES_PER_ELEMENT?new e(t):Array.prototype.slice.call(t)},isTypedArray:function(t){return ArrayBuffer.isView(t)&&!(t instanceof DataView)},getKeyframeOrder:function(t){const e=t.length,n=new Array(e);for(let t=0;t!==e;++t)n[t]=t;return n.sort((function(e,n){return t[e]-t[n]})),n},sortedArray:function(t,e,n){const i=t.length,r=new t.constructor(i);for(let s=0,a=0;a!==i;++s){const i=n[s]*e;for(let n=0;n!==e;++n)r[a++]=t[i+n]}return r},flattenJSON:function(t,e,n,i){let r=1,s=t[0];for(;void 0!==s&&void 0===s[i];)s=t[r++];if(void 0===s)return;let a=s[i];if(void 0!==a)if(Array.isArray(a))do{a=s[i],void 0!==a&&(e.push(s.time),n.push.apply(n,a)),s=t[r++]}while(void 0!==s);else if(void 0!==a.toArray)do{a=s[i],void 0!==a&&(e.push(s.time),a.toArray(n,n.length)),s=t[r++]}while(void 0!==s);else do{a=s[i],void 0!==a&&(e.push(s.time),n.push(a)),s=t[r++]}while(void 0!==s)},subclip:function(t,e,n,i,r=30){const s=t.clone();s.name=e;const a=[];for(let t=0;t=i)){l.push(e.times[t]);for(let n=0;ns.tracks[t].times[0]&&(o=s.tracks[t].times[0]);for(let t=0;t=i.times[u]){const t=u*l+o,e=t+l-o;d=sc.arraySlice(i.values,t,e)}else{const t=i.createInterpolant(),e=o,n=l-o;t.evaluate(s),d=sc.arraySlice(t.resultBuffer,e,n)}if("quaternion"===r){(new Vt).fromArray(d).normalize().conjugate().toArray(d)}const p=a.times.length;for(let t=0;t=r)break t;{const a=e[1];t=r)break e}s=n,n=0}}for(;n>>1;te;)--s;if(++s,0!==r||s!==i){r>=s&&(s=Math.max(s,1),r=s-1);const t=this.getValueSize();this.times=sc.arraySlice(n,r,s),this.values=sc.arraySlice(this.values,r*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,i=this.values,r=n.length;0===r&&(console.error("THREE.KeyframeTrack: Track is empty.",this),t=!1);let s=null;for(let e=0;e!==r;e++){const i=n[e];if("number"==typeof i&&isNaN(i)){console.error("THREE.KeyframeTrack: Time is not a valid number.",this,e,i),t=!1;break}if(null!==s&&s>i){console.error("THREE.KeyframeTrack: Out of order keys.",this,e,i,s),t=!1;break}s=i}if(void 0!==i&&sc.isTypedArray(i))for(let e=0,n=i.length;e!==n;++e){const n=i[e];if(isNaN(n)){console.error("THREE.KeyframeTrack: Value is not a valid number.",this,e,n),t=!1;break}}return t}optimize(){const t=sc.arraySlice(this.times),e=sc.arraySlice(this.values),n=this.getValueSize(),i=this.getInterpolation()===et,r=t.length-1;let s=1;for(let a=1;a0){t[s]=t[r];for(let t=r*n,i=s*n,a=0;a!==n;++a)e[i+a]=e[t+a];++s}return s!==t.length?(this.times=sc.arraySlice(t,0,s),this.values=sc.arraySlice(e,0,s*n)):(this.times=t,this.values=e),this}clone(){const t=sc.arraySlice(this.times,0),e=sc.arraySlice(this.values,0),n=new(0,this.constructor)(this.name,t,e);return n.createInterpolant=this.createInterpolant,n}}hc.prototype.TimeBufferType=Float32Array,hc.prototype.ValueBufferType=Float32Array,hc.prototype.DefaultInterpolation=tt;class uc extends hc{}uc.prototype.ValueTypeName="bool",uc.prototype.ValueBufferType=Array,uc.prototype.DefaultInterpolation=$,uc.prototype.InterpolantFactoryMethodLinear=void 0,uc.prototype.InterpolantFactoryMethodSmooth=void 0;class dc extends hc{}dc.prototype.ValueTypeName="color";class pc extends hc{}pc.prototype.ValueTypeName="number";class mc extends ac{constructor(t,e,n,i){super(t,e,n,i)}interpolate_(t,e,n,i){const r=this.resultBuffer,s=this.sampleValues,a=this.valueSize,o=(n-e)/(i-e);let l=t*a;for(let t=l+a;l!==t;l+=4)Vt.slerpFlat(r,0,s,l-a,s,l,o);return r}}class fc extends hc{InterpolantFactoryMethodLinear(t){return new mc(this.times,this.values,this.getValueSize(),t)}}fc.prototype.ValueTypeName="quaternion",fc.prototype.DefaultInterpolation=tt,fc.prototype.InterpolantFactoryMethodSmooth=void 0;class gc extends hc{}gc.prototype.ValueTypeName="string",gc.prototype.ValueBufferType=Array,gc.prototype.DefaultInterpolation=$,gc.prototype.InterpolantFactoryMethodLinear=void 0,gc.prototype.InterpolantFactoryMethodSmooth=void 0;class vc extends hc{}vc.prototype.ValueTypeName="vector";class xc{constructor(t,e=-1,n,i=2500){this.name=t,this.tracks=n,this.duration=e,this.blendMode=i,this.uuid=_t(),this.duration<0&&this.resetDuration()}static parse(t){const e=[],n=t.tracks,i=1/(t.fps||1);for(let t=0,r=n.length;t!==r;++t)e.push(yc(n[t]).scale(i));const r=new this(t.name,t.duration,e,t.blendMode);return r.uuid=t.uuid,r}static toJSON(t){const e=[],n=t.tracks,i={name:t.name,duration:t.duration,tracks:e,uuid:t.uuid,blendMode:t.blendMode};for(let t=0,i=n.length;t!==i;++t)e.push(hc.toJSON(n[t]));return i}static CreateFromMorphTargetSequence(t,e,n,i){const r=e.length,s=[];for(let t=0;t1){const t=s[1];let e=i[t];e||(i[t]=e=[]),e.push(n)}}const s=[];for(const t in i)s.push(this.CreateFromMorphTargetSequence(t,i[t],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,i,r){if(0!==n.length){const s=[],a=[];sc.flattenJSON(n,s,a,i),0!==s.length&&r.push(new t(e,s,a))}},i=[],r=t.name||"default",s=t.fps||30,a=t.blendMode;let o=t.length||-1;const l=t.hierarchy||[];for(let t=0;t{e&&e(r),this.manager.itemEnd(t)}),0),r;if(void 0!==Sc[t])return void Sc[t].push({onLoad:e,onProgress:n,onError:i});Sc[t]=[],Sc[t].push({onLoad:e,onProgress:n,onError:i});const s=new mt.Request(t,{headers:new mt.Headers(this.requestHeader),credentials:this.withCredentials?"include":"same-origin"}),a=this.mimeType,o=this.responseType;mt.fetch(s).then((e=>{if(200===e.status||0===e.status){if(0===e.status&&console.warn("THREE.FileLoader: HTTP Status 0 received."),"undefined"==typeof ReadableStream||void 0===e.body||void 0===e.body.getReader)return e;const n=Sc[t],i=e.body.getReader(),r=e.headers.get("Content-Length"),s=r?parseInt(r):0,a=0!==s;let o=0;const l=new ReadableStream({start(t){!function e(){i.read().then((({done:i,value:r})=>{if(i)t.close();else{o+=r.byteLength;const i=new ProgressEvent("progress",{lengthComputable:a,loaded:o,total:s});for(let t=0,e=n.length;t{switch(o){case"arraybuffer":return t.arrayBuffer();case"blob":return t.blob();case"document":return t.text().then((t=>(new DOMParser).parseFromString(t,a)));case"json":return t.json();default:if(void 0===a)return t.text();{const e=/charset="?([^;"\s]*)"?/i.exec(a),n=e&&e[1]?e[1].toLowerCase():void 0,i=new TextDecoder(n);return t.arrayBuffer().then((t=>i.decode(t)))}}})).then((e=>{_c.add(t,e);const n=Sc[t];delete Sc[t];for(let t=0,i=n.length;t{const n=Sc[t];if(void 0===n)throw this.manager.itemError(t),e;delete Sc[t];for(let t=0,i=n.length;t{this.manager.itemEnd(t)})),this.manager.itemStart(t)}setResponseType(t){return this.responseType=t,this}setMimeType(t){return this.mimeType=t,this}}class Ec extends wc{constructor(t){super(t)}load(t,e,n,i){void 0!==this.path&&(t=this.path+t),t=this.manager.resolveURL(t);const r=this,s=_c.get(t);if(void 0!==s)return r.manager.itemStart(t),setTimeout((function(){e&&e(s),r.manager.itemEnd(t)}),0),s;const a=Dt("img");function o(){c(),_c.add(t,this),e&&e(this),r.manager.itemEnd(t)}function l(e){c(),i&&i(e),r.manager.itemError(t),r.manager.itemEnd(t)}function c(){a.removeEventListener("load",o,!1),a.removeEventListener("error",l,!1)}return a.addEventListener("load",o,!1),a.addEventListener("error",l,!1),"data:"!==t.substr(0,5)&&void 0!==this.crossOrigin&&(a.crossOrigin=this.crossOrigin),r.manager.itemStart(t),a.src=t,a}}class Ac extends wc{constructor(t){super(t)}load(t,e,n,i){const r=new ci,s=new Ec(this.manager);s.setCrossOrigin(this.crossOrigin),s.setPath(this.path);let a=0;function o(n){s.load(t[n],(function(t){r.images[n]=t,a++,6===a&&(r.needsUpdate=!0,e&&e(r))}),void 0,i)}for(let e=0;e0:i.vertexColors=t.vertexColors),void 0!==t.uniforms)for(const e in t.uniforms){const r=t.uniforms[e];switch(i.uniforms[e]={},r.type){case"t":i.uniforms[e].value=n(r.value);break;case"c":i.uniforms[e].value=(new dn).setHex(r.value);break;case"v2":i.uniforms[e].value=(new Rt).fromArray(r.value);break;case"v3":i.uniforms[e].value=(new kt).fromArray(r.value);break;case"v4":i.uniforms[e].value=(new Ut).fromArray(r.value);break;case"m3":i.uniforms[e].value=(new Ct).fromArray(r.value);break;case"m4":i.uniforms[e].value=(new _e).fromArray(r.value);break;default:i.uniforms[e].value=r.value}}if(void 0!==t.defines&&(i.defines=t.defines),void 0!==t.vertexShader&&(i.vertexShader=t.vertexShader),void 0!==t.fragmentShader&&(i.fragmentShader=t.fragmentShader),void 0!==t.extensions)for(const e in t.extensions)i.extensions[e]=t.extensions[e];if(void 0!==t.shading&&(i.flatShading=1===t.shading),void 0!==t.size&&(i.size=t.size),void 0!==t.sizeAttenuation&&(i.sizeAttenuation=t.sizeAttenuation),void 0!==t.map&&(i.map=n(t.map)),void 0!==t.matcap&&(i.matcap=n(t.matcap)),void 0!==t.alphaMap&&(i.alphaMap=n(t.alphaMap)),void 0!==t.bumpMap&&(i.bumpMap=n(t.bumpMap)),void 0!==t.bumpScale&&(i.bumpScale=t.bumpScale),void 0!==t.normalMap&&(i.normalMap=n(t.normalMap)),void 0!==t.normalMapType&&(i.normalMapType=t.normalMapType),void 0!==t.normalScale){let e=t.normalScale;!1===Array.isArray(e)&&(e=[e,e]),i.normalScale=(new Rt).fromArray(e)}return void 0!==t.displacementMap&&(i.displacementMap=n(t.displacementMap)),void 0!==t.displacementScale&&(i.displacementScale=t.displacementScale),void 0!==t.displacementBias&&(i.displacementBias=t.displacementBias),void 0!==t.roughnessMap&&(i.roughnessMap=n(t.roughnessMap)),void 0!==t.metalnessMap&&(i.metalnessMap=n(t.metalnessMap)),void 0!==t.emissiveMap&&(i.emissiveMap=n(t.emissiveMap)),void 0!==t.emissiveIntensity&&(i.emissiveIntensity=t.emissiveIntensity),void 0!==t.specularMap&&(i.specularMap=n(t.specularMap)),void 0!==t.specularIntensityMap&&(i.specularIntensityMap=n(t.specularIntensityMap)),void 0!==t.specularColorMap&&(i.specularColorMap=n(t.specularColorMap)),void 0!==t.envMap&&(i.envMap=n(t.envMap)),void 0!==t.envMapIntensity&&(i.envMapIntensity=t.envMapIntensity),void 0!==t.reflectivity&&(i.reflectivity=t.reflectivity),void 0!==t.refractionRatio&&(i.refractionRatio=t.refractionRatio),void 0!==t.lightMap&&(i.lightMap=n(t.lightMap)),void 0!==t.lightMapIntensity&&(i.lightMapIntensity=t.lightMapIntensity),void 0!==t.aoMap&&(i.aoMap=n(t.aoMap)),void 0!==t.aoMapIntensity&&(i.aoMapIntensity=t.aoMapIntensity),void 0!==t.gradientMap&&(i.gradientMap=n(t.gradientMap)),void 0!==t.clearcoatMap&&(i.clearcoatMap=n(t.clearcoatMap)),void 0!==t.clearcoatRoughnessMap&&(i.clearcoatRoughnessMap=n(t.clearcoatRoughnessMap)),void 0!==t.clearcoatNormalMap&&(i.clearcoatNormalMap=n(t.clearcoatNormalMap)),void 0!==t.clearcoatNormalScale&&(i.clearcoatNormalScale=(new Rt).fromArray(t.clearcoatNormalScale)),void 0!==t.transmissionMap&&(i.transmissionMap=n(t.transmissionMap)),void 0!==t.thicknessMap&&(i.thicknessMap=n(t.thicknessMap)),void 0!==t.sheenColorMap&&(i.sheenColorMap=n(t.sheenColorMap)),void 0!==t.sheenRoughnessMap&&(i.sheenRoughnessMap=n(t.sheenRoughnessMap)),i}setTextures(t){return this.textures=t,this}}class Zc{static decodeText(t){if("undefined"!=typeof TextDecoder)return(new TextDecoder).decode(t);let e="";for(let n=0,i=t.length;n0){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,i,this._addIndex*e,1,e);for(let t=e,r=e+e;t!==r;++t)if(n[t]!==n[t+e]){a.setValue(n,i);break}}saveOriginalState(){const t=this.binding,e=this.buffer,n=this.valueSize,i=n*this._origIndex;t.getValue(e,i);for(let t=n,r=i;t!==r;++t)e[t]=e[i+t%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 i=0;i!==r;++i)t[e+i]=t[n+i]}_slerp(t,e,n,i){Vt.slerpFlat(t,e,t,e,t,n,i)}_slerpAdditive(t,e,n,i,r){const s=this._workIndex*r;Vt.multiplyQuaternionsFlat(t,s,t,e,t,n),Vt.slerpFlat(t,e,t,e,t,s,i)}_lerp(t,e,n,i,r){const s=1-i;for(let a=0;a!==r;++a){const r=e+a;t[r]=t[r]*s+t[n+a]*i}}_lerpAdditive(t,e,n,i,r){for(let s=0;s!==r;++s){const r=e+s;t[r]=t[r]+t[n+s]*i}}}const Sh="\\[\\]\\.:\\/",Th=new RegExp("[\\[\\]\\.:\\/]","g"),Eh="[^\\[\\]\\.:\\/]",Ah="[^"+Sh.replace("\\.","")+"]",Rh=/((?:WC+[\/:])*)/.source.replace("WC",Eh),Ch=/(WCOD+)?/.source.replace("WCOD",Ah),Lh=/(?:\.(WC+)(?:\[(.+)\])?)?/.source.replace("WC",Eh),Ph=/\.(WC+)(?:\[(.+)\])?/.source.replace("WC",Eh),Ih=new RegExp("^"+Rh+Ch+Lh+Ph+"$"),Dh=["material","materials","bones"];class Nh{constructor(t,e,n){this.path=e,this.parsedPath=n||Nh.parseTrackName(e),this.node=Nh.findNode(t,this.parsedPath.nodeName)||t,this.rootNode=t,this.getValue=this._getValue_unbound,this.setValue=this._setValue_unbound}static create(t,e,n){return t&&t.isAnimationObjectGroup?new Nh.Composite(t,e,n):new Nh(t,e,n)}static sanitizeNodeName(t){return t.replace(/\s/g,"_").replace(Th,"")}static parseTrackName(t){const e=Ih.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]},i=n.nodeName&&n.nodeName.lastIndexOf(".");if(void 0!==i&&-1!==i){const t=n.nodeName.substring(i+1);-1!==Dh.indexOf(t)&&(n.nodeName=n.nodeName.substring(0,i),n.objectName=t)}if(null===n.propertyName||0===n.propertyName.length)throw new Error("PropertyBinding: can not parse propertyName from trackName: "+t);return n}static findNode(t,e){if(!e||""===e||"."===e||-1===e||e===t.name||e===t.uuid||e===t.uniqueName)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 i=0;i=r){const s=r++,c=t[s];e[c.uuid]=l,t[l]=c,e[o]=s,t[s]=a;for(let t=0,e=i;t!==e;++t){const e=n[t],i=e[s],r=e[l];e[l]=i,e[s]=r}}}this.nCachedObjects_=r}uncache(){const t=this._objects,e=this._indicesByUUID,n=this._bindings,i=n.length;let r=this.nCachedObjects_,s=t.length;for(let a=0,o=arguments.length;a!==o;++a){const o=arguments[a].uuid,l=e[o];if(void 0!==l)if(delete e[o],l0&&(e[a.uuid]=l),t[l]=a,t.pop();for(let t=0,e=i;t!==e;++t){const e=n[t];e[l]=e[r],e.pop()}}}this.nCachedObjects_=r}subscribe_(t,e){const n=this._bindingsIndicesByPath;let i=n[t];const r=this._bindings;if(void 0!==i)return r[i];const s=this._paths,a=this._parsedPaths,o=this._objects,l=o.length,c=this.nCachedObjects_,h=new Array(l);i=r.length,n[t]=i,s.push(t),a.push(e),r.push(h);for(let n=c,i=o.length;n!==i;++n){const i=o[n];h[n]=new Nh(i,t,e)}return h}unsubscribe_(t){const e=this._bindingsIndicesByPath,n=e[t];if(void 0!==n){const i=this._paths,r=this._parsedPaths,s=this._bindings,a=s.length-1,o=s[a];e[t[a]]=n,s[n]=o,s.pop(),r[n]=r[a],r.pop(),i[n]=i[a],i.pop()}}}Oh.prototype.isAnimationObjectGroup=!0;class Bh{constructor(t,e,n=null,i=e.blendMode){this._mixer=t,this._clip=e,this._localRoot=n,this.blendMode=i;const r=e.tracks,s=r.length,a=new Array(s),o={endingStart:nt,endingEnd:nt};for(let t=0;t!==s;++t){const e=r[t].createInterpolant(null);a[t]=e,e.settings=o}this._interpolantSettings=o,this._interpolants=a,this._propertyBindings=new Array(s),this._cacheIndex=null,this._byClipCacheIndex=null,this._timeScaleInterpolant=null,this._weightInterpolant=null,this.loop=2201,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,i=t._clip.duration,r=i/n,s=n/i;t.warp(1,r,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 i=this._mixer,r=i.time,s=this.timeScale;let a=this._timeScaleInterpolant;null===a&&(a=i._lendControlInterpolant(),this._timeScaleInterpolant=a);const o=a.parameterPositions,l=a.sampleValues;return o[0]=r,o[1]=r+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,i){if(!this.enabled)return void this._updateWeight(t);const r=this._startTime;if(null!==r){const i=(t-r)*n;if(i<0||0===n)return;this._startTime=null,e=n*i}e*=this._updateTimeScale(t);const s=this._updateTime(e),a=this._updateWeight(t);if(a>0){const t=this._interpolants,e=this._propertyBindings;if(this.blendMode===at)for(let n=0,i=t.length;n!==i;++n)t[n].evaluate(s),e[n].accumulateAdditive(a);else for(let n=0,r=t.length;n!==r;++n)t[n].evaluate(s),e[n].accumulate(i,a)}}_updateWeight(t){let e=0;if(this.enabled){e=this.weight;const n=this._weightInterpolant;if(null!==n){const i=n.evaluate(t)[0];e*=i,t>n.parameterPositions[1]&&(this.stopFading(),0===i&&(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 i=this.time+t,r=this._loopCount;const s=2202===n;if(0===t)return-1===r?i:s&&1==(1&r)?e-i:i;if(2200===n){-1===r&&(this._loopCount=0,this._setEndings(!0,!0,!1));t:{if(i>=e)i=e;else{if(!(i<0)){this.time=i;break t}i=0}this.clampWhenFinished?this.paused=!0:this.enabled=!1,this.time=i,this._mixer.dispatchEvent({type:"finished",action:this,direction:t<0?-1:1})}}else{if(-1===r&&(t>=0?(r=0,this._setEndings(!0,0===this.repetitions,s)):this._setEndings(0===this.repetitions,!0,s)),i>=e||i<0){const n=Math.floor(i/e);i-=e*n,r+=Math.abs(n);const a=this.repetitions-r;if(a<=0)this.clampWhenFinished?this.paused=!0:this.enabled=!1,i=t>0?e:0,this.time=i,this._mixer.dispatchEvent({type:"finished",action:this,direction:t>0?1:-1});else{if(1===a){const e=t<0;this._setEndings(e,!e,s)}else this._setEndings(!1,!1,s);this._loopCount=r,this.time=i,this._mixer.dispatchEvent({type:"loop",action:this,loopDelta:n})}}else this.time=i;if(s&&1==(1&r))return e-i}return i}_setEndings(t,e,n){const i=this._interpolantSettings;n?(i.endingStart=it,i.endingEnd=it):(i.endingStart=t?this.zeroSlopeAtStart?it:nt:rt,i.endingEnd=e?this.zeroSlopeAtEnd?it:nt:rt)}_scheduleFading(t,e,n){const i=this._mixer,r=i.time;let s=this._weightInterpolant;null===s&&(s=i._lendControlInterpolant(),this._weightInterpolant=s);const a=s.parameterPositions,o=s.sampleValues;return a[0]=r,o[0]=e,a[1]=r+t,o[1]=n,this}}class zh extends ft{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,i=t._clip.tracks,r=i.length,s=t._propertyBindings,a=t._interpolants,o=n.uuid,l=this._bindingsByRootAndName;let c=l[o];void 0===c&&(c={},l[o]=c);for(let t=0;t!==r;++t){const r=i[t],l=r.name;let h=c[l];if(void 0!==h)++h.referenceCount,s[t]=h;else{if(h=s[t],void 0!==h){null===h._cacheIndex&&(++h.referenceCount,this._addInactiveBinding(h,o,l));continue}const i=e&&e._propertyBindings[t].binding.parsedPath;h=new wh(Nh.create(n,l,i),r.ValueTypeName,r.getValueSize()),++h.referenceCount,this._addInactiveBinding(h,o,l),s[t]=h}a[t].resultBuffer=h.buffer}}_activateAction(t){if(!this._isActiveAction(t)){if(null===t._cacheIndex){const e=(t._localRoot||this._root).uuid,n=t._clip.uuid,i=this._actionsByClip[n];this._bindAction(t,i&&i.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,i=this.time+=t,r=Math.sign(t),s=this._accuIndex^=1;for(let a=0;a!==n;++a){e[a]._update(i,t,r,s)}const a=this._bindings,o=this._nActiveBindings;for(let t=0;t!==o;++t)a[t].apply(s);return this}setTime(t){this.time=0;for(let t=0;tthis.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 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 e.copy(t).clamp(this.min,this.max)}distanceToPoint(t){return kh.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)}}Wh.prototype.isBox2=!0;const jh=new kt,qh=new kt;class Xh{constructor(t=new kt,e=new kt){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 t.addVectors(this.start,this.end).multiplyScalar(.5)}delta(t){return t.subVectors(this.end,this.start)}distanceSq(){return this.start.distanceToSquared(this.end)}distance(){return this.start.distanceTo(this.end)}at(t,e){return this.delta(e).multiplyScalar(t).add(this.start)}closestPointToPointParameter(t,e){jh.subVectors(t,this.start),qh.subVectors(this.end,this.start);const n=qh.dot(qh);let i=qh.dot(jh)/n;return e&&(i=Mt(i,0,1)),i}closestPointToPoint(t,e,n){const i=this.closestPointToPointParameter(t,e);return this.delta(n).multiplyScalar(i).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)}}const Yh=new kt;const Jh=new kt,Zh=new _e,Kh=new _e;class Qh extends co{constructor(t){const e=$h(t),n=new Nn,i=[],r=[],s=new dn(0,0,1),a=new dn(0,1,0);for(let t=0;t.99999)this.quaternion.set(0,0,0,1);else if(t.y<-.99999)this.quaternion.set(1,0,0,0);else{du.set(t.z,0,-t.x).normalize();const e=Math.acos(t.y);this.quaternion.setFromAxisAngle(du,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}},t.Audio=vh,t.AudioAnalyser=bh,t.AudioContext=rh,t.AudioListener=class extends je{constructor(){super(),this.type="AudioListener",this.context=rh.getContext(),this.gain=this.context.createGain(),this.gain.connect(this.context.destination),this.filter=null,this.timeDelta=0,this._clock=new uh}getInput(){return this.gain}removeFilter(){return null!==this.filter&&(this.gain.disconnect(this.filter),this.filter.disconnect(this.context.destination),this.gain.connect(this.context.destination),this.filter=null),this}getFilter(){return this.filter}setFilter(t){return null!==this.filter?(this.gain.disconnect(this.filter),this.filter.disconnect(this.context.destination)):this.gain.disconnect(this.context.destination),this.filter=t,this.gain.connect(this.filter),this.filter.connect(this.context.destination),this}getMasterVolume(){return this.gain.gain.value}setMasterVolume(t){return this.gain.gain.setTargetAtTime(t,this.context.currentTime,.01),this}updateMatrixWorld(t){super.updateMatrixWorld(t);const e=this.context.listener,n=this.up;if(this.timeDelta=this._clock.getDelta(),this.matrixWorld.decompose(ph,mh,fh),gh.set(0,0,-1).applyQuaternion(mh),e.positionX){const t=this.context.currentTime+this.timeDelta;e.positionX.linearRampToValueAtTime(ph.x,t),e.positionY.linearRampToValueAtTime(ph.y,t),e.positionZ.linearRampToValueAtTime(ph.z,t),e.forwardX.linearRampToValueAtTime(gh.x,t),e.forwardY.linearRampToValueAtTime(gh.y,t),e.forwardZ.linearRampToValueAtTime(gh.z,t),e.upX.linearRampToValueAtTime(n.x,t),e.upY.linearRampToValueAtTime(n.y,t),e.upZ.linearRampToValueAtTime(n.z,t)}else e.setPosition(ph.x,ph.y,ph.z),e.setOrientation(gh.x,gh.y,gh.z,n.x,n.y,n.z)}},t.AudioLoader=sh,t.AxesHelper=fu,t.AxisHelper=function(t){return console.warn("THREE.AxisHelper has been renamed to THREE.AxesHelper."),new fu(t)},t.BackSide=1,t.BasicDepthPacking=3200,t.BasicShadowMap=0,t.BinaryTextureLoader=function(t){return console.warn("THREE.BinaryTextureLoader has been renamed to THREE.DataTextureLoader."),new Rc(t)},t.Bone=ka,t.BooleanKeyframeTrack=uc,t.BoundingBoxHelper=function(t,e){return console.warn("THREE.BoundingBoxHelper has been deprecated. Creating a THREE.BoxHelper instead."),new uu(t,e)},t.Box2=Wh,t.Box3=qt,t.Box3Helper=class extends co{constructor(t,e=16776960){const n=new Uint16Array([0,1,1,2,2,3,3,0,4,5,5,6,6,7,7,4,0,4,1,5,2,6,3,7]),i=new Nn;i.setIndex(new gn(n,1)),i.setAttribute("position",new Tn([1,1,1,-1,1,1,-1,-1,1,1,-1,1,1,1,-1,-1,1,-1,-1,-1,-1,1,-1,-1],3)),super(i,new to({color:e,toneMapped:!1})),this.box=t,this.type="Box3Helper",this.geometry.computeBoundingSphere()}updateMatrixWorld(t){const e=this.box;e.isEmpty()||(e.getCenter(this.position),e.getSize(this.scale),this.scale.multiplyScalar(.5),super.updateMatrixWorld(t))}},t.BoxBufferGeometry=ti,t.BoxGeometry=ti,t.BoxHelper=uu,t.BufferAttribute=gn,t.BufferGeometry=Nn,t.BufferGeometryLoader=Qc,t.ByteType=1010,t.Cache=_c,t.Camera=si,t.CameraHelper=class extends co{constructor(t){const e=new Nn,n=new to({color:16777215,vertexColors:!0,toneMapped:!1}),i=[],r=[],s={},a=new dn(16755200),o=new dn(16711680),l=new dn(43775),c=new dn(16777215),h=new dn(3355443);function u(t,e,n){d(t,n),d(e,n)}function d(t,e){i.push(0,0,0),r.push(e.r,e.g,e.b),void 0===s[t]&&(s[t]=[]),s[t].push(i.length/3-1)}u("n1","n2",a),u("n2","n4",a),u("n4","n3",a),u("n3","n1",a),u("f1","f2",a),u("f2","f4",a),u("f4","f3",a),u("f3","f1",a),u("n1","f1",a),u("n2","f2",a),u("n3","f3",a),u("n4","f4",a),u("p","n1",o),u("p","n2",o),u("p","n3",o),u("p","n4",o),u("u1","u2",l),u("u2","u3",l),u("u3","u1",l),u("c","t",c),u("p","c",h),u("cn1","cn2",h),u("cn3","cn4",h),u("cf1","cf2",h),u("cf3","cf4",h),e.setAttribute("position",new Tn(i,3)),e.setAttribute("color",new Tn(r,3)),super(e,n),this.type="CameraHelper",this.camera=t,this.camera.updateProjectionMatrix&&this.camera.updateProjectionMatrix(),this.matrix=t.matrixWorld,this.matrixAutoUpdate=!1,this.pointMap=s,this.update()}update(){const t=this.geometry,e=this.pointMap;lu.projectionMatrixInverse.copy(this.camera.projectionMatrixInverse),cu("c",e,t,lu,0,0,-1),cu("t",e,t,lu,0,0,1),cu("n1",e,t,lu,-1,-1,-1),cu("n2",e,t,lu,1,-1,-1),cu("n3",e,t,lu,-1,1,-1),cu("n4",e,t,lu,1,1,-1),cu("f1",e,t,lu,-1,-1,1),cu("f2",e,t,lu,1,-1,1),cu("f3",e,t,lu,-1,1,1),cu("f4",e,t,lu,1,1,1),cu("u1",e,t,lu,.7,1.1,-1),cu("u2",e,t,lu,-.7,1.1,-1),cu("u3",e,t,lu,0,2,-1),cu("cf1",e,t,lu,-1,0,1),cu("cf2",e,t,lu,1,0,1),cu("cf3",e,t,lu,0,-1,1),cu("cf4",e,t,lu,0,1,1),cu("cn1",e,t,lu,-1,0,-1),cu("cn2",e,t,lu,1,0,-1),cu("cn3",e,t,lu,0,-1,-1),cu("cn4",e,t,lu,0,1,-1),t.getAttribute("position").needsUpdate=!0}dispose(){this.geometry.dispose(),this.material.dispose()}},t.CanvasRenderer=function(){console.error("THREE.CanvasRenderer has been removed")},t.CanvasTexture=bo,t.CatmullRomCurve3=Vo,t.CineonToneMapping=3,t.CircleBufferGeometry=So,t.CircleGeometry=So,t.ClampToEdgeWrapping=u,t.Clock=uh,t.Color=dn,t.ColorKeyframeTrack=dc,t.CompressedTexture=Mo,t.CompressedTextureLoader=class extends wc{constructor(t){super(t)}load(t,e,n,i){const r=this,s=[],a=new Mo,o=new Tc(this.manager);o.setPath(this.path),o.setResponseType("arraybuffer"),o.setRequestHeader(this.requestHeader),o.setWithCredentials(r.withCredentials);let l=0;function c(c){o.load(t[c],(function(t){const n=r.parse(t,!0);s[c]={width:n.width,height:n.height,format:n.format,mipmaps:n.mipmaps},l+=1,6===l&&(1===n.mipmapCount&&(a.minFilter=g),a.image=s,a.format=n.format,a.needsUpdate=!0,e&&e(a))}),n,i)}if(Array.isArray(t))for(let e=0,n=t.length;e65504&&(console.warn("THREE.DataUtils.toHalfFloat(): value exceeds 65504."),t=65504),vu[0]=t;const e=xu[0];let n=e>>16&32768,i=e>>12&2047;const r=e>>23&255;return r<103?n:r>142?(n|=31744,n|=(255==r?0:1)&&8388607&e,n):r<113?(i|=2048,n|=(i>>114-r)+(i>>113-r&1),n):(n|=r-112<<10|i>>1,n+=1&i,n)}},t.DecrementStencilOp=7683,t.DecrementWrapStencilOp=34056,t.DefaultLoadingManager=bc,t.DepthFormat=E,t.DepthStencilFormat=A,t.DepthTexture=oa,t.DirectionalLight=Wc,t.DirectionalLightHelper=class extends je{constructor(t,e,n){super(),this.light=t,this.light.updateMatrixWorld(),this.matrix=t.matrixWorld,this.matrixAutoUpdate=!1,this.color=n,void 0===e&&(e=1);let i=new Nn;i.setAttribute("position",new Tn([-e,e,0,e,e,0,e,-e,0,-e,-e,0,-e,e,0],3));const r=new to({fog:!1,toneMapped:!1});this.lightPlane=new ao(i,r),this.add(this.lightPlane),i=new Nn,i.setAttribute("position",new Tn([0,0,0,0,0,1],3)),this.targetLine=new ao(i,r),this.add(this.targetLine),this.update()}dispose(){this.lightPlane.geometry.dispose(),this.lightPlane.material.dispose(),this.targetLine.geometry.dispose(),this.targetLine.material.dispose()}update(){ru.setFromMatrixPosition(this.light.matrixWorld),su.setFromMatrixPosition(this.light.target.matrixWorld),au.subVectors(su,ru),this.lightPlane.lookAt(su),void 0!==this.color?(this.lightPlane.material.color.set(this.color),this.targetLine.material.color.set(this.color)):(this.lightPlane.material.color.copy(this.light.color),this.targetLine.material.color.copy(this.light.color)),this.targetLine.lookAt(su),this.targetLine.scale.z=au.length()}},t.DiscreteInterpolant=cc,t.DodecahedronBufferGeometry=Ro,t.DodecahedronGeometry=Ro,t.DoubleSide=2,t.DstAlphaFactor=206,t.DstColorFactor=208,t.DynamicBufferAttribute=function(t,e){return console.warn("THREE.DynamicBufferAttribute has been removed. Use new THREE.BufferAttribute().setUsage( THREE.DynamicDrawUsage ) instead."),new gn(t,e).setUsage(dt)},t.DynamicCopyUsage=35050,t.DynamicDrawUsage=dt,t.DynamicReadUsage=35049,t.EdgesGeometry=Do,t.EdgesHelper=function(t,e){return console.warn("THREE.EdgesHelper has been removed. Use THREE.EdgesGeometry instead."),new co(new Do(t.geometry),new to({color:void 0!==e?e:16777215}))},t.EllipseCurve=Oo,t.EqualDepth=4,t.EqualStencilFunc=514,t.EquirectangularReflectionMapping=a,t.EquirectangularRefractionMapping=o,t.Euler=Le,t.EventDispatcher=ft,t.ExternalTexture2D=wo,t.ExtrudeBufferGeometry=Pl,t.ExtrudeGeometry=Pl,t.FaceColors=1,t.FileLoader=Tc,t.FlatShading=1,t.Float16BufferAttribute=Sn,t.Float32Attribute=function(t,e){return console.warn("THREE.Float32Attribute has been removed. Use new THREE.Float32BufferAttribute() instead."),new Tn(t,e)},t.Float32BufferAttribute=Tn,t.Float64Attribute=function(t,e){return console.warn("THREE.Float64Attribute has been removed. Use new THREE.Float64BufferAttribute() instead."),new En(t,e)},t.Float64BufferAttribute=En,t.FloatType=b,t.Fog=pa,t.FogExp2=da,t.Font=function(){console.error("THREE.Font has been moved to /examples/jsm/loaders/FontLoader.js")},t.FontLoader=function(){console.error("THREE.FontLoader has been moved to /examples/jsm/loaders/FontLoader.js")},t.FramebufferTexture=_o,t.FrontSide=0,t.Frustum=vi,t.GLBufferAttribute=Hh,t.GLSL1="100",t.GLSL3=pt,t.GreaterDepth=6,t.GreaterEqualDepth=5,t.GreaterEqualStencilFunc=518,t.GreaterStencilFunc=516,t.GridHelper=iu,t.Group=ra,t.HalfFloatType=w,t.HemisphereLight=Pc,t.HemisphereLightHelper=class extends je{constructor(t,e,n){super(),this.light=t,this.light.updateMatrixWorld(),this.matrix=t.matrixWorld,this.matrixAutoUpdate=!1,this.color=n;const i=new Ol(e);i.rotateY(.5*Math.PI),this.material=new pn({wireframe:!0,fog:!1,toneMapped:!1}),void 0===this.color&&(this.material.vertexColors=!0);const r=i.getAttribute("position"),s=new Float32Array(3*r.count);i.setAttribute("color",new gn(s,3)),this.add(new Qn(i,this.material)),this.update()}dispose(){this.children[0].geometry.dispose(),this.children[0].material.dispose()}update(){const t=this.children[0];if(void 0!==this.color)this.material.color.set(this.color);else{const e=t.geometry.getAttribute("color");eu.copy(this.light.color),nu.copy(this.light.groundColor);for(let t=0,n=e.count;t0){const n=new Mc(e);r=new Ec(n),r.setCrossOrigin(this.crossOrigin);for(let e=0,n=t.length;e0){i=new Ec(this.manager),i.setCrossOrigin(this.crossOrigin);for(let e=0,i=t.length;eNumber.EPSILON){if(l<0&&(n=e[s],o=-o,a=e[r],l=-l),t.ya.y)continue;if(t.y===n.y){if(t.x===n.x)return!0}else{const e=l*(t.x-n.x)-o*(t.y-n.y);if(0===e)return!0;if(e<0)continue;i=!i}}else{if(t.y!==n.y)continue;if(a.x<=t.x&&t.x<=n.x||n.x<=t.x&&t.x<=a.x)return!0}}return i}const r=Rl.isClockWise,s=this.subPaths;if(0===s.length)return[];if(!0===e)return n(s);let a,o,l;const c=[];if(1===s.length)return o=s[0],l=new nl,l.curves=o.curves,c.push(l),c;let h=!r(s[0].getPoints());h=t?!h:h;const u=[],d=[];let p,m,f=[],g=0;d[g]=void 0,f[g]=[];for(let e=0,n=s.length;e1){let t=!1;const e=[];for(let t=0,e=d.length;t0&&(t||(f=u))}for(let t=0,e=d.length;twindow.devicePixelRatio});class ft{addEventListener(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(t,e){if(void 0===this._listeners)return!1;const n=this._listeners;return void 0!==n[t]&&-1!==n[t].indexOf(e)}removeEventListener(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(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,i=n.length;e>8&255]+gt[t>>16&255]+gt[t>>24&255]+"-"+gt[255&e]+gt[e>>8&255]+"-"+gt[e>>16&15|64]+gt[e>>24&255]+"-"+gt[63&n|128]+gt[n>>8&255]+"-"+gt[n>>16&255]+gt[n>>24&255]+gt[255&i]+gt[i>>8&255]+gt[i>>16&255]+gt[i>>24&255]).toUpperCase()}function Mt(t,e,n){return Math.max(e,Math.min(n,t))}function bt(t,e){return(t%e+e)%e}function wt(t,e,n){return(1-n)*t+n*e}function St(t){return 0==(t&t-1)&&0!==t}function Tt(t){return Math.pow(2,Math.ceil(Math.log(t)/Math.LN2))}function Et(t){return Math.pow(2,Math.floor(Math.log(t)/Math.LN2))}var At=Object.freeze({__proto__:null,DEG2RAD:xt,RAD2DEG:yt,generateUUID:_t,clamp:Mt,euclideanModulo:bt,mapLinear:function(t,e,n,i,r){return i+(t-e)*(r-i)/(n-e)},inverseLerp:function(t,e,n){return t!==e?(n-t)/(e-t):0},lerp:wt,damp:function(t,e,n,i){return wt(t,e,1-Math.exp(-n*i))},pingpong:function(t,e=1){return e-Math.abs(bt(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&&(vt=t%2147483647),vt=16807*vt%2147483647,(vt-1)/2147483646},degToRad:function(t){return t*xt},radToDeg:function(t){return t*yt},isPowerOfTwo:St,ceilPowerOfTwo:Tt,floorPowerOfTwo:Et,setQuaternionFromProperEuler:function(t,e,n,i,r){const s=Math.cos,a=Math.sin,o=s(n/2),l=a(n/2),c=s((e+i)/2),h=a((e+i)/2),u=s((e-i)/2),d=a((e-i)/2),p=s((i-e)/2),m=a((i-e)/2);switch(r){case"XYX":t.set(o*h,l*u,l*d,o*c);break;case"YZY":t.set(l*d,o*h,l*u,o*c);break;case"ZXZ":t.set(l*u,l*d,o*h,o*c);break;case"XZX":t.set(o*h,l*m,l*p,o*c);break;case"YXY":t.set(l*p,o*h,l*m,o*c);break;case"ZYZ":t.set(l*m,l*p,o*h,o*c);break;default:console.warn("THREE.MathUtils: .setQuaternionFromProperEuler() encountered an unknown order: "+r)}}});class Rt{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,i=t.elements;return this.x=i[0]*e+i[3]*n+i[6],this.y=i[1]*e+i[4]*n+i[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),i=Math.sin(e),r=this.x-t.x,s=this.y-t.y;return this.x=r*n-s*i+t.x,this.y=r*i+s*n+t.y,this}random(){return this.x=Math.random(),this.y=Math.random(),this}*[Symbol.iterator](){yield this.x,yield this.y}}Rt.prototype.isVector2=!0;class Ct{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,i,r,s,a,o,l){const c=this.elements;return c[0]=t,c[1]=i,c[2]=a,c[3]=e,c[4]=r,c[5]=o,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,i=e.elements,r=this.elements,s=n[0],a=n[3],o=n[6],l=n[1],c=n[4],h=n[7],u=n[2],d=n[5],p=n[8],m=i[0],f=i[3],g=i[6],v=i[1],x=i[4],y=i[7],_=i[2],M=i[5],b=i[8];return r[0]=s*m+a*v+o*_,r[3]=s*f+a*x+o*M,r[6]=s*g+a*y+o*b,r[1]=l*m+c*v+h*_,r[4]=l*f+c*x+h*M,r[7]=l*g+c*y+h*b,r[2]=u*m+d*v+p*_,r[5]=u*f+d*x+p*M,r[8]=u*g+d*y+p*b,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],i=t[2],r=t[3],s=t[4],a=t[5],o=t[6],l=t[7],c=t[8];return e*s*c-e*a*l-n*r*c+n*a*o+i*r*l-i*s*o}invert(){const t=this.elements,e=t[0],n=t[1],i=t[2],r=t[3],s=t[4],a=t[5],o=t[6],l=t[7],c=t[8],h=c*s-a*l,u=a*o-c*r,d=l*r-s*o,p=e*h+n*u+i*d;if(0===p)return this.set(0,0,0,0,0,0,0,0,0);const m=1/p;return t[0]=h*m,t[1]=(i*l-c*n)*m,t[2]=(a*n-i*s)*m,t[3]=u*m,t[4]=(c*e-i*o)*m,t[5]=(i*r-a*e)*m,t[6]=d*m,t[7]=(n*o-l*e)*m,t[8]=(s*e-n*r)*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,i,r,s,a){const o=Math.cos(r),l=Math.sin(r);return this.set(n*o,n*l,-n*(o*s+l*a)+s+t,-i*l,i*o,-i*(-l*s+o*a)+a+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),i=this.elements,r=i[0],s=i[3],a=i[6],o=i[1],l=i[4],c=i[7];return i[0]=e*r+n*o,i[3]=e*s+n*l,i[6]=e*a+n*c,i[1]=-n*r+e*o,i[4]=-n*s+e*l,i[7]=-n*a+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 t=0;t<9;t++)if(e[t]!==n[t])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)}}function Lt(t){for(let e=t.length-1;e>=0;--e)if(t[e]>65535)return!0;return!1}Ct.prototype.isMatrix3=!0;const Pt={Int8Array:Int8Array,Uint8Array:Uint8Array,Uint8ClampedArray:Uint8ClampedArray,Int16Array:Int16Array,Uint16Array:Uint16Array,Int32Array:Int32Array,Uint32Array:Uint32Array,Float32Array:Float32Array,Float64Array:Float64Array};function It(t,e){return new Pt[t](e)}function Dt(t){return mt.createElementNS("http://www.w3.org/1999/xhtml",t)}let Nt;class Ot{static getDataURL(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===Nt&&(Nt=Dt("canvas")),Nt.width=t.width,Nt.height=t.height;const n=Nt.getContext("2d");t instanceof ImageData?n.putImageData(t,0,0):n.drawImage(t,0,0,t.width,t.height),e=Nt}return e.width>2048||e.height>2048?(console.warn("THREE.ImageUtils.getDataURL: Image converted to jpg for performance reasons",t),e.toDataURL("image/jpeg",.6)):e.toDataURL("image/png")}}let Bt=0;class zt extends ft{constructor(t=zt.DEFAULT_IMAGE,e=zt.DEFAULT_MAPPING,n=1001,i=1001,r=1006,s=1008,a=1023,o=1009,l=1,c=3e3){super(),Object.defineProperty(this,"id",{value:Bt++}),this.uuid=_t(),this.name="",this.image=t,this.mipmaps=[],this.mapping=e,this.wrapS=n,this.wrapT=i,this.magFilter=r,this.minFilter=s,this.anisotropy=l,this.format=a,this.internalFormat=null,this.type=o,this.offset=new Rt(0,0),this.repeat=new Rt(1,1),this.center=new Rt(0,0),this.rotation=0,this.matrixAutoUpdate=!0,this.matrix=new Ct,this.generateMipmaps=!0,this.premultiplyAlpha=!1,this.flipY=!0,this.unpackAlignment=4,this.encoding=c,this.userData={},this.version=0,this.onUpdate=null,this.isRenderTargetTexture=!1,this.needsPMREMUpdate=!1,this.sRGBToLinearWithShader=!zt.useSrgbTextures}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.userData=JSON.parse(JSON.stringify(t.userData)),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 i=this.image;if(void 0===i.uuid&&(i.uuid=_t()),!e&&void 0===t.images[i.uuid]){let e;if(Array.isArray(i)){e=[];for(let t=0,n=i.length;t1)switch(this.wrapS){case h:t.x=t.x-Math.floor(t.x);break;case u:t.x=t.x<0?0:1;break;case d: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 h:t.y=t.y-Math.floor(t.y);break;case u:t.y=t.y<0?0:1;break;case d: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 Ft(t){return"undefined"!=typeof HTMLImageElement&&t instanceof HTMLImageElement||"undefined"!=typeof HTMLCanvasElement&&t instanceof HTMLCanvasElement||"undefined"!=typeof ImageBitmap&&t instanceof ImageBitmap?Ot.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."),{})}zt.DEFAULT_IMAGE=void 0,zt.DEFAULT_MAPPING=i,zt.useSrgbTextures=!0,zt.prototype.isTexture=!0;class Ut{constructor(t=0,e=0,n=0,i=1){this.x=t,this.y=e,this.z=n,this.w=i}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,i){return this.x=t,this.y=e,this.z=n,this.w=i,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}applyQuaternion(t){const e=this.x,n=this.y,i=this.z,r=this.w,s=t.x,a=t.y,o=t.z,l=t.w,c=l*e+a*i-o*n,h=l*n+o*e-s*i,u=l*i+s*n-a*e,d=-s*e-a*n-o*i;return this.x=c*l+d*-s+h*-o-u*-a,this.y=h*l+d*-a+u*-s-c*-o,this.z=u*l+d*-o+c*-a-h*-s,this.w=r,this}applyMatrix4(t){const e=this.x,n=this.y,i=this.z,r=this.w,s=t.elements;return this.x=s[0]*e+s[4]*n+s[8]*i+s[12]*r,this.y=s[1]*e+s[5]*n+s[9]*i+s[13]*r,this.z=s[2]*e+s[6]*n+s[10]*i+s[14]*r,this.w=s[3]*e+s[7]*n+s[11]*i+s[15]*r,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,i,r;const s=.01,a=.1,o=t.elements,l=o[0],c=o[4],h=o[8],u=o[1],d=o[5],p=o[9],m=o[2],f=o[6],g=o[10];if(Math.abs(c-u)o&&t>v?tv?o=0?1:-1,i=1-e*e;if(i>Number.EPSILON){const r=Math.sqrt(i),s=Math.atan2(r,e*n);t=Math.sin(t*s)/r,a=Math.sin(a*s)/r}const r=a*n;if(o=o*t+u*r,l=l*t+d*r,c=c*t+p*r,h=h*t+m*r,t===1-a){const t=1/Math.sqrt(o*o+l*l+c*c+h*h);o*=t,l*=t,c*=t,h*=t}}t[e]=o,t[e+1]=l,t[e+2]=c,t[e+3]=h}static multiplyQuaternionsFlat(t,e,n,i,r,s){const a=n[i],o=n[i+1],l=n[i+2],c=n[i+3],h=r[s],u=r[s+1],d=r[s+2],p=r[s+3];return t[e]=a*p+c*h+o*d-l*u,t[e+1]=o*p+c*u+l*h-a*d,t[e+2]=l*p+c*d+a*u-o*h,t[e+3]=c*p-a*h-o*u-l*d,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,i){return this._x=t,this._y=e,this._z=n,this._w=i,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,i=t._y,r=t._z,s=t._order,a=Math.cos,o=Math.sin,l=a(n/2),c=a(i/2),h=a(r/2),u=o(n/2),d=o(i/2),p=o(r/2);switch(s){case"XYZ":this._x=u*c*h+l*d*p,this._y=l*d*h-u*c*p,this._z=l*c*p+u*d*h,this._w=l*c*h-u*d*p;break;case"YXZ":this._x=u*c*h+l*d*p,this._y=l*d*h-u*c*p,this._z=l*c*p-u*d*h,this._w=l*c*h+u*d*p;break;case"ZXY":this._x=u*c*h-l*d*p,this._y=l*d*h+u*c*p,this._z=l*c*p+u*d*h,this._w=l*c*h-u*d*p;break;case"ZYX":this._x=u*c*h-l*d*p,this._y=l*d*h+u*c*p,this._z=l*c*p-u*d*h,this._w=l*c*h+u*d*p;break;case"YZX":this._x=u*c*h+l*d*p,this._y=l*d*h+u*c*p,this._z=l*c*p-u*d*h,this._w=l*c*h-u*d*p;break;case"XZY":this._x=u*c*h-l*d*p,this._y=l*d*h-u*c*p,this._z=l*c*p+u*d*h,this._w=l*c*h+u*d*p;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,i=Math.sin(n);return this._x=t.x*i,this._y=t.y*i,this._z=t.z*i,this._w=Math.cos(n),this._onChangeCallback(),this}setFromRotationMatrix(t){const e=t.elements,n=e[0],i=e[4],r=e[8],s=e[1],a=e[5],o=e[9],l=e[2],c=e[6],h=e[10],u=n+a+h;if(u>0){const t=.5/Math.sqrt(u+1);this._w=.25/t,this._x=(c-o)*t,this._y=(r-l)*t,this._z=(s-i)*t}else if(n>a&&n>h){const t=2*Math.sqrt(1+n-a-h);this._w=(c-o)/t,this._x=.25*t,this._y=(i+s)/t,this._z=(r+l)/t}else if(a>h){const t=2*Math.sqrt(1+a-n-h);this._w=(r-l)/t,this._x=(i+s)/t,this._y=.25*t,this._z=(o+c)/t}else{const t=2*Math.sqrt(1+h-n-a);this._w=(s-i)/t,this._x=(r+l)/t,this._y=(o+c)/t,this._z=.25*t}return this._onChangeCallback(),this}setFromUnitVectors(t,e){let n=t.dot(e)+1;return nMath.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(Mt(this.dot(t),-1,1)))}rotateTowards(t,e){const n=this.angleTo(t);if(0===n)return this;const i=Math.min(1,e/n);return this.slerp(t,i),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,i=t._y,r=t._z,s=t._w,a=e._x,o=e._y,l=e._z,c=e._w;return this._x=n*c+s*a+i*l-r*o,this._y=i*c+s*o+r*a-n*l,this._z=r*c+s*l+n*o-i*a,this._w=s*c-n*a-i*o-r*l,this._onChangeCallback(),this}slerp(t,e){if(0===e)return this;if(1===e)return this.copy(t);const n=this._x,i=this._y,r=this._z,s=this._w;let a=s*t._w+n*t._x+i*t._y+r*t._z;if(a<0?(this._w=-t._w,this._x=-t._x,this._y=-t._y,this._z=-t._z,a=-a):this.copy(t),a>=1)return this._w=s,this._x=n,this._y=i,this._z=r,this;const o=1-a*a;if(o<=Number.EPSILON){const t=1-e;return this._w=t*s+e*this._w,this._x=t*n+e*this._x,this._y=t*i+e*this._y,this._z=t*r+e*this._z,this.normalize(),this._onChangeCallback(),this}const l=Math.sqrt(o),c=Math.atan2(l,a),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=i*h+this._y*u,this._z=r*h+this._z*u,this._onChangeCallback(),this}slerpQuaternions(t,e,n){return this.copy(t).slerp(e,n)}random(){const t=Math.random(),e=Math.sqrt(1-t),n=Math.sqrt(t),i=2*Math.PI*Math.random(),r=2*Math.PI*Math.random();return this.set(e*Math.cos(i),n*Math.sin(r),n*Math.cos(r),e*Math.sin(i))}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(){}}Vt.prototype.isQuaternion=!0;class kt{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(jt.setFromEuler(t))}applyAxisAngle(t,e){return this.applyQuaternion(jt.setFromAxisAngle(t,e))}applyMatrix3(t){const e=this.x,n=this.y,i=this.z,r=t.elements;return this.x=r[0]*e+r[3]*n+r[6]*i,this.y=r[1]*e+r[4]*n+r[7]*i,this.z=r[2]*e+r[5]*n+r[8]*i,this}applyNormalMatrix(t){return this.applyMatrix3(t).normalize()}applyMatrix4(t){const e=this.x,n=this.y,i=this.z,r=t.elements,s=1/(r[3]*e+r[7]*n+r[11]*i+r[15]);return this.x=(r[0]*e+r[4]*n+r[8]*i+r[12])*s,this.y=(r[1]*e+r[5]*n+r[9]*i+r[13])*s,this.z=(r[2]*e+r[6]*n+r[10]*i+r[14])*s,this}applyQuaternion(t){const e=this.x,n=this.y,i=this.z,r=t.x,s=t.y,a=t.z,o=t.w,l=o*e+s*i-a*n,c=o*n+a*e-r*i,h=o*i+r*n-s*e,u=-r*e-s*n-a*i;return this.x=l*o+u*-r+c*-a-h*-s,this.y=c*o+u*-s+h*-r-l*-a,this.z=h*o+u*-a+l*-s-c*-r,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,i=this.z,r=t.elements;return this.x=r[0]*e+r[4]*n+r[8]*i,this.y=r[1]*e+r[5]*n+r[9]*i,this.z=r[2]*e+r[6]*n+r[10]*i,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,i=t.y,r=t.z,s=e.x,a=e.y,o=e.z;return this.x=i*o-r*a,this.y=r*s-n*o,this.z=n*a-i*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 Wt.copy(this).projectOnVector(t),this.sub(Wt)}reflect(t){return this.sub(Wt.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(Mt(n,-1,1))}distanceTo(t){return Math.sqrt(this.distanceToSquared(t))}distanceToSquared(t){const e=this.x-t.x,n=this.y-t.y,i=this.z-t.z;return e*e+n*n+i*i}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 i=Math.sin(e)*t;return this.x=i*Math.sin(n),this.y=Math.cos(e)*t,this.z=i*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(),i=this.setFromMatrixColumn(t,2).length();return this.x=e,this.y=n,this.z=i,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}randomDirection(){const t=2*(Math.random()-.5),e=Math.random()*Math.PI*2,n=Math.sqrt(1-t**2);return this.x=n*Math.cos(e),this.y=n*Math.sin(e),this.z=t,this}*[Symbol.iterator](){yield this.x,yield this.y,yield this.z}}kt.prototype.isVector3=!0;const Wt=new kt,jt=new Vt;class qt{constructor(t=new kt(1/0,1/0,1/0),e=new kt(-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,i=1/0,r=-1/0,s=-1/0,a=-1/0;for(let o=0,l=t.length;or&&(r=l),c>s&&(s=c),h>a&&(a=h)}return this.min.set(e,n,i),this.max.set(r,s,a),this}setFromBufferAttribute(t){let e=1/0,n=1/0,i=1/0,r=-1/0,s=-1/0,a=-1/0;for(let o=0,l=t.count;or&&(r=l),c>s&&(s=c),h>a&&(a=h)}return this.min.set(e,n,i),this.max.set(r,s,a),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 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,Yt),Yt.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(ne),ie.subVectors(this.max,ne),Zt.subVectors(t.a,ne),Kt.subVectors(t.b,ne),Qt.subVectors(t.c,ne),$t.subVectors(Kt,Zt),te.subVectors(Qt,Kt),ee.subVectors(Zt,Qt);let e=[0,-$t.z,$t.y,0,-te.z,te.y,0,-ee.z,ee.y,$t.z,0,-$t.x,te.z,0,-te.x,ee.z,0,-ee.x,-$t.y,$t.x,0,-te.y,te.x,0,-ee.y,ee.x,0];return!!ae(e,Zt,Kt,Qt,ie)&&(e=[1,0,0,0,1,0,0,0,1],!!ae(e,Zt,Kt,Qt,ie)&&(re.crossVectors($t,te),e=[re.x,re.y,re.z],ae(e,Zt,Kt,Qt,ie)))}clampPoint(t,e){return e.copy(t).clamp(this.min,this.max)}distanceToPoint(t){return Yt.copy(t).clamp(this.min,this.max).sub(t).length()}getBoundingSphere(t){return this.getCenter(t.center),t.radius=.5*this.getSize(Yt).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()||(Xt[0].set(this.min.x,this.min.y,this.min.z).applyMatrix4(t),Xt[1].set(this.min.x,this.min.y,this.max.z).applyMatrix4(t),Xt[2].set(this.min.x,this.max.y,this.min.z).applyMatrix4(t),Xt[3].set(this.min.x,this.max.y,this.max.z).applyMatrix4(t),Xt[4].set(this.max.x,this.min.y,this.min.z).applyMatrix4(t),Xt[5].set(this.max.x,this.min.y,this.max.z).applyMatrix4(t),Xt[6].set(this.max.x,this.max.y,this.min.z).applyMatrix4(t),Xt[7].set(this.max.x,this.max.y,this.max.z).applyMatrix4(t),this.setFromPoints(Xt)),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)}}qt.prototype.isBox3=!0;const Xt=[new kt,new kt,new kt,new kt,new kt,new kt,new kt,new kt],Yt=new kt,Jt=new qt,Zt=new kt,Kt=new kt,Qt=new kt,$t=new kt,te=new kt,ee=new kt,ne=new kt,ie=new kt,re=new kt,se=new kt;function ae(t,e,n,i,r){for(let s=0,a=t.length-3;s<=a;s+=3){se.fromArray(t,s);const a=r.x*Math.abs(se.x)+r.y*Math.abs(se.y)+r.z*Math.abs(se.z),o=e.dot(se),l=n.dot(se),c=i.dot(se);if(Math.max(-Math.max(o,l,c),Math.min(o,l,c))>a)return!1}return!0}const oe=new qt,le=new kt,ce=new kt,he=new kt;class ue{constructor(t=new kt,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):oe.setFromPoints(t).getCenter(n);let i=0;for(let e=0,r=t.length;ethis.radius*this.radius&&(e.sub(this.center).normalize(),e.multiplyScalar(this.radius).add(this.center)),e}getBoundingBox(t){return 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}expandByPoint(t){he.subVectors(t,this.center);const e=he.lengthSq();if(e>this.radius*this.radius){const t=Math.sqrt(e),n=.5*(t-this.radius);this.center.add(he.multiplyScalar(n/t)),this.radius+=n}return this}union(t){return!0===this.center.equals(t.center)?ce.set(0,0,1).multiplyScalar(t.radius):ce.subVectors(t.center,this.center).normalize().multiplyScalar(t.radius),this.expandByPoint(le.copy(t.center).add(ce)),this.expandByPoint(le.copy(t.center).sub(ce)),this}equals(t){return t.center.equals(this.center)&&t.radius===this.radius}clone(){return(new this.constructor).copy(this)}}const de=new kt,pe=new kt,me=new kt,fe=new kt,ge=new kt,ve=new kt,xe=new kt;class ye{constructor(t=new kt,e=new kt(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 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,de)),this}closestPointToPoint(t,e){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=de.subVectors(t,this.origin).dot(this.direction);return e<0?this.origin.distanceToSquared(t):(de.copy(this.direction).multiplyScalar(e).add(this.origin),de.distanceToSquared(t))}distanceSqToSegment(t,e,n,i){pe.copy(t).add(e).multiplyScalar(.5),me.copy(e).sub(t).normalize(),fe.copy(this.origin).sub(pe);const r=.5*t.distanceTo(e),s=-this.direction.dot(me),a=fe.dot(this.direction),o=-fe.dot(me),l=fe.lengthSq(),c=Math.abs(1-s*s);let h,u,d,p;if(c>0)if(h=s*o-a,u=s*a-o,p=r*c,h>=0)if(u>=-p)if(u<=p){const t=1/c;h*=t,u*=t,d=h*(h+s*u+2*a)+u*(s*h+u+2*o)+l}else u=r,h=Math.max(0,-(s*u+a)),d=-h*h+u*(u+2*o)+l;else u=-r,h=Math.max(0,-(s*u+a)),d=-h*h+u*(u+2*o)+l;else u<=-p?(h=Math.max(0,-(-s*r+a)),u=h>0?-r:Math.min(Math.max(-r,-o),r),d=-h*h+u*(u+2*o)+l):u<=p?(h=0,u=Math.min(Math.max(-r,-o),r),d=u*(u+2*o)+l):(h=Math.max(0,-(s*r+a)),u=h>0?r:Math.min(Math.max(-r,-o),r),d=-h*h+u*(u+2*o)+l);else u=s>0?-r:r,h=Math.max(0,-(s*u+a)),d=-h*h+u*(u+2*o)+l;return n&&n.copy(this.direction).multiplyScalar(h).add(this.origin),i&&i.copy(me).multiplyScalar(u).add(pe),d}intersectSphere(t,e){de.subVectors(t.center,this.origin);const n=de.dot(this.direction),i=de.dot(de)-n*n,r=t.radius*t.radius;if(i>r)return null;const s=Math.sqrt(r-i),a=n-s,o=n+s;return a<0&&o<0?null:a<0?this.at(o,e):this.at(a,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);if(0===e)return!0;return t.normal.dot(this.direction)*e<0}intersectBox(t,e){let n,i,r,s,a,o;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,i=(t.max.x-u.x)*l):(n=(t.max.x-u.x)*l,i=(t.min.x-u.x)*l),c>=0?(r=(t.min.y-u.y)*c,s=(t.max.y-u.y)*c):(r=(t.max.y-u.y)*c,s=(t.min.y-u.y)*c),n>s||r>i?null:((r>n||n!=n)&&(n=r),(s=0?(a=(t.min.z-u.z)*h,o=(t.max.z-u.z)*h):(a=(t.max.z-u.z)*h,o=(t.min.z-u.z)*h),n>o||a>i?null:((a>n||n!=n)&&(n=a),(o=0?n:i,e)))}intersectsBox(t){return null!==this.intersectBox(t,de)}intersectTriangle(t,e,n,i,r){ge.subVectors(e,t),ve.subVectors(n,t),xe.crossVectors(ge,ve);let s,a=this.direction.dot(xe);if(a>0){if(i)return null;s=1}else{if(!(a<0))return null;s=-1,a=-a}fe.subVectors(this.origin,t);const o=s*this.direction.dot(ve.crossVectors(fe,ve));if(o<0)return null;const l=s*this.direction.dot(ge.cross(fe));if(l<0)return null;if(o+l>a)return null;const c=-s*fe.dot(xe);return c<0?null:this.at(c/a,r)}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)}}class _e{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,i,r,s,a,o,l,c,h,u,d,p,m,f){const g=this.elements;return g[0]=t,g[4]=e,g[8]=n,g[12]=i,g[1]=r,g[5]=s,g[9]=a,g[13]=o,g[2]=l,g[6]=c,g[10]=h,g[14]=u,g[3]=d,g[7]=p,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 _e).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,i=1/Me.setFromMatrixColumn(t,0).length(),r=1/Me.setFromMatrixColumn(t,1).length(),s=1/Me.setFromMatrixColumn(t,2).length();return e[0]=n[0]*i,e[1]=n[1]*i,e[2]=n[2]*i,e[3]=0,e[4]=n[4]*r,e[5]=n[5]*r,e[6]=n[6]*r,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,i=t.y,r=t.z,s=Math.cos(n),a=Math.sin(n),o=Math.cos(i),l=Math.sin(i),c=Math.cos(r),h=Math.sin(r);if("XYZ"===t.order){const t=s*c,n=s*h,i=a*c,r=a*h;e[0]=o*c,e[4]=-o*h,e[8]=l,e[1]=n+i*l,e[5]=t-r*l,e[9]=-a*o,e[2]=r-t*l,e[6]=i+n*l,e[10]=s*o}else if("YXZ"===t.order){const t=o*c,n=o*h,i=l*c,r=l*h;e[0]=t+r*a,e[4]=i*a-n,e[8]=s*l,e[1]=s*h,e[5]=s*c,e[9]=-a,e[2]=n*a-i,e[6]=r+t*a,e[10]=s*o}else if("ZXY"===t.order){const t=o*c,n=o*h,i=l*c,r=l*h;e[0]=t-r*a,e[4]=-s*h,e[8]=i+n*a,e[1]=n+i*a,e[5]=s*c,e[9]=r-t*a,e[2]=-s*l,e[6]=a,e[10]=s*o}else if("ZYX"===t.order){const t=s*c,n=s*h,i=a*c,r=a*h;e[0]=o*c,e[4]=i*l-n,e[8]=t*l+r,e[1]=o*h,e[5]=r*l+t,e[9]=n*l-i,e[2]=-l,e[6]=a*o,e[10]=s*o}else if("YZX"===t.order){const t=s*o,n=s*l,i=a*o,r=a*l;e[0]=o*c,e[4]=r-t*h,e[8]=i*h+n,e[1]=h,e[5]=s*c,e[9]=-a*c,e[2]=-l*c,e[6]=n*h+i,e[10]=t-r*h}else if("XZY"===t.order){const t=s*o,n=s*l,i=a*o,r=a*l;e[0]=o*c,e[4]=-h,e[8]=l*c,e[1]=t*h+r,e[5]=s*c,e[9]=n*h-i,e[2]=i*h-n,e[6]=a*c,e[10]=r*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(we,t,Se)}lookAt(t,e,n){const i=this.elements;return Ae.subVectors(t,e),0===Ae.lengthSq()&&(Ae.z=1),Ae.normalize(),Te.crossVectors(n,Ae),0===Te.lengthSq()&&(1===Math.abs(n.z)?Ae.x+=1e-4:Ae.z+=1e-4,Ae.normalize(),Te.crossVectors(n,Ae)),Te.normalize(),Ee.crossVectors(Ae,Te),i[0]=Te.x,i[4]=Ee.x,i[8]=Ae.x,i[1]=Te.y,i[5]=Ee.y,i[9]=Ae.y,i[2]=Te.z,i[6]=Ee.z,i[10]=Ae.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,i=e.elements,r=this.elements,s=n[0],a=n[4],o=n[8],l=n[12],c=n[1],h=n[5],u=n[9],d=n[13],p=n[2],m=n[6],f=n[10],g=n[14],v=n[3],x=n[7],y=n[11],_=n[15],M=i[0],b=i[4],w=i[8],S=i[12],T=i[1],E=i[5],A=i[9],R=i[13],C=i[2],L=i[6],P=i[10],I=i[14],D=i[3],N=i[7],O=i[11],B=i[15];return r[0]=s*M+a*T+o*C+l*D,r[4]=s*b+a*E+o*L+l*N,r[8]=s*w+a*A+o*P+l*O,r[12]=s*S+a*R+o*I+l*B,r[1]=c*M+h*T+u*C+d*D,r[5]=c*b+h*E+u*L+d*N,r[9]=c*w+h*A+u*P+d*O,r[13]=c*S+h*R+u*I+d*B,r[2]=p*M+m*T+f*C+g*D,r[6]=p*b+m*E+f*L+g*N,r[10]=p*w+m*A+f*P+g*O,r[14]=p*S+m*R+f*I+g*B,r[3]=v*M+x*T+y*C+_*D,r[7]=v*b+x*E+y*L+_*N,r[11]=v*w+x*A+y*P+_*O,r[15]=v*S+x*R+y*I+_*B,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],i=t[8],r=t[12],s=t[1],a=t[5],o=t[9],l=t[13],c=t[2],h=t[6],u=t[10],d=t[14];return t[3]*(+r*o*h-i*l*h-r*a*u+n*l*u+i*a*d-n*o*d)+t[7]*(+e*o*d-e*l*u+r*s*u-i*s*d+i*l*c-r*o*c)+t[11]*(+e*l*h-e*a*d-r*s*h+n*s*d+r*a*c-n*l*c)+t[15]*(-i*a*c-e*o*h+e*a*u+i*s*h-n*s*u+n*o*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 i=this.elements;return t.isVector3?(i[12]=t.x,i[13]=t.y,i[14]=t.z):(i[12]=t,i[13]=e,i[14]=n),this}invert(){const t=this.elements,e=t[0],n=t[1],i=t[2],r=t[3],s=t[4],a=t[5],o=t[6],l=t[7],c=t[8],h=t[9],u=t[10],d=t[11],p=t[12],m=t[13],f=t[14],g=t[15],v=h*f*l-m*u*l+m*o*d-a*f*d-h*o*g+a*u*g,x=p*u*l-c*f*l-p*o*d+s*f*d+c*o*g-s*u*g,y=c*m*l-p*h*l+p*a*d-s*m*d-c*a*g+s*h*g,_=p*h*o-c*m*o-p*a*u+s*m*u+c*a*f-s*h*f,M=e*v+n*x+i*y+r*_;if(0===M)return this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);const b=1/M;return t[0]=v*b,t[1]=(m*u*r-h*f*r-m*i*d+n*f*d+h*i*g-n*u*g)*b,t[2]=(a*f*r-m*o*r+m*i*l-n*f*l-a*i*g+n*o*g)*b,t[3]=(h*o*r-a*u*r-h*i*l+n*u*l+a*i*d-n*o*d)*b,t[4]=x*b,t[5]=(c*f*r-p*u*r+p*i*d-e*f*d-c*i*g+e*u*g)*b,t[6]=(p*o*r-s*f*r-p*i*l+e*f*l+s*i*g-e*o*g)*b,t[7]=(s*u*r-c*o*r+c*i*l-e*u*l-s*i*d+e*o*d)*b,t[8]=y*b,t[9]=(p*h*r-c*m*r-p*n*d+e*m*d+c*n*g-e*h*g)*b,t[10]=(s*m*r-p*a*r+p*n*l-e*m*l-s*n*g+e*a*g)*b,t[11]=(c*a*r-s*h*r-c*n*l+e*h*l+s*n*d-e*a*d)*b,t[12]=_*b,t[13]=(c*m*i-p*h*i+p*n*u-e*m*u-c*n*f+e*h*f)*b,t[14]=(p*a*i-s*m*i-p*n*o+e*m*o+s*n*f-e*a*f)*b,t[15]=(s*h*i-c*a*i+c*n*o-e*h*o-s*n*u+e*a*u)*b,this}scale(t){const e=this.elements,n=t.x,i=t.y,r=t.z;return e[0]*=n,e[4]*=i,e[8]*=r,e[1]*=n,e[5]*=i,e[9]*=r,e[2]*=n,e[6]*=i,e[10]*=r,e[3]*=n,e[7]*=i,e[11]*=r,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],i=t[8]*t[8]+t[9]*t[9]+t[10]*t[10];return Math.sqrt(Math.max(e,n,i))}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),i=Math.sin(e),r=1-n,s=t.x,a=t.y,o=t.z,l=r*s,c=r*a;return this.set(l*s+n,l*a-i*o,l*o+i*a,0,l*a+i*o,c*a+n,c*o-i*s,0,l*o-i*a,c*o+i*s,r*o*o+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,i,r,s){return this.set(1,n,r,0,t,1,s,0,e,i,1,0,0,0,0,1),this}compose(t,e,n){const i=this.elements,r=e._x,s=e._y,a=e._z,o=e._w,l=r+r,c=s+s,h=a+a,u=r*l,d=r*c,p=r*h,m=s*c,f=s*h,g=a*h,v=o*l,x=o*c,y=o*h,_=n.x,M=n.y,b=n.z;return i[0]=(1-(m+g))*_,i[1]=(d+y)*_,i[2]=(p-x)*_,i[3]=0,i[4]=(d-y)*M,i[5]=(1-(u+g))*M,i[6]=(f+v)*M,i[7]=0,i[8]=(p+x)*b,i[9]=(f-v)*b,i[10]=(1-(u+m))*b,i[11]=0,i[12]=t.x,i[13]=t.y,i[14]=t.z,i[15]=1,this}decompose(t,e,n){const i=this.elements;let r=Me.set(i[0],i[1],i[2]).length();const s=Me.set(i[4],i[5],i[6]).length(),a=Me.set(i[8],i[9],i[10]).length();this.determinant()<0&&(r=-r),t.x=i[12],t.y=i[13],t.z=i[14],be.copy(this);const o=1/r,l=1/s,c=1/a;return be.elements[0]*=o,be.elements[1]*=o,be.elements[2]*=o,be.elements[4]*=l,be.elements[5]*=l,be.elements[6]*=l,be.elements[8]*=c,be.elements[9]*=c,be.elements[10]*=c,e.setFromRotationMatrix(be),n.x=r,n.y=s,n.z=a,this}makePerspective(t,e,n,i,r,s){void 0===s&&console.warn("THREE.Matrix4: .makePerspective() has been redefined and has a new signature. Please check the docs.");const a=this.elements,o=2*r/(e-t),l=2*r/(n-i),c=(e+t)/(e-t),h=(n+i)/(n-i),u=-(s+r)/(s-r),d=-2*s*r/(s-r);return a[0]=o,a[4]=0,a[8]=c,a[12]=0,a[1]=0,a[5]=l,a[9]=h,a[13]=0,a[2]=0,a[6]=0,a[10]=u,a[14]=d,a[3]=0,a[7]=0,a[11]=-1,a[15]=0,this}makeOrthographic(t,e,n,i,r,s){const a=this.elements,o=1/(e-t),l=1/(n-i),c=1/(s-r),h=(e+t)*o,u=(n+i)*l,d=(s+r)*c;return a[0]=2*o,a[4]=0,a[8]=0,a[12]=-h,a[1]=0,a[5]=2*l,a[9]=0,a[13]=-u,a[2]=0,a[6]=0,a[10]=-2*c,a[14]=-d,a[3]=0,a[7]=0,a[11]=0,a[15]=1,this}equals(t){const e=this.elements,n=t.elements;for(let t=0;t<16;t++)if(e[t]!==n[t])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}}_e.prototype.isMatrix4=!0;const Me=new kt,be=new _e,we=new kt(0,0,0),Se=new kt(1,1,1),Te=new kt,Ee=new kt,Ae=new kt,Re=new _e,Ce=new Vt;class Le{constructor(t=0,e=0,n=0,i=Le.DefaultOrder){this._x=t,this._y=e,this._z=n,this._order=i}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,i=this._order){return this._x=t,this._y=e,this._z=n,this._order=i,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=this._order,n=!0){const i=t.elements,r=i[0],s=i[4],a=i[8],o=i[1],l=i[5],c=i[9],h=i[2],u=i[6],d=i[10];switch(e){case"XYZ":this._y=Math.asin(Mt(a,-1,1)),Math.abs(a)<.9999999?(this._x=Math.atan2(-c,d),this._z=Math.atan2(-s,r)):(this._x=Math.atan2(u,l),this._z=0);break;case"YXZ":this._x=Math.asin(-Mt(c,-1,1)),Math.abs(c)<.9999999?(this._y=Math.atan2(a,d),this._z=Math.atan2(o,l)):(this._y=Math.atan2(-h,r),this._z=0);break;case"ZXY":this._x=Math.asin(Mt(u,-1,1)),Math.abs(u)<.9999999?(this._y=Math.atan2(-h,d),this._z=Math.atan2(-s,l)):(this._y=0,this._z=Math.atan2(o,r));break;case"ZYX":this._y=Math.asin(-Mt(h,-1,1)),Math.abs(h)<.9999999?(this._x=Math.atan2(u,d),this._z=Math.atan2(o,r)):(this._x=0,this._z=Math.atan2(-s,l));break;case"YZX":this._z=Math.asin(Mt(o,-1,1)),Math.abs(o)<.9999999?(this._x=Math.atan2(-c,l),this._y=Math.atan2(-h,r)):(this._x=0,this._y=Math.atan2(a,d));break;case"XZY":this._z=Math.asin(-Mt(s,-1,1)),Math.abs(s)<.9999999?(this._x=Math.atan2(u,l),this._y=Math.atan2(a,r)):(this._x=Math.atan2(-c,d),this._y=0);break;default:console.warn("THREE.Euler: .setFromRotationMatrix() encountered an unknown order: "+e)}return this._order=e,!0===n&&this._onChangeCallback(),this}setFromQuaternion(t,e,n){return Re.makeRotationFromQuaternion(t),this.setFromRotationMatrix(Re,e,n)}setFromVector3(t,e=this._order){return this.set(t.x,t.y,t.z,e)}reorder(t){return Ce.setFromEuler(this),this.setFromQuaternion(Ce,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 kt(this._x,this._y,this._z)}_onChange(t){return this._onChangeCallback=t,this}_onChangeCallback(){}}Le.prototype.isEuler=!0,Le.DefaultOrder="XYZ",Le.RotationOrders=["XYZ","YZX","ZXY","XZY","YXZ","ZYX"];class Pe{constructor(){this.mask=1}set(t){this.mask=(1<>>0}enable(t){this.mask|=1<1){for(let t=0;t1){for(let t=0;t0){i.children=[];for(let e=0;e0){i.animations=[];for(let e=0;e0&&(n.geometries=e),i.length>0&&(n.materials=i),r.length>0&&(n.textures=r),a.length>0&&(n.images=a),o.length>0&&(n.shapes=o),l.length>0&&(n.skeletons=l),c.length>0&&(n.animations=c)}return n.object=i,n;function s(t){const e=[];for(const n in t){const i=t[n];delete i.metadata,e.push(i)}return e}}clone(t){return(new this.constructor).copy(this,t)}copy(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 e=0;e0?i.multiplyScalar(1/Math.sqrt(r)):i.set(0,0,0)}static getBarycoord(t,e,n,i,r){qe.subVectors(i,e),Xe.subVectors(n,e),Ye.subVectors(t,e);const s=qe.dot(qe),a=qe.dot(Xe),o=qe.dot(Ye),l=Xe.dot(Xe),c=Xe.dot(Ye),h=s*l-a*a;if(0===h)return r.set(-2,-1,-1);const u=1/h,d=(l*o-a*c)*u,p=(s*c-a*o)*u;return r.set(1-d-p,p,d)}static containsPoint(t,e,n,i){return this.getBarycoord(t,e,n,i,Je),Je.x>=0&&Je.y>=0&&Je.x+Je.y<=1}static getUV(t,e,n,i,r,s,a,o){return this.getBarycoord(t,e,n,i,Je),o.set(0,0),o.addScaledVector(r,Je.x),o.addScaledVector(s,Je.y),o.addScaledVector(a,Je.z),o}static isFrontFacing(t,e,n,i){return qe.subVectors(n,e),Xe.subVectors(t,e),qe.cross(Xe).dot(i)<0}set(t,e,n){return this.a.copy(t),this.b.copy(e),this.c.copy(n),this}setFromPointsAndIndices(t,e,n,i){return this.a.copy(t[e]),this.b.copy(t[n]),this.c.copy(t[i]),this}setFromAttributeAndIndices(t,e,n,i){return this.a.fromBufferAttribute(t,e),this.b.fromBufferAttribute(t,n),this.c.fromBufferAttribute(t,i),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 qe.subVectors(this.c,this.b),Xe.subVectors(this.a,this.b),.5*qe.cross(Xe).length()}getMidpoint(t){return t.addVectors(this.a,this.b).add(this.c).multiplyScalar(1/3)}getNormal(t){return nn.getNormal(this.a,this.b,this.c,t)}getPlane(t){return t.setFromCoplanarPoints(this.a,this.b,this.c)}getBarycoord(t,e){return nn.getBarycoord(t,this.a,this.b,this.c,e)}getUV(t,e,n,i,r){return nn.getUV(t,this.a,this.b,this.c,e,n,i,r)}containsPoint(t){return nn.containsPoint(t,this.a,this.b,this.c)}isFrontFacing(t){return nn.isFrontFacing(this.a,this.b,this.c,t)}intersectsBox(t){return t.intersectsTriangle(this)}closestPointToPoint(t,e){const n=this.a,i=this.b,r=this.c;let s,a;Ze.subVectors(i,n),Ke.subVectors(r,n),$e.subVectors(t,n);const o=Ze.dot($e),l=Ke.dot($e);if(o<=0&&l<=0)return e.copy(n);tn.subVectors(t,i);const c=Ze.dot(tn),h=Ke.dot(tn);if(c>=0&&h<=c)return e.copy(i);const u=o*h-c*l;if(u<=0&&o>=0&&c<=0)return s=o/(o-c),e.copy(n).addScaledVector(Ze,s);en.subVectors(t,r);const d=Ze.dot(en),p=Ke.dot(en);if(p>=0&&d<=p)return e.copy(r);const m=d*l-o*p;if(m<=0&&l>=0&&p<=0)return a=l/(l-p),e.copy(n).addScaledVector(Ke,a);const f=c*p-d*h;if(f<=0&&h-c>=0&&d-p>=0)return Qe.subVectors(r,i),a=(h-c)/(h-c+(d-p)),e.copy(i).addScaledVector(Qe,a);const g=1/(f+m+u);return s=m*g,a=u*g,e.copy(n).addScaledVector(Ze,s).addScaledVector(Ke,a)}equals(t){return t.a.equals(this.a)&&t.b.equals(this.b)&&t.c.equals(this.c)}}let rn=0;class sn extends ft{constructor(){super(),Object.defineProperty(this,"id",{value:rn++}),this.uuid=_t(),this.name="",this.type="Material",this.fog=!0,this.blending=1,this.side=0,this.vertexColors=!1,this.opacity=1,this.transparent=!1,this.blendSrc=204,this.blendDst=205,this.blendEquation=n,this.blendSrcAlpha=null,this.blendDstAlpha=null,this.blendEquationAlpha=null,this.depthFunc=3,this.depthTest=!0,this.depthWrite=!0,this.stencilWriteMask=255,this.stencilFunc=519,this.stencilRef=0,this.stencilFuncMask=255,this.stencilFail=ht,this.stencilZFail=ht,this.stencilZPass=ht,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.alphaToCoverage=!1,this.premultipliedAlpha=!1,this.visible=!0,this.toneMapped=!0,this.userData={},this.version=0,this._alphaTest=0}get alphaTest(){return this._alphaTest}set alphaTest(t){this._alphaTest>0!=t>0&&this.version++,this._alphaTest=t}onBuild(){}onBeforeRender(){}onBeforeCompile(){}customProgramCacheKey(){return this.onBeforeCompile.toString()}setValues(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 i=this[e];void 0!==i?i&&i.isColor?i.set(n):i&&i.isVector3&&n&&n.isVector3?i.copy(n):this[e]=n:console.warn("THREE."+this.type+": '"+e+"' is not a property of this material.")}}toJSON(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 i(t){const e=[];for(const n in t){const i=t[n];delete i.metadata,e.push(i)}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),void 0!==this.sheen&&(n.sheen=this.sheen),this.sheenColor&&this.sheenColor.isColor&&(n.sheenColor=this.sheenColor.getHex()),void 0!==this.sheenRoughness&&(n.sheenRoughness=this.sheenRoughness),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.specularIntensity&&(n.specularIntensity=this.specularIntensity),this.specularColor&&this.specularColor.isColor&&(n.specularColor=this.specularColor.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.specularIntensityMap&&this.specularIntensityMap.isTexture&&(n.specularIntensityMap=this.specularIntensityMap.toJSON(t).uuid),this.specularColorMap&&this.specularColorMap.isTexture&&(n.specularColorMap=this.specularColorMap.toJSON(t).uuid),this.envMap&&this.envMap.isTexture&&(n.envMap=this.envMap.toJSON(t).uuid,void 0!==this.combine&&(n.combine=this.combine)),void 0!==this.envMapIntensity&&(n.envMapIntensity=this.envMapIntensity),void 0!==this.reflectivity&&(n.reflectivity=this.reflectivity),void 0!==this.refractionRatio&&(n.refractionRatio=this.refractionRatio),this.gradientMap&&this.gradientMap.isTexture&&(n.gradientMap=this.gradientMap.toJSON(t).uuid),void 0!==this.transmission&&(n.transmission=this.transmission),this.transmissionMap&&this.transmissionMap.isTexture&&(n.transmissionMap=this.transmissionMap.toJSON(t).uuid),void 0!==this.thickness&&(n.thickness=this.thickness),this.thicknessMap&&this.thicknessMap.isTexture&&(n.thicknessMap=this.thicknessMap.toJSON(t).uuid),void 0!==this.attenuationDistance&&(n.attenuationDistance=this.attenuationDistance),void 0!==this.attenuationColor&&(n.attenuationColor=this.attenuationColor.getHex()),void 0!==this.size&&(n.size=this.size),null!==this.shadowSide&&(n.shadowSide=this.shadowSide),void 0!==this.sizeAttenuation&&(n.sizeAttenuation=this.sizeAttenuation),1!==this.blending&&(n.blending=this.blending),0!==this.side&&(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.colorWrite=this.colorWrite,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.alphaToCoverage&&(n.alphaToCoverage=this.alphaToCoverage),!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.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=i(t.textures),r=i(t.images);e.length>0&&(n.textures=e),r.length>0&&(n.images=r)}return n}clone(){return(new this.constructor).copy(this)}copy(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 i=0;i!==t;++i)n[i]=e[i].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.alphaToCoverage=t.alphaToCoverage,this.premultipliedAlpha=t.premultipliedAlpha,this.visible=t.visible,this.toneMapped=t.toneMapped,this.userData=JSON.parse(JSON.stringify(t.userData)),this}dispose(){this.dispatchEvent({type:"dispose"})}set needsUpdate(t){!0===t&&this.version++}}sn.r115Compatible=!1,sn.prototype.isMaterial=!0;const an={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},on={h:0,s:0,l:0},ln={h:0,s:0,l:0};function cn(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 hn(t){return t<.04045?.0773993808*t:Math.pow(.9478672986*t+.0521327014,2.4)}function un(t){return t<.0031308?12.92*t:1.055*Math.pow(t,.41666)-.055}class dn{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=bt(t,1),e=Mt(e,0,1),n=Mt(n,0,1),0===e)this.r=this.g=this.b=n;else{const i=n<=.5?n*(1+e):n+e-n*e,r=2*n-i;this.r=cn(r,i,t+1/3),this.g=cn(r,i,t),this.b=cn(r,i,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 i=n[1],r=n[2];switch(i){case"rgb":case"rgba":if(t=/^\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(r))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(r))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(r)){const n=parseFloat(t[1])/360,i=parseInt(t[2],10)/100,r=parseInt(t[3],10)/100;return e(t[4]),this.setHSL(n,i,r)}}}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=an[t.toLowerCase()];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}copySRGBToLinear(t){return this.r=hn(t.r),this.g=hn(t.g),this.b=hn(t.b),this}copyLinearToSRGB(t){return this.r=un(t.r),this.g=un(t.g),this.b=un(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){const e=this.r,n=this.g,i=this.b,r=Math.max(e,n,i),s=Math.min(e,n,i);let a,o;const l=(s+r)/2;if(s===r)a=0,o=0;else{const t=r-s;switch(o=l<=.5?t/(r+s):t/(2-r-s),r){case e:a=(n-i)/t+(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 e in n){const i=n[e];t.data.attributes[e]=i.toJSON(t.data)}const i={};let r=!1;for(const e in this.morphAttributes){const n=this.morphAttributes[e],s=[];for(let e=0,i=n.length;e0&&(i[e]=s,r=!0)}r&&(t.data.morphAttributes=i,t.data.morphTargetsRelative=this.morphTargetsRelative);const s=this.groups;s.length>0&&(t.data.groups=JSON.parse(JSON.stringify(s)));const a=this.boundingSphere;return null!==a&&(t.data.boundingSphere={center:a.center.toArray(),radius:a.radius}),t}clone(){return(new this.constructor).copy(this)}copy(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 i=t.attributes;for(const t in i){const n=i[t];this.setAttribute(t,n.clone(e))}const r=t.morphAttributes;for(const t in r){const n=[],i=r[t];for(let t=0,r=i.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(t,e){const n=this.geometry,i=this.material,r=this.matrixWorld;if(void 0===i)return;if(null===n.boundingSphere&&n.computeBoundingSphere(),zn.copy(n.boundingSphere),zn.applyMatrix4(r),!1===t.ray.intersectsSphere(zn))return;if(On.copy(r).invert(),Bn.copy(t.ray).applyMatrix4(On),null!==n.boundingBox&&!1===Bn.intersectsBox(n.boundingBox))return;let s;if(n.isBufferGeometry){const r=n.index,a=n.attributes.position,o=n.morphAttributes.position,l=n.morphTargetsRelative,c=n.attributes.uv,h=n.attributes.uv2,u=n.groups,d=n.drawRange;if(null!==r)if(Array.isArray(i))for(let n=0,p=u.length;nn.far?null:{distance:c,point:Kn.clone(),object:t}}(t,e,n,i,Fn,Un,Hn,Zn);if(p){o&&(Xn.fromBufferAttribute(o,c),Yn.fromBufferAttribute(o,h),Jn.fromBufferAttribute(o,u),p.uv=nn.getUV(Zn,Fn,Un,Hn,Xn,Yn,Jn,new Rt)),l&&(Xn.fromBufferAttribute(l,c),Yn.fromBufferAttribute(l,h),Jn.fromBufferAttribute(l,u),p.uv2=nn.getUV(Zn,Fn,Un,Hn,Xn,Yn,Jn,new Rt));const t={a:c,b:h,c:u,normal:new kt,materialIndex:0};nn.getNormal(Fn,Un,Hn,t.normal),p.face=t}return p}Qn.prototype.isMesh=!0;class ti extends Nn{constructor(t=1,e=1,n=1,i=1,r=1,s=1){super(),this.type="BoxGeometry",this.parameters={width:t,height:e,depth:n,widthSegments:i,heightSegments:r,depthSegments:s};const a=this;i=Math.floor(i),r=Math.floor(r),s=Math.floor(s);const o=[],l=[],c=[],h=[];let u=0,d=0;function p(t,e,n,i,r,s,p,m,f,g,v){const x=s/f,y=p/g,_=s/2,M=p/2,b=m/2,w=f+1,S=g+1;let T=0,E=0;const A=new kt;for(let s=0;s0?1:-1,c.push(A.x,A.y,A.z),h.push(o/f),h.push(1-s/g),T+=1}}for(let t=0;t0&&(e.defines=this.defines),e.vertexShader=this.vertexShader,e.fragmentShader=this.fragmentShader;const n={};for(const t in this.extensions)!0===this.extensions[t]&&(n[t]=!0);return Object.keys(n).length>0&&(e.extensions=n),e}}ri.prototype.isShaderMaterial=!0;class si extends je{constructor(){super(),this.type="Camera",this.matrixWorldInverse=new _e,this.projectionMatrix=new _e,this.projectionMatrixInverse=new _e}copy(t,e){return super.copy(t,e),this.matrixWorldInverse.copy(t.matrixWorldInverse),this.projectionMatrix.copy(t.projectionMatrix),this.projectionMatrixInverse.copy(t.projectionMatrixInverse),this}getWorldDirection(t){this.updateWorldMatrix(!0,!1);const e=this.matrixWorld.elements;return t.set(-e[8],-e[9],-e[10]).normalize()}updateMatrixWorld(t){super.updateMatrixWorld(t),this.matrixWorldInverse.copy(this.matrixWorld).invert()}updateWorldMatrix(t,e){super.updateWorldMatrix(t,e),this.matrixWorldInverse.copy(this.matrixWorld).invert()}clone(){return(new this.constructor).copy(this)}}si.prototype.isCamera=!0;class ai extends si{constructor(t=50,e=1,n=.1,i=2e3){super(),this.type="PerspectiveCamera",this.fov=t,this.zoom=1,this.near=n,this.far=i,this.focus=10,this.aspect=e,this.view=null,this.filmGauge=35,this.filmOffset=0,this.updateProjectionMatrix()}copy(t,e){return super.copy(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(t){const e=.5*this.getFilmHeight()/t;this.fov=2*yt*Math.atan(e),this.updateProjectionMatrix()}getFocalLength(){const t=Math.tan(.5*xt*this.fov);return.5*this.getFilmHeight()/t}getEffectiveFOV(){return 2*yt*Math.atan(Math.tan(.5*xt*this.fov)/this.zoom)}getFilmWidth(){return this.filmGauge*Math.min(this.aspect,1)}getFilmHeight(){return this.filmGauge/Math.max(this.aspect,1)}setViewOffset(t,e,n,i,r,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=i,this.view.width=r,this.view.height=s,this.updateProjectionMatrix()}clearViewOffset(){null!==this.view&&(this.view.enabled=!1),this.updateProjectionMatrix()}updateProjectionMatrix(){const t=this.near;let e=t*Math.tan(.5*xt*this.fov)/this.zoom,n=2*e,i=this.aspect*n,r=-.5*i;const s=this.view;if(null!==this.view&&this.view.enabled){const t=s.fullWidth,a=s.fullHeight;r+=s.offsetX*i/t,e-=s.offsetY*n/a,i*=s.width/t,n*=s.height/a}const a=this.filmOffset;0!==a&&(r+=t*a/this.getFilmWidth()),this.projectionMatrix.makePerspective(r,r+i,e,e-n,t,this.far),this.projectionMatrixInverse.copy(this.projectionMatrix).invert()}toJSON(t){const e=super.toJSON(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}}ai.prototype.isPerspectiveCamera=!0;const oi=90;class li extends je{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 i=new ai(oi,1,t,e);i.layers=this.layers,i.up.set(0,-1,0),i.lookAt(new kt(1,0,0)),this.add(i);const r=new ai(oi,1,t,e);r.layers=this.layers,r.up.set(0,-1,0),r.lookAt(new kt(-1,0,0)),this.add(r);const s=new ai(oi,1,t,e);s.layers=this.layers,s.up.set(0,0,1),s.lookAt(new kt(0,1,0)),this.add(s);const a=new ai(oi,1,t,e);a.layers=this.layers,a.up.set(0,0,-1),a.lookAt(new kt(0,-1,0)),this.add(a);const o=new ai(oi,1,t,e);o.layers=this.layers,o.up.set(0,-1,0),o.lookAt(new kt(0,0,1)),this.add(o);const l=new ai(oi,1,t,e);l.layers=this.layers,l.up.set(0,-1,0),l.lookAt(new kt(0,0,-1)),this.add(l)}update(t,e){null===this.parent&&this.updateMatrixWorld();const n=this.renderTarget,[i,r,s,a,o,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,i),t.setRenderTarget(n,1),t.render(e,r),t.setRenderTarget(n,2),t.render(e,s),t.setRenderTarget(n,3),t.render(e,a),t.setRenderTarget(n,4),t.render(e,o),n.texture.generateMipmaps=u,t.setRenderTarget(n,5),t.render(e,l),t.setRenderTarget(h),t.xr.enabled=c,n.texture.needsPMREMUpdate=!0}}class ci extends zt{constructor(t,e,n,i,s,a,o,l,c,h){super(t=void 0!==t?t:[],e=void 0!==e?e:r,n,i,s,a,o,l,c,h),this.flipY=!1}get images(){return this.image}set images(t){this.image=t}}ci.prototype.isCubeTexture=!0;class hi extends Ht{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 ci(void 0,e.mapping,e.wrapS,e.wrapT,e.magFilter,e.minFilter,e.format,e.type,e.anisotropy,e.encoding),this.texture.isRenderTargetTexture=!0,this.texture.generateMipmaps=void 0!==e.generateMipmaps&&e.generateMipmaps,this.texture.minFilter=void 0!==e.minFilter?e.minFilter:g}fromEquirectangularTexture(t,e){this.texture.type=e.type,this.texture.format=T,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"},i=new ti(5,5,5),r=new ri({name:"CubemapFromEquirect",uniforms:ei(n.uniforms),vertexShader:n.vertexShader,fragmentShader:n.fragmentShader,side:1,blending:0});r.uniforms.tEquirect.value=e;const s=new Qn(i,r),a=e.minFilter;e.minFilter===x&&(e.minFilter=g);return new li(1,10,this).update(t,s),e.minFilter=a,s.geometry.dispose(),s.material.dispose(),this}clear(t,e,n,i){const r=t.getRenderTarget();for(let r=0;r<6;r++)t.setRenderTarget(this,r),t.clear(e,n,i);t.setRenderTarget(r)}}hi.prototype.isWebGLCubeRenderTarget=!0;const ui=new kt,di=new kt,pi=new Ct;class mi{constructor(t=new kt(1,0,0),e=0){this.normal=t,this.constant=e}set(t,e){return this.normal.copy(t),this.constant=e,this}setComponents(t,e,n,i){return this.normal.set(t,e,n),this.constant=i,this}setFromNormalAndCoplanarPoint(t,e){return this.normal.copy(t),this.constant=-e.dot(this.normal),this}setFromCoplanarPoints(t,e,n){const i=ui.subVectors(n,e).cross(di.subVectors(t,e)).normalize();return this.setFromNormalAndCoplanarPoint(i,t),this}copy(t){return this.normal.copy(t.normal),this.constant=t.constant,this}normalize(){const t=1/this.normal.length();return this.normal.multiplyScalar(t),this.constant*=t,this}negate(){return this.constant*=-1,this.normal.negate(),this}distanceToPoint(t){return this.normal.dot(t)+this.constant}distanceToSphere(t){return this.distanceToPoint(t.center)-t.radius}projectPoint(t,e){return e.copy(this.normal).multiplyScalar(-this.distanceToPoint(t)).add(t)}intersectLine(t,e){const n=t.delta(ui),i=this.normal.dot(n);if(0===i)return 0===this.distanceToPoint(t.start)?e.copy(t.start):null;const r=-(t.start.dot(this.normal)+this.constant)/i;return r<0||r>1?null:e.copy(n).multiplyScalar(r).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 t.copy(this.normal).multiplyScalar(-this.constant)}applyMatrix4(t,e){const n=e||pi.getNormalMatrix(t),i=this.coplanarPoint(ui).applyMatrix4(t),r=this.normal.applyMatrix3(n).normalize();return this.constant=-i.dot(r),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)}}mi.prototype.isPlane=!0;const fi=new ue,gi=new kt;class vi{constructor(t=new mi,e=new mi,n=new mi,i=new mi,r=new mi,s=new mi){this.planes=[t,e,n,i,r,s]}set(t,e,n,i,r,s){const a=this.planes;return a[0].copy(t),a[1].copy(e),a[2].copy(n),a[3].copy(i),a[4].copy(r),a[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,i=n[0],r=n[1],s=n[2],a=n[3],o=n[4],l=n[5],c=n[6],h=n[7],u=n[8],d=n[9],p=n[10],m=n[11],f=n[12],g=n[13],v=n[14],x=n[15];return e[0].setComponents(a-i,h-o,m-u,x-f).normalize(),e[1].setComponents(a+i,h+o,m+u,x+f).normalize(),e[2].setComponents(a+r,h+l,m+d,x+g).normalize(),e[3].setComponents(a-r,h-l,m-d,x-g).normalize(),e[4].setComponents(a-s,h-c,m-p,x-v).normalize(),e[5].setComponents(a+s,h+c,m+p,x+v).normalize(),this}intersectsObject(t){const e=t.geometry;if(null===e.boundingSphere&&e.computeBoundingSphere(),fi.copy(e.boundingSphere),t.skeleton&&t.skeleton.rootMotionBone){const e=t.skeleton.rootMotionBone.matrixWorld.clone();e.multiply(t.skeleton.rootMotionBoneInitialMatrixInverse),fi.applyMatrix4(e)}else fi.applyMatrix4(t.matrixWorld);return this.intersectsSphere(fi)}intersectsSprite(t){return fi.center.set(0,0,0),fi.radius=.7071067811865476,fi.applyMatrix4(t.matrixWorld),this.intersectsSphere(fi)}intersectsSphere(t){const e=this.planes,n=t.center,i=-t.radius;for(let t=0;t<6;t++){if(e[t].distanceToPoint(n)0?t.max.x:t.min.x,gi.y=i.normal.y>0?t.max.y:t.min.y,gi.z=i.normal.z>0?t.max.z:t.min.z,i.distanceToPoint(gi)<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 xi(){let t=null,e=!1,n=null,i=null;function r(e,s){n(e,s),i=t.requestAnimationFrame(r)}return{start:function(){!0!==e&&null!==n&&(i=t.requestAnimationFrame(r),e=!0)},stop:function(){t.cancelAnimationFrame(i),e=!1},setAnimationLoop:function(t){n=t},setContext:function(e){t=e}}}function yi(t,e){const n=e.isWebGL2,i=new WeakMap;return{get:function(t){return t.isInterleavedBufferAttribute&&(t=t.data),i.get(t)},remove:function(e){e.isInterleavedBufferAttribute&&(e=e.data);const n=i.get(e);n&&(t.deleteBuffer(n.buffer),i.delete(e))},update:function(e,r){if(e.isGLBufferAttribute){const t=i.get(e);return void((!t||t.version 0.0 ) ? v : 0.5 * inversesqrt( max( 1.0 - x * x, 1e-7 ) ) - v;\n\treturn cross( v1, v2 ) * theta_sintheta;\n}\nvec3 LTC_Evaluate( const in vec3 N, const in vec3 V, const in vec3 P, const in mat3 mInv, const in vec3 rectCoords[ 4 ] ) {\n\tvec3 v1 = rectCoords[ 1 ] - rectCoords[ 0 ];\n\tvec3 v2 = rectCoords[ 3 ] - rectCoords[ 0 ];\n\tvec3 lightNormal = cross( v1, v2 );\n\tif( dot( lightNormal, P - rectCoords[ 0 ] ) < 0.0 ) return vec3( 0.0 );\n\tvec3 T1, T2;\n\tT1 = normalize( V - N * dot( V, N ) );\n\tT2 = - cross( N, T1 );\n\tmat3 mat = mInv * transposeMat3( mat3( T1, T2, N ) );\n\tvec3 coords[ 4 ];\n\tcoords[ 0 ] = mat * ( rectCoords[ 0 ] - P );\n\tcoords[ 1 ] = mat * ( rectCoords[ 1 ] - P );\n\tcoords[ 2 ] = mat * ( rectCoords[ 2 ] - P );\n\tcoords[ 3 ] = mat * ( rectCoords[ 3 ] - P );\n\tcoords[ 0 ] = normalize( coords[ 0 ] );\n\tcoords[ 1 ] = normalize( coords[ 1 ] );\n\tcoords[ 2 ] = normalize( coords[ 2 ] );\n\tcoords[ 3 ] = normalize( coords[ 3 ] );\n\tvec3 vectorFormFactor = vec3( 0.0 );\n\tvectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 0 ], coords[ 1 ] );\n\tvectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 1 ], coords[ 2 ] );\n\tvectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 2 ], coords[ 3 ] );\n\tvectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 3 ], coords[ 0 ] );\n\tfloat result = LTC_ClippedSphereFormFactor( vectorFormFactor );\n\treturn vec3( result );\n}\nfloat G_BlinnPhong_Implicit( ) {\n\treturn 0.25;\n}\nfloat D_BlinnPhong( const in float shininess, const in float dotNH ) {\n\treturn RECIPROCAL_PI * ( shininess * 0.5 + 1.0 ) * pow( dotNH, shininess );\n}\nvec3 BRDF_BlinnPhong( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in vec3 specularColor, const in float shininess ) {\n\tvec3 halfDir = normalize( lightDir + viewDir );\n\tfloat dotNH = saturate( dot( normal, halfDir ) );\n\tfloat dotVH = saturate( dot( viewDir, halfDir ) );\n\tvec3 F = F_Schlick( specularColor, 1.0, dotVH );\n\tfloat G = G_BlinnPhong_Implicit( );\n\tfloat D = D_BlinnPhong( shininess, dotNH );\n\treturn F * ( G * D );\n}\n#if defined( USE_SHEEN )\nfloat D_Charlie( float roughness, float dotNH ) {\n\tfloat alpha = pow2( roughness );\n\tfloat invAlpha = 1.0 / alpha;\n\tfloat cos2h = dotNH * dotNH;\n\tfloat sin2h = max( 1.0 - cos2h, 0.0078125 );\n\treturn ( 2.0 + invAlpha ) * pow( sin2h, invAlpha * 0.5 ) / ( 2.0 * PI );\n}\nfloat V_Neubelt( float dotNV, float dotNL ) {\n\treturn saturate( 1.0 / ( 4.0 * ( dotNL + dotNV - dotNL * dotNV ) ) );\n}\nvec3 BRDF_Sheen( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, vec3 sheenColor, const in float sheenRoughness ) {\n\tvec3 halfDir = normalize( lightDir + viewDir );\n\tfloat dotNL = saturate( dot( normal, lightDir ) );\n\tfloat dotNV = saturate( dot( normal, viewDir ) );\n\tfloat dotNH = saturate( dot( normal, halfDir ) );\n\tfloat D = D_Charlie( sheenRoughness, dotNH );\n\tfloat V = V_Neubelt( dotNV, dotNL );\n\treturn sheenColor * ( D * V );\n}\n#endif",bumpmap_pars_fragment:"#ifdef USE_BUMPMAP\n\tuniform sampler2D bumpMap;\n\tuniform float bumpScale;\n\tvec2 dHdxy_fwd() {\n\t\tvec2 dSTdx = dFdx( vUv );\n\t\tvec2 dSTdy = dFdy( vUv );\n\t\tfloat Hll = bumpScale * texture2D( bumpMap, vUv ).x;\n\t\tfloat dBx = bumpScale * texture2D( bumpMap, vUv + dSTdx ).x - Hll;\n\t\tfloat dBy = bumpScale * texture2D( bumpMap, vUv + dSTdy ).x - Hll;\n\t\treturn vec2( dBx, dBy );\n\t}\n\tvec3 perturbNormalArb( vec3 surf_pos, vec3 surf_norm, vec2 dHdxy, float faceDirection ) {\n\t\tvec3 vSigmaX = vec3( dFdx( surf_pos.x ), dFdx( surf_pos.y ), dFdx( surf_pos.z ) );\n\t\tvec3 vSigmaY = vec3( dFdy( surf_pos.x ), dFdy( surf_pos.y ), dFdy( surf_pos.z ) );\n\t\tvec3 vN = surf_norm;\n\t\tvec3 R1 = cross( vSigmaY, vN );\n\t\tvec3 R2 = cross( vN, vSigmaX );\n\t\tfloat fDet = dot( vSigmaX, R1 ) * faceDirection;\n\t\tvec3 vGrad = sign( fDet ) * ( dHdxy.x * R1 + dHdxy.y * R2 );\n\t\treturn normalize( abs( fDet ) * surf_norm - vGrad );\n\t}\n#endif",clipping_planes_fragment:"#if NUM_CLIPPING_PLANES > 0\n\tvec4 plane;\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < UNION_CLIPPING_PLANES; i ++ ) {\n\t\tplane = clippingPlanes[ i ];\n\t\tif ( dot( vClipPosition, plane.xyz ) > plane.w ) discard;\n\t}\n\t#pragma unroll_loop_end\n\t#if UNION_CLIPPING_PLANES < NUM_CLIPPING_PLANES\n\t\tbool clipped = true;\n\t\t#pragma unroll_loop_start\n\t\tfor ( int i = UNION_CLIPPING_PLANES; i < NUM_CLIPPING_PLANES; i ++ ) {\n\t\t\tplane = clippingPlanes[ i ];\n\t\t\tclipped = ( dot( vClipPosition, plane.xyz ) > plane.w ) && clipped;\n\t\t}\n\t\t#pragma unroll_loop_end\n\t\tif ( clipped ) discard;\n\t#endif\n#endif",clipping_planes_pars_fragment:"#if NUM_CLIPPING_PLANES > 0\n\tvarying vec3 vClipPosition;\n\tuniform vec4 clippingPlanes[ NUM_CLIPPING_PLANES ];\n#endif",clipping_planes_pars_vertex:"#if NUM_CLIPPING_PLANES > 0\n\tvarying vec3 vClipPosition;\n#endif",clipping_planes_vertex:"#if NUM_CLIPPING_PLANES > 0\n\tvClipPosition = - mvPosition.xyz;\n#endif",color_fragment:"#if defined( USE_COLOR_ALPHA )\n\tdiffuseColor *= vColor;\n#elif defined( USE_COLOR )\n\tdiffuseColor.rgb *= vColor;\n#endif",color_pars_fragment:"#if defined( USE_COLOR_ALPHA )\n\tvarying vec4 vColor;\n#elif defined( USE_COLOR )\n\tvarying vec3 vColor;\n#endif",color_pars_vertex:"#if defined( USE_COLOR_ALPHA )\n\tvarying vec4 vColor;\n#elif defined( USE_COLOR ) || defined( USE_INSTANCING_COLOR )\n\tvarying vec3 vColor;\n#endif",color_vertex:"#if defined( USE_COLOR_ALPHA )\n\tvColor = vec4( 1.0 );\n#elif defined( USE_COLOR ) || defined( USE_INSTANCING_COLOR )\n\tvColor = vec3( 1.0 );\n#endif\n#ifdef USE_COLOR\n\tvColor *= color;\n#endif\n#ifdef USE_INSTANCING_COLOR\n\tvColor.xyz *= instanceColor.xyz;\n#endif",common:"#define PI 3.141592653589793\n#define PI2 6.283185307179586\n#define PI_HALF 1.5707963267948966\n#define RECIPROCAL_PI 0.3183098861837907\n#define RECIPROCAL_PI2 0.15915494309189535\n#define EPSILON 1e-6\n#ifndef saturate\n#define saturate( a ) clamp( a, 0.0, 1.0 )\n#endif\n#define whiteComplement( a ) ( 1.0 - saturate( a ) )\nfloat pow2( const in float x ) { return x*x; }\nfloat pow3( const in float x ) { return x*x*x; }\nfloat pow4( const in float x ) { float x2 = x*x; return x2*x2; }\nfloat max3( const in vec3 v ) { return max( max( v.x, v.y ), v.z ); }\nfloat average( const in vec3 color ) { return dot( color, vec3( 0.3333 ) ); }\nhighp float rand( const in vec2 uv ) {\n\tconst highp float a = 12.9898, b = 78.233, c = 43758.5453;\n\thighp float dt = dot( uv.xy, vec2( a,b ) ), sn = mod( dt, PI );\n\treturn fract( sin( sn ) * c );\n}\n#ifdef HIGH_PRECISION\n\tfloat precisionSafeLength( vec3 v ) { return length( v ); }\n#else\n\tfloat precisionSafeLength( vec3 v ) {\n\t\tfloat maxComponent = max3( abs( v ) );\n\t\treturn length( v / maxComponent ) * maxComponent;\n\t}\n#endif\nstruct IncidentLight {\n\tvec3 color;\n\tvec3 direction;\n\tbool visible;\n};\nstruct ReflectedLight {\n\tvec3 directDiffuse;\n\tvec3 directSpecular;\n\tvec3 indirectDiffuse;\n\tvec3 indirectSpecular;\n};\nstruct GeometricContext {\n\tvec3 position;\n\tvec3 viewDir;\n};\nvec3 transformDirection( in vec3 dir, in mat4 matrix ) {\n\treturn normalize( ( matrix * vec4( dir, 0.0 ) ).xyz );\n}\nvec3 inverseTransformDirection( in vec3 dir, in mat4 matrix ) {\n\treturn normalize( ( vec4( dir, 0.0 ) * matrix ).xyz );\n}\nmat3 transposeMat3( const in mat3 m ) {\n\tmat3 tmp;\n\ttmp[ 0 ] = vec3( m[ 0 ].x, m[ 1 ].x, m[ 2 ].x );\n\ttmp[ 1 ] = vec3( m[ 0 ].y, m[ 1 ].y, m[ 2 ].y );\n\ttmp[ 2 ] = vec3( m[ 0 ].z, m[ 1 ].z, m[ 2 ].z );\n\treturn tmp;\n}\nfloat linearToRelativeLuminance( const in vec3 color ) {\n\tvec3 weights = vec3( 0.2126, 0.7152, 0.0722 );\n\treturn dot( weights, color.rgb );\n}\nbool isPerspectiveMatrix( mat4 m ) {\n\treturn m[ 2 ][ 3 ] == - 1.0;\n}\nvec2 equirectUv( in vec3 dir ) {\n\tfloat u = atan( dir.z, dir.x ) * RECIPROCAL_PI2 + 0.5;\n\tfloat v = asin( clamp( dir.y, - 1.0, 1.0 ) ) * RECIPROCAL_PI + 0.5;\n\treturn vec2( u, v );\n}",cube_uv_reflection_fragment:"#ifdef ENVMAP_TYPE_CUBE_UV\n\t#define cubeUV_maxMipLevel 8.0\n\t#define cubeUV_minMipLevel 4.0\n\t#define cubeUV_maxTileSize 256.0\n\t#define cubeUV_minTileSize 16.0\n\tfloat getFace( vec3 direction ) {\n\t\tvec3 absDirection = abs( direction );\n\t\tfloat face = - 1.0;\n\t\tif ( absDirection.x > absDirection.z ) {\n\t\t\tif ( absDirection.x > absDirection.y )\n\t\t\t\tface = direction.x > 0.0 ? 0.0 : 3.0;\n\t\t\telse\n\t\t\t\tface = direction.y > 0.0 ? 1.0 : 4.0;\n\t\t} else {\n\t\t\tif ( absDirection.z > absDirection.y )\n\t\t\t\tface = direction.z > 0.0 ? 2.0 : 5.0;\n\t\t\telse\n\t\t\t\tface = direction.y > 0.0 ? 1.0 : 4.0;\n\t\t}\n\t\treturn face;\n\t}\n\tvec2 getUV( vec3 direction, float face ) {\n\t\tvec2 uv;\n\t\tif ( face == 0.0 ) {\n\t\t\tuv = vec2(-direction.z, direction.y) / abs(direction.x);\n\t\t} else if ( face == 1.0 ) {\n\t\t\tuv = vec2(direction.x, -direction.z) / abs(direction.y);\n\t\t} else if ( face == 2.0 ) {\n\t\t\tuv = direction.xy / abs(direction.z);\n\t\t} else if ( face == 3.0 ) {\n\t\t\tuv = vec2(direction.z, direction.y) / abs(direction.x);\n\t\t} else if ( face == 4.0 ) {\n\t\t\tuv = direction.xz / abs(direction.y);\n\t\t} else {\n\t\t\tuv = vec2(-direction.x, direction.y) / abs(direction.z);\n\t\t}\n\t\treturn 0.5 * ( uv + 1.0 );\n\t}\n\tvec3 bilinearCubeUV( sampler2D envMap, vec3 direction, float mipInt ) {\n\t\tfloat face = getFace( direction );\n\t\tfloat filterInt = max( cubeUV_minMipLevel - mipInt, 0.0 );\n\t\tmipInt = max( mipInt, cubeUV_minMipLevel );\n\t\tfloat faceSize = exp2( mipInt );\n\t\tfloat texelSize = 1.0 / ( 3.0 * cubeUV_maxTileSize );\n\t\tvec2 uv = getUV( direction, face ) * ( faceSize - 1.0 );\n\t\tvec2 f = fract( uv );\n\t\tuv += 0.5 - f;\n\t\tif ( face > 2.0 ) {\n\t\t\tuv.y += faceSize;\n\t\t\tface -= 3.0;\n\t\t}\n\t\tuv.x += face * faceSize;\n\t\tif ( mipInt < cubeUV_maxMipLevel ) {\n\t\t\tuv.y += 2.0 * cubeUV_maxTileSize;\n\t\t}\n\t\tuv.y += filterInt * 2.0 * cubeUV_minTileSize;\n\t\tuv.x += 3.0 * max( 0.0, cubeUV_maxTileSize - 2.0 * faceSize );\n\t\tuv *= texelSize;\n\t\tvec3 tl = envMapTexelToLinear( texture2D( envMap, uv ) ).rgb;\n\t\tuv.x += texelSize;\n\t\tvec3 tr = envMapTexelToLinear( texture2D( envMap, uv ) ).rgb;\n\t\tuv.y += texelSize;\n\t\tvec3 br = envMapTexelToLinear( texture2D( envMap, uv ) ).rgb;\n\t\tuv.x -= texelSize;\n\t\tvec3 bl = envMapTexelToLinear( texture2D( envMap, uv ) ).rgb;\n\t\tvec3 tm = mix( tl, tr, f.x );\n\t\tvec3 bm = mix( bl, br, f.x );\n\t\treturn mix( tm, bm, f.y );\n\t}\n\t#define r0 1.0\n\t#define v0 0.339\n\t#define m0 - 2.0\n\t#define r1 0.8\n\t#define v1 0.276\n\t#define m1 - 1.0\n\t#define r4 0.4\n\t#define v4 0.046\n\t#define m4 2.0\n\t#define r5 0.305\n\t#define v5 0.016\n\t#define m5 3.0\n\t#define r6 0.21\n\t#define v6 0.0038\n\t#define m6 4.0\n\tfloat roughnessToMip( float roughness ) {\n\t\tfloat mip = 0.0;\n\t\tif ( roughness >= r1 ) {\n\t\t\tmip = ( r0 - roughness ) * ( m1 - m0 ) / ( r0 - r1 ) + m0;\n\t\t} else if ( roughness >= r4 ) {\n\t\t\tmip = ( r1 - roughness ) * ( m4 - m1 ) / ( r1 - r4 ) + m1;\n\t\t} else if ( roughness >= r5 ) {\n\t\t\tmip = ( r4 - roughness ) * ( m5 - m4 ) / ( r4 - r5 ) + m4;\n\t\t} else if ( roughness >= r6 ) {\n\t\t\tmip = ( r5 - roughness ) * ( m6 - m5 ) / ( r5 - r6 ) + m5;\n\t\t} else {\n\t\t\tmip = - 2.0 * log2( 1.16 * roughness );\t\t}\n\t\treturn mip;\n\t}\n\tvec4 textureCubeUV( sampler2D envMap, vec3 sampleDir, float roughness ) {\n\t\tfloat mip = clamp( roughnessToMip( roughness ), m0, cubeUV_maxMipLevel );\n\t\tfloat mipF = fract( mip );\n\t\tfloat mipInt = floor( mip );\n\t\tvec3 color0 = bilinearCubeUV( envMap, sampleDir, mipInt );\n\t\tif ( mipF == 0.0 ) {\n\t\t\treturn vec4( color0, 1.0 );\n\t\t} else {\n\t\t\tvec3 color1 = bilinearCubeUV( envMap, sampleDir, mipInt + 1.0 );\n\t\t\treturn vec4( mix( color0, color1, mipF ), 1.0 );\n\t\t}\n\t}\n#endif",defaultnormal_vertex:"vec3 transformedNormal = objectNormal;\n#ifdef USE_INSTANCING\n\tmat3 m = mat3( instanceMatrix );\n\ttransformedNormal /= vec3( dot( m[ 0 ], m[ 0 ] ), dot( m[ 1 ], m[ 1 ] ), dot( m[ 2 ], m[ 2 ] ) );\n\ttransformedNormal = m * transformedNormal;\n#endif\ntransformedNormal = normalMatrix * transformedNormal;\n#ifdef FLIP_SIDED\n\ttransformedNormal = - transformedNormal;\n#endif\n#ifdef USE_TANGENT\n\tvec3 transformedTangent = ( modelViewMatrix * vec4( objectTangent, 0.0 ) ).xyz;\n\t#ifdef FLIP_SIDED\n\t\ttransformedTangent = - transformedTangent;\n\t#endif\n#endif",displacementmap_pars_vertex:"#ifdef USE_DISPLACEMENTMAP\n\tuniform sampler2D displacementMap;\n\tuniform float displacementScale;\n\tuniform float displacementBias;\n#endif",displacementmap_vertex:"#ifdef USE_DISPLACEMENTMAP\n\ttransformed += normalize( objectNormal ) * ( texture2D( displacementMap, vUv ).x * displacementScale + displacementBias );\n#endif",emissivemap_fragment:"#ifdef USE_EMISSIVEMAP\n\tvec4 emissiveColor = texture2D( emissiveMap, vUv );\n\temissiveColor.rgb = emissiveMapTexelToLinear( emissiveColor ).rgb;\n\ttotalEmissiveRadiance *= emissiveColor.rgb;\n#endif",emissivemap_pars_fragment:"#ifdef USE_EMISSIVEMAP\n\tuniform sampler2D emissiveMap;\n#endif",encodings_fragment:"gl_FragColor = linearToOutputTexel( gl_FragColor );",encodings_pars_fragment:"vec4 LinearToLinear( in vec4 value ) {\n\treturn value;\n}\nvec4 sRGBToLinear( in vec4 value ) {\n\treturn vec4( mix( pow( value.rgb * 0.9478672986 + vec3( 0.0521327014 ), vec3( 2.4 ) ), value.rgb * 0.0773993808, vec3( lessThanEqual( value.rgb, vec3( 0.04045 ) ) ) ), value.a );\n}\nvec4 LinearTosRGB( in vec4 value ) {\n\treturn vec4( mix( pow( value.rgb, vec3( 0.41666 ) ) * 1.055 - vec3( 0.055 ), value.rgb * 12.92, vec3( lessThanEqual( value.rgb, vec3( 0.0031308 ) ) ) ), value.a );\n}\nvec4 RGBEToLinear( in vec4 value ) {\n\treturn vec4( value.rgb * exp2( value.a * 255.0 - 128.0 ), 1.0 );\n}\nvec4 LinearToRGBE( in vec4 value ) {\n\tfloat maxComponent = max( max( value.r, value.g ), value.b );\n\tfloat fExp = clamp( ceil( log2( maxComponent ) ), -128.0, 127.0 );\n\treturn vec4( value.rgb / exp2( fExp ), ( fExp + 128.0 ) / 255.0 );\n}",envmap_fragment:"#ifdef USE_ENVMAP\n\t#ifdef ENV_WORLDPOS\n\t\tvec3 cameraToFrag;\n\t\tif ( isOrthographic ) {\n\t\t\tcameraToFrag = normalize( vec3( - viewMatrix[ 0 ][ 2 ], - viewMatrix[ 1 ][ 2 ], - viewMatrix[ 2 ][ 2 ] ) );\n\t\t} else {\n\t\t\tcameraToFrag = normalize( vWorldPosition - cameraPosition );\n\t\t}\n\t\tvec3 worldNormal = inverseTransformDirection( normal, viewMatrix );\n\t\t#ifdef ENVMAP_MODE_REFLECTION\n\t\t\tvec3 reflectVec = reflect( cameraToFrag, worldNormal );\n\t\t#else\n\t\t\tvec3 reflectVec = refract( cameraToFrag, worldNormal, refractionRatio );\n\t\t#endif\n\t#else\n\t\tvec3 reflectVec = vReflect;\n\t#endif\n\t#ifdef ENVMAP_TYPE_CUBE\n\t\tvec4 envColor = textureCube( envMap, vec3( flipEnvMap * reflectVec.x, reflectVec.yz ) );\n\t\tenvColor = envMapTexelToLinear( envColor );\n\t#elif defined( ENVMAP_TYPE_CUBE_UV )\n\t\tvec4 envColor = textureCubeUV( envMap, reflectVec, 0.0 );\n\t#else\n\t\tvec4 envColor = vec4( 0.0 );\n\t#endif\n\t#ifdef ENVMAP_BLENDING_MULTIPLY\n\t\toutgoingLight = mix( outgoingLight, outgoingLight * envColor.xyz, specularStrength * reflectivity );\n\t#elif defined( ENVMAP_BLENDING_MIX )\n\t\toutgoingLight = mix( outgoingLight, envColor.xyz, specularStrength * reflectivity );\n\t#elif defined( ENVMAP_BLENDING_ADD )\n\t\toutgoingLight += envColor.xyz * specularStrength * reflectivity;\n\t#endif\n#endif",envmap_common_pars_fragment:"#ifdef USE_ENVMAP\n\tuniform float envMapIntensity;\n\tuniform float flipEnvMap;\n\t#ifdef ENVMAP_TYPE_CUBE\n\t\tuniform samplerCube envMap;\n\t#else\n\t\tuniform sampler2D envMap;\n\t#endif\n\t\n#endif",envmap_pars_fragment:"#ifdef USE_ENVMAP\n\tuniform float reflectivity;\n\t#if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG )\n\t\t#define ENV_WORLDPOS\n\t#endif\n\t#ifdef ENV_WORLDPOS\n\t\tvarying vec3 vWorldPosition;\n\t\tuniform float refractionRatio;\n\t#else\n\t\tvarying vec3 vReflect;\n\t#endif\n#endif",envmap_pars_vertex:"#ifdef USE_ENVMAP\n\t#if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) ||defined( PHONG )\n\t\t#define ENV_WORLDPOS\n\t#endif\n\t#ifdef ENV_WORLDPOS\n\t\t\n\t\tvarying vec3 vWorldPosition;\n\t#else\n\t\tvarying vec3 vReflect;\n\t\tuniform float refractionRatio;\n\t#endif\n#endif",envmap_physical_pars_fragment:"#if defined( USE_ENVMAP )\n\tuniform float refractionRatio;\n\tvec3 getIBLIrradiance( const in vec3 normal ) {\n\t\t#if defined( ENVMAP_TYPE_CUBE_UV )\n\t\t\tvec3 worldNormal = inverseTransformDirection( normal, viewMatrix );\n\t\t\tvec4 envMapColor = textureCubeUV( envMap, worldNormal, 1.0 );\n\t\t\treturn PI * envMapColor.rgb * envMapIntensity;\n\t\t#else\n\t\t\treturn vec3( 0.0 );\n\t\t#endif\n\t}\n\tvec3 getIBLRadiance( const in vec3 outVec, const in float roughness ) {\n\t\t#if defined( ENVMAP_TYPE_CUBE_UV )\n\t\t\tvec3 worldOutVec = inverseTransformDirection( outVec, viewMatrix );\n\t\t\tvec4 envMapColor = textureCubeUV( envMap, worldOutVec, roughness );\n\t\t\treturn envMapColor.rgb * envMapIntensity;\n\t\t#else\n\t\t\treturn vec3( 0.0 );\n\t\t#endif\n\t}\n\tvec3 getIBLRadianceReflection( const in vec3 viewDir, const in vec3 normal, const in float roughness ) {\n\t\tvec3 reflectVec = reflect( -viewDir, normal );\n\t\treflectVec = normalize( mix( reflectVec, normal, roughness * roughness) );\n\t\treturn getIBLRadiance(reflectVec, roughness);\n\t}\n\tvec3 refract2(vec3 viewVec, vec3 Normal, float ior) {\n\t\tfloat vn = dot(viewVec, Normal);\n\t\tfloat k = 1.0 - ior * ior * (1.0 - vn * vn);\n\t\tvec3 refrVec = ior * viewVec - (ior * vn + sqrt(k)) * Normal;\n\t\treturn refrVec;\n\t}\n\tvec3 getIBLRadianceRefraction( const in vec3 viewDir, const in vec3 normal, const in float roughness ) {\n\t\tvec3 refractVec = refract2( -viewDir, normal, refractionRatio );\n\t\treturn getIBLRadiance(refractVec, roughness);\n\t}\n#endif",envmap_vertex:"#ifdef USE_ENVMAP\n\t#ifdef ENV_WORLDPOS\n\t\tvWorldPosition = worldPosition.xyz;\n\t#else\n\t\tvec3 cameraToVertex;\n\t\tif ( isOrthographic ) {\n\t\t\tcameraToVertex = normalize( vec3( - viewMatrix[ 0 ][ 2 ], - viewMatrix[ 1 ][ 2 ], - viewMatrix[ 2 ][ 2 ] ) );\n\t\t} else {\n\t\t\tcameraToVertex = normalize( worldPosition.xyz - cameraPosition );\n\t\t}\n\t\tvec3 worldNormal = inverseTransformDirection( transformedNormal, viewMatrix );\n\t\t#ifdef ENVMAP_MODE_REFLECTION\n\t\t\tvReflect = reflect( cameraToVertex, worldNormal );\n\t\t#else\n\t\t\tvReflect = refract( cameraToVertex, worldNormal, refractionRatio );\n\t\t#endif\n\t#endif\n#endif",fog_vertex:"#ifdef USE_FOG\n\tvFogDepth = - mvPosition.z;\n#endif",fog_pars_vertex:"#ifdef USE_FOG\n\tvarying float vFogDepth;\n#endif",fog_fragment:"#ifdef USE_FOG\n\t#ifdef FOG_EXP2\n\t\tfloat fogFactor = 1.0 - exp( - fogDensity * fogDensity * vFogDepth * vFogDepth );\n\t#else\n\t\tfloat fogFactor = smoothstep( fogNear, fogFar, vFogDepth );\n\t#endif\n\tgl_FragColor.rgb = mix( gl_FragColor.rgb, fogColor, fogFactor );\n#endif",fog_pars_fragment:"#ifdef USE_FOG\n\tuniform vec3 fogColor;\n\tvarying float vFogDepth;\n\t#ifdef FOG_EXP2\n\t\tuniform float fogDensity;\n\t#else\n\t\tuniform float fogNear;\n\t\tuniform float fogFar;\n\t#endif\n#endif",gradientmap_pars_fragment:"#ifdef USE_GRADIENTMAP\n\tuniform sampler2D gradientMap;\n#endif\nvec3 getGradientIrradiance( vec3 normal, vec3 lightDirection ) {\n\tfloat dotNL = dot( normal, lightDirection );\n\tvec2 coord = vec2( dotNL * 0.5 + 0.5, 0.0 );\n\t#ifdef USE_GRADIENTMAP\n\t\treturn vec3( texture2D( gradientMap, coord ).r );\n\t#else\n\t\treturn ( coord.x < 0.7 ) ? vec3( 0.7 ) : vec3( 1.0 );\n\t#endif\n}",lightmap_fragment:"#ifdef USE_LIGHTMAP\n\tvec4 lightMapTexel = texture2D( lightMap, vUv2 );\n\tvec3 lightMapIrradiance = lightMapTexelToLinear( lightMapTexel ).rgb * lightMapIntensity;\n\t#ifndef PHYSICALLY_CORRECT_LIGHTS\n\t\tlightMapIrradiance *= PI;\n\t#endif\n\treflectedLight.indirectDiffuse += lightMapIrradiance;\n#endif",lightmap_pars_fragment:"#ifdef USE_LIGHTMAP\n\tuniform sampler2D lightMap;\n\tuniform float lightMapIntensity;\n#endif",lights_lambert_vertex:"vec3 diffuse = vec3( 1.0 );\nGeometricContext geometry;\ngeometry.position = mvPosition.xyz;\ngeometry.viewDir = ( isOrthographic ) ? vec3( 0, 0, 1 ) : normalize( -mvPosition.xyz );\nvec3 normal = normalize( transformedNormal );\nGeometricContext backGeometry;\nbackGeometry.position = geometry.position;\nbackGeometry.viewDir = geometry.viewDir;\nvec3 backNormal = -normal;\nvLightFront = vec3( 0.0 );\nvIndirectFront = vec3( 0.0 );\n#ifdef DOUBLE_SIDED\n\tvLightBack = vec3( 0.0 );\n\tvIndirectBack = vec3( 0.0 );\n#endif\nIncidentLight directLight;\nfloat dotNL;\nvec3 directLightColor_Diffuse;\nvIndirectFront += getAmbientLightIrradiance( ambientLightColor );\nvIndirectFront += getLightProbeIrradiance( lightProbe, normal );\n#ifdef DOUBLE_SIDED\n\tvIndirectBack += getAmbientLightIrradiance( ambientLightColor );\n\tvIndirectBack += getLightProbeIrradiance( lightProbe, backNormal );\n#endif\n#if NUM_POINT_LIGHTS > 0\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) {\n\t\tgetPointLightInfo( pointLights[ i ], geometry, directLight );\n\t\tdotNL = dot( normal, directLight.direction );\n\t\tdirectLightColor_Diffuse = directLight.color;\n\t\tvLightFront += saturate( dotNL ) * directLightColor_Diffuse;\n\t\t#ifdef DOUBLE_SIDED\n\t\t\tvLightBack += saturate( - dotNL ) * directLightColor_Diffuse;\n\t\t#endif\n\t}\n\t#pragma unroll_loop_end\n#endif\n#if NUM_SPOT_LIGHTS > 0\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_SPOT_LIGHTS; i ++ ) {\n\t\tgetSpotLightInfo( spotLights[ i ], geometry, directLight );\n\t\tdotNL = dot( normal, directLight.direction );\n\t\tdirectLightColor_Diffuse = directLight.color;\n\t\tvLightFront += saturate( dotNL ) * directLightColor_Diffuse;\n\t\t#ifdef DOUBLE_SIDED\n\t\t\tvLightBack += saturate( - dotNL ) * directLightColor_Diffuse;\n\t\t#endif\n\t}\n\t#pragma unroll_loop_end\n#endif\n#if NUM_DIR_LIGHTS > 0\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) {\n\t\tgetDirectionalLightInfo( directionalLights[ i ], geometry, directLight );\n\t\tdotNL = dot( normal, directLight.direction );\n\t\tdirectLightColor_Diffuse = directLight.color;\n\t\tvLightFront += saturate( dotNL ) * directLightColor_Diffuse;\n\t\t#ifdef DOUBLE_SIDED\n\t\t\tvLightBack += saturate( - dotNL ) * directLightColor_Diffuse;\n\t\t#endif\n\t}\n\t#pragma unroll_loop_end\n#endif\n#if NUM_HEMI_LIGHTS > 0\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_HEMI_LIGHTS; i ++ ) {\n\t\tvIndirectFront += getHemisphereLightIrradiance( hemisphereLights[ i ], normal );\n\t\t#ifdef DOUBLE_SIDED\n\t\t\tvIndirectBack += getHemisphereLightIrradiance( hemisphereLights[ i ], backNormal );\n\t\t#endif\n\t}\n\t#pragma unroll_loop_end\n#endif",lights_pars_begin:"uniform bool receiveShadow;\nuniform vec3 ambientLightColor;\nuniform vec3 lightProbe[ 9 ];\nvec3 shGetIrradianceAt( in vec3 normal, in vec3 shCoefficients[ 9 ] ) {\n\tfloat x = normal.x, y = normal.y, z = normal.z;\n\tvec3 result = shCoefficients[ 0 ] * 0.886227;\n\tresult += shCoefficients[ 1 ] * 2.0 * 0.511664 * y;\n\tresult += shCoefficients[ 2 ] * 2.0 * 0.511664 * z;\n\tresult += shCoefficients[ 3 ] * 2.0 * 0.511664 * x;\n\tresult += shCoefficients[ 4 ] * 2.0 * 0.429043 * x * y;\n\tresult += shCoefficients[ 5 ] * 2.0 * 0.429043 * y * z;\n\tresult += shCoefficients[ 6 ] * ( 0.743125 * z * z - 0.247708 );\n\tresult += shCoefficients[ 7 ] * 2.0 * 0.429043 * x * z;\n\tresult += shCoefficients[ 8 ] * 0.429043 * ( x * x - y * y );\n\treturn result;\n}\nvec3 getLightProbeIrradiance( const in vec3 lightProbe[ 9 ], const in vec3 normal ) {\n\tvec3 worldNormal = inverseTransformDirection( normal, viewMatrix );\n\tvec3 irradiance = shGetIrradianceAt( worldNormal, lightProbe );\n\treturn irradiance;\n}\nvec3 getAmbientLightIrradiance( const in vec3 ambientLightColor ) {\n\tvec3 irradiance = ambientLightColor;\n\treturn irradiance;\n}\nfloat getDistanceAttenuation( const in float lightDistance, const in float cutoffDistance, const in float decayExponent ) {\n\t#if defined ( PHYSICALLY_CORRECT_LIGHTS )\n\t\tfloat distanceFalloff = 1.0 / max( pow( lightDistance, decayExponent ), 0.01 );\n\t\tif ( cutoffDistance > 0.0 ) {\n\t\t\tdistanceFalloff *= pow2( saturate( 1.0 - pow4( lightDistance / cutoffDistance ) ) );\n\t\t}\n\t\treturn distanceFalloff;\n\t#else\n\t\tif ( cutoffDistance > 0.0 && decayExponent > 0.0 ) {\n\t\t\treturn pow( saturate( - lightDistance / cutoffDistance + 1.0 ), decayExponent );\n\t\t}\n\t\treturn 1.0;\n\t#endif\n}\nfloat getSpotAttenuation( const in float coneCosine, const in float penumbraCosine, const in float angleCosine ) {\n\treturn smoothstep( coneCosine, penumbraCosine, angleCosine );\n}\n#if NUM_DIR_LIGHTS > 0\n\tstruct DirectionalLight {\n\t\tvec3 direction;\n\t\tvec3 color;\n\t};\n\tuniform DirectionalLight directionalLights[ NUM_DIR_LIGHTS ];\n\tvoid getDirectionalLightInfo( const in DirectionalLight directionalLight, const in GeometricContext geometry, out IncidentLight light ) {\n\t\tlight.color = directionalLight.color;\n\t\tlight.direction = directionalLight.direction;\n\t\tlight.visible = true;\n\t}\n#endif\n#if NUM_POINT_LIGHTS > 0\n\tstruct PointLight {\n\t\tvec3 position;\n\t\tvec3 color;\n\t\tfloat distance;\n\t\tfloat decay;\n\t};\n\tuniform PointLight pointLights[ NUM_POINT_LIGHTS ];\n\tvoid getPointLightInfo( const in PointLight pointLight, const in GeometricContext geometry, out IncidentLight light ) {\n\t\tvec3 lVector = pointLight.position - geometry.position;\n\t\tlight.direction = normalize( lVector );\n\t\tfloat lightDistance = length( lVector );\n\t\tlight.color = pointLight.color;\n\t\tlight.color *= getDistanceAttenuation( lightDistance, pointLight.distance, pointLight.decay );\n\t\tlight.visible = ( light.color != vec3( 0.0 ) );\n\t}\n#endif\n#if NUM_SPOT_LIGHTS > 0\n\tstruct SpotLight {\n\t\tvec3 position;\n\t\tvec3 direction;\n\t\tvec3 color;\n\t\tfloat distance;\n\t\tfloat decay;\n\t\tfloat coneCos;\n\t\tfloat penumbraCos;\n\t};\n\tuniform SpotLight spotLights[ NUM_SPOT_LIGHTS ];\n\tvoid getSpotLightInfo( const in SpotLight spotLight, const in GeometricContext geometry, out IncidentLight light ) {\n\t\tvec3 lVector = spotLight.position - geometry.position;\n\t\tlight.direction = normalize( lVector );\n\t\tfloat angleCos = dot( light.direction, spotLight.direction );\n\t\tfloat spotAttenuation = getSpotAttenuation( spotLight.coneCos, spotLight.penumbraCos, angleCos );\n\t\tif ( spotAttenuation > 0.0 ) {\n\t\t\tfloat lightDistance = length( lVector );\n\t\t\tlight.color = spotLight.color * spotAttenuation;\n\t\t\tlight.color *= getDistanceAttenuation( lightDistance, spotLight.distance, spotLight.decay );\n\t\t\tlight.visible = ( light.color != vec3( 0.0 ) );\n\t\t} else {\n\t\t\tlight.color = vec3( 0.0 );\n\t\t\tlight.visible = false;\n\t\t}\n\t}\n#endif\n#if NUM_RECT_AREA_LIGHTS > 0\n\tstruct RectAreaLight {\n\t\tvec3 color;\n\t\tvec3 position;\n\t\tvec3 halfWidth;\n\t\tvec3 halfHeight;\n\t};\n\tuniform sampler2D ltc_1;\tuniform sampler2D ltc_2;\n\tuniform RectAreaLight rectAreaLights[ NUM_RECT_AREA_LIGHTS ];\n#endif\n#if NUM_HEMI_LIGHTS > 0\n\tstruct HemisphereLight {\n\t\tvec3 direction;\n\t\tvec3 skyColor;\n\t\tvec3 groundColor;\n\t};\n\tuniform HemisphereLight hemisphereLights[ NUM_HEMI_LIGHTS ];\n\tvec3 getHemisphereLightIrradiance( const in HemisphereLight hemiLight, const in vec3 normal ) {\n\t\tfloat dotNL = dot( normal, hemiLight.direction );\n\t\tfloat hemiDiffuseWeight = 0.5 * dotNL + 0.5;\n\t\tvec3 irradiance = mix( hemiLight.groundColor, hemiLight.skyColor, hemiDiffuseWeight );\n\t\treturn irradiance;\n\t}\n#endif",lights_toon_fragment:"ToonMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb;",lights_toon_pars_fragment:"varying vec3 vViewPosition;\nstruct ToonMaterial {\n\tvec3 diffuseColor;\n};\nvoid RE_Direct_Toon(\n\tconst in IncidentLight directLight,\n\tconst in vec3 normal,\n#ifdef USE_CLEARCOAT\n\tconst in vec3 ccNormal,\n#endif\n\tconst in GeometricContext geometry,\n\tconst in ToonMaterial material,\n\tinout ReflectedLight reflectedLight\n) {\n\tvec3 irradiance = getGradientIrradiance( normal, directLight.direction ) * directLight.color;\n\treflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n}\nvoid RE_IndirectDiffuse_Toon( const in vec3 irradiance, const in GeometricContext geometry, const in ToonMaterial material, inout ReflectedLight reflectedLight ) {\n\treflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n}\n#define RE_Direct\t\t\t\tRE_Direct_Toon\n#define RE_IndirectDiffuse\t\tRE_IndirectDiffuse_Toon\n#define Material_LightProbeLOD( material )\t(0)",lights_phong_fragment:"BlinnPhongMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb;\nmaterial.specularColor = specular;\nmaterial.specularShininess = shininess;\nmaterial.specularStrength = specularStrength;",lights_phong_pars_fragment:"varying vec3 vViewPosition;\nstruct BlinnPhongMaterial {\n\tvec3 diffuseColor;\n\tvec3 specularColor;\n\tfloat specularShininess;\n\tfloat specularStrength;\n};\nvoid RE_Direct_BlinnPhong(\n\tconst in IncidentLight directLight,\n\tconst in vec3 normal,\n#ifdef USE_CLEARCOAT\n\tconst in vec3 ccNormal,\n#endif\n\tconst in GeometricContext geometry,\n\tconst in BlinnPhongMaterial material,\n\tinout ReflectedLight reflectedLight\n) {\n\tfloat dotNL = saturate( dot( normal, directLight.direction ) );\n\tvec3 irradiance = dotNL * directLight.color;\n\treflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n\treflectedLight.directSpecular += irradiance * BRDF_BlinnPhong( directLight.direction, geometry.viewDir, normal, material.specularColor, material.specularShininess ) * material.specularStrength;\n}\nvoid RE_IndirectDiffuse_BlinnPhong( const in vec3 irradiance, const in GeometricContext geometry, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight ) {\n\treflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n}\n#define RE_Direct\t\t\t\tRE_Direct_BlinnPhong\n#define RE_IndirectDiffuse\t\tRE_IndirectDiffuse_BlinnPhong\n#define Material_LightProbeLOD( material )\t(0)",lights_physical_fragment:"PhysicalMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb * ( 1.0 - metalnessFactor );\nvec3 dxy = max( abs( dFdx( geometryNormal ) ), abs( dFdy( geometryNormal ) ) );\nfloat geometryRoughness = max( max( dxy.x, dxy.y ), dxy.z );\nmaterial.roughness = max( roughnessFactor, 0.0525 );material.roughness += geometryRoughness;\nmaterial.roughness = min( material.roughness, 1.0 );\n#ifdef IOR\n\t#ifdef SPECULAR\n\t\tfloat specularIntensityFactor = specularIntensity;\n\t\tvec3 specularColorFactor = specularColor;\n\t\t#ifdef USE_SPECULARINTENSITYMAP\n\t\t\tspecularIntensityFactor *= texture2D( specularIntensityMap,\n\t\t\t\t#if defined( USE_LIGHTMAP ) || defined( USE_AOMAP )\n\t\t\t\t\tvUv2\n\t\t\t\t#else\n\t\t\t\t\tvUv\n\t\t\t\t#endif\n\t\t\t).a;\n\t\t#endif\n\t\t#ifdef USE_SPECULARCOLORMAP\n\t\t\tspecularColorFactor *= specularColorMapTexelToLinear( texture2D( specularColorMap, vUv ) ).rgb;\n\t\t#endif\n\t\tmaterial.specularF90 = mix( specularIntensityFactor, 1.0, metalnessFactor );\n\t#else\n\t\tfloat specularIntensityFactor = 1.0;\n\t\tvec3 specularColorFactor = vec3( 1.0 );\n\t\tmaterial.specularF90 = 1.0;\n\t#endif\n\tmaterial.specularColor = mix( min( pow2( ( ior - 1.0 ) / ( ior + 1.0 ) ) * specularColorFactor, vec3( 1.0 ) ) * specularIntensityFactor, diffuseColor.rgb, metalnessFactor );\n#else\n\tmaterial.specularColor = mix( vec3( 0.04 ), diffuseColor.rgb, metalnessFactor );\n\tmaterial.specularF90 = 1.0;\n#endif\n#ifdef USE_CLEARCOAT\n\tmaterial.clearcoat = clearcoat;\n\tmaterial.clearcoatRoughness = clearcoatRoughness;\n\tmaterial.clearcoatF0 = vec3( 0.04 );\n\tmaterial.clearcoatF90 = 1.0;\n\t#ifdef USE_CLEARCOATMAP\n\t\tmaterial.clearcoat *= texture2D( clearcoatMap, vUv ).x;\n\t#endif\n\t#ifdef USE_CLEARCOAT_ROUGHNESSMAP\n\t\tmaterial.clearcoatRoughness *= texture2D( clearcoatRoughnessMap, vUv ).y;\n\t#endif\n\tmaterial.clearcoat = saturate( material.clearcoat );\tmaterial.clearcoatRoughness = max( material.clearcoatRoughness, 0.0525 );\n\tmaterial.clearcoatRoughness += geometryRoughness;\n\tmaterial.clearcoatRoughness = min( material.clearcoatRoughness, 1.0 );\n#endif\n#ifdef USE_SHEEN\n\tmaterial.sheenColor = sheenColor;\n\t#ifdef USE_SHEENCOLORMAP\n\t\tmaterial.sheenColor *= sheenColorMapTexelToLinear( texture2D( sheenColorMap, vUv ) ).rgb;\n\t#endif\n\tmaterial.sheenRoughness = clamp( sheenRoughness, 0.07, 1.0 );\n\t#ifdef USE_SHEENROUGHNESSMAP\n\t\tmaterial.sheenRoughness *= texture2D( sheenRoughnessMap, vUv ).a;\n\t#endif\n#endif\n#ifdef USE_REFRACTION\n\tmaterial.refraction = refraction;\n#endif",lights_physical_pars_fragment:"struct PhysicalMaterial {\n\tvec3 diffuseColor;\n\tfloat roughness;\n\tvec3 specularColor;\n\tfloat specularF90;\n\t#ifdef USE_CLEARCOAT\n\t\tfloat clearcoat;\n\t\tfloat clearcoatRoughness;\n\t\tvec3 clearcoatF0;\n\t\tfloat clearcoatF90;\n\t#endif\n\t#ifdef USE_SHEEN\n\t\tvec3 sheenColor;\n\t\tfloat sheenRoughness;\n\t#endif\n\t#ifdef USE_REFRACTION\n\t\tfloat refraction;\n\t#endif\n};\n#ifndef CLEARCOAT_R115_COMPATABILITY\nvec3 clearcoatSpecular = vec3( 0.0 );\nvec3 sheenSpecular = vec3( 0.0 );\n#endif\nfloat IBLSheenBRDF( const in vec3 normal, const in vec3 viewDir, const in float roughness) {\n\tfloat dotNV = saturate( dot( normal, viewDir ) );\n\tfloat r2 = roughness * roughness;\n\tfloat a = roughness < 0.25 ? -339.2 * r2 + 161.4 * roughness - 25.9 : -8.48 * r2 + 14.3 * roughness - 9.95;\n\tfloat b = roughness < 0.25 ? 44.0 * r2 - 23.7 * roughness + 3.26 : 1.97 * r2 - 3.27 * roughness + 0.72;\n\tfloat DG = exp( a * dotNV + b ) + ( roughness < 0.25 ? 0.0 : 0.1 * ( roughness - 0.25 ) );\n\treturn saturate( DG * RECIPROCAL_PI );\n}\nvec2 DFGApprox( const in vec3 normal, const in vec3 viewDir, const in float roughness ) {\n\tfloat dotNV = saturate( dot( normal, viewDir ) );\n\tconst vec4 c0 = vec4( - 1, - 0.0275, - 0.572, 0.022 );\n\tconst vec4 c1 = vec4( 1, 0.0425, 1.04, - 0.04 );\n\tvec4 r = roughness * c0 + c1;\n\tfloat a004 = min( r.x * r.x, exp2( - 9.28 * dotNV ) ) * r.x + r.y;\n\tvec2 fab = vec2( - 1.04, 1.04 ) * a004 + r.zw;\n\treturn fab;\n}\nvec3 EnvironmentBRDF( const in vec3 normal, const in vec3 viewDir, const in vec3 specularColor, const in float specularF90, const in float roughness ) {\n\tvec2 fab = DFGApprox( normal, viewDir, roughness );\n\treturn specularColor * fab.x + specularF90 * fab.y;\n}\nvoid computeMultiscattering( const in vec3 normal, const in vec3 viewDir, const in vec3 specularColor, const in float specularF90, const in float roughness, inout vec3 singleScatter, inout vec3 multiScatter ) {\n\tvec2 fab = DFGApprox( normal, viewDir, roughness );\n#ifdef MULTISCATTERRING_R115_COMPATABILITY\n\tfloat dotNV = saturate( dot( normal, viewDir ) );\n\tfloat fresnel = exp2( ( -5.55473 * dotNV - 6.98316 ) * dotNV );\n\tvec3 Fr = max( vec3( 1.0 - roughness ), specularColor ) - specularColor;\n\tvec3 F = f90_r115_compatability * Fr * fresnel + specularColor;\n\tvec3 FssEss = F * fab.x + specularF90 * fab.y;\n#else\n\tvec3 FssEss = specularColor * fab.x + specularF90 * fab.y;\n#endif\n\tfloat Ess = fab.x + fab.y;\n\tfloat Ems = 1.0 - Ess;\n\tvec3 Favg = specularColor + ( 1.0 - specularColor ) * 0.047619;\tvec3 Fms = FssEss * Favg / ( 1.0 - Ems * Favg );\n\tsingleScatter += FssEss;\n\tmultiScatter += Fms * Ems;\n}\n#if NUM_RECT_AREA_LIGHTS > 0\n\tvoid RE_Direct_RectArea_Physical( const in RectAreaLight rectAreaLight, const in vec3 normal, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {\n\t\tvec3 viewDir = geometry.viewDir;\n\t\tvec3 position = geometry.position;\n\t\tvec3 lightPos = rectAreaLight.position;\n\t\tvec3 halfWidth = rectAreaLight.halfWidth;\n\t\tvec3 halfHeight = rectAreaLight.halfHeight;\n\t\tvec3 lightColor = rectAreaLight.color;\n\t\tfloat roughness = material.roughness;\n\t\tvec3 rectCoords[ 4 ];\n\t\trectCoords[ 0 ] = lightPos + halfWidth - halfHeight;\t\trectCoords[ 1 ] = lightPos - halfWidth - halfHeight;\n\t\trectCoords[ 2 ] = lightPos - halfWidth + halfHeight;\n\t\trectCoords[ 3 ] = lightPos + halfWidth + halfHeight;\n\t\tvec2 uv = LTC_Uv( normal, viewDir, roughness );\n\t\tvec4 t1 = texture2D( ltc_1, uv );\n\t\tvec4 t2 = texture2D( ltc_2, uv );\n\t\tmat3 mInv = mat3(\n\t\t\tvec3( t1.x, 0, t1.y ),\n\t\t\tvec3(\t\t0, 1,\t\t0 ),\n\t\t\tvec3( t1.z, 0, t1.w )\n\t\t);\n\t\tvec3 fresnel = ( material.specularColor * t2.x + ( vec3( 1.0 ) - material.specularColor ) * t2.y );\n\t\treflectedLight.directSpecular += lightColor * fresnel * LTC_Evaluate( normal, viewDir, position, mInv, rectCoords );\n\t\treflectedLight.directDiffuse += lightColor * material.diffuseColor * LTC_Evaluate( normal, viewDir, position, mat3( 1.0 ), rectCoords );\n\t}\n#endif\n#define DEFAULT_SPECULAR_COEFFICIENT 0.04\nfloat clearcoatDHRApprox( const in float roughness, const in float dotNL ) {\n\treturn DEFAULT_SPECULAR_COEFFICIENT + ( 1.0 - DEFAULT_SPECULAR_COEFFICIENT ) * ( pow( 1.0 - dotNL, 5.0 ) * pow( 1.0 - roughness, 2.0 ) );\n}\nvoid RE_Direct_Physical(\n\tconst in IncidentLight directLight,\n\tconst in vec3 normal,\n#ifdef USE_CLEARCOAT\n\tconst in vec3 ccNormal,\n#endif\n\tconst in GeometricContext geometry,\n\tconst in PhysicalMaterial material,\n\tinout ReflectedLight reflectedLight\n) {\n\tfloat dotNL = saturate( dot( normal, directLight.direction ) );\n\tvec3 irradiance = dotNL * directLight.color;\n\t#ifdef USE_CLEARCOAT\n\t\tfloat dotNLcc = saturate( dot( ccNormal, directLight.direction ) );\n\t\tvec3 ccIrradiance = dotNLcc * directLight.color;\n\t\tvec3 ccSpecular = ccIrradiance * BRDF_GGX( directLight.direction, geometry.viewDir, ccNormal, material.clearcoatF0, material.clearcoatF90, material.clearcoatRoughness );\n\t#ifdef CLEARCOAT_R115_COMPATABILITY\n\t\tfloat clearcoatDHR = material.clearcoat * clearcoatDHRApprox( material.clearcoatRoughness, dotNLcc );\n\t\treflectedLight.directSpecular += material.clearcoat * ccSpecular;\n\t\n\t#else\n\t\tclearcoatSpecular += ccSpecular;\n\t#endif\n\t#else\n\t#ifdef CLEARCOAT_R115_COMPATABILITY\n\t\tfloat clearcoatDHR = 0.0;\n\t#endif\n\t#endif\n\t#ifdef CLEARCOAT_R115_COMPATABILITY\n\tfloat clearcoatInv = 1.0 - clearcoatDHR;\n\t#else\n\tfloat clearcoatInv = 1.0;\n\t#endif\n\t#ifdef USE_SHEEN\n\t\tvec3 snSpecular = irradiance * BRDF_Sheen( directLight.direction, geometry.viewDir, normal, material.sheenColor, material.sheenRoughness );\n\t#ifdef CLEARCOAT_R115_COMPATABILITY\n\t\treflectedLight.directSpecular += clearcoatInv * snSpecular;\n\t#else\n\t\tsheenSpecular += snSpecular;\n\t#endif\n\t#endif\n\treflectedLight.directSpecular += clearcoatInv * irradiance * BRDF_GGX( directLight.direction, geometry.viewDir, normal, material.specularColor, material.specularF90, material.roughness );\n\treflectedLight.directDiffuse += clearcoatInv * irradiance * BRDF_Lambert( material.diffuseColor );\n}\nvoid RE_IndirectDiffuse_Physical( const in vec3 irradiance, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {\n\treflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n}\nvoid RE_IndirectSpecular_Physical(\n\tconst in vec3 radiance,\n#ifdef USE_REFRACTION\n\tconst in vec3 radianceRefraction,\n#endif\n\tconst in vec3 irradiance,\n\tconst in vec3 clearcoatRadiance,\n\tconst in vec3 normal,\n#ifdef USE_CLEARCOAT\n\tconst in vec3 ccNormal,\n#endif\n\tconst in GeometricContext geometry,\n\tconst in PhysicalMaterial material,\n\tinout ReflectedLight reflectedLight\n) {\n\t#ifdef USE_CLEARCOAT\n\t\tvec3 ccSpecular = clearcoatRadiance * EnvironmentBRDF( ccNormal, geometry.viewDir, material.clearcoatF0, material.clearcoatF90, material.clearcoatRoughness );\n\t#ifdef CLEARCOAT_R115_COMPATABILITY\n\t\tfloat dotNLcc = saturate( dot( ccNormal, geometry.viewDir ) );\n\t\tfloat clearcoatDHR = material.clearcoat * clearcoatDHRApprox( material.clearcoatRoughness, dotNLcc );\n\t\treflectedLight.indirectSpecular += material.clearcoat * ccSpecular;\n\t\n\t#else\n\t\tclearcoatSpecular += ccSpecular;\n\t#endif\n\t#else\n\t#ifdef CLEARCOAT_R115_COMPATABILITY\n\t\tfloat clearcoatDHR = 0.0;\n\t#endif\n\t#endif\n\t#ifdef USE_SHEEN\n\t#ifndef CLEARCOAT_R115_COMPATABILITY\n\t\tsheenSpecular += irradiance * material.sheenColor * IBLSheenBRDF( normal, geometry.viewDir, material.sheenRoughness );\n\t#endif\n\t#endif\n\t#ifdef CLEARCOAT_R115_COMPATABILITY\n\tfloat clearcoatInv = 1.0 - clearcoatDHR;\n\t#else\n\tfloat clearcoatInv = 1.0;\n\t#endif\n\tvec3 singleScattering = vec3( 0.0 );\n\tvec3 multiScattering = vec3( 0.0 );\n\tvec3 cosineWeightedIrradiance = irradiance * RECIPROCAL_PI;\n\tcomputeMultiscattering( normal, geometry.viewDir, material.specularColor, material.specularF90, material.roughness, singleScattering, multiScattering );\n\tvec3 diffuse = material.diffuseColor * ( 1.0 - ( singleScattering + multiScattering ) );\n\treflectedLight.indirectSpecular += clearcoatInv * radiance * singleScattering;\n\treflectedLight.indirectSpecular += multiScattering * cosineWeightedIrradiance;\n\treflectedLight.indirectDiffuse += diffuse * cosineWeightedIrradiance;\n\t#ifdef ENVMAP_MODE_REFLECTION\n\t\t#ifdef USE_REFRACTION\n\t\t\treflectedLight.indirectDiffuse = mix(reflectedLight.indirectDiffuse, radianceRefraction * material.diffuseColor, material.refraction);\n\t\t#endif\n\t#endif\n}\n#define RE_Direct\t\t\t\tRE_Direct_Physical\n#define RE_Direct_RectArea\t\tRE_Direct_RectArea_Physical\n#define RE_IndirectDiffuse\t\tRE_IndirectDiffuse_Physical\n#define RE_IndirectSpecular\t\tRE_IndirectSpecular_Physical\nfloat computeSpecularOcclusion( const in float dotNV, const in float ambientOcclusion, const in float roughness ) {\n\treturn saturate( pow( dotNV + ambientOcclusion, exp2( - 16.0 * roughness - 1.0 ) ) - 1.0 + ambientOcclusion );\n}",lights_fragment_begin:"\nGeometricContext geometry;\ngeometry.position = - vViewPosition;\ngeometry.viewDir = ( isOrthographic ) ? vec3( 0, 0, 1 ) : normalize( vViewPosition );\nvec3 splitGeoNormal = normal;\n#ifdef USE_CLEARCOAT\n\tvec3 splitGeoClearcoatNormal = clearcoatNormal;\n#endif\nIncidentLight directLight;\n#if ( NUM_POINT_LIGHTS > 0 ) && defined( RE_Direct )\n\tPointLight pointLight;\n\t#if defined( USE_SHADOWMAP ) && NUM_POINT_LIGHT_SHADOWS > 0\n\tPointLightShadow pointLightShadow;\n\t#endif\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) {\n\t\tpointLight = pointLights[ i ];\n\t\tgetPointLightInfo( pointLight, geometry, directLight );\n\t\t#if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_POINT_LIGHT_SHADOWS )\n\t\tpointLightShadow = pointLightShadows[ i ];\n\t\tdirectLight.color *= all( bvec2( directLight.visible, receiveShadow ) ) ? getPointShadow( pointShadowMap[ i ], pointLightShadow.shadowMapSize, pointLightShadow.shadowBias, pointLightShadow.shadowRadius, vPointShadowCoord[ i ], pointLightShadow.shadowCameraNear, pointLightShadow.shadowCameraFar ) : 1.0;\n\t\t#endif\n\t\tRE_Direct(\n\t\t\tdirectLight,\n\t\t\tsplitGeoNormal,\n#ifdef USE_CLEARCOAT\n\t\t\tsplitGeoClearcoatNormal,\n#endif\n\t\t\tgeometry,\n\t\t\tmaterial,\n\t\t\treflectedLight\n\t\t);\n\t}\n\t#pragma unroll_loop_end\n#endif\n#if ( NUM_SPOT_LIGHTS > 0 ) && defined( RE_Direct )\n\tSpotLight spotLight;\n\t#if defined( USE_SHADOWMAP ) && NUM_SPOT_LIGHT_SHADOWS > 0\n\tSpotLightShadow spotLightShadow;\n\t#endif\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_SPOT_LIGHTS; i ++ ) {\n\t\tspotLight = spotLights[ i ];\n\t\tgetSpotLightInfo( spotLight, geometry, directLight );\n\t\t#if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS )\n\t\tspotLightShadow = spotLightShadows[ i ];\n\t\tdirectLight.color *= all( bvec2( directLight.visible, receiveShadow ) ) ? getShadow( spotShadowMap[ i ], spotLightShadow.shadowMapSize, spotLightShadow.shadowBias, spotLightShadow.shadowRadius, vSpotShadowCoord[ i ] ) : 1.0;\n\t\t#endif\n\t\tRE_Direct(\n\t\t\tdirectLight,\n\t\t\tsplitGeoNormal,\n#ifdef USE_CLEARCOAT\n\t\t\tsplitGeoClearcoatNormal,\n#endif\n\t\t\tgeometry,\n\t\t\tmaterial,\n\t\t\treflectedLight\n\t\t);\n\t}\n\t#pragma unroll_loop_end\n#endif\n#if ( NUM_DIR_LIGHTS > 0 ) && defined( RE_Direct )\n\tDirectionalLight directionalLight;\n\t#if defined( USE_SHADOWMAP ) && NUM_DIR_LIGHT_SHADOWS > 0\n\tDirectionalLightShadow directionalLightShadow;\n\t#endif\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) {\n\t\tdirectionalLight = directionalLights[ i ];\n\t\tgetDirectionalLightInfo( directionalLight, geometry, directLight );\n\t\t#if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_DIR_LIGHT_SHADOWS )\n\t\tdirectionalLightShadow = directionalLightShadows[ i ];\n\t\tdirectLight.color *= all( bvec2( directLight.visible, receiveShadow ) ) ? getShadow( directionalShadowMap[ i ], directionalLightShadow.shadowMapSize, directionalLightShadow.shadowBias, directionalLightShadow.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0;\n\t\t#endif\n\t\tRE_Direct(\n\t\t\tdirectLight,\n\t\t\tsplitGeoNormal,\n#ifdef USE_CLEARCOAT\n\t\t\tsplitGeoClearcoatNormal,\n#endif\n\t\t\tgeometry,\n\t\t\tmaterial,\n\t\t\treflectedLight\n\t\t);\n\t}\n\t#pragma unroll_loop_end\n#endif\n#if ( NUM_RECT_AREA_LIGHTS > 0 ) && defined( RE_Direct_RectArea )\n\tRectAreaLight rectAreaLight;\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_RECT_AREA_LIGHTS; i ++ ) {\n\t\trectAreaLight = rectAreaLights[ i ];\n\t\tRE_Direct_RectArea( rectAreaLight, splitGeoNormal, geometry, material, reflectedLight );\n\t}\n\t#pragma unroll_loop_end\n#endif\n#if defined( RE_IndirectDiffuse )\n\tvec3 iblIrradiance = vec3( 0.0 );\n\tvec3 irradiance = getAmbientLightIrradiance( ambientLightColor );\n\tirradiance += getLightProbeIrradiance( lightProbe, splitGeoNormal );\n\t#if ( NUM_HEMI_LIGHTS > 0 )\n\t\t#pragma unroll_loop_start\n\t\tfor ( int i = 0; i < NUM_HEMI_LIGHTS; i ++ ) {\n\t\t\tirradiance += getHemisphereLightIrradiance( hemisphereLights[ i ], splitGeoNormal );\n\t\t}\n\t\t#pragma unroll_loop_end\n\t#endif\n#endif\n#if defined( RE_IndirectSpecular )\n\tvec3 radiance = vec3( 0.0 );\n\tvec3 clearcoatRadiance = vec3( 0.0 );\n\t#ifdef USE_REFRACTION\n\t\tvec3 radianceRefraction = vec3( 0.0 );\n\t#endif\n#endif",lights_fragment_maps:"#if defined( RE_IndirectDiffuse )\n\t#ifdef USE_LIGHTMAP\n\t\tvec4 lightMapTexel = texture2D( lightMap, vUv2 );\n\t\tvec3 lightMapIrradiance = lightMapTexelToLinear( lightMapTexel ).rgb * lightMapIntensity;\n\t\t#ifndef PHYSICALLY_CORRECT_LIGHTS\n\t\t\tlightMapIrradiance *= PI;\n\t\t#endif\n\t\tirradiance += lightMapIrradiance;\n\t#endif\n\t#if defined( USE_ENVMAP ) && defined( STANDARD ) && defined( ENVMAP_TYPE_CUBE_UV )\n\t\tiblIrradiance += getIBLIrradiance( splitGeoNormal );\n\t#endif\n#endif\n#if defined( USE_ENVMAP ) && defined( RE_IndirectSpecular )\n\t#ifdef ENVMAP_MODE_REFLECTION\n\t\tradiance += getIBLRadianceReflection( geometry.viewDir, splitGeoNormal, material.roughness );\n\t\t#ifdef USE_REFRACTION\n\t\t\tradianceRefraction += getIBLRadianceRefraction( geometry.viewDir, splitGeoNormal, material.roughness );\n\t\t#endif\n\t#else\n\t\tradiance += getIBLRadianceRefraction( geometry.viewDir, splitGeoNormal, material.roughness );\n\t#endif\n\t#ifdef USE_CLEARCOAT\n\t\t#ifdef ENVMAP_MODE_REFLECTION\n\t\t\tclearcoatRadiance += getIBLRadianceReflection( geometry.viewDir, splitGeoClearcoatNormal, material.clearcoatRoughness );\n\t\t#else\n\t\t\tclearcoatRadiance += getIBLRadianceRefraction( geometry.viewDir, splitGeoClearcoatNormal, material.clearcoatRoughness );\n\t\t#endif\n\t#endif\n#endif",lights_fragment_end:"#if defined( RE_IndirectDiffuse )\n\tRE_IndirectDiffuse( irradiance, geometry, material, reflectedLight );\n#endif\n#if defined( RE_IndirectSpecular )\n\tRE_IndirectSpecular(\n\t\tradiance,\n#ifdef USE_REFRACTION\n\t\tradianceRefraction,\n#endif\n\t\tiblIrradiance,\n\t\tclearcoatRadiance,\n\t\tsplitGeoNormal,\n#ifdef USE_CLEARCOAT\n\t\tsplitGeoClearcoatNormal,\n#endif\n\t\tgeometry,\n\t\tmaterial,\n\t\treflectedLight\n\t);\n#endif",logdepthbuf_fragment:"#if defined( USE_LOGDEPTHBUF ) && defined( USE_LOGDEPTHBUF_EXT )\n\tgl_FragDepthEXT = vIsPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5;\n#endif",logdepthbuf_pars_fragment:"#if defined( USE_LOGDEPTHBUF ) && defined( USE_LOGDEPTHBUF_EXT )\n\tuniform float logDepthBufFC;\n\tvarying float vFragDepth;\n\tvarying float vIsPerspective;\n#endif",logdepthbuf_pars_vertex:"#ifdef USE_LOGDEPTHBUF\n\t#ifdef USE_LOGDEPTHBUF_EXT\n\t\tvarying float vFragDepth;\n\t\tvarying float vIsPerspective;\n\t#else\n\t\tuniform float logDepthBufFC;\n\t#endif\n#endif",logdepthbuf_vertex:"#ifdef USE_LOGDEPTHBUF\n\t#ifdef USE_LOGDEPTHBUF_EXT\n\t\tvFragDepth = 1.0 + gl_Position.w;\n\t\tvIsPerspective = float( isPerspectiveMatrix( projectionMatrix ) );\n\t#else\n\t\tif ( isPerspectiveMatrix( projectionMatrix ) ) {\n\t\t\tgl_Position.z = log2( max( EPSILON, gl_Position.w + 1.0 ) ) * logDepthBufFC - 1.0;\n\t\t\tgl_Position.z *= gl_Position.w;\n\t\t}\n\t#endif\n#endif",map_fragment:"#ifdef USE_MAP\n\tvec4 texelColor = texture2D( map, vUv );\n\ttexelColor = mapTexelToLinear( texelColor );\n\tdiffuseColor *= texelColor;\n#endif",map_pars_fragment:"#ifdef USE_MAP\n\tuniform sampler2D map;\n#endif",map_particle_fragment:"#if defined( USE_MAP ) || defined( USE_ALPHAMAP )\n\tvec2 uv = ( uvTransform * vec3( gl_PointCoord.x, 1.0 - gl_PointCoord.y, 1 ) ).xy;\n#endif\n#ifdef USE_MAP\n\tvec4 mapTexel = texture2D( map, uv );\n\tdiffuseColor *= mapTexelToLinear( mapTexel );\n#endif\n#ifdef USE_ALPHAMAP\n\tdiffuseColor.a *= texture2D( alphaMap, uv ).g;\n#endif",map_particle_pars_fragment:"#if defined( USE_MAP ) || defined( USE_ALPHAMAP )\n\tuniform mat3 uvTransform;\n#endif\n#ifdef USE_MAP\n\tuniform sampler2D map;\n#endif\n#ifdef USE_ALPHAMAP\n\tuniform sampler2D alphaMap;\n#endif",metalnessmap_fragment:"float metalnessFactor = metalness;\n#ifdef USE_METALNESSMAP\n\tvec4 texelMetalness = texture2D( metalnessMap, vUv );\n\tmetalnessFactor *= texelMetalness.b;\n#endif",metalnessmap_pars_fragment:"#ifdef USE_METALNESSMAP\n\tuniform sampler2D metalnessMap;\n#endif",morphnormal_vertex:"#ifdef USE_MORPHNORMALS\n\tobjectNormal *= morphTargetBaseInfluence;\n\t#ifdef MORPHTARGETS_TEXTURE\n\t\tfor ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {\n\t\t\tif ( morphTargetInfluences[ i ] != 0.0 ) objectNormal += getMorph( gl_VertexID, i, 1, 2 ) * morphTargetInfluences[ i ];\n\t\t}\n\t#else\n\t\tobjectNormal += morphNormal0 * morphTargetInfluences[ 0 ];\n\t\tobjectNormal += morphNormal1 * morphTargetInfluences[ 1 ];\n\t\tobjectNormal += morphNormal2 * morphTargetInfluences[ 2 ];\n\t\tobjectNormal += morphNormal3 * morphTargetInfluences[ 3 ];\n\t#endif\n#endif",morphtarget_pars_vertex:"#ifdef USE_MORPHTARGETS\n\tuniform float morphTargetBaseInfluence;\n\t#ifdef MORPHTARGETS_TEXTURE\n\t\tuniform float morphTargetInfluences[ MORPHTARGETS_COUNT ];\n\t\tuniform sampler2DArray morphTargetsTexture;\n\t\tuniform ivec2 morphTargetsTextureSize;\n\t\tvec3 getMorph( const in int vertexIndex, const in int morphTargetIndex, const in int offset, const in int stride ) {\n\t\t\tint texelIndex = vertexIndex * stride + offset;\n\t\t\tint y = texelIndex / morphTargetsTextureSize.x;\n\t\t\tint x = texelIndex - y * morphTargetsTextureSize.x;\n\t\t\tivec3 morphUV = ivec3( x, y, morphTargetIndex );\n\t\t\treturn texelFetch( morphTargetsTexture, morphUV, 0 ).xyz;\n\t\t}\n\t#else\n\t\t#ifndef USE_MORPHNORMALS\n\t\t\tuniform float morphTargetInfluences[ 8 ];\n\t\t#else\n\t\t\tuniform float morphTargetInfluences[ 4 ];\n\t\t#endif\n\t#endif\n#endif",morphtarget_vertex:"#ifdef USE_MORPHTARGETS\n\ttransformed *= morphTargetBaseInfluence;\n\t#ifdef MORPHTARGETS_TEXTURE\n\t\tfor ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {\n\t\t\t#ifndef USE_MORPHNORMALS\n\t\t\t\tif ( morphTargetInfluences[ i ] != 0.0 ) transformed += getMorph( gl_VertexID, i, 0, 1 ) * morphTargetInfluences[ i ];\n\t\t\t#else\n\t\t\t\tif ( morphTargetInfluences[ i ] != 0.0 ) transformed += getMorph( gl_VertexID, i, 0, 2 ) * morphTargetInfluences[ i ];\n\t\t\t#endif\n\t\t}\n\t#else\n\t\ttransformed += morphTarget0 * morphTargetInfluences[ 0 ];\n\t\ttransformed += morphTarget1 * morphTargetInfluences[ 1 ];\n\t\ttransformed += morphTarget2 * morphTargetInfluences[ 2 ];\n\t\ttransformed += morphTarget3 * morphTargetInfluences[ 3 ];\n\t\t#ifndef USE_MORPHNORMALS\n\t\t\ttransformed += morphTarget4 * morphTargetInfluences[ 4 ];\n\t\t\ttransformed += morphTarget5 * morphTargetInfluences[ 5 ];\n\t\t\ttransformed += morphTarget6 * morphTargetInfluences[ 6 ];\n\t\t\ttransformed += morphTarget7 * morphTargetInfluences[ 7 ];\n\t\t#endif\n\t#endif\n#endif",normal_fragment_begin:"float faceDirection = gl_FrontFacing ? 1.0 : - 1.0;\n#ifdef FLAT_SHADED\n\tvec3 fdx = vec3( dFdx( vViewPosition.x ), dFdx( vViewPosition.y ), dFdx( vViewPosition.z ) );\n\tvec3 fdy = vec3( dFdy( vViewPosition.x ), dFdy( vViewPosition.y ), dFdy( vViewPosition.z ) );\n\tvec3 normal = normalize( cross( fdx, fdy ) );\n#else\n\tvec3 normal = normalize( vNormal );\n\t#ifdef DOUBLE_SIDED\n\t\tnormal = normal * faceDirection;\n\t#endif\n\t#ifdef USE_TANGENT\n\t\tvec3 tangent = normalize( vTangent );\n\t\tvec3 bitangent = normalize( vBitangent );\n\t\t#ifdef DOUBLE_SIDED\n\t\t\ttangent = tangent * faceDirection;\n\t\t\tbitangent = bitangent * faceDirection;\n\t\t#endif\n\t\t#if defined( TANGENTSPACE_NORMALMAP ) || defined( USE_CLEARCOAT_NORMALMAP )\n\t\t\tmat3 vTBN = mat3( tangent, bitangent, normal );\n\t\t#endif\n\t#endif\n#endif\nvec3 geometryNormal = normal;",normal_fragment_maps:"#ifdef OBJECTSPACE_NORMALMAP\n\tnormal = texture2D( normalMap, vUv ).xyz * 2.0 - 1.0;\n\t#ifdef FLIP_SIDED\n\t\tnormal = - normal;\n\t#endif\n\t#ifdef DOUBLE_SIDED\n\t\tnormal = normal * faceDirection;\n\t#endif\n\tnormal = normalize( normalMatrix * normal );\n#elif defined( TANGENTSPACE_NORMALMAP )\n\tvec3 mapN = texture2D( normalMap, vUv ).xyz * 2.0 - 1.0;\n\t#ifdef USE_LOWER_8_BIT_NORMALMAP\n\tvec3 lowerMapN = texture2D( lowerNormalMap, vUv ).xyz * 2.0 - 1.0;\n\tmapN = mapN * (256.0 / 257.0) + lowerMapN / 257.0;\n\t#endif\n\tmapN.xy *= normalScale;\n\t#ifdef USE_TANGENT\n\t\tnormal = normalize( vTBN * mapN );\n\t#else\n\t\tnormal = perturbNormal2Arb( - vViewPosition, normal, mapN, faceDirection );\n\t#endif\n#elif defined( USE_BUMPMAP )\n\tnormal = perturbNormalArb( - vViewPosition, normal, dHdxy_fwd(), faceDirection );\n#endif",normal_pars_fragment:"#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n\t#ifdef USE_TANGENT\n\t\tvarying vec3 vTangent;\n\t\tvarying vec3 vBitangent;\n\t#endif\n#endif",normal_pars_vertex:"#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n\t#ifdef USE_TANGENT\n\t\tvarying vec3 vTangent;\n\t\tvarying vec3 vBitangent;\n\t#endif\n#endif",normal_vertex:"#ifndef FLAT_SHADED\n\tvNormal = normalize( transformedNormal );\n\t#ifdef USE_TANGENT\n\t\tvTangent = normalize( transformedTangent );\n\t\tvBitangent = normalize( cross( vNormal, vTangent ) * tangent.w );\n\t#endif\n#endif",normalmap_pars_fragment:"#ifdef USE_NORMALMAP\n\tuniform sampler2D normalMap;\n\tuniform vec2 normalScale;\n\t#ifdef USE_LOWER_8_BIT_NORMALMAP\n\tuniform sampler2D lowerNormalMap;\n\t#endif\n#endif\n#ifdef OBJECTSPACE_NORMALMAP\n\tuniform mat3 normalMatrix;\n#endif\n#if ! defined ( USE_TANGENT ) && ( defined ( TANGENTSPACE_NORMALMAP ) || defined ( USE_CLEARCOAT_NORMALMAP ) )\n\tvec3 perturbNormal2Arb( vec3 eye_pos, vec3 surf_norm, vec3 mapN, float faceDirection ) {\n\t\tvec3 q0 = vec3( dFdx( eye_pos.x ), dFdx( eye_pos.y ), dFdx( eye_pos.z ) );\n\t\tvec3 q1 = vec3( dFdy( eye_pos.x ), dFdy( eye_pos.y ), dFdy( eye_pos.z ) );\n\t\tvec2 st0 = dFdx( vUv.st );\n\t\tvec2 st1 = dFdy( vUv.st );\n\t#ifdef PERTURB_NORMAL_R115_COMPATABILITY\n\t\tfloat scale = sign( st1.t * st0.s - st0.t * st1.s );\n\t\tvec3 S = normalize( ( q0 * st1.t - q1 * st0.t ) * scale );\n\t\tvec3 T = normalize( ( - q0 * st1.s + q1 * st0.s ) * scale );\n\t\tvec3 N = normalize( surf_norm );\n\t\tmat3 tsn = mat3( S, T, N );\n\t\tmapN.xy *= ( faceDirection * 2.0 - 1.0 );\n\t\treturn normalize( tsn * mapN );\n\t#else\n\t\tvec3 N = surf_norm;\n\t\tvec3 q1perp = cross( q1, N );\n\t\tvec3 q0perp = cross( N, q0 );\n\t\tvec3 T = q1perp * st0.x + q0perp * st1.x;\n\t\tvec3 B = q1perp * st0.y + q0perp * st1.y;\n\t\tfloat det = max( dot( T, T ), dot( B, B ) );\n\t\tfloat scale = ( det == 0.0 ) ? 0.0 : faceDirection * inversesqrt( det );\n\t\treturn normalize( T * ( mapN.x * scale ) + B * ( mapN.y * scale ) + N * mapN.z );\n\t#endif\n\t}\n#endif",clearcoat_normal_fragment_begin:"#ifdef USE_CLEARCOAT\n\tvec3 clearcoatNormal = geometryNormal;\n#endif",clearcoat_normal_fragment_maps:"#ifdef USE_CLEARCOAT_NORMALMAP\n\tvec3 clearcoatMapN = texture2D( clearcoatNormalMap, vUv ).xyz * 2.0 - 1.0;\n\tclearcoatMapN.xy *= clearcoatNormalScale;\n\t#ifdef USE_TANGENT\n\t\tclearcoatNormal = normalize( vTBN * clearcoatMapN );\n\t#else\n\t\tclearcoatNormal = perturbNormal2Arb( - vViewPosition, clearcoatNormal, clearcoatMapN, faceDirection );\n\t#endif\n#endif",clearcoat_pars_fragment:"#ifdef USE_CLEARCOATMAP\n\tuniform sampler2D clearcoatMap;\n#endif\n#ifdef USE_CLEARCOAT_ROUGHNESSMAP\n\tuniform sampler2D clearcoatRoughnessMap;\n#endif\n#ifdef USE_CLEARCOAT_NORMALMAP\n\tuniform sampler2D clearcoatNormalMap;\n\tuniform vec2 clearcoatNormalScale;\n#endif",output_fragment:"#ifndef ALPHA_R115_COMPATABILITY\n#ifdef OPAQUE\ndiffuseColor.a = 1.0;\n#endif\n#endif\n#ifdef USE_TRANSMISSION\ndiffuseColor.a *= transmissionAlpha + 0.1;\n#endif\ngl_FragColor = vec4( outgoingLight, diffuseColor.a );",packing:"vec3 packNormalToRGB( const in vec3 normal ) {\n\treturn normalize( normal ) * 0.5 + 0.5;\n}\nvec3 unpackRGBToNormal( const in vec3 rgb ) {\n\treturn 2.0 * rgb.xyz - 1.0;\n}\nconst float PackUpscale = 256. / 255.;const float UnpackDownscale = 255. / 256.;\nconst vec3 PackFactors = vec3( 256. * 256. * 256., 256. * 256., 256. );\nconst vec4 UnpackFactors = UnpackDownscale / vec4( PackFactors, 1. );\nconst float ShiftRight8 = 1. / 256.;\nvec4 packDepthToRGBA( const in float v ) {\n\tvec4 r = vec4( fract( v * PackFactors ), v );\n\tr.yzw -= r.xyz * ShiftRight8;\treturn r * PackUpscale;\n}\nfloat unpackRGBAToDepth( const in vec4 v ) {\n\treturn dot( v, UnpackFactors );\n}\nvec4 pack2HalfToRGBA( vec2 v ) {\n\tvec4 r = vec4( v.x, fract( v.x * 255.0 ), v.y, fract( v.y * 255.0 ) );\n\treturn vec4( r.x - r.y / 255.0, r.y, r.z - r.w / 255.0, r.w );\n}\nvec2 unpackRGBATo2Half( vec4 v ) {\n\treturn vec2( v.x + ( v.y / 255.0 ), v.z + ( v.w / 255.0 ) );\n}\nfloat viewZToOrthographicDepth( const in float viewZ, const in float near, const in float far ) {\n\treturn ( viewZ + near ) / ( near - far );\n}\nfloat orthographicDepthToViewZ( const in float linearClipZ, const in float near, const in float far ) {\n\treturn linearClipZ * ( near - far ) - near;\n}\nfloat viewZToPerspectiveDepth( const in float viewZ, const in float near, const in float far ) {\n\treturn ( ( near + viewZ ) * far ) / ( ( far - near ) * viewZ );\n}\nfloat perspectiveDepthToViewZ( const in float invClipZ, const in float near, const in float far ) {\n\treturn ( near * far ) / ( ( far - near ) * invClipZ - far );\n}",premultiplied_alpha_fragment:"#ifdef PREMULTIPLIED_ALPHA\n\tgl_FragColor.rgb *= gl_FragColor.a;\n#endif",project_vertex:"vec4 mvPosition = vec4( transformed, 1.0 );\n#ifdef USE_INSTANCING\n\tmvPosition = instanceMatrix * mvPosition;\n#endif\nmvPosition = modelViewMatrix * mvPosition;\ngl_Position = projectionMatrix * mvPosition;",dithering_fragment:"#ifdef DITHERING\n\tgl_FragColor.rgb = dithering( gl_FragColor.rgb );\n#endif",dithering_pars_fragment:"#ifdef DITHERING\n\tvec3 dithering( vec3 color ) {\n\t\tfloat grid_position = rand( gl_FragCoord.xy );\n\t\tvec3 dither_shift_RGB = vec3( 0.25 / 255.0, -0.25 / 255.0, 0.25 / 255.0 );\n\t\tdither_shift_RGB = mix( 2.0 * dither_shift_RGB, -2.0 * dither_shift_RGB, grid_position );\n\t\treturn color + dither_shift_RGB;\n\t}\n#endif",roughnessmap_fragment:"float roughnessFactor = roughness;\n#ifdef USE_ROUGHNESSMAP\n\tvec4 texelRoughness = texture2D( roughnessMap, vUv );\n\troughnessFactor *= texelRoughness.g;\n#endif",roughnessmap_pars_fragment:"#ifdef USE_ROUGHNESSMAP\n\tuniform sampler2D roughnessMap;\n#endif",shadowmap_pars_fragment:"#ifdef USE_SHADOWMAP\n\t#if NUM_DIR_LIGHT_SHADOWS > 0\n\t\tuniform sampler2D directionalShadowMap[ NUM_DIR_LIGHT_SHADOWS ];\n\t\tvarying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHT_SHADOWS ];\n\t\tstruct DirectionalLightShadow {\n\t\t\tfloat shadowBias;\n\t\t\tfloat shadowNormalBias;\n\t\t\tfloat shadowRadius;\n\t\t\tvec2 shadowMapSize;\n\t\t};\n\t\tuniform DirectionalLightShadow directionalLightShadows[ NUM_DIR_LIGHT_SHADOWS ];\n\t#endif\n\t#if NUM_SPOT_LIGHT_SHADOWS > 0\n\t\tuniform sampler2D spotShadowMap[ NUM_SPOT_LIGHT_SHADOWS ];\n\t\tvarying vec4 vSpotShadowCoord[ NUM_SPOT_LIGHT_SHADOWS ];\n\t\tstruct SpotLightShadow {\n\t\t\tfloat shadowBias;\n\t\t\tfloat shadowNormalBias;\n\t\t\tfloat shadowRadius;\n\t\t\tvec2 shadowMapSize;\n\t\t};\n\t\tuniform SpotLightShadow spotLightShadows[ NUM_SPOT_LIGHT_SHADOWS ];\n\t#endif\n\t#if NUM_POINT_LIGHT_SHADOWS > 0\n\t\tuniform sampler2D pointShadowMap[ NUM_POINT_LIGHT_SHADOWS ];\n\t\tvarying vec4 vPointShadowCoord[ NUM_POINT_LIGHT_SHADOWS ];\n\t\tstruct PointLightShadow {\n\t\t\tfloat shadowBias;\n\t\t\tfloat shadowNormalBias;\n\t\t\tfloat shadowRadius;\n\t\t\tvec2 shadowMapSize;\n\t\t\tfloat shadowCameraNear;\n\t\t\tfloat shadowCameraFar;\n\t\t};\n\t\tuniform PointLightShadow pointLightShadows[ NUM_POINT_LIGHT_SHADOWS ];\n\t#endif\n\tfloat texture2DCompare( sampler2D depths, vec2 uv, float compare ) {\n\t\treturn step( compare, unpackRGBAToDepth( texture2D( depths, uv ) ) );\n\t}\n\tvec2 texture2DDistribution( sampler2D shadow, vec2 uv ) {\n\t\treturn unpackRGBATo2Half( texture2D( shadow, uv ) );\n\t}\n\tfloat VSMShadow (sampler2D shadow, vec2 uv, float compare ){\n\t\tfloat occlusion = 1.0;\n\t\tvec2 distribution = texture2DDistribution( shadow, uv );\n\t\tfloat hard_shadow = step( compare , distribution.x );\n\t\tif (hard_shadow != 1.0 ) {\n\t\t\tfloat distance = compare - distribution.x ;\n\t\t\tfloat variance = max( 0.00000, distribution.y * distribution.y );\n\t\t\tfloat softness_probability = variance / (variance + distance * distance );\t\t\tsoftness_probability = clamp( ( softness_probability - 0.3 ) / ( 0.95 - 0.3 ), 0.0, 1.0 );\t\t\tocclusion = clamp( max( hard_shadow, softness_probability ), 0.0, 1.0 );\n\t\t}\n\t\treturn occlusion;\n\t}\n\tfloat getShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowBias, float shadowRadius, vec4 shadowCoord ) {\n\t\tfloat shadow = 1.0;\n\t\tshadowCoord.xyz /= shadowCoord.w;\n\t\tshadowCoord.z += shadowBias;\n\t\tbvec4 inFrustumVec = bvec4 ( shadowCoord.x >= 0.0, shadowCoord.x <= 1.0, shadowCoord.y >= 0.0, shadowCoord.y <= 1.0 );\n\t\tbool inFrustum = all( inFrustumVec );\n\t\tbvec2 frustumTestVec = bvec2( inFrustum, shadowCoord.z <= 1.0 );\n\t\tbool frustumTest = all( frustumTestVec );\n\t\tif ( frustumTest ) {\n\t\t#if defined( SHADOWMAP_TYPE_PCF )\n\t\t\tvec2 texelSize = vec2( 1.0 ) / shadowMapSize;\n\t\t\tfloat dx0 = - texelSize.x * shadowRadius;\n\t\t\tfloat dy0 = - texelSize.y * shadowRadius;\n\t\t\tfloat dx1 = + texelSize.x * shadowRadius;\n\t\t\tfloat dy1 = + texelSize.y * shadowRadius;\n\t\t\tfloat dx2 = dx0 / 2.0;\n\t\t\tfloat dy2 = dy0 / 2.0;\n\t\t\tfloat dx3 = dx1 / 2.0;\n\t\t\tfloat dy3 = dy1 / 2.0;\n\t\t\tshadow = (\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, dy0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, dy0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, dy2 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy2 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, dy2 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy, shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, dy3 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy3 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, dy3 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, dy1 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy1 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, dy1 ), shadowCoord.z )\n\t\t\t) * ( 1.0 / 17.0 );\n\t\t#elif defined( SHADOWMAP_TYPE_PCF_SOFT )\n\t\t\tvec2 texelSize = vec2( 1.0 ) / shadowMapSize;\n\t\t\tfloat dx = texelSize.x;\n\t\t\tfloat dy = texelSize.y;\n\t\t\tvec2 uv = shadowCoord.xy;\n\t\t\tvec2 f = fract( uv * shadowMapSize + 0.5 );\n\t\t\tuv -= f * texelSize;\n\t\t\tshadow = (\n\t\t\t\ttexture2DCompare( shadowMap, uv, shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, uv + vec2( dx, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, uv + vec2( 0.0, dy ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, uv + texelSize, shadowCoord.z ) +\n\t\t\t\tmix( texture2DCompare( shadowMap, uv + vec2( -dx, 0.0 ), shadowCoord.z ), \n\t\t\t\t\t texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, 0.0 ), shadowCoord.z ),\n\t\t\t\t\t f.x ) +\n\t\t\t\tmix( texture2DCompare( shadowMap, uv + vec2( -dx, dy ), shadowCoord.z ), \n\t\t\t\t\t texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, dy ), shadowCoord.z ),\n\t\t\t\t\t f.x ) +\n\t\t\t\tmix( texture2DCompare( shadowMap, uv + vec2( 0.0, -dy ), shadowCoord.z ), \n\t\t\t\t\t texture2DCompare( shadowMap, uv + vec2( 0.0, 2.0 * dy ), shadowCoord.z ),\n\t\t\t\t\t f.y ) +\n\t\t\t\tmix( texture2DCompare( shadowMap, uv + vec2( dx, -dy ), shadowCoord.z ), \n\t\t\t\t\t texture2DCompare( shadowMap, uv + vec2( dx, 2.0 * dy ), shadowCoord.z ),\n\t\t\t\t\t f.y ) +\n\t\t\t\tmix( mix( texture2DCompare( shadowMap, uv + vec2( -dx, -dy ), shadowCoord.z ), \n\t\t\t\t\t\t\ttexture2DCompare( shadowMap, uv + vec2( 2.0 * dx, -dy ), shadowCoord.z ),\n\t\t\t\t\t\t\tf.x ),\n\t\t\t\t\t mix( texture2DCompare( shadowMap, uv + vec2( -dx, 2.0 * dy ), shadowCoord.z ), \n\t\t\t\t\t\t\ttexture2DCompare( shadowMap, uv + vec2( 2.0 * dx, 2.0 * dy ), shadowCoord.z ),\n\t\t\t\t\t\t\tf.x ),\n\t\t\t\t\t f.y )\n\t\t\t) * ( 1.0 / 9.0 );\n\t\t#elif defined( SHADOWMAP_TYPE_VSM )\n\t\t\tshadow = VSMShadow( shadowMap, shadowCoord.xy, shadowCoord.z );\n\t\t#else\n\t\t\tshadow = texture2DCompare( shadowMap, shadowCoord.xy, shadowCoord.z );\n\t\t#endif\n\t\t}\n\t\treturn shadow;\n\t}\n\tvec2 cubeToUV( vec3 v, float texelSizeY ) {\n\t\tvec3 absV = abs( v );\n\t\tfloat scaleToCube = 1.0 / max( absV.x, max( absV.y, absV.z ) );\n\t\tabsV *= scaleToCube;\n\t\tv *= scaleToCube * ( 1.0 - 2.0 * texelSizeY );\n\t\tvec2 planar = v.xy;\n\t\tfloat almostATexel = 1.5 * texelSizeY;\n\t\tfloat almostOne = 1.0 - almostATexel;\n\t\tif ( absV.z >= almostOne ) {\n\t\t\tif ( v.z > 0.0 )\n\t\t\t\tplanar.x = 4.0 - v.x;\n\t\t} else if ( absV.x >= almostOne ) {\n\t\t\tfloat signX = sign( v.x );\n\t\t\tplanar.x = v.z * signX + 2.0 * signX;\n\t\t} else if ( absV.y >= almostOne ) {\n\t\t\tfloat signY = sign( v.y );\n\t\t\tplanar.x = v.x + 2.0 * signY + 2.0;\n\t\t\tplanar.y = v.z * signY - 2.0;\n\t\t}\n\t\treturn vec2( 0.125, 0.25 ) * planar + vec2( 0.375, 0.75 );\n\t}\n\tfloat getPointShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowBias, float shadowRadius, vec4 shadowCoord, float shadowCameraNear, float shadowCameraFar ) {\n\t\tvec2 texelSize = vec2( 1.0 ) / ( shadowMapSize * vec2( 4.0, 2.0 ) );\n\t\tvec3 lightToPosition = shadowCoord.xyz;\n\t\tfloat dp = ( length( lightToPosition ) - shadowCameraNear ) / ( shadowCameraFar - shadowCameraNear );\t\tdp += shadowBias;\n\t\tvec3 bd3D = normalize( lightToPosition );\n\t\t#if defined( SHADOWMAP_TYPE_PCF ) || defined( SHADOWMAP_TYPE_PCF_SOFT ) || defined( SHADOWMAP_TYPE_VSM )\n\t\t\tvec2 offset = vec2( - 1, 1 ) * shadowRadius * texelSize.y;\n\t\t\treturn (\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.xyy, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.yyy, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.xyx, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.yyx, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.xxy, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.yxy, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.xxx, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.yxx, texelSize.y ), dp )\n\t\t\t) * ( 1.0 / 9.0 );\n\t\t#else\n\t\t\treturn texture2DCompare( shadowMap, cubeToUV( bd3D, texelSize.y ), dp );\n\t\t#endif\n\t}\n#endif",shadowmap_pars_vertex:"#ifdef USE_SHADOWMAP\n\t#if NUM_DIR_LIGHT_SHADOWS > 0\n\t\tuniform mat4 directionalShadowMatrix[ NUM_DIR_LIGHT_SHADOWS ];\n\t\tvarying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHT_SHADOWS ];\n\t\tstruct DirectionalLightShadow {\n\t\t\tfloat shadowBias;\n\t\t\tfloat shadowNormalBias;\n\t\t\tfloat shadowRadius;\n\t\t\tvec2 shadowMapSize;\n\t\t};\n\t\tuniform DirectionalLightShadow directionalLightShadows[ NUM_DIR_LIGHT_SHADOWS ];\n\t#endif\n\t#if NUM_SPOT_LIGHT_SHADOWS > 0\n\t\tuniform mat4 spotShadowMatrix[ NUM_SPOT_LIGHT_SHADOWS ];\n\t\tvarying vec4 vSpotShadowCoord[ NUM_SPOT_LIGHT_SHADOWS ];\n\t\tstruct SpotLightShadow {\n\t\t\tfloat shadowBias;\n\t\t\tfloat shadowNormalBias;\n\t\t\tfloat shadowRadius;\n\t\t\tvec2 shadowMapSize;\n\t\t};\n\t\tuniform SpotLightShadow spotLightShadows[ NUM_SPOT_LIGHT_SHADOWS ];\n\t#endif\n\t#if NUM_POINT_LIGHT_SHADOWS > 0\n\t\tuniform mat4 pointShadowMatrix[ NUM_POINT_LIGHT_SHADOWS ];\n\t\tvarying vec4 vPointShadowCoord[ NUM_POINT_LIGHT_SHADOWS ];\n\t\tstruct PointLightShadow {\n\t\t\tfloat shadowBias;\n\t\t\tfloat shadowNormalBias;\n\t\t\tfloat shadowRadius;\n\t\t\tvec2 shadowMapSize;\n\t\t\tfloat shadowCameraNear;\n\t\t\tfloat shadowCameraFar;\n\t\t};\n\t\tuniform PointLightShadow pointLightShadows[ NUM_POINT_LIGHT_SHADOWS ];\n\t#endif\n#endif",shadowmap_vertex:"#ifdef USE_SHADOWMAP\n\t#if NUM_DIR_LIGHT_SHADOWS > 0 || NUM_SPOT_LIGHT_SHADOWS > 0 || NUM_POINT_LIGHT_SHADOWS > 0\n\t\tvec3 shadowWorldNormal = inverseTransformDirection( transformedNormal, viewMatrix );\n\t\tvec4 shadowWorldPosition;\n\t#endif\n\t#if NUM_DIR_LIGHT_SHADOWS > 0\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_DIR_LIGHT_SHADOWS; i ++ ) {\n\t\tshadowWorldPosition = worldPosition + vec4( shadowWorldNormal * directionalLightShadows[ i ].shadowNormalBias, 0 );\n\t\tvDirectionalShadowCoord[ i ] = directionalShadowMatrix[ i ] * shadowWorldPosition;\n\t}\n\t#pragma unroll_loop_end\n\t#endif\n\t#if NUM_SPOT_LIGHT_SHADOWS > 0\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_SPOT_LIGHT_SHADOWS; i ++ ) {\n\t\tshadowWorldPosition = worldPosition + vec4( shadowWorldNormal * spotLightShadows[ i ].shadowNormalBias, 0 );\n\t\tvSpotShadowCoord[ i ] = spotShadowMatrix[ i ] * shadowWorldPosition;\n\t}\n\t#pragma unroll_loop_end\n\t#endif\n\t#if NUM_POINT_LIGHT_SHADOWS > 0\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_POINT_LIGHT_SHADOWS; i ++ ) {\n\t\tshadowWorldPosition = worldPosition + vec4( shadowWorldNormal * pointLightShadows[ i ].shadowNormalBias, 0 );\n\t\tvPointShadowCoord[ i ] = pointShadowMatrix[ i ] * shadowWorldPosition;\n\t}\n\t#pragma unroll_loop_end\n\t#endif\n#endif",shadowmask_pars_fragment:"float getShadowMask() {\n\tfloat shadow = 1.0;\n\t#ifdef USE_SHADOWMAP\n\t#if NUM_DIR_LIGHT_SHADOWS > 0\n\tDirectionalLightShadow directionalLight;\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_DIR_LIGHT_SHADOWS; i ++ ) {\n\t\tdirectionalLight = directionalLightShadows[ i ];\n\t\tshadow *= receiveShadow ? getShadow( directionalShadowMap[ i ], directionalLight.shadowMapSize, directionalLight.shadowBias, directionalLight.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0;\n\t}\n\t#pragma unroll_loop_end\n\t#endif\n\t#if NUM_SPOT_LIGHT_SHADOWS > 0\n\tSpotLightShadow spotLight;\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_SPOT_LIGHT_SHADOWS; i ++ ) {\n\t\tspotLight = spotLightShadows[ i ];\n\t\tshadow *= receiveShadow ? getShadow( spotShadowMap[ i ], spotLight.shadowMapSize, spotLight.shadowBias, spotLight.shadowRadius, vSpotShadowCoord[ i ] ) : 1.0;\n\t}\n\t#pragma unroll_loop_end\n\t#endif\n\t#if NUM_POINT_LIGHT_SHADOWS > 0\n\tPointLightShadow pointLight;\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_POINT_LIGHT_SHADOWS; i ++ ) {\n\t\tpointLight = pointLightShadows[ i ];\n\t\tshadow *= receiveShadow ? getPointShadow( pointShadowMap[ i ], pointLight.shadowMapSize, pointLight.shadowBias, pointLight.shadowRadius, vPointShadowCoord[ i ], pointLight.shadowCameraNear, pointLight.shadowCameraFar ) : 1.0;\n\t}\n\t#pragma unroll_loop_end\n\t#endif\n\t#endif\n\treturn shadow;\n}",skinbase_vertex:"#ifdef USE_SKINNING\n\tmat4 boneMatX = getBoneMatrix( skinIndex.x );\n\tmat4 boneMatY = getBoneMatrix( skinIndex.y );\n\tmat4 boneMatZ = getBoneMatrix( skinIndex.z );\n\tmat4 boneMatW = getBoneMatrix( skinIndex.w );\n#endif",skinning_pars_vertex:"#ifdef USE_SKINNING\n\tuniform mat4 bindMatrix;\n\tuniform mat4 bindMatrixInverse;\n\t#ifdef BONE_TEXTURE\n\t\tuniform highp sampler2D boneTexture;\n\t\tuniform int boneTextureSize;\n\t\tmat4 getBoneMatrix( const in float i ) {\n\t\t\tfloat j = i * 4.0;\n\t\t\tfloat x = mod( j, float( boneTextureSize ) );\n\t\t\tfloat y = floor( j / float( boneTextureSize ) );\n\t\t\tfloat dx = 1.0 / float( boneTextureSize );\n\t\t\tfloat dy = 1.0 / float( boneTextureSize );\n\t\t\ty = dy * ( y + 0.5 );\n\t\t\tvec4 v1 = texture2D( boneTexture, vec2( dx * ( x + 0.5 ), y ) );\n\t\t\tvec4 v2 = texture2D( boneTexture, vec2( dx * ( x + 1.5 ), y ) );\n\t\t\tvec4 v3 = texture2D( boneTexture, vec2( dx * ( x + 2.5 ), y ) );\n\t\t\tvec4 v4 = texture2D( boneTexture, vec2( dx * ( x + 3.5 ), y ) );\n\t\t\tmat4 bone = mat4( v1, v2, v3, v4 );\n\t\t\treturn bone;\n\t\t}\n\t#else\n\t\tuniform mat4 boneMatrices[ MAX_BONES ];\n\t\tmat4 getBoneMatrix( const in float i ) {\n\t\t\tmat4 bone = boneMatrices[ int(i) ];\n\t\t\treturn bone;\n\t\t}\n\t#endif\n#endif",skinning_vertex:"#ifdef USE_SKINNING\n\tvec4 skinVertex = bindMatrix * vec4( transformed, 1.0 );\n\tvec4 skinned = vec4( 0.0 );\n\tskinned += boneMatX * skinVertex * skinWeight.x;\n\tskinned += boneMatY * skinVertex * skinWeight.y;\n\tskinned += boneMatZ * skinVertex * skinWeight.z;\n\tskinned += boneMatW * skinVertex * skinWeight.w;\n\ttransformed = ( bindMatrixInverse * skinned ).xyz;\n#endif",skinnormal_vertex:"#ifdef USE_SKINNING\n\tmat4 skinMatrix = mat4( 0.0 );\n\tskinMatrix += skinWeight.x * boneMatX;\n\tskinMatrix += skinWeight.y * boneMatY;\n\tskinMatrix += skinWeight.z * boneMatZ;\n\tskinMatrix += skinWeight.w * boneMatW;\n\tskinMatrix = bindMatrixInverse * skinMatrix * bindMatrix;\n\tobjectNormal = vec4( skinMatrix * vec4( objectNormal, 0.0 ) ).xyz;\n\t#ifdef USE_TANGENT\n\t\tobjectTangent = vec4( skinMatrix * vec4( objectTangent, 0.0 ) ).xyz;\n\t#endif\n#endif",specularmap_fragment:"float specularStrength;\n#ifdef USE_SPECULARMAP\n\tvec4 texelSpecular = texture2D( specularMap, vUv );\n\tspecularStrength = texelSpecular.r;\n#else\n\tspecularStrength = 1.0;\n#endif",specularmap_pars_fragment:"#ifdef USE_SPECULARMAP\n\tuniform sampler2D specularMap;\n#endif",tonemapping_fragment:"#if defined( TONE_MAPPING )\n\tgl_FragColor.rgb = toneMapping( gl_FragColor.rgb );\n#endif",tonemapping_pars_fragment:"#ifndef saturate\n#define saturate( a ) clamp( a, 0.0, 1.0 )\n#endif\nuniform float toneMappingExposure;\nvec3 LinearToneMapping( vec3 color ) {\n\treturn toneMappingExposure * color;\n}\nvec3 ReinhardToneMapping( vec3 color ) {\n\tcolor *= toneMappingExposure;\n\treturn saturate( color / ( vec3( 1.0 ) + color ) );\n}\nvec3 OptimizedCineonToneMapping( vec3 color ) {\n\tcolor *= toneMappingExposure;\n\tcolor = max( vec3( 0.0 ), color - 0.004 );\n\treturn pow( ( color * ( 6.2 * color + 0.5 ) ) / ( color * ( 6.2 * color + 1.7 ) + 0.06 ), vec3( 2.2 ) );\n}\nvec3 RRTAndODTFit( vec3 v ) {\n\tvec3 a = v * ( v + 0.0245786 ) - 0.000090537;\n\tvec3 b = v * ( 0.983729 * v + 0.4329510 ) + 0.238081;\n\treturn a / b;\n}\nvec3 ACESFilmicToneMapping( vec3 color ) {\n\tconst mat3 ACESInputMat = mat3(\n\t\tvec3( 0.59719, 0.07600, 0.02840 ),\t\tvec3( 0.35458, 0.90834, 0.13383 ),\n\t\tvec3( 0.04823, 0.01566, 0.83777 )\n\t);\n\tconst mat3 ACESOutputMat = mat3(\n\t\tvec3(\t1.60475, -0.10208, -0.00327 ),\t\tvec3( -0.53108,\t1.10813, -0.07276 ),\n\t\tvec3( -0.07367, -0.00605,\t1.07602 )\n\t);\n\tcolor *= toneMappingExposure / 0.6;\n\tcolor = ACESInputMat * color;\n\tcolor = RRTAndODTFit( color );\n\tcolor = ACESOutputMat * color;\n\treturn saturate( color );\n}\nvec3 CustomToneMapping( vec3 color ) {\n\tcolor *= toneMappingExposure;\n\treturn saturate( ( color * ( 2.51 * color + 0.03 ) ) / ( color * ( 2.43 * color + 0.59 ) + 0.14 ) );\n}",transmission_fragment:"#ifdef USE_TRANSMISSION\n\tfloat transmissionAlpha = 1.0;\n\tfloat transmissionFactor = transmission;\n\tfloat thicknessFactor = thickness;\n\t#ifdef USE_TRANSMISSIONMAP\n\t\ttransmissionFactor *= texture2D( transmissionMap, vUv ).r;\n\t#endif\n\t#ifdef USE_THICKNESSMAP\n\t\tthicknessFactor *= texture2D( thicknessMap, vUv ).g;\n\t#endif\n\tvec3 pos = vWorldPosition;\n\tvec3 v = normalize( cameraPosition - pos );\n\tvec3 n = inverseTransformDirection( normal, viewMatrix );\n\tvec4 transmission = getIBLVolumeRefraction(\n\t\tn, v, roughnessFactor, material.diffuseColor, material.specularColor, material.specularF90,\n\t\tpos, modelMatrix, viewMatrix, projectionMatrix, ior, thicknessFactor,\n\t\tattenuationColor, attenuationDistance );\n\ttotalDiffuse = mix( totalDiffuse, transmission.rgb, transmissionFactor );\n\ttransmissionAlpha = mix( transmissionAlpha, transmission.a, transmissionFactor );\n#endif",transmission_pars_fragment:"#ifdef USE_TRANSMISSION\n\tuniform float transmission;\n\tuniform float thickness;\n\tuniform float attenuationDistance;\n\tuniform vec3 attenuationColor;\n\t#ifdef USE_TRANSMISSIONMAP\n\t\tuniform sampler2D transmissionMap;\n\t#endif\n\t#ifdef USE_THICKNESSMAP\n\t\tuniform sampler2D thicknessMap;\n\t#endif\n\tuniform vec2 transmissionSamplerSize;\n\tuniform sampler2D transmissionSamplerMap;\n\tuniform mat4 modelMatrix;\n\tuniform mat4 projectionMatrix;\n\tvarying vec3 vWorldPosition;\n\tvec3 getVolumeTransmissionRay( const in vec3 n, const in vec3 v, const in float thickness, const in float ior, const in mat4 modelMatrix ) {\n\t\tvec3 refractionVector = refract( - v, normalize( n ), 1.0 / ior );\n\t\tvec3 modelScale;\n\t\tmodelScale.x = length( vec3( modelMatrix[ 0 ].xyz ) );\n\t\tmodelScale.y = length( vec3( modelMatrix[ 1 ].xyz ) );\n\t\tmodelScale.z = length( vec3( modelMatrix[ 2 ].xyz ) );\n\t\treturn normalize( refractionVector ) * thickness * modelScale;\n\t}\n\tfloat applyIorToRoughness( const in float roughness, const in float ior ) {\n\t\treturn roughness * clamp( ior * 2.0 - 2.0, 0.0, 1.0 );\n\t}\n\tvec4 getTransmissionSample( const in vec2 fragCoord, const in float roughness, const in float ior ) {\n\t\tfloat framebufferLod = log2( transmissionSamplerSize.x ) * applyIorToRoughness( roughness, ior );\n\t\t#ifdef TEXTURE_LOD_EXT\n\t\t\treturn texture2DLodEXT( transmissionSamplerMap, fragCoord.xy, framebufferLod );\n\t\t#else\n\t\t\treturn texture2D( transmissionSamplerMap, fragCoord.xy, framebufferLod );\n\t\t#endif\n\t}\n\tvec3 applyVolumeAttenuation( const in vec3 radiance, const in float transmissionDistance, const in vec3 attenuationColor, const in float attenuationDistance ) {\n\t\tif ( attenuationDistance == 0.0 ) {\n\t\t\treturn radiance;\n\t\t} else {\n\t\t\tvec3 attenuationCoefficient = -log( attenuationColor ) / attenuationDistance;\n\t\t\tvec3 transmittance = exp( - attenuationCoefficient * transmissionDistance );\t\t\treturn transmittance * radiance;\n\t\t}\n\t}\n\tvec4 getIBLVolumeRefraction( const in vec3 n, const in vec3 v, const in float roughness, const in vec3 diffuseColor,\n\t\tconst in vec3 specularColor, const in float specularF90, const in vec3 position, const in mat4 modelMatrix,\n\t\tconst in mat4 viewMatrix, const in mat4 projMatrix, const in float ior, const in float thickness,\n\t\tconst in vec3 attenuationColor, const in float attenuationDistance ) {\n\t\tvec3 transmissionRay = getVolumeTransmissionRay( n, v, thickness, ior, modelMatrix );\n\t\tvec3 refractedRayExit = position + transmissionRay;\n\t\tvec4 ndcPos = projMatrix * viewMatrix * vec4( refractedRayExit, 1.0 );\n\t\tvec2 refractionCoords = ndcPos.xy / ndcPos.w;\n\t\trefractionCoords += 1.0;\n\t\trefractionCoords /= 2.0;\n\t\tvec4 transmittedLight = getTransmissionSample( refractionCoords, roughness, ior );\n\t\tvec3 attenuatedColor = applyVolumeAttenuation( transmittedLight.rgb, length( transmissionRay ), attenuationColor, attenuationDistance );\n\t\tvec3 F = EnvironmentBRDF( n, v, specularColor, specularF90, roughness );\n\t\treturn vec4( ( 1.0 - F ) * attenuatedColor * diffuseColor, transmittedLight.a );\n\t}\n#endif",uv_pars_fragment:"#if ( defined( USE_UV ) && ! defined( UVS_VERTEX_ONLY ) )\n\tvarying vec2 vUv;\n#endif",uv_pars_vertex:"#ifdef USE_UV\n\t#ifdef UVS_VERTEX_ONLY\n\t\tvec2 vUv;\n\t#else\n\t\tvarying vec2 vUv;\n\t#endif\n\tuniform mat3 uvTransform;\n#endif",uv_vertex:"#ifdef USE_UV\n\tvUv = ( uvTransform * vec3( uv, 1 ) ).xy;\n#endif",uv2_pars_fragment:"#if defined( USE_LIGHTMAP ) || defined( USE_AOMAP )\n\tvarying vec2 vUv2;\n#endif",uv2_pars_vertex:"#if defined( USE_LIGHTMAP ) || defined( USE_AOMAP )\n\tattribute vec2 uv2;\n\tvarying vec2 vUv2;\n\tuniform mat3 uv2Transform;\n#endif",uv2_vertex:"#if defined( USE_LIGHTMAP ) || defined( USE_AOMAP )\n\tvUv2 = ( uv2Transform * vec3( uv2, 1 ) ).xy;\n#endif",worldpos_vertex:"#if defined( USE_ENVMAP ) || defined( DISTANCE ) || defined ( USE_SHADOWMAP ) || defined ( USE_TRANSMISSION )\n\tvec4 worldPosition = vec4( transformed, 1.0 );\n\t#ifdef USE_INSTANCING\n\t\tworldPosition = instanceMatrix * worldPosition;\n\t#endif\n\tworldPosition = modelMatrix * worldPosition;\n#endif",background_vert:"varying vec2 vUv;\nuniform mat3 uvTransform;\nvoid main() {\n\tvUv = ( uvTransform * vec3( uv, 1 ) ).xy;\n\tgl_Position = vec4( position.xy, 1.0, 1.0 );\n}",background_frag:"uniform sampler2D t2D;\nvarying vec2 vUv;\nvoid main() {\n\tvec4 texColor = texture2D( t2D, vUv );\n\tgl_FragColor = mapTexelToLinear( texColor );\n\t#include \n\t#include \n}",cube_vert:"varying vec3 vWorldDirection;\n#include \nvoid main() {\n\tvWorldDirection = transformDirection( position, modelMatrix );\n\t#include \n\t#include \n\tgl_Position.z = gl_Position.w;\n}",cube_frag:"#include \nuniform float opacity;\nvarying vec3 vWorldDirection;\n#include \nvoid main() {\n\tvec3 vReflect = vWorldDirection;\n\t#include \n\tgl_FragColor = envColor;\n\tgl_FragColor.a *= opacity;\n\t#include \n\t#include \n}",depth_vert:"#include \n#include \n#include \n#include \n#include \n#include \n#include \nvarying vec2 vHighPrecisionZW;\nvoid main() {\n\t#include \n\t#include \n\t#ifdef USE_DISPLACEMENTMAP\n\t\t#include \n\t\t#include \n\t\t#include \n\t#endif\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\tvHighPrecisionZW = gl_Position.zw;\n}",depth_frag:"#if DEPTH_PACKING == 3200\n\tuniform float opacity;\n#endif\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvarying vec2 vHighPrecisionZW;\nvoid main() {\n\t#include \n\tvec4 diffuseColor = vec4( 1.0 );\n\t#if DEPTH_PACKING == 3200\n\t\tdiffuseColor.a = opacity;\n\t#endif\n\t#include \n\t#include \n\t#include \n\t#include \n\tfloat fragCoordZ = 0.5 * vHighPrecisionZW[0] / vHighPrecisionZW[1] + 0.5;\n\t#if DEPTH_PACKING == 3200\n\t\tgl_FragColor = vec4( vec3( 1.0 - fragCoordZ ), opacity );\n\t#elif DEPTH_PACKING == 3201\n\t\tgl_FragColor = packDepthToRGBA( fragCoordZ );\n\t#endif\n}",distanceRGBA_vert:"#define DISTANCE\nvarying vec3 vWorldPosition;\n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\t#include \n\t#ifdef USE_DISPLACEMENTMAP\n\t\t#include \n\t\t#include \n\t\t#include \n\t#endif\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\tvWorldPosition = worldPosition.xyz;\n}",distanceRGBA_frag:"#define DISTANCE\nuniform vec3 referencePosition;\nuniform float nearDistance;\nuniform float farDistance;\nvarying vec3 vWorldPosition;\n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main () {\n\t#include \n\tvec4 diffuseColor = vec4( 1.0 );\n\t#include \n\t#include \n\t#include \n\tfloat dist = length( vWorldPosition - referencePosition );\n\tdist = ( dist - nearDistance ) / ( farDistance - nearDistance );\n\tdist = saturate( dist );\n\tgl_FragColor = packDepthToRGBA( dist );\n}",equirect_vert:"varying vec3 vWorldDirection;\n#include \nvoid main() {\n\tvWorldDirection = transformDirection( position, modelMatrix );\n\t#include \n\t#include \n}",equirect_frag:"uniform sampler2D tEquirect;\nvarying vec3 vWorldDirection;\n#include \nvoid main() {\n\tvec3 direction = normalize( vWorldDirection );\n\tvec2 sampleUV = equirectUv( direction );\n\tvec4 texColor = texture2D( tEquirect, sampleUV );\n\tgl_FragColor = mapTexelToLinear( texColor );\n\t#include \n\t#include \n}",linedashed_vert:"uniform float scale;\nattribute float lineDistance;\nvarying float vLineDistance;\n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\tvLineDistance = scale * lineDistance;\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n}",linedashed_frag:"uniform vec3 diffuse;\nuniform float opacity;\nuniform float dashSize;\nuniform float totalSize;\nvarying float vLineDistance;\n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\tif ( mod( vLineDistance, totalSize ) > dashSize ) {\n\t\tdiscard;\n\t}\n\tvec3 outgoingLight = vec3( 0.0 );\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include \n\t#include \n\toutgoingLight = diffuseColor.rgb;\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n}",meshbasic_vert:"#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\t#include \n\t#include \n\t#if defined ( USE_ENVMAP ) || defined ( USE_SKINNING )\n\t\t#include \n\t\t#include \n\t\t#include \n\t\t#include \n\t\t#include \n\t#endif\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n}",meshbasic_frag:"uniform vec3 diffuse;\nuniform float opacity;\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n#endif\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\t#ifdef USE_LIGHTMAP\n\t\tvec4 lightMapTexel= texture2D( lightMap, vUv2 );\n\t\treflectedLight.indirectDiffuse += lightMapTexelToLinear( lightMapTexel ).rgb * lightMapIntensity;\n\t#else\n\t\treflectedLight.indirectDiffuse += vec3( 1.0 );\n\t#endif\n\t#include \n\treflectedLight.indirectDiffuse *= diffuseColor.rgb;\n\tvec3 outgoingLight = reflectedLight.indirectDiffuse;\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n}",meshlambert_vert:"#define LAMBERT\nvarying vec3 vLightFront;\nvarying vec3 vIndirectFront;\n#ifdef DOUBLE_SIDED\n\tvarying vec3 vLightBack;\n\tvarying vec3 vIndirectBack;\n#endif\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n}",meshlambert_frag:"uniform vec3 diffuse;\nuniform vec3 emissive;\nuniform float opacity;\nvarying vec3 vLightFront;\nvarying vec3 vIndirectFront;\n#ifdef DOUBLE_SIDED\n\tvarying vec3 vLightBack;\n\tvarying vec3 vIndirectBack;\n#endif\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\tvec3 totalEmissiveRadiance = emissive;\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#ifdef DOUBLE_SIDED\n\t\treflectedLight.indirectDiffuse += ( gl_FrontFacing ) ? vIndirectFront : vIndirectBack;\n\t#else\n\t\treflectedLight.indirectDiffuse += vIndirectFront;\n\t#endif\n\t#include \n\treflectedLight.indirectDiffuse *= BRDF_Lambert( diffuseColor.rgb );\n\t#ifdef DOUBLE_SIDED\n\t\treflectedLight.directDiffuse = ( gl_FrontFacing ) ? vLightFront : vLightBack;\n\t#else\n\t\treflectedLight.directDiffuse = vLightFront;\n\t#endif\n\treflectedLight.directDiffuse *= BRDF_Lambert( diffuseColor.rgb ) * getShadowMask();\n\t#include \n\tvec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance;\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n}",meshmatcap_vert:"#define MATCAP\nvarying vec3 vViewPosition;\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\tvViewPosition = - mvPosition.xyz;\n}",meshmatcap_frag:"#define MATCAP\nuniform vec3 diffuse;\nuniform float opacity;\nuniform sampler2D matcap;\nvarying vec3 vViewPosition;\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\tvec3 viewDir = normalize( vViewPosition );\n\tvec3 x = normalize( vec3( viewDir.z, 0.0, - viewDir.x ) );\n\tvec3 y = cross( viewDir, x );\n\tvec2 uv = vec2( dot( x, normal ), dot( y, normal ) ) * 0.495 + 0.5;\n\t#ifdef OFT_MATCAP\n\tuv.y = 1.0 - uv.y;\n\t#endif\n\t#ifdef USE_MATCAP\n\t\tvec4 matcapColor = texture2D( matcap, uv );\n\t\tmatcapColor = matcapTexelToLinear( matcapColor );\n\t#else\n\t\tvec4 matcapColor = vec4( vec3( mix( 0.2, 0.8, uv.y ) ), 1.0 );\n\t#endif\n\tvec3 outgoingLight = diffuseColor.rgb * matcapColor.rgb;\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n}",meshnormal_vert:"#define NORMAL\n#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( TANGENTSPACE_NORMALMAP )\n\tvarying vec3 vViewPosition;\n#endif\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( TANGENTSPACE_NORMALMAP )\n\tvViewPosition = - mvPosition.xyz;\n#endif\n}",meshnormal_frag:"#define NORMAL\nuniform float opacity;\n#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( TANGENTSPACE_NORMALMAP )\n\tvarying vec3 vViewPosition;\n#endif\n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\t#include \n\t#include \n\t#include \n\tgl_FragColor = vec4( packNormalToRGB( normal ), opacity );\n\t#ifdef OPAQUE\n\t\tgl_FragColor.a = 1.0;\n\t#endif\n}",meshphong_vert:"#define PHONG\nvarying vec3 vViewPosition;\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\tvViewPosition = - mvPosition.xyz;\n\t#include \n\t#include \n\t#include \n\t#include \n}",meshphong_frag:"#define PHONG\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform vec3 specular;\nuniform float shininess;\nuniform float opacity;\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\tvec3 totalEmissiveRadiance = emissive;\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\tvec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + reflectedLight.directSpecular + reflectedLight.indirectSpecular + totalEmissiveRadiance;\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n}",meshphysical_vert:"#define STANDARD\nvarying vec3 vViewPosition;\n#ifdef USE_TRANSMISSION\n\tvarying vec3 vWorldPosition;\n#endif\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\tvViewPosition = - mvPosition.xyz;\n\t#include \n\t#include \n\t#include \n#ifdef USE_TRANSMISSION\n\tvWorldPosition = worldPosition.xyz;\n#endif\n}",meshphysical_frag:"#define STANDARD\n#ifdef PHYSICAL\n\t#define IOR\n\t#define SPECULAR\n#endif\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform float roughness;\nuniform float metalness;\nuniform float f90_r115_compatability;\nuniform float opacity;\n#ifdef IOR\n\tuniform float ior;\n#endif\n#ifdef SPECULAR\n\tuniform float specularIntensity;\n\tuniform vec3 specularColor;\n\t#ifdef USE_SPECULARINTENSITYMAP\n\t\tuniform sampler2D specularIntensityMap;\n\t#endif\n\t#ifdef USE_SPECULARCOLORMAP\n\t\tuniform sampler2D specularColorMap;\n\t#endif\n#endif\n#ifdef USE_CLEARCOAT\n\tuniform float clearcoat;\n\tuniform float clearcoatRoughness;\n#endif\n#ifdef USE_SHEEN\n\tuniform vec3 sheenColor;\n\tuniform float sheenRoughness;\n\t#ifdef USE_SHEENCOLORMAP\n\t\tuniform sampler2D sheenColorMap;\n\t#endif\n\t#ifdef USE_SHEENROUGHNESSMAP\n\t\tuniform sampler2D sheenRoughnessMap;\n\t#endif\n#endif\n#ifdef USE_REFRACTION\n\tuniform float refraction;\n#endif\nvarying vec3 vViewPosition;\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\tvec3 totalEmissiveRadiance = emissive;\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\tvec3 totalDiffuse = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse;\n\tvec3 totalSpecular = reflectedLight.directSpecular + reflectedLight.indirectSpecular;\n\t#include \n\tvec3 outgoingLight = totalDiffuse + totalSpecular + totalEmissiveRadiance;\n\t#ifndef CLEARCOAT_R115_COMPATABILITY\n\t#ifdef USE_SHEEN\n\t\tfloat sheenEnergyComp = 1.0 - 0.157 * max3( material.sheenColor );\n\t\toutgoingLight = outgoingLight * sheenEnergyComp + sheenSpecular;\n\t#endif\n\t#ifdef USE_CLEARCOAT\n\t\tfloat dotNVcc = saturate( dot( splitGeoClearcoatNormal, geometry.viewDir ) );\n\t\tvec3 Fcc = F_Schlick( material.clearcoatF0, material.clearcoatF90, dotNVcc );\n\t\toutgoingLight = outgoingLight * ( 1.0 - material.clearcoat * Fcc ) + clearcoatSpecular * material.clearcoat;\n\t#endif\n\t#endif\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n}",meshtoon_vert:"#define TOON\nvarying vec3 vViewPosition;\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\tvViewPosition = - mvPosition.xyz;\n\t#include \n\t#include \n\t#include \n}",meshtoon_frag:"#define TOON\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform float opacity;\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\tvec3 totalEmissiveRadiance = emissive;\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\tvec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance;\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n}",points_vert:"uniform float size;\nuniform float scale;\n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\t#include \n\t#include \n\t#include \n\tgl_PointSize = size;\n\t#ifdef USE_SIZEATTENUATION\n\t\tbool isPerspective = isPerspectiveMatrix( projectionMatrix );\n\t\tif ( isPerspective ) gl_PointSize *= ( scale / - mvPosition.z );\n\t#endif\n\t#include \n\t#include \n\t#include \n\t#include \n}",points_frag:"uniform vec3 diffuse;\nuniform float opacity;\n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\tvec3 outgoingLight = vec3( 0.0 );\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include \n\t#include \n\t#include \n\t#include \n\toutgoingLight = diffuseColor.rgb;\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n}",shadow_vert:"#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n}",shadow_frag:"uniform vec3 color;\nuniform float opacity;\n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\tgl_FragColor = vec4( color, opacity * ( 1.0 - getShadowMask() ) );\n\t#include \n\t#include \n\t#include \n}",sprite_vert:"uniform float rotation;\nuniform vec2 center;\n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\tvec4 mvPosition = modelViewMatrix * vec4( 0.0, 0.0, 0.0, 1.0 );\n\tvec2 scale;\n\tscale.x = length( vec3( modelMatrix[ 0 ].x, modelMatrix[ 0 ].y, modelMatrix[ 0 ].z ) );\n\tscale.y = length( vec3( modelMatrix[ 1 ].x, modelMatrix[ 1 ].y, modelMatrix[ 1 ].z ) );\n\t#ifndef USE_SIZEATTENUATION\n\t\tbool isPerspective = isPerspectiveMatrix( projectionMatrix );\n\t\tif ( isPerspective ) scale *= - mvPosition.z;\n\t#endif\n\tvec2 alignedPosition = ( position.xy - ( center - vec2( 0.5 ) ) ) * scale;\n\tvec2 rotatedPosition;\n\trotatedPosition.x = cos( rotation ) * alignedPosition.x - sin( rotation ) * alignedPosition.y;\n\trotatedPosition.y = sin( rotation ) * alignedPosition.x + cos( rotation ) * alignedPosition.y;\n\tmvPosition.xy += rotatedPosition;\n\tgl_Position = projectionMatrix * mvPosition;\n\t#include \n\t#include \n\t#include \n}",sprite_frag:"uniform vec3 diffuse;\nuniform float opacity;\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\tvec3 outgoingLight = vec3( 0.0 );\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include \n\t#include \n\t#include \n\t#include \n\toutgoingLight = diffuseColor.rgb;\n\t#include \n\t#include \n\t#include \n\t#include \n}"},bi={common:{diffuse:{value:new dn(16777215)},opacity:{value:1},map:{value:null},uvTransform:{value:new Ct},uv2Transform:{value:new Ct},alphaMap:{value:null},alphaTest:{value:0}},specularmap:{specularMap:{value:null}},envmap:{envMap:{value:null},flipEnvMap:{value:-1},reflectivity:{value:1},ior:{value:1.5},refractionRatio:{value:.98}},aomap:{aoMap:{value:null},aoMapIntensity:{value:1}},lightmap:{lightMap:{value:null},lightMapIntensity:{value:1}},emissivemap:{emissiveMap:{value:null}},bumpmap:{bumpMap:{value:null},bumpScale:{value:1}},normalmap:{normalMap:{value:null},lowerNormalMap:{value:null},normalScale:{value:new Rt(1,1)}},displacementmap:{displacementMap:{value:null},displacementScale:{value:1},displacementBias:{value:0}},roughnessmap:{roughnessMap:{value:null}},metalnessmap:{metalnessMap:{value:null}},gradientmap:{gradientMap:{value:null}},fog:{fogDensity:{value:25e-5},fogNear:{value:1},fogFar:{value:2e3},fogColor:{value:new dn(16777215)}},lights:{ambientLightColor:{value:[]},lightProbe:{value:[]},directionalLights:{value:[],properties:{direction:{},color:{}}},directionalLightShadows:{value:[],properties:{shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{}}},directionalShadowMap:{value:[]},directionalShadowMatrix:{value:[]},spotLights:{value:[],properties:{color:{},position:{},direction:{},distance:{},coneCos:{},penumbraCos:{},decay:{}}},spotLightShadows:{value:[],properties:{shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{}}},spotShadowMap:{value:[]},spotShadowMatrix:{value:[]},pointLights:{value:[],properties:{color:{},position:{},decay:{},distance:{}}},pointLightShadows:{value:[],properties:{shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{},shadowCameraNear:{},shadowCameraFar:{}}},pointShadowMap:{value:[]},pointShadowMatrix:{value:[]},hemisphereLights:{value:[],properties:{direction:{},skyColor:{},groundColor:{}}},rectAreaLights:{value:[],properties:{color:{},position:{},width:{},height:{}}},ltc_1:{value:null},ltc_2:{value:null}},points:{diffuse:{value:new dn(16777215)},opacity:{value:1},size:{value:1},scale:{value:1},map:{value:null},alphaMap:{value:null},alphaTest:{value:0},uvTransform:{value:new Ct}},sprite:{diffuse:{value:new dn(16777215)},opacity:{value:1},center:{value:new Rt(.5,.5)},rotation:{value:0},map:{value:null},alphaMap:{value:null},alphaTest:{value:0},uvTransform:{value:new Ct}}},wi={basic:{uniforms:ni([bi.common,bi.specularmap,bi.envmap,bi.aomap,bi.lightmap,bi.fog]),vertexShader:Mi.meshbasic_vert,fragmentShader:Mi.meshbasic_frag},lambert:{uniforms:ni([bi.common,bi.specularmap,bi.envmap,bi.aomap,bi.lightmap,bi.emissivemap,bi.fog,bi.lights,{emissive:{value:new dn(0)}}]),vertexShader:Mi.meshlambert_vert,fragmentShader:Mi.meshlambert_frag},phong:{uniforms:ni([bi.common,bi.specularmap,bi.envmap,bi.aomap,bi.lightmap,bi.emissivemap,bi.bumpmap,bi.normalmap,bi.displacementmap,bi.fog,bi.lights,{emissive:{value:new dn(0)},specular:{value:new dn(1118481)},shininess:{value:30}}]),vertexShader:Mi.meshphong_vert,fragmentShader:Mi.meshphong_frag},standard:{uniforms:ni([bi.common,bi.envmap,bi.aomap,bi.lightmap,bi.emissivemap,bi.bumpmap,bi.normalmap,bi.displacementmap,bi.roughnessmap,bi.metalnessmap,bi.fog,bi.lights,{emissive:{value:new dn(0)},roughness:{value:1},metalness:{value:0},refraction:{value:0},envMapIntensity:{value:1},f90_r115_compatability:{value:1}}]),vertexShader:Mi.meshphysical_vert,fragmentShader:Mi.meshphysical_frag},toon:{uniforms:ni([bi.common,bi.aomap,bi.lightmap,bi.emissivemap,bi.bumpmap,bi.normalmap,bi.displacementmap,bi.gradientmap,bi.fog,bi.lights,{emissive:{value:new dn(0)}}]),vertexShader:Mi.meshtoon_vert,fragmentShader:Mi.meshtoon_frag},matcap:{uniforms:ni([bi.common,bi.bumpmap,bi.normalmap,bi.displacementmap,bi.fog,{matcap:{value:null}}]),vertexShader:Mi.meshmatcap_vert,fragmentShader:Mi.meshmatcap_frag},points:{uniforms:ni([bi.points,bi.fog]),vertexShader:Mi.points_vert,fragmentShader:Mi.points_frag},dashed:{uniforms:ni([bi.common,bi.fog,{scale:{value:1},dashSize:{value:1},totalSize:{value:2}}]),vertexShader:Mi.linedashed_vert,fragmentShader:Mi.linedashed_frag},depth:{uniforms:ni([bi.common,bi.displacementmap]),vertexShader:Mi.depth_vert,fragmentShader:Mi.depth_frag},normal:{uniforms:ni([bi.common,bi.bumpmap,bi.normalmap,bi.displacementmap,{opacity:{value:1}}]),vertexShader:Mi.meshnormal_vert,fragmentShader:Mi.meshnormal_frag},sprite:{uniforms:ni([bi.sprite,bi.fog]),vertexShader:Mi.sprite_vert,fragmentShader:Mi.sprite_frag},background:{uniforms:{uvTransform:{value:new Ct},t2D:{value:null}},vertexShader:Mi.background_vert,fragmentShader:Mi.background_frag},cube:{uniforms:ni([bi.envmap,{opacity:{value:1}}]),vertexShader:Mi.cube_vert,fragmentShader:Mi.cube_frag},equirect:{uniforms:{tEquirect:{value:null}},vertexShader:Mi.equirect_vert,fragmentShader:Mi.equirect_frag},distanceRGBA:{uniforms:ni([bi.common,bi.displacementmap,{referencePosition:{value:new kt},nearDistance:{value:1},farDistance:{value:1e3}}]),vertexShader:Mi.distanceRGBA_vert,fragmentShader:Mi.distanceRGBA_frag},shadow:{uniforms:ni([bi.lights,bi.fog,{color:{value:new dn(0)},opacity:{value:1}}]),vertexShader:Mi.shadow_vert,fragmentShader:Mi.shadow_frag}};function Si(t,e,n,i,r,s){const a=new dn(0);let o,c,h=!0===r?0:1,u=null,d=0,p=null,m=null;function f(t,e,i){n.buffers.color.setClear(t.r,t.g,t.b,e,i)}return{getClearColor:function(){return a},setClearColor:function(t,e=1){a.set(t),h=e,f(a,h,s)},getClearAlpha:function(){return h},setClearAlpha:function(t){h=t,f(a,h,s)},render:function(n,r,g){let v=!1,x=!0===r.isScene?r.background:null;const y=!0===r.isScene&&r.bgToneMapped;x&&x.isTexture&&(x=e.get(x));const _=t.xr,M=_.getSession&&_.getSession();M&&"additive"===M.environmentBlendMode&&(x=null);const b=a.clone();let w=h;if(x&&x.isColor&&(b.set(x),w=1,v=!0),null===x||x.isColor){const e=null!==g?t.getTextureEncodingFromMap(g.texture):t.outputEncoding;e===ot?b.convertSRGBToLinear():e===ct&&(b.convertSRGBToLinear(),w=128/255);f(b,w,null!=g?g.texture.premultiplyAlpha:s)}(t.autoClear||v)&&t.clear(t.autoClearColor,t.autoClearDepth,t.autoClearStencil),x&&(x.isCubeTexture||x.mapping===l)?(void 0===c&&(c=new Qn(new ti(1,1,1),new ri({name:"BackgroundCubeMaterial",uniforms:ei(wi.cube.uniforms),vertexShader:wi.cube.vertexShader,fragmentShader:wi.cube.fragmentShader,side:1,depthTest:!1,depthWrite:!1,fog:!1})),c.layers.enableAll(),c.geometry.deleteAttribute("normal"),c.geometry.deleteAttribute("uv"),c.onBeforeRender=function(t,e,n){this.matrixWorld.copyPosition(n.matrixWorld)},Object.defineProperty(c.material,"envMap",{get:function(){return this.uniforms.envMap.value}}),i.update(c)),c.material.toneMapped=y,c.material.uniforms.envMap.value=x,c.material.uniforms.flipEnvMap.value=x.isCubeTexture&&!1===x.isRenderTargetTexture?-1:1,u===x&&d===x.version&&p===t.toneMapping&&m===y||(c.material.needsUpdate=!0,u=x,d=x.version,p=t.toneMapping,m=y),n.unshift(c,c.geometry,c.material,0,0,null)):x&&x.isTexture&&(void 0===o&&(o=new Qn(new _i(2,2),new ri({name:"BackgroundMaterial",uniforms:ei(wi.background.uniforms),vertexShader:wi.background.vertexShader,fragmentShader:wi.background.fragmentShader,side:0,depthTest:!1,depthWrite:!1,fog:!1})),o.layers.enableAll(),o.geometry.deleteAttribute("normal"),Object.defineProperty(o.material,"map",{get:function(){return this.uniforms.t2D.value}}),i.update(o)),o.material.toneMapped=y,o.material.uniforms.t2D.value=x,!0===x.matrixAutoUpdate&&x.updateMatrix(),o.material.uniforms.uvTransform.value.copy(x.matrix),u===x&&d===x.version&&p===t.toneMapping&&m===y||(o.material.needsUpdate=!0,u=x,d=x.version,p=t.toneMapping,m=y),n.unshift(o,o.geometry,o.material,0,0,null))}}}function Ti(t,e,n,i){const r=t.getParameter(34921),s=i.isWebGL2?null:e.get("OES_vertex_array_object"),a=i.isWebGL2||null!==s,o={},l=d(null);let c=l;function h(e){return i.isWebGL2?t.bindVertexArray(e):s.bindVertexArrayOES(e)}function u(e){return i.isWebGL2?t.deleteVertexArray(e):s.deleteVertexArrayOES(e)}function d(t){const e=[],n=[],i=[];for(let t=0;t=0){let s=l[e];if(void 0===s&&("instanceMatrix"===e&&r.instanceMatrix&&(s=r.instanceMatrix),"instanceColor"===e&&r.instanceColor&&(s=r.instanceColor)),void 0!==s){const e=s.normalized,a=s.itemSize,l=n.get(s);if(void 0===l)continue;const c=l.buffer,h=l.type,u=l.bytesPerElement;if(s.isInterleavedBufferAttribute){const n=s.data,l=n.stride,d=s.offset;if(n&&n.isInstancedInterleavedBuffer){for(let t=0;t0&&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 a=void 0!==n.precision?n.precision:"highp";const o=r(a);o!==a&&(console.warn("THREE.WebGLRenderer:",a,"not supported, using",o,"instead."),a=o);const l=s||e.has("WEBGL_draw_buffers"),c=!0===n.logarithmicDepthBuffer,h=t.getParameter(34930),u=t.getParameter(35660),d=t.getParameter(3379),p=t.getParameter(34076),m=t.getParameter(34921),f=t.getParameter(36347),g=t.getParameter(36348),v=t.getParameter(36349),x=u>0,y=s||e.has("OES_texture_float");return{isWebGL2:s,drawBuffers:l,getMaxAnisotropy:function(){if(void 0!==i)return i;if(!0===e.has("EXT_texture_filter_anisotropic")){const n=e.get("EXT_texture_filter_anisotropic");i=t.getParameter(n.MAX_TEXTURE_MAX_ANISOTROPY_EXT)}else i=0;return i},getMaxPrecision:r,precision:a,logarithmicDepthBuffer:c,maxTextures:h,maxVertexTextures:u,maxTextureSize:d,maxCubemapSize:p,maxAttributes:m,maxVertexUniforms:f,maxVaryings:g,maxFragmentUniforms:v,vertexTextures:x,floatFragmentTextures:y,floatVertexTextures:x&&y,maxSamples:s?t.getParameter(36183):0}}function Ri(t){const e=this;let n=null,i=0,r=!1,s=!1;const a=new mi,o=new Ct,l={value:null,needsUpdate:!1};function c(){l.value!==n&&(l.value=n,l.needsUpdate=i>0),e.numPlanes=i,e.numIntersection=0}function h(t,n,i,r){const s=null!==t?t.length:0;let c=null;if(0!==s){if(c=l.value,!0!==r||null===c){const e=i+4*s,r=n.matrixWorldInverse;o.getNormalMatrix(r),(null===c||c.length0){const a=new hi(s.height/2);return a.fromEquirectangularTexture(t,r),e.set(r,a),r.addEventListener("dispose",i),n(a.texture,r.mapping)}return null}}}return r},dispose:function(){e=new WeakMap}}}wi.physical={uniforms:ni([wi.standard.uniforms,{clearcoat:{value:0},clearcoatMap:{value:null},clearcoatRoughness:{value:0},clearcoatRoughnessMap:{value:null},clearcoatNormalScale:{value:new Rt(1,1)},clearcoatNormalMap:{value:null},sheen:{value:0},sheenColor:{value:new dn(0)},sheenColorMap:{value:null},sheenRoughness:{value:1},sheenRoughnessMap:{value:null},transmission:{value:0},transmissionMap:{value:null},transmissionSamplerSize:{value:new Rt},transmissionSamplerMap:{value:null},thickness:{value:0},thicknessMap:{value:null},attenuationDistance:{value:0},attenuationColor:{value:new dn(0)},specularIntensity:{value:1},specularIntensityMap:{value:null},specularColor:{value:new dn(1,1,1)},specularColorMap:{value:null}}]),vertexShader:Mi.meshphysical_vert,fragmentShader:Mi.meshphysical_frag};class Li extends si{constructor(t=-1,e=1,n=1,i=-1,r=.1,s=2e3){super(),this.type="OrthographicCamera",this.zoom=1,this.view=null,this.left=t,this.right=e,this.top=n,this.bottom=i,this.near=r,this.far=s,this.updateProjectionMatrix()}copy(t,e){return super.copy(t,e),this.left=t.left,this.right=t.right,this.top=t.top,this.bottom=t.bottom,this.near=t.near,this.far=t.far,this.zoom=t.zoom,this.view=null===t.view?null:Object.assign({},t.view),this}setViewOffset(t,e,n,i,r,s){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=i,this.view.width=r,this.view.height=s,this.updateProjectionMatrix()}clearViewOffset(){null!==this.view&&(this.view.enabled=!1),this.updateProjectionMatrix()}updateProjectionMatrix(){const t=(this.right-this.left)/(2*this.zoom),e=(this.top-this.bottom)/(2*this.zoom),n=(this.right+this.left)/2,i=(this.top+this.bottom)/2;let r=n-t,s=n+t,a=i+e,o=i-e;if(null!==this.view&&this.view.enabled){const t=(this.right-this.left)/this.view.fullWidth/this.zoom,e=(this.top-this.bottom)/this.view.fullHeight/this.zoom;r+=t*this.view.offsetX,s=r+t*this.view.width,a-=e*this.view.offsetY,o=a-e*this.view.height}this.projectionMatrix.makeOrthographic(r,s,a,o,this.near,this.far),this.projectionMatrixInverse.copy(this.projectionMatrix).invert()}toJSON(t){const e=super.toJSON(t);return e.object.zoom=this.zoom,e.object.left=this.left,e.object.right=this.right,e.object.top=this.top,e.object.bottom=this.bottom,e.object.near=this.near,e.object.far=this.far,null!==this.view&&(e.object.view=Object.assign({},this.view)),e}}Li.prototype.isOrthographicCamera=!0;class Pi extends ri{constructor(t){super(t),this.type="RawShaderMaterial"}}Pi.prototype.isRawShaderMaterial=!0;const Ii=Math.pow(2,8),Di=[.125,.215,.35,.446,.526,.582],Ni=5+Di.length,Oi=20,Bi={[ot]:0,[lt]:1,[ct]:2},zi=new Li,{_lodPlanes:Fi,_sizeLods:Ui,_sigmas:Hi}=Xi(),Gi=new dn;let Vi=null;const ki=(1+Math.sqrt(5))/2,Wi=1/ki,ji=[new kt(1,1,1),new kt(-1,1,1),new kt(1,1,-1),new kt(-1,1,-1),new kt(0,ki,Wi),new kt(0,ki,-Wi),new kt(Wi,0,ki),new kt(-Wi,0,ki),new kt(ki,Wi,0),new kt(-ki,Wi,0)];class qi{constructor(t){this._renderer=t,this._pingPongRenderTarget=null,this._blurMaterial=function(t){const e=new Float32Array(t),n=new kt(0,1,0);return new Pi({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:Bi[3e3]},outputEncoding:{value:Bi[3e3]}},vertexShader:Qi(),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${$i()}\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:0,depthTest:!1,depthWrite:!1})}(Oi),this._flipCubeUVMaxLevelTileShader=null,this._equirectShader=null,this._cubemapShader=null,this._compileMaterial(this._blurMaterial)}fromScene(t,e=0,n=.1,i=100){Vi=this._renderer.getRenderTarget();const r=this._allocateTargets();return this._sceneToCubeUV(t,n,i,this._pingPongRenderTarget),this._flipCubeUVMaxLevelTile(this._pingPongRenderTarget,r),e>0&&this._blur(r,0,0,e),this._applyPMREM(r),this._cleanup(r),r}fromEquirectangular(t,e=null){return this._fromTexture(t,e)}fromCubemap(t,e=null){return this._fromTexture(t,e)}compileCubemapShader(){null===this._cubemapShader&&(this._cubemapShader=Ki(),this._compileMaterial(this._cubemapShader))}compileEquirectangularShader(){null===this._equirectShader&&(this._equirectShader=Zi(),this._compileMaterial(this._equirectShader))}dispose(){this._blurMaterial.dispose(),null!==this._pingPongRenderTarget&&this._pingPongRenderTarget.dispose(),null!==this._flipCubeUVMaxLevelTileShader&&this._flipCubeUVMaxLevelTileShader.dispose(),null!==this._cubemapShader&&this._cubemapShader.dispose(),null!==this._equirectShader&&this._equirectShader.dispose();for(let t=0;t2?Ii:0,Ii,Ii),o.setRenderTarget(i),p&&o.render(d,r),o.render(t,r)}d.geometry.dispose(),d.material.dispose(),o.toneMapping=h,o.outputEncoding=c,o.autoClear=l,t.background=m}_setEncoding(t,e){t.value=Bi[this._renderer.getTextureEncodingFromMap(e)]}_textureToCubeUV(t,e){const n=this._renderer,i=t.mapping===r||t.mapping===s;i?(null===this._cubemapShader&&(this._cubemapShader=Ki()),this._cubemapShader.uniforms.flipEnvMap.value=!1===t.isRenderTargetTexture?-1:1):null===this._equirectShader&&(this._equirectShader=Zi());const a=i?this._cubemapShader:this._equirectShader,o=new Qn(Fi[0],a),l=a.uniforms;l.envMap.value=t,i||l.texelSize.value.set(1/t.image.width,1/t.image.height),this._setEncoding(l.inputEncoding,t),this._setEncoding(l.outputEncoding,e.texture),Ji(e,0,0,3*Ii,2*Ii),n.setRenderTarget(e),n.render(o,zi)}_applyPMREM(t){const e=this._renderer,n=e.autoClear;e.autoClear=!1;for(let e=1;eOi&&console.warn(`sigmaRadians, ${r}, is too large and will clip, as it requested ${m} samples when the maximum is set to 20`);const f=[];let g=0;for(let t=0;t4?i-8+4:0),3*v,2*v),o.setRenderTarget(e),o.render(c,zi)}_flipCubeUVMaxLevelTile(t,e){const n=this._renderer;null===this._flipCubeUVMaxLevelTileShader&&(this._flipCubeUVMaxLevelTileShader=new Pi({name:"FlipCubeUVMaxLevelTile",uniforms:{envMap:{value:null},inputEncoding:{value:Bi[3e3]},outputEncoding:{value:Bi[3e3]}},vertexShader:Qi(),fragmentShader:`\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\n\t\t\t${$i()}\n\n\t\t\t#define ENVMAP_TYPE_CUBE_UV\n\t\t\t#include \n\n\t\t\tvoid main() {\n\n\t\t\t\tvec3 direction = normalize( vOutputDirection );\n\t\t\t\tfloat face = getFace( direction );\n\n\t\t\t\tif ( face == 0.0 || face == 3.0 ) {\n\n\t\t\t\t\tdirection.z = - direction.z;\n\n\t\t\t\t} else {\n\n\t\t\t\t\tdirection.x = - direction.x;\n\n\t\t\t\t}\n\n\t\t\t\tgl_FragColor = vec4( bilinearCubeUV( envMap, direction, cubeUV_maxMipLevel ), 1.0 );\n\t\t\t\tgl_FragColor = linearToOutputTexel( gl_FragColor );\n\n\t\t\t}\n\t\t`,blending:0,depthTest:!1,depthWrite:!1}));const i=this._flipCubeUVMaxLevelTileShader,r=new Qn(Fi[0],i),s=i.uniforms;s.envMap.value=t.texture,this._setEncoding(s.inputEncoding,t.texture),this._setEncoding(s.outputEncoding,t.texture),Ji(e,0,0,3*Ii,2*Ii),n.setRenderTarget(e),n.render(r,zi)}}function Xi(){const t=[],e=[],n=[];let i=8;for(let r=0;r4?a=Di[r-8+4-1]:0===r&&(a=0),n.push(a);const o=1/(s-1),l=-o/2,c=1+o/2,h=[l,l,c,l,c,c,l,l,c,c,l,c],u=6,d=6,p=3,m=2,f=1,g=new Float32Array(p*d*u),v=new Float32Array(m*d*u),x=new Float32Array(f*d*u);for(let t=0;t2?0:-1,i=[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(i,p*d*t),v.set(h,m*d*t);const r=[t,t,t,t,t,t];x.set(r,f*d*t)}const y=new Nn;y.setAttribute("position",new gn(g,p)),y.setAttribute("uv",new gn(v,m)),y.setAttribute("faceIndex",new gn(x,f)),t.push(y),i>4&&i--}return{_lodPlanes:t,_sizeLods:e,_sigmas:n}}function Yi(t){const e=new Ht(3*Ii,3*Ii,t);return e.texture.mapping=l,e.texture.name="PMREM.cubeUv",e.scissorTest=!0,e}function Ji(t,e,n,i,r){t.viewport.set(e,n,i,r),t.scissor.set(e,n,i,r)}function Zi(){const t=new Rt(1,1);return new Pi({name:"EquirectangularToCubeUV",uniforms:{envMap:{value:null},texelSize:{value:t},inputEncoding:{value:Bi[3e3]},outputEncoding:{value:Bi[3e3]}},vertexShader:Qi(),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${$i()}\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:0,depthTest:!1,depthWrite:!1})}function Ki(){return new Pi({name:"CubemapToCubeUV",uniforms:{envMap:{value:null},flipEnvMap:{value:-1},inputEncoding:{value:Bi[3e3]},outputEncoding:{value:Bi[3e3]}},vertexShader:Qi(),fragmentShader:`\n\n\t\t\tprecision mediump float;\n\t\t\tprecision mediump int;\n\n\t\t\tuniform float flipEnvMap;\n\n\t\t\tvarying vec3 vOutputDirection;\n\n\t\t\tuniform samplerCube envMap;\n\n\t\t\t${$i()}\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( flipEnvMap * vOutputDirection.x, vOutputDirection.yz ) ) ).rgb;\n\t\t\t\tgl_FragColor = linearToOutputTexel( gl_FragColor );\n\n\t\t\t}\n\t\t`,blending:0,depthTest:!1,depthWrite:!1})}function Qi(){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\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;\n\t\t\t\tdirection.z *= -1.0;\n\n\t\t\t} else if ( face == 1.0 ) {\n\n\t\t\t\tdirection = direction.xzy;\n\t\t\t\tdirection.z *= -1.0;\n\n\t\t\t} else if ( face == 3.0 ) {\n\n\t\t\t\tdirection = direction.zyx;\n\t\t\t\tdirection.x *= -1.0;\n\n\t\t\t} else if ( face == 4.0 ) {\n\n\t\t\t\tdirection = direction.xzy;\n\t\t\t\tdirection.y *= -1.0;\n\n\t\t\t} else if ( face == 5.0 ) {\n\n\t\t\t\tdirection.xz *= -1.0;\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 $i(){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 == 2 ) {\n\n\t\t\t\treturn RGBEToLinear( value );\n\n\t\t\t} else {\n\n\t\t\t\treturn sRGBToLinear( value );\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}\n\n\t\t}\n\n\t\tvec4 envMapTexelToLinear( vec4 color ) {\n\n\t\t\treturn inputTexelToLinear( color );\n\n\t\t}\n\t"}function tr(t){let e=new WeakMap,n=null;function i(t){const n=t.target;n.removeEventListener("dispose",i);const r=e.get(n);void 0!==r&&(e.delete(n),r.dispose())}return{get:function(l){if(l&&l.isTexture){const c=l.mapping,h=c===a||c===o,u=c===r||c===s;if(h||u){if(l.isRenderTargetTexture&&!0===l.needsPMREMUpdate){l.needsPMREMUpdate=!1;let i=e.get(l);return null===n&&(n=new qi(t)),i=h?n.fromEquirectangular(l,i):n.fromCubemap(l,i),e.set(l,i),i.texture}if(e.has(l))return e.get(l).texture;{const r=l.image;if(h&&r&&r.height>0||u&&r&&function(t){let e=0;const n=6;for(let i=0;ie.maxTextureSize&&(u=Math.ceil(h/e.maxTextureSize),h=e.maxTextureSize);const d=new Float32Array(h*u*4*i),p=new sr(d,h,u,i);p.format=T,p.type=b,p.needsUpdate=!0;const m=4*l;for(let e=0;e0)return t;const r=e*n;let s=gr[r];if(void 0===s&&(s=new Float32Array(r),gr[r]=s),0!==e){i.toArray(s,0);for(let i=1,r=0;i!==e;++i)r+=n,t[i].toArray(s,r)}return s}function br(t,e){if(t.length!==e.length)return!1;for(let n=0,i=t.length;n/gm;function As(t){return t.replace(Es,Rs)}function Rs(t,e){const n=Mi[e];if(void 0===n)throw new Error("Can not resolve #include <"+e+">");return As(n)}const Cs=/#pragma unroll_loop[\s]+?for \( int i \= (\d+)\; i < (\d+)\; i \+\+ \) \{([\s\S]+?)(?=\})\}/g,Ls=/#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 Ps(t){return t.replace(Ls,Ds).replace(Cs,Is)}function Is(t,e,n,i){return console.warn("WebGLProgram: #pragma unroll_loop shader syntax is deprecated. Please use #pragma unroll_loop_start syntax instead."),Ds(t,e,n,i)}function Ds(t,e,n,i){let r="";for(let t=parseInt(e);t0&&(y+="\n"),_=[g,v].filter(ws).join("\n"),_.length>0&&(_+="\n")):(y=[Ns(n),"#define SHADER_NAME "+n.shaderName,v,n.instancing?"#define USE_INSTANCING":"",n.instancingColor?"#define USE_INSTANCING_COLOR":"",n.supportsVertexTextures?"#define VERTEX_TEXTURES":"","#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 "+m:"",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.lowerNormalMap?"#define USE_LOWER_8_BIT_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.specularIntensityMap?"#define USE_SPECULARINTENSITYMAP":"",n.specularColorMap?"#define USE_SPECULARCOLORMAP":"",n.roughnessMap?"#define USE_ROUGHNESSMAP":"",n.metalnessMap?"#define USE_METALNESSMAP":"",n.alphaMap?"#define USE_ALPHAMAP":"",n.transmission?"#define USE_TRANSMISSION":"",n.transmissionMap?"#define USE_TRANSMISSIONMAP":"",n.thicknessMap?"#define USE_THICKNESSMAP":"",n.sheenColorMap?"#define USE_SHEENCOLORMAP":"",n.sheenRoughnessMap?"#define USE_SHEENROUGHNESSMAP":"",n.vertexTangents?"#define USE_TANGENT":"",n.vertexColors?"#define USE_COLOR":"",n.vertexAlphas?"#define USE_COLOR_ALPHA":"",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.morphTargets&&n.isWebGL2?"#define MORPHTARGETS_TEXTURE":"",n.morphTargets&&n.isWebGL2?"#define MORPHTARGETS_COUNT "+n.morphTargetsCount:"",n.doubleSided?"#define DOUBLE_SIDED":"",n.flipSided?"#define FLIP_SIDED":"",n.shadowMapEnabled?"#define USE_SHADOWMAP":"",n.shadowMapEnabled?"#define "+d:"",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","#if defined( USE_COLOR_ALPHA )","\tattribute vec4 color;","#elif defined( USE_COLOR )","\tattribute vec3 color;","#endif","#if ( defined( USE_MORPHTARGETS ) && ! defined( MORPHTARGETS_TEXTURE ) )","\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(ws).join("\n"),_=[g,Ns(n),"#define SHADER_NAME "+n.shaderName,v,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 "+p:"",n.envMap?"#define "+m:"",n.envMap?"#define "+f:"",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.lowerNormalMap?"#define USE_LOWER_8_BIT_NORMALMAP":"",n.normalMap&&n.objectSpaceNormalMap?"#define OBJECTSPACE_NORMALMAP":"",n.normalMap&&n.tangentSpaceNormalMap?"#define TANGENTSPACE_NORMALMAP":"",n.clearcoat?"#define USE_CLEARCOAT":"",n.clearcoatMap?"#define USE_CLEARCOATMAP":"",n.clearcoatRoughnessMap?"#define USE_CLEARCOAT_ROUGHNESSMAP":"",n.clearcoatNormalMap?"#define USE_CLEARCOAT_NORMALMAP":"",n.specularMap?"#define USE_SPECULARMAP":"",n.specularIntensityMap?"#define USE_SPECULARINTENSITYMAP":"",n.specularColorMap?"#define USE_SPECULARCOLORMAP":"",n.roughnessMap?"#define USE_ROUGHNESSMAP":"",n.metalnessMap?"#define USE_METALNESSMAP":"",n.alphaMap?"#define USE_ALPHAMAP":"",n.alphaTest?"#define USE_ALPHATEST":"",n.sheen?"#define USE_SHEEN":"",n.sheenColorMap?"#define USE_SHEENCOLORMAP":"",n.sheenRoughnessMap?"#define USE_SHEENROUGHNESSMAP":"",n.transmission?"#define USE_TRANSMISSION":"",n.transmissionMap?"#define USE_TRANSMISSIONMAP":"",n.thicknessMap?"#define USE_THICKNESSMAP":"",n.refraction?"#define USE_REFRACTION":"",n.vertexTangents?"#define USE_TANGENT":"",n.vertexColors||n.instancingColor?"#define USE_COLOR":"",n.vertexAlphas?"#define USE_COLOR_ALPHA":"",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 "+d:"",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;",0!==n.toneMapping?"#define TONE_MAPPING":"",0!==n.toneMapping?Mi.tonemapping_pars_fragment:"",0!==n.toneMapping?bs("toneMapping",n.toneMapping):"",n.dithering?"#define DITHERING":"",n.transparent?"":"#define OPAQUE",Mi.encodings_pars_fragment,n.map?_s("mapTexelToLinear",n.mapEncoding):"",n.matcap?_s("matcapTexelToLinear",n.matcapEncoding):"",n.envMap?_s("envMapTexelToLinear",n.envMapEncoding):"",n.emissiveMap?_s("emissiveMapTexelToLinear",n.emissiveMapEncoding):"",n.specularColorMap?_s("specularColorMapTexelToLinear",n.specularColorMapEncoding):"",n.sheenColorMap?_s("sheenColorMapTexelToLinear",n.sheenColorMapEncoding):"",n.lightMap?_s("lightMapTexelToLinear",n.lightMapEncoding):"",Ms("linearToOutputTexel",n.outputEncoding),n.depthPacking?"#define DEPTH_PACKING "+n.depthPacking:"","\n"].filter(ws).join("\n")),h=As(h),h=Ss(h,n),h=Ts(h,n),u=As(u),u=Ss(u,n),u=Ts(u,n),h=Ps(h),u=Ps(u),n.isWebGL2&&!0!==n.isRawShaderMaterial&&(M="#version 300 es\n",y=["precision mediump sampler2DArray;","#define attribute in","#define varying out","#define texture2D texture"].join("\n")+"\n"+y,_=["#define varying in",n.glslVersion===pt?"":"layout(location = 0) out highp vec4 pc_fragColor;",n.glslVersion===pt?"":"#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"+_);const b=M+_+u,w=gs(a,35633,M+y+h),S=gs(a,35632,b);if(a.attachShader(x,w),a.attachShader(x,S),void 0!==n.index0AttributeName?a.bindAttribLocation(x,0,n.index0AttributeName):!0===n.morphTargets&&a.bindAttribLocation(x,0,"position"),a.linkProgram(x),t.debug.checkShaderErrors){const t=a.getProgramInfoLog(x).trim(),e=a.getShaderInfoLog(w).trim(),n=a.getShaderInfoLog(S).trim();let i=!0,r=!0;if(!1===a.getProgramParameter(x,35714)){i=!1;const e=ys(a,w,"vertex"),n=ys(a,S,"fragment");console.error("THREE.WebGLProgram: Shader Error "+a.getError()+" - VALIDATE_STATUS "+a.getProgramParameter(x,35715)+"\n\nProgram Info Log: "+t+"\n"+e+"\n"+n)}else""!==t?console.warn("THREE.WebGLProgram: Program Info Log:",t):""!==e&&""!==n||(r=!1);r&&(this.diagnostics={runnable:i,programLog:t,vertexShader:{log:e,prefix:y},fragmentShader:{log:n,prefix:_}})}let T,E;return a.deleteShader(w),a.deleteShader(S),this.getUniforms=function(){return void 0===T&&(T=new fs(a,x)),T},this.getAttributes=function(){return void 0===E&&(E=function(t,e){const n={},i=t.getProgramParameter(e,35721);for(let r=0;r0,I=s.clearcoat>0;return{isWebGL2:d,shaderID:S,shaderName:s.type,vertexShader:E,fragmentShader:A,defines:s.defines,customVertexShaderID:R,customFragmentShaderID:C,isRawShaderMaterial:!0===s.isRawShaderMaterial,glslVersion:s.glslVersion,precision:v,instancing:!0===_.isInstancedMesh,instancingColor:!0===_.isInstancedMesh&&null!==_.instanceColor,supportsVertexTextures:g,outputEncoding:null!==L?t.getTextureEncodingFromMap(L.texture):t.outputEncoding,map:!!s.map,mapEncoding:t.getTextureEncodingFromMap(s.map),matcap:!!s.matcap,matcapEncoding:t.getTextureEncodingFromMap(s.matcap),envMap:!!w,envMapMode:w&&w.mapping,envMapEncoding:t.getTextureEncodingFromMap(w),envMapCubeUV:!!w&&(w.mapping===l||w.mapping===c),lightMap:!!s.lightMap,lightMapEncoding:t.getTextureEncodingFromMap(s.lightMap),aoMap:!!s.aoMap,emissiveMap:!!s.emissiveMap,emissiveMapEncoding:t.getTextureEncodingFromMap(s.emissiveMap),bumpMap:!!s.bumpMap,normalMap:!!s.normalMap,lowerNormalMap:!!s.lowerNormalMap,objectSpaceNormalMap:1===s.normalMapType,tangentSpaceNormalMap:0===s.normalMapType,clearcoat:I,clearcoatMap:I&&!!s.clearcoatMap,clearcoatRoughnessMap:I&&!!s.clearcoatRoughnessMap,clearcoatNormalMap:I&&!!s.clearcoatNormalMap,displacementMap:!!s.displacementMap,roughnessMap:!!s.roughnessMap,metalnessMap:!!s.metalnessMap,specularMap:!!s.specularMap,specularIntensityMap:!!s.specularIntensityMap,specularColorMap:!!s.specularColorMap,specularColorMapEncoding:t.getTextureEncodingFromMap(s.specularColorMap),transparent:s.transparent,alphaMap:!!s.alphaMap,alphaTest:P,gradientMap:!!s.gradientMap,sheen:s.sheen>0,sheenColorMap:!!s.sheenColorMap,sheenColorMapEncoding:t.getTextureEncodingFromMap(s.sheenColorMap),sheenRoughnessMap:!!s.sheenRoughnessMap,transmission:s.transmission>0,transmissionMap:!!s.transmissionMap,thicknessMap:!!s.thicknessMap,refraction:s.refraction>0,combine:s.combine,vertexTangents:!!s.normalMap&&!!_.geometry&&!!_.geometry.attributes.tangent,vertexColors:s.vertexColors,vertexAlphas:!0===s.vertexColors&&!!_.geometry&&!!_.geometry.attributes.color&&4===_.geometry.attributes.color.itemSize,vertexUvs:!!(s.map||s.bumpMap||s.normalMap||s.specularMap||s.alphaMap||s.emissiveMap||s.roughnessMap||s.metalnessMap||s.clearcoatMap||s.clearcoatRoughnessMap||s.clearcoatNormalMap||s.displacementMap||s.transmissionMap||s.thicknessMap||s.specularIntensityMap||s.specularColorMap||s.sheenColorMap||s.sheenRoughnessMap),uvsVertexOnly:!(s.map||s.bumpMap||s.normalMap||s.specularMap||s.alphaMap||s.emissiveMap||s.roughnessMap||s.metalnessMap||s.clearcoatNormalMap||s.transmission>0||s.transmissionMap||s.thicknessMap||s.specularIntensityMap||s.specularColorMap||s.sheen>0||s.sheenColorMap||s.sheenRoughnessMap||!s.displacementMap),fog:!!M,useFog:s.fog,fogExp2:M&&M.isFogExp2,flatShading:!!s.flatShading,sizeAttenuation:s.sizeAttenuation,logarithmicDepthBuffer:p,skinning:!0===_.isSkinnedMesh&&T>0,maxBones:T,useVertexTexture:m,morphTargets:!!_.geometry&&!!_.geometry.morphAttributes.position,morphNormals:!!_.geometry&&!!_.geometry.morphAttributes.normal,morphTargetsCount:_.geometry&&_.geometry.morphAttributes.position?_.geometry.morphAttributes.position.length:0,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:a.numPlanes,numClipIntersection:a.numIntersection,dithering:s.dithering,shadowMapEnabled:t.shadowMap.enabled&&u.length>0,shadowMapType:t.shadowMap.type,toneMapping:s.toneMapped?t.toneMapping:0,physicallyCorrectLights:t.physicallyCorrectLights,premultipliedAlpha:s.premultipliedAlpha,doubleSided:2===s.side,flipSided:1===s.side,depthPacking:void 0!==s.depthPacking&&s.depthPacking,index0AttributeName:s.index0AttributeName,extensionDerivatives:s.extensions&&s.extensions.derivatives,extensionFragDepth:s.extensions&&s.extensions.fragDepth,extensionDrawBuffers:s.extensions&&s.extensions.drawBuffers,extensionShaderTextureLOD:s.extensions&&s.extensions.shaderTextureLOD,rendererExtensionFragDepth:d||i.has("EXT_frag_depth"),rendererExtensionDrawBuffers:d||i.has("WEBGL_draw_buffers"),rendererExtensionShaderTextureLod:d||i.has("EXT_shader_texture_lod"),customProgramCacheKey:s.customProgramCacheKey()}},getProgramCacheKey:function(e){const n=[];if(e.shaderID?n.push(e.shaderID):(n.push(e.customVertexShaderID),n.push(e.customFragmentShaderID)),void 0!==e.defines)for(const t in e.defines)n.push(t),n.push(e.defines[t]);return!1===e.isRawShaderMaterial&&(!function(t,e){t.push(e.precision),t.push(e.outputEncoding),t.push(e.mapEncoding),t.push(e.matcapEncoding),t.push(e.envMapMode),t.push(e.envMapEncoding),t.push(e.lightMapEncoding),t.push(e.emissiveMapEncoding),t.push(e.combine),t.push(e.vertexUvs),t.push(e.fogExp2),t.push(e.sizeAttenuation),t.push(e.maxBones),t.push(e.morphTargetsCount),t.push(e.numDirLights),t.push(e.numPointLights),t.push(e.numSpotLights),t.push(e.numHemiLights),t.push(e.numRectAreaLights),t.push(e.numDirLightShadows),t.push(e.numPointLightShadows),t.push(e.numSpotLightShadows),t.push(e.shadowMapType),t.push(e.toneMapping),t.push(e.numClippingPlanes),t.push(e.numClipIntersection),t.push(e.specularColorMapEncoding),t.push(e.sheenColorMapEncoding)}(n,e),function(t,e){o.disableAll(),e.isWebGL2&&o.enable(0);e.supportsVertexTextures&&o.enable(1);e.instancing&&o.enable(2);e.instancingColor&&o.enable(3);e.map&&o.enable(4);e.matcap&&o.enable(5);e.envMap&&o.enable(6);e.envMapCubeUV&&o.enable(7);e.lightMap&&o.enable(8);e.aoMap&&o.enable(9);e.emissiveMap&&o.enable(10);e.bumpMap&&o.enable(11);e.normalMap&&o.enable(12);e.objectSpaceNormalMap&&o.enable(13);e.tangentSpaceNormalMap&&o.enable(14);e.clearcoat&&o.enable(15);e.clearcoatMap&&o.enable(16);e.clearcoatRoughnessMap&&o.enable(17);e.clearcoatNormalMap&&o.enable(18);e.displacementMap&&o.enable(19);e.specularMap&&o.enable(20);e.roughnessMap&&o.enable(21);e.metalnessMap&&o.enable(22);e.gradientMap&&o.enable(23);e.alphaMap&&o.enable(24);e.alphaTest&&o.enable(25);e.vertexColors&&o.enable(26);e.vertexAlphas&&o.enable(27);e.vertexUvs&&o.enable(28);e.vertexTangents&&o.enable(29);e.uvsVertexOnly&&o.enable(30);e.fog&&o.enable(31);t.push(o.mask),o.disableAll(),e.useFog&&o.enable(0);e.flatShading&&o.enable(1);e.logarithmicDepthBuffer&&o.enable(2);e.skinning&&o.enable(3);e.useVertexTexture&&o.enable(4);e.morphTargets&&o.enable(5);e.morphNormals&&o.enable(6);e.premultipliedAlpha&&o.enable(7);e.shadowMapEnabled&&o.enable(8);e.physicallyCorrectLights&&o.enable(9);e.doubleSided&&o.enable(10);e.flipSided&&o.enable(11);e.depthPacking&&o.enable(12);e.dithering&&o.enable(13);e.specularIntensityMap&&o.enable(14);e.specularColorMap&&o.enable(15);e.transmission&&o.enable(16);e.transmissionMap&&o.enable(17);e.thicknessMap&&o.enable(18);e.sheen&&o.enable(19);e.sheenColorMap&&o.enable(20);e.sheenRoughnessMap&&o.enable(21);e.transparent&&o.enable(22);e.lowerNormalMap&&o.enable(23);e.refraction&&o.enable(24);t.push(o.mask)}(n,e),n.push(t.outputEncoding)),n.push(e.customProgramCacheKey),n.join()},getUniforms:function(t){const e=x[t.type];let n;if(e){const t=wi[e];n=ii.clone(t.uniforms)}else n=t.uniforms;return n},acquireProgram:function(e,n){let i;for(let t=0,e=u.length;t0?i.push(h):!0===a.transparent?r.push(h):n.push(h)},unshift:function(t,e,a,o,l,c){const h=s(t,e,a,o,l,c);a.transmission>0?i.unshift(h):!0===a.transparent?r.unshift(h):n.unshift(h)},finish:function(){for(let n=e,i=t.length;n1&&n.sort(t||Gs),i.length>1&&i.sort(e||Vs),r.length>1&&r.sort(e||Vs)}}}function Ws(){let t=new WeakMap;return{get:function(e,n){let i;return!1===t.has(e)?(i=new ks,t.set(e,[i])):n>=t.get(e).length?(i=new ks,t.get(e).push(i)):i=t.get(e)[n],i},dispose:function(){t=new WeakMap}}}function js(){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 kt,color:new dn};break;case"SpotLight":n={position:new kt,direction:new kt,color:new dn,distance:0,coneCos:0,penumbraCos:0,decay:0};break;case"PointLight":n={position:new kt,color:new dn,distance:0,decay:0};break;case"HemisphereLight":n={direction:new kt,skyColor:new dn,groundColor:new dn};break;case"RectAreaLight":n={color:new dn,position:new kt,halfWidth:new kt,halfHeight:new kt}}return t[e.id]=n,n}}}let qs=0;function Xs(t,e){return(e.castShadow?1:0)-(t.castShadow?1:0)}function Ys(t,e){const n=new js,i=function(){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 Rt};break;case"PointLight":n={shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new Rt,shadowCameraNear:1,shadowCameraFar:1e3}}return t[e.id]=n,n}}}(),r={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 t=0;t<9;t++)r.probe.push(new kt);const s=new kt,a=new _e,o=new _e;return{setup:function(s,a){let o=0,l=0,c=0;for(let t=0;t<9;t++)r.probe[t].set(0,0,0);let h=0,u=0,d=0,p=0,m=0,f=0,g=0,v=0;s.sort(Xs);const x=!0!==a?Math.PI:1;for(let t=0,e=s.length;t0&&(e.isWebGL2||!0===t.has("OES_texture_float_linear")?(r.rectAreaLTC1=bi.LTC_FLOAT_1,r.rectAreaLTC2=bi.LTC_FLOAT_2):!0===t.has("OES_texture_half_float_linear")?(r.rectAreaLTC1=bi.LTC_HALF_1,r.rectAreaLTC2=bi.LTC_HALF_2):console.error("THREE.WebGLRenderer: Unable to use RectAreaLight. Missing WebGL extensions.")),r.ambient[0]=o,r.ambient[1]=l,r.ambient[2]=c;const y=r.hash;y.directionalLength===h&&y.pointLength===u&&y.spotLength===d&&y.rectAreaLength===p&&y.hemiLength===m&&y.numDirectionalShadows===f&&y.numPointShadows===g&&y.numSpotShadows===v||(r.directional.length=h,r.spot.length=d,r.rectArea.length=p,r.point.length=u,r.hemi.length=m,r.directionalShadow.length=f,r.directionalShadowMap.length=f,r.pointShadow.length=g,r.pointShadowMap.length=g,r.spotShadow.length=v,r.spotShadowMap.length=v,r.directionalShadowMatrix.length=f,r.pointShadowMatrix.length=g,r.spotShadowMatrix.length=v,y.directionalLength=h,y.pointLength=u,y.spotLength=d,y.rectAreaLength=p,y.hemiLength=m,y.numDirectionalShadows=f,y.numPointShadows=g,y.numSpotShadows=v,r.version=qs++)},setupView:function(t,e){let n=0,i=0,l=0,c=0,h=0;const u=e.matrixWorldInverse;for(let e=0,d=t.length;e=n.get(i).length?(s=new Js(t,e),n.get(i).push(s)):s=n.get(i)[r],s},dispose:function(){n=new WeakMap}}}class Ks extends sn{constructor(t){super(),this.type="MeshDepthMaterial",this.depthPacking=3200,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.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}}Ks.prototype.isMeshDepthMaterial=!0;class Qs extends sn{constructor(t){super(),this.type="MeshDistanceMaterial",this.referencePosition=new kt,this.nearDistance=1,this.farDistance=1e3,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.map=t.map,this.alphaMap=t.alphaMap,this.displacementMap=t.displacementMap,this.displacementScale=t.displacementScale,this.displacementBias=t.displacementBias,this}}Qs.prototype.isMeshDistanceMaterial=!0;function $s(t,e,n){let i=new vi;const r=new Rt,s=new Rt,a=new Ut,o=new Ks({depthPacking:3201}),l=new Qs,c={},h=n.maxTextureSize,u={0:1,1:0,2:2},d=new ri({defines:{VSM_SAMPLES:8},uniforms:{shadow_pass:{value:null},resolution:{value:new Rt},radius:{value:4}},vertexShader:"void main() {\n\tgl_Position = vec4( position, 1.0 );\n}",fragmentShader:"uniform sampler2D shadow_pass;\nuniform vec2 resolution;\nuniform float radius;\n#include \nvoid main() {\n\tconst float samples = float( VSM_SAMPLES );\n\tfloat mean = 0.0;\n\tfloat squared_mean = 0.0;\n\tfloat uvStride = samples <= 1.0 ? 0.0 : 2.0 / ( samples - 1.0 );\n\tfloat uvStart = samples <= 1.0 ? 0.0 : - 1.0;\n\tfor ( float i = 0.0; i < samples; i ++ ) {\n\t\tfloat uvOffset = uvStart + i * uvStride;\n\t\t#ifdef HORIZONTAL_PASS\n\t\t\tvec2 distribution = unpackRGBATo2Half( texture2D( shadow_pass, ( gl_FragCoord.xy + vec2( uvOffset, 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, uvOffset ) * radius ) / resolution ) );\n\t\t\tmean += depth;\n\t\t\tsquared_mean += depth * depth;\n\t\t#endif\n\t}\n\tmean = mean / samples;\n\tsquared_mean = squared_mean / samples;\n\tfloat std_dev = sqrt( squared_mean - mean * mean );\n\tgl_FragColor = pack2HalfToRGBA( vec2( mean, std_dev ) );\n}"}),m=d.clone();m.defines.HORIZONTAL_PASS=1;const f=new Nn;f.setAttribute("position",new gn(new Float32Array([-1,-1,.5,3,-1,.5,-1,3,.5]),3));const v=new Qn(f,d),x=this;function y(n,i){const r=e.update(v);d.defines.VSM_SAMPLES!==n.blurSamples&&(d.defines.VSM_SAMPLES=n.blurSamples,m.defines.VSM_SAMPLES=n.blurSamples,d.needsUpdate=!0,m.needsUpdate=!0),d.uniforms.shadow_pass.value=n.map.texture,d.uniforms.resolution.value=n.mapSize,d.uniforms.radius.value=n.radius,t.setRenderTarget(n.mapPass),t.clear(),t.renderBufferDirect(i,null,r,d,v,null),m.uniforms.shadow_pass.value=n.mapPass.texture,m.uniforms.resolution.value=n.mapSize,m.uniforms.radius.value=n.radius,t.setRenderTarget(n.map),t.clear(),t.renderBufferDirect(i,null,r,m,v,null)}function _(e,n,i,r,s,a,h){let d=null;const p=!0===r.isPointLight?e.customDistanceMaterial:e.customDepthMaterial;if(d=void 0!==p?p:!0===r.isPointLight?l:o,t.localClippingEnabled&&!0===i.clipShadows&&0!==i.clippingPlanes.length||i.displacementMap&&0!==i.displacementScale||i.alphaMap&&i.alphaTest>0){const t=d.uuid,e=i.uuid;let n=c[t];void 0===n&&(n={},c[t]=n);let r=n[e];void 0===r&&(r=d.clone(),n[e]=r),d=r}return d.visible=i.visible,d.wireframe=i.wireframe,d.side=3===h?null!==i.shadowSide?i.shadowSide:i.side:null!==i.shadowSide?i.shadowSide:u[i.side],d.alphaMap=i.alphaMap,d.alphaTest=i.alphaTest,d.clipShadows=i.clipShadows,d.clippingPlanes=i.clippingPlanes,d.clipIntersection=i.clipIntersection,d.displacementMap=i.displacementMap,d.displacementScale=i.displacementScale,d.displacementBias=i.displacementBias,d.wireframeLinewidth=i.wireframeLinewidth,d.linewidth=i.linewidth,!0===r.isPointLight&&!0===d.isMeshDistanceMaterial&&(d.referencePosition.setFromMatrixPosition(r.matrixWorld),d.nearDistance=s,d.farDistance=a),d}function M(n,r,s,a,o){if(!1===n.visible)return;if(n.layers.test(r.layers)&&(n.isMesh||n.isLine||n.isPoints)&&(n.castShadow||n.receiveShadow&&3===o)&&(!n.frustumCulled||i.intersectsObject(n))){n.modelViewMatrix.multiplyMatrices(s.matrixWorldInverse,n.matrixWorld);const i=e.update(n),r=n.material;if(Array.isArray(r)){const e=i.groups;for(let l=0,c=e.length;lh||r.y>h)&&(r.x>h&&(s.x=Math.floor(h/m.x),r.x=s.x*m.x,u.mapSize.x=s.x),r.y>h&&(s.y=Math.floor(h/m.y),r.y=s.y*m.y,u.mapSize.y=s.y)),null===u.map&&!u.isPointLightShadow&&3===this.type){const t={minFilter:g,magFilter:g,format:T};u.map=new Ht(r.x,r.y,t),u.map.texture.name=c.name+".shadowMap",u.mapPass=new Ht(r.x,r.y,t),u.camera.updateProjectionMatrix()}if(null===u.map){const t={minFilter:p,magFilter:p,format:T};u.map=new Ht(r.x,r.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!==L.indexOf("OpenGL ES")&&(C=parseFloat(/^OpenGL ES (\d)/.exec(L)[1]),R=C>=2);let P=null,I={};const D=t.getParameter(3088),N=t.getParameter(2978),O=(new Ut).fromArray(D),B=(new Ut).fromArray(N);function z(e,n,i){const r=new Uint8Array(4),s=t.createTexture();t.bindTexture(e,s),t.texParameteri(e,10241,9728),t.texParameteri(e,10240,9728);for(let e=0;ei||t.height>i)&&(r=i/Math.max(t.width,t.height)),r<1||!0===e){if("undefined"!=typeof HTMLImageElement&&t instanceof HTMLImageElement||"undefined"!=typeof HTMLCanvasElement&&t instanceof HTMLCanvasElement||"undefined"!=typeof ImageBitmap&&t instanceof ImageBitmap){const i=e?Et:Math.floor,s=i(r*t.width),a=i(r*t.height);void 0===I&&(I=N(s,a));const o=n?N(s,a):I;o.width=s,o.height=a;return o.getContext("2d").drawImage(t,0,0,s,a),console.warn("THREE.WebGLRenderer: Texture has been resized from ("+t.width+"x"+t.height+") to ("+s+"x"+a+")."),o}return"data"in t&&console.warn("THREE.WebGLRenderer: Image in DataTexture is too big ("+t.width+"x"+t.height+")."),t}return t}function B(t){return St(t.width)&&St(t.height)}function z(t,e){return t.generateMipmaps&&e&&t.minFilter!==p&&t.minFilter!==g}function F(e){t.generateMipmap(e)}function U(n,i,r,s,a=!zt.useSrgbTextures){if(!1===o)return i;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 l=i;return 6403===i&&(5126===r&&(l=33326),5131===r&&(l=33325),5121===r&&(l=33321)),33319===i&&(5126===r&&(l=33328),5131===r&&(l=33327),5121===r&&(l=33323)),6408===i&&(5126===r&&(l=34836),5131===r&&(l=34842),5121===r&&(l=o&&s===lt&&!a?35907:32856),32819===r&&(l=32854),32820===r&&(l=32855)),33325!==l&&33326!==l&&33327!==l&&33328!==l&&34842!==l&&34836!==l||e.get("EXT_color_buffer_float"),l}function H(t,e,n){return!0===z(t,n)||t.isFramebufferTexture&&t.minFilter!==p&&t.minFilter!==g?Math.log2(Math.max(e.width,e.height))+1:void 0!==t.mipmaps&&t.mipmaps.length>0?t.mipmaps.length:t.isCompressedTexture&&Array.isArray(t.image)?e.mipmaps.length:1}function G(t){return t===p||t===m||t===f?9728:9729}function V(e){const n=e.target;n.removeEventListener("dispose",V),function(e){const n=i.get(e);if(void 0===n.__webglInit)return;t.deleteTexture(n.__webglTexture),delete n.__webglTexture,i.remove(e)}(n),n.isVideoTexture&&P.delete(n),a.memory.textures--}function k(e){const n=e.target;n.removeEventListener("dispose",k),function(e){const n=e.texture,r=i.get(e),s=i.get(n);if(!e)return;void 0!==s.__webglTexture&&(t.deleteTexture(s.__webglTexture),delete s.__webglTexture,a.memory.textures--);e.depthTexture&&e.depthTexture.dispose();if(e.isWebGLCubeRenderTarget)for(let e=0;e<6;e++)t.deleteFramebuffer(r.__webglFramebuffer[e]),r.__webglDepthbuffer&&t.deleteRenderbuffer(r.__webglDepthbuffer[e]);else t.deleteFramebuffer(r.__webglFramebuffer),r.__webglDepthbuffer&&t.deleteRenderbuffer(r.__webglDepthbuffer),r.__webglMultisampledFramebuffer&&t.deleteFramebuffer(r.__webglMultisampledFramebuffer),r.__webglColorRenderbuffer&&t.deleteRenderbuffer(r.__webglColorRenderbuffer),r.__webglDepthRenderbuffer&&t.deleteRenderbuffer(r.__webglDepthRenderbuffer);if(e.isWebGLMultipleRenderTargets)for(let e=0,r=n.length;e0&&r.__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 K(r,t,e);console.warn("THREE.WebGLRenderer: Texture marked for update but image is incomplete")}}n.activeTexture(33984+e),n.bindTexture(3553,r.__webglTexture)}function q(e,r){const a=i.get(e);e.version>0&&a.__version!==e.version?function(e,i,r){if(6!==i.image.length)return;Z(e,i),n.activeTexture(33984+r),n.bindTexture(34067,e.__webglTexture),t.pixelStorei(37440,i.flipY),t.pixelStorei(37441,i.premultiplyAlpha),t.pixelStorei(3317,i.unpackAlignment),t.pixelStorei(37443,0);const a=i&&(i.isCompressedTexture||i.image[0].isCompressedTexture),l=i.image[0]&&i.image[0].isDataTexture,h=[];for(let t=0;t<6;t++)h[t]=a||l?l?i.image[t].image:i.image[t]:O(i.image[t],!1,!0,c);const u=h[0],d=B(u)||o,p=s.convert(i.format,i.encoding),m=s.convert(i.type),f=U(i.internalFormat,p,m,i.encoding,i.sRGBToLinearWithShader),g=o&&!0!==i.isVideoTexture,v=void 0===e.__version;let x,y=H(i,u,d);if(J(34067,i,d),a){g&&v&&n.texStorage2D(34067,y,f,u.width,u.height);for(let t=0;t<6;t++){x=h[t].mipmaps;for(let e=0;e0&&y++,n.texStorage2D(34067,y,f,h[0].width,h[0].height));for(let t=0;t<6;t++)if(l){g?n.texSubImage2D(34069+t,0,0,0,h[t].width,h[t].height,p,m,h[t].data):n.texImage2D(34069+t,0,f,h[t].width,h[t].height,0,p,m,h[t].data);for(let e=0;e1||i.get(s).__currentAnisotropy)&&(t.texParameterf(n,a.TEXTURE_MAX_ANISOTROPY_EXT,Math.min(s.anisotropy,r.getMaxAnisotropy())),i.get(s).__currentAnisotropy=s.anisotropy)}}function Z(e,n){void 0===e.__webglInit&&(e.__webglInit=!0,n.addEventListener("dispose",V),e.__webglTexture=t.createTexture(),a.memory.textures++)}function K(e,i,r){let a=3553;i.isDataTexture2DArray&&(a=35866),i.isDataTexture3D&&(a=32879),Z(e,i),n.activeTexture(33984+r),n.bindTexture(a,e.__webglTexture),t.pixelStorei(37440,i.flipY),t.pixelStorei(37441,i.premultiplyAlpha),t.pixelStorei(3317,i.unpackAlignment),t.pixelStorei(37443,0);const l=function(t){return!o&&(t.wrapS!==u||t.wrapT!==u||t.minFilter!==p&&t.minFilter!==g)}(i)&&!1===B(i.image),c=O(i.image,l,!1,y),h=B(c)||o,d=s.convert(i.format,i.encoding);let m,f=s.convert(i.type),v=U(i.internalFormat,d,f,i.encoding,i.sRGBToLinearWithShader);J(a,i,h);const x=i.mipmaps,w=o&&!0!==i.isVideoTexture,R=void 0===e.__version,C=H(i,c,h);if(i.isDepthTexture)v=6402,o?v=i.type===b?36012:i.type===M?33190:i.type===S?35056:33189:i.type===b&&console.error("WebGLRenderer: Floating point depth texture requires WebGL2."),i.format===E&&6402===v&&i.type!==_&&i.type!==M&&(console.warn("THREE.WebGLRenderer: Use UnsignedShortType or UnsignedIntType for DepthFormat DepthTexture."),i.type=_,f=s.convert(i.type)),i.format===A&&6402===v&&(v=34041,i.type!==S&&(console.warn("THREE.WebGLRenderer: Use UnsignedInt248Type for DepthStencilFormat DepthTexture."),i.type=S,f=s.convert(i.type))),w&&R?n.texStorage2D(3553,1,v,c.width,c.height):R&&n.texImage2D(3553,0,v,c.width,c.height,0,d,f,null);else if(i.isDataTexture)if(x.length>0&&h){w&&R&&n.texStorage2D(3553,C,v,x[0].width,x[0].height);for(let t=0,e=x.length;t>=1,e>>=1}}else if(x.length>0&&h){w&&R&&n.texStorage2D(3553,C,v,x[0].width,x[0].height);for(let t=0,e=x.length;t0&&!0===e.has("WEBGL_multisampled_render_to_texture")&&!1!==n.__useRenderToTexture}let it=!1,rt=!1;this.allocateTextureUnit=function(){const t=W;return t>=l&&console.warn("THREE.WebGLTextures: Trying to use "+t+" texture units while this GPU supports only "+l),W+=1,t},this.resetTextureUnits=function(){W=0},this.setTexture2D=j,this.setTexture2DArray=function(t,e){const r=i.get(t);t.version>0&&r.__version!==t.version?K(r,t,e):(n.activeTexture(33984+e),n.bindTexture(35866,r.__webglTexture))},this.setTexture3D=function(t,e){const r=i.get(t);t.version>0&&r.__version!==t.version?K(r,t,e):(n.activeTexture(33984+e),n.bindTexture(32879,r.__webglTexture))},this.setTextureCube=q,this.rebindTextures=function(t,e,n){const r=i.get(t);void 0!==e&&Q(r.__webglFramebuffer,t,t.texture,36064,3553),void 0!==n&&tt(t)},this.setupRenderTarget=function(e){const l=e.texture,c=i.get(e),h=i.get(l);e.addEventListener("dispose",k),!0!==e.isWebGLMultipleRenderTargets&&(void 0===h.__webglTexture&&(h.__webglTexture=t.createTexture()),h.__version=l.version,a.memory.textures++);const u=!0===e.isWebGLCubeRenderTarget,d=!0===e.isWebGLMultipleRenderTargets,p=l.isDataTexture3D||l.isDataTexture2DArray,m=B(e)||o;if(u){c.__webglFramebuffer=[];for(let e=0;e<6;e++)c.__webglFramebuffer[e]=t.createFramebuffer()}else if(c.__webglFramebuffer=t.createFramebuffer(),d)if(r.drawBuffers){const n=e.texture;for(let e=0,r=n.length;e0&&!1===nt(e)){c.__webglMultisampledFramebuffer=t.createFramebuffer(),c.__webglColorRenderbuffer=t.createRenderbuffer(),t.bindRenderbuffer(36161,c.__webglColorRenderbuffer);const i=s.convert(l.format,l.encoding),r=s.convert(l.type),a=U(l.internalFormat,i,r,l.encoding),o=et(e);t.renderbufferStorageMultisample(36161,o,a,e.width,e.height),n.bindFramebuffer(36160,c.__webglMultisampledFramebuffer),t.framebufferRenderbuffer(36160,36064,36161,c.__webglColorRenderbuffer),t.bindRenderbuffer(36161,null),e.depthBuffer&&(c.__webglDepthRenderbuffer=t.createRenderbuffer(),$(c.__webglDepthRenderbuffer,e,!0)),n.bindFramebuffer(36160,null)}if(u){n.bindTexture(34067,h.__webglTexture),J(34067,l,m);for(let t=0;t<6;t++)Q(c.__webglFramebuffer[t],e,l,36064,34069+t);z(l,m)&&F(34067),n.unbindTexture()}else if(d){const t=e.texture;for(let r=0,s=t.length;r0&&!1===nt(e)){const r=e.width,s=e.height;let a=16384;const o=[36064],l=e.stencilBuffer?33306:36096;e.depthBuffer&&o.push(l);const c=i.get(e),h=void 0!==c.__ignoreDepthValues&&c.__ignoreDepthValues;!1===h&&(e.depthBuffer&&(a|=256),e.stencilBuffer&&(a|=1024)),n.bindFramebuffer(36008,c.__webglMultisampledFramebuffer),n.bindFramebuffer(36009,c.__webglFramebuffer),!0===h&&(t.invalidateFramebuffer(36008,[l]),t.invalidateFramebuffer(36009,[l])),t.blitFramebuffer(0,0,r,s,0,0,r,s,a,9728),L&&t.invalidateFramebuffer(36008,o),n.bindFramebuffer(36008,null),n.bindFramebuffer(36009,c.__webglMultisampledFramebuffer)}},this.setupDepthRenderbuffer=tt,this.setupFrameBufferTexture=Q,this.useMultisampledRenderToTexture=nt,this.safeSetTexture2D=function(t,e){t&&t.isWebGLRenderTarget&&(!1===it&&(console.warn("THREE.WebGLTextures.safeSetTexture2D: don't use render targets as textures. Use their .texture property instead."),it=!0),t=t.texture),j(t,e)},this.safeSetTextureCube=function(t,e){t&&t.isWebGLCubeRenderTarget&&(!1===rt&&(console.warn("THREE.WebGLTextures.safeSetTextureCube: don't use cube render targets as textures. Use their .texture property instead."),rt=!0),t=t.texture),q(t,e)}}function na(t,e,n){const i=n.isWebGL2;return{convert:function(t,n=null){let r;if(t===y)return 5121;if(1017===t)return 32819;if(1018===t)return 32820;if(1010===t)return 5120;if(1011===t)return 5122;if(t===_)return 5123;if(1013===t)return 5124;if(t===M)return 5125;if(t===b)return 5126;if(t===w)return i?5131:(r=e.get("OES_texture_half_float"),null!==r?r.HALF_FLOAT_OES:null);if(1021===t)return 6406;if(t===T)return 6408;if(1024===t)return 6409;if(1025===t)return 6410;if(t===E)return 6402;if(t===A)return 34041;if(1028===t)return 6403;if(1029===t)return 36244;if(1030===t)return 33319;if(1031===t)return 33320;if(1033===t)return 36249;if(t===R||t===C||t===L||t===P)if(n===lt){if(r=e.get("WEBGL_compressed_texture_s3tc_srgb"),null===r)return null;if(t===R)return r.COMPRESSED_SRGB_S3TC_DXT1_EXT;if(t===C)return r.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT;if(t===L)return r.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT;if(t===P)return r.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT}else{if(r=e.get("WEBGL_compressed_texture_s3tc"),null===r)return null;if(t===R)return r.COMPRESSED_RGB_S3TC_DXT1_EXT;if(t===C)return r.COMPRESSED_RGBA_S3TC_DXT1_EXT;if(t===L)return r.COMPRESSED_RGBA_S3TC_DXT3_EXT;if(t===P)return r.COMPRESSED_RGBA_S3TC_DXT5_EXT}if(t===I||t===D||t===N||t===O){if(r=e.get("WEBGL_compressed_texture_pvrtc"),null===r)return null;if(t===I)return r.COMPRESSED_RGB_PVRTC_4BPPV1_IMG;if(t===D)return r.COMPRESSED_RGB_PVRTC_2BPPV1_IMG;if(t===N)return r.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG;if(t===O)return r.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG}if(36196===t)return r=e.get("WEBGL_compressed_texture_etc1"),null!==r?r.COMPRESSED_RGB_ETC1_WEBGL:null;if(t===B||t===z){if(r=e.get("WEBGL_compressed_texture_etc"),null===r)return null;if(t===B)return n===lt?r.COMPRESSED_SRGB8_ETC2:r.COMPRESSED_RGB8_ETC2;if(t===z)return n===lt?r.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC:r.COMPRESSED_RGBA8_ETC2_EAC}if(t===F||t===U||t===H||t===G||t===V||t===k||t===W||t===j||t===q||t===X||t===Y||t===J||t===Z||t===K){if(r=e.get("WEBGL_compressed_texture_astc"),null===r)return null;if(t===F)return n===lt?r.COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR:r.COMPRESSED_RGBA_ASTC_4x4_KHR;if(t===U)return n===lt?r.COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR:r.COMPRESSED_RGBA_ASTC_5x4_KHR;if(t===H)return n===lt?r.COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR:r.COMPRESSED_RGBA_ASTC_5x5_KHR;if(t===G)return n===lt?r.COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR:r.COMPRESSED_RGBA_ASTC_6x5_KHR;if(t===V)return n===lt?r.COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR:r.COMPRESSED_RGBA_ASTC_6x6_KHR;if(t===k)return n===lt?r.COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR:r.COMPRESSED_RGBA_ASTC_8x5_KHR;if(t===W)return n===lt?r.COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR:r.COMPRESSED_RGBA_ASTC_8x6_KHR;if(t===j)return n===lt?r.COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR:r.COMPRESSED_RGBA_ASTC_8x8_KHR;if(t===q)return n===lt?r.COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR:r.COMPRESSED_RGBA_ASTC_10x5_KHR;if(t===X)return n===lt?r.COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR:r.COMPRESSED_RGBA_ASTC_10x6_KHR;if(t===Y)return n===lt?r.COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR:r.COMPRESSED_RGBA_ASTC_10x8_KHR;if(t===J)return n===lt?r.COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR:r.COMPRESSED_RGBA_ASTC_10x10_KHR;if(t===Z)return n===lt?r.COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR:r.COMPRESSED_RGBA_ASTC_12x10_KHR;if(t===K)return n===lt?r.COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR:r.COMPRESSED_RGBA_ASTC_12x12_KHR}if(t===Q){if(r=e.get("EXT_texture_compression_bptc"),null===r)return null;if(t===Q)return n===lt?r.COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT:r.COMPRESSED_RGBA_BPTC_UNORM_EXT}return t===S?i?34042:(r=e.get("WEBGL_depth_texture"),null!==r?r.UNSIGNED_INT_24_8_WEBGL:null):void 0}}}class ia extends ai{constructor(t=[]){super(),this.cameras=t}}ia.prototype.isArrayCamera=!0;class ra extends je{constructor(){super(),this.type="Group"}}ra.prototype.isGroup=!0;const sa={type:"move"};class aa{constructor(){this._targetRay=null,this._grip=null,this._hand=null}getHandSpace(){return null===this._hand&&(this._hand=new ra,this._hand.matrixAutoUpdate=!1,this._hand.visible=!1,this._hand.joints={},this._hand.inputState={pinching:!1}),this._hand}getTargetRaySpace(){return null===this._targetRay&&(this._targetRay=new ra,this._targetRay.matrixAutoUpdate=!1,this._targetRay.visible=!1,this._targetRay.hasLinearVelocity=!1,this._targetRay.linearVelocity=new kt,this._targetRay.hasAngularVelocity=!1,this._targetRay.angularVelocity=new kt),this._targetRay}getGripSpace(){return null===this._grip&&(this._grip=new ra,this._grip.matrixAutoUpdate=!1,this._grip.visible=!1,this._grip.hasLinearVelocity=!1,this._grip.linearVelocity=new kt,this._grip.hasAngularVelocity=!1,this._grip.angularVelocity=new kt),this._grip}dispatchEvent(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(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(t,e,n){let i=null,r=null,s=null;const a=this._targetRay,o=this._grip,l=this._hand;if(t&&"visible-blurred"!==e.session.visibilityState)if(null!==a&&(i=e.getPose(t.targetRaySpace,n),null!==i&&(a.matrix.fromArray(i.transform.matrix),a.matrix.decompose(a.position,a.rotation,a.scale),i.linearVelocity?(a.hasLinearVelocity=!0,a.linearVelocity.copy(i.linearVelocity)):a.hasLinearVelocity=!1,i.angularVelocity?(a.hasAngularVelocity=!0,a.angularVelocity.copy(i.angularVelocity)):a.hasAngularVelocity=!1,this.dispatchEvent(sa))),l&&t.hand){s=!0;for(const i of t.hand.values()){const t=e.getJointPose(i,n);if(void 0===l.joints[i.jointName]){const t=new ra;t.matrixAutoUpdate=!1,t.visible=!1,l.joints[i.jointName]=t,l.add(t)}const r=l.joints[i.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 i=l.joints["index-finger-tip"],r=l.joints["thumb-tip"],a=i.position.distanceTo(r.position),o=.02,c=.005;l.inputState.pinching&&a>o+c?(l.inputState.pinching=!1,this.dispatchEvent({type:"pinchend",handedness:t.handedness,target:this})):!l.inputState.pinching&&a<=o-c&&(l.inputState.pinching=!0,this.dispatchEvent({type:"pinchstart",handedness:t.handedness,target:this}))}else null!==o&&t.gripSpace&&(r=e.getPose(t.gripSpace,n),null!==r&&(o.matrix.fromArray(r.transform.matrix),o.matrix.decompose(o.position,o.rotation,o.scale),r.linearVelocity?(o.hasLinearVelocity=!0,o.linearVelocity.copy(r.linearVelocity)):o.hasLinearVelocity=!1,r.angularVelocity?(o.hasAngularVelocity=!0,o.angularVelocity.copy(r.angularVelocity)):o.hasAngularVelocity=!1));return null!==a&&(a.visible=null!==i),null!==o&&(o.visible=null!==r),null!==l&&(l.visible=null!==s),this}}class oa extends zt{constructor(t,e,n,i,r,s,a,o,l,c){if((c=void 0!==c?c:E)!==E&&c!==A)throw new Error("DepthTexture format must be either THREE.DepthFormat or THREE.DepthStencilFormat");void 0===n&&c===E&&(n=_),void 0===n&&c===A&&(n=S),super(null,i,r,s,a,o,c,n,l),this.image={width:t,height:e},this.magFilter=void 0!==a?a:p,this.minFilter=void 0!==o?o:p,this.flipY=!1,this.generateMipmaps=!1}}oa.prototype.isDepthTexture=!0;class la extends ft{constructor(t,e){super();const n=this;let i=null,r=1,s=null,a="local-floor",o=null,l=null,c=null,h=null,u=null;const d=e.getContextAttributes();let p=null,m=null;const f=[],g=new Map,v=new ai;v.layers.enable(1),v.viewport=new Ut;const x=new ai;x.layers.enable(2),x.viewport=new Ut;const M=[v,x],b=new ia;b.layers.enable(1),b.layers.enable(2);let w=null,R=null;function C(t){const e=g.get(t.inputSource);e&&e.dispatchEvent({type:t.type,data:t.inputSource})}function L(){g.forEach((function(t,e){t.disconnect(e)})),g.clear(),w=null,R=null,t.setRenderTarget(p),h=null,c=null,l=null,i=null,m=null,B.stop(),n.isPresenting=!1,n.dispatchEvent({type:"sessionend"})}function P(t){const e=i.inputSources;for(let t=0;t0&&(e.alphaTest.value=n.alphaTest);const i=t.get(n).envMap;let r,s;i&&(e.envMap.value=i,e.flipEnvMap.value=i.isCubeTexture&&!1===i.isRenderTargetTexture?-1:1,e.reflectivity.value=n.reflectivity,e.ior.value=n.ior,e.refractionRatio.value=n.refractionRatio),n.lightMap&&(e.lightMap.value=n.lightMap,e.lightMapIntensity.value=n.lightMapIntensity),n.aoMap&&(e.aoMap.value=n.aoMap,e.aoMapIntensity.value=n.aoMapIntensity),n.map?r=n.map:n.specularMap?r=n.specularMap:n.displacementMap?r=n.displacementMap:n.normalMap?r=n.normalMap:n.bumpMap?r=n.bumpMap:n.roughnessMap?r=n.roughnessMap:n.metalnessMap?r=n.metalnessMap:n.alphaMap?r=n.alphaMap:n.emissiveMap?r=n.emissiveMap:n.clearcoatMap?r=n.clearcoatMap:n.clearcoatNormalMap?r=n.clearcoatNormalMap:n.clearcoatRoughnessMap?r=n.clearcoatRoughnessMap:n.specularIntensityMap?r=n.specularIntensityMap:n.specularColorMap?r=n.specularColorMap:n.transmissionMap?r=n.transmissionMap:n.thicknessMap?r=n.thicknessMap:n.sheenColorMap?r=n.sheenColorMap:n.sheenRoughnessMap&&(r=n.sheenRoughnessMap),void 0!==r&&(r.isWebGLRenderTarget&&(r=r.texture),!0===r.matrixAutoUpdate&&r.updateMatrix(),e.uvTransform.value.copy(r.matrix)),n.aoMap?s=n.aoMap:n.lightMap&&(s=n.lightMap),void 0!==s&&(s.isWebGLRenderTarget&&(s=s.texture),!0===s.matrixAutoUpdate&&s.updateMatrix(),e.uv2Transform.value.copy(s.matrix))}function n(e,n){e.roughness.value=n.roughness,e.metalness.value=n.metalness,e.f90_r115_compatability.value=n.f90,n.refraction>0&&(e.refraction.value=n.refraction),n.roughnessMap&&(e.roughnessMap.value=n.roughnessMap),n.metalnessMap&&(e.metalnessMap.value=n.metalnessMap),n.emissiveMap&&(e.emissiveMap.value=n.emissiveMap),n.bumpMap&&(e.bumpMap.value=n.bumpMap,e.bumpScale.value=n.bumpScale,1===n.side&&(e.bumpScale.value*=-1)),n.normalMap&&(e.normalMap.value=n.normalMap,e.normalScale.value.copy(n.normalScale),n.lowerNormalMap&&(e.lowerNormalMap.value=n.lowerNormalMap),1===n.side&&e.normalScale.value.negate()),n.displacementMap&&(e.displacementMap.value=n.displacementMap,e.displacementScale.value=n.displacementScale,e.displacementBias.value=n.displacementBias);t.get(n).envMap&&(e.envMapIntensity.value=n.envMapIntensity)}return{refreshFogUniforms:function(t,e){t.fogColor.value.copy(e.color),e.isFog?(t.fogNear.value=e.near,t.fogFar.value=e.far):e.isFogExp2&&(t.fogDensity.value=e.density)},refreshMaterialUniforms:function(t,i,r,s,a){i.isMeshBasicMaterial?e(t,i):i.isMeshLambertMaterial?(e(t,i),function(t,e){e.emissiveMap&&(t.emissiveMap.value=e.emissiveMap)}(t,i)):i.isMeshToonMaterial?(e(t,i),function(t,e){e.gradientMap&&(t.gradientMap.value=e.gradientMap);e.emissiveMap&&(t.emissiveMap.value=e.emissiveMap);e.bumpMap&&(t.bumpMap.value=e.bumpMap,t.bumpScale.value=e.bumpScale,1===e.side&&(t.bumpScale.value*=-1));e.normalMap&&(t.normalMap.value=e.normalMap,t.normalScale.value.copy(e.normalScale),1===e.side&&t.normalScale.value.negate());e.displacementMap&&(t.displacementMap.value=e.displacementMap,t.displacementScale.value=e.displacementScale,t.displacementBias.value=e.displacementBias)}(t,i)):i.isMeshPhongMaterial?(e(t,i),function(t,e){t.specular.value.copy(e.specular),t.shininess.value=Math.max(e.shininess,1e-4),e.emissiveMap&&(t.emissiveMap.value=e.emissiveMap);e.bumpMap&&(t.bumpMap.value=e.bumpMap,t.bumpScale.value=e.bumpScale,1===e.side&&(t.bumpScale.value*=-1));e.normalMap&&(t.normalMap.value=e.normalMap,t.normalScale.value.copy(e.normalScale),1===e.side&&t.normalScale.value.negate());e.displacementMap&&(t.displacementMap.value=e.displacementMap,t.displacementScale.value=e.displacementScale,t.displacementBias.value=e.displacementBias)}(t,i)):i.isMeshStandardMaterial?(e(t,i),i.isMeshPhysicalMaterial?function(t,e,i){n(t,e),t.ior.value=e.ior,e.sheen>0&&(t.sheenColor.value.copy(e.sheenColor).multiplyScalar(e.sheen),t.sheenRoughness.value=e.sheenRoughness,e.sheenColorMap&&(t.sheenColorMap.value=e.sheenColorMap),e.sheenRoughnessMap&&(t.sheenRoughnessMap.value=e.sheenRoughnessMap));e.clearcoat>0&&(t.clearcoat.value=e.clearcoat,t.clearcoatRoughness.value=e.clearcoatRoughness,e.clearcoatMap&&(t.clearcoatMap.value=e.clearcoatMap),e.clearcoatRoughnessMap&&(t.clearcoatRoughnessMap.value=e.clearcoatRoughnessMap),e.clearcoatNormalMap&&(t.clearcoatNormalScale.value.copy(e.clearcoatNormalScale),t.clearcoatNormalMap.value=e.clearcoatNormalMap,1===e.side&&t.clearcoatNormalScale.value.negate()));e.transmission>0&&(t.transmission.value=e.transmission,t.transmissionSamplerMap.value=i.texture,t.transmissionSamplerSize.value.set(i.width,i.height),e.transmissionMap&&(t.transmissionMap.value=e.transmissionMap),t.thickness.value=e.thickness,e.thicknessMap&&(t.thicknessMap.value=e.thicknessMap),t.attenuationDistance.value=e.attenuationDistance,t.attenuationColor.value.copy(e.attenuationColor));t.specularIntensity.value=e.specularIntensity,t.specularColor.value.copy(e.specularColor),e.specularIntensityMap&&(t.specularIntensityMap.value=e.specularIntensityMap);e.specularColorMap&&(t.specularColorMap.value=e.specularColorMap)}(t,i,a):n(t,i)):i.isMeshMatcapMaterial?(e(t,i),function(t,e){e.matcap&&(t.matcap.value=e.matcap);e.bumpMap&&(t.bumpMap.value=e.bumpMap,t.bumpScale.value=e.bumpScale,1===e.side&&(t.bumpScale.value*=-1));e.normalMap&&(t.normalMap.value=e.normalMap,t.normalScale.value.copy(e.normalScale),1===e.side&&t.normalScale.value.negate());e.displacementMap&&(t.displacementMap.value=e.displacementMap,t.displacementScale.value=e.displacementScale,t.displacementBias.value=e.displacementBias)}(t,i)):i.isMeshDepthMaterial?(e(t,i),function(t,e){e.displacementMap&&(t.displacementMap.value=e.displacementMap,t.displacementScale.value=e.displacementScale,t.displacementBias.value=e.displacementBias)}(t,i)):i.isMeshDistanceMaterial?(e(t,i),function(t,e){e.displacementMap&&(t.displacementMap.value=e.displacementMap,t.displacementScale.value=e.displacementScale,t.displacementBias.value=e.displacementBias);t.referencePosition.value.copy(e.referencePosition),t.nearDistance.value=e.nearDistance,t.farDistance.value=e.farDistance}(t,i)):i.isMeshNormalMaterial?(e(t,i),function(t,e){e.bumpMap&&(t.bumpMap.value=e.bumpMap,t.bumpScale.value=e.bumpScale,1===e.side&&(t.bumpScale.value*=-1));e.normalMap&&(t.normalMap.value=e.normalMap,t.normalScale.value.copy(e.normalScale),1===e.side&&t.normalScale.value.negate());e.displacementMap&&(t.displacementMap.value=e.displacementMap,t.displacementScale.value=e.displacementScale,t.displacementBias.value=e.displacementBias)}(t,i)):i.isLineBasicMaterial?(function(t,e){t.diffuse.value.copy(e.color),t.opacity.value=e.opacity}(t,i),i.isLineDashedMaterial&&function(t,e){t.dashSize.value=e.dashSize,t.totalSize.value=e.dashSize+e.gapSize,t.scale.value=e.scale}(t,i)):i.isPointsMaterial?function(t,e,n,i){t.diffuse.value.copy(e.color),t.opacity.value=e.opacity,t.size.value=e.size*n,t.scale.value=.5*i,e.map&&(t.map.value=e.map);e.alphaMap&&(t.alphaMap.value=e.alphaMap);e.alphaTest>0&&(t.alphaTest.value=e.alphaTest);let r;e.map?r=e.map:e.alphaMap&&(r=e.alphaMap);void 0!==r&&(!0===r.matrixAutoUpdate&&r.updateMatrix(),t.uvTransform.value.copy(r.matrix))}(t,i,r,s):i.isSpriteMaterial?function(t,e){t.diffuse.value.copy(e.color),t.opacity.value=e.opacity,t.rotation.value=e.rotation,e.map&&(t.map.value=e.map);e.alphaMap&&(t.alphaMap.value=e.alphaMap);e.alphaTest>0&&(t.alphaTest.value=e.alphaTest);let n;e.map?n=e.map:e.alphaMap&&(n=e.alphaMap);void 0!==n&&(!0===n.matrixAutoUpdate&&n.updateMatrix(),t.uvTransform.value.copy(n.matrix))}(t,i):i.isShadowMaterial?(t.color.value.copy(i.color),t.opacity.value=i.opacity):i.isShaderMaterial&&(i.uniformsNeedUpdate=!1)}}}function ha(t={}){const e=void 0!==t.canvas?t.canvas:function(){const t=Dt("canvas");return t.style.display="block",t}(),n=void 0!==t.context?t.context:null,i=void 0!==t.alpha&&t.alpha,r=void 0===t.depth||t.depth,s=void 0===t.stencil||t.stencil,a=void 0!==t.antialias&&t.antialias,o=void 0===t.premultipliedAlpha||t.premultipliedAlpha,l=void 0!==t.preserveDrawingBuffer&&t.preserveDrawingBuffer,c=void 0!==t.powerPreference?t.powerPreference:"default",h=void 0!==t.failIfMajorPerformanceCaveat&&t.failIfMajorPerformanceCaveat;let u=null,d=null;const p=[],m=[];this.domElement=e,this.debug={checkShaderErrors:!0},this.autoClear=!0,this.autoClearColor=!0,this.autoClearDepth=!0,this.autoClearStencil=!0,this.sortObjects=!0,this.clippingPlanes=[],this.localClippingEnabled=!1,this.outputEncoding=ot,this.physicallyCorrectLights=!1,this.toneMapping=0,this.toneMappingExposure=1;const f=this;let g=!1,v=0,_=0,M=null,S=-1,E=null;const A=new Ut,R=new Ut;let C=null,L=e.width,P=e.height,I=1,D=null,N=null;const O=new Ut(0,0,L,P),B=new Ut(0,0,L,P);let z=!1;const F=new vi;let U=!1,H=!1,G=null;const V=new _e,k=new kt,W=new Rt,j={background:null,fog:null,environment:null,overrideMaterial:null,layers:{test:()=>!1},children:[],isScene:!0,onBeforeRender:function(){},onAfterRender:function(){}},q={isCamera:!0,projectionMatrix:new _e,matrixWorldInverse:new _e};function X(){return null===M?I:1}let Y,J,Z,K,Q,$,tt,et,nt,it,rt,st,at,ct,ht,ut,dt,pt,ft,gt,vt,xt,yt,_t=n;function Mt(t,n){for(let i=0;i0&&function(t,e,n){if(null===G){const t=!0===a&&!0===J.isWebGL2,e=Y.has("EXT_color_buffer_half_float")||J.isWebGL2&&Y.has("EXT_color_buffer_float");G=new Ht(1,1,{generateMipmaps:!0,type:e?w:y,minFilter:x,samples:t?4:0})}f.getDrawingBufferSize(W),G.setSize(W.x,W.y);const i=f.getRenderTarget();f.setRenderTarget(G),f.clear();const r=f.toneMapping;f.toneMapping=0,Ot(t,e,n),f.toneMapping=r,$.updateMultisampleRenderTarget(G),$.updateRenderTargetMipmap(G),f.setRenderTarget(i)}(r,e,n),i&&Z.viewport(A.copy(i)),r.length>0&&Ot(r,e,n),s.length>0&&Ot(s,e,n),o.length>0&&Ot(o,e,n)}function Ot(t,e,n){const i=!0===e.isScene?e.overrideMaterial:null;for(let r=0,s=t.length;r0?m[m.length-1]:null,p.pop(),u=p.length>0?p[p.length-1]:null},this.getActiveCubeFace=function(){return v},this.getActiveMipmapLevel=function(){return _},this.getRenderTarget=function(){return M},this.setRenderTargetTextures=function(t,e,n){Q.get(t.texture).__webglTexture=e,Q.get(t.depthTexture).__webglTexture=n;const i=Q.get(t);i.__hasExternalTextures=!0,i.__hasExternalTextures&&(i.__autoAllocateDepthBuffer=void 0===n,i.__autoAllocateDepthBuffer||!0===Y.has("WEBGL_multisampled_render_to_texture")&&(console.warn("THREE.WebGLRenderer: Render-to-texture extension was disabled because an external texture was provided"),i.__useRenderToTexture=!1))},this.setRenderTargetFramebuffer=function(t,e){const n=Q.get(t);n.__webglFramebuffer=e,n.__useDefaultFramebuffer=void 0===e},this.setRenderTarget=function(t,e=0,n=0){M=t,v=e,_=n;let i=!0;if(t){const e=Q.get(t);void 0!==e.__useDefaultFramebuffer?(Z.bindFramebuffer(36160,null),i=!1):void 0===e.__webglFramebuffer?$.setupRenderTarget(t):e.__hasExternalTextures&&$.rebindTextures(t,Q.get(t.texture).__webglTexture,Q.get(t.depthTexture).__webglTexture)}let r=null,s=!1,a=!1;if(t){const n=t.texture;(n.isDataTexture3D||n.isDataTexture2DArray)&&(a=!0);const i=Q.get(t).__webglFramebuffer;t.isWebGLCubeRenderTarget?(r=i[e],s=!0):r=J.isWebGL2&&t.samples>0&&!1===$.useMultisampledRenderToTexture(t)?Q.get(t).__webglMultisampledFramebuffer:i,A.copy(t.viewport),R.copy(t.scissor),C=t.scissorTest}else A.copy(O).multiplyScalar(I).floor(),R.copy(B).multiplyScalar(I).floor(),C=z;if(Z.bindFramebuffer(36160,r)&&J.drawBuffers&&i&&Z.drawBuffers(t,r),Z.viewport(A),Z.scissor(R),Z.setScissorTest(C),s){const i=Q.get(t.texture);_t.framebufferTexture2D(36160,36064,34069+e,i.__webglTexture,n)}else if(a){const i=Q.get(t.texture),r=e||0;_t.framebufferTextureLayer(36160,36064,i.__webglTexture,n||0,r)}S=-1},this.readRenderTargetPixels=function(t,e,n,i,r,s,a){if(!t||!t.isWebGLRenderTarget)return void console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");let o=Q.get(t).__webglFramebuffer;if(t.isWebGLCubeRenderTarget&&void 0!==a&&(o=o[a]),o){Z.bindFramebuffer(36160,o);try{const a=t.texture,o=a.format,l=a.type;if(o!==T&&xt.convert(o)!==_t.getParameter(35739))return void console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in RGBA or implementation defined format.");const c=l===w&&(Y.has("EXT_color_buffer_half_float")||J.isWebGL2&&Y.has("EXT_color_buffer_float"));if(!(l===y||xt.convert(l)===_t.getParameter(35738)||l===b&&(J.isWebGL2||Y.has("OES_texture_float")||Y.has("WEBGL_color_buffer_float"))||c))return void console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in UnsignedByteType or implementation defined type.");36053===_t.checkFramebufferStatus(36160)?e>=0&&e<=t.width-i&&n>=0&&n<=t.height-r&&_t.readPixels(e,n,i,r,xt.convert(o),xt.convert(l),s):console.error("THREE.WebGLRenderer.readRenderTargetPixels: readPixels from renderTarget failed. Framebuffer not complete.")}finally{const t=null!==M?Q.get(M).__webglFramebuffer:null;Z.bindFramebuffer(36160,t)}}},this.copyFramebufferToTexture=function(t,e,n=0){const i=Math.pow(2,-n),r=Math.floor(e.image.width*i),s=Math.floor(e.image.height*i);$.setTexture2D(e,0),_t.copyTexSubImage2D(3553,n,0,0,t.x,t.y,r,s),Z.unbindTexture()},this.copyTextureToTexture=function(t,e,n,i=0){const r=e.image.width,s=e.image.height,a=xt.convert(n.format),o=xt.convert(n.type);$.setTexture2D(n,0),_t.pixelStorei(37440,n.flipY),_t.pixelStorei(37441,n.premultiplyAlpha),_t.pixelStorei(3317,n.unpackAlignment),e.isDataTexture?_t.texSubImage2D(3553,i,t.x,t.y,r,s,a,o,e.image.data):e.isCompressedTexture?_t.compressedTexSubImage2D(3553,i,t.x,t.y,e.mipmaps[0].width,e.mipmaps[0].height,a,e.mipmaps[0].data):_t.texSubImage2D(3553,i,t.x,t.y,a,o,e.image),0===i&&n.generateMipmaps&&_t.generateMipmap(3553),Z.unbindTexture()},this.copyTextureToTexture3D=function(t,e,n,i,r=0){if(f.isWebGL1Renderer)return void console.warn("THREE.WebGLRenderer.copyTextureToTexture3D: can only be used with WebGL2.");const s=t.max.x-t.min.x+1,a=t.max.y-t.min.y+1,o=t.max.z-t.min.z+1,l=xt.convert(i.format),c=xt.convert(i.type);let h;if(i.isDataTexture3D)$.setTexture3D(i,0),h=32879;else{if(!i.isDataTexture2DArray)return void console.warn("THREE.WebGLRenderer.copyTextureToTexture3D: only supports THREE.DataTexture3D and THREE.DataTexture2DArray.");$.setTexture2DArray(i,0),h=35866}_t.pixelStorei(37440,i.flipY),_t.pixelStorei(37441,i.premultiplyAlpha),_t.pixelStorei(3317,i.unpackAlignment);const u=_t.getParameter(3314),d=_t.getParameter(32878),p=_t.getParameter(3316),m=_t.getParameter(3315),g=_t.getParameter(32877),v=n.isCompressedTexture?n.mipmaps[0]:n.image;_t.pixelStorei(3314,v.width),_t.pixelStorei(32878,v.height),_t.pixelStorei(3316,t.min.x),_t.pixelStorei(3315,t.min.y),_t.pixelStorei(32877,t.min.z),n.isDataTexture||n.isDataTexture3D?_t.texSubImage3D(h,r,e.x,e.y,e.z,s,a,o,l,c,v.data):n.isCompressedTexture?(console.warn("THREE.WebGLRenderer.copyTextureToTexture3D: untested support for compressed srcTexture."),_t.compressedTexSubImage3D(h,r,e.x,e.y,e.z,s,a,o,l,v.data)):_t.texSubImage3D(h,r,e.x,e.y,e.z,s,a,o,l,c,v),_t.pixelStorei(3314,u),_t.pixelStorei(32878,d),_t.pixelStorei(3316,p),_t.pixelStorei(3315,m),_t.pixelStorei(32877,g),0===r&&i.generateMipmaps&&_t.generateMipmap(h),Z.unbindTexture()},this.initTexture=function(t){$.setTexture2D(t,0),Z.unbindTexture()},this.resetState=function(){v=0,_=0,M=null,Z.reset(),yt.reset()},"undefined"!=typeof __THREE_DEVTOOLS__&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}ha.prototype.isWebGLRenderer=!0;class ua extends ha{}ua.prototype.isWebGL1Renderer=!0;class da{constructor(t,e=25e-5){this.name="",this.color=new dn(t),this.density=e}clone(){return new da(this.color,this.density)}toJSON(){return{type:"FogExp2",color:this.color.getHex(),density:this.density}}}da.prototype.isFogExp2=!0;class pa{constructor(t,e=1,n=1e3){this.name="",this.color=new dn(t),this.near=e,this.far=n}clone(){return new pa(this.color,this.near,this.far)}toJSON(){return{type:"Fog",color:this.color.getHex(),near:this.near,far:this.far}}}pa.prototype.isFog=!0;class ma extends je{constructor(){super(),this.type="Scene",this.bgToneMapped=!0,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),this.bgToneMapped=t.bgToneMapped,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.fog&&(e.object.fog=this.fog.toJSON()),e.object.bgToneMapped=this.bgToneMapped.toJSON(),e}}ma.prototype.isScene=!0;class fa{constructor(t,e){this.array=t,this.stride=e,this.count=void 0!==t?t.length/e:0,this.usage=ut,this.updateRange={offset:0,count:-1},this.version=0,this.uuid=_t()}onUploadCallback(){}set needsUpdate(t){!0===t&&this.version++}setUsage(t){return this.usage=t,this}copy(t){return this.array=new t.array.constructor(t.array),this.count=t.count,this.stride=t.stride,this.usage=t.usage,this}copyAt(t,e,n){t*=this.stride,n*=e.stride;for(let i=0,r=this.stride;it.far||e.push({distance:o,point:_a.clone(),uv:nn.getUV(_a,Ea,Aa,Ra,Ca,La,Pa,new Rt),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 Da(t,e,n,i,r,s){wa.subVectors(t,n).addScalar(.5).multiply(i),void 0!==r?(Sa.x=s*wa.x-r*wa.y,Sa.y=r*wa.x+s*wa.y):Sa.copy(wa),t.copy(e),t.x+=Sa.x,t.y+=Sa.y,t.applyMatrix4(Ta)}Ia.prototype.isSprite=!0;const Na=new kt,Oa=new kt;class Ba extends je{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 t=0,n=e.length;t0){let n,i;for(n=1,i=e.length;n0){Na.setFromMatrixPosition(this.matrixWorld);const n=t.ray.origin.distanceTo(Na);this.getObjectForDistance(n).raycast(t,e)}}update(t){const e=this.levels;if(e.length>1){Na.setFromMatrixPosition(t.matrixWorld),Oa.setFromMatrixPosition(this.matrixWorld);const n=Na.distanceTo(Oa)/t.zoom;let i,r;for(e[0].object.visible=!0,i=1,r=e.length;i=e[i].distance;i++)e[i-1].object.visible=!1,e[i].object.visible=!0;for(this._currentLevel=i-1;i=0){this.rootMotionBone=this.bones[e];break}this.rootMotionBone&&(this.rootMotionBoneInitialMatrixInverse=this.rootMotionBone.matrixWorld.clone(),this.rootMotionBoneInitialMatrixInverse.invert())}toJSON(){const t={metadata:{version:4.5,type:"Skeleton",generator:"Skeleton.toJSON"},bones:[],boneInverses:[]};t.uuid=this.uuid;const e=this.bones,n=this.boneInverses;for(let i=0,r=e.length;io)continue;u.applyMatrix4(this.matrixWorld);const d=t.ray.origin.distanceTo(u);dt.far||e.push({distance:d,point:h.clone().applyMatrix4(this.matrixWorld),index:n,face:null,faceIndex:null,object:this})}}else{for(let n=Math.max(0,s.start),i=Math.min(r.count,s.start+s.count)-1;no)continue;u.applyMatrix4(this.matrixWorld);const i=t.ray.origin.distanceTo(u);it.far||e.push({distance:i,point:h.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(){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.")}}}ao.prototype.isLine=!0;const oo=new kt,lo=new kt;class co extends ao{constructor(t,e){super(t,e),this.type="LineSegments"}computeLineDistances(){const t=this.geometry;if(t.isBufferGeometry)if(null===t.index){const e=t.attributes.position,n=[];for(let t=0,i=e.count;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.Points.updateMorphTargets() does not support THREE.Geometry. Use THREE.BufferGeometry instead.")}}}function xo(t,e,n,i,r,s,a){const o=mo.distanceSqToPoint(t);if(or.far)return;s.push({distance:l,distanceToRay:Math.sqrt(o),point:n,index:e,face:null,object:a})}}vo.prototype.isPoints=!0;class yo extends zt{constructor(t,e,n,i,r,s,a,o,l){super(t,e,n,i,r,s,a,o,l),this.minFilter=void 0!==s?s:g,this.magFilter=void 0!==r?r:g,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)}}yo.prototype.isVideoTexture=!0;class _o extends zt{constructor(t,e,n){super({width:t,height:e}),this.format=n,this.magFilter=p,this.minFilter=p,this.generateMipmaps=!1,this.needsUpdate=!0}}_o.prototype.isFramebufferTexture=!0;class Mo extends zt{constructor(t,e,n,i,r,s,a,o,l,c,h,u){super(null,s,a,o,l,c,i,r,h,u),this.image={width:e,height:n},this.mipmaps=t,this.flipY=!1,this.generateMipmaps=!1}}Mo.prototype.isCompressedTexture=!0;class bo extends zt{constructor(t,e,n,i,r,s,a,o,l){super(t,e,n,i,r,s,a,o,l),this.needsUpdate=!0}}bo.prototype.isCanvasTexture=!0;class wo{constructor(){this.webglTexture=null}}wo.prototype.isExternalTexture2D=!0;class So extends Nn{constructor(t=1,e=8,n=0,i=2*Math.PI){super(),this.type="CircleGeometry",this.parameters={radius:t,segments:e,thetaStart:n,thetaLength:i},e=Math.max(3,e);const r=[],s=[],a=[],o=[],l=new kt,c=new Rt;s.push(0,0,0),a.push(0,0,1),o.push(.5,.5);for(let r=0,h=3;r<=e;r++,h+=3){const u=n+r/e*i;l.x=t*Math.cos(u),l.y=t*Math.sin(u),s.push(l.x,l.y,l.z),a.push(0,0,1),c.x=(s[h]/t+1)/2,c.y=(s[h+1]/t+1)/2,o.push(c.x,c.y)}for(let t=1;t<=e;t++)r.push(t,t+1,0);this.setIndex(r),this.setAttribute("position",new Tn(s,3)),this.setAttribute("normal",new Tn(a,3)),this.setAttribute("uv",new Tn(o,2))}static fromJSON(t){return new So(t.radius,t.segments,t.thetaStart,t.thetaLength)}}class To extends Nn{constructor(t=1,e=1,n=1,i=8,r=1,s=!1,a=0,o=2*Math.PI){super(),this.type="CylinderGeometry",this.parameters={radiusTop:t,radiusBottom:e,height:n,radialSegments:i,heightSegments:r,openEnded:s,thetaStart:a,thetaLength:o};const l=this;i=Math.floor(i),r=Math.floor(r);const c=[],h=[],u=[],d=[];let p=0;const m=[],f=n/2;let g=0;function v(n){const r=p,s=new Rt,m=new kt;let v=0;const x=!0===n?t:e,y=!0===n?1:-1;for(let t=1;t<=i;t++)h.push(0,f*y,0),u.push(0,y,0),d.push(.5,.5),p++;const _=p;for(let t=0;t<=i;t++){const e=t/i*o+a,n=Math.cos(e),r=Math.sin(e);m.x=x*r,m.y=f*y,m.z=x*n,h.push(m.x,m.y,m.z),u.push(0,y,0),s.x=.5*n+.5,s.y=.5*r*y+.5,d.push(s.x,s.y),p++}for(let t=0;t0&&v(!0),e>0&&v(!1)),this.setIndex(c),this.setAttribute("position",new Tn(h,3)),this.setAttribute("normal",new Tn(u,3)),this.setAttribute("uv",new Tn(d,2))}static fromJSON(t){return new To(t.radiusTop,t.radiusBottom,t.height,t.radialSegments,t.heightSegments,t.openEnded,t.thetaStart,t.thetaLength)}}class Eo extends To{constructor(t=1,e=1,n=8,i=1,r=!1,s=0,a=2*Math.PI){super(0,t,e,n,i,r,s,a),this.type="ConeGeometry",this.parameters={radius:t,height:e,radialSegments:n,heightSegments:i,openEnded:r,thetaStart:s,thetaLength:a}}static fromJSON(t){return new Eo(t.radius,t.height,t.radialSegments,t.heightSegments,t.openEnded,t.thetaStart,t.thetaLength)}}class Ao extends Nn{constructor(t=[],e=[],n=1,i=0){super(),this.type="PolyhedronGeometry",this.parameters={vertices:t,indices:e,radius:n,detail:i};const r=[],s=[];function a(t,e,n,i){const r=i+1,s=[];for(let i=0;i<=r;i++){s[i]=[];const a=t.clone().lerp(n,i/r),o=e.clone().lerp(n,i/r),l=r-i;for(let t=0;t<=l;t++)s[i][t]=0===t&&i===r?a:a.clone().lerp(o,t/l)}for(let t=0;t.9&&a<.1&&(e<.2&&(s[t+0]+=1),n<.2&&(s[t+2]+=1),i<.2&&(s[t+4]+=1))}}()}(),this.setAttribute("position",new Tn(r,3)),this.setAttribute("normal",new Tn(r.slice(),3)),this.setAttribute("uv",new Tn(s,2)),0===i?this.computeVertexNormals():this.normalizeNormals()}static fromJSON(t){return new Ao(t.vertices,t.indices,t.radius,t.details)}}class Ro extends Ao{constructor(t=1,e=0){const n=(1+Math.sqrt(5))/2,i=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,-i,-n,0,-i,n,0,i,-n,0,i,n,-i,-n,0,-i,n,0,i,-n,0,i,n,0,-n,0,-i,n,0,-i,-n,0,i,n,0,i],[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}}static fromJSON(t){return new Ro(t.radius,t.detail)}}const Co=new kt,Lo=new kt,Po=new kt,Io=new nn;class Do extends Nn{constructor(t=null,e=1){if(super(),this.type="EdgesGeometry",this.parameters={geometry:t,thresholdAngle:e},null!==t){const n=4,i=Math.pow(10,n),r=Math.cos(xt*e),s=t.getIndex(),a=t.getAttribute("position"),o=s?s.count:a.count,l=[0,0,0],c=["a","b","c"],h=new Array(3),u={},d=[];for(let t=0;t0)){l=i;break}l=i-1}if(i=l,n[i]===s)return i/(r-1);const c=n[i];return(i+(s-c)/(n[i+1]-c))/(r-1)}getTangent(t,e){const n=1e-4;let i=t-n,r=t+n;i<0&&(i=0),r>1&&(r=1);const s=this.getPoint(i),a=this.getPoint(r),o=e||(s.isVector2?new Rt:new kt);return o.copy(a).sub(s).normalize(),o}getTangentAt(t,e){const n=this.getUtoTmapping(t);return this.getTangent(n,e)}computeFrenetFrames(t,e){const n=new kt,i=[],r=[],s=[],a=new kt,o=new _e;for(let e=0;e<=t;e++){const n=e/t;i[e]=this.getTangentAt(n,new kt)}r[0]=new kt,s[0]=new kt;let l=Number.MAX_VALUE;const c=Math.abs(i[0].x),h=Math.abs(i[0].y),u=Math.abs(i[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),a.crossVectors(i[0],n).normalize(),r[0].crossVectors(i[0],a),s[0].crossVectors(i[0],r[0]);for(let e=1;e<=t;e++){if(r[e]=r[e-1].clone(),s[e]=s[e-1].clone(),a.crossVectors(i[e-1],i[e]),a.length()>Number.EPSILON){a.normalize();const t=Math.acos(Mt(i[e-1].dot(i[e]),-1,1));r[e].applyMatrix4(o.makeRotationAxis(a,t))}s[e].crossVectors(i[e],r[e])}if(!0===e){let e=Math.acos(Mt(r[0].dot(r[t]),-1,1));e/=t,i[0].dot(a.crossVectors(r[0],r[t]))>0&&(e=-e);for(let n=1;n<=t;n++)r[n].applyMatrix4(o.makeRotationAxis(i[n],e*n)),s[n].crossVectors(i[n],r[n])}return{tangents:i,normals:r,binormals:s}}clone(){return(new this.constructor).copy(this)}copy(t){return this.arcLengthDivisions=t.arcLengthDivisions,this}toJSON(){const t={metadata:{version:4.5,type:"Curve",generator:"Curve.toJSON"}};return t.arcLengthDivisions=this.arcLengthDivisions,t.type=this.type,t}fromJSON(t){return this.arcLengthDivisions=t.arcLengthDivisions,this}}class Oo extends No{constructor(t=0,e=0,n=1,i=1,r=0,s=2*Math.PI,a=!1,o=0){super(),this.type="EllipseCurve",this.aX=t,this.aY=e,this.xRadius=n,this.yRadius=i,this.aStartAngle=r,this.aEndAngle=s,this.aClockwise=a,this.aRotation=o}getPoint(t,e){const n=e||new Rt,i=2*Math.PI;let r=this.aEndAngle-this.aStartAngle;const s=Math.abs(r)i;)r-=i;r0?0:(Math.floor(Math.abs(l)/r)+1)*r:0===c&&l===r-1&&(l=r-2,c=1),this.closed||l>0?a=i[(l-1)%r]:(Fo.subVectors(i[0],i[1]).add(i[0]),a=Fo);const h=i[l%r],u=i[(l+1)%r];if(this.closed||l+2i.length-2?i.length-1:s+1],h=i[s>i.length-3?i.length-1:s+2];return n.set(ko(a,o.x,l.x,c.x,h.x),ko(a,o.y,l.y,c.y,h.y)),n}copy(t){super.copy(t),this.points=[];for(let e=0,n=t.points.length;e=n){const t=i[r]-n,s=this.curves[r],a=s.getLength(),o=0===a?0:1-t/a;return s.getPointAt(o,e)}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,i=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}}class nl extends el{constructor(t){super(t),this.uuid=_t(),this.type="Shape",this.holes=[]}getPointsHoles(t){const e=[];for(let n=0,i=this.holes.length;n80*n){o=c=t[0],l=h=t[1];for(let e=n;ec&&(c=u),d>h&&(h=d);p=Math.max(c-o,h-l),p=0!==p?1/p:0}return al(s,a,n,o,l,p),a};function rl(t,e,n,i,r){let s,a;if(r===function(t,e,n,i){let r=0;for(let s=e,a=n-i;s0)for(s=e;s=e;s-=i)a=Tl(s,t[s],t[s+1],a);return a&&yl(a,a.next)&&(El(a),a=a.next),a}function sl(t,e){if(!t)return t;e||(e=t);let n,i=t;do{if(n=!1,i.steiner||!yl(i,i.next)&&0!==xl(i.prev,i,i.next))i=i.next;else{if(El(i),i=e=i.prev,i===i.next)break;n=!0}}while(n||i!==e);return e}function al(t,e,n,i,r,s,a){if(!t)return;!a&&s&&function(t,e,n,i){let r=t;do{null===r.z&&(r.z=ml(r.x,r.y,e,n,i)),r.prevZ=r.prev,r.nextZ=r.next,r=r.next}while(r!==t);r.prevZ.nextZ=null,r.prevZ=null,function(t){let e,n,i,r,s,a,o,l,c=1;do{for(n=t,t=null,s=null,a=0;n;){for(a++,i=n,o=0,e=0;e0||l>0&&i;)0!==o&&(0===l||!i||n.z<=i.z)?(r=n,n=n.nextZ,o--):(r=i,i=i.nextZ,l--),s?s.nextZ=r:t=r,r.prevZ=s,s=r;n=i}s.nextZ=null,c*=2}while(a>1)}(r)}(t,i,r,s);let o,l,c=t;for(;t.prev!==t.next;)if(o=t.prev,l=t.next,s?ll(t,i,r,s):ol(t))e.push(o.i/n),e.push(t.i/n),e.push(l.i/n),El(t),t=l.next,c=l.next;else if((t=l)===c){a?1===a?al(t=cl(sl(t),e,n),e,n,i,r,s,2):2===a&&hl(t,e,n,i,r,s):al(sl(t),e,n,i,r,s,1);break}}function ol(t){const e=t.prev,n=t,i=t.next;if(xl(e,n,i)>=0)return!1;let r=t.next.next;for(;r!==t.prev;){if(gl(e.x,e.y,n.x,n.y,i.x,i.y,r.x,r.y)&&xl(r.prev,r,r.next)>=0)return!1;r=r.next}return!0}function ll(t,e,n,i){const r=t.prev,s=t,a=t.next;if(xl(r,s,a)>=0)return!1;const o=r.xs.x?r.x>a.x?r.x:a.x:s.x>a.x?s.x:a.x,h=r.y>s.y?r.y>a.y?r.y:a.y:s.y>a.y?s.y:a.y,u=ml(o,l,e,n,i),d=ml(c,h,e,n,i);let p=t.prevZ,m=t.nextZ;for(;p&&p.z>=u&&m&&m.z<=d;){if(p!==t.prev&&p!==t.next&&gl(r.x,r.y,s.x,s.y,a.x,a.y,p.x,p.y)&&xl(p.prev,p,p.next)>=0)return!1;if(p=p.prevZ,m!==t.prev&&m!==t.next&&gl(r.x,r.y,s.x,s.y,a.x,a.y,m.x,m.y)&&xl(m.prev,m,m.next)>=0)return!1;m=m.nextZ}for(;p&&p.z>=u;){if(p!==t.prev&&p!==t.next&&gl(r.x,r.y,s.x,s.y,a.x,a.y,p.x,p.y)&&xl(p.prev,p,p.next)>=0)return!1;p=p.prevZ}for(;m&&m.z<=d;){if(m!==t.prev&&m!==t.next&&gl(r.x,r.y,s.x,s.y,a.x,a.y,m.x,m.y)&&xl(m.prev,m,m.next)>=0)return!1;m=m.nextZ}return!0}function cl(t,e,n){let i=t;do{const r=i.prev,s=i.next.next;!yl(r,s)&&_l(r,i,i.next,s)&&wl(r,s)&&wl(s,r)&&(e.push(r.i/n),e.push(i.i/n),e.push(s.i/n),El(i),El(i.next),i=t=s),i=i.next}while(i!==t);return sl(i)}function hl(t,e,n,i,r,s){let a=t;do{let t=a.next.next;for(;t!==a.prev;){if(a.i!==t.i&&vl(a,t)){let o=Sl(a,t);return a=sl(a,a.next),o=sl(o,o.next),al(a,e,n,i,r,s),void al(o,e,n,i,r,s)}t=t.next}a=a.next}while(a!==t)}function ul(t,e){return t.x-e.x}function dl(t,e){if(e=function(t,e){let n=e;const i=t.x,r=t.y;let s,a=-1/0;do{if(r<=n.y&&r>=n.next.y&&n.next.y!==n.y){const t=n.x+(r-n.y)*(n.next.x-n.x)/(n.next.y-n.y);if(t<=i&&t>a){if(a=t,t===i){if(r===n.y)return n;if(r===n.next.y)return n.next}s=n.x=n.x&&n.x>=l&&i!==n.x&&gl(rs.x||n.x===s.x&&pl(s,n)))&&(s=n,u=h)),n=n.next}while(n!==o);return s}(t,e),e){const n=Sl(e,t);sl(e,e.next),sl(n,n.next)}}function pl(t,e){return xl(t.prev,t,e.prev)<0&&xl(e.next,t,t.next)<0}function ml(t,e,n,i,r){return(t=1431655765&((t=858993459&((t=252645135&((t=16711935&((t=32767*(t-n)*r)|t<<8))|t<<4))|t<<2))|t<<1))|(e=1431655765&((e=858993459&((e=252645135&((e=16711935&((e=32767*(e-i)*r)|e<<8))|e<<4))|e<<2))|e<<1))<<1}function fl(t){let e=t,n=t;do{(e.x=0&&(t-a)*(i-o)-(n-a)*(e-o)>=0&&(n-a)*(s-o)-(r-a)*(i-o)>=0}function vl(t,e){return t.next.i!==e.i&&t.prev.i!==e.i&&!function(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&&_l(n,n.next,t,e))return!0;n=n.next}while(n!==t);return!1}(t,e)&&(wl(t,e)&&wl(e,t)&&function(t,e){let n=t,i=!1;const r=(t.x+e.x)/2,s=(t.y+e.y)/2;do{n.y>s!=n.next.y>s&&n.next.y!==n.y&&r<(n.next.x-n.x)*(s-n.y)/(n.next.y-n.y)+n.x&&(i=!i),n=n.next}while(n!==t);return i}(t,e)&&(xl(t.prev,t,e.prev)||xl(t,e.prev,e))||yl(t,e)&&xl(t.prev,t,t.next)>0&&xl(e.prev,e,e.next)>0)}function xl(t,e,n){return(e.y-t.y)*(n.x-e.x)-(e.x-t.x)*(n.y-e.y)}function yl(t,e){return t.x===e.x&&t.y===e.y}function _l(t,e,n,i){const r=bl(xl(t,e,n)),s=bl(xl(t,e,i)),a=bl(xl(n,i,t)),o=bl(xl(n,i,e));return r!==s&&a!==o||(!(0!==r||!Ml(t,n,e))||(!(0!==s||!Ml(t,i,e))||(!(0!==a||!Ml(n,t,i))||!(0!==o||!Ml(n,e,i)))))}function Ml(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 bl(t){return t>0?1:t<0?-1:0}function wl(t,e){return xl(t.prev,t,t.next)<0?xl(t,e,t.next)>=0&&xl(t,t.prev,e)>=0:xl(t,e,t.prev)<0||xl(t,t.next,e)<0}function Sl(t,e){const n=new Al(t.i,t.x,t.y),i=new Al(e.i,e.x,e.y),r=t.next,s=e.prev;return t.next=e,e.prev=t,n.next=r,r.prev=n,i.next=n,n.prev=i,s.next=i,i.prev=s,i}function Tl(t,e,n,i){const r=new Al(t,e,n);return i?(r.next=i.next,r.prev=i,i.next.prev=r,i.next=r):(r.prev=r,r.next=r),r}function El(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 Al(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}class Rl{static area(t){const e=t.length;let n=0;for(let i=e-1,r=0;r2&&t[e-1].equals(t[0])&&t.pop()}function Ll(t,e){for(let n=0;nNumber.EPSILON){const u=Math.sqrt(h),d=Math.sqrt(l*l+c*c),p=e.x-o/u,m=e.y+a/u,f=((n.x-c/d-p)*c-(n.y+l/d-m)*l)/(a*c-o*l);i=p+a*f-t.x,r=m+o*f-t.y;const g=i*i+r*r;if(g<=2)return new Rt(i,r);s=Math.sqrt(g/2)}else{let t=!1;a>Number.EPSILON?l>Number.EPSILON&&(t=!0):a<-Number.EPSILON?l<-Number.EPSILON&&(t=!0):Math.sign(o)===Math.sign(c)&&(t=!0),t?(i=-o,r=a,s=Math.sqrt(h)):(i=a,r=o,s=Math.sqrt(h/2))}return new Rt(i/s,r/s)}const P=[];for(let t=0,e=E.length,n=e-1,i=t+1;t=0;t--){const e=t/p,n=h*Math.cos(e*Math.PI/2),i=u*Math.sin(e*Math.PI/2)+d;for(let t=0,e=E.length;t=0;){const i=n;let r=n-1;r<0&&(r=t.length-1);for(let t=0,n=o+2*p;t0)&&d.push(e,r,l),(t!==n-1||o0!=t>0&&this.version++,this._refraction=t}copy(t){return super.copy(t),this.defines=t.defines,this.color.copy(t.color),this.roughness=t.roughness,this.metalness=t.metalness,this.f90=t.f90,this.map=t.map,this.lightMap=t.lightMap,this.lightMapIntensity=t.lightMapIntensity,this.aoMap=t.aoMap,this.aoMapIntensity=t.aoMapIntensity,this.emissive.copy(t.emissive),this.emissiveMap=t.emissiveMap,this.emissiveIntensity=t.emissiveIntensity,this.bumpMap=t.bumpMap,this.bumpScale=t.bumpScale,this.normalMap=t.normalMap,this.lowerNormalMap=t.lowerNormalMap,this.normalMapType=t.normalMapType,this.normalScale.copy(t.normalScale),this.displacementMap=t.displacementMap,this.displacementScale=t.displacementScale,this.displacementBias=t.displacementBias,this.roughnessMap=t.roughnessMap,this.metalnessMap=t.metalnessMap,this.alphaMap=t.alphaMap,this.envMap=t.envMap,this.envMapIntensity=t.envMapIntensity,this.refraction=t.refraction,this.refractionRatio=t.refractionRatio,this.wireframe=t.wireframe,this.wireframeLinewidth=t.wireframeLinewidth,this.wireframeLinecap=t.wireframeLinecap,this.wireframeLinejoin=t.wireframeLinejoin,this.flatShading=t.flatShading,this}}Xl.prototype.isMeshStandardMaterial=!0;class Yl extends Xl{constructor(t){super(),this.defines.PHYSICAL="",this.type="MeshPhysicalMaterial",this.clearcoatMap=null,this.clearcoatRoughness=0,this.clearcoatRoughnessMap=null,this.clearcoatNormalScale=new Rt(1,1),this.clearcoatNormalMap=null,this.ior=1.5,Object.defineProperty(this,"reflectivity",{get:function(){return Mt(2.5*(this.ior-1)/(this.ior+1),0,1)},set:function(t){this.ior=(1+.4*t)/(1-.4*t)}}),this.sheenColor=new dn(0),this.sheenColorMap=null,this.sheenRoughness=1,this.sheenRoughnessMap=null,this.transmissionMap=null,this.thickness=0,this.thicknessMap=null,this.attenuationDistance=0,this.attenuationColor=new dn(1,1,1),this.specularIntensity=1,this.specularIntensityMap=null,this.specularColor=new dn(1,1,1),this.specularColorMap=null,this._sheen=0,this._clearcoat=0,this._transmission=0,this.setValues(t)}get sheen(){return this._sheen}set sheen(t){this._sheen>0!=t>0&&this.version++,this._sheen=t}get clearcoat(){return this._clearcoat}set clearcoat(t){this._clearcoat>0!=t>0&&this.version++,this._clearcoat=t}get transmission(){return this._transmission}set transmission(t){this._transmission>0!=t>0&&this.version++,this._transmission=t}copy(t){return super.copy(t),this.defines=t.defines,this.clearcoat=t.clearcoat,this.clearcoatMap=t.clearcoatMap,this.clearcoatRoughness=t.clearcoatRoughness,this.clearcoatRoughnessMap=t.clearcoatRoughnessMap,this.clearcoatNormalMap=t.clearcoatNormalMap,this.clearcoatNormalScale.copy(t.clearcoatNormalScale),this.ior=t.ior,this.sheen=t.sheen,this.sheenColor.copy(t.sheenColor),this.sheenColorMap=t.sheenColorMap,this.sheenRoughness=t.sheenRoughness,this.sheenRoughnessMap=t.sheenRoughnessMap,this.transmission=t.transmission,this.transmissionMap=t.transmissionMap,this.thickness=t.thickness,this.thicknessMap=t.thicknessMap,this.attenuationDistance=t.attenuationDistance,this.attenuationColor.copy(t.attenuationColor),this.specularIntensity=t.specularIntensity,this.specularIntensityMap=t.specularIntensityMap,this.specularColor.copy(t.specularColor),this.specularColorMap=t.specularColorMap,this}}Yl.prototype.isMeshPhysicalMaterial=!0;class Jl extends sn{constructor(t){super(),this.type="MeshPhongMaterial",this.color=new dn(16777215),this.specular=new dn(1118481),this.shininess=30,this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new dn(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=0,this.normalScale=new Rt(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.combine=0,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.flatShading=!1,this.setValues(t)}copy(t){return super.copy(t),this.color.copy(t.color),this.specular.copy(t.specular),this.shininess=t.shininess,this.map=t.map,this.lightMap=t.lightMap,this.lightMapIntensity=t.lightMapIntensity,this.aoMap=t.aoMap,this.aoMapIntensity=t.aoMapIntensity,this.emissive.copy(t.emissive),this.emissiveMap=t.emissiveMap,this.emissiveIntensity=t.emissiveIntensity,this.bumpMap=t.bumpMap,this.bumpScale=t.bumpScale,this.normalMap=t.normalMap,this.normalMapType=t.normalMapType,this.normalScale.copy(t.normalScale),this.displacementMap=t.displacementMap,this.displacementScale=t.displacementScale,this.displacementBias=t.displacementBias,this.specularMap=t.specularMap,this.alphaMap=t.alphaMap,this.envMap=t.envMap,this.combine=t.combine,this.reflectivity=t.reflectivity,this.refractionRatio=t.refractionRatio,this.wireframe=t.wireframe,this.wireframeLinewidth=t.wireframeLinewidth,this.wireframeLinecap=t.wireframeLinecap,this.wireframeLinejoin=t.wireframeLinejoin,this.flatShading=t.flatShading,this}}Jl.prototype.isMeshPhongMaterial=!0;class Zl extends Jl{constructor(t){super(t),this.type="MeshNoTonePhongMaterial",Object.defineProperty(this,"toneMapped",{get:function(){return!1},set:function(){}})}}class Kl extends sn{constructor(t){super(),this.defines={TOON:""},this.type="MeshToonMaterial",this.color=new dn(16777215),this.map=null,this.gradientMap=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new dn(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=0,this.normalScale=new Rt(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.alphaMap=null,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.setValues(t)}copy(t){return super.copy(t),this.color.copy(t.color),this.map=t.map,this.gradientMap=t.gradientMap,this.lightMap=t.lightMap,this.lightMapIntensity=t.lightMapIntensity,this.aoMap=t.aoMap,this.aoMapIntensity=t.aoMapIntensity,this.emissive.copy(t.emissive),this.emissiveMap=t.emissiveMap,this.emissiveIntensity=t.emissiveIntensity,this.bumpMap=t.bumpMap,this.bumpScale=t.bumpScale,this.normalMap=t.normalMap,this.normalMapType=t.normalMapType,this.normalScale.copy(t.normalScale),this.displacementMap=t.displacementMap,this.displacementScale=t.displacementScale,this.displacementBias=t.displacementBias,this.alphaMap=t.alphaMap,this.wireframe=t.wireframe,this.wireframeLinewidth=t.wireframeLinewidth,this.wireframeLinecap=t.wireframeLinecap,this.wireframeLinejoin=t.wireframeLinejoin,this}}Kl.prototype.isMeshToonMaterial=!0;class Ql extends sn{constructor(t){super(),this.type="MeshNormalMaterial",this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=0,this.normalScale=new Rt(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.wireframe=!1,this.wireframeLinewidth=1,this.fog=!1,this.flatShading=!1,this.setValues(t)}copy(t){return super.copy(t),this.bumpMap=t.bumpMap,this.bumpScale=t.bumpScale,this.normalMap=t.normalMap,this.normalMapType=t.normalMapType,this.normalScale.copy(t.normalScale),this.displacementMap=t.displacementMap,this.displacementScale=t.displacementScale,this.displacementBias=t.displacementBias,this.wireframe=t.wireframe,this.wireframeLinewidth=t.wireframeLinewidth,this.flatShading=t.flatShading,this}}Ql.prototype.isMeshNormalMaterial=!0;class $l extends sn{constructor(t){super(),this.type="MeshLambertMaterial",this.color=new dn(16777215),this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new dn(0),this.emissiveIntensity=1,this.emissiveMap=null,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.combine=0,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.setValues(t)}copy(t){return super.copy(t),this.color.copy(t.color),this.map=t.map,this.lightMap=t.lightMap,this.lightMapIntensity=t.lightMapIntensity,this.aoMap=t.aoMap,this.aoMapIntensity=t.aoMapIntensity,this.emissive.copy(t.emissive),this.emissiveMap=t.emissiveMap,this.emissiveIntensity=t.emissiveIntensity,this.specularMap=t.specularMap,this.alphaMap=t.alphaMap,this.envMap=t.envMap,this.combine=t.combine,this.reflectivity=t.reflectivity,this.refractionRatio=t.refractionRatio,this.wireframe=t.wireframe,this.wireframeLinewidth=t.wireframeLinewidth,this.wireframeLinecap=t.wireframeLinecap,this.wireframeLinejoin=t.wireframeLinejoin,this}}$l.prototype.isMeshLambertMaterial=!0;class tc extends sn{constructor(t){super(),this.defines={MATCAP:""},!0===sn.r115Compatible&&(this.defines.PERTURB_NORMAL_R115_COMPATABILITY=""),this.type="MeshMatcapMaterial",this.color=new dn(16777215),this.matcap=null,this.map=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=0,this.normalScale=new Rt(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.alphaMap=null,this.flatShading=!1,this.setValues(t)}copy(t){return super.copy(t),this.defines=t.defines,this.color.copy(t.color),this.matcap=t.matcap,this.map=t.map,this.bumpMap=t.bumpMap,this.bumpScale=t.bumpScale,this.normalMap=t.normalMap,this.normalMapType=t.normalMapType,this.normalScale.copy(t.normalScale),this.displacementMap=t.displacementMap,this.displacementScale=t.displacementScale,this.displacementBias=t.displacementBias,this.alphaMap=t.alphaMap,this.flatShading=t.flatShading,this}}tc.prototype.isMeshMatcapMaterial=!0;class ec extends tc{constructor(t){super(t),this.type="OFTMatcapMaterial",this.defines.OFT_MATCAP=""}copy(t){return super.copy(t),this.defines=Object.assign({},t.defines),this}}ec.prototype.isOFTMatcapMaterial=!0;class nc extends ri{constructor(t){super({vertexShader:"\n\t\t\tattribute float size;\n\n\t\t\tuniform float pointSize;\n\n\t\t\tvarying vec4 vColor;\n\t\t\tvarying float vIntensity;\n\t\t\tvarying float vRandom;\n\t\t\tvarying vec4 vMvpPosition;\n\n\t\t\t#define PI 3.14159265359\n\t\t\t#define PI2 6.28318530718\n\n\t\t\tconst float Threshold = 0.65;\n\n\t\t\thighp float rand( const in vec2 uv ) {\n\t\t\t\tconst highp float a = 12.9898, b = 78.233, c = 43758.5453;\n\t\t\t\thighp float dt = dot( uv.xy, vec2( a, b ) ), sn = mod( dt, PI );\n\t\t\t\treturn fract(sin(sn) * c);\n\t\t\t}\n\n\t\t\tvoid main() {\n\n\t\t\t\tvColor.rgb = color.rgb;\n\n\t\t\t\tvRandom = rand(position.xy);\n\t\t\t\tvec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );\n\t\t\t\tvec3 ViewPosition = - mvPosition.xyz;\n\t\t\t\tvec3 viewDir = normalize(ViewPosition);\n\n\t\t\t\tvec3 n = normalize(normalMatrix * normal);\n\t\t\t\tfloat dotNV = dot(viewDir, n);\n\t\t\t\t// cos func to liner func\n\t\t\t\tvIntensity = 1.0 - acos(dotNV);\n\t\t\t\t// map Threshold ~ 1.0 to 0 ~ 1.0\n\t\t\t\tvIntensity = vIntensity < Threshold ? 0.0 : (vIntensity - Threshold) / (1.0 - Threshold);\n\t\t\t\t// sharp the curve\n\t\t\t\tvIntensity = pow(vIntensity, 1.1);\n\n\t\t\t\tvColor.a = 0.2 + vIntensity * 0.8;\n\n\t\t\t\tgl_Position = projectionMatrix * mvPosition;\n\n\t\t\t\tvMvpPosition = gl_Position;\n\t\t\t\tgl_PointSize = ((vRandom * 0.2 + 1.8) * pointSize) * vIntensity * (0.5/-mvPosition.z);\n\n\t\t\t}\n\t\t\t",fragmentShader:"\n\t\t\tprecision highp float;\n\t\t\t#include \n\n\t\t\t#define PI 3.14159265359\n\t\t\t#define PI2 6.28318530718\n\n\t\t\tuniform sampler2D pointTexture;\n\t\t\tuniform sampler2D depthTexture;\n\t\t\tuniform float depthBias;\n\n\t\t\tvarying vec4 vColor;\n\t\t\tvarying float vRandom;\n\t\t\tvarying float vDotNV;\n\t\t\tvarying float vIntensity;\n\t\t\tvarying vec4 vMvpPosition;\n\n\t\t\tvec2 rotateUV(vec2 uv, float rotation) {\n\t\t\t\tfloat mid = 0.5;\n\t\t\t\treturn vec2(\n\t\t\t\t\tcos(rotation) * (uv.x - mid) + sin(rotation) * (uv.y - mid) + mid,\n\t\t\t\t\tcos(rotation) * (uv.y - mid) - sin(rotation) * (uv.x - mid) + mid\n\t\t\t\t);\n\t\t\t}\n\n\t\t\tvec3 rgb2hsv(vec3 c) {\n\t\t\t\tvec4 K = vec4(0.0, -1.0 / 3.0, 2.0 / 3.0, -1.0);\n\t\t\t\tvec4 p = mix(vec4(c.bg, K.wz), vec4(c.gb, K.xy), step(c.b, c.g));\n\t\t\t\tvec4 q = mix(vec4(p.xyw, c.r), vec4(c.r, p.yzx), step(p.x, c.r));\n\n\t\t\t\tfloat d = q.x - min(q.w, q.y);\n\t\t\t\tfloat e = 1.0e-10;\n\t\t\t\treturn vec3(abs(q.z + (q.w - q.y) / (6.0 * d + e)), d / (q.x + e), q.x);\n\t\t\t}\n\n\t\t\tvec3 hsv2rgb(vec3 c) {\n\t\t\t\tvec4 K = vec4(1.0, 2.0 / 3.0, 1.0 / 3.0, 3.0);\n\t\t\t\tvec3 p = abs(fract(c.xxx + K.xyz) * 6.0 - K.www);\n\t\t\t\treturn c.z * mix(K.xxx, clamp(p - K.xxx, 0.0, 1.0), c.y);\n\t\t\t}\n\n\t\t\tfloat readDepth( sampler2D depthSampler, vec2 coord ) {\n\t\t\t\tfloat fragCoordZ = texture2D( depthSampler, coord ).x;\n\t\t\t\tfloat viewZ = perspectiveDepthToViewZ( fragCoordZ, 0.1, 2.0 );\n\t\t\t\treturn viewZToOrthographicDepth( viewZ, 0.1, 2.0 );\n\t\t\t}\n\n\t\t\tvoid main() {\n\t\t\t\tvec3 projCoords = vMvpPosition.xyz / vMvpPosition.w;\n\t\t\t\tprojCoords = projCoords * 0.5 + 0.5;\n\t\t\t\tfloat depth = unpackRGBAToDepth(texture2D(depthTexture, projCoords.xy));\n\t\t\t\tif (projCoords.z - depth >= depthBias) discard;\n\n\t\t\t\tif (vIntensity <= 0.0) discard;\n\t\t\t\tgl_FragColor = vColor;\n\t\t\t\tvec2 rotateUv = rotateUV(gl_PointCoord, vRandom * vIntensity * PI * 0.6);\n\t\t\t\trotateUv = clamp(rotateUv, 0.0, 1.0);\n\t\t\t\tgl_FragColor = gl_FragColor * mapTexelToLinear(texture2D( pointTexture, rotateUv ));\n\n\t\t\t\t#include \n\t\t\t}\n\t\t\t",blending:2,depthTest:!1,transparent:!0,vertexColors:!0}),null!=t&&(this._pointSize=t.pointSize||50,this._depthBias=t.depthBias||.001,this._pointTexture=t.pointTexture||null,this._depthTexture=t.depthTexture||null),this.uniforms={pointSize:{value:this.pointSize},pointTexture:{value:this.pointTexture},depthTexture:{value:this.depthTexture},depthBias:{value:this.depthBias}},this.type="OFTPointSpriteMaterial"}get pointSize(){return this._pointSize}set pointSize(t){this._pointSize=t,this.uniforms.pointSize.value=t}get depthBias(){return this._depthBias}set depthBias(t){this._depthBias=t,this.uniforms.depthBias.value=t}get map(){return this._pointTexture}get pointTexture(){return this._pointTexture}set pointTexture(t){this._pointTexture=t,this.uniforms.pointTexture.value=t}get depthTexture(){return this._depthTexture}set depthTexture(t){this._depthTexture=t,this.uniforms.depthTexture.value=t}}nc.prototype.isOFTPointSpriteMaterial=!0;class ic extends to{constructor(t){super(),this.type="LineDashedMaterial",this.scale=1,this.dashSize=3,this.gapSize=1,this.setValues(t)}copy(t){return super.copy(t),this.scale=t.scale,this.dashSize=t.dashSize,this.gapSize=t.gapSize,this}}ic.prototype.isLineDashedMaterial=!0;var rc=Object.freeze({__proto__:null,ShadowMaterial:ql,SpriteMaterial:xa,RawShaderMaterial:Pi,ShaderMaterial:ri,PointsMaterial:uo,MeshPhysicalMaterial:Yl,MeshStandardMaterial:Xl,MeshPhongMaterial:Jl,MeshNoTonePhongMaterial:Zl,MeshToonMaterial:Kl,MeshNormalMaterial:Ql,MeshLambertMaterial:$l,MeshDepthMaterial:Ks,MeshDistanceMaterial:Qs,MeshBasicMaterial:pn,MeshMatcapMaterial:tc,OFTMatcapMaterial:ec,OFTPointSpriteMaterial:nc,LineDashedMaterial:ic,LineBasicMaterial:to,Material:sn});const sc={arraySlice:function(t,e,n){return sc.isTypedArray(t)?new t.constructor(t.subarray(e,void 0!==n?n:t.length)):t.slice(e,n)},convertArray:function(t,e,n){return!t||!n&&t.constructor===e?t:"number"==typeof e.BYTES_PER_ELEMENT?new e(t):Array.prototype.slice.call(t)},isTypedArray:function(t){return ArrayBuffer.isView(t)&&!(t instanceof DataView)},getKeyframeOrder:function(t){const e=t.length,n=new Array(e);for(let t=0;t!==e;++t)n[t]=t;return n.sort((function(e,n){return t[e]-t[n]})),n},sortedArray:function(t,e,n){const i=t.length,r=new t.constructor(i);for(let s=0,a=0;a!==i;++s){const i=n[s]*e;for(let n=0;n!==e;++n)r[a++]=t[i+n]}return r},flattenJSON:function(t,e,n,i){let r=1,s=t[0];for(;void 0!==s&&void 0===s[i];)s=t[r++];if(void 0===s)return;let a=s[i];if(void 0!==a)if(Array.isArray(a))do{a=s[i],void 0!==a&&(e.push(s.time),n.push.apply(n,a)),s=t[r++]}while(void 0!==s);else if(void 0!==a.toArray)do{a=s[i],void 0!==a&&(e.push(s.time),a.toArray(n,n.length)),s=t[r++]}while(void 0!==s);else do{a=s[i],void 0!==a&&(e.push(s.time),n.push(a)),s=t[r++]}while(void 0!==s)},subclip:function(t,e,n,i,r=30){const s=t.clone();s.name=e;const a=[];for(let t=0;t=i)){l.push(e.times[t]);for(let n=0;ns.tracks[t].times[0]&&(o=s.tracks[t].times[0]);for(let t=0;t=i.times[u]){const t=u*l+o,e=t+l-o;d=sc.arraySlice(i.values,t,e)}else{const t=i.createInterpolant(),e=o,n=l-o;t.evaluate(s),d=sc.arraySlice(t.resultBuffer,e,n)}if("quaternion"===r){(new Vt).fromArray(d).normalize().conjugate().toArray(d)}const p=a.times.length;for(let t=0;t=r)break t;{const a=e[1];t=r)break e}s=n,n=0}}for(;n>>1;te;)--s;if(++s,0!==r||s!==i){r>=s&&(s=Math.max(s,1),r=s-1);const t=this.getValueSize();this.times=sc.arraySlice(n,r,s),this.values=sc.arraySlice(this.values,r*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,i=this.values,r=n.length;0===r&&(console.error("THREE.KeyframeTrack: Track is empty.",this),t=!1);let s=null;for(let e=0;e!==r;e++){const i=n[e];if("number"==typeof i&&isNaN(i)){console.error("THREE.KeyframeTrack: Time is not a valid number.",this,e,i),t=!1;break}if(null!==s&&s>i){console.error("THREE.KeyframeTrack: Out of order keys.",this,e,i,s),t=!1;break}s=i}if(void 0!==i&&sc.isTypedArray(i))for(let e=0,n=i.length;e!==n;++e){const n=i[e];if(isNaN(n)){console.error("THREE.KeyframeTrack: Value is not a valid number.",this,e,n),t=!1;break}}return t}optimize(){const t=sc.arraySlice(this.times),e=sc.arraySlice(this.values),n=this.getValueSize(),i=this.getInterpolation()===et,r=t.length-1;let s=1;for(let a=1;a0){t[s]=t[r];for(let t=r*n,i=s*n,a=0;a!==n;++a)e[i+a]=e[t+a];++s}return s!==t.length?(this.times=sc.arraySlice(t,0,s),this.values=sc.arraySlice(e,0,s*n)):(this.times=t,this.values=e),this}clone(){const t=sc.arraySlice(this.times,0),e=sc.arraySlice(this.values,0),n=new(0,this.constructor)(this.name,t,e);return n.createInterpolant=this.createInterpolant,n}}hc.prototype.TimeBufferType=Float32Array,hc.prototype.ValueBufferType=Float32Array,hc.prototype.DefaultInterpolation=tt;class uc extends hc{}uc.prototype.ValueTypeName="bool",uc.prototype.ValueBufferType=Array,uc.prototype.DefaultInterpolation=$,uc.prototype.InterpolantFactoryMethodLinear=void 0,uc.prototype.InterpolantFactoryMethodSmooth=void 0;class dc extends hc{}dc.prototype.ValueTypeName="color";class pc extends hc{}pc.prototype.ValueTypeName="number";class mc extends ac{constructor(t,e,n,i){super(t,e,n,i)}interpolate_(t,e,n,i){const r=this.resultBuffer,s=this.sampleValues,a=this.valueSize,o=(n-e)/(i-e);let l=t*a;for(let t=l+a;l!==t;l+=4)Vt.slerpFlat(r,0,s,l-a,s,l,o);return r}}class fc extends hc{InterpolantFactoryMethodLinear(t){return new mc(this.times,this.values,this.getValueSize(),t)}}fc.prototype.ValueTypeName="quaternion",fc.prototype.DefaultInterpolation=tt,fc.prototype.InterpolantFactoryMethodSmooth=void 0;class gc extends hc{}gc.prototype.ValueTypeName="string",gc.prototype.ValueBufferType=Array,gc.prototype.DefaultInterpolation=$,gc.prototype.InterpolantFactoryMethodLinear=void 0,gc.prototype.InterpolantFactoryMethodSmooth=void 0;class vc extends hc{}vc.prototype.ValueTypeName="vector";class xc{constructor(t,e=-1,n,i=2500){this.name=t,this.tracks=n,this.duration=e,this.blendMode=i,this.uuid=_t(),this.duration<0&&this.resetDuration()}static parse(t){const e=[],n=t.tracks,i=1/(t.fps||1);for(let t=0,r=n.length;t!==r;++t)e.push(yc(n[t]).scale(i));const r=new this(t.name,t.duration,e,t.blendMode);return r.uuid=t.uuid,r}static toJSON(t){const e=[],n=t.tracks,i={name:t.name,duration:t.duration,tracks:e,uuid:t.uuid,blendMode:t.blendMode};for(let t=0,i=n.length;t!==i;++t)e.push(hc.toJSON(n[t]));return i}static CreateFromMorphTargetSequence(t,e,n,i){const r=e.length,s=[];for(let t=0;t1){const t=s[1];let e=i[t];e||(i[t]=e=[]),e.push(n)}}const s=[];for(const t in i)s.push(this.CreateFromMorphTargetSequence(t,i[t],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,i,r){if(0!==n.length){const s=[],a=[];sc.flattenJSON(n,s,a,i),0!==s.length&&r.push(new t(e,s,a))}},i=[],r=t.name||"default",s=t.fps||30,a=t.blendMode;let o=t.length||-1;const l=t.hierarchy||[];for(let t=0;t{e&&e(r),this.manager.itemEnd(t)}),0),r;if(void 0!==Sc[t])return void Sc[t].push({onLoad:e,onProgress:n,onError:i});Sc[t]=[],Sc[t].push({onLoad:e,onProgress:n,onError:i});const s=new mt.Request(t,{headers:new mt.Headers(this.requestHeader),credentials:this.withCredentials?"include":"same-origin"}),a=this.mimeType,o=this.responseType;mt.fetch(s).then((e=>{if(200===e.status||0===e.status){if(0===e.status&&console.warn("THREE.FileLoader: HTTP Status 0 received."),"undefined"==typeof ReadableStream||void 0===e.body||void 0===e.body.getReader)return e;const n=Sc[t],i=e.body.getReader(),r=e.headers.get("Content-Length"),s=r?parseInt(r):0,a=0!==s;let o=0;const l=new ReadableStream({start(t){!function e(){i.read().then((({done:i,value:r})=>{if(i)t.close();else{o+=r.byteLength;const i=new ProgressEvent("progress",{lengthComputable:a,loaded:o,total:s});for(let t=0,e=n.length;t{switch(o){case"arraybuffer":return t.arrayBuffer();case"blob":return t.blob();case"document":return t.text().then((t=>(new DOMParser).parseFromString(t,a)));case"json":return t.json();default:if(void 0===a)return t.text();{const e=/charset="?([^;"\s]*)"?/i.exec(a),n=e&&e[1]?e[1].toLowerCase():void 0,i=new TextDecoder(n);return t.arrayBuffer().then((t=>i.decode(t)))}}})).then((e=>{_c.add(t,e);const n=Sc[t];delete Sc[t];for(let t=0,i=n.length;t{const n=Sc[t];if(void 0===n)throw this.manager.itemError(t),e;delete Sc[t];for(let t=0,i=n.length;t{this.manager.itemEnd(t)})),this.manager.itemStart(t)}setResponseType(t){return this.responseType=t,this}setMimeType(t){return this.mimeType=t,this}}class Ec extends wc{constructor(t){super(t)}load(t,e,n,i){void 0!==this.path&&(t=this.path+t),t=this.manager.resolveURL(t);const r=this,s=_c.get(t);if(void 0!==s)return r.manager.itemStart(t),setTimeout((function(){e&&e(s),r.manager.itemEnd(t)}),0),s;const a=Dt("img");function o(){c(),_c.add(t,this),e&&e(this),r.manager.itemEnd(t)}function l(e){c(),i&&i(e),r.manager.itemError(t),r.manager.itemEnd(t)}function c(){a.removeEventListener("load",o,!1),a.removeEventListener("error",l,!1)}return a.addEventListener("load",o,!1),a.addEventListener("error",l,!1),"data:"!==t.substr(0,5)&&void 0!==this.crossOrigin&&(a.crossOrigin=this.crossOrigin),r.manager.itemStart(t),a.src=t,a}}class Ac extends wc{constructor(t){super(t)}load(t,e,n,i){const r=new ci,s=new Ec(this.manager);s.setCrossOrigin(this.crossOrigin),s.setPath(this.path);let a=0;function o(n){s.load(t[n],(function(t){r.images[n]=t,a++,6===a&&(r.needsUpdate=!0,e&&e(r))}),void 0,i)}for(let e=0;e0:i.vertexColors=t.vertexColors),void 0!==t.uniforms)for(const e in t.uniforms){const r=t.uniforms[e];switch(i.uniforms[e]={},r.type){case"t":i.uniforms[e].value=n(r.value);break;case"c":i.uniforms[e].value=(new dn).setHex(r.value);break;case"v2":i.uniforms[e].value=(new Rt).fromArray(r.value);break;case"v3":i.uniforms[e].value=(new kt).fromArray(r.value);break;case"v4":i.uniforms[e].value=(new Ut).fromArray(r.value);break;case"m3":i.uniforms[e].value=(new Ct).fromArray(r.value);break;case"m4":i.uniforms[e].value=(new _e).fromArray(r.value);break;default:i.uniforms[e].value=r.value}}if(void 0!==t.defines&&(i.defines=t.defines),void 0!==t.vertexShader&&(i.vertexShader=t.vertexShader),void 0!==t.fragmentShader&&(i.fragmentShader=t.fragmentShader),void 0!==t.extensions)for(const e in t.extensions)i.extensions[e]=t.extensions[e];if(void 0!==t.shading&&(i.flatShading=1===t.shading),void 0!==t.size&&(i.size=t.size),void 0!==t.sizeAttenuation&&(i.sizeAttenuation=t.sizeAttenuation),void 0!==t.map&&(i.map=n(t.map)),void 0!==t.matcap&&(i.matcap=n(t.matcap)),void 0!==t.alphaMap&&(i.alphaMap=n(t.alphaMap)),void 0!==t.bumpMap&&(i.bumpMap=n(t.bumpMap)),void 0!==t.bumpScale&&(i.bumpScale=t.bumpScale),void 0!==t.normalMap&&(i.normalMap=n(t.normalMap)),void 0!==t.normalMapType&&(i.normalMapType=t.normalMapType),void 0!==t.normalScale){let e=t.normalScale;!1===Array.isArray(e)&&(e=[e,e]),i.normalScale=(new Rt).fromArray(e)}return void 0!==t.displacementMap&&(i.displacementMap=n(t.displacementMap)),void 0!==t.displacementScale&&(i.displacementScale=t.displacementScale),void 0!==t.displacementBias&&(i.displacementBias=t.displacementBias),void 0!==t.roughnessMap&&(i.roughnessMap=n(t.roughnessMap)),void 0!==t.metalnessMap&&(i.metalnessMap=n(t.metalnessMap)),void 0!==t.emissiveMap&&(i.emissiveMap=n(t.emissiveMap)),void 0!==t.emissiveIntensity&&(i.emissiveIntensity=t.emissiveIntensity),void 0!==t.specularMap&&(i.specularMap=n(t.specularMap)),void 0!==t.specularIntensityMap&&(i.specularIntensityMap=n(t.specularIntensityMap)),void 0!==t.specularColorMap&&(i.specularColorMap=n(t.specularColorMap)),void 0!==t.envMap&&(i.envMap=n(t.envMap)),void 0!==t.envMapIntensity&&(i.envMapIntensity=t.envMapIntensity),void 0!==t.reflectivity&&(i.reflectivity=t.reflectivity),void 0!==t.refractionRatio&&(i.refractionRatio=t.refractionRatio),void 0!==t.lightMap&&(i.lightMap=n(t.lightMap)),void 0!==t.lightMapIntensity&&(i.lightMapIntensity=t.lightMapIntensity),void 0!==t.aoMap&&(i.aoMap=n(t.aoMap)),void 0!==t.aoMapIntensity&&(i.aoMapIntensity=t.aoMapIntensity),void 0!==t.gradientMap&&(i.gradientMap=n(t.gradientMap)),void 0!==t.clearcoatMap&&(i.clearcoatMap=n(t.clearcoatMap)),void 0!==t.clearcoatRoughnessMap&&(i.clearcoatRoughnessMap=n(t.clearcoatRoughnessMap)),void 0!==t.clearcoatNormalMap&&(i.clearcoatNormalMap=n(t.clearcoatNormalMap)),void 0!==t.clearcoatNormalScale&&(i.clearcoatNormalScale=(new Rt).fromArray(t.clearcoatNormalScale)),void 0!==t.transmissionMap&&(i.transmissionMap=n(t.transmissionMap)),void 0!==t.thicknessMap&&(i.thicknessMap=n(t.thicknessMap)),void 0!==t.sheenColorMap&&(i.sheenColorMap=n(t.sheenColorMap)),void 0!==t.sheenRoughnessMap&&(i.sheenRoughnessMap=n(t.sheenRoughnessMap)),i}setTextures(t){return this.textures=t,this}}class Zc{static decodeText(t){if("undefined"!=typeof TextDecoder)return(new TextDecoder).decode(t);let e="";for(let n=0,i=t.length;n0){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,i,this._addIndex*e,1,e);for(let t=e,r=e+e;t!==r;++t)if(n[t]!==n[t+e]){a.setValue(n,i);break}}saveOriginalState(){const t=this.binding,e=this.buffer,n=this.valueSize,i=n*this._origIndex;t.getValue(e,i);for(let t=n,r=i;t!==r;++t)e[t]=e[i+t%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 i=0;i!==r;++i)t[e+i]=t[n+i]}_slerp(t,e,n,i){Vt.slerpFlat(t,e,t,e,t,n,i)}_slerpAdditive(t,e,n,i,r){const s=this._workIndex*r;Vt.multiplyQuaternionsFlat(t,s,t,e,t,n),Vt.slerpFlat(t,e,t,e,t,s,i)}_lerp(t,e,n,i,r){const s=1-i;for(let a=0;a!==r;++a){const r=e+a;t[r]=t[r]*s+t[n+a]*i}}_lerpAdditive(t,e,n,i,r){for(let s=0;s!==r;++s){const r=e+s;t[r]=t[r]+t[n+s]*i}}}const Sh="\\[\\]\\.:\\/",Th=new RegExp("[\\[\\]\\.:\\/]","g"),Eh="[^\\[\\]\\.:\\/]",Ah="[^"+Sh.replace("\\.","")+"]",Rh=/((?:WC+[\/:])*)/.source.replace("WC",Eh),Ch=/(WCOD+)?/.source.replace("WCOD",Ah),Lh=/(?:\.(WC+)(?:\[(.+)\])?)?/.source.replace("WC",Eh),Ph=/\.(WC+)(?:\[(.+)\])?/.source.replace("WC",Eh),Ih=new RegExp("^"+Rh+Ch+Lh+Ph+"$"),Dh=["material","materials","bones"];class Nh{constructor(t,e,n){this.path=e,this.parsedPath=n||Nh.parseTrackName(e),this.node=Nh.findNode(t,this.parsedPath.nodeName)||t,this.rootNode=t,this.getValue=this._getValue_unbound,this.setValue=this._setValue_unbound}static create(t,e,n){return t&&t.isAnimationObjectGroup?new Nh.Composite(t,e,n):new Nh(t,e,n)}static sanitizeNodeName(t){return t.replace(/\s/g,"_").replace(Th,"")}static parseTrackName(t){const e=Ih.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]},i=n.nodeName&&n.nodeName.lastIndexOf(".");if(void 0!==i&&-1!==i){const t=n.nodeName.substring(i+1);-1!==Dh.indexOf(t)&&(n.nodeName=n.nodeName.substring(0,i),n.objectName=t)}if(null===n.propertyName||0===n.propertyName.length)throw new Error("PropertyBinding: can not parse propertyName from trackName: "+t);return n}static findNode(t,e){if(!e||""===e||"."===e||-1===e||e===t.name||e===t.uuid||e===t.uniqueName)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 i=0;i=r){const s=r++,c=t[s];e[c.uuid]=l,t[l]=c,e[o]=s,t[s]=a;for(let t=0,e=i;t!==e;++t){const e=n[t],i=e[s],r=e[l];e[l]=i,e[s]=r}}}this.nCachedObjects_=r}uncache(){const t=this._objects,e=this._indicesByUUID,n=this._bindings,i=n.length;let r=this.nCachedObjects_,s=t.length;for(let a=0,o=arguments.length;a!==o;++a){const o=arguments[a].uuid,l=e[o];if(void 0!==l)if(delete e[o],l0&&(e[a.uuid]=l),t[l]=a,t.pop();for(let t=0,e=i;t!==e;++t){const e=n[t];e[l]=e[r],e.pop()}}}this.nCachedObjects_=r}subscribe_(t,e){const n=this._bindingsIndicesByPath;let i=n[t];const r=this._bindings;if(void 0!==i)return r[i];const s=this._paths,a=this._parsedPaths,o=this._objects,l=o.length,c=this.nCachedObjects_,h=new Array(l);i=r.length,n[t]=i,s.push(t),a.push(e),r.push(h);for(let n=c,i=o.length;n!==i;++n){const i=o[n];h[n]=new Nh(i,t,e)}return h}unsubscribe_(t){const e=this._bindingsIndicesByPath,n=e[t];if(void 0!==n){const i=this._paths,r=this._parsedPaths,s=this._bindings,a=s.length-1,o=s[a];e[t[a]]=n,s[n]=o,s.pop(),r[n]=r[a],r.pop(),i[n]=i[a],i.pop()}}}Oh.prototype.isAnimationObjectGroup=!0;class Bh{constructor(t,e,n=null,i=e.blendMode){this._mixer=t,this._clip=e,this._localRoot=n,this.blendMode=i;const r=e.tracks,s=r.length,a=new Array(s),o={endingStart:nt,endingEnd:nt};for(let t=0;t!==s;++t){const e=r[t].createInterpolant(null);a[t]=e,e.settings=o}this._interpolantSettings=o,this._interpolants=a,this._propertyBindings=new Array(s),this._cacheIndex=null,this._byClipCacheIndex=null,this._timeScaleInterpolant=null,this._weightInterpolant=null,this.loop=2201,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,i=t._clip.duration,r=i/n,s=n/i;t.warp(1,r,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 i=this._mixer,r=i.time,s=this.timeScale;let a=this._timeScaleInterpolant;null===a&&(a=i._lendControlInterpolant(),this._timeScaleInterpolant=a);const o=a.parameterPositions,l=a.sampleValues;return o[0]=r,o[1]=r+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,i){if(!this.enabled)return void this._updateWeight(t);const r=this._startTime;if(null!==r){const i=(t-r)*n;if(i<0||0===n)return;this._startTime=null,e=n*i}e*=this._updateTimeScale(t);const s=this._updateTime(e),a=this._updateWeight(t);if(a>0){const t=this._interpolants,e=this._propertyBindings;if(this.blendMode===at)for(let n=0,i=t.length;n!==i;++n)t[n].evaluate(s),e[n].accumulateAdditive(a);else for(let n=0,r=t.length;n!==r;++n)t[n].evaluate(s),e[n].accumulate(i,a)}}_updateWeight(t){let e=0;if(this.enabled){e=this.weight;const n=this._weightInterpolant;if(null!==n){const i=n.evaluate(t)[0];e*=i,t>n.parameterPositions[1]&&(this.stopFading(),0===i&&(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 i=this.time+t,r=this._loopCount;const s=2202===n;if(0===t)return-1===r?i:s&&1==(1&r)?e-i:i;if(2200===n){-1===r&&(this._loopCount=0,this._setEndings(!0,!0,!1));t:{if(i>=e)i=e;else{if(!(i<0)){this.time=i;break t}i=0}this.clampWhenFinished?this.paused=!0:this.enabled=!1,this.time=i,this._mixer.dispatchEvent({type:"finished",action:this,direction:t<0?-1:1})}}else{if(-1===r&&(t>=0?(r=0,this._setEndings(!0,0===this.repetitions,s)):this._setEndings(0===this.repetitions,!0,s)),i>=e||i<0){const n=Math.floor(i/e);i-=e*n,r+=Math.abs(n);const a=this.repetitions-r;if(a<=0)this.clampWhenFinished?this.paused=!0:this.enabled=!1,i=t>0?e:0,this.time=i,this._mixer.dispatchEvent({type:"finished",action:this,direction:t>0?1:-1});else{if(1===a){const e=t<0;this._setEndings(e,!e,s)}else this._setEndings(!1,!1,s);this._loopCount=r,this.time=i,this._mixer.dispatchEvent({type:"loop",action:this,loopDelta:n})}}else this.time=i;if(s&&1==(1&r))return e-i}return i}_setEndings(t,e,n){const i=this._interpolantSettings;n?(i.endingStart=it,i.endingEnd=it):(i.endingStart=t?this.zeroSlopeAtStart?it:nt:rt,i.endingEnd=e?this.zeroSlopeAtEnd?it:nt:rt)}_scheduleFading(t,e,n){const i=this._mixer,r=i.time;let s=this._weightInterpolant;null===s&&(s=i._lendControlInterpolant(),this._weightInterpolant=s);const a=s.parameterPositions,o=s.sampleValues;return a[0]=r,o[0]=e,a[1]=r+t,o[1]=n,this}}class zh extends ft{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,i=t._clip.tracks,r=i.length,s=t._propertyBindings,a=t._interpolants,o=n.uuid,l=this._bindingsByRootAndName;let c=l[o];void 0===c&&(c={},l[o]=c);for(let t=0;t!==r;++t){const r=i[t],l=r.name;let h=c[l];if(void 0!==h)++h.referenceCount,s[t]=h;else{if(h=s[t],void 0!==h){null===h._cacheIndex&&(++h.referenceCount,this._addInactiveBinding(h,o,l));continue}const i=e&&e._propertyBindings[t].binding.parsedPath;h=new wh(Nh.create(n,l,i),r.ValueTypeName,r.getValueSize()),++h.referenceCount,this._addInactiveBinding(h,o,l),s[t]=h}a[t].resultBuffer=h.buffer}}_activateAction(t){if(!this._isActiveAction(t)){if(null===t._cacheIndex){const e=(t._localRoot||this._root).uuid,n=t._clip.uuid,i=this._actionsByClip[n];this._bindAction(t,i&&i.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,i=this.time+=t,r=Math.sign(t),s=this._accuIndex^=1;for(let a=0;a!==n;++a){e[a]._update(i,t,r,s)}const a=this._bindings,o=this._nActiveBindings;for(let t=0;t!==o;++t)a[t].apply(s);return this}setTime(t){this.time=0;for(let t=0;tthis.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 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 e.copy(t).clamp(this.min,this.max)}distanceToPoint(t){return kh.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)}}Wh.prototype.isBox2=!0;const jh=new kt,qh=new kt;class Xh{constructor(t=new kt,e=new kt){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 t.addVectors(this.start,this.end).multiplyScalar(.5)}delta(t){return t.subVectors(this.end,this.start)}distanceSq(){return this.start.distanceToSquared(this.end)}distance(){return this.start.distanceTo(this.end)}at(t,e){return this.delta(e).multiplyScalar(t).add(this.start)}closestPointToPointParameter(t,e){jh.subVectors(t,this.start),qh.subVectors(this.end,this.start);const n=qh.dot(qh);let i=qh.dot(jh)/n;return e&&(i=Mt(i,0,1)),i}closestPointToPoint(t,e,n){const i=this.closestPointToPointParameter(t,e);return this.delta(n).multiplyScalar(i).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)}}const Yh=new kt;const Jh=new kt,Zh=new _e,Kh=new _e;class Qh extends co{constructor(t){const e=$h(t),n=new Nn,i=[],r=[],s=new dn(0,0,1),a=new dn(0,1,0);for(let t=0;t.99999)this.quaternion.set(0,0,0,1);else if(t.y<-.99999)this.quaternion.set(1,0,0,0);else{du.set(t.z,0,-t.x).normalize();const e=Math.acos(t.y);this.quaternion.setFromAxisAngle(du,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}},t.Audio=vh,t.AudioAnalyser=bh,t.AudioContext=rh,t.AudioListener=class extends je{constructor(){super(),this.type="AudioListener",this.context=rh.getContext(),this.gain=this.context.createGain(),this.gain.connect(this.context.destination),this.filter=null,this.timeDelta=0,this._clock=new uh}getInput(){return this.gain}removeFilter(){return null!==this.filter&&(this.gain.disconnect(this.filter),this.filter.disconnect(this.context.destination),this.gain.connect(this.context.destination),this.filter=null),this}getFilter(){return this.filter}setFilter(t){return null!==this.filter?(this.gain.disconnect(this.filter),this.filter.disconnect(this.context.destination)):this.gain.disconnect(this.context.destination),this.filter=t,this.gain.connect(this.filter),this.filter.connect(this.context.destination),this}getMasterVolume(){return this.gain.gain.value}setMasterVolume(t){return this.gain.gain.setTargetAtTime(t,this.context.currentTime,.01),this}updateMatrixWorld(t){super.updateMatrixWorld(t);const e=this.context.listener,n=this.up;if(this.timeDelta=this._clock.getDelta(),this.matrixWorld.decompose(ph,mh,fh),gh.set(0,0,-1).applyQuaternion(mh),e.positionX){const t=this.context.currentTime+this.timeDelta;e.positionX.linearRampToValueAtTime(ph.x,t),e.positionY.linearRampToValueAtTime(ph.y,t),e.positionZ.linearRampToValueAtTime(ph.z,t),e.forwardX.linearRampToValueAtTime(gh.x,t),e.forwardY.linearRampToValueAtTime(gh.y,t),e.forwardZ.linearRampToValueAtTime(gh.z,t),e.upX.linearRampToValueAtTime(n.x,t),e.upY.linearRampToValueAtTime(n.y,t),e.upZ.linearRampToValueAtTime(n.z,t)}else e.setPosition(ph.x,ph.y,ph.z),e.setOrientation(gh.x,gh.y,gh.z,n.x,n.y,n.z)}},t.AudioLoader=sh,t.AxesHelper=fu,t.AxisHelper=function(t){return console.warn("THREE.AxisHelper has been renamed to THREE.AxesHelper."),new fu(t)},t.BackSide=1,t.BasicDepthPacking=3200,t.BasicShadowMap=0,t.BinaryTextureLoader=function(t){return console.warn("THREE.BinaryTextureLoader has been renamed to THREE.DataTextureLoader."),new Rc(t)},t.Bone=ka,t.BooleanKeyframeTrack=uc,t.BoundingBoxHelper=function(t,e){return console.warn("THREE.BoundingBoxHelper has been deprecated. Creating a THREE.BoxHelper instead."),new uu(t,e)},t.Box2=Wh,t.Box3=qt,t.Box3Helper=class extends co{constructor(t,e=16776960){const n=new Uint16Array([0,1,1,2,2,3,3,0,4,5,5,6,6,7,7,4,0,4,1,5,2,6,3,7]),i=new Nn;i.setIndex(new gn(n,1)),i.setAttribute("position",new Tn([1,1,1,-1,1,1,-1,-1,1,1,-1,1,1,1,-1,-1,1,-1,-1,-1,-1,1,-1,-1],3)),super(i,new to({color:e,toneMapped:!1})),this.box=t,this.type="Box3Helper",this.geometry.computeBoundingSphere()}updateMatrixWorld(t){const e=this.box;e.isEmpty()||(e.getCenter(this.position),e.getSize(this.scale),this.scale.multiplyScalar(.5),super.updateMatrixWorld(t))}},t.BoxBufferGeometry=ti,t.BoxGeometry=ti,t.BoxHelper=uu,t.BufferAttribute=gn,t.BufferGeometry=Nn,t.BufferGeometryLoader=Qc,t.ByteType=1010,t.Cache=_c,t.Camera=si,t.CameraHelper=class extends co{constructor(t){const e=new Nn,n=new to({color:16777215,vertexColors:!0,toneMapped:!1}),i=[],r=[],s={},a=new dn(16755200),o=new dn(16711680),l=new dn(43775),c=new dn(16777215),h=new dn(3355443);function u(t,e,n){d(t,n),d(e,n)}function d(t,e){i.push(0,0,0),r.push(e.r,e.g,e.b),void 0===s[t]&&(s[t]=[]),s[t].push(i.length/3-1)}u("n1","n2",a),u("n2","n4",a),u("n4","n3",a),u("n3","n1",a),u("f1","f2",a),u("f2","f4",a),u("f4","f3",a),u("f3","f1",a),u("n1","f1",a),u("n2","f2",a),u("n3","f3",a),u("n4","f4",a),u("p","n1",o),u("p","n2",o),u("p","n3",o),u("p","n4",o),u("u1","u2",l),u("u2","u3",l),u("u3","u1",l),u("c","t",c),u("p","c",h),u("cn1","cn2",h),u("cn3","cn4",h),u("cf1","cf2",h),u("cf3","cf4",h),e.setAttribute("position",new Tn(i,3)),e.setAttribute("color",new Tn(r,3)),super(e,n),this.type="CameraHelper",this.camera=t,this.camera.updateProjectionMatrix&&this.camera.updateProjectionMatrix(),this.matrix=t.matrixWorld,this.matrixAutoUpdate=!1,this.pointMap=s,this.update()}update(){const t=this.geometry,e=this.pointMap;lu.projectionMatrixInverse.copy(this.camera.projectionMatrixInverse),cu("c",e,t,lu,0,0,-1),cu("t",e,t,lu,0,0,1),cu("n1",e,t,lu,-1,-1,-1),cu("n2",e,t,lu,1,-1,-1),cu("n3",e,t,lu,-1,1,-1),cu("n4",e,t,lu,1,1,-1),cu("f1",e,t,lu,-1,-1,1),cu("f2",e,t,lu,1,-1,1),cu("f3",e,t,lu,-1,1,1),cu("f4",e,t,lu,1,1,1),cu("u1",e,t,lu,.7,1.1,-1),cu("u2",e,t,lu,-.7,1.1,-1),cu("u3",e,t,lu,0,2,-1),cu("cf1",e,t,lu,-1,0,1),cu("cf2",e,t,lu,1,0,1),cu("cf3",e,t,lu,0,-1,1),cu("cf4",e,t,lu,0,1,1),cu("cn1",e,t,lu,-1,0,-1),cu("cn2",e,t,lu,1,0,-1),cu("cn3",e,t,lu,0,-1,-1),cu("cn4",e,t,lu,0,1,-1),t.getAttribute("position").needsUpdate=!0}dispose(){this.geometry.dispose(),this.material.dispose()}},t.CanvasRenderer=function(){console.error("THREE.CanvasRenderer has been removed")},t.CanvasTexture=bo,t.CatmullRomCurve3=Vo,t.CineonToneMapping=3,t.CircleBufferGeometry=So,t.CircleGeometry=So,t.ClampToEdgeWrapping=u,t.Clock=uh,t.Color=dn,t.ColorKeyframeTrack=dc,t.CompressedTexture=Mo,t.CompressedTextureLoader=class extends wc{constructor(t){super(t)}load(t,e,n,i){const r=this,s=[],a=new Mo,o=new Tc(this.manager);o.setPath(this.path),o.setResponseType("arraybuffer"),o.setRequestHeader(this.requestHeader),o.setWithCredentials(r.withCredentials);let l=0;function c(c){o.load(t[c],(function(t){const n=r.parse(t,!0);s[c]={width:n.width,height:n.height,format:n.format,mipmaps:n.mipmaps},l+=1,6===l&&(1===n.mipmapCount&&(a.minFilter=g),a.image=s,a.format=n.format,a.needsUpdate=!0,e&&e(a))}),n,i)}if(Array.isArray(t))for(let e=0,n=t.length;e65504&&(console.warn("THREE.DataUtils.toHalfFloat(): value exceeds 65504."),t=65504),vu[0]=t;const e=xu[0];let n=e>>16&32768,i=e>>12&2047;const r=e>>23&255;return r<103?n:r>142?(n|=31744,n|=(255==r?0:1)&&8388607&e,n):r<113?(i|=2048,n|=(i>>114-r)+(i>>113-r&1),n):(n|=r-112<<10|i>>1,n+=1&i,n)}},t.DecrementStencilOp=7683,t.DecrementWrapStencilOp=34056,t.DefaultLoadingManager=bc,t.DepthFormat=E,t.DepthStencilFormat=A,t.DepthTexture=oa,t.DirectionalLight=Wc,t.DirectionalLightHelper=class extends je{constructor(t,e,n){super(),this.light=t,this.light.updateMatrixWorld(),this.matrix=t.matrixWorld,this.matrixAutoUpdate=!1,this.color=n,void 0===e&&(e=1);let i=new Nn;i.setAttribute("position",new Tn([-e,e,0,e,e,0,e,-e,0,-e,-e,0,-e,e,0],3));const r=new to({fog:!1,toneMapped:!1});this.lightPlane=new ao(i,r),this.add(this.lightPlane),i=new Nn,i.setAttribute("position",new Tn([0,0,0,0,0,1],3)),this.targetLine=new ao(i,r),this.add(this.targetLine),this.update()}dispose(){this.lightPlane.geometry.dispose(),this.lightPlane.material.dispose(),this.targetLine.geometry.dispose(),this.targetLine.material.dispose()}update(){ru.setFromMatrixPosition(this.light.matrixWorld),su.setFromMatrixPosition(this.light.target.matrixWorld),au.subVectors(su,ru),this.lightPlane.lookAt(su),void 0!==this.color?(this.lightPlane.material.color.set(this.color),this.targetLine.material.color.set(this.color)):(this.lightPlane.material.color.copy(this.light.color),this.targetLine.material.color.copy(this.light.color)),this.targetLine.lookAt(su),this.targetLine.scale.z=au.length()}},t.DiscreteInterpolant=cc,t.DodecahedronBufferGeometry=Ro,t.DodecahedronGeometry=Ro,t.DoubleSide=2,t.DstAlphaFactor=206,t.DstColorFactor=208,t.DynamicBufferAttribute=function(t,e){return console.warn("THREE.DynamicBufferAttribute has been removed. Use new THREE.BufferAttribute().setUsage( THREE.DynamicDrawUsage ) instead."),new gn(t,e).setUsage(dt)},t.DynamicCopyUsage=35050,t.DynamicDrawUsage=dt,t.DynamicReadUsage=35049,t.EdgesGeometry=Do,t.EdgesHelper=function(t,e){return console.warn("THREE.EdgesHelper has been removed. Use THREE.EdgesGeometry instead."),new co(new Do(t.geometry),new to({color:void 0!==e?e:16777215}))},t.EllipseCurve=Oo,t.EqualDepth=4,t.EqualStencilFunc=514,t.EquirectangularReflectionMapping=a,t.EquirectangularRefractionMapping=o,t.Euler=Le,t.EventDispatcher=ft,t.ExternalTexture2D=wo,t.ExtrudeBufferGeometry=Pl,t.ExtrudeGeometry=Pl,t.FaceColors=1,t.FileLoader=Tc,t.FlatShading=1,t.Float16BufferAttribute=Sn,t.Float32Attribute=function(t,e){return console.warn("THREE.Float32Attribute has been removed. Use new THREE.Float32BufferAttribute() instead."),new Tn(t,e)},t.Float32BufferAttribute=Tn,t.Float64Attribute=function(t,e){return console.warn("THREE.Float64Attribute has been removed. Use new THREE.Float64BufferAttribute() instead."),new En(t,e)},t.Float64BufferAttribute=En,t.FloatType=b,t.Fog=pa,t.FogExp2=da,t.Font=function(){console.error("THREE.Font has been moved to /examples/jsm/loaders/FontLoader.js")},t.FontLoader=function(){console.error("THREE.FontLoader has been moved to /examples/jsm/loaders/FontLoader.js")},t.FramebufferTexture=_o,t.FrontSide=0,t.Frustum=vi,t.GLBufferAttribute=Hh,t.GLSL1="100",t.GLSL3=pt,t.GreaterDepth=6,t.GreaterEqualDepth=5,t.GreaterEqualStencilFunc=518,t.GreaterStencilFunc=516,t.GridHelper=iu,t.Group=ra,t.HalfFloatType=w,t.HemisphereLight=Pc,t.HemisphereLightHelper=class extends je{constructor(t,e,n){super(),this.light=t,this.light.updateMatrixWorld(),this.matrix=t.matrixWorld,this.matrixAutoUpdate=!1,this.color=n;const i=new Ol(e);i.rotateY(.5*Math.PI),this.material=new pn({wireframe:!0,fog:!1,toneMapped:!1}),void 0===this.color&&(this.material.vertexColors=!0);const r=i.getAttribute("position"),s=new Float32Array(3*r.count);i.setAttribute("color",new gn(s,3)),this.add(new Qn(i,this.material)),this.update()}dispose(){this.children[0].geometry.dispose(),this.children[0].material.dispose()}update(){const t=this.children[0];if(void 0!==this.color)this.material.color.set(this.color);else{const e=t.geometry.getAttribute("color");eu.copy(this.light.color),nu.copy(this.light.groundColor);for(let t=0,n=e.count;t0){const n=new Mc(e);r=new Ec(n),r.setCrossOrigin(this.crossOrigin);for(let e=0,n=t.length;e0){i=new Ec(this.manager),i.setCrossOrigin(this.crossOrigin);for(let e=0,i=t.length;eNumber.EPSILON){if(l<0&&(n=e[s],o=-o,a=e[r],l=-l),t.ya.y)continue;if(t.y===n.y){if(t.x===n.x)return!0}else{const e=l*(t.x-n.x)-o*(t.y-n.y);if(0===e)return!0;if(e<0)continue;i=!i}}else{if(t.y!==n.y)continue;if(a.x<=t.x&&t.x<=n.x||n.x<=t.x&&t.x<=a.x)return!0}}return i}const r=Rl.isClockWise,s=this.subPaths;if(0===s.length)return[];if(!0===e)return n(s);let a,o,l;const c=[];if(1===s.length)return o=s[0],l=new nl,l.curves=o.curves,c.push(l),c;let h=!r(s[0].getPoints());h=t?!h:h;const u=[],d=[];let p,m,f=[],g=0;d[g]=void 0,f[g]=[];for(let e=0,n=s.length;e1){let t=!1;const e=[];for(let t=0,e=d.length;t0&&(t||(f=u))}for(let t=0,e=d.length;t=4.0.0" } }, - "node_modules/ms": {}, "node_modules/mz-modules": { "version": "2.1.0", "resolved": "https://registry.npmjs.org/mz-modules/-/mz-modules-2.1.0.tgz", @@ -1659,7 +1658,6 @@ "resolved": "https://registry.npmjs.org/mime/-/mime-2.6.0.tgz", "integrity": "sha512-USPkMeET31rOMiarsBNIHZKLGgvKc/LrjofAnBlOttf5ajRvqiRA8QsenbcooctK6d6Ts6aqZXBA+XbkKthiQg==" }, - "ms": {}, "mz-modules": { "version": "2.1.0", "resolved": "https://registry.npmjs.org/mz-modules/-/mz-modules-2.1.0.tgz", diff --git a/package-lock.json b/package-lock.json index 0a18f274b9e68c..397e91510a0266 100644 --- a/package-lock.json +++ b/package-lock.json @@ -10,11 +10,11 @@ "version": "0.137.16", "license": "MIT", "devDependencies": { - "@babel/core": "^7.15.5", + "@babel/core": "^7.26.0", "@babel/eslint-parser": "^7.15.7", "@babel/plugin-proposal-class-properties": "^7.14.5", - "@babel/preset-env": "^7.15.6", - "@rollup/plugin-babel": "^5.3.0", + "@babel/preset-env": "^7.26.0", + "@rollup/plugin-babel": "^5.3.1", "@rollup/plugin-node-resolve": "^13.0.5", "chalk": "^4.1.2", "concurrently": "^6.2.2", @@ -28,48 +28,67 @@ "servez": "^1.12.0" } }, + "node_modules/@ampproject/remapping": { + "version": "2.3.0", + "resolved": "https://r.cnpmjs.org/@ampproject/remapping/-/remapping-2.3.0.tgz", + "integrity": "sha512-30iZtAPgz+LTIYoeivqYo853f02jBYSd5uGnGpkFV0M3xOt9aN73erkgYAmZU43x4VfqcnLxW9Kpg3R5LC4YYw==", + "dev": true, + "license": "Apache-2.0", + "dependencies": { + "@jridgewell/gen-mapping": "^0.3.5", + "@jridgewell/trace-mapping": "^0.3.24" + }, + "engines": { + "node": ">=6.0.0" + } + }, "node_modules/@babel/code-frame": { - "version": "7.16.7", - "resolved": "https://registry.npmjs.org/@babel/code-frame/-/code-frame-7.16.7.tgz", - "integrity": "sha512-iAXqUn8IIeBTNd72xsFlgaXHkMBMt6y4HJp1tIaK465CWLT/fG1aqB7ykr95gHHmlBdGbFeWWfyB4NJJ0nmeIg==", + "version": "7.26.2", + "resolved": "https://r.cnpmjs.org/@babel/code-frame/-/code-frame-7.26.2.tgz", + "integrity": "sha512-RJlIHRueQgwWitWgF8OdFYGZX328Ax5BCemNGlqHfplnRT9ESi8JkFlvaVYbS+UubVY6dpv87Fs2u5M29iNFVQ==", "dev": true, + "license": "MIT", "dependencies": { - "@babel/highlight": "^7.16.7" + "@babel/helper-validator-identifier": "^7.25.9", + "js-tokens": "^4.0.0", + "picocolors": "^1.0.0" }, "engines": { "node": ">=6.9.0" } }, "node_modules/@babel/compat-data": { - "version": "7.16.8", - "resolved": "https://registry.npmjs.org/@babel/compat-data/-/compat-data-7.16.8.tgz", - "integrity": "sha512-m7OkX0IdKLKPpBlJtF561YJal5y/jyI5fNfWbPxh2D/nbzzGI4qRyrD8xO2jB24u7l+5I2a43scCG2IrfjC50Q==", + "version": "7.26.3", + "resolved": "https://r.cnpmjs.org/@babel/compat-data/-/compat-data-7.26.3.tgz", + "integrity": "sha512-nHIxvKPniQXpmQLb0vhY3VaFb3S0YrTAwpOWJZh1wn3oJPjJk9Asva204PsBdmAE8vpzfHudT8DB0scYvy9q0g==", "dev": true, + "license": "MIT", "engines": { "node": ">=6.9.0" } }, "node_modules/@babel/core": { - "version": "7.16.7", - "resolved": "https://registry.npmjs.org/@babel/core/-/core-7.16.7.tgz", - "integrity": "sha512-aeLaqcqThRNZYmbMqtulsetOQZ/5gbR/dWruUCJcpas4Qoyy+QeagfDsPdMrqwsPRDNxJvBlRiZxxX7THO7qtA==", - "dev": true, - "dependencies": { - "@babel/code-frame": "^7.16.7", - "@babel/generator": "^7.16.7", - "@babel/helper-compilation-targets": "^7.16.7", - "@babel/helper-module-transforms": "^7.16.7", - "@babel/helpers": "^7.16.7", - "@babel/parser": "^7.16.7", - "@babel/template": "^7.16.7", - "@babel/traverse": "^7.16.7", - "@babel/types": "^7.16.7", - "convert-source-map": "^1.7.0", + "version": "7.26.0", + "resolved": "https://r.cnpmjs.org/@babel/core/-/core-7.26.0.tgz", + "integrity": "sha512-i1SLeK+DzNnQ3LL/CswPCa/E5u4lh1k6IAEphON8F+cXt0t9euTshDru0q7/IqMa1PMPz5RnHuHscF8/ZJsStg==", + "dev": true, + "license": "MIT", + "dependencies": { + "@ampproject/remapping": "^2.2.0", + "@babel/code-frame": "^7.26.0", + "@babel/generator": "^7.26.0", + "@babel/helper-compilation-targets": "^7.25.9", + "@babel/helper-module-transforms": "^7.26.0", + "@babel/helpers": "^7.26.0", + "@babel/parser": "^7.26.0", + "@babel/template": "^7.25.9", + "@babel/traverse": "^7.25.9", + "@babel/types": "^7.26.0", + "convert-source-map": "^2.0.0", "debug": "^4.1.0", "gensync": "^1.0.0-beta.2", - "json5": "^2.1.2", - "semver": "^6.3.0", - "source-map": "^0.5.0" + "json5": "^2.2.3", + "semver": "^6.3.1" }, "engines": { "node": ">=6.9.0" @@ -98,75 +117,83 @@ } }, "node_modules/@babel/generator": { - "version": "7.16.8", - "resolved": "https://registry.npmjs.org/@babel/generator/-/generator-7.16.8.tgz", - "integrity": "sha512-1ojZwE9+lOXzcWdWmO6TbUzDfqLD39CmEhN8+2cX9XkDo5yW1OpgfejfliysR2AWLpMamTiOiAp/mtroaymhpw==", + "version": "7.26.3", + "resolved": "https://r.cnpmjs.org/@babel/generator/-/generator-7.26.3.tgz", + "integrity": "sha512-6FF/urZvD0sTeO7k6/B15pMLC4CHUv1426lzr3N01aHJTl046uCAh9LXW/fzeXXjPNCJ6iABW5XaWOsIZB93aQ==", "dev": true, + "license": "MIT", "dependencies": { - "@babel/types": "^7.16.8", - "jsesc": "^2.5.1", - "source-map": "^0.5.0" + "@babel/parser": "^7.26.3", + "@babel/types": "^7.26.3", + "@jridgewell/gen-mapping": "^0.3.5", + "@jridgewell/trace-mapping": "^0.3.25", + "jsesc": "^3.0.2" }, "engines": { "node": ">=6.9.0" } }, "node_modules/@babel/helper-annotate-as-pure": { - "version": "7.16.7", - "resolved": "https://registry.npmjs.org/@babel/helper-annotate-as-pure/-/helper-annotate-as-pure-7.16.7.tgz", - "integrity": "sha512-s6t2w/IPQVTAET1HitoowRGXooX8mCgtuP5195wD/QJPV6wYjpujCGF7JuMODVX2ZAJOf1GT6DT9MHEZvLOFSw==", + "version": "7.25.9", + "resolved": "https://r.cnpmjs.org/@babel/helper-annotate-as-pure/-/helper-annotate-as-pure-7.25.9.tgz", + "integrity": "sha512-gv7320KBUFJz1RnylIg5WWYPRXKZ884AGkYpgpWW02TH66Dl+HaC1t1CKd0z3R4b6hdYEcmrNZHUmfCP+1u3/g==", "dev": true, + "license": "MIT", "dependencies": { - "@babel/types": "^7.16.7" + "@babel/types": "^7.25.9" }, "engines": { "node": ">=6.9.0" } }, - "node_modules/@babel/helper-builder-binary-assignment-operator-visitor": { - "version": "7.16.7", - "resolved": "https://registry.npmjs.org/@babel/helper-builder-binary-assignment-operator-visitor/-/helper-builder-binary-assignment-operator-visitor-7.16.7.tgz", - "integrity": "sha512-C6FdbRaxYjwVu/geKW4ZeQ0Q31AftgRcdSnZ5/jsH6BzCJbtvXvhpfkbkThYSuutZA7nCXpPR6AD9zd1dprMkA==", + "node_modules/@babel/helper-compilation-targets": { + "version": "7.25.9", + "resolved": "https://r.cnpmjs.org/@babel/helper-compilation-targets/-/helper-compilation-targets-7.25.9.tgz", + "integrity": "sha512-j9Db8Suy6yV/VHa4qzrj9yZfZxhLWQdVnRlXxmKLYlhWUVB1sB2G5sxuWYXk/whHD9iW76PmNzxZ4UCnTQTVEQ==", "dev": true, + "license": "MIT", "dependencies": { - "@babel/helper-explode-assignable-expression": "^7.16.7", - "@babel/types": "^7.16.7" + "@babel/compat-data": "^7.25.9", + "@babel/helper-validator-option": "^7.25.9", + "browserslist": "^4.24.0", + "lru-cache": "^5.1.1", + "semver": "^6.3.1" }, "engines": { "node": ">=6.9.0" } }, - "node_modules/@babel/helper-compilation-targets": { - "version": "7.16.7", - "resolved": "https://registry.npmjs.org/@babel/helper-compilation-targets/-/helper-compilation-targets-7.16.7.tgz", - "integrity": "sha512-mGojBwIWcwGD6rfqgRXVlVYmPAv7eOpIemUG3dGnDdCY4Pae70ROij3XmfrH6Fa1h1aiDylpglbZyktfzyo/hA==", + "node_modules/@babel/helper-compilation-targets/node_modules/lru-cache": { + "version": "5.1.1", + "resolved": "https://r2.cnpmjs.org/lru-cache/-/lru-cache-5.1.1.tgz", + "integrity": "sha512-KpNARQA3Iwv+jTA0utUVVbrh+Jlrr1Fv0e56GGzAFOXN7dk/FviaDW8LHmK52DlcH4WP2n6gI8vN1aesBFgo9w==", "dev": true, + "license": "ISC", "dependencies": { - "@babel/compat-data": "^7.16.4", - "@babel/helper-validator-option": "^7.16.7", - "browserslist": "^4.17.5", - "semver": "^6.3.0" - }, - "engines": { - "node": ">=6.9.0" - }, - "peerDependencies": { - "@babel/core": "^7.0.0" + "yallist": "^3.0.2" } }, + "node_modules/@babel/helper-compilation-targets/node_modules/yallist": { + "version": "3.1.1", + "resolved": "https://r2.cnpmjs.org/yallist/-/yallist-3.1.1.tgz", + "integrity": "sha512-a4UGQaWPH59mOXUYnAG2ewncQS4i4F43Tv3JoAM+s2VDAmS9NsK8GpDMLrCHPksFT7h3K6TOoUNn2pb7RoXx4g==", + "dev": true, + "license": "ISC" + }, "node_modules/@babel/helper-create-class-features-plugin": { - "version": "7.16.7", - "resolved": "https://registry.npmjs.org/@babel/helper-create-class-features-plugin/-/helper-create-class-features-plugin-7.16.7.tgz", - "integrity": "sha512-kIFozAvVfK05DM4EVQYKK+zteWvY85BFdGBRQBytRyY3y+6PX0DkDOn/CZ3lEuczCfrCxEzwt0YtP/87YPTWSw==", + "version": "7.25.9", + "resolved": "https://r.cnpmjs.org/@babel/helper-create-class-features-plugin/-/helper-create-class-features-plugin-7.25.9.tgz", + "integrity": "sha512-UTZQMvt0d/rSz6KI+qdu7GQze5TIajwTS++GUozlw8VBJDEOAqSXwm1WvmYEZwqdqSGQshRocPDqrt4HBZB3fQ==", "dev": true, + "license": "MIT", "dependencies": { - "@babel/helper-annotate-as-pure": "^7.16.7", - "@babel/helper-environment-visitor": "^7.16.7", - "@babel/helper-function-name": "^7.16.7", - "@babel/helper-member-expression-to-functions": "^7.16.7", - "@babel/helper-optimise-call-expression": "^7.16.7", - "@babel/helper-replace-supers": "^7.16.7", - "@babel/helper-split-export-declaration": "^7.16.7" + "@babel/helper-annotate-as-pure": "^7.25.9", + "@babel/helper-member-expression-to-functions": "^7.25.9", + "@babel/helper-optimise-call-expression": "^7.25.9", + "@babel/helper-replace-supers": "^7.25.9", + "@babel/helper-skip-transparent-expression-wrappers": "^7.25.9", + "@babel/traverse": "^7.25.9", + "semver": "^6.3.1" }, "engines": { "node": ">=6.9.0" @@ -176,13 +203,15 @@ } }, "node_modules/@babel/helper-create-regexp-features-plugin": { - "version": "7.16.7", - "resolved": "https://registry.npmjs.org/@babel/helper-create-regexp-features-plugin/-/helper-create-regexp-features-plugin-7.16.7.tgz", - "integrity": "sha512-fk5A6ymfp+O5+p2yCkXAu5Kyj6v0xh0RBeNcAkYUMDvvAAoxvSKXn+Jb37t/yWFiQVDFK1ELpUTD8/aLhCPu+g==", + "version": "7.26.3", + "resolved": "https://r.cnpmjs.org/@babel/helper-create-regexp-features-plugin/-/helper-create-regexp-features-plugin-7.26.3.tgz", + "integrity": "sha512-G7ZRb40uUgdKOQqPLjfD12ZmGA54PzqDFUv2BKImnC9QIfGhIHKvVML0oN8IUiDq4iRqpq74ABpvOaerfWdong==", "dev": true, + "license": "MIT", "dependencies": { - "@babel/helper-annotate-as-pure": "^7.16.7", - "regexpu-core": "^4.7.1" + "@babel/helper-annotate-as-pure": "^7.25.9", + "regexpu-core": "^6.2.0", + "semver": "^6.3.1" }, "engines": { "node": ">=6.9.0" @@ -192,258 +221,195 @@ } }, "node_modules/@babel/helper-define-polyfill-provider": { - "version": "0.3.1", - "resolved": "https://registry.npmjs.org/@babel/helper-define-polyfill-provider/-/helper-define-polyfill-provider-0.3.1.tgz", - "integrity": "sha512-J9hGMpJQmtWmj46B3kBHmL38UhJGhYX7eqkcq+2gsstyYt341HmPeWspihX43yVRA0mS+8GGk2Gckc7bY/HCmA==", + "version": "0.6.3", + "resolved": "https://r.cnpmjs.org/@babel/helper-define-polyfill-provider/-/helper-define-polyfill-provider-0.6.3.tgz", + "integrity": "sha512-HK7Bi+Hj6H+VTHA3ZvBis7V/6hu9QuTrnMXNybfUf2iiuU/N97I8VjB+KbhFF8Rld/Lx5MzoCwPCpPjfK+n8Cg==", "dev": true, + "license": "MIT", "dependencies": { - "@babel/helper-compilation-targets": "^7.13.0", - "@babel/helper-module-imports": "^7.12.13", - "@babel/helper-plugin-utils": "^7.13.0", - "@babel/traverse": "^7.13.0", + "@babel/helper-compilation-targets": "^7.22.6", + "@babel/helper-plugin-utils": "^7.22.5", "debug": "^4.1.1", "lodash.debounce": "^4.0.8", - "resolve": "^1.14.2", - "semver": "^6.1.2" + "resolve": "^1.14.2" }, "peerDependencies": { - "@babel/core": "^7.4.0-0" - } - }, - "node_modules/@babel/helper-environment-visitor": { - "version": "7.16.7", - "resolved": "https://registry.npmjs.org/@babel/helper-environment-visitor/-/helper-environment-visitor-7.16.7.tgz", - "integrity": "sha512-SLLb0AAn6PkUeAfKJCCOl9e1R53pQlGAfc4y4XuMRZfqeMYLE0dM1LMhqbGAlGQY0lfw5/ohoYWAe9V1yibRag==", - "dev": true, - "dependencies": { - "@babel/types": "^7.16.7" - }, - "engines": { - "node": ">=6.9.0" - } - }, - "node_modules/@babel/helper-explode-assignable-expression": { - "version": "7.16.7", - "resolved": "https://registry.npmjs.org/@babel/helper-explode-assignable-expression/-/helper-explode-assignable-expression-7.16.7.tgz", - "integrity": "sha512-KyUenhWMC8VrxzkGP0Jizjo4/Zx+1nNZhgocs+gLzyZyB8SHidhoq9KK/8Ato4anhwsivfkBLftky7gvzbZMtQ==", - "dev": true, - "dependencies": { - "@babel/types": "^7.16.7" - }, - "engines": { - "node": ">=6.9.0" - } - }, - "node_modules/@babel/helper-function-name": { - "version": "7.16.7", - "resolved": "https://registry.npmjs.org/@babel/helper-function-name/-/helper-function-name-7.16.7.tgz", - "integrity": "sha512-QfDfEnIUyyBSR3HtrtGECuZ6DAyCkYFp7GHl75vFtTnn6pjKeK0T1DB5lLkFvBea8MdaiUABx3osbgLyInoejA==", - "dev": true, - "dependencies": { - "@babel/helper-get-function-arity": "^7.16.7", - "@babel/template": "^7.16.7", - "@babel/types": "^7.16.7" - }, - "engines": { - "node": ">=6.9.0" - } - }, - "node_modules/@babel/helper-get-function-arity": { - "version": "7.16.7", - "resolved": "https://registry.npmjs.org/@babel/helper-get-function-arity/-/helper-get-function-arity-7.16.7.tgz", - "integrity": "sha512-flc+RLSOBXzNzVhcLu6ujeHUrD6tANAOU5ojrRx/as+tbzf8+stUCj7+IfRRoAbEZqj/ahXEMsjhOhgeZsrnTw==", - "dev": true, - "dependencies": { - "@babel/types": "^7.16.7" - }, - "engines": { - "node": ">=6.9.0" - } - }, - "node_modules/@babel/helper-hoist-variables": { - "version": "7.16.7", - "resolved": "https://registry.npmjs.org/@babel/helper-hoist-variables/-/helper-hoist-variables-7.16.7.tgz", - "integrity": "sha512-m04d/0Op34H5v7pbZw6pSKP7weA6lsMvfiIAMeIvkY/R4xQtBSMFEigu9QTZ2qB/9l22vsxtM8a+Q8CzD255fg==", - "dev": true, - "dependencies": { - "@babel/types": "^7.16.7" - }, - "engines": { - "node": ">=6.9.0" + "@babel/core": "^7.4.0 || ^8.0.0-0 <8.0.0" } }, "node_modules/@babel/helper-member-expression-to-functions": { - "version": "7.16.7", - "resolved": "https://registry.npmjs.org/@babel/helper-member-expression-to-functions/-/helper-member-expression-to-functions-7.16.7.tgz", - "integrity": "sha512-VtJ/65tYiU/6AbMTDwyoXGPKHgTsfRarivm+YbB5uAzKUyuPjgZSgAFeG87FCigc7KNHu2Pegh1XIT3lXjvz3Q==", + "version": "7.25.9", + "resolved": "https://r.cnpmjs.org/@babel/helper-member-expression-to-functions/-/helper-member-expression-to-functions-7.25.9.tgz", + "integrity": "sha512-wbfdZ9w5vk0C0oyHqAJbc62+vet5prjj01jjJ8sKn3j9h3MQQlflEdXYvuqRWjHnM12coDEqiC1IRCi0U/EKwQ==", "dev": true, + "license": "MIT", "dependencies": { - "@babel/types": "^7.16.7" + "@babel/traverse": "^7.25.9", + "@babel/types": "^7.25.9" }, "engines": { "node": ">=6.9.0" } }, "node_modules/@babel/helper-module-imports": { - "version": "7.16.7", - "resolved": "https://registry.npmjs.org/@babel/helper-module-imports/-/helper-module-imports-7.16.7.tgz", - "integrity": "sha512-LVtS6TqjJHFc+nYeITRo6VLXve70xmq7wPhWTqDJusJEgGmkAACWwMiTNrvfoQo6hEhFwAIixNkvB0jPXDL8Wg==", + "version": "7.25.9", + "resolved": "https://r.cnpmjs.org/@babel/helper-module-imports/-/helper-module-imports-7.25.9.tgz", + "integrity": "sha512-tnUA4RsrmflIM6W6RFTLFSXITtl0wKjgpnLgXyowocVPrbYrLUXSBXDgTs8BlbmIzIdlBySRQjINYs2BAkiLtw==", "dev": true, + "license": "MIT", "dependencies": { - "@babel/types": "^7.16.7" + "@babel/traverse": "^7.25.9", + "@babel/types": "^7.25.9" }, "engines": { "node": ">=6.9.0" } }, "node_modules/@babel/helper-module-transforms": { - "version": "7.16.7", - "resolved": "https://registry.npmjs.org/@babel/helper-module-transforms/-/helper-module-transforms-7.16.7.tgz", - "integrity": "sha512-gaqtLDxJEFCeQbYp9aLAefjhkKdjKcdh6DB7jniIGU3Pz52WAmP268zK0VgPz9hUNkMSYeH976K2/Y6yPadpng==", + "version": "7.26.0", + "resolved": "https://r.cnpmjs.org/@babel/helper-module-transforms/-/helper-module-transforms-7.26.0.tgz", + "integrity": "sha512-xO+xu6B5K2czEnQye6BHA7DolFFmS3LB7stHZFaOLb1pAwO1HWLS8fXA+eh0A2yIvltPVmx3eNNDBJA2SLHXFw==", "dev": true, + "license": "MIT", "dependencies": { - "@babel/helper-environment-visitor": "^7.16.7", - "@babel/helper-module-imports": "^7.16.7", - "@babel/helper-simple-access": "^7.16.7", - "@babel/helper-split-export-declaration": "^7.16.7", - "@babel/helper-validator-identifier": "^7.16.7", - "@babel/template": "^7.16.7", - "@babel/traverse": "^7.16.7", - "@babel/types": "^7.16.7" + "@babel/helper-module-imports": "^7.25.9", + "@babel/helper-validator-identifier": "^7.25.9", + "@babel/traverse": "^7.25.9" }, "engines": { "node": ">=6.9.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0" } }, "node_modules/@babel/helper-optimise-call-expression": { - "version": "7.16.7", - "resolved": "https://registry.npmjs.org/@babel/helper-optimise-call-expression/-/helper-optimise-call-expression-7.16.7.tgz", - "integrity": "sha512-EtgBhg7rd/JcnpZFXpBy0ze1YRfdm7BnBX4uKMBd3ixa3RGAE002JZB66FJyNH7g0F38U05pXmA5P8cBh7z+1w==", + "version": "7.25.9", + "resolved": "https://r.cnpmjs.org/@babel/helper-optimise-call-expression/-/helper-optimise-call-expression-7.25.9.tgz", + "integrity": "sha512-FIpuNaz5ow8VyrYcnXQTDRGvV6tTjkNtCK/RYNDXGSLlUD6cBuQTSw43CShGxjvfBTfcUA/r6UhUCbtYqkhcuQ==", "dev": true, + "license": "MIT", "dependencies": { - "@babel/types": "^7.16.7" + "@babel/types": "^7.25.9" }, "engines": { "node": ">=6.9.0" } }, "node_modules/@babel/helper-plugin-utils": { - "version": "7.16.7", - "resolved": "https://registry.npmjs.org/@babel/helper-plugin-utils/-/helper-plugin-utils-7.16.7.tgz", - "integrity": "sha512-Qg3Nk7ZxpgMrsox6HreY1ZNKdBq7K72tDSliA6dCl5f007jR4ne8iD5UzuNnCJH2xBf2BEEVGr+/OL6Gdp7RxA==", + "version": "7.25.9", + "resolved": "https://r.cnpmjs.org/@babel/helper-plugin-utils/-/helper-plugin-utils-7.25.9.tgz", + "integrity": "sha512-kSMlyUVdWe25rEsRGviIgOWnoT/nfABVWlqt9N19/dIPWViAOW2s9wznP5tURbs/IDuNk4gPy3YdYRgH3uxhBw==", "dev": true, + "license": "MIT", "engines": { "node": ">=6.9.0" } }, "node_modules/@babel/helper-remap-async-to-generator": { - "version": "7.16.8", - "resolved": "https://registry.npmjs.org/@babel/helper-remap-async-to-generator/-/helper-remap-async-to-generator-7.16.8.tgz", - "integrity": "sha512-fm0gH7Flb8H51LqJHy3HJ3wnE1+qtYR2A99K06ahwrawLdOFsCEWjZOrYricXJHoPSudNKxrMBUPEIPxiIIvBw==", + "version": "7.25.9", + "resolved": "https://r.cnpmjs.org/@babel/helper-remap-async-to-generator/-/helper-remap-async-to-generator-7.25.9.tgz", + "integrity": "sha512-IZtukuUeBbhgOcaW2s06OXTzVNJR0ybm4W5xC1opWFFJMZbwRj5LCk+ByYH7WdZPZTt8KnFwA8pvjN2yqcPlgw==", "dev": true, + "license": "MIT", "dependencies": { - "@babel/helper-annotate-as-pure": "^7.16.7", - "@babel/helper-wrap-function": "^7.16.8", - "@babel/types": "^7.16.8" + "@babel/helper-annotate-as-pure": "^7.25.9", + "@babel/helper-wrap-function": "^7.25.9", + "@babel/traverse": "^7.25.9" }, "engines": { "node": ">=6.9.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0" } }, "node_modules/@babel/helper-replace-supers": { - "version": "7.16.7", - "resolved": "https://registry.npmjs.org/@babel/helper-replace-supers/-/helper-replace-supers-7.16.7.tgz", - "integrity": "sha512-y9vsWilTNaVnVh6xiJfABzsNpgDPKev9HnAgz6Gb1p6UUwf9NepdlsV7VXGCftJM+jqD5f7JIEubcpLjZj5dBw==", + "version": "7.25.9", + "resolved": "https://r.cnpmjs.org/@babel/helper-replace-supers/-/helper-replace-supers-7.25.9.tgz", + "integrity": "sha512-IiDqTOTBQy0sWyeXyGSC5TBJpGFXBkRynjBeXsvbhQFKj2viwJC76Epz35YLU1fpe/Am6Vppb7W7zM4fPQzLsQ==", "dev": true, + "license": "MIT", "dependencies": { - "@babel/helper-environment-visitor": "^7.16.7", - "@babel/helper-member-expression-to-functions": "^7.16.7", - "@babel/helper-optimise-call-expression": "^7.16.7", - "@babel/traverse": "^7.16.7", - "@babel/types": "^7.16.7" + "@babel/helper-member-expression-to-functions": "^7.25.9", + "@babel/helper-optimise-call-expression": "^7.25.9", + "@babel/traverse": "^7.25.9" }, "engines": { "node": ">=6.9.0" - } - }, - "node_modules/@babel/helper-simple-access": { - "version": "7.16.7", - "resolved": "https://registry.npmjs.org/@babel/helper-simple-access/-/helper-simple-access-7.16.7.tgz", - "integrity": "sha512-ZIzHVyoeLMvXMN/vok/a4LWRy8G2v205mNP0XOuf9XRLyX5/u9CnVulUtDgUTama3lT+bf/UqucuZjqiGuTS1g==", - "dev": true, - "dependencies": { - "@babel/types": "^7.16.7" }, - "engines": { - "node": ">=6.9.0" + "peerDependencies": { + "@babel/core": "^7.0.0" } }, "node_modules/@babel/helper-skip-transparent-expression-wrappers": { - "version": "7.16.0", - "resolved": "https://registry.npmjs.org/@babel/helper-skip-transparent-expression-wrappers/-/helper-skip-transparent-expression-wrappers-7.16.0.tgz", - "integrity": "sha512-+il1gTy0oHwUsBQZyJvukbB4vPMdcYBrFHa0Uc4AizLxbq6BOYC51Rv4tWocX9BLBDLZ4kc6qUFpQ6HRgL+3zw==", + "version": "7.25.9", + "resolved": "https://r.cnpmjs.org/@babel/helper-skip-transparent-expression-wrappers/-/helper-skip-transparent-expression-wrappers-7.25.9.tgz", + "integrity": "sha512-K4Du3BFa3gvyhzgPcntrkDgZzQaq6uozzcpGbOO1OEJaI+EJdqWIMTLgFgQf6lrfiDFo5FU+BxKepI9RmZqahA==", "dev": true, + "license": "MIT", "dependencies": { - "@babel/types": "^7.16.0" + "@babel/traverse": "^7.25.9", + "@babel/types": "^7.25.9" }, "engines": { "node": ">=6.9.0" } }, - "node_modules/@babel/helper-split-export-declaration": { - "version": "7.16.7", - "resolved": "https://registry.npmjs.org/@babel/helper-split-export-declaration/-/helper-split-export-declaration-7.16.7.tgz", - "integrity": "sha512-xbWoy/PFoxSWazIToT9Sif+jJTlrMcndIsaOKvTA6u7QEo7ilkRZpjew18/W3c7nm8fXdUDXh02VXTbZ0pGDNw==", + "node_modules/@babel/helper-string-parser": { + "version": "7.25.9", + "resolved": "https://r.cnpmjs.org/@babel/helper-string-parser/-/helper-string-parser-7.25.9.tgz", + "integrity": "sha512-4A/SCr/2KLd5jrtOMFzaKjVtAei3+2r/NChoBNoZ3EyP/+GlhoaEGoWOZUmFmoITP7zOJyHIMm+DYRd8o3PvHA==", "dev": true, - "dependencies": { - "@babel/types": "^7.16.7" - }, + "license": "MIT", "engines": { "node": ">=6.9.0" } }, "node_modules/@babel/helper-validator-identifier": { - "version": "7.16.7", - "resolved": "https://registry.npmjs.org/@babel/helper-validator-identifier/-/helper-validator-identifier-7.16.7.tgz", - "integrity": "sha512-hsEnFemeiW4D08A5gUAZxLBTXpZ39P+a+DGDsHw1yxqyQ/jzFEnxf5uTEGp+3bzAbNOxU1paTgYS4ECU/IgfDw==", + "version": "7.25.9", + "resolved": "https://r.cnpmjs.org/@babel/helper-validator-identifier/-/helper-validator-identifier-7.25.9.tgz", + "integrity": "sha512-Ed61U6XJc3CVRfkERJWDz4dJwKe7iLmmJsbOGu9wSloNSFttHV0I8g6UAgb7qnK5ly5bGLPd4oXZlxCdANBOWQ==", "dev": true, + "license": "MIT", "engines": { "node": ">=6.9.0" } }, "node_modules/@babel/helper-validator-option": { - "version": "7.16.7", - "resolved": "https://registry.npmjs.org/@babel/helper-validator-option/-/helper-validator-option-7.16.7.tgz", - "integrity": "sha512-TRtenOuRUVo9oIQGPC5G9DgK4743cdxvtOw0weQNpZXaS16SCBi5MNjZF8vba3ETURjZpTbVn7Vvcf2eAwFozQ==", + "version": "7.25.9", + "resolved": "https://r.cnpmjs.org/@babel/helper-validator-option/-/helper-validator-option-7.25.9.tgz", + "integrity": "sha512-e/zv1co8pp55dNdEcCynfj9X7nyUKUXoUEwfXqaZt0omVOmDe9oOTdKStH4GmAw6zxMFs50ZayuMfHDKlO7Tfw==", "dev": true, + "license": "MIT", "engines": { "node": ">=6.9.0" } }, "node_modules/@babel/helper-wrap-function": { - "version": "7.16.8", - "resolved": "https://registry.npmjs.org/@babel/helper-wrap-function/-/helper-wrap-function-7.16.8.tgz", - "integrity": "sha512-8RpyRVIAW1RcDDGTA+GpPAwV22wXCfKOoM9bet6TLkGIFTkRQSkH1nMQ5Yet4MpoXe1ZwHPVtNasc2w0uZMqnw==", + "version": "7.25.9", + "resolved": "https://r.cnpmjs.org/@babel/helper-wrap-function/-/helper-wrap-function-7.25.9.tgz", + "integrity": "sha512-ETzz9UTjQSTmw39GboatdymDq4XIQbR8ySgVrylRhPOFpsd+JrKHIuF0de7GCWmem+T4uC5z7EZguod7Wj4A4g==", "dev": true, + "license": "MIT", "dependencies": { - "@babel/helper-function-name": "^7.16.7", - "@babel/template": "^7.16.7", - "@babel/traverse": "^7.16.8", - "@babel/types": "^7.16.8" + "@babel/template": "^7.25.9", + "@babel/traverse": "^7.25.9", + "@babel/types": "^7.25.9" }, "engines": { "node": ">=6.9.0" } }, "node_modules/@babel/helpers": { - "version": "7.16.7", - "resolved": "https://registry.npmjs.org/@babel/helpers/-/helpers-7.16.7.tgz", - "integrity": "sha512-9ZDoqtfY7AuEOt3cxchfii6C7GDyyMBffktR5B2jvWv8u2+efwvpnVKXMWzNehqy68tKgAfSwfdw/lWpthS2bw==", + "version": "7.26.0", + "resolved": "https://r.cnpmjs.org/@babel/helpers/-/helpers-7.26.0.tgz", + "integrity": "sha512-tbhNuIxNcVb21pInl3ZSjksLCvgdZy9KwJ8brv993QtIVKJBBkYXz4q4ZbAv31GdnC+R90np23L5FbEBlthAEw==", "dev": true, + "license": "MIT", "dependencies": { - "@babel/template": "^7.16.7", - "@babel/traverse": "^7.16.7", - "@babel/types": "^7.16.7" + "@babel/template": "^7.25.9", + "@babel/types": "^7.26.0" }, "engines": { "node": ">=6.9.0" @@ -535,10 +501,14 @@ } }, "node_modules/@babel/parser": { - "version": "7.16.8", - "resolved": "https://registry.npmjs.org/@babel/parser/-/parser-7.16.8.tgz", - "integrity": "sha512-i7jDUfrVBWc+7OKcBzEe5n7fbv3i2fWtxKzzCvOjnzSxMfWMigAhtfJ7qzZNGFNMsCCd67+uz553dYKWXPvCKw==", + "version": "7.26.3", + "resolved": "https://r.cnpmjs.org/@babel/parser/-/parser-7.26.3.tgz", + "integrity": "sha512-WJ/CvmY8Mea8iDXo6a7RK2wbmJITT5fN3BEkRuFlxVyNx8jOKIIhmC4fSkTcPcf8JyavbBwIe6OpiCOBXt/IcA==", "dev": true, + "license": "MIT", + "dependencies": { + "@babel/types": "^7.26.3" + }, "bin": { "parser": "bin/babel-parser.js" }, @@ -546,13 +516,15 @@ "node": ">=6.0.0" } }, - "node_modules/@babel/plugin-bugfix-safari-id-destructuring-collision-in-function-expression": { - "version": "7.16.7", - "resolved": "https://registry.npmjs.org/@babel/plugin-bugfix-safari-id-destructuring-collision-in-function-expression/-/plugin-bugfix-safari-id-destructuring-collision-in-function-expression-7.16.7.tgz", - "integrity": "sha512-anv/DObl7waiGEnC24O9zqL0pSuI9hljihqiDuFHC8d7/bjr/4RLGPWuc8rYOff/QPzbEPSkzG8wGG9aDuhHRg==", + "node_modules/@babel/plugin-bugfix-firefox-class-in-computed-class-key": { + "version": "7.25.9", + "resolved": "https://r.cnpmjs.org/@babel/plugin-bugfix-firefox-class-in-computed-class-key/-/plugin-bugfix-firefox-class-in-computed-class-key-7.25.9.tgz", + "integrity": "sha512-ZkRyVkThtxQ/J6nv3JFYv1RYY+JT5BvU0y3k5bWrmuG4woXypRa4PXmm9RhOwodRkYFWqC0C0cqcJ4OqR7kW+g==", "dev": true, + "license": "MIT", "dependencies": { - "@babel/helper-plugin-utils": "^7.16.7" + "@babel/helper-plugin-utils": "^7.25.9", + "@babel/traverse": "^7.25.9" }, "engines": { "node": ">=6.9.0" @@ -561,81 +533,81 @@ "@babel/core": "^7.0.0" } }, - "node_modules/@babel/plugin-bugfix-v8-spread-parameters-in-optional-chaining": { - "version": "7.16.7", - "resolved": "https://registry.npmjs.org/@babel/plugin-bugfix-v8-spread-parameters-in-optional-chaining/-/plugin-bugfix-v8-spread-parameters-in-optional-chaining-7.16.7.tgz", - "integrity": "sha512-di8vUHRdf+4aJ7ltXhaDbPoszdkh59AQtJM5soLsuHpQJdFQZOA4uGj0V2u/CZ8bJ/u8ULDL5yq6FO/bCXnKHw==", + "node_modules/@babel/plugin-bugfix-safari-class-field-initializer-scope": { + "version": "7.25.9", + "resolved": "https://r.cnpmjs.org/@babel/plugin-bugfix-safari-class-field-initializer-scope/-/plugin-bugfix-safari-class-field-initializer-scope-7.25.9.tgz", + "integrity": "sha512-MrGRLZxLD/Zjj0gdU15dfs+HH/OXvnw/U4jJD8vpcP2CJQapPEv1IWwjc/qMg7ItBlPwSv1hRBbb7LeuANdcnw==", "dev": true, + "license": "MIT", "dependencies": { - "@babel/helper-plugin-utils": "^7.16.7", - "@babel/helper-skip-transparent-expression-wrappers": "^7.16.0", - "@babel/plugin-proposal-optional-chaining": "^7.16.7" + "@babel/helper-plugin-utils": "^7.25.9" }, "engines": { "node": ">=6.9.0" }, "peerDependencies": { - "@babel/core": "^7.13.0" + "@babel/core": "^7.0.0" } }, - "node_modules/@babel/plugin-proposal-async-generator-functions": { - "version": "7.16.8", - "resolved": "https://registry.npmjs.org/@babel/plugin-proposal-async-generator-functions/-/plugin-proposal-async-generator-functions-7.16.8.tgz", - "integrity": "sha512-71YHIvMuiuqWJQkebWJtdhQTfd4Q4mF76q2IX37uZPkG9+olBxsX+rH1vkhFto4UeJZ9dPY2s+mDvhDm1u2BGQ==", + "node_modules/@babel/plugin-bugfix-safari-id-destructuring-collision-in-function-expression": { + "version": "7.25.9", + "resolved": "https://r.cnpmjs.org/@babel/plugin-bugfix-safari-id-destructuring-collision-in-function-expression/-/plugin-bugfix-safari-id-destructuring-collision-in-function-expression-7.25.9.tgz", + "integrity": "sha512-2qUwwfAFpJLZqxd02YW9btUCZHl+RFvdDkNfZwaIJrvB8Tesjsk8pEQkTvGwZXLqXUx/2oyY3ySRhm6HOXuCug==", "dev": true, + "license": "MIT", "dependencies": { - "@babel/helper-plugin-utils": "^7.16.7", - "@babel/helper-remap-async-to-generator": "^7.16.8", - "@babel/plugin-syntax-async-generators": "^7.8.4" + "@babel/helper-plugin-utils": "^7.25.9" }, "engines": { "node": ">=6.9.0" }, "peerDependencies": { - "@babel/core": "^7.0.0-0" + "@babel/core": "^7.0.0" } }, - "node_modules/@babel/plugin-proposal-class-properties": { - "version": "7.16.7", - "resolved": "https://registry.npmjs.org/@babel/plugin-proposal-class-properties/-/plugin-proposal-class-properties-7.16.7.tgz", - "integrity": "sha512-IobU0Xme31ewjYOShSIqd/ZGM/r/cuOz2z0MDbNrhF5FW+ZVgi0f2lyeoj9KFPDOAqsYxmLWZte1WOwlvY9aww==", + "node_modules/@babel/plugin-bugfix-v8-spread-parameters-in-optional-chaining": { + "version": "7.25.9", + "resolved": "https://r.cnpmjs.org/@babel/plugin-bugfix-v8-spread-parameters-in-optional-chaining/-/plugin-bugfix-v8-spread-parameters-in-optional-chaining-7.25.9.tgz", + "integrity": "sha512-6xWgLZTJXwilVjlnV7ospI3xi+sl8lN8rXXbBD6vYn3UYDlGsag8wrZkKcSI8G6KgqKP7vNFaDgeDnfAABq61g==", "dev": true, + "license": "MIT", "dependencies": { - "@babel/helper-create-class-features-plugin": "^7.16.7", - "@babel/helper-plugin-utils": "^7.16.7" + "@babel/helper-plugin-utils": "^7.25.9", + "@babel/helper-skip-transparent-expression-wrappers": "^7.25.9", + "@babel/plugin-transform-optional-chaining": "^7.25.9" }, "engines": { "node": ">=6.9.0" }, "peerDependencies": { - "@babel/core": "^7.0.0-0" + "@babel/core": "^7.13.0" } }, - "node_modules/@babel/plugin-proposal-class-static-block": { - "version": "7.16.7", - "resolved": "https://registry.npmjs.org/@babel/plugin-proposal-class-static-block/-/plugin-proposal-class-static-block-7.16.7.tgz", - "integrity": "sha512-dgqJJrcZoG/4CkMopzhPJjGxsIe9A8RlkQLnL/Vhhx8AA9ZuaRwGSlscSh42hazc7WSrya/IK7mTeoF0DP9tEw==", + "node_modules/@babel/plugin-bugfix-v8-static-class-fields-redefine-readonly": { + "version": "7.25.9", + "resolved": "https://r.cnpmjs.org/@babel/plugin-bugfix-v8-static-class-fields-redefine-readonly/-/plugin-bugfix-v8-static-class-fields-redefine-readonly-7.25.9.tgz", + "integrity": "sha512-aLnMXYPnzwwqhYSCyXfKkIkYgJ8zv9RK+roo9DkTXz38ynIhd9XCbN08s3MGvqL2MYGVUGdRQLL/JqBIeJhJBg==", "dev": true, + "license": "MIT", "dependencies": { - "@babel/helper-create-class-features-plugin": "^7.16.7", - "@babel/helper-plugin-utils": "^7.16.7", - "@babel/plugin-syntax-class-static-block": "^7.14.5" + "@babel/helper-plugin-utils": "^7.25.9", + "@babel/traverse": "^7.25.9" }, "engines": { "node": ">=6.9.0" }, "peerDependencies": { - "@babel/core": "^7.12.0" + "@babel/core": "^7.0.0" } }, - "node_modules/@babel/plugin-proposal-dynamic-import": { + "node_modules/@babel/plugin-proposal-class-properties": { "version": "7.16.7", - "resolved": "https://registry.npmjs.org/@babel/plugin-proposal-dynamic-import/-/plugin-proposal-dynamic-import-7.16.7.tgz", - "integrity": "sha512-I8SW9Ho3/8DRSdmDdH3gORdyUuYnk1m4cMxUAdu5oy4n3OfN8flDEH+d60iG7dUfi0KkYwSvoalHzzdRzpWHTg==", + "resolved": "https://registry.npmjs.org/@babel/plugin-proposal-class-properties/-/plugin-proposal-class-properties-7.16.7.tgz", + "integrity": "sha512-IobU0Xme31ewjYOShSIqd/ZGM/r/cuOz2z0MDbNrhF5FW+ZVgi0f2lyeoj9KFPDOAqsYxmLWZte1WOwlvY9aww==", "dev": true, "dependencies": { - "@babel/helper-plugin-utils": "^7.16.7", - "@babel/plugin-syntax-dynamic-import": "^7.8.3" + "@babel/helper-create-class-features-plugin": "^7.16.7", + "@babel/helper-plugin-utils": "^7.16.7" }, "engines": { "node": ">=6.9.0" @@ -644,15 +616,12 @@ "@babel/core": "^7.0.0-0" } }, - "node_modules/@babel/plugin-proposal-export-namespace-from": { - "version": "7.16.7", - "resolved": "https://registry.npmjs.org/@babel/plugin-proposal-export-namespace-from/-/plugin-proposal-export-namespace-from-7.16.7.tgz", - "integrity": "sha512-ZxdtqDXLRGBL64ocZcs7ovt71L3jhC1RGSyR996svrCi3PYqHNkb3SwPJCs8RIzD86s+WPpt2S73+EHCGO+NUA==", + "node_modules/@babel/plugin-proposal-private-property-in-object": { + "version": "7.21.0-placeholder-for-preset-env.2", + "resolved": "https://r.cnpmjs.org/@babel/plugin-proposal-private-property-in-object/-/plugin-proposal-private-property-in-object-7.21.0-placeholder-for-preset-env.2.tgz", + "integrity": "sha512-SOSkfJDddaM7mak6cPEpswyTRnuRltl429hMraQEglW+OkovnCzsiszTmsrlY//qLFjCpQDFRvjdm2wA5pPm9w==", "dev": true, - "dependencies": { - "@babel/helper-plugin-utils": "^7.16.7", - "@babel/plugin-syntax-export-namespace-from": "^7.8.3" - }, + "license": "MIT", "engines": { "node": ">=6.9.0" }, @@ -660,14 +629,14 @@ "@babel/core": "^7.0.0-0" } }, - "node_modules/@babel/plugin-proposal-json-strings": { - "version": "7.16.7", - "resolved": "https://registry.npmjs.org/@babel/plugin-proposal-json-strings/-/plugin-proposal-json-strings-7.16.7.tgz", - "integrity": "sha512-lNZ3EEggsGY78JavgbHsK9u5P3pQaW7k4axlgFLYkMd7UBsiNahCITShLjNQschPyjtO6dADrL24757IdhBrsQ==", + "node_modules/@babel/plugin-syntax-import-assertions": { + "version": "7.26.0", + "resolved": "https://r.cnpmjs.org/@babel/plugin-syntax-import-assertions/-/plugin-syntax-import-assertions-7.26.0.tgz", + "integrity": "sha512-QCWT5Hh830hK5EQa7XzuqIkQU9tT/whqbDz7kuaZMHFl1inRRg7JnuAEOQ0Ur0QUl0NufCk1msK2BeY79Aj/eg==", "dev": true, + "license": "MIT", "dependencies": { - "@babel/helper-plugin-utils": "^7.16.7", - "@babel/plugin-syntax-json-strings": "^7.8.3" + "@babel/helper-plugin-utils": "^7.25.9" }, "engines": { "node": ">=6.9.0" @@ -676,14 +645,14 @@ "@babel/core": "^7.0.0-0" } }, - "node_modules/@babel/plugin-proposal-logical-assignment-operators": { - "version": "7.16.7", - "resolved": "https://registry.npmjs.org/@babel/plugin-proposal-logical-assignment-operators/-/plugin-proposal-logical-assignment-operators-7.16.7.tgz", - "integrity": "sha512-K3XzyZJGQCr00+EtYtrDjmwX7o7PLK6U9bi1nCwkQioRFVUv6dJoxbQjtWVtP+bCPy82bONBKG8NPyQ4+i6yjg==", + "node_modules/@babel/plugin-syntax-import-attributes": { + "version": "7.26.0", + "resolved": "https://r.cnpmjs.org/@babel/plugin-syntax-import-attributes/-/plugin-syntax-import-attributes-7.26.0.tgz", + "integrity": "sha512-e2dttdsJ1ZTpi3B9UYGLw41hifAubg19AtCu/2I/F1QNVclOBr1dYpTdmdyZ84Xiz43BS/tCUkMAZNLv12Pi+A==", "dev": true, + "license": "MIT", "dependencies": { - "@babel/helper-plugin-utils": "^7.16.7", - "@babel/plugin-syntax-logical-assignment-operators": "^7.10.4" + "@babel/helper-plugin-utils": "^7.25.9" }, "engines": { "node": ">=6.9.0" @@ -692,30 +661,31 @@ "@babel/core": "^7.0.0-0" } }, - "node_modules/@babel/plugin-proposal-nullish-coalescing-operator": { - "version": "7.16.7", - "resolved": "https://registry.npmjs.org/@babel/plugin-proposal-nullish-coalescing-operator/-/plugin-proposal-nullish-coalescing-operator-7.16.7.tgz", - "integrity": "sha512-aUOrYU3EVtjf62jQrCj63pYZ7k6vns2h/DQvHPWGmsJRYzWXZ6/AsfgpiRy6XiuIDADhJzP2Q9MwSMKauBQ+UQ==", + "node_modules/@babel/plugin-syntax-unicode-sets-regex": { + "version": "7.18.6", + "resolved": "https://r.cnpmjs.org/@babel/plugin-syntax-unicode-sets-regex/-/plugin-syntax-unicode-sets-regex-7.18.6.tgz", + "integrity": "sha512-727YkEAPwSIQTv5im8QHz3upqp92JTWhidIC81Tdx4VJYIte/VndKf1qKrfnnhPLiPghStWfvC/iFaMCQu7Nqg==", "dev": true, + "license": "MIT", "dependencies": { - "@babel/helper-plugin-utils": "^7.16.7", - "@babel/plugin-syntax-nullish-coalescing-operator": "^7.8.3" + "@babel/helper-create-regexp-features-plugin": "^7.18.6", + "@babel/helper-plugin-utils": "^7.18.6" }, "engines": { "node": ">=6.9.0" }, "peerDependencies": { - "@babel/core": "^7.0.0-0" + "@babel/core": "^7.0.0" } }, - "node_modules/@babel/plugin-proposal-numeric-separator": { - "version": "7.16.7", - "resolved": "https://registry.npmjs.org/@babel/plugin-proposal-numeric-separator/-/plugin-proposal-numeric-separator-7.16.7.tgz", - "integrity": "sha512-vQgPMknOIgiuVqbokToyXbkY/OmmjAzr/0lhSIbG/KmnzXPGwW/AdhdKpi+O4X/VkWiWjnkKOBiqJrTaC98VKw==", + "node_modules/@babel/plugin-transform-arrow-functions": { + "version": "7.25.9", + "resolved": "https://r.cnpmjs.org/@babel/plugin-transform-arrow-functions/-/plugin-transform-arrow-functions-7.25.9.tgz", + "integrity": "sha512-6jmooXYIwn9ca5/RylZADJ+EnSxVUS5sjeJ9UPk6RWRzXCmOJCy6dqItPJFpw2cuCangPK4OYr5uhGKcmrm5Qg==", "dev": true, + "license": "MIT", "dependencies": { - "@babel/helper-plugin-utils": "^7.16.7", - "@babel/plugin-syntax-numeric-separator": "^7.10.4" + "@babel/helper-plugin-utils": "^7.25.9" }, "engines": { "node": ">=6.9.0" @@ -724,17 +694,16 @@ "@babel/core": "^7.0.0-0" } }, - "node_modules/@babel/plugin-proposal-object-rest-spread": { - "version": "7.16.7", - "resolved": "https://registry.npmjs.org/@babel/plugin-proposal-object-rest-spread/-/plugin-proposal-object-rest-spread-7.16.7.tgz", - "integrity": "sha512-3O0Y4+dw94HA86qSg9IHfyPktgR7q3gpNVAeiKQd+8jBKFaU5NQS1Yatgo4wY+UFNuLjvxcSmzcsHqrhgTyBUA==", + "node_modules/@babel/plugin-transform-async-generator-functions": { + "version": "7.25.9", + "resolved": "https://r.cnpmjs.org/@babel/plugin-transform-async-generator-functions/-/plugin-transform-async-generator-functions-7.25.9.tgz", + "integrity": "sha512-RXV6QAzTBbhDMO9fWwOmwwTuYaiPbggWQ9INdZqAYeSHyG7FzQ+nOZaUUjNwKv9pV3aE4WFqFm1Hnbci5tBCAw==", "dev": true, + "license": "MIT", "dependencies": { - "@babel/compat-data": "^7.16.4", - "@babel/helper-compilation-targets": "^7.16.7", - "@babel/helper-plugin-utils": "^7.16.7", - "@babel/plugin-syntax-object-rest-spread": "^7.8.3", - "@babel/plugin-transform-parameters": "^7.16.7" + "@babel/helper-plugin-utils": "^7.25.9", + "@babel/helper-remap-async-to-generator": "^7.25.9", + "@babel/traverse": "^7.25.9" }, "engines": { "node": ">=6.9.0" @@ -743,14 +712,16 @@ "@babel/core": "^7.0.0-0" } }, - "node_modules/@babel/plugin-proposal-optional-catch-binding": { - "version": "7.16.7", - "resolved": "https://registry.npmjs.org/@babel/plugin-proposal-optional-catch-binding/-/plugin-proposal-optional-catch-binding-7.16.7.tgz", - "integrity": "sha512-eMOH/L4OvWSZAE1VkHbr1vckLG1WUcHGJSLqqQwl2GaUqG6QjddvrOaTUMNYiv77H5IKPMZ9U9P7EaHwvAShfA==", + "node_modules/@babel/plugin-transform-async-to-generator": { + "version": "7.25.9", + "resolved": "https://r.cnpmjs.org/@babel/plugin-transform-async-to-generator/-/plugin-transform-async-to-generator-7.25.9.tgz", + "integrity": "sha512-NT7Ejn7Z/LjUH0Gv5KsBCxh7BH3fbLTV0ptHvpeMvrt3cPThHfJfst9Wrb7S8EvJ7vRTFI7z+VAvFVEQn/m5zQ==", "dev": true, + "license": "MIT", "dependencies": { - "@babel/helper-plugin-utils": "^7.16.7", - "@babel/plugin-syntax-optional-catch-binding": "^7.8.3" + "@babel/helper-module-imports": "^7.25.9", + "@babel/helper-plugin-utils": "^7.25.9", + "@babel/helper-remap-async-to-generator": "^7.25.9" }, "engines": { "node": ">=6.9.0" @@ -759,15 +730,14 @@ "@babel/core": "^7.0.0-0" } }, - "node_modules/@babel/plugin-proposal-optional-chaining": { - "version": "7.16.7", - "resolved": "https://registry.npmjs.org/@babel/plugin-proposal-optional-chaining/-/plugin-proposal-optional-chaining-7.16.7.tgz", - "integrity": "sha512-eC3xy+ZrUcBtP7x+sq62Q/HYd674pPTb/77XZMb5wbDPGWIdUbSr4Agr052+zaUPSb+gGRnjxXfKFvx5iMJ+DA==", + "node_modules/@babel/plugin-transform-block-scoped-functions": { + "version": "7.25.9", + "resolved": "https://r.cnpmjs.org/@babel/plugin-transform-block-scoped-functions/-/plugin-transform-block-scoped-functions-7.25.9.tgz", + "integrity": "sha512-toHc9fzab0ZfenFpsyYinOX0J/5dgJVA2fm64xPewu7CoYHWEivIWKxkK2rMi4r3yQqLnVmheMXRdG+k239CgA==", "dev": true, + "license": "MIT", "dependencies": { - "@babel/helper-plugin-utils": "^7.16.7", - "@babel/helper-skip-transparent-expression-wrappers": "^7.16.0", - "@babel/plugin-syntax-optional-chaining": "^7.8.3" + "@babel/helper-plugin-utils": "^7.25.9" }, "engines": { "node": ">=6.9.0" @@ -776,14 +746,14 @@ "@babel/core": "^7.0.0-0" } }, - "node_modules/@babel/plugin-proposal-private-methods": { - "version": "7.16.7", - "resolved": "https://registry.npmjs.org/@babel/plugin-proposal-private-methods/-/plugin-proposal-private-methods-7.16.7.tgz", - "integrity": "sha512-7twV3pzhrRxSwHeIvFE6coPgvo+exNDOiGUMg39o2LiLo1Y+4aKpfkcLGcg1UHonzorCt7SNXnoMyCnnIOA8Sw==", + "node_modules/@babel/plugin-transform-block-scoping": { + "version": "7.25.9", + "resolved": "https://r.cnpmjs.org/@babel/plugin-transform-block-scoping/-/plugin-transform-block-scoping-7.25.9.tgz", + "integrity": "sha512-1F05O7AYjymAtqbsFETboN1NvBdcnzMerO+zlMyJBEz6WkMdejvGWw9p05iTSjC85RLlBseHHQpYaM4gzJkBGg==", "dev": true, + "license": "MIT", "dependencies": { - "@babel/helper-create-class-features-plugin": "^7.16.7", - "@babel/helper-plugin-utils": "^7.16.7" + "@babel/helper-plugin-utils": "^7.25.9" }, "engines": { "node": ">=6.9.0" @@ -792,16 +762,15 @@ "@babel/core": "^7.0.0-0" } }, - "node_modules/@babel/plugin-proposal-private-property-in-object": { - "version": "7.16.7", - "resolved": "https://registry.npmjs.org/@babel/plugin-proposal-private-property-in-object/-/plugin-proposal-private-property-in-object-7.16.7.tgz", - "integrity": "sha512-rMQkjcOFbm+ufe3bTZLyOfsOUOxyvLXZJCTARhJr+8UMSoZmqTe1K1BgkFcrW37rAchWg57yI69ORxiWvUINuQ==", + "node_modules/@babel/plugin-transform-class-properties": { + "version": "7.25.9", + "resolved": "https://r.cnpmjs.org/@babel/plugin-transform-class-properties/-/plugin-transform-class-properties-7.25.9.tgz", + "integrity": "sha512-bbMAII8GRSkcd0h0b4X+36GksxuheLFjP65ul9w6C3KgAamI3JqErNgSrosX6ZPj+Mpim5VvEbawXxJCyEUV3Q==", "dev": true, + "license": "MIT", "dependencies": { - "@babel/helper-annotate-as-pure": "^7.16.7", - "@babel/helper-create-class-features-plugin": "^7.16.7", - "@babel/helper-plugin-utils": "^7.16.7", - "@babel/plugin-syntax-private-property-in-object": "^7.14.5" + "@babel/helper-create-class-features-plugin": "^7.25.9", + "@babel/helper-plugin-utils": "^7.25.9" }, "engines": { "node": ">=6.9.0" @@ -810,53 +779,53 @@ "@babel/core": "^7.0.0-0" } }, - "node_modules/@babel/plugin-proposal-unicode-property-regex": { - "version": "7.16.7", - "resolved": "https://registry.npmjs.org/@babel/plugin-proposal-unicode-property-regex/-/plugin-proposal-unicode-property-regex-7.16.7.tgz", - "integrity": "sha512-QRK0YI/40VLhNVGIjRNAAQkEHws0cswSdFFjpFyt943YmJIU1da9uW63Iu6NFV6CxTZW5eTDCrwZUstBWgp/Rg==", + "node_modules/@babel/plugin-transform-class-static-block": { + "version": "7.26.0", + "resolved": "https://r.cnpmjs.org/@babel/plugin-transform-class-static-block/-/plugin-transform-class-static-block-7.26.0.tgz", + "integrity": "sha512-6J2APTs7BDDm+UMqP1useWqhcRAXo0WIoVj26N7kPFB6S73Lgvyka4KTZYIxtgYXiN5HTyRObA72N2iu628iTQ==", "dev": true, + "license": "MIT", "dependencies": { - "@babel/helper-create-regexp-features-plugin": "^7.16.7", - "@babel/helper-plugin-utils": "^7.16.7" + "@babel/helper-create-class-features-plugin": "^7.25.9", + "@babel/helper-plugin-utils": "^7.25.9" }, "engines": { - "node": ">=4" + "node": ">=6.9.0" }, "peerDependencies": { - "@babel/core": "^7.0.0-0" + "@babel/core": "^7.12.0" } }, - "node_modules/@babel/plugin-syntax-async-generators": { - "version": "7.8.4", - "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-async-generators/-/plugin-syntax-async-generators-7.8.4.tgz", - "integrity": "sha512-tycmZxkGfZaxhMRbXlPXuVFpdWlXpir2W4AMhSJgRKzk/eDlIXOhb2LHWoLpDF7TEHylV5zNhykX6KAgHJmTNw==", + "node_modules/@babel/plugin-transform-classes": { + "version": "7.25.9", + "resolved": "https://r.cnpmjs.org/@babel/plugin-transform-classes/-/plugin-transform-classes-7.25.9.tgz", + "integrity": "sha512-mD8APIXmseE7oZvZgGABDyM34GUmK45Um2TXiBUt7PnuAxrgoSVf123qUzPxEr/+/BHrRn5NMZCdE2m/1F8DGg==", "dev": true, + "license": "MIT", "dependencies": { - "@babel/helper-plugin-utils": "^7.8.0" + "@babel/helper-annotate-as-pure": "^7.25.9", + "@babel/helper-compilation-targets": "^7.25.9", + "@babel/helper-plugin-utils": "^7.25.9", + "@babel/helper-replace-supers": "^7.25.9", + "@babel/traverse": "^7.25.9", + "globals": "^11.1.0" }, - "peerDependencies": { - "@babel/core": "^7.0.0-0" - } - }, - "node_modules/@babel/plugin-syntax-class-properties": { - "version": "7.12.13", - "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-class-properties/-/plugin-syntax-class-properties-7.12.13.tgz", - "integrity": "sha512-fm4idjKla0YahUNgFNLCB0qySdsoPiZP3iQE3rky0mBUtMZ23yDJ9SJdg6dXTSDnulOVqiF3Hgr9nbXvXTQZYA==", - "dev": true, - "dependencies": { - "@babel/helper-plugin-utils": "^7.12.13" + "engines": { + "node": ">=6.9.0" }, "peerDependencies": { "@babel/core": "^7.0.0-0" } }, - "node_modules/@babel/plugin-syntax-class-static-block": { - "version": "7.14.5", - "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-class-static-block/-/plugin-syntax-class-static-block-7.14.5.tgz", - "integrity": "sha512-b+YyPmr6ldyNnM6sqYeMWE+bgJcJpO6yS4QD7ymxgH34GBPNDM/THBh8iunyvKIZztiwLH4CJZ0RxTk9emgpjw==", + "node_modules/@babel/plugin-transform-computed-properties": { + "version": "7.25.9", + "resolved": "https://r.cnpmjs.org/@babel/plugin-transform-computed-properties/-/plugin-transform-computed-properties-7.25.9.tgz", + "integrity": "sha512-HnBegGqXZR12xbcTHlJ9HGxw1OniltT26J5YpfruGqtUHlz/xKf/G2ak9e+t0rVqrjXa9WOhvYPz1ERfMj23AA==", "dev": true, + "license": "MIT", "dependencies": { - "@babel/helper-plugin-utils": "^7.14.5" + "@babel/helper-plugin-utils": "^7.25.9", + "@babel/template": "^7.25.9" }, "engines": { "node": ">=6.9.0" @@ -865,121 +834,129 @@ "@babel/core": "^7.0.0-0" } }, - "node_modules/@babel/plugin-syntax-dynamic-import": { - "version": "7.8.3", - "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-dynamic-import/-/plugin-syntax-dynamic-import-7.8.3.tgz", - "integrity": "sha512-5gdGbFon+PszYzqs83S3E5mpi7/y/8M9eC90MRTZfduQOYW76ig6SOSPNe41IG5LoP3FGBn2N0RjVDSQiS94kQ==", + "node_modules/@babel/plugin-transform-destructuring": { + "version": "7.25.9", + "resolved": "https://r.cnpmjs.org/@babel/plugin-transform-destructuring/-/plugin-transform-destructuring-7.25.9.tgz", + "integrity": "sha512-WkCGb/3ZxXepmMiX101nnGiU+1CAdut8oHyEOHxkKuS1qKpU2SMXE2uSvfz8PBuLd49V6LEsbtyPhWC7fnkgvQ==", "dev": true, + "license": "MIT", "dependencies": { - "@babel/helper-plugin-utils": "^7.8.0" + "@babel/helper-plugin-utils": "^7.25.9" }, - "peerDependencies": { - "@babel/core": "^7.0.0-0" - } - }, - "node_modules/@babel/plugin-syntax-export-namespace-from": { - "version": "7.8.3", - "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-export-namespace-from/-/plugin-syntax-export-namespace-from-7.8.3.tgz", - "integrity": "sha512-MXf5laXo6c1IbEbegDmzGPwGNTsHZmEy6QGznu5Sh2UCWvueywb2ee+CCE4zQiZstxU9BMoQO9i6zUFSY0Kj0Q==", - "dev": true, - "dependencies": { - "@babel/helper-plugin-utils": "^7.8.3" + "engines": { + "node": ">=6.9.0" }, "peerDependencies": { "@babel/core": "^7.0.0-0" } }, - "node_modules/@babel/plugin-syntax-json-strings": { - "version": "7.8.3", - "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-json-strings/-/plugin-syntax-json-strings-7.8.3.tgz", - "integrity": "sha512-lY6kdGpWHvjoe2vk4WrAapEuBR69EMxZl+RoGRhrFGNYVK8mOPAW8VfbT/ZgrFbXlDNiiaxQnAtgVCZ6jv30EA==", + "node_modules/@babel/plugin-transform-dotall-regex": { + "version": "7.25.9", + "resolved": "https://r.cnpmjs.org/@babel/plugin-transform-dotall-regex/-/plugin-transform-dotall-regex-7.25.9.tgz", + "integrity": "sha512-t7ZQ7g5trIgSRYhI9pIJtRl64KHotutUJsh4Eze5l7olJv+mRSg4/MmbZ0tv1eeqRbdvo/+trvJD/Oc5DmW2cA==", "dev": true, + "license": "MIT", "dependencies": { - "@babel/helper-plugin-utils": "^7.8.0" + "@babel/helper-create-regexp-features-plugin": "^7.25.9", + "@babel/helper-plugin-utils": "^7.25.9" }, - "peerDependencies": { - "@babel/core": "^7.0.0-0" - } - }, - "node_modules/@babel/plugin-syntax-logical-assignment-operators": { - "version": "7.10.4", - "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-logical-assignment-operators/-/plugin-syntax-logical-assignment-operators-7.10.4.tgz", - "integrity": "sha512-d8waShlpFDinQ5MtvGU9xDAOzKH47+FFoney2baFIoMr952hKOLp1HR7VszoZvOsV/4+RRszNY7D17ba0te0ig==", - "dev": true, - "dependencies": { - "@babel/helper-plugin-utils": "^7.10.4" + "engines": { + "node": ">=6.9.0" }, "peerDependencies": { "@babel/core": "^7.0.0-0" } }, - "node_modules/@babel/plugin-syntax-nullish-coalescing-operator": { - "version": "7.8.3", - "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-nullish-coalescing-operator/-/plugin-syntax-nullish-coalescing-operator-7.8.3.tgz", - "integrity": "sha512-aSff4zPII1u2QD7y+F8oDsz19ew4IGEJg9SVW+bqwpwtfFleiQDMdzA/R+UlWDzfnHFCxxleFT0PMIrR36XLNQ==", + "node_modules/@babel/plugin-transform-duplicate-keys": { + "version": "7.25.9", + "resolved": "https://r.cnpmjs.org/@babel/plugin-transform-duplicate-keys/-/plugin-transform-duplicate-keys-7.25.9.tgz", + "integrity": "sha512-LZxhJ6dvBb/f3x8xwWIuyiAHy56nrRG3PeYTpBkkzkYRRQ6tJLu68lEF5VIqMUZiAV7a8+Tb78nEoMCMcqjXBw==", "dev": true, + "license": "MIT", "dependencies": { - "@babel/helper-plugin-utils": "^7.8.0" + "@babel/helper-plugin-utils": "^7.25.9" + }, + "engines": { + "node": ">=6.9.0" }, "peerDependencies": { "@babel/core": "^7.0.0-0" } }, - "node_modules/@babel/plugin-syntax-numeric-separator": { - "version": "7.10.4", - "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-numeric-separator/-/plugin-syntax-numeric-separator-7.10.4.tgz", - "integrity": "sha512-9H6YdfkcK/uOnY/K7/aA2xpzaAgkQn37yzWUMRK7OaPOqOpGS1+n0H5hxT9AUw9EsSjPW8SVyMJwYRtWs3X3ug==", + "node_modules/@babel/plugin-transform-duplicate-named-capturing-groups-regex": { + "version": "7.25.9", + "resolved": "https://r.cnpmjs.org/@babel/plugin-transform-duplicate-named-capturing-groups-regex/-/plugin-transform-duplicate-named-capturing-groups-regex-7.25.9.tgz", + "integrity": "sha512-0UfuJS0EsXbRvKnwcLjFtJy/Sxc5J5jhLHnFhy7u4zih97Hz6tJkLU+O+FMMrNZrosUPxDi6sYxJ/EA8jDiAog==", "dev": true, + "license": "MIT", "dependencies": { - "@babel/helper-plugin-utils": "^7.10.4" + "@babel/helper-create-regexp-features-plugin": "^7.25.9", + "@babel/helper-plugin-utils": "^7.25.9" + }, + "engines": { + "node": ">=6.9.0" }, "peerDependencies": { - "@babel/core": "^7.0.0-0" + "@babel/core": "^7.0.0" } }, - "node_modules/@babel/plugin-syntax-object-rest-spread": { - "version": "7.8.3", - "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-object-rest-spread/-/plugin-syntax-object-rest-spread-7.8.3.tgz", - "integrity": "sha512-XoqMijGZb9y3y2XskN+P1wUGiVwWZ5JmoDRwx5+3GmEplNyVM2s2Dg8ILFQm8rWM48orGy5YpI5Bl8U1y7ydlA==", + "node_modules/@babel/plugin-transform-dynamic-import": { + "version": "7.25.9", + "resolved": "https://r.cnpmjs.org/@babel/plugin-transform-dynamic-import/-/plugin-transform-dynamic-import-7.25.9.tgz", + "integrity": "sha512-GCggjexbmSLaFhqsojeugBpeaRIgWNTcgKVq/0qIteFEqY2A+b9QidYadrWlnbWQUrW5fn+mCvf3tr7OeBFTyg==", "dev": true, + "license": "MIT", "dependencies": { - "@babel/helper-plugin-utils": "^7.8.0" + "@babel/helper-plugin-utils": "^7.25.9" + }, + "engines": { + "node": ">=6.9.0" }, "peerDependencies": { "@babel/core": "^7.0.0-0" } }, - "node_modules/@babel/plugin-syntax-optional-catch-binding": { - "version": "7.8.3", - "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-optional-catch-binding/-/plugin-syntax-optional-catch-binding-7.8.3.tgz", - "integrity": "sha512-6VPD0Pc1lpTqw0aKoeRTMiB+kWhAoT24PA+ksWSBrFtl5SIRVpZlwN3NNPQjehA2E/91FV3RjLWoVTglWcSV3Q==", + "node_modules/@babel/plugin-transform-exponentiation-operator": { + "version": "7.26.3", + "resolved": "https://r.cnpmjs.org/@babel/plugin-transform-exponentiation-operator/-/plugin-transform-exponentiation-operator-7.26.3.tgz", + "integrity": "sha512-7CAHcQ58z2chuXPWblnn1K6rLDnDWieghSOEmqQsrBenH0P9InCUtOJYD89pvngljmZlJcz3fcmgYsXFNGa1ZQ==", "dev": true, + "license": "MIT", "dependencies": { - "@babel/helper-plugin-utils": "^7.8.0" + "@babel/helper-plugin-utils": "^7.25.9" + }, + "engines": { + "node": ">=6.9.0" }, "peerDependencies": { "@babel/core": "^7.0.0-0" } }, - "node_modules/@babel/plugin-syntax-optional-chaining": { - "version": "7.8.3", - "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-optional-chaining/-/plugin-syntax-optional-chaining-7.8.3.tgz", - "integrity": "sha512-KoK9ErH1MBlCPxV0VANkXW2/dw4vlbGDrFgz8bmUsBGYkFRcbRwMh6cIJubdPrkxRwuGdtCk0v/wPTKbQgBjkg==", + "node_modules/@babel/plugin-transform-export-namespace-from": { + "version": "7.25.9", + "resolved": "https://r.cnpmjs.org/@babel/plugin-transform-export-namespace-from/-/plugin-transform-export-namespace-from-7.25.9.tgz", + "integrity": "sha512-2NsEz+CxzJIVOPx2o9UsW1rXLqtChtLoVnwYHHiB04wS5sgn7mrV45fWMBX0Kk+ub9uXytVYfNP2HjbVbCB3Ww==", "dev": true, + "license": "MIT", "dependencies": { - "@babel/helper-plugin-utils": "^7.8.0" + "@babel/helper-plugin-utils": "^7.25.9" + }, + "engines": { + "node": ">=6.9.0" }, "peerDependencies": { "@babel/core": "^7.0.0-0" } }, - "node_modules/@babel/plugin-syntax-private-property-in-object": { - "version": "7.14.5", - "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-private-property-in-object/-/plugin-syntax-private-property-in-object-7.14.5.tgz", - "integrity": "sha512-0wVnp9dxJ72ZUJDV27ZfbSj6iHLoytYZmh3rFcxNnvsJF3ktkzLDZPy/mA17HGsaQT3/DQsWYX1f1QGWkCoVUg==", + "node_modules/@babel/plugin-transform-for-of": { + "version": "7.25.9", + "resolved": "https://r.cnpmjs.org/@babel/plugin-transform-for-of/-/plugin-transform-for-of-7.25.9.tgz", + "integrity": "sha512-LqHxduHoaGELJl2uhImHwRQudhCM50pT46rIBNvtT/Oql3nqiS3wOwP+5ten7NpYSXrrVLgtZU3DZmPtWZo16A==", "dev": true, + "license": "MIT", "dependencies": { - "@babel/helper-plugin-utils": "^7.14.5" + "@babel/helper-plugin-utils": "^7.25.9", + "@babel/helper-skip-transparent-expression-wrappers": "^7.25.9" }, "engines": { "node": ">=6.9.0" @@ -988,13 +965,16 @@ "@babel/core": "^7.0.0-0" } }, - "node_modules/@babel/plugin-syntax-top-level-await": { - "version": "7.14.5", - "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-top-level-await/-/plugin-syntax-top-level-await-7.14.5.tgz", - "integrity": "sha512-hx++upLv5U1rgYfwe1xBQUhRmU41NEvpUvrp8jkrSCdvGSnM5/qdRMtylJ6PG5OFkBaHkbTAKTnd3/YyESRHFw==", + "node_modules/@babel/plugin-transform-function-name": { + "version": "7.25.9", + "resolved": "https://r.cnpmjs.org/@babel/plugin-transform-function-name/-/plugin-transform-function-name-7.25.9.tgz", + "integrity": "sha512-8lP+Yxjv14Vc5MuWBpJsoUCd3hD6V9DgBon2FVYL4jJgbnVQ9fTgYmonchzZJOVNgzEgbxp4OwAf6xz6M/14XA==", "dev": true, + "license": "MIT", "dependencies": { - "@babel/helper-plugin-utils": "^7.14.5" + "@babel/helper-compilation-targets": "^7.25.9", + "@babel/helper-plugin-utils": "^7.25.9", + "@babel/traverse": "^7.25.9" }, "engines": { "node": ">=6.9.0" @@ -1003,13 +983,14 @@ "@babel/core": "^7.0.0-0" } }, - "node_modules/@babel/plugin-transform-arrow-functions": { - "version": "7.16.7", - "resolved": "https://registry.npmjs.org/@babel/plugin-transform-arrow-functions/-/plugin-transform-arrow-functions-7.16.7.tgz", - "integrity": "sha512-9ffkFFMbvzTvv+7dTp/66xvZAWASuPD5Tl9LK3Z9vhOmANo6j94rik+5YMBt4CwHVMWLWpMsriIc2zsa3WW3xQ==", + "node_modules/@babel/plugin-transform-json-strings": { + "version": "7.25.9", + "resolved": "https://r.cnpmjs.org/@babel/plugin-transform-json-strings/-/plugin-transform-json-strings-7.25.9.tgz", + "integrity": "sha512-xoTMk0WXceiiIvsaquQQUaLLXSW1KJ159KP87VilruQm0LNNGxWzahxSS6T6i4Zg3ezp4vA4zuwiNUR53qmQAw==", "dev": true, + "license": "MIT", "dependencies": { - "@babel/helper-plugin-utils": "^7.16.7" + "@babel/helper-plugin-utils": "^7.25.9" }, "engines": { "node": ">=6.9.0" @@ -1018,15 +999,14 @@ "@babel/core": "^7.0.0-0" } }, - "node_modules/@babel/plugin-transform-async-to-generator": { - "version": "7.16.8", - "resolved": "https://registry.npmjs.org/@babel/plugin-transform-async-to-generator/-/plugin-transform-async-to-generator-7.16.8.tgz", - "integrity": "sha512-MtmUmTJQHCnyJVrScNzNlofQJ3dLFuobYn3mwOTKHnSCMtbNsqvF71GQmJfFjdrXSsAA7iysFmYWw4bXZ20hOg==", + "node_modules/@babel/plugin-transform-literals": { + "version": "7.25.9", + "resolved": "https://r.cnpmjs.org/@babel/plugin-transform-literals/-/plugin-transform-literals-7.25.9.tgz", + "integrity": "sha512-9N7+2lFziW8W9pBl2TzaNht3+pgMIRP74zizeCSrtnSKVdUl8mAjjOP2OOVQAfZ881P2cNjDj1uAMEdeD50nuQ==", "dev": true, + "license": "MIT", "dependencies": { - "@babel/helper-module-imports": "^7.16.7", - "@babel/helper-plugin-utils": "^7.16.7", - "@babel/helper-remap-async-to-generator": "^7.16.8" + "@babel/helper-plugin-utils": "^7.25.9" }, "engines": { "node": ">=6.9.0" @@ -1035,13 +1015,14 @@ "@babel/core": "^7.0.0-0" } }, - "node_modules/@babel/plugin-transform-block-scoped-functions": { - "version": "7.16.7", - "resolved": "https://registry.npmjs.org/@babel/plugin-transform-block-scoped-functions/-/plugin-transform-block-scoped-functions-7.16.7.tgz", - "integrity": "sha512-JUuzlzmF40Z9cXyytcbZEZKckgrQzChbQJw/5PuEHYeqzCsvebDx0K0jWnIIVcmmDOAVctCgnYs0pMcrYj2zJg==", + "node_modules/@babel/plugin-transform-logical-assignment-operators": { + "version": "7.25.9", + "resolved": "https://r.cnpmjs.org/@babel/plugin-transform-logical-assignment-operators/-/plugin-transform-logical-assignment-operators-7.25.9.tgz", + "integrity": "sha512-wI4wRAzGko551Y8eVf6iOY9EouIDTtPb0ByZx+ktDGHwv6bHFimrgJM/2T021txPZ2s4c7bqvHbd+vXG6K948Q==", "dev": true, + "license": "MIT", "dependencies": { - "@babel/helper-plugin-utils": "^7.16.7" + "@babel/helper-plugin-utils": "^7.25.9" }, "engines": { "node": ">=6.9.0" @@ -1050,13 +1031,14 @@ "@babel/core": "^7.0.0-0" } }, - "node_modules/@babel/plugin-transform-block-scoping": { - "version": "7.16.7", - "resolved": "https://registry.npmjs.org/@babel/plugin-transform-block-scoping/-/plugin-transform-block-scoping-7.16.7.tgz", - "integrity": "sha512-ObZev2nxVAYA4bhyusELdo9hb3H+A56bxH3FZMbEImZFiEDYVHXQSJ1hQKFlDnlt8G9bBrCZ5ZpURZUrV4G5qQ==", + "node_modules/@babel/plugin-transform-member-expression-literals": { + "version": "7.25.9", + "resolved": "https://r.cnpmjs.org/@babel/plugin-transform-member-expression-literals/-/plugin-transform-member-expression-literals-7.25.9.tgz", + "integrity": "sha512-PYazBVfofCQkkMzh2P6IdIUaCEWni3iYEerAsRWuVd8+jlM1S9S9cz1dF9hIzyoZ8IA3+OwVYIp9v9e+GbgZhA==", "dev": true, + "license": "MIT", "dependencies": { - "@babel/helper-plugin-utils": "^7.16.7" + "@babel/helper-plugin-utils": "^7.25.9" }, "engines": { "node": ">=6.9.0" @@ -1065,20 +1047,15 @@ "@babel/core": "^7.0.0-0" } }, - "node_modules/@babel/plugin-transform-classes": { - "version": "7.16.7", - "resolved": "https://registry.npmjs.org/@babel/plugin-transform-classes/-/plugin-transform-classes-7.16.7.tgz", - "integrity": "sha512-WY7og38SFAGYRe64BrjKf8OrE6ulEHtr5jEYaZMwox9KebgqPi67Zqz8K53EKk1fFEJgm96r32rkKZ3qA2nCWQ==", + "node_modules/@babel/plugin-transform-modules-amd": { + "version": "7.25.9", + "resolved": "https://r.cnpmjs.org/@babel/plugin-transform-modules-amd/-/plugin-transform-modules-amd-7.25.9.tgz", + "integrity": "sha512-g5T11tnI36jVClQlMlt4qKDLlWnG5pP9CSM4GhdRciTNMRgkfpo5cR6b4rGIOYPgRRuFAvwjPQ/Yk+ql4dyhbw==", "dev": true, + "license": "MIT", "dependencies": { - "@babel/helper-annotate-as-pure": "^7.16.7", - "@babel/helper-environment-visitor": "^7.16.7", - "@babel/helper-function-name": "^7.16.7", - "@babel/helper-optimise-call-expression": "^7.16.7", - "@babel/helper-plugin-utils": "^7.16.7", - "@babel/helper-replace-supers": "^7.16.7", - "@babel/helper-split-export-declaration": "^7.16.7", - "globals": "^11.1.0" + "@babel/helper-module-transforms": "^7.25.9", + "@babel/helper-plugin-utils": "^7.25.9" }, "engines": { "node": ">=6.9.0" @@ -1087,13 +1064,15 @@ "@babel/core": "^7.0.0-0" } }, - "node_modules/@babel/plugin-transform-computed-properties": { - "version": "7.16.7", - "resolved": "https://registry.npmjs.org/@babel/plugin-transform-computed-properties/-/plugin-transform-computed-properties-7.16.7.tgz", - "integrity": "sha512-gN72G9bcmenVILj//sv1zLNaPyYcOzUho2lIJBMh/iakJ9ygCo/hEF9cpGb61SCMEDxbbyBoVQxrt+bWKu5KGw==", + "node_modules/@babel/plugin-transform-modules-commonjs": { + "version": "7.26.3", + "resolved": "https://r.cnpmjs.org/@babel/plugin-transform-modules-commonjs/-/plugin-transform-modules-commonjs-7.26.3.tgz", + "integrity": "sha512-MgR55l4q9KddUDITEzEFYn5ZsGDXMSsU9E+kh7fjRXTIC3RHqfCo8RPRbyReYJh44HQ/yomFkqbOFohXvDCiIQ==", "dev": true, + "license": "MIT", "dependencies": { - "@babel/helper-plugin-utils": "^7.16.7" + "@babel/helper-module-transforms": "^7.26.0", + "@babel/helper-plugin-utils": "^7.25.9" }, "engines": { "node": ">=6.9.0" @@ -1102,13 +1081,17 @@ "@babel/core": "^7.0.0-0" } }, - "node_modules/@babel/plugin-transform-destructuring": { - "version": "7.16.7", - "resolved": "https://registry.npmjs.org/@babel/plugin-transform-destructuring/-/plugin-transform-destructuring-7.16.7.tgz", - "integrity": "sha512-VqAwhTHBnu5xBVDCvrvqJbtLUa++qZaWC0Fgr2mqokBlulZARGyIvZDoqbPlPaKImQ9dKAcCzbv+ul//uqu70A==", + "node_modules/@babel/plugin-transform-modules-systemjs": { + "version": "7.25.9", + "resolved": "https://r.cnpmjs.org/@babel/plugin-transform-modules-systemjs/-/plugin-transform-modules-systemjs-7.25.9.tgz", + "integrity": "sha512-hyss7iIlH/zLHaehT+xwiymtPOpsiwIIRlCAOwBB04ta5Tt+lNItADdlXw3jAWZ96VJ2jlhl/c+PNIQPKNfvcA==", "dev": true, + "license": "MIT", "dependencies": { - "@babel/helper-plugin-utils": "^7.16.7" + "@babel/helper-module-transforms": "^7.25.9", + "@babel/helper-plugin-utils": "^7.25.9", + "@babel/helper-validator-identifier": "^7.25.9", + "@babel/traverse": "^7.25.9" }, "engines": { "node": ">=6.9.0" @@ -1117,14 +1100,15 @@ "@babel/core": "^7.0.0-0" } }, - "node_modules/@babel/plugin-transform-dotall-regex": { - "version": "7.16.7", - "resolved": "https://registry.npmjs.org/@babel/plugin-transform-dotall-regex/-/plugin-transform-dotall-regex-7.16.7.tgz", - "integrity": "sha512-Lyttaao2SjZF6Pf4vk1dVKv8YypMpomAbygW+mU5cYP3S5cWTfCJjG8xV6CFdzGFlfWK81IjL9viiTvpb6G7gQ==", + "node_modules/@babel/plugin-transform-modules-umd": { + "version": "7.25.9", + "resolved": "https://r.cnpmjs.org/@babel/plugin-transform-modules-umd/-/plugin-transform-modules-umd-7.25.9.tgz", + "integrity": "sha512-bS9MVObUgE7ww36HEfwe6g9WakQ0KF07mQF74uuXdkoziUPfKyu/nIm663kz//e5O1nPInPFx36z7WJmJ4yNEw==", "dev": true, + "license": "MIT", "dependencies": { - "@babel/helper-create-regexp-features-plugin": "^7.16.7", - "@babel/helper-plugin-utils": "^7.16.7" + "@babel/helper-module-transforms": "^7.25.9", + "@babel/helper-plugin-utils": "^7.25.9" }, "engines": { "node": ">=6.9.0" @@ -1133,29 +1117,31 @@ "@babel/core": "^7.0.0-0" } }, - "node_modules/@babel/plugin-transform-duplicate-keys": { - "version": "7.16.7", - "resolved": "https://registry.npmjs.org/@babel/plugin-transform-duplicate-keys/-/plugin-transform-duplicate-keys-7.16.7.tgz", - "integrity": "sha512-03DvpbRfvWIXyK0/6QiR1KMTWeT6OcQ7tbhjrXyFS02kjuX/mu5Bvnh5SDSWHxyawit2g5aWhKwI86EE7GUnTw==", + "node_modules/@babel/plugin-transform-named-capturing-groups-regex": { + "version": "7.25.9", + "resolved": "https://r.cnpmjs.org/@babel/plugin-transform-named-capturing-groups-regex/-/plugin-transform-named-capturing-groups-regex-7.25.9.tgz", + "integrity": "sha512-oqB6WHdKTGl3q/ItQhpLSnWWOpjUJLsOCLVyeFgeTktkBSCiurvPOsyt93gibI9CmuKvTUEtWmG5VhZD+5T/KA==", "dev": true, + "license": "MIT", "dependencies": { - "@babel/helper-plugin-utils": "^7.16.7" + "@babel/helper-create-regexp-features-plugin": "^7.25.9", + "@babel/helper-plugin-utils": "^7.25.9" }, "engines": { "node": ">=6.9.0" }, "peerDependencies": { - "@babel/core": "^7.0.0-0" + "@babel/core": "^7.0.0" } }, - "node_modules/@babel/plugin-transform-exponentiation-operator": { - "version": "7.16.7", - "resolved": "https://registry.npmjs.org/@babel/plugin-transform-exponentiation-operator/-/plugin-transform-exponentiation-operator-7.16.7.tgz", - "integrity": "sha512-8UYLSlyLgRixQvlYH3J2ekXFHDFLQutdy7FfFAMm3CPZ6q9wHCwnUyiXpQCe3gVVnQlHc5nsuiEVziteRNTXEA==", + "node_modules/@babel/plugin-transform-new-target": { + "version": "7.25.9", + "resolved": "https://r.cnpmjs.org/@babel/plugin-transform-new-target/-/plugin-transform-new-target-7.25.9.tgz", + "integrity": "sha512-U/3p8X1yCSoKyUj2eOBIx3FOn6pElFOKvAAGf8HTtItuPyB+ZeOqfn+mvTtg9ZlOAjsPdK3ayQEjqHjU/yLeVQ==", "dev": true, + "license": "MIT", "dependencies": { - "@babel/helper-builder-binary-assignment-operator-visitor": "^7.16.7", - "@babel/helper-plugin-utils": "^7.16.7" + "@babel/helper-plugin-utils": "^7.25.9" }, "engines": { "node": ">=6.9.0" @@ -1164,13 +1150,14 @@ "@babel/core": "^7.0.0-0" } }, - "node_modules/@babel/plugin-transform-for-of": { - "version": "7.16.7", - "resolved": "https://registry.npmjs.org/@babel/plugin-transform-for-of/-/plugin-transform-for-of-7.16.7.tgz", - "integrity": "sha512-/QZm9W92Ptpw7sjI9Nx1mbcsWz33+l8kuMIQnDwgQBG5s3fAfQvkRjQ7NqXhtNcKOnPkdICmUHyCaWW06HCsqg==", + "node_modules/@babel/plugin-transform-nullish-coalescing-operator": { + "version": "7.25.9", + "resolved": "https://r.cnpmjs.org/@babel/plugin-transform-nullish-coalescing-operator/-/plugin-transform-nullish-coalescing-operator-7.25.9.tgz", + "integrity": "sha512-ENfftpLZw5EItALAD4WsY/KUWvhUlZndm5GC7G3evUsVeSJB6p0pBeLQUnRnBCBx7zV0RKQjR9kCuwrsIrjWog==", "dev": true, + "license": "MIT", "dependencies": { - "@babel/helper-plugin-utils": "^7.16.7" + "@babel/helper-plugin-utils": "^7.25.9" }, "engines": { "node": ">=6.9.0" @@ -1179,15 +1166,14 @@ "@babel/core": "^7.0.0-0" } }, - "node_modules/@babel/plugin-transform-function-name": { - "version": "7.16.7", - "resolved": "https://registry.npmjs.org/@babel/plugin-transform-function-name/-/plugin-transform-function-name-7.16.7.tgz", - "integrity": "sha512-SU/C68YVwTRxqWj5kgsbKINakGag0KTgq9f2iZEXdStoAbOzLHEBRYzImmA6yFo8YZhJVflvXmIHUO7GWHmxxA==", + "node_modules/@babel/plugin-transform-numeric-separator": { + "version": "7.25.9", + "resolved": "https://r.cnpmjs.org/@babel/plugin-transform-numeric-separator/-/plugin-transform-numeric-separator-7.25.9.tgz", + "integrity": "sha512-TlprrJ1GBZ3r6s96Yq8gEQv82s8/5HnCVHtEJScUj90thHQbwe+E5MLhi2bbNHBEJuzrvltXSru+BUxHDoog7Q==", "dev": true, + "license": "MIT", "dependencies": { - "@babel/helper-compilation-targets": "^7.16.7", - "@babel/helper-function-name": "^7.16.7", - "@babel/helper-plugin-utils": "^7.16.7" + "@babel/helper-plugin-utils": "^7.25.9" }, "engines": { "node": ">=6.9.0" @@ -1196,13 +1182,16 @@ "@babel/core": "^7.0.0-0" } }, - "node_modules/@babel/plugin-transform-literals": { - "version": "7.16.7", - "resolved": "https://registry.npmjs.org/@babel/plugin-transform-literals/-/plugin-transform-literals-7.16.7.tgz", - "integrity": "sha512-6tH8RTpTWI0s2sV6uq3e/C9wPo4PTqqZps4uF0kzQ9/xPLFQtipynvmT1g/dOfEJ+0EQsHhkQ/zyRId8J2b8zQ==", + "node_modules/@babel/plugin-transform-object-rest-spread": { + "version": "7.25.9", + "resolved": "https://r.cnpmjs.org/@babel/plugin-transform-object-rest-spread/-/plugin-transform-object-rest-spread-7.25.9.tgz", + "integrity": "sha512-fSaXafEE9CVHPweLYw4J0emp1t8zYTXyzN3UuG+lylqkvYd7RMrsOQ8TYx5RF231be0vqtFC6jnx3UmpJmKBYg==", "dev": true, + "license": "MIT", "dependencies": { - "@babel/helper-plugin-utils": "^7.16.7" + "@babel/helper-compilation-targets": "^7.25.9", + "@babel/helper-plugin-utils": "^7.25.9", + "@babel/plugin-transform-parameters": "^7.25.9" }, "engines": { "node": ">=6.9.0" @@ -1211,13 +1200,15 @@ "@babel/core": "^7.0.0-0" } }, - "node_modules/@babel/plugin-transform-member-expression-literals": { - "version": "7.16.7", - "resolved": "https://registry.npmjs.org/@babel/plugin-transform-member-expression-literals/-/plugin-transform-member-expression-literals-7.16.7.tgz", - "integrity": "sha512-mBruRMbktKQwbxaJof32LT9KLy2f3gH+27a5XSuXo6h7R3vqltl0PgZ80C8ZMKw98Bf8bqt6BEVi3svOh2PzMw==", + "node_modules/@babel/plugin-transform-object-super": { + "version": "7.25.9", + "resolved": "https://r.cnpmjs.org/@babel/plugin-transform-object-super/-/plugin-transform-object-super-7.25.9.tgz", + "integrity": "sha512-Kj/Gh+Rw2RNLbCK1VAWj2U48yxxqL2x0k10nPtSdRa0O2xnHXalD0s+o1A6a0W43gJ00ANo38jxkQreckOzv5A==", "dev": true, + "license": "MIT", "dependencies": { - "@babel/helper-plugin-utils": "^7.16.7" + "@babel/helper-plugin-utils": "^7.25.9", + "@babel/helper-replace-supers": "^7.25.9" }, "engines": { "node": ">=6.9.0" @@ -1226,15 +1217,14 @@ "@babel/core": "^7.0.0-0" } }, - "node_modules/@babel/plugin-transform-modules-amd": { - "version": "7.16.7", - "resolved": "https://registry.npmjs.org/@babel/plugin-transform-modules-amd/-/plugin-transform-modules-amd-7.16.7.tgz", - "integrity": "sha512-KaaEtgBL7FKYwjJ/teH63oAmE3lP34N3kshz8mm4VMAw7U3PxjVwwUmxEFksbgsNUaO3wId9R2AVQYSEGRa2+g==", + "node_modules/@babel/plugin-transform-optional-catch-binding": { + "version": "7.25.9", + "resolved": "https://r.cnpmjs.org/@babel/plugin-transform-optional-catch-binding/-/plugin-transform-optional-catch-binding-7.25.9.tgz", + "integrity": "sha512-qM/6m6hQZzDcZF3onzIhZeDHDO43bkNNlOX0i8n3lR6zLbu0GN2d8qfM/IERJZYauhAHSLHy39NF0Ctdvcid7g==", "dev": true, + "license": "MIT", "dependencies": { - "@babel/helper-module-transforms": "^7.16.7", - "@babel/helper-plugin-utils": "^7.16.7", - "babel-plugin-dynamic-import-node": "^2.3.3" + "@babel/helper-plugin-utils": "^7.25.9" }, "engines": { "node": ">=6.9.0" @@ -1243,16 +1233,15 @@ "@babel/core": "^7.0.0-0" } }, - "node_modules/@babel/plugin-transform-modules-commonjs": { - "version": "7.16.8", - "resolved": "https://registry.npmjs.org/@babel/plugin-transform-modules-commonjs/-/plugin-transform-modules-commonjs-7.16.8.tgz", - "integrity": "sha512-oflKPvsLT2+uKQopesJt3ApiaIS2HW+hzHFcwRNtyDGieAeC/dIHZX8buJQ2J2X1rxGPy4eRcUijm3qcSPjYcA==", + "node_modules/@babel/plugin-transform-optional-chaining": { + "version": "7.25.9", + "resolved": "https://r.cnpmjs.org/@babel/plugin-transform-optional-chaining/-/plugin-transform-optional-chaining-7.25.9.tgz", + "integrity": "sha512-6AvV0FsLULbpnXeBjrY4dmWF8F7gf8QnvTEoO/wX/5xm/xE1Xo8oPuD3MPS+KS9f9XBEAWN7X1aWr4z9HdOr7A==", "dev": true, + "license": "MIT", "dependencies": { - "@babel/helper-module-transforms": "^7.16.7", - "@babel/helper-plugin-utils": "^7.16.7", - "@babel/helper-simple-access": "^7.16.7", - "babel-plugin-dynamic-import-node": "^2.3.3" + "@babel/helper-plugin-utils": "^7.25.9", + "@babel/helper-skip-transparent-expression-wrappers": "^7.25.9" }, "engines": { "node": ">=6.9.0" @@ -1261,17 +1250,14 @@ "@babel/core": "^7.0.0-0" } }, - "node_modules/@babel/plugin-transform-modules-systemjs": { - "version": "7.16.7", - "resolved": "https://registry.npmjs.org/@babel/plugin-transform-modules-systemjs/-/plugin-transform-modules-systemjs-7.16.7.tgz", - "integrity": "sha512-DuK5E3k+QQmnOqBR9UkusByy5WZWGRxfzV529s9nPra1GE7olmxfqO2FHobEOYSPIjPBTr4p66YDcjQnt8cBmw==", + "node_modules/@babel/plugin-transform-parameters": { + "version": "7.25.9", + "resolved": "https://r.cnpmjs.org/@babel/plugin-transform-parameters/-/plugin-transform-parameters-7.25.9.tgz", + "integrity": "sha512-wzz6MKwpnshBAiRmn4jR8LYz/g8Ksg0o80XmwZDlordjwEk9SxBzTWC7F5ef1jhbrbOW2DJ5J6ayRukrJmnr0g==", "dev": true, + "license": "MIT", "dependencies": { - "@babel/helper-hoist-variables": "^7.16.7", - "@babel/helper-module-transforms": "^7.16.7", - "@babel/helper-plugin-utils": "^7.16.7", - "@babel/helper-validator-identifier": "^7.16.7", - "babel-plugin-dynamic-import-node": "^2.3.3" + "@babel/helper-plugin-utils": "^7.25.9" }, "engines": { "node": ">=6.9.0" @@ -1280,14 +1266,15 @@ "@babel/core": "^7.0.0-0" } }, - "node_modules/@babel/plugin-transform-modules-umd": { - "version": "7.16.7", - "resolved": "https://registry.npmjs.org/@babel/plugin-transform-modules-umd/-/plugin-transform-modules-umd-7.16.7.tgz", - "integrity": "sha512-EMh7uolsC8O4xhudF2F6wedbSHm1HHZ0C6aJ7K67zcDNidMzVcxWdGr+htW9n21klm+bOn+Rx4CBsAntZd3rEQ==", + "node_modules/@babel/plugin-transform-private-methods": { + "version": "7.25.9", + "resolved": "https://r.cnpmjs.org/@babel/plugin-transform-private-methods/-/plugin-transform-private-methods-7.25.9.tgz", + "integrity": "sha512-D/JUozNpQLAPUVusvqMxyvjzllRaF8/nSrP1s2YGQT/W4LHK4xxsMcHjhOGTS01mp9Hda8nswb+FblLdJornQw==", "dev": true, + "license": "MIT", "dependencies": { - "@babel/helper-module-transforms": "^7.16.7", - "@babel/helper-plugin-utils": "^7.16.7" + "@babel/helper-create-class-features-plugin": "^7.25.9", + "@babel/helper-plugin-utils": "^7.25.9" }, "engines": { "node": ">=6.9.0" @@ -1296,28 +1283,32 @@ "@babel/core": "^7.0.0-0" } }, - "node_modules/@babel/plugin-transform-named-capturing-groups-regex": { - "version": "7.16.8", - "resolved": "https://registry.npmjs.org/@babel/plugin-transform-named-capturing-groups-regex/-/plugin-transform-named-capturing-groups-regex-7.16.8.tgz", - "integrity": "sha512-j3Jw+n5PvpmhRR+mrgIh04puSANCk/T/UA3m3P1MjJkhlK906+ApHhDIqBQDdOgL/r1UYpz4GNclTXxyZrYGSw==", + "node_modules/@babel/plugin-transform-private-property-in-object": { + "version": "7.25.9", + "resolved": "https://r.cnpmjs.org/@babel/plugin-transform-private-property-in-object/-/plugin-transform-private-property-in-object-7.25.9.tgz", + "integrity": "sha512-Evf3kcMqzXA3xfYJmZ9Pg1OvKdtqsDMSWBDzZOPLvHiTt36E75jLDQo5w1gtRU95Q4E5PDttrTf25Fw8d/uWLw==", "dev": true, + "license": "MIT", "dependencies": { - "@babel/helper-create-regexp-features-plugin": "^7.16.7" + "@babel/helper-annotate-as-pure": "^7.25.9", + "@babel/helper-create-class-features-plugin": "^7.25.9", + "@babel/helper-plugin-utils": "^7.25.9" }, "engines": { "node": ">=6.9.0" }, "peerDependencies": { - "@babel/core": "^7.0.0" + "@babel/core": "^7.0.0-0" } }, - "node_modules/@babel/plugin-transform-new-target": { - "version": "7.16.7", - "resolved": "https://registry.npmjs.org/@babel/plugin-transform-new-target/-/plugin-transform-new-target-7.16.7.tgz", - "integrity": "sha512-xiLDzWNMfKoGOpc6t3U+etCE2yRnn3SM09BXqWPIZOBpL2gvVrBWUKnsJx0K/ADi5F5YC5f8APFfWrz25TdlGg==", + "node_modules/@babel/plugin-transform-property-literals": { + "version": "7.25.9", + "resolved": "https://r.cnpmjs.org/@babel/plugin-transform-property-literals/-/plugin-transform-property-literals-7.25.9.tgz", + "integrity": "sha512-IvIUeV5KrS/VPavfSM/Iu+RE6llrHrYIKY1yfCzyO/lMXHQ+p7uGhonmGVisv6tSBSVgWzMBohTcvkC9vQcQFA==", "dev": true, + "license": "MIT", "dependencies": { - "@babel/helper-plugin-utils": "^7.16.7" + "@babel/helper-plugin-utils": "^7.25.9" }, "engines": { "node": ">=6.9.0" @@ -1326,14 +1317,15 @@ "@babel/core": "^7.0.0-0" } }, - "node_modules/@babel/plugin-transform-object-super": { - "version": "7.16.7", - "resolved": "https://registry.npmjs.org/@babel/plugin-transform-object-super/-/plugin-transform-object-super-7.16.7.tgz", - "integrity": "sha512-14J1feiQVWaGvRxj2WjyMuXS2jsBkgB3MdSN5HuC2G5nRspa5RK9COcs82Pwy5BuGcjb+fYaUj94mYcOj7rCvw==", + "node_modules/@babel/plugin-transform-regenerator": { + "version": "7.25.9", + "resolved": "https://r.cnpmjs.org/@babel/plugin-transform-regenerator/-/plugin-transform-regenerator-7.25.9.tgz", + "integrity": "sha512-vwDcDNsgMPDGP0nMqzahDWE5/MLcX8sv96+wfX7as7LoF/kr97Bo/7fI00lXY4wUXYfVmwIIyG80fGZ1uvt2qg==", "dev": true, + "license": "MIT", "dependencies": { - "@babel/helper-plugin-utils": "^7.16.7", - "@babel/helper-replace-supers": "^7.16.7" + "@babel/helper-plugin-utils": "^7.25.9", + "regenerator-transform": "^0.15.2" }, "engines": { "node": ">=6.9.0" @@ -1342,28 +1334,31 @@ "@babel/core": "^7.0.0-0" } }, - "node_modules/@babel/plugin-transform-parameters": { - "version": "7.16.7", - "resolved": "https://registry.npmjs.org/@babel/plugin-transform-parameters/-/plugin-transform-parameters-7.16.7.tgz", - "integrity": "sha512-AT3MufQ7zZEhU2hwOA11axBnExW0Lszu4RL/tAlUJBuNoRak+wehQW8h6KcXOcgjY42fHtDxswuMhMjFEuv/aw==", + "node_modules/@babel/plugin-transform-regexp-modifiers": { + "version": "7.26.0", + "resolved": "https://r.cnpmjs.org/@babel/plugin-transform-regexp-modifiers/-/plugin-transform-regexp-modifiers-7.26.0.tgz", + "integrity": "sha512-vN6saax7lrA2yA/Pak3sCxuD6F5InBjn9IcrIKQPjpsLvuHYLVroTxjdlVRHjjBWxKOqIwpTXDkOssYT4BFdRw==", "dev": true, + "license": "MIT", "dependencies": { - "@babel/helper-plugin-utils": "^7.16.7" + "@babel/helper-create-regexp-features-plugin": "^7.25.9", + "@babel/helper-plugin-utils": "^7.25.9" }, "engines": { "node": ">=6.9.0" }, "peerDependencies": { - "@babel/core": "^7.0.0-0" + "@babel/core": "^7.0.0" } }, - "node_modules/@babel/plugin-transform-property-literals": { - "version": "7.16.7", - "resolved": "https://registry.npmjs.org/@babel/plugin-transform-property-literals/-/plugin-transform-property-literals-7.16.7.tgz", - "integrity": "sha512-z4FGr9NMGdoIl1RqavCqGG+ZuYjfZ/hkCIeuH6Do7tXmSm0ls11nYVSJqFEUOSJbDab5wC6lRE/w6YjVcr6Hqw==", + "node_modules/@babel/plugin-transform-reserved-words": { + "version": "7.25.9", + "resolved": "https://r.cnpmjs.org/@babel/plugin-transform-reserved-words/-/plugin-transform-reserved-words-7.25.9.tgz", + "integrity": "sha512-7DL7DKYjn5Su++4RXu8puKZm2XBPHyjWLUidaPEkCUBbE7IPcsrkRHggAOOKydH1dASWdcUBxrkOGNxUv5P3Jg==", "dev": true, + "license": "MIT", "dependencies": { - "@babel/helper-plugin-utils": "^7.16.7" + "@babel/helper-plugin-utils": "^7.25.9" }, "engines": { "node": ">=6.9.0" @@ -1372,13 +1367,14 @@ "@babel/core": "^7.0.0-0" } }, - "node_modules/@babel/plugin-transform-regenerator": { - "version": "7.16.7", - "resolved": "https://registry.npmjs.org/@babel/plugin-transform-regenerator/-/plugin-transform-regenerator-7.16.7.tgz", - "integrity": "sha512-mF7jOgGYCkSJagJ6XCujSQg+6xC1M77/03K2oBmVJWoFGNUtnVJO4WHKJk3dnPC8HCcj4xBQP1Egm8DWh3Pb3Q==", + "node_modules/@babel/plugin-transform-shorthand-properties": { + "version": "7.25.9", + "resolved": "https://r.cnpmjs.org/@babel/plugin-transform-shorthand-properties/-/plugin-transform-shorthand-properties-7.25.9.tgz", + "integrity": "sha512-MUv6t0FhO5qHnS/W8XCbHmiRWOphNufpE1IVxhK5kuN3Td9FT1x4rx4K42s3RYdMXCXpfWkGSbCSd0Z64xA7Ng==", "dev": true, + "license": "MIT", "dependencies": { - "regenerator-transform": "^0.14.2" + "@babel/helper-plugin-utils": "^7.25.9" }, "engines": { "node": ">=6.9.0" @@ -1387,13 +1383,15 @@ "@babel/core": "^7.0.0-0" } }, - "node_modules/@babel/plugin-transform-reserved-words": { - "version": "7.16.7", - "resolved": "https://registry.npmjs.org/@babel/plugin-transform-reserved-words/-/plugin-transform-reserved-words-7.16.7.tgz", - "integrity": "sha512-KQzzDnZ9hWQBjwi5lpY5v9shmm6IVG0U9pB18zvMu2i4H90xpT4gmqwPYsn8rObiadYe2M0gmgsiOIF5A/2rtg==", + "node_modules/@babel/plugin-transform-spread": { + "version": "7.25.9", + "resolved": "https://r.cnpmjs.org/@babel/plugin-transform-spread/-/plugin-transform-spread-7.25.9.tgz", + "integrity": "sha512-oNknIB0TbURU5pqJFVbOOFspVlrpVwo2H1+HUIsVDvp5VauGGDP1ZEvO8Nn5xyMEs3dakajOxlmkNW7kNgSm6A==", "dev": true, + "license": "MIT", "dependencies": { - "@babel/helper-plugin-utils": "^7.16.7" + "@babel/helper-plugin-utils": "^7.25.9", + "@babel/helper-skip-transparent-expression-wrappers": "^7.25.9" }, "engines": { "node": ">=6.9.0" @@ -1402,13 +1400,14 @@ "@babel/core": "^7.0.0-0" } }, - "node_modules/@babel/plugin-transform-shorthand-properties": { - "version": "7.16.7", - "resolved": "https://registry.npmjs.org/@babel/plugin-transform-shorthand-properties/-/plugin-transform-shorthand-properties-7.16.7.tgz", - "integrity": "sha512-hah2+FEnoRoATdIb05IOXf+4GzXYTq75TVhIn1PewihbpyrNWUt2JbudKQOETWw6QpLe+AIUpJ5MVLYTQbeeUg==", + "node_modules/@babel/plugin-transform-sticky-regex": { + "version": "7.25.9", + "resolved": "https://r.cnpmjs.org/@babel/plugin-transform-sticky-regex/-/plugin-transform-sticky-regex-7.25.9.tgz", + "integrity": "sha512-WqBUSgeVwucYDP9U/xNRQam7xV8W5Zf+6Eo7T2SRVUFlhRiMNFdFz58u0KZmCVVqs2i7SHgpRnAhzRNmKfi2uA==", "dev": true, + "license": "MIT", "dependencies": { - "@babel/helper-plugin-utils": "^7.16.7" + "@babel/helper-plugin-utils": "^7.25.9" }, "engines": { "node": ">=6.9.0" @@ -1417,14 +1416,14 @@ "@babel/core": "^7.0.0-0" } }, - "node_modules/@babel/plugin-transform-spread": { - "version": "7.16.7", - "resolved": "https://registry.npmjs.org/@babel/plugin-transform-spread/-/plugin-transform-spread-7.16.7.tgz", - "integrity": "sha512-+pjJpgAngb53L0iaA5gU/1MLXJIfXcYepLgXB3esVRf4fqmj8f2cxM3/FKaHsZms08hFQJkFccEWuIpm429TXg==", + "node_modules/@babel/plugin-transform-template-literals": { + "version": "7.25.9", + "resolved": "https://r.cnpmjs.org/@babel/plugin-transform-template-literals/-/plugin-transform-template-literals-7.25.9.tgz", + "integrity": "sha512-o97AE4syN71M/lxrCtQByzphAdlYluKPDBzDVzMmfCobUjjhAryZV0AIpRPrxN0eAkxXO6ZLEScmt+PNhj2OTw==", "dev": true, + "license": "MIT", "dependencies": { - "@babel/helper-plugin-utils": "^7.16.7", - "@babel/helper-skip-transparent-expression-wrappers": "^7.16.0" + "@babel/helper-plugin-utils": "^7.25.9" }, "engines": { "node": ">=6.9.0" @@ -1433,13 +1432,14 @@ "@babel/core": "^7.0.0-0" } }, - "node_modules/@babel/plugin-transform-sticky-regex": { - "version": "7.16.7", - "resolved": "https://registry.npmjs.org/@babel/plugin-transform-sticky-regex/-/plugin-transform-sticky-regex-7.16.7.tgz", - "integrity": "sha512-NJa0Bd/87QV5NZZzTuZG5BPJjLYadeSZ9fO6oOUoL4iQx+9EEuw/eEM92SrsT19Yc2jgB1u1hsjqDtH02c3Drw==", + "node_modules/@babel/plugin-transform-typeof-symbol": { + "version": "7.25.9", + "resolved": "https://r.cnpmjs.org/@babel/plugin-transform-typeof-symbol/-/plugin-transform-typeof-symbol-7.25.9.tgz", + "integrity": "sha512-v61XqUMiueJROUv66BVIOi0Fv/CUuZuZMl5NkRoCVxLAnMexZ0A3kMe7vvZ0nulxMuMp0Mk6S5hNh48yki08ZA==", "dev": true, + "license": "MIT", "dependencies": { - "@babel/helper-plugin-utils": "^7.16.7" + "@babel/helper-plugin-utils": "^7.25.9" }, "engines": { "node": ">=6.9.0" @@ -1448,13 +1448,14 @@ "@babel/core": "^7.0.0-0" } }, - "node_modules/@babel/plugin-transform-template-literals": { - "version": "7.16.7", - "resolved": "https://registry.npmjs.org/@babel/plugin-transform-template-literals/-/plugin-transform-template-literals-7.16.7.tgz", - "integrity": "sha512-VwbkDDUeenlIjmfNeDX/V0aWrQH2QiVyJtwymVQSzItFDTpxfyJh3EVaQiS0rIN/CqbLGr0VcGmuwyTdZtdIsA==", + "node_modules/@babel/plugin-transform-unicode-escapes": { + "version": "7.25.9", + "resolved": "https://r.cnpmjs.org/@babel/plugin-transform-unicode-escapes/-/plugin-transform-unicode-escapes-7.25.9.tgz", + "integrity": "sha512-s5EDrE6bW97LtxOcGj1Khcx5AaXwiMmi4toFWRDP9/y0Woo6pXC+iyPu/KuhKtfSrNFd7jJB+/fkOtZy6aIC6Q==", "dev": true, + "license": "MIT", "dependencies": { - "@babel/helper-plugin-utils": "^7.16.7" + "@babel/helper-plugin-utils": "^7.25.9" }, "engines": { "node": ">=6.9.0" @@ -1463,13 +1464,15 @@ "@babel/core": "^7.0.0-0" } }, - "node_modules/@babel/plugin-transform-typeof-symbol": { - "version": "7.16.7", - "resolved": "https://registry.npmjs.org/@babel/plugin-transform-typeof-symbol/-/plugin-transform-typeof-symbol-7.16.7.tgz", - "integrity": "sha512-p2rOixCKRJzpg9JB4gjnG4gjWkWa89ZoYUnl9snJ1cWIcTH/hvxZqfO+WjG6T8DRBpctEol5jw1O5rA8gkCokQ==", + "node_modules/@babel/plugin-transform-unicode-property-regex": { + "version": "7.25.9", + "resolved": "https://r.cnpmjs.org/@babel/plugin-transform-unicode-property-regex/-/plugin-transform-unicode-property-regex-7.25.9.tgz", + "integrity": "sha512-Jt2d8Ga+QwRluxRQ307Vlxa6dMrYEMZCgGxoPR8V52rxPyldHu3hdlHspxaqYmE7oID5+kB+UKUB/eWS+DkkWg==", "dev": true, + "license": "MIT", "dependencies": { - "@babel/helper-plugin-utils": "^7.16.7" + "@babel/helper-create-regexp-features-plugin": "^7.25.9", + "@babel/helper-plugin-utils": "^7.25.9" }, "engines": { "node": ">=6.9.0" @@ -1478,13 +1481,15 @@ "@babel/core": "^7.0.0-0" } }, - "node_modules/@babel/plugin-transform-unicode-escapes": { - "version": "7.16.7", - "resolved": "https://registry.npmjs.org/@babel/plugin-transform-unicode-escapes/-/plugin-transform-unicode-escapes-7.16.7.tgz", - "integrity": "sha512-TAV5IGahIz3yZ9/Hfv35TV2xEm+kaBDaZQCn2S/hG9/CZ0DktxJv9eKfPc7yYCvOYR4JGx1h8C+jcSOvgaaI/Q==", + "node_modules/@babel/plugin-transform-unicode-regex": { + "version": "7.25.9", + "resolved": "https://r.cnpmjs.org/@babel/plugin-transform-unicode-regex/-/plugin-transform-unicode-regex-7.25.9.tgz", + "integrity": "sha512-yoxstj7Rg9dlNn9UQxzk4fcNivwv4nUYz7fYXBaKxvw/lnmPuOm/ikoELygbYq68Bls3D/D+NBPHiLwZdZZ4HA==", "dev": true, + "license": "MIT", "dependencies": { - "@babel/helper-plugin-utils": "^7.16.7" + "@babel/helper-create-regexp-features-plugin": "^7.25.9", + "@babel/helper-plugin-utils": "^7.25.9" }, "engines": { "node": ">=6.9.0" @@ -1493,102 +1498,99 @@ "@babel/core": "^7.0.0-0" } }, - "node_modules/@babel/plugin-transform-unicode-regex": { - "version": "7.16.7", - "resolved": "https://registry.npmjs.org/@babel/plugin-transform-unicode-regex/-/plugin-transform-unicode-regex-7.16.7.tgz", - "integrity": "sha512-oC5tYYKw56HO75KZVLQ+R/Nl3Hro9kf8iG0hXoaHP7tjAyCpvqBiSNe6vGrZni1Z6MggmUOC6A7VP7AVmw225Q==", + "node_modules/@babel/plugin-transform-unicode-sets-regex": { + "version": "7.25.9", + "resolved": "https://r.cnpmjs.org/@babel/plugin-transform-unicode-sets-regex/-/plugin-transform-unicode-sets-regex-7.25.9.tgz", + "integrity": "sha512-8BYqO3GeVNHtx69fdPshN3fnzUNLrWdHhk/icSwigksJGczKSizZ+Z6SBCxTs723Fr5VSNorTIK7a+R2tISvwQ==", "dev": true, + "license": "MIT", "dependencies": { - "@babel/helper-create-regexp-features-plugin": "^7.16.7", - "@babel/helper-plugin-utils": "^7.16.7" + "@babel/helper-create-regexp-features-plugin": "^7.25.9", + "@babel/helper-plugin-utils": "^7.25.9" }, "engines": { "node": ">=6.9.0" }, "peerDependencies": { - "@babel/core": "^7.0.0-0" + "@babel/core": "^7.0.0" } }, "node_modules/@babel/preset-env": { - "version": "7.16.8", - "resolved": "https://registry.npmjs.org/@babel/preset-env/-/preset-env-7.16.8.tgz", - "integrity": "sha512-9rNKgVCdwHb3z1IlbMyft6yIXIeP3xz6vWvGaLHrJThuEIqWfHb0DNBH9VuTgnDfdbUDhkmkvMZS/YMCtP7Elg==", - "dev": true, - "dependencies": { - "@babel/compat-data": "^7.16.8", - "@babel/helper-compilation-targets": "^7.16.7", - "@babel/helper-plugin-utils": "^7.16.7", - "@babel/helper-validator-option": "^7.16.7", - "@babel/plugin-bugfix-safari-id-destructuring-collision-in-function-expression": "^7.16.7", - "@babel/plugin-bugfix-v8-spread-parameters-in-optional-chaining": "^7.16.7", - "@babel/plugin-proposal-async-generator-functions": "^7.16.8", - "@babel/plugin-proposal-class-properties": "^7.16.7", - "@babel/plugin-proposal-class-static-block": "^7.16.7", - "@babel/plugin-proposal-dynamic-import": "^7.16.7", - "@babel/plugin-proposal-export-namespace-from": "^7.16.7", - "@babel/plugin-proposal-json-strings": "^7.16.7", - "@babel/plugin-proposal-logical-assignment-operators": "^7.16.7", - "@babel/plugin-proposal-nullish-coalescing-operator": "^7.16.7", - "@babel/plugin-proposal-numeric-separator": "^7.16.7", - "@babel/plugin-proposal-object-rest-spread": "^7.16.7", - "@babel/plugin-proposal-optional-catch-binding": "^7.16.7", - "@babel/plugin-proposal-optional-chaining": "^7.16.7", - "@babel/plugin-proposal-private-methods": "^7.16.7", - "@babel/plugin-proposal-private-property-in-object": "^7.16.7", - "@babel/plugin-proposal-unicode-property-regex": "^7.16.7", - "@babel/plugin-syntax-async-generators": "^7.8.4", - "@babel/plugin-syntax-class-properties": "^7.12.13", - "@babel/plugin-syntax-class-static-block": "^7.14.5", - "@babel/plugin-syntax-dynamic-import": "^7.8.3", - "@babel/plugin-syntax-export-namespace-from": "^7.8.3", - "@babel/plugin-syntax-json-strings": "^7.8.3", - "@babel/plugin-syntax-logical-assignment-operators": "^7.10.4", - "@babel/plugin-syntax-nullish-coalescing-operator": "^7.8.3", - "@babel/plugin-syntax-numeric-separator": "^7.10.4", - "@babel/plugin-syntax-object-rest-spread": "^7.8.3", - "@babel/plugin-syntax-optional-catch-binding": "^7.8.3", - "@babel/plugin-syntax-optional-chaining": "^7.8.3", - "@babel/plugin-syntax-private-property-in-object": "^7.14.5", - "@babel/plugin-syntax-top-level-await": "^7.14.5", - "@babel/plugin-transform-arrow-functions": "^7.16.7", - "@babel/plugin-transform-async-to-generator": "^7.16.8", - "@babel/plugin-transform-block-scoped-functions": "^7.16.7", - "@babel/plugin-transform-block-scoping": "^7.16.7", - "@babel/plugin-transform-classes": "^7.16.7", - "@babel/plugin-transform-computed-properties": "^7.16.7", - "@babel/plugin-transform-destructuring": "^7.16.7", - "@babel/plugin-transform-dotall-regex": "^7.16.7", - "@babel/plugin-transform-duplicate-keys": "^7.16.7", - "@babel/plugin-transform-exponentiation-operator": "^7.16.7", - "@babel/plugin-transform-for-of": "^7.16.7", - "@babel/plugin-transform-function-name": "^7.16.7", - "@babel/plugin-transform-literals": "^7.16.7", - "@babel/plugin-transform-member-expression-literals": "^7.16.7", - "@babel/plugin-transform-modules-amd": "^7.16.7", - "@babel/plugin-transform-modules-commonjs": "^7.16.8", - "@babel/plugin-transform-modules-systemjs": "^7.16.7", - "@babel/plugin-transform-modules-umd": "^7.16.7", - "@babel/plugin-transform-named-capturing-groups-regex": "^7.16.8", - "@babel/plugin-transform-new-target": "^7.16.7", - "@babel/plugin-transform-object-super": "^7.16.7", - "@babel/plugin-transform-parameters": "^7.16.7", - "@babel/plugin-transform-property-literals": "^7.16.7", - "@babel/plugin-transform-regenerator": "^7.16.7", - "@babel/plugin-transform-reserved-words": "^7.16.7", - "@babel/plugin-transform-shorthand-properties": "^7.16.7", - "@babel/plugin-transform-spread": "^7.16.7", - "@babel/plugin-transform-sticky-regex": "^7.16.7", - "@babel/plugin-transform-template-literals": "^7.16.7", - "@babel/plugin-transform-typeof-symbol": "^7.16.7", - "@babel/plugin-transform-unicode-escapes": "^7.16.7", - "@babel/plugin-transform-unicode-regex": "^7.16.7", - "@babel/preset-modules": "^0.1.5", - "@babel/types": "^7.16.8", - "babel-plugin-polyfill-corejs2": "^0.3.0", - "babel-plugin-polyfill-corejs3": "^0.5.0", - "babel-plugin-polyfill-regenerator": "^0.3.0", - "core-js-compat": "^3.20.2", - "semver": "^6.3.0" + "version": "7.26.0", + "resolved": "https://r.cnpmjs.org/@babel/preset-env/-/preset-env-7.26.0.tgz", + "integrity": "sha512-H84Fxq0CQJNdPFT2DrfnylZ3cf5K43rGfWK4LJGPpjKHiZlk0/RzwEus3PDDZZg+/Er7lCA03MVacueUuXdzfw==", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/compat-data": "^7.26.0", + "@babel/helper-compilation-targets": "^7.25.9", + "@babel/helper-plugin-utils": "^7.25.9", + "@babel/helper-validator-option": "^7.25.9", + "@babel/plugin-bugfix-firefox-class-in-computed-class-key": "^7.25.9", + "@babel/plugin-bugfix-safari-class-field-initializer-scope": "^7.25.9", + "@babel/plugin-bugfix-safari-id-destructuring-collision-in-function-expression": "^7.25.9", + "@babel/plugin-bugfix-v8-spread-parameters-in-optional-chaining": "^7.25.9", + "@babel/plugin-bugfix-v8-static-class-fields-redefine-readonly": "^7.25.9", + "@babel/plugin-proposal-private-property-in-object": "7.21.0-placeholder-for-preset-env.2", + "@babel/plugin-syntax-import-assertions": "^7.26.0", + "@babel/plugin-syntax-import-attributes": "^7.26.0", + "@babel/plugin-syntax-unicode-sets-regex": "^7.18.6", + "@babel/plugin-transform-arrow-functions": "^7.25.9", + "@babel/plugin-transform-async-generator-functions": "^7.25.9", + "@babel/plugin-transform-async-to-generator": "^7.25.9", + "@babel/plugin-transform-block-scoped-functions": "^7.25.9", + "@babel/plugin-transform-block-scoping": "^7.25.9", + "@babel/plugin-transform-class-properties": "^7.25.9", + "@babel/plugin-transform-class-static-block": "^7.26.0", + "@babel/plugin-transform-classes": "^7.25.9", + "@babel/plugin-transform-computed-properties": "^7.25.9", + "@babel/plugin-transform-destructuring": "^7.25.9", + "@babel/plugin-transform-dotall-regex": "^7.25.9", + "@babel/plugin-transform-duplicate-keys": "^7.25.9", + "@babel/plugin-transform-duplicate-named-capturing-groups-regex": "^7.25.9", + "@babel/plugin-transform-dynamic-import": "^7.25.9", + "@babel/plugin-transform-exponentiation-operator": "^7.25.9", + "@babel/plugin-transform-export-namespace-from": "^7.25.9", + "@babel/plugin-transform-for-of": "^7.25.9", + "@babel/plugin-transform-function-name": "^7.25.9", + "@babel/plugin-transform-json-strings": "^7.25.9", + "@babel/plugin-transform-literals": "^7.25.9", + "@babel/plugin-transform-logical-assignment-operators": "^7.25.9", + "@babel/plugin-transform-member-expression-literals": "^7.25.9", + "@babel/plugin-transform-modules-amd": "^7.25.9", + "@babel/plugin-transform-modules-commonjs": "^7.25.9", + "@babel/plugin-transform-modules-systemjs": "^7.25.9", + "@babel/plugin-transform-modules-umd": "^7.25.9", + "@babel/plugin-transform-named-capturing-groups-regex": "^7.25.9", + "@babel/plugin-transform-new-target": "^7.25.9", + "@babel/plugin-transform-nullish-coalescing-operator": "^7.25.9", + "@babel/plugin-transform-numeric-separator": "^7.25.9", + "@babel/plugin-transform-object-rest-spread": "^7.25.9", + "@babel/plugin-transform-object-super": "^7.25.9", + "@babel/plugin-transform-optional-catch-binding": "^7.25.9", + "@babel/plugin-transform-optional-chaining": "^7.25.9", + "@babel/plugin-transform-parameters": "^7.25.9", + "@babel/plugin-transform-private-methods": "^7.25.9", + "@babel/plugin-transform-private-property-in-object": "^7.25.9", + "@babel/plugin-transform-property-literals": "^7.25.9", + "@babel/plugin-transform-regenerator": "^7.25.9", + "@babel/plugin-transform-regexp-modifiers": "^7.26.0", + "@babel/plugin-transform-reserved-words": "^7.25.9", + "@babel/plugin-transform-shorthand-properties": "^7.25.9", + "@babel/plugin-transform-spread": "^7.25.9", + "@babel/plugin-transform-sticky-regex": "^7.25.9", + "@babel/plugin-transform-template-literals": "^7.25.9", + "@babel/plugin-transform-typeof-symbol": "^7.25.9", + "@babel/plugin-transform-unicode-escapes": "^7.25.9", + "@babel/plugin-transform-unicode-property-regex": "^7.25.9", + "@babel/plugin-transform-unicode-regex": "^7.25.9", + "@babel/plugin-transform-unicode-sets-regex": "^7.25.9", + "@babel/preset-modules": "0.1.6-no-external-plugins", + "babel-plugin-polyfill-corejs2": "^0.4.10", + "babel-plugin-polyfill-corejs3": "^0.10.6", + "babel-plugin-polyfill-regenerator": "^0.6.1", + "core-js-compat": "^3.38.1", + "semver": "^6.3.1" }, "engines": { "node": ">=6.9.0" @@ -1598,19 +1600,18 @@ } }, "node_modules/@babel/preset-modules": { - "version": "0.1.5", - "resolved": "https://registry.npmjs.org/@babel/preset-modules/-/preset-modules-0.1.5.tgz", - "integrity": "sha512-A57th6YRG7oR3cq/yt/Y84MvGgE0eJG2F1JLhKuyG+jFxEgrd/HAMJatiFtmOiZurz+0DkrvbheCLaV5f2JfjA==", + "version": "0.1.6-no-external-plugins", + "resolved": "https://r.cnpmjs.org/@babel/preset-modules/-/preset-modules-0.1.6-no-external-plugins.tgz", + "integrity": "sha512-HrcgcIESLm9aIR842yhJ5RWan/gebQUJ6E/E5+rf0y9o6oj7w0Br+sWuL6kEQ/o/AdfvR1Je9jG18/gnpwjEyA==", "dev": true, + "license": "MIT", "dependencies": { "@babel/helper-plugin-utils": "^7.0.0", - "@babel/plugin-proposal-unicode-property-regex": "^7.4.4", - "@babel/plugin-transform-dotall-regex": "^7.4.4", "@babel/types": "^7.4.4", "esutils": "^2.0.2" }, "peerDependencies": { - "@babel/core": "^7.0.0-0" + "@babel/core": "^7.0.0-0 || ^8.0.0-0 <8.0.0" } }, "node_modules/@babel/runtime": { @@ -1626,34 +1627,33 @@ } }, "node_modules/@babel/template": { - "version": "7.16.7", - "resolved": "https://registry.npmjs.org/@babel/template/-/template-7.16.7.tgz", - "integrity": "sha512-I8j/x8kHUrbYRTUxXrrMbfCa7jxkE7tZre39x3kjr9hvI82cK1FfqLygotcWN5kdPGWcLdWMHpSBavse5tWw3w==", + "version": "7.25.9", + "resolved": "https://r.cnpmjs.org/@babel/template/-/template-7.25.9.tgz", + "integrity": "sha512-9DGttpmPvIxBb/2uwpVo3dqJ+O6RooAFOS+lB+xDqoE2PVCE8nfoHMdZLpfCQRLwvohzXISPZcgxt80xLfsuwg==", "dev": true, + "license": "MIT", "dependencies": { - "@babel/code-frame": "^7.16.7", - "@babel/parser": "^7.16.7", - "@babel/types": "^7.16.7" + "@babel/code-frame": "^7.25.9", + "@babel/parser": "^7.25.9", + "@babel/types": "^7.25.9" }, "engines": { "node": ">=6.9.0" } }, "node_modules/@babel/traverse": { - "version": "7.16.8", - "resolved": "https://registry.npmjs.org/@babel/traverse/-/traverse-7.16.8.tgz", - "integrity": "sha512-xe+H7JlvKsDQwXRsBhSnq1/+9c+LlQcCK3Tn/l5sbx02HYns/cn7ibp9+RV1sIUqu7hKg91NWsgHurO9dowITQ==", - "dev": true, - "dependencies": { - "@babel/code-frame": "^7.16.7", - "@babel/generator": "^7.16.8", - "@babel/helper-environment-visitor": "^7.16.7", - "@babel/helper-function-name": "^7.16.7", - "@babel/helper-hoist-variables": "^7.16.7", - "@babel/helper-split-export-declaration": "^7.16.7", - "@babel/parser": "^7.16.8", - "@babel/types": "^7.16.8", - "debug": "^4.1.0", + "version": "7.26.4", + "resolved": "https://r.cnpmjs.org/@babel/traverse/-/traverse-7.26.4.tgz", + "integrity": "sha512-fH+b7Y4p3yqvApJALCPJcwb0/XaOSgtK4pzV6WVjPR5GLFQBRI7pfoX2V2iM48NXvX07NUxxm1Vw98YjqTcU5w==", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/code-frame": "^7.26.2", + "@babel/generator": "^7.26.3", + "@babel/parser": "^7.26.3", + "@babel/template": "^7.25.9", + "@babel/types": "^7.26.3", + "debug": "^4.3.1", "globals": "^11.1.0" }, "engines": { @@ -1661,13 +1661,14 @@ } }, "node_modules/@babel/types": { - "version": "7.16.8", - "resolved": "https://registry.npmjs.org/@babel/types/-/types-7.16.8.tgz", - "integrity": "sha512-smN2DQc5s4M7fntyjGtyIPbRJv6wW4rU/94fmYJ7PKQuZkC0qGMHXJbg6sNGt12JmVr4k5YaptI/XtiLJBnmIg==", + "version": "7.26.3", + "resolved": "https://r.cnpmjs.org/@babel/types/-/types-7.26.3.tgz", + "integrity": "sha512-vN5p+1kl59GVKMvTHt55NzzmYVxprfJD+ql7U9NFIfKCBkYE55LYtS+WtPlaYOyzydrKI8Nezd+aZextrd+FMA==", "dev": true, + "license": "MIT", "dependencies": { - "@babel/helper-validator-identifier": "^7.16.7", - "to-fast-properties": "^2.0.0" + "@babel/helper-string-parser": "^7.25.9", + "@babel/helper-validator-identifier": "^7.25.9" }, "engines": { "node": ">=6.9.0" @@ -1734,6 +1735,59 @@ "integrity": "sha512-ZnQMnLV4e7hDlUvw8H+U8ASL02SS2Gn6+9Ac3wGGLIe7+je2AeAOxPY+izIPJDfFDb7eDjev0Us8MO1iFRN8hA==", "dev": true }, + "node_modules/@jridgewell/gen-mapping": { + "version": "0.3.5", + "resolved": "https://r.cnpmjs.org/@jridgewell/gen-mapping/-/gen-mapping-0.3.5.tgz", + "integrity": "sha512-IzL8ZoEDIBRWEzlCcRhOaCupYyN5gdIK+Q6fbFdPDg6HqX6jpkItn7DFIpW9LQzXG6Df9sA7+OKnq0qlz/GaQg==", + "dev": true, + "license": "MIT", + "dependencies": { + "@jridgewell/set-array": "^1.2.1", + "@jridgewell/sourcemap-codec": "^1.4.10", + "@jridgewell/trace-mapping": "^0.3.24" + }, + "engines": { + "node": ">=6.0.0" + } + }, + "node_modules/@jridgewell/resolve-uri": { + "version": "3.1.2", + "resolved": "https://r.cnpmjs.org/@jridgewell/resolve-uri/-/resolve-uri-3.1.2.tgz", + "integrity": "sha512-bRISgCIjP20/tbWSPWMEi54QVPRZExkuD9lJL+UIxUKtwVJA8wW1Trb1jMs1RFXo1CBTNZ/5hpC9QvmKWdopKw==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=6.0.0" + } + }, + "node_modules/@jridgewell/set-array": { + "version": "1.2.1", + "resolved": "https://r.cnpmjs.org/@jridgewell/set-array/-/set-array-1.2.1.tgz", + "integrity": "sha512-R8gLRTZeyp03ymzP/6Lil/28tGeGEzhx1q2k703KGWRAI1VdvPIXdG70VJc2pAMw3NA6JKL5hhFu1sJX0Mnn/A==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=6.0.0" + } + }, + "node_modules/@jridgewell/sourcemap-codec": { + "version": "1.5.0", + "resolved": "https://r.cnpmjs.org/@jridgewell/sourcemap-codec/-/sourcemap-codec-1.5.0.tgz", + "integrity": "sha512-gv3ZRaISU3fjPAgNsriBRqGWQL6quFx04YMPW/zD8XMLsU32mhCCbfbO6KZFLjvYpCZ8zyDEgqsgf+PwPaM7GQ==", + "dev": true, + "license": "MIT" + }, + "node_modules/@jridgewell/trace-mapping": { + "version": "0.3.25", + "resolved": "https://r.cnpmjs.org/@jridgewell/trace-mapping/-/trace-mapping-0.3.25.tgz", + "integrity": "sha512-vNk6aEwybGtawWmy/PzwnGDOjCkLWSD2wqvjGGAgOAwCGWySYXfYoxt00IJkTF+8Lb57DwOb3Aa0o9CApepiYQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "@jridgewell/resolve-uri": "^3.1.0", + "@jridgewell/sourcemap-codec": "^1.4.14" + } + }, "node_modules/@npmcli/fs": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/@npmcli/fs/-/fs-1.1.0.tgz", @@ -1850,10 +1904,11 @@ } }, "node_modules/@rollup/plugin-babel": { - "version": "5.3.0", - "resolved": "https://registry.npmjs.org/@rollup/plugin-babel/-/plugin-babel-5.3.0.tgz", - "integrity": "sha512-9uIC8HZOnVLrLHxayq/PTzw+uS25E14KPUBh5ktF+18Mjo5yK0ToMMx6epY0uEgkjwJw0aBW4x2horYXh8juWw==", + "version": "5.3.1", + "resolved": "https://r.cnpmjs.org/@rollup/plugin-babel/-/plugin-babel-5.3.1.tgz", + "integrity": "sha512-WFfdLWU/xVWKeRQnKmIAQULUI7Il0gZnBIH/ZFO069wYIfPu+8zrfp/KMW0atmELoRDq8FbiP3VCss9MhCut7Q==", "dev": true, + "license": "MIT", "dependencies": { "@babel/helper-module-imports": "^7.10.4", "@rollup/pluginutils": "^3.1.0" @@ -2155,52 +2210,46 @@ "integrity": "sha512-xh1Rl34h6Fi1DC2WWKfxUTVqRsNnr6LsKz2+hfwDxQJWmrx8+c7ylaqBMcHfl1U1r2dsifOvKX3LQuLNZ+XSvA==", "dev": true }, - "node_modules/babel-plugin-dynamic-import-node": { - "version": "2.3.3", - "resolved": "https://registry.npmjs.org/babel-plugin-dynamic-import-node/-/babel-plugin-dynamic-import-node-2.3.3.tgz", - "integrity": "sha512-jZVI+s9Zg3IqA/kdi0i6UDCybUI3aSBLnglhYbSSjKlV7yF1F/5LWv8MakQmvYpnbJDS6fcBL2KzHSxNCMtWSQ==", - "dev": true, - "dependencies": { - "object.assign": "^4.1.0" - } - }, "node_modules/babel-plugin-polyfill-corejs2": { - "version": "0.3.1", - "resolved": "https://registry.npmjs.org/babel-plugin-polyfill-corejs2/-/babel-plugin-polyfill-corejs2-0.3.1.tgz", - "integrity": "sha512-v7/T6EQcNfVLfcN2X8Lulb7DjprieyLWJK/zOWH5DUYcAgex9sP3h25Q+DLsX9TloXe3y1O8l2q2Jv9q8UVB9w==", + "version": "0.4.12", + "resolved": "https://r.cnpmjs.org/babel-plugin-polyfill-corejs2/-/babel-plugin-polyfill-corejs2-0.4.12.tgz", + "integrity": "sha512-CPWT6BwvhrTO2d8QVorhTCQw9Y43zOu7G9HigcfxvepOU6b8o3tcWad6oVgZIsZCTt42FFv97aA7ZJsbM4+8og==", "dev": true, + "license": "MIT", "dependencies": { - "@babel/compat-data": "^7.13.11", - "@babel/helper-define-polyfill-provider": "^0.3.1", - "semver": "^6.1.1" + "@babel/compat-data": "^7.22.6", + "@babel/helper-define-polyfill-provider": "^0.6.3", + "semver": "^6.3.1" }, "peerDependencies": { - "@babel/core": "^7.0.0-0" + "@babel/core": "^7.4.0 || ^8.0.0-0 <8.0.0" } }, "node_modules/babel-plugin-polyfill-corejs3": { - "version": "0.5.1", - "resolved": "https://registry.npmjs.org/babel-plugin-polyfill-corejs3/-/babel-plugin-polyfill-corejs3-0.5.1.tgz", - "integrity": "sha512-TihqEe4sQcb/QcPJvxe94/9RZuLQuF1+To4WqQcRvc+3J3gLCPIPgDKzGLG6zmQLfH3nn25heRuDNkS2KR4I8A==", + "version": "0.10.6", + "resolved": "https://r.cnpmjs.org/babel-plugin-polyfill-corejs3/-/babel-plugin-polyfill-corejs3-0.10.6.tgz", + "integrity": "sha512-b37+KR2i/khY5sKmWNVQAnitvquQbNdWy6lJdsr0kmquCKEEUgMKK4SboVM3HtfnZilfjr4MMQ7vY58FVWDtIA==", "dev": true, + "license": "MIT", "dependencies": { - "@babel/helper-define-polyfill-provider": "^0.3.1", - "core-js-compat": "^3.20.0" + "@babel/helper-define-polyfill-provider": "^0.6.2", + "core-js-compat": "^3.38.0" }, "peerDependencies": { - "@babel/core": "^7.0.0-0" + "@babel/core": "^7.4.0 || ^8.0.0-0 <8.0.0" } }, "node_modules/babel-plugin-polyfill-regenerator": { - "version": "0.3.1", - "resolved": "https://registry.npmjs.org/babel-plugin-polyfill-regenerator/-/babel-plugin-polyfill-regenerator-0.3.1.tgz", - "integrity": "sha512-Y2B06tvgHYt1x0yz17jGkGeeMr5FeKUu+ASJ+N6nB5lQ8Dapfg42i0OVrf8PNGJ3zKL4A23snMi1IRwrqqND7A==", + "version": "0.6.3", + "resolved": "https://r.cnpmjs.org/babel-plugin-polyfill-regenerator/-/babel-plugin-polyfill-regenerator-0.6.3.tgz", + "integrity": "sha512-LiWSbl4CRSIa5x/JAU6jZiG9eit9w6mz+yVMFwDE83LAWvt0AfGBoZ7HS/mkhrKuh2ZlzfVZYKoLjXdqw6Yt7Q==", "dev": true, + "license": "MIT", "dependencies": { - "@babel/helper-define-polyfill-provider": "^0.3.1" + "@babel/helper-define-polyfill-provider": "^0.6.3" }, "peerDependencies": { - "@babel/core": "^7.0.0-0" + "@babel/core": "^7.4.0 || ^8.0.0-0 <8.0.0" } }, "node_modules/balanced-match": { @@ -2341,26 +2390,36 @@ } }, "node_modules/browserslist": { - "version": "4.19.1", - "resolved": "https://registry.npmjs.org/browserslist/-/browserslist-4.19.1.tgz", - "integrity": "sha512-u2tbbG5PdKRTUoctO3NBD8FQ5HdPh1ZXPHzp1rwaa5jTc+RV9/+RlWiAIKmjRPQF+xbGM9Kklj5bZQFa2s/38A==", + "version": "4.24.2", + "resolved": "https://r.cnpmjs.org/browserslist/-/browserslist-4.24.2.tgz", + "integrity": "sha512-ZIc+Q62revdMcqC6aChtW4jz3My3klmCO1fEmINZY/8J3EpBg5/A/D0AKmBveUh6pgoeycoMkVMko84tuYS+Gg==", "dev": true, + "funding": [ + { + "type": "opencollective", + "url": "https://opencollective.com/browserslist" + }, + { + "type": "tidelift", + "url": "https://tidelift.com/funding/github/npm/browserslist" + }, + { + "type": "github", + "url": "https://github.com/sponsors/ai" + } + ], + "license": "MIT", "dependencies": { - "caniuse-lite": "^1.0.30001286", - "electron-to-chromium": "^1.4.17", - "escalade": "^3.1.1", - "node-releases": "^2.0.1", - "picocolors": "^1.0.0" + "caniuse-lite": "^1.0.30001669", + "electron-to-chromium": "^1.5.41", + "node-releases": "^2.0.18", + "update-browserslist-db": "^1.1.1" }, "bin": { "browserslist": "cli.js" }, "engines": { "node": "^6 || ^7 || ^8 || ^9 || ^10 || ^11 || ^12 || >=13.7" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/browserslist" } }, "node_modules/buffer-from": { @@ -2425,19 +2484,6 @@ "node": ">= 10" } }, - "node_modules/call-bind": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/call-bind/-/call-bind-1.0.2.tgz", - "integrity": "sha512-7O+FbCihrB5WGbFYesctwmTKae6rOiIzmz1icreWJ+0aA7LJfuqhEso2T9ncpcFtzMQtzXf2QGGueWJGTYsqrA==", - "dev": true, - "dependencies": { - "function-bind": "^1.1.1", - "get-intrinsic": "^1.0.2" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, "node_modules/callsites": { "version": "3.1.0", "resolved": "https://registry.npmjs.org/callsites/-/callsites-3.1.0.tgz", @@ -2459,15 +2505,26 @@ "url": "https://github.com/sponsors/sindresorhus" } }, - "node_modules/caniuse-lite": { - "version": "1.0.30001300", - "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001300.tgz", - "integrity": "sha512-cVjiJHWGcNlJi8TZVKNMnvMid3Z3TTdDHmLDzlOdIiZq138Exvo0G+G0wTdVYolxKb4AYwC+38pxodiInVtJSA==", - "dev": true, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/browserslist" - } + "node_modules/caniuse-lite": { + "version": "1.0.30001687", + "resolved": "https://r.cnpmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001687.tgz", + "integrity": "sha512-0S/FDhf4ZiqrTUiQ39dKeUjYRjkv7lOZU1Dgif2rIqrTzX/1wV2hfKu9TOm1IHkdSijfLswxTFzl/cvir+SLSQ==", + "dev": true, + "funding": [ + { + "type": "opencollective", + "url": "https://opencollective.com/browserslist" + }, + { + "type": "tidelift", + "url": "https://tidelift.com/funding/github/npm/caniuse-lite" + }, + { + "type": "github", + "url": "https://github.com/sponsors/ai" + } + ], + "license": "CC-BY-4.0" }, "node_modules/caseless": { "version": "0.12.0", @@ -2686,13 +2743,11 @@ } }, "node_modules/convert-source-map": { - "version": "1.8.0", - "resolved": "https://registry.npmjs.org/convert-source-map/-/convert-source-map-1.8.0.tgz", - "integrity": "sha512-+OQdjP49zViI/6i7nIJpA8rAl4sV/JdPfU9nZs3VqOwGIgizICvuN2ru6fMd+4llL0tar18UYJXfZ/TWtmhUjA==", + "version": "2.0.0", + "resolved": "https://r.cnpmjs.org/convert-source-map/-/convert-source-map-2.0.0.tgz", + "integrity": "sha512-Kvp459HrV2FEJ1CAsi1Ku+MY3kasH19TFykTz2xWmMeq6bk2NU3XXvfJ+Q61m0xktWwt+1HSYf3JZsTms3aRJg==", "dev": true, - "dependencies": { - "safe-buffer": "~5.1.1" - } + "license": "MIT" }, "node_modules/cookie": { "version": "0.4.1", @@ -2710,28 +2765,19 @@ "dev": true }, "node_modules/core-js-compat": { - "version": "3.20.3", - "resolved": "https://registry.npmjs.org/core-js-compat/-/core-js-compat-3.20.3.tgz", - "integrity": "sha512-c8M5h0IkNZ+I92QhIpuSijOxGAcj3lgpsWdkCqmUTZNwidujF4r3pi6x1DCN+Vcs5qTS2XWWMfWSuCqyupX8gw==", + "version": "3.39.0", + "resolved": "https://r.cnpmjs.org/core-js-compat/-/core-js-compat-3.39.0.tgz", + "integrity": "sha512-VgEUx3VwlExr5no0tXlBt+silBvhTryPwCXRI2Id1PN8WTKu7MreethvddqOubrYxkFdv/RnYrqlv1sFNAUelw==", "dev": true, + "license": "MIT", "dependencies": { - "browserslist": "^4.19.1", - "semver": "7.0.0" + "browserslist": "^4.24.2" }, "funding": { "type": "opencollective", "url": "https://opencollective.com/core-js" } }, - "node_modules/core-js-compat/node_modules/semver": { - "version": "7.0.0", - "resolved": "https://registry.npmjs.org/semver/-/semver-7.0.0.tgz", - "integrity": "sha512-+GB6zVA9LWh6zovYQLALHwv5rb2PHGlJi3lfiqIHxR0uuwCgefcOJc59v9fv1w8GbStwxuuqqAjI9NMAOOgq1A==", - "dev": true, - "bin": { - "semver": "bin/semver.js" - } - }, "node_modules/core-util-is": { "version": "1.0.3", "resolved": "https://registry.npmjs.org/core-util-is/-/core-util-is-1.0.3.tgz", @@ -2831,18 +2877,6 @@ "node": ">=8" } }, - "node_modules/define-properties": { - "version": "1.1.3", - "resolved": "https://registry.npmjs.org/define-properties/-/define-properties-1.1.3.tgz", - "integrity": "sha512-3MqfYKj2lLzdMSf8ZIZE/V+Zuy+BgD6f164e8K2w7dgnpKArBDerGYpM46IYYcjnkdPNMjPk9A6VFB8+3SKlXQ==", - "dev": true, - "dependencies": { - "object-keys": "^1.0.12" - }, - "engines": { - "node": ">= 0.4" - } - }, "node_modules/delayed-stream": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/delayed-stream/-/delayed-stream-1.0.0.tgz", @@ -2972,10 +3006,11 @@ "dev": true }, "node_modules/electron-to-chromium": { - "version": "1.4.48", - "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.4.48.tgz", - "integrity": "sha512-RT3SEmpv7XUA+tKXrZGudAWLDpa7f8qmhjcLaM6OD/ERxjQ/zAojT8/Vvo0BSzbArkElFZ1WyZ9FuwAYbkdBNA==", - "dev": true + "version": "1.5.72", + "resolved": "https://r.cnpmjs.org/electron-to-chromium/-/electron-to-chromium-1.5.72.tgz", + "integrity": "sha512-ZpSAUOZ2Izby7qnZluSrAlGgGQzucmFbN0n64dYzocYxnxV5ufurpj3VgEe4cUp7ir9LmeLxNYo8bVnlM8bQHw==", + "dev": true, + "license": "ISC" }, "node_modules/emoji-regex": { "version": "8.0.0", @@ -3042,10 +3077,11 @@ "dev": true }, "node_modules/escalade": { - "version": "3.1.1", - "resolved": "https://registry.npmjs.org/escalade/-/escalade-3.1.1.tgz", - "integrity": "sha512-k0er2gUkLf8O0zKJiAhmkTnJlTvINGv7ygDNPbeIsX/TJjGJZHuh9B2UxbsaEkmlEo9MfhrSzmhIlhRlI2GXnw==", + "version": "3.2.0", + "resolved": "https://r.cnpmjs.org/escalade/-/escalade-3.2.0.tgz", + "integrity": "sha512-WUj2qlxaQtO4g6Pq5c29GTcWGDyd8itL8zTlipgECz3JesAiiOKotd8JU6otB3PACgG6xkJUyVhboMS+bje/jA==", "dev": true, + "license": "MIT", "engines": { "node": ">=6" } @@ -3696,20 +3732,6 @@ "node": "6.* || 8.* || >= 10.*" } }, - "node_modules/get-intrinsic": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/get-intrinsic/-/get-intrinsic-1.1.1.tgz", - "integrity": "sha512-kWZrnVM42QCiEA2Ig1bG8zjoIMOgxWwYCEeNdwY6Tv/cOSeGpcoX4pXHfKUxNKVoArnrEr2e9srnAxxGIraS9Q==", - "dev": true, - "dependencies": { - "function-bind": "^1.1.1", - "has": "^1.0.3", - "has-symbols": "^1.0.1" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, "node_modules/getpass": { "version": "0.1.7", "resolved": "https://registry.npmjs.org/getpass/-/getpass-0.1.7.tgz", @@ -3831,18 +3853,6 @@ "node": ">=8" } }, - "node_modules/has-symbols": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/has-symbols/-/has-symbols-1.0.2.tgz", - "integrity": "sha512-chXa79rL/UC2KlX17jo3vRGz0azaWEx5tGqZg5pO3NUyEJVB17dMruQlzCCOfUvElghKcm5194+BCRvi2Rv/Gw==", - "dev": true, - "engines": { - "node": ">= 0.4" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, "node_modules/has-unicode": { "version": "2.0.1", "resolved": "https://registry.npmjs.org/has-unicode/-/has-unicode-2.0.1.tgz", @@ -4200,15 +4210,16 @@ "dev": true }, "node_modules/jsesc": { - "version": "2.5.2", - "resolved": "https://registry.npmjs.org/jsesc/-/jsesc-2.5.2.tgz", - "integrity": "sha512-OYu7XEzjkCQ3C5Ps3QIZsQfNpqoJyZZA99wd9aWd05NCtC5pWOkShK2mkL6HXQR6/Cy2lbNdPlZBpuQHXE63gA==", + "version": "3.0.2", + "resolved": "https://r2.cnpmjs.org/jsesc/-/jsesc-3.0.2.tgz", + "integrity": "sha512-xKqzzWXDttJuOcawBt4KnKHHIf5oQ/Cxax+0PWFG+DFDgHNAdi+TXECADI+RYiFUMmx8792xsMbbgXj4CwnP4g==", "dev": true, + "license": "MIT", "bin": { "jsesc": "bin/jsesc" }, "engines": { - "node": ">=4" + "node": ">=6" } }, "node_modules/json-parse-even-better-errors": { @@ -4242,13 +4253,11 @@ "dev": true }, "node_modules/json5": { - "version": "2.2.0", - "resolved": "https://registry.npmjs.org/json5/-/json5-2.2.0.tgz", - "integrity": "sha512-f+8cldu7X/y7RAJurMEJmdoKXGB/X550w2Nr3tTbezL6RwEE/iMcm+tZnXeoZtKuOq6ft8+CqzEkrIgx1fPoQA==", + "version": "2.2.3", + "resolved": "https://r.cnpmjs.org/json5/-/json5-2.2.3.tgz", + "integrity": "sha512-XmOWe7eyHYH14cLdVPoyg+GOH3rYX++KpzrylJwSW98t3Nk+U8XOl8FWKOgwtzdb8lXGf6zYwDUzeHMWfxasyg==", "dev": true, - "dependencies": { - "minimist": "^1.2.5" - }, + "license": "MIT", "bin": { "json5": "lib/cli.js" }, @@ -4301,9 +4310,10 @@ }, "node_modules/lodash.debounce": { "version": "4.0.8", - "resolved": "https://registry.npmjs.org/lodash.debounce/-/lodash.debounce-4.0.8.tgz", - "integrity": "sha1-gteb/zCmfEAF/9XiUVMArZyk168=", - "dev": true + "resolved": "https://r2.cnpmjs.org/lodash.debounce/-/lodash.debounce-4.0.8.tgz", + "integrity": "sha512-FT1yDzDYEoYWhnSGnpE/4Kj1fLZkDFyqRb7fNt6FdYOSxlUWAtp42Eh6Wb0rGIv/m9Bgo7x4GhQbm5Ys4SG5ow==", + "dev": true, + "license": "MIT" }, "node_modules/lodash.merge": { "version": "4.6.2", @@ -4431,12 +4441,6 @@ "node": "*" } }, - "node_modules/minimist": { - "version": "1.2.5", - "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.5.tgz", - "integrity": "sha512-FM9nNUYrRBAELZQT3xeZQ7fmMOBg6nWNmJKTcgsJeaLstP/UODVpGsr5OhXhhXg6f+qtJ8uiZ+PUxkDWcgIXLw==", - "dev": true - }, "node_modules/minipass": { "version": "3.1.6", "resolved": "https://registry.npmjs.org/minipass/-/minipass-3.1.6.tgz", @@ -4631,10 +4635,11 @@ } }, "node_modules/node-releases": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/node-releases/-/node-releases-2.0.1.tgz", - "integrity": "sha512-CqyzN6z7Q6aMeF/ktcMVTzhAHCEpf8SOarwpzpf8pNBY2k5/oM34UHldUwp8VKI7uxct2HxSRdJjBaZeESzcxA==", - "dev": true + "version": "2.0.19", + "resolved": "https://r.cnpmjs.org/node-releases/-/node-releases-2.0.19.tgz", + "integrity": "sha512-xxOWJsBKtzAq7DY0J+DTzuz58K8e7sJbdgwkbMWQe8UYB6ekmsQ45q0M/tJDsGaZmbC+l7n57UV8Hl5tHxO9uw==", + "dev": true, + "license": "MIT" }, "node_modules/nopt": { "version": "5.0.0", @@ -4823,33 +4828,6 @@ "node": ">=0.10.0" } }, - "node_modules/object-keys": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/object-keys/-/object-keys-1.1.1.tgz", - "integrity": "sha512-NuAESUOUMrlIXOfHKzD6bpPu3tYt3xvjNdRIQ+FeT0lNb4K8WR70CaDxhuNguS2XG+GjkyMwOzsN5ZktImfhLA==", - "dev": true, - "engines": { - "node": ">= 0.4" - } - }, - "node_modules/object.assign": { - "version": "4.1.2", - "resolved": "https://registry.npmjs.org/object.assign/-/object.assign-4.1.2.tgz", - "integrity": "sha512-ixT2L5THXsApyiUPYKmW+2EHpXXe5Ii3M+f4e+aJFAHao5amFRW6J0OO6c/LU8Be47utCx2GL89hxGB6XSmKuQ==", - "dev": true, - "dependencies": { - "call-bind": "^1.0.0", - "define-properties": "^1.1.3", - "has-symbols": "^1.0.1", - "object-keys": "^1.1.1" - }, - "engines": { - "node": ">= 0.4" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, "node_modules/on-finished": { "version": "2.3.0", "resolved": "https://registry.npmjs.org/on-finished/-/on-finished-2.3.0.tgz", @@ -5011,10 +4989,11 @@ "dev": true }, "node_modules/picocolors": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/picocolors/-/picocolors-1.0.0.tgz", - "integrity": "sha512-1fygroTLlHu66zi26VoTDv8yRgm0Fccecssto+MhsZ0D/DGW2sm8E8AjW7NU5VVTRt5GxbeZ5qBuJr+HyLYkjQ==", - "dev": true + "version": "1.1.1", + "resolved": "https://r.cnpmjs.org/picocolors/-/picocolors-1.1.1.tgz", + "integrity": "sha512-xceH2snhtb5M9liqDsmEw56le376mTZkEX/jEb/RxNFyegNul7eNslCXP9FDj/Lcu0X8KEyMceP2ntpaHrDEVA==", + "dev": true, + "license": "ISC" }, "node_modules/picomatch": { "version": "2.3.1", @@ -5183,15 +5162,17 @@ }, "node_modules/regenerate": { "version": "1.4.2", - "resolved": "https://registry.npmjs.org/regenerate/-/regenerate-1.4.2.tgz", + "resolved": "https://r2.cnpmjs.org/regenerate/-/regenerate-1.4.2.tgz", "integrity": "sha512-zrceR/XhGYU/d/opr2EKO7aRHUeiBI8qjtfHqADTwZd6Szfy16la6kqD0MIUs5z5hx6AaKa+PixpPrR289+I0A==", - "dev": true + "dev": true, + "license": "MIT" }, "node_modules/regenerate-unicode-properties": { - "version": "9.0.0", - "resolved": "https://registry.npmjs.org/regenerate-unicode-properties/-/regenerate-unicode-properties-9.0.0.tgz", - "integrity": "sha512-3E12UeNSPfjrgwjkR81m5J7Aw/T55Tu7nUyZVQYCKEOs+2dkxEY+DpPtZzO4YruuiPb7NkYLVcyJC4+zCbk5pA==", + "version": "10.2.0", + "resolved": "https://r.cnpmjs.org/regenerate-unicode-properties/-/regenerate-unicode-properties-10.2.0.tgz", + "integrity": "sha512-DqHn3DwbmmPVzeKj9woBadqmXxLvQoQIwu7nopMc72ztvxVmVk2SBhSnx67zuye5TP+lJsb/TBQsjLKhnDf3MA==", "dev": true, + "license": "MIT", "dependencies": { "regenerate": "^1.4.2" }, @@ -5206,10 +5187,11 @@ "dev": true }, "node_modules/regenerator-transform": { - "version": "0.14.5", - "resolved": "https://registry.npmjs.org/regenerator-transform/-/regenerator-transform-0.14.5.tgz", - "integrity": "sha512-eOf6vka5IO151Jfsw2NO9WpGX58W6wWmefK3I1zEGr0lOD0u8rwPaNqQL1aRxUaxLeKO3ArNh3VYg1KbaD+FFw==", + "version": "0.15.2", + "resolved": "https://r.cnpmjs.org/regenerator-transform/-/regenerator-transform-0.15.2.tgz", + "integrity": "sha512-hfMp2BoF0qOk3uc5V20ALGDS2ddjQaLrdl7xrGXvAIow7qeWRM2VA2HuCHkUKk9slq3VwEwLNK3DFBqDfPGYtg==", "dev": true, + "license": "MIT", "dependencies": { "@babel/runtime": "^7.8.4" } @@ -5227,49 +5209,43 @@ } }, "node_modules/regexpu-core": { - "version": "4.8.0", - "resolved": "https://registry.npmjs.org/regexpu-core/-/regexpu-core-4.8.0.tgz", - "integrity": "sha512-1F6bYsoYiz6is+oz70NWur2Vlh9KWtswuRuzJOfeYUrfPX2o8n74AnUVaOGDbUqVGO9fNHu48/pjJO4sNVwsOg==", + "version": "6.2.0", + "resolved": "https://r.cnpmjs.org/regexpu-core/-/regexpu-core-6.2.0.tgz", + "integrity": "sha512-H66BPQMrv+V16t8xtmq+UC0CBpiTBA60V8ibS1QVReIp8T1z8hwFxqcGzm9K6lgsN7sB5edVH8a+ze6Fqm4weA==", "dev": true, + "license": "MIT", "dependencies": { "regenerate": "^1.4.2", - "regenerate-unicode-properties": "^9.0.0", - "regjsgen": "^0.5.2", - "regjsparser": "^0.7.0", + "regenerate-unicode-properties": "^10.2.0", + "regjsgen": "^0.8.0", + "regjsparser": "^0.12.0", "unicode-match-property-ecmascript": "^2.0.0", - "unicode-match-property-value-ecmascript": "^2.0.0" + "unicode-match-property-value-ecmascript": "^2.1.0" }, "engines": { "node": ">=4" } }, "node_modules/regjsgen": { - "version": "0.5.2", - "resolved": "https://registry.npmjs.org/regjsgen/-/regjsgen-0.5.2.tgz", - "integrity": "sha512-OFFT3MfrH90xIW8OOSyUrk6QHD5E9JOTeGodiJeBS3J6IwlgzJMNE/1bZklWz5oTg+9dCMyEetclvCVXOPoN3A==", - "dev": true + "version": "0.8.0", + "resolved": "https://r.cnpmjs.org/regjsgen/-/regjsgen-0.8.0.tgz", + "integrity": "sha512-RvwtGe3d7LvWiDQXeQw8p5asZUmfU1G/l6WbUXeHta7Y2PEIvBTwH6E2EfmYUK8pxcxEdEmaomqyp0vZZ7C+3Q==", + "dev": true, + "license": "MIT" }, "node_modules/regjsparser": { - "version": "0.7.0", - "resolved": "https://registry.npmjs.org/regjsparser/-/regjsparser-0.7.0.tgz", - "integrity": "sha512-A4pcaORqmNMDVwUjWoTzuhwMGpP+NykpfqAsEgI1FSH/EzC7lrN5TMd+kN8YCovX+jMpu8eaqXgXPCa0g8FQNQ==", + "version": "0.12.0", + "resolved": "https://r.cnpmjs.org/regjsparser/-/regjsparser-0.12.0.tgz", + "integrity": "sha512-cnE+y8bz4NhMjISKbgeVJtqNbtf5QpjZP+Bslo+UqkIt9QPnX9q095eiRRASJG1/tz6dlNr6Z5NsBiWYokp6EQ==", "dev": true, + "license": "BSD-2-Clause", "dependencies": { - "jsesc": "~0.5.0" + "jsesc": "~3.0.2" }, "bin": { "regjsparser": "bin/parser" } }, - "node_modules/regjsparser/node_modules/jsesc": { - "version": "0.5.0", - "resolved": "https://registry.npmjs.org/jsesc/-/jsesc-0.5.0.tgz", - "integrity": "sha1-597mbjXW/Bb3EP6R1c9p9w8IkR0=", - "dev": true, - "bin": { - "jsesc": "bin/jsesc" - } - }, "node_modules/request": { "version": "2.88.2", "resolved": "https://registry.npmjs.org/request/-/request-2.88.2.tgz", @@ -5615,10 +5591,11 @@ } }, "node_modules/semver": { - "version": "6.3.0", - "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.0.tgz", - "integrity": "sha512-b39TBaTSfV6yBrapU89p5fKekE2m/NwnDocOVruQFS1/veMgdzuPcnOM34M6CwxW8jH/lxEa5rBoDeUwu5HHTw==", + "version": "6.3.1", + "resolved": "https://r.cnpmjs.org/semver/-/semver-6.3.1.tgz", + "integrity": "sha512-BR7VvDCVHO+q2xBEWskxS6DJE1qRnb7DxzUrogb71CWoSficBxYsiAGd+Kl0mmq/MprG9yArRkyrQxTO6XjMzA==", "dev": true, + "license": "ISC", "bin": { "semver": "bin/semver.js" } @@ -5934,15 +5911,6 @@ "node": ">= 10" } }, - "node_modules/source-map": { - "version": "0.5.7", - "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.5.7.tgz", - "integrity": "sha1-igOdLRAh0i0eoUyA2OpGi6LvP8w=", - "dev": true, - "engines": { - "node": ">=0.10.0" - } - }, "node_modules/source-map-support": { "version": "0.5.21", "resolved": "https://registry.npmjs.org/source-map-support/-/source-map-support-0.5.21.tgz", @@ -6152,15 +6120,6 @@ "integrity": "sha1-f17oI66AUgfACvLfSoTsP8+lcLQ=", "dev": true }, - "node_modules/to-fast-properties": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/to-fast-properties/-/to-fast-properties-2.0.0.tgz", - "integrity": "sha1-3F5pjL0HkmW8c+A3doGk5Og/YW4=", - "dev": true, - "engines": { - "node": ">=4" - } - }, "node_modules/toidentifier": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/toidentifier/-/toidentifier-1.0.1.tgz", @@ -6254,19 +6213,21 @@ } }, "node_modules/unicode-canonical-property-names-ecmascript": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/unicode-canonical-property-names-ecmascript/-/unicode-canonical-property-names-ecmascript-2.0.0.tgz", - "integrity": "sha512-yY5PpDlfVIU5+y/BSCxAJRBIS1Zc2dDG3Ujq+sR0U+JjUevW2JhocOF+soROYDSaAezOzOKuyyixhD6mBknSmQ==", + "version": "2.0.1", + "resolved": "https://r.cnpmjs.org/unicode-canonical-property-names-ecmascript/-/unicode-canonical-property-names-ecmascript-2.0.1.tgz", + "integrity": "sha512-dA8WbNeb2a6oQzAQ55YlT5vQAWGV9WXOsi3SskE3bcCdM0P4SDd+24zS/OCacdRq5BkdsRj9q3Pg6YyQoxIGqg==", "dev": true, + "license": "MIT", "engines": { "node": ">=4" } }, "node_modules/unicode-match-property-ecmascript": { "version": "2.0.0", - "resolved": "https://registry.npmjs.org/unicode-match-property-ecmascript/-/unicode-match-property-ecmascript-2.0.0.tgz", + "resolved": "https://r2.cnpmjs.org/unicode-match-property-ecmascript/-/unicode-match-property-ecmascript-2.0.0.tgz", "integrity": "sha512-5kaZCrbp5mmbz5ulBkDkbY0SsPOjKqVS35VpL9ulMPfSl0J0Xsm+9Evphv9CoIZFwre7aJoa94AY6seMKGVN5Q==", "dev": true, + "license": "MIT", "dependencies": { "unicode-canonical-property-names-ecmascript": "^2.0.0", "unicode-property-aliases-ecmascript": "^2.0.0" @@ -6276,19 +6237,21 @@ } }, "node_modules/unicode-match-property-value-ecmascript": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/unicode-match-property-value-ecmascript/-/unicode-match-property-value-ecmascript-2.0.0.tgz", - "integrity": "sha512-7Yhkc0Ye+t4PNYzOGKedDhXbYIBe1XEQYQxOPyhcXNMJ0WCABqqj6ckydd6pWRZTHV4GuCPKdBAUiMc60tsKVw==", + "version": "2.2.0", + "resolved": "https://r.cnpmjs.org/unicode-match-property-value-ecmascript/-/unicode-match-property-value-ecmascript-2.2.0.tgz", + "integrity": "sha512-4IehN3V/+kkr5YeSSDDQG8QLqO26XpL2XP3GQtqwlT/QYSECAwFztxVHjlbh0+gjJ3XmNLS0zDsbgs9jWKExLg==", "dev": true, + "license": "MIT", "engines": { "node": ">=4" } }, "node_modules/unicode-property-aliases-ecmascript": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/unicode-property-aliases-ecmascript/-/unicode-property-aliases-ecmascript-2.0.0.tgz", - "integrity": "sha512-5Zfuy9q/DFr4tfO7ZPeVXb1aPoeQSdeFMLpYuFebehDAhbuevLs5yxSZmIFN1tP5F9Wl4IpJrYojg85/zgyZHQ==", + "version": "2.1.0", + "resolved": "https://r.cnpmjs.org/unicode-property-aliases-ecmascript/-/unicode-property-aliases-ecmascript-2.1.0.tgz", + "integrity": "sha512-6t3foTQI9qne+OZoVQB/8x8rk2k1eVy1gRXhV3oFQ5T6R1dqQ1xtin3XqSlx3+ATBkliTaR/hHyJBm+LVPNM8w==", "dev": true, + "license": "MIT", "engines": { "node": ">=4" } @@ -6320,6 +6283,37 @@ "node": ">= 0.8" } }, + "node_modules/update-browserslist-db": { + "version": "1.1.1", + "resolved": "https://r.cnpmjs.org/update-browserslist-db/-/update-browserslist-db-1.1.1.tgz", + "integrity": "sha512-R8UzCaa9Az+38REPiJ1tXlImTJXlVfgHZsglwBD/k6nj76ctsH1E3q4doGrukiLQd3sGQYu56r5+lo5r94l29A==", + "dev": true, + "funding": [ + { + "type": "opencollective", + "url": "https://opencollective.com/browserslist" + }, + { + "type": "tidelift", + "url": "https://tidelift.com/funding/github/npm/browserslist" + }, + { + "type": "github", + "url": "https://github.com/sponsors/ai" + } + ], + "license": "MIT", + "dependencies": { + "escalade": "^3.2.0", + "picocolors": "^1.1.0" + }, + "bin": { + "update-browserslist-db": "cli.js" + }, + "peerDependencies": { + "browserslist": ">= 4.21.0" + } + }, "node_modules/uri-js": { "version": "4.4.1", "resolved": "https://registry.npmjs.org/uri-js/-/uri-js-4.4.1.tgz", @@ -6510,42 +6504,54 @@ } }, "dependencies": { + "@ampproject/remapping": { + "version": "2.3.0", + "resolved": "https://r.cnpmjs.org/@ampproject/remapping/-/remapping-2.3.0.tgz", + "integrity": "sha512-30iZtAPgz+LTIYoeivqYo853f02jBYSd5uGnGpkFV0M3xOt9aN73erkgYAmZU43x4VfqcnLxW9Kpg3R5LC4YYw==", + "dev": true, + "requires": { + "@jridgewell/gen-mapping": "^0.3.5", + "@jridgewell/trace-mapping": "^0.3.24" + } + }, "@babel/code-frame": { - "version": "7.16.7", - "resolved": "https://registry.npmjs.org/@babel/code-frame/-/code-frame-7.16.7.tgz", - "integrity": "sha512-iAXqUn8IIeBTNd72xsFlgaXHkMBMt6y4HJp1tIaK465CWLT/fG1aqB7ykr95gHHmlBdGbFeWWfyB4NJJ0nmeIg==", + "version": "7.26.2", + "resolved": "https://r.cnpmjs.org/@babel/code-frame/-/code-frame-7.26.2.tgz", + "integrity": "sha512-RJlIHRueQgwWitWgF8OdFYGZX328Ax5BCemNGlqHfplnRT9ESi8JkFlvaVYbS+UubVY6dpv87Fs2u5M29iNFVQ==", "dev": true, "requires": { - "@babel/highlight": "^7.16.7" + "@babel/helper-validator-identifier": "^7.25.9", + "js-tokens": "^4.0.0", + "picocolors": "^1.0.0" } }, "@babel/compat-data": { - "version": "7.16.8", - "resolved": "https://registry.npmjs.org/@babel/compat-data/-/compat-data-7.16.8.tgz", - "integrity": "sha512-m7OkX0IdKLKPpBlJtF561YJal5y/jyI5fNfWbPxh2D/nbzzGI4qRyrD8xO2jB24u7l+5I2a43scCG2IrfjC50Q==", + "version": "7.26.3", + "resolved": "https://r.cnpmjs.org/@babel/compat-data/-/compat-data-7.26.3.tgz", + "integrity": "sha512-nHIxvKPniQXpmQLb0vhY3VaFb3S0YrTAwpOWJZh1wn3oJPjJk9Asva204PsBdmAE8vpzfHudT8DB0scYvy9q0g==", "dev": true }, "@babel/core": { - "version": "7.16.7", - "resolved": "https://registry.npmjs.org/@babel/core/-/core-7.16.7.tgz", - "integrity": "sha512-aeLaqcqThRNZYmbMqtulsetOQZ/5gbR/dWruUCJcpas4Qoyy+QeagfDsPdMrqwsPRDNxJvBlRiZxxX7THO7qtA==", - "dev": true, - "requires": { - "@babel/code-frame": "^7.16.7", - "@babel/generator": "^7.16.7", - "@babel/helper-compilation-targets": "^7.16.7", - "@babel/helper-module-transforms": "^7.16.7", - "@babel/helpers": "^7.16.7", - "@babel/parser": "^7.16.7", - "@babel/template": "^7.16.7", - "@babel/traverse": "^7.16.7", - "@babel/types": "^7.16.7", - "convert-source-map": "^1.7.0", + "version": "7.26.0", + "resolved": "https://r.cnpmjs.org/@babel/core/-/core-7.26.0.tgz", + "integrity": "sha512-i1SLeK+DzNnQ3LL/CswPCa/E5u4lh1k6IAEphON8F+cXt0t9euTshDru0q7/IqMa1PMPz5RnHuHscF8/ZJsStg==", + "dev": true, + "requires": { + "@ampproject/remapping": "^2.2.0", + "@babel/code-frame": "^7.26.0", + "@babel/generator": "^7.26.0", + "@babel/helper-compilation-targets": "^7.25.9", + "@babel/helper-module-transforms": "^7.26.0", + "@babel/helpers": "^7.26.0", + "@babel/parser": "^7.26.0", + "@babel/template": "^7.25.9", + "@babel/traverse": "^7.25.9", + "@babel/types": "^7.26.0", + "convert-source-map": "^2.0.0", "debug": "^4.1.0", "gensync": "^1.0.0-beta.2", - "json5": "^2.1.2", - "semver": "^6.3.0", - "source-map": "^0.5.0" + "json5": "^2.2.3", + "semver": "^6.3.1" } }, "@babel/eslint-parser": { @@ -6560,268 +6566,211 @@ } }, "@babel/generator": { - "version": "7.16.8", - "resolved": "https://registry.npmjs.org/@babel/generator/-/generator-7.16.8.tgz", - "integrity": "sha512-1ojZwE9+lOXzcWdWmO6TbUzDfqLD39CmEhN8+2cX9XkDo5yW1OpgfejfliysR2AWLpMamTiOiAp/mtroaymhpw==", + "version": "7.26.3", + "resolved": "https://r.cnpmjs.org/@babel/generator/-/generator-7.26.3.tgz", + "integrity": "sha512-6FF/urZvD0sTeO7k6/B15pMLC4CHUv1426lzr3N01aHJTl046uCAh9LXW/fzeXXjPNCJ6iABW5XaWOsIZB93aQ==", "dev": true, "requires": { - "@babel/types": "^7.16.8", - "jsesc": "^2.5.1", - "source-map": "^0.5.0" + "@babel/parser": "^7.26.3", + "@babel/types": "^7.26.3", + "@jridgewell/gen-mapping": "^0.3.5", + "@jridgewell/trace-mapping": "^0.3.25", + "jsesc": "^3.0.2" } }, "@babel/helper-annotate-as-pure": { - "version": "7.16.7", - "resolved": "https://registry.npmjs.org/@babel/helper-annotate-as-pure/-/helper-annotate-as-pure-7.16.7.tgz", - "integrity": "sha512-s6t2w/IPQVTAET1HitoowRGXooX8mCgtuP5195wD/QJPV6wYjpujCGF7JuMODVX2ZAJOf1GT6DT9MHEZvLOFSw==", - "dev": true, - "requires": { - "@babel/types": "^7.16.7" - } - }, - "@babel/helper-builder-binary-assignment-operator-visitor": { - "version": "7.16.7", - "resolved": "https://registry.npmjs.org/@babel/helper-builder-binary-assignment-operator-visitor/-/helper-builder-binary-assignment-operator-visitor-7.16.7.tgz", - "integrity": "sha512-C6FdbRaxYjwVu/geKW4ZeQ0Q31AftgRcdSnZ5/jsH6BzCJbtvXvhpfkbkThYSuutZA7nCXpPR6AD9zd1dprMkA==", + "version": "7.25.9", + "resolved": "https://r.cnpmjs.org/@babel/helper-annotate-as-pure/-/helper-annotate-as-pure-7.25.9.tgz", + "integrity": "sha512-gv7320KBUFJz1RnylIg5WWYPRXKZ884AGkYpgpWW02TH66Dl+HaC1t1CKd0z3R4b6hdYEcmrNZHUmfCP+1u3/g==", "dev": true, "requires": { - "@babel/helper-explode-assignable-expression": "^7.16.7", - "@babel/types": "^7.16.7" + "@babel/types": "^7.25.9" } }, "@babel/helper-compilation-targets": { - "version": "7.16.7", - "resolved": "https://registry.npmjs.org/@babel/helper-compilation-targets/-/helper-compilation-targets-7.16.7.tgz", - "integrity": "sha512-mGojBwIWcwGD6rfqgRXVlVYmPAv7eOpIemUG3dGnDdCY4Pae70ROij3XmfrH6Fa1h1aiDylpglbZyktfzyo/hA==", + "version": "7.25.9", + "resolved": "https://r.cnpmjs.org/@babel/helper-compilation-targets/-/helper-compilation-targets-7.25.9.tgz", + "integrity": "sha512-j9Db8Suy6yV/VHa4qzrj9yZfZxhLWQdVnRlXxmKLYlhWUVB1sB2G5sxuWYXk/whHD9iW76PmNzxZ4UCnTQTVEQ==", "dev": true, "requires": { - "@babel/compat-data": "^7.16.4", - "@babel/helper-validator-option": "^7.16.7", - "browserslist": "^4.17.5", - "semver": "^6.3.0" + "@babel/compat-data": "^7.25.9", + "@babel/helper-validator-option": "^7.25.9", + "browserslist": "^4.24.0", + "lru-cache": "^5.1.1", + "semver": "^6.3.1" + }, + "dependencies": { + "lru-cache": { + "version": "5.1.1", + "resolved": "https://r2.cnpmjs.org/lru-cache/-/lru-cache-5.1.1.tgz", + "integrity": "sha512-KpNARQA3Iwv+jTA0utUVVbrh+Jlrr1Fv0e56GGzAFOXN7dk/FviaDW8LHmK52DlcH4WP2n6gI8vN1aesBFgo9w==", + "dev": true, + "requires": { + "yallist": "^3.0.2" + } + }, + "yallist": { + "version": "3.1.1", + "resolved": "https://r2.cnpmjs.org/yallist/-/yallist-3.1.1.tgz", + "integrity": "sha512-a4UGQaWPH59mOXUYnAG2ewncQS4i4F43Tv3JoAM+s2VDAmS9NsK8GpDMLrCHPksFT7h3K6TOoUNn2pb7RoXx4g==", + "dev": true + } } }, "@babel/helper-create-class-features-plugin": { - "version": "7.16.7", - "resolved": "https://registry.npmjs.org/@babel/helper-create-class-features-plugin/-/helper-create-class-features-plugin-7.16.7.tgz", - "integrity": "sha512-kIFozAvVfK05DM4EVQYKK+zteWvY85BFdGBRQBytRyY3y+6PX0DkDOn/CZ3lEuczCfrCxEzwt0YtP/87YPTWSw==", + "version": "7.25.9", + "resolved": "https://r.cnpmjs.org/@babel/helper-create-class-features-plugin/-/helper-create-class-features-plugin-7.25.9.tgz", + "integrity": "sha512-UTZQMvt0d/rSz6KI+qdu7GQze5TIajwTS++GUozlw8VBJDEOAqSXwm1WvmYEZwqdqSGQshRocPDqrt4HBZB3fQ==", "dev": true, "requires": { - "@babel/helper-annotate-as-pure": "^7.16.7", - "@babel/helper-environment-visitor": "^7.16.7", - "@babel/helper-function-name": "^7.16.7", - "@babel/helper-member-expression-to-functions": "^7.16.7", - "@babel/helper-optimise-call-expression": "^7.16.7", - "@babel/helper-replace-supers": "^7.16.7", - "@babel/helper-split-export-declaration": "^7.16.7" + "@babel/helper-annotate-as-pure": "^7.25.9", + "@babel/helper-member-expression-to-functions": "^7.25.9", + "@babel/helper-optimise-call-expression": "^7.25.9", + "@babel/helper-replace-supers": "^7.25.9", + "@babel/helper-skip-transparent-expression-wrappers": "^7.25.9", + "@babel/traverse": "^7.25.9", + "semver": "^6.3.1" } }, "@babel/helper-create-regexp-features-plugin": { - "version": "7.16.7", - "resolved": "https://registry.npmjs.org/@babel/helper-create-regexp-features-plugin/-/helper-create-regexp-features-plugin-7.16.7.tgz", - "integrity": "sha512-fk5A6ymfp+O5+p2yCkXAu5Kyj6v0xh0RBeNcAkYUMDvvAAoxvSKXn+Jb37t/yWFiQVDFK1ELpUTD8/aLhCPu+g==", + "version": "7.26.3", + "resolved": "https://r.cnpmjs.org/@babel/helper-create-regexp-features-plugin/-/helper-create-regexp-features-plugin-7.26.3.tgz", + "integrity": "sha512-G7ZRb40uUgdKOQqPLjfD12ZmGA54PzqDFUv2BKImnC9QIfGhIHKvVML0oN8IUiDq4iRqpq74ABpvOaerfWdong==", "dev": true, "requires": { - "@babel/helper-annotate-as-pure": "^7.16.7", - "regexpu-core": "^4.7.1" + "@babel/helper-annotate-as-pure": "^7.25.9", + "regexpu-core": "^6.2.0", + "semver": "^6.3.1" } }, "@babel/helper-define-polyfill-provider": { - "version": "0.3.1", - "resolved": "https://registry.npmjs.org/@babel/helper-define-polyfill-provider/-/helper-define-polyfill-provider-0.3.1.tgz", - "integrity": "sha512-J9hGMpJQmtWmj46B3kBHmL38UhJGhYX7eqkcq+2gsstyYt341HmPeWspihX43yVRA0mS+8GGk2Gckc7bY/HCmA==", + "version": "0.6.3", + "resolved": "https://r.cnpmjs.org/@babel/helper-define-polyfill-provider/-/helper-define-polyfill-provider-0.6.3.tgz", + "integrity": "sha512-HK7Bi+Hj6H+VTHA3ZvBis7V/6hu9QuTrnMXNybfUf2iiuU/N97I8VjB+KbhFF8Rld/Lx5MzoCwPCpPjfK+n8Cg==", "dev": true, "requires": { - "@babel/helper-compilation-targets": "^7.13.0", - "@babel/helper-module-imports": "^7.12.13", - "@babel/helper-plugin-utils": "^7.13.0", - "@babel/traverse": "^7.13.0", + "@babel/helper-compilation-targets": "^7.22.6", + "@babel/helper-plugin-utils": "^7.22.5", "debug": "^4.1.1", "lodash.debounce": "^4.0.8", - "resolve": "^1.14.2", - "semver": "^6.1.2" - } - }, - "@babel/helper-environment-visitor": { - "version": "7.16.7", - "resolved": "https://registry.npmjs.org/@babel/helper-environment-visitor/-/helper-environment-visitor-7.16.7.tgz", - "integrity": "sha512-SLLb0AAn6PkUeAfKJCCOl9e1R53pQlGAfc4y4XuMRZfqeMYLE0dM1LMhqbGAlGQY0lfw5/ohoYWAe9V1yibRag==", - "dev": true, - "requires": { - "@babel/types": "^7.16.7" - } - }, - "@babel/helper-explode-assignable-expression": { - "version": "7.16.7", - "resolved": "https://registry.npmjs.org/@babel/helper-explode-assignable-expression/-/helper-explode-assignable-expression-7.16.7.tgz", - "integrity": "sha512-KyUenhWMC8VrxzkGP0Jizjo4/Zx+1nNZhgocs+gLzyZyB8SHidhoq9KK/8Ato4anhwsivfkBLftky7gvzbZMtQ==", - "dev": true, - "requires": { - "@babel/types": "^7.16.7" - } - }, - "@babel/helper-function-name": { - "version": "7.16.7", - "resolved": "https://registry.npmjs.org/@babel/helper-function-name/-/helper-function-name-7.16.7.tgz", - "integrity": "sha512-QfDfEnIUyyBSR3HtrtGECuZ6DAyCkYFp7GHl75vFtTnn6pjKeK0T1DB5lLkFvBea8MdaiUABx3osbgLyInoejA==", - "dev": true, - "requires": { - "@babel/helper-get-function-arity": "^7.16.7", - "@babel/template": "^7.16.7", - "@babel/types": "^7.16.7" - } - }, - "@babel/helper-get-function-arity": { - "version": "7.16.7", - "resolved": "https://registry.npmjs.org/@babel/helper-get-function-arity/-/helper-get-function-arity-7.16.7.tgz", - "integrity": "sha512-flc+RLSOBXzNzVhcLu6ujeHUrD6tANAOU5ojrRx/as+tbzf8+stUCj7+IfRRoAbEZqj/ahXEMsjhOhgeZsrnTw==", - "dev": true, - "requires": { - "@babel/types": "^7.16.7" - } - }, - "@babel/helper-hoist-variables": { - "version": "7.16.7", - "resolved": "https://registry.npmjs.org/@babel/helper-hoist-variables/-/helper-hoist-variables-7.16.7.tgz", - "integrity": "sha512-m04d/0Op34H5v7pbZw6pSKP7weA6lsMvfiIAMeIvkY/R4xQtBSMFEigu9QTZ2qB/9l22vsxtM8a+Q8CzD255fg==", - "dev": true, - "requires": { - "@babel/types": "^7.16.7" + "resolve": "^1.14.2" } }, "@babel/helper-member-expression-to-functions": { - "version": "7.16.7", - "resolved": "https://registry.npmjs.org/@babel/helper-member-expression-to-functions/-/helper-member-expression-to-functions-7.16.7.tgz", - "integrity": "sha512-VtJ/65tYiU/6AbMTDwyoXGPKHgTsfRarivm+YbB5uAzKUyuPjgZSgAFeG87FCigc7KNHu2Pegh1XIT3lXjvz3Q==", + "version": "7.25.9", + "resolved": "https://r.cnpmjs.org/@babel/helper-member-expression-to-functions/-/helper-member-expression-to-functions-7.25.9.tgz", + "integrity": "sha512-wbfdZ9w5vk0C0oyHqAJbc62+vet5prjj01jjJ8sKn3j9h3MQQlflEdXYvuqRWjHnM12coDEqiC1IRCi0U/EKwQ==", "dev": true, "requires": { - "@babel/types": "^7.16.7" + "@babel/traverse": "^7.25.9", + "@babel/types": "^7.25.9" } }, "@babel/helper-module-imports": { - "version": "7.16.7", - "resolved": "https://registry.npmjs.org/@babel/helper-module-imports/-/helper-module-imports-7.16.7.tgz", - "integrity": "sha512-LVtS6TqjJHFc+nYeITRo6VLXve70xmq7wPhWTqDJusJEgGmkAACWwMiTNrvfoQo6hEhFwAIixNkvB0jPXDL8Wg==", + "version": "7.25.9", + "resolved": "https://r.cnpmjs.org/@babel/helper-module-imports/-/helper-module-imports-7.25.9.tgz", + "integrity": "sha512-tnUA4RsrmflIM6W6RFTLFSXITtl0wKjgpnLgXyowocVPrbYrLUXSBXDgTs8BlbmIzIdlBySRQjINYs2BAkiLtw==", "dev": true, "requires": { - "@babel/types": "^7.16.7" + "@babel/traverse": "^7.25.9", + "@babel/types": "^7.25.9" } }, "@babel/helper-module-transforms": { - "version": "7.16.7", - "resolved": "https://registry.npmjs.org/@babel/helper-module-transforms/-/helper-module-transforms-7.16.7.tgz", - "integrity": "sha512-gaqtLDxJEFCeQbYp9aLAefjhkKdjKcdh6DB7jniIGU3Pz52WAmP268zK0VgPz9hUNkMSYeH976K2/Y6yPadpng==", + "version": "7.26.0", + "resolved": "https://r.cnpmjs.org/@babel/helper-module-transforms/-/helper-module-transforms-7.26.0.tgz", + "integrity": "sha512-xO+xu6B5K2czEnQye6BHA7DolFFmS3LB7stHZFaOLb1pAwO1HWLS8fXA+eh0A2yIvltPVmx3eNNDBJA2SLHXFw==", "dev": true, "requires": { - "@babel/helper-environment-visitor": "^7.16.7", - "@babel/helper-module-imports": "^7.16.7", - "@babel/helper-simple-access": "^7.16.7", - "@babel/helper-split-export-declaration": "^7.16.7", - "@babel/helper-validator-identifier": "^7.16.7", - "@babel/template": "^7.16.7", - "@babel/traverse": "^7.16.7", - "@babel/types": "^7.16.7" + "@babel/helper-module-imports": "^7.25.9", + "@babel/helper-validator-identifier": "^7.25.9", + "@babel/traverse": "^7.25.9" } }, "@babel/helper-optimise-call-expression": { - "version": "7.16.7", - "resolved": "https://registry.npmjs.org/@babel/helper-optimise-call-expression/-/helper-optimise-call-expression-7.16.7.tgz", - "integrity": "sha512-EtgBhg7rd/JcnpZFXpBy0ze1YRfdm7BnBX4uKMBd3ixa3RGAE002JZB66FJyNH7g0F38U05pXmA5P8cBh7z+1w==", + "version": "7.25.9", + "resolved": "https://r.cnpmjs.org/@babel/helper-optimise-call-expression/-/helper-optimise-call-expression-7.25.9.tgz", + "integrity": "sha512-FIpuNaz5ow8VyrYcnXQTDRGvV6tTjkNtCK/RYNDXGSLlUD6cBuQTSw43CShGxjvfBTfcUA/r6UhUCbtYqkhcuQ==", "dev": true, "requires": { - "@babel/types": "^7.16.7" + "@babel/types": "^7.25.9" } }, "@babel/helper-plugin-utils": { - "version": "7.16.7", - "resolved": "https://registry.npmjs.org/@babel/helper-plugin-utils/-/helper-plugin-utils-7.16.7.tgz", - "integrity": "sha512-Qg3Nk7ZxpgMrsox6HreY1ZNKdBq7K72tDSliA6dCl5f007jR4ne8iD5UzuNnCJH2xBf2BEEVGr+/OL6Gdp7RxA==", + "version": "7.25.9", + "resolved": "https://r.cnpmjs.org/@babel/helper-plugin-utils/-/helper-plugin-utils-7.25.9.tgz", + "integrity": "sha512-kSMlyUVdWe25rEsRGviIgOWnoT/nfABVWlqt9N19/dIPWViAOW2s9wznP5tURbs/IDuNk4gPy3YdYRgH3uxhBw==", "dev": true }, "@babel/helper-remap-async-to-generator": { - "version": "7.16.8", - "resolved": "https://registry.npmjs.org/@babel/helper-remap-async-to-generator/-/helper-remap-async-to-generator-7.16.8.tgz", - "integrity": "sha512-fm0gH7Flb8H51LqJHy3HJ3wnE1+qtYR2A99K06ahwrawLdOFsCEWjZOrYricXJHoPSudNKxrMBUPEIPxiIIvBw==", + "version": "7.25.9", + "resolved": "https://r.cnpmjs.org/@babel/helper-remap-async-to-generator/-/helper-remap-async-to-generator-7.25.9.tgz", + "integrity": "sha512-IZtukuUeBbhgOcaW2s06OXTzVNJR0ybm4W5xC1opWFFJMZbwRj5LCk+ByYH7WdZPZTt8KnFwA8pvjN2yqcPlgw==", "dev": true, "requires": { - "@babel/helper-annotate-as-pure": "^7.16.7", - "@babel/helper-wrap-function": "^7.16.8", - "@babel/types": "^7.16.8" + "@babel/helper-annotate-as-pure": "^7.25.9", + "@babel/helper-wrap-function": "^7.25.9", + "@babel/traverse": "^7.25.9" } }, "@babel/helper-replace-supers": { - "version": "7.16.7", - "resolved": "https://registry.npmjs.org/@babel/helper-replace-supers/-/helper-replace-supers-7.16.7.tgz", - "integrity": "sha512-y9vsWilTNaVnVh6xiJfABzsNpgDPKev9HnAgz6Gb1p6UUwf9NepdlsV7VXGCftJM+jqD5f7JIEubcpLjZj5dBw==", - "dev": true, - "requires": { - "@babel/helper-environment-visitor": "^7.16.7", - "@babel/helper-member-expression-to-functions": "^7.16.7", - "@babel/helper-optimise-call-expression": "^7.16.7", - "@babel/traverse": "^7.16.7", - "@babel/types": "^7.16.7" - } - }, - "@babel/helper-simple-access": { - "version": "7.16.7", - "resolved": "https://registry.npmjs.org/@babel/helper-simple-access/-/helper-simple-access-7.16.7.tgz", - "integrity": "sha512-ZIzHVyoeLMvXMN/vok/a4LWRy8G2v205mNP0XOuf9XRLyX5/u9CnVulUtDgUTama3lT+bf/UqucuZjqiGuTS1g==", + "version": "7.25.9", + "resolved": "https://r.cnpmjs.org/@babel/helper-replace-supers/-/helper-replace-supers-7.25.9.tgz", + "integrity": "sha512-IiDqTOTBQy0sWyeXyGSC5TBJpGFXBkRynjBeXsvbhQFKj2viwJC76Epz35YLU1fpe/Am6Vppb7W7zM4fPQzLsQ==", "dev": true, "requires": { - "@babel/types": "^7.16.7" + "@babel/helper-member-expression-to-functions": "^7.25.9", + "@babel/helper-optimise-call-expression": "^7.25.9", + "@babel/traverse": "^7.25.9" } }, "@babel/helper-skip-transparent-expression-wrappers": { - "version": "7.16.0", - "resolved": "https://registry.npmjs.org/@babel/helper-skip-transparent-expression-wrappers/-/helper-skip-transparent-expression-wrappers-7.16.0.tgz", - "integrity": "sha512-+il1gTy0oHwUsBQZyJvukbB4vPMdcYBrFHa0Uc4AizLxbq6BOYC51Rv4tWocX9BLBDLZ4kc6qUFpQ6HRgL+3zw==", + "version": "7.25.9", + "resolved": "https://r.cnpmjs.org/@babel/helper-skip-transparent-expression-wrappers/-/helper-skip-transparent-expression-wrappers-7.25.9.tgz", + "integrity": "sha512-K4Du3BFa3gvyhzgPcntrkDgZzQaq6uozzcpGbOO1OEJaI+EJdqWIMTLgFgQf6lrfiDFo5FU+BxKepI9RmZqahA==", "dev": true, "requires": { - "@babel/types": "^7.16.0" + "@babel/traverse": "^7.25.9", + "@babel/types": "^7.25.9" } }, - "@babel/helper-split-export-declaration": { - "version": "7.16.7", - "resolved": "https://registry.npmjs.org/@babel/helper-split-export-declaration/-/helper-split-export-declaration-7.16.7.tgz", - "integrity": "sha512-xbWoy/PFoxSWazIToT9Sif+jJTlrMcndIsaOKvTA6u7QEo7ilkRZpjew18/W3c7nm8fXdUDXh02VXTbZ0pGDNw==", - "dev": true, - "requires": { - "@babel/types": "^7.16.7" - } + "@babel/helper-string-parser": { + "version": "7.25.9", + "resolved": "https://r.cnpmjs.org/@babel/helper-string-parser/-/helper-string-parser-7.25.9.tgz", + "integrity": "sha512-4A/SCr/2KLd5jrtOMFzaKjVtAei3+2r/NChoBNoZ3EyP/+GlhoaEGoWOZUmFmoITP7zOJyHIMm+DYRd8o3PvHA==", + "dev": true }, "@babel/helper-validator-identifier": { - "version": "7.16.7", - "resolved": "https://registry.npmjs.org/@babel/helper-validator-identifier/-/helper-validator-identifier-7.16.7.tgz", - "integrity": "sha512-hsEnFemeiW4D08A5gUAZxLBTXpZ39P+a+DGDsHw1yxqyQ/jzFEnxf5uTEGp+3bzAbNOxU1paTgYS4ECU/IgfDw==", + "version": "7.25.9", + "resolved": "https://r.cnpmjs.org/@babel/helper-validator-identifier/-/helper-validator-identifier-7.25.9.tgz", + "integrity": "sha512-Ed61U6XJc3CVRfkERJWDz4dJwKe7iLmmJsbOGu9wSloNSFttHV0I8g6UAgb7qnK5ly5bGLPd4oXZlxCdANBOWQ==", "dev": true }, "@babel/helper-validator-option": { - "version": "7.16.7", - "resolved": "https://registry.npmjs.org/@babel/helper-validator-option/-/helper-validator-option-7.16.7.tgz", - "integrity": "sha512-TRtenOuRUVo9oIQGPC5G9DgK4743cdxvtOw0weQNpZXaS16SCBi5MNjZF8vba3ETURjZpTbVn7Vvcf2eAwFozQ==", + "version": "7.25.9", + "resolved": "https://r.cnpmjs.org/@babel/helper-validator-option/-/helper-validator-option-7.25.9.tgz", + "integrity": "sha512-e/zv1co8pp55dNdEcCynfj9X7nyUKUXoUEwfXqaZt0omVOmDe9oOTdKStH4GmAw6zxMFs50ZayuMfHDKlO7Tfw==", "dev": true }, "@babel/helper-wrap-function": { - "version": "7.16.8", - "resolved": "https://registry.npmjs.org/@babel/helper-wrap-function/-/helper-wrap-function-7.16.8.tgz", - "integrity": "sha512-8RpyRVIAW1RcDDGTA+GpPAwV22wXCfKOoM9bet6TLkGIFTkRQSkH1nMQ5Yet4MpoXe1ZwHPVtNasc2w0uZMqnw==", + "version": "7.25.9", + "resolved": "https://r.cnpmjs.org/@babel/helper-wrap-function/-/helper-wrap-function-7.25.9.tgz", + "integrity": "sha512-ETzz9UTjQSTmw39GboatdymDq4XIQbR8ySgVrylRhPOFpsd+JrKHIuF0de7GCWmem+T4uC5z7EZguod7Wj4A4g==", "dev": true, "requires": { - "@babel/helper-function-name": "^7.16.7", - "@babel/template": "^7.16.7", - "@babel/traverse": "^7.16.8", - "@babel/types": "^7.16.8" + "@babel/template": "^7.25.9", + "@babel/traverse": "^7.25.9", + "@babel/types": "^7.25.9" } }, "@babel/helpers": { - "version": "7.16.7", - "resolved": "https://registry.npmjs.org/@babel/helpers/-/helpers-7.16.7.tgz", - "integrity": "sha512-9ZDoqtfY7AuEOt3cxchfii6C7GDyyMBffktR5B2jvWv8u2+efwvpnVKXMWzNehqy68tKgAfSwfdw/lWpthS2bw==", + "version": "7.26.0", + "resolved": "https://r.cnpmjs.org/@babel/helpers/-/helpers-7.26.0.tgz", + "integrity": "sha512-tbhNuIxNcVb21pInl3ZSjksLCvgdZy9KwJ8brv993QtIVKJBBkYXz4q4ZbAv31GdnC+R90np23L5FbEBlthAEw==", "dev": true, "requires": { - "@babel/template": "^7.16.7", - "@babel/traverse": "^7.16.7", - "@babel/types": "^7.16.7" + "@babel/template": "^7.25.9", + "@babel/types": "^7.26.0" } }, "@babel/highlight": { @@ -6884,730 +6833,689 @@ }, "supports-color": { "version": "5.5.0", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.5.0.tgz", - "integrity": "sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==", - "dev": true, - "requires": { - "has-flag": "^3.0.0" - } - } - } - }, - "@babel/parser": { - "version": "7.16.8", - "resolved": "https://registry.npmjs.org/@babel/parser/-/parser-7.16.8.tgz", - "integrity": "sha512-i7jDUfrVBWc+7OKcBzEe5n7fbv3i2fWtxKzzCvOjnzSxMfWMigAhtfJ7qzZNGFNMsCCd67+uz553dYKWXPvCKw==", - "dev": true - }, - "@babel/plugin-bugfix-safari-id-destructuring-collision-in-function-expression": { - "version": "7.16.7", - "resolved": "https://registry.npmjs.org/@babel/plugin-bugfix-safari-id-destructuring-collision-in-function-expression/-/plugin-bugfix-safari-id-destructuring-collision-in-function-expression-7.16.7.tgz", - "integrity": "sha512-anv/DObl7waiGEnC24O9zqL0pSuI9hljihqiDuFHC8d7/bjr/4RLGPWuc8rYOff/QPzbEPSkzG8wGG9aDuhHRg==", - "dev": true, - "requires": { - "@babel/helper-plugin-utils": "^7.16.7" - } - }, - "@babel/plugin-bugfix-v8-spread-parameters-in-optional-chaining": { - "version": "7.16.7", - "resolved": "https://registry.npmjs.org/@babel/plugin-bugfix-v8-spread-parameters-in-optional-chaining/-/plugin-bugfix-v8-spread-parameters-in-optional-chaining-7.16.7.tgz", - "integrity": "sha512-di8vUHRdf+4aJ7ltXhaDbPoszdkh59AQtJM5soLsuHpQJdFQZOA4uGj0V2u/CZ8bJ/u8ULDL5yq6FO/bCXnKHw==", - "dev": true, - "requires": { - "@babel/helper-plugin-utils": "^7.16.7", - "@babel/helper-skip-transparent-expression-wrappers": "^7.16.0", - "@babel/plugin-proposal-optional-chaining": "^7.16.7" - } - }, - "@babel/plugin-proposal-async-generator-functions": { - "version": "7.16.8", - "resolved": "https://registry.npmjs.org/@babel/plugin-proposal-async-generator-functions/-/plugin-proposal-async-generator-functions-7.16.8.tgz", - "integrity": "sha512-71YHIvMuiuqWJQkebWJtdhQTfd4Q4mF76q2IX37uZPkG9+olBxsX+rH1vkhFto4UeJZ9dPY2s+mDvhDm1u2BGQ==", - "dev": true, - "requires": { - "@babel/helper-plugin-utils": "^7.16.7", - "@babel/helper-remap-async-to-generator": "^7.16.8", - "@babel/plugin-syntax-async-generators": "^7.8.4" - } - }, - "@babel/plugin-proposal-class-properties": { - "version": "7.16.7", - "resolved": "https://registry.npmjs.org/@babel/plugin-proposal-class-properties/-/plugin-proposal-class-properties-7.16.7.tgz", - "integrity": "sha512-IobU0Xme31ewjYOShSIqd/ZGM/r/cuOz2z0MDbNrhF5FW+ZVgi0f2lyeoj9KFPDOAqsYxmLWZte1WOwlvY9aww==", - "dev": true, - "requires": { - "@babel/helper-create-class-features-plugin": "^7.16.7", - "@babel/helper-plugin-utils": "^7.16.7" + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.5.0.tgz", + "integrity": "sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==", + "dev": true, + "requires": { + "has-flag": "^3.0.0" + } + } } }, - "@babel/plugin-proposal-class-static-block": { - "version": "7.16.7", - "resolved": "https://registry.npmjs.org/@babel/plugin-proposal-class-static-block/-/plugin-proposal-class-static-block-7.16.7.tgz", - "integrity": "sha512-dgqJJrcZoG/4CkMopzhPJjGxsIe9A8RlkQLnL/Vhhx8AA9ZuaRwGSlscSh42hazc7WSrya/IK7mTeoF0DP9tEw==", + "@babel/parser": { + "version": "7.26.3", + "resolved": "https://r.cnpmjs.org/@babel/parser/-/parser-7.26.3.tgz", + "integrity": "sha512-WJ/CvmY8Mea8iDXo6a7RK2wbmJITT5fN3BEkRuFlxVyNx8jOKIIhmC4fSkTcPcf8JyavbBwIe6OpiCOBXt/IcA==", "dev": true, "requires": { - "@babel/helper-create-class-features-plugin": "^7.16.7", - "@babel/helper-plugin-utils": "^7.16.7", - "@babel/plugin-syntax-class-static-block": "^7.14.5" + "@babel/types": "^7.26.3" } }, - "@babel/plugin-proposal-dynamic-import": { - "version": "7.16.7", - "resolved": "https://registry.npmjs.org/@babel/plugin-proposal-dynamic-import/-/plugin-proposal-dynamic-import-7.16.7.tgz", - "integrity": "sha512-I8SW9Ho3/8DRSdmDdH3gORdyUuYnk1m4cMxUAdu5oy4n3OfN8flDEH+d60iG7dUfi0KkYwSvoalHzzdRzpWHTg==", + "@babel/plugin-bugfix-firefox-class-in-computed-class-key": { + "version": "7.25.9", + "resolved": "https://r.cnpmjs.org/@babel/plugin-bugfix-firefox-class-in-computed-class-key/-/plugin-bugfix-firefox-class-in-computed-class-key-7.25.9.tgz", + "integrity": "sha512-ZkRyVkThtxQ/J6nv3JFYv1RYY+JT5BvU0y3k5bWrmuG4woXypRa4PXmm9RhOwodRkYFWqC0C0cqcJ4OqR7kW+g==", "dev": true, "requires": { - "@babel/helper-plugin-utils": "^7.16.7", - "@babel/plugin-syntax-dynamic-import": "^7.8.3" + "@babel/helper-plugin-utils": "^7.25.9", + "@babel/traverse": "^7.25.9" } }, - "@babel/plugin-proposal-export-namespace-from": { - "version": "7.16.7", - "resolved": "https://registry.npmjs.org/@babel/plugin-proposal-export-namespace-from/-/plugin-proposal-export-namespace-from-7.16.7.tgz", - "integrity": "sha512-ZxdtqDXLRGBL64ocZcs7ovt71L3jhC1RGSyR996svrCi3PYqHNkb3SwPJCs8RIzD86s+WPpt2S73+EHCGO+NUA==", + "@babel/plugin-bugfix-safari-class-field-initializer-scope": { + "version": "7.25.9", + "resolved": "https://r.cnpmjs.org/@babel/plugin-bugfix-safari-class-field-initializer-scope/-/plugin-bugfix-safari-class-field-initializer-scope-7.25.9.tgz", + "integrity": "sha512-MrGRLZxLD/Zjj0gdU15dfs+HH/OXvnw/U4jJD8vpcP2CJQapPEv1IWwjc/qMg7ItBlPwSv1hRBbb7LeuANdcnw==", "dev": true, "requires": { - "@babel/helper-plugin-utils": "^7.16.7", - "@babel/plugin-syntax-export-namespace-from": "^7.8.3" + "@babel/helper-plugin-utils": "^7.25.9" } }, - "@babel/plugin-proposal-json-strings": { - "version": "7.16.7", - "resolved": "https://registry.npmjs.org/@babel/plugin-proposal-json-strings/-/plugin-proposal-json-strings-7.16.7.tgz", - "integrity": "sha512-lNZ3EEggsGY78JavgbHsK9u5P3pQaW7k4axlgFLYkMd7UBsiNahCITShLjNQschPyjtO6dADrL24757IdhBrsQ==", + "@babel/plugin-bugfix-safari-id-destructuring-collision-in-function-expression": { + "version": "7.25.9", + "resolved": "https://r.cnpmjs.org/@babel/plugin-bugfix-safari-id-destructuring-collision-in-function-expression/-/plugin-bugfix-safari-id-destructuring-collision-in-function-expression-7.25.9.tgz", + "integrity": "sha512-2qUwwfAFpJLZqxd02YW9btUCZHl+RFvdDkNfZwaIJrvB8Tesjsk8pEQkTvGwZXLqXUx/2oyY3ySRhm6HOXuCug==", "dev": true, "requires": { - "@babel/helper-plugin-utils": "^7.16.7", - "@babel/plugin-syntax-json-strings": "^7.8.3" + "@babel/helper-plugin-utils": "^7.25.9" } }, - "@babel/plugin-proposal-logical-assignment-operators": { - "version": "7.16.7", - "resolved": "https://registry.npmjs.org/@babel/plugin-proposal-logical-assignment-operators/-/plugin-proposal-logical-assignment-operators-7.16.7.tgz", - "integrity": "sha512-K3XzyZJGQCr00+EtYtrDjmwX7o7PLK6U9bi1nCwkQioRFVUv6dJoxbQjtWVtP+bCPy82bONBKG8NPyQ4+i6yjg==", + "@babel/plugin-bugfix-v8-spread-parameters-in-optional-chaining": { + "version": "7.25.9", + "resolved": "https://r.cnpmjs.org/@babel/plugin-bugfix-v8-spread-parameters-in-optional-chaining/-/plugin-bugfix-v8-spread-parameters-in-optional-chaining-7.25.9.tgz", + "integrity": "sha512-6xWgLZTJXwilVjlnV7ospI3xi+sl8lN8rXXbBD6vYn3UYDlGsag8wrZkKcSI8G6KgqKP7vNFaDgeDnfAABq61g==", "dev": true, "requires": { - "@babel/helper-plugin-utils": "^7.16.7", - "@babel/plugin-syntax-logical-assignment-operators": "^7.10.4" + "@babel/helper-plugin-utils": "^7.25.9", + "@babel/helper-skip-transparent-expression-wrappers": "^7.25.9", + "@babel/plugin-transform-optional-chaining": "^7.25.9" } }, - "@babel/plugin-proposal-nullish-coalescing-operator": { - "version": "7.16.7", - "resolved": "https://registry.npmjs.org/@babel/plugin-proposal-nullish-coalescing-operator/-/plugin-proposal-nullish-coalescing-operator-7.16.7.tgz", - "integrity": "sha512-aUOrYU3EVtjf62jQrCj63pYZ7k6vns2h/DQvHPWGmsJRYzWXZ6/AsfgpiRy6XiuIDADhJzP2Q9MwSMKauBQ+UQ==", + "@babel/plugin-bugfix-v8-static-class-fields-redefine-readonly": { + "version": "7.25.9", + "resolved": "https://r.cnpmjs.org/@babel/plugin-bugfix-v8-static-class-fields-redefine-readonly/-/plugin-bugfix-v8-static-class-fields-redefine-readonly-7.25.9.tgz", + "integrity": "sha512-aLnMXYPnzwwqhYSCyXfKkIkYgJ8zv9RK+roo9DkTXz38ynIhd9XCbN08s3MGvqL2MYGVUGdRQLL/JqBIeJhJBg==", "dev": true, "requires": { - "@babel/helper-plugin-utils": "^7.16.7", - "@babel/plugin-syntax-nullish-coalescing-operator": "^7.8.3" + "@babel/helper-plugin-utils": "^7.25.9", + "@babel/traverse": "^7.25.9" } }, - "@babel/plugin-proposal-numeric-separator": { + "@babel/plugin-proposal-class-properties": { "version": "7.16.7", - "resolved": "https://registry.npmjs.org/@babel/plugin-proposal-numeric-separator/-/plugin-proposal-numeric-separator-7.16.7.tgz", - "integrity": "sha512-vQgPMknOIgiuVqbokToyXbkY/OmmjAzr/0lhSIbG/KmnzXPGwW/AdhdKpi+O4X/VkWiWjnkKOBiqJrTaC98VKw==", + "resolved": "https://registry.npmjs.org/@babel/plugin-proposal-class-properties/-/plugin-proposal-class-properties-7.16.7.tgz", + "integrity": "sha512-IobU0Xme31ewjYOShSIqd/ZGM/r/cuOz2z0MDbNrhF5FW+ZVgi0f2lyeoj9KFPDOAqsYxmLWZte1WOwlvY9aww==", "dev": true, "requires": { - "@babel/helper-plugin-utils": "^7.16.7", - "@babel/plugin-syntax-numeric-separator": "^7.10.4" + "@babel/helper-create-class-features-plugin": "^7.16.7", + "@babel/helper-plugin-utils": "^7.16.7" } }, - "@babel/plugin-proposal-object-rest-spread": { - "version": "7.16.7", - "resolved": "https://registry.npmjs.org/@babel/plugin-proposal-object-rest-spread/-/plugin-proposal-object-rest-spread-7.16.7.tgz", - "integrity": "sha512-3O0Y4+dw94HA86qSg9IHfyPktgR7q3gpNVAeiKQd+8jBKFaU5NQS1Yatgo4wY+UFNuLjvxcSmzcsHqrhgTyBUA==", + "@babel/plugin-proposal-private-property-in-object": { + "version": "7.21.0-placeholder-for-preset-env.2", + "resolved": "https://r.cnpmjs.org/@babel/plugin-proposal-private-property-in-object/-/plugin-proposal-private-property-in-object-7.21.0-placeholder-for-preset-env.2.tgz", + "integrity": "sha512-SOSkfJDddaM7mak6cPEpswyTRnuRltl429hMraQEglW+OkovnCzsiszTmsrlY//qLFjCpQDFRvjdm2wA5pPm9w==", "dev": true, - "requires": { - "@babel/compat-data": "^7.16.4", - "@babel/helper-compilation-targets": "^7.16.7", - "@babel/helper-plugin-utils": "^7.16.7", - "@babel/plugin-syntax-object-rest-spread": "^7.8.3", - "@babel/plugin-transform-parameters": "^7.16.7" - } + "requires": {} }, - "@babel/plugin-proposal-optional-catch-binding": { - "version": "7.16.7", - "resolved": "https://registry.npmjs.org/@babel/plugin-proposal-optional-catch-binding/-/plugin-proposal-optional-catch-binding-7.16.7.tgz", - "integrity": "sha512-eMOH/L4OvWSZAE1VkHbr1vckLG1WUcHGJSLqqQwl2GaUqG6QjddvrOaTUMNYiv77H5IKPMZ9U9P7EaHwvAShfA==", + "@babel/plugin-syntax-import-assertions": { + "version": "7.26.0", + "resolved": "https://r.cnpmjs.org/@babel/plugin-syntax-import-assertions/-/plugin-syntax-import-assertions-7.26.0.tgz", + "integrity": "sha512-QCWT5Hh830hK5EQa7XzuqIkQU9tT/whqbDz7kuaZMHFl1inRRg7JnuAEOQ0Ur0QUl0NufCk1msK2BeY79Aj/eg==", "dev": true, "requires": { - "@babel/helper-plugin-utils": "^7.16.7", - "@babel/plugin-syntax-optional-catch-binding": "^7.8.3" + "@babel/helper-plugin-utils": "^7.25.9" } }, - "@babel/plugin-proposal-optional-chaining": { - "version": "7.16.7", - "resolved": "https://registry.npmjs.org/@babel/plugin-proposal-optional-chaining/-/plugin-proposal-optional-chaining-7.16.7.tgz", - "integrity": "sha512-eC3xy+ZrUcBtP7x+sq62Q/HYd674pPTb/77XZMb5wbDPGWIdUbSr4Agr052+zaUPSb+gGRnjxXfKFvx5iMJ+DA==", + "@babel/plugin-syntax-import-attributes": { + "version": "7.26.0", + "resolved": "https://r.cnpmjs.org/@babel/plugin-syntax-import-attributes/-/plugin-syntax-import-attributes-7.26.0.tgz", + "integrity": "sha512-e2dttdsJ1ZTpi3B9UYGLw41hifAubg19AtCu/2I/F1QNVclOBr1dYpTdmdyZ84Xiz43BS/tCUkMAZNLv12Pi+A==", "dev": true, "requires": { - "@babel/helper-plugin-utils": "^7.16.7", - "@babel/helper-skip-transparent-expression-wrappers": "^7.16.0", - "@babel/plugin-syntax-optional-chaining": "^7.8.3" + "@babel/helper-plugin-utils": "^7.25.9" } }, - "@babel/plugin-proposal-private-methods": { - "version": "7.16.7", - "resolved": "https://registry.npmjs.org/@babel/plugin-proposal-private-methods/-/plugin-proposal-private-methods-7.16.7.tgz", - "integrity": "sha512-7twV3pzhrRxSwHeIvFE6coPgvo+exNDOiGUMg39o2LiLo1Y+4aKpfkcLGcg1UHonzorCt7SNXnoMyCnnIOA8Sw==", + "@babel/plugin-syntax-unicode-sets-regex": { + "version": "7.18.6", + "resolved": "https://r.cnpmjs.org/@babel/plugin-syntax-unicode-sets-regex/-/plugin-syntax-unicode-sets-regex-7.18.6.tgz", + "integrity": "sha512-727YkEAPwSIQTv5im8QHz3upqp92JTWhidIC81Tdx4VJYIte/VndKf1qKrfnnhPLiPghStWfvC/iFaMCQu7Nqg==", "dev": true, "requires": { - "@babel/helper-create-class-features-plugin": "^7.16.7", - "@babel/helper-plugin-utils": "^7.16.7" + "@babel/helper-create-regexp-features-plugin": "^7.18.6", + "@babel/helper-plugin-utils": "^7.18.6" } }, - "@babel/plugin-proposal-private-property-in-object": { - "version": "7.16.7", - "resolved": "https://registry.npmjs.org/@babel/plugin-proposal-private-property-in-object/-/plugin-proposal-private-property-in-object-7.16.7.tgz", - "integrity": "sha512-rMQkjcOFbm+ufe3bTZLyOfsOUOxyvLXZJCTARhJr+8UMSoZmqTe1K1BgkFcrW37rAchWg57yI69ORxiWvUINuQ==", + "@babel/plugin-transform-arrow-functions": { + "version": "7.25.9", + "resolved": "https://r.cnpmjs.org/@babel/plugin-transform-arrow-functions/-/plugin-transform-arrow-functions-7.25.9.tgz", + "integrity": "sha512-6jmooXYIwn9ca5/RylZADJ+EnSxVUS5sjeJ9UPk6RWRzXCmOJCy6dqItPJFpw2cuCangPK4OYr5uhGKcmrm5Qg==", "dev": true, "requires": { - "@babel/helper-annotate-as-pure": "^7.16.7", - "@babel/helper-create-class-features-plugin": "^7.16.7", - "@babel/helper-plugin-utils": "^7.16.7", - "@babel/plugin-syntax-private-property-in-object": "^7.14.5" + "@babel/helper-plugin-utils": "^7.25.9" } }, - "@babel/plugin-proposal-unicode-property-regex": { - "version": "7.16.7", - "resolved": "https://registry.npmjs.org/@babel/plugin-proposal-unicode-property-regex/-/plugin-proposal-unicode-property-regex-7.16.7.tgz", - "integrity": "sha512-QRK0YI/40VLhNVGIjRNAAQkEHws0cswSdFFjpFyt943YmJIU1da9uW63Iu6NFV6CxTZW5eTDCrwZUstBWgp/Rg==", + "@babel/plugin-transform-async-generator-functions": { + "version": "7.25.9", + "resolved": "https://r.cnpmjs.org/@babel/plugin-transform-async-generator-functions/-/plugin-transform-async-generator-functions-7.25.9.tgz", + "integrity": "sha512-RXV6QAzTBbhDMO9fWwOmwwTuYaiPbggWQ9INdZqAYeSHyG7FzQ+nOZaUUjNwKv9pV3aE4WFqFm1Hnbci5tBCAw==", "dev": true, "requires": { - "@babel/helper-create-regexp-features-plugin": "^7.16.7", - "@babel/helper-plugin-utils": "^7.16.7" + "@babel/helper-plugin-utils": "^7.25.9", + "@babel/helper-remap-async-to-generator": "^7.25.9", + "@babel/traverse": "^7.25.9" } }, - "@babel/plugin-syntax-async-generators": { - "version": "7.8.4", - "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-async-generators/-/plugin-syntax-async-generators-7.8.4.tgz", - "integrity": "sha512-tycmZxkGfZaxhMRbXlPXuVFpdWlXpir2W4AMhSJgRKzk/eDlIXOhb2LHWoLpDF7TEHylV5zNhykX6KAgHJmTNw==", + "@babel/plugin-transform-async-to-generator": { + "version": "7.25.9", + "resolved": "https://r.cnpmjs.org/@babel/plugin-transform-async-to-generator/-/plugin-transform-async-to-generator-7.25.9.tgz", + "integrity": "sha512-NT7Ejn7Z/LjUH0Gv5KsBCxh7BH3fbLTV0ptHvpeMvrt3cPThHfJfst9Wrb7S8EvJ7vRTFI7z+VAvFVEQn/m5zQ==", "dev": true, "requires": { - "@babel/helper-plugin-utils": "^7.8.0" + "@babel/helper-module-imports": "^7.25.9", + "@babel/helper-plugin-utils": "^7.25.9", + "@babel/helper-remap-async-to-generator": "^7.25.9" } }, - "@babel/plugin-syntax-class-properties": { - "version": "7.12.13", - "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-class-properties/-/plugin-syntax-class-properties-7.12.13.tgz", - "integrity": "sha512-fm4idjKla0YahUNgFNLCB0qySdsoPiZP3iQE3rky0mBUtMZ23yDJ9SJdg6dXTSDnulOVqiF3Hgr9nbXvXTQZYA==", + "@babel/plugin-transform-block-scoped-functions": { + "version": "7.25.9", + "resolved": "https://r.cnpmjs.org/@babel/plugin-transform-block-scoped-functions/-/plugin-transform-block-scoped-functions-7.25.9.tgz", + "integrity": "sha512-toHc9fzab0ZfenFpsyYinOX0J/5dgJVA2fm64xPewu7CoYHWEivIWKxkK2rMi4r3yQqLnVmheMXRdG+k239CgA==", "dev": true, "requires": { - "@babel/helper-plugin-utils": "^7.12.13" + "@babel/helper-plugin-utils": "^7.25.9" } }, - "@babel/plugin-syntax-class-static-block": { - "version": "7.14.5", - "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-class-static-block/-/plugin-syntax-class-static-block-7.14.5.tgz", - "integrity": "sha512-b+YyPmr6ldyNnM6sqYeMWE+bgJcJpO6yS4QD7ymxgH34GBPNDM/THBh8iunyvKIZztiwLH4CJZ0RxTk9emgpjw==", + "@babel/plugin-transform-block-scoping": { + "version": "7.25.9", + "resolved": "https://r.cnpmjs.org/@babel/plugin-transform-block-scoping/-/plugin-transform-block-scoping-7.25.9.tgz", + "integrity": "sha512-1F05O7AYjymAtqbsFETboN1NvBdcnzMerO+zlMyJBEz6WkMdejvGWw9p05iTSjC85RLlBseHHQpYaM4gzJkBGg==", "dev": true, "requires": { - "@babel/helper-plugin-utils": "^7.14.5" + "@babel/helper-plugin-utils": "^7.25.9" } }, - "@babel/plugin-syntax-dynamic-import": { - "version": "7.8.3", - "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-dynamic-import/-/plugin-syntax-dynamic-import-7.8.3.tgz", - "integrity": "sha512-5gdGbFon+PszYzqs83S3E5mpi7/y/8M9eC90MRTZfduQOYW76ig6SOSPNe41IG5LoP3FGBn2N0RjVDSQiS94kQ==", + "@babel/plugin-transform-class-properties": { + "version": "7.25.9", + "resolved": "https://r.cnpmjs.org/@babel/plugin-transform-class-properties/-/plugin-transform-class-properties-7.25.9.tgz", + "integrity": "sha512-bbMAII8GRSkcd0h0b4X+36GksxuheLFjP65ul9w6C3KgAamI3JqErNgSrosX6ZPj+Mpim5VvEbawXxJCyEUV3Q==", "dev": true, "requires": { - "@babel/helper-plugin-utils": "^7.8.0" + "@babel/helper-create-class-features-plugin": "^7.25.9", + "@babel/helper-plugin-utils": "^7.25.9" } }, - "@babel/plugin-syntax-export-namespace-from": { - "version": "7.8.3", - "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-export-namespace-from/-/plugin-syntax-export-namespace-from-7.8.3.tgz", - "integrity": "sha512-MXf5laXo6c1IbEbegDmzGPwGNTsHZmEy6QGznu5Sh2UCWvueywb2ee+CCE4zQiZstxU9BMoQO9i6zUFSY0Kj0Q==", + "@babel/plugin-transform-class-static-block": { + "version": "7.26.0", + "resolved": "https://r.cnpmjs.org/@babel/plugin-transform-class-static-block/-/plugin-transform-class-static-block-7.26.0.tgz", + "integrity": "sha512-6J2APTs7BDDm+UMqP1useWqhcRAXo0WIoVj26N7kPFB6S73Lgvyka4KTZYIxtgYXiN5HTyRObA72N2iu628iTQ==", "dev": true, "requires": { - "@babel/helper-plugin-utils": "^7.8.3" + "@babel/helper-create-class-features-plugin": "^7.25.9", + "@babel/helper-plugin-utils": "^7.25.9" } }, - "@babel/plugin-syntax-json-strings": { - "version": "7.8.3", - "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-json-strings/-/plugin-syntax-json-strings-7.8.3.tgz", - "integrity": "sha512-lY6kdGpWHvjoe2vk4WrAapEuBR69EMxZl+RoGRhrFGNYVK8mOPAW8VfbT/ZgrFbXlDNiiaxQnAtgVCZ6jv30EA==", + "@babel/plugin-transform-classes": { + "version": "7.25.9", + "resolved": "https://r.cnpmjs.org/@babel/plugin-transform-classes/-/plugin-transform-classes-7.25.9.tgz", + "integrity": "sha512-mD8APIXmseE7oZvZgGABDyM34GUmK45Um2TXiBUt7PnuAxrgoSVf123qUzPxEr/+/BHrRn5NMZCdE2m/1F8DGg==", "dev": true, "requires": { - "@babel/helper-plugin-utils": "^7.8.0" + "@babel/helper-annotate-as-pure": "^7.25.9", + "@babel/helper-compilation-targets": "^7.25.9", + "@babel/helper-plugin-utils": "^7.25.9", + "@babel/helper-replace-supers": "^7.25.9", + "@babel/traverse": "^7.25.9", + "globals": "^11.1.0" } }, - "@babel/plugin-syntax-logical-assignment-operators": { - "version": "7.10.4", - "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-logical-assignment-operators/-/plugin-syntax-logical-assignment-operators-7.10.4.tgz", - "integrity": "sha512-d8waShlpFDinQ5MtvGU9xDAOzKH47+FFoney2baFIoMr952hKOLp1HR7VszoZvOsV/4+RRszNY7D17ba0te0ig==", + "@babel/plugin-transform-computed-properties": { + "version": "7.25.9", + "resolved": "https://r.cnpmjs.org/@babel/plugin-transform-computed-properties/-/plugin-transform-computed-properties-7.25.9.tgz", + "integrity": "sha512-HnBegGqXZR12xbcTHlJ9HGxw1OniltT26J5YpfruGqtUHlz/xKf/G2ak9e+t0rVqrjXa9WOhvYPz1ERfMj23AA==", "dev": true, "requires": { - "@babel/helper-plugin-utils": "^7.10.4" + "@babel/helper-plugin-utils": "^7.25.9", + "@babel/template": "^7.25.9" } }, - "@babel/plugin-syntax-nullish-coalescing-operator": { - "version": "7.8.3", - "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-nullish-coalescing-operator/-/plugin-syntax-nullish-coalescing-operator-7.8.3.tgz", - "integrity": "sha512-aSff4zPII1u2QD7y+F8oDsz19ew4IGEJg9SVW+bqwpwtfFleiQDMdzA/R+UlWDzfnHFCxxleFT0PMIrR36XLNQ==", + "@babel/plugin-transform-destructuring": { + "version": "7.25.9", + "resolved": "https://r.cnpmjs.org/@babel/plugin-transform-destructuring/-/plugin-transform-destructuring-7.25.9.tgz", + "integrity": "sha512-WkCGb/3ZxXepmMiX101nnGiU+1CAdut8oHyEOHxkKuS1qKpU2SMXE2uSvfz8PBuLd49V6LEsbtyPhWC7fnkgvQ==", "dev": true, "requires": { - "@babel/helper-plugin-utils": "^7.8.0" + "@babel/helper-plugin-utils": "^7.25.9" } }, - "@babel/plugin-syntax-numeric-separator": { - "version": "7.10.4", - "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-numeric-separator/-/plugin-syntax-numeric-separator-7.10.4.tgz", - "integrity": "sha512-9H6YdfkcK/uOnY/K7/aA2xpzaAgkQn37yzWUMRK7OaPOqOpGS1+n0H5hxT9AUw9EsSjPW8SVyMJwYRtWs3X3ug==", + "@babel/plugin-transform-dotall-regex": { + "version": "7.25.9", + "resolved": "https://r.cnpmjs.org/@babel/plugin-transform-dotall-regex/-/plugin-transform-dotall-regex-7.25.9.tgz", + "integrity": "sha512-t7ZQ7g5trIgSRYhI9pIJtRl64KHotutUJsh4Eze5l7olJv+mRSg4/MmbZ0tv1eeqRbdvo/+trvJD/Oc5DmW2cA==", "dev": true, "requires": { - "@babel/helper-plugin-utils": "^7.10.4" + "@babel/helper-create-regexp-features-plugin": "^7.25.9", + "@babel/helper-plugin-utils": "^7.25.9" } }, - "@babel/plugin-syntax-object-rest-spread": { - "version": "7.8.3", - "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-object-rest-spread/-/plugin-syntax-object-rest-spread-7.8.3.tgz", - "integrity": "sha512-XoqMijGZb9y3y2XskN+P1wUGiVwWZ5JmoDRwx5+3GmEplNyVM2s2Dg8ILFQm8rWM48orGy5YpI5Bl8U1y7ydlA==", + "@babel/plugin-transform-duplicate-keys": { + "version": "7.25.9", + "resolved": "https://r.cnpmjs.org/@babel/plugin-transform-duplicate-keys/-/plugin-transform-duplicate-keys-7.25.9.tgz", + "integrity": "sha512-LZxhJ6dvBb/f3x8xwWIuyiAHy56nrRG3PeYTpBkkzkYRRQ6tJLu68lEF5VIqMUZiAV7a8+Tb78nEoMCMcqjXBw==", "dev": true, "requires": { - "@babel/helper-plugin-utils": "^7.8.0" + "@babel/helper-plugin-utils": "^7.25.9" } }, - "@babel/plugin-syntax-optional-catch-binding": { - "version": "7.8.3", - "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-optional-catch-binding/-/plugin-syntax-optional-catch-binding-7.8.3.tgz", - "integrity": "sha512-6VPD0Pc1lpTqw0aKoeRTMiB+kWhAoT24PA+ksWSBrFtl5SIRVpZlwN3NNPQjehA2E/91FV3RjLWoVTglWcSV3Q==", + "@babel/plugin-transform-duplicate-named-capturing-groups-regex": { + "version": "7.25.9", + "resolved": "https://r.cnpmjs.org/@babel/plugin-transform-duplicate-named-capturing-groups-regex/-/plugin-transform-duplicate-named-capturing-groups-regex-7.25.9.tgz", + "integrity": "sha512-0UfuJS0EsXbRvKnwcLjFtJy/Sxc5J5jhLHnFhy7u4zih97Hz6tJkLU+O+FMMrNZrosUPxDi6sYxJ/EA8jDiAog==", "dev": true, "requires": { - "@babel/helper-plugin-utils": "^7.8.0" + "@babel/helper-create-regexp-features-plugin": "^7.25.9", + "@babel/helper-plugin-utils": "^7.25.9" } }, - "@babel/plugin-syntax-optional-chaining": { - "version": "7.8.3", - "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-optional-chaining/-/plugin-syntax-optional-chaining-7.8.3.tgz", - "integrity": "sha512-KoK9ErH1MBlCPxV0VANkXW2/dw4vlbGDrFgz8bmUsBGYkFRcbRwMh6cIJubdPrkxRwuGdtCk0v/wPTKbQgBjkg==", + "@babel/plugin-transform-dynamic-import": { + "version": "7.25.9", + "resolved": "https://r.cnpmjs.org/@babel/plugin-transform-dynamic-import/-/plugin-transform-dynamic-import-7.25.9.tgz", + "integrity": "sha512-GCggjexbmSLaFhqsojeugBpeaRIgWNTcgKVq/0qIteFEqY2A+b9QidYadrWlnbWQUrW5fn+mCvf3tr7OeBFTyg==", "dev": true, "requires": { - "@babel/helper-plugin-utils": "^7.8.0" + "@babel/helper-plugin-utils": "^7.25.9" } }, - "@babel/plugin-syntax-private-property-in-object": { - "version": "7.14.5", - "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-private-property-in-object/-/plugin-syntax-private-property-in-object-7.14.5.tgz", - "integrity": "sha512-0wVnp9dxJ72ZUJDV27ZfbSj6iHLoytYZmh3rFcxNnvsJF3ktkzLDZPy/mA17HGsaQT3/DQsWYX1f1QGWkCoVUg==", + "@babel/plugin-transform-exponentiation-operator": { + "version": "7.26.3", + "resolved": "https://r.cnpmjs.org/@babel/plugin-transform-exponentiation-operator/-/plugin-transform-exponentiation-operator-7.26.3.tgz", + "integrity": "sha512-7CAHcQ58z2chuXPWblnn1K6rLDnDWieghSOEmqQsrBenH0P9InCUtOJYD89pvngljmZlJcz3fcmgYsXFNGa1ZQ==", "dev": true, "requires": { - "@babel/helper-plugin-utils": "^7.14.5" + "@babel/helper-plugin-utils": "^7.25.9" } }, - "@babel/plugin-syntax-top-level-await": { - "version": "7.14.5", - "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-top-level-await/-/plugin-syntax-top-level-await-7.14.5.tgz", - "integrity": "sha512-hx++upLv5U1rgYfwe1xBQUhRmU41NEvpUvrp8jkrSCdvGSnM5/qdRMtylJ6PG5OFkBaHkbTAKTnd3/YyESRHFw==", + "@babel/plugin-transform-export-namespace-from": { + "version": "7.25.9", + "resolved": "https://r.cnpmjs.org/@babel/plugin-transform-export-namespace-from/-/plugin-transform-export-namespace-from-7.25.9.tgz", + "integrity": "sha512-2NsEz+CxzJIVOPx2o9UsW1rXLqtChtLoVnwYHHiB04wS5sgn7mrV45fWMBX0Kk+ub9uXytVYfNP2HjbVbCB3Ww==", "dev": true, "requires": { - "@babel/helper-plugin-utils": "^7.14.5" + "@babel/helper-plugin-utils": "^7.25.9" } }, - "@babel/plugin-transform-arrow-functions": { - "version": "7.16.7", - "resolved": "https://registry.npmjs.org/@babel/plugin-transform-arrow-functions/-/plugin-transform-arrow-functions-7.16.7.tgz", - "integrity": "sha512-9ffkFFMbvzTvv+7dTp/66xvZAWASuPD5Tl9LK3Z9vhOmANo6j94rik+5YMBt4CwHVMWLWpMsriIc2zsa3WW3xQ==", + "@babel/plugin-transform-for-of": { + "version": "7.25.9", + "resolved": "https://r.cnpmjs.org/@babel/plugin-transform-for-of/-/plugin-transform-for-of-7.25.9.tgz", + "integrity": "sha512-LqHxduHoaGELJl2uhImHwRQudhCM50pT46rIBNvtT/Oql3nqiS3wOwP+5ten7NpYSXrrVLgtZU3DZmPtWZo16A==", "dev": true, "requires": { - "@babel/helper-plugin-utils": "^7.16.7" + "@babel/helper-plugin-utils": "^7.25.9", + "@babel/helper-skip-transparent-expression-wrappers": "^7.25.9" } }, - "@babel/plugin-transform-async-to-generator": { - "version": "7.16.8", - "resolved": "https://registry.npmjs.org/@babel/plugin-transform-async-to-generator/-/plugin-transform-async-to-generator-7.16.8.tgz", - "integrity": "sha512-MtmUmTJQHCnyJVrScNzNlofQJ3dLFuobYn3mwOTKHnSCMtbNsqvF71GQmJfFjdrXSsAA7iysFmYWw4bXZ20hOg==", + "@babel/plugin-transform-function-name": { + "version": "7.25.9", + "resolved": "https://r.cnpmjs.org/@babel/plugin-transform-function-name/-/plugin-transform-function-name-7.25.9.tgz", + "integrity": "sha512-8lP+Yxjv14Vc5MuWBpJsoUCd3hD6V9DgBon2FVYL4jJgbnVQ9fTgYmonchzZJOVNgzEgbxp4OwAf6xz6M/14XA==", "dev": true, "requires": { - "@babel/helper-module-imports": "^7.16.7", - "@babel/helper-plugin-utils": "^7.16.7", - "@babel/helper-remap-async-to-generator": "^7.16.8" + "@babel/helper-compilation-targets": "^7.25.9", + "@babel/helper-plugin-utils": "^7.25.9", + "@babel/traverse": "^7.25.9" } }, - "@babel/plugin-transform-block-scoped-functions": { - "version": "7.16.7", - "resolved": "https://registry.npmjs.org/@babel/plugin-transform-block-scoped-functions/-/plugin-transform-block-scoped-functions-7.16.7.tgz", - "integrity": "sha512-JUuzlzmF40Z9cXyytcbZEZKckgrQzChbQJw/5PuEHYeqzCsvebDx0K0jWnIIVcmmDOAVctCgnYs0pMcrYj2zJg==", + "@babel/plugin-transform-json-strings": { + "version": "7.25.9", + "resolved": "https://r.cnpmjs.org/@babel/plugin-transform-json-strings/-/plugin-transform-json-strings-7.25.9.tgz", + "integrity": "sha512-xoTMk0WXceiiIvsaquQQUaLLXSW1KJ159KP87VilruQm0LNNGxWzahxSS6T6i4Zg3ezp4vA4zuwiNUR53qmQAw==", "dev": true, "requires": { - "@babel/helper-plugin-utils": "^7.16.7" + "@babel/helper-plugin-utils": "^7.25.9" } }, - "@babel/plugin-transform-block-scoping": { - "version": "7.16.7", - "resolved": "https://registry.npmjs.org/@babel/plugin-transform-block-scoping/-/plugin-transform-block-scoping-7.16.7.tgz", - "integrity": "sha512-ObZev2nxVAYA4bhyusELdo9hb3H+A56bxH3FZMbEImZFiEDYVHXQSJ1hQKFlDnlt8G9bBrCZ5ZpURZUrV4G5qQ==", + "@babel/plugin-transform-literals": { + "version": "7.25.9", + "resolved": "https://r.cnpmjs.org/@babel/plugin-transform-literals/-/plugin-transform-literals-7.25.9.tgz", + "integrity": "sha512-9N7+2lFziW8W9pBl2TzaNht3+pgMIRP74zizeCSrtnSKVdUl8mAjjOP2OOVQAfZ881P2cNjDj1uAMEdeD50nuQ==", "dev": true, "requires": { - "@babel/helper-plugin-utils": "^7.16.7" + "@babel/helper-plugin-utils": "^7.25.9" } }, - "@babel/plugin-transform-classes": { - "version": "7.16.7", - "resolved": "https://registry.npmjs.org/@babel/plugin-transform-classes/-/plugin-transform-classes-7.16.7.tgz", - "integrity": "sha512-WY7og38SFAGYRe64BrjKf8OrE6ulEHtr5jEYaZMwox9KebgqPi67Zqz8K53EKk1fFEJgm96r32rkKZ3qA2nCWQ==", + "@babel/plugin-transform-logical-assignment-operators": { + "version": "7.25.9", + "resolved": "https://r.cnpmjs.org/@babel/plugin-transform-logical-assignment-operators/-/plugin-transform-logical-assignment-operators-7.25.9.tgz", + "integrity": "sha512-wI4wRAzGko551Y8eVf6iOY9EouIDTtPb0ByZx+ktDGHwv6bHFimrgJM/2T021txPZ2s4c7bqvHbd+vXG6K948Q==", "dev": true, "requires": { - "@babel/helper-annotate-as-pure": "^7.16.7", - "@babel/helper-environment-visitor": "^7.16.7", - "@babel/helper-function-name": "^7.16.7", - "@babel/helper-optimise-call-expression": "^7.16.7", - "@babel/helper-plugin-utils": "^7.16.7", - "@babel/helper-replace-supers": "^7.16.7", - "@babel/helper-split-export-declaration": "^7.16.7", - "globals": "^11.1.0" + "@babel/helper-plugin-utils": "^7.25.9" } }, - "@babel/plugin-transform-computed-properties": { - "version": "7.16.7", - "resolved": "https://registry.npmjs.org/@babel/plugin-transform-computed-properties/-/plugin-transform-computed-properties-7.16.7.tgz", - "integrity": "sha512-gN72G9bcmenVILj//sv1zLNaPyYcOzUho2lIJBMh/iakJ9ygCo/hEF9cpGb61SCMEDxbbyBoVQxrt+bWKu5KGw==", + "@babel/plugin-transform-member-expression-literals": { + "version": "7.25.9", + "resolved": "https://r.cnpmjs.org/@babel/plugin-transform-member-expression-literals/-/plugin-transform-member-expression-literals-7.25.9.tgz", + "integrity": "sha512-PYazBVfofCQkkMzh2P6IdIUaCEWni3iYEerAsRWuVd8+jlM1S9S9cz1dF9hIzyoZ8IA3+OwVYIp9v9e+GbgZhA==", "dev": true, "requires": { - "@babel/helper-plugin-utils": "^7.16.7" + "@babel/helper-plugin-utils": "^7.25.9" } }, - "@babel/plugin-transform-destructuring": { - "version": "7.16.7", - "resolved": "https://registry.npmjs.org/@babel/plugin-transform-destructuring/-/plugin-transform-destructuring-7.16.7.tgz", - "integrity": "sha512-VqAwhTHBnu5xBVDCvrvqJbtLUa++qZaWC0Fgr2mqokBlulZARGyIvZDoqbPlPaKImQ9dKAcCzbv+ul//uqu70A==", + "@babel/plugin-transform-modules-amd": { + "version": "7.25.9", + "resolved": "https://r.cnpmjs.org/@babel/plugin-transform-modules-amd/-/plugin-transform-modules-amd-7.25.9.tgz", + "integrity": "sha512-g5T11tnI36jVClQlMlt4qKDLlWnG5pP9CSM4GhdRciTNMRgkfpo5cR6b4rGIOYPgRRuFAvwjPQ/Yk+ql4dyhbw==", "dev": true, "requires": { - "@babel/helper-plugin-utils": "^7.16.7" + "@babel/helper-module-transforms": "^7.25.9", + "@babel/helper-plugin-utils": "^7.25.9" } }, - "@babel/plugin-transform-dotall-regex": { - "version": "7.16.7", - "resolved": "https://registry.npmjs.org/@babel/plugin-transform-dotall-regex/-/plugin-transform-dotall-regex-7.16.7.tgz", - "integrity": "sha512-Lyttaao2SjZF6Pf4vk1dVKv8YypMpomAbygW+mU5cYP3S5cWTfCJjG8xV6CFdzGFlfWK81IjL9viiTvpb6G7gQ==", + "@babel/plugin-transform-modules-commonjs": { + "version": "7.26.3", + "resolved": "https://r.cnpmjs.org/@babel/plugin-transform-modules-commonjs/-/plugin-transform-modules-commonjs-7.26.3.tgz", + "integrity": "sha512-MgR55l4q9KddUDITEzEFYn5ZsGDXMSsU9E+kh7fjRXTIC3RHqfCo8RPRbyReYJh44HQ/yomFkqbOFohXvDCiIQ==", "dev": true, "requires": { - "@babel/helper-create-regexp-features-plugin": "^7.16.7", - "@babel/helper-plugin-utils": "^7.16.7" + "@babel/helper-module-transforms": "^7.26.0", + "@babel/helper-plugin-utils": "^7.25.9" } }, - "@babel/plugin-transform-duplicate-keys": { - "version": "7.16.7", - "resolved": "https://registry.npmjs.org/@babel/plugin-transform-duplicate-keys/-/plugin-transform-duplicate-keys-7.16.7.tgz", - "integrity": "sha512-03DvpbRfvWIXyK0/6QiR1KMTWeT6OcQ7tbhjrXyFS02kjuX/mu5Bvnh5SDSWHxyawit2g5aWhKwI86EE7GUnTw==", + "@babel/plugin-transform-modules-systemjs": { + "version": "7.25.9", + "resolved": "https://r.cnpmjs.org/@babel/plugin-transform-modules-systemjs/-/plugin-transform-modules-systemjs-7.25.9.tgz", + "integrity": "sha512-hyss7iIlH/zLHaehT+xwiymtPOpsiwIIRlCAOwBB04ta5Tt+lNItADdlXw3jAWZ96VJ2jlhl/c+PNIQPKNfvcA==", "dev": true, "requires": { - "@babel/helper-plugin-utils": "^7.16.7" + "@babel/helper-module-transforms": "^7.25.9", + "@babel/helper-plugin-utils": "^7.25.9", + "@babel/helper-validator-identifier": "^7.25.9", + "@babel/traverse": "^7.25.9" } }, - "@babel/plugin-transform-exponentiation-operator": { - "version": "7.16.7", - "resolved": "https://registry.npmjs.org/@babel/plugin-transform-exponentiation-operator/-/plugin-transform-exponentiation-operator-7.16.7.tgz", - "integrity": "sha512-8UYLSlyLgRixQvlYH3J2ekXFHDFLQutdy7FfFAMm3CPZ6q9wHCwnUyiXpQCe3gVVnQlHc5nsuiEVziteRNTXEA==", + "@babel/plugin-transform-modules-umd": { + "version": "7.25.9", + "resolved": "https://r.cnpmjs.org/@babel/plugin-transform-modules-umd/-/plugin-transform-modules-umd-7.25.9.tgz", + "integrity": "sha512-bS9MVObUgE7ww36HEfwe6g9WakQ0KF07mQF74uuXdkoziUPfKyu/nIm663kz//e5O1nPInPFx36z7WJmJ4yNEw==", "dev": true, "requires": { - "@babel/helper-builder-binary-assignment-operator-visitor": "^7.16.7", - "@babel/helper-plugin-utils": "^7.16.7" + "@babel/helper-module-transforms": "^7.25.9", + "@babel/helper-plugin-utils": "^7.25.9" } }, - "@babel/plugin-transform-for-of": { - "version": "7.16.7", - "resolved": "https://registry.npmjs.org/@babel/plugin-transform-for-of/-/plugin-transform-for-of-7.16.7.tgz", - "integrity": "sha512-/QZm9W92Ptpw7sjI9Nx1mbcsWz33+l8kuMIQnDwgQBG5s3fAfQvkRjQ7NqXhtNcKOnPkdICmUHyCaWW06HCsqg==", + "@babel/plugin-transform-named-capturing-groups-regex": { + "version": "7.25.9", + "resolved": "https://r.cnpmjs.org/@babel/plugin-transform-named-capturing-groups-regex/-/plugin-transform-named-capturing-groups-regex-7.25.9.tgz", + "integrity": "sha512-oqB6WHdKTGl3q/ItQhpLSnWWOpjUJLsOCLVyeFgeTktkBSCiurvPOsyt93gibI9CmuKvTUEtWmG5VhZD+5T/KA==", "dev": true, "requires": { - "@babel/helper-plugin-utils": "^7.16.7" + "@babel/helper-create-regexp-features-plugin": "^7.25.9", + "@babel/helper-plugin-utils": "^7.25.9" } }, - "@babel/plugin-transform-function-name": { - "version": "7.16.7", - "resolved": "https://registry.npmjs.org/@babel/plugin-transform-function-name/-/plugin-transform-function-name-7.16.7.tgz", - "integrity": "sha512-SU/C68YVwTRxqWj5kgsbKINakGag0KTgq9f2iZEXdStoAbOzLHEBRYzImmA6yFo8YZhJVflvXmIHUO7GWHmxxA==", + "@babel/plugin-transform-new-target": { + "version": "7.25.9", + "resolved": "https://r.cnpmjs.org/@babel/plugin-transform-new-target/-/plugin-transform-new-target-7.25.9.tgz", + "integrity": "sha512-U/3p8X1yCSoKyUj2eOBIx3FOn6pElFOKvAAGf8HTtItuPyB+ZeOqfn+mvTtg9ZlOAjsPdK3ayQEjqHjU/yLeVQ==", "dev": true, "requires": { - "@babel/helper-compilation-targets": "^7.16.7", - "@babel/helper-function-name": "^7.16.7", - "@babel/helper-plugin-utils": "^7.16.7" + "@babel/helper-plugin-utils": "^7.25.9" } }, - "@babel/plugin-transform-literals": { - "version": "7.16.7", - "resolved": "https://registry.npmjs.org/@babel/plugin-transform-literals/-/plugin-transform-literals-7.16.7.tgz", - "integrity": "sha512-6tH8RTpTWI0s2sV6uq3e/C9wPo4PTqqZps4uF0kzQ9/xPLFQtipynvmT1g/dOfEJ+0EQsHhkQ/zyRId8J2b8zQ==", + "@babel/plugin-transform-nullish-coalescing-operator": { + "version": "7.25.9", + "resolved": "https://r.cnpmjs.org/@babel/plugin-transform-nullish-coalescing-operator/-/plugin-transform-nullish-coalescing-operator-7.25.9.tgz", + "integrity": "sha512-ENfftpLZw5EItALAD4WsY/KUWvhUlZndm5GC7G3evUsVeSJB6p0pBeLQUnRnBCBx7zV0RKQjR9kCuwrsIrjWog==", "dev": true, "requires": { - "@babel/helper-plugin-utils": "^7.16.7" + "@babel/helper-plugin-utils": "^7.25.9" } }, - "@babel/plugin-transform-member-expression-literals": { - "version": "7.16.7", - "resolved": "https://registry.npmjs.org/@babel/plugin-transform-member-expression-literals/-/plugin-transform-member-expression-literals-7.16.7.tgz", - "integrity": "sha512-mBruRMbktKQwbxaJof32LT9KLy2f3gH+27a5XSuXo6h7R3vqltl0PgZ80C8ZMKw98Bf8bqt6BEVi3svOh2PzMw==", + "@babel/plugin-transform-numeric-separator": { + "version": "7.25.9", + "resolved": "https://r.cnpmjs.org/@babel/plugin-transform-numeric-separator/-/plugin-transform-numeric-separator-7.25.9.tgz", + "integrity": "sha512-TlprrJ1GBZ3r6s96Yq8gEQv82s8/5HnCVHtEJScUj90thHQbwe+E5MLhi2bbNHBEJuzrvltXSru+BUxHDoog7Q==", "dev": true, "requires": { - "@babel/helper-plugin-utils": "^7.16.7" + "@babel/helper-plugin-utils": "^7.25.9" } }, - "@babel/plugin-transform-modules-amd": { - "version": "7.16.7", - "resolved": "https://registry.npmjs.org/@babel/plugin-transform-modules-amd/-/plugin-transform-modules-amd-7.16.7.tgz", - "integrity": "sha512-KaaEtgBL7FKYwjJ/teH63oAmE3lP34N3kshz8mm4VMAw7U3PxjVwwUmxEFksbgsNUaO3wId9R2AVQYSEGRa2+g==", + "@babel/plugin-transform-object-rest-spread": { + "version": "7.25.9", + "resolved": "https://r.cnpmjs.org/@babel/plugin-transform-object-rest-spread/-/plugin-transform-object-rest-spread-7.25.9.tgz", + "integrity": "sha512-fSaXafEE9CVHPweLYw4J0emp1t8zYTXyzN3UuG+lylqkvYd7RMrsOQ8TYx5RF231be0vqtFC6jnx3UmpJmKBYg==", "dev": true, "requires": { - "@babel/helper-module-transforms": "^7.16.7", - "@babel/helper-plugin-utils": "^7.16.7", - "babel-plugin-dynamic-import-node": "^2.3.3" + "@babel/helper-compilation-targets": "^7.25.9", + "@babel/helper-plugin-utils": "^7.25.9", + "@babel/plugin-transform-parameters": "^7.25.9" } }, - "@babel/plugin-transform-modules-commonjs": { - "version": "7.16.8", - "resolved": "https://registry.npmjs.org/@babel/plugin-transform-modules-commonjs/-/plugin-transform-modules-commonjs-7.16.8.tgz", - "integrity": "sha512-oflKPvsLT2+uKQopesJt3ApiaIS2HW+hzHFcwRNtyDGieAeC/dIHZX8buJQ2J2X1rxGPy4eRcUijm3qcSPjYcA==", + "@babel/plugin-transform-object-super": { + "version": "7.25.9", + "resolved": "https://r.cnpmjs.org/@babel/plugin-transform-object-super/-/plugin-transform-object-super-7.25.9.tgz", + "integrity": "sha512-Kj/Gh+Rw2RNLbCK1VAWj2U48yxxqL2x0k10nPtSdRa0O2xnHXalD0s+o1A6a0W43gJ00ANo38jxkQreckOzv5A==", "dev": true, "requires": { - "@babel/helper-module-transforms": "^7.16.7", - "@babel/helper-plugin-utils": "^7.16.7", - "@babel/helper-simple-access": "^7.16.7", - "babel-plugin-dynamic-import-node": "^2.3.3" + "@babel/helper-plugin-utils": "^7.25.9", + "@babel/helper-replace-supers": "^7.25.9" } }, - "@babel/plugin-transform-modules-systemjs": { - "version": "7.16.7", - "resolved": "https://registry.npmjs.org/@babel/plugin-transform-modules-systemjs/-/plugin-transform-modules-systemjs-7.16.7.tgz", - "integrity": "sha512-DuK5E3k+QQmnOqBR9UkusByy5WZWGRxfzV529s9nPra1GE7olmxfqO2FHobEOYSPIjPBTr4p66YDcjQnt8cBmw==", + "@babel/plugin-transform-optional-catch-binding": { + "version": "7.25.9", + "resolved": "https://r.cnpmjs.org/@babel/plugin-transform-optional-catch-binding/-/plugin-transform-optional-catch-binding-7.25.9.tgz", + "integrity": "sha512-qM/6m6hQZzDcZF3onzIhZeDHDO43bkNNlOX0i8n3lR6zLbu0GN2d8qfM/IERJZYauhAHSLHy39NF0Ctdvcid7g==", "dev": true, "requires": { - "@babel/helper-hoist-variables": "^7.16.7", - "@babel/helper-module-transforms": "^7.16.7", - "@babel/helper-plugin-utils": "^7.16.7", - "@babel/helper-validator-identifier": "^7.16.7", - "babel-plugin-dynamic-import-node": "^2.3.3" + "@babel/helper-plugin-utils": "^7.25.9" } }, - "@babel/plugin-transform-modules-umd": { - "version": "7.16.7", - "resolved": "https://registry.npmjs.org/@babel/plugin-transform-modules-umd/-/plugin-transform-modules-umd-7.16.7.tgz", - "integrity": "sha512-EMh7uolsC8O4xhudF2F6wedbSHm1HHZ0C6aJ7K67zcDNidMzVcxWdGr+htW9n21klm+bOn+Rx4CBsAntZd3rEQ==", + "@babel/plugin-transform-optional-chaining": { + "version": "7.25.9", + "resolved": "https://r.cnpmjs.org/@babel/plugin-transform-optional-chaining/-/plugin-transform-optional-chaining-7.25.9.tgz", + "integrity": "sha512-6AvV0FsLULbpnXeBjrY4dmWF8F7gf8QnvTEoO/wX/5xm/xE1Xo8oPuD3MPS+KS9f9XBEAWN7X1aWr4z9HdOr7A==", "dev": true, "requires": { - "@babel/helper-module-transforms": "^7.16.7", - "@babel/helper-plugin-utils": "^7.16.7" + "@babel/helper-plugin-utils": "^7.25.9", + "@babel/helper-skip-transparent-expression-wrappers": "^7.25.9" } }, - "@babel/plugin-transform-named-capturing-groups-regex": { - "version": "7.16.8", - "resolved": "https://registry.npmjs.org/@babel/plugin-transform-named-capturing-groups-regex/-/plugin-transform-named-capturing-groups-regex-7.16.8.tgz", - "integrity": "sha512-j3Jw+n5PvpmhRR+mrgIh04puSANCk/T/UA3m3P1MjJkhlK906+ApHhDIqBQDdOgL/r1UYpz4GNclTXxyZrYGSw==", + "@babel/plugin-transform-parameters": { + "version": "7.25.9", + "resolved": "https://r.cnpmjs.org/@babel/plugin-transform-parameters/-/plugin-transform-parameters-7.25.9.tgz", + "integrity": "sha512-wzz6MKwpnshBAiRmn4jR8LYz/g8Ksg0o80XmwZDlordjwEk9SxBzTWC7F5ef1jhbrbOW2DJ5J6ayRukrJmnr0g==", "dev": true, "requires": { - "@babel/helper-create-regexp-features-plugin": "^7.16.7" + "@babel/helper-plugin-utils": "^7.25.9" } }, - "@babel/plugin-transform-new-target": { - "version": "7.16.7", - "resolved": "https://registry.npmjs.org/@babel/plugin-transform-new-target/-/plugin-transform-new-target-7.16.7.tgz", - "integrity": "sha512-xiLDzWNMfKoGOpc6t3U+etCE2yRnn3SM09BXqWPIZOBpL2gvVrBWUKnsJx0K/ADi5F5YC5f8APFfWrz25TdlGg==", + "@babel/plugin-transform-private-methods": { + "version": "7.25.9", + "resolved": "https://r.cnpmjs.org/@babel/plugin-transform-private-methods/-/plugin-transform-private-methods-7.25.9.tgz", + "integrity": "sha512-D/JUozNpQLAPUVusvqMxyvjzllRaF8/nSrP1s2YGQT/W4LHK4xxsMcHjhOGTS01mp9Hda8nswb+FblLdJornQw==", "dev": true, "requires": { - "@babel/helper-plugin-utils": "^7.16.7" + "@babel/helper-create-class-features-plugin": "^7.25.9", + "@babel/helper-plugin-utils": "^7.25.9" } }, - "@babel/plugin-transform-object-super": { - "version": "7.16.7", - "resolved": "https://registry.npmjs.org/@babel/plugin-transform-object-super/-/plugin-transform-object-super-7.16.7.tgz", - "integrity": "sha512-14J1feiQVWaGvRxj2WjyMuXS2jsBkgB3MdSN5HuC2G5nRspa5RK9COcs82Pwy5BuGcjb+fYaUj94mYcOj7rCvw==", + "@babel/plugin-transform-private-property-in-object": { + "version": "7.25.9", + "resolved": "https://r.cnpmjs.org/@babel/plugin-transform-private-property-in-object/-/plugin-transform-private-property-in-object-7.25.9.tgz", + "integrity": "sha512-Evf3kcMqzXA3xfYJmZ9Pg1OvKdtqsDMSWBDzZOPLvHiTt36E75jLDQo5w1gtRU95Q4E5PDttrTf25Fw8d/uWLw==", "dev": true, "requires": { - "@babel/helper-plugin-utils": "^7.16.7", - "@babel/helper-replace-supers": "^7.16.7" + "@babel/helper-annotate-as-pure": "^7.25.9", + "@babel/helper-create-class-features-plugin": "^7.25.9", + "@babel/helper-plugin-utils": "^7.25.9" } }, - "@babel/plugin-transform-parameters": { - "version": "7.16.7", - "resolved": "https://registry.npmjs.org/@babel/plugin-transform-parameters/-/plugin-transform-parameters-7.16.7.tgz", - "integrity": "sha512-AT3MufQ7zZEhU2hwOA11axBnExW0Lszu4RL/tAlUJBuNoRak+wehQW8h6KcXOcgjY42fHtDxswuMhMjFEuv/aw==", + "@babel/plugin-transform-property-literals": { + "version": "7.25.9", + "resolved": "https://r.cnpmjs.org/@babel/plugin-transform-property-literals/-/plugin-transform-property-literals-7.25.9.tgz", + "integrity": "sha512-IvIUeV5KrS/VPavfSM/Iu+RE6llrHrYIKY1yfCzyO/lMXHQ+p7uGhonmGVisv6tSBSVgWzMBohTcvkC9vQcQFA==", "dev": true, "requires": { - "@babel/helper-plugin-utils": "^7.16.7" + "@babel/helper-plugin-utils": "^7.25.9" } }, - "@babel/plugin-transform-property-literals": { - "version": "7.16.7", - "resolved": "https://registry.npmjs.org/@babel/plugin-transform-property-literals/-/plugin-transform-property-literals-7.16.7.tgz", - "integrity": "sha512-z4FGr9NMGdoIl1RqavCqGG+ZuYjfZ/hkCIeuH6Do7tXmSm0ls11nYVSJqFEUOSJbDab5wC6lRE/w6YjVcr6Hqw==", + "@babel/plugin-transform-regenerator": { + "version": "7.25.9", + "resolved": "https://r.cnpmjs.org/@babel/plugin-transform-regenerator/-/plugin-transform-regenerator-7.25.9.tgz", + "integrity": "sha512-vwDcDNsgMPDGP0nMqzahDWE5/MLcX8sv96+wfX7as7LoF/kr97Bo/7fI00lXY4wUXYfVmwIIyG80fGZ1uvt2qg==", "dev": true, "requires": { - "@babel/helper-plugin-utils": "^7.16.7" + "@babel/helper-plugin-utils": "^7.25.9", + "regenerator-transform": "^0.15.2" } }, - "@babel/plugin-transform-regenerator": { - "version": "7.16.7", - "resolved": "https://registry.npmjs.org/@babel/plugin-transform-regenerator/-/plugin-transform-regenerator-7.16.7.tgz", - "integrity": "sha512-mF7jOgGYCkSJagJ6XCujSQg+6xC1M77/03K2oBmVJWoFGNUtnVJO4WHKJk3dnPC8HCcj4xBQP1Egm8DWh3Pb3Q==", + "@babel/plugin-transform-regexp-modifiers": { + "version": "7.26.0", + "resolved": "https://r.cnpmjs.org/@babel/plugin-transform-regexp-modifiers/-/plugin-transform-regexp-modifiers-7.26.0.tgz", + "integrity": "sha512-vN6saax7lrA2yA/Pak3sCxuD6F5InBjn9IcrIKQPjpsLvuHYLVroTxjdlVRHjjBWxKOqIwpTXDkOssYT4BFdRw==", "dev": true, "requires": { - "regenerator-transform": "^0.14.2" + "@babel/helper-create-regexp-features-plugin": "^7.25.9", + "@babel/helper-plugin-utils": "^7.25.9" } }, "@babel/plugin-transform-reserved-words": { - "version": "7.16.7", - "resolved": "https://registry.npmjs.org/@babel/plugin-transform-reserved-words/-/plugin-transform-reserved-words-7.16.7.tgz", - "integrity": "sha512-KQzzDnZ9hWQBjwi5lpY5v9shmm6IVG0U9pB18zvMu2i4H90xpT4gmqwPYsn8rObiadYe2M0gmgsiOIF5A/2rtg==", + "version": "7.25.9", + "resolved": "https://r.cnpmjs.org/@babel/plugin-transform-reserved-words/-/plugin-transform-reserved-words-7.25.9.tgz", + "integrity": "sha512-7DL7DKYjn5Su++4RXu8puKZm2XBPHyjWLUidaPEkCUBbE7IPcsrkRHggAOOKydH1dASWdcUBxrkOGNxUv5P3Jg==", "dev": true, "requires": { - "@babel/helper-plugin-utils": "^7.16.7" + "@babel/helper-plugin-utils": "^7.25.9" } }, "@babel/plugin-transform-shorthand-properties": { - "version": "7.16.7", - "resolved": "https://registry.npmjs.org/@babel/plugin-transform-shorthand-properties/-/plugin-transform-shorthand-properties-7.16.7.tgz", - "integrity": "sha512-hah2+FEnoRoATdIb05IOXf+4GzXYTq75TVhIn1PewihbpyrNWUt2JbudKQOETWw6QpLe+AIUpJ5MVLYTQbeeUg==", + "version": "7.25.9", + "resolved": "https://r.cnpmjs.org/@babel/plugin-transform-shorthand-properties/-/plugin-transform-shorthand-properties-7.25.9.tgz", + "integrity": "sha512-MUv6t0FhO5qHnS/W8XCbHmiRWOphNufpE1IVxhK5kuN3Td9FT1x4rx4K42s3RYdMXCXpfWkGSbCSd0Z64xA7Ng==", "dev": true, "requires": { - "@babel/helper-plugin-utils": "^7.16.7" + "@babel/helper-plugin-utils": "^7.25.9" } }, "@babel/plugin-transform-spread": { - "version": "7.16.7", - "resolved": "https://registry.npmjs.org/@babel/plugin-transform-spread/-/plugin-transform-spread-7.16.7.tgz", - "integrity": "sha512-+pjJpgAngb53L0iaA5gU/1MLXJIfXcYepLgXB3esVRf4fqmj8f2cxM3/FKaHsZms08hFQJkFccEWuIpm429TXg==", + "version": "7.25.9", + "resolved": "https://r.cnpmjs.org/@babel/plugin-transform-spread/-/plugin-transform-spread-7.25.9.tgz", + "integrity": "sha512-oNknIB0TbURU5pqJFVbOOFspVlrpVwo2H1+HUIsVDvp5VauGGDP1ZEvO8Nn5xyMEs3dakajOxlmkNW7kNgSm6A==", "dev": true, "requires": { - "@babel/helper-plugin-utils": "^7.16.7", - "@babel/helper-skip-transparent-expression-wrappers": "^7.16.0" + "@babel/helper-plugin-utils": "^7.25.9", + "@babel/helper-skip-transparent-expression-wrappers": "^7.25.9" } }, "@babel/plugin-transform-sticky-regex": { - "version": "7.16.7", - "resolved": "https://registry.npmjs.org/@babel/plugin-transform-sticky-regex/-/plugin-transform-sticky-regex-7.16.7.tgz", - "integrity": "sha512-NJa0Bd/87QV5NZZzTuZG5BPJjLYadeSZ9fO6oOUoL4iQx+9EEuw/eEM92SrsT19Yc2jgB1u1hsjqDtH02c3Drw==", + "version": "7.25.9", + "resolved": "https://r.cnpmjs.org/@babel/plugin-transform-sticky-regex/-/plugin-transform-sticky-regex-7.25.9.tgz", + "integrity": "sha512-WqBUSgeVwucYDP9U/xNRQam7xV8W5Zf+6Eo7T2SRVUFlhRiMNFdFz58u0KZmCVVqs2i7SHgpRnAhzRNmKfi2uA==", "dev": true, "requires": { - "@babel/helper-plugin-utils": "^7.16.7" + "@babel/helper-plugin-utils": "^7.25.9" } }, "@babel/plugin-transform-template-literals": { - "version": "7.16.7", - "resolved": "https://registry.npmjs.org/@babel/plugin-transform-template-literals/-/plugin-transform-template-literals-7.16.7.tgz", - "integrity": "sha512-VwbkDDUeenlIjmfNeDX/V0aWrQH2QiVyJtwymVQSzItFDTpxfyJh3EVaQiS0rIN/CqbLGr0VcGmuwyTdZtdIsA==", + "version": "7.25.9", + "resolved": "https://r.cnpmjs.org/@babel/plugin-transform-template-literals/-/plugin-transform-template-literals-7.25.9.tgz", + "integrity": "sha512-o97AE4syN71M/lxrCtQByzphAdlYluKPDBzDVzMmfCobUjjhAryZV0AIpRPrxN0eAkxXO6ZLEScmt+PNhj2OTw==", "dev": true, "requires": { - "@babel/helper-plugin-utils": "^7.16.7" + "@babel/helper-plugin-utils": "^7.25.9" } }, "@babel/plugin-transform-typeof-symbol": { - "version": "7.16.7", - "resolved": "https://registry.npmjs.org/@babel/plugin-transform-typeof-symbol/-/plugin-transform-typeof-symbol-7.16.7.tgz", - "integrity": "sha512-p2rOixCKRJzpg9JB4gjnG4gjWkWa89ZoYUnl9snJ1cWIcTH/hvxZqfO+WjG6T8DRBpctEol5jw1O5rA8gkCokQ==", + "version": "7.25.9", + "resolved": "https://r.cnpmjs.org/@babel/plugin-transform-typeof-symbol/-/plugin-transform-typeof-symbol-7.25.9.tgz", + "integrity": "sha512-v61XqUMiueJROUv66BVIOi0Fv/CUuZuZMl5NkRoCVxLAnMexZ0A3kMe7vvZ0nulxMuMp0Mk6S5hNh48yki08ZA==", "dev": true, "requires": { - "@babel/helper-plugin-utils": "^7.16.7" + "@babel/helper-plugin-utils": "^7.25.9" } }, "@babel/plugin-transform-unicode-escapes": { - "version": "7.16.7", - "resolved": "https://registry.npmjs.org/@babel/plugin-transform-unicode-escapes/-/plugin-transform-unicode-escapes-7.16.7.tgz", - "integrity": "sha512-TAV5IGahIz3yZ9/Hfv35TV2xEm+kaBDaZQCn2S/hG9/CZ0DktxJv9eKfPc7yYCvOYR4JGx1h8C+jcSOvgaaI/Q==", + "version": "7.25.9", + "resolved": "https://r.cnpmjs.org/@babel/plugin-transform-unicode-escapes/-/plugin-transform-unicode-escapes-7.25.9.tgz", + "integrity": "sha512-s5EDrE6bW97LtxOcGj1Khcx5AaXwiMmi4toFWRDP9/y0Woo6pXC+iyPu/KuhKtfSrNFd7jJB+/fkOtZy6aIC6Q==", "dev": true, "requires": { - "@babel/helper-plugin-utils": "^7.16.7" + "@babel/helper-plugin-utils": "^7.25.9" + } + }, + "@babel/plugin-transform-unicode-property-regex": { + "version": "7.25.9", + "resolved": "https://r.cnpmjs.org/@babel/plugin-transform-unicode-property-regex/-/plugin-transform-unicode-property-regex-7.25.9.tgz", + "integrity": "sha512-Jt2d8Ga+QwRluxRQ307Vlxa6dMrYEMZCgGxoPR8V52rxPyldHu3hdlHspxaqYmE7oID5+kB+UKUB/eWS+DkkWg==", + "dev": true, + "requires": { + "@babel/helper-create-regexp-features-plugin": "^7.25.9", + "@babel/helper-plugin-utils": "^7.25.9" } }, "@babel/plugin-transform-unicode-regex": { - "version": "7.16.7", - "resolved": "https://registry.npmjs.org/@babel/plugin-transform-unicode-regex/-/plugin-transform-unicode-regex-7.16.7.tgz", - "integrity": "sha512-oC5tYYKw56HO75KZVLQ+R/Nl3Hro9kf8iG0hXoaHP7tjAyCpvqBiSNe6vGrZni1Z6MggmUOC6A7VP7AVmw225Q==", + "version": "7.25.9", + "resolved": "https://r.cnpmjs.org/@babel/plugin-transform-unicode-regex/-/plugin-transform-unicode-regex-7.25.9.tgz", + "integrity": "sha512-yoxstj7Rg9dlNn9UQxzk4fcNivwv4nUYz7fYXBaKxvw/lnmPuOm/ikoELygbYq68Bls3D/D+NBPHiLwZdZZ4HA==", "dev": true, "requires": { - "@babel/helper-create-regexp-features-plugin": "^7.16.7", - "@babel/helper-plugin-utils": "^7.16.7" + "@babel/helper-create-regexp-features-plugin": "^7.25.9", + "@babel/helper-plugin-utils": "^7.25.9" + } + }, + "@babel/plugin-transform-unicode-sets-regex": { + "version": "7.25.9", + "resolved": "https://r.cnpmjs.org/@babel/plugin-transform-unicode-sets-regex/-/plugin-transform-unicode-sets-regex-7.25.9.tgz", + "integrity": "sha512-8BYqO3GeVNHtx69fdPshN3fnzUNLrWdHhk/icSwigksJGczKSizZ+Z6SBCxTs723Fr5VSNorTIK7a+R2tISvwQ==", + "dev": true, + "requires": { + "@babel/helper-create-regexp-features-plugin": "^7.25.9", + "@babel/helper-plugin-utils": "^7.25.9" } }, "@babel/preset-env": { - "version": "7.16.8", - "resolved": "https://registry.npmjs.org/@babel/preset-env/-/preset-env-7.16.8.tgz", - "integrity": "sha512-9rNKgVCdwHb3z1IlbMyft6yIXIeP3xz6vWvGaLHrJThuEIqWfHb0DNBH9VuTgnDfdbUDhkmkvMZS/YMCtP7Elg==", - "dev": true, - "requires": { - "@babel/compat-data": "^7.16.8", - "@babel/helper-compilation-targets": "^7.16.7", - "@babel/helper-plugin-utils": "^7.16.7", - "@babel/helper-validator-option": "^7.16.7", - "@babel/plugin-bugfix-safari-id-destructuring-collision-in-function-expression": "^7.16.7", - "@babel/plugin-bugfix-v8-spread-parameters-in-optional-chaining": "^7.16.7", - "@babel/plugin-proposal-async-generator-functions": "^7.16.8", - "@babel/plugin-proposal-class-properties": "^7.16.7", - "@babel/plugin-proposal-class-static-block": "^7.16.7", - "@babel/plugin-proposal-dynamic-import": "^7.16.7", - "@babel/plugin-proposal-export-namespace-from": "^7.16.7", - "@babel/plugin-proposal-json-strings": "^7.16.7", - "@babel/plugin-proposal-logical-assignment-operators": "^7.16.7", - "@babel/plugin-proposal-nullish-coalescing-operator": "^7.16.7", - "@babel/plugin-proposal-numeric-separator": "^7.16.7", - "@babel/plugin-proposal-object-rest-spread": "^7.16.7", - "@babel/plugin-proposal-optional-catch-binding": "^7.16.7", - "@babel/plugin-proposal-optional-chaining": "^7.16.7", - "@babel/plugin-proposal-private-methods": "^7.16.7", - "@babel/plugin-proposal-private-property-in-object": "^7.16.7", - "@babel/plugin-proposal-unicode-property-regex": "^7.16.7", - "@babel/plugin-syntax-async-generators": "^7.8.4", - "@babel/plugin-syntax-class-properties": "^7.12.13", - "@babel/plugin-syntax-class-static-block": "^7.14.5", - "@babel/plugin-syntax-dynamic-import": "^7.8.3", - "@babel/plugin-syntax-export-namespace-from": "^7.8.3", - "@babel/plugin-syntax-json-strings": "^7.8.3", - "@babel/plugin-syntax-logical-assignment-operators": "^7.10.4", - "@babel/plugin-syntax-nullish-coalescing-operator": "^7.8.3", - "@babel/plugin-syntax-numeric-separator": "^7.10.4", - "@babel/plugin-syntax-object-rest-spread": "^7.8.3", - "@babel/plugin-syntax-optional-catch-binding": "^7.8.3", - "@babel/plugin-syntax-optional-chaining": "^7.8.3", - "@babel/plugin-syntax-private-property-in-object": "^7.14.5", - "@babel/plugin-syntax-top-level-await": "^7.14.5", - "@babel/plugin-transform-arrow-functions": "^7.16.7", - "@babel/plugin-transform-async-to-generator": "^7.16.8", - "@babel/plugin-transform-block-scoped-functions": "^7.16.7", - "@babel/plugin-transform-block-scoping": "^7.16.7", - "@babel/plugin-transform-classes": "^7.16.7", - "@babel/plugin-transform-computed-properties": "^7.16.7", - "@babel/plugin-transform-destructuring": "^7.16.7", - "@babel/plugin-transform-dotall-regex": "^7.16.7", - "@babel/plugin-transform-duplicate-keys": "^7.16.7", - "@babel/plugin-transform-exponentiation-operator": "^7.16.7", - "@babel/plugin-transform-for-of": "^7.16.7", - "@babel/plugin-transform-function-name": "^7.16.7", - "@babel/plugin-transform-literals": "^7.16.7", - "@babel/plugin-transform-member-expression-literals": "^7.16.7", - "@babel/plugin-transform-modules-amd": "^7.16.7", - "@babel/plugin-transform-modules-commonjs": "^7.16.8", - "@babel/plugin-transform-modules-systemjs": "^7.16.7", - "@babel/plugin-transform-modules-umd": "^7.16.7", - "@babel/plugin-transform-named-capturing-groups-regex": "^7.16.8", - "@babel/plugin-transform-new-target": "^7.16.7", - "@babel/plugin-transform-object-super": "^7.16.7", - "@babel/plugin-transform-parameters": "^7.16.7", - "@babel/plugin-transform-property-literals": "^7.16.7", - "@babel/plugin-transform-regenerator": "^7.16.7", - "@babel/plugin-transform-reserved-words": "^7.16.7", - "@babel/plugin-transform-shorthand-properties": "^7.16.7", - "@babel/plugin-transform-spread": "^7.16.7", - "@babel/plugin-transform-sticky-regex": "^7.16.7", - "@babel/plugin-transform-template-literals": "^7.16.7", - "@babel/plugin-transform-typeof-symbol": "^7.16.7", - "@babel/plugin-transform-unicode-escapes": "^7.16.7", - "@babel/plugin-transform-unicode-regex": "^7.16.7", - "@babel/preset-modules": "^0.1.5", - "@babel/types": "^7.16.8", - "babel-plugin-polyfill-corejs2": "^0.3.0", - "babel-plugin-polyfill-corejs3": "^0.5.0", - "babel-plugin-polyfill-regenerator": "^0.3.0", - "core-js-compat": "^3.20.2", - "semver": "^6.3.0" + "version": "7.26.0", + "resolved": "https://r.cnpmjs.org/@babel/preset-env/-/preset-env-7.26.0.tgz", + "integrity": "sha512-H84Fxq0CQJNdPFT2DrfnylZ3cf5K43rGfWK4LJGPpjKHiZlk0/RzwEus3PDDZZg+/Er7lCA03MVacueUuXdzfw==", + "dev": true, + "requires": { + "@babel/compat-data": "^7.26.0", + "@babel/helper-compilation-targets": "^7.25.9", + "@babel/helper-plugin-utils": "^7.25.9", + "@babel/helper-validator-option": "^7.25.9", + "@babel/plugin-bugfix-firefox-class-in-computed-class-key": "^7.25.9", + "@babel/plugin-bugfix-safari-class-field-initializer-scope": "^7.25.9", + "@babel/plugin-bugfix-safari-id-destructuring-collision-in-function-expression": "^7.25.9", + "@babel/plugin-bugfix-v8-spread-parameters-in-optional-chaining": "^7.25.9", + "@babel/plugin-bugfix-v8-static-class-fields-redefine-readonly": "^7.25.9", + "@babel/plugin-proposal-private-property-in-object": "7.21.0-placeholder-for-preset-env.2", + "@babel/plugin-syntax-import-assertions": "^7.26.0", + "@babel/plugin-syntax-import-attributes": "^7.26.0", + "@babel/plugin-syntax-unicode-sets-regex": "^7.18.6", + "@babel/plugin-transform-arrow-functions": "^7.25.9", + "@babel/plugin-transform-async-generator-functions": "^7.25.9", + "@babel/plugin-transform-async-to-generator": "^7.25.9", + "@babel/plugin-transform-block-scoped-functions": "^7.25.9", + "@babel/plugin-transform-block-scoping": "^7.25.9", + "@babel/plugin-transform-class-properties": "^7.25.9", + "@babel/plugin-transform-class-static-block": "^7.26.0", + "@babel/plugin-transform-classes": "^7.25.9", + "@babel/plugin-transform-computed-properties": "^7.25.9", + "@babel/plugin-transform-destructuring": "^7.25.9", + "@babel/plugin-transform-dotall-regex": "^7.25.9", + "@babel/plugin-transform-duplicate-keys": "^7.25.9", + "@babel/plugin-transform-duplicate-named-capturing-groups-regex": "^7.25.9", + "@babel/plugin-transform-dynamic-import": "^7.25.9", + "@babel/plugin-transform-exponentiation-operator": "^7.25.9", + "@babel/plugin-transform-export-namespace-from": "^7.25.9", + "@babel/plugin-transform-for-of": "^7.25.9", + "@babel/plugin-transform-function-name": "^7.25.9", + "@babel/plugin-transform-json-strings": "^7.25.9", + "@babel/plugin-transform-literals": "^7.25.9", + "@babel/plugin-transform-logical-assignment-operators": "^7.25.9", + "@babel/plugin-transform-member-expression-literals": "^7.25.9", + "@babel/plugin-transform-modules-amd": "^7.25.9", + "@babel/plugin-transform-modules-commonjs": "^7.25.9", + "@babel/plugin-transform-modules-systemjs": "^7.25.9", + "@babel/plugin-transform-modules-umd": "^7.25.9", + "@babel/plugin-transform-named-capturing-groups-regex": "^7.25.9", + "@babel/plugin-transform-new-target": "^7.25.9", + "@babel/plugin-transform-nullish-coalescing-operator": "^7.25.9", + "@babel/plugin-transform-numeric-separator": "^7.25.9", + "@babel/plugin-transform-object-rest-spread": "^7.25.9", + "@babel/plugin-transform-object-super": "^7.25.9", + "@babel/plugin-transform-optional-catch-binding": "^7.25.9", + "@babel/plugin-transform-optional-chaining": "^7.25.9", + "@babel/plugin-transform-parameters": "^7.25.9", + "@babel/plugin-transform-private-methods": "^7.25.9", + "@babel/plugin-transform-private-property-in-object": "^7.25.9", + "@babel/plugin-transform-property-literals": "^7.25.9", + "@babel/plugin-transform-regenerator": "^7.25.9", + "@babel/plugin-transform-regexp-modifiers": "^7.26.0", + "@babel/plugin-transform-reserved-words": "^7.25.9", + "@babel/plugin-transform-shorthand-properties": "^7.25.9", + "@babel/plugin-transform-spread": "^7.25.9", + "@babel/plugin-transform-sticky-regex": "^7.25.9", + "@babel/plugin-transform-template-literals": "^7.25.9", + "@babel/plugin-transform-typeof-symbol": "^7.25.9", + "@babel/plugin-transform-unicode-escapes": "^7.25.9", + "@babel/plugin-transform-unicode-property-regex": "^7.25.9", + "@babel/plugin-transform-unicode-regex": "^7.25.9", + "@babel/plugin-transform-unicode-sets-regex": "^7.25.9", + "@babel/preset-modules": "0.1.6-no-external-plugins", + "babel-plugin-polyfill-corejs2": "^0.4.10", + "babel-plugin-polyfill-corejs3": "^0.10.6", + "babel-plugin-polyfill-regenerator": "^0.6.1", + "core-js-compat": "^3.38.1", + "semver": "^6.3.1" } }, "@babel/preset-modules": { - "version": "0.1.5", - "resolved": "https://registry.npmjs.org/@babel/preset-modules/-/preset-modules-0.1.5.tgz", - "integrity": "sha512-A57th6YRG7oR3cq/yt/Y84MvGgE0eJG2F1JLhKuyG+jFxEgrd/HAMJatiFtmOiZurz+0DkrvbheCLaV5f2JfjA==", + "version": "0.1.6-no-external-plugins", + "resolved": "https://r.cnpmjs.org/@babel/preset-modules/-/preset-modules-0.1.6-no-external-plugins.tgz", + "integrity": "sha512-HrcgcIESLm9aIR842yhJ5RWan/gebQUJ6E/E5+rf0y9o6oj7w0Br+sWuL6kEQ/o/AdfvR1Je9jG18/gnpwjEyA==", "dev": true, "requires": { "@babel/helper-plugin-utils": "^7.0.0", - "@babel/plugin-proposal-unicode-property-regex": "^7.4.4", - "@babel/plugin-transform-dotall-regex": "^7.4.4", "@babel/types": "^7.4.4", "esutils": "^2.0.2" } @@ -7622,42 +7530,39 @@ } }, "@babel/template": { - "version": "7.16.7", - "resolved": "https://registry.npmjs.org/@babel/template/-/template-7.16.7.tgz", - "integrity": "sha512-I8j/x8kHUrbYRTUxXrrMbfCa7jxkE7tZre39x3kjr9hvI82cK1FfqLygotcWN5kdPGWcLdWMHpSBavse5tWw3w==", + "version": "7.25.9", + "resolved": "https://r.cnpmjs.org/@babel/template/-/template-7.25.9.tgz", + "integrity": "sha512-9DGttpmPvIxBb/2uwpVo3dqJ+O6RooAFOS+lB+xDqoE2PVCE8nfoHMdZLpfCQRLwvohzXISPZcgxt80xLfsuwg==", "dev": true, "requires": { - "@babel/code-frame": "^7.16.7", - "@babel/parser": "^7.16.7", - "@babel/types": "^7.16.7" + "@babel/code-frame": "^7.25.9", + "@babel/parser": "^7.25.9", + "@babel/types": "^7.25.9" } }, "@babel/traverse": { - "version": "7.16.8", - "resolved": "https://registry.npmjs.org/@babel/traverse/-/traverse-7.16.8.tgz", - "integrity": "sha512-xe+H7JlvKsDQwXRsBhSnq1/+9c+LlQcCK3Tn/l5sbx02HYns/cn7ibp9+RV1sIUqu7hKg91NWsgHurO9dowITQ==", - "dev": true, - "requires": { - "@babel/code-frame": "^7.16.7", - "@babel/generator": "^7.16.8", - "@babel/helper-environment-visitor": "^7.16.7", - "@babel/helper-function-name": "^7.16.7", - "@babel/helper-hoist-variables": "^7.16.7", - "@babel/helper-split-export-declaration": "^7.16.7", - "@babel/parser": "^7.16.8", - "@babel/types": "^7.16.8", - "debug": "^4.1.0", + "version": "7.26.4", + "resolved": "https://r.cnpmjs.org/@babel/traverse/-/traverse-7.26.4.tgz", + "integrity": "sha512-fH+b7Y4p3yqvApJALCPJcwb0/XaOSgtK4pzV6WVjPR5GLFQBRI7pfoX2V2iM48NXvX07NUxxm1Vw98YjqTcU5w==", + "dev": true, + "requires": { + "@babel/code-frame": "^7.26.2", + "@babel/generator": "^7.26.3", + "@babel/parser": "^7.26.3", + "@babel/template": "^7.25.9", + "@babel/types": "^7.26.3", + "debug": "^4.3.1", "globals": "^11.1.0" } }, "@babel/types": { - "version": "7.16.8", - "resolved": "https://registry.npmjs.org/@babel/types/-/types-7.16.8.tgz", - "integrity": "sha512-smN2DQc5s4M7fntyjGtyIPbRJv6wW4rU/94fmYJ7PKQuZkC0qGMHXJbg6sNGt12JmVr4k5YaptI/XtiLJBnmIg==", + "version": "7.26.3", + "resolved": "https://r.cnpmjs.org/@babel/types/-/types-7.26.3.tgz", + "integrity": "sha512-vN5p+1kl59GVKMvTHt55NzzmYVxprfJD+ql7U9NFIfKCBkYE55LYtS+WtPlaYOyzydrKI8Nezd+aZextrd+FMA==", "dev": true, "requires": { - "@babel/helper-validator-identifier": "^7.16.7", - "to-fast-properties": "^2.0.0" + "@babel/helper-string-parser": "^7.25.9", + "@babel/helper-validator-identifier": "^7.25.9" } }, "@eslint/eslintrc": { @@ -7711,6 +7616,45 @@ "integrity": "sha512-ZnQMnLV4e7hDlUvw8H+U8ASL02SS2Gn6+9Ac3wGGLIe7+je2AeAOxPY+izIPJDfFDb7eDjev0Us8MO1iFRN8hA==", "dev": true }, + "@jridgewell/gen-mapping": { + "version": "0.3.5", + "resolved": "https://r.cnpmjs.org/@jridgewell/gen-mapping/-/gen-mapping-0.3.5.tgz", + "integrity": "sha512-IzL8ZoEDIBRWEzlCcRhOaCupYyN5gdIK+Q6fbFdPDg6HqX6jpkItn7DFIpW9LQzXG6Df9sA7+OKnq0qlz/GaQg==", + "dev": true, + "requires": { + "@jridgewell/set-array": "^1.2.1", + "@jridgewell/sourcemap-codec": "^1.4.10", + "@jridgewell/trace-mapping": "^0.3.24" + } + }, + "@jridgewell/resolve-uri": { + "version": "3.1.2", + "resolved": "https://r.cnpmjs.org/@jridgewell/resolve-uri/-/resolve-uri-3.1.2.tgz", + "integrity": "sha512-bRISgCIjP20/tbWSPWMEi54QVPRZExkuD9lJL+UIxUKtwVJA8wW1Trb1jMs1RFXo1CBTNZ/5hpC9QvmKWdopKw==", + "dev": true + }, + "@jridgewell/set-array": { + "version": "1.2.1", + "resolved": "https://r.cnpmjs.org/@jridgewell/set-array/-/set-array-1.2.1.tgz", + "integrity": "sha512-R8gLRTZeyp03ymzP/6Lil/28tGeGEzhx1q2k703KGWRAI1VdvPIXdG70VJc2pAMw3NA6JKL5hhFu1sJX0Mnn/A==", + "dev": true + }, + "@jridgewell/sourcemap-codec": { + "version": "1.5.0", + "resolved": "https://r.cnpmjs.org/@jridgewell/sourcemap-codec/-/sourcemap-codec-1.5.0.tgz", + "integrity": "sha512-gv3ZRaISU3fjPAgNsriBRqGWQL6quFx04YMPW/zD8XMLsU32mhCCbfbO6KZFLjvYpCZ8zyDEgqsgf+PwPaM7GQ==", + "dev": true + }, + "@jridgewell/trace-mapping": { + "version": "0.3.25", + "resolved": "https://r.cnpmjs.org/@jridgewell/trace-mapping/-/trace-mapping-0.3.25.tgz", + "integrity": "sha512-vNk6aEwybGtawWmy/PzwnGDOjCkLWSD2wqvjGGAgOAwCGWySYXfYoxt00IJkTF+8Lb57DwOb3Aa0o9CApepiYQ==", + "dev": true, + "requires": { + "@jridgewell/resolve-uri": "^3.1.0", + "@jridgewell/sourcemap-codec": "^1.4.14" + } + }, "@npmcli/fs": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/@npmcli/fs/-/fs-1.1.0.tgz", @@ -7807,9 +7751,9 @@ } }, "@rollup/plugin-babel": { - "version": "5.3.0", - "resolved": "https://registry.npmjs.org/@rollup/plugin-babel/-/plugin-babel-5.3.0.tgz", - "integrity": "sha512-9uIC8HZOnVLrLHxayq/PTzw+uS25E14KPUBh5ktF+18Mjo5yK0ToMMx6epY0uEgkjwJw0aBW4x2horYXh8juWw==", + "version": "5.3.1", + "resolved": "https://r.cnpmjs.org/@rollup/plugin-babel/-/plugin-babel-5.3.1.tgz", + "integrity": "sha512-WFfdLWU/xVWKeRQnKmIAQULUI7Il0gZnBIH/ZFO069wYIfPu+8zrfp/KMW0atmELoRDq8FbiP3VCss9MhCut7Q==", "dev": true, "requires": { "@babel/helper-module-imports": "^7.10.4", @@ -8039,43 +7983,34 @@ "integrity": "sha512-xh1Rl34h6Fi1DC2WWKfxUTVqRsNnr6LsKz2+hfwDxQJWmrx8+c7ylaqBMcHfl1U1r2dsifOvKX3LQuLNZ+XSvA==", "dev": true }, - "babel-plugin-dynamic-import-node": { - "version": "2.3.3", - "resolved": "https://registry.npmjs.org/babel-plugin-dynamic-import-node/-/babel-plugin-dynamic-import-node-2.3.3.tgz", - "integrity": "sha512-jZVI+s9Zg3IqA/kdi0i6UDCybUI3aSBLnglhYbSSjKlV7yF1F/5LWv8MakQmvYpnbJDS6fcBL2KzHSxNCMtWSQ==", - "dev": true, - "requires": { - "object.assign": "^4.1.0" - } - }, "babel-plugin-polyfill-corejs2": { - "version": "0.3.1", - "resolved": "https://registry.npmjs.org/babel-plugin-polyfill-corejs2/-/babel-plugin-polyfill-corejs2-0.3.1.tgz", - "integrity": "sha512-v7/T6EQcNfVLfcN2X8Lulb7DjprieyLWJK/zOWH5DUYcAgex9sP3h25Q+DLsX9TloXe3y1O8l2q2Jv9q8UVB9w==", + "version": "0.4.12", + "resolved": "https://r.cnpmjs.org/babel-plugin-polyfill-corejs2/-/babel-plugin-polyfill-corejs2-0.4.12.tgz", + "integrity": "sha512-CPWT6BwvhrTO2d8QVorhTCQw9Y43zOu7G9HigcfxvepOU6b8o3tcWad6oVgZIsZCTt42FFv97aA7ZJsbM4+8og==", "dev": true, "requires": { - "@babel/compat-data": "^7.13.11", - "@babel/helper-define-polyfill-provider": "^0.3.1", - "semver": "^6.1.1" + "@babel/compat-data": "^7.22.6", + "@babel/helper-define-polyfill-provider": "^0.6.3", + "semver": "^6.3.1" } }, "babel-plugin-polyfill-corejs3": { - "version": "0.5.1", - "resolved": "https://registry.npmjs.org/babel-plugin-polyfill-corejs3/-/babel-plugin-polyfill-corejs3-0.5.1.tgz", - "integrity": "sha512-TihqEe4sQcb/QcPJvxe94/9RZuLQuF1+To4WqQcRvc+3J3gLCPIPgDKzGLG6zmQLfH3nn25heRuDNkS2KR4I8A==", + "version": "0.10.6", + "resolved": "https://r.cnpmjs.org/babel-plugin-polyfill-corejs3/-/babel-plugin-polyfill-corejs3-0.10.6.tgz", + "integrity": "sha512-b37+KR2i/khY5sKmWNVQAnitvquQbNdWy6lJdsr0kmquCKEEUgMKK4SboVM3HtfnZilfjr4MMQ7vY58FVWDtIA==", "dev": true, "requires": { - "@babel/helper-define-polyfill-provider": "^0.3.1", - "core-js-compat": "^3.20.0" + "@babel/helper-define-polyfill-provider": "^0.6.2", + "core-js-compat": "^3.38.0" } }, "babel-plugin-polyfill-regenerator": { - "version": "0.3.1", - "resolved": "https://registry.npmjs.org/babel-plugin-polyfill-regenerator/-/babel-plugin-polyfill-regenerator-0.3.1.tgz", - "integrity": "sha512-Y2B06tvgHYt1x0yz17jGkGeeMr5FeKUu+ASJ+N6nB5lQ8Dapfg42i0OVrf8PNGJ3zKL4A23snMi1IRwrqqND7A==", + "version": "0.6.3", + "resolved": "https://r.cnpmjs.org/babel-plugin-polyfill-regenerator/-/babel-plugin-polyfill-regenerator-0.6.3.tgz", + "integrity": "sha512-LiWSbl4CRSIa5x/JAU6jZiG9eit9w6mz+yVMFwDE83LAWvt0AfGBoZ7HS/mkhrKuh2ZlzfVZYKoLjXdqw6Yt7Q==", "dev": true, "requires": { - "@babel/helper-define-polyfill-provider": "^0.3.1" + "@babel/helper-define-polyfill-provider": "^0.6.3" } }, "balanced-match": { @@ -8194,16 +8129,15 @@ } }, "browserslist": { - "version": "4.19.1", - "resolved": "https://registry.npmjs.org/browserslist/-/browserslist-4.19.1.tgz", - "integrity": "sha512-u2tbbG5PdKRTUoctO3NBD8FQ5HdPh1ZXPHzp1rwaa5jTc+RV9/+RlWiAIKmjRPQF+xbGM9Kklj5bZQFa2s/38A==", + "version": "4.24.2", + "resolved": "https://r.cnpmjs.org/browserslist/-/browserslist-4.24.2.tgz", + "integrity": "sha512-ZIc+Q62revdMcqC6aChtW4jz3My3klmCO1fEmINZY/8J3EpBg5/A/D0AKmBveUh6pgoeycoMkVMko84tuYS+Gg==", "dev": true, "requires": { - "caniuse-lite": "^1.0.30001286", - "electron-to-chromium": "^1.4.17", - "escalade": "^3.1.1", - "node-releases": "^2.0.1", - "picocolors": "^1.0.0" + "caniuse-lite": "^1.0.30001669", + "electron-to-chromium": "^1.5.41", + "node-releases": "^2.0.18", + "update-browserslist-db": "^1.1.1" } }, "buffer-from": { @@ -8256,16 +8190,6 @@ "unique-filename": "^1.1.1" } }, - "call-bind": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/call-bind/-/call-bind-1.0.2.tgz", - "integrity": "sha512-7O+FbCihrB5WGbFYesctwmTKae6rOiIzmz1icreWJ+0aA7LJfuqhEso2T9ncpcFtzMQtzXf2QGGueWJGTYsqrA==", - "dev": true, - "requires": { - "function-bind": "^1.1.1", - "get-intrinsic": "^1.0.2" - } - }, "callsites": { "version": "3.1.0", "resolved": "https://registry.npmjs.org/callsites/-/callsites-3.1.0.tgz", @@ -8279,9 +8203,9 @@ "dev": true }, "caniuse-lite": { - "version": "1.0.30001300", - "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001300.tgz", - "integrity": "sha512-cVjiJHWGcNlJi8TZVKNMnvMid3Z3TTdDHmLDzlOdIiZq138Exvo0G+G0wTdVYolxKb4AYwC+38pxodiInVtJSA==", + "version": "1.0.30001687", + "resolved": "https://r.cnpmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001687.tgz", + "integrity": "sha512-0S/FDhf4ZiqrTUiQ39dKeUjYRjkv7lOZU1Dgif2rIqrTzX/1wV2hfKu9TOm1IHkdSijfLswxTFzl/cvir+SLSQ==", "dev": true }, "caseless": { @@ -8440,13 +8364,10 @@ "dev": true }, "convert-source-map": { - "version": "1.8.0", - "resolved": "https://registry.npmjs.org/convert-source-map/-/convert-source-map-1.8.0.tgz", - "integrity": "sha512-+OQdjP49zViI/6i7nIJpA8rAl4sV/JdPfU9nZs3VqOwGIgizICvuN2ru6fMd+4llL0tar18UYJXfZ/TWtmhUjA==", - "dev": true, - "requires": { - "safe-buffer": "~5.1.1" - } + "version": "2.0.0", + "resolved": "https://r.cnpmjs.org/convert-source-map/-/convert-source-map-2.0.0.tgz", + "integrity": "sha512-Kvp459HrV2FEJ1CAsi1Ku+MY3kasH19TFykTz2xWmMeq6bk2NU3XXvfJ+Q61m0xktWwt+1HSYf3JZsTms3aRJg==", + "dev": true }, "cookie": { "version": "0.4.1", @@ -8461,21 +8382,12 @@ "dev": true }, "core-js-compat": { - "version": "3.20.3", - "resolved": "https://registry.npmjs.org/core-js-compat/-/core-js-compat-3.20.3.tgz", - "integrity": "sha512-c8M5h0IkNZ+I92QhIpuSijOxGAcj3lgpsWdkCqmUTZNwidujF4r3pi6x1DCN+Vcs5qTS2XWWMfWSuCqyupX8gw==", + "version": "3.39.0", + "resolved": "https://r.cnpmjs.org/core-js-compat/-/core-js-compat-3.39.0.tgz", + "integrity": "sha512-VgEUx3VwlExr5no0tXlBt+silBvhTryPwCXRI2Id1PN8WTKu7MreethvddqOubrYxkFdv/RnYrqlv1sFNAUelw==", "dev": true, "requires": { - "browserslist": "^4.19.1", - "semver": "7.0.0" - }, - "dependencies": { - "semver": { - "version": "7.0.0", - "resolved": "https://registry.npmjs.org/semver/-/semver-7.0.0.tgz", - "integrity": "sha512-+GB6zVA9LWh6zovYQLALHwv5rb2PHGlJi3lfiqIHxR0uuwCgefcOJc59v9fv1w8GbStwxuuqqAjI9NMAOOgq1A==", - "dev": true - } + "browserslist": "^4.24.2" } }, "core-util-is": { @@ -8547,15 +8459,6 @@ "integrity": "sha512-Ds09qNh8yw3khSjiJjiUInaGX9xlqZDY7JVryGxdxV7NPeuqQfplOpQ66yJFZut3jLa5zOwkXw1g9EI2uKh4Og==", "dev": true }, - "define-properties": { - "version": "1.1.3", - "resolved": "https://registry.npmjs.org/define-properties/-/define-properties-1.1.3.tgz", - "integrity": "sha512-3MqfYKj2lLzdMSf8ZIZE/V+Zuy+BgD6f164e8K2w7dgnpKArBDerGYpM46IYYcjnkdPNMjPk9A6VFB8+3SKlXQ==", - "dev": true, - "requires": { - "object-keys": "^1.0.12" - } - }, "delayed-stream": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/delayed-stream/-/delayed-stream-1.0.0.tgz", @@ -8657,9 +8560,9 @@ "dev": true }, "electron-to-chromium": { - "version": "1.4.48", - "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.4.48.tgz", - "integrity": "sha512-RT3SEmpv7XUA+tKXrZGudAWLDpa7f8qmhjcLaM6OD/ERxjQ/zAojT8/Vvo0BSzbArkElFZ1WyZ9FuwAYbkdBNA==", + "version": "1.5.72", + "resolved": "https://r.cnpmjs.org/electron-to-chromium/-/electron-to-chromium-1.5.72.tgz", + "integrity": "sha512-ZpSAUOZ2Izby7qnZluSrAlGgGQzucmFbN0n64dYzocYxnxV5ufurpj3VgEe4cUp7ir9LmeLxNYo8bVnlM8bQHw==", "dev": true }, "emoji-regex": { @@ -8712,9 +8615,9 @@ "dev": true }, "escalade": { - "version": "3.1.1", - "resolved": "https://registry.npmjs.org/escalade/-/escalade-3.1.1.tgz", - "integrity": "sha512-k0er2gUkLf8O0zKJiAhmkTnJlTvINGv7ygDNPbeIsX/TJjGJZHuh9B2UxbsaEkmlEo9MfhrSzmhIlhRlI2GXnw==", + "version": "3.2.0", + "resolved": "https://r.cnpmjs.org/escalade/-/escalade-3.2.0.tgz", + "integrity": "sha512-WUj2qlxaQtO4g6Pq5c29GTcWGDyd8itL8zTlipgECz3JesAiiOKotd8JU6otB3PACgG6xkJUyVhboMS+bje/jA==", "dev": true }, "escape-html": { @@ -9225,17 +9128,6 @@ "integrity": "sha512-DyFP3BM/3YHTQOCUL/w0OZHR0lpKeGrxotcHWcqNEdnltqFwXVfhEBQ94eIo34AfQpo0rGki4cyIiftY06h2Fg==", "dev": true }, - "get-intrinsic": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/get-intrinsic/-/get-intrinsic-1.1.1.tgz", - "integrity": "sha512-kWZrnVM42QCiEA2Ig1bG8zjoIMOgxWwYCEeNdwY6Tv/cOSeGpcoX4pXHfKUxNKVoArnrEr2e9srnAxxGIraS9Q==", - "dev": true, - "requires": { - "function-bind": "^1.1.1", - "has": "^1.0.3", - "has-symbols": "^1.0.1" - } - }, "getpass": { "version": "0.1.7", "resolved": "https://registry.npmjs.org/getpass/-/getpass-0.1.7.tgz", @@ -9328,12 +9220,6 @@ "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", "dev": true }, - "has-symbols": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/has-symbols/-/has-symbols-1.0.2.tgz", - "integrity": "sha512-chXa79rL/UC2KlX17jo3vRGz0azaWEx5tGqZg5pO3NUyEJVB17dMruQlzCCOfUvElghKcm5194+BCRvi2Rv/Gw==", - "dev": true - }, "has-unicode": { "version": "2.0.1", "resolved": "https://registry.npmjs.org/has-unicode/-/has-unicode-2.0.1.tgz", @@ -9617,9 +9503,9 @@ "dev": true }, "jsesc": { - "version": "2.5.2", - "resolved": "https://registry.npmjs.org/jsesc/-/jsesc-2.5.2.tgz", - "integrity": "sha512-OYu7XEzjkCQ3C5Ps3QIZsQfNpqoJyZZA99wd9aWd05NCtC5pWOkShK2mkL6HXQR6/Cy2lbNdPlZBpuQHXE63gA==", + "version": "3.0.2", + "resolved": "https://r2.cnpmjs.org/jsesc/-/jsesc-3.0.2.tgz", + "integrity": "sha512-xKqzzWXDttJuOcawBt4KnKHHIf5oQ/Cxax+0PWFG+DFDgHNAdi+TXECADI+RYiFUMmx8792xsMbbgXj4CwnP4g==", "dev": true }, "json-parse-even-better-errors": { @@ -9653,13 +9539,10 @@ "dev": true }, "json5": { - "version": "2.2.0", - "resolved": "https://registry.npmjs.org/json5/-/json5-2.2.0.tgz", - "integrity": "sha512-f+8cldu7X/y7RAJurMEJmdoKXGB/X550w2Nr3tTbezL6RwEE/iMcm+tZnXeoZtKuOq6ft8+CqzEkrIgx1fPoQA==", - "dev": true, - "requires": { - "minimist": "^1.2.5" - } + "version": "2.2.3", + "resolved": "https://r.cnpmjs.org/json5/-/json5-2.2.3.tgz", + "integrity": "sha512-XmOWe7eyHYH14cLdVPoyg+GOH3rYX++KpzrylJwSW98t3Nk+U8XOl8FWKOgwtzdb8lXGf6zYwDUzeHMWfxasyg==", + "dev": true }, "jsonparse": { "version": "1.3.1", @@ -9697,8 +9580,8 @@ }, "lodash.debounce": { "version": "4.0.8", - "resolved": "https://registry.npmjs.org/lodash.debounce/-/lodash.debounce-4.0.8.tgz", - "integrity": "sha1-gteb/zCmfEAF/9XiUVMArZyk168=", + "resolved": "https://r2.cnpmjs.org/lodash.debounce/-/lodash.debounce-4.0.8.tgz", + "integrity": "sha512-FT1yDzDYEoYWhnSGnpE/4Kj1fLZkDFyqRb7fNt6FdYOSxlUWAtp42Eh6Wb0rGIv/m9Bgo7x4GhQbm5Ys4SG5ow==", "dev": true }, "lodash.merge": { @@ -9800,12 +9683,6 @@ "brace-expansion": "^1.1.7" } }, - "minimist": { - "version": "1.2.5", - "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.5.tgz", - "integrity": "sha512-FM9nNUYrRBAELZQT3xeZQ7fmMOBg6nWNmJKTcgsJeaLstP/UODVpGsr5OhXhhXg6f+qtJ8uiZ+PUxkDWcgIXLw==", - "dev": true - }, "minipass": { "version": "3.1.6", "resolved": "https://registry.npmjs.org/minipass/-/minipass-3.1.6.tgz", @@ -9949,9 +9826,9 @@ } }, "node-releases": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/node-releases/-/node-releases-2.0.1.tgz", - "integrity": "sha512-CqyzN6z7Q6aMeF/ktcMVTzhAHCEpf8SOarwpzpf8pNBY2k5/oM34UHldUwp8VKI7uxct2HxSRdJjBaZeESzcxA==", + "version": "2.0.19", + "resolved": "https://r.cnpmjs.org/node-releases/-/node-releases-2.0.19.tgz", + "integrity": "sha512-xxOWJsBKtzAq7DY0J+DTzuz58K8e7sJbdgwkbMWQe8UYB6ekmsQ45q0M/tJDsGaZmbC+l7n57UV8Hl5tHxO9uw==", "dev": true }, "nopt": { @@ -10099,24 +9976,6 @@ "integrity": "sha1-IQmtx5ZYh8/AXLvUQsrIv7s2CGM=", "dev": true }, - "object-keys": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/object-keys/-/object-keys-1.1.1.tgz", - "integrity": "sha512-NuAESUOUMrlIXOfHKzD6bpPu3tYt3xvjNdRIQ+FeT0lNb4K8WR70CaDxhuNguS2XG+GjkyMwOzsN5ZktImfhLA==", - "dev": true - }, - "object.assign": { - "version": "4.1.2", - "resolved": "https://registry.npmjs.org/object.assign/-/object.assign-4.1.2.tgz", - "integrity": "sha512-ixT2L5THXsApyiUPYKmW+2EHpXXe5Ii3M+f4e+aJFAHao5amFRW6J0OO6c/LU8Be47utCx2GL89hxGB6XSmKuQ==", - "dev": true, - "requires": { - "call-bind": "^1.0.0", - "define-properties": "^1.1.3", - "has-symbols": "^1.0.1", - "object-keys": "^1.1.1" - } - }, "on-finished": { "version": "2.3.0", "resolved": "https://registry.npmjs.org/on-finished/-/on-finished-2.3.0.tgz", @@ -10242,9 +10101,9 @@ "dev": true }, "picocolors": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/picocolors/-/picocolors-1.0.0.tgz", - "integrity": "sha512-1fygroTLlHu66zi26VoTDv8yRgm0Fccecssto+MhsZ0D/DGW2sm8E8AjW7NU5VVTRt5GxbeZ5qBuJr+HyLYkjQ==", + "version": "1.1.1", + "resolved": "https://r.cnpmjs.org/picocolors/-/picocolors-1.1.1.tgz", + "integrity": "sha512-xceH2snhtb5M9liqDsmEw56le376mTZkEX/jEb/RxNFyegNul7eNslCXP9FDj/Lcu0X8KEyMceP2ntpaHrDEVA==", "dev": true }, "picomatch": { @@ -10380,14 +10239,14 @@ }, "regenerate": { "version": "1.4.2", - "resolved": "https://registry.npmjs.org/regenerate/-/regenerate-1.4.2.tgz", + "resolved": "https://r2.cnpmjs.org/regenerate/-/regenerate-1.4.2.tgz", "integrity": "sha512-zrceR/XhGYU/d/opr2EKO7aRHUeiBI8qjtfHqADTwZd6Szfy16la6kqD0MIUs5z5hx6AaKa+PixpPrR289+I0A==", "dev": true }, "regenerate-unicode-properties": { - "version": "9.0.0", - "resolved": "https://registry.npmjs.org/regenerate-unicode-properties/-/regenerate-unicode-properties-9.0.0.tgz", - "integrity": "sha512-3E12UeNSPfjrgwjkR81m5J7Aw/T55Tu7nUyZVQYCKEOs+2dkxEY+DpPtZzO4YruuiPb7NkYLVcyJC4+zCbk5pA==", + "version": "10.2.0", + "resolved": "https://r.cnpmjs.org/regenerate-unicode-properties/-/regenerate-unicode-properties-10.2.0.tgz", + "integrity": "sha512-DqHn3DwbmmPVzeKj9woBadqmXxLvQoQIwu7nopMc72ztvxVmVk2SBhSnx67zuye5TP+lJsb/TBQsjLKhnDf3MA==", "dev": true, "requires": { "regenerate": "^1.4.2" @@ -10400,9 +10259,9 @@ "dev": true }, "regenerator-transform": { - "version": "0.14.5", - "resolved": "https://registry.npmjs.org/regenerator-transform/-/regenerator-transform-0.14.5.tgz", - "integrity": "sha512-eOf6vka5IO151Jfsw2NO9WpGX58W6wWmefK3I1zEGr0lOD0u8rwPaNqQL1aRxUaxLeKO3ArNh3VYg1KbaD+FFw==", + "version": "0.15.2", + "resolved": "https://r.cnpmjs.org/regenerator-transform/-/regenerator-transform-0.15.2.tgz", + "integrity": "sha512-hfMp2BoF0qOk3uc5V20ALGDS2ddjQaLrdl7xrGXvAIow7qeWRM2VA2HuCHkUKk9slq3VwEwLNK3DFBqDfPGYtg==", "dev": true, "requires": { "@babel/runtime": "^7.8.4" @@ -10415,40 +10274,32 @@ "dev": true }, "regexpu-core": { - "version": "4.8.0", - "resolved": "https://registry.npmjs.org/regexpu-core/-/regexpu-core-4.8.0.tgz", - "integrity": "sha512-1F6bYsoYiz6is+oz70NWur2Vlh9KWtswuRuzJOfeYUrfPX2o8n74AnUVaOGDbUqVGO9fNHu48/pjJO4sNVwsOg==", + "version": "6.2.0", + "resolved": "https://r.cnpmjs.org/regexpu-core/-/regexpu-core-6.2.0.tgz", + "integrity": "sha512-H66BPQMrv+V16t8xtmq+UC0CBpiTBA60V8ibS1QVReIp8T1z8hwFxqcGzm9K6lgsN7sB5edVH8a+ze6Fqm4weA==", "dev": true, "requires": { "regenerate": "^1.4.2", - "regenerate-unicode-properties": "^9.0.0", - "regjsgen": "^0.5.2", - "regjsparser": "^0.7.0", + "regenerate-unicode-properties": "^10.2.0", + "regjsgen": "^0.8.0", + "regjsparser": "^0.12.0", "unicode-match-property-ecmascript": "^2.0.0", - "unicode-match-property-value-ecmascript": "^2.0.0" + "unicode-match-property-value-ecmascript": "^2.1.0" } }, "regjsgen": { - "version": "0.5.2", - "resolved": "https://registry.npmjs.org/regjsgen/-/regjsgen-0.5.2.tgz", - "integrity": "sha512-OFFT3MfrH90xIW8OOSyUrk6QHD5E9JOTeGodiJeBS3J6IwlgzJMNE/1bZklWz5oTg+9dCMyEetclvCVXOPoN3A==", + "version": "0.8.0", + "resolved": "https://r.cnpmjs.org/regjsgen/-/regjsgen-0.8.0.tgz", + "integrity": "sha512-RvwtGe3d7LvWiDQXeQw8p5asZUmfU1G/l6WbUXeHta7Y2PEIvBTwH6E2EfmYUK8pxcxEdEmaomqyp0vZZ7C+3Q==", "dev": true }, "regjsparser": { - "version": "0.7.0", - "resolved": "https://registry.npmjs.org/regjsparser/-/regjsparser-0.7.0.tgz", - "integrity": "sha512-A4pcaORqmNMDVwUjWoTzuhwMGpP+NykpfqAsEgI1FSH/EzC7lrN5TMd+kN8YCovX+jMpu8eaqXgXPCa0g8FQNQ==", + "version": "0.12.0", + "resolved": "https://r.cnpmjs.org/regjsparser/-/regjsparser-0.12.0.tgz", + "integrity": "sha512-cnE+y8bz4NhMjISKbgeVJtqNbtf5QpjZP+Bslo+UqkIt9QPnX9q095eiRRASJG1/tz6dlNr6Z5NsBiWYokp6EQ==", "dev": true, "requires": { - "jsesc": "~0.5.0" - }, - "dependencies": { - "jsesc": { - "version": "0.5.0", - "resolved": "https://registry.npmjs.org/jsesc/-/jsesc-0.5.0.tgz", - "integrity": "sha1-597mbjXW/Bb3EP6R1c9p9w8IkR0=", - "dev": true - } + "jsesc": "~3.0.2" } }, "request": { @@ -10692,9 +10543,9 @@ } }, "semver": { - "version": "6.3.0", - "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.0.tgz", - "integrity": "sha512-b39TBaTSfV6yBrapU89p5fKekE2m/NwnDocOVruQFS1/veMgdzuPcnOM34M6CwxW8jH/lxEa5rBoDeUwu5HHTw==", + "version": "6.3.1", + "resolved": "https://r.cnpmjs.org/semver/-/semver-6.3.1.tgz", + "integrity": "sha512-BR7VvDCVHO+q2xBEWskxS6DJE1qRnb7DxzUrogb71CWoSficBxYsiAGd+Kl0mmq/MprG9yArRkyrQxTO6XjMzA==", "dev": true }, "send": { @@ -10966,12 +10817,6 @@ "socks": "^2.6.1" } }, - "source-map": { - "version": "0.5.7", - "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.5.7.tgz", - "integrity": "sha1-igOdLRAh0i0eoUyA2OpGi6LvP8w=", - "dev": true - }, "source-map-support": { "version": "0.5.21", "resolved": "https://registry.npmjs.org/source-map-support/-/source-map-support-0.5.21.tgz", @@ -11137,12 +10982,6 @@ "integrity": "sha1-f17oI66AUgfACvLfSoTsP8+lcLQ=", "dev": true }, - "to-fast-properties": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/to-fast-properties/-/to-fast-properties-2.0.0.tgz", - "integrity": "sha1-3F5pjL0HkmW8c+A3doGk5Og/YW4=", - "dev": true - }, "toidentifier": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/toidentifier/-/toidentifier-1.0.1.tgz", @@ -11212,14 +11051,14 @@ } }, "unicode-canonical-property-names-ecmascript": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/unicode-canonical-property-names-ecmascript/-/unicode-canonical-property-names-ecmascript-2.0.0.tgz", - "integrity": "sha512-yY5PpDlfVIU5+y/BSCxAJRBIS1Zc2dDG3Ujq+sR0U+JjUevW2JhocOF+soROYDSaAezOzOKuyyixhD6mBknSmQ==", + "version": "2.0.1", + "resolved": "https://r.cnpmjs.org/unicode-canonical-property-names-ecmascript/-/unicode-canonical-property-names-ecmascript-2.0.1.tgz", + "integrity": "sha512-dA8WbNeb2a6oQzAQ55YlT5vQAWGV9WXOsi3SskE3bcCdM0P4SDd+24zS/OCacdRq5BkdsRj9q3Pg6YyQoxIGqg==", "dev": true }, "unicode-match-property-ecmascript": { "version": "2.0.0", - "resolved": "https://registry.npmjs.org/unicode-match-property-ecmascript/-/unicode-match-property-ecmascript-2.0.0.tgz", + "resolved": "https://r2.cnpmjs.org/unicode-match-property-ecmascript/-/unicode-match-property-ecmascript-2.0.0.tgz", "integrity": "sha512-5kaZCrbp5mmbz5ulBkDkbY0SsPOjKqVS35VpL9ulMPfSl0J0Xsm+9Evphv9CoIZFwre7aJoa94AY6seMKGVN5Q==", "dev": true, "requires": { @@ -11228,15 +11067,15 @@ } }, "unicode-match-property-value-ecmascript": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/unicode-match-property-value-ecmascript/-/unicode-match-property-value-ecmascript-2.0.0.tgz", - "integrity": "sha512-7Yhkc0Ye+t4PNYzOGKedDhXbYIBe1XEQYQxOPyhcXNMJ0WCABqqj6ckydd6pWRZTHV4GuCPKdBAUiMc60tsKVw==", + "version": "2.2.0", + "resolved": "https://r.cnpmjs.org/unicode-match-property-value-ecmascript/-/unicode-match-property-value-ecmascript-2.2.0.tgz", + "integrity": "sha512-4IehN3V/+kkr5YeSSDDQG8QLqO26XpL2XP3GQtqwlT/QYSECAwFztxVHjlbh0+gjJ3XmNLS0zDsbgs9jWKExLg==", "dev": true }, "unicode-property-aliases-ecmascript": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/unicode-property-aliases-ecmascript/-/unicode-property-aliases-ecmascript-2.0.0.tgz", - "integrity": "sha512-5Zfuy9q/DFr4tfO7ZPeVXb1aPoeQSdeFMLpYuFebehDAhbuevLs5yxSZmIFN1tP5F9Wl4IpJrYojg85/zgyZHQ==", + "version": "2.1.0", + "resolved": "https://r.cnpmjs.org/unicode-property-aliases-ecmascript/-/unicode-property-aliases-ecmascript-2.1.0.tgz", + "integrity": "sha512-6t3foTQI9qne+OZoVQB/8x8rk2k1eVy1gRXhV3oFQ5T6R1dqQ1xtin3XqSlx3+ATBkliTaR/hHyJBm+LVPNM8w==", "dev": true }, "unique-filename": { @@ -11263,6 +11102,16 @@ "integrity": "sha1-sr9O6FFKrmFltIF4KdIbLvSZBOw=", "dev": true }, + "update-browserslist-db": { + "version": "1.1.1", + "resolved": "https://r.cnpmjs.org/update-browserslist-db/-/update-browserslist-db-1.1.1.tgz", + "integrity": "sha512-R8UzCaa9Az+38REPiJ1tXlImTJXlVfgHZsglwBD/k6nj76ctsH1E3q4doGrukiLQd3sGQYu56r5+lo5r94l29A==", + "dev": true, + "requires": { + "escalade": "^3.2.0", + "picocolors": "^1.1.0" + } + }, "uri-js": { "version": "4.4.1", "resolved": "https://registry.npmjs.org/uri-js/-/uri-js-4.4.1.tgz", diff --git a/package.json b/package.json index fba3c0c60e61f5..7a5bfc67e89ddf 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@oppentech/three", - "version": "0.137.16", + "version": "0.137.17", "description": "JavaScript 3D library", "type": "module", "main": "./build/three.js", @@ -126,11 +126,11 @@ }, "homepage": "https://threejs.org/", "devDependencies": { - "@babel/core": "^7.15.5", + "@babel/core": "^7.26.0", "@babel/eslint-parser": "^7.15.7", "@babel/plugin-proposal-class-properties": "^7.14.5", - "@babel/preset-env": "^7.15.6", - "@rollup/plugin-babel": "^5.3.0", + "@babel/preset-env": "^7.26.0", + "@rollup/plugin-babel": "^5.3.1", "@rollup/plugin-node-resolve": "^13.0.5", "chalk": "^4.1.2", "concurrently": "^6.2.2", @@ -143,6 +143,7 @@ "rollup-plugin-visualizer": "^5.5.2", "servez": "^1.12.0" }, + "jspm": { "files": [ "package.json", @@ -154,4 +155,4 @@ ], "directories": {} } -} +} \ No newline at end of file diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml new file mode 100644 index 00000000000000..79c3f0a1a53632 --- /dev/null +++ b/pnpm-lock.yaml @@ -0,0 +1,4539 @@ +lockfileVersion: '9.0' + +settings: + autoInstallPeers: true + excludeLinksFromLockfile: false + +importers: + + .: + devDependencies: + '@babel/core': + specifier: ^7.26.0 + version: 7.26.0 + '@babel/eslint-parser': + specifier: ^7.15.7 + version: 7.16.5(@babel/core@7.26.0)(eslint@7.32.0) + '@babel/plugin-proposal-class-properties': + specifier: ^7.14.5 + version: 7.16.7(@babel/core@7.26.0) + '@babel/preset-env': + specifier: ^7.26.0 + version: 7.26.0(@babel/core@7.26.0) + '@rollup/plugin-babel': + specifier: ^5.3.1 + version: 5.3.1(@babel/core@7.26.0)(rollup@2.64.0) + '@rollup/plugin-node-resolve': + specifier: ^13.0.5 + version: 13.1.3(rollup@2.64.0) + chalk: + specifier: ^4.1.2 + version: 4.1.2 + concurrently: + specifier: ^6.2.2 + version: 6.5.1 + eslint: + specifier: ^7.32.0 + version: 7.32.0 + eslint-config-mdcs: + specifier: ^5.0.0 + version: 5.0.0 + eslint-plugin-html: + specifier: ^6.2.0 + version: 6.2.0 + rollup: + specifier: ^2.57.0 + version: 2.64.0 + rollup-plugin-filesize: + specifier: ^9.1.1 + version: 9.1.2(acorn@7.4.1) + rollup-plugin-terser: + specifier: ^7.0.2 + version: 7.0.2(acorn@7.4.1)(rollup@2.64.0) + rollup-plugin-visualizer: + specifier: ^5.5.2 + version: 5.5.4(rollup@2.64.0) + servez: + specifier: ^1.12.0 + version: 1.12.0 + +packages: + + '@ampproject/remapping@2.3.0': + resolution: {integrity: sha512-30iZtAPgz+LTIYoeivqYo853f02jBYSd5uGnGpkFV0M3xOt9aN73erkgYAmZU43x4VfqcnLxW9Kpg3R5LC4YYw==} + engines: {node: '>=6.0.0'} + + '@babel/code-frame@7.12.11': + resolution: {integrity: sha512-Zt1yodBx1UcyiePMSkWnU4hPqhwq7hGi2nFL1LeA3EUl+q2LQx16MISgJ0+z7dnmgvP9QtIleuETGOiOH1RcIw==} + + '@babel/code-frame@7.26.2': + resolution: {integrity: sha512-RJlIHRueQgwWitWgF8OdFYGZX328Ax5BCemNGlqHfplnRT9ESi8JkFlvaVYbS+UubVY6dpv87Fs2u5M29iNFVQ==} + engines: {node: '>=6.9.0'} + + '@babel/compat-data@7.26.3': + resolution: {integrity: sha512-nHIxvKPniQXpmQLb0vhY3VaFb3S0YrTAwpOWJZh1wn3oJPjJk9Asva204PsBdmAE8vpzfHudT8DB0scYvy9q0g==} + engines: {node: '>=6.9.0'} + + '@babel/core@7.26.0': + resolution: {integrity: sha512-i1SLeK+DzNnQ3LL/CswPCa/E5u4lh1k6IAEphON8F+cXt0t9euTshDru0q7/IqMa1PMPz5RnHuHscF8/ZJsStg==} + engines: {node: '>=6.9.0'} + + '@babel/eslint-parser@7.16.5': + resolution: {integrity: sha512-mUqYa46lgWqHKQ33Q6LNCGp/wPR3eqOYTUixHFsfrSQqRxH0+WOzca75iEjFr5RDGH1dDz622LaHhLOzOuQRUA==} + engines: {node: ^10.13.0 || ^12.13.0 || >=14.0.0} + peerDependencies: + '@babel/core': '>=7.11.0' + eslint: ^7.5.0 || ^8.0.0 + + '@babel/generator@7.26.3': + resolution: {integrity: sha512-6FF/urZvD0sTeO7k6/B15pMLC4CHUv1426lzr3N01aHJTl046uCAh9LXW/fzeXXjPNCJ6iABW5XaWOsIZB93aQ==} + engines: {node: '>=6.9.0'} + + '@babel/helper-annotate-as-pure@7.25.9': + resolution: {integrity: sha512-gv7320KBUFJz1RnylIg5WWYPRXKZ884AGkYpgpWW02TH66Dl+HaC1t1CKd0z3R4b6hdYEcmrNZHUmfCP+1u3/g==} + engines: {node: '>=6.9.0'} + + '@babel/helper-compilation-targets@7.25.9': + resolution: {integrity: sha512-j9Db8Suy6yV/VHa4qzrj9yZfZxhLWQdVnRlXxmKLYlhWUVB1sB2G5sxuWYXk/whHD9iW76PmNzxZ4UCnTQTVEQ==} + engines: {node: '>=6.9.0'} + + '@babel/helper-create-class-features-plugin@7.25.9': + resolution: {integrity: sha512-UTZQMvt0d/rSz6KI+qdu7GQze5TIajwTS++GUozlw8VBJDEOAqSXwm1WvmYEZwqdqSGQshRocPDqrt4HBZB3fQ==} + engines: {node: '>=6.9.0'} + peerDependencies: + '@babel/core': ^7.0.0 + + '@babel/helper-create-regexp-features-plugin@7.26.3': + resolution: {integrity: sha512-G7ZRb40uUgdKOQqPLjfD12ZmGA54PzqDFUv2BKImnC9QIfGhIHKvVML0oN8IUiDq4iRqpq74ABpvOaerfWdong==} + engines: {node: '>=6.9.0'} + peerDependencies: + '@babel/core': ^7.0.0 + + '@babel/helper-define-polyfill-provider@0.6.3': + resolution: {integrity: sha512-HK7Bi+Hj6H+VTHA3ZvBis7V/6hu9QuTrnMXNybfUf2iiuU/N97I8VjB+KbhFF8Rld/Lx5MzoCwPCpPjfK+n8Cg==} + peerDependencies: + '@babel/core': ^7.4.0 || ^8.0.0-0 <8.0.0 + + '@babel/helper-member-expression-to-functions@7.25.9': + resolution: {integrity: sha512-wbfdZ9w5vk0C0oyHqAJbc62+vet5prjj01jjJ8sKn3j9h3MQQlflEdXYvuqRWjHnM12coDEqiC1IRCi0U/EKwQ==} + engines: {node: '>=6.9.0'} + + '@babel/helper-module-imports@7.25.9': + resolution: {integrity: sha512-tnUA4RsrmflIM6W6RFTLFSXITtl0wKjgpnLgXyowocVPrbYrLUXSBXDgTs8BlbmIzIdlBySRQjINYs2BAkiLtw==} + engines: {node: '>=6.9.0'} + + '@babel/helper-module-transforms@7.26.0': + resolution: {integrity: sha512-xO+xu6B5K2czEnQye6BHA7DolFFmS3LB7stHZFaOLb1pAwO1HWLS8fXA+eh0A2yIvltPVmx3eNNDBJA2SLHXFw==} + engines: {node: '>=6.9.0'} + peerDependencies: + '@babel/core': ^7.0.0 + + '@babel/helper-optimise-call-expression@7.25.9': + resolution: {integrity: sha512-FIpuNaz5ow8VyrYcnXQTDRGvV6tTjkNtCK/RYNDXGSLlUD6cBuQTSw43CShGxjvfBTfcUA/r6UhUCbtYqkhcuQ==} + engines: {node: '>=6.9.0'} + + '@babel/helper-plugin-utils@7.25.9': + resolution: {integrity: sha512-kSMlyUVdWe25rEsRGviIgOWnoT/nfABVWlqt9N19/dIPWViAOW2s9wznP5tURbs/IDuNk4gPy3YdYRgH3uxhBw==} + engines: {node: '>=6.9.0'} + + '@babel/helper-remap-async-to-generator@7.25.9': + resolution: {integrity: sha512-IZtukuUeBbhgOcaW2s06OXTzVNJR0ybm4W5xC1opWFFJMZbwRj5LCk+ByYH7WdZPZTt8KnFwA8pvjN2yqcPlgw==} + engines: {node: '>=6.9.0'} + peerDependencies: + '@babel/core': ^7.0.0 + + '@babel/helper-replace-supers@7.25.9': + resolution: {integrity: sha512-IiDqTOTBQy0sWyeXyGSC5TBJpGFXBkRynjBeXsvbhQFKj2viwJC76Epz35YLU1fpe/Am6Vppb7W7zM4fPQzLsQ==} + engines: {node: '>=6.9.0'} + peerDependencies: + '@babel/core': ^7.0.0 + + '@babel/helper-skip-transparent-expression-wrappers@7.25.9': + resolution: {integrity: sha512-K4Du3BFa3gvyhzgPcntrkDgZzQaq6uozzcpGbOO1OEJaI+EJdqWIMTLgFgQf6lrfiDFo5FU+BxKepI9RmZqahA==} + engines: {node: '>=6.9.0'} + + '@babel/helper-string-parser@7.25.9': + resolution: {integrity: sha512-4A/SCr/2KLd5jrtOMFzaKjVtAei3+2r/NChoBNoZ3EyP/+GlhoaEGoWOZUmFmoITP7zOJyHIMm+DYRd8o3PvHA==} + engines: {node: '>=6.9.0'} + + '@babel/helper-validator-identifier@7.25.9': + resolution: {integrity: sha512-Ed61U6XJc3CVRfkERJWDz4dJwKe7iLmmJsbOGu9wSloNSFttHV0I8g6UAgb7qnK5ly5bGLPd4oXZlxCdANBOWQ==} + engines: {node: '>=6.9.0'} + + '@babel/helper-validator-option@7.25.9': + resolution: {integrity: sha512-e/zv1co8pp55dNdEcCynfj9X7nyUKUXoUEwfXqaZt0omVOmDe9oOTdKStH4GmAw6zxMFs50ZayuMfHDKlO7Tfw==} + engines: {node: '>=6.9.0'} + + '@babel/helper-wrap-function@7.25.9': + resolution: {integrity: sha512-ETzz9UTjQSTmw39GboatdymDq4XIQbR8ySgVrylRhPOFpsd+JrKHIuF0de7GCWmem+T4uC5z7EZguod7Wj4A4g==} + engines: {node: '>=6.9.0'} + + '@babel/helpers@7.26.0': + resolution: {integrity: sha512-tbhNuIxNcVb21pInl3ZSjksLCvgdZy9KwJ8brv993QtIVKJBBkYXz4q4ZbAv31GdnC+R90np23L5FbEBlthAEw==} + engines: {node: '>=6.9.0'} + + '@babel/highlight@7.16.7': + resolution: {integrity: sha512-aKpPMfLvGO3Q97V0qhw/V2SWNWlwfJknuwAunU7wZLSfrM4xTBvg7E5opUVi1kJTBKihE38CPg4nBiqX83PWYw==} + engines: {node: '>=6.9.0'} + + '@babel/parser@7.26.3': + resolution: {integrity: sha512-WJ/CvmY8Mea8iDXo6a7RK2wbmJITT5fN3BEkRuFlxVyNx8jOKIIhmC4fSkTcPcf8JyavbBwIe6OpiCOBXt/IcA==} + engines: {node: '>=6.0.0'} + hasBin: true + + '@babel/plugin-bugfix-firefox-class-in-computed-class-key@7.25.9': + resolution: {integrity: sha512-ZkRyVkThtxQ/J6nv3JFYv1RYY+JT5BvU0y3k5bWrmuG4woXypRa4PXmm9RhOwodRkYFWqC0C0cqcJ4OqR7kW+g==} + engines: {node: '>=6.9.0'} + peerDependencies: + '@babel/core': ^7.0.0 + + '@babel/plugin-bugfix-safari-class-field-initializer-scope@7.25.9': + resolution: {integrity: sha512-MrGRLZxLD/Zjj0gdU15dfs+HH/OXvnw/U4jJD8vpcP2CJQapPEv1IWwjc/qMg7ItBlPwSv1hRBbb7LeuANdcnw==} + engines: {node: '>=6.9.0'} + peerDependencies: + '@babel/core': ^7.0.0 + + '@babel/plugin-bugfix-safari-id-destructuring-collision-in-function-expression@7.25.9': + resolution: {integrity: sha512-2qUwwfAFpJLZqxd02YW9btUCZHl+RFvdDkNfZwaIJrvB8Tesjsk8pEQkTvGwZXLqXUx/2oyY3ySRhm6HOXuCug==} + engines: {node: '>=6.9.0'} + peerDependencies: + '@babel/core': ^7.0.0 + + '@babel/plugin-bugfix-v8-spread-parameters-in-optional-chaining@7.25.9': + resolution: {integrity: sha512-6xWgLZTJXwilVjlnV7ospI3xi+sl8lN8rXXbBD6vYn3UYDlGsag8wrZkKcSI8G6KgqKP7vNFaDgeDnfAABq61g==} + engines: {node: '>=6.9.0'} + peerDependencies: + '@babel/core': ^7.13.0 + + '@babel/plugin-bugfix-v8-static-class-fields-redefine-readonly@7.25.9': + resolution: {integrity: sha512-aLnMXYPnzwwqhYSCyXfKkIkYgJ8zv9RK+roo9DkTXz38ynIhd9XCbN08s3MGvqL2MYGVUGdRQLL/JqBIeJhJBg==} + engines: {node: '>=6.9.0'} + peerDependencies: + '@babel/core': ^7.0.0 + + '@babel/plugin-proposal-class-properties@7.16.7': + resolution: {integrity: sha512-IobU0Xme31ewjYOShSIqd/ZGM/r/cuOz2z0MDbNrhF5FW+ZVgi0f2lyeoj9KFPDOAqsYxmLWZte1WOwlvY9aww==} + engines: {node: '>=6.9.0'} + deprecated: This proposal has been merged to the ECMAScript standard and thus this plugin is no longer maintained. Please use @babel/plugin-transform-class-properties instead. + peerDependencies: + '@babel/core': ^7.0.0-0 + + '@babel/plugin-proposal-private-property-in-object@7.21.0-placeholder-for-preset-env.2': + resolution: {integrity: sha512-SOSkfJDddaM7mak6cPEpswyTRnuRltl429hMraQEglW+OkovnCzsiszTmsrlY//qLFjCpQDFRvjdm2wA5pPm9w==} + engines: {node: '>=6.9.0'} + peerDependencies: + '@babel/core': ^7.0.0-0 + + '@babel/plugin-syntax-import-assertions@7.26.0': + resolution: {integrity: sha512-QCWT5Hh830hK5EQa7XzuqIkQU9tT/whqbDz7kuaZMHFl1inRRg7JnuAEOQ0Ur0QUl0NufCk1msK2BeY79Aj/eg==} + engines: {node: '>=6.9.0'} + peerDependencies: + '@babel/core': ^7.0.0-0 + + '@babel/plugin-syntax-import-attributes@7.26.0': + resolution: {integrity: sha512-e2dttdsJ1ZTpi3B9UYGLw41hifAubg19AtCu/2I/F1QNVclOBr1dYpTdmdyZ84Xiz43BS/tCUkMAZNLv12Pi+A==} + engines: {node: '>=6.9.0'} + peerDependencies: + '@babel/core': ^7.0.0-0 + + '@babel/plugin-syntax-unicode-sets-regex@7.18.6': + resolution: {integrity: sha512-727YkEAPwSIQTv5im8QHz3upqp92JTWhidIC81Tdx4VJYIte/VndKf1qKrfnnhPLiPghStWfvC/iFaMCQu7Nqg==} + engines: {node: '>=6.9.0'} + peerDependencies: + '@babel/core': ^7.0.0 + + '@babel/plugin-transform-arrow-functions@7.25.9': + resolution: {integrity: sha512-6jmooXYIwn9ca5/RylZADJ+EnSxVUS5sjeJ9UPk6RWRzXCmOJCy6dqItPJFpw2cuCangPK4OYr5uhGKcmrm5Qg==} + engines: {node: '>=6.9.0'} + peerDependencies: + '@babel/core': ^7.0.0-0 + + '@babel/plugin-transform-async-generator-functions@7.25.9': + resolution: {integrity: sha512-RXV6QAzTBbhDMO9fWwOmwwTuYaiPbggWQ9INdZqAYeSHyG7FzQ+nOZaUUjNwKv9pV3aE4WFqFm1Hnbci5tBCAw==} + engines: {node: '>=6.9.0'} + peerDependencies: + '@babel/core': ^7.0.0-0 + + '@babel/plugin-transform-async-to-generator@7.25.9': + resolution: {integrity: sha512-NT7Ejn7Z/LjUH0Gv5KsBCxh7BH3fbLTV0ptHvpeMvrt3cPThHfJfst9Wrb7S8EvJ7vRTFI7z+VAvFVEQn/m5zQ==} + engines: {node: '>=6.9.0'} + peerDependencies: + '@babel/core': ^7.0.0-0 + + '@babel/plugin-transform-block-scoped-functions@7.25.9': + resolution: {integrity: sha512-toHc9fzab0ZfenFpsyYinOX0J/5dgJVA2fm64xPewu7CoYHWEivIWKxkK2rMi4r3yQqLnVmheMXRdG+k239CgA==} + engines: {node: '>=6.9.0'} + peerDependencies: + '@babel/core': ^7.0.0-0 + + '@babel/plugin-transform-block-scoping@7.25.9': + resolution: {integrity: sha512-1F05O7AYjymAtqbsFETboN1NvBdcnzMerO+zlMyJBEz6WkMdejvGWw9p05iTSjC85RLlBseHHQpYaM4gzJkBGg==} + engines: {node: '>=6.9.0'} + peerDependencies: + '@babel/core': ^7.0.0-0 + + '@babel/plugin-transform-class-properties@7.25.9': + resolution: {integrity: sha512-bbMAII8GRSkcd0h0b4X+36GksxuheLFjP65ul9w6C3KgAamI3JqErNgSrosX6ZPj+Mpim5VvEbawXxJCyEUV3Q==} + engines: {node: '>=6.9.0'} + peerDependencies: + '@babel/core': ^7.0.0-0 + + '@babel/plugin-transform-class-static-block@7.26.0': + resolution: {integrity: sha512-6J2APTs7BDDm+UMqP1useWqhcRAXo0WIoVj26N7kPFB6S73Lgvyka4KTZYIxtgYXiN5HTyRObA72N2iu628iTQ==} + engines: {node: '>=6.9.0'} + peerDependencies: + '@babel/core': ^7.12.0 + + '@babel/plugin-transform-classes@7.25.9': + resolution: {integrity: sha512-mD8APIXmseE7oZvZgGABDyM34GUmK45Um2TXiBUt7PnuAxrgoSVf123qUzPxEr/+/BHrRn5NMZCdE2m/1F8DGg==} + engines: {node: '>=6.9.0'} + peerDependencies: + '@babel/core': ^7.0.0-0 + + '@babel/plugin-transform-computed-properties@7.25.9': + resolution: {integrity: sha512-HnBegGqXZR12xbcTHlJ9HGxw1OniltT26J5YpfruGqtUHlz/xKf/G2ak9e+t0rVqrjXa9WOhvYPz1ERfMj23AA==} + engines: {node: '>=6.9.0'} + peerDependencies: + '@babel/core': ^7.0.0-0 + + '@babel/plugin-transform-destructuring@7.25.9': + resolution: {integrity: sha512-WkCGb/3ZxXepmMiX101nnGiU+1CAdut8oHyEOHxkKuS1qKpU2SMXE2uSvfz8PBuLd49V6LEsbtyPhWC7fnkgvQ==} + engines: {node: '>=6.9.0'} + peerDependencies: + '@babel/core': ^7.0.0-0 + + '@babel/plugin-transform-dotall-regex@7.25.9': + resolution: {integrity: sha512-t7ZQ7g5trIgSRYhI9pIJtRl64KHotutUJsh4Eze5l7olJv+mRSg4/MmbZ0tv1eeqRbdvo/+trvJD/Oc5DmW2cA==} + engines: {node: '>=6.9.0'} + peerDependencies: + '@babel/core': ^7.0.0-0 + + '@babel/plugin-transform-duplicate-keys@7.25.9': + resolution: {integrity: sha512-LZxhJ6dvBb/f3x8xwWIuyiAHy56nrRG3PeYTpBkkzkYRRQ6tJLu68lEF5VIqMUZiAV7a8+Tb78nEoMCMcqjXBw==} + engines: {node: '>=6.9.0'} + peerDependencies: + '@babel/core': ^7.0.0-0 + + '@babel/plugin-transform-duplicate-named-capturing-groups-regex@7.25.9': + resolution: {integrity: sha512-0UfuJS0EsXbRvKnwcLjFtJy/Sxc5J5jhLHnFhy7u4zih97Hz6tJkLU+O+FMMrNZrosUPxDi6sYxJ/EA8jDiAog==} + engines: {node: '>=6.9.0'} + peerDependencies: + '@babel/core': ^7.0.0 + + '@babel/plugin-transform-dynamic-import@7.25.9': + resolution: {integrity: sha512-GCggjexbmSLaFhqsojeugBpeaRIgWNTcgKVq/0qIteFEqY2A+b9QidYadrWlnbWQUrW5fn+mCvf3tr7OeBFTyg==} + engines: {node: '>=6.9.0'} + peerDependencies: + '@babel/core': ^7.0.0-0 + + '@babel/plugin-transform-exponentiation-operator@7.26.3': + resolution: {integrity: sha512-7CAHcQ58z2chuXPWblnn1K6rLDnDWieghSOEmqQsrBenH0P9InCUtOJYD89pvngljmZlJcz3fcmgYsXFNGa1ZQ==} + engines: {node: '>=6.9.0'} + peerDependencies: + '@babel/core': ^7.0.0-0 + + '@babel/plugin-transform-export-namespace-from@7.25.9': + resolution: {integrity: sha512-2NsEz+CxzJIVOPx2o9UsW1rXLqtChtLoVnwYHHiB04wS5sgn7mrV45fWMBX0Kk+ub9uXytVYfNP2HjbVbCB3Ww==} + engines: {node: '>=6.9.0'} + peerDependencies: + '@babel/core': ^7.0.0-0 + + '@babel/plugin-transform-for-of@7.25.9': + resolution: {integrity: sha512-LqHxduHoaGELJl2uhImHwRQudhCM50pT46rIBNvtT/Oql3nqiS3wOwP+5ten7NpYSXrrVLgtZU3DZmPtWZo16A==} + engines: {node: '>=6.9.0'} + peerDependencies: + '@babel/core': ^7.0.0-0 + + '@babel/plugin-transform-function-name@7.25.9': + resolution: {integrity: sha512-8lP+Yxjv14Vc5MuWBpJsoUCd3hD6V9DgBon2FVYL4jJgbnVQ9fTgYmonchzZJOVNgzEgbxp4OwAf6xz6M/14XA==} + engines: {node: '>=6.9.0'} + peerDependencies: + '@babel/core': ^7.0.0-0 + + '@babel/plugin-transform-json-strings@7.25.9': + resolution: {integrity: sha512-xoTMk0WXceiiIvsaquQQUaLLXSW1KJ159KP87VilruQm0LNNGxWzahxSS6T6i4Zg3ezp4vA4zuwiNUR53qmQAw==} + engines: {node: '>=6.9.0'} + peerDependencies: + '@babel/core': ^7.0.0-0 + + '@babel/plugin-transform-literals@7.25.9': + resolution: {integrity: sha512-9N7+2lFziW8W9pBl2TzaNht3+pgMIRP74zizeCSrtnSKVdUl8mAjjOP2OOVQAfZ881P2cNjDj1uAMEdeD50nuQ==} + engines: {node: '>=6.9.0'} + peerDependencies: + '@babel/core': ^7.0.0-0 + + '@babel/plugin-transform-logical-assignment-operators@7.25.9': + resolution: {integrity: sha512-wI4wRAzGko551Y8eVf6iOY9EouIDTtPb0ByZx+ktDGHwv6bHFimrgJM/2T021txPZ2s4c7bqvHbd+vXG6K948Q==} + engines: {node: '>=6.9.0'} + peerDependencies: + '@babel/core': ^7.0.0-0 + + '@babel/plugin-transform-member-expression-literals@7.25.9': + resolution: {integrity: sha512-PYazBVfofCQkkMzh2P6IdIUaCEWni3iYEerAsRWuVd8+jlM1S9S9cz1dF9hIzyoZ8IA3+OwVYIp9v9e+GbgZhA==} + engines: {node: '>=6.9.0'} + peerDependencies: + '@babel/core': ^7.0.0-0 + + '@babel/plugin-transform-modules-amd@7.25.9': + resolution: {integrity: sha512-g5T11tnI36jVClQlMlt4qKDLlWnG5pP9CSM4GhdRciTNMRgkfpo5cR6b4rGIOYPgRRuFAvwjPQ/Yk+ql4dyhbw==} + engines: {node: '>=6.9.0'} + peerDependencies: + '@babel/core': ^7.0.0-0 + + '@babel/plugin-transform-modules-commonjs@7.26.3': + resolution: {integrity: sha512-MgR55l4q9KddUDITEzEFYn5ZsGDXMSsU9E+kh7fjRXTIC3RHqfCo8RPRbyReYJh44HQ/yomFkqbOFohXvDCiIQ==} + engines: {node: '>=6.9.0'} + peerDependencies: + '@babel/core': ^7.0.0-0 + + '@babel/plugin-transform-modules-systemjs@7.25.9': + resolution: {integrity: sha512-hyss7iIlH/zLHaehT+xwiymtPOpsiwIIRlCAOwBB04ta5Tt+lNItADdlXw3jAWZ96VJ2jlhl/c+PNIQPKNfvcA==} + engines: {node: '>=6.9.0'} + peerDependencies: + '@babel/core': ^7.0.0-0 + + '@babel/plugin-transform-modules-umd@7.25.9': + resolution: {integrity: sha512-bS9MVObUgE7ww36HEfwe6g9WakQ0KF07mQF74uuXdkoziUPfKyu/nIm663kz//e5O1nPInPFx36z7WJmJ4yNEw==} + engines: {node: '>=6.9.0'} + peerDependencies: + '@babel/core': ^7.0.0-0 + + '@babel/plugin-transform-named-capturing-groups-regex@7.25.9': + resolution: {integrity: sha512-oqB6WHdKTGl3q/ItQhpLSnWWOpjUJLsOCLVyeFgeTktkBSCiurvPOsyt93gibI9CmuKvTUEtWmG5VhZD+5T/KA==} + engines: {node: '>=6.9.0'} + peerDependencies: + '@babel/core': ^7.0.0 + + '@babel/plugin-transform-new-target@7.25.9': + resolution: {integrity: sha512-U/3p8X1yCSoKyUj2eOBIx3FOn6pElFOKvAAGf8HTtItuPyB+ZeOqfn+mvTtg9ZlOAjsPdK3ayQEjqHjU/yLeVQ==} + engines: {node: '>=6.9.0'} + peerDependencies: + '@babel/core': ^7.0.0-0 + + '@babel/plugin-transform-nullish-coalescing-operator@7.25.9': + resolution: {integrity: sha512-ENfftpLZw5EItALAD4WsY/KUWvhUlZndm5GC7G3evUsVeSJB6p0pBeLQUnRnBCBx7zV0RKQjR9kCuwrsIrjWog==} + engines: {node: '>=6.9.0'} + peerDependencies: + '@babel/core': ^7.0.0-0 + + '@babel/plugin-transform-numeric-separator@7.25.9': + resolution: {integrity: sha512-TlprrJ1GBZ3r6s96Yq8gEQv82s8/5HnCVHtEJScUj90thHQbwe+E5MLhi2bbNHBEJuzrvltXSru+BUxHDoog7Q==} + engines: {node: '>=6.9.0'} + peerDependencies: + '@babel/core': ^7.0.0-0 + + '@babel/plugin-transform-object-rest-spread@7.25.9': + resolution: {integrity: sha512-fSaXafEE9CVHPweLYw4J0emp1t8zYTXyzN3UuG+lylqkvYd7RMrsOQ8TYx5RF231be0vqtFC6jnx3UmpJmKBYg==} + engines: {node: '>=6.9.0'} + peerDependencies: + '@babel/core': ^7.0.0-0 + + '@babel/plugin-transform-object-super@7.25.9': + resolution: {integrity: sha512-Kj/Gh+Rw2RNLbCK1VAWj2U48yxxqL2x0k10nPtSdRa0O2xnHXalD0s+o1A6a0W43gJ00ANo38jxkQreckOzv5A==} + engines: {node: '>=6.9.0'} + peerDependencies: + '@babel/core': ^7.0.0-0 + + '@babel/plugin-transform-optional-catch-binding@7.25.9': + resolution: {integrity: sha512-qM/6m6hQZzDcZF3onzIhZeDHDO43bkNNlOX0i8n3lR6zLbu0GN2d8qfM/IERJZYauhAHSLHy39NF0Ctdvcid7g==} + engines: {node: '>=6.9.0'} + peerDependencies: + '@babel/core': ^7.0.0-0 + + '@babel/plugin-transform-optional-chaining@7.25.9': + resolution: {integrity: sha512-6AvV0FsLULbpnXeBjrY4dmWF8F7gf8QnvTEoO/wX/5xm/xE1Xo8oPuD3MPS+KS9f9XBEAWN7X1aWr4z9HdOr7A==} + engines: {node: '>=6.9.0'} + peerDependencies: + '@babel/core': ^7.0.0-0 + + '@babel/plugin-transform-parameters@7.25.9': + resolution: {integrity: sha512-wzz6MKwpnshBAiRmn4jR8LYz/g8Ksg0o80XmwZDlordjwEk9SxBzTWC7F5ef1jhbrbOW2DJ5J6ayRukrJmnr0g==} + engines: {node: '>=6.9.0'} + peerDependencies: + '@babel/core': ^7.0.0-0 + + '@babel/plugin-transform-private-methods@7.25.9': + resolution: {integrity: sha512-D/JUozNpQLAPUVusvqMxyvjzllRaF8/nSrP1s2YGQT/W4LHK4xxsMcHjhOGTS01mp9Hda8nswb+FblLdJornQw==} + engines: {node: '>=6.9.0'} + peerDependencies: + '@babel/core': ^7.0.0-0 + + '@babel/plugin-transform-private-property-in-object@7.25.9': + resolution: {integrity: sha512-Evf3kcMqzXA3xfYJmZ9Pg1OvKdtqsDMSWBDzZOPLvHiTt36E75jLDQo5w1gtRU95Q4E5PDttrTf25Fw8d/uWLw==} + engines: {node: '>=6.9.0'} + peerDependencies: + '@babel/core': ^7.0.0-0 + + '@babel/plugin-transform-property-literals@7.25.9': + resolution: {integrity: sha512-IvIUeV5KrS/VPavfSM/Iu+RE6llrHrYIKY1yfCzyO/lMXHQ+p7uGhonmGVisv6tSBSVgWzMBohTcvkC9vQcQFA==} + engines: {node: '>=6.9.0'} + peerDependencies: + '@babel/core': ^7.0.0-0 + + '@babel/plugin-transform-regenerator@7.25.9': + resolution: {integrity: sha512-vwDcDNsgMPDGP0nMqzahDWE5/MLcX8sv96+wfX7as7LoF/kr97Bo/7fI00lXY4wUXYfVmwIIyG80fGZ1uvt2qg==} + engines: {node: '>=6.9.0'} + peerDependencies: + '@babel/core': ^7.0.0-0 + + '@babel/plugin-transform-regexp-modifiers@7.26.0': + resolution: {integrity: sha512-vN6saax7lrA2yA/Pak3sCxuD6F5InBjn9IcrIKQPjpsLvuHYLVroTxjdlVRHjjBWxKOqIwpTXDkOssYT4BFdRw==} + engines: {node: '>=6.9.0'} + peerDependencies: + '@babel/core': ^7.0.0 + + '@babel/plugin-transform-reserved-words@7.25.9': + resolution: {integrity: sha512-7DL7DKYjn5Su++4RXu8puKZm2XBPHyjWLUidaPEkCUBbE7IPcsrkRHggAOOKydH1dASWdcUBxrkOGNxUv5P3Jg==} + engines: {node: '>=6.9.0'} + peerDependencies: + '@babel/core': ^7.0.0-0 + + '@babel/plugin-transform-shorthand-properties@7.25.9': + resolution: {integrity: sha512-MUv6t0FhO5qHnS/W8XCbHmiRWOphNufpE1IVxhK5kuN3Td9FT1x4rx4K42s3RYdMXCXpfWkGSbCSd0Z64xA7Ng==} + engines: {node: '>=6.9.0'} + peerDependencies: + '@babel/core': ^7.0.0-0 + + '@babel/plugin-transform-spread@7.25.9': + resolution: {integrity: sha512-oNknIB0TbURU5pqJFVbOOFspVlrpVwo2H1+HUIsVDvp5VauGGDP1ZEvO8Nn5xyMEs3dakajOxlmkNW7kNgSm6A==} + engines: {node: '>=6.9.0'} + peerDependencies: + '@babel/core': ^7.0.0-0 + + '@babel/plugin-transform-sticky-regex@7.25.9': + resolution: {integrity: sha512-WqBUSgeVwucYDP9U/xNRQam7xV8W5Zf+6Eo7T2SRVUFlhRiMNFdFz58u0KZmCVVqs2i7SHgpRnAhzRNmKfi2uA==} + engines: {node: '>=6.9.0'} + peerDependencies: + '@babel/core': ^7.0.0-0 + + '@babel/plugin-transform-template-literals@7.25.9': + resolution: {integrity: sha512-o97AE4syN71M/lxrCtQByzphAdlYluKPDBzDVzMmfCobUjjhAryZV0AIpRPrxN0eAkxXO6ZLEScmt+PNhj2OTw==} + engines: {node: '>=6.9.0'} + peerDependencies: + '@babel/core': ^7.0.0-0 + + '@babel/plugin-transform-typeof-symbol@7.25.9': + resolution: {integrity: sha512-v61XqUMiueJROUv66BVIOi0Fv/CUuZuZMl5NkRoCVxLAnMexZ0A3kMe7vvZ0nulxMuMp0Mk6S5hNh48yki08ZA==} + engines: {node: '>=6.9.0'} + peerDependencies: + '@babel/core': ^7.0.0-0 + + '@babel/plugin-transform-unicode-escapes@7.25.9': + resolution: {integrity: sha512-s5EDrE6bW97LtxOcGj1Khcx5AaXwiMmi4toFWRDP9/y0Woo6pXC+iyPu/KuhKtfSrNFd7jJB+/fkOtZy6aIC6Q==} + engines: {node: '>=6.9.0'} + peerDependencies: + '@babel/core': ^7.0.0-0 + + '@babel/plugin-transform-unicode-property-regex@7.25.9': + resolution: {integrity: sha512-Jt2d8Ga+QwRluxRQ307Vlxa6dMrYEMZCgGxoPR8V52rxPyldHu3hdlHspxaqYmE7oID5+kB+UKUB/eWS+DkkWg==} + engines: {node: '>=6.9.0'} + peerDependencies: + '@babel/core': ^7.0.0-0 + + '@babel/plugin-transform-unicode-regex@7.25.9': + resolution: {integrity: sha512-yoxstj7Rg9dlNn9UQxzk4fcNivwv4nUYz7fYXBaKxvw/lnmPuOm/ikoELygbYq68Bls3D/D+NBPHiLwZdZZ4HA==} + engines: {node: '>=6.9.0'} + peerDependencies: + '@babel/core': ^7.0.0-0 + + '@babel/plugin-transform-unicode-sets-regex@7.25.9': + resolution: {integrity: sha512-8BYqO3GeVNHtx69fdPshN3fnzUNLrWdHhk/icSwigksJGczKSizZ+Z6SBCxTs723Fr5VSNorTIK7a+R2tISvwQ==} + engines: {node: '>=6.9.0'} + peerDependencies: + '@babel/core': ^7.0.0 + + '@babel/preset-env@7.26.0': + resolution: {integrity: sha512-H84Fxq0CQJNdPFT2DrfnylZ3cf5K43rGfWK4LJGPpjKHiZlk0/RzwEus3PDDZZg+/Er7lCA03MVacueUuXdzfw==} + engines: {node: '>=6.9.0'} + peerDependencies: + '@babel/core': ^7.0.0-0 + + '@babel/preset-modules@0.1.6-no-external-plugins': + resolution: {integrity: sha512-HrcgcIESLm9aIR842yhJ5RWan/gebQUJ6E/E5+rf0y9o6oj7w0Br+sWuL6kEQ/o/AdfvR1Je9jG18/gnpwjEyA==} + peerDependencies: + '@babel/core': ^7.0.0-0 || ^8.0.0-0 <8.0.0 + + '@babel/runtime@7.16.7': + resolution: {integrity: sha512-9E9FJowqAsytyOY6LG+1KuueckRL+aQW+mKvXRXnuFGyRAyepJPmEo9vgMfXUA6O9u3IeEdv9MAkppFcaQwogQ==} + engines: {node: '>=6.9.0'} + + '@babel/template@7.25.9': + resolution: {integrity: sha512-9DGttpmPvIxBb/2uwpVo3dqJ+O6RooAFOS+lB+xDqoE2PVCE8nfoHMdZLpfCQRLwvohzXISPZcgxt80xLfsuwg==} + engines: {node: '>=6.9.0'} + + '@babel/traverse@7.26.4': + resolution: {integrity: sha512-fH+b7Y4p3yqvApJALCPJcwb0/XaOSgtK4pzV6WVjPR5GLFQBRI7pfoX2V2iM48NXvX07NUxxm1Vw98YjqTcU5w==} + engines: {node: '>=6.9.0'} + + '@babel/types@7.26.3': + resolution: {integrity: sha512-vN5p+1kl59GVKMvTHt55NzzmYVxprfJD+ql7U9NFIfKCBkYE55LYtS+WtPlaYOyzydrKI8Nezd+aZextrd+FMA==} + engines: {node: '>=6.9.0'} + + '@eslint/eslintrc@0.4.3': + resolution: {integrity: sha512-J6KFFz5QCYUJq3pf0mjEcCJVERbzv71PUIDczuh9JkwGEzced6CO5ADLHB1rbf/+oPBtoPfMYNOpGDzCANlbXw==} + engines: {node: ^10.12.0 || >=12.0.0} + + '@gar/promisify@1.1.2': + resolution: {integrity: sha512-82cpyJyKRoQoRi+14ibCeGPu0CwypgtBAdBhq1WfvagpCZNKqwXbKwXllYSMG91DhmG4jt9gN8eP6lGOtozuaw==} + + '@humanwhocodes/config-array@0.5.0': + resolution: {integrity: sha512-FagtKFz74XrTl7y6HCzQpwDfXP0yhxe9lHLD1UZxjvZIcbyRz8zTFF/yYNfSfzU414eDwZ1SrO0Qvtyf+wFMQg==} + engines: {node: '>=10.10.0'} + deprecated: Use @eslint/config-array instead + + '@humanwhocodes/object-schema@1.2.1': + resolution: {integrity: sha512-ZnQMnLV4e7hDlUvw8H+U8ASL02SS2Gn6+9Ac3wGGLIe7+je2AeAOxPY+izIPJDfFDb7eDjev0Us8MO1iFRN8hA==} + deprecated: Use @eslint/object-schema instead + + '@jridgewell/gen-mapping@0.3.5': + resolution: {integrity: sha512-IzL8ZoEDIBRWEzlCcRhOaCupYyN5gdIK+Q6fbFdPDg6HqX6jpkItn7DFIpW9LQzXG6Df9sA7+OKnq0qlz/GaQg==} + engines: {node: '>=6.0.0'} + + '@jridgewell/resolve-uri@3.1.2': + resolution: {integrity: sha512-bRISgCIjP20/tbWSPWMEi54QVPRZExkuD9lJL+UIxUKtwVJA8wW1Trb1jMs1RFXo1CBTNZ/5hpC9QvmKWdopKw==} + engines: {node: '>=6.0.0'} + + '@jridgewell/set-array@1.2.1': + resolution: {integrity: sha512-R8gLRTZeyp03ymzP/6Lil/28tGeGEzhx1q2k703KGWRAI1VdvPIXdG70VJc2pAMw3NA6JKL5hhFu1sJX0Mnn/A==} + engines: {node: '>=6.0.0'} + + '@jridgewell/sourcemap-codec@1.5.0': + resolution: {integrity: sha512-gv3ZRaISU3fjPAgNsriBRqGWQL6quFx04YMPW/zD8XMLsU32mhCCbfbO6KZFLjvYpCZ8zyDEgqsgf+PwPaM7GQ==} + + '@jridgewell/trace-mapping@0.3.25': + resolution: {integrity: sha512-vNk6aEwybGtawWmy/PzwnGDOjCkLWSD2wqvjGGAgOAwCGWySYXfYoxt00IJkTF+8Lb57DwOb3Aa0o9CApepiYQ==} + + '@npmcli/fs@1.1.0': + resolution: {integrity: sha512-VhP1qZLXcrXRIaPoqb4YA55JQxLNF3jNR4T55IdOJa3+IFJKNYHtPvtXx8slmeMavj37vCzCfrqQM1vWLsYKLA==} + engines: {node: ^12.13.0 || ^14.15.0 || >=16} + deprecated: this version had an improper engines field added, update to 1.1.1 + + '@npmcli/git@2.1.0': + resolution: {integrity: sha512-/hBFX/QG1b+N7PZBFs0bi+evgRZcK9nWBxQKZkGoXUT5hJSwl5c4d7y8/hm+NQZRPhQ67RzFaj5UM9YeyKoryw==} + + '@npmcli/installed-package-contents@1.0.7': + resolution: {integrity: sha512-9rufe0wnJusCQoLpV9ZPKIVP55itrM5BxOXs10DmdbRfgWtHy1LDyskbwRnBghuB0PrF7pNPOqREVtpz4HqzKw==} + engines: {node: '>= 10'} + hasBin: true + + '@npmcli/move-file@1.1.2': + resolution: {integrity: sha512-1SUf/Cg2GzGDyaf15aR9St9TWlb+XvbZXWpDx8YKs7MLzMH/BCeopv+y9vzrzgkfykCGuWOlSu3mZhj2+FQcrg==} + engines: {node: '>=10'} + deprecated: This functionality has been moved to @npmcli/fs + + '@npmcli/node-gyp@1.0.3': + resolution: {integrity: sha512-fnkhw+fmX65kiLqk6E3BFLXNC26rUhK90zVwe2yncPliVT/Qos3xjhTLE59Df8KnPlcwIERXKVlU1bXoUQ+liA==} + + '@npmcli/promise-spawn@1.3.2': + resolution: {integrity: sha512-QyAGYo/Fbj4MXeGdJcFzZ+FkDkomfRBrPM+9QYJSg+PxgAUL+LU3FneQk37rKR2/zjqkCV1BLHccX98wRXG3Sg==} + + '@npmcli/run-script@1.8.6': + resolution: {integrity: sha512-e42bVZnC6VluBZBAFEr3YrdqSspG3bgilyg4nSLBJ7TRGNCzxHa92XAHxQBLYg0BmgwO4b2mf3h/l5EkEWRn3g==} + + '@rollup/plugin-babel@5.3.1': + resolution: {integrity: sha512-WFfdLWU/xVWKeRQnKmIAQULUI7Il0gZnBIH/ZFO069wYIfPu+8zrfp/KMW0atmELoRDq8FbiP3VCss9MhCut7Q==} + engines: {node: '>= 10.0.0'} + peerDependencies: + '@babel/core': ^7.0.0 + '@types/babel__core': ^7.1.9 + rollup: ^1.20.0||^2.0.0 + peerDependenciesMeta: + '@types/babel__core': + optional: true + + '@rollup/plugin-node-resolve@13.1.3': + resolution: {integrity: sha512-BdxNk+LtmElRo5d06MGY4zoepyrXX1tkzX2hrnPEZ53k78GuOMWLqmJDGIIOPwVRIFZrLQOo+Yr6KtCuLIA0AQ==} + engines: {node: '>= 10.0.0'} + peerDependencies: + rollup: ^2.42.0 + + '@rollup/pluginutils@3.1.0': + resolution: {integrity: sha512-GksZ6pr6TpIjHm8h9lSQ8pi8BE9VeubNT0OMJ3B5uZJ8pz73NPiqOtCog/x2/QzM1ENChPKxMDhiQuRHsqc+lg==} + engines: {node: '>= 8.0.0'} + peerDependencies: + rollup: ^1.20.0||^2.0.0 + + '@tootallnate/once@1.1.2': + resolution: {integrity: sha512-RbzJvlNzmRq5c3O09UipeuXno4tA1FE6ikOjxZK0tuxVv3412l64l5t1W5pj4+rJq9vpkm/kwiR07aZXnsKPxw==} + engines: {node: '>= 6'} + + '@types/estree@0.0.39': + resolution: {integrity: sha512-EYNwp3bU+98cpU4lAWYYL7Zz+2gryWH1qbdDTidVd6hkiR6weksdbMadyXKXNPEkQFhXM+hVO9ZygomHXp+AIw==} + + '@types/node@17.0.10': + resolution: {integrity: sha512-S/3xB4KzyFxYGCppyDt68yzBU9ysL88lSdIah4D6cptdcltc4NCPCAMc0+PCpg/lLIyC7IPvj2Z52OJWeIUkog==} + + '@types/resolve@1.17.1': + resolution: {integrity: sha512-yy7HuzQhj0dhGpD8RLXSZWEkLsV9ibvxvi6EiJ3bkqLAO1RGo0WbkWQiwpRlSFymTJRz0d3k5LM3kkx8ArDbLw==} + + abbrev@1.1.1: + resolution: {integrity: sha512-nne9/IiQ/hzIhY6pdDnbBtz7DjPTKrY00P/zvPSm5pOFkl6xuGrGnXn/VtTNNfNtAfZ9/1RtehkszU9qcTii0Q==} + + accepts@1.3.7: + resolution: {integrity: sha512-Il80Qs2WjYlJIBNzNkK6KYqlVMTbZLXgHx2oT0pU/fjRHyEp+PEfEPY0R3WCwAGVOtauxh1hOxNgIf5bv7dQpA==} + engines: {node: '>= 0.6'} + + acorn-jsx@5.3.2: + resolution: {integrity: sha512-rq9s+JNhf0IChjtDXxllJ7g41oZk5SlXtp0LHwyA5cejwn7vKmKp4pPri6YEePv2PU65sAsegbXtIinmDFDXgQ==} + peerDependencies: + acorn: ^6.0.0 || ^7.0.0 || ^8.0.0 + + acorn@7.4.1: + resolution: {integrity: sha512-nQyp0o1/mNdbTO1PO6kHkwSrmgZ0MT/jCCpNiwbUjGoRN4dlBhqJtoQuCnEOKzgTVwg0ZWiCoQy6SxMebQVh8A==} + engines: {node: '>=0.4.0'} + hasBin: true + + agent-base@6.0.2: + resolution: {integrity: sha512-RZNwNclF7+MS/8bDg70amg32dyeZGZxiDuQmZxKLAlQjr3jGyLx+4Kkk58UO7D2QdgFIQCovuSuZESne6RG6XQ==} + engines: {node: '>= 6.0.0'} + + agentkeepalive@4.2.0: + resolution: {integrity: sha512-0PhAp58jZNw13UJv7NVdTGb0ZcghHUb3DrZ046JiiJY/BOaTTpbwdHq2VObPCBV8M2GPh7sgrJ3AQ8Ey468LJw==} + engines: {node: '>= 8.0.0'} + + aggregate-error@3.1.0: + resolution: {integrity: sha512-4I7Td01quW/RpocfNayFdFVk1qSuoh0E7JrbRJ16nH01HhKFQ88INq9Sd+nd72zqRySlr9BmDA8xlEJ6vJMrYA==} + engines: {node: '>=8'} + + ajv@6.12.6: + resolution: {integrity: sha512-j3fVLgvTo527anyYyJOGTYJbG+vnnQYvE0m5mmkc1TK+nxAppkCLMIL0aZ4dblVCNoGShhm+kzE4ZUykBoMg4g==} + + ajv@8.9.0: + resolution: {integrity: sha512-qOKJyNj/h+OWx7s5DePL6Zu1KeM9jPZhwBqs+7DzP6bGOvqzVCSf0xueYmVuaC/oQ/VtS2zLMLHdQFbkka+XDQ==} + + ansi-align@3.0.1: + resolution: {integrity: sha512-IOfwwBF5iczOjp/WeY4YxyjqAFMQoZufdQWDd19SEExbVLNXqvpzSJ/M7Za4/sCPmQ0+GRquoA7bGcINcxew6w==} + + ansi-colors@4.1.1: + resolution: {integrity: sha512-JoX0apGbHaUJBNl6yF+p6JAFYZ666/hhCGKN5t9QFjbJQKUU/g8MNbFDbvfrgKXvI1QpZplPOnwIo99lX/AAmA==} + engines: {node: '>=6'} + + ansi-regex@2.1.1: + resolution: {integrity: sha512-TIGnTpdo+E3+pCyAluZvtED5p5wCqLdezCyhPZzKPcxvFplEt4i+W7OONCKgeZFT3+y5NZZfOOS/Bdcanm1MYA==} + engines: {node: '>=0.10.0'} + + ansi-regex@5.0.1: + resolution: {integrity: sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==} + engines: {node: '>=8'} + + ansi-styles@3.2.1: + resolution: {integrity: sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA==} + engines: {node: '>=4'} + + ansi-styles@4.3.0: + resolution: {integrity: sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==} + engines: {node: '>=8'} + + aproba@1.2.0: + resolution: {integrity: sha512-Y9J6ZjXtoYh8RnXVCMOU/ttDmk1aBjunq9vO0ta5x85WDQiQfUF9sIPBITdbiiIVcBo03Hi3jMxigBtsddlXRw==} + + are-we-there-yet@1.1.7: + resolution: {integrity: sha512-nxwy40TuMiUGqMyRHgCSWZ9FM4VAoRP4xUYSTv5ImRog+h9yISPbVH7H8fASCIzYn9wlEv4zvFL7uKDMCFQm3g==} + deprecated: This package is no longer supported. + + argparse@1.0.10: + resolution: {integrity: sha512-o5Roy6tNG4SL/FOkCAN6RzjiakZS25RLYFrcMttJqbdd8BWrnA+fGz57iN5Pb06pvBGvl5gQ0B48dJlslXvoTg==} + + array-flatten@1.1.1: + resolution: {integrity: sha512-PCVAQswWemu6UdxsDFFX/+gVeYqKAod3D3UVm91jHwynguOwAvYPhx8nNlM++NqRcK6CxxpUafjmhIdKiHibqg==} + + asn1@0.2.6: + resolution: {integrity: sha512-ix/FxPn0MDjeyJ7i/yoHGFt/EX6LyNbxSEhPPXODPL+KB0VPk86UYfL0lMdy+KCnv+fmvIzySwaK5COwqVbWTQ==} + + assert-plus@1.0.0: + resolution: {integrity: sha512-NfJ4UzBCcQGLDlQq7nHxH+tv3kyZ0hHQqF5BO6J7tNJeP5do1llPr8dZ8zHonfhAu0PHAdMkSo+8o0wxg9lZWw==} + engines: {node: '>=0.8'} + + astral-regex@2.0.0: + resolution: {integrity: sha512-Z7tMw1ytTXt5jqMcOP+OQteU1VuNK9Y02uuJtKQ1Sv69jXQKKg5cibLwGJow8yzZP+eAc18EmLGPal0bp36rvQ==} + engines: {node: '>=8'} + + asynckit@0.4.0: + resolution: {integrity: sha512-Oei9OH4tRh0YqU3GxhX79dM/mwVgvbZJaSNaRk+bshkj0S5cfHcgYakreBjrHwatXKbz+IoIdYLxrKim2MjW0Q==} + + aws-sign2@0.7.0: + resolution: {integrity: sha512-08kcGqnYf/YmjoRhfxyu+CLxBjUtHLXLXX/vUfx9l2LYzG3c1m61nrpyFUZI6zeS+Li/wWMMidD9KgrqtGq3mA==} + + aws4@1.11.0: + resolution: {integrity: sha512-xh1Rl34h6Fi1DC2WWKfxUTVqRsNnr6LsKz2+hfwDxQJWmrx8+c7ylaqBMcHfl1U1r2dsifOvKX3LQuLNZ+XSvA==} + + babel-plugin-polyfill-corejs2@0.4.12: + resolution: {integrity: sha512-CPWT6BwvhrTO2d8QVorhTCQw9Y43zOu7G9HigcfxvepOU6b8o3tcWad6oVgZIsZCTt42FFv97aA7ZJsbM4+8og==} + peerDependencies: + '@babel/core': ^7.4.0 || ^8.0.0-0 <8.0.0 + + babel-plugin-polyfill-corejs3@0.10.6: + resolution: {integrity: sha512-b37+KR2i/khY5sKmWNVQAnitvquQbNdWy6lJdsr0kmquCKEEUgMKK4SboVM3HtfnZilfjr4MMQ7vY58FVWDtIA==} + peerDependencies: + '@babel/core': ^7.4.0 || ^8.0.0-0 <8.0.0 + + babel-plugin-polyfill-regenerator@0.6.3: + resolution: {integrity: sha512-LiWSbl4CRSIa5x/JAU6jZiG9eit9w6mz+yVMFwDE83LAWvt0AfGBoZ7HS/mkhrKuh2ZlzfVZYKoLjXdqw6Yt7Q==} + peerDependencies: + '@babel/core': ^7.4.0 || ^8.0.0-0 <8.0.0 + + balanced-match@1.0.2: + resolution: {integrity: sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw==} + + basic-auth@2.0.1: + resolution: {integrity: sha512-NF+epuEdnUYVlGuhaxbbq+dvJttwLnGY+YixlXlME5KpQ5W3CnXA5cVTneY3SPbPDRkcjMbifrwmFYcClgOZeg==} + engines: {node: '>= 0.8'} + + batch@0.6.1: + resolution: {integrity: sha512-x+VAiMRL6UPkx+kudNvxTl6hB2XNNCG2r+7wixVfIYwu/2HKRXimwQyaumLjMveWvT2Hkd/cAJw+QBMfJ/EKVw==} + + bcrypt-pbkdf@1.0.2: + resolution: {integrity: sha512-qeFIXtP4MSoi6NLqO12WfqARWWuCKi2Rn/9hJLEmtB5yTNr9DqFWkJRCf2qShWzPeAMRnOgCrq0sg/KLv5ES9w==} + + body-parser@1.19.1: + resolution: {integrity: sha512-8ljfQi5eBk8EJfECMrgqNGWPEY5jWP+1IzkzkGdFFEwFQZZyaZ21UqdaHktgiMlH0xLHqIFtE/u2OYE5dOtViA==} + engines: {node: '>= 0.8'} + + boxen@5.1.2: + resolution: {integrity: sha512-9gYgQKXx+1nP8mP7CzFyaUARhg7D3n1dF/FnErWmu9l6JvGpNUN278h0aSb+QjoiKSWG+iZ3uHrcqk0qrY9RQQ==} + engines: {node: '>=10'} + + brace-expansion@1.1.11: + resolution: {integrity: sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==} + + brotli-size@4.0.0: + resolution: {integrity: sha512-uA9fOtlTRC0iqKfzff1W34DXUA3GyVqbUaeo3Rw3d4gd1eavKVCETXrn3NzO74W+UVkG3UHu8WxUi+XvKI/huA==} + engines: {node: '>= 10.16.0'} + + browserslist@4.24.2: + resolution: {integrity: sha512-ZIc+Q62revdMcqC6aChtW4jz3My3klmCO1fEmINZY/8J3EpBg5/A/D0AKmBveUh6pgoeycoMkVMko84tuYS+Gg==} + engines: {node: ^6 || ^7 || ^8 || ^9 || ^10 || ^11 || ^12 || >=13.7} + hasBin: true + + buffer-from@1.1.2: + resolution: {integrity: sha512-E+XQCRwSbaaiChtv6k6Dwgc+bx+Bs6vuKJHHl5kox/BaKbhiXzqQOwK4cO22yElGp2OCmjwVhT3HmxgyPGnJfQ==} + + builtin-modules@3.2.0: + resolution: {integrity: sha512-lGzLKcioL90C7wMczpkY0n/oART3MbBa8R9OFGE1rJxoVI86u4WAGfEk8Wjv10eKSyTHVGkSo3bvBylCEtk7LA==} + engines: {node: '>=6'} + + builtins@1.0.3: + resolution: {integrity: sha512-uYBjakWipfaO/bXI7E8rq6kpwHRZK5cNYrUv2OzZSI/FvmdMyXJ2tG9dKcjEC5YHmHpUAwsargWIZNWdxb/bnQ==} + + bytes@3.1.1: + resolution: {integrity: sha512-dWe4nWO/ruEOY7HkUJ5gFt1DCFV9zPRoJr8pV0/ASQermOZjtq8jMjOprC0Kd10GLN+l7xaUPvxzJFWtxGu8Fg==} + engines: {node: '>= 0.8'} + + cacache@15.3.0: + resolution: {integrity: sha512-VVdYzXEn+cnbXpFgWs5hTT7OScegHVmLhJIR8Ufqk3iFD6A6j5iSX1KuBTfNEv4tdJWE2PzA6IVFtcLC7fN9wQ==} + engines: {node: '>= 10'} + + callsites@3.1.0: + resolution: {integrity: sha512-P8BjAsXvZS+VIDUI11hHCQEv74YT67YUi5JJFNWIqL235sBmjX4+qx9Muvls5ivyNENctx46xQLQ3aTuE7ssaQ==} + engines: {node: '>=6'} + + camelcase@6.3.0: + resolution: {integrity: sha512-Gmy6FhYlCY7uOElZUSbxo2UCDH8owEk996gkbrpsgGtrJLM3J7jGxl9Ic7Qwwj4ivOE5AWZWRMecDdF7hqGjFA==} + engines: {node: '>=10'} + + caniuse-lite@1.0.30001687: + resolution: {integrity: sha512-0S/FDhf4ZiqrTUiQ39dKeUjYRjkv7lOZU1Dgif2rIqrTzX/1wV2hfKu9TOm1IHkdSijfLswxTFzl/cvir+SLSQ==} + + caseless@0.12.0: + resolution: {integrity: sha512-4tYFyifaFfGacoiObjJegolkwSU4xQNGbVgUiNYVUxbQ2x2lUsFvY4hVgVzGiIe6WLOPqycWXA40l+PWsxthUw==} + + chalk@2.4.2: + resolution: {integrity: sha512-Mti+f9lpJNcwF4tWV8/OrTTtF1gZi+f8FqlyAdouralcFWFQWF2+NgCHShjkCb+IFBLq9buZwE1xckQU4peSuQ==} + engines: {node: '>=4'} + + chalk@4.1.2: + resolution: {integrity: sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==} + engines: {node: '>=10'} + + chownr@2.0.0: + resolution: {integrity: sha512-bIomtDF5KGpdogkLd9VspvFzk9KfpyyGlS8YFVZl7TGPBHL5snIOnxeshwVgPteQ9b4Eydl+pVbIyE1DcvCWgQ==} + engines: {node: '>=10'} + + clean-stack@2.2.0: + resolution: {integrity: sha512-4diC9HaTE+KRAMWhDhrGOECgWZxoevMc5TlkObMqNSsVU62PYzXZ/SMTjzyGAFF1YusgxGcSWTEXBhp0CPwQ1A==} + engines: {node: '>=6'} + + cli-boxes@2.2.1: + resolution: {integrity: sha512-y4coMcylgSCdVinjiDBuR8PCC2bLjyGTwEmPb9NHR/QaNU6EUOXcTY/s6VjGMD6ENSEaeQYHCY0GNGS5jfMwPw==} + engines: {node: '>=6'} + + cliui@7.0.4: + resolution: {integrity: sha512-OcRE68cOsVMXp1Yvonl/fzkQOyjLSu/8bhPDfQt0e0/Eb283TKP20Fs2MqoPsr9SwA595rRCA+QMzYc9nBP+JQ==} + + code-point-at@1.1.0: + resolution: {integrity: sha512-RpAVKQA5T63xEj6/giIbUEtZwJ4UFIc3ZtvEkiaUERylqe8xb5IvqcgOurZLahv93CLKfxcw5YI+DZcUBRyLXA==} + engines: {node: '>=0.10.0'} + + color-convert@1.9.3: + resolution: {integrity: sha512-QfAUtd+vFdAtFQcC8CCyYt1fYWxSqAiK2cSD6zDB8N3cpsEBAvRxp9zOGg6G/SHHJYAT88/az/IuDGALsNVbGg==} + + color-convert@2.0.1: + resolution: {integrity: sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==} + engines: {node: '>=7.0.0'} + + color-name@1.1.3: + resolution: {integrity: sha512-72fSenhMw2HZMTVHeCA9KCmpEIbzWiQsjN+BHcBbS9vr1mtt+vJjPdksIBNUmKAW8TFUDPJK5SUU3QhE9NEXDw==} + + color-name@1.1.4: + resolution: {integrity: sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==} + + color-support@1.1.3: + resolution: {integrity: sha512-qiBjkpbMLO/HL68y+lh4q0/O1MZFj2RX6X/KmMa3+gJD3z+WwI1ZzDHysvqHGS3mP6mznPckpXmw1nI9cJjyRg==} + hasBin: true + + colors@1.4.0: + resolution: {integrity: sha512-a+UqTh4kgZg/SlGvfbzDHpgRu7AAQOmmqRHJnxhRZICKFUT91brVhNNt58CMWU9PsBbv3PDCZUHbVxuDiH2mtA==} + engines: {node: '>=0.1.90'} + + combined-stream@1.0.8: + resolution: {integrity: sha512-FQN4MRfuJeHf7cBbBMJFXhKSDq+2kAArBlmRBvcvFE5BB1HZKXtSFASDhdlz9zOYwxh8lDdnvmMOe/+5cdoEdg==} + engines: {node: '>= 0.8'} + + commander@2.20.3: + resolution: {integrity: sha512-GpVkmM8vF2vQUkj2LvZmD35JxeJOLCwJ9cUkugyk2nuhbv3+mJvpLYYt+0+USMxE+oj+ey/lJEnhZw75x/OMcQ==} + + concat-map@0.0.1: + resolution: {integrity: sha512-/Srv4dswyQNBfohGpz9o6Yb3Gz3SrUDqBH5rTuhGR7ahtlbYKnVxw2bCFMRljaA7EXHaXZ8wsHdodFvbkhKmqg==} + + concurrently@6.5.1: + resolution: {integrity: sha512-FlSwNpGjWQfRwPLXvJ/OgysbBxPkWpiVjy1042b0U7on7S7qwwMIILRj7WTN1mTgqa582bG6NFuScOoh6Zgdag==} + engines: {node: '>=10.0.0'} + hasBin: true + + console-control-strings@1.1.0: + resolution: {integrity: sha512-ty/fTekppD2fIwRvnZAVdeOiGd1c7YXEixbgJTNzqcxJWKQnjJ/V1bNEEE6hygpM3WjwHFUVK6HTjWSzV4a8sQ==} + + content-disposition@0.5.4: + resolution: {integrity: sha512-FveZTNuGw04cxlAiWbzi6zTAL/lhehaWbTtgluJh4/E95DqMwTmha3KZN1aAWA8cFIhHzMZUvLevkw5Rqk+tSQ==} + engines: {node: '>= 0.6'} + + content-type@1.0.4: + resolution: {integrity: sha512-hIP3EEPs8tB9AT1L+NUqtwOAps4mk2Zob89MWXMHjHWg9milF/j4osnnQLXBCBFBk/tvIG/tUc9mOUJiPBhPXA==} + engines: {node: '>= 0.6'} + + convert-source-map@2.0.0: + resolution: {integrity: sha512-Kvp459HrV2FEJ1CAsi1Ku+MY3kasH19TFykTz2xWmMeq6bk2NU3XXvfJ+Q61m0xktWwt+1HSYf3JZsTms3aRJg==} + + cookie-signature@1.0.6: + resolution: {integrity: sha512-QADzlaHc8icV8I7vbaJXJwod9HWYp8uCqf1xa4OfNu1T7JVxQIrUgOWtHdNDtPiywmFbiS12VjotIXLrKM3orQ==} + + cookie@0.4.1: + resolution: {integrity: sha512-ZwrFkGJxUR3EIoXtO+yVE69Eb7KlixbaeAWfBQB9vVsNn/o+Yw69gBWSSDK825hQNdN+wF8zELf3dFNl/kxkUA==} + engines: {node: '>= 0.6'} + + core-js-compat@3.39.0: + resolution: {integrity: sha512-VgEUx3VwlExr5no0tXlBt+silBvhTryPwCXRI2Id1PN8WTKu7MreethvddqOubrYxkFdv/RnYrqlv1sFNAUelw==} + + core-util-is@1.0.2: + resolution: {integrity: sha512-3lqz5YjWTYnW6dlDa5TLaTCcShfar1e40rmcJVwCBJC6mWlFuj0eCHIElmG1g5kyuJ/GD+8Wn4FFCcz4gJPfaQ==} + + core-util-is@1.0.3: + resolution: {integrity: sha512-ZQBvi1DcpJ4GDqanjucZ2Hj3wEO5pZDS89BWbkcrvdxksJorwUDDZamX9ldFkp9aw2lmBDLgkObEA4DWNJ9FYQ==} + + cors@2.8.5: + resolution: {integrity: sha512-KIHbLJqu73RGr/hnbrO9uBeixNGuvSQjul/jdFvS/KFSIH1hWVd1ng7zOHx+YrEfInLG7q4n6GHQ9cDtxv/P6g==} + engines: {node: '>= 0.10'} + + cross-spawn@7.0.3: + resolution: {integrity: sha512-iRDPJKUPVEND7dHPO8rkbOnPpyDygcDFtWjpeWNCgy8WP2rXcxXL8TskReQl6OrB2G7+UJrags1q15Fudc7G6w==} + engines: {node: '>= 8'} + + dashdash@1.14.1: + resolution: {integrity: sha512-jRFi8UDGo6j+odZiEpjazZaWqEal3w/basFjQHQEwVtZJGDpxbH1MeYluwCS8Xq5wmLJooDlMgvVarmWfGM44g==} + engines: {node: '>=0.10'} + + date-fns@2.28.0: + resolution: {integrity: sha512-8d35hViGYx/QH0icHYCeLmsLmMUheMmTyV9Fcm6gvNwdw31yXXH+O85sOBJ+OLnLQMKZowvpKb6FgMIQjcpvQw==} + engines: {node: '>=0.11'} + + debug@2.6.9: + resolution: {integrity: sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==} + peerDependencies: + supports-color: '*' + peerDependenciesMeta: + supports-color: + optional: true + + debug@4.3.3: + resolution: {integrity: sha512-/zxw5+vh1Tfv+4Qn7a5nsbcJKPaSvCDhojn6FEl9vupwK2VCSDtEiEtqr8DFtzYFOdz63LBkxec7DYuc2jon6Q==} + engines: {node: '>=6.0'} + peerDependencies: + supports-color: '*' + peerDependenciesMeta: + supports-color: + optional: true + + deep-is@0.1.4: + resolution: {integrity: sha512-oIPzksmTg4/MriiaYGO+okXDT7ztn/w3Eptv/+gSIdMdKsJo0u4CfYNFJPy+4SKMuCqGw2wxnA+URMg3t8a/bQ==} + + deepmerge@4.2.2: + resolution: {integrity: sha512-FJ3UgI4gIl+PHZm53knsuSFpE+nESMr7M4v9QcgB7S63Kj/6WqMiFQJpBBYz1Pt+66bZpP3Q7Lye0Oo9MPKEdg==} + engines: {node: '>=0.10.0'} + + define-lazy-prop@2.0.0: + resolution: {integrity: sha512-Ds09qNh8yw3khSjiJjiUInaGX9xlqZDY7JVryGxdxV7NPeuqQfplOpQ66yJFZut3jLa5zOwkXw1g9EI2uKh4Og==} + engines: {node: '>=8'} + + delayed-stream@1.0.0: + resolution: {integrity: sha512-ZySD7Nf91aLB0RxL4KGrKHBXl7Eds1DAmEdcoVawXnLD7SDhpNgtuII2aAkg7a7QS41jxPSZ17p4VdGnMHk3MQ==} + engines: {node: '>=0.4.0'} + + delegates@1.0.0: + resolution: {integrity: sha512-bd2L678uiWATM6m5Z1VzNCErI3jiGzt6HGY8OVICs40JQq/HALfbyNJmp0UDakEY4pMMaN0Ly5om/B1VI/+xfQ==} + + depd@1.1.2: + resolution: {integrity: sha512-7emPTl6Dpo6JRXOXjLRxck+FlLRX5847cLKEn00PLAgc3g2hTZZgr+e4c2v6QpSmLeFP3n5yUo7ft6avBK/5jQ==} + engines: {node: '>= 0.6'} + + destroy@1.0.4: + resolution: {integrity: sha512-3NdhDuEXnfun/z7x9GOElY49LoqVHoGScmOKwmxhsS8N5Y+Z8KyPPDnaSzqWgYt/ji4mqwfTS34Htrk0zPIXVg==} + + doctrine@3.0.0: + resolution: {integrity: sha512-yS+Q5i3hBf7GBkd4KG8a7eBNNWNGLTaEwwYWUijIYM7zrlYDM0BFXHjjPWlWZ1Rg7UaddZeIDmi9jF3HmqiQ2w==} + engines: {node: '>=6.0.0'} + + dom-serializer@1.3.2: + resolution: {integrity: sha512-5c54Bk5Dw4qAxNOI1pFEizPSjVsx5+bpJKmL2kPn8JhBUq2q09tTCa3mjijun2NfK78NMouDYNMBkOrPZiS+ig==} + + domelementtype@2.2.0: + resolution: {integrity: sha512-DtBMo82pv1dFtUmHyr48beiuq792Sxohr+8Hm9zoxklYPfa6n0Z3Byjj2IV7bmr2IyqClnqEQhfgHJJ5QF0R5A==} + + domhandler@4.3.0: + resolution: {integrity: sha512-fC0aXNQXqKSFTr2wDNZDhsEYjCiYsDWl3D01kwt25hm1YIPyDGHvvi3rw+PLqHAl/m71MaiF7d5zvBr0p5UB2g==} + engines: {node: '>= 4'} + + domutils@2.8.0: + resolution: {integrity: sha512-w96Cjofp72M5IIhpjgobBimYEfoPjx1Vx0BSX9P30WBdZW2WIKU0T1Bd0kz2eNZ9ikjKgHbEyKx8BB6H1L3h3A==} + + duplexer@0.1.1: + resolution: {integrity: sha512-sxNZ+ljy+RA1maXoUReeqBBpBC6RLKmg5ewzV+x+mSETmWNoKdZN6vcQjpFROemza23hGFskJtFNoUWUaQ+R4Q==} + + duplexer@0.1.2: + resolution: {integrity: sha512-jtD6YG370ZCIi/9GTaJKQxWTZD045+4R4hTk/x1UyoqadyJ9x9CgSi1RlVDQF8U2sxLLSnFkCaMihqljHIWgMg==} + + ecc-jsbn@0.1.2: + resolution: {integrity: sha512-eh9O+hwRHNbG4BLTjEl3nw044CkGm5X6LoaCf7LPp7UU8Qrt47JYNi6nPX8xjW97TKGKm1ouctg0QSpZe9qrnw==} + + ee-first@1.1.1: + resolution: {integrity: sha512-WMwm9LhRUo+WUaRN+vRuETqG89IgZphVSNkdFgeb6sS/E4OrDIN7t48CAewSHXc6C8lefD8KKfr5vY61brQlow==} + + electron-to-chromium@1.5.72: + resolution: {integrity: sha512-ZpSAUOZ2Izby7qnZluSrAlGgGQzucmFbN0n64dYzocYxnxV5ufurpj3VgEe4cUp7ir9LmeLxNYo8bVnlM8bQHw==} + + emoji-regex@8.0.0: + resolution: {integrity: sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==} + + encodeurl@1.0.2: + resolution: {integrity: sha512-TPJXq8JqFaVYm2CWmPvnP2Iyo4ZSM7/QKcSmuMLDObfpH5fi7RUGmd/rTDf+rut/saiDiQEeVTNgAmJEdAOx0w==} + engines: {node: '>= 0.8'} + + encoding@0.1.13: + resolution: {integrity: sha512-ETBauow1T35Y/WZMkio9jiM0Z5xjHHmJ4XmjZOq1l/dXz3lr2sRn87nJy20RupqSh1F2m3HHPSp8ShIPQJrJ3A==} + + enquirer@2.3.6: + resolution: {integrity: sha512-yjNnPr315/FjS4zIsUxYguYUPP2e1NK4d7E7ZOLiyYCcbFBiTMyID+2wvm2w6+pZ/odMA7cRkjhsPbltwBOrLg==} + engines: {node: '>=8.6'} + + entities@2.2.0: + resolution: {integrity: sha512-p92if5Nz619I0w+akJrLZH0MX0Pb5DX39XOwQTtXSdQQOaYH03S1uIQp4mhOZtAXrxq4ViO67YTiLBo2638o9A==} + + entities@3.0.1: + resolution: {integrity: sha512-WiyBqoomrwMdFG1e0kqvASYfnlb0lp8M5o5Fw2OFq1hNZxxcNk8Ik0Xm7LxzBhuidnZB/UtBqVCgUz3kBOP51Q==} + engines: {node: '>=0.12'} + + env-paths@2.2.1: + resolution: {integrity: sha512-+h1lkLKhZMTYjog1VEpJNG7NZJWcuc2DDk/qsqSTRRCOXiLjeQ1d1/udrUGhqMxUgAlwKNZ0cf2uqan5GLuS2A==} + engines: {node: '>=6'} + + err-code@2.0.3: + resolution: {integrity: sha512-2bmlRpNKBxT/CRmPOlyISQpNj+qSeYvcym/uT0Jx2bMOlKLtSy1ZmLuVxSEKKyor/N5yhvp/ZiG1oE3DEYMSFA==} + + escalade@3.2.0: + resolution: {integrity: sha512-WUj2qlxaQtO4g6Pq5c29GTcWGDyd8itL8zTlipgECz3JesAiiOKotd8JU6otB3PACgG6xkJUyVhboMS+bje/jA==} + engines: {node: '>=6'} + + escape-html@1.0.3: + resolution: {integrity: sha512-NiSupZ4OeuGwr68lGIeym/ksIZMJodUGOSCZ/FSnTxcrekbvqrgdUxlJOMpijaKZVjAJrWrGs/6Jy8OMuyj9ow==} + + escape-string-regexp@1.0.5: + resolution: {integrity: sha512-vbRorB5FUQWvla16U8R/qgaFIya2qGzwDrNmCZuYKrbdSUMG6I1ZCGQRefkRVhuOkIGVne7BQ35DSfo1qvJqFg==} + engines: {node: '>=0.8.0'} + + escape-string-regexp@4.0.0: + resolution: {integrity: sha512-TtpcNJ3XAzx3Gq8sWRzJaVajRs0uVxA2YAkdb1jm2YkPz4G6egUFAyA3n5vtEIZefPk5Wa4UXbKuS5fKkJWdgA==} + engines: {node: '>=10'} + + eslint-config-mdcs@5.0.0: + resolution: {integrity: sha512-d4lzeT/sQ3TkI69hd+N/dtQ15g3GrbIboTfCAw6FaDQTLjWK2O3+dNfOOfkAC5TlwyU9BxztR1TE+x8iSzyuPw==} + + eslint-plugin-html@6.2.0: + resolution: {integrity: sha512-vi3NW0E8AJombTvt8beMwkL1R/fdRWl4QSNRNMhVQKWm36/X0KF0unGNAY4mqUF06mnwVWZcIcerrCnfn9025g==} + + eslint-scope@5.1.1: + resolution: {integrity: sha512-2NxwbF/hZ0KpepYN0cNbo+FN6XoK7GaHlQhgx/hIZl6Va0bF45RQOOwhLIy8lQDbuCiadSLCBnH2CFYquit5bw==} + engines: {node: '>=8.0.0'} + + eslint-utils@2.1.0: + resolution: {integrity: sha512-w94dQYoauyvlDc43XnGB8lU3Zt713vNChgt4EWwhXAP2XkBvndfxF0AgIqKOOasjPIPzj9JqgwkwbCYD0/V3Zg==} + engines: {node: '>=6'} + + eslint-visitor-keys@1.3.0: + resolution: {integrity: sha512-6J72N8UNa462wa/KFODt/PJ3IU60SDpC3QXC1Hjc1BXXpfL2C9R5+AU7jhe0F6GREqVMh4Juu+NY7xn+6dipUQ==} + engines: {node: '>=4'} + + eslint-visitor-keys@2.1.0: + resolution: {integrity: sha512-0rSmRBzXgDzIsD6mGdJgevzgezI534Cer5L/vyMX0kHzT/jiB43jRhd9YUlMGYLQy2zprNmoT8qasCGtY+QaKw==} + engines: {node: '>=10'} + + eslint@7.32.0: + resolution: {integrity: sha512-VHZ8gX+EDfz+97jGcgyGCyRia/dPOd6Xh9yPv8Bl1+SoaIwD+a/vlrOmGRUyOYu7MwUhc7CxqeaDZU13S4+EpA==} + engines: {node: ^10.12.0 || >=12.0.0} + deprecated: This version is no longer supported. Please see https://eslint.org/version-support for other options. + hasBin: true + + espree@7.3.1: + resolution: {integrity: sha512-v3JCNCE64umkFpmkFGqzVKsOT0tN1Zr+ueqLZfpV1Ob8e+CEgPWa+OxCoGH3tnhimMKIaBm4m/vaRpJ/krRz2g==} + engines: {node: ^10.12.0 || >=12.0.0} + + esprima@4.0.1: + resolution: {integrity: sha512-eGuFFw7Upda+g4p+QHvnW0RyTX/SVeJBDM/gCtMARO0cLuT2HcEKnTPvhjV6aGeqrCB/sbNop0Kszm0jsaWU4A==} + engines: {node: '>=4'} + hasBin: true + + esquery@1.4.0: + resolution: {integrity: sha512-cCDispWt5vHHtwMY2YrAQ4ibFkAL8RbH5YGBnZBc90MolvvfkkQcJro/aZiAQUlQ3qgrYS6D6v8Gc5G5CQsc9w==} + engines: {node: '>=0.10'} + + esrecurse@4.3.0: + resolution: {integrity: sha512-KmfKL3b6G+RXvP8N1vr3Tq1kL/oCFgn2NYXEtqP8/L3pKapUA4G8cFVaoF3SU323CD4XypR/ffioHmkti6/Tag==} + engines: {node: '>=4.0'} + + estraverse@4.3.0: + resolution: {integrity: sha512-39nnKffWz8xN1BU/2c79n9nB9HDzo0niYUqx6xyqUnyoAnQyyWpOTdZEeiCch8BBu515t4wp9ZmgVfVhn9EBpw==} + engines: {node: '>=4.0'} + + estraverse@5.3.0: + resolution: {integrity: sha512-MMdARuVEQziNTeJD8DgMqmhwR11BRQ/cBP+pLtYdSTnf3MIO8fFeiINEbX36ZdNlfU/7A9f3gUw49B3oQsvwBA==} + engines: {node: '>=4.0'} + + estree-walker@1.0.1: + resolution: {integrity: sha512-1fMXF3YP4pZZVozF8j/ZLfvnR8NSIljt56UhbZ5PeeDmmGHpgpdwQt7ITlGvYaQukCvuBRMLEiKiYC+oeIg4cg==} + + esutils@2.0.3: + resolution: {integrity: sha512-kVscqXk4OCp68SZ0dkgEKVi6/8ij300KBWTJq32P/dYeWTSwK41WyTxalN1eRmA5Z9UU/LX9D7FWSmV9SAYx6g==} + engines: {node: '>=0.10.0'} + + etag@1.8.1: + resolution: {integrity: sha512-aIL5Fx7mawVa300al2BnEE4iNvo1qETxLrPI/o05L7z6go7fCw1J6EQmbK4FmJ2AS7kgVF/KEZWufBfdClMcPg==} + engines: {node: '>= 0.6'} + + express@4.17.2: + resolution: {integrity: sha512-oxlxJxcQlYwqPWKVJJtvQiwHgosH/LrLSPA+H4UxpyvSS6jC5aH+5MoHFM+KABgTOt0APue4w66Ha8jCUo9QGg==} + engines: {node: '>= 0.10.0'} + + extend@3.0.2: + resolution: {integrity: sha512-fjquC59cD7CyW6urNXK0FBufkZcoiGG80wTuPujX590cB5Ttln20E2UB4S/WARVqhXffZl2LNgS+gQdPIIim/g==} + + extsprintf@1.3.0: + resolution: {integrity: sha512-11Ndz7Nv+mvAC1j0ktTa7fAb0vLyGGX+rMHNBYQviQDGU0Hw7lhctJANqbPhu9nV9/izT/IntTgZ7Im/9LJs9g==} + engines: {'0': node >=0.6.0} + + fast-deep-equal@3.1.3: + resolution: {integrity: sha512-f3qQ9oQy9j2AhBe/H9VC91wLmKBCCU/gDOnKNAYG5hswO7BLKj09Hc5HYNz9cGI++xlpDCIgDaitVs03ATR84Q==} + + fast-json-stable-stringify@2.1.0: + resolution: {integrity: sha512-lhd/wF+Lk98HZoTCtlVraHtfh5XYijIjalXck7saUtuanSDyLMxnHhSXEDJqHxD7msR8D0uCmqlkwjCV8xvwHw==} + + fast-levenshtein@2.0.6: + resolution: {integrity: sha512-DCXu6Ifhqcks7TZKY3Hxp3y6qphY5SJZmrWMDrKcERSOXWQdMhU9Ig/PYrzyw/ul9jOIyh0N4M0tbC5hodg8dw==} + + file-entry-cache@6.0.1: + resolution: {integrity: sha512-7Gps/XWymbLk2QLYK4NzpMOrYjMhdIxXuIvy2QBsLE6ljuodKvdkWs/cpyJJ3CVIVpH0Oi1Hvg1ovbMzLdFBBg==} + engines: {node: ^10.12.0 || >=12.0.0} + + filesize@6.4.0: + resolution: {integrity: sha512-mjFIpOHC4jbfcTfoh4rkWpI31mF7viw9ikj/JyLoKzqlwG/YsefKfvYlYhdYdg/9mtK2z1AzgN/0LvVQ3zdlSQ==} + engines: {node: '>= 0.4.0'} + + finalhandler@1.1.2: + resolution: {integrity: sha512-aAWcW57uxVNrQZqFXjITpW3sIUQmHGG3qSb9mUah9MgMC4NeWhNOlNjXEYq3HjRAvL6arUviZGGJsBg6z0zsWA==} + engines: {node: '>= 0.8'} + + flat-cache@3.0.4: + resolution: {integrity: sha512-dm9s5Pw7Jc0GvMYbshN6zchCA9RgQlzzEZX3vylR9IqFfS8XciblUXOKfW6SiuJ0e13eDYZoZV5wdrev7P3Nwg==} + engines: {node: ^10.12.0 || >=12.0.0} + + flatted@3.2.4: + resolution: {integrity: sha512-8/sOawo8tJ4QOBX8YlQBMxL8+RLZfxMQOif9o0KUKTNTjMYElWPE0r/m5VNFxTRd0NSw8qSy8dajrwX4RYI1Hw==} + + forever-agent@0.6.1: + resolution: {integrity: sha512-j0KLYPhm6zeac4lz3oJ3o65qvgQCcPubiyotZrXqEaG4hNagNYO8qdlUrX5vwqv9ohqeT/Z3j6+yW067yWWdUw==} + + form-data@2.3.3: + resolution: {integrity: sha512-1lLKB2Mu3aGP1Q/2eCOx0fNbRMe7XdwktwOruhfqqd0rIJWwN4Dh+E3hrPSlDCXnSR7UtZ1N38rVXm+6+MEhJQ==} + engines: {node: '>= 0.12'} + + forwarded@0.2.0: + resolution: {integrity: sha512-buRG0fpBtRHSTCOASe6hD258tEubFoRLb4ZNA6NxMVHNw2gOcwHo9wyablzMzOA5z9xA9L1KNjk/Nt6MT9aYow==} + engines: {node: '>= 0.6'} + + fresh@0.5.2: + resolution: {integrity: sha512-zJ2mQYM18rEFOudeV4GShTGIQ7RbzA7ozbU9I/XBpm7kqgMywgmylMwXHxZJmkVoYkna9d2pVXVXPdYTP9ej8Q==} + engines: {node: '>= 0.6'} + + fs-minipass@2.1.0: + resolution: {integrity: sha512-V/JgOLFCS+R6Vcq0slCuaeWEdNC3ouDlJMNIsacH2VtALiu9mV4LPrHc5cDl8k5aw6J8jwgWWpiTo5RYhmIzvg==} + engines: {node: '>= 8'} + + fs.realpath@1.0.0: + resolution: {integrity: sha512-OO0pH2lK6a0hZnAdau5ItzHPI6pUlvI7jMVnxUQRtw4owF2wk8lOSabtGDCTP4Ggrg2MbGnWO9X8K1t4+fGMDw==} + + fsevents@2.3.2: + resolution: {integrity: sha512-xiqMQR4xAeHTuB9uWm+fFRcIOgKBMiOBP+eXiyT7jsgVCq1bkVygt00oASowB7EdtpOHaaPgKt812P9ab+DDKA==} + engines: {node: ^8.16.0 || ^10.6.0 || >=11.0.0} + os: [darwin] + + function-bind@1.1.1: + resolution: {integrity: sha512-yIovAzMX49sF8Yl58fSCWJ5svSLuaibPxXQJFLmBObTuCr0Mf1KiPopGM9NiFjiYBCbfaa2Fh6breQ6ANVTI0A==} + + functional-red-black-tree@1.0.1: + resolution: {integrity: sha512-dsKNQNdj6xA3T+QlADDA7mOSlX0qiMINjn0cgr+eGHGsbSHzTabcIogz2+p/iqP1Xs6EP/sS2SbqH+brGTbq0g==} + + gauge@2.7.4: + resolution: {integrity: sha512-14x4kjc6lkD3ltw589k0NrPD6cCNTD6CWoVUNpB85+DrtONoZn+Rug6xZU5RvSC4+TZPxA5AnBibQYAvZn41Hg==} + deprecated: This package is no longer supported. + + gensync@1.0.0-beta.2: + resolution: {integrity: sha512-3hN7NaskYvMDLQY55gnW3NQ+mesEAepTqlg+VEbj7zzqEMBVNhzcGYYeqFo/TlYz6eQiFcp1HcsCZO+nGgS8zg==} + engines: {node: '>=6.9.0'} + + get-caller-file@2.0.5: + resolution: {integrity: sha512-DyFP3BM/3YHTQOCUL/w0OZHR0lpKeGrxotcHWcqNEdnltqFwXVfhEBQ94eIo34AfQpo0rGki4cyIiftY06h2Fg==} + engines: {node: 6.* || 8.* || >= 10.*} + + getpass@0.1.7: + resolution: {integrity: sha512-0fzj9JxOLfJ+XGLhR8ze3unN0KZCgZwiSSDz168VERjK8Wl8kVSdcu2kspd4s4wtAa1y/qrVRiAA0WclVsu0ng==} + + glob-parent@5.1.2: + resolution: {integrity: sha512-AOIgSQCepiJYwP3ARnGx+5VnTu2HBYdzbGP45eLw1vr3zB3vZLeyed1sC9hnbcOc9/SrMyM5RPQrkGz4aS9Zow==} + engines: {node: '>= 6'} + + glob@7.2.0: + resolution: {integrity: sha512-lmLf6gtyrPq8tTjSmrO94wBeQbFR3HbLHbuyD69wuyQkImp2hWqMGB47OX65FBkPffO641IP9jWa1z4ivqG26Q==} + deprecated: Glob versions prior to v9 are no longer supported + + globals@11.12.0: + resolution: {integrity: sha512-WOBp/EEGUiIsJSp7wcv/y6MO+lV9UoncWqxuFfm8eBwzWNgyfBd6Gz+IeKQ9jCmyhoH99g15M3T+QaVHFjizVA==} + engines: {node: '>=4'} + + globals@13.12.0: + resolution: {integrity: sha512-uS8X6lSKN2JumVoXrbUz+uG4BYG+eiawqm3qFcT7ammfbUHeCBoJMlHcec/S3krSk73/AE/f0szYFmgAA3kYZg==} + engines: {node: '>=8'} + + graceful-fs@4.2.9: + resolution: {integrity: sha512-NtNxqUcXgpW2iMrfqSfR73Glt39K+BLwWsPs94yR63v45T0Wbej7eRmL5cWfwEgqXnmjQp3zaJTshdRW/qC2ZQ==} + + gzip-size@6.0.0: + resolution: {integrity: sha512-ax7ZYomf6jqPTQ4+XCpUGyXKHk5WweS+e05MBO4/y3WJ5RkmPXNKvX+bx1behVILVwr6JSQvZAku021CHPXG3Q==} + engines: {node: '>=10'} + + har-schema@2.0.0: + resolution: {integrity: sha512-Oqluz6zhGX8cyRaTQlFMPw80bSJVG2x/cFb8ZPhUILGgHka9SsokCCOQgpveePerqidZOrT14ipqfJb7ILcW5Q==} + engines: {node: '>=4'} + + har-validator@5.1.5: + resolution: {integrity: sha512-nmT2T0lljbxdQZfspsno9hgrG3Uir6Ks5afism62poxqBM6sDnMEuPmzTq8XN0OEwqKLLdh1jQI3qyE66Nzb3w==} + engines: {node: '>=6'} + deprecated: this library is no longer supported + + has-flag@3.0.0: + resolution: {integrity: sha512-sKJf1+ceQBr4SMkvQnBDNDtf4TXpVhVGateu0t918bl30FnbE2m4vNLX+VWe/dpjlb+HugGYzW7uQXH98HPEYw==} + engines: {node: '>=4'} + + has-flag@4.0.0: + resolution: {integrity: sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==} + engines: {node: '>=8'} + + has-unicode@2.0.1: + resolution: {integrity: sha512-8Rf9Y83NBReMnx0gFzA8JImQACstCYWUplepDa9xprwwtmgEZUF0h/i5xSA625zB/I37EtrswSST6OXxwaaIJQ==} + + has@1.0.3: + resolution: {integrity: sha512-f2dvO0VU6Oej7RkWJGrehjbzMAjFp5/VKPp5tTpWIV4JHHZK1/BxbFRtf/siA2SWTe09caDmVtYYzWEIbBS4zw==} + engines: {node: '>= 0.4.0'} + + hosted-git-info@4.1.0: + resolution: {integrity: sha512-kyCuEOWjJqZuDbRHzL8V93NzQhwIB71oFWSyzVo+KPZI+pnQPPxucdkrOZvkLRnrf5URsQM+IJ09Dw29cRALIA==} + engines: {node: '>=10'} + + htmlparser2@7.2.0: + resolution: {integrity: sha512-H7MImA4MS6cw7nbyURtLPO1Tms7C5H602LRETv95z1MxO/7CP7rDVROehUYeYBUYEON94NXXDEPmZuq+hX4sog==} + + http-cache-semantics@4.1.0: + resolution: {integrity: sha512-carPklcUh7ROWRK7Cv27RPtdhYhUsela/ue5/jKzjegVvXDqM2ILE9Q2BGn9JZJh1g87cp56su/FgQSzcWS8cQ==} + + http-errors@1.6.3: + resolution: {integrity: sha512-lks+lVC8dgGyh97jxvxeYTWQFvh4uw4yC12gVl63Cg30sjPX4wuGcdkICVXDAESr6OJGjqGA8Iz5mkeN6zlD7A==} + engines: {node: '>= 0.6'} + + http-errors@1.8.1: + resolution: {integrity: sha512-Kpk9Sm7NmI+RHhnj6OIWDI1d6fIoFAtFt9RLaTMRlg/8w49juAStsrBgp0Dp4OdxdVbRIeKhtCUvoi/RuAhO4g==} + engines: {node: '>= 0.6'} + + http-proxy-agent@4.0.1: + resolution: {integrity: sha512-k0zdNgqWTGA6aeIRVpvfVob4fL52dTfaehylg0Y4UvSySvOq/Y+BOyPrgpUrA7HylqvU8vIZGsRuXmspskV0Tg==} + engines: {node: '>= 6'} + + http-signature@1.2.0: + resolution: {integrity: sha512-CAbnr6Rz4CYQkLYUtSNXxQPUH2gK8f3iWexVlsnMeD+GjlsQ0Xsy1cOX+mN3dtxYomRy21CiOzU8Uhw6OwncEQ==} + engines: {node: '>=0.8', npm: '>=1.3.7'} + + https-proxy-agent@5.0.0: + resolution: {integrity: sha512-EkYm5BcKUGiduxzSt3Eppko+PiNWNEpa4ySk9vTC6wDsQJW9rHSa+UhGNJoRYp7bz6Ht1eaRIa6QaJqO5rCFbA==} + engines: {node: '>= 6'} + + humanize-ms@1.2.1: + resolution: {integrity: sha512-Fl70vYtsAFb/C06PTS9dZBo7ihau+Tu/DNCk/OyHhea07S+aeMWpFFkUaXRa8fI+ScZbEI8dfSxwY7gxZ9SAVQ==} + + iconv-lite@0.4.24: + resolution: {integrity: sha512-v3MXnZAcvnywkTUEZomIActle7RXXeedOR31wwl7VlyoXO4Qi9arvSenNQWne1TcRwhCL1HwLI21bEqdpj8/rA==} + engines: {node: '>=0.10.0'} + + iconv-lite@0.6.3: + resolution: {integrity: sha512-4fCk79wshMdzMp2rH06qWrJE4iolqLhCUH+OiuIgU++RB0+94NlDL81atO7GX55uUKueo0txHNtvEyI6D7WdMw==} + engines: {node: '>=0.10.0'} + + ignore-walk@3.0.4: + resolution: {integrity: sha512-PY6Ii8o1jMRA1z4F2hRkH/xN59ox43DavKvD3oDpfurRlOJyAHpifIwpbdv1n4jt4ov0jSpw3kQ4GhJnpBL6WQ==} + + ignore@4.0.6: + resolution: {integrity: sha512-cyFDKrqc/YdcWFniJhzI42+AzS+gNwmUzOSFcRCQYwySuBBBy/KjuxWLZ/FHEH6Moq1NizMOBWyTcv8O4OZIMg==} + engines: {node: '>= 4'} + + import-fresh@3.3.0: + resolution: {integrity: sha512-veYYhQa+D1QBKznvhUHxb8faxlrwUnxseDAbAp457E0wLNio2bOSKnjYDhMj+YiAq61xrMGhQk9iXVk5FzgQMw==} + engines: {node: '>=6'} + + imurmurhash@0.1.4: + resolution: {integrity: sha512-JmXMZ6wuvDmLiHEml9ykzqO6lwFbof0GG4IkcGaENdCRDDmMVnny7s5HsIgHCbaq0w2MyPhDqkhTUgS2LU2PHA==} + engines: {node: '>=0.8.19'} + + indent-string@4.0.0: + resolution: {integrity: sha512-EdDDZu4A2OyIK7Lr/2zG+w5jmbuk1DVBnEwREQvBzspBJkCEbRa8GxU1lghYcaGJCnRWibjDXlq779X1/y5xwg==} + engines: {node: '>=8'} + + infer-owner@1.0.4: + resolution: {integrity: sha512-IClj+Xz94+d7irH5qRyfJonOdfTzuDaifE6ZPWfx0N0+/ATZCbuTPq2prFl526urkQd90WyUKIh1DfBQ2hMz9A==} + + inflight@1.0.6: + resolution: {integrity: sha512-k92I/b08q4wvFscXCLvqfsHCrjrF7yiXsQuIVvVE7N82W3+aqpzuUdBbfhWcy/FZR3/4IgflMgKLOsvPDrGCJA==} + deprecated: This module is not supported, and leaks memory. Do not use it. Check out lru-cache if you want a good and tested way to coalesce async requests by a key value, which is much more comprehensive and powerful. + + inherits@2.0.3: + resolution: {integrity: sha512-x00IRNXNy63jwGkJmzPigoySHbaqpNuzKbBOmzK+g2OdZpQ9w+sxCN+VSB3ja7IAge2OP2qpfxTjeNcyjmW1uw==} + + inherits@2.0.4: + resolution: {integrity: sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==} + + ip@1.1.5: + resolution: {integrity: sha512-rBtCAQAJm8A110nbwn6YdveUnuZH3WrC36IwkRXxDnq53JvXA2NVQvB7IHyKomxK1MJ4VDNw3UtFDdXQ+AvLYA==} + + ipaddr.js@1.9.1: + resolution: {integrity: sha512-0KI/607xoxSToH7GjN1FfSbLoU0+btTicjsQSWQlh/hZykN8KpmMf7uYwPW3R+akZ6R/w18ZlXSHBYXiYUPO3g==} + engines: {node: '>= 0.10'} + + is-core-module@2.8.1: + resolution: {integrity: sha512-SdNCUs284hr40hFTFP6l0IfZ/RSrMXF3qgoRHd3/79unUTvrFO/JoXwkGm+5J/Oe3E/b5GsnG330uUNgRpu1PA==} + + is-docker@2.2.1: + resolution: {integrity: sha512-F+i2BKsFrH66iaUFc0woD8sLy8getkwTwtOBjvs56Cx4CgJDeKQeqfz8wAYiSb8JOprWhHH5p77PbmYCvvUuXQ==} + engines: {node: '>=8'} + hasBin: true + + is-extglob@2.1.1: + resolution: {integrity: sha512-SbKbANkN603Vi4jEZv49LeVJMn4yGwsbzZworEoyEiutsN3nJYdbO36zfhGJ6QEDpOZIFkDtnq5JRxmvl3jsoQ==} + engines: {node: '>=0.10.0'} + + is-fullwidth-code-point@1.0.0: + resolution: {integrity: sha512-1pqUqRjkhPJ9miNq9SwMfdvi6lBJcd6eFxvfaivQhaH3SgisfiuudvFntdKOmxuee/77l+FPjKrQjWvmPjWrRw==} + engines: {node: '>=0.10.0'} + + is-fullwidth-code-point@3.0.0: + resolution: {integrity: sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg==} + engines: {node: '>=8'} + + is-glob@4.0.3: + resolution: {integrity: sha512-xelSayHH36ZgE7ZWhli7pW34hNbNl8Ojv5KVmkJD4hBdD3th8Tfk9vYasLM+mXWOZhFkgZfxhLSnrwRr4elSSg==} + engines: {node: '>=0.10.0'} + + is-lambda@1.0.1: + resolution: {integrity: sha512-z7CMFGNrENq5iFB9Bqo64Xk6Y9sg+epq1myIcdHaGnbMTYOxvzsEtdYqQUylB7LxfkvgrrjP32T6Ywciio9UIQ==} + + is-module@1.0.0: + resolution: {integrity: sha512-51ypPSPCoTEIN9dy5Oy+h4pShgJmPCygKfyRCISBI+JoWT/2oJvK8QPxmwv7b/p239jXrm9M1mlQbyKJ5A152g==} + + is-typedarray@1.0.0: + resolution: {integrity: sha512-cyA56iCMHAh5CdzjJIa4aohJyeO1YbwLi3Jc35MmRU6poroFjIGZzUzupGiRPOjgHg9TLu43xbpwXk523fMxKA==} + + is-wsl@2.2.0: + resolution: {integrity: sha512-fKzAra0rGJUUBwGBgNkHZuToZcn+TtXHpeCgmkMJMMYx1sQDYaCSyjJBSCa2nH1DGm7s3n1oBnohoVTBaN7Lww==} + engines: {node: '>=8'} + + isarray@1.0.0: + resolution: {integrity: sha512-VLghIWNM6ELQzo7zwmcg0NmTVyWKYjvIeM83yjp0wRDTmUnrM678fQbcKBo6n2CJEF0szoG//ytg+TKla89ALQ==} + + isexe@2.0.0: + resolution: {integrity: sha512-RHxMLp9lnKHGHRng9QFhRCMbYAcVpn69smSGcq3f36xjgVVWThj4qqLbTLlq7Ssj8B+fIQ1EuCEGI2lKsyQeIw==} + + isstream@0.1.2: + resolution: {integrity: sha512-Yljz7ffyPbrLpLngrMtZ7NduUgVvi6wG9RJ9IUcyCd59YQ911PBJphODUcbOVbqYfxe1wuYf/LJ8PauMRwsM/g==} + + jest-worker@26.6.2: + resolution: {integrity: sha512-KWYVV1c4i+jbMpaBC+U++4Va0cp8OisU185o73T1vo99hqi7w8tSJfUXYswwqqrjzwxa6KpRK54WhPvwf5w6PQ==} + engines: {node: '>= 10.13.0'} + + js-tokens@4.0.0: + resolution: {integrity: sha512-RdJUflcE3cUzKiMqQgsCu06FPu9UdIJO0beYbPhHN4k6apgJtifcoCtT9bcxOpYBtpD2kCM6Sbzg4CausW/PKQ==} + + js-yaml@3.14.1: + resolution: {integrity: sha512-okMH7OXXJ7YrN9Ok3/SXrnu4iX9yOk+25nqX4imS2npuvTYDmo/QEZoqwZkYaIDk3jVvBOTOIEgEhaLOynBS9g==} + hasBin: true + + jsbn@0.1.1: + resolution: {integrity: sha512-UVU9dibq2JcFWxQPA6KCqj5O42VOmAY3zQUfEKxU0KpTGXwNoCjkX1e13eHNvw/xPynt6pU0rZ1htjWTNTSXsg==} + + jsesc@3.0.2: + resolution: {integrity: sha512-xKqzzWXDttJuOcawBt4KnKHHIf5oQ/Cxax+0PWFG+DFDgHNAdi+TXECADI+RYiFUMmx8792xsMbbgXj4CwnP4g==} + engines: {node: '>=6'} + hasBin: true + + json-parse-even-better-errors@2.3.1: + resolution: {integrity: sha512-xyFwyhro/JEof6Ghe2iz2NcXoj2sloNsWr/XsERDK/oiPCfaNhl5ONfp+jQdAZRQQ0IJWNzH9zIZF7li91kh2w==} + + json-schema-traverse@0.4.1: + resolution: {integrity: sha512-xbbCH5dCYU5T8LcEhhuh7HJ88HXuW3qsI3Y0zOZFKfZEHcpWiHU/Jxzk629Brsab/mMiHQti9wMP+845RPe3Vg==} + + json-schema-traverse@1.0.0: + resolution: {integrity: sha512-NM8/P9n3XjXhIZn1lLhkFaACTOURQXjWhV4BA/RnOv8xvgqtqpAX9IO4mRQxSx1Rlo4tqzeqb0sOlruaOy3dug==} + + json-schema@0.4.0: + resolution: {integrity: sha512-es94M3nTIfsEPisRafak+HDLfHXnKBhV3vU5eqPcS3flIWqcxJWgXHXiey3YrpaNsanY5ei1VoYEbOzijuq9BA==} + + json-stable-stringify-without-jsonify@1.0.1: + resolution: {integrity: sha512-Bdboy+l7tA3OGW6FjyFHWkP5LuByj1Tk33Ljyq0axyzdk9//JSi2u3fP1QSmd1KNwq6VOKYGlAu87CisVir6Pw==} + + json-stringify-safe@5.0.1: + resolution: {integrity: sha512-ZClg6AaYvamvYEE82d3Iyd3vSSIjQ+odgjaTzRuO3s7toCdFKczob2i0zCh7JE8kWn17yvAWhUVxvqGwUalsRA==} + + json5@2.2.3: + resolution: {integrity: sha512-XmOWe7eyHYH14cLdVPoyg+GOH3rYX++KpzrylJwSW98t3Nk+U8XOl8FWKOgwtzdb8lXGf6zYwDUzeHMWfxasyg==} + engines: {node: '>=6'} + hasBin: true + + jsonparse@1.3.1: + resolution: {integrity: sha512-POQXvpdL69+CluYsillJ7SUhKvytYjW9vG/GKpnf+xP8UWgYEM/RaMzHHofbALDiKbbP1W8UEYmgGl39WkPZsg==} + engines: {'0': node >= 0.2.0} + + jsprim@1.4.2: + resolution: {integrity: sha512-P2bSOMAc/ciLz6DzgjVlGJP9+BrJWu5UDGK70C2iweC5QBIeFf0ZXRvGjEj2uYgrY2MkAAhsSWHDWlFtEroZWw==} + engines: {node: '>=0.6.0'} + + levn@0.3.0: + resolution: {integrity: sha512-0OO4y2iOHix2W6ujICbKIaEQXvFQHue65vUG3pb5EUomzPI90z9hsA1VsO/dbIIpC53J8gxM9Q4Oho0jrCM/yA==} + engines: {node: '>= 0.8.0'} + + levn@0.4.1: + resolution: {integrity: sha512-+bT2uH4E5LGE7h/n3evcS/sQlJXCpIp6ym8OWJ5eV6+67Dsql/LaaT7qJBAt2rzfoa/5QBGBhxDix1dMt2kQKQ==} + engines: {node: '>= 0.8.0'} + + lodash.debounce@4.0.8: + resolution: {integrity: sha512-FT1yDzDYEoYWhnSGnpE/4Kj1fLZkDFyqRb7fNt6FdYOSxlUWAtp42Eh6Wb0rGIv/m9Bgo7x4GhQbm5Ys4SG5ow==} + + lodash.merge@4.6.2: + resolution: {integrity: sha512-0KpjqXRVvrYyCsX1swR/XTK0va6VQkQM6MNo7PqW77ByjAhoARA8EfrP1N4+KlKj8YS0ZUCtRT/YUuhyYDujIQ==} + + lodash.truncate@4.4.2: + resolution: {integrity: sha512-jttmRe7bRse52OsWIMDLaXxWqRAmtIUccAQ3garviCqJjafXOfNMO0yMfNpdD6zbGaTU0P5Nz7e7gAT6cKmJRw==} + + lodash@4.17.21: + resolution: {integrity: sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg==} + + lru-cache@5.1.1: + resolution: {integrity: sha512-KpNARQA3Iwv+jTA0utUVVbrh+Jlrr1Fv0e56GGzAFOXN7dk/FviaDW8LHmK52DlcH4WP2n6gI8vN1aesBFgo9w==} + + lru-cache@6.0.0: + resolution: {integrity: sha512-Jo6dJ04CmSjuznwJSS3pUeWmd/H0ffTlkXXgwZi+eq1UCmqQwCh+eLsYOYCwY991i2Fah4h1BEMCx4qThGbsiA==} + engines: {node: '>=10'} + + make-fetch-happen@9.1.0: + resolution: {integrity: sha512-+zopwDy7DNknmwPQplem5lAZX/eCOzSvSNNcSKm5eVwTkOBzoktEfXsa9L23J/GIRhxRsaxzkPEhrJEpE2F4Gg==} + engines: {node: '>= 10'} + + media-typer@0.3.0: + resolution: {integrity: sha512-dq+qelQ9akHpcOl/gUVRTxVIOkAJ1wR3QAvb4RsVjS8oVoFjDGTc679wJYmUmknUF5HwMLOgb5O+a3KxfWapPQ==} + engines: {node: '>= 0.6'} + + merge-descriptors@1.0.1: + resolution: {integrity: sha512-cCi6g3/Zr1iqQi6ySbseM1Xvooa98N0w31jzUYrXPX2xqObmFGHJ0tQ5u74H3mVh7wLouTseZyYIq39g8cNp1w==} + + merge-stream@2.0.0: + resolution: {integrity: sha512-abv/qOcuPfk3URPfDzmZU1LKmuw8kT+0nIHvKrKgFrwifol/doWcdA4ZqsWQ8ENrFKkd67Mfpo/LovbIUsbt3w==} + + methods@1.1.2: + resolution: {integrity: sha512-iclAHeNqNm68zFtnZ0e+1L2yUIdvzNoauKU4WBA3VvH/vPFieF7qfRlwUZU+DA9P9bPXIS90ulxoUoCH23sV2w==} + engines: {node: '>= 0.6'} + + mime-db@1.51.0: + resolution: {integrity: sha512-5y8A56jg7XVQx2mbv1lu49NR4dokRnhZYTtL+KGfaa27uq4pSTXkwQkFJl4pkRMyNFz/EtYDSkiiEHx3F7UN6g==} + engines: {node: '>= 0.6'} + + mime-types@2.1.34: + resolution: {integrity: sha512-6cP692WwGIs9XXdOO4++N+7qjqv0rqxxVvJ3VHPh/Sc9mVZcQP+ZGhkKiTvWMQRr2tbHkJP/Yn7Y0npb3ZBs4A==} + engines: {node: '>= 0.6'} + + mime@1.6.0: + resolution: {integrity: sha512-x0Vn8spI+wuJ1O6S7gnbaQg8Pxh4NNHb7KSINmEWKiPE4RKOplvijn+NkmYmmRgP68mc70j2EbeTFRsrswaQeg==} + engines: {node: '>=4'} + hasBin: true + + minimatch@3.0.4: + resolution: {integrity: sha512-yJHVQEhyqPLUTgt9B83PXu6W3rx4MvvHvSUvToogpwoGDOUQ+yDrR0HRot+yOCdCO7u4hX3pWft6kWBBcqh0UA==} + + minipass-collect@1.0.2: + resolution: {integrity: sha512-6T6lH0H8OG9kITm/Jm6tdooIbogG9e0tLgpY6mphXSm/A9u8Nq1ryBG+Qspiub9LjWlBPsPS3tWQ/Botq4FdxA==} + engines: {node: '>= 8'} + + minipass-fetch@1.4.1: + resolution: {integrity: sha512-CGH1eblLq26Y15+Azk7ey4xh0J/XfJfrCox5LDJiKqI2Q2iwOLOKrlmIaODiSQS8d18jalF6y2K2ePUm0CmShw==} + engines: {node: '>=8'} + + minipass-flush@1.0.5: + resolution: {integrity: sha512-JmQSYYpPUqX5Jyn1mXaRwOda1uQ8HP5KAT/oDSLCzt1BYRhQU0/hDtsB1ufZfEEzMZ9aAVmsBw8+FWsIXlClWw==} + engines: {node: '>= 8'} + + minipass-json-stream@1.0.1: + resolution: {integrity: sha512-ODqY18UZt/I8k+b7rl2AENgbWE8IDYam+undIJONvigAz8KR5GWblsFTEfQs0WODsjbSXWlm+JHEv8Gr6Tfdbg==} + + minipass-pipeline@1.2.4: + resolution: {integrity: sha512-xuIq7cIOt09RPRJ19gdi4b+RiNvDFYe5JH+ggNvBqGqpQXcru3PcRmOZuHBKWK1Txf9+cQ+HMVN4d6z46LZP7A==} + engines: {node: '>=8'} + + minipass-sized@1.0.3: + resolution: {integrity: sha512-MbkQQ2CTiBMlA2Dm/5cY+9SWFEN8pzzOXi6rlM5Xxq0Yqbda5ZQy9sU75a673FE9ZK0Zsbr6Y5iP6u9nktfg2g==} + engines: {node: '>=8'} + + minipass@3.1.6: + resolution: {integrity: sha512-rty5kpw9/z8SX9dmxblFA6edItUmwJgMeYDZRrwlIVN27i8gysGbznJwUggw2V/FVqFSDdWy040ZPS811DYAqQ==} + engines: {node: '>=8'} + + minizlib@2.1.2: + resolution: {integrity: sha512-bAxsR8BVfj60DWXHE3u30oHzfl4G7khkSuPW+qvpd7jFRHm7dLxOjUk1EHACJ/hxLY8phGJ0YhYHZo7jil7Qdg==} + engines: {node: '>= 8'} + + mkdirp@1.0.4: + resolution: {integrity: sha512-vVqVZQyf3WLx2Shd0qJ9xuvqgAyKPLAiqITEtqW0oIUjzo3PePDd6fW9iFz30ef7Ysp/oiWqbhszeGWW2T6Gzw==} + engines: {node: '>=10'} + hasBin: true + + ms@2.0.0: + resolution: {integrity: sha512-Tpp60P6IUJDTuOq/5Z8cdskzJujfwqfOTkrwIwj7IRISpnkJnT6SyJ4PCPnGMoFjC9ddhal5KVIYtAt97ix05A==} + + ms@2.1.2: + resolution: {integrity: sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==} + + ms@2.1.3: + resolution: {integrity: sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==} + + nanoid@3.2.0: + resolution: {integrity: sha512-fmsZYa9lpn69Ad5eDn7FMcnnSR+8R34W9qJEijxYhTbfOWzr22n1QxCMzXLK+ODyW2973V3Fux959iQoUxzUIA==} + engines: {node: ^10 || ^12 || ^13.7 || ^14 || >=15.0.1} + hasBin: true + + natural-compare@1.4.0: + resolution: {integrity: sha512-OWND8ei3VtNC9h7V60qff3SVobHr996CTwgxubgyQYEpg290h9J0buyECNNJexkFm5sOajh5G116RYA1c8ZMSw==} + + negotiator@0.6.2: + resolution: {integrity: sha512-hZXc7K2e+PgeI1eDBe/10Ard4ekbfrrqG8Ep+8Jmf4JID2bNg7NvCPOZN+kfF574pFQI7mum2AUqDidoKqcTOw==} + engines: {node: '>= 0.6'} + + node-forge@1.2.1: + resolution: {integrity: sha512-Fcvtbb+zBcZXbTTVwqGA5W+MKBj56UjVRevvchv5XrcyXbmNdesfZL37nlcWOfpgHhgmxApw3tQbTr4CqNmX4w==} + engines: {node: '>= 6.13.0'} + + node-gyp@7.1.2: + resolution: {integrity: sha512-CbpcIo7C3eMu3dL1c3d0xw449fHIGALIJsRP4DDPHpyiW8vcriNY7ubh9TE4zEKfSxscY7PjeFnshE7h75ynjQ==} + engines: {node: '>= 10.12.0'} + hasBin: true + + node-releases@2.0.19: + resolution: {integrity: sha512-xxOWJsBKtzAq7DY0J+DTzuz58K8e7sJbdgwkbMWQe8UYB6ekmsQ45q0M/tJDsGaZmbC+l7n57UV8Hl5tHxO9uw==} + + nopt@5.0.0: + resolution: {integrity: sha512-Tbj67rffqceeLpcRXrT7vKAN8CwfPeIBgM7E6iBkmKLV7bEMwpGgYLGv0jACUsECaa/vuxP0IjEont6umdMgtQ==} + engines: {node: '>=6'} + hasBin: true + + npm-bundled@1.1.2: + resolution: {integrity: sha512-x5DHup0SuyQcmL3s7Rx/YQ8sbw/Hzg0rj48eN0dV7hf5cmQq5PXIeioroH3raV1QC1yh3uTYuMThvEQF3iKgGQ==} + + npm-install-checks@4.0.0: + resolution: {integrity: sha512-09OmyDkNLYwqKPOnbI8exiOZU2GVVmQp7tgez2BPi5OZC8M82elDAps7sxC4l//uSUtotWqoEIDwjRvWH4qz8w==} + engines: {node: '>=10'} + + npm-normalize-package-bin@1.0.1: + resolution: {integrity: sha512-EPfafl6JL5/rU+ot6P3gRSCpPDW5VmIzX959Ob1+ySFUuuYHWHekXpwdUZcKP5C+DS4GEtdJluwBjnsNDl+fSA==} + + npm-package-arg@8.1.5: + resolution: {integrity: sha512-LhgZrg0n0VgvzVdSm1oiZworPbTxYHUJCgtsJW8mGvlDpxTM1vSJc3m5QZeUkhAHIzbz3VCHd/R4osi1L1Tg/Q==} + engines: {node: '>=10'} + + npm-packlist@2.2.2: + resolution: {integrity: sha512-Jt01acDvJRhJGthnUJVF/w6gumWOZxO7IkpY/lsX9//zqQgnF7OJaxgQXcerd4uQOLu7W5bkb4mChL9mdfm+Zg==} + engines: {node: '>=10'} + hasBin: true + + npm-pick-manifest@6.1.1: + resolution: {integrity: sha512-dBsdBtORT84S8V8UTad1WlUyKIY9iMsAmqxHbLdeEeBNMLQDlDWWra3wYUx9EBEIiG/YwAy0XyNHDd2goAsfuA==} + + npm-registry-fetch@11.0.0: + resolution: {integrity: sha512-jmlgSxoDNuhAtxUIG6pVwwtz840i994dL14FoNVZisrmZW5kWd63IUTNv1m/hyRSGSqWjCUp/YZlS1BJyNp9XA==} + engines: {node: '>=10'} + + npmlog@4.1.2: + resolution: {integrity: sha512-2uUqazuKlTaSI/dC8AzicUck7+IrEaOnN/e0jd3Xtt1KcGpwx30v50mL7oPyr/h9bL3E4aZccVwpwP+5W9Vjkg==} + deprecated: This package is no longer supported. + + number-is-nan@1.0.1: + resolution: {integrity: sha512-4jbtZXNAsfZbAHiiqjLPBiCl16dES1zI4Hpzzxw61Tk+loF+sBDBKx1ICKKKwIqQ7M0mFn1TmkN7euSncWgHiQ==} + engines: {node: '>=0.10.0'} + + oauth-sign@0.9.0: + resolution: {integrity: sha512-fexhUFFPTGV8ybAtSIGbV6gOkSv8UtRbDBnAyLQw4QPKkgNlsH2ByPGtMUqdWkos6YCRmAqViwgZrJc/mRDzZQ==} + + object-assign@4.1.1: + resolution: {integrity: sha512-rJgTQnkUnH1sFw8yT6VSU3zD3sWmu6sZhIseY8VX+GRu3P6F7Fu+JNDoXfklElbLJSnc3FUQHVe4cU5hj+BcUg==} + engines: {node: '>=0.10.0'} + + on-finished@2.3.0: + resolution: {integrity: sha512-ikqdkGAAyf/X/gPhXGvfgAytDZtDbr+bkNUJ0N9h5MI/dmdgCs3l6hoHrcUv41sRKew3jIwrp4qQDXiK99Utww==} + engines: {node: '>= 0.8'} + + once@1.4.0: + resolution: {integrity: sha512-lNaJgI+2Q5URQBkccEKHTQOPaXdUxnZZElQTZY0MFUAuaEqe1E+Nyvgdz/aIyNi6Z9MzO5dv1H8n58/GELp3+w==} + + open@8.4.0: + resolution: {integrity: sha512-XgFPPM+B28FtCCgSb9I+s9szOC1vZRSwgWsRUA5ylIxRTgKozqjOCrVOqGsYABPYK5qnfqClxZTFBa8PKt2v6Q==} + engines: {node: '>=12'} + + optionator@0.8.3: + resolution: {integrity: sha512-+IW9pACdk3XWmmTXG8m3upGUJst5XRGzxMRjXzAuJ1XnIFNvfhjjIuYkDvysnPQ7qzqVzLt78BCruntqRhWQbA==} + engines: {node: '>= 0.8.0'} + + optionator@0.9.1: + resolution: {integrity: sha512-74RlY5FCnhq4jRxVUPKDaRwrVNXMqsGsiW6AJw4XK8hmtm10wC0ypZBLw5IIp85NZMr91+qd1RvvENwg7jjRFw==} + engines: {node: '>= 0.8.0'} + + p-map@4.0.0: + resolution: {integrity: sha512-/bjOqmgETBYB5BoEeGVea8dmvHb2m9GLy1E9W43yeyfP6QQCZGFNa+XRceJEuDB6zqr+gKpIAmlLebMpykw/MQ==} + engines: {node: '>=10'} + + pacote@11.3.5: + resolution: {integrity: sha512-fT375Yczn4zi+6Hkk2TBe1x1sP8FgFsEIZ2/iWaXY2r/NkhDJfxbcn5paz1+RTFCyNf+dPnaoBDJoAxXSU8Bkg==} + engines: {node: '>=10'} + hasBin: true + + parent-module@1.0.1: + resolution: {integrity: sha512-GQ2EWRpQV8/o+Aw8YqtfZZPfNRWZYkbidE9k5rpl/hC3vtHHBfGm2Ifi6qWV+coDGkrUKZAxE3Lot5kcsRlh+g==} + engines: {node: '>=6'} + + parseurl@1.3.3: + resolution: {integrity: sha512-CiyeOxFT/JZyN5m0z9PfXw4SCBJ6Sygz1Dpl0wqjlhDEGGBP1GnsUVEL0p63hoG1fcj3fHynXi9NYO4nWOL+qQ==} + engines: {node: '>= 0.8'} + + path-is-absolute@1.0.1: + resolution: {integrity: sha512-AVbw3UJ2e9bq64vSaS9Am0fje1Pa8pbGqTTsmXfaIiMpnr5DlDhfJOuLj9Sf95ZPVDAUerDfEk88MPmPe7UCQg==} + engines: {node: '>=0.10.0'} + + path-key@3.1.1: + resolution: {integrity: sha512-ojmeN0qd+y0jszEtoY48r0Peq5dwMEkIlCOu6Q5f41lfkswXuKtYrhgoTpLnyIcHm24Uhqx+5Tqm2InSwLhE6Q==} + engines: {node: '>=8'} + + path-parse@1.0.7: + resolution: {integrity: sha512-LDJzPVEEEPR+y48z93A0Ed0yXb8pAByGWo/k5YYdYgpY2/2EsOsksJrq7lOHxryrVOn1ejG6oAp8ahvOIQD8sw==} + + path-to-regexp@0.1.7: + resolution: {integrity: sha512-5DFkuoqlv1uYQKxy8omFBeJPQcdoE07Kv2sferDCrAq1ohOU+MSDswDIbnx3YAM60qIOnYa53wBhXW0EbMonrQ==} + + performance-now@2.1.0: + resolution: {integrity: sha512-7EAHlyLHI56VEIdK57uwHdHKIaAGbnXPiw0yWbarQZOKaKpvUIgW0jWRVLiatnM+XXlSwsanIBH/hzGMJulMow==} + + picocolors@1.1.1: + resolution: {integrity: sha512-xceH2snhtb5M9liqDsmEw56le376mTZkEX/jEb/RxNFyegNul7eNslCXP9FDj/Lcu0X8KEyMceP2ntpaHrDEVA==} + + picomatch@2.3.1: + resolution: {integrity: sha512-JU3teHTNjmE2VCGFzuY8EXzCDVwEqB2a8fsIvwaStHhAWJEeVd1o1QD80CU6+ZdEXXSLbSsuLwJjkCBWqRQUVA==} + engines: {node: '>=8.6'} + + prelude-ls@1.1.2: + resolution: {integrity: sha512-ESF23V4SKG6lVSGZgYNpbsiaAkdab6ZgOxe52p7+Kid3W3u3bxR4Vfd/o21dmN7jSt0IwgZ4v5MUd26FEtXE9w==} + engines: {node: '>= 0.8.0'} + + prelude-ls@1.2.1: + resolution: {integrity: sha512-vkcDPrRZo1QZLbn5RLGPpg/WmIQ65qoWWhcGKf/b5eplkkarX0m9z8ppCat4mlOqUsWpyNuYgO3VRyrYHSzX5g==} + engines: {node: '>= 0.8.0'} + + process-nextick-args@2.0.1: + resolution: {integrity: sha512-3ouUOpQhtgrbOa17J7+uxOTpITYWaGP7/AhoR3+A+/1e9skrzelGi/dXzEYyvbxubEF6Wn2ypscTKiKJFFn1ag==} + + progress@2.0.3: + resolution: {integrity: sha512-7PiHtLll5LdnKIMw100I+8xJXR5gW2QwWYkT6iJva0bXitZKa/XMrSbdmg3r2Xnaidz9Qumd0VPaMrZlF9V9sA==} + engines: {node: '>=0.4.0'} + + promise-inflight@1.0.1: + resolution: {integrity: sha512-6zWPyEOFaQBJYcGMHBKTKJ3u6TBsnMFOIZSa6ce1e/ZrrsOlnHRHbabMjLiBYKp+n44X9eUI6VUPaukCXHuG4g==} + peerDependencies: + bluebird: '*' + peerDependenciesMeta: + bluebird: + optional: true + + promise-retry@2.0.1: + resolution: {integrity: sha512-y+WKFlBR8BGXnsNlIHFGPZmyDf3DFMoLhaflAnyZgV6rG6xu+JwesTo2Q9R6XwYmtmwAFCkAk3e35jEdoeh/3g==} + engines: {node: '>=10'} + + proxy-addr@2.0.7: + resolution: {integrity: sha512-llQsMLSUDUPT44jdrU/O37qlnifitDP+ZwrmmZcoSKyLKvtZxpyV0n2/bD/N4tBAAZ/gJEdZU7KMraoK1+XYAg==} + engines: {node: '>= 0.10'} + + psl@1.8.0: + resolution: {integrity: sha512-RIdOzyoavK+hA18OGGWDqUTsCLhtA7IcZ/6NCs4fFJaHBDab+pDDmDIByWFRQJq2Cd7r1OoQxBGKOaztq+hjIQ==} + + punycode@2.1.1: + resolution: {integrity: sha512-XRsRjdf+j5ml+y/6GKHPZbrF/8p2Yga0JPtdqTIY2Xe5ohJPD9saDJJLPvp9+NSBprVvevdXZybnj2cv8OEd0A==} + engines: {node: '>=6'} + + qs@6.5.3: + resolution: {integrity: sha512-qxXIEh4pCGfHICj1mAJQ2/2XVZkjCDTcEgfoSQxc/fYivUZxTkk7L3bDBJSoNrEzXI17oUO5Dp07ktqE5KzczA==} + engines: {node: '>=0.6'} + + qs@6.9.6: + resolution: {integrity: sha512-TIRk4aqYLNoJUbd+g2lEdz5kLWIuTMRagAXxl78Q0RiVjAOugHmeKNGdd3cwo/ktpf9aL9epCfFqWDEKysUlLQ==} + engines: {node: '>=0.6'} + + randombytes@2.1.0: + resolution: {integrity: sha512-vYl3iOX+4CKUWuxGi9Ukhie6fsqXqS9FE2Zaic4tNFD2N2QQaXOMFbuKK4QmDHC0JO6B1Zp41J0LpT0oR68amQ==} + + range-parser@1.2.1: + resolution: {integrity: sha512-Hrgsx+orqoygnmhFbKaHE6c296J+HTAQXoxEF6gNupROmmGJRoyzfG3ccAveqCBrwr/2yxQ5BVd/GTl5agOwSg==} + engines: {node: '>= 0.6'} + + raw-body@2.4.2: + resolution: {integrity: sha512-RPMAFUJP19WIet/99ngh6Iv8fzAbqum4Li7AD6DtGaW2RpMB/11xDoalPiJMTbu6I3hkbMVkATvZrqb9EEqeeQ==} + engines: {node: '>= 0.8'} + + read-package-json-fast@2.0.3: + resolution: {integrity: sha512-W/BKtbL+dUjTuRL2vziuYhp76s5HZ9qQhd/dKfWIZveD0O40453QNyZhC0e63lqZrAQ4jiOapVoeJ7JrszenQQ==} + engines: {node: '>=10'} + + readable-stream@2.3.7: + resolution: {integrity: sha512-Ebho8K4jIbHAxnuxi7o42OrZgF/ZTNcsZj6nRKyUmkhLFq8CHItp/fy6hQZuZmP/n3yZ9VBUbp4zz/mX8hmYPw==} + + regenerate-unicode-properties@10.2.0: + resolution: {integrity: sha512-DqHn3DwbmmPVzeKj9woBadqmXxLvQoQIwu7nopMc72ztvxVmVk2SBhSnx67zuye5TP+lJsb/TBQsjLKhnDf3MA==} + engines: {node: '>=4'} + + regenerate@1.4.2: + resolution: {integrity: sha512-zrceR/XhGYU/d/opr2EKO7aRHUeiBI8qjtfHqADTwZd6Szfy16la6kqD0MIUs5z5hx6AaKa+PixpPrR289+I0A==} + + regenerator-runtime@0.13.9: + resolution: {integrity: sha512-p3VT+cOEgxFsRRA9X4lkI1E+k2/CtnKtU4gcxyaCUreilL/vqI6CdZ3wxVUx3UOUg+gnUOQQcRI7BmSI656MYA==} + + regenerator-transform@0.15.2: + resolution: {integrity: sha512-hfMp2BoF0qOk3uc5V20ALGDS2ddjQaLrdl7xrGXvAIow7qeWRM2VA2HuCHkUKk9slq3VwEwLNK3DFBqDfPGYtg==} + + regexpp@3.2.0: + resolution: {integrity: sha512-pq2bWo9mVD43nbts2wGv17XLiNLya+GklZ8kaDLV2Z08gDCsGpnKn9BFMepvWuHCbyVvY7J5o5+BVvoQbmlJLg==} + engines: {node: '>=8'} + + regexpu-core@6.2.0: + resolution: {integrity: sha512-H66BPQMrv+V16t8xtmq+UC0CBpiTBA60V8ibS1QVReIp8T1z8hwFxqcGzm9K6lgsN7sB5edVH8a+ze6Fqm4weA==} + engines: {node: '>=4'} + + regjsgen@0.8.0: + resolution: {integrity: sha512-RvwtGe3d7LvWiDQXeQw8p5asZUmfU1G/l6WbUXeHta7Y2PEIvBTwH6E2EfmYUK8pxcxEdEmaomqyp0vZZ7C+3Q==} + + regjsparser@0.12.0: + resolution: {integrity: sha512-cnE+y8bz4NhMjISKbgeVJtqNbtf5QpjZP+Bslo+UqkIt9QPnX9q095eiRRASJG1/tz6dlNr6Z5NsBiWYokp6EQ==} + hasBin: true + + request@2.88.2: + resolution: {integrity: sha512-MsvtOrfG9ZcrOwAW+Qi+F6HbD0CWXEh9ou77uOb7FM2WPhwT7smM833PzanhJLsgXjN89Ir6V2PczXNnMpwKhw==} + engines: {node: '>= 6'} + deprecated: request has been deprecated, see https://github.com/request/request/issues/3142 + + require-directory@2.1.1: + resolution: {integrity: sha512-fGxEI7+wsG9xrvdjsrlmL22OMTTiHRwAMroiEeMgq8gzoLC/PQr7RsRDSTLUg/bZAZtF+TVIkHc6/4RIKrui+Q==} + engines: {node: '>=0.10.0'} + + require-from-string@2.0.2: + resolution: {integrity: sha512-Xf0nWe6RseziFMu+Ap9biiUbmplq6S9/p+7w7YXP/JBHhrUDDUhwa+vANyubuqfZWTveU//DYVGsDG7RKL/vEw==} + engines: {node: '>=0.10.0'} + + resolve-from@4.0.0: + resolution: {integrity: sha512-pb/MYmXstAkysRFx8piNI1tGFNQIFA3vkE3Gq4EuA1dF6gHp/+vgZqsCGJapvy8N3Q+4o7FwvquPJcnZ7RYy4g==} + engines: {node: '>=4'} + + resolve@1.21.0: + resolution: {integrity: sha512-3wCbTpk5WJlyE4mSOtDLhqQmGFi0/TD9VPwmiolnk8U0wRgMEktqCXd3vy5buTO3tljvalNvKrjHEfrd2WpEKA==} + hasBin: true + + retry@0.12.0: + resolution: {integrity: sha512-9LkiTwjUh6rT555DtE9rTX+BKByPfrMzEAtnlEtdEwr3Nkffwiihqe2bWADg+OQRjt9gl6ICdmB/ZFDCGAtSow==} + engines: {node: '>= 4'} + + rimraf@3.0.2: + resolution: {integrity: sha512-JZkJMZkAGFFPP2YqXZXPbMlMBgsxzE8ILs4lMIX/2o0L9UBw9O/Y3o6wFw/i9YLapcUJWwqbi3kdxIPdC62TIA==} + deprecated: Rimraf versions prior to v4 are no longer supported + hasBin: true + + rollup-plugin-filesize@9.1.2: + resolution: {integrity: sha512-m2fE9hFaKgWKisJzyWXctOFKlgMRelo/58HgeC0lXUK/qykxiqkr6bsrotlvo2bvrwPsjgT7scNdQSr6qtl37A==} + engines: {node: '>=10.0.0'} + + rollup-plugin-terser@7.0.2: + resolution: {integrity: sha512-w3iIaU4OxcF52UUXiZNsNeuXIMDvFrr+ZXK6bFZ0Q60qyVfq4uLptoS4bbq3paG3x216eQllFZX7zt6TIImguQ==} + deprecated: This package has been deprecated and is no longer maintained. Please use @rollup/plugin-terser + peerDependencies: + rollup: ^2.0.0 + + rollup-plugin-visualizer@5.5.4: + resolution: {integrity: sha512-CJQFUuZ75S1daGEkk62UH7lL6UFCoP86Sn/iz4gXBdamdwFeD5nPGCHHXfXCrly/wNgQOYTH7cdcxk4+OG3Xjw==} + engines: {node: '>=12'} + hasBin: true + peerDependencies: + rollup: ^2.0.0 + + rollup@2.64.0: + resolution: {integrity: sha512-+c+lbw1lexBKSMb1yxGDVfJ+vchJH3qLbmavR+awDinTDA2C5Ug9u7lkOzj62SCu0PKUExsW36tpgW7Fmpn3yQ==} + engines: {node: '>=10.0.0'} + hasBin: true + + rxjs@6.6.7: + resolution: {integrity: sha512-hTdwr+7yYNIT5n4AMYp85KA6yw2Va0FLa3Rguvbpa4W3I5xynaBZo41cM3XM+4Q6fRMj3sBYIR1VAmZMXYJvRQ==} + engines: {npm: '>=2.0.0'} + + safe-buffer@5.1.2: + resolution: {integrity: sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g==} + + safe-buffer@5.2.1: + resolution: {integrity: sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ==} + + safer-buffer@2.1.2: + resolution: {integrity: sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==} + + secure-compare@3.0.1: + resolution: {integrity: sha512-AckIIV90rPDcBcglUwXPF3kg0P0qmPsPXAj6BBEENQE1p5yA1xfmDJzfi1Tappj37Pv2mVbKpL3Z1T+Nn7k1Qw==} + + selfsigned@2.0.0: + resolution: {integrity: sha512-cUdFiCbKoa1mZ6osuJs2uDHrs0k0oprsKveFiiaBKCNq3SYyb5gs2HxhQyDNLCmL51ZZThqi4YNDpCK6GOP1iQ==} + engines: {node: '>=10'} + + semver@6.3.1: + resolution: {integrity: sha512-BR7VvDCVHO+q2xBEWskxS6DJE1qRnb7DxzUrogb71CWoSficBxYsiAGd+Kl0mmq/MprG9yArRkyrQxTO6XjMzA==} + hasBin: true + + semver@7.3.5: + resolution: {integrity: sha512-PoeGJYh8HK4BTO/a9Tf6ZG3veo/A7ZVsYrSA6J8ny9nb3B1VrpkuN+z9OE5wfE5p6H4LchYZsegiQgbJD94ZFQ==} + engines: {node: '>=10'} + hasBin: true + + send@0.17.2: + resolution: {integrity: sha512-UJYB6wFSJE3G00nEivR5rgWp8c2xXvJ3OPWPhmuteU0IKj8nKbG3DrjiOmLwpnHGYWAVwA69zmTm++YG0Hmwww==} + engines: {node: '>= 0.8.0'} + + serialize-javascript@4.0.0: + resolution: {integrity: sha512-GaNA54380uFefWghODBWEGisLZFj00nS5ACs6yHa9nLqlLpVLO8ChDGeKRjZnV4Nh4n0Qi7nhYZD/9fCPzEqkw==} + + serve-index@1.9.1: + resolution: {integrity: sha512-pXHfKNP4qujrtteMrSBb0rc8HJ9Ms/GrXwcUtUtD5s4ewDJI8bT3Cz2zTVRMKtri49pLx2e0Ya8ziP5Ya2pZZw==} + engines: {node: '>= 0.8.0'} + + serve-static@1.14.2: + resolution: {integrity: sha512-+TMNA9AFxUEGuC0z2mevogSnn9MXKb4fa7ngeRMJaaGv8vTwnIEkKi+QGvPt33HSnf8pRS+WGM0EbMtCJLKMBQ==} + engines: {node: '>= 0.8.0'} + + server-destroy@1.0.1: + resolution: {integrity: sha512-rb+9B5YBIEzYcD6x2VKidaa+cqYBJQKnU4oe4E3ANwRRN56yk/ua1YCJT1n21NTS8w6CcOclAKNP3PhdCXKYtQ==} + + servez-lib@2.4.1: + resolution: {integrity: sha512-rphdtQBu+AuTu7b9o7uyeLMSWEqeWTNm8YT4FaVaAl3aODP47tERRH5mh+G5yM+kOq4FPJQlAG/kKFHI3MYWAg==} + + servez@1.12.0: + resolution: {integrity: sha512-GbqIyShRvL9y0T/tPB47NYEz8aXg3SfsYcfm9ptQ5Be3h77WTexYmdUMjqN/JkiCtTFbUZUrOfxdlD0DhCjpWA==} + hasBin: true + + set-blocking@2.0.0: + resolution: {integrity: sha512-KiKBS8AnWGEyLzofFfmvKwpdPzqiy16LvQfK3yv/fVH7Bj13/wl3JSR1J+rfgRE9q7xUJK4qvgS8raSOeLUehw==} + + setprototypeof@1.1.0: + resolution: {integrity: sha512-BvE/TwpZX4FXExxOxZyRGQQv651MSwmWKZGqvmPcRIjDqWub67kTKuIMx43cZZrS/cBBzwBcNDWoFxt2XEFIpQ==} + + setprototypeof@1.2.0: + resolution: {integrity: sha512-E5LDX7Wrp85Kil5bhZv46j8jOeboKq5JMmYM3gVGdGH8xFpPWXUMsNrlODCrkoxMEeNi/XZIwuRvY4XNwYMJpw==} + + shebang-command@2.0.0: + resolution: {integrity: sha512-kHxr2zZpYtdmrN1qDjrrX/Z1rR1kG8Dx+gkpK1G4eXmvXswmcE1hTWBWYUzlraYw1/yZp6YuDY77YtvbN0dmDA==} + engines: {node: '>=8'} + + shebang-regex@3.0.0: + resolution: {integrity: sha512-7++dFhtcx3353uBaq8DDR4NuxBetBzC7ZQOhmTQInHEd6bSrXdiEyzCvG07Z44UYdLShWUyXt5M/yhz8ekcb1A==} + engines: {node: '>=8'} + + signal-exit@3.0.6: + resolution: {integrity: sha512-sDl4qMFpijcGw22U5w63KmD3cZJfBuFlVNbVMKje2keoKML7X2UzWbc4XrmEbDwg0NXJc3yv4/ox7b+JWb57kQ==} + + slice-ansi@4.0.0: + resolution: {integrity: sha512-qMCMfhY040cVHT43K9BFygqYbUPFZKHOg7K73mtTWJRb8pyP3fzf4Ixd5SzdEJQ6MRUg/WBnOLxghZtKKurENQ==} + engines: {node: '>=10'} + + smart-buffer@4.2.0: + resolution: {integrity: sha512-94hK0Hh8rPqQl2xXc3HsaBoOXKV20MToPkcXvwbISWLEs+64sBq5kFgn2kJDHb1Pry9yrP0dxrCI9RRci7RXKg==} + engines: {node: '>= 6.0.0', npm: '>= 3.0.0'} + + socks-proxy-agent@6.1.1: + resolution: {integrity: sha512-t8J0kG3csjA4g6FTbsMOWws+7R7vuRC8aQ/wy3/1OWmsgwA68zs/+cExQ0koSitUDXqhufF/YJr9wtNMZHw5Ew==} + engines: {node: '>= 10'} + + socks@2.6.1: + resolution: {integrity: sha512-kLQ9N5ucj8uIcxrDwjm0Jsqk06xdpBjGNQtpXy4Q8/QY2k+fY7nZH8CARy+hkbG+SGAovmzzuauCpBlb8FrnBA==} + engines: {node: '>= 10.13.0', npm: '>= 3.0.0'} + + source-map-support@0.5.21: + resolution: {integrity: sha512-uBHU3L3czsIyYXKX88fdrGovxdSCoTGDRZ6SYXtSRxLZUzHg5P/66Ht6uoUlHu9EZod+inXhKo3qQgwXUT/y1w==} + + source-map@0.6.1: + resolution: {integrity: sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==} + engines: {node: '>=0.10.0'} + + source-map@0.7.3: + resolution: {integrity: sha512-CkCj6giN3S+n9qrYiBTX5gystlENnRW5jZeNLHpe6aue+SrHcG5VYwujhW9s4dY31mEGsxBDrHR6oI69fTXsaQ==} + engines: {node: '>= 8'} + + spawn-command@0.0.2-1: + resolution: {integrity: sha512-n98l9E2RMSJ9ON1AKisHzz7V42VDiBQGY6PB1BwRglz99wpVsSuGzQ+jOi6lFXBGVTCrRpltvjm+/XA+tpeJrg==} + + sprintf-js@1.0.3: + resolution: {integrity: sha512-D9cPgkvLlV3t3IzL0D0YLvGA9Ahk4PcvVwUbN0dSGr1aP0Nrt4AEnTUbuGvquEC0mA64Gqt1fzirlRs5ibXx8g==} + + sshpk@1.17.0: + resolution: {integrity: sha512-/9HIEs1ZXGhSPE8X6Ccm7Nam1z8KcoCqPdI7ecm1N33EzAetWahvQWVqLZtaZQ+IDKX4IyA2o0gBzqIMkAagHQ==} + engines: {node: '>=0.10.0'} + hasBin: true + + ssri@8.0.1: + resolution: {integrity: sha512-97qShzy1AiyxvPNIkLWoGua7xoQzzPjQ0HAH4B0rWKo7SZ6USuPcrUiAFrws0UH8RrbWmgq3LMTObhPIHbbBeQ==} + engines: {node: '>= 8'} + + statuses@1.5.0: + resolution: {integrity: sha512-OpZ3zP+jT1PI7I8nemJX4AKmAX070ZkYPVWV/AaKTJl+tXCTGyVdC1a4SL8RUQYEwk/f34ZX8UTykN68FwrqAA==} + engines: {node: '>= 0.6'} + + string-width@1.0.2: + resolution: {integrity: sha512-0XsVpQLnVCXHJfyEs8tC0zpTVIr5PKKsQtkT29IwupnPTjtPmQ3xT/4yCREF9hYkV/3M3kzcUTSAZT6a6h81tw==} + engines: {node: '>=0.10.0'} + + string-width@4.2.3: + resolution: {integrity: sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==} + engines: {node: '>=8'} + + string_decoder@1.1.1: + resolution: {integrity: sha512-n/ShnvDi6FHbbVfviro+WojiFzv+s8MPMHBczVePfUpDJLwoLT0ht1l4YwBCbi8pJAveEEdnkHyPyTP/mzRfwg==} + + strip-ansi@3.0.1: + resolution: {integrity: sha512-VhumSSbBqDTP8p2ZLKj40UjBCV4+v8bUSEpUb4KjRgWk9pbqGF4REFj6KEagidb2f/M6AzC0EmFyDNGaw9OCzg==} + engines: {node: '>=0.10.0'} + + strip-ansi@6.0.1: + resolution: {integrity: sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==} + engines: {node: '>=8'} + + strip-json-comments@3.1.1: + resolution: {integrity: sha512-6fPc+R4ihwqP6N/aIv2f1gMH8lOVtWQHoqC4yK6oSDVVocumAsfCqjkXnqiYMhmMwS/mEHLp7Vehlt3ql6lEig==} + engines: {node: '>=8'} + + supports-color@5.5.0: + resolution: {integrity: sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==} + engines: {node: '>=4'} + + supports-color@7.2.0: + resolution: {integrity: sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==} + engines: {node: '>=8'} + + supports-color@8.1.1: + resolution: {integrity: sha512-MpUEN2OodtUzxvKQl72cUF7RQ5EiHsGvSsVG0ia9c5RbWGL2CI4C7EpPS8UTBIplnlzZiNuV56w+FuNxy3ty2Q==} + engines: {node: '>=10'} + + supports-preserve-symlinks-flag@1.0.0: + resolution: {integrity: sha512-ot0WnXS9fgdkgIcePe6RHNk1WA8+muPa6cSjeR3V8K27q9BB1rTE3R1p7Hv0z1ZyAc8s6Vvv8DIyWf681MAt0w==} + engines: {node: '>= 0.4'} + + table@6.8.0: + resolution: {integrity: sha512-s/fitrbVeEyHKFa7mFdkuQMWlH1Wgw/yEXMt5xACT4ZpzWFluehAxRtUUQKPuWhaLAWhFcVx6w3oC8VKaUfPGA==} + engines: {node: '>=10.0.0'} + + tar@6.1.11: + resolution: {integrity: sha512-an/KZQzQUkZCkuoAA64hM92X0Urb6VpRhAFllDzz44U2mcD5scmT3zBc4VgVpkugF580+DQn8eAFSyoQt0tznA==} + engines: {node: '>= 10'} + + terser@5.10.0: + resolution: {integrity: sha512-AMmF99DMfEDiRJfxfY5jj5wNH/bYO09cniSqhfoyxc8sFoYIgkJy86G04UoZU5VjlpnplVu0K6Tx6E9b5+DlHA==} + engines: {node: '>=10'} + hasBin: true + peerDependencies: + acorn: ^8.5.0 + peerDependenciesMeta: + acorn: + optional: true + + text-table@0.2.0: + resolution: {integrity: sha512-N+8UisAXDGk8PFXP4HAzVR9nbfmVJ3zYLAWiTIoqC5v5isinhr+r5uaO8+7r3BMfuNIufIsA7RdpVgacC2cSpw==} + + toidentifier@1.0.1: + resolution: {integrity: sha512-o5sSPKEkg/DIQNmH43V0/uerLrpzVedkUh8tGNvaeXpfpuwjKenlSox/2O/BTlZUtEe+JG7s5YhEz608PlAHRA==} + engines: {node: '>=0.6'} + + tough-cookie@2.5.0: + resolution: {integrity: sha512-nlLsUzgm1kfLXSXfRZMc1KLAugd4hqJHDTvc2hDIwS3mZAfMEuMbc03SujMF+GEcpaX/qboeycw6iO8JwVv2+g==} + engines: {node: '>=0.8'} + + tree-kill@1.2.2: + resolution: {integrity: sha512-L0Orpi8qGpRG//Nd+H90vFB+3iHnue1zSSGmNOOCh1GLJ7rUKVwV2HvijphGQS2UmhUZewS9VgvxYIdgr+fG1A==} + hasBin: true + + tslib@1.14.1: + resolution: {integrity: sha512-Xni35NKzjgMrwevysHTCArtLDpPvye8zV/0E4EyYn43P7/7qvQwPh9BGkHewbMulVntbigmcT7rdX3BNo9wRJg==} + + tunnel-agent@0.6.0: + resolution: {integrity: sha512-McnNiV1l8RYeY8tBgEpuodCC1mLUdbSN+CYBL7kJsJNInOP8UjDDEwdk6Mw60vdLLrr5NHKZhMAOSrR2NZuQ+w==} + + tweetnacl@0.14.5: + resolution: {integrity: sha512-KXXFFdAbFXY4geFIwoyNK+f5Z1b7swfXABfL7HXCmoIWMKU3dmS26672A4EeQtDzLKy7SXmfBu51JolvEKwtGA==} + + type-check@0.3.2: + resolution: {integrity: sha512-ZCmOJdvOWDBYJlzAoFkC+Q0+bUyEOS1ltgp1MGU03fqHG+dbi9tBFU2Rd9QKiDZFAYrhPh2JUf7rZRIuHRKtOg==} + engines: {node: '>= 0.8.0'} + + type-check@0.4.0: + resolution: {integrity: sha512-XleUoc9uwGXqjWwXaUTZAmzMcFZ5858QA2vvx1Ur5xIcixXIP+8LnFDgRplU30us6teqdlskFfu+ae4K79Ooew==} + engines: {node: '>= 0.8.0'} + + type-fest@0.20.2: + resolution: {integrity: sha512-Ne+eE4r0/iWnpAxD852z3A+N0Bt5RN//NjJwRd2VFHEmrywxf5vsZlh4R6lixl6B+wz/8d+maTSAkN1FIkI3LQ==} + engines: {node: '>=10'} + + type-is@1.6.18: + resolution: {integrity: sha512-TkRKr9sUTxEH8MdfuCSP7VizJyzRNMjj2J2do2Jr3Kym598JVdEksuzPQCnlFPW4ky9Q+iA+ma9BGm06XQBy8g==} + engines: {node: '>= 0.6'} + + unicode-canonical-property-names-ecmascript@2.0.1: + resolution: {integrity: sha512-dA8WbNeb2a6oQzAQ55YlT5vQAWGV9WXOsi3SskE3bcCdM0P4SDd+24zS/OCacdRq5BkdsRj9q3Pg6YyQoxIGqg==} + engines: {node: '>=4'} + + unicode-match-property-ecmascript@2.0.0: + resolution: {integrity: sha512-5kaZCrbp5mmbz5ulBkDkbY0SsPOjKqVS35VpL9ulMPfSl0J0Xsm+9Evphv9CoIZFwre7aJoa94AY6seMKGVN5Q==} + engines: {node: '>=4'} + + unicode-match-property-value-ecmascript@2.2.0: + resolution: {integrity: sha512-4IehN3V/+kkr5YeSSDDQG8QLqO26XpL2XP3GQtqwlT/QYSECAwFztxVHjlbh0+gjJ3XmNLS0zDsbgs9jWKExLg==} + engines: {node: '>=4'} + + unicode-property-aliases-ecmascript@2.1.0: + resolution: {integrity: sha512-6t3foTQI9qne+OZoVQB/8x8rk2k1eVy1gRXhV3oFQ5T6R1dqQ1xtin3XqSlx3+ATBkliTaR/hHyJBm+LVPNM8w==} + engines: {node: '>=4'} + + unique-filename@1.1.1: + resolution: {integrity: sha512-Vmp0jIp2ln35UTXuryvjzkjGdRyf9b2lTXuSYUiPmzRcl3FDtYqAwOnTJkAngD9SWhnoJzDbTKwaOrZ+STtxNQ==} + + unique-slug@2.0.2: + resolution: {integrity: sha512-zoWr9ObaxALD3DOPfjPSqxt4fnZiWblxHIgeWqW8x7UqDzEtHEQLzji2cuJYQFCU6KmoJikOYAZlrTHHebjx2w==} + + unpipe@1.0.0: + resolution: {integrity: sha512-pjy2bYhSsufwWlKwPc+l3cN7+wuJlK6uz0YdJEOlQDbl6jo/YlPi4mb8agUkVC8BF7V8NuzeyPNqRksA3hztKQ==} + engines: {node: '>= 0.8'} + + update-browserslist-db@1.1.1: + resolution: {integrity: sha512-R8UzCaa9Az+38REPiJ1tXlImTJXlVfgHZsglwBD/k6nj76ctsH1E3q4doGrukiLQd3sGQYu56r5+lo5r94l29A==} + hasBin: true + peerDependencies: + browserslist: '>= 4.21.0' + + uri-js@4.4.1: + resolution: {integrity: sha512-7rKUyy33Q1yc98pQ1DAmLtwX109F7TIfWlW1Ydo8Wl1ii1SeHieeh0HHfPeL2fMXK6z0s8ecKs9frCuLJvndBg==} + + util-deprecate@1.0.2: + resolution: {integrity: sha512-EPD5q1uXyFxJpCrLnCc1nHnq3gOa6DZBocAIiI2TaSCA7VCJ1UJDMagCzIkXNsUYfD1daK//LTEQ8xiIbrHtcw==} + + utils-merge@1.0.1: + resolution: {integrity: sha512-pMZTvIkT1d+TFGvDOqodOclx0QWkkgi6Tdoa8gC8ffGAAqz9pzPTZWAybbsHHoED/ztMtkv/VoYTYyShUn81hA==} + engines: {node: '>= 0.4.0'} + + uuid@3.4.0: + resolution: {integrity: sha512-HjSDRw6gZE5JMggctHBcjVak08+KEVhSIiDzFnT9S9aegmp85S/bReBVTb4QTFaRNptJ9kuYaNhnbNEOkbKb/A==} + deprecated: Please upgrade to version 7 or higher. Older versions may use Math.random() in certain circumstances, which is known to be problematic. See https://v8.dev/blog/math-random for details. + hasBin: true + + v8-compile-cache@2.3.0: + resolution: {integrity: sha512-l8lCEmLcLYZh4nbunNZvQCJc5pv7+RCwa8q/LdUx8u7lsWvPDKmpodJAJNwkAhJC//dFY48KuIEmjtd4RViDrA==} + + validate-npm-package-name@3.0.0: + resolution: {integrity: sha512-M6w37eVCMMouJ9V/sdPGnC5H4uDr73/+xdq0FBLO3TFFX1+7wiUY6Es328NN+y43tmY+doUdN9g9J21vqB7iLw==} + + vary@1.1.2: + resolution: {integrity: sha512-BNGbWLfd0eUPabhkXUVm0j8uuvREyTh5ovRa/dyow/BqAbZJyC+5fU+IzQOzmAKzYqYRAISoRhdQr3eIZ/PXqg==} + engines: {node: '>= 0.8'} + + verror@1.10.0: + resolution: {integrity: sha512-ZZKSmDAEFOijERBLkmYfJ+vmk3w+7hOLYDNkRCuRuMJGEmqYNCNLyBBFwWKVMhfwaEF3WOd0Zlw86U/WC/+nYw==} + engines: {'0': node >=0.6.0} + + which@2.0.2: + resolution: {integrity: sha512-BLI3Tl1TW3Pvl70l3yq3Y64i+awpwXqsGBYWkkqMtnbXgrMD+yj7rhW0kuEDxzJaYXGjEW5ogapKNMEKNMjibA==} + engines: {node: '>= 8'} + hasBin: true + + wide-align@1.1.5: + resolution: {integrity: sha512-eDMORYaPNZ4sQIuuYPDHdQvf4gyCF9rEEV/yPxGfwPkRodwEgiMUUXTx/dex+Me0wxx53S+NgUHaP7y3MGlDmg==} + + widest-line@3.1.0: + resolution: {integrity: sha512-NsmoXalsWVDMGupxZ5R08ka9flZjjiLvHVAWYOKtiKM8ujtZWr9cRffak+uSE48+Ob8ObalXpwyeUiyDD6QFgg==} + engines: {node: '>=8'} + + word-wrap@1.2.3: + resolution: {integrity: sha512-Hz/mrNwitNRh/HUAtM/VT/5VH+ygD6DV7mYKZAtHOrbs8U7lvPS6xf7EJKMF0uW1KJCl0H701g3ZGus+muE5vQ==} + engines: {node: '>=0.10.0'} + + wrap-ansi@7.0.0: + resolution: {integrity: sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q==} + engines: {node: '>=10'} + + wrappy@1.0.2: + resolution: {integrity: sha512-l4Sp/DRseor9wL6EvV2+TuQn63dMkPjZ/sp9XkghTEbV9KlPS1xUsZ3u7/IQO4wxtcFB4bgpQPRcR3QCvezPcQ==} + + y18n@5.0.8: + resolution: {integrity: sha512-0pfFzegeDWJHJIAmTLRP2DwHjdF5s7jo9tuztdQxAhINCdvS+3nGINqPd00AphqJR/0LhANUS6/+7SCb98YOfA==} + engines: {node: '>=10'} + + yallist@3.1.1: + resolution: {integrity: sha512-a4UGQaWPH59mOXUYnAG2ewncQS4i4F43Tv3JoAM+s2VDAmS9NsK8GpDMLrCHPksFT7h3K6TOoUNn2pb7RoXx4g==} + + yallist@4.0.0: + resolution: {integrity: sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A==} + + yargs-parser@20.2.9: + resolution: {integrity: sha512-y11nGElTIV+CT3Zv9t7VKl+Q3hTQoT9a1Qzezhhl6Rp21gJ/IVTW7Z3y9EWXhuUBC2Shnf+DX0antecpAwSP8w==} + engines: {node: '>=10'} + + yargs-parser@21.0.0: + resolution: {integrity: sha512-z9kApYUOCwoeZ78rfRYYWdiU/iNL6mwwYlkkZfJoyMR1xps+NEBX5X7XmRpxkZHhXJ6+Ey00IwKxBBSW9FIjyA==} + engines: {node: '>=12'} + + yargs@16.2.0: + resolution: {integrity: sha512-D1mvvtDG0L5ft/jGWkLpG1+m0eQxOfaBvTNELraWj22wSVUMWxZUvYgJYcKh6jGGIkJFhH4IZPQhR4TKpc8mBw==} + engines: {node: '>=10'} + + yargs@17.3.1: + resolution: {integrity: sha512-WUANQeVgjLbNsEmGk20f+nlHgOqzRFpiGWVaBrYGYIGANIIu3lWjoyi0fNlFmJkvfhCZ6BXINe7/W2O2bV4iaA==} + engines: {node: '>=12'} + +snapshots: + + '@ampproject/remapping@2.3.0': + dependencies: + '@jridgewell/gen-mapping': 0.3.5 + '@jridgewell/trace-mapping': 0.3.25 + + '@babel/code-frame@7.12.11': + dependencies: + '@babel/highlight': 7.16.7 + + '@babel/code-frame@7.26.2': + dependencies: + '@babel/helper-validator-identifier': 7.25.9 + js-tokens: 4.0.0 + picocolors: 1.1.1 + + '@babel/compat-data@7.26.3': {} + + '@babel/core@7.26.0': + dependencies: + '@ampproject/remapping': 2.3.0 + '@babel/code-frame': 7.26.2 + '@babel/generator': 7.26.3 + '@babel/helper-compilation-targets': 7.25.9 + '@babel/helper-module-transforms': 7.26.0(@babel/core@7.26.0) + '@babel/helpers': 7.26.0 + '@babel/parser': 7.26.3 + '@babel/template': 7.25.9 + '@babel/traverse': 7.26.4 + '@babel/types': 7.26.3 + convert-source-map: 2.0.0 + debug: 4.3.3 + gensync: 1.0.0-beta.2 + json5: 2.2.3 + semver: 6.3.1 + transitivePeerDependencies: + - supports-color + + '@babel/eslint-parser@7.16.5(@babel/core@7.26.0)(eslint@7.32.0)': + dependencies: + '@babel/core': 7.26.0 + eslint: 7.32.0 + eslint-scope: 5.1.1 + eslint-visitor-keys: 2.1.0 + semver: 6.3.1 + + '@babel/generator@7.26.3': + dependencies: + '@babel/parser': 7.26.3 + '@babel/types': 7.26.3 + '@jridgewell/gen-mapping': 0.3.5 + '@jridgewell/trace-mapping': 0.3.25 + jsesc: 3.0.2 + + '@babel/helper-annotate-as-pure@7.25.9': + dependencies: + '@babel/types': 7.26.3 + + '@babel/helper-compilation-targets@7.25.9': + dependencies: + '@babel/compat-data': 7.26.3 + '@babel/helper-validator-option': 7.25.9 + browserslist: 4.24.2 + lru-cache: 5.1.1 + semver: 6.3.1 + + '@babel/helper-create-class-features-plugin@7.25.9(@babel/core@7.26.0)': + dependencies: + '@babel/core': 7.26.0 + '@babel/helper-annotate-as-pure': 7.25.9 + '@babel/helper-member-expression-to-functions': 7.25.9 + '@babel/helper-optimise-call-expression': 7.25.9 + '@babel/helper-replace-supers': 7.25.9(@babel/core@7.26.0) + '@babel/helper-skip-transparent-expression-wrappers': 7.25.9 + '@babel/traverse': 7.26.4 + semver: 6.3.1 + transitivePeerDependencies: + - supports-color + + '@babel/helper-create-regexp-features-plugin@7.26.3(@babel/core@7.26.0)': + dependencies: + '@babel/core': 7.26.0 + '@babel/helper-annotate-as-pure': 7.25.9 + regexpu-core: 6.2.0 + semver: 6.3.1 + + '@babel/helper-define-polyfill-provider@0.6.3(@babel/core@7.26.0)': + dependencies: + '@babel/core': 7.26.0 + '@babel/helper-compilation-targets': 7.25.9 + '@babel/helper-plugin-utils': 7.25.9 + debug: 4.3.3 + lodash.debounce: 4.0.8 + resolve: 1.21.0 + transitivePeerDependencies: + - supports-color + + '@babel/helper-member-expression-to-functions@7.25.9': + dependencies: + '@babel/traverse': 7.26.4 + '@babel/types': 7.26.3 + transitivePeerDependencies: + - supports-color + + '@babel/helper-module-imports@7.25.9': + dependencies: + '@babel/traverse': 7.26.4 + '@babel/types': 7.26.3 + transitivePeerDependencies: + - supports-color + + '@babel/helper-module-transforms@7.26.0(@babel/core@7.26.0)': + dependencies: + '@babel/core': 7.26.0 + '@babel/helper-module-imports': 7.25.9 + '@babel/helper-validator-identifier': 7.25.9 + '@babel/traverse': 7.26.4 + transitivePeerDependencies: + - supports-color + + '@babel/helper-optimise-call-expression@7.25.9': + dependencies: + '@babel/types': 7.26.3 + + '@babel/helper-plugin-utils@7.25.9': {} + + '@babel/helper-remap-async-to-generator@7.25.9(@babel/core@7.26.0)': + dependencies: + '@babel/core': 7.26.0 + '@babel/helper-annotate-as-pure': 7.25.9 + '@babel/helper-wrap-function': 7.25.9 + '@babel/traverse': 7.26.4 + transitivePeerDependencies: + - supports-color + + '@babel/helper-replace-supers@7.25.9(@babel/core@7.26.0)': + dependencies: + '@babel/core': 7.26.0 + '@babel/helper-member-expression-to-functions': 7.25.9 + '@babel/helper-optimise-call-expression': 7.25.9 + '@babel/traverse': 7.26.4 + transitivePeerDependencies: + - supports-color + + '@babel/helper-skip-transparent-expression-wrappers@7.25.9': + dependencies: + '@babel/traverse': 7.26.4 + '@babel/types': 7.26.3 + transitivePeerDependencies: + - supports-color + + '@babel/helper-string-parser@7.25.9': {} + + '@babel/helper-validator-identifier@7.25.9': {} + + '@babel/helper-validator-option@7.25.9': {} + + '@babel/helper-wrap-function@7.25.9': + dependencies: + '@babel/template': 7.25.9 + '@babel/traverse': 7.26.4 + '@babel/types': 7.26.3 + transitivePeerDependencies: + - supports-color + + '@babel/helpers@7.26.0': + dependencies: + '@babel/template': 7.25.9 + '@babel/types': 7.26.3 + + '@babel/highlight@7.16.7': + dependencies: + '@babel/helper-validator-identifier': 7.25.9 + chalk: 2.4.2 + js-tokens: 4.0.0 + + '@babel/parser@7.26.3': + dependencies: + '@babel/types': 7.26.3 + + '@babel/plugin-bugfix-firefox-class-in-computed-class-key@7.25.9(@babel/core@7.26.0)': + dependencies: + '@babel/core': 7.26.0 + '@babel/helper-plugin-utils': 7.25.9 + '@babel/traverse': 7.26.4 + transitivePeerDependencies: + - supports-color + + '@babel/plugin-bugfix-safari-class-field-initializer-scope@7.25.9(@babel/core@7.26.0)': + dependencies: + '@babel/core': 7.26.0 + '@babel/helper-plugin-utils': 7.25.9 + + '@babel/plugin-bugfix-safari-id-destructuring-collision-in-function-expression@7.25.9(@babel/core@7.26.0)': + dependencies: + '@babel/core': 7.26.0 + '@babel/helper-plugin-utils': 7.25.9 + + '@babel/plugin-bugfix-v8-spread-parameters-in-optional-chaining@7.25.9(@babel/core@7.26.0)': + dependencies: + '@babel/core': 7.26.0 + '@babel/helper-plugin-utils': 7.25.9 + '@babel/helper-skip-transparent-expression-wrappers': 7.25.9 + '@babel/plugin-transform-optional-chaining': 7.25.9(@babel/core@7.26.0) + transitivePeerDependencies: + - supports-color + + '@babel/plugin-bugfix-v8-static-class-fields-redefine-readonly@7.25.9(@babel/core@7.26.0)': + dependencies: + '@babel/core': 7.26.0 + '@babel/helper-plugin-utils': 7.25.9 + '@babel/traverse': 7.26.4 + transitivePeerDependencies: + - supports-color + + '@babel/plugin-proposal-class-properties@7.16.7(@babel/core@7.26.0)': + dependencies: + '@babel/core': 7.26.0 + '@babel/helper-create-class-features-plugin': 7.25.9(@babel/core@7.26.0) + '@babel/helper-plugin-utils': 7.25.9 + transitivePeerDependencies: + - supports-color + + '@babel/plugin-proposal-private-property-in-object@7.21.0-placeholder-for-preset-env.2(@babel/core@7.26.0)': + dependencies: + '@babel/core': 7.26.0 + + '@babel/plugin-syntax-import-assertions@7.26.0(@babel/core@7.26.0)': + dependencies: + '@babel/core': 7.26.0 + '@babel/helper-plugin-utils': 7.25.9 + + '@babel/plugin-syntax-import-attributes@7.26.0(@babel/core@7.26.0)': + dependencies: + '@babel/core': 7.26.0 + '@babel/helper-plugin-utils': 7.25.9 + + '@babel/plugin-syntax-unicode-sets-regex@7.18.6(@babel/core@7.26.0)': + dependencies: + '@babel/core': 7.26.0 + '@babel/helper-create-regexp-features-plugin': 7.26.3(@babel/core@7.26.0) + '@babel/helper-plugin-utils': 7.25.9 + + '@babel/plugin-transform-arrow-functions@7.25.9(@babel/core@7.26.0)': + dependencies: + '@babel/core': 7.26.0 + '@babel/helper-plugin-utils': 7.25.9 + + '@babel/plugin-transform-async-generator-functions@7.25.9(@babel/core@7.26.0)': + dependencies: + '@babel/core': 7.26.0 + '@babel/helper-plugin-utils': 7.25.9 + '@babel/helper-remap-async-to-generator': 7.25.9(@babel/core@7.26.0) + '@babel/traverse': 7.26.4 + transitivePeerDependencies: + - supports-color + + '@babel/plugin-transform-async-to-generator@7.25.9(@babel/core@7.26.0)': + dependencies: + '@babel/core': 7.26.0 + '@babel/helper-module-imports': 7.25.9 + '@babel/helper-plugin-utils': 7.25.9 + '@babel/helper-remap-async-to-generator': 7.25.9(@babel/core@7.26.0) + transitivePeerDependencies: + - supports-color + + '@babel/plugin-transform-block-scoped-functions@7.25.9(@babel/core@7.26.0)': + dependencies: + '@babel/core': 7.26.0 + '@babel/helper-plugin-utils': 7.25.9 + + '@babel/plugin-transform-block-scoping@7.25.9(@babel/core@7.26.0)': + dependencies: + '@babel/core': 7.26.0 + '@babel/helper-plugin-utils': 7.25.9 + + '@babel/plugin-transform-class-properties@7.25.9(@babel/core@7.26.0)': + dependencies: + '@babel/core': 7.26.0 + '@babel/helper-create-class-features-plugin': 7.25.9(@babel/core@7.26.0) + '@babel/helper-plugin-utils': 7.25.9 + transitivePeerDependencies: + - supports-color + + '@babel/plugin-transform-class-static-block@7.26.0(@babel/core@7.26.0)': + dependencies: + '@babel/core': 7.26.0 + '@babel/helper-create-class-features-plugin': 7.25.9(@babel/core@7.26.0) + '@babel/helper-plugin-utils': 7.25.9 + transitivePeerDependencies: + - supports-color + + '@babel/plugin-transform-classes@7.25.9(@babel/core@7.26.0)': + dependencies: + '@babel/core': 7.26.0 + '@babel/helper-annotate-as-pure': 7.25.9 + '@babel/helper-compilation-targets': 7.25.9 + '@babel/helper-plugin-utils': 7.25.9 + '@babel/helper-replace-supers': 7.25.9(@babel/core@7.26.0) + '@babel/traverse': 7.26.4 + globals: 11.12.0 + transitivePeerDependencies: + - supports-color + + '@babel/plugin-transform-computed-properties@7.25.9(@babel/core@7.26.0)': + dependencies: + '@babel/core': 7.26.0 + '@babel/helper-plugin-utils': 7.25.9 + '@babel/template': 7.25.9 + + '@babel/plugin-transform-destructuring@7.25.9(@babel/core@7.26.0)': + dependencies: + '@babel/core': 7.26.0 + '@babel/helper-plugin-utils': 7.25.9 + + '@babel/plugin-transform-dotall-regex@7.25.9(@babel/core@7.26.0)': + dependencies: + '@babel/core': 7.26.0 + '@babel/helper-create-regexp-features-plugin': 7.26.3(@babel/core@7.26.0) + '@babel/helper-plugin-utils': 7.25.9 + + '@babel/plugin-transform-duplicate-keys@7.25.9(@babel/core@7.26.0)': + dependencies: + '@babel/core': 7.26.0 + '@babel/helper-plugin-utils': 7.25.9 + + '@babel/plugin-transform-duplicate-named-capturing-groups-regex@7.25.9(@babel/core@7.26.0)': + dependencies: + '@babel/core': 7.26.0 + '@babel/helper-create-regexp-features-plugin': 7.26.3(@babel/core@7.26.0) + '@babel/helper-plugin-utils': 7.25.9 + + '@babel/plugin-transform-dynamic-import@7.25.9(@babel/core@7.26.0)': + dependencies: + '@babel/core': 7.26.0 + '@babel/helper-plugin-utils': 7.25.9 + + '@babel/plugin-transform-exponentiation-operator@7.26.3(@babel/core@7.26.0)': + dependencies: + '@babel/core': 7.26.0 + '@babel/helper-plugin-utils': 7.25.9 + + '@babel/plugin-transform-export-namespace-from@7.25.9(@babel/core@7.26.0)': + dependencies: + '@babel/core': 7.26.0 + '@babel/helper-plugin-utils': 7.25.9 + + '@babel/plugin-transform-for-of@7.25.9(@babel/core@7.26.0)': + dependencies: + '@babel/core': 7.26.0 + '@babel/helper-plugin-utils': 7.25.9 + '@babel/helper-skip-transparent-expression-wrappers': 7.25.9 + transitivePeerDependencies: + - supports-color + + '@babel/plugin-transform-function-name@7.25.9(@babel/core@7.26.0)': + dependencies: + '@babel/core': 7.26.0 + '@babel/helper-compilation-targets': 7.25.9 + '@babel/helper-plugin-utils': 7.25.9 + '@babel/traverse': 7.26.4 + transitivePeerDependencies: + - supports-color + + '@babel/plugin-transform-json-strings@7.25.9(@babel/core@7.26.0)': + dependencies: + '@babel/core': 7.26.0 + '@babel/helper-plugin-utils': 7.25.9 + + '@babel/plugin-transform-literals@7.25.9(@babel/core@7.26.0)': + dependencies: + '@babel/core': 7.26.0 + '@babel/helper-plugin-utils': 7.25.9 + + '@babel/plugin-transform-logical-assignment-operators@7.25.9(@babel/core@7.26.0)': + dependencies: + '@babel/core': 7.26.0 + '@babel/helper-plugin-utils': 7.25.9 + + '@babel/plugin-transform-member-expression-literals@7.25.9(@babel/core@7.26.0)': + dependencies: + '@babel/core': 7.26.0 + '@babel/helper-plugin-utils': 7.25.9 + + '@babel/plugin-transform-modules-amd@7.25.9(@babel/core@7.26.0)': + dependencies: + '@babel/core': 7.26.0 + '@babel/helper-module-transforms': 7.26.0(@babel/core@7.26.0) + '@babel/helper-plugin-utils': 7.25.9 + transitivePeerDependencies: + - supports-color + + '@babel/plugin-transform-modules-commonjs@7.26.3(@babel/core@7.26.0)': + dependencies: + '@babel/core': 7.26.0 + '@babel/helper-module-transforms': 7.26.0(@babel/core@7.26.0) + '@babel/helper-plugin-utils': 7.25.9 + transitivePeerDependencies: + - supports-color + + '@babel/plugin-transform-modules-systemjs@7.25.9(@babel/core@7.26.0)': + dependencies: + '@babel/core': 7.26.0 + '@babel/helper-module-transforms': 7.26.0(@babel/core@7.26.0) + '@babel/helper-plugin-utils': 7.25.9 + '@babel/helper-validator-identifier': 7.25.9 + '@babel/traverse': 7.26.4 + transitivePeerDependencies: + - supports-color + + '@babel/plugin-transform-modules-umd@7.25.9(@babel/core@7.26.0)': + dependencies: + '@babel/core': 7.26.0 + '@babel/helper-module-transforms': 7.26.0(@babel/core@7.26.0) + '@babel/helper-plugin-utils': 7.25.9 + transitivePeerDependencies: + - supports-color + + '@babel/plugin-transform-named-capturing-groups-regex@7.25.9(@babel/core@7.26.0)': + dependencies: + '@babel/core': 7.26.0 + '@babel/helper-create-regexp-features-plugin': 7.26.3(@babel/core@7.26.0) + '@babel/helper-plugin-utils': 7.25.9 + + '@babel/plugin-transform-new-target@7.25.9(@babel/core@7.26.0)': + dependencies: + '@babel/core': 7.26.0 + '@babel/helper-plugin-utils': 7.25.9 + + '@babel/plugin-transform-nullish-coalescing-operator@7.25.9(@babel/core@7.26.0)': + dependencies: + '@babel/core': 7.26.0 + '@babel/helper-plugin-utils': 7.25.9 + + '@babel/plugin-transform-numeric-separator@7.25.9(@babel/core@7.26.0)': + dependencies: + '@babel/core': 7.26.0 + '@babel/helper-plugin-utils': 7.25.9 + + '@babel/plugin-transform-object-rest-spread@7.25.9(@babel/core@7.26.0)': + dependencies: + '@babel/core': 7.26.0 + '@babel/helper-compilation-targets': 7.25.9 + '@babel/helper-plugin-utils': 7.25.9 + '@babel/plugin-transform-parameters': 7.25.9(@babel/core@7.26.0) + + '@babel/plugin-transform-object-super@7.25.9(@babel/core@7.26.0)': + dependencies: + '@babel/core': 7.26.0 + '@babel/helper-plugin-utils': 7.25.9 + '@babel/helper-replace-supers': 7.25.9(@babel/core@7.26.0) + transitivePeerDependencies: + - supports-color + + '@babel/plugin-transform-optional-catch-binding@7.25.9(@babel/core@7.26.0)': + dependencies: + '@babel/core': 7.26.0 + '@babel/helper-plugin-utils': 7.25.9 + + '@babel/plugin-transform-optional-chaining@7.25.9(@babel/core@7.26.0)': + dependencies: + '@babel/core': 7.26.0 + '@babel/helper-plugin-utils': 7.25.9 + '@babel/helper-skip-transparent-expression-wrappers': 7.25.9 + transitivePeerDependencies: + - supports-color + + '@babel/plugin-transform-parameters@7.25.9(@babel/core@7.26.0)': + dependencies: + '@babel/core': 7.26.0 + '@babel/helper-plugin-utils': 7.25.9 + + '@babel/plugin-transform-private-methods@7.25.9(@babel/core@7.26.0)': + dependencies: + '@babel/core': 7.26.0 + '@babel/helper-create-class-features-plugin': 7.25.9(@babel/core@7.26.0) + '@babel/helper-plugin-utils': 7.25.9 + transitivePeerDependencies: + - supports-color + + '@babel/plugin-transform-private-property-in-object@7.25.9(@babel/core@7.26.0)': + dependencies: + '@babel/core': 7.26.0 + '@babel/helper-annotate-as-pure': 7.25.9 + '@babel/helper-create-class-features-plugin': 7.25.9(@babel/core@7.26.0) + '@babel/helper-plugin-utils': 7.25.9 + transitivePeerDependencies: + - supports-color + + '@babel/plugin-transform-property-literals@7.25.9(@babel/core@7.26.0)': + dependencies: + '@babel/core': 7.26.0 + '@babel/helper-plugin-utils': 7.25.9 + + '@babel/plugin-transform-regenerator@7.25.9(@babel/core@7.26.0)': + dependencies: + '@babel/core': 7.26.0 + '@babel/helper-plugin-utils': 7.25.9 + regenerator-transform: 0.15.2 + + '@babel/plugin-transform-regexp-modifiers@7.26.0(@babel/core@7.26.0)': + dependencies: + '@babel/core': 7.26.0 + '@babel/helper-create-regexp-features-plugin': 7.26.3(@babel/core@7.26.0) + '@babel/helper-plugin-utils': 7.25.9 + + '@babel/plugin-transform-reserved-words@7.25.9(@babel/core@7.26.0)': + dependencies: + '@babel/core': 7.26.0 + '@babel/helper-plugin-utils': 7.25.9 + + '@babel/plugin-transform-shorthand-properties@7.25.9(@babel/core@7.26.0)': + dependencies: + '@babel/core': 7.26.0 + '@babel/helper-plugin-utils': 7.25.9 + + '@babel/plugin-transform-spread@7.25.9(@babel/core@7.26.0)': + dependencies: + '@babel/core': 7.26.0 + '@babel/helper-plugin-utils': 7.25.9 + '@babel/helper-skip-transparent-expression-wrappers': 7.25.9 + transitivePeerDependencies: + - supports-color + + '@babel/plugin-transform-sticky-regex@7.25.9(@babel/core@7.26.0)': + dependencies: + '@babel/core': 7.26.0 + '@babel/helper-plugin-utils': 7.25.9 + + '@babel/plugin-transform-template-literals@7.25.9(@babel/core@7.26.0)': + dependencies: + '@babel/core': 7.26.0 + '@babel/helper-plugin-utils': 7.25.9 + + '@babel/plugin-transform-typeof-symbol@7.25.9(@babel/core@7.26.0)': + dependencies: + '@babel/core': 7.26.0 + '@babel/helper-plugin-utils': 7.25.9 + + '@babel/plugin-transform-unicode-escapes@7.25.9(@babel/core@7.26.0)': + dependencies: + '@babel/core': 7.26.0 + '@babel/helper-plugin-utils': 7.25.9 + + '@babel/plugin-transform-unicode-property-regex@7.25.9(@babel/core@7.26.0)': + dependencies: + '@babel/core': 7.26.0 + '@babel/helper-create-regexp-features-plugin': 7.26.3(@babel/core@7.26.0) + '@babel/helper-plugin-utils': 7.25.9 + + '@babel/plugin-transform-unicode-regex@7.25.9(@babel/core@7.26.0)': + dependencies: + '@babel/core': 7.26.0 + '@babel/helper-create-regexp-features-plugin': 7.26.3(@babel/core@7.26.0) + '@babel/helper-plugin-utils': 7.25.9 + + '@babel/plugin-transform-unicode-sets-regex@7.25.9(@babel/core@7.26.0)': + dependencies: + '@babel/core': 7.26.0 + '@babel/helper-create-regexp-features-plugin': 7.26.3(@babel/core@7.26.0) + '@babel/helper-plugin-utils': 7.25.9 + + '@babel/preset-env@7.26.0(@babel/core@7.26.0)': + dependencies: + '@babel/compat-data': 7.26.3 + '@babel/core': 7.26.0 + '@babel/helper-compilation-targets': 7.25.9 + '@babel/helper-plugin-utils': 7.25.9 + '@babel/helper-validator-option': 7.25.9 + '@babel/plugin-bugfix-firefox-class-in-computed-class-key': 7.25.9(@babel/core@7.26.0) + '@babel/plugin-bugfix-safari-class-field-initializer-scope': 7.25.9(@babel/core@7.26.0) + '@babel/plugin-bugfix-safari-id-destructuring-collision-in-function-expression': 7.25.9(@babel/core@7.26.0) + '@babel/plugin-bugfix-v8-spread-parameters-in-optional-chaining': 7.25.9(@babel/core@7.26.0) + '@babel/plugin-bugfix-v8-static-class-fields-redefine-readonly': 7.25.9(@babel/core@7.26.0) + '@babel/plugin-proposal-private-property-in-object': 7.21.0-placeholder-for-preset-env.2(@babel/core@7.26.0) + '@babel/plugin-syntax-import-assertions': 7.26.0(@babel/core@7.26.0) + '@babel/plugin-syntax-import-attributes': 7.26.0(@babel/core@7.26.0) + '@babel/plugin-syntax-unicode-sets-regex': 7.18.6(@babel/core@7.26.0) + '@babel/plugin-transform-arrow-functions': 7.25.9(@babel/core@7.26.0) + '@babel/plugin-transform-async-generator-functions': 7.25.9(@babel/core@7.26.0) + '@babel/plugin-transform-async-to-generator': 7.25.9(@babel/core@7.26.0) + '@babel/plugin-transform-block-scoped-functions': 7.25.9(@babel/core@7.26.0) + '@babel/plugin-transform-block-scoping': 7.25.9(@babel/core@7.26.0) + '@babel/plugin-transform-class-properties': 7.25.9(@babel/core@7.26.0) + '@babel/plugin-transform-class-static-block': 7.26.0(@babel/core@7.26.0) + '@babel/plugin-transform-classes': 7.25.9(@babel/core@7.26.0) + '@babel/plugin-transform-computed-properties': 7.25.9(@babel/core@7.26.0) + '@babel/plugin-transform-destructuring': 7.25.9(@babel/core@7.26.0) + '@babel/plugin-transform-dotall-regex': 7.25.9(@babel/core@7.26.0) + '@babel/plugin-transform-duplicate-keys': 7.25.9(@babel/core@7.26.0) + '@babel/plugin-transform-duplicate-named-capturing-groups-regex': 7.25.9(@babel/core@7.26.0) + '@babel/plugin-transform-dynamic-import': 7.25.9(@babel/core@7.26.0) + '@babel/plugin-transform-exponentiation-operator': 7.26.3(@babel/core@7.26.0) + '@babel/plugin-transform-export-namespace-from': 7.25.9(@babel/core@7.26.0) + '@babel/plugin-transform-for-of': 7.25.9(@babel/core@7.26.0) + '@babel/plugin-transform-function-name': 7.25.9(@babel/core@7.26.0) + '@babel/plugin-transform-json-strings': 7.25.9(@babel/core@7.26.0) + '@babel/plugin-transform-literals': 7.25.9(@babel/core@7.26.0) + '@babel/plugin-transform-logical-assignment-operators': 7.25.9(@babel/core@7.26.0) + '@babel/plugin-transform-member-expression-literals': 7.25.9(@babel/core@7.26.0) + '@babel/plugin-transform-modules-amd': 7.25.9(@babel/core@7.26.0) + '@babel/plugin-transform-modules-commonjs': 7.26.3(@babel/core@7.26.0) + '@babel/plugin-transform-modules-systemjs': 7.25.9(@babel/core@7.26.0) + '@babel/plugin-transform-modules-umd': 7.25.9(@babel/core@7.26.0) + '@babel/plugin-transform-named-capturing-groups-regex': 7.25.9(@babel/core@7.26.0) + '@babel/plugin-transform-new-target': 7.25.9(@babel/core@7.26.0) + '@babel/plugin-transform-nullish-coalescing-operator': 7.25.9(@babel/core@7.26.0) + '@babel/plugin-transform-numeric-separator': 7.25.9(@babel/core@7.26.0) + '@babel/plugin-transform-object-rest-spread': 7.25.9(@babel/core@7.26.0) + '@babel/plugin-transform-object-super': 7.25.9(@babel/core@7.26.0) + '@babel/plugin-transform-optional-catch-binding': 7.25.9(@babel/core@7.26.0) + '@babel/plugin-transform-optional-chaining': 7.25.9(@babel/core@7.26.0) + '@babel/plugin-transform-parameters': 7.25.9(@babel/core@7.26.0) + '@babel/plugin-transform-private-methods': 7.25.9(@babel/core@7.26.0) + '@babel/plugin-transform-private-property-in-object': 7.25.9(@babel/core@7.26.0) + '@babel/plugin-transform-property-literals': 7.25.9(@babel/core@7.26.0) + '@babel/plugin-transform-regenerator': 7.25.9(@babel/core@7.26.0) + '@babel/plugin-transform-regexp-modifiers': 7.26.0(@babel/core@7.26.0) + '@babel/plugin-transform-reserved-words': 7.25.9(@babel/core@7.26.0) + '@babel/plugin-transform-shorthand-properties': 7.25.9(@babel/core@7.26.0) + '@babel/plugin-transform-spread': 7.25.9(@babel/core@7.26.0) + '@babel/plugin-transform-sticky-regex': 7.25.9(@babel/core@7.26.0) + '@babel/plugin-transform-template-literals': 7.25.9(@babel/core@7.26.0) + '@babel/plugin-transform-typeof-symbol': 7.25.9(@babel/core@7.26.0) + '@babel/plugin-transform-unicode-escapes': 7.25.9(@babel/core@7.26.0) + '@babel/plugin-transform-unicode-property-regex': 7.25.9(@babel/core@7.26.0) + '@babel/plugin-transform-unicode-regex': 7.25.9(@babel/core@7.26.0) + '@babel/plugin-transform-unicode-sets-regex': 7.25.9(@babel/core@7.26.0) + '@babel/preset-modules': 0.1.6-no-external-plugins(@babel/core@7.26.0) + babel-plugin-polyfill-corejs2: 0.4.12(@babel/core@7.26.0) + babel-plugin-polyfill-corejs3: 0.10.6(@babel/core@7.26.0) + babel-plugin-polyfill-regenerator: 0.6.3(@babel/core@7.26.0) + core-js-compat: 3.39.0 + semver: 6.3.1 + transitivePeerDependencies: + - supports-color + + '@babel/preset-modules@0.1.6-no-external-plugins(@babel/core@7.26.0)': + dependencies: + '@babel/core': 7.26.0 + '@babel/helper-plugin-utils': 7.25.9 + '@babel/types': 7.26.3 + esutils: 2.0.3 + + '@babel/runtime@7.16.7': + dependencies: + regenerator-runtime: 0.13.9 + + '@babel/template@7.25.9': + dependencies: + '@babel/code-frame': 7.26.2 + '@babel/parser': 7.26.3 + '@babel/types': 7.26.3 + + '@babel/traverse@7.26.4': + dependencies: + '@babel/code-frame': 7.26.2 + '@babel/generator': 7.26.3 + '@babel/parser': 7.26.3 + '@babel/template': 7.25.9 + '@babel/types': 7.26.3 + debug: 4.3.3 + globals: 11.12.0 + transitivePeerDependencies: + - supports-color + + '@babel/types@7.26.3': + dependencies: + '@babel/helper-string-parser': 7.25.9 + '@babel/helper-validator-identifier': 7.25.9 + + '@eslint/eslintrc@0.4.3': + dependencies: + ajv: 6.12.6 + debug: 4.3.3 + espree: 7.3.1 + globals: 13.12.0 + ignore: 4.0.6 + import-fresh: 3.3.0 + js-yaml: 3.14.1 + minimatch: 3.0.4 + strip-json-comments: 3.1.1 + transitivePeerDependencies: + - supports-color + + '@gar/promisify@1.1.2': {} + + '@humanwhocodes/config-array@0.5.0': + dependencies: + '@humanwhocodes/object-schema': 1.2.1 + debug: 4.3.3 + minimatch: 3.0.4 + transitivePeerDependencies: + - supports-color + + '@humanwhocodes/object-schema@1.2.1': {} + + '@jridgewell/gen-mapping@0.3.5': + dependencies: + '@jridgewell/set-array': 1.2.1 + '@jridgewell/sourcemap-codec': 1.5.0 + '@jridgewell/trace-mapping': 0.3.25 + + '@jridgewell/resolve-uri@3.1.2': {} + + '@jridgewell/set-array@1.2.1': {} + + '@jridgewell/sourcemap-codec@1.5.0': {} + + '@jridgewell/trace-mapping@0.3.25': + dependencies: + '@jridgewell/resolve-uri': 3.1.2 + '@jridgewell/sourcemap-codec': 1.5.0 + + '@npmcli/fs@1.1.0': + dependencies: + '@gar/promisify': 1.1.2 + semver: 7.3.5 + + '@npmcli/git@2.1.0': + dependencies: + '@npmcli/promise-spawn': 1.3.2 + lru-cache: 6.0.0 + mkdirp: 1.0.4 + npm-pick-manifest: 6.1.1 + promise-inflight: 1.0.1 + promise-retry: 2.0.1 + semver: 7.3.5 + which: 2.0.2 + transitivePeerDependencies: + - bluebird + + '@npmcli/installed-package-contents@1.0.7': + dependencies: + npm-bundled: 1.1.2 + npm-normalize-package-bin: 1.0.1 + + '@npmcli/move-file@1.1.2': + dependencies: + mkdirp: 1.0.4 + rimraf: 3.0.2 + + '@npmcli/node-gyp@1.0.3': {} + + '@npmcli/promise-spawn@1.3.2': + dependencies: + infer-owner: 1.0.4 + + '@npmcli/run-script@1.8.6': + dependencies: + '@npmcli/node-gyp': 1.0.3 + '@npmcli/promise-spawn': 1.3.2 + node-gyp: 7.1.2 + read-package-json-fast: 2.0.3 + + '@rollup/plugin-babel@5.3.1(@babel/core@7.26.0)(rollup@2.64.0)': + dependencies: + '@babel/core': 7.26.0 + '@babel/helper-module-imports': 7.25.9 + '@rollup/pluginutils': 3.1.0(rollup@2.64.0) + rollup: 2.64.0 + transitivePeerDependencies: + - supports-color + + '@rollup/plugin-node-resolve@13.1.3(rollup@2.64.0)': + dependencies: + '@rollup/pluginutils': 3.1.0(rollup@2.64.0) + '@types/resolve': 1.17.1 + builtin-modules: 3.2.0 + deepmerge: 4.2.2 + is-module: 1.0.0 + resolve: 1.21.0 + rollup: 2.64.0 + + '@rollup/pluginutils@3.1.0(rollup@2.64.0)': + dependencies: + '@types/estree': 0.0.39 + estree-walker: 1.0.1 + picomatch: 2.3.1 + rollup: 2.64.0 + + '@tootallnate/once@1.1.2': {} + + '@types/estree@0.0.39': {} + + '@types/node@17.0.10': {} + + '@types/resolve@1.17.1': + dependencies: + '@types/node': 17.0.10 + + abbrev@1.1.1: {} + + accepts@1.3.7: + dependencies: + mime-types: 2.1.34 + negotiator: 0.6.2 + + acorn-jsx@5.3.2(acorn@7.4.1): + dependencies: + acorn: 7.4.1 + + acorn@7.4.1: {} + + agent-base@6.0.2: + dependencies: + debug: 4.3.3 + transitivePeerDependencies: + - supports-color + + agentkeepalive@4.2.0: + dependencies: + debug: 4.3.3 + depd: 1.1.2 + humanize-ms: 1.2.1 + transitivePeerDependencies: + - supports-color + + aggregate-error@3.1.0: + dependencies: + clean-stack: 2.2.0 + indent-string: 4.0.0 + + ajv@6.12.6: + dependencies: + fast-deep-equal: 3.1.3 + fast-json-stable-stringify: 2.1.0 + json-schema-traverse: 0.4.1 + uri-js: 4.4.1 + + ajv@8.9.0: + dependencies: + fast-deep-equal: 3.1.3 + json-schema-traverse: 1.0.0 + require-from-string: 2.0.2 + uri-js: 4.4.1 + + ansi-align@3.0.1: + dependencies: + string-width: 4.2.3 + + ansi-colors@4.1.1: {} + + ansi-regex@2.1.1: {} + + ansi-regex@5.0.1: {} + + ansi-styles@3.2.1: + dependencies: + color-convert: 1.9.3 + + ansi-styles@4.3.0: + dependencies: + color-convert: 2.0.1 + + aproba@1.2.0: {} + + are-we-there-yet@1.1.7: + dependencies: + delegates: 1.0.0 + readable-stream: 2.3.7 + + argparse@1.0.10: + dependencies: + sprintf-js: 1.0.3 + + array-flatten@1.1.1: {} + + asn1@0.2.6: + dependencies: + safer-buffer: 2.1.2 + + assert-plus@1.0.0: {} + + astral-regex@2.0.0: {} + + asynckit@0.4.0: {} + + aws-sign2@0.7.0: {} + + aws4@1.11.0: {} + + babel-plugin-polyfill-corejs2@0.4.12(@babel/core@7.26.0): + dependencies: + '@babel/compat-data': 7.26.3 + '@babel/core': 7.26.0 + '@babel/helper-define-polyfill-provider': 0.6.3(@babel/core@7.26.0) + semver: 6.3.1 + transitivePeerDependencies: + - supports-color + + babel-plugin-polyfill-corejs3@0.10.6(@babel/core@7.26.0): + dependencies: + '@babel/core': 7.26.0 + '@babel/helper-define-polyfill-provider': 0.6.3(@babel/core@7.26.0) + core-js-compat: 3.39.0 + transitivePeerDependencies: + - supports-color + + babel-plugin-polyfill-regenerator@0.6.3(@babel/core@7.26.0): + dependencies: + '@babel/core': 7.26.0 + '@babel/helper-define-polyfill-provider': 0.6.3(@babel/core@7.26.0) + transitivePeerDependencies: + - supports-color + + balanced-match@1.0.2: {} + + basic-auth@2.0.1: + dependencies: + safe-buffer: 5.1.2 + + batch@0.6.1: {} + + bcrypt-pbkdf@1.0.2: + dependencies: + tweetnacl: 0.14.5 + + body-parser@1.19.1: + dependencies: + bytes: 3.1.1 + content-type: 1.0.4 + debug: 2.6.9 + depd: 1.1.2 + http-errors: 1.8.1 + iconv-lite: 0.4.24 + on-finished: 2.3.0 + qs: 6.9.6 + raw-body: 2.4.2 + type-is: 1.6.18 + transitivePeerDependencies: + - supports-color + + boxen@5.1.2: + dependencies: + ansi-align: 3.0.1 + camelcase: 6.3.0 + chalk: 4.1.2 + cli-boxes: 2.2.1 + string-width: 4.2.3 + type-fest: 0.20.2 + widest-line: 3.1.0 + wrap-ansi: 7.0.0 + + brace-expansion@1.1.11: + dependencies: + balanced-match: 1.0.2 + concat-map: 0.0.1 + + brotli-size@4.0.0: + dependencies: + duplexer: 0.1.1 + + browserslist@4.24.2: + dependencies: + caniuse-lite: 1.0.30001687 + electron-to-chromium: 1.5.72 + node-releases: 2.0.19 + update-browserslist-db: 1.1.1(browserslist@4.24.2) + + buffer-from@1.1.2: {} + + builtin-modules@3.2.0: {} + + builtins@1.0.3: {} + + bytes@3.1.1: {} + + cacache@15.3.0: + dependencies: + '@npmcli/fs': 1.1.0 + '@npmcli/move-file': 1.1.2 + chownr: 2.0.0 + fs-minipass: 2.1.0 + glob: 7.2.0 + infer-owner: 1.0.4 + lru-cache: 6.0.0 + minipass: 3.1.6 + minipass-collect: 1.0.2 + minipass-flush: 1.0.5 + minipass-pipeline: 1.2.4 + mkdirp: 1.0.4 + p-map: 4.0.0 + promise-inflight: 1.0.1 + rimraf: 3.0.2 + ssri: 8.0.1 + tar: 6.1.11 + unique-filename: 1.1.1 + transitivePeerDependencies: + - bluebird + + callsites@3.1.0: {} + + camelcase@6.3.0: {} + + caniuse-lite@1.0.30001687: {} + + caseless@0.12.0: {} + + chalk@2.4.2: + dependencies: + ansi-styles: 3.2.1 + escape-string-regexp: 1.0.5 + supports-color: 5.5.0 + + chalk@4.1.2: + dependencies: + ansi-styles: 4.3.0 + supports-color: 7.2.0 + + chownr@2.0.0: {} + + clean-stack@2.2.0: {} + + cli-boxes@2.2.1: {} + + cliui@7.0.4: + dependencies: + string-width: 4.2.3 + strip-ansi: 6.0.1 + wrap-ansi: 7.0.0 + + code-point-at@1.1.0: {} + + color-convert@1.9.3: + dependencies: + color-name: 1.1.3 + + color-convert@2.0.1: + dependencies: + color-name: 1.1.4 + + color-name@1.1.3: {} + + color-name@1.1.4: {} + + color-support@1.1.3: {} + + colors@1.4.0: {} + + combined-stream@1.0.8: + dependencies: + delayed-stream: 1.0.0 + + commander@2.20.3: {} + + concat-map@0.0.1: {} + + concurrently@6.5.1: + dependencies: + chalk: 4.1.2 + date-fns: 2.28.0 + lodash: 4.17.21 + rxjs: 6.6.7 + spawn-command: 0.0.2-1 + supports-color: 8.1.1 + tree-kill: 1.2.2 + yargs: 16.2.0 + + console-control-strings@1.1.0: {} + + content-disposition@0.5.4: + dependencies: + safe-buffer: 5.2.1 + + content-type@1.0.4: {} + + convert-source-map@2.0.0: {} + + cookie-signature@1.0.6: {} + + cookie@0.4.1: {} + + core-js-compat@3.39.0: + dependencies: + browserslist: 4.24.2 + + core-util-is@1.0.2: {} + + core-util-is@1.0.3: {} + + cors@2.8.5: + dependencies: + object-assign: 4.1.1 + vary: 1.1.2 + + cross-spawn@7.0.3: + dependencies: + path-key: 3.1.1 + shebang-command: 2.0.0 + which: 2.0.2 + + dashdash@1.14.1: + dependencies: + assert-plus: 1.0.0 + + date-fns@2.28.0: {} + + debug@2.6.9: + dependencies: + ms: 2.0.0 + + debug@4.3.3: + dependencies: + ms: 2.1.2 + + deep-is@0.1.4: {} + + deepmerge@4.2.2: {} + + define-lazy-prop@2.0.0: {} + + delayed-stream@1.0.0: {} + + delegates@1.0.0: {} + + depd@1.1.2: {} + + destroy@1.0.4: {} + + doctrine@3.0.0: + dependencies: + esutils: 2.0.3 + + dom-serializer@1.3.2: + dependencies: + domelementtype: 2.2.0 + domhandler: 4.3.0 + entities: 2.2.0 + + domelementtype@2.2.0: {} + + domhandler@4.3.0: + dependencies: + domelementtype: 2.2.0 + + domutils@2.8.0: + dependencies: + dom-serializer: 1.3.2 + domelementtype: 2.2.0 + domhandler: 4.3.0 + + duplexer@0.1.1: {} + + duplexer@0.1.2: {} + + ecc-jsbn@0.1.2: + dependencies: + jsbn: 0.1.1 + safer-buffer: 2.1.2 + + ee-first@1.1.1: {} + + electron-to-chromium@1.5.72: {} + + emoji-regex@8.0.0: {} + + encodeurl@1.0.2: {} + + encoding@0.1.13: + dependencies: + iconv-lite: 0.6.3 + optional: true + + enquirer@2.3.6: + dependencies: + ansi-colors: 4.1.1 + + entities@2.2.0: {} + + entities@3.0.1: {} + + env-paths@2.2.1: {} + + err-code@2.0.3: {} + + escalade@3.2.0: {} + + escape-html@1.0.3: {} + + escape-string-regexp@1.0.5: {} + + escape-string-regexp@4.0.0: {} + + eslint-config-mdcs@5.0.0: {} + + eslint-plugin-html@6.2.0: + dependencies: + htmlparser2: 7.2.0 + + eslint-scope@5.1.1: + dependencies: + esrecurse: 4.3.0 + estraverse: 4.3.0 + + eslint-utils@2.1.0: + dependencies: + eslint-visitor-keys: 1.3.0 + + eslint-visitor-keys@1.3.0: {} + + eslint-visitor-keys@2.1.0: {} + + eslint@7.32.0: + dependencies: + '@babel/code-frame': 7.12.11 + '@eslint/eslintrc': 0.4.3 + '@humanwhocodes/config-array': 0.5.0 + ajv: 6.12.6 + chalk: 4.1.2 + cross-spawn: 7.0.3 + debug: 4.3.3 + doctrine: 3.0.0 + enquirer: 2.3.6 + escape-string-regexp: 4.0.0 + eslint-scope: 5.1.1 + eslint-utils: 2.1.0 + eslint-visitor-keys: 2.1.0 + espree: 7.3.1 + esquery: 1.4.0 + esutils: 2.0.3 + fast-deep-equal: 3.1.3 + file-entry-cache: 6.0.1 + functional-red-black-tree: 1.0.1 + glob-parent: 5.1.2 + globals: 13.12.0 + ignore: 4.0.6 + import-fresh: 3.3.0 + imurmurhash: 0.1.4 + is-glob: 4.0.3 + js-yaml: 3.14.1 + json-stable-stringify-without-jsonify: 1.0.1 + levn: 0.4.1 + lodash.merge: 4.6.2 + minimatch: 3.0.4 + natural-compare: 1.4.0 + optionator: 0.9.1 + progress: 2.0.3 + regexpp: 3.2.0 + semver: 7.3.5 + strip-ansi: 6.0.1 + strip-json-comments: 3.1.1 + table: 6.8.0 + text-table: 0.2.0 + v8-compile-cache: 2.3.0 + transitivePeerDependencies: + - supports-color + + espree@7.3.1: + dependencies: + acorn: 7.4.1 + acorn-jsx: 5.3.2(acorn@7.4.1) + eslint-visitor-keys: 1.3.0 + + esprima@4.0.1: {} + + esquery@1.4.0: + dependencies: + estraverse: 5.3.0 + + esrecurse@4.3.0: + dependencies: + estraverse: 5.3.0 + + estraverse@4.3.0: {} + + estraverse@5.3.0: {} + + estree-walker@1.0.1: {} + + esutils@2.0.3: {} + + etag@1.8.1: {} + + express@4.17.2: + dependencies: + accepts: 1.3.7 + array-flatten: 1.1.1 + body-parser: 1.19.1 + content-disposition: 0.5.4 + content-type: 1.0.4 + cookie: 0.4.1 + cookie-signature: 1.0.6 + debug: 2.6.9 + depd: 1.1.2 + encodeurl: 1.0.2 + escape-html: 1.0.3 + etag: 1.8.1 + finalhandler: 1.1.2 + fresh: 0.5.2 + merge-descriptors: 1.0.1 + methods: 1.1.2 + on-finished: 2.3.0 + parseurl: 1.3.3 + path-to-regexp: 0.1.7 + proxy-addr: 2.0.7 + qs: 6.9.6 + range-parser: 1.2.1 + safe-buffer: 5.2.1 + send: 0.17.2 + serve-static: 1.14.2 + setprototypeof: 1.2.0 + statuses: 1.5.0 + type-is: 1.6.18 + utils-merge: 1.0.1 + vary: 1.1.2 + transitivePeerDependencies: + - supports-color + + extend@3.0.2: {} + + extsprintf@1.3.0: {} + + fast-deep-equal@3.1.3: {} + + fast-json-stable-stringify@2.1.0: {} + + fast-levenshtein@2.0.6: {} + + file-entry-cache@6.0.1: + dependencies: + flat-cache: 3.0.4 + + filesize@6.4.0: {} + + finalhandler@1.1.2: + dependencies: + debug: 2.6.9 + encodeurl: 1.0.2 + escape-html: 1.0.3 + on-finished: 2.3.0 + parseurl: 1.3.3 + statuses: 1.5.0 + unpipe: 1.0.0 + transitivePeerDependencies: + - supports-color + + flat-cache@3.0.4: + dependencies: + flatted: 3.2.4 + rimraf: 3.0.2 + + flatted@3.2.4: {} + + forever-agent@0.6.1: {} + + form-data@2.3.3: + dependencies: + asynckit: 0.4.0 + combined-stream: 1.0.8 + mime-types: 2.1.34 + + forwarded@0.2.0: {} + + fresh@0.5.2: {} + + fs-minipass@2.1.0: + dependencies: + minipass: 3.1.6 + + fs.realpath@1.0.0: {} + + fsevents@2.3.2: + optional: true + + function-bind@1.1.1: {} + + functional-red-black-tree@1.0.1: {} + + gauge@2.7.4: + dependencies: + aproba: 1.2.0 + console-control-strings: 1.1.0 + has-unicode: 2.0.1 + object-assign: 4.1.1 + signal-exit: 3.0.6 + string-width: 1.0.2 + strip-ansi: 3.0.1 + wide-align: 1.1.5 + + gensync@1.0.0-beta.2: {} + + get-caller-file@2.0.5: {} + + getpass@0.1.7: + dependencies: + assert-plus: 1.0.0 + + glob-parent@5.1.2: + dependencies: + is-glob: 4.0.3 + + glob@7.2.0: + dependencies: + fs.realpath: 1.0.0 + inflight: 1.0.6 + inherits: 2.0.4 + minimatch: 3.0.4 + once: 1.4.0 + path-is-absolute: 1.0.1 + + globals@11.12.0: {} + + globals@13.12.0: + dependencies: + type-fest: 0.20.2 + + graceful-fs@4.2.9: {} + + gzip-size@6.0.0: + dependencies: + duplexer: 0.1.2 + + har-schema@2.0.0: {} + + har-validator@5.1.5: + dependencies: + ajv: 6.12.6 + har-schema: 2.0.0 + + has-flag@3.0.0: {} + + has-flag@4.0.0: {} + + has-unicode@2.0.1: {} + + has@1.0.3: + dependencies: + function-bind: 1.1.1 + + hosted-git-info@4.1.0: + dependencies: + lru-cache: 6.0.0 + + htmlparser2@7.2.0: + dependencies: + domelementtype: 2.2.0 + domhandler: 4.3.0 + domutils: 2.8.0 + entities: 3.0.1 + + http-cache-semantics@4.1.0: {} + + http-errors@1.6.3: + dependencies: + depd: 1.1.2 + inherits: 2.0.3 + setprototypeof: 1.1.0 + statuses: 1.5.0 + + http-errors@1.8.1: + dependencies: + depd: 1.1.2 + inherits: 2.0.4 + setprototypeof: 1.2.0 + statuses: 1.5.0 + toidentifier: 1.0.1 + + http-proxy-agent@4.0.1: + dependencies: + '@tootallnate/once': 1.1.2 + agent-base: 6.0.2 + debug: 4.3.3 + transitivePeerDependencies: + - supports-color + + http-signature@1.2.0: + dependencies: + assert-plus: 1.0.0 + jsprim: 1.4.2 + sshpk: 1.17.0 + + https-proxy-agent@5.0.0: + dependencies: + agent-base: 6.0.2 + debug: 4.3.3 + transitivePeerDependencies: + - supports-color + + humanize-ms@1.2.1: + dependencies: + ms: 2.1.3 + + iconv-lite@0.4.24: + dependencies: + safer-buffer: 2.1.2 + + iconv-lite@0.6.3: + dependencies: + safer-buffer: 2.1.2 + optional: true + + ignore-walk@3.0.4: + dependencies: + minimatch: 3.0.4 + + ignore@4.0.6: {} + + import-fresh@3.3.0: + dependencies: + parent-module: 1.0.1 + resolve-from: 4.0.0 + + imurmurhash@0.1.4: {} + + indent-string@4.0.0: {} + + infer-owner@1.0.4: {} + + inflight@1.0.6: + dependencies: + once: 1.4.0 + wrappy: 1.0.2 + + inherits@2.0.3: {} + + inherits@2.0.4: {} + + ip@1.1.5: {} + + ipaddr.js@1.9.1: {} + + is-core-module@2.8.1: + dependencies: + has: 1.0.3 + + is-docker@2.2.1: {} + + is-extglob@2.1.1: {} + + is-fullwidth-code-point@1.0.0: + dependencies: + number-is-nan: 1.0.1 + + is-fullwidth-code-point@3.0.0: {} + + is-glob@4.0.3: + dependencies: + is-extglob: 2.1.1 + + is-lambda@1.0.1: {} + + is-module@1.0.0: {} + + is-typedarray@1.0.0: {} + + is-wsl@2.2.0: + dependencies: + is-docker: 2.2.1 + + isarray@1.0.0: {} + + isexe@2.0.0: {} + + isstream@0.1.2: {} + + jest-worker@26.6.2: + dependencies: + '@types/node': 17.0.10 + merge-stream: 2.0.0 + supports-color: 7.2.0 + + js-tokens@4.0.0: {} + + js-yaml@3.14.1: + dependencies: + argparse: 1.0.10 + esprima: 4.0.1 + + jsbn@0.1.1: {} + + jsesc@3.0.2: {} + + json-parse-even-better-errors@2.3.1: {} + + json-schema-traverse@0.4.1: {} + + json-schema-traverse@1.0.0: {} + + json-schema@0.4.0: {} + + json-stable-stringify-without-jsonify@1.0.1: {} + + json-stringify-safe@5.0.1: {} + + json5@2.2.3: {} + + jsonparse@1.3.1: {} + + jsprim@1.4.2: + dependencies: + assert-plus: 1.0.0 + extsprintf: 1.3.0 + json-schema: 0.4.0 + verror: 1.10.0 + + levn@0.3.0: + dependencies: + prelude-ls: 1.1.2 + type-check: 0.3.2 + + levn@0.4.1: + dependencies: + prelude-ls: 1.2.1 + type-check: 0.4.0 + + lodash.debounce@4.0.8: {} + + lodash.merge@4.6.2: {} + + lodash.truncate@4.4.2: {} + + lodash@4.17.21: {} + + lru-cache@5.1.1: + dependencies: + yallist: 3.1.1 + + lru-cache@6.0.0: + dependencies: + yallist: 4.0.0 + + make-fetch-happen@9.1.0: + dependencies: + agentkeepalive: 4.2.0 + cacache: 15.3.0 + http-cache-semantics: 4.1.0 + http-proxy-agent: 4.0.1 + https-proxy-agent: 5.0.0 + is-lambda: 1.0.1 + lru-cache: 6.0.0 + minipass: 3.1.6 + minipass-collect: 1.0.2 + minipass-fetch: 1.4.1 + minipass-flush: 1.0.5 + minipass-pipeline: 1.2.4 + negotiator: 0.6.2 + promise-retry: 2.0.1 + socks-proxy-agent: 6.1.1 + ssri: 8.0.1 + transitivePeerDependencies: + - bluebird + - supports-color + + media-typer@0.3.0: {} + + merge-descriptors@1.0.1: {} + + merge-stream@2.0.0: {} + + methods@1.1.2: {} + + mime-db@1.51.0: {} + + mime-types@2.1.34: + dependencies: + mime-db: 1.51.0 + + mime@1.6.0: {} + + minimatch@3.0.4: + dependencies: + brace-expansion: 1.1.11 + + minipass-collect@1.0.2: + dependencies: + minipass: 3.1.6 + + minipass-fetch@1.4.1: + dependencies: + minipass: 3.1.6 + minipass-sized: 1.0.3 + minizlib: 2.1.2 + optionalDependencies: + encoding: 0.1.13 + + minipass-flush@1.0.5: + dependencies: + minipass: 3.1.6 + + minipass-json-stream@1.0.1: + dependencies: + jsonparse: 1.3.1 + minipass: 3.1.6 + + minipass-pipeline@1.2.4: + dependencies: + minipass: 3.1.6 + + minipass-sized@1.0.3: + dependencies: + minipass: 3.1.6 + + minipass@3.1.6: + dependencies: + yallist: 4.0.0 + + minizlib@2.1.2: + dependencies: + minipass: 3.1.6 + yallist: 4.0.0 + + mkdirp@1.0.4: {} + + ms@2.0.0: {} + + ms@2.1.2: {} + + ms@2.1.3: {} + + nanoid@3.2.0: {} + + natural-compare@1.4.0: {} + + negotiator@0.6.2: {} + + node-forge@1.2.1: {} + + node-gyp@7.1.2: + dependencies: + env-paths: 2.2.1 + glob: 7.2.0 + graceful-fs: 4.2.9 + nopt: 5.0.0 + npmlog: 4.1.2 + request: 2.88.2 + rimraf: 3.0.2 + semver: 7.3.5 + tar: 6.1.11 + which: 2.0.2 + + node-releases@2.0.19: {} + + nopt@5.0.0: + dependencies: + abbrev: 1.1.1 + + npm-bundled@1.1.2: + dependencies: + npm-normalize-package-bin: 1.0.1 + + npm-install-checks@4.0.0: + dependencies: + semver: 7.3.5 + + npm-normalize-package-bin@1.0.1: {} + + npm-package-arg@8.1.5: + dependencies: + hosted-git-info: 4.1.0 + semver: 7.3.5 + validate-npm-package-name: 3.0.0 + + npm-packlist@2.2.2: + dependencies: + glob: 7.2.0 + ignore-walk: 3.0.4 + npm-bundled: 1.1.2 + npm-normalize-package-bin: 1.0.1 + + npm-pick-manifest@6.1.1: + dependencies: + npm-install-checks: 4.0.0 + npm-normalize-package-bin: 1.0.1 + npm-package-arg: 8.1.5 + semver: 7.3.5 + + npm-registry-fetch@11.0.0: + dependencies: + make-fetch-happen: 9.1.0 + minipass: 3.1.6 + minipass-fetch: 1.4.1 + minipass-json-stream: 1.0.1 + minizlib: 2.1.2 + npm-package-arg: 8.1.5 + transitivePeerDependencies: + - bluebird + - supports-color + + npmlog@4.1.2: + dependencies: + are-we-there-yet: 1.1.7 + console-control-strings: 1.1.0 + gauge: 2.7.4 + set-blocking: 2.0.0 + + number-is-nan@1.0.1: {} + + oauth-sign@0.9.0: {} + + object-assign@4.1.1: {} + + on-finished@2.3.0: + dependencies: + ee-first: 1.1.1 + + once@1.4.0: + dependencies: + wrappy: 1.0.2 + + open@8.4.0: + dependencies: + define-lazy-prop: 2.0.0 + is-docker: 2.2.1 + is-wsl: 2.2.0 + + optionator@0.8.3: + dependencies: + deep-is: 0.1.4 + fast-levenshtein: 2.0.6 + levn: 0.3.0 + prelude-ls: 1.1.2 + type-check: 0.3.2 + word-wrap: 1.2.3 + + optionator@0.9.1: + dependencies: + deep-is: 0.1.4 + fast-levenshtein: 2.0.6 + levn: 0.4.1 + prelude-ls: 1.2.1 + type-check: 0.4.0 + word-wrap: 1.2.3 + + p-map@4.0.0: + dependencies: + aggregate-error: 3.1.0 + + pacote@11.3.5: + dependencies: + '@npmcli/git': 2.1.0 + '@npmcli/installed-package-contents': 1.0.7 + '@npmcli/promise-spawn': 1.3.2 + '@npmcli/run-script': 1.8.6 + cacache: 15.3.0 + chownr: 2.0.0 + fs-minipass: 2.1.0 + infer-owner: 1.0.4 + minipass: 3.1.6 + mkdirp: 1.0.4 + npm-package-arg: 8.1.5 + npm-packlist: 2.2.2 + npm-pick-manifest: 6.1.1 + npm-registry-fetch: 11.0.0 + promise-retry: 2.0.1 + read-package-json-fast: 2.0.3 + rimraf: 3.0.2 + ssri: 8.0.1 + tar: 6.1.11 + transitivePeerDependencies: + - bluebird + - supports-color + + parent-module@1.0.1: + dependencies: + callsites: 3.1.0 + + parseurl@1.3.3: {} + + path-is-absolute@1.0.1: {} + + path-key@3.1.1: {} + + path-parse@1.0.7: {} + + path-to-regexp@0.1.7: {} + + performance-now@2.1.0: {} + + picocolors@1.1.1: {} + + picomatch@2.3.1: {} + + prelude-ls@1.1.2: {} + + prelude-ls@1.2.1: {} + + process-nextick-args@2.0.1: {} + + progress@2.0.3: {} + + promise-inflight@1.0.1: {} + + promise-retry@2.0.1: + dependencies: + err-code: 2.0.3 + retry: 0.12.0 + + proxy-addr@2.0.7: + dependencies: + forwarded: 0.2.0 + ipaddr.js: 1.9.1 + + psl@1.8.0: {} + + punycode@2.1.1: {} + + qs@6.5.3: {} + + qs@6.9.6: {} + + randombytes@2.1.0: + dependencies: + safe-buffer: 5.2.1 + + range-parser@1.2.1: {} + + raw-body@2.4.2: + dependencies: + bytes: 3.1.1 + http-errors: 1.8.1 + iconv-lite: 0.4.24 + unpipe: 1.0.0 + + read-package-json-fast@2.0.3: + dependencies: + json-parse-even-better-errors: 2.3.1 + npm-normalize-package-bin: 1.0.1 + + readable-stream@2.3.7: + dependencies: + core-util-is: 1.0.3 + inherits: 2.0.4 + isarray: 1.0.0 + process-nextick-args: 2.0.1 + safe-buffer: 5.1.2 + string_decoder: 1.1.1 + util-deprecate: 1.0.2 + + regenerate-unicode-properties@10.2.0: + dependencies: + regenerate: 1.4.2 + + regenerate@1.4.2: {} + + regenerator-runtime@0.13.9: {} + + regenerator-transform@0.15.2: + dependencies: + '@babel/runtime': 7.16.7 + + regexpp@3.2.0: {} + + regexpu-core@6.2.0: + dependencies: + regenerate: 1.4.2 + regenerate-unicode-properties: 10.2.0 + regjsgen: 0.8.0 + regjsparser: 0.12.0 + unicode-match-property-ecmascript: 2.0.0 + unicode-match-property-value-ecmascript: 2.2.0 + + regjsgen@0.8.0: {} + + regjsparser@0.12.0: + dependencies: + jsesc: 3.0.2 + + request@2.88.2: + dependencies: + aws-sign2: 0.7.0 + aws4: 1.11.0 + caseless: 0.12.0 + combined-stream: 1.0.8 + extend: 3.0.2 + forever-agent: 0.6.1 + form-data: 2.3.3 + har-validator: 5.1.5 + http-signature: 1.2.0 + is-typedarray: 1.0.0 + isstream: 0.1.2 + json-stringify-safe: 5.0.1 + mime-types: 2.1.34 + oauth-sign: 0.9.0 + performance-now: 2.1.0 + qs: 6.5.3 + safe-buffer: 5.2.1 + tough-cookie: 2.5.0 + tunnel-agent: 0.6.0 + uuid: 3.4.0 + + require-directory@2.1.1: {} + + require-from-string@2.0.2: {} + + resolve-from@4.0.0: {} + + resolve@1.21.0: + dependencies: + is-core-module: 2.8.1 + path-parse: 1.0.7 + supports-preserve-symlinks-flag: 1.0.0 + + retry@0.12.0: {} + + rimraf@3.0.2: + dependencies: + glob: 7.2.0 + + rollup-plugin-filesize@9.1.2(acorn@7.4.1): + dependencies: + '@babel/runtime': 7.16.7 + boxen: 5.1.2 + brotli-size: 4.0.0 + colors: 1.4.0 + filesize: 6.4.0 + gzip-size: 6.0.0 + pacote: 11.3.5 + terser: 5.10.0(acorn@7.4.1) + transitivePeerDependencies: + - acorn + - bluebird + - supports-color + + rollup-plugin-terser@7.0.2(acorn@7.4.1)(rollup@2.64.0): + dependencies: + '@babel/code-frame': 7.26.2 + jest-worker: 26.6.2 + rollup: 2.64.0 + serialize-javascript: 4.0.0 + terser: 5.10.0(acorn@7.4.1) + transitivePeerDependencies: + - acorn + + rollup-plugin-visualizer@5.5.4(rollup@2.64.0): + dependencies: + nanoid: 3.2.0 + open: 8.4.0 + rollup: 2.64.0 + source-map: 0.7.3 + yargs: 17.3.1 + + rollup@2.64.0: + optionalDependencies: + fsevents: 2.3.2 + + rxjs@6.6.7: + dependencies: + tslib: 1.14.1 + + safe-buffer@5.1.2: {} + + safe-buffer@5.2.1: {} + + safer-buffer@2.1.2: {} + + secure-compare@3.0.1: {} + + selfsigned@2.0.0: + dependencies: + node-forge: 1.2.1 + + semver@6.3.1: {} + + semver@7.3.5: + dependencies: + lru-cache: 6.0.0 + + send@0.17.2: + dependencies: + debug: 2.6.9 + depd: 1.1.2 + destroy: 1.0.4 + encodeurl: 1.0.2 + escape-html: 1.0.3 + etag: 1.8.1 + fresh: 0.5.2 + http-errors: 1.8.1 + mime: 1.6.0 + ms: 2.1.3 + on-finished: 2.3.0 + range-parser: 1.2.1 + statuses: 1.5.0 + transitivePeerDependencies: + - supports-color + + serialize-javascript@4.0.0: + dependencies: + randombytes: 2.1.0 + + serve-index@1.9.1: + dependencies: + accepts: 1.3.7 + batch: 0.6.1 + debug: 2.6.9 + escape-html: 1.0.3 + http-errors: 1.6.3 + mime-types: 2.1.34 + parseurl: 1.3.3 + transitivePeerDependencies: + - supports-color + + serve-static@1.14.2: + dependencies: + encodeurl: 1.0.2 + escape-html: 1.0.3 + parseurl: 1.3.3 + send: 0.17.2 + transitivePeerDependencies: + - supports-color + + server-destroy@1.0.1: {} + + servez-lib@2.4.1: + dependencies: + basic-auth: 2.0.1 + cors: 2.8.5 + debug: 4.3.3 + express: 4.17.2 + secure-compare: 3.0.1 + selfsigned: 2.0.0 + serve-index: 1.9.1 + server-destroy: 1.0.1 + transitivePeerDependencies: + - supports-color + + servez@1.12.0: + dependencies: + ansi-colors: 4.1.1 + color-support: 1.1.3 + optionator: 0.8.3 + servez-lib: 2.4.1 + transitivePeerDependencies: + - supports-color + + set-blocking@2.0.0: {} + + setprototypeof@1.1.0: {} + + setprototypeof@1.2.0: {} + + shebang-command@2.0.0: + dependencies: + shebang-regex: 3.0.0 + + shebang-regex@3.0.0: {} + + signal-exit@3.0.6: {} + + slice-ansi@4.0.0: + dependencies: + ansi-styles: 4.3.0 + astral-regex: 2.0.0 + is-fullwidth-code-point: 3.0.0 + + smart-buffer@4.2.0: {} + + socks-proxy-agent@6.1.1: + dependencies: + agent-base: 6.0.2 + debug: 4.3.3 + socks: 2.6.1 + transitivePeerDependencies: + - supports-color + + socks@2.6.1: + dependencies: + ip: 1.1.5 + smart-buffer: 4.2.0 + + source-map-support@0.5.21: + dependencies: + buffer-from: 1.1.2 + source-map: 0.6.1 + + source-map@0.6.1: {} + + source-map@0.7.3: {} + + spawn-command@0.0.2-1: {} + + sprintf-js@1.0.3: {} + + sshpk@1.17.0: + dependencies: + asn1: 0.2.6 + assert-plus: 1.0.0 + bcrypt-pbkdf: 1.0.2 + dashdash: 1.14.1 + ecc-jsbn: 0.1.2 + getpass: 0.1.7 + jsbn: 0.1.1 + safer-buffer: 2.1.2 + tweetnacl: 0.14.5 + + ssri@8.0.1: + dependencies: + minipass: 3.1.6 + + statuses@1.5.0: {} + + string-width@1.0.2: + dependencies: + code-point-at: 1.1.0 + is-fullwidth-code-point: 1.0.0 + strip-ansi: 3.0.1 + + string-width@4.2.3: + dependencies: + emoji-regex: 8.0.0 + is-fullwidth-code-point: 3.0.0 + strip-ansi: 6.0.1 + + string_decoder@1.1.1: + dependencies: + safe-buffer: 5.1.2 + + strip-ansi@3.0.1: + dependencies: + ansi-regex: 2.1.1 + + strip-ansi@6.0.1: + dependencies: + ansi-regex: 5.0.1 + + strip-json-comments@3.1.1: {} + + supports-color@5.5.0: + dependencies: + has-flag: 3.0.0 + + supports-color@7.2.0: + dependencies: + has-flag: 4.0.0 + + supports-color@8.1.1: + dependencies: + has-flag: 4.0.0 + + supports-preserve-symlinks-flag@1.0.0: {} + + table@6.8.0: + dependencies: + ajv: 8.9.0 + lodash.truncate: 4.4.2 + slice-ansi: 4.0.0 + string-width: 4.2.3 + strip-ansi: 6.0.1 + + tar@6.1.11: + dependencies: + chownr: 2.0.0 + fs-minipass: 2.1.0 + minipass: 3.1.6 + minizlib: 2.1.2 + mkdirp: 1.0.4 + yallist: 4.0.0 + + terser@5.10.0(acorn@7.4.1): + dependencies: + commander: 2.20.3 + source-map: 0.7.3 + source-map-support: 0.5.21 + optionalDependencies: + acorn: 7.4.1 + + text-table@0.2.0: {} + + toidentifier@1.0.1: {} + + tough-cookie@2.5.0: + dependencies: + psl: 1.8.0 + punycode: 2.1.1 + + tree-kill@1.2.2: {} + + tslib@1.14.1: {} + + tunnel-agent@0.6.0: + dependencies: + safe-buffer: 5.2.1 + + tweetnacl@0.14.5: {} + + type-check@0.3.2: + dependencies: + prelude-ls: 1.1.2 + + type-check@0.4.0: + dependencies: + prelude-ls: 1.2.1 + + type-fest@0.20.2: {} + + type-is@1.6.18: + dependencies: + media-typer: 0.3.0 + mime-types: 2.1.34 + + unicode-canonical-property-names-ecmascript@2.0.1: {} + + unicode-match-property-ecmascript@2.0.0: + dependencies: + unicode-canonical-property-names-ecmascript: 2.0.1 + unicode-property-aliases-ecmascript: 2.1.0 + + unicode-match-property-value-ecmascript@2.2.0: {} + + unicode-property-aliases-ecmascript@2.1.0: {} + + unique-filename@1.1.1: + dependencies: + unique-slug: 2.0.2 + + unique-slug@2.0.2: + dependencies: + imurmurhash: 0.1.4 + + unpipe@1.0.0: {} + + update-browserslist-db@1.1.1(browserslist@4.24.2): + dependencies: + browserslist: 4.24.2 + escalade: 3.2.0 + picocolors: 1.1.1 + + uri-js@4.4.1: + dependencies: + punycode: 2.1.1 + + util-deprecate@1.0.2: {} + + utils-merge@1.0.1: {} + + uuid@3.4.0: {} + + v8-compile-cache@2.3.0: {} + + validate-npm-package-name@3.0.0: + dependencies: + builtins: 1.0.3 + + vary@1.1.2: {} + + verror@1.10.0: + dependencies: + assert-plus: 1.0.0 + core-util-is: 1.0.2 + extsprintf: 1.3.0 + + which@2.0.2: + dependencies: + isexe: 2.0.0 + + wide-align@1.1.5: + dependencies: + string-width: 4.2.3 + + widest-line@3.1.0: + dependencies: + string-width: 4.2.3 + + word-wrap@1.2.3: {} + + wrap-ansi@7.0.0: + dependencies: + ansi-styles: 4.3.0 + string-width: 4.2.3 + strip-ansi: 6.0.1 + + wrappy@1.0.2: {} + + y18n@5.0.8: {} + + yallist@3.1.1: {} + + yallist@4.0.0: {} + + yargs-parser@20.2.9: {} + + yargs-parser@21.0.0: {} + + yargs@16.2.0: + dependencies: + cliui: 7.0.4 + escalade: 3.2.0 + get-caller-file: 2.0.5 + require-directory: 2.1.1 + string-width: 4.2.3 + y18n: 5.0.8 + yargs-parser: 20.2.9 + + yargs@17.3.1: + dependencies: + cliui: 7.0.4 + escalade: 3.2.0 + get-caller-file: 2.0.5 + require-directory: 2.1.1 + string-width: 4.2.3 + y18n: 5.0.8 + yargs-parser: 21.0.0 diff --git a/src/renderers/webxr/WebXRManager.js b/src/renderers/webxr/WebXRManager.js index 04df05d6ad443e..fe2b6480e61f9f 100644 --- a/src/renderers/webxr/WebXRManager.js +++ b/src/renderers/webxr/WebXRManager.js @@ -613,7 +613,16 @@ class WebXRManager extends EventDispatcher { } - const camera = cameras[ i ]; + let camera = cameras[ i ]; + + if ( camera === undefined ) { + + camera = new PerspectiveCamera(); + camera.layers.enable( i ); + camera.viewport = new Vector4(); + cameras[ i ] = camera; + + } camera.matrix.fromArray( view.transform.matrix ); camera.projectionMatrix.fromArray( view.projectionMatrix ); diff --git a/test/package.json b/test/package.json index 502a68c8c54c45..6f4c3e07589647 100644 --- a/test/package.json +++ b/test/package.json @@ -16,5 +16,10 @@ "puppeteer": "^13.1.2", "qunit": "^2.17.2", "serve-handler": "^6.1.3" + }, + "pnpm": { + "onlyBuiltDependencies": [ + "puppeteer" + ] } -} +} \ No newline at end of file