From bd71dd1cf5fb00794077214b2565a066e48fa1a1 Mon Sep 17 00:00:00 2001 From: Mugen87 Date: Wed, 24 Mar 2021 12:47:53 +0100 Subject: [PATCH] InstancedMesh: Add bounding volumes. --- build/three.js | 20072 +++++++++------- build/three.min.js | 2 +- build/three.module.js | 882 +- examples/jsm/modifiers/CurveModifier.js | 1 + examples/jsm/physics/AmmoPhysics.js | 1 + ...buffergeometry_instancing_interleaved.html | 1 + examples/webgl_instancing_dynamic.html | 8 +- examples/webgl_instancing_modified.html | 1 + examples/webgl_instancing_scatter.html | 3 + src/math/Box3.js | 29 +- src/math/Frustum.js | 16 +- src/objects/InstancedMesh.js | 73 +- 12 files changed, 11859 insertions(+), 9230 deletions(-) diff --git a/build/three.js b/build/three.js index 86b62edf87e85b..d54102125dbf5c 100644 --- a/build/three.js +++ b/build/three.js @@ -9,8 +9,8 @@ (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.THREE = {})); }(this, (function (exports) { 'use strict'; - const REVISION = '127dev'; - const MOUSE = { + var REVISION = '127dev'; + var MOUSE = { LEFT: 0, MIDDLE: 1, RIGHT: 2, @@ -18,203 +18,311 @@ DOLLY: 1, PAN: 2 }; - const TOUCH = { + var TOUCH = { ROTATE: 0, PAN: 1, DOLLY_PAN: 2, DOLLY_ROTATE: 3 }; - const CullFaceNone = 0; - const CullFaceBack = 1; - const CullFaceFront = 2; - const CullFaceFrontBack = 3; - const BasicShadowMap = 0; - const PCFShadowMap = 1; - const PCFSoftShadowMap = 2; - const VSMShadowMap = 3; - const FrontSide = 0; - const BackSide = 1; - const DoubleSide = 2; - const FlatShading = 1; - const SmoothShading = 2; - const NoBlending = 0; - const NormalBlending = 1; - const AdditiveBlending = 2; - const SubtractiveBlending = 3; - const MultiplyBlending = 4; - const CustomBlending = 5; - const AddEquation = 100; - const SubtractEquation = 101; - const ReverseSubtractEquation = 102; - const MinEquation = 103; - const MaxEquation = 104; - const ZeroFactor = 200; - const OneFactor = 201; - const SrcColorFactor = 202; - const OneMinusSrcColorFactor = 203; - const SrcAlphaFactor = 204; - const OneMinusSrcAlphaFactor = 205; - const DstAlphaFactor = 206; - const OneMinusDstAlphaFactor = 207; - const DstColorFactor = 208; - const OneMinusDstColorFactor = 209; - const SrcAlphaSaturateFactor = 210; - const NeverDepth = 0; - const AlwaysDepth = 1; - const LessDepth = 2; - const LessEqualDepth = 3; - const EqualDepth = 4; - const GreaterEqualDepth = 5; - const GreaterDepth = 6; - const NotEqualDepth = 7; - const MultiplyOperation = 0; - const MixOperation = 1; - const AddOperation = 2; - const NoToneMapping = 0; - const LinearToneMapping = 1; - const ReinhardToneMapping = 2; - const CineonToneMapping = 3; - const ACESFilmicToneMapping = 4; - const CustomToneMapping = 5; - const UVMapping = 300; - const CubeReflectionMapping = 301; - const CubeRefractionMapping = 302; - const EquirectangularReflectionMapping = 303; - const EquirectangularRefractionMapping = 304; - const CubeUVReflectionMapping = 306; - const CubeUVRefractionMapping = 307; - const RepeatWrapping = 1000; - const ClampToEdgeWrapping = 1001; - const MirroredRepeatWrapping = 1002; - const NearestFilter = 1003; - const NearestMipmapNearestFilter = 1004; - const NearestMipMapNearestFilter = 1004; - const NearestMipmapLinearFilter = 1005; - const NearestMipMapLinearFilter = 1005; - const LinearFilter = 1006; - const LinearMipmapNearestFilter = 1007; - const LinearMipMapNearestFilter = 1007; - const LinearMipmapLinearFilter = 1008; - const LinearMipMapLinearFilter = 1008; - const UnsignedByteType = 1009; - const ByteType = 1010; - const ShortType = 1011; - const UnsignedShortType = 1012; - const IntType = 1013; - const UnsignedIntType = 1014; - const FloatType = 1015; - const HalfFloatType = 1016; - const UnsignedShort4444Type = 1017; - const UnsignedShort5551Type = 1018; - const UnsignedShort565Type = 1019; - const UnsignedInt248Type = 1020; - const AlphaFormat = 1021; - const RGBFormat = 1022; - const RGBAFormat = 1023; - const LuminanceFormat = 1024; - const LuminanceAlphaFormat = 1025; - const RGBEFormat = RGBAFormat; - const DepthFormat = 1026; - const DepthStencilFormat = 1027; - const RedFormat = 1028; - const RedIntegerFormat = 1029; - const RGFormat = 1030; - const RGIntegerFormat = 1031; - const RGBIntegerFormat = 1032; - const RGBAIntegerFormat = 1033; - const RGB_S3TC_DXT1_Format = 33776; - const RGBA_S3TC_DXT1_Format = 33777; - const RGBA_S3TC_DXT3_Format = 33778; - const RGBA_S3TC_DXT5_Format = 33779; - const RGB_PVRTC_4BPPV1_Format = 35840; - const RGB_PVRTC_2BPPV1_Format = 35841; - const RGBA_PVRTC_4BPPV1_Format = 35842; - const RGBA_PVRTC_2BPPV1_Format = 35843; - const RGB_ETC1_Format = 36196; - const RGB_ETC2_Format = 37492; - const RGBA_ETC2_EAC_Format = 37496; - const RGBA_ASTC_4x4_Format = 37808; - const RGBA_ASTC_5x4_Format = 37809; - const RGBA_ASTC_5x5_Format = 37810; - const RGBA_ASTC_6x5_Format = 37811; - const RGBA_ASTC_6x6_Format = 37812; - const RGBA_ASTC_8x5_Format = 37813; - const RGBA_ASTC_8x6_Format = 37814; - const RGBA_ASTC_8x8_Format = 37815; - const RGBA_ASTC_10x5_Format = 37816; - const RGBA_ASTC_10x6_Format = 37817; - const RGBA_ASTC_10x8_Format = 37818; - const RGBA_ASTC_10x10_Format = 37819; - const RGBA_ASTC_12x10_Format = 37820; - const RGBA_ASTC_12x12_Format = 37821; - const RGBA_BPTC_Format = 36492; - const SRGB8_ALPHA8_ASTC_4x4_Format = 37840; - const SRGB8_ALPHA8_ASTC_5x4_Format = 37841; - const SRGB8_ALPHA8_ASTC_5x5_Format = 37842; - const SRGB8_ALPHA8_ASTC_6x5_Format = 37843; - const SRGB8_ALPHA8_ASTC_6x6_Format = 37844; - const SRGB8_ALPHA8_ASTC_8x5_Format = 37845; - const SRGB8_ALPHA8_ASTC_8x6_Format = 37846; - const SRGB8_ALPHA8_ASTC_8x8_Format = 37847; - const SRGB8_ALPHA8_ASTC_10x5_Format = 37848; - const SRGB8_ALPHA8_ASTC_10x6_Format = 37849; - const SRGB8_ALPHA8_ASTC_10x8_Format = 37850; - const SRGB8_ALPHA8_ASTC_10x10_Format = 37851; - const SRGB8_ALPHA8_ASTC_12x10_Format = 37852; - const SRGB8_ALPHA8_ASTC_12x12_Format = 37853; - const LoopOnce = 2200; - const LoopRepeat = 2201; - const LoopPingPong = 2202; - const InterpolateDiscrete = 2300; - const InterpolateLinear = 2301; - const InterpolateSmooth = 2302; - const ZeroCurvatureEnding = 2400; - const ZeroSlopeEnding = 2401; - const WrapAroundEnding = 2402; - const NormalAnimationBlendMode = 2500; - const AdditiveAnimationBlendMode = 2501; - const TrianglesDrawMode = 0; - const TriangleStripDrawMode = 1; - const TriangleFanDrawMode = 2; - const LinearEncoding = 3000; - const sRGBEncoding = 3001; - const GammaEncoding = 3007; - const RGBEEncoding = 3002; - const LogLuvEncoding = 3003; - const RGBM7Encoding = 3004; - const RGBM16Encoding = 3005; - const RGBDEncoding = 3006; - const BasicDepthPacking = 3200; - const RGBADepthPacking = 3201; - const TangentSpaceNormalMap = 0; - const ObjectSpaceNormalMap = 1; - const ZeroStencilOp = 0; - const KeepStencilOp = 7680; - const ReplaceStencilOp = 7681; - const IncrementStencilOp = 7682; - const DecrementStencilOp = 7683; - const IncrementWrapStencilOp = 34055; - const DecrementWrapStencilOp = 34056; - const InvertStencilOp = 5386; - const NeverStencilFunc = 512; - const LessStencilFunc = 513; - const EqualStencilFunc = 514; - const LessEqualStencilFunc = 515; - const GreaterStencilFunc = 516; - const NotEqualStencilFunc = 517; - const GreaterEqualStencilFunc = 518; - const AlwaysStencilFunc = 519; - const StaticDrawUsage = 35044; - const DynamicDrawUsage = 35048; - const StreamDrawUsage = 35040; - const StaticReadUsage = 35045; - const DynamicReadUsage = 35049; - const StreamReadUsage = 35041; - const StaticCopyUsage = 35046; - const DynamicCopyUsage = 35050; - const StreamCopyUsage = 35042; - const GLSL1 = '100'; - const GLSL3 = '300 es'; + var CullFaceNone = 0; + var CullFaceBack = 1; + var CullFaceFront = 2; + var CullFaceFrontBack = 3; + var BasicShadowMap = 0; + var PCFShadowMap = 1; + var PCFSoftShadowMap = 2; + var VSMShadowMap = 3; + var FrontSide = 0; + var BackSide = 1; + var DoubleSide = 2; + var FlatShading = 1; + var SmoothShading = 2; + var NoBlending = 0; + var NormalBlending = 1; + var AdditiveBlending = 2; + var SubtractiveBlending = 3; + var MultiplyBlending = 4; + var CustomBlending = 5; + var AddEquation = 100; + var SubtractEquation = 101; + var ReverseSubtractEquation = 102; + var MinEquation = 103; + var MaxEquation = 104; + var ZeroFactor = 200; + var OneFactor = 201; + var SrcColorFactor = 202; + var OneMinusSrcColorFactor = 203; + var SrcAlphaFactor = 204; + var OneMinusSrcAlphaFactor = 205; + var DstAlphaFactor = 206; + var OneMinusDstAlphaFactor = 207; + var DstColorFactor = 208; + var OneMinusDstColorFactor = 209; + var SrcAlphaSaturateFactor = 210; + var NeverDepth = 0; + var AlwaysDepth = 1; + var LessDepth = 2; + var LessEqualDepth = 3; + var EqualDepth = 4; + var GreaterEqualDepth = 5; + var GreaterDepth = 6; + var NotEqualDepth = 7; + var MultiplyOperation = 0; + var MixOperation = 1; + var AddOperation = 2; + var NoToneMapping = 0; + var LinearToneMapping = 1; + var ReinhardToneMapping = 2; + var CineonToneMapping = 3; + var ACESFilmicToneMapping = 4; + var CustomToneMapping = 5; + var UVMapping = 300; + var CubeReflectionMapping = 301; + var CubeRefractionMapping = 302; + var EquirectangularReflectionMapping = 303; + var EquirectangularRefractionMapping = 304; + var CubeUVReflectionMapping = 306; + var CubeUVRefractionMapping = 307; + var RepeatWrapping = 1000; + var ClampToEdgeWrapping = 1001; + var MirroredRepeatWrapping = 1002; + var NearestFilter = 1003; + var NearestMipmapNearestFilter = 1004; + var NearestMipMapNearestFilter = 1004; + var NearestMipmapLinearFilter = 1005; + var NearestMipMapLinearFilter = 1005; + var LinearFilter = 1006; + var LinearMipmapNearestFilter = 1007; + var LinearMipMapNearestFilter = 1007; + var LinearMipmapLinearFilter = 1008; + var LinearMipMapLinearFilter = 1008; + var UnsignedByteType = 1009; + var ByteType = 1010; + var ShortType = 1011; + var UnsignedShortType = 1012; + var IntType = 1013; + var UnsignedIntType = 1014; + var FloatType = 1015; + var HalfFloatType = 1016; + var UnsignedShort4444Type = 1017; + var UnsignedShort5551Type = 1018; + var UnsignedShort565Type = 1019; + var UnsignedInt248Type = 1020; + var AlphaFormat = 1021; + var RGBFormat = 1022; + var RGBAFormat = 1023; + var LuminanceFormat = 1024; + var LuminanceAlphaFormat = 1025; + var RGBEFormat = RGBAFormat; + var DepthFormat = 1026; + var DepthStencilFormat = 1027; + var RedFormat = 1028; + var RedIntegerFormat = 1029; + var RGFormat = 1030; + var RGIntegerFormat = 1031; + var RGBIntegerFormat = 1032; + var RGBAIntegerFormat = 1033; + var RGB_S3TC_DXT1_Format = 33776; + var RGBA_S3TC_DXT1_Format = 33777; + var RGBA_S3TC_DXT3_Format = 33778; + var RGBA_S3TC_DXT5_Format = 33779; + var RGB_PVRTC_4BPPV1_Format = 35840; + var RGB_PVRTC_2BPPV1_Format = 35841; + var RGBA_PVRTC_4BPPV1_Format = 35842; + var RGBA_PVRTC_2BPPV1_Format = 35843; + var RGB_ETC1_Format = 36196; + var RGB_ETC2_Format = 37492; + var RGBA_ETC2_EAC_Format = 37496; + var RGBA_ASTC_4x4_Format = 37808; + var RGBA_ASTC_5x4_Format = 37809; + var RGBA_ASTC_5x5_Format = 37810; + var RGBA_ASTC_6x5_Format = 37811; + var RGBA_ASTC_6x6_Format = 37812; + var RGBA_ASTC_8x5_Format = 37813; + var RGBA_ASTC_8x6_Format = 37814; + var RGBA_ASTC_8x8_Format = 37815; + var RGBA_ASTC_10x5_Format = 37816; + var RGBA_ASTC_10x6_Format = 37817; + var RGBA_ASTC_10x8_Format = 37818; + var RGBA_ASTC_10x10_Format = 37819; + var RGBA_ASTC_12x10_Format = 37820; + var RGBA_ASTC_12x12_Format = 37821; + var RGBA_BPTC_Format = 36492; + var SRGB8_ALPHA8_ASTC_4x4_Format = 37840; + var SRGB8_ALPHA8_ASTC_5x4_Format = 37841; + var SRGB8_ALPHA8_ASTC_5x5_Format = 37842; + var SRGB8_ALPHA8_ASTC_6x5_Format = 37843; + var SRGB8_ALPHA8_ASTC_6x6_Format = 37844; + var SRGB8_ALPHA8_ASTC_8x5_Format = 37845; + var SRGB8_ALPHA8_ASTC_8x6_Format = 37846; + var SRGB8_ALPHA8_ASTC_8x8_Format = 37847; + var SRGB8_ALPHA8_ASTC_10x5_Format = 37848; + var SRGB8_ALPHA8_ASTC_10x6_Format = 37849; + var SRGB8_ALPHA8_ASTC_10x8_Format = 37850; + var SRGB8_ALPHA8_ASTC_10x10_Format = 37851; + var SRGB8_ALPHA8_ASTC_12x10_Format = 37852; + var SRGB8_ALPHA8_ASTC_12x12_Format = 37853; + var LoopOnce = 2200; + var LoopRepeat = 2201; + var LoopPingPong = 2202; + var InterpolateDiscrete = 2300; + var InterpolateLinear = 2301; + var InterpolateSmooth = 2302; + var ZeroCurvatureEnding = 2400; + var ZeroSlopeEnding = 2401; + var WrapAroundEnding = 2402; + var NormalAnimationBlendMode = 2500; + var AdditiveAnimationBlendMode = 2501; + var TrianglesDrawMode = 0; + var TriangleStripDrawMode = 1; + var TriangleFanDrawMode = 2; + var LinearEncoding = 3000; + var sRGBEncoding = 3001; + var GammaEncoding = 3007; + var RGBEEncoding = 3002; + var LogLuvEncoding = 3003; + var RGBM7Encoding = 3004; + var RGBM16Encoding = 3005; + var RGBDEncoding = 3006; + var BasicDepthPacking = 3200; + var RGBADepthPacking = 3201; + var TangentSpaceNormalMap = 0; + var ObjectSpaceNormalMap = 1; + var ZeroStencilOp = 0; + var KeepStencilOp = 7680; + var ReplaceStencilOp = 7681; + var IncrementStencilOp = 7682; + var DecrementStencilOp = 7683; + var IncrementWrapStencilOp = 34055; + var DecrementWrapStencilOp = 34056; + var InvertStencilOp = 5386; + var NeverStencilFunc = 512; + var LessStencilFunc = 513; + var EqualStencilFunc = 514; + var LessEqualStencilFunc = 515; + var GreaterStencilFunc = 516; + var NotEqualStencilFunc = 517; + var GreaterEqualStencilFunc = 518; + var AlwaysStencilFunc = 519; + var StaticDrawUsage = 35044; + var DynamicDrawUsage = 35048; + var StreamDrawUsage = 35040; + var StaticReadUsage = 35045; + var DynamicReadUsage = 35049; + var StreamReadUsage = 35041; + var StaticCopyUsage = 35046; + var DynamicCopyUsage = 35050; + var StreamCopyUsage = 35042; + var GLSL1 = '100'; + var GLSL3 = '300 es'; + + function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { + try { + var info = gen[key](arg); + var value = info.value; + } catch (error) { + reject(error); + return; + } + + if (info.done) { + resolve(value); + } else { + Promise.resolve(value).then(_next, _throw); + } + } + + function _asyncToGenerator(fn) { + return function () { + var self = this, + args = arguments; + return new Promise(function (resolve, reject) { + var gen = fn.apply(self, args); + + function _next(value) { + asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); + } + + function _throw(err) { + asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); + } + + _next(undefined); + }); + }; + } + + function _defineProperties(target, props) { + for (var i = 0; i < props.length; i++) { + var descriptor = props[i]; + descriptor.enumerable = descriptor.enumerable || false; + descriptor.configurable = true; + if ("value" in descriptor) descriptor.writable = true; + Object.defineProperty(target, descriptor.key, descriptor); + } + } + + function _createClass(Constructor, protoProps, staticProps) { + if (protoProps) _defineProperties(Constructor.prototype, protoProps); + if (staticProps) _defineProperties(Constructor, staticProps); + return Constructor; + } + + function _inheritsLoose(subClass, superClass) { + subClass.prototype = Object.create(superClass.prototype); + subClass.prototype.constructor = subClass; + subClass.__proto__ = superClass; + } + + function _assertThisInitialized(self) { + if (self === void 0) { + throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); + } + + return self; + } + + function _unsupportedIterableToArray(o, minLen) { + if (!o) return; + if (typeof o === "string") return _arrayLikeToArray(o, minLen); + var n = Object.prototype.toString.call(o).slice(8, -1); + if (n === "Object" && o.constructor) n = o.constructor.name; + if (n === "Map" || n === "Set") return Array.from(o); + if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); + } + + function _arrayLikeToArray(arr, len) { + if (len == null || len > arr.length) len = arr.length; + + for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; + + return arr2; + } + + function _createForOfIteratorHelperLoose(o, allowArrayLike) { + var it; + + if (typeof Symbol === "undefined" || o[Symbol.iterator] == null) { + if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { + if (it) o = it; + var i = 0; + return function () { + if (i >= o.length) return { + done: true + }; + return { + done: false, + value: o[i++] + }; + }; + } + + throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); + } + + it = o[Symbol.iterator](); + return it.next.bind(it); + } /** * https://github.com/mrdoob/eventdispatcher.js/ @@ -222,9 +330,9 @@ function EventDispatcher() {} Object.assign(EventDispatcher.prototype, { - addEventListener: function (type, listener) { + addEventListener: function addEventListener(type, listener) { if (this._listeners === undefined) this._listeners = {}; - const listeners = this._listeners; + var listeners = this._listeners; if (listeners[type] === undefined) { listeners[type] = []; @@ -234,147 +342,151 @@ listeners[type].push(listener); } }, - hasEventListener: function (type, listener) { + hasEventListener: function hasEventListener(type, listener) { if (this._listeners === undefined) return false; - const listeners = this._listeners; + var listeners = this._listeners; return listeners[type] !== undefined && listeners[type].indexOf(listener) !== -1; }, - removeEventListener: function (type, listener) { + removeEventListener: function removeEventListener(type, listener) { if (this._listeners === undefined) return; - const listeners = this._listeners; - const listenerArray = listeners[type]; + var listeners = this._listeners; + var listenerArray = listeners[type]; if (listenerArray !== undefined) { - const index = listenerArray.indexOf(listener); + var index = listenerArray.indexOf(listener); if (index !== -1) { listenerArray.splice(index, 1); } } }, - dispatchEvent: function (event) { + dispatchEvent: function dispatchEvent(event) { if (this._listeners === undefined) return; - const listeners = this._listeners; - const listenerArray = listeners[event.type]; + var listeners = this._listeners; + var listenerArray = listeners[event.type]; if (listenerArray !== undefined) { event.target = this; // Make a copy, in case listeners are removed while iterating. - const array = listenerArray.slice(0); + var array = listenerArray.slice(0); - for (let i = 0, l = array.length; i < l; i++) { + for (var i = 0, l = array.length; i < l; i++) { array[i].call(this, event); } } } }); - const _lut = []; + var _lut = []; - for (let i = 0; i < 256; i++) { + for (var i = 0; i < 256; i++) { _lut[i] = (i < 16 ? '0' : '') + i.toString(16); } - let _seed = 1234567; - const MathUtils = { + var _seed = 1234567; + var MathUtils = { DEG2RAD: Math.PI / 180, RAD2DEG: 180 / Math.PI, - generateUUID: function () { + generateUUID: function generateUUID() { // http://stackoverflow.com/questions/105034/how-to-create-a-guid-uuid-in-javascript/21963136#21963136 - 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. + var d0 = Math.random() * 0xffffffff | 0; + var d1 = Math.random() * 0xffffffff | 0; + var d2 = Math.random() * 0xffffffff | 0; + var d3 = Math.random() * 0xffffffff | 0; + var 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(); }, - clamp: function (value, min, max) { + clamp: 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 - euclideanModulo: function (n, m) { + euclideanModulo: function euclideanModulo(n, m) { return (n % m + m) % m; }, // Linear mapping from range to range - mapLinear: function (x, a1, a2, b1, b2) { + mapLinear: function mapLinear(x, a1, a2, b1, b2) { return b1 + (x - a1) * (b2 - b1) / (a2 - a1); }, // https://en.wikipedia.org/wiki/Linear_interpolation - lerp: function (x, y, t) { + lerp: function lerp(x, y, t) { return (1 - t) * x + t * y; }, // http://www.rorydriscoll.com/2016/03/07/frame-rate-independent-damping-using-lerp/ - damp: function (x, y, lambda, dt) { + damp: function damp(x, y, lambda, dt) { return MathUtils.lerp(x, y, 1 - Math.exp(-lambda * dt)); }, // https://www.desmos.com/calculator/vcsjnyz7x4 - pingpong: function (x, length = 1) { + pingpong: function pingpong(x, length) { + if (length === void 0) { + length = 1; + } + return length - Math.abs(MathUtils.euclideanModulo(x, length * 2) - length); }, // http://en.wikipedia.org/wiki/Smoothstep - smoothstep: function (x, min, max) { + 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); }, - smootherstep: function (x, min, max) { + smootherstep: 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 - randInt: function (low, high) { + randInt: function randInt(low, high) { return low + Math.floor(Math.random() * (high - low + 1)); }, // Random float from interval - randFloat: function (low, high) { + randFloat: function randFloat(low, high) { return low + Math.random() * (high - low); }, // Random float from <-range/2, range/2> interval - randFloatSpread: function (range) { + randFloatSpread: function randFloatSpread(range) { return range * (0.5 - Math.random()); }, // Deterministic pseudo-random float in the interval [ 0, 1 ] - seededRandom: function (s) { + seededRandom: function seededRandom(s) { if (s !== undefined) _seed = s % 2147483647; // Park-Miller algorithm _seed = _seed * 16807 % 2147483647; return (_seed - 1) / 2147483646; }, - degToRad: function (degrees) { + degToRad: function degToRad(degrees) { return degrees * MathUtils.DEG2RAD; }, - radToDeg: function (radians) { + radToDeg: function radToDeg(radians) { return radians * MathUtils.RAD2DEG; }, - isPowerOfTwo: function (value) { + isPowerOfTwo: function isPowerOfTwo(value) { return (value & value - 1) === 0 && value !== 0; }, - ceilPowerOfTwo: function (value) { + ceilPowerOfTwo: function ceilPowerOfTwo(value) { return Math.pow(2, Math.ceil(Math.log(value) / Math.LN2)); }, - floorPowerOfTwo: function (value) { + floorPowerOfTwo: function floorPowerOfTwo(value) { return Math.pow(2, Math.floor(Math.log(value) / Math.LN2)); }, - setQuaternionFromProperEuler: function (q, a, b, c, order) { + setQuaternionFromProperEuler: 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); - const s2 = sin(b / 2); - const c13 = cos((a + c) / 2); - const s13 = sin((a + c) / 2); - const c1_3 = cos((a - c) / 2); - const s1_3 = sin((a - c) / 2); - const c3_1 = cos((c - a) / 2); - const s3_1 = sin((c - a) / 2); + var cos = Math.cos; + var sin = Math.sin; + var c2 = cos(b / 2); + var s2 = sin(b / 2); + var c13 = cos((a + c) / 2); + var s13 = sin((a + c) / 2); + var c1_3 = cos((a - c) / 2); + var s1_3 = sin((a - c) / 2); + var c3_1 = cos((c - a) / 2); + var s3_1 = sin((c - a) / 2); switch (order) { case 'XYX': @@ -407,51 +519,45 @@ } }; - class Vector2 { - constructor(x = 0, y = 0) { - this.x = x; - this.y = y; - } - - get width() { - return this.x; - } + var Vector2 = /*#__PURE__*/function () { + function Vector2(x, y) { + if (x === void 0) { + x = 0; + } - set width(value) { - this.x = value; - } + if (y === void 0) { + y = 0; + } - get height() { - return this.y; + this.x = x; + this.y = y; } - set height(value) { - this.y = value; - } + var _proto = Vector2.prototype; - set(x, y) { + _proto.set = function set(x, y) { this.x = x; this.y = y; return this; - } + }; - setScalar(scalar) { + _proto.setScalar = function setScalar(scalar) { this.x = scalar; this.y = scalar; return this; - } + }; - setX(x) { + _proto.setX = function setX(x) { this.x = x; return this; - } + }; - setY(y) { + _proto.setY = function setY(y) { this.y = y; return this; - } + }; - setComponent(index, value) { + _proto.setComponent = function setComponent(index, value) { switch (index) { case 0: this.x = value; @@ -466,9 +572,9 @@ } return this; - } + }; - getComponent(index) { + _proto.getComponent = function getComponent(index) { switch (index) { case 0: return this.x; @@ -479,19 +585,19 @@ default: throw new Error('index is out of range: ' + index); } - } + }; - clone() { + _proto.clone = function clone() { return new this.constructor(this.x, this.y); - } + }; - copy(v) { + _proto.copy = function copy(v) { this.x = v.x; this.y = v.y; return this; - } + }; - add(v, w) { + _proto.add = function 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); @@ -500,27 +606,27 @@ this.x += v.x; this.y += v.y; return this; - } + }; - addScalar(s) { + _proto.addScalar = function addScalar(s) { this.x += s; this.y += s; return this; - } + }; - addVectors(a, b) { + _proto.addVectors = function addVectors(a, b) { this.x = a.x + b.x; this.y = a.y + b.y; return this; - } + }; - addScaledVector(v, s) { + _proto.addScaledVector = function addScaledVector(v, s) { this.x += v.x * s; this.y += v.y * s; return this; - } + }; - sub(v, w) { + _proto.sub = function 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); @@ -529,188 +635,200 @@ this.x -= v.x; this.y -= v.y; return this; - } + }; - subScalar(s) { + _proto.subScalar = function subScalar(s) { this.x -= s; this.y -= s; return this; - } + }; - subVectors(a, b) { + _proto.subVectors = function subVectors(a, b) { this.x = a.x - b.x; this.y = a.y - b.y; return this; - } + }; - multiply(v) { + _proto.multiply = function multiply(v) { this.x *= v.x; this.y *= v.y; return this; - } + }; - multiplyScalar(scalar) { + _proto.multiplyScalar = function multiplyScalar(scalar) { this.x *= scalar; this.y *= scalar; return this; - } + }; - divide(v) { + _proto.divide = function divide(v) { this.x /= v.x; this.y /= v.y; return this; - } + }; - divideScalar(scalar) { + _proto.divideScalar = function divideScalar(scalar) { return this.multiplyScalar(1 / scalar); - } + }; - applyMatrix3(m) { - const x = this.x, - y = this.y; - const e = m.elements; + _proto.applyMatrix3 = function applyMatrix3(m) { + var x = this.x, + y = this.y; + var 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) { + _proto.min = function min(v) { this.x = Math.min(this.x, v.x); this.y = Math.min(this.y, v.y); return this; - } + }; - max(v) { + _proto.max = function max(v) { this.x = Math.max(this.x, v.x); this.y = Math.max(this.y, v.y); return this; - } + }; - clamp(min, max) { + _proto.clamp = function 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) { + _proto.clampScalar = function 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(); + _proto.clampLength = function clampLength(min, max) { + var length = this.length(); return this.divideScalar(length || 1).multiplyScalar(Math.max(min, Math.min(max, length))); - } + }; - floor() { + _proto.floor = function floor() { this.x = Math.floor(this.x); this.y = Math.floor(this.y); return this; - } + }; - ceil() { + _proto.ceil = function ceil() { this.x = Math.ceil(this.x); this.y = Math.ceil(this.y); return this; - } + }; - round() { + _proto.round = function round() { this.x = Math.round(this.x); this.y = Math.round(this.y); return this; - } + }; - roundToZero() { + _proto.roundToZero = function 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() { + _proto.negate = function negate() { this.x = -this.x; this.y = -this.y; return this; - } + }; - dot(v) { + _proto.dot = function dot(v) { return this.x * v.x + this.y * v.y; - } + }; - cross(v) { + _proto.cross = function cross(v) { return this.x * v.y - this.y * v.x; - } + }; - lengthSq() { + _proto.lengthSq = function lengthSq() { return this.x * this.x + this.y * this.y; - } + }; - length() { + _proto.length = function length() { return Math.sqrt(this.x * this.x + this.y * this.y); - } + }; - manhattanLength() { + _proto.manhattanLength = function manhattanLength() { return Math.abs(this.x) + Math.abs(this.y); - } + }; - normalize() { + _proto.normalize = function normalize() { return this.divideScalar(this.length() || 1); - } + }; - angle() { + _proto.angle = function angle() { // computes the angle in radians with respect to the positive x-axis - const angle = Math.atan2(-this.y, -this.x) + Math.PI; + var angle = Math.atan2(-this.y, -this.x) + Math.PI; return angle; - } + }; - distanceTo(v) { + _proto.distanceTo = function distanceTo(v) { return Math.sqrt(this.distanceToSquared(v)); - } + }; - distanceToSquared(v) { - const dx = this.x - v.x, - dy = this.y - v.y; + _proto.distanceToSquared = function distanceToSquared(v) { + var dx = this.x - v.x, + dy = this.y - v.y; return dx * dx + dy * dy; - } + }; - manhattanDistanceTo(v) { + _proto.manhattanDistanceTo = function manhattanDistanceTo(v) { return Math.abs(this.x - v.x) + Math.abs(this.y - v.y); - } + }; - setLength(length) { + _proto.setLength = function setLength(length) { return this.normalize().multiplyScalar(length); - } + }; - lerp(v, alpha) { + _proto.lerp = function lerp(v, alpha) { this.x += (v.x - this.x) * alpha; this.y += (v.y - this.y) * alpha; return this; - } + }; - lerpVectors(v1, v2, alpha) { + _proto.lerpVectors = function 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) { + _proto.equals = function equals(v) { return v.x === this.x && v.y === this.y; - } + }; + + _proto.fromArray = function fromArray(array, offset) { + if (offset === void 0) { + offset = 0; + } - fromArray(array, offset = 0) { this.x = array[offset]; this.y = array[offset + 1]; return this; - } + }; + + _proto.toArray = function toArray(array, offset) { + if (array === void 0) { + array = []; + } + + if (offset === void 0) { + offset = 0; + } - toArray(array = [], offset = 0) { array[offset] = this.x; array[offset + 1] = this.y; return array; - } + }; - fromBufferAttribute(attribute, index, offset) { + _proto.fromBufferAttribute = function fromBufferAttribute(attribute, index, offset) { if (offset !== undefined) { console.warn('THREE.Vector2: offset has been removed from .fromBufferAttribute().'); } @@ -718,30 +836,49 @@ this.x = attribute.getX(index); this.y = attribute.getY(index); return this; - } + }; - rotateAround(center, angle) { - const c = Math.cos(angle), - s = Math.sin(angle); - const x = this.x - center.x; - const y = this.y - center.y; + _proto.rotateAround = function rotateAround(center, angle) { + var c = Math.cos(angle), + s = Math.sin(angle); + var x = this.x - center.x; + var y = this.y - center.y; this.x = x * c - y * s + center.x; this.y = x * s + y * c + center.y; return this; - } + }; - random() { + _proto.random = function random() { this.x = Math.random(); this.y = Math.random(); return this; - } + }; - } + _createClass(Vector2, [{ + key: "width", + get: function get() { + return this.x; + }, + set: function set(value) { + this.x = value; + } + }, { + key: "height", + get: function get() { + return this.y; + }, + set: function set(value) { + this.y = value; + } + }]); + + return Vector2; + }(); Vector2.prototype.isVector2 = true; - class Matrix3 { - constructor() { + var Matrix3 = /*#__PURE__*/function () { + function Matrix3() { this.elements = [1, 0, 0, 0, 1, 0, 0, 0, 1]; if (arguments.length > 0) { @@ -749,8 +886,10 @@ } } - set(n11, n12, n13, n21, n22, n23, n31, n32, n33) { - const te = this.elements; + var _proto = Matrix3.prototype; + + _proto.set = function set(n11, n12, n13, n21, n22, n23, n31, n32, n33) { + var te = this.elements; te[0] = n11; te[1] = n21; te[2] = n31; @@ -761,16 +900,16 @@ te[7] = n23; te[8] = n33; return this; - } + }; - identity() { + _proto.identity = function identity() { this.set(1, 0, 0, 0, 1, 0, 0, 0, 1); return this; - } + }; - copy(m) { - const te = this.elements; - const me = m.elements; + _proto.copy = function copy(m) { + var te = this.elements; + var me = m.elements; te[0] = me[0]; te[1] = me[1]; te[2] = me[2]; @@ -781,51 +920,51 @@ te[7] = me[7]; te[8] = me[8]; return this; - } + }; - extractBasis(xAxis, yAxis, zAxis) { + _proto.extractBasis = function extractBasis(xAxis, yAxis, zAxis) { xAxis.setFromMatrix3Column(this, 0); yAxis.setFromMatrix3Column(this, 1); zAxis.setFromMatrix3Column(this, 2); return this; - } + }; - setFromMatrix4(m) { - const me = m.elements; + _proto.setFromMatrix4 = function setFromMatrix4(m) { + var 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) { + _proto.multiply = function multiply(m) { return this.multiplyMatrices(this, m); - } + }; - premultiply(m) { + _proto.premultiply = function 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]; - const a21 = ae[1], - a22 = ae[4], - a23 = ae[7]; - const a31 = ae[2], - a32 = ae[5], - a33 = ae[8]; - const b11 = be[0], - b12 = be[3], - b13 = be[6]; - const b21 = be[1], - b22 = be[4], - b23 = be[7]; - const b31 = be[2], - b32 = be[5], - b33 = be[8]; + _proto.multiplyMatrices = function multiplyMatrices(a, b) { + var ae = a.elements; + var be = b.elements; + var te = this.elements; + var a11 = ae[0], + a12 = ae[3], + a13 = ae[6]; + var a21 = ae[1], + a22 = ae[4], + a23 = ae[7]; + var a31 = ae[2], + a32 = ae[5], + a33 = ae[8]; + var b11 = be[0], + b12 = be[3], + b13 = be[6]; + var b21 = be[1], + b22 = be[4], + b23 = be[7]; + var b31 = be[2], + 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; @@ -836,10 +975,10 @@ te[5] = a31 * b12 + a32 * b22 + a33 * b32; te[8] = a31 * b13 + a32 * b23 + a33 * b33; return this; - } + }; - multiplyScalar(s) { - const te = this.elements; + _proto.multiplyScalar = function multiplyScalar(s) { + var te = this.elements; te[0] *= s; te[3] *= s; te[6] *= s; @@ -850,39 +989,39 @@ te[5] *= s; 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]; + _proto.determinant = function determinant() { + var te = this.elements; + var 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]; 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; + _proto.invert = function invert() { + var 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; if (det === 0) return this.set(0, 0, 0, 0, 0, 0, 0, 0, 0); - const detInv = 1 / det; + var detInv = 1 / det; te[0] = t11 * detInv; te[1] = (n31 * n23 - n33 * n21) * detInv; te[2] = (n32 * n21 - n31 * n22) * detInv; @@ -893,11 +1032,11 @@ te[7] = (n21 * n13 - n23 * n11) * detInv; te[8] = (n22 * n11 - n21 * n12) * detInv; return this; - } + }; - transpose() { - let tmp; - const m = this.elements; + _proto.transpose = function transpose() { + var tmp; + var m = this.elements; tmp = m[1]; m[1] = m[3]; m[3] = tmp; @@ -908,14 +1047,14 @@ m[5] = m[7]; m[7] = tmp; return this; - } + }; - getNormalMatrix(matrix4) { + _proto.getNormalMatrix = function getNormalMatrix(matrix4) { return this.setFromMatrix4(matrix4).invert().transpose(); - } + }; - transposeIntoArray(r) { - const m = this.elements; + _proto.transposeIntoArray = function transposeIntoArray(r) { + var m = this.elements; r[0] = m[0]; r[1] = m[3]; r[2] = m[6]; @@ -926,17 +1065,17 @@ r[7] = m[5]; r[8] = m[8]; return this; - } + }; - setUvTransform(tx, ty, sx, sy, rotation, cx, cy) { - const c = Math.cos(rotation); - const s = Math.sin(rotation); + _proto.setUvTransform = function setUvTransform(tx, ty, sx, sy, rotation, cx, cy) { + var c = Math.cos(rotation); + var 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; + _proto.scale = function scale(sx, sy) { + var te = this.elements; te[0] *= sx; te[3] *= sx; te[6] *= sx; @@ -944,18 +1083,18 @@ te[4] *= sy; 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]; - const a21 = te[1], - a22 = te[4], - a23 = te[7]; + _proto.rotate = function rotate(theta) { + var c = Math.cos(theta); + var s = Math.sin(theta); + var te = this.elements; + var a11 = te[0], + a12 = te[3], + a13 = te[6]; + var a21 = te[1], + a22 = te[4], + a23 = te[7]; te[0] = c * a11 + s * a21; te[3] = c * a12 + s * a22; te[6] = c * a13 + s * a23; @@ -963,10 +1102,10 @@ te[4] = -s * a12 + c * a22; te[7] = -s * a13 + c * a23; return this; - } + }; - translate(tx, ty) { - const te = this.elements; + _proto.translate = function translate(tx, ty) { + var te = this.elements; te[0] += tx * te[2]; te[3] += tx * te[5]; te[6] += tx * te[8]; @@ -974,29 +1113,41 @@ te[4] += ty * te[5]; te[7] += ty * te[8]; return this; - } + }; - equals(matrix) { - const te = this.elements; - const me = matrix.elements; + _proto.equals = function equals(matrix) { + var te = this.elements; + var me = matrix.elements; - for (let i = 0; i < 9; i++) { + for (var i = 0; i < 9; i++) { if (te[i] !== me[i]) return false; } return true; - } + }; + + _proto.fromArray = function fromArray(array, offset) { + if (offset === void 0) { + offset = 0; + } - fromArray(array, offset = 0) { - for (let i = 0; i < 9; i++) { + for (var i = 0; i < 9; i++) { this.elements[i] = array[i + offset]; } return this; - } + }; + + _proto.toArray = function toArray(array, offset) { + if (array === void 0) { + array = []; + } + + if (offset === void 0) { + offset = 0; + } - toArray(array = [], offset = 0) { - const te = this.elements; + var te = this.elements; array[offset] = te[0]; array[offset + 1] = te[1]; array[offset + 2] = te[2]; @@ -1007,20 +1158,21 @@ array[offset + 7] = te[7]; array[offset + 8] = te[8]; return array; - } + }; - clone() { + _proto.clone = function clone() { return new this.constructor().fromArray(this.elements); - } + }; - } + return Matrix3; + }(); Matrix3.prototype.isMatrix3 = true; - let _canvas; + var _canvas; - const ImageUtils = { - getDataURL: function (image) { + var ImageUtils = { + getDataURL: function getDataURL(image) { if (/^data:/i.test(image.src)) { return image.src; } @@ -1029,7 +1181,7 @@ return image.src; } - let canvas; + var canvas; if (image instanceof HTMLCanvasElement) { canvas = image; @@ -1038,7 +1190,7 @@ _canvas.width = image.width; _canvas.height = image.height; - const context = _canvas.getContext('2d'); + var context = _canvas.getContext('2d'); if (image instanceof ImageData) { context.putImageData(image, 0, 0); @@ -1058,56 +1210,103 @@ } }; - let textureId = 0; + var textureId = 0; + + var Texture = /*#__PURE__*/function (_EventDispatcher) { + _inheritsLoose(Texture, _EventDispatcher); + + function Texture(image, mapping, wrapS, wrapT, magFilter, minFilter, format, type, anisotropy, encoding) { + var _this; + + if (image === void 0) { + image = Texture.DEFAULT_IMAGE; + } + + if (mapping === void 0) { + mapping = Texture.DEFAULT_MAPPING; + } + + if (wrapS === void 0) { + wrapS = ClampToEdgeWrapping; + } + + if (wrapT === void 0) { + wrapT = ClampToEdgeWrapping; + } + + if (magFilter === void 0) { + magFilter = LinearFilter; + } + + if (minFilter === void 0) { + minFilter = LinearMipmapLinearFilter; + } + + if (format === void 0) { + format = RGBAFormat; + } + + if (type === void 0) { + type = UnsignedByteType; + } + + if (anisotropy === void 0) { + anisotropy = 1; + } + + if (encoding === void 0) { + encoding = LinearEncoding; + } - 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(); - Object.defineProperty(this, 'id', { + _this = _EventDispatcher.call(this) || this; + Object.defineProperty(_assertThisInitialized(_this), 'id', { value: textureId++ }); - this.uuid = MathUtils.generateUUID(); - this.name = ''; - this.image = image; - this.mipmaps = []; - this.mapping = mapping; - this.wrapS = wrapS; - this.wrapT = wrapT; - this.magFilter = magFilter; - this.minFilter = minFilter; - this.anisotropy = anisotropy; - this.format = format; - this.internalFormat = null; - this.type = type; - this.offset = new Vector2(0, 0); - this.repeat = new Vector2(1, 1); - this.center = new Vector2(0, 0); - this.rotation = 0; - this.matrixAutoUpdate = true; - this.matrix = new Matrix3(); - this.generateMipmaps = true; - 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) + _this.uuid = MathUtils.generateUUID(); + _this.name = ''; + _this.image = image; + _this.mipmaps = []; + _this.mapping = mapping; + _this.wrapS = wrapS; + _this.wrapT = wrapT; + _this.magFilter = magFilter; + _this.minFilter = minFilter; + _this.anisotropy = anisotropy; + _this.format = format; + _this.internalFormat = null; + _this.type = type; + _this.offset = new Vector2(0, 0); + _this.repeat = new Vector2(1, 1); + _this.center = new Vector2(0, 0); + _this.rotation = 0; + _this.matrixAutoUpdate = true; + _this.matrix = new Matrix3(); + _this.generateMipmaps = true; + _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.version = 0; - this.onUpdate = null; + _this.encoding = encoding; + _this.version = 0; + _this.onUpdate = null; + return _this; } - updateMatrix() { + var _proto = Texture.prototype; + + _proto.updateMatrix = function 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() { + _proto.clone = function clone() { return new this.constructor().copy(this); - } + }; - copy(source) { + _proto.copy = function copy(source) { this.name = source.name; this.image = source.image; this.mipmaps = source.mipmaps.slice(0); @@ -1132,16 +1331,16 @@ this.unpackAlignment = source.unpackAlignment; this.encoding = source.encoding; return this; - } + }; - toJSON(meta) { - const isRootObject = meta === undefined || typeof meta === 'string'; + _proto.toJSON = function toJSON(meta) { + var isRootObject = meta === undefined || typeof meta === 'string'; if (!isRootObject && meta.textures[this.uuid] !== undefined) { return meta.textures[this.uuid]; } - const output = { + var output = { metadata: { version: 4.5, type: 'Texture', @@ -1168,20 +1367,20 @@ if (this.image !== undefined) { // TODO: Move to THREE.Image - const image = this.image; + var image = this.image; if (image.uuid === undefined) { image.uuid = MathUtils.generateUUID(); // UGH } if (!isRootObject && meta.images[image.uuid] === undefined) { - let url; + var url; if (Array.isArray(image)) { // process array of images e.g. CubeTexture url = []; - for (let i = 0, l = image.length; i < l; i++) { + for (var i = 0, l = image.length; i < l; i++) { // check cube texture with data textures if (image[i].isDataTexture) { url.push(serializeImage(image[i].image)); @@ -1208,15 +1407,15 @@ } return output; - } + }; - dispose() { + _proto.dispose = function dispose() { this.dispatchEvent({ type: 'dispose' }); - } + }; - transformUv(uv) { + _proto.transformUv = function transformUv(uv) { if (this.mapping !== UVMapping) return uv; uv.applyMatrix3(this.matrix); @@ -1267,13 +1466,17 @@ } return uv; - } + }; - set needsUpdate(value) { - if (value === true) this.version++; - } + _createClass(Texture, [{ + key: "needsUpdate", + set: function set(value) { + if (value === true) this.version++; + } + }]); - } + return Texture; + }(EventDispatcher); Texture.DEFAULT_IMAGE = undefined; Texture.DEFAULT_MAPPING = UVMapping; @@ -1299,67 +1502,69 @@ } } - class Vector4 { - constructor(x = 0, y = 0, z = 0, w = 1) { + var Vector4 = /*#__PURE__*/function () { + function Vector4(x, y, z, w) { + if (x === void 0) { + x = 0; + } + + if (y === void 0) { + y = 0; + } + + if (z === void 0) { + z = 0; + } + + if (w === void 0) { + w = 1; + } + this.x = x; this.y = y; 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; - } + var _proto = Vector4.prototype; - set(x, y, z, w) { + _proto.set = function set(x, y, z, w) { this.x = x; this.y = y; this.z = z; this.w = w; return this; - } + }; - setScalar(scalar) { + _proto.setScalar = function setScalar(scalar) { this.x = scalar; this.y = scalar; this.z = scalar; this.w = scalar; return this; - } + }; - setX(x) { + _proto.setX = function setX(x) { this.x = x; return this; - } + }; - setY(y) { + _proto.setY = function setY(y) { this.y = y; return this; - } + }; - setZ(z) { + _proto.setZ = function setZ(z) { this.z = z; return this; - } + }; - setW(w) { + _proto.setW = function setW(w) { this.w = w; return this; - } + }; - setComponent(index, value) { + _proto.setComponent = function setComponent(index, value) { switch (index) { case 0: this.x = value; @@ -1382,9 +1587,9 @@ } return this; - } + }; - getComponent(index) { + _proto.getComponent = function getComponent(index) { switch (index) { case 0: return this.x; @@ -1401,21 +1606,21 @@ default: throw new Error('index is out of range: ' + index); } - } + }; - clone() { + _proto.clone = function clone() { return new this.constructor(this.x, this.y, this.z, this.w); - } + }; - copy(v) { + _proto.copy = function copy(v) { this.x = v.x; this.y = v.y; this.z = v.z; this.w = v.w !== undefined ? v.w : 1; return this; - } + }; - add(v, w) { + _proto.add = function 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); @@ -1426,33 +1631,33 @@ this.z += v.z; this.w += v.w; return this; - } + }; - addScalar(s) { + _proto.addScalar = function addScalar(s) { this.x += s; this.y += s; this.z += s; this.w += s; return this; - } + }; - addVectors(a, b) { + _proto.addVectors = function addVectors(a, b) { this.x = a.x + b.x; this.y = a.y + b.y; this.z = a.z + b.z; this.w = a.w + b.w; return this; - } + }; - addScaledVector(v, s) { + _proto.addScaledVector = function addScaledVector(v, s) { this.x += v.x * s; this.y += v.y * s; this.z += v.z * s; this.w += v.w * s; return this; - } + }; - sub(v, w) { + _proto.sub = function 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); @@ -1463,62 +1668,62 @@ this.z -= v.z; this.w -= v.w; return this; - } + }; - subScalar(s) { + _proto.subScalar = function subScalar(s) { this.x -= s; this.y -= s; this.z -= s; this.w -= s; return this; - } + }; - subVectors(a, b) { + _proto.subVectors = function subVectors(a, b) { this.x = a.x - b.x; this.y = a.y - b.y; this.z = a.z - b.z; this.w = a.w - b.w; return this; - } + }; - multiply(v) { + _proto.multiply = function multiply(v) { this.x *= v.x; this.y *= v.y; this.z *= v.z; this.w *= v.w; return this; - } + }; - multiplyScalar(scalar) { + _proto.multiplyScalar = function multiplyScalar(scalar) { this.x *= scalar; this.y *= scalar; this.z *= scalar; this.w *= scalar; return this; - } + }; - applyMatrix4(m) { - const x = this.x, - y = this.y, - z = this.z, - w = this.w; - const e = m.elements; + _proto.applyMatrix4 = function applyMatrix4(m) { + var x = this.x, + y = this.y, + z = this.z, + w = this.w; + var 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; this.z = e[2] * x + e[6] * y + e[10] * z + e[14] * w; this.w = e[3] * x + e[7] * y + e[11] * z + e[15] * w; return this; - } + }; - divideScalar(scalar) { + _proto.divideScalar = function divideScalar(scalar) { return this.multiplyScalar(1 / scalar); - } + }; - setAxisAngleFromQuaternion(q) { + _proto.setAxisAngleFromQuaternion = function 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); + var s = Math.sqrt(1 - q.w * q.w); if (s < 0.0001) { this.x = 1; @@ -1531,27 +1736,27 @@ } return this; - } + }; - setAxisAngleFromRotationMatrix(m) { + _proto.setAxisAngleFromRotationMatrix = function 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 + var angle, x, y, z; // variables for result - const epsilon = 0.01, - // margin to allow for rounding errors + var epsilon = 0.01, + // margin to allow for rounding errors epsilon2 = 0.1, - // margin to distinguish between 0 and 180 degrees + // 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]; + 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 @@ -1565,12 +1770,12 @@ angle = Math.PI; - const xx = (m11 + 1) / 2; - const yy = (m22 + 1) / 2; - const zz = (m33 + 1) / 2; - const xy = (m12 + m21) / 4; - const xz = (m13 + m31) / 4; - const yz = (m23 + m32) / 4; + var xx = (m11 + 1) / 2; + var yy = (m22 + 1) / 2; + var zz = (m33 + 1) / 2; + var xy = (m12 + m21) / 4; + var xz = (m13 + m31) / 4; + var yz = (m23 + m32) / 4; if (xx > yy && xx > zz) { // m11 is the largest diagonal term @@ -1612,7 +1817,7 @@ } // 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 + var 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 // caught by singularity test above, but I've left it in just in case @@ -1622,147 +1827,159 @@ this.z = (m21 - m12) / s; this.w = Math.acos((m11 + m22 + m33 - 1) / 2); return this; - } + }; - min(v) { + _proto.min = function 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); this.w = Math.min(this.w, v.w); return this; - } + }; - max(v) { + _proto.max = function 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); this.w = Math.max(this.w, v.w); return this; - } + }; - clamp(min, max) { + _proto.clamp = function 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) { + _proto.clampScalar = function 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)); this.w = Math.max(minVal, Math.min(maxVal, this.w)); return this; - } + }; - clampLength(min, max) { - const length = this.length(); + _proto.clampLength = function clampLength(min, max) { + var length = this.length(); return this.divideScalar(length || 1).multiplyScalar(Math.max(min, Math.min(max, length))); - } + }; - floor() { + _proto.floor = function floor() { this.x = Math.floor(this.x); this.y = Math.floor(this.y); this.z = Math.floor(this.z); this.w = Math.floor(this.w); return this; - } + }; - ceil() { + _proto.ceil = function ceil() { this.x = Math.ceil(this.x); this.y = Math.ceil(this.y); this.z = Math.ceil(this.z); this.w = Math.ceil(this.w); return this; - } + }; - round() { + _proto.round = function round() { this.x = Math.round(this.x); this.y = Math.round(this.y); this.z = Math.round(this.z); this.w = Math.round(this.w); return this; - } + }; - roundToZero() { + _proto.roundToZero = function 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); this.w = this.w < 0 ? Math.ceil(this.w) : Math.floor(this.w); return this; - } + }; - negate() { + _proto.negate = function negate() { this.x = -this.x; this.y = -this.y; this.z = -this.z; this.w = -this.w; return this; - } + }; - dot(v) { + _proto.dot = function dot(v) { return this.x * v.x + this.y * v.y + this.z * v.z + this.w * v.w; - } + }; - lengthSq() { + _proto.lengthSq = function lengthSq() { return this.x * this.x + this.y * this.y + this.z * this.z + this.w * this.w; - } + }; - length() { + _proto.length = function length() { return Math.sqrt(this.x * this.x + this.y * this.y + this.z * this.z + this.w * this.w); - } + }; - manhattanLength() { + _proto.manhattanLength = function manhattanLength() { return Math.abs(this.x) + Math.abs(this.y) + Math.abs(this.z) + Math.abs(this.w); - } + }; - normalize() { + _proto.normalize = function normalize() { return this.divideScalar(this.length() || 1); - } + }; - setLength(length) { + _proto.setLength = function setLength(length) { return this.normalize().multiplyScalar(length); - } + }; - lerp(v, alpha) { + _proto.lerp = function lerp(v, alpha) { this.x += (v.x - this.x) * alpha; this.y += (v.y - this.y) * alpha; this.z += (v.z - this.z) * alpha; this.w += (v.w - this.w) * alpha; return this; - } + }; - lerpVectors(v1, v2, alpha) { + _proto.lerpVectors = function 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; this.w = v1.w + (v2.w - v1.w) * alpha; return this; - } + }; - equals(v) { + _proto.equals = function equals(v) { return v.x === this.x && v.y === this.y && v.z === this.z && v.w === this.w; - } + }; + + _proto.fromArray = function fromArray(array, offset) { + if (offset === void 0) { + offset = 0; + } - fromArray(array, offset = 0) { this.x = array[offset]; this.y = array[offset + 1]; this.z = array[offset + 2]; this.w = array[offset + 3]; return this; - } + }; + + _proto.toArray = function toArray(array, offset) { + if (array === void 0) { + array = []; + } + + if (offset === void 0) { + offset = 0; + } - toArray(array = [], offset = 0) { array[offset] = this.x; array[offset + 1] = this.y; array[offset + 2] = this.z; array[offset + 3] = this.w; return array; - } + }; - fromBufferAttribute(attribute, index, offset) { + _proto.fromBufferAttribute = function fromBufferAttribute(attribute, index, offset) { if (offset !== undefined) { console.warn('THREE.Vector4: offset has been removed from .fromBufferAttribute().'); } @@ -1772,17 +1989,36 @@ this.z = attribute.getZ(index); this.w = attribute.getW(index); return this; - } + }; - random() { + _proto.random = function random() { this.x = Math.random(); this.y = Math.random(); this.z = Math.random(); this.w = Math.random(); return this; - } + }; - } + _createClass(Vector4, [{ + key: "width", + get: function get() { + return this.z; + }, + set: function set(value) { + this.z = value; + } + }, { + key: "height", + get: function get() { + return this.w; + }, + set: function set(value) { + this.w = value; + } + }]); + + return Vector4; + }(); Vector4.prototype.isVector4 = true; @@ -1792,38 +2028,49 @@ * depthBuffer/stencilBuffer: Booleans to indicate if we should generate these buffers */ - class WebGLRenderTarget extends EventDispatcher { - constructor(width, height, options) { - super(); - this.width = width; - this.height = height; - this.depth = 1; - this.scissor = new Vector4(0, 0, width, height); - this.scissorTest = false; - this.viewport = new Vector4(0, 0, width, height); + var WebGLRenderTarget = /*#__PURE__*/function (_EventDispatcher) { + _inheritsLoose(WebGLRenderTarget, _EventDispatcher); + + function WebGLRenderTarget(width, height, options) { + var _this; + + _this = _EventDispatcher.call(this) || this; + _this.width = width; + _this.height = height; + _this.depth = 1; + _this.scissor = new Vector4(0, 0, width, height); + _this.scissorTest = false; + _this.viewport = new Vector4(0, 0, width, height); options = options || {}; - this.texture = new Texture(undefined, options.mapping, options.wrapS, options.wrapT, options.magFilter, options.minFilter, options.format, options.type, options.anisotropy, options.encoding); - this.texture.image = {}; - this.texture.image.width = width; - this.texture.image.height = height; - this.texture.image.depth = 1; - this.texture.generateMipmaps = options.generateMipmaps !== undefined ? options.generateMipmaps : false; - this.texture.minFilter = options.minFilter !== undefined ? options.minFilter : LinearFilter; - this.depthBuffer = options.depthBuffer !== undefined ? options.depthBuffer : true; - this.stencilBuffer = options.stencilBuffer !== undefined ? options.stencilBuffer : false; - this.depthTexture = options.depthTexture !== undefined ? options.depthTexture : null; - } - - setTexture(texture) { + _this.texture = new Texture(undefined, options.mapping, options.wrapS, options.wrapT, options.magFilter, options.minFilter, options.format, options.type, options.anisotropy, options.encoding); + _this.texture.image = {}; + _this.texture.image.width = width; + _this.texture.image.height = height; + _this.texture.image.depth = 1; + _this.texture.generateMipmaps = options.generateMipmaps !== undefined ? options.generateMipmaps : false; + _this.texture.minFilter = options.minFilter !== undefined ? options.minFilter : LinearFilter; + _this.depthBuffer = options.depthBuffer !== undefined ? options.depthBuffer : true; + _this.stencilBuffer = options.stencilBuffer !== undefined ? options.stencilBuffer : false; + _this.depthTexture = options.depthTexture !== undefined ? options.depthTexture : null; + return _this; + } + + var _proto = WebGLRenderTarget.prototype; + + _proto.setTexture = function setTexture(texture) { texture.image = { width: this.width, height: this.height, depth: this.depth }; this.texture = texture; - } + }; + + _proto.setSize = function setSize(width, height, depth) { + if (depth === void 0) { + depth = 1; + } - setSize(width, height, depth = 1) { if (this.width !== width || this.height !== height || this.depth !== depth) { this.width = width; this.height = height; @@ -1836,13 +2083,13 @@ this.viewport.set(0, 0, width, height); this.scissor.set(0, 0, width, height); - } + }; - clone() { + _proto.clone = function clone() { return new this.constructor().copy(this); - } + }; - copy(source) { + _proto.copy = function copy(source) { this.width = source.width; this.height = source.height; this.depth = source.depth; @@ -1852,56 +2099,82 @@ this.stencilBuffer = source.stencilBuffer; this.depthTexture = source.depthTexture; return this; - } + }; - dispose() { + _proto.dispose = function dispose() { this.dispatchEvent({ type: 'dispose' }); - } + }; - } + return WebGLRenderTarget; + }(EventDispatcher); WebGLRenderTarget.prototype.isWebGLRenderTarget = true; - class WebGLMultisampleRenderTarget extends WebGLRenderTarget { - constructor(width, height, options) { - super(width, height, options); - this.samples = 4; + var WebGLMultisampleRenderTarget = /*#__PURE__*/function (_WebGLRenderTarget) { + _inheritsLoose(WebGLMultisampleRenderTarget, _WebGLRenderTarget); + + function WebGLMultisampleRenderTarget(width, height, options) { + var _this; + + _this = _WebGLRenderTarget.call(this, width, height, options) || this; + _this.samples = 4; + return _this; } - copy(source) { - super.copy.call(this, source); + var _proto = WebGLMultisampleRenderTarget.prototype; + + _proto.copy = function copy(source) { + _WebGLRenderTarget.prototype.copy.call(this, source); + this.samples = source.samples; return this; - } + }; - } + return WebGLMultisampleRenderTarget; + }(WebGLRenderTarget); WebGLMultisampleRenderTarget.prototype.isWebGLMultisampleRenderTarget = true; - class Quaternion { - constructor(x = 0, y = 0, z = 0, w = 1) { + var Quaternion = /*#__PURE__*/function () { + function Quaternion(x, y, z, w) { + if (x === void 0) { + x = 0; + } + + if (y === void 0) { + y = 0; + } + + if (z === void 0) { + z = 0; + } + + if (w === void 0) { + w = 1; + } + this._x = x; this._y = y; this._z = z; this._w = w; } - static slerp(qa, qb, qm, t) { + Quaternion.slerp = function slerp(qa, qb, qm, t) { return qm.copy(qa).slerp(qb, t); - } + }; - static slerpFlat(dst, dstOffset, src0, srcOffset0, src1, srcOffset1, t) { + Quaternion.slerpFlat = function slerpFlat(dst, dstOffset, src0, srcOffset0, src1, srcOffset1, t) { // fuzz-free, array-based Quaternion SLERP operation - let x0 = src0[srcOffset0 + 0], + var x0 = src0[srcOffset0 + 0], 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]; + var x1 = src1[srcOffset1 + 0], + y1 = src1[srcOffset1 + 1], + z1 = src1[srcOffset1 + 2], + w1 = src1[srcOffset1 + 3]; if (t === 0) { dst[dstOffset + 0] = x0; @@ -1920,26 +2193,26 @@ } 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: + var s = 1 - t; + var 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: if (sqrSin > Number.EPSILON) { - const sin = Math.sqrt(sqrSin), - len = Math.atan2(sin, cos * dir); + var sin = Math.sqrt(sqrSin), + len = Math.atan2(sin, cos * dir); s = Math.sin(s * len) / sin; t = Math.sin(t * len) / sin; } - const tDir = t * dir; + var 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: if (s === 1 - t) { - const f = 1 / Math.sqrt(x0 * x0 + y0 * y0 + z0 * z0 + w0 * w0); + var f = 1 / Math.sqrt(x0 * x0 + y0 * y0 + z0 * z0 + w0 * w0); x0 *= f; y0 *= f; z0 *= f; @@ -1951,65 +2224,27 @@ 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]; - const z0 = src0[srcOffset0 + 2]; - const w0 = src0[srcOffset0 + 3]; - const x1 = src1[srcOffset1]; - const y1 = src1[srcOffset1 + 1]; - const z1 = src1[srcOffset1 + 2]; - const w1 = src1[srcOffset1 + 3]; + Quaternion.multiplyQuaternionsFlat = function multiplyQuaternionsFlat(dst, dstOffset, src0, srcOffset0, src1, srcOffset1) { + var x0 = src0[srcOffset0]; + var y0 = src0[srcOffset0 + 1]; + var z0 = src0[srcOffset0 + 2]; + var w0 = src0[srcOffset0 + 3]; + var x1 = src1[srcOffset1]; + var y1 = src1[srcOffset1 + 1]; + var z1 = src1[srcOffset1 + 2]; + var w1 = src1[srcOffset1 + 3]; dst[dstOffset] = x0 * w1 + w0 * x1 + y0 * z1 - z0 * y1; dst[dstOffset + 1] = y0 * w1 + w0 * y1 + z0 * x1 - x0 * z1; dst[dstOffset + 2] = z0 * w1 + w0 * z1 + x0 * y1 - y0 * x1; 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(); - } + var _proto = Quaternion.prototype; - set(x, y, z, w) { + _proto.set = function set(x, y, z, w) { this._x = x; this._y = y; this._z = z; @@ -2018,13 +2253,13 @@ this._onChangeCallback(); return this; - } + }; - clone() { + _proto.clone = function clone() { return new this.constructor(this._x, this._y, this._z, this._w); - } + }; - copy(quaternion) { + _proto.copy = function copy(quaternion) { this._x = quaternion.x; this._y = quaternion.y; this._z = quaternion.z; @@ -2033,28 +2268,28 @@ this._onChangeCallback(); return this; - } + }; - setFromEuler(euler, update) { + _proto.setFromEuler = function 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/ + var x = euler._x, + 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 - const cos = Math.cos; - const sin = Math.sin; - const c1 = cos(x / 2); - const c2 = cos(y / 2); - const c3 = cos(z / 2); - const s1 = sin(x / 2); - const s2 = sin(y / 2); - const s3 = sin(z / 2); + var cos = Math.cos; + var sin = Math.sin; + var c1 = cos(x / 2); + var c2 = cos(y / 2); + var c3 = cos(z / 2); + var s1 = sin(x / 2); + var s2 = sin(y / 2); + var s3 = sin(z / 2); switch (order) { case 'XYZ': @@ -2105,13 +2340,13 @@ if (update !== false) this._onChangeCallback(); return this; - } + }; - setFromAxisAngle(axis, angle) { + _proto.setFromAxisAngle = function 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); + var halfAngle = angle / 2, + s = Math.sin(halfAngle); this._x = axis.x * s; this._y = axis.y * s; this._z = axis.z * s; @@ -2120,57 +2355,60 @@ this._onChangeCallback(); return this; - } + }; - setFromRotationMatrix(m) { + _proto.setFromRotationMatrix = function 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; + var 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); + var s = 0.5 / Math.sqrt(trace + 1.0); this._w = 0.25 / s; this._x = (m32 - m23) * s; this._y = (m13 - m31) * s; this._z = (m21 - m12) * s; } else if (m11 > m22 && m11 > m33) { - const s = 2.0 * Math.sqrt(1.0 + m11 - m22 - m33); - this._w = (m32 - m23) / s; - this._x = 0.25 * s; - this._y = (m12 + m21) / s; - this._z = (m13 + m31) / s; + var _s = 2.0 * Math.sqrt(1.0 + m11 - m22 - m33); + + this._w = (m32 - m23) / _s; + this._x = 0.25 * _s; + this._y = (m12 + m21) / _s; + this._z = (m13 + m31) / _s; } else if (m22 > m33) { - const s = 2.0 * Math.sqrt(1.0 + m22 - m11 - m33); - this._w = (m13 - m31) / s; - this._x = (m12 + m21) / s; - this._y = 0.25 * s; - this._z = (m23 + m32) / s; + var _s2 = 2.0 * Math.sqrt(1.0 + m22 - m11 - m33); + + this._w = (m13 - m31) / _s2; + this._x = (m12 + m21) / _s2; + this._y = 0.25 * _s2; + this._z = (m23 + m32) / _s2; } else { - const s = 2.0 * Math.sqrt(1.0 + m33 - m11 - m22); - this._w = (m21 - m12) / s; - this._x = (m13 + m31) / s; - this._y = (m23 + m32) / s; - this._z = 0.25 * s; + var _s3 = 2.0 * Math.sqrt(1.0 + m33 - m11 - m22); + + this._w = (m21 - m12) / _s3; + this._x = (m13 + m31) / _s3; + this._y = (m23 + m32) / _s3; + this._z = 0.25 * _s3; } this._onChangeCallback(); return this; - } + }; - setFromUnitVectors(vFrom, vTo) { + _proto.setFromUnitVectors = function setFromUnitVectors(vFrom, vTo) { // assumes direction vectors vFrom and vTo are normalized - let r = vFrom.dot(vTo) + 1; + var r = vFrom.dot(vTo) + 1; if (r < Number.EPSILON) { // vFrom and vTo point in opposite directions @@ -2196,30 +2434,30 @@ } return this.normalize(); - } + }; - angleTo(q) { + _proto.angleTo = function angleTo(q) { return 2 * Math.acos(Math.abs(MathUtils.clamp(this.dot(q), -1, 1))); - } + }; - rotateTowards(q, step) { - const angle = this.angleTo(q); + _proto.rotateTowards = function rotateTowards(q, step) { + var angle = this.angleTo(q); if (angle === 0) return this; - const t = Math.min(1, step / angle); + var t = Math.min(1, step / angle); this.slerp(q, t); return this; - } + }; - identity() { + _proto.identity = function identity() { return this.set(0, 0, 0, 1); - } + }; - invert() { + _proto.invert = function invert() { // quaternion is assumed to have unit length return this.conjugate(); - } + }; - conjugate() { + _proto.conjugate = function conjugate() { this._x *= -1; this._y *= -1; this._z *= -1; @@ -2227,22 +2465,22 @@ this._onChangeCallback(); return this; - } + }; - dot(v) { + _proto.dot = function dot(v) { return this._x * v._x + this._y * v._y + this._z * v._z + this._w * v._w; - } + }; - lengthSq() { + _proto.lengthSq = function lengthSq() { return this._x * this._x + this._y * this._y + this._z * this._z + this._w * this._w; - } + }; - length() { + _proto.length = function 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(); + _proto.normalize = function normalize() { + var l = this.length(); if (l === 0) { this._x = 0; @@ -2260,31 +2498,31 @@ this._onChangeCallback(); return this; - } + }; - multiply(q, p) { + _proto.multiply = function 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) { + _proto.premultiply = function premultiply(q) { return this.multiplyQuaternions(q, this); - } + }; - multiplyQuaternions(a, b) { + _proto.multiplyQuaternions = function 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; - const qbx = b._x, - qby = b._y, - qbz = b._z, - qbw = b._w; + var qax = a._x, + qay = a._y, + qaz = a._z, + qaw = a._w; + var qbx = b._x, + 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; @@ -2293,17 +2531,17 @@ this._onChangeCallback(); return this; - } + }; - slerp(qb, t) { + _proto.slerp = function 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/ + var x = this._x, + y = this._y, + z = this._z, + w = this._w; // http://www.euclideanspace.com/maths/algebra/realNormedAlgebra/quaternions/slerp/ - let cosHalfTheta = w * qb._w + x * qb._x + y * qb._y + z * qb._z; + var cosHalfTheta = w * qb._w + x * qb._x + y * qb._y + z * qb._z; if (cosHalfTheta < 0) { this._w = -qb._w; @@ -2323,10 +2561,10 @@ return this; } - const sqrSinHalfTheta = 1.0 - cosHalfTheta * cosHalfTheta; + var sqrSinHalfTheta = 1.0 - cosHalfTheta * cosHalfTheta; if (sqrSinHalfTheta <= Number.EPSILON) { - const s = 1 - t; + var s = 1 - t; this._w = s * w + t * this._w; this._x = s * x + t * this._x; this._y = s * y + t * this._y; @@ -2338,10 +2576,10 @@ 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; + var sinHalfTheta = Math.sqrt(sqrSinHalfTheta); + var halfTheta = Math.atan2(sinHalfTheta, cosHalfTheta); + var ratioA = Math.sin((1 - 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; @@ -2350,13 +2588,17 @@ this._onChangeCallback(); return this; - } + }; - equals(quaternion) { + _proto.equals = function equals(quaternion) { return quaternion._x === this._x && quaternion._y === this._y && quaternion._z === this._z && quaternion._w === this._w; - } + }; + + _proto.fromArray = function fromArray(array, offset) { + if (offset === void 0) { + offset = 0; + } - fromArray(array, offset = 0) { this._x = array[offset]; this._y = array[offset + 1]; this._z = array[offset + 2]; @@ -2365,74 +2607,139 @@ this._onChangeCallback(); return this; - } + }; + + _proto.toArray = function toArray(array, offset) { + if (array === void 0) { + array = []; + } + + if (offset === void 0) { + offset = 0; + } - toArray(array = [], offset = 0) { array[offset] = this._x; array[offset + 1] = this._y; array[offset + 2] = this._z; array[offset + 3] = this._w; return array; - } + }; - fromBufferAttribute(attribute, index) { + _proto.fromBufferAttribute = function fromBufferAttribute(attribute, index) { this._x = attribute.getX(index); this._y = attribute.getY(index); this._z = attribute.getZ(index); this._w = attribute.getW(index); return this; - } + }; - _onChange(callback) { + _proto._onChange = function _onChange(callback) { this._onChangeCallback = callback; return this; - } + }; - _onChangeCallback() {} + _proto._onChangeCallback = function _onChangeCallback() {}; - } + _createClass(Quaternion, [{ + key: "x", + get: function get() { + return this._x; + }, + set: function set(value) { + this._x = value; - Quaternion.prototype.isQuaternion = true; + this._onChangeCallback(); + } + }, { + key: "y", + get: function get() { + return this._y; + }, + set: function set(value) { + this._y = value; + + this._onChangeCallback(); + } + }, { + key: "z", + get: function get() { + return this._z; + }, + set: function set(value) { + this._z = value; + + this._onChangeCallback(); + } + }, { + key: "w", + get: function get() { + return this._w; + }, + set: function set(value) { + this._w = value; + + this._onChangeCallback(); + } + }]); + + return Quaternion; + }(); + + Quaternion.prototype.isQuaternion = true; + + var Vector3 = /*#__PURE__*/function () { + function Vector3(x, y, z) { + if (x === void 0) { + x = 0; + } + + if (y === void 0) { + y = 0; + } + + if (z === void 0) { + z = 0; + } - class Vector3 { - constructor(x = 0, y = 0, z = 0) { this.x = x; this.y = y; this.z = z; } - set(x, y, z) { + var _proto = Vector3.prototype; + + _proto.set = function set(x, y, z) { if (z === undefined) z = this.z; // sprite.scale.set(x,y) this.x = x; this.y = y; this.z = z; return this; - } + }; - setScalar(scalar) { + _proto.setScalar = function setScalar(scalar) { this.x = scalar; this.y = scalar; this.z = scalar; return this; - } + }; - setX(x) { + _proto.setX = function setX(x) { this.x = x; return this; - } + }; - setY(y) { + _proto.setY = function setY(y) { this.y = y; return this; - } + }; - setZ(z) { + _proto.setZ = function setZ(z) { this.z = z; return this; - } + }; - setComponent(index, value) { + _proto.setComponent = function setComponent(index, value) { switch (index) { case 0: this.x = value; @@ -2451,9 +2758,9 @@ } return this; - } + }; - getComponent(index) { + _proto.getComponent = function getComponent(index) { switch (index) { case 0: return this.x; @@ -2467,20 +2774,20 @@ default: throw new Error('index is out of range: ' + index); } - } + }; - clone() { + _proto.clone = function clone() { return new this.constructor(this.x, this.y, this.z); - } + }; - copy(v) { + _proto.copy = function copy(v) { this.x = v.x; this.y = v.y; this.z = v.z; return this; - } + }; - add(v, w) { + _proto.add = function 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); @@ -2490,30 +2797,30 @@ this.y += v.y; this.z += v.z; return this; - } + }; - addScalar(s) { + _proto.addScalar = function addScalar(s) { this.x += s; this.y += s; this.z += s; return this; - } + }; - addVectors(a, b) { + _proto.addVectors = function 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) { + _proto.addScaledVector = function addScaledVector(v, s) { this.x += v.x * s; this.y += v.y * s; this.z += v.z * s; return this; - } + }; - sub(v, w) { + _proto.sub = function 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); @@ -2523,23 +2830,23 @@ this.y -= v.y; this.z -= v.z; return this; - } + }; - subScalar(s) { + _proto.subScalar = function subScalar(s) { this.x -= s; this.y -= s; this.z -= s; return this; - } + }; - subVectors(a, b) { + _proto.subVectors = function 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) { + _proto.multiply = function 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); @@ -2549,353 +2856,365 @@ this.y *= v.y; this.z *= v.z; return this; - } + }; - multiplyScalar(scalar) { + _proto.multiplyScalar = function multiplyScalar(scalar) { this.x *= scalar; this.y *= scalar; this.z *= scalar; return this; - } + }; - multiplyVectors(a, b) { + _proto.multiplyVectors = function 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) { + _proto.applyEuler = function 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)); - } + return this.applyQuaternion(_quaternion.setFromEuler(euler)); + }; - applyAxisAngle(axis, angle) { - return this.applyQuaternion(_quaternion$4.setFromAxisAngle(axis, angle)); - } + _proto.applyAxisAngle = function applyAxisAngle(axis, angle) { + return this.applyQuaternion(_quaternion.setFromAxisAngle(axis, angle)); + }; - applyMatrix3(m) { - const x = this.x, - y = this.y, - z = this.z; - const e = m.elements; + _proto.applyMatrix3 = function applyMatrix3(m) { + var x = this.x, + y = this.y, + z = this.z; + var 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) { + _proto.applyNormalMatrix = function applyNormalMatrix(m) { return this.applyMatrix3(m).normalize(); - } + }; - applyMatrix4(m) { - const x = this.x, - y = this.y, - z = this.z; - const e = m.elements; - const w = 1 / (e[3] * x + e[7] * y + e[11] * z + e[15]); + _proto.applyMatrix4 = function applyMatrix4(m) { + var x = this.x, + y = this.y, + z = this.z; + var e = m.elements; + var 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; this.y = (e[1] * x + e[5] * y + e[9] * z + e[13]) * w; 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; - const qx = q.x, - qy = q.y, - qz = q.z, - qw = q.w; // calculate quat * vector + _proto.applyQuaternion = function applyQuaternion(q) { + var x = this.x, + y = this.y, + z = this.z; + var qx = q.x, + 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 + var ix = qw * x + qy * z - qz * y; + var iy = qw * y + qz * x - qx * z; + var iz = qw * z + qx * y - qy * x; + var 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) { + _proto.project = function project(camera) { return this.applyMatrix4(camera.matrixWorldInverse).applyMatrix4(camera.projectionMatrix); - } + }; - unproject(camera) { + _proto.unproject = function unproject(camera) { return this.applyMatrix4(camera.projectionMatrixInverse).applyMatrix4(camera.matrixWorld); - } + }; - transformDirection(m) { + _proto.transformDirection = function transformDirection(m) { // input: THREE.Matrix4 affine matrix // vector interpreted as a direction - const x = this.x, - y = this.y, - z = this.z; - const e = m.elements; + var x = this.x, + y = this.y, + z = this.z; + var 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) { + _proto.divide = function divide(v) { this.x /= v.x; this.y /= v.y; this.z /= v.z; return this; - } + }; - divideScalar(scalar) { + _proto.divideScalar = function divideScalar(scalar) { return this.multiplyScalar(1 / scalar); - } + }; - min(v) { + _proto.min = function 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) { + _proto.max = function 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) { + _proto.clamp = function 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) { + _proto.clampScalar = function 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(); + _proto.clampLength = function clampLength(min, max) { + var length = this.length(); return this.divideScalar(length || 1).multiplyScalar(Math.max(min, Math.min(max, length))); - } + }; - floor() { + _proto.floor = function floor() { this.x = Math.floor(this.x); this.y = Math.floor(this.y); this.z = Math.floor(this.z); return this; - } + }; - ceil() { + _proto.ceil = function ceil() { this.x = Math.ceil(this.x); this.y = Math.ceil(this.y); this.z = Math.ceil(this.z); return this; - } + }; - round() { + _proto.round = function round() { this.x = Math.round(this.x); this.y = Math.round(this.y); this.z = Math.round(this.z); return this; - } + }; - roundToZero() { + _proto.roundToZero = function 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() { + _proto.negate = function negate() { this.x = -this.x; this.y = -this.y; this.z = -this.z; return this; - } + }; - dot(v) { + _proto.dot = function dot(v) { return this.x * v.x + this.y * v.y + this.z * v.z; } // TODO lengthSquared? + ; - - lengthSq() { + _proto.lengthSq = function lengthSq() { return this.x * this.x + this.y * this.y + this.z * this.z; - } + }; - length() { + _proto.length = function length() { return Math.sqrt(this.x * this.x + this.y * this.y + this.z * this.z); - } + }; - manhattanLength() { + _proto.manhattanLength = function manhattanLength() { return Math.abs(this.x) + Math.abs(this.y) + Math.abs(this.z); - } + }; - normalize() { + _proto.normalize = function normalize() { return this.divideScalar(this.length() || 1); - } + }; - setLength(length) { + _proto.setLength = function setLength(length) { return this.normalize().multiplyScalar(length); - } + }; - lerp(v, alpha) { + _proto.lerp = function 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) { + _proto.lerpVectors = function 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) { + _proto.cross = function 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; - const bx = b.x, - by = b.y, - bz = b.z; + _proto.crossVectors = function crossVectors(a, b) { + var ax = a.x, + ay = a.y, + az = a.z; + var bx = b.x, + 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(); + _proto.projectOnVector = function projectOnVector(v) { + var denominator = v.lengthSq(); if (denominator === 0) return this.set(0, 0, 0); - const scalar = v.dot(this) / denominator; + var scalar = v.dot(this) / denominator; return this.copy(v).multiplyScalar(scalar); - } + }; - projectOnPlane(planeNormal) { - _vector$c.copy(this).projectOnVector(planeNormal); + _proto.projectOnPlane = function projectOnPlane(planeNormal) { + _vector.copy(this).projectOnVector(planeNormal); - return this.sub(_vector$c); - } + return this.sub(_vector); + }; - reflect(normal) { + _proto.reflect = function 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))); - } + return this.sub(_vector.copy(normal).multiplyScalar(2 * this.dot(normal))); + }; - angleTo(v) { - const denominator = Math.sqrt(this.lengthSq() * v.lengthSq()); + _proto.angleTo = function angleTo(v) { + var 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 + var theta = this.dot(v) / denominator; // clamp, to handle numerical problems return Math.acos(MathUtils.clamp(theta, -1, 1)); - } + }; - distanceTo(v) { + _proto.distanceTo = function 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; + _proto.distanceToSquared = function distanceToSquared(v) { + var dx = this.x - v.x, + dy = this.y - v.y, + dz = this.z - v.z; return dx * dx + dy * dy + dz * dz; - } + }; - manhattanDistanceTo(v) { + _proto.manhattanDistanceTo = function manhattanDistanceTo(v) { return Math.abs(this.x - v.x) + Math.abs(this.y - v.y) + Math.abs(this.z - v.z); - } + }; - setFromSpherical(s) { + _proto.setFromSpherical = function setFromSpherical(s) { return this.setFromSphericalCoords(s.radius, s.phi, s.theta); - } + }; - setFromSphericalCoords(radius, phi, theta) { - const sinPhiRadius = Math.sin(phi) * radius; + _proto.setFromSphericalCoords = function setFromSphericalCoords(radius, phi, theta) { + var sinPhiRadius = Math.sin(phi) * radius; this.x = sinPhiRadius * Math.sin(theta); this.y = Math.cos(phi) * radius; this.z = sinPhiRadius * Math.cos(theta); return this; - } + }; - setFromCylindrical(c) { + _proto.setFromCylindrical = function setFromCylindrical(c) { return this.setFromCylindricalCoords(c.radius, c.theta, c.y); - } + }; - setFromCylindricalCoords(radius, theta, y) { + _proto.setFromCylindricalCoords = function 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; + _proto.setFromMatrixPosition = function setFromMatrixPosition(m) { + var e = m.elements; this.x = e[12]; this.y = e[13]; this.z = e[14]; return this; - } + }; - setFromMatrixScale(m) { - const sx = this.setFromMatrixColumn(m, 0).length(); - const sy = this.setFromMatrixColumn(m, 1).length(); - const sz = this.setFromMatrixColumn(m, 2).length(); + _proto.setFromMatrixScale = function setFromMatrixScale(m) { + var sx = this.setFromMatrixColumn(m, 0).length(); + var sy = this.setFromMatrixColumn(m, 1).length(); + var sz = this.setFromMatrixColumn(m, 2).length(); this.x = sx; this.y = sy; this.z = sz; return this; - } + }; - setFromMatrixColumn(m, index) { + _proto.setFromMatrixColumn = function setFromMatrixColumn(m, index) { return this.fromArray(m.elements, index * 4); - } + }; - setFromMatrix3Column(m, index) { + _proto.setFromMatrix3Column = function setFromMatrix3Column(m, index) { return this.fromArray(m.elements, index * 3); - } + }; - equals(v) { + _proto.equals = function equals(v) { return v.x === this.x && v.y === this.y && v.z === this.z; - } + }; + + _proto.fromArray = function fromArray(array, offset) { + if (offset === void 0) { + offset = 0; + } - fromArray(array, offset = 0) { this.x = array[offset]; this.y = array[offset + 1]; this.z = array[offset + 2]; return this; - } + }; + + _proto.toArray = function toArray(array, offset) { + if (array === void 0) { + array = []; + } + + if (offset === void 0) { + offset = 0; + } - toArray(array = [], offset = 0) { array[offset] = this.x; array[offset + 1] = this.y; array[offset + 2] = this.z; return array; - } + }; - fromBufferAttribute(attribute, index, offset) { + _proto.fromBufferAttribute = function fromBufferAttribute(attribute, index, offset) { if (offset !== undefined) { console.warn('THREE.Vector3: offset has been removed from .fromBufferAttribute().'); } @@ -2904,47 +3223,58 @@ this.y = attribute.getY(index); this.z = attribute.getZ(index); return this; - } + }; - random() { + _proto.random = function random() { this.x = Math.random(); this.y = Math.random(); this.z = Math.random(); return this; - } + }; - } + return Vector3; + }(); Vector3.prototype.isVector3 = true; - const _vector$c = /*@__PURE__*/new Vector3(); + var _vector = /*@__PURE__*/new Vector3(); - const _quaternion$4 = /*@__PURE__*/new Quaternion(); + var _quaternion = /*@__PURE__*/new Quaternion(); + + var Box3 = /*#__PURE__*/function () { + function Box3(min, max) { + if (min === void 0) { + min = new Vector3(+Infinity, +Infinity, +Infinity); + } + + if (max === void 0) { + max = new Vector3(-Infinity, -Infinity, -Infinity); + } - class Box3 { - constructor(min = new Vector3(+Infinity, +Infinity, +Infinity), max = new Vector3(-Infinity, -Infinity, -Infinity)) { this.min = min; this.max = max; } - set(min, max) { + var _proto = Box3.prototype; + + _proto.set = function set(min, max) { this.min.copy(min); this.max.copy(max); return this; - } - - setFromArray(array) { - let minX = +Infinity; - let minY = +Infinity; - let minZ = +Infinity; - 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]; - const z = array[i + 2]; + _proto.setFromArray = function setFromArray(array) { + var minX = +Infinity; + var minY = +Infinity; + var minZ = +Infinity; + var maxX = -Infinity; + var maxY = -Infinity; + var maxZ = -Infinity; + + for (var i = 0, l = array.length; i < l; i += 3) { + var x = array[i]; + var y = array[i + 1]; + var z = array[i + 2]; if (x < minX) minX = x; if (y < minY) minY = y; if (z < minZ) minZ = z; @@ -2956,20 +3286,20 @@ this.min.set(minX, minY, minZ); this.max.set(maxX, maxY, maxZ); return this; - } - - setFromBufferAttribute(attribute) { - let minX = +Infinity; - let minY = +Infinity; - let minZ = +Infinity; - 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); - const z = attribute.getZ(i); + _proto.setFromBufferAttribute = function setFromBufferAttribute(attribute) { + var minX = +Infinity; + var minY = +Infinity; + var minZ = +Infinity; + var maxX = -Infinity; + var maxY = -Infinity; + var maxZ = -Infinity; + + for (var i = 0, l = attribute.count; i < l; i++) { + var x = attribute.getX(i); + var y = attribute.getY(i); + var z = attribute.getZ(i); if (x < minX) minX = x; if (y < minY) minY = y; if (z < minZ) minZ = z; @@ -2981,124 +3311,137 @@ this.min.set(minX, minY, minZ); this.max.set(maxX, maxY, maxZ); return this; - } + }; - setFromPoints(points) { + _proto.setFromPoints = function setFromPoints(points) { this.makeEmpty(); - for (let i = 0, il = points.length; i < il; i++) { + for (var 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); + _proto.setFromCenterAndSize = function setFromCenterAndSize(center, size) { + var halfSize = _vector$1.copy(size).multiplyScalar(0.5); this.min.copy(center).sub(halfSize); this.max.copy(center).add(halfSize); return this; - } + }; - setFromObject(object) { + _proto.setFromObject = function setFromObject(object) { this.makeEmpty(); return this.expandByObject(object); - } + }; - clone() { + _proto.clone = function clone() { return new this.constructor().copy(this); - } + }; - copy(box) { + _proto.copy = function copy(box) { this.min.copy(box.min); this.max.copy(box.max); return this; - } + }; - makeEmpty() { + _proto.makeEmpty = function makeEmpty() { this.min.x = this.min.y = this.min.z = +Infinity; this.max.x = this.max.y = this.max.z = -Infinity; return this; - } + }; - isEmpty() { + _proto.isEmpty = function 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) { + _proto.getCenter = function getCenter(target) { if (target === undefined) { console.warn('THREE.Box3: .getCenter() target is now required'); target = new Vector3(); } return this.isEmpty() ? target.set(0, 0, 0) : target.addVectors(this.min, this.max).multiplyScalar(0.5); - } + }; - getSize(target) { + _proto.getSize = function getSize(target) { if (target === undefined) { console.warn('THREE.Box3: .getSize() target is now required'); target = new Vector3(); } return this.isEmpty() ? target.set(0, 0, 0) : target.subVectors(this.max, this.min); - } + }; - expandByPoint(point) { + _proto.expandByPoint = function expandByPoint(point) { this.min.min(point); this.max.max(point); return this; - } + }; - expandByVector(vector) { + _proto.expandByVector = function expandByVector(vector) { this.min.sub(vector); this.max.add(vector); return this; - } + }; - expandByScalar(scalar) { + _proto.expandByScalar = function expandByScalar(scalar) { this.min.addScalar(-scalar); this.max.addScalar(scalar); return this; - } + }; - expandByObject(object) { + _proto.expandByObject = function expandByObject(object) { // 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 (geometry.boundingBox === null) { - geometry.computeBoundingBox(); + if (object.boundingBox !== undefined) { + if (object.boundingBox === null) { + object.computeBoundingBox(); } - _box$3.copy(geometry.boundingBox); + _box.copy(object.boundingBox); + + _box.applyMatrix4(object.matrixWorld); + + this.union(_box); + } else { + var geometry = object.geometry; + + if (geometry !== undefined) { + if (geometry.boundingBox === null) { + geometry.computeBoundingBox(); + } + + _box.copy(geometry.boundingBox); - _box$3.applyMatrix4(object.matrixWorld); + _box.applyMatrix4(object.matrixWorld); - this.union(_box$3); + this.union(_box); + } } - const children = object.children; + var children = object.children; - for (let i = 0, l = children.length; i < l; i++) { + for (var i = 0, l = children.length; i < l; i++) { this.expandByObject(children[i]); } return this; - } + }; - containsPoint(point) { + _proto.containsPoint = function 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) { + _proto.containsBox = function 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) { + _proto.getParameter = function getParameter(point, target) { // This can potentially have a divide by zero if the box // has a size dimension of 0. if (target === undefined) { @@ -3107,24 +3450,24 @@ } 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) { + _proto.intersectsBox = function 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) { + _proto.intersectsSphere = function 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$1); // If that point is inside the sphere, the AABB and sphere intersect. - return _vector$b.distanceToSquared(sphere.center) <= sphere.radius * sphere.radius; - } + return _vector$1.distanceToSquared(sphere.center) <= sphere.radius * sphere.radius; + }; - intersectsPlane(plane) { + _proto.intersectsPlane = function 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; + var min, max; if (plane.normal.x > 0) { min = plane.normal.x * this.min.x; @@ -3151,9 +3494,9 @@ } return min <= -plane.constant && max >= -plane.constant; - } + }; - intersectsTriangle(triangle) { + _proto.intersectsTriangle = function intersectsTriangle(triangle) { if (this.isEmpty()) { return false; } // compute box center and extents @@ -3164,32 +3507,32 @@ _extents.subVectors(this.max, _center); // translate triangle to aabb origin - _v0$2.subVectors(triangle.a, _center); + _v0.subVectors(triangle.a, _center); - _v1$6.subVectors(triangle.b, _center); + _v1.subVectors(triangle.b, _center); - _v2$3.subVectors(triangle.c, _center); // compute edge vectors for triangle + _v2.subVectors(triangle.c, _center); // compute edge vectors for triangle - _f0.subVectors(_v1$6, _v0$2); + _f0.subVectors(_v1, _v0); - _f1.subVectors(_v2$3, _v1$6); + _f1.subVectors(_v2, _v1); - _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 + _f2.subVectors(_v0, _v2); // 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]; + var 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$6, _v2$3, _extents)) { + if (!satForAxes(axes, _v0, _v1, _v2, _extents)) { return false; } // test 3 face normals from the aabb axes = [1, 0, 0, 0, 1, 0, 0, 0, 1]; - if (!satForAxes(axes, _v0$2, _v1$6, _v2$3, _extents)) { + if (!satForAxes(axes, _v0, _v1, _v2, _extents)) { return false; } // finally testing the face normal of the triangle // use already existing triangle edge vectors here @@ -3198,49 +3541,49 @@ _triangleNormal.crossVectors(_f0, _f1); axes = [_triangleNormal.x, _triangleNormal.y, _triangleNormal.z]; - return satForAxes(axes, _v0$2, _v1$6, _v2$3, _extents); - } + return satForAxes(axes, _v0, _v1, _v2, _extents); + }; - clampPoint(point, target) { + _proto.clampPoint = function clampPoint(point, target) { if (target === undefined) { console.warn('THREE.Box3: .clampPoint() target is now required'); target = new Vector3(); } return target.copy(point).clamp(this.min, this.max); - } + }; - distanceToPoint(point) { - const clampedPoint = _vector$b.copy(point).clamp(this.min, this.max); + _proto.distanceToPoint = function distanceToPoint(point) { + var clampedPoint = _vector$1.copy(point).clamp(this.min, this.max); return clampedPoint.sub(point).length(); - } + }; - getBoundingSphere(target) { + _proto.getBoundingSphere = function getBoundingSphere(target) { if (target === undefined) { console.error('THREE.Box3: .getBoundingSphere() target is now required'); //target = new Sphere(); // removed to avoid cyclic dependency } this.getCenter(target.center); - target.radius = this.getSize(_vector$b).length() * 0.5; + target.radius = this.getSize(_vector$1).length() * 0.5; return target; - } + }; - intersect(box) { + _proto.intersect = function 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. if (this.isEmpty()) this.makeEmpty(); return this; - } + }; - union(box) { + _proto.union = function union(box) { this.min.min(box.min); this.max.max(box.max); return this; - } + }; - applyMatrix4(matrix) { + _proto.applyMatrix4 = function 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 @@ -3270,59 +3613,60 @@ this.setFromPoints(_points); return this; - } + }; - translate(offset) { + _proto.translate = function translate(offset) { this.min.add(offset); this.max.add(offset); return this; - } + }; - equals(box) { + _proto.equals = function equals(box) { return box.min.equals(this.min) && box.max.equals(this.max); - } + }; - } + return Box3; + }(); 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()]; + var _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(); + var _vector$1 = /*@__PURE__*/new Vector3(); - const _box$3 = /*@__PURE__*/new Box3(); // triangle centered vertices + var _box = /*@__PURE__*/new Box3(); // triangle centered vertices - const _v0$2 = /*@__PURE__*/new Vector3(); + var _v0 = /*@__PURE__*/new Vector3(); - const _v1$6 = /*@__PURE__*/new Vector3(); + var _v1 = /*@__PURE__*/new Vector3(); - const _v2$3 = /*@__PURE__*/new Vector3(); // triangle edge vectors + var _v2 = /*@__PURE__*/new Vector3(); // triangle edge vectors - const _f0 = /*@__PURE__*/new Vector3(); + var _f0 = /*@__PURE__*/new Vector3(); - const _f1 = /*@__PURE__*/new Vector3(); + var _f1 = /*@__PURE__*/new Vector3(); - const _f2 = /*@__PURE__*/new Vector3(); + var _f2 = /*@__PURE__*/new Vector3(); - const _center = /*@__PURE__*/new Vector3(); + var _center = /*@__PURE__*/new Vector3(); - const _extents = /*@__PURE__*/new Vector3(); + var _extents = /*@__PURE__*/new Vector3(); - const _triangleNormal = /*@__PURE__*/new Vector3(); + var _triangleNormal = /*@__PURE__*/new Vector3(); - const _testAxis = /*@__PURE__*/new Vector3(); + var _testAxis = /*@__PURE__*/new Vector3(); function satForAxes(axes, v0, v1, v2, extents) { - for (let i = 0, j = axes.length - 3; i <= j; i += 3) { + for (var 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 + var 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 + var p0 = v0.dot(_testAxis); + var p1 = v1.dot(_testAxis); + var 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 @@ -3334,78 +3678,94 @@ return true; } - const _box$2 = /*@__PURE__*/new Box3(); + var _box$1 = /*@__PURE__*/new Box3(); + + var _v1$1 = /*@__PURE__*/new Vector3(); + + var _toFarthestPoint = /*@__PURE__*/new Vector3(); + + var _toPoint = /*@__PURE__*/new Vector3(); + + var Sphere = /*#__PURE__*/function () { + function Sphere(center, radius) { + if (center === void 0) { + center = new Vector3(); + } + + if (radius === void 0) { + radius = -1; + } - class Sphere { - constructor(center = new Vector3(), radius = -1) { this.center = center; this.radius = radius; } - set(center, radius) { + var _proto = Sphere.prototype; + + _proto.set = function set(center, radius) { this.center.copy(center); this.radius = radius; return this; - } + }; - setFromPoints(points, optionalCenter) { - const center = this.center; + _proto.setFromPoints = function setFromPoints(points, optionalCenter) { + var center = this.center; if (optionalCenter !== undefined) { center.copy(optionalCenter); } else { - _box$2.setFromPoints(points).getCenter(center); + _box$1.setFromPoints(points).getCenter(center); } - let maxRadiusSq = 0; + var maxRadiusSq = 0; - for (let i = 0, il = points.length; i < il; i++) { + for (var 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) { + _proto.copy = function copy(sphere) { this.center.copy(sphere.center); this.radius = sphere.radius; return this; - } + }; - isEmpty() { + _proto.isEmpty = function isEmpty() { return this.radius < 0; - } + }; - makeEmpty() { + _proto.makeEmpty = function makeEmpty() { this.center.set(0, 0, 0); this.radius = -1; return this; - } + }; - containsPoint(point) { + _proto.containsPoint = function containsPoint(point) { return point.distanceToSquared(this.center) <= this.radius * this.radius; - } + }; - distanceToPoint(point) { + _proto.distanceToPoint = function distanceToPoint(point) { return point.distanceTo(this.center) - this.radius; - } + }; - intersectsSphere(sphere) { - const radiusSum = this.radius + sphere.radius; + _proto.intersectsSphere = function intersectsSphere(sphere) { + var radiusSum = this.radius + sphere.radius; return sphere.center.distanceToSquared(this.center) <= radiusSum * radiusSum; - } + }; - intersectsBox(box) { + _proto.intersectsBox = function intersectsBox(box) { return box.intersectsSphere(this); - } + }; - intersectsPlane(plane) { + _proto.intersectsPlane = function intersectsPlane(plane) { return Math.abs(plane.distanceToPoint(this.center)) <= this.radius; - } + }; - clampPoint(point, target) { - const deltaLengthSq = this.center.distanceToSquared(point); + _proto.clampPoint = function clampPoint(point, target) { + var deltaLengthSq = this.center.distanceToSquared(point); if (target === undefined) { console.warn('THREE.Sphere: .clampPoint() target is now required'); @@ -3420,9 +3780,9 @@ } return target; - } + }; - getBoundingBox(target) { + _proto.getBoundingBox = function getBoundingBox(target) { if (target === undefined) { console.warn('THREE.Sphere: .getBoundingBox() target is now required'); target = new Box3(); @@ -3437,114 +3797,156 @@ target.set(this.center, this.center); target.expandByScalar(this.radius); return target; - } + }; - applyMatrix4(matrix) { + _proto.applyMatrix4 = function applyMatrix4(matrix) { this.center.applyMatrix4(matrix); this.radius = this.radius * matrix.getMaxScaleOnAxis(); return this; - } + }; - translate(offset) { + _proto.translate = function translate(offset) { this.center.add(offset); return this; - } + }; + + _proto.expandByPoint = function expandByPoint(point) { + // from https://github.com/juj/MathGeoLib/blob/2940b99b99cfe575dd45103ef20f4019dee15b54/src/Geometry/Sphere.cpp#L649-L671 + _toPoint.subVectors(point, this.center); + + var lengthSq = _toPoint.lengthSq(); + + if (lengthSq > this.radius * this.radius) { + var length = Math.sqrt(lengthSq); + var 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. - equals(sphere) { + this.center.add(_toPoint.multiplyScalar(missingRadiusHalf / length)); + this.radius += missingRadiusHalf; + } + + return this; + }; + + _proto.union = function 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. + _toFarthestPoint.subVectors(sphere.center, this.center).normalize().multiplyScalar(sphere.radius); + + this.expandByPoint(_v1$1.copy(sphere.center).add(_toFarthestPoint)); + this.expandByPoint(_v1$1.copy(sphere.center).sub(_toFarthestPoint)); + return this; + }; + + _proto.equals = function equals(sphere) { return sphere.center.equals(this.center) && sphere.radius === this.radius; - } + }; - clone() { + _proto.clone = function clone() { return new this.constructor().copy(this); - } + }; - } + return Sphere; + }(); + + var _vector$2 = /*@__PURE__*/new Vector3(); + + var _segCenter = /*@__PURE__*/new Vector3(); - const _vector$a = /*@__PURE__*/new Vector3(); + var _segDir = /*@__PURE__*/new Vector3(); - const _segCenter = /*@__PURE__*/new Vector3(); + var _diff = /*@__PURE__*/new Vector3(); - const _segDir = /*@__PURE__*/new Vector3(); + var _edge1 = /*@__PURE__*/new Vector3(); - const _diff = /*@__PURE__*/new Vector3(); + var _edge2 = /*@__PURE__*/new Vector3(); - const _edge1 = /*@__PURE__*/new Vector3(); + var _normal = /*@__PURE__*/new Vector3(); - const _edge2 = /*@__PURE__*/new Vector3(); + var Ray = /*#__PURE__*/function () { + function Ray(origin, direction) { + if (origin === void 0) { + origin = new Vector3(); + } - const _normal$1 = /*@__PURE__*/new Vector3(); + if (direction === void 0) { + direction = new Vector3(0, 0, -1); + } - class Ray { - constructor(origin = new Vector3(), direction = new Vector3(0, 0, -1)) { this.origin = origin; this.direction = direction; } - set(origin, direction) { + var _proto = Ray.prototype; + + _proto.set = function set(origin, direction) { this.origin.copy(origin); this.direction.copy(direction); return this; - } + }; - copy(ray) { + _proto.copy = function copy(ray) { this.origin.copy(ray.origin); this.direction.copy(ray.direction); return this; - } + }; - at(t, target) { + _proto.at = function at(t, target) { if (target === undefined) { console.warn('THREE.Ray: .at() target is now required'); target = new Vector3(); } return target.copy(this.direction).multiplyScalar(t).add(this.origin); - } + }; - lookAt(v) { + _proto.lookAt = function lookAt(v) { this.direction.copy(v).sub(this.origin).normalize(); return this; - } + }; - recast(t) { - this.origin.copy(this.at(t, _vector$a)); + _proto.recast = function recast(t) { + this.origin.copy(this.at(t, _vector$2)); return this; - } + }; - closestPointToPoint(point, target) { + _proto.closestPointToPoint = function closestPointToPoint(point, target) { if (target === undefined) { console.warn('THREE.Ray: .closestPointToPoint() target is now required'); target = new Vector3(); } target.subVectors(point, this.origin); - const directionDistance = target.dot(this.direction); + var 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) { + _proto.distanceToPoint = function 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 + _proto.distanceSqToPoint = function distanceSqToPoint(point) { + var directionDistance = _vector$2.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); + _vector$2.copy(this.direction).multiplyScalar(directionDistance).add(this.origin); - return _vector$a.distanceToSquared(point); - } + return _vector$2.distanceToSquared(point); + }; - distanceSqToSegment(v0, v1, optionalPointOnRay, optionalPointOnSegment) { + _proto.distanceSqToSegment = function distanceSqToSegment(v0, v1, optionalPointOnRay, optionalPointOnSegment) { // from http://www.geometrictools.com/GTEngine/Include/Mathematics/GteDistRaySegment.h // It returns the min distance between the ray and the segment // defined by v0 and v1 @@ -3557,17 +3959,17 @@ _diff.copy(this.origin).sub(_segCenter); - const segExtent = v0.distanceTo(v1) * 0.5; - const a01 = -this.direction.dot(_segDir); + var segExtent = v0.distanceTo(v1) * 0.5; + var a01 = -this.direction.dot(_segDir); - const b0 = _diff.dot(this.direction); + var b0 = _diff.dot(this.direction); - const b1 = -_diff.dot(_segDir); + var b1 = -_diff.dot(_segDir); - const c = _diff.lengthSq(); + var c = _diff.lengthSq(); - const det = Math.abs(1 - a01 * a01); - let s0, s1, sqrDist, extDet; + var det = Math.abs(1 - a01 * a01); + var s0, s1, sqrDist, extDet; if (det > 0) { // The ray and segment are not parallel. @@ -3580,7 +3982,7 @@ if (s1 <= extDet) { // region 0 // Minimum at interior points of ray and segment. - const invDet = 1 / det; + var invDet = 1 / det; s0 *= invDet; s1 *= invDet; sqrDist = s0 * (s0 + a01 * s1 + 2 * b0) + s1 * (a01 * s0 + s1 + 2 * b1) + c; @@ -3630,21 +4032,21 @@ } return sqrDist; - } + }; - intersectSphere(sphere, target) { - _vector$a.subVectors(sphere.center, this.origin); + _proto.intersectSphere = function intersectSphere(sphere, target) { + _vector$2.subVectors(sphere.center, this.origin); - const tca = _vector$a.dot(this.direction); + var tca = _vector$2.dot(this.direction); - const d2 = _vector$a.dot(_vector$a) - tca * tca; - const radius2 = sphere.radius * sphere.radius; + var d2 = _vector$2.dot(_vector$2) - tca * tca; + var 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 + var thc = Math.sqrt(radius2 - d2); // t0 = first intersect point - entrance on front of sphere - const t0 = tca - thc; // t1 = second intersect point - exit point on back of sphere + var t0 = tca - thc; // t1 = second intersect point - exit point on back of sphere - const t1 = tca + thc; // test to see if both t0 and t1 are behind the ray - if so, return null + var t1 = tca + thc; // test to see if both t0 and t1 are behind the ray - if so, return null if (t0 < 0 && t1 < 0) return null; // 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, @@ -3653,14 +4055,14 @@ 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 return this.at(t0, target); - } + }; - intersectsSphere(sphere) { + _proto.intersectsSphere = function intersectsSphere(sphere) { return this.distanceSqToPoint(sphere.center) <= sphere.radius * sphere.radius; - } + }; - distanceToPlane(plane) { - const denominator = plane.normal.dot(this.direction); + _proto.distanceToPlane = function distanceToPlane(plane) { + var denominator = plane.normal.dot(this.direction); if (denominator === 0) { // line is coplanar, return origin @@ -3672,30 +4074,30 @@ return null; } - const t = -(this.origin.dot(plane.normal) + plane.constant) / denominator; // Return if the ray never intersects the plane + var t = -(this.origin.dot(plane.normal) + plane.constant) / denominator; // Return if the ray never intersects the plane return t >= 0 ? t : null; - } + }; - intersectPlane(plane, target) { - const t = this.distanceToPlane(plane); + _proto.intersectPlane = function intersectPlane(plane, target) { + var t = this.distanceToPlane(plane); if (t === null) { return null; } return this.at(t, target); - } + }; - intersectsPlane(plane) { + _proto.intersectsPlane = function intersectsPlane(plane) { // check if the ray lies on the plane first - const distToPoint = plane.distanceToPoint(this.origin); + var distToPoint = plane.distanceToPoint(this.origin); if (distToPoint === 0) { return true; } - const denominator = plane.normal.dot(this.direction); + var denominator = plane.normal.dot(this.direction); if (denominator * distToPoint < 0) { return true; @@ -3703,14 +4105,14 @@ 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; - const origin = this.origin; + _proto.intersectBox = function intersectBox(box, target) { + var tmin, tmax, tymin, tymax, tzmin, tzmax; + var invdirx = 1 / this.direction.x, + invdiry = 1 / this.direction.y, + invdirz = 1 / this.direction.z; + var origin = this.origin; if (invdirx >= 0) { tmin = (box.min.x - origin.x) * invdirx; @@ -3748,28 +4150,28 @@ if (tmax < 0) return null; return this.at(tmin >= 0 ? tmin : tmax, target); - } + }; - intersectsBox(box) { - return this.intersectBox(box, _vector$a) !== null; - } + _proto.intersectsBox = function intersectsBox(box) { + return this.intersectBox(box, _vector$2) !== null; + }; - intersectTriangle(a, b, c, backfaceCulling, target) { + _proto.intersectTriangle = function intersectTriangle(a, b, c, backfaceCulling, target) { // Compute the offset origin, edges, and normal. // from http://www.geometrictools.com/GTEngine/Include/Mathematics/GteIntrRay3Triangle3.h _edge1.subVectors(b, a); _edge2.subVectors(c, a); - _normal$1.crossVectors(_edge1, _edge2); // Solve Q + t*D = b1*E1 + b2*E2 (Q = kDiff, D = ray direction, + _normal.crossVectors(_edge1, _edge2); // 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; + var DdN = this.direction.dot(_normal); + var sign; if (DdN > 0) { if (backfaceCulling) return null; @@ -3783,13 +4185,13 @@ _diff.subVectors(this.origin, a); - const DdQxE2 = sign * this.direction.dot(_edge2.crossVectors(_diff, _edge2)); // b1 < 0, no intersection + var DdQxE2 = sign * this.direction.dot(_edge2.crossVectors(_diff, _edge2)); // b1 < 0, no intersection if (DdQxE2 < 0) { return null; } - const DdE1xQ = sign * this.direction.dot(_edge1.cross(_diff)); // b2 < 0, no intersection + var DdE1xQ = sign * this.direction.dot(_edge1.cross(_diff)); // b2 < 0, no intersection if (DdE1xQ < 0) { return null; @@ -3801,7 +4203,7 @@ } // Line intersects triangle, check if ray does. - const QdN = -sign * _diff.dot(_normal$1); // t < 0, no intersection + var QdN = -sign * _diff.dot(_normal); // t < 0, no intersection if (QdN < 0) { @@ -3810,26 +4212,27 @@ return this.at(QdN / DdN, target); - } + }; - applyMatrix4(matrix4) { + _proto.applyMatrix4 = function applyMatrix4(matrix4) { this.origin.applyMatrix4(matrix4); this.direction.transformDirection(matrix4); return this; - } + }; - equals(ray) { + _proto.equals = function equals(ray) { return ray.origin.equals(this.origin) && ray.direction.equals(this.direction); - } + }; - clone() { + _proto.clone = function clone() { return new this.constructor().copy(this); - } + }; - } + return Ray; + }(); - class Matrix4 { - constructor() { + var Matrix4 = /*#__PURE__*/function () { + function Matrix4() { this.elements = [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1]; if (arguments.length > 0) { @@ -3837,8 +4240,10 @@ } } - set(n11, n12, n13, n14, n21, n22, n23, n24, n31, n32, n33, n34, n41, n42, n43, n44) { - const te = this.elements; + var _proto = Matrix4.prototype; + + _proto.set = function set(n11, n12, n13, n14, n21, n22, n23, n24, n31, n32, n33, n34, n41, n42, n43, n44) { + var te = this.elements; te[0] = n11; te[4] = n12; te[8] = n13; @@ -3856,20 +4261,20 @@ te[11] = n43; te[15] = n44; return this; - } + }; - identity() { + _proto.identity = function identity() { this.set(1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1); return this; - } + }; - clone() { + _proto.clone = function clone() { return new Matrix4().fromArray(this.elements); - } + }; - copy(m) { - const te = this.elements; - const me = m.elements; + _proto.copy = function copy(m) { + var te = this.elements; + var me = m.elements; te[0] = me[0]; te[1] = me[1]; te[2] = me[2]; @@ -3887,45 +4292,45 @@ te[14] = me[14]; te[15] = me[15]; return this; - } + }; - copyPosition(m) { - const te = this.elements, - me = m.elements; + _proto.copyPosition = function copyPosition(m) { + var te = this.elements, + me = m.elements; te[12] = me[12]; te[13] = me[13]; te[14] = me[14]; return this; - } + }; - setFromMatrix3(m) { - const me = m.elements; + _proto.setFromMatrix3 = function setFromMatrix3(m) { + var 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) { + _proto.extractBasis = function extractBasis(xAxis, yAxis, zAxis) { xAxis.setFromMatrixColumn(this, 0); yAxis.setFromMatrixColumn(this, 1); zAxis.setFromMatrixColumn(this, 2); return this; - } + }; - makeBasis(xAxis, yAxis, zAxis) { + _proto.makeBasis = function 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) { + _proto.extractRotation = function extractRotation(m) { // this method does not support reflection matrices - const te = this.elements; - const me = m.elements; + var te = this.elements; + var me = m.elements; - const scaleX = 1 / _v1$5.setFromMatrixColumn(m, 0).length(); + var scaleX = 1 / _v1$2.setFromMatrixColumn(m, 0).length(); - const scaleY = 1 / _v1$5.setFromMatrixColumn(m, 1).length(); + var scaleY = 1 / _v1$2.setFromMatrixColumn(m, 1).length(); - const scaleZ = 1 / _v1$5.setFromMatrixColumn(m, 2).length(); + var scaleZ = 1 / _v1$2.setFromMatrixColumn(m, 2).length(); te[0] = me[0] * scaleX; te[1] = me[1] * scaleX; @@ -3944,29 +4349,29 @@ te[14] = 0; te[15] = 1; return this; - } + }; - makeRotationFromEuler(euler) { + _proto.makeRotationFromEuler = function 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; - const a = Math.cos(x), - b = Math.sin(x); - const c = Math.cos(y), - d = Math.sin(y); - const e = Math.cos(z), - f = Math.sin(z); + var te = this.elements; + var x = euler.x, + y = euler.y, + z = euler.z; + var a = Math.cos(x), + b = Math.sin(x); + var c = Math.cos(y), + d = Math.sin(y); + var e = Math.cos(z), + f = Math.sin(z); if (euler.order === 'XYZ') { - const ae = a * e, - af = a * f, - be = b * e, - bf = b * f; + var ae = a * e, + af = a * f, + be = b * e, + bf = b * f; te[0] = c * e; te[4] = -c * f; te[8] = d; @@ -3977,10 +4382,10 @@ te[6] = be + af * d; te[10] = a * c; } else if (euler.order === 'YXZ') { - const ce = c * e, - cf = c * f, - de = d * e, - df = d * f; + var ce = c * e, + cf = c * f, + de = d * e, + df = d * f; te[0] = ce + df * b; te[4] = de * b - cf; te[8] = a * d; @@ -3991,38 +4396,40 @@ te[6] = df + ce * b; te[10] = a * c; } else if (euler.order === 'ZXY') { - const ce = c * e, - cf = c * f, - de = d * e, - df = d * f; - te[0] = ce - df * b; + var _ce = c * e, + _cf = c * f, + _de = d * e, + _df = d * f; + + te[0] = _ce - _df * b; te[4] = -a * f; - te[8] = de + cf * b; - te[1] = cf + de * b; + te[8] = _de + _cf * b; + te[1] = _cf + _de * b; te[5] = a * e; - te[9] = df - ce * b; + te[9] = _df - _ce * b; te[2] = -a * d; te[6] = b; te[10] = a * c; } else if (euler.order === 'ZYX') { - const ae = a * e, - af = a * f, - be = b * e, - bf = b * f; + var _ae = a * e, + _af = a * f, + _be = b * e, + _bf = b * f; + te[0] = c * e; - te[4] = be * d - af; - te[8] = ae * d + bf; + te[4] = _be * d - _af; + te[8] = _ae * d + _bf; te[1] = c * f; - te[5] = bf * d + ae; - te[9] = af * d - be; + te[5] = _bf * d + _ae; + te[9] = _af * d - _be; te[2] = -d; te[6] = b * c; te[10] = a * c; } else if (euler.order === 'YZX') { - const ac = a * c, - ad = a * d, - bc = b * c, - bd = b * d; + var ac = a * c, + ad = a * d, + bc = b * c, + bd = b * d; te[0] = c * e; te[4] = bd - ac * f; te[8] = bc * f + ad; @@ -4033,19 +4440,20 @@ te[6] = ad * f + bc; te[10] = ac - bd * f; } else if (euler.order === 'XZY') { - const ac = a * c, - ad = a * d, - bc = b * c, - bd = b * d; + var _ac = a * c, + _ad = a * d, + _bc = b * c, + _bd = b * d; + te[0] = c * e; te[4] = -f; te[8] = d * e; - te[1] = ac * f + bd; + te[1] = _ac * f + _bd; te[5] = a * e; - te[9] = ad * f - bc; - te[2] = bc * f - ad; + te[9] = _ad * f - _bc; + te[2] = _bc * f - _ad; te[6] = b * e; - te[10] = bd * f + ac; + te[10] = _bd * f + _ac; } // bottom row @@ -4058,14 +4466,14 @@ te[14] = 0; te[15] = 1; return this; - } + }; - makeRotationFromQuaternion(q) { + _proto.makeRotationFromQuaternion = function makeRotationFromQuaternion(q) { return this.compose(_zero, q, _one); - } + }; - lookAt(eye, target, up) { - const te = this.elements; + _proto.lookAt = function lookAt(eye, target, up) { + var te = this.elements; _z.subVectors(eye, target); @@ -4105,57 +4513,57 @@ te[6] = _y.z; te[10] = _z.z; return this; - } + }; - multiply(m, n) { + _proto.multiply = function 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) { + _proto.premultiply = function 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]; - const a21 = ae[1], - a22 = ae[5], - a23 = ae[9], - a24 = ae[13]; - const a31 = ae[2], - a32 = ae[6], - a33 = ae[10], - a34 = ae[14]; - const a41 = ae[3], - a42 = ae[7], - a43 = ae[11], - a44 = ae[15]; - const b11 = be[0], - b12 = be[4], - b13 = be[8], - b14 = be[12]; - const b21 = be[1], - b22 = be[5], - b23 = be[9], - b24 = be[13]; - const b31 = be[2], - b32 = be[6], - b33 = be[10], - b34 = be[14]; - const b41 = be[3], - b42 = be[7], - b43 = be[11], - b44 = be[15]; + _proto.multiplyMatrices = function multiplyMatrices(a, b) { + var ae = a.elements; + var be = b.elements; + var te = this.elements; + var a11 = ae[0], + a12 = ae[4], + a13 = ae[8], + a14 = ae[12]; + var a21 = ae[1], + a22 = ae[5], + a23 = ae[9], + a24 = ae[13]; + var a31 = ae[2], + a32 = ae[6], + a33 = ae[10], + a34 = ae[14]; + var a41 = ae[3], + a42 = ae[7], + a43 = ae[11], + a44 = ae[15]; + var b11 = be[0], + b12 = be[4], + b13 = be[8], + b14 = be[12]; + var b21 = be[1], + b22 = be[5], + b23 = be[9], + b24 = be[13]; + var b31 = be[2], + b32 = be[6], + b33 = be[10], + b34 = be[14]; + var b41 = be[3], + 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; @@ -4173,10 +4581,10 @@ te[11] = a41 * b13 + a42 * b23 + a43 * b33 + a44 * b43; te[15] = a41 * b14 + a42 * b24 + a43 * b34 + a44 * b44; return this; - } + }; - multiplyScalar(s) { - const te = this.elements; + _proto.multiplyScalar = function multiplyScalar(s) { + var te = this.elements; te[0] *= s; te[4] *= s; te[8] *= s; @@ -4194,34 +4602,34 @@ te[11] *= s; te[15] *= s; return this; - } + }; - determinant() { - const te = this.elements; - const n11 = te[0], - n12 = te[4], - n13 = te[8], - n14 = te[12]; - const n21 = te[1], - n22 = te[5], - n23 = te[9], - n24 = te[13]; - const n31 = te[2], - 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 + _proto.determinant = function determinant() { + var te = this.elements; + var n11 = te[0], + n12 = te[4], + n13 = te[8], + n14 = te[12]; + var n21 = te[1], + n22 = te[5], + n23 = te[9], + n24 = te[13]; + var n31 = te[2], + n32 = te[6], + n33 = te[10], + n34 = te[14]; + var n41 = te[3], + 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; + _proto.transpose = function transpose() { + var te = this.elements; + var tmp; tmp = te[1]; te[1] = te[4]; te[4] = tmp; @@ -4241,10 +4649,10 @@ te[11] = te[14]; te[14] = tmp; return this; - } + }; - setPosition(x, y, z) { - const te = this.elements; + _proto.setPosition = function setPosition(x, y, z) { + var te = this.elements; if (x.isVector3) { te[12] = x.x; @@ -4257,34 +4665,34 @@ } return this; - } + }; - invert() { + _proto.invert = function 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; - const det = n11 * t11 + n21 * t12 + n31 * t13 + n41 * t14; + var 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; + var 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; + var detInv = 1 / det; te[0] = t11 * detInv; te[1] = (n24 * n33 * n41 - n23 * n34 * n41 - n24 * n31 * n43 + n21 * n34 * n43 + n23 * n31 * n44 - n21 * n33 * n44) * detInv; te[2] = (n22 * n34 * n41 - n24 * n32 * n41 + n24 * n31 * n42 - n21 * n34 * n42 - n22 * n31 * n44 + n21 * n32 * n44) * detInv; @@ -4302,13 +4710,13 @@ te[14] = (n14 * n22 * n31 - n12 * n24 * n31 - n14 * n21 * n32 + n11 * n24 * n32 + n12 * n21 * n34 - n11 * n22 * n34) * detInv; 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; + _proto.scale = function scale(v) { + var te = this.elements; + var x = v.x, + y = v.y, + z = v.z; te[0] *= x; te[4] *= y; te[8] *= z; @@ -4322,87 +4730,87 @@ te[7] *= y; te[11] *= z; return this; - } + }; - getMaxScaleOnAxis() { - const te = this.elements; - const scaleXSq = te[0] * te[0] + te[1] * te[1] + te[2] * te[2]; - const scaleYSq = te[4] * te[4] + te[5] * te[5] + te[6] * te[6]; - const scaleZSq = te[8] * te[8] + te[9] * te[9] + te[10] * te[10]; + _proto.getMaxScaleOnAxis = function getMaxScaleOnAxis() { + var te = this.elements; + var scaleXSq = te[0] * te[0] + te[1] * te[1] + te[2] * te[2]; + var scaleYSq = te[4] * te[4] + te[5] * te[5] + te[6] * te[6]; + var 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) { + _proto.makeTranslation = function 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); + _proto.makeRotationX = function makeRotationX(theta) { + var c = Math.cos(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); + _proto.makeRotationY = function makeRotationY(theta) { + var c = Math.cos(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); + _proto.makeRotationZ = function makeRotationZ(theta) { + var c = Math.cos(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) { + _proto.makeRotationAxis = function 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; - const tx = t * x, - ty = t * y; + var c = Math.cos(angle); + var s = Math.sin(angle); + var t = 1 - c; + var x = axis.x, + y = axis.y, + z = axis.z; + var tx = t * x, + 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) { + _proto.makeScale = function 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(x, y, z) { + _proto.makeShear = function makeShear(x, y, z) { this.set(1, y, z, 0, x, 1, z, 0, x, y, 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; - const x2 = x + x, - y2 = y + y, - z2 = z + z; - const xx = x * x2, - xy = x * y2, - xz = x * z2; - const yy = y * y2, - yz = y * z2, - zz = z * z2; - const wx = w * x2, - wy = w * y2, - wz = w * z2; - const sx = scale.x, - sy = scale.y, - sz = scale.z; + _proto.compose = function compose(position, quaternion, scale) { + var te = this.elements; + var x = quaternion._x, + y = quaternion._y, + z = quaternion._z, + w = quaternion._w; + var x2 = x + x, + y2 = y + y, + z2 = z + z; + var xx = x * x2, + xy = x * y2, + xz = x * z2; + var yy = y * y2, + yz = y * z2, + zz = z * z2; + var wx = w * x2, + wy = w * y2, + wz = w * z2; + var sx = scale.x, + sy = scale.y, + sz = scale.z; te[0] = (1 - (yy + zz)) * sx; te[1] = (xy + wz) * sx; te[2] = (xz - wy) * sx; @@ -4420,57 +4828,57 @@ te[14] = position.z; te[15] = 1; return this; - } + }; - decompose(position, quaternion, scale) { - const te = this.elements; + _proto.decompose = function decompose(position, quaternion, scale) { + var te = this.elements; - let sx = _v1$5.set(te[0], te[1], te[2]).length(); + var sx = _v1$2.set(te[0], te[1], te[2]).length(); - const sy = _v1$5.set(te[4], te[5], te[6]).length(); + var sy = _v1$2.set(te[4], te[5], te[6]).length(); - const sz = _v1$5.set(te[8], te[9], te[10]).length(); // if determine is negative, we need to invert one scale + var sz = _v1$2.set(te[8], te[9], te[10]).length(); // if determine is negative, we need to invert one scale - const det = this.determinant(); + var det = this.determinant(); if (det < 0) sx = -sx; position.x = te[12]; position.y = te[13]; position.z = te[14]; // scale the rotation part - _m1$2.copy(this); - - const invSX = 1 / sx; - const invSY = 1 / sy; - const invSZ = 1 / sz; - _m1$2.elements[0] *= invSX; - _m1$2.elements[1] *= invSX; - _m1$2.elements[2] *= invSX; - _m1$2.elements[4] *= invSY; - _m1$2.elements[5] *= invSY; - _m1$2.elements[6] *= invSY; - _m1$2.elements[8] *= invSZ; - _m1$2.elements[9] *= invSZ; - _m1$2.elements[10] *= invSZ; - quaternion.setFromRotationMatrix(_m1$2); + _m1.copy(this); + + var invSX = 1 / sx; + var invSY = 1 / sy; + var invSZ = 1 / sz; + _m1.elements[0] *= invSX; + _m1.elements[1] *= invSX; + _m1.elements[2] *= invSX; + _m1.elements[4] *= invSY; + _m1.elements[5] *= invSY; + _m1.elements[6] *= invSY; + _m1.elements[8] *= invSZ; + _m1.elements[9] *= invSZ; + _m1.elements[10] *= invSZ; + quaternion.setFromRotationMatrix(_m1); scale.x = sx; scale.y = sy; scale.z = sz; return this; - } + }; - makePerspective(left, right, top, bottom, near, far) { + _proto.makePerspective = function 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); - const a = (right + left) / (right - left); - const b = (top + bottom) / (top - bottom); - const c = -(far + near) / (far - near); - const d = -2 * far * near / (far - near); + var te = this.elements; + var x = 2 * near / (right - left); + var y = 2 * near / (top - bottom); + var a = (right + left) / (right - left); + var b = (top + bottom) / (top - bottom); + var c = -(far + near) / (far - near); + var d = -2 * far * near / (far - near); te[0] = x; te[4] = 0; te[8] = a; @@ -4488,16 +4896,16 @@ te[11] = -1; te[15] = 0; return this; - } + }; - makeOrthographic(left, right, top, bottom, near, far) { - const te = this.elements; - const w = 1.0 / (right - left); - const h = 1.0 / (top - bottom); - const p = 1.0 / (far - near); - const x = (right + left) * w; - const y = (top + bottom) * h; - const z = (far + near) * p; + _proto.makeOrthographic = function makeOrthographic(left, right, top, bottom, near, far) { + var te = this.elements; + var w = 1.0 / (right - left); + var h = 1.0 / (top - bottom); + var p = 1.0 / (far - near); + var x = (right + left) * w; + var y = (top + bottom) * h; + var z = (far + near) * p; te[0] = 2 * w; te[4] = 0; te[8] = 0; @@ -4515,29 +4923,41 @@ te[11] = 0; te[15] = 1; return this; - } + }; - equals(matrix) { - const te = this.elements; - const me = matrix.elements; + _proto.equals = function equals(matrix) { + var te = this.elements; + var me = matrix.elements; - for (let i = 0; i < 16; i++) { + for (var 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++) { + _proto.fromArray = function fromArray(array, offset) { + if (offset === void 0) { + offset = 0; + } + + for (var i = 0; i < 16; i++) { this.elements[i] = array[i + offset]; } return this; - } + }; + + _proto.toArray = function toArray(array, offset) { + if (array === void 0) { + array = []; + } + + if (offset === void 0) { + offset = 0; + } - toArray(array = [], offset = 0) { - const te = this.elements; + var te = this.elements; array[offset] = te[0]; array[offset + 1] = te[1]; array[offset + 2] = te[2]; @@ -4555,79 +4975,58 @@ array[offset + 14] = te[14]; array[offset + 15] = te[15]; return array; - } + }; - } + return Matrix4; + }(); 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); + var _v1$2 = /*@__PURE__*/new Vector3(); - const _x = /*@__PURE__*/new Vector3(); + var _m1 = /*@__PURE__*/new Matrix4(); - const _y = /*@__PURE__*/new Vector3(); + var _zero = /*@__PURE__*/new Vector3(0, 0, 0); - 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; - this._y = y; - this._z = z; - this._order = order; - } + var _one = /*@__PURE__*/new Vector3(1, 1, 1); - get x() { - return this._x; - } + var _x = /*@__PURE__*/new Vector3(); - set x(value) { - this._x = value; + var _y = /*@__PURE__*/new Vector3(); - this._onChangeCallback(); - } + var _z = /*@__PURE__*/new Vector3(); - get y() { - return this._y; - } + var _matrix = /*@__PURE__*/new Matrix4(); - set y(value) { - this._y = value; + var _quaternion$1 = /*@__PURE__*/new Quaternion(); - this._onChangeCallback(); - } + var Euler = /*#__PURE__*/function () { + function Euler(x, y, z, order) { + if (x === void 0) { + x = 0; + } - get z() { - return this._z; - } + if (y === void 0) { + y = 0; + } - set z(value) { - this._z = value; + if (z === void 0) { + z = 0; + } - this._onChangeCallback(); - } + if (order === void 0) { + order = Euler.DefaultOrder; + } - get order() { - return this._order; + this._x = x; + this._y = y; + this._z = z; + this._order = order; } - set order(value) { - this._order = value; - - this._onChangeCallback(); - } + var _proto = Euler.prototype; - set(x, y, z, order) { + _proto.set = function set(x, y, z, order) { this._x = x; this._y = y; this._z = z; @@ -4636,13 +5035,13 @@ this._onChangeCallback(); return this; - } + }; - clone() { + _proto.clone = function clone() { return new this.constructor(this._x, this._y, this._z, this._order); - } + }; - copy(euler) { + _proto.copy = function copy(euler) { this._x = euler._x; this._y = euler._y; this._z = euler._z; @@ -4651,21 +5050,21 @@ this._onChangeCallback(); return this; - } - - setFromRotationMatrix(m, order, update) { - const clamp = MathUtils.clamp; // 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]; - const m21 = te[1], - m22 = te[5], - m23 = te[9]; - const m31 = te[2], - m32 = te[6], - m33 = te[10]; + _proto.setFromRotationMatrix = function setFromRotationMatrix(m, order, update) { + var clamp = MathUtils.clamp; // assumes the upper 3x3 of m is a pure rotation matrix (i.e, unscaled) + + var te = m.elements; + var m11 = te[0], + m12 = te[4], + m13 = te[8]; + var m21 = te[1], + m22 = te[5], + m23 = te[9]; + var m31 = te[2], + m32 = te[6], + m33 = te[10]; order = order || this._order; switch (order) { @@ -4754,30 +5153,30 @@ this._order = order; if (update !== false) this._onChangeCallback(); return this; - } + }; - setFromQuaternion(q, order, update) { - _matrix$1.makeRotationFromQuaternion(q); + _proto.setFromQuaternion = function setFromQuaternion(q, order, update) { + _matrix.makeRotationFromQuaternion(q); - return this.setFromRotationMatrix(_matrix$1, order, update); - } + return this.setFromRotationMatrix(_matrix, order, update); + }; - setFromVector3(v, order) { + _proto.setFromVector3 = function setFromVector3(v, order) { return this.set(v.x, v.y, v.z, order || this._order); - } + }; - reorder(newOrder) { + _proto.reorder = function reorder(newOrder) { // WARNING: this discards revolution information -bhouston - _quaternion$3.setFromEuler(this); + _quaternion$1.setFromEuler(this); - return this.setFromQuaternion(_quaternion$3, newOrder); - } + return this.setFromQuaternion(_quaternion$1, newOrder); + }; - equals(euler) { + _proto.equals = function equals(euler) { return euler._x === this._x && euler._y === this._y && euler._z === this._z && euler._order === this._order; - } + }; - fromArray(array) { + _proto.fromArray = function fromArray(array) { this._x = array[0]; this._y = array[1]; this._z = array[2]; @@ -4786,98 +5185,152 @@ this._onChangeCallback(); return this; - } + }; + + _proto.toArray = function toArray(array, offset) { + if (array === void 0) { + array = []; + } + + if (offset === void 0) { + offset = 0; + } - toArray(array = [], offset = 0) { array[offset] = this._x; array[offset + 1] = this._y; array[offset + 2] = this._z; array[offset + 3] = this._order; return array; - } + }; - toVector3(optionalResult) { + _proto.toVector3 = function toVector3(optionalResult) { if (optionalResult) { return optionalResult.set(this._x, this._y, this._z); } else { return new Vector3(this._x, this._y, this._z); } - } + }; - _onChange(callback) { + _proto._onChange = function _onChange(callback) { this._onChangeCallback = callback; return this; - } + }; - _onChangeCallback() {} + _proto._onChangeCallback = function _onChangeCallback() {}; - } + _createClass(Euler, [{ + key: "x", + get: function get() { + return this._x; + }, + set: function set(value) { + this._x = value; + + this._onChangeCallback(); + } + }, { + key: "y", + get: function get() { + return this._y; + }, + set: function set(value) { + this._y = value; + + this._onChangeCallback(); + } + }, { + key: "z", + get: function get() { + return this._z; + }, + set: function set(value) { + this._z = value; + + this._onChangeCallback(); + } + }, { + key: "order", + get: function get() { + return this._order; + }, + set: function set(value) { + this._order = value; + + this._onChangeCallback(); + } + }]); + + return Euler; + }(); Euler.prototype.isEuler = true; Euler.DefaultOrder = 'XYZ'; Euler.RotationOrders = ['XYZ', 'YZX', 'ZXY', 'XZY', 'YXZ', 'ZYX']; - class Layers { - constructor() { + var Layers = /*#__PURE__*/function () { + function Layers() { this.mask = 1 | 0; } - set(channel) { + var _proto = Layers.prototype; + + _proto.set = function set(channel) { this.mask = 1 << channel | 0; - } + }; - enable(channel) { + _proto.enable = function enable(channel) { this.mask |= 1 << channel | 0; - } + }; - enableAll() { + _proto.enableAll = function enableAll() { this.mask = 0xffffffff | 0; - } + }; - toggle(channel) { + _proto.toggle = function toggle(channel) { this.mask ^= 1 << channel | 0; - } + }; - disable(channel) { + _proto.disable = function disable(channel) { this.mask &= ~(1 << channel | 0); - } + }; - disableAll() { + _proto.disableAll = function disableAll() { this.mask = 0; - } + }; - test(layers) { + _proto.test = function test(layers) { return (this.mask & layers.mask) !== 0; - } + }; - } + return Layers; + }(); - let _object3DId = 0; + var _object3DId = 0; - const _v1$4 = new Vector3(); + var _v1$3 = new Vector3(); - const _q1 = new Quaternion(); + var _q1 = new Quaternion(); - const _m1$1 = new Matrix4(); + var _m1$1 = new Matrix4(); - const _target = new Vector3(); + var _target = new Vector3(); - const _position$3 = new Vector3(); + var _position = new Vector3(); - const _scale$2 = new Vector3(); + var _scale = new Vector3(); - const _quaternion$2 = new Quaternion(); + var _quaternion$2 = new Quaternion(); - const _xAxis = new Vector3(1, 0, 0); + var _xAxis = new Vector3(1, 0, 0); - const _yAxis = new Vector3(0, 1, 0); + var _yAxis = new Vector3(0, 1, 0); - const _zAxis = new Vector3(0, 0, 1); + var _zAxis = new Vector3(0, 0, 1); - const _addedEvent = { + var _addedEvent = { type: 'added' }; - const _removedEvent = { + var _removedEvent = { type: 'removed' }; @@ -4891,10 +5344,10 @@ this.parent = null; this.children = []; this.up = Object3D.DefaultUp.clone(); - const position = new Vector3(); - const rotation = new Euler(); - const quaternion = new Quaternion(); - const scale = new Vector3(1, 1, 1); + var position = new Vector3(); + var rotation = new Euler(); + var quaternion = new Quaternion(); + var scale = new Vector3(1, 1, 1); function onRotationChange() { quaternion.setFromEuler(rotation, false); @@ -4955,33 +5408,33 @@ Object3D.prototype = Object.assign(Object.create(EventDispatcher.prototype), { constructor: Object3D, isObject3D: true, - onBeforeRender: function () {}, - onAfterRender: function () {}, - applyMatrix4: function (matrix) { + onBeforeRender: function onBeforeRender() {}, + onAfterRender: function onAfterRender() {}, + applyMatrix4: function applyMatrix4(matrix) { if (this.matrixAutoUpdate) this.updateMatrix(); this.matrix.premultiply(matrix); this.matrix.decompose(this.position, this.quaternion, this.scale); }, - applyQuaternion: function (q) { + applyQuaternion: function applyQuaternion(q) { this.quaternion.premultiply(q); return this; }, - setRotationFromAxisAngle: function (axis, angle) { + setRotationFromAxisAngle: function setRotationFromAxisAngle(axis, angle) { // assumes axis is normalized this.quaternion.setFromAxisAngle(axis, angle); }, - setRotationFromEuler: function (euler) { + setRotationFromEuler: function setRotationFromEuler(euler) { this.quaternion.setFromEuler(euler, true); }, - setRotationFromMatrix: function (m) { + setRotationFromMatrix: function setRotationFromMatrix(m) { // assumes the upper 3x3 of m is a pure rotation matrix (i.e, unscaled) this.quaternion.setFromRotationMatrix(m); }, - setRotationFromQuaternion: function (q) { + setRotationFromQuaternion: function setRotationFromQuaternion(q) { // assumes q is normalized this.quaternion.copy(q); }, - rotateOnAxis: function (axis, angle) { + rotateOnAxis: function rotateOnAxis(axis, angle) { // rotate object on axis in object space // axis is assumed to be normalized _q1.setFromAxisAngle(axis, angle); @@ -4989,7 +5442,7 @@ this.quaternion.multiply(_q1); return this; }, - rotateOnWorldAxis: function (axis, angle) { + rotateOnWorldAxis: function rotateOnWorldAxis(axis, angle) { // rotate object on axis in world space // axis is assumed to be normalized // method assumes no rotated parent @@ -4998,39 +5451,39 @@ this.quaternion.premultiply(_q1); return this; }, - rotateX: function (angle) { + rotateX: function rotateX(angle) { return this.rotateOnAxis(_xAxis, angle); }, - rotateY: function (angle) { + rotateY: function rotateY(angle) { return this.rotateOnAxis(_yAxis, angle); }, - rotateZ: function (angle) { + rotateZ: function rotateZ(angle) { return this.rotateOnAxis(_zAxis, angle); }, - translateOnAxis: function (axis, distance) { + translateOnAxis: function 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$3.copy(axis).applyQuaternion(this.quaternion); - this.position.add(_v1$4.multiplyScalar(distance)); + this.position.add(_v1$3.multiplyScalar(distance)); return this; }, - translateX: function (distance) { + translateX: function translateX(distance) { return this.translateOnAxis(_xAxis, distance); }, - translateY: function (distance) { + translateY: function translateY(distance) { return this.translateOnAxis(_yAxis, distance); }, - translateZ: function (distance) { + translateZ: function translateZ(distance) { return this.translateOnAxis(_zAxis, distance); }, - localToWorld: function (vector) { + localToWorld: function localToWorld(vector) { return vector.applyMatrix4(this.matrixWorld); }, - worldToLocal: function (vector) { + worldToLocal: function worldToLocal(vector) { return vector.applyMatrix4(_m1$1.copy(this.matrixWorld).invert()); }, - lookAt: function (x, y, z) { + lookAt: function lookAt(x, y, z) { // This method does not support objects having non-uniformly-scaled parent(s) if (x.isVector3) { _target.copy(x); @@ -5038,15 +5491,15 @@ _target.set(x, y, z); } - const parent = this.parent; + var parent = this.parent; this.updateWorldMatrix(true, false); - _position$3.setFromMatrixPosition(this.matrixWorld); + _position.setFromMatrixPosition(this.matrixWorld); if (this.isCamera || this.isLight) { - _m1$1.lookAt(_position$3, _target, this.up); + _m1$1.lookAt(_position, _target, this.up); } else { - _m1$1.lookAt(_target, _position$3, this.up); + _m1$1.lookAt(_target, _position, this.up); } this.quaternion.setFromRotationMatrix(_m1$1); @@ -5059,9 +5512,9 @@ this.quaternion.premultiply(_q1.invert()); } }, - add: function (object) { + add: function add(object) { if (arguments.length > 1) { - for (let i = 0; i < arguments.length; i++) { + for (var i = 0; i < arguments.length; i++) { this.add(arguments[i]); } @@ -5087,16 +5540,16 @@ return this; }, - remove: function (object) { + remove: function remove(object) { if (arguments.length > 1) { - for (let i = 0; i < arguments.length; i++) { + for (var i = 0; i < arguments.length; i++) { this.remove(arguments[i]); } return this; } - const index = this.children.indexOf(object); + var index = this.children.indexOf(object); if (index !== -1) { object.parent = null; @@ -5106,9 +5559,9 @@ return this; }, - clear: function () { - for (let i = 0; i < this.children.length; i++) { - const object = this.children[i]; + clear: function clear() { + for (var i = 0; i < this.children.length; i++) { + var object = this.children[i]; object.parent = null; object.dispatchEvent(_removedEvent); } @@ -5116,7 +5569,7 @@ this.children.length = 0; return this; }, - attach: function (object) { + attach: function attach(object) { // adds object as a child of this, while maintaining the object's world transform this.updateWorldMatrix(true, false); @@ -5133,18 +5586,18 @@ object.updateWorldMatrix(false, true); return this; }, - getObjectById: function (id) { + getObjectById: function getObjectById(id) { return this.getObjectByProperty('id', id); }, - getObjectByName: function (name) { + getObjectByName: function getObjectByName(name) { return this.getObjectByProperty('name', name); }, - getObjectByProperty: function (name, value) { + getObjectByProperty: function 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); + for (var i = 0, l = this.children.length; i < l; i++) { + var child = this.children[i]; + var object = child.getObjectByProperty(name, value); if (object !== undefined) { return object; @@ -5153,7 +5606,7 @@ return undefined; }, - getWorldPosition: function (target) { + getWorldPosition: function getWorldPosition(target) { if (target === undefined) { console.warn('THREE.Object3D: .getWorldPosition() target is now required'); target = new Vector3(); @@ -5162,67 +5615,67 @@ this.updateWorldMatrix(true, false); return target.setFromMatrixPosition(this.matrixWorld); }, - getWorldQuaternion: function (target) { + getWorldQuaternion: function getWorldQuaternion(target) { if (target === undefined) { console.warn('THREE.Object3D: .getWorldQuaternion() target is now required'); target = new Quaternion(); } this.updateWorldMatrix(true, false); - this.matrixWorld.decompose(_position$3, target, _scale$2); + this.matrixWorld.decompose(_position, target, _scale); return target; }, - getWorldScale: function (target) { + getWorldScale: function getWorldScale(target) { if (target === undefined) { console.warn('THREE.Object3D: .getWorldScale() target is now required'); target = new Vector3(); } this.updateWorldMatrix(true, false); - this.matrixWorld.decompose(_position$3, _quaternion$2, target); + this.matrixWorld.decompose(_position, _quaternion$2, target); return target; }, - getWorldDirection: function (target) { + getWorldDirection: function getWorldDirection(target) { if (target === undefined) { console.warn('THREE.Object3D: .getWorldDirection() target is now required'); target = new Vector3(); } this.updateWorldMatrix(true, false); - const e = this.matrixWorld.elements; + var e = this.matrixWorld.elements; return target.set(e[8], e[9], e[10]).normalize(); }, - raycast: function () {}, - traverse: function (callback) { + raycast: function raycast() {}, + traverse: function traverse(callback) { callback(this); - const children = this.children; + var children = this.children; - for (let i = 0, l = children.length; i < l; i++) { + for (var i = 0, l = children.length; i < l; i++) { children[i].traverse(callback); } }, - traverseVisible: function (callback) { + traverseVisible: function traverseVisible(callback) { if (this.visible === false) return; callback(this); - const children = this.children; + var children = this.children; - for (let i = 0, l = children.length; i < l; i++) { + for (var i = 0, l = children.length; i < l; i++) { children[i].traverseVisible(callback); } }, - traverseAncestors: function (callback) { - const parent = this.parent; + traverseAncestors: function traverseAncestors(callback) { + var parent = this.parent; if (parent !== null) { callback(parent); parent.traverseAncestors(callback); } }, - updateMatrix: function () { + updateMatrix: function updateMatrix() { this.matrix.compose(this.position, this.quaternion, this.scale); this.matrixWorldNeedsUpdate = true; }, - updateMatrixWorld: function (force) { + updateMatrixWorld: function updateMatrixWorld(force) { if (this.matrixAutoUpdate) this.updateMatrix(); if (this.matrixWorldNeedsUpdate || force) { @@ -5237,14 +5690,14 @@ } // update children - const children = this.children; + var children = this.children; - for (let i = 0, l = children.length; i < l; i++) { + for (var i = 0, l = children.length; i < l; i++) { children[i].updateMatrixWorld(force); } }, - updateWorldMatrix: function (updateParents, updateChildren) { - const parent = this.parent; + updateWorldMatrix: function updateWorldMatrix(updateParents, updateChildren) { + var parent = this.parent; if (updateParents === true && parent !== null) { parent.updateWorldMatrix(true, false); @@ -5260,17 +5713,17 @@ if (updateChildren === true) { - const children = this.children; + var children = this.children; - for (let i = 0, l = children.length; i < l; i++) { + for (var i = 0, l = children.length; i < l; i++) { children[i].updateWorldMatrix(false, true); } } }, - toJSON: function (meta) { + toJSON: function 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. + var isRootObject = meta === undefined || typeof meta === 'string'; + var output = {}; // meta is a hash used to collect geometries, materials. // not providing it implies that this is the root object // being serialized. @@ -5293,7 +5746,7 @@ } // standard Object3D serialization - const object = {}; + var object = {}; object.uuid = this.uuid; object.type = this.type; if (this.name !== '') object.name = this.name; @@ -5324,14 +5777,14 @@ if (this.isMesh || this.isLine || this.isPoints) { object.geometry = serialize(meta.geometries, this.geometry); - const parameters = this.geometry.parameters; + var parameters = this.geometry.parameters; if (parameters !== undefined && parameters.shapes !== undefined) { - const shapes = parameters.shapes; + var shapes = parameters.shapes; if (Array.isArray(shapes)) { - for (let i = 0, l = shapes.length; i < l; i++) { - const shape = shapes[i]; + for (var i = 0, l = shapes.length; i < l; i++) { + var shape = shapes[i]; serialize(meta.shapes, shape); } } else { @@ -5352,10 +5805,10 @@ if (this.material !== undefined) { if (Array.isArray(this.material)) { - const uuids = []; + var uuids = []; - for (let i = 0, l = this.material.length; i < l; i++) { - uuids.push(serialize(meta.materials, this.material[i])); + for (var _i = 0, _l = this.material.length; _i < _l; _i++) { + uuids.push(serialize(meta.materials, this.material[_i])); } object.material = uuids; @@ -5368,8 +5821,8 @@ 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); + for (var _i2 = 0; _i2 < this.children.length; _i2++) { + object.children.push(this.children[_i2].toJSON(meta).object); } } // @@ -5377,25 +5830,27 @@ if (this.animations.length > 0) { object.animations = []; - for (let i = 0; i < this.animations.length; i++) { - const animation = this.animations[i]; + for (var _i3 = 0; _i3 < this.animations.length; _i3++) { + var animation = this.animations[_i3]; object.animations.push(serialize(meta.animations, animation)); } } if (isRootObject) { - const geometries = extractFromCache(meta.geometries); - const materials = extractFromCache(meta.materials); - const textures = extractFromCache(meta.textures); - const images = extractFromCache(meta.images); - const shapes = extractFromCache(meta.shapes); - const skeletons = extractFromCache(meta.skeletons); - const animations = extractFromCache(meta.animations); + var geometries = extractFromCache(meta.geometries); + var materials = extractFromCache(meta.materials); + var textures = extractFromCache(meta.textures); + var images = extractFromCache(meta.images); + + var _shapes = extractFromCache(meta.shapes); + + var skeletons = extractFromCache(meta.skeletons); + var animations = extractFromCache(meta.animations); if (geometries.length > 0) output.geometries = geometries; if (materials.length > 0) output.materials = materials; if (textures.length > 0) output.textures = textures; if (images.length > 0) output.images = images; - if (shapes.length > 0) output.shapes = shapes; + if (_shapes.length > 0) output.shapes = _shapes; if (skeletons.length > 0) output.skeletons = skeletons; if (animations.length > 0) output.animations = animations; } @@ -5406,10 +5861,10 @@ // and return as array function extractFromCache(cache) { - const values = []; + var values = []; - for (const key in cache) { - const data = cache[key]; + for (var key in cache) { + var data = cache[key]; delete data.metadata; values.push(data); } @@ -5417,10 +5872,14 @@ return values; } }, - clone: function (recursive) { + clone: function clone(recursive) { return new this.constructor().copy(this, recursive); }, - copy: function (source, recursive = true) { + copy: function copy(source, recursive) { + if (recursive === void 0) { + recursive = true; + } + this.name = source.name; this.up.copy(source.up); this.position.copy(source.position); @@ -5440,8 +5899,8 @@ 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]; + for (var i = 0; i < source.children.length; i++) { + var child = source.children[i]; this.add(child.clone()); } } @@ -5450,90 +5909,100 @@ } }); - const _vector1 = /*@__PURE__*/new Vector3(); + var _vector1 = /*@__PURE__*/new Vector3(); - const _vector2$1 = /*@__PURE__*/new Vector3(); + var _vector2 = /*@__PURE__*/new Vector3(); - const _normalMatrix = /*@__PURE__*/new Matrix3(); + var _normalMatrix = /*@__PURE__*/new Matrix3(); + + var Plane = /*#__PURE__*/function () { + function Plane(normal, constant) { + if (normal === void 0) { + normal = new Vector3(1, 0, 0); + } + + if (constant === void 0) { + constant = 0; + } - 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) { + var _proto = Plane.prototype; + + _proto.set = function set(normal, constant) { this.normal.copy(normal); this.constant = constant; return this; - } + }; - setComponents(x, y, z, w) { + _proto.setComponents = function setComponents(x, y, z, w) { this.normal.set(x, y, z); this.constant = w; return this; - } + }; - setFromNormalAndCoplanarPoint(normal, point) { + _proto.setFromNormalAndCoplanarPoint = function 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$1.subVectors(a, b)).normalize(); // Q: should an error be thrown if normal is zero (e.g. degenerate plane)? + _proto.setFromCoplanarPoints = function setFromCoplanarPoints(a, b, c) { + var 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) { + _proto.copy = function copy(plane) { this.normal.copy(plane.normal); this.constant = plane.constant; return this; - } + }; - normalize() { + _proto.normalize = function normalize() { // Note: will lead to a divide by zero if the plane is invalid. - const inverseNormalLength = 1.0 / this.normal.length(); + var inverseNormalLength = 1.0 / this.normal.length(); this.normal.multiplyScalar(inverseNormalLength); this.constant *= inverseNormalLength; return this; - } + }; - negate() { + _proto.negate = function negate() { this.constant *= -1; this.normal.negate(); return this; - } + }; - distanceToPoint(point) { + _proto.distanceToPoint = function distanceToPoint(point) { return this.normal.dot(point) + this.constant; - } + }; - distanceToSphere(sphere) { + _proto.distanceToSphere = function distanceToSphere(sphere) { return this.distanceToPoint(sphere.center) - sphere.radius; - } + }; - projectPoint(point, target) { + _proto.projectPoint = function projectPoint(point, target) { if (target === undefined) { console.warn('THREE.Plane: .projectPoint() target is now required'); target = new Vector3(); } return target.copy(this.normal).multiplyScalar(-this.distanceToPoint(point)).add(point); - } + }; - intersectLine(line, target) { + _proto.intersectLine = function intersectLine(line, target) { if (target === undefined) { console.warn('THREE.Plane: .intersectLine() target is now required'); target = new Vector3(); } - const direction = line.delta(_vector1); - const denominator = this.normal.dot(direction); + var direction = line.delta(_vector1); + var denominator = this.normal.dot(direction); if (denominator === 0) { // line is coplanar, return origin @@ -5545,93 +6014,106 @@ return null; } - const t = -(line.start.dot(this.normal) + this.constant) / denominator; + var 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) { + _proto.intersectsLine = function 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); + var startSign = this.distanceToPoint(line.start); + var endSign = this.distanceToPoint(line.end); return startSign < 0 && endSign > 0 || endSign < 0 && startSign > 0; - } + }; - intersectsBox(box) { + _proto.intersectsBox = function intersectsBox(box) { return box.intersectsPlane(this); - } + }; - intersectsSphere(sphere) { + _proto.intersectsSphere = function intersectsSphere(sphere) { return sphere.intersectsPlane(this); - } + }; - coplanarPoint(target) { + _proto.coplanarPoint = function coplanarPoint(target) { if (target === undefined) { console.warn('THREE.Plane: .coplanarPoint() target is now required'); target = new Vector3(); } return target.copy(this.normal).multiplyScalar(-this.constant); - } + }; - applyMatrix4(matrix, optionalNormalMatrix) { - const normalMatrix = optionalNormalMatrix || _normalMatrix.getNormalMatrix(matrix); + _proto.applyMatrix4 = function applyMatrix4(matrix, optionalNormalMatrix) { + var normalMatrix = optionalNormalMatrix || _normalMatrix.getNormalMatrix(matrix); - const referencePoint = this.coplanarPoint(_vector1).applyMatrix4(matrix); - const normal = this.normal.applyMatrix3(normalMatrix).normalize(); + var referencePoint = this.coplanarPoint(_vector1).applyMatrix4(matrix); + var normal = this.normal.applyMatrix3(normalMatrix).normalize(); this.constant = -referencePoint.dot(normal); return this; - } + }; - translate(offset) { + _proto.translate = function translate(offset) { this.constant -= offset.dot(this.normal); return this; - } + }; - equals(plane) { + _proto.equals = function equals(plane) { return plane.normal.equals(this.normal) && plane.constant === this.constant; - } + }; - clone() { + _proto.clone = function clone() { return new this.constructor().copy(this); - } + }; - } + return Plane; + }(); Plane.prototype.isPlane = true; - const _v0$1 = /*@__PURE__*/new Vector3(); + var _v0$1 = /*@__PURE__*/new Vector3(); - const _v1$3 = /*@__PURE__*/new Vector3(); + var _v1$4 = /*@__PURE__*/new Vector3(); - const _v2$2 = /*@__PURE__*/new Vector3(); + var _v2$1 = /*@__PURE__*/new Vector3(); - const _v3$1 = /*@__PURE__*/new Vector3(); + var _v3 = /*@__PURE__*/new Vector3(); - const _vab = /*@__PURE__*/new Vector3(); + var _vab = /*@__PURE__*/new Vector3(); - const _vac = /*@__PURE__*/new Vector3(); + var _vac = /*@__PURE__*/new Vector3(); - const _vbc = /*@__PURE__*/new Vector3(); + var _vbc = /*@__PURE__*/new Vector3(); - const _vap = /*@__PURE__*/new Vector3(); + var _vap = /*@__PURE__*/new Vector3(); - const _vbp = /*@__PURE__*/new Vector3(); + var _vbp = /*@__PURE__*/new Vector3(); - const _vcp = /*@__PURE__*/new Vector3(); + var _vcp = /*@__PURE__*/new Vector3(); + + var Triangle = /*#__PURE__*/function () { + function Triangle(a, b, c) { + if (a === void 0) { + a = new Vector3(); + } + + if (b === void 0) { + b = new Vector3(); + } + + if (c === void 0) { + c = 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) { + Triangle.getNormal = function getNormal(a, b, c, target) { if (target === undefined) { console.warn('THREE.Triangle: .getNormal() target is now required'); target = new Vector3(); @@ -5642,7 +6124,7 @@ _v0$1.subVectors(a, b); target.cross(_v0$1); - const targetLengthSq = target.lengthSq(); + var targetLengthSq = target.lengthSq(); if (targetLengthSq > 0) { return target.multiplyScalar(1 / Math.sqrt(targetLengthSq)); @@ -5651,26 +6133,26 @@ return target.set(0, 0, 0); } // static/instance method to calculate barycentric coordinates // based on: http://www.blackpawn.com/texts/pointinpoly/default.html + ; - - static getBarycoord(point, a, b, c, target) { + Triangle.getBarycoord = function getBarycoord(point, a, b, c, target) { _v0$1.subVectors(c, a); - _v1$3.subVectors(b, a); + _v1$4.subVectors(b, a); - _v2$2.subVectors(point, a); + _v2$1.subVectors(point, a); - const dot00 = _v0$1.dot(_v0$1); + var dot00 = _v0$1.dot(_v0$1); - const dot01 = _v0$1.dot(_v1$3); + var dot01 = _v0$1.dot(_v1$4); - const dot02 = _v0$1.dot(_v2$2); + var dot02 = _v0$1.dot(_v2$1); - const dot11 = _v1$3.dot(_v1$3); + var dot11 = _v1$4.dot(_v1$4); - const dot12 = _v1$3.dot(_v2$2); + var dot12 = _v1$4.dot(_v2$1); - const denom = dot00 * dot11 - dot01 * dot01; + var denom = dot00 * dot11 - dot01 * dot01; if (target === undefined) { console.warn('THREE.Triangle: .getBarycoord() target is now required'); @@ -5684,121 +6166,123 @@ 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 + var invDenom = 1 / denom; + var u = (dot11 * dot02 - dot01 * dot12) * invDenom; + var 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; - } + Triangle.containsPoint = function containsPoint(point, a, b, c) { + this.getBarycoord(point, a, b, c, _v3); + return _v3.x >= 0 && _v3.y >= 0 && _v3.x + _v3.y <= 1; + }; - static getUV(point, p1, p2, p3, uv1, uv2, uv3, target) { - this.getBarycoord(point, p1, p2, p3, _v3$1); + Triangle.getUV = function getUV(point, p1, p2, p3, uv1, uv2, uv3, target) { + this.getBarycoord(point, p1, p2, p3, _v3); target.set(0, 0); - target.addScaledVector(uv1, _v3$1.x); - target.addScaledVector(uv2, _v3$1.y); - target.addScaledVector(uv3, _v3$1.z); + target.addScaledVector(uv1, _v3.x); + target.addScaledVector(uv2, _v3.y); + target.addScaledVector(uv3, _v3.z); return target; - } + }; - static isFrontFacing(a, b, c, direction) { + Triangle.isFrontFacing = function isFrontFacing(a, b, c, direction) { _v0$1.subVectors(c, b); - _v1$3.subVectors(a, b); // strictly front facing + _v1$4.subVectors(a, b); // strictly front facing - return _v0$1.cross(_v1$3).dot(direction) < 0 ? true : false; - } + return _v0$1.cross(_v1$4).dot(direction) < 0 ? true : false; + }; + + var _proto = Triangle.prototype; - set(a, b, c) { + _proto.set = function set(a, b, c) { this.a.copy(a); this.b.copy(b); this.c.copy(c); return this; - } + }; - setFromPointsAndIndices(points, i0, i1, i2) { + _proto.setFromPointsAndIndices = function setFromPointsAndIndices(points, i0, i1, i2) { this.a.copy(points[i0]); this.b.copy(points[i1]); this.c.copy(points[i2]); return this; - } + }; - clone() { + _proto.clone = function clone() { return new this.constructor().copy(this); - } + }; - copy(triangle) { + _proto.copy = function copy(triangle) { this.a.copy(triangle.a); this.b.copy(triangle.b); this.c.copy(triangle.c); return this; - } + }; - getArea() { + _proto.getArea = function getArea() { _v0$1.subVectors(this.c, this.b); - _v1$3.subVectors(this.a, this.b); + _v1$4.subVectors(this.a, this.b); - return _v0$1.cross(_v1$3).length() * 0.5; - } + return _v0$1.cross(_v1$4).length() * 0.5; + }; - getMidpoint(target) { + _proto.getMidpoint = function getMidpoint(target) { if (target === undefined) { console.warn('THREE.Triangle: .getMidpoint() target is now required'); target = new Vector3(); } return target.addVectors(this.a, this.b).add(this.c).multiplyScalar(1 / 3); - } + }; - getNormal(target) { + _proto.getNormal = function getNormal(target) { return Triangle.getNormal(this.a, this.b, this.c, target); - } + }; - getPlane(target) { + _proto.getPlane = function getPlane(target) { if (target === undefined) { console.warn('THREE.Triangle: .getPlane() target is now required'); target = new Plane(); } return target.setFromCoplanarPoints(this.a, this.b, this.c); - } + }; - getBarycoord(point, target) { + _proto.getBarycoord = function getBarycoord(point, target) { return Triangle.getBarycoord(point, this.a, this.b, this.c, target); - } + }; - getUV(point, uv1, uv2, uv3, target) { + _proto.getUV = function getUV(point, uv1, uv2, uv3, target) { return Triangle.getUV(point, this.a, this.b, this.c, uv1, uv2, uv3, target); - } + }; - containsPoint(point) { + _proto.containsPoint = function containsPoint(point) { return Triangle.containsPoint(point, this.a, this.b, this.c); - } + }; - isFrontFacing(direction) { + _proto.isFrontFacing = function isFrontFacing(direction) { return Triangle.isFrontFacing(this.a, this.b, this.c, direction); - } + }; - intersectsBox(box) { + _proto.intersectsBox = function intersectsBox(box) { return box.intersectsTriangle(this); - } + }; - closestPointToPoint(p, target) { + _proto.closestPointToPoint = function closestPointToPoint(p, target) { if (target === undefined) { console.warn('THREE.Triangle: .closestPointToPoint() target is now required'); target = new Vector3(); } - const a = this.a, - b = this.b, - c = this.c; - let v, w; // algorithm thanks to Real-Time Collision Detection by Christer Ericson, + var a = this.a, + b = this.b, + c = this.c; + var 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 @@ -5810,9 +6294,9 @@ _vap.subVectors(p, a); - const d1 = _vab.dot(_vap); + var d1 = _vab.dot(_vap); - const d2 = _vac.dot(_vap); + var d2 = _vac.dot(_vap); if (d1 <= 0 && d2 <= 0) { // vertex region of A; barycentric coords (1, 0, 0) @@ -5821,16 +6305,16 @@ _vbp.subVectors(p, b); - const d3 = _vab.dot(_vbp); + var d3 = _vab.dot(_vbp); - const d4 = _vac.dot(_vbp); + var 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; + var 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) @@ -5840,16 +6324,16 @@ _vcp.subVectors(p, c); - const d5 = _vab.dot(_vcp); + var d5 = _vab.dot(_vcp); - const d6 = _vac.dot(_vcp); + var 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; + var 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) @@ -5857,7 +6341,7 @@ return target.copy(a).addScaledVector(_vac, w); } - const va = d3 * d6 - d5 * d4; + var va = d3 * d6 - d5 * d4; if (va <= 0 && d4 - d3 >= 0 && d5 - d6 >= 0) { _vbc.subVectors(c, b); @@ -5868,20 +6352,21 @@ } // face region - const denom = 1 / (va + vb + vc); // u = va * denom + var 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) { + _proto.equals = function equals(triangle) { return triangle.a.equals(this.a) && triangle.b.equals(this.b) && triangle.c.equals(this.c); - } + }; - } + return Triangle; + }(); - let materialId = 0; + var materialId = 0; function Material() { Object.defineProperty(this, 'id', { @@ -5936,17 +6421,17 @@ Material.prototype = Object.assign(Object.create(EventDispatcher.prototype), { constructor: Material, isMaterial: true, - onBeforeCompile: function () + onBeforeCompile: function onBeforeCompile() /* shaderobject, renderer */ {}, - customProgramCacheKey: function () { + customProgramCacheKey: function customProgramCacheKey() { return this.onBeforeCompile.toString(); }, - setValues: function (values) { + setValues: function setValues(values) { if (values === undefined) return; - for (const key in values) { - const newValue = values[key]; + for (var key in values) { + var newValue = values[key]; if (newValue === undefined) { console.warn('THREE.Material: \'' + key + '\' parameter is undefined.'); @@ -5960,7 +6445,7 @@ continue; } - const currentValue = this[key]; + var currentValue = this[key]; if (currentValue === undefined) { console.warn('THREE.' + this.type + ': \'' + key + '\' is not a property of this material.'); @@ -5976,8 +6461,8 @@ } } }, - toJSON: function (meta) { - const isRoot = meta === undefined || typeof meta === 'string'; + toJSON: function toJSON(meta) { + var isRoot = meta === undefined || typeof meta === 'string'; if (isRoot) { meta = { @@ -5986,7 +6471,7 @@ }; } - const data = { + var data = { metadata: { version: 4.5, type: 'Material', @@ -6116,30 +6601,30 @@ if (JSON.stringify(this.userData) !== '{}') data.userData = this.userData; // TODO: Copied from Object3D.toJSON function extractFromCache(cache) { - const values = []; + var values = []; - for (const key in cache) { - const data = cache[key]; - delete data.metadata; - values.push(data); + for (var key in cache) { + var _data = cache[key]; + delete _data.metadata; + values.push(_data); } return values; } if (isRoot) { - const textures = extractFromCache(meta.textures); - const images = extractFromCache(meta.images); + var textures = extractFromCache(meta.textures); + var images = extractFromCache(meta.images); if (textures.length > 0) data.textures = textures; if (images.length > 0) data.images = images; } return data; }, - clone: function () { + clone: function clone() { return new this.constructor().copy(this); }, - copy: function (source) { + copy: function copy(source) { this.name = source.name; this.fog = source.fog; this.blending = source.blending; @@ -6164,14 +6649,14 @@ this.stencilZFail = source.stencilZFail; this.stencilZPass = source.stencilZPass; this.stencilWrite = source.stencilWrite; - const srcPlanes = source.clippingPlanes; - let dstPlanes = null; + var srcPlanes = source.clippingPlanes; + var dstPlanes = null; if (srcPlanes !== null) { - const n = srcPlanes.length; + var n = srcPlanes.length; dstPlanes = new Array(n); - for (let i = 0; i !== n; ++i) { + for (var i = 0; i !== n; ++i) { dstPlanes[i] = srcPlanes[i].clone(); } } @@ -6194,19 +6679,19 @@ this.userData = JSON.parse(JSON.stringify(source.userData)); return this; }, - dispose: function () { + dispose: function dispose() { this.dispatchEvent({ type: 'dispose' }); } }); Object.defineProperty(Material.prototype, 'needsUpdate', { - set: function (value) { + set: function set(value) { if (value === true) this.version++; } }); - const _colorKeywords = { + var _colorKeywords = { 'aliceblue': 0xF0F8FF, 'antiquewhite': 0xFAEBD7, 'aqua': 0x00FFFF, @@ -6356,12 +6841,12 @@ 'yellow': 0xFFFF00, 'yellowgreen': 0x9ACD32 }; - const _hslA = { + var _hslA = { h: 0, s: 0, l: 0 }; - const _hslB = { + var _hslB = { h: 0, s: 0, l: 0 @@ -6384,8 +6869,8 @@ return c < 0.0031308 ? c * 12.92 : 1.055 * Math.pow(c, 0.41666) - 0.055; } - class Color { - constructor(r, g, b) { + var Color = /*#__PURE__*/function () { + function Color(r, g, b) { if (g === undefined && b === undefined) { // r is THREE.Color, hex or string return this.set(r); @@ -6394,7 +6879,9 @@ return this.setRGB(r, g, b); } - set(value) { + var _proto = Color.prototype; + + _proto.set = function set(value) { if (value && value.isColor) { this.copy(value); } else if (typeof value === 'number') { @@ -6404,31 +6891,31 @@ } return this; - } + }; - setScalar(scalar) { + _proto.setScalar = function setScalar(scalar) { this.r = scalar; this.g = scalar; this.b = scalar; return this; - } + }; - setHex(hex) { + _proto.setHex = function setHex(hex) { hex = Math.floor(hex); this.r = (hex >> 16 & 255) / 255; this.g = (hex >> 8 & 255) / 255; this.b = (hex & 255) / 255; return this; - } + }; - setRGB(r, g, b) { + _proto.setRGB = function setRGB(r, g, b) { this.r = r; this.g = g; this.b = b; return this; - } + }; - setHSL(h, s, l) { + _proto.setHSL = function setHSL(h, s, l) { // h,s,l ranges are in 0.0 - 1.0 h = MathUtils.euclideanModulo(h, 1); s = MathUtils.clamp(s, 0, 1); @@ -6437,17 +6924,17 @@ if (s === 0) { this.r = this.g = this.b = l; } else { - const p = l <= 0.5 ? l * (1 + s) : l + s - l * s; - const q = 2 * l - p; + var p = l <= 0.5 ? l * (1 + s) : l + s - l * s; + var q = 2 * l - p; this.r = hue2rgb(q, p, h + 1 / 3); this.g = hue2rgb(q, p, h); this.b = hue2rgb(q, p, h - 1 / 3); } return this; - } + }; - setStyle(style) { + _proto.setStyle = function setStyle(style) { function handleAlpha(string) { if (string === undefined) return; @@ -6456,13 +6943,13 @@ } } - let m; + var m; if (m = /^((?:rgb|hsl)a?)\(([^\)]*)\)/.exec(style)) { // rgb / hsl - let color; - const name = m[1]; - const components = m[2]; + var color; + var name = m[1]; + var components = m[2]; switch (name) { case 'rgb': @@ -6491,9 +6978,9 @@ case 'hsla': if (color = /^\s*(\d*\.?\d+)\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(components)) { // hsl(120,50%,50%) hsla(120,50%,50%,0.5) - const h = parseFloat(color[1]) / 360; - const s = parseInt(color[2], 10) / 100; - const l = parseInt(color[3], 10) / 100; + var h = parseFloat(color[1]) / 360; + var s = parseInt(color[2], 10) / 100; + var l = parseInt(color[3], 10) / 100; handleAlpha(color[4]); return this.setHSL(h, s, l); } @@ -6502,8 +6989,8 @@ } } else if (m = /^\#([A-Fa-f\d]+)$/.exec(style)) { // hex color - const hex = m[1]; - const size = hex.length; + var hex = m[1]; + var size = hex.length; if (size === 3) { // #ff0 @@ -6525,11 +7012,11 @@ } return this; - } + }; - setColorName(style) { + _proto.setColorName = function setColorName(style) { // color keywords - const hex = _colorKeywords[style]; + var hex = _colorKeywords[style]; if (hex !== undefined) { // red @@ -6540,77 +7027,85 @@ } return this; - } + }; - clone() { + _proto.clone = function clone() { return new this.constructor(this.r, this.g, this.b); - } + }; - copy(color) { + _proto.copy = function copy(color) { this.r = color.r; this.g = color.g; this.b = color.b; return this; - } + }; + + _proto.copyGammaToLinear = function copyGammaToLinear(color, gammaFactor) { + if (gammaFactor === void 0) { + gammaFactor = 2.0; + } - copyGammaToLinear(color, gammaFactor = 2.0) { this.r = Math.pow(color.r, gammaFactor); this.g = Math.pow(color.g, gammaFactor); this.b = Math.pow(color.b, gammaFactor); return this; - } + }; - copyLinearToGamma(color, gammaFactor = 2.0) { - const safeInverse = gammaFactor > 0 ? 1.0 / gammaFactor : 1.0; + _proto.copyLinearToGamma = function copyLinearToGamma(color, gammaFactor) { + if (gammaFactor === void 0) { + gammaFactor = 2.0; + } + + var safeInverse = gammaFactor > 0 ? 1.0 / gammaFactor : 1.0; this.r = Math.pow(color.r, safeInverse); this.g = Math.pow(color.g, safeInverse); this.b = Math.pow(color.b, safeInverse); return this; - } + }; - convertGammaToLinear(gammaFactor) { + _proto.convertGammaToLinear = function convertGammaToLinear(gammaFactor) { this.copyGammaToLinear(this, gammaFactor); return this; - } + }; - convertLinearToGamma(gammaFactor) { + _proto.convertLinearToGamma = function convertLinearToGamma(gammaFactor) { this.copyLinearToGamma(this, gammaFactor); return this; - } + }; - copySRGBToLinear(color) { + _proto.copySRGBToLinear = function copySRGBToLinear(color) { this.r = SRGBToLinear(color.r); this.g = SRGBToLinear(color.g); this.b = SRGBToLinear(color.b); return this; - } + }; - copyLinearToSRGB(color) { + _proto.copyLinearToSRGB = function copyLinearToSRGB(color) { this.r = LinearToSRGB(color.r); this.g = LinearToSRGB(color.g); this.b = LinearToSRGB(color.b); return this; - } + }; - convertSRGBToLinear() { + _proto.convertSRGBToLinear = function convertSRGBToLinear() { this.copySRGBToLinear(this); return this; - } + }; - convertLinearToSRGB() { + _proto.convertLinearToSRGB = function convertLinearToSRGB() { this.copyLinearToSRGB(this); return this; - } + }; - getHex() { + _proto.getHex = function getHex() { return this.r * 255 << 16 ^ this.g * 255 << 8 ^ this.b * 255 << 0; - } + }; - getHexString() { + _proto.getHexString = function getHexString() { return ('000000' + this.getHex().toString(16)).slice(-6); - } + }; - getHSL(target) { + _proto.getHSL = function getHSL(target) { // h,s,l ranges are in 0.0 - 1.0 if (target === undefined) { console.warn('THREE.Color: .getHSL() target is now required'); @@ -6621,19 +7116,19 @@ }; } - const r = this.r, - 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; + var r = this.r, + g = this.g, + b = this.b; + var max = Math.max(r, g, b); + var min = Math.min(r, g, b); + var hue, saturation; + var lightness = (min + max) / 2.0; if (min === max) { hue = 0; saturation = 0; } else { - const delta = max - min; + var delta = max - min; saturation = lightness <= 0.5 ? delta / (max + min) : delta / (2 - max - min); switch (max) { @@ -6657,106 +7152,118 @@ target.s = saturation; target.l = lightness; return target; - } + }; - getStyle() { + _proto.getStyle = function getStyle() { return 'rgb(' + (this.r * 255 | 0) + ',' + (this.g * 255 | 0) + ',' + (this.b * 255 | 0) + ')'; - } + }; - offsetHSL(h, s, l) { + _proto.offsetHSL = function offsetHSL(h, s, l) { this.getHSL(_hslA); _hslA.h += h; _hslA.s += s; _hslA.l += l; this.setHSL(_hslA.h, _hslA.s, _hslA.l); return this; - } + }; - add(color) { + _proto.add = function add(color) { this.r += color.r; this.g += color.g; this.b += color.b; return this; - } + }; - addColors(color1, color2) { + _proto.addColors = function 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) { + _proto.addScalar = function addScalar(s) { this.r += s; this.g += s; this.b += s; return this; - } + }; - sub(color) { + _proto.sub = function 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) { + _proto.multiply = function multiply(color) { this.r *= color.r; this.g *= color.g; this.b *= color.b; return this; - } + }; - multiplyScalar(s) { + _proto.multiplyScalar = function multiplyScalar(s) { this.r *= s; this.g *= s; this.b *= s; return this; - } + }; - lerp(color, alpha) { + _proto.lerp = function 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) { + _proto.lerpColors = function 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) { + _proto.lerpHSL = function lerpHSL(color, alpha) { this.getHSL(_hslA); color.getHSL(_hslB); - const h = MathUtils.lerp(_hslA.h, _hslB.h, alpha); - const s = MathUtils.lerp(_hslA.s, _hslB.s, alpha); - const l = MathUtils.lerp(_hslA.l, _hslB.l, alpha); + var h = MathUtils.lerp(_hslA.h, _hslB.h, alpha); + var s = MathUtils.lerp(_hslA.s, _hslB.s, alpha); + var l = MathUtils.lerp(_hslA.l, _hslB.l, alpha); this.setHSL(h, s, l); return this; - } + }; - equals(c) { + _proto.equals = function equals(c) { return c.r === this.r && c.g === this.g && c.b === this.b; - } + }; + + _proto.fromArray = function fromArray(array, offset) { + if (offset === void 0) { + offset = 0; + } - fromArray(array, offset = 0) { this.r = array[offset]; this.g = array[offset + 1]; this.b = array[offset + 2]; return this; - } + }; + + _proto.toArray = function toArray(array, offset) { + if (array === void 0) { + array = []; + } + + if (offset === void 0) { + offset = 0; + } - toArray(array = [], offset = 0) { array[offset] = this.r; array[offset + 1] = this.g; array[offset + 2] = this.b; return array; - } + }; - fromBufferAttribute(attribute, index) { + _proto.fromBufferAttribute = function fromBufferAttribute(attribute, index) { this.r = attribute.getX(index); this.g = attribute.getY(index); this.b = attribute.getZ(index); @@ -6769,13 +7276,14 @@ } return this; - } + }; - toJSON() { + _proto.toJSON = function toJSON() { return this.getHex(); - } + }; - } + return Color; + }(); Color.NAMES = _colorKeywords; Color.prototype.isColor = true; @@ -6815,34 +7323,44 @@ * } */ - class MeshBasicMaterial extends Material { - constructor(parameters) { - super(); - this.type = 'MeshBasicMaterial'; - this.color = new Color(0xffffff); // emissive + var MeshBasicMaterial = /*#__PURE__*/function (_Material) { + _inheritsLoose(MeshBasicMaterial, _Material); - this.map = null; - this.lightMap = null; - this.lightMapIntensity = 1.0; - this.aoMap = null; - this.aoMapIntensity = 1.0; - this.specularMap = null; - this.alphaMap = null; - this.envMap = null; - this.combine = MultiplyOperation; - this.reflectivity = 1; - this.refractionRatio = 0.98; - this.wireframe = false; - this.wireframeLinewidth = 1; - this.wireframeLinecap = 'round'; - this.wireframeLinejoin = 'round'; - this.skinning = false; - this.morphTargets = false; - this.setValues(parameters); + function MeshBasicMaterial(parameters) { + var _this; + + _this = _Material.call(this) || this; + _this.type = 'MeshBasicMaterial'; + _this.color = new Color(0xffffff); // emissive + + _this.map = null; + _this.lightMap = null; + _this.lightMapIntensity = 1.0; + _this.aoMap = null; + _this.aoMapIntensity = 1.0; + _this.specularMap = null; + _this.alphaMap = null; + _this.envMap = null; + _this.combine = MultiplyOperation; + _this.reflectivity = 1; + _this.refractionRatio = 0.98; + _this.wireframe = false; + _this.wireframeLinewidth = 1; + _this.wireframeLinecap = 'round'; + _this.wireframeLinejoin = 'round'; + _this.skinning = false; + _this.morphTargets = false; + + _this.setValues(parameters); + + return _this; } - copy(source) { - super.copy(source); + var _proto = MeshBasicMaterial.prototype; + + _proto.copy = function copy(source) { + _Material.prototype.copy.call(this, source); + this.color.copy(source.color); this.map = source.map; this.lightMap = source.lightMap; @@ -6862,15 +7380,16 @@ this.skinning = source.skinning; this.morphTargets = source.morphTargets; return this; - } + }; - } + return MeshBasicMaterial; + }(Material); MeshBasicMaterial.prototype.isMeshBasicMaterial = true; - const _vector$9 = new Vector3(); + var _vector$3 = new Vector3(); - const _vector2 = new Vector2(); + var _vector2$1 = new Vector2(); function BufferAttribute(array, itemSize, normalized) { if (Array.isArray(array)) { @@ -6891,18 +7410,18 @@ } Object.defineProperty(BufferAttribute.prototype, 'needsUpdate', { - set: function (value) { + set: function set(value) { if (value === true) this.version++; } }); Object.assign(BufferAttribute.prototype, { isBufferAttribute: true, - onUploadCallback: function () {}, - setUsage: function (value) { + onUploadCallback: function onUploadCallback() {}, + setUsage: function setUsage(value) { this.usage = value; return this; }, - copy: function (source) { + copy: function copy(source) { this.name = source.name; this.array = new source.array.constructor(source.array); this.itemSize = source.itemSize; @@ -6911,26 +7430,26 @@ this.usage = source.usage; return this; }, - copyAt: function (index1, attribute, index2) { + copyAt: function copyAt(index1, attribute, index2) { index1 *= this.itemSize; index2 *= attribute.itemSize; - for (let i = 0, l = this.itemSize; i < l; i++) { + for (var i = 0, l = this.itemSize; i < l; i++) { this.array[index1 + i] = attribute.array[index2 + i]; } return this; }, - copyArray: function (array) { + copyArray: function copyArray(array) { this.array.set(array); return this; }, - copyColorsArray: function (colors) { - const array = this.array; - let offset = 0; + copyColorsArray: function copyColorsArray(colors) { + var array = this.array; + var offset = 0; - for (let i = 0, l = colors.length; i < l; i++) { - let color = colors[i]; + for (var i = 0, l = colors.length; i < l; i++) { + var color = colors[i]; if (color === undefined) { console.warn('THREE.BufferAttribute.copyColorsArray(): color is undefined', i); @@ -6944,12 +7463,12 @@ return this; }, - copyVector2sArray: function (vectors) { - const array = this.array; - let offset = 0; + copyVector2sArray: function copyVector2sArray(vectors) { + var array = this.array; + var offset = 0; - for (let i = 0, l = vectors.length; i < l; i++) { - let vector = vectors[i]; + for (var i = 0, l = vectors.length; i < l; i++) { + var vector = vectors[i]; if (vector === undefined) { console.warn('THREE.BufferAttribute.copyVector2sArray(): vector is undefined', i); @@ -6962,12 +7481,12 @@ return this; }, - copyVector3sArray: function (vectors) { - const array = this.array; - let offset = 0; + copyVector3sArray: function copyVector3sArray(vectors) { + var array = this.array; + var offset = 0; - for (let i = 0, l = vectors.length; i < l; i++) { - let vector = vectors[i]; + for (var i = 0, l = vectors.length; i < l; i++) { + var vector = vectors[i]; if (vector === undefined) { console.warn('THREE.BufferAttribute.copyVector3sArray(): vector is undefined', i); @@ -6981,12 +7500,12 @@ return this; }, - copyVector4sArray: function (vectors) { - const array = this.array; - let offset = 0; + copyVector4sArray: function copyVector4sArray(vectors) { + var array = this.array; + var offset = 0; - for (let i = 0, l = vectors.length; i < l; i++) { - let vector = vectors[i]; + for (var i = 0, l = vectors.length; i < l; i++) { + var vector = vectors[i]; if (vector === undefined) { console.warn('THREE.BufferAttribute.copyVector4sArray(): vector is undefined', i); @@ -7001,112 +7520,116 @@ return this; }, - applyMatrix3: function (m) { + applyMatrix3: function applyMatrix3(m) { if (this.itemSize === 2) { - for (let i = 0, l = this.count; i < l; i++) { - _vector2.fromBufferAttribute(this, i); + for (var i = 0, l = this.count; i < l; i++) { + _vector2$1.fromBufferAttribute(this, i); - _vector2.applyMatrix3(m); + _vector2$1.applyMatrix3(m); - this.setXY(i, _vector2.x, _vector2.y); + 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); + for (var _i = 0, _l = this.count; _i < _l; _i++) { + _vector$3.fromBufferAttribute(this, _i); - _vector$9.applyMatrix3(m); + _vector$3.applyMatrix3(m); - this.setXYZ(i, _vector$9.x, _vector$9.y, _vector$9.z); + this.setXYZ(_i, _vector$3.x, _vector$3.y, _vector$3.z); } } return this; }, - applyMatrix4: function (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); + applyMatrix4: function applyMatrix4(m) { + for (var i = 0, l = this.count; i < l; i++) { + _vector$3.x = this.getX(i); + _vector$3.y = this.getY(i); + _vector$3.z = this.getZ(i); - _vector$9.applyMatrix4(m); + _vector$3.applyMatrix4(m); - this.setXYZ(i, _vector$9.x, _vector$9.y, _vector$9.z); + this.setXYZ(i, _vector$3.x, _vector$3.y, _vector$3.z); } return this; }, - applyNormalMatrix: function (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); + applyNormalMatrix: function applyNormalMatrix(m) { + for (var i = 0, l = this.count; i < l; i++) { + _vector$3.x = this.getX(i); + _vector$3.y = this.getY(i); + _vector$3.z = this.getZ(i); - _vector$9.applyNormalMatrix(m); + _vector$3.applyNormalMatrix(m); - this.setXYZ(i, _vector$9.x, _vector$9.y, _vector$9.z); + this.setXYZ(i, _vector$3.x, _vector$3.y, _vector$3.z); } return this; }, - transformDirection: function (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); + transformDirection: function transformDirection(m) { + for (var i = 0, l = this.count; i < l; i++) { + _vector$3.x = this.getX(i); + _vector$3.y = this.getY(i); + _vector$3.z = this.getZ(i); - _vector$9.transformDirection(m); + _vector$3.transformDirection(m); - this.setXYZ(i, _vector$9.x, _vector$9.y, _vector$9.z); + this.setXYZ(i, _vector$3.x, _vector$3.y, _vector$3.z); } return this; }, - set: function (value, offset = 0) { + set: function set(value, offset) { + if (offset === void 0) { + offset = 0; + } + this.array.set(value, offset); return this; }, - getX: function (index) { + getX: function getX(index) { return this.array[index * this.itemSize]; }, - setX: function (index, x) { + setX: function setX(index, x) { this.array[index * this.itemSize] = x; return this; }, - getY: function (index) { + getY: function getY(index) { return this.array[index * this.itemSize + 1]; }, - setY: function (index, y) { + setY: function setY(index, y) { this.array[index * this.itemSize + 1] = y; return this; }, - getZ: function (index) { + getZ: function getZ(index) { return this.array[index * this.itemSize + 2]; }, - setZ: function (index, z) { + setZ: function setZ(index, z) { this.array[index * this.itemSize + 2] = z; return this; }, - getW: function (index) { + getW: function getW(index) { return this.array[index * this.itemSize + 3]; }, - setW: function (index, w) { + setW: function setW(index, w) { this.array[index * this.itemSize + 3] = w; return this; }, - setXY: function (index, x, y) { + setXY: function setXY(index, x, y) { index *= this.itemSize; this.array[index + 0] = x; this.array[index + 1] = y; return this; }, - setXYZ: function (index, x, y, z) { + setXYZ: function setXYZ(index, x, y, z) { index *= this.itemSize; this.array[index + 0] = x; this.array[index + 1] = y; this.array[index + 2] = z; return this; }, - setXYZW: function (index, x, y, z, w) { + setXYZW: function setXYZW(index, x, y, z, w) { index *= this.itemSize; this.array[index + 0] = x; this.array[index + 1] = y; @@ -7114,15 +7637,15 @@ this.array[index + 3] = w; return this; }, - onUpload: function (callback) { + onUpload: function onUpload(callback) { this.onUploadCallback = callback; return this; }, - clone: function () { + clone: function clone() { return new this.constructor(this.array, this.itemSize).copy(this); }, - toJSON: function () { - const data = { + toJSON: function toJSON() { + var data = { itemSize: this.itemSize, type: this.array.constructor.name, array: Array.prototype.slice.call(this.array), @@ -7208,16 +7731,16 @@ function arrayMax(array) { if (array.length === 0) return -Infinity; - let max = array[0]; + var max = array[0]; - for (let i = 1, l = array.length; i < l; ++i) { + for (var i = 1, l = array.length; i < l; ++i) { if (array[i] > max) max = array[i]; } return max; } - const TYPED_ARRAYS = { + var TYPED_ARRAYS = { Int8Array: Int8Array, Uint8Array: Uint8Array, Uint8ClampedArray: Uint8ClampedArray, @@ -7233,19 +7756,19 @@ return new TYPED_ARRAYS[type](buffer); } - let _id = 0; + var _id = 0; - const _m1 = new Matrix4(); + var _m1$2 = new Matrix4(); - const _obj = new Object3D(); + var _obj = new Object3D(); - const _offset = new Vector3(); + var _offset = new Vector3(); - const _box$1 = new Box3(); + var _box$2 = new Box3(); - const _boxMorphTargets = new Box3(); + var _boxMorphTargets = new Box3(); - const _vector$8 = new Vector3(); + var _vector$4 = new Vector3(); function BufferGeometry() { Object.defineProperty(this, 'id', { @@ -7271,10 +7794,10 @@ BufferGeometry.prototype = Object.assign(Object.create(EventDispatcher.prototype), { constructor: BufferGeometry, isBufferGeometry: true, - getIndex: function () { + getIndex: function getIndex() { return this.index; }, - setIndex: function (index) { + setIndex: function setIndex(index) { if (Array.isArray(index)) { this.index = new (arrayMax(index) > 65535 ? Uint32BufferAttribute : Uint16BufferAttribute)(index, 1); } else { @@ -7283,51 +7806,55 @@ return this; }, - getAttribute: function (name) { + getAttribute: function getAttribute(name) { return this.attributes[name]; }, - setAttribute: function (name, attribute) { + setAttribute: function setAttribute(name, attribute) { this.attributes[name] = attribute; return this; }, - deleteAttribute: function (name) { + deleteAttribute: function deleteAttribute(name) { delete this.attributes[name]; return this; }, - hasAttribute: function (name) { + hasAttribute: function hasAttribute(name) { return this.attributes[name] !== undefined; }, - addGroup: function (start, count, materialIndex = 0) { + addGroup: function addGroup(start, count, materialIndex) { + if (materialIndex === void 0) { + materialIndex = 0; + } + this.groups.push({ start: start, count: count, materialIndex: materialIndex }); }, - clearGroups: function () { + clearGroups: function clearGroups() { this.groups = []; }, - setDrawRange: function (start, count) { + setDrawRange: function setDrawRange(start, count) { this.drawRange.start = start; this.drawRange.count = count; }, - applyMatrix4: function (matrix) { - const position = this.attributes.position; + applyMatrix4: function applyMatrix4(matrix) { + var position = this.attributes.position; if (position !== undefined) { position.applyMatrix4(matrix); position.needsUpdate = true; } - const normal = this.attributes.normal; + var normal = this.attributes.normal; if (normal !== undefined) { - const normalMatrix = new Matrix3().getNormalMatrix(matrix); + var normalMatrix = new Matrix3().getNormalMatrix(matrix); normal.applyNormalMatrix(normalMatrix); normal.needsUpdate = true; } - const tangent = this.attributes.tangent; + var tangent = this.attributes.tangent; if (tangent !== undefined) { tangent.transformDirection(matrix); @@ -7344,42 +7871,42 @@ return this; }, - rotateX: function (angle) { + rotateX: function rotateX(angle) { // rotate geometry around world x-axis - _m1.makeRotationX(angle); + _m1$2.makeRotationX(angle); - this.applyMatrix4(_m1); + this.applyMatrix4(_m1$2); return this; }, - rotateY: function (angle) { + rotateY: function rotateY(angle) { // rotate geometry around world y-axis - _m1.makeRotationY(angle); + _m1$2.makeRotationY(angle); - this.applyMatrix4(_m1); + this.applyMatrix4(_m1$2); return this; }, - rotateZ: function (angle) { + rotateZ: function rotateZ(angle) { // rotate geometry around world z-axis - _m1.makeRotationZ(angle); + _m1$2.makeRotationZ(angle); - this.applyMatrix4(_m1); + this.applyMatrix4(_m1$2); return this; }, - translate: function (x, y, z) { + translate: function translate(x, y, z) { // translate geometry - _m1.makeTranslation(x, y, z); + _m1$2.makeTranslation(x, y, z); - this.applyMatrix4(_m1); + this.applyMatrix4(_m1$2); return this; }, - scale: function (x, y, z) { + scale: function scale(x, y, z) { // scale geometry - _m1.makeScale(x, y, z); + _m1$2.makeScale(x, y, z); - this.applyMatrix4(_m1); + this.applyMatrix4(_m1$2); return this; }, - lookAt: function (vector) { + lookAt: function lookAt(vector) { _obj.lookAt(vector); _obj.updateMatrix(); @@ -7387,30 +7914,30 @@ this.applyMatrix4(_obj.matrix); return this; }, - center: function () { + center: function center() { this.computeBoundingBox(); this.boundingBox.getCenter(_offset).negate(); this.translate(_offset.x, _offset.y, _offset.z); return this; }, - setFromPoints: function (points) { - const position = []; + setFromPoints: function setFromPoints(points) { + var position = []; - for (let i = 0, l = points.length; i < l; i++) { - const point = points[i]; + for (var i = 0, l = points.length; i < l; i++) { + var point = points[i]; position.push(point.x, point.y, point.z || 0); } this.setAttribute('position', new Float32BufferAttribute(position, 3)); return this; }, - computeBoundingBox: function () { + computeBoundingBox: function computeBoundingBox() { if (this.boundingBox === null) { this.boundingBox = new Box3(); } - const position = this.attributes.position; - const morphAttributesPosition = this.morphAttributes.position; + var position = this.attributes.position; + var 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); @@ -7422,22 +7949,22 @@ 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]; + for (var i = 0, il = morphAttributesPosition.length; i < il; i++) { + var morphAttribute = morphAttributesPosition[i]; - _box$1.setFromBufferAttribute(morphAttribute); + _box$2.setFromBufferAttribute(morphAttribute); if (this.morphTargetsRelative) { - _vector$8.addVectors(this.boundingBox.min, _box$1.min); + _vector$4.addVectors(this.boundingBox.min, _box$2.min); - this.boundingBox.expandByPoint(_vector$8); + this.boundingBox.expandByPoint(_vector$4); - _vector$8.addVectors(this.boundingBox.max, _box$1.max); + _vector$4.addVectors(this.boundingBox.max, _box$2.max); - this.boundingBox.expandByPoint(_vector$8); + this.boundingBox.expandByPoint(_vector$4); } else { - this.boundingBox.expandByPoint(_box$1.min); - this.boundingBox.expandByPoint(_box$1.max); + this.boundingBox.expandByPoint(_box$2.min); + this.boundingBox.expandByPoint(_box$2.max); } } } @@ -7449,13 +7976,13 @@ console.error('THREE.BufferGeometry.computeBoundingBox(): Computed min/max have NaN values. The "position" attribute is likely to have NaN values.', this); } }, - computeBoundingSphere: function () { + computeBoundingSphere: function computeBoundingSphere() { if (this.boundingSphere === null) { this.boundingSphere = new Sphere(); } - const position = this.attributes.position; - const morphAttributesPosition = this.morphAttributes.position; + var position = this.attributes.position; + var 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); @@ -7465,61 +7992,61 @@ if (position) { // first, find the center of the bounding sphere - const center = this.boundingSphere.center; + var center = this.boundingSphere.center; - _box$1.setFromBufferAttribute(position); // process morph attributes if present + _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]; + for (var i = 0, il = morphAttributesPosition.length; i < il; i++) { + var morphAttribute = morphAttributesPosition[i]; _boxMorphTargets.setFromBufferAttribute(morphAttribute); if (this.morphTargetsRelative) { - _vector$8.addVectors(_box$1.min, _boxMorphTargets.min); + _vector$4.addVectors(_box$2.min, _boxMorphTargets.min); - _box$1.expandByPoint(_vector$8); + _box$2.expandByPoint(_vector$4); - _vector$8.addVectors(_box$1.max, _boxMorphTargets.max); + _vector$4.addVectors(_box$2.max, _boxMorphTargets.max); - _box$1.expandByPoint(_vector$8); + _box$2.expandByPoint(_vector$4); } else { - _box$1.expandByPoint(_boxMorphTargets.min); + _box$2.expandByPoint(_boxMorphTargets.min); - _box$1.expandByPoint(_boxMorphTargets.max); + _box$2.expandByPoint(_boxMorphTargets.max); } } } - _box$1.getCenter(center); // second, try to find a boundingSphere with a radius smaller than the + _box$2.getCenter(center); // 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; + var maxRadiusSq = 0; - for (let i = 0, il = position.count; i < il; i++) { - _vector$8.fromBufferAttribute(position, i); + for (var _i = 0, _il = position.count; _i < _il; _i++) { + _vector$4.fromBufferAttribute(position, _i); - maxRadiusSq = Math.max(maxRadiusSq, center.distanceToSquared(_vector$8)); + maxRadiusSq = Math.max(maxRadiusSq, center.distanceToSquared(_vector$4)); } // 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 (var _i2 = 0, _il2 = morphAttributesPosition.length; _i2 < _il2; _i2++) { + var _morphAttribute = morphAttributesPosition[_i2]; + var morphTargetsRelative = this.morphTargetsRelative; - for (let j = 0, jl = morphAttribute.count; j < jl; j++) { - _vector$8.fromBufferAttribute(morphAttribute, j); + for (var j = 0, jl = _morphAttribute.count; j < jl; j++) { + _vector$4.fromBufferAttribute(_morphAttribute, j); if (morphTargetsRelative) { _offset.fromBufferAttribute(position, j); - _vector$8.add(_offset); + _vector$4.add(_offset); } - maxRadiusSq = Math.max(maxRadiusSq, center.distanceToSquared(_vector$8)); + maxRadiusSq = Math.max(maxRadiusSq, center.distanceToSquared(_vector$4)); } } } @@ -7531,11 +8058,11 @@ } } }, - computeFaceNormals: function () {// backwards compatibility + computeFaceNormals: function computeFaceNormals() {// backwards compatibility }, - computeTangents: function () { - const index = this.index; - const attributes = this.attributes; // based on http://www.terathon.com/code/tangent.html + computeTangents: function computeTangents() { + var index = this.index; + var 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) { @@ -7543,33 +8070,33 @@ 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; + var indices = index.array; + var positions = attributes.position.array; + var normals = attributes.normal.array; + var uvs = attributes.uv.array; + var 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 = []; + var tangents = attributes.tangent.array; + var tan1 = [], + tan2 = []; - for (let i = 0; i < nVertices; i++) { + for (var 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(); + var vA = 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); @@ -7582,7 +8109,7 @@ 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 + var 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); @@ -7595,7 +8122,7 @@ tan2[c].add(tdir); } - let groups = this.groups; + var groups = this.groups; if (groups.length === 0) { groups = [{ @@ -7604,81 +8131,81 @@ }]; } - for (let i = 0, il = groups.length; i < il; ++i) { - const group = groups[i]; - const start = group.start; - const count = group.count; + for (var _i3 = 0, il = groups.length; _i3 < il; ++_i3) { + var group = groups[_i3]; + var start = group.start; + var count = group.count; - for (let j = start, jl = start + count; j < jl; j += 3) { + for (var 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(); - const n = new Vector3(), - n2 = new Vector3(); + var tmp = new Vector3(), + tmp2 = new Vector3(); + var n = new Vector3(), + n2 = new Vector3(); function handleVertex(v) { n.fromArray(normals, v * 3); n2.copy(n); - const t = tan1[v]; // Gram-Schmidt orthogonalize + var t = tan1[v]; // Gram-Schmidt orthogonalize tmp.copy(t); tmp.sub(n.multiplyScalar(n.dot(t))).normalize(); // Calculate handedness tmp2.crossVectors(n2, t); - const test = tmp2.dot(tan2[v]); - const w = test < 0.0 ? -1.0 : 1.0; + var test = tmp2.dot(tan2[v]); + var w = test < 0.0 ? -1.0 : 1.0; tangents[v * 4] = tmp.x; tangents[v * 4 + 1] = tmp.y; 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 (var _i4 = 0, _il3 = groups.length; _i4 < _il3; ++_i4) { + var _group = groups[_i4]; + var _start = _group.start; + var _count = _group.count; - for (let j = start, jl = start + count; j < jl; j += 3) { - handleVertex(indices[j + 0]); - handleVertex(indices[j + 1]); - handleVertex(indices[j + 2]); + for (var _j = _start, _jl = _start + _count; _j < _jl; _j += 3) { + handleVertex(indices[_j + 0]); + handleVertex(indices[_j + 1]); + handleVertex(indices[_j + 2]); } } }, - computeVertexNormals: function () { - const index = this.index; - const positionAttribute = this.getAttribute('position'); + computeVertexNormals: function computeVertexNormals() { + var index = this.index; + var positionAttribute = this.getAttribute('position'); if (positionAttribute !== undefined) { - let normalAttribute = this.getAttribute('normal'); + var 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++) { + for (var i = 0, il = normalAttribute.count; i < il; i++) { normalAttribute.setXYZ(i, 0, 0, 0); } } - const pA = new Vector3(), - pB = new Vector3(), - pC = new Vector3(); - const nA = new Vector3(), - nB = new Vector3(), - nC = new Vector3(); - const cb = new Vector3(), - ab = new Vector3(); // indexed elements + var pA = new Vector3(), + pB = new Vector3(), + pC = new Vector3(); + var nA = new Vector3(), + nB = new Vector3(), + nC = new Vector3(); + var cb = new Vector3(), + ab = new Vector3(); // indexed elements if (index) { - for (let i = 0, il = index.count; i < il; i += 3) { - const vA = index.getX(i + 0); - const vB = index.getX(i + 1); - const vC = index.getX(i + 2); + for (var _i5 = 0, _il4 = index.count; _i5 < _il4; _i5 += 3) { + var vA = index.getX(_i5 + 0); + var vB = index.getX(_i5 + 1); + var vC = index.getX(_i5 + 2); pA.fromBufferAttribute(positionAttribute, vA); pB.fromBufferAttribute(positionAttribute, vB); pC.fromBufferAttribute(positionAttribute, vC); @@ -7697,16 +8224,16 @@ } } 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); - pC.fromBufferAttribute(positionAttribute, i + 2); + for (var _i6 = 0, _il5 = positionAttribute.count; _i6 < _il5; _i6 += 3) { + pA.fromBufferAttribute(positionAttribute, _i6 + 0); + pB.fromBufferAttribute(positionAttribute, _i6 + 1); + pC.fromBufferAttribute(positionAttribute, _i6 + 2); cb.subVectors(pC, pB); ab.subVectors(pA, pB); cb.cross(ab); - normalAttribute.setXYZ(i + 0, cb.x, cb.y, cb.z); - normalAttribute.setXYZ(i + 1, cb.x, cb.y, cb.z); - normalAttribute.setXYZ(i + 2, cb.x, cb.y, cb.z); + normalAttribute.setXYZ(_i6 + 0, cb.x, cb.y, cb.z); + normalAttribute.setXYZ(_i6 + 1, cb.x, cb.y, cb.z); + normalAttribute.setXYZ(_i6 + 2, cb.x, cb.y, cb.z); } } @@ -7714,7 +8241,7 @@ normalAttribute.needsUpdate = true; } }, - merge: function (geometry, offset) { + merge: function merge(geometry, offset) { if (!(geometry && geometry.isBufferGeometry)) { console.error('THREE.BufferGeometry.merge(): geometry not an instance of THREE.BufferGeometry.', geometry); return; @@ -7725,48 +8252,48 @@ console.warn('THREE.BufferGeometry.merge(): Overwriting original geometry, starting at offset=0. ' + 'Use BufferGeometryUtils.mergeBufferGeometries() for lossless merge.'); } - const attributes = this.attributes; + var attributes = this.attributes; - for (const key in attributes) { + for (var key in attributes) { if (geometry.attributes[key] === undefined) continue; - const attribute1 = attributes[key]; - const attributeArray1 = attribute1.array; - const attribute2 = geometry.attributes[key]; - 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++) { + var attribute1 = attributes[key]; + var attributeArray1 = attribute1.array; + var attribute2 = geometry.attributes[key]; + var attributeArray2 = attribute2.array; + var attributeOffset = attribute2.itemSize * offset; + var length = Math.min(attributeArray2.length, attributeArray1.length - attributeOffset); + + for (var i = 0, j = attributeOffset; i < length; i++, j++) { attributeArray1[j] = attributeArray2[i]; } } return this; }, - normalizeNormals: function () { - const normals = this.attributes.normal; + normalizeNormals: function normalizeNormals() { + var normals = this.attributes.normal; - for (let i = 0, il = normals.count; i < il; i++) { - _vector$8.fromBufferAttribute(normals, i); + for (var i = 0, il = normals.count; i < il; i++) { + _vector$4.fromBufferAttribute(normals, i); - _vector$8.normalize(); + _vector$4.normalize(); - normals.setXYZ(i, _vector$8.x, _vector$8.y, _vector$8.z); + normals.setXYZ(i, _vector$4.x, _vector$4.y, _vector$4.z); } }, - toNonIndexed: function () { + toNonIndexed: function toNonIndexed() { function convertBufferAttribute(attribute, indices) { - const array = attribute.array; - const itemSize = attribute.itemSize; - const normalized = attribute.normalized; - const array2 = new array.constructor(indices.length * itemSize); - let index = 0, + var array = attribute.array; + var itemSize = attribute.itemSize; + var normalized = attribute.normalized; + var array2 = new array.constructor(indices.length * itemSize); + var index = 0, index2 = 0; - for (let i = 0, l = indices.length; i < l; i++) { + for (var i = 0, l = indices.length; i < l; i++) { index = indices[i] * itemSize; - for (let j = 0; j < itemSize; j++) { + for (var j = 0; j < itemSize; j++) { array2[index2++] = array[index++]; } } @@ -7780,45 +8307,47 @@ return this; } - const geometry2 = new BufferGeometry(); - const indices = this.index.array; - const attributes = this.attributes; // attributes + var geometry2 = new BufferGeometry(); + var indices = this.index.array; + var attributes = this.attributes; // attributes - for (const name in attributes) { - const attribute = attributes[name]; - const newAttribute = convertBufferAttribute(attribute, indices); + for (var name in attributes) { + var attribute = attributes[name]; + var newAttribute = convertBufferAttribute(attribute, indices); geometry2.setAttribute(name, newAttribute); } // morph attributes - const morphAttributes = this.morphAttributes; + var morphAttributes = this.morphAttributes; + + for (var _name in morphAttributes) { + var morphArray = []; + var morphAttribute = morphAttributes[_name]; // morphAttribute: array of Float32BufferAttributes - for (const name in morphAttributes) { - const morphArray = []; - const morphAttribute = morphAttributes[name]; // morphAttribute: array of Float32BufferAttributes + for (var i = 0, il = morphAttribute.length; i < il; i++) { + var _attribute = morphAttribute[i]; - for (let i = 0, il = morphAttribute.length; i < il; i++) { - const attribute = morphAttribute[i]; - const newAttribute = convertBufferAttribute(attribute, indices); - morphArray.push(newAttribute); + var _newAttribute = convertBufferAttribute(_attribute, indices); + + morphArray.push(_newAttribute); } - geometry2.morphAttributes[name] = morphArray; + geometry2.morphAttributes[_name] = morphArray; } geometry2.morphTargetsRelative = this.morphTargetsRelative; // groups - const groups = this.groups; + var groups = this.groups; - for (let i = 0, l = groups.length; i < l; i++) { - const group = groups[i]; + for (var _i7 = 0, l = groups.length; _i7 < l; _i7++) { + var group = groups[_i7]; geometry2.addGroup(group.start, group.count, group.materialIndex); } return geometry2; }, - toJSON: function () { - const data = { + toJSON: function toJSON() { + var data = { metadata: { version: 4.5, type: 'BufferGeometry', @@ -7832,9 +8361,9 @@ if (Object.keys(this.userData).length > 0) data.userData = this.userData; if (this.parameters !== undefined) { - const parameters = this.parameters; + var parameters = this.parameters; - for (const key in parameters) { + for (var key in parameters) { if (parameters[key] !== undefined) data[key] = parameters[key]; } @@ -7845,7 +8374,7 @@ data.data = { attributes: {} }; - const index = this.index; + var index = this.index; if (index !== null) { data.data.index = { @@ -7854,27 +8383,27 @@ }; } - const attributes = this.attributes; + var attributes = this.attributes; - for (const key in attributes) { - const attribute = attributes[key]; - data.data.attributes[key] = attribute.toJSON(data.data); + for (var _key in attributes) { + var attribute = attributes[_key]; + data.data.attributes[_key] = attribute.toJSON(data.data); } - const morphAttributes = {}; - let hasMorphAttributes = false; + var morphAttributes = {}; + var hasMorphAttributes = false; - for (const key in this.morphAttributes) { - const attributeArray = this.morphAttributes[key]; - const array = []; + for (var _key2 in this.morphAttributes) { + var attributeArray = this.morphAttributes[_key2]; + var array = []; - for (let i = 0, il = attributeArray.length; i < il; i++) { - const attribute = attributeArray[i]; - array.push(attribute.toJSON(data.data)); + for (var i = 0, il = attributeArray.length; i < il; i++) { + var _attribute2 = attributeArray[i]; + array.push(_attribute2.toJSON(data.data)); } if (array.length > 0) { - morphAttributes[key] = array; + morphAttributes[_key2] = array; hasMorphAttributes = true; } } @@ -7884,13 +8413,13 @@ data.data.morphTargetsRelative = this.morphTargetsRelative; } - const groups = this.groups; + var groups = this.groups; if (groups.length > 0) { data.data.groups = JSON.parse(JSON.stringify(groups)); } - const boundingSphere = this.boundingSphere; + var boundingSphere = this.boundingSphere; if (boundingSphere !== null) { data.data.boundingSphere = { @@ -7901,7 +8430,7 @@ return data; }, - clone: function () { + clone: function clone() { /* // Handle primitives const parameters = this.parameters; @@ -7918,7 +8447,7 @@ */ return new BufferGeometry().copy(this); }, - copy: function (source) { + copy: function copy(source) { // reset this.index = null; this.attributes = {}; @@ -7927,56 +8456,56 @@ this.boundingBox = null; this.boundingSphere = null; // used for storing cloned, shared data - const data = {}; // name + var data = {}; // name this.name = source.name; // index - const index = source.index; + var index = source.index; if (index !== null) { this.setIndex(index.clone(data)); } // attributes - const attributes = source.attributes; + var attributes = source.attributes; - for (const name in attributes) { - const attribute = attributes[name]; + for (var name in attributes) { + var attribute = attributes[name]; this.setAttribute(name, attribute.clone(data)); } // morph attributes - const morphAttributes = source.morphAttributes; + var morphAttributes = source.morphAttributes; - for (const name in morphAttributes) { - const array = []; - const morphAttribute = morphAttributes[name]; // morphAttribute: array of Float32BufferAttributes + for (var _name2 in morphAttributes) { + var array = []; + var morphAttribute = morphAttributes[_name2]; // morphAttribute: array of Float32BufferAttributes - for (let i = 0, l = morphAttribute.length; i < l; i++) { + for (var i = 0, l = morphAttribute.length; i < l; i++) { array.push(morphAttribute[i].clone(data)); } - this.morphAttributes[name] = array; + this.morphAttributes[_name2] = array; } this.morphTargetsRelative = source.morphTargetsRelative; // groups - const groups = source.groups; + var groups = source.groups; - for (let i = 0, l = groups.length; i < l; i++) { - const group = groups[i]; + for (var _i8 = 0, _l = groups.length; _i8 < _l; _i8++) { + var group = groups[_i8]; this.addGroup(group.start, group.count, group.materialIndex); } // bounding box - const boundingBox = source.boundingBox; + var boundingBox = source.boundingBox; if (boundingBox !== null) { this.boundingBox = boundingBox.clone(); } // bounding sphere - const boundingSphere = source.boundingSphere; + var boundingSphere = source.boundingSphere; if (boundingSphere !== null) { this.boundingSphere = boundingSphere.clone(); @@ -7989,48 +8518,56 @@ this.userData = source.userData; return this; }, - dispose: function () { + dispose: function dispose() { this.dispatchEvent({ type: 'dispose' }); } }); - const _inverseMatrix$2 = new Matrix4(); + var _inverseMatrix = new Matrix4(); + + var _ray = new Ray(); - const _ray$2 = new Ray(); + var _sphere = new Sphere(); - const _sphere$3 = new Sphere(); + var _vA = new Vector3(); - const _vA$1 = new Vector3(); + var _vB = new Vector3(); - const _vB$1 = new Vector3(); + var _vC = new Vector3(); - const _vC$1 = new Vector3(); + var _tempA = new Vector3(); - const _tempA = new Vector3(); + var _tempB = new Vector3(); - const _tempB = new Vector3(); + var _tempC = new Vector3(); - const _tempC = new Vector3(); + var _morphA = new Vector3(); - const _morphA = new Vector3(); + var _morphB = new Vector3(); - const _morphB = new Vector3(); + var _morphC = new Vector3(); - const _morphC = new Vector3(); + var _uvA = new Vector2(); - const _uvA$1 = new Vector2(); + var _uvB = new Vector2(); - const _uvB$1 = new Vector2(); + var _uvC = new Vector2(); - const _uvC$1 = new Vector2(); + var _intersectionPoint = new Vector3(); - const _intersectionPoint = new Vector3(); + var _intersectionPointWorld = new Vector3(); + + function Mesh(geometry, material) { + if (geometry === void 0) { + geometry = new BufferGeometry(); + } - const _intersectionPointWorld = new Vector3(); + if (material === void 0) { + material = new MeshBasicMaterial(); + } - function Mesh(geometry = new BufferGeometry(), material = new MeshBasicMaterial()) { Object3D.call(this); this.type = 'Mesh'; this.geometry = geometry; @@ -8041,7 +8578,7 @@ Mesh.prototype = Object.assign(Object.create(Object3D.prototype), { constructor: Mesh, isMesh: true, - copy: function (source) { + copy: function copy(source) { Object3D.prototype.copy.call(this, source); if (source.morphTargetInfluences !== undefined) { @@ -8056,84 +8593,84 @@ this.geometry = source.geometry; return this; }, - updateMorphTargets: function () { - const geometry = this.geometry; + updateMorphTargets: function updateMorphTargets() { + var geometry = this.geometry; if (geometry.isBufferGeometry) { - const morphAttributes = geometry.morphAttributes; - const keys = Object.keys(morphAttributes); + var morphAttributes = geometry.morphAttributes; + var keys = Object.keys(morphAttributes); if (keys.length > 0) { - const morphAttribute = morphAttributes[keys[0]]; + var 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); + for (var m = 0, ml = morphAttribute.length; m < ml; m++) { + var name = morphAttribute[m].name || String(m); this.morphTargetInfluences.push(0); this.morphTargetDictionary[name] = m; } } } } else { - const morphTargets = geometry.morphTargets; + var morphTargets = geometry.morphTargets; if (morphTargets !== undefined && morphTargets.length > 0) { console.error('THREE.Mesh.updateMorphTargets() no longer supports THREE.Geometry. Use THREE.BufferGeometry instead.'); } } }, - raycast: function (raycaster, intersects) { - const geometry = this.geometry; - const material = this.material; - const matrixWorld = this.matrixWorld; + raycast: function raycast(raycaster, intersects) { + var geometry = this.geometry; + var material = this.material; + var matrixWorld = this.matrixWorld; if (material === undefined) return; // Checking boundingSphere distance to ray if (geometry.boundingSphere === null) geometry.computeBoundingSphere(); - _sphere$3.copy(geometry.boundingSphere); + _sphere.copy(geometry.boundingSphere); - _sphere$3.applyMatrix4(matrixWorld); + _sphere.applyMatrix4(matrixWorld); - if (raycaster.ray.intersectsSphere(_sphere$3) === false) return; // + if (raycaster.ray.intersectsSphere(_sphere) === false) return; // - _inverseMatrix$2.copy(matrixWorld).invert(); + _inverseMatrix.copy(matrixWorld).invert(); - _ray$2.copy(raycaster.ray).applyMatrix4(_inverseMatrix$2); // Check boundingBox before continuing + _ray.copy(raycaster.ray).applyMatrix4(_inverseMatrix); // Check boundingBox before continuing if (geometry.boundingBox !== null) { - if (_ray$2.intersectsBox(geometry.boundingBox) === false) return; + if (_ray.intersectsBox(geometry.boundingBox) === false) return; } - let intersection; + var intersection; if (geometry.isBufferGeometry) { - const index = geometry.index; - const position = geometry.attributes.position; - const morphPosition = geometry.morphAttributes.position; - const morphTargetsRelative = geometry.morphTargetsRelative; - const uv = geometry.attributes.uv; - const uv2 = geometry.attributes.uv2; - const groups = geometry.groups; - const drawRange = geometry.drawRange; + var index = geometry.index; + var position = geometry.attributes.position; + var morphPosition = geometry.morphAttributes.position; + var morphTargetsRelative = geometry.morphTargetsRelative; + var uv = geometry.attributes.uv; + var uv2 = geometry.attributes.uv2; + var groups = geometry.groups; + var 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(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); + for (var i = 0, il = groups.length; i < il; i++) { + var group = groups[i]; + var groupMaterial = material[group.materialIndex]; + var start = Math.max(group.start, drawRange.start); + var end = Math.min(group.start + group.count, drawRange.start + drawRange.count); + + for (var j = start, jl = end; j < jl; j += 3) { + var a = index.getX(j); + var b = index.getX(j + 1); + var c = index.getX(j + 2); + intersection = checkBufferGeometryIntersection(this, groupMaterial, raycaster, _ray, position, morphPosition, morphTargetsRelative, uv, uv2, a, b, c); if (intersection) { intersection.faceIndex = Math.floor(j / 3); // triangle number in indexed buffer semantics @@ -8144,17 +8681,21 @@ } } } else { - const start = Math.max(0, drawRange.start); - const end = Math.min(index.count, drawRange.start + drawRange.count); + var _start = Math.max(0, drawRange.start); + + var _end = Math.min(index.count, drawRange.start + drawRange.count); + + for (var _i = _start, _il = _end; _i < _il; _i += 3) { + var _a = index.getX(_i); - 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); + var _b = index.getX(_i + 1); + + var _c = index.getX(_i + 2); + + intersection = checkBufferGeometryIntersection(this, material, raycaster, _ray, position, morphPosition, morphTargetsRelative, uv, uv2, _a, _b, _c); if (intersection) { - intersection.faceIndex = Math.floor(i / 3); // triangle number in indexed buffer semantics + intersection.faceIndex = Math.floor(_i / 3); // triangle number in indexed buffer semantics intersects.push(intersection); } @@ -8163,38 +8704,47 @@ } 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(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); + for (var _i2 = 0, _il2 = groups.length; _i2 < _il2; _i2++) { + var _group = groups[_i2]; + var _groupMaterial = material[_group.materialIndex]; + + var _start2 = Math.max(_group.start, drawRange.start); + + var _end2 = Math.min(_group.start + _group.count, drawRange.start + drawRange.count); + + for (var _j = _start2, _jl = _end2; _j < _jl; _j += 3) { + var _a2 = _j; + + var _b2 = _j + 1; + + var _c2 = _j + 2; + + intersection = checkBufferGeometryIntersection(this, _groupMaterial, raycaster, _ray, position, morphPosition, morphTargetsRelative, uv, uv2, _a2, _b2, _c2); if (intersection) { - intersection.faceIndex = Math.floor(j / 3); // triangle number in non-indexed buffer semantics + intersection.faceIndex = Math.floor(_j / 3); // triangle number in non-indexed buffer semantics - intersection.face.materialIndex = group.materialIndex; + intersection.face.materialIndex = _group.materialIndex; intersects.push(intersection); } } } } else { - const start = Math.max(0, drawRange.start); - const end = Math.min(position.count, drawRange.start + drawRange.count); + var _start3 = Math.max(0, drawRange.start); + + var _end3 = Math.min(position.count, drawRange.start + drawRange.count); + + for (var _i3 = _start3, _il3 = _end3; _i3 < _il3; _i3 += 3) { + var _a3 = _i3; + + var _b3 = _i3 + 1; - 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); + var _c3 = _i3 + 2; + + intersection = checkBufferGeometryIntersection(this, material, raycaster, _ray, position, morphPosition, morphTargetsRelative, uv, uv2, _a3, _b3, _c3); if (intersection) { - intersection.faceIndex = Math.floor(i / 3); // triangle number in non-indexed buffer semantics + intersection.faceIndex = Math.floor(_i3 / 3); // triangle number in non-indexed buffer semantics intersects.push(intersection); } @@ -8208,7 +8758,7 @@ }); function checkIntersection(object, material, raycaster, ray, pA, pB, pC, point) { - let intersect; + var intersect; if (material.side === BackSide) { intersect = ray.intersectTriangle(pC, pB, pA, true, point); @@ -8222,7 +8772,7 @@ _intersectionPointWorld.applyMatrix4(object.matrixWorld); - const distance = raycaster.ray.origin.distanceTo(_intersectionPointWorld); + var distance = raycaster.ray.origin.distanceTo(_intersectionPointWorld); if (distance < raycaster.near || distance > raycaster.far) return null; return { distance: distance, @@ -8232,13 +8782,13 @@ } function checkBufferGeometryIntersection(object, material, raycaster, ray, position, morphPosition, morphTargetsRelative, uv, uv2, a, b, c) { - _vA$1.fromBufferAttribute(position, a); + _vA.fromBufferAttribute(position, a); - _vB$1.fromBufferAttribute(position, b); + _vB.fromBufferAttribute(position, b); - _vC$1.fromBufferAttribute(position, c); + _vC.fromBufferAttribute(position, c); - const morphInfluences = object.morphTargetInfluences; + var morphInfluences = object.morphTargetInfluences; if (material.morphTargets && morphPosition && morphInfluences) { _morphA.set(0, 0, 0); @@ -8247,9 +8797,9 @@ _morphC.set(0, 0, 0); - for (let i = 0, il = morphPosition.length; i < il; i++) { - const influence = morphInfluences[i]; - const morphAttribute = morphPosition[i]; + for (var i = 0, il = morphPosition.length; i < il; i++) { + var influence = morphInfluences[i]; + var morphAttribute = morphPosition[i]; if (influence === 0) continue; _tempA.fromBufferAttribute(morphAttribute, a); @@ -8265,89 +8815,119 @@ _morphC.addScaledVector(_tempC, influence); } else { - _morphA.addScaledVector(_tempA.sub(_vA$1), influence); + _morphA.addScaledVector(_tempA.sub(_vA), influence); - _morphB.addScaledVector(_tempB.sub(_vB$1), influence); + _morphB.addScaledVector(_tempB.sub(_vB), influence); - _morphC.addScaledVector(_tempC.sub(_vC$1), influence); + _morphC.addScaledVector(_tempC.sub(_vC), influence); } } - _vA$1.add(_morphA); + _vA.add(_morphA); - _vB$1.add(_morphB); + _vB.add(_morphB); - _vC$1.add(_morphC); + _vC.add(_morphC); } if (object.isSkinnedMesh && material.skinning) { - object.boneTransform(a, _vA$1); - object.boneTransform(b, _vB$1); - object.boneTransform(c, _vC$1); + object.boneTransform(a, _vA); + object.boneTransform(b, _vB); + object.boneTransform(c, _vC); } - const intersection = checkIntersection(object, material, raycaster, ray, _vA$1, _vB$1, _vC$1, _intersectionPoint); + var intersection = checkIntersection(object, material, raycaster, ray, _vA, _vB, _vC, _intersectionPoint); if (intersection) { if (uv) { - _uvA$1.fromBufferAttribute(uv, a); + _uvA.fromBufferAttribute(uv, a); - _uvB$1.fromBufferAttribute(uv, b); + _uvB.fromBufferAttribute(uv, b); - _uvC$1.fromBufferAttribute(uv, c); + _uvC.fromBufferAttribute(uv, c); - intersection.uv = Triangle.getUV(_intersectionPoint, _vA$1, _vB$1, _vC$1, _uvA$1, _uvB$1, _uvC$1, new Vector2()); + intersection.uv = Triangle.getUV(_intersectionPoint, _vA, _vB, _vC, _uvA, _uvB, _uvC, new Vector2()); } if (uv2) { - _uvA$1.fromBufferAttribute(uv2, a); + _uvA.fromBufferAttribute(uv2, a); - _uvB$1.fromBufferAttribute(uv2, b); + _uvB.fromBufferAttribute(uv2, b); - _uvC$1.fromBufferAttribute(uv2, c); + _uvC.fromBufferAttribute(uv2, c); - intersection.uv2 = Triangle.getUV(_intersectionPoint, _vA$1, _vB$1, _vC$1, _uvA$1, _uvB$1, _uvC$1, new Vector2()); + intersection.uv2 = Triangle.getUV(_intersectionPoint, _vA, _vB, _vC, _uvA, _uvB, _uvC, new Vector2()); } - const face = { + var face = { a: a, b: b, c: c, normal: new Vector3(), materialIndex: 0 }; - Triangle.getNormal(_vA$1, _vB$1, _vC$1, face.normal); + Triangle.getNormal(_vA, _vB, _vC, face.normal); intersection.face = face; } return intersection; } - class BoxGeometry extends BufferGeometry { - constructor(width = 1, height = 1, depth = 1, widthSegments = 1, heightSegments = 1, depthSegments = 1) { - super(); - this.type = 'BoxGeometry'; - this.parameters = { - width: width, - height: height, - depth: depth, - widthSegments: widthSegments, - heightSegments: heightSegments, - depthSegments: depthSegments - }; - const scope = this; // segments + var BoxGeometry = /*#__PURE__*/function (_BufferGeometry) { + _inheritsLoose(BoxGeometry, _BufferGeometry); - widthSegments = Math.floor(widthSegments); - heightSegments = Math.floor(heightSegments); - depthSegments = Math.floor(depthSegments); // buffers + function BoxGeometry(width, height, depth, widthSegments, heightSegments, depthSegments) { + var _this; - const indices = []; - const vertices = []; - const normals = []; - const uvs = []; // helper variables + if (width === void 0) { + width = 1; + } - let numberOfVertices = 0; - let groupStart = 0; // build each side of the box geometry + if (height === void 0) { + height = 1; + } + + if (depth === void 0) { + depth = 1; + } + + if (widthSegments === void 0) { + widthSegments = 1; + } + + if (heightSegments === void 0) { + heightSegments = 1; + } + + if (depthSegments === void 0) { + depthSegments = 1; + } + + _this = _BufferGeometry.call(this) || this; + _this.type = 'BoxGeometry'; + _this.parameters = { + width: width, + height: height, + depth: depth, + widthSegments: widthSegments, + heightSegments: heightSegments, + depthSegments: depthSegments + }; + + var scope = _assertThisInitialized(_this); // segments + + + widthSegments = Math.floor(widthSegments); + heightSegments = Math.floor(heightSegments); + depthSegments = Math.floor(depthSegments); // buffers + + var indices = []; + var vertices = []; + var normals = []; + var uvs = []; // helper variables + + var numberOfVertices = 0; + var groupStart = 0; // build each side of the box geometry buildPlane('z', 'y', 'x', -1, -1, depth, height, width, depthSegments, heightSegments, 0); // px @@ -8362,28 +8942,31 @@ 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)); + _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; - const widthHalf = width / 2; - const heightHalf = height / 2; - const depthHalf = depth / 2; - const gridX1 = gridX + 1; - const gridY1 = gridY + 1; - let vertexCounter = 0; - let groupCount = 0; - 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 + var segmentWidth = width / gridX; + var segmentHeight = height / gridY; + var widthHalf = width / 2; + var heightHalf = height / 2; + var depthHalf = depth / 2; + var gridX1 = gridX + 1; + var gridY1 = gridY + 1; + var vertexCounter = 0; + var groupCount = 0; + var vector = new Vector3(); // generate vertices, normals and uvs + + for (var iy = 0; iy < gridY1; iy++) { + var y = iy * segmentHeight - heightHalf; + + for (var ix = 0; ix < gridX1; ix++) { + var x = ix * segmentWidth - widthHalf; // set values to correct vector component vector[u] = x * udir; vector[v] = y * vdir; @@ -8408,12 +8991,12 @@ // 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 + for (var _iy = 0; _iy < gridY; _iy++) { + for (var _ix = 0; _ix < gridX; _ix++) { + var a = numberOfVertices + _ix + gridX1 * _iy; + var b = numberOfVertices + _ix + gridX1 * (_iy + 1); + var c = numberOfVertices + (_ix + 1) + gridX1 * (_iy + 1); + var d = numberOfVertices + (_ix + 1) + gridX1 * _iy; // faces indices.push(a, b, d); indices.push(b, c, d); // increase counter @@ -8429,21 +9012,24 @@ numberOfVertices += vertexCounter; } + + return _this; } - } + return BoxGeometry; + }(BufferGeometry); /** * Uniform Utilities */ function cloneUniforms(src) { - const dst = {}; + var dst = {}; - for (const u in src) { + for (var u in src) { dst[u] = {}; - for (const p in src[u]) { - const property = src[u][p]; + for (var p in src[u]) { + var 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(); @@ -8458,12 +9044,12 @@ return dst; } function mergeUniforms(uniforms) { - const merged = {}; + var merged = {}; - for (let u = 0; u < uniforms.length; u++) { - const tmp = cloneUniforms(uniforms[u]); + for (var u = 0; u < uniforms.length; u++) { + var tmp = cloneUniforms(uniforms[u]); - for (const p in tmp) { + for (var p in tmp) { merged[p] = tmp[p]; } } @@ -8471,7 +9057,7 @@ return merged; } // Legacy - const UniformsUtils = { + var UniformsUtils = { clone: cloneUniforms, merge: mergeUniforms }; @@ -8574,13 +9160,13 @@ }; ShaderMaterial.prototype.toJSON = function (meta) { - const data = Material.prototype.toJSON.call(this, meta); + var data = Material.prototype.toJSON.call(this, meta); data.glslVersion = this.glslVersion; data.uniforms = {}; - for (const name in this.uniforms) { - const uniform = this.uniforms[name]; - const value = uniform.value; + for (var name in this.uniforms) { + var uniform = this.uniforms[name]; + var value = uniform.value; if (value && value.isTexture) { data.uniforms[name] = { @@ -8627,9 +9213,9 @@ if (Object.keys(this.defines).length > 0) data.defines = this.defines; data.vertexShader = this.vertexShader; data.fragmentShader = this.fragmentShader; - const extensions = {}; + var extensions = {}; - for (const key in this.extensions) { + for (var key in this.extensions) { if (this.extensions[key] === true) extensions[key] = true; } @@ -8648,37 +9234,53 @@ Camera.prototype = Object.assign(Object.create(Object3D.prototype), { constructor: Camera, isCamera: true, - copy: function (source, recursive) { + copy: function copy(source, recursive) { Object3D.prototype.copy.call(this, source, recursive); this.matrixWorldInverse.copy(source.matrixWorldInverse); this.projectionMatrix.copy(source.projectionMatrix); this.projectionMatrixInverse.copy(source.projectionMatrixInverse); return this; }, - getWorldDirection: function (target) { + getWorldDirection: function getWorldDirection(target) { if (target === undefined) { console.warn('THREE.Camera: .getWorldDirection() target is now required'); target = new Vector3(); } this.updateWorldMatrix(true, false); - const e = this.matrixWorld.elements; + var e = this.matrixWorld.elements; return target.set(-e[8], -e[9], -e[10]).normalize(); }, - updateMatrixWorld: function (force) { + updateMatrixWorld: function updateMatrixWorld(force) { Object3D.prototype.updateMatrixWorld.call(this, force); this.matrixWorldInverse.copy(this.matrixWorld).invert(); }, - updateWorldMatrix: function (updateParents, updateChildren) { + updateWorldMatrix: function updateWorldMatrix(updateParents, updateChildren) { Object3D.prototype.updateWorldMatrix.call(this, updateParents, updateChildren); this.matrixWorldInverse.copy(this.matrixWorld).invert(); }, - clone: function () { + clone: function clone() { return new this.constructor().copy(this); } }); - function PerspectiveCamera(fov = 50, aspect = 1, near = 0.1, far = 2000) { + function PerspectiveCamera(fov, aspect, near, far) { + if (fov === void 0) { + fov = 50; + } + + if (aspect === void 0) { + aspect = 1; + } + + if (near === void 0) { + near = 0.1; + } + + if (far === void 0) { + far = 2000; + } + Camera.call(this); this.type = 'PerspectiveCamera'; this.fov = fov; @@ -8698,7 +9300,7 @@ PerspectiveCamera.prototype = Object.assign(Object.create(Camera.prototype), { constructor: PerspectiveCamera, isPerspectiveCamera: true, - copy: function (source, recursive) { + copy: function copy(source, recursive) { Camera.prototype.copy.call(this, source, recursive); this.fov = source.fov; this.zoom = source.zoom; @@ -8720,9 +9322,9 @@ * * Values for focal length and film gauge must have the same unit. */ - setFocalLength: function (focalLength) { + setFocalLength: function setFocalLength(focalLength) { /** see {@link http://www.bobatkins.com/photography/technical/field_of_view.html} */ - const vExtentSlope = 0.5 * this.getFilmHeight() / focalLength; + var vExtentSlope = 0.5 * this.getFilmHeight() / focalLength; this.fov = MathUtils.RAD2DEG * 2 * Math.atan(vExtentSlope); this.updateProjectionMatrix(); }, @@ -8730,18 +9332,18 @@ /** * Calculates the focal length from the current .fov and .filmGauge. */ - getFocalLength: function () { - const vExtentSlope = Math.tan(MathUtils.DEG2RAD * 0.5 * this.fov); + getFocalLength: function getFocalLength() { + var vExtentSlope = Math.tan(MathUtils.DEG2RAD * 0.5 * this.fov); return 0.5 * this.getFilmHeight() / vExtentSlope; }, - getEffectiveFOV: function () { + getEffectiveFOV: function getEffectiveFOV() { return MathUtils.RAD2DEG * 2 * Math.atan(Math.tan(MathUtils.DEG2RAD * 0.5 * this.fov) / this.zoom); }, - getFilmWidth: function () { + getFilmWidth: function getFilmWidth() { // film not completely covered in portrait format (aspect < 1) return this.filmGauge * Math.min(this.aspect, 1); }, - getFilmHeight: function () { + getFilmHeight: function getFilmHeight() { // film not completely covered in landscape format (aspect > 1) return this.filmGauge / Math.max(this.aspect, 1); }, @@ -8781,7 +9383,7 @@ * * Note there is no reason monitors have to be the same size or in a grid. */ - setViewOffset: function (fullWidth, fullHeight, x, y, width, height) { + setViewOffset: function setViewOffset(fullWidth, fullHeight, x, y, width, height) { this.aspect = fullWidth / fullHeight; if (this.view === null) { @@ -8805,37 +9407,37 @@ this.view.height = height; this.updateProjectionMatrix(); }, - clearViewOffset: function () { + clearViewOffset: function clearViewOffset() { if (this.view !== null) { this.view.enabled = false; } this.updateProjectionMatrix(); }, - updateProjectionMatrix: function () { - const near = this.near; - let top = near * Math.tan(MathUtils.DEG2RAD * 0.5 * this.fov) / this.zoom; - let height = 2 * top; - let width = this.aspect * height; - let left = -0.5 * width; - const view = this.view; + updateProjectionMatrix: function updateProjectionMatrix() { + var near = this.near; + var top = near * Math.tan(MathUtils.DEG2RAD * 0.5 * this.fov) / this.zoom; + var height = 2 * top; + var width = this.aspect * height; + var left = -0.5 * width; + var view = this.view; if (this.view !== null && this.view.enabled) { - const fullWidth = view.fullWidth, - fullHeight = view.fullHeight; + var fullWidth = view.fullWidth, + 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; + var 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: function (meta) { - const data = Object3D.prototype.toJSON.call(this, meta); + toJSON: function toJSON(meta) { + var data = Object3D.prototype.toJSON.call(this, meta); data.object.fov = this.fov; data.object.zoom = this.zoom; data.object.near = this.near; @@ -8849,60 +9451,85 @@ } }); - const fov = 90, - aspect = 1; + var fov = 90, + aspect = 1; + + var CubeCamera = /*#__PURE__*/function (_Object3D) { + _inheritsLoose(CubeCamera, _Object3D); + + function CubeCamera(near, far, renderTarget) { + var _this; - class CubeCamera extends Object3D { - constructor(near, far, renderTarget) { - super(); - this.type = 'CubeCamera'; + _this = _Object3D.call(this) || this; + _this.type = 'CubeCamera'; if (renderTarget.isWebGLCubeRenderTarget !== true) { console.error('THREE.CubeCamera: The constructor now expects an instance of WebGLCubeRenderTarget as third parameter.'); - return; + return _assertThisInitialized(_this); } - this.renderTarget = renderTarget; - const cameraPX = new PerspectiveCamera(fov, aspect, near, far); - cameraPX.layers = this.layers; + _this.renderTarget = renderTarget; + var cameraPX = new PerspectiveCamera(fov, aspect, near, far); + cameraPX.layers = _this.layers; cameraPX.up.set(0, -1, 0); cameraPX.lookAt(new Vector3(1, 0, 0)); - this.add(cameraPX); - const cameraNX = new PerspectiveCamera(fov, aspect, near, far); - cameraNX.layers = this.layers; + + _this.add(cameraPX); + + var cameraNX = new PerspectiveCamera(fov, aspect, near, far); + cameraNX.layers = _this.layers; cameraNX.up.set(0, -1, 0); cameraNX.lookAt(new Vector3(-1, 0, 0)); - this.add(cameraNX); - const cameraPY = new PerspectiveCamera(fov, aspect, near, far); - cameraPY.layers = this.layers; + + _this.add(cameraNX); + + var cameraPY = new PerspectiveCamera(fov, aspect, near, far); + cameraPY.layers = _this.layers; cameraPY.up.set(0, 0, 1); cameraPY.lookAt(new Vector3(0, 1, 0)); - this.add(cameraPY); - const cameraNY = new PerspectiveCamera(fov, aspect, near, far); - cameraNY.layers = this.layers; + + _this.add(cameraPY); + + var cameraNY = new PerspectiveCamera(fov, aspect, near, far); + cameraNY.layers = _this.layers; cameraNY.up.set(0, 0, -1); cameraNY.lookAt(new Vector3(0, -1, 0)); - this.add(cameraNY); - const cameraPZ = new PerspectiveCamera(fov, aspect, near, far); - cameraPZ.layers = this.layers; + + _this.add(cameraNY); + + var cameraPZ = new PerspectiveCamera(fov, aspect, near, far); + cameraPZ.layers = _this.layers; cameraPZ.up.set(0, -1, 0); cameraPZ.lookAt(new Vector3(0, 0, 1)); - this.add(cameraPZ); - const cameraNZ = new PerspectiveCamera(fov, aspect, near, far); - cameraNZ.layers = this.layers; + + _this.add(cameraPZ); + + var cameraNZ = new PerspectiveCamera(fov, aspect, near, far); + cameraNZ.layers = _this.layers; cameraNZ.up.set(0, -1, 0); cameraNZ.lookAt(new Vector3(0, 0, -1)); - this.add(cameraNZ); + + _this.add(cameraNZ); + + return _this; } - update(renderer, scene) { + var _proto = CubeCamera.prototype; + + _proto.update = function update(renderer, scene) { if (this.parent === null) this.updateMatrixWorld(); - const renderTarget = this.renderTarget; - const [cameraPX, cameraNX, cameraPY, cameraNY, cameraPZ, cameraNZ] = this.children; - const currentXrEnabled = renderer.xr.enabled; - const currentRenderTarget = renderer.getRenderTarget(); + var renderTarget = this.renderTarget; + var _this$children = this.children, + cameraPX = _this$children[0], + cameraNX = _this$children[1], + cameraPY = _this$children[2], + cameraNY = _this$children[3], + cameraPZ = _this$children[4], + cameraNZ = _this$children[5]; + var currentXrEnabled = renderer.xr.enabled; + var currentRenderTarget = renderer.getRenderTarget(); renderer.xr.enabled = false; - const generateMipmaps = renderTarget.texture.generateMipmaps; + var generateMipmaps = renderTarget.texture.generateMipmaps; renderTarget.texture.generateMipmaps = false; renderer.setRenderTarget(renderTarget, 0); renderer.render(scene, cameraPX); @@ -8919,16 +9546,21 @@ renderer.render(scene, cameraNZ); renderer.setRenderTarget(currentRenderTarget); renderer.xr.enabled = currentXrEnabled; - } + }; - } + return CubeCamera; + }(Object3D); + + var CubeTexture = /*#__PURE__*/function (_Texture) { + _inheritsLoose(CubeTexture, _Texture); + + function CubeTexture(images, mapping, wrapS, wrapT, magFilter, minFilter, format, type, anisotropy, encoding) { + var _this; - class CubeTexture extends Texture { - constructor(images, mapping, wrapS, wrapT, magFilter, minFilter, format, type, anisotropy, encoding) { images = images !== undefined ? images : []; mapping = mapping !== undefined ? mapping : CubeReflectionMapping; format = format !== undefined ? format : RGBFormat; - super(images, mapping, wrapS, wrapT, magFilter, minFilter, format, type, anisotropy, encoding); // Why CubeTexture._needsFlipEnvMap is necessary: + _this = _Texture.call(this, images, mapping, wrapS, wrapT, magFilter, minFilter, format, type, anisotropy, encoding) || this; // Why CubeTexture._needsFlipEnvMap is necessary: // // 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, @@ -8937,38 +9569,49 @@ // and the flag _needsFlipEnvMap controls this conversion. The flip is not required (and thus _needsFlipEnvMap is set to false) // when using WebGLCubeRenderTarget.texture as a cube texture. - this._needsFlipEnvMap = true; - this.flipY = false; - } - - get images() { - return this.image; + _this._needsFlipEnvMap = true; + _this.flipY = false; + return _this; } - set images(value) { - this.image = value; - } + _createClass(CubeTexture, [{ + key: "images", + get: function get() { + return this.image; + }, + set: function set(value) { + this.image = value; + } + }]); - } + return CubeTexture; + }(Texture); CubeTexture.prototype.isCubeTexture = true; - class WebGLCubeRenderTarget extends WebGLRenderTarget { - constructor(size, options, dummy) { + var WebGLCubeRenderTarget = /*#__PURE__*/function (_WebGLRenderTarget) { + _inheritsLoose(WebGLCubeRenderTarget, _WebGLRenderTarget); + + function WebGLCubeRenderTarget(size, options, dummy) { + var _this; + if (Number.isInteger(options)) { console.warn('THREE.WebGLCubeRenderTarget: constructor signature is now WebGLCubeRenderTarget( size, options )'); options = dummy; } - super(size, size, options); + _this = _WebGLRenderTarget.call(this, size, size, options) || this; options = options || {}; - this.texture = new CubeTexture(undefined, options.mapping, options.wrapS, options.wrapT, options.magFilter, options.minFilter, options.format, options.type, options.anisotropy, options.encoding); - this.texture.generateMipmaps = options.generateMipmaps !== undefined ? options.generateMipmaps : false; - this.texture.minFilter = options.minFilter !== undefined ? options.minFilter : LinearFilter; - this.texture._needsFlipEnvMap = false; + _this.texture = new CubeTexture(undefined, options.mapping, options.wrapS, options.wrapT, options.magFilter, options.minFilter, options.format, options.type, options.anisotropy, options.encoding); + _this.texture.generateMipmaps = options.generateMipmaps !== undefined ? options.generateMipmaps : false; + _this.texture.minFilter = options.minFilter !== undefined ? options.minFilter : LinearFilter; + _this.texture._needsFlipEnvMap = false; + return _this; } - fromEquirectangularTexture(renderer, texture) { + var _proto = WebGLCubeRenderTarget.prototype; + + _proto.fromEquirectangularTexture = function fromEquirectangularTexture(renderer, texture) { this.texture.type = texture.type; this.texture.format = RGBAFormat; // see #18859 @@ -8976,7 +9619,7 @@ this.texture.generateMipmaps = texture.generateMipmaps; this.texture.minFilter = texture.minFilter; this.texture.magFilter = texture.magFilter; - const shader = { + var shader = { uniforms: { tEquirect: { value: null @@ -8984,48 +9627,13 @@ }, vertexShader: /* glsl */ - ` - - varying vec3 vWorldDirection; - - vec3 transformDirection( in vec3 dir, in mat4 matrix ) { - - return normalize( ( matrix * vec4( dir, 0.0 ) ).xyz ); - - } - - void main() { - - vWorldDirection = transformDirection( position, modelMatrix ); - - #include - #include - - } - `, + "\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: /* glsl */ - ` - - uniform sampler2D tEquirect; - - varying vec3 vWorldDirection; - - #include - - void main() { - - vec3 direction = normalize( vWorldDirection ); - - vec2 sampleUV = equirectUv( direction ); - - gl_FragColor = texture2D( tEquirect, sampleUV ); - - } - ` + "\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" }; - const geometry = new BoxGeometry(5, 5, 5); - const material = new ShaderMaterial({ + var geometry = new BoxGeometry(5, 5, 5); + var material = new ShaderMaterial({ name: 'CubemapFromEquirect', uniforms: cloneUniforms(shader.uniforms), vertexShader: shader.vertexShader, @@ -9034,64 +9642,97 @@ blending: NoBlending }); material.uniforms.tEquirect.value = texture; - const mesh = new Mesh(geometry, material); - const currentMinFilter = texture.minFilter; // Avoid blurred poles + var mesh = new Mesh(geometry, material); + var currentMinFilter = texture.minFilter; // Avoid blurred poles if (texture.minFilter === LinearMipmapLinearFilter) texture.minFilter = LinearFilter; - const camera = new CubeCamera(1, 10, this); + var camera = new CubeCamera(1, 10, this); camera.update(renderer, mesh); texture.minFilter = currentMinFilter; mesh.geometry.dispose(); mesh.material.dispose(); return this; - } + }; - clear(renderer, color, depth, stencil) { - const currentRenderTarget = renderer.getRenderTarget(); + _proto.clear = function clear(renderer, color, depth, stencil) { + var currentRenderTarget = renderer.getRenderTarget(); - for (let i = 0; i < 6; i++) { + for (var i = 0; i < 6; i++) { renderer.setRenderTarget(this, i); renderer.clear(color, depth, stencil); } renderer.setRenderTarget(currentRenderTarget); - } + }; - } + return WebGLCubeRenderTarget; + }(WebGLRenderTarget); WebGLCubeRenderTarget.prototype.isWebGLCubeRenderTarget = true; - class DataTexture extends Texture { - constructor(data, width, height, format, type, mapping, wrapS, wrapT, magFilter, minFilter, anisotropy, encoding) { - super(null, mapping, wrapS, wrapT, magFilter, minFilter, format, type, anisotropy, encoding); - this.image = { + var DataTexture = /*#__PURE__*/function (_Texture) { + _inheritsLoose(DataTexture, _Texture); + + function DataTexture(data, width, height, format, type, mapping, wrapS, wrapT, magFilter, minFilter, anisotropy, encoding) { + var _this; + + _this = _Texture.call(this, null, mapping, wrapS, wrapT, magFilter, minFilter, format, type, anisotropy, encoding) || this; + _this.image = { data: data || null, width: width || 1, height: height || 1 }; - this.magFilter = magFilter !== undefined ? magFilter : NearestFilter; - this.minFilter = minFilter !== undefined ? minFilter : NearestFilter; - this.generateMipmaps = false; - this.flipY = false; - this.unpackAlignment = 1; - this.needsUpdate = true; + _this.magFilter = magFilter !== undefined ? magFilter : NearestFilter; + _this.minFilter = minFilter !== undefined ? minFilter : NearestFilter; + _this.generateMipmaps = false; + _this.flipY = false; + _this.unpackAlignment = 1; + _this.needsUpdate = true; + return _this; } - } + return DataTexture; + }(Texture); DataTexture.prototype.isDataTexture = true; - const _sphere$2 = /*@__PURE__*/new Sphere(); + var _sphere$1 = /*@__PURE__*/new Sphere(); - const _vector$7 = /*@__PURE__*/new Vector3(); + var _vector$5 = /*@__PURE__*/new Vector3(); + + var Frustum = /*#__PURE__*/function () { + function Frustum(p0, p1, p2, p3, p4, p5) { + if (p0 === void 0) { + p0 = new Plane(); + } + + if (p1 === void 0) { + p1 = new Plane(); + } + + if (p2 === void 0) { + p2 = new Plane(); + } + + if (p3 === void 0) { + p3 = new Plane(); + } + + if (p4 === void 0) { + p4 = new Plane(); + } + + if (p5 === void 0) { + p5 = new Plane(); + } - 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; + var _proto = Frustum.prototype; + + _proto.set = function set(p0, p1, p2, p3, p4, p5) { + var planes = this.planes; planes[0].copy(p0); planes[1].copy(p1); planes[2].copy(p2); @@ -9099,37 +9740,37 @@ planes[4].copy(p4); planes[5].copy(p5); return this; - } + }; - copy(frustum) { - const planes = this.planes; + _proto.copy = function copy(frustum) { + var planes = this.planes; - for (let i = 0; i < 6; i++) { + for (var 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]; - const me4 = me[4], - me5 = me[5], - me6 = me[6], - me7 = me[7]; - const me8 = me[8], - me9 = me[9], - me10 = me[10], - me11 = me[11]; - const me12 = me[12], - me13 = me[13], - me14 = me[14], - me15 = me[15]; + _proto.setFromProjectionMatrix = function setFromProjectionMatrix(m) { + var planes = this.planes; + var me = m.elements; + var me0 = me[0], + me1 = me[1], + me2 = me[2], + me3 = me[3]; + var me4 = me[4], + me5 = me[5], + me6 = me[6], + me7 = me[7]; + var me8 = me[8], + me9 = me[9], + me10 = me[10], + me11 = me[11]; + var me12 = me[12], + 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(); @@ -9137,34 +9778,40 @@ planes[4].setComponents(me3 - me2, me7 - me6, me11 - me10, me15 - me14).normalize(); 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(); + _proto.intersectsObject = function intersectsObject(object) { + if (object.boundingSphere !== undefined) { + if (object.boundingSphere === null) object.computeBoundingSphere(); - _sphere$2.copy(geometry.boundingSphere).applyMatrix4(object.matrixWorld); + _sphere$1.copy(object.boundingSphere).applyMatrix4(object.matrixWorld); + } else { + var geometry = object.geometry; + if (geometry.boundingSphere === null) geometry.computeBoundingSphere(); - return this.intersectsSphere(_sphere$2); - } + _sphere$1.copy(geometry.boundingSphere).applyMatrix4(object.matrixWorld); + } + + return this.intersectsSphere(_sphere$1); + }; - intersectsSprite(sprite) { - _sphere$2.center.set(0, 0, 0); + _proto.intersectsSprite = function intersectsSprite(sprite) { + _sphere$1.center.set(0, 0, 0); - _sphere$2.radius = 0.7071067811865476; + _sphere$1.radius = 0.7071067811865476; - _sphere$2.applyMatrix4(sprite.matrixWorld); + _sphere$1.applyMatrix4(sprite.matrixWorld); - return this.intersectsSphere(_sphere$2); - } + return this.intersectsSphere(_sphere$1); + }; - intersectsSphere(sphere) { - const planes = this.planes; - const center = sphere.center; - const negRadius = -sphere.radius; + _proto.intersectsSphere = function intersectsSphere(sphere) { + var planes = this.planes; + var center = sphere.center; + var negRadius = -sphere.radius; - for (let i = 0; i < 6; i++) { - const distance = planes[i].distanceToPoint(center); + for (var i = 0; i < 6; i++) { + var distance = planes[i].distanceToPoint(center); if (distance < negRadius) { return false; @@ -9172,49 +9819,50 @@ } return true; - } + }; - intersectsBox(box) { - const planes = this.planes; + _proto.intersectsBox = function intersectsBox(box) { + var planes = this.planes; - for (let i = 0; i < 6; i++) { - const plane = planes[i]; // corner at max distance + for (var i = 0; i < 6; i++) { + var 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; + _vector$5.x = plane.normal.x > 0 ? box.max.x : box.min.x; + _vector$5.y = plane.normal.y > 0 ? box.max.y : box.min.y; + _vector$5.z = plane.normal.z > 0 ? box.max.z : box.min.z; - if (plane.distanceToPoint(_vector$7) < 0) { + if (plane.distanceToPoint(_vector$5) < 0) { return false; } } return true; - } + }; - containsPoint(point) { - const planes = this.planes; + _proto.containsPoint = function containsPoint(point) { + var planes = this.planes; - for (let i = 0; i < 6; i++) { + for (var i = 0; i < 6; i++) { if (planes[i].distanceToPoint(point) < 0) { return false; } } return true; - } + }; - clone() { + _proto.clone = function clone() { return new this.constructor().copy(this); - } + }; - } + return Frustum; + }(); function WebGLAnimation() { - let context = null; - let isAnimating = false; - let animationLoop = null; - let requestId = null; + var context = null; + var isAnimating = false; + var animationLoop = null; + var requestId = null; function onAnimationFrame(time, frame) { animationLoop(time, frame); @@ -9222,37 +9870,37 @@ } return { - start: function () { + start: function start() { if (isAnimating === true) return; if (animationLoop === null) return; requestId = context.requestAnimationFrame(onAnimationFrame); isAnimating = true; }, - stop: function () { + stop: function stop() { context.cancelAnimationFrame(requestId); isAnimating = false; }, - setAnimationLoop: function (callback) { + setAnimationLoop: function setAnimationLoop(callback) { animationLoop = callback; }, - setContext: function (value) { + setContext: function setContext(value) { context = value; } }; } function WebGLAttributes(gl, capabilities) { - const isWebGL2 = capabilities.isWebGL2; - const buffers = new WeakMap(); + var isWebGL2 = capabilities.isWebGL2; + var buffers = new WeakMap(); function createBuffer(attribute, bufferType) { - const array = attribute.array; - const usage = attribute.usage; - const buffer = gl.createBuffer(); + var array = attribute.array; + var usage = attribute.usage; + var buffer = gl.createBuffer(); gl.bindBuffer(bufferType, buffer); gl.bufferData(bufferType, array, usage); attribute.onUploadCallback(); - let type = 5126; + var type = 5126; if (array instanceof Float32Array) { type = 5126; @@ -9289,8 +9937,8 @@ } function updateBuffer(buffer, attribute, bufferType) { - const array = attribute.array; - const updateRange = attribute.updateRange; + var array = attribute.array; + var updateRange = attribute.updateRange; gl.bindBuffer(bufferType, buffer); if (updateRange.count === -1) { @@ -9315,7 +9963,7 @@ function remove(attribute) { if (attribute.isInterleavedBufferAttribute) attribute = attribute.data; - const data = buffers.get(attribute); + var data = buffers.get(attribute); if (data) { gl.deleteBuffer(data.buffer); @@ -9325,7 +9973,7 @@ function update(attribute, bufferType) { if (attribute.isGLBufferAttribute) { - const cached = buffers.get(attribute); + var cached = buffers.get(attribute); if (!cached || cached.version < attribute.version) { buffers.set(attribute, { @@ -9340,7 +9988,7 @@ } if (attribute.isInterleavedBufferAttribute) attribute = attribute.data; - const data = buffers.get(attribute); + var data = buffers.get(attribute); if (data === undefined) { buffers.set(attribute, createBuffer(attribute, bufferType)); @@ -9357,35 +10005,55 @@ }; } - class PlaneGeometry extends BufferGeometry { - constructor(width = 1, height = 1, widthSegments = 1, heightSegments = 1) { - super(); - this.type = 'PlaneGeometry'; - this.parameters = { + var PlaneGeometry = /*#__PURE__*/function (_BufferGeometry) { + _inheritsLoose(PlaneGeometry, _BufferGeometry); + + function PlaneGeometry(width, height, widthSegments, heightSegments) { + var _this; + + if (width === void 0) { + width = 1; + } + + if (height === void 0) { + height = 1; + } + + if (widthSegments === void 0) { + widthSegments = 1; + } + + if (heightSegments === void 0) { + heightSegments = 1; + } + + _this = _BufferGeometry.call(this) || this; + _this.type = 'PlaneGeometry'; + _this.parameters = { width: width, height: height, widthSegments: widthSegments, heightSegments: heightSegments }; - const width_half = width / 2; - const height_half = height / 2; - const gridX = Math.floor(widthSegments); - const gridY = Math.floor(heightSegments); - const gridX1 = gridX + 1; - const gridY1 = gridY + 1; - const segment_width = width / gridX; - 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; + var width_half = width / 2; + var height_half = height / 2; + var gridX = Math.floor(widthSegments); + var gridY = Math.floor(heightSegments); + var gridX1 = gridX + 1; + var gridY1 = gridY + 1; + var segment_width = width / gridX; + var segment_height = height / gridY; // + + var indices = []; + var vertices = []; + var normals = []; + var uvs = []; + + for (var iy = 0; iy < gridY1; iy++) { + var y = iy * segment_height - height_half; + + for (var ix = 0; ix < gridX1; ix++) { + var x = ix * segment_width - width_half; vertices.push(x, -y, 0); normals.push(0, 0, 1); uvs.push(ix / gridX); @@ -9393,24 +10061,30 @@ } } - for (let iy = 0; iy < gridY; iy++) { - for (let ix = 0; ix < gridX; ix++) { - const a = ix + gridX1 * iy; - const b = ix + gridX1 * (iy + 1); - const c = ix + 1 + gridX1 * (iy + 1); - const d = ix + 1 + gridX1 * iy; + for (var _iy = 0; _iy < gridY; _iy++) { + for (var _ix = 0; _ix < gridX; _ix++) { + var a = _ix + gridX1 * _iy; + var b = _ix + gridX1 * (_iy + 1); + var c = _ix + 1 + gridX1 * (_iy + 1); + var d = _ix + 1 + gridX1 * _iy; indices.push(a, b, d); 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)); + _this.setIndex(indices); + + _this.setAttribute('position', new Float32BufferAttribute(vertices, 3)); + + _this.setAttribute('normal', new Float32BufferAttribute(normals, 3)); + + _this.setAttribute('uv', new Float32BufferAttribute(uvs, 2)); + + return _this; } - } + return PlaneGeometry; + }(BufferGeometry); var alphamap_fragment = "#ifdef USE_ALPHAMAP\n\tdiffuseColor.a *= texture2D( alphaMap, vUv ).g;\n#endif"; @@ -9670,7 +10344,7 @@ var 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}"; - const ShaderChunk = { + var ShaderChunk = { alphamap_fragment: alphamap_fragment, alphamap_pars_fragment: alphamap_pars_fragment, alphatest_fragment: alphatest_fragment, @@ -9806,7 +10480,7 @@ * Uniforms library for shared webgl shaders */ - const UniformsLib = { + var UniformsLib = { common: { diffuse: { value: new Color(0xeeeeee) @@ -10081,7 +10755,7 @@ } }; - const ShaderLib = { + var ShaderLib = { basic: { uniforms: mergeUniforms([UniformsLib.common, UniformsLib.specularmap, UniformsLib.envmap, UniformsLib.aomap, UniformsLib.lightmap, UniformsLib.fog]), vertexShader: ShaderChunk.meshbasic_vert, @@ -10284,16 +10958,16 @@ }; function WebGLBackground(renderer, cubemaps, state, objects, premultipliedAlpha) { - const clearColor = new Color(0x000000); - let clearAlpha = 0; - let planeMesh; - let boxMesh; - let currentBackground = null; - let currentBackgroundVersion = 0; - let currentTonemapping = null; + var clearColor = new Color(0x000000); + var clearAlpha = 0; + var planeMesh; + var boxMesh; + var currentBackground = null; + var currentBackgroundVersion = 0; + var currentTonemapping = null; function render(renderList, scene, camera, forceClear) { - let background = scene.isScene === true ? scene.background : null; + var background = scene.isScene === true ? scene.background : null; if (background && background.isTexture) { background = cubemaps.get(background); @@ -10301,8 +10975,8 @@ // TODO: Reconsider this. - const xr = renderer.xr; - const session = xr.getSession && xr.getSession(); + var xr = renderer.xr; + var session = xr.getSession && xr.getSession(); if (session && session.environmentBlendMode === 'additive') { background = null; @@ -10340,7 +11014,7 @@ Object.defineProperty(boxMesh.material, 'envMap', { - get: function () { + get: function get() { return this.uniforms.envMap.value; } }); @@ -10374,7 +11048,7 @@ planeMesh.geometry.deleteAttribute('normal'); // enable code injection for non-built-in material Object.defineProperty(planeMesh.material, 'map', { - get: function () { + get: function get() { return this.uniforms.t2D.value; } }); @@ -10406,18 +11080,22 @@ } return { - getClearColor: function () { + getClearColor: function getClearColor() { return clearColor; }, - setClearColor: function (color, alpha = 1) { + setClearColor: function setClearColor(color, alpha) { + if (alpha === void 0) { + alpha = 1; + } + clearColor.set(color); clearAlpha = alpha; setClear(clearColor, clearAlpha); }, - getClearAlpha: function () { + getClearAlpha: function getClearAlpha() { return clearAlpha; }, - setClearAlpha: function (alpha) { + setClearAlpha: function setClearAlpha(alpha) { clearAlpha = alpha; setClear(clearColor, clearAlpha); }, @@ -10426,18 +11104,18 @@ } function WebGLBindingStates(gl, extensions, attributes, capabilities) { - const maxVertexAttributes = gl.getParameter(34921); - const extension = capabilities.isWebGL2 ? null : extensions.get('OES_vertex_array_object'); - const vaoAvailable = capabilities.isWebGL2 || extension !== null; - const bindingStates = {}; - const defaultState = createBindingState(null); - let currentState = defaultState; + var maxVertexAttributes = gl.getParameter(34921); + var extension = capabilities.isWebGL2 ? null : extensions.get('OES_vertex_array_object'); + var vaoAvailable = capabilities.isWebGL2 || extension !== null; + var bindingStates = {}; + var defaultState = createBindingState(null); + var currentState = defaultState; function setup(object, material, program, geometry, index) { - let updateBuffers = false; + var updateBuffers = false; if (vaoAvailable) { - const state = getBindingState(geometry, program, material); + var state = getBindingState(geometry, program, material); if (currentState !== state) { currentState = state; @@ -10447,7 +11125,7 @@ updateBuffers = needsUpdate(geometry, index); if (updateBuffers) saveCache(geometry, index); } else { - const wireframe = material.wireframe === true; + var wireframe = material.wireframe === true; if (currentState.geometry !== geometry.id || currentState.program !== program.id || currentState.wireframe !== wireframe) { currentState.geometry = geometry.id; @@ -10490,22 +11168,22 @@ } function getBindingState(geometry, program, material) { - const wireframe = material.wireframe === true; - let programMap = bindingStates[geometry.id]; + var wireframe = material.wireframe === true; + var programMap = bindingStates[geometry.id]; if (programMap === undefined) { programMap = {}; bindingStates[geometry.id] = programMap; } - let stateMap = programMap[program.id]; + var stateMap = programMap[program.id]; if (stateMap === undefined) { stateMap = {}; programMap[program.id] = stateMap; } - let state = stateMap[wireframe]; + var state = stateMap[wireframe]; if (state === undefined) { state = createBindingState(createVertexArrayObject()); @@ -10516,11 +11194,11 @@ } function createBindingState(vao) { - const newAttributes = []; - const enabledAttributes = []; - const attributeDivisors = []; + var newAttributes = []; + var enabledAttributes = []; + var attributeDivisors = []; - for (let i = 0; i < maxVertexAttributes; i++) { + for (var i = 0; i < maxVertexAttributes; i++) { newAttributes[i] = 0; enabledAttributes[i] = 0; attributeDivisors[i] = 0; @@ -10541,13 +11219,13 @@ } function needsUpdate(geometry, index) { - const cachedAttributes = currentState.attributes; - const geometryAttributes = geometry.attributes; - let attributesNum = 0; + var cachedAttributes = currentState.attributes; + var geometryAttributes = geometry.attributes; + var attributesNum = 0; - for (const key in geometryAttributes) { - const cachedAttribute = cachedAttributes[key]; - const geometryAttribute = geometryAttributes[key]; + for (var key in geometryAttributes) { + var cachedAttribute = cachedAttributes[key]; + var geometryAttribute = geometryAttributes[key]; if (cachedAttribute === undefined) return true; if (cachedAttribute.attribute !== geometryAttribute) return true; if (cachedAttribute.data !== geometryAttribute.data) return true; @@ -10560,13 +11238,13 @@ } function saveCache(geometry, index) { - const cache = {}; - const attributes = geometry.attributes; - let attributesNum = 0; + var cache = {}; + var attributes = geometry.attributes; + var attributesNum = 0; - for (const key in attributes) { - const attribute = attributes[key]; - const data = {}; + for (var key in attributes) { + var attribute = attributes[key]; + var data = {}; data.attribute = attribute; if (attribute.data) { @@ -10583,9 +11261,9 @@ } function initAttributes() { - const newAttributes = currentState.newAttributes; + var newAttributes = currentState.newAttributes; - for (let i = 0, il = newAttributes.length; i < il; i++) { + for (var i = 0, il = newAttributes.length; i < il; i++) { newAttributes[i] = 0; } } @@ -10595,9 +11273,9 @@ } function enableAttributeAndDivisor(attribute, meshPerAttribute) { - const newAttributes = currentState.newAttributes; - const enabledAttributes = currentState.enabledAttributes; - const attributeDivisors = currentState.attributeDivisors; + var newAttributes = currentState.newAttributes; + var enabledAttributes = currentState.enabledAttributes; + var attributeDivisors = currentState.attributeDivisors; newAttributes[attribute] = 1; if (enabledAttributes[attribute] === 0) { @@ -10606,17 +11284,19 @@ } if (attributeDivisors[attribute] !== meshPerAttribute) { - const extension = capabilities.isWebGL2 ? gl : extensions.get('ANGLE_instanced_arrays'); - extension[capabilities.isWebGL2 ? 'vertexAttribDivisor' : 'vertexAttribDivisorANGLE'](attribute, meshPerAttribute); + var _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; + var newAttributes = currentState.newAttributes; + var enabledAttributes = currentState.enabledAttributes; - for (let i = 0, il = enabledAttributes.length; i < il; i++) { + for (var i = 0, il = enabledAttributes.length; i < il; i++) { if (enabledAttributes[i] !== newAttributes[i]) { gl.disableVertexAttribArray(i); enabledAttributes[i] = 0; @@ -10638,30 +11318,30 @@ } initAttributes(); - const geometryAttributes = geometry.attributes; - const programAttributes = program.getAttributes(); - const materialDefaultAttributeValues = material.defaultAttributeValues; + var geometryAttributes = geometry.attributes; + var programAttributes = program.getAttributes(); + var materialDefaultAttributeValues = material.defaultAttributeValues; - for (const name in programAttributes) { - const programAttribute = programAttributes[name]; + for (var name in programAttributes) { + var programAttribute = programAttributes[name]; if (programAttribute >= 0) { - const geometryAttribute = geometryAttributes[name]; + var geometryAttribute = geometryAttributes[name]; 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 + var normalized = geometryAttribute.normalized; + var size = geometryAttribute.itemSize; + var 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; + var buffer = attribute.buffer; + var type = attribute.type; + var bytesPerElement = attribute.bytesPerElement; if (geometryAttribute.isInterleavedBufferAttribute) { - const data = geometryAttribute.data; - const stride = data.stride; - const offset = geometryAttribute.offset; + var data = geometryAttribute.data; + var stride = data.stride; + var offset = geometryAttribute.offset; if (data && data.isInstancedInterleavedBuffer) { enableAttributeAndDivisor(programAttribute, data.meshPerAttribute); @@ -10690,31 +11370,33 @@ vertexAttribPointer(programAttribute, size, type, normalized, 0, 0); } } else if (name === 'instanceMatrix') { - const attribute = attributes.get(object.instanceMatrix); // TODO Attribute may not be available on context restore + var _attribute = attributes.get(object.instanceMatrix); // TODO Attribute may not be available on context restore - if (attribute === undefined) continue; - const buffer = attribute.buffer; - const type = attribute.type; + + if (_attribute === undefined) continue; + var _buffer = _attribute.buffer; + var _type = _attribute.type; enableAttributeAndDivisor(programAttribute + 0, 1); enableAttributeAndDivisor(programAttribute + 1, 1); enableAttributeAndDivisor(programAttribute + 2, 1); enableAttributeAndDivisor(programAttribute + 3, 1); - gl.bindBuffer(34962, buffer); - gl.vertexAttribPointer(programAttribute + 0, 4, type, false, 64, 0); - gl.vertexAttribPointer(programAttribute + 1, 4, type, false, 64, 16); - gl.vertexAttribPointer(programAttribute + 2, 4, type, false, 64, 32); - gl.vertexAttribPointer(programAttribute + 3, 4, type, false, 64, 48); + gl.bindBuffer(34962, _buffer); + gl.vertexAttribPointer(programAttribute + 0, 4, _type, false, 64, 0); + gl.vertexAttribPointer(programAttribute + 1, 4, _type, false, 64, 16); + gl.vertexAttribPointer(programAttribute + 2, 4, _type, false, 64, 32); + gl.vertexAttribPointer(programAttribute + 3, 4, _type, false, 64, 48); } else if (name === 'instanceColor') { - const attribute = attributes.get(object.instanceColor); // TODO Attribute may not be available on context restore + var _attribute2 = attributes.get(object.instanceColor); // TODO Attribute may not be available on context restore - if (attribute === undefined) continue; - const buffer = attribute.buffer; - const type = attribute.type; + + if (_attribute2 === undefined) continue; + var _buffer2 = _attribute2.buffer; + var _type2 = _attribute2.type; enableAttributeAndDivisor(programAttribute, 1); - gl.bindBuffer(34962, buffer); - gl.vertexAttribPointer(programAttribute, 3, type, false, 12, 0); + gl.bindBuffer(34962, _buffer2); + gl.vertexAttribPointer(programAttribute, 3, _type2, false, 12, 0); } else if (materialDefaultAttributeValues !== undefined) { - const value = materialDefaultAttributeValues[name]; + var value = materialDefaultAttributeValues[name]; if (value !== undefined) { switch (value.length) { @@ -10744,13 +11426,13 @@ function dispose() { reset(); - for (const geometryId in bindingStates) { - const programMap = bindingStates[geometryId]; + for (var geometryId in bindingStates) { + var programMap = bindingStates[geometryId]; - for (const programId in programMap) { - const stateMap = programMap[programId]; + for (var programId in programMap) { + var stateMap = programMap[programId]; - for (const wireframe in stateMap) { + for (var wireframe in stateMap) { deleteVertexArrayObject(stateMap[wireframe].object); delete stateMap[wireframe]; } @@ -10764,12 +11446,12 @@ function releaseStatesOfGeometry(geometry) { if (bindingStates[geometry.id] === undefined) return; - const programMap = bindingStates[geometry.id]; + var programMap = bindingStates[geometry.id]; - for (const programId in programMap) { - const stateMap = programMap[programId]; + for (var programId in programMap) { + var stateMap = programMap[programId]; - for (const wireframe in stateMap) { + for (var wireframe in stateMap) { deleteVertexArrayObject(stateMap[wireframe].object); delete stateMap[wireframe]; } @@ -10781,12 +11463,12 @@ } function releaseStatesOfProgram(program) { - for (const geometryId in bindingStates) { - const programMap = bindingStates[geometryId]; + for (var geometryId in bindingStates) { + var programMap = bindingStates[geometryId]; if (programMap[program.id] === undefined) continue; - const stateMap = programMap[program.id]; + var stateMap = programMap[program.id]; - for (const wireframe in stateMap) { + for (var wireframe in stateMap) { deleteVertexArrayObject(stateMap[wireframe].object); delete stateMap[wireframe]; } @@ -10823,8 +11505,8 @@ } function WebGLBufferRenderer(gl, extensions, info, capabilities) { - const isWebGL2 = capabilities.isWebGL2; - let mode; + var isWebGL2 = capabilities.isWebGL2; + var mode; function setMode(value) { mode = value; @@ -10837,7 +11519,7 @@ function renderInstances(start, count, primcount) { if (primcount === 0) return; - let extension, methodName; + var extension, methodName; if (isWebGL2) { extension = gl; @@ -10863,13 +11545,13 @@ } function WebGLCapabilities(gl, extensions, parameters) { - let maxAnisotropy; + var maxAnisotropy; function getMaxAnisotropy() { if (maxAnisotropy !== undefined) return maxAnisotropy; if (extensions.has('EXT_texture_filter_anisotropic') === true) { - const extension = extensions.get('EXT_texture_filter_anisotropic'); + var extension = extensions.get('EXT_texture_filter_anisotropic'); maxAnisotropy = gl.getParameter(extension.MAX_TEXTURE_MAX_ANISOTROPY_EXT); } else { maxAnisotropy = 0; @@ -10898,30 +11580,30 @@ /* eslint-disable no-undef */ - const isWebGL2 = typeof WebGL2RenderingContext !== 'undefined' && gl instanceof WebGL2RenderingContext || typeof WebGL2ComputeRenderingContext !== 'undefined' && gl instanceof WebGL2ComputeRenderingContext; + var isWebGL2 = typeof WebGL2RenderingContext !== 'undefined' && gl instanceof WebGL2RenderingContext || typeof WebGL2ComputeRenderingContext !== 'undefined' && gl instanceof WebGL2ComputeRenderingContext; /* eslint-enable no-undef */ - let precision = parameters.precision !== undefined ? parameters.precision : 'highp'; - const maxPrecision = getMaxPrecision(precision); + var precision = parameters.precision !== undefined ? parameters.precision : 'highp'; + var maxPrecision = getMaxPrecision(precision); if (maxPrecision !== precision) { console.warn('THREE.WebGLRenderer:', precision, 'not supported, using', maxPrecision, 'instead.'); precision = maxPrecision; } - const logarithmicDepthBuffer = parameters.logarithmicDepthBuffer === true; - const maxTextures = gl.getParameter(34930); - const maxVertexTextures = gl.getParameter(35660); - const maxTextureSize = gl.getParameter(3379); - const maxCubemapSize = gl.getParameter(34076); - const maxAttributes = gl.getParameter(34921); - const maxVertexUniforms = gl.getParameter(36347); - const maxVaryings = gl.getParameter(36348); - const maxFragmentUniforms = gl.getParameter(36349); - const vertexTextures = maxVertexTextures > 0; - const floatFragmentTextures = isWebGL2 || extensions.has('OES_texture_float'); - const floatVertexTextures = vertexTextures && floatFragmentTextures; - const maxSamples = isWebGL2 ? gl.getParameter(36183) : 0; + var logarithmicDepthBuffer = parameters.logarithmicDepthBuffer === true; + var maxTextures = gl.getParameter(34930); + var maxVertexTextures = gl.getParameter(35660); + var maxTextureSize = gl.getParameter(3379); + var maxCubemapSize = gl.getParameter(34076); + var maxAttributes = gl.getParameter(34921); + var maxVertexUniforms = gl.getParameter(36347); + var maxVaryings = gl.getParameter(36348); + var maxFragmentUniforms = gl.getParameter(36349); + var vertexTextures = maxVertexTextures > 0; + var floatFragmentTextures = isWebGL2 || extensions.has('OES_texture_float'); + var floatVertexTextures = vertexTextures && floatFragmentTextures; + var maxSamples = isWebGL2 ? gl.getParameter(36183) : 0; return { isWebGL2: isWebGL2, getMaxAnisotropy: getMaxAnisotropy, @@ -10944,14 +11626,14 @@ } function WebGLClipping(properties) { - const scope = this; - let globalState = null, + var scope = this; + var globalState = null, numGlobalPlanes = 0, localClippingEnabled = false, renderingShadows = false; - const plane = new Plane(), - viewNormalMatrix = new Matrix3(), - uniform = { + var plane = new Plane(), + viewNormalMatrix = new Matrix3(), + uniform = { value: null, needsUpdate: false }; @@ -10960,7 +11642,7 @@ 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 + var 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; @@ -10980,10 +11662,10 @@ }; this.setState = function (material, camera, useCache) { - const planes = material.clippingPlanes, - clipIntersection = material.clipIntersection, - clipShadows = material.clipShadows; - const materialProperties = properties.get(material); + var planes = material.clippingPlanes, + clipIntersection = material.clipIntersection, + clipShadows = material.clipShadows; + var materialProperties = properties.get(material); if (!localClippingEnabled || planes === null || planes.length === 0 || renderingShadows && !clipShadows) { // there's no local clipping @@ -10994,14 +11676,14 @@ resetGlobalState(); } } else { - const nGlobal = renderingShadows ? 0 : numGlobalPlanes, - lGlobal = nGlobal * 4; - let dstArray = materialProperties.clippingState || null; + var nGlobal = renderingShadows ? 0 : numGlobalPlanes, + lGlobal = nGlobal * 4; + var dstArray = materialProperties.clippingState || null; uniform.value = dstArray; // ensure unique state dstArray = projectPlanes(planes, camera, lGlobal, useCache); - for (let i = 0; i !== lGlobal; ++i) { + for (var i = 0; i !== lGlobal; ++i) { dstArray[i] = globalState[i]; } @@ -11022,22 +11704,22 @@ } function projectPlanes(planes, camera, dstOffset, skipTransform) { - const nPlanes = planes !== null ? planes.length : 0; - let dstArray = null; + var nPlanes = planes !== null ? planes.length : 0; + var dstArray = null; if (nPlanes !== 0) { dstArray = uniform.value; if (skipTransform !== true || dstArray === null) { - const flatSize = dstOffset + nPlanes * 4, - viewMatrix = camera.matrixWorldInverse; + var flatSize = dstOffset + nPlanes * 4, + 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) { + for (var 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; @@ -11055,7 +11737,7 @@ } function WebGLCubeMaps(renderer) { - let cubemaps = new WeakMap(); + var cubemaps = new WeakMap(); function mapTextureMapping(texture, mapping) { if (mapping === EquirectangularReflectionMapping) { @@ -11069,18 +11751,18 @@ function get(texture) { if (texture && texture.isTexture) { - const mapping = texture.mapping; + var mapping = texture.mapping; if (mapping === EquirectangularReflectionMapping || mapping === EquirectangularRefractionMapping) { if (cubemaps.has(texture)) { - const cubemap = cubemaps.get(texture).texture; + var cubemap = cubemaps.get(texture).texture; return mapTextureMapping(cubemap, texture.mapping); } else { - const image = texture.image; + var image = texture.image; if (image && image.height > 0) { - const currentRenderTarget = renderer.getRenderTarget(); - const renderTarget = new WebGLCubeRenderTarget(image.height / 2); + var currentRenderTarget = renderer.getRenderTarget(); + var renderTarget = new WebGLCubeRenderTarget(image.height / 2); renderTarget.fromEquirectangularTexture(renderer, texture); cubemaps.set(texture, renderTarget); renderer.setRenderTarget(currentRenderTarget); @@ -11098,9 +11780,9 @@ } function onTextureDispose(event) { - const texture = event.target; + var texture = event.target; texture.removeEventListener('dispose', onTextureDispose); - const cubemap = cubemaps.get(texture); + var cubemap = cubemaps.get(texture); if (cubemap !== undefined) { cubemaps.delete(texture); @@ -11119,14 +11801,14 @@ } function WebGLExtensions(gl) { - const extensions = {}; + var extensions = {}; function getExtension(name) { if (extensions[name] !== undefined) { return extensions[name]; } - let extension; + var extension; switch (name) { case 'WEBGL_depth_texture': @@ -11154,10 +11836,10 @@ } return { - has: function (name) { + has: function has(name) { return getExtension(name) !== null; }, - init: function (capabilities) { + init: function init(capabilities) { if (capabilities.isWebGL2) { getExtension('EXT_color_buffer_float'); } else { @@ -11174,8 +11856,8 @@ getExtension('OES_texture_float_linear'); getExtension('EXT_color_buffer_half_float'); }, - get: function (name) { - const extension = getExtension(name); + get: function get(name) { + var extension = getExtension(name); if (extension === null) { console.warn('THREE.WebGLRenderer: ' + name + ' extension not supported.'); @@ -11187,23 +11869,23 @@ } function WebGLGeometries(gl, attributes, info, bindingStates) { - const geometries = {}; - const wireframeAttributes = new WeakMap(); + var geometries = {}; + var wireframeAttributes = new WeakMap(); function onGeometryDispose(event) { - const geometry = event.target; + var geometry = event.target; if (geometry.index !== null) { attributes.remove(geometry.index); } - for (const name in geometry.attributes) { + for (var name in geometry.attributes) { attributes.remove(geometry.attributes[name]); } geometry.removeEventListener('dispose', onGeometryDispose); delete geometries[geometry.id]; - const attribute = wireframeAttributes.get(geometry); + var attribute = wireframeAttributes.get(geometry); if (attribute) { attributes.remove(attribute); @@ -11229,67 +11911,70 @@ } function update(geometry) { - const geometryAttributes = geometry.attributes; // Updating index buffer in VAO now. See WebGLBindingStates. + var geometryAttributes = geometry.attributes; // Updating index buffer in VAO now. See WebGLBindingStates. - for (const name in geometryAttributes) { + for (var name in geometryAttributes) { attributes.update(geometryAttributes[name], 34962); } // morph targets - const morphAttributes = geometry.morphAttributes; + var morphAttributes = geometry.morphAttributes; - for (const name in morphAttributes) { - const array = morphAttributes[name]; + for (var _name in morphAttributes) { + var array = morphAttributes[_name]; - for (let i = 0, l = array.length; i < l; i++) { + for (var i = 0, l = array.length; i < l; i++) { attributes.update(array[i], 34962); } } } function updateWireframeAttribute(geometry) { - const indices = []; - const geometryIndex = geometry.index; - const geometryPosition = geometry.attributes.position; - let version = 0; + var indices = []; + var geometryIndex = geometry.index; + var geometryPosition = geometry.attributes.position; + var version = 0; if (geometryIndex !== null) { - const array = geometryIndex.array; + var 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]; - const c = array[i + 2]; + for (var i = 0, l = array.length; i < l; i += 3) { + var a = array[i + 0]; + var b = array[i + 1]; + var c = array[i + 2]; indices.push(a, b, b, c, c, a); } } else { - const array = geometryPosition.array; + var _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; - const c = i + 2; - indices.push(a, b, b, c, c, a); + for (var _i = 0, _l = _array.length / 3 - 1; _i < _l; _i += 3) { + var _a = _i + 0; + + var _b = _i + 1; + + var _c = _i + 2; + + indices.push(_a, _b, _b, _c, _c, _a); } } - const attribute = new (arrayMax(indices) > 65535 ? Uint32BufferAttribute : Uint16BufferAttribute)(indices, 1); + var attribute = new (arrayMax(indices) > 65535 ? Uint32BufferAttribute : Uint16BufferAttribute)(indices, 1); attribute.version = version; // Updating index buffer in VAO now. See WebGLBindingStates // - const previousAttribute = wireframeAttributes.get(geometry); + var previousAttribute = wireframeAttributes.get(geometry); if (previousAttribute) attributes.remove(previousAttribute); // wireframeAttributes.set(geometry, attribute); } function getWireframeAttribute(geometry) { - const currentAttribute = wireframeAttributes.get(geometry); + var currentAttribute = wireframeAttributes.get(geometry); if (currentAttribute) { - const geometryIndex = geometry.index; + var geometryIndex = geometry.index; if (geometryIndex !== null) { // if the attribute is obsolete, create a new one @@ -11312,14 +11997,14 @@ } function WebGLIndexedBufferRenderer(gl, extensions, info, capabilities) { - const isWebGL2 = capabilities.isWebGL2; - let mode; + var isWebGL2 = capabilities.isWebGL2; + var mode; function setMode(value) { mode = value; } - let type, bytesPerElement; + var type, bytesPerElement; function setIndex(value) { type = value.type; @@ -11333,7 +12018,7 @@ function renderInstances(start, count, primcount) { if (primcount === 0) return; - let extension, methodName; + var extension, methodName; if (isWebGL2) { extension = gl; @@ -11360,11 +12045,11 @@ } function WebGLInfo(gl) { - const memory = { + var memory = { geometries: 0, textures: 0 }; - const render = { + var render = { frame: 0, calls: 0, triangles: 0, @@ -11429,89 +12114,89 @@ } function WebGLMorphtargets(gl) { - const influencesList = {}; - const morphInfluences = new Float32Array(8); - const workInfluences = []; + var influencesList = {}; + var morphInfluences = new Float32Array(8); + var workInfluences = []; - for (let i = 0; i < 8; i++) { + for (var i = 0; i < 8; i++) { workInfluences[i] = [i, 0]; } function update(object, geometry, material, program) { - const objectInfluences = object.morphTargetInfluences; // When object doesn't have morph target influences defined, we treat it as a 0-length array + var objectInfluences = object.morphTargetInfluences; // 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]; + var length = objectInfluences === undefined ? 0 : objectInfluences.length; + var influences = influencesList[geometry.id]; if (influences === undefined) { // initialise list influences = []; - for (let i = 0; i < length; i++) { - influences[i] = [i, 0]; + for (var _i = 0; _i < length; _i++) { + influences[_i] = [_i, 0]; } influencesList[geometry.id] = influences; } // Collect influences - for (let i = 0; i < length; i++) { - const influence = influences[i]; - influence[0] = i; - influence[1] = objectInfluences[i]; + for (var _i2 = 0; _i2 < length; _i2++) { + var influence = influences[_i2]; + influence[0] = _i2; + influence[1] = objectInfluences[_i2]; } influences.sort(absNumericalSort); - for (let i = 0; i < 8; i++) { - if (i < length && influences[i][1]) { - workInfluences[i][0] = influences[i][0]; - workInfluences[i][1] = influences[i][1]; + for (var _i3 = 0; _i3 < 8; _i3++) { + if (_i3 < length && influences[_i3][1]) { + workInfluences[_i3][0] = influences[_i3][0]; + workInfluences[_i3][1] = influences[_i3][1]; } else { - workInfluences[i][0] = Number.MAX_SAFE_INTEGER; - workInfluences[i][1] = 0; + workInfluences[_i3][0] = Number.MAX_SAFE_INTEGER; + workInfluences[_i3][1] = 0; } } workInfluences.sort(numericalSort); - const morphTargets = material.morphTargets && geometry.morphAttributes.position; - const morphNormals = material.morphNormals && geometry.morphAttributes.normal; - let morphInfluencesSum = 0; + var morphTargets = material.morphTargets && geometry.morphAttributes.position; + var morphNormals = material.morphNormals && geometry.morphAttributes.normal; + var morphInfluencesSum = 0; - for (let i = 0; i < 8; i++) { - const influence = workInfluences[i]; - const index = influence[0]; - const value = influence[1]; + for (var _i4 = 0; _i4 < 8; _i4++) { + var _influence = workInfluences[_i4]; + var index = _influence[0]; + var 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 (morphTargets && geometry.getAttribute('morphTarget' + _i4) !== morphTargets[index]) { + geometry.setAttribute('morphTarget' + _i4, morphTargets[index]); } - if (morphNormals && geometry.getAttribute('morphNormal' + i) !== morphNormals[index]) { - geometry.setAttribute('morphNormal' + i, morphNormals[index]); + if (morphNormals && geometry.getAttribute('morphNormal' + _i4) !== morphNormals[index]) { + geometry.setAttribute('morphNormal' + _i4, morphNormals[index]); } - morphInfluences[i] = value; + morphInfluences[_i4] = value; morphInfluencesSum += value; } else { - if (morphTargets && geometry.hasAttribute('morphTarget' + i) === true) { - geometry.deleteAttribute('morphTarget' + i); + if (morphTargets && geometry.hasAttribute('morphTarget' + _i4) === true) { + geometry.deleteAttribute('morphTarget' + _i4); } - if (morphNormals && geometry.hasAttribute('morphNormal' + i) === true) { - geometry.deleteAttribute('morphNormal' + i); + if (morphNormals && geometry.hasAttribute('morphNormal' + _i4) === true) { + geometry.deleteAttribute('morphNormal' + _i4); } - morphInfluences[i] = 0; + morphInfluences[_i4] = 0; } } // 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; + var morphBaseInfluence = geometry.morphTargetsRelative ? 1 : 1 - morphInfluencesSum; program.getUniforms().setValue(gl, 'morphTargetBaseInfluence', morphBaseInfluence); program.getUniforms().setValue(gl, 'morphTargetInfluences', morphInfluences); } @@ -11522,12 +12207,12 @@ } function WebGLObjects(gl, geometries, attributes, info) { - let updateMap = new WeakMap(); + var 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 + var frame = info.render.frame; + var geometry = object.geometry; + var buffergeometry = geometries.get(object, geometry); // Update once per frame if (updateMap.get(buffergeometry) !== frame) { geometries.update(buffergeometry); @@ -11554,7 +12239,7 @@ } function onInstancedMeshDispose(event) { - const instancedMesh = event.target; + var instancedMesh = event.target; instancedMesh.removeEventListener('dispose', onInstancedMeshDispose); attributes.remove(instancedMesh.instanceMatrix); if (instancedMesh.instanceColor !== null) attributes.remove(instancedMesh.instanceColor); @@ -11566,29 +12251,71 @@ }; } - class DataTexture2DArray extends Texture { - constructor(data = null, width = 1, height = 1, depth = 1) { - super(null); - this.image = { - data, - width, - height, - depth + var DataTexture2DArray = /*#__PURE__*/function (_Texture) { + _inheritsLoose(DataTexture2DArray, _Texture); + + function DataTexture2DArray(data, width, height, depth) { + var _this; + + if (data === void 0) { + data = null; + } + + if (width === void 0) { + width = 1; + } + + if (height === void 0) { + height = 1; + } + + if (depth === void 0) { + depth = 1; + } + + _this = _Texture.call(this, null) || this; + _this.image = { + data: data, + width: width, + height: height, + depth: depth }; - this.magFilter = NearestFilter; - this.minFilter = NearestFilter; - this.wrapR = ClampToEdgeWrapping; - this.generateMipmaps = false; - this.flipY = false; - this.needsUpdate = true; + _this.magFilter = NearestFilter; + _this.minFilter = NearestFilter; + _this.wrapR = ClampToEdgeWrapping; + _this.generateMipmaps = false; + _this.flipY = false; + _this.needsUpdate = true; + return _this; } - } + return DataTexture2DArray; + }(Texture); DataTexture2DArray.prototype.isDataTexture2DArray = true; - class DataTexture3D extends Texture { - constructor(data = null, width = 1, height = 1, depth = 1) { + var DataTexture3D = /*#__PURE__*/function (_Texture) { + _inheritsLoose(DataTexture3D, _Texture); + + function DataTexture3D(data, width, height, depth) { + var _this; + + if (data === void 0) { + data = null; + } + + if (width === void 0) { + width = 1; + } + + if (height === void 0) { + height = 1; + } + + if (depth === void 0) { + depth = 1; + } + // We're going to add .setXXX() methods for setting properties later. // Users can still set in DataTexture3D directly. // @@ -11596,22 +12323,24 @@ // texture.anisotropy = 16; // // See #14839 - super(null); - this.image = { - data, - width, - height, - depth + _this = _Texture.call(this, null) || this; + _this.image = { + data: data, + width: width, + height: height, + depth: depth }; - this.magFilter = NearestFilter; - this.minFilter = NearestFilter; - this.wrapR = ClampToEdgeWrapping; - this.generateMipmaps = false; - this.flipY = false; - this.needsUpdate = true; + _this.magFilter = NearestFilter; + _this.minFilter = NearestFilter; + _this.wrapR = ClampToEdgeWrapping; + _this.generateMipmaps = false; + _this.flipY = false; + _this.needsUpdate = true; + return _this; } - } + return DataTexture3D; + }(Texture); DataTexture3D.prototype.isDataTexture3D = true; @@ -11657,26 +12386,26 @@ * like .set for an optional property of the object * */ - const emptyTexture = new Texture(); - const emptyTexture2dArray = new DataTexture2DArray(); - const emptyTexture3d = new DataTexture3D(); - const emptyCubeTexture = new CubeTexture(); // --- Utilities --- + var emptyTexture = new Texture(); + var emptyTexture2dArray = new DataTexture2DArray(); + var emptyTexture3d = new DataTexture3D(); + var emptyCubeTexture = new CubeTexture(); // --- Utilities --- // Array Caches (provide typed arrays for temporary by size) - const arrayCacheF32 = []; - const arrayCacheI32 = []; // Float32Array caches used for uploading Matrix uniforms + var arrayCacheF32 = []; + var 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 + var mat4array = new Float32Array(16); + var mat3array = new Float32Array(9); + var mat2array = new Float32Array(4); // Flattening for arrays of vectors and matrices function flatten(array, nBlocks, blockSize) { - const firstElem = array[0]; + var firstElem = array[0]; if (firstElem <= 0 || firstElem > 0) return array; // unoptimized: ! isNaN( firstElem ) // see http://jacksondunstan.com/articles/983 - const n = nBlocks * blockSize; - let r = arrayCacheF32[n]; + var n = nBlocks * blockSize; + var r = arrayCacheF32[n]; if (r === undefined) { r = new Float32Array(n); @@ -11686,7 +12415,7 @@ if (nBlocks !== 0) { firstElem.toArray(r, 0); - for (let i = 1, offset = 0; i !== nBlocks; ++i) { + for (var i = 1, offset = 0; i !== nBlocks; ++i) { offset += blockSize; array[i].toArray(r, offset); } @@ -11698,7 +12427,7 @@ function arraysEqual(a, b) { if (a.length !== b.length) return false; - for (let i = 0, l = a.length; i < l; i++) { + for (var i = 0, l = a.length; i < l; i++) { if (a[i] !== b[i]) return false; } @@ -11706,21 +12435,21 @@ } function copyArray(a, b) { - for (let i = 0, l = b.length; i < l; i++) { + for (var i = 0, l = b.length; i < l; i++) { a[i] = b[i]; } } // Texture unit allocation function allocTexUnits(textures, n) { - let r = arrayCacheI32[n]; + var r = arrayCacheI32[n]; if (r === undefined) { r = new Int32Array(n); arrayCacheI32[n] = r; } - for (let i = 0; i !== n; ++i) { + for (var i = 0; i !== n; ++i) { r[i] = textures.allocateTextureUnit(); } @@ -11732,7 +12461,7 @@ function setValueV1f(gl, v) { - const cache = this.cache; + var cache = this.cache; if (cache[0] === v) return; gl.uniform1f(this.addr, v); cache[0] = v; @@ -11740,7 +12469,7 @@ function setValueV2f(gl, v) { - const cache = this.cache; + var cache = this.cache; if (v.x !== undefined) { if (cache[0] !== v.x || cache[1] !== v.y) { @@ -11756,7 +12485,7 @@ } function setValueV3f(gl, v) { - const cache = this.cache; + var cache = this.cache; if (v.x !== undefined) { if (cache[0] !== v.x || cache[1] !== v.y || cache[2] !== v.z) { @@ -11780,7 +12509,7 @@ } function setValueV4f(gl, v) { - const cache = this.cache; + var cache = this.cache; if (v.x !== undefined) { if (cache[0] !== v.x || cache[1] !== v.y || cache[2] !== v.z || cache[3] !== v.w) { @@ -11799,8 +12528,8 @@ function setValueM2(gl, v) { - const cache = this.cache; - const elements = v.elements; + var cache = this.cache; + var elements = v.elements; if (elements === undefined) { if (arraysEqual(cache, v)) return; @@ -11815,8 +12544,8 @@ } function setValueM3(gl, v) { - const cache = this.cache; - const elements = v.elements; + var cache = this.cache; + var elements = v.elements; if (elements === undefined) { if (arraysEqual(cache, v)) return; @@ -11831,8 +12560,8 @@ } function setValueM4(gl, v) { - const cache = this.cache; - const elements = v.elements; + var cache = this.cache; + var elements = v.elements; if (elements === undefined) { if (arraysEqual(cache, v)) return; @@ -11848,8 +12577,8 @@ function setValueT1(gl, v, textures) { - const cache = this.cache; - const unit = textures.allocateTextureUnit(); + var cache = this.cache; + var unit = textures.allocateTextureUnit(); if (cache[0] !== unit) { gl.uniform1i(this.addr, unit); @@ -11860,8 +12589,8 @@ } function setValueT2DArray1(gl, v, textures) { - const cache = this.cache; - const unit = textures.allocateTextureUnit(); + var cache = this.cache; + var unit = textures.allocateTextureUnit(); if (cache[0] !== unit) { gl.uniform1i(this.addr, unit); @@ -11872,8 +12601,8 @@ } function setValueT3D1(gl, v, textures) { - const cache = this.cache; - const unit = textures.allocateTextureUnit(); + var cache = this.cache; + var unit = textures.allocateTextureUnit(); if (cache[0] !== unit) { gl.uniform1i(this.addr, unit); @@ -11884,8 +12613,8 @@ } function setValueT6(gl, v, textures) { - const cache = this.cache; - const unit = textures.allocateTextureUnit(); + var cache = this.cache; + var unit = textures.allocateTextureUnit(); if (cache[0] !== unit) { gl.uniform1i(this.addr, unit); @@ -11897,28 +12626,28 @@ function setValueV1i(gl, v) { - const cache = this.cache; + var cache = this.cache; if (cache[0] === v) return; gl.uniform1i(this.addr, v); cache[0] = v; } function setValueV2i(gl, v) { - const cache = this.cache; + var cache = this.cache; if (arraysEqual(cache, v)) return; gl.uniform2iv(this.addr, v); copyArray(cache, v); } function setValueV3i(gl, v) { - const cache = this.cache; + var cache = this.cache; if (arraysEqual(cache, v)) return; gl.uniform3iv(this.addr, v); copyArray(cache, v); } function setValueV4i(gl, v) { - const cache = this.cache; + var cache = this.cache; if (arraysEqual(cache, v)) return; gl.uniform4iv(this.addr, v); copyArray(cache, v); @@ -11926,7 +12655,7 @@ function setValueV1ui(gl, v) { - const cache = this.cache; + var cache = this.cache; if (cache[0] === v) return; gl.uniform1ui(this.addr, v); cache[0] = v; @@ -12053,53 +12782,53 @@ function setValueV2fArray(gl, v) { - const data = flatten(v, this.size, 2); + var data = flatten(v, this.size, 2); gl.uniform2fv(this.addr, data); } function setValueV3fArray(gl, v) { - const data = flatten(v, this.size, 3); + var data = flatten(v, this.size, 3); gl.uniform3fv(this.addr, data); } function setValueV4fArray(gl, v) { - const data = flatten(v, this.size, 4); + var data = flatten(v, this.size, 4); gl.uniform4fv(this.addr, data); } // Array of matrices (flat or from THREE clases) function setValueM2Array(gl, v) { - const data = flatten(v, this.size, 4); + var data = flatten(v, this.size, 4); gl.uniformMatrix2fv(this.addr, false, data); } function setValueM3Array(gl, v) { - const data = flatten(v, this.size, 9); + var data = flatten(v, this.size, 9); gl.uniformMatrix3fv(this.addr, false, data); } function setValueM4Array(gl, v) { - const data = flatten(v, this.size, 16); + var data = flatten(v, this.size, 16); gl.uniformMatrix4fv(this.addr, false, data); } // Array of textures (2D / Cube) function setValueT1Array(gl, v, textures) { - const n = v.length; - const units = allocTexUnits(textures, n); + var n = v.length; + var units = allocTexUnits(textures, n); gl.uniform1iv(this.addr, units); - for (let i = 0; i !== n; ++i) { + for (var i = 0; i !== n; ++i) { textures.safeSetTexture2D(v[i] || emptyTexture, units[i]); } } function setValueT6Array(gl, v, textures) { - const n = v.length; - const units = allocTexUnits(textures, n); + var n = v.length; + var units = allocTexUnits(textures, n); gl.uniform1iv(this.addr, units); - for (let i = 0; i !== n; ++i) { + for (var i = 0; i !== n; ++i) { textures.safeSetTextureCube(v[i] || emptyCubeTexture, units[i]); } } // Helper to pick the right setter for a pure (bottom-level) array @@ -12196,7 +12925,7 @@ } PureArrayUniform.prototype.updateCache = function (data) { - const cache = this.cache; + var cache = this.cache; if (data instanceof Float32Array && cache.length !== data.length) { this.cache = new Float32Array(data.length); @@ -12212,17 +12941,17 @@ } StructuredUniform.prototype.setValue = function (gl, value, textures) { - const seq = this.seq; + var seq = this.seq; - for (let i = 0, n = seq.length; i !== n; ++i) { - const u = seq[i]; + for (var i = 0, n = seq.length; i !== n; ++i) { + var u = seq[i]; u.setValue(gl, value[u.id], textures); } }; // --- Top-level --- // Parser - builds up the property tree from the path strings - const RePathPart = /(\w+)(\])?(\[|\.)?/g; // extracts + var RePathPart = /(\w+)(\])?(\[|\.)?/g; // 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) @@ -12237,17 +12966,17 @@ } function parseUniform(activeInfo, addr, container) { - const path = activeInfo.name, - pathLength = path.length; // reset RegExp object, because of the early exit of a previous run + var path = activeInfo.name, + 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; - let id = match[1]; - const idIsIndex = match[2] === ']', - subscript = match[3]; + var match = RePathPart.exec(path), + matchEnd = RePathPart.lastIndex; + var id = match[1]; + var idIsIndex = match[2] === ']', + subscript = match[3]; if (idIsIndex) id = id | 0; // convert to integer if (subscript === undefined || subscript === '[' && matchEnd + 2 === pathLength) { @@ -12256,8 +12985,8 @@ break; } else { // step into inner node / create it in case it doesn't exist - const map = container.map; - let next = map[id]; + var map = container.map; + var next = map[id]; if (next === undefined) { next = new StructuredUniform(id); @@ -12273,30 +13002,30 @@ function WebGLUniforms(gl, program) { this.seq = []; this.map = {}; - const n = gl.getProgramParameter(program, 35718); + var n = gl.getProgramParameter(program, 35718); - for (let i = 0; i < n; ++i) { - const info = gl.getActiveUniform(program, i), - addr = gl.getUniformLocation(program, info.name); + for (var i = 0; i < n; ++i) { + var info = gl.getActiveUniform(program, i), + addr = gl.getUniformLocation(program, info.name); parseUniform(info, addr, this); } } WebGLUniforms.prototype.setValue = function (gl, name, value, textures) { - const u = this.map[name]; + var u = this.map[name]; if (u !== undefined) u.setValue(gl, value, textures); }; WebGLUniforms.prototype.setOptional = function (gl, object, name) { - const v = object[name]; + var v = object[name]; if (v !== undefined) this.setValue(gl, name, v); }; // 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]; + for (var i = 0, n = seq.length; i !== n; ++i) { + var u = seq[i], + v = values[u.id]; if (v.needsUpdate !== false) { // note: always updating when .needsUpdate is undefined @@ -12306,10 +13035,10 @@ }; WebGLUniforms.seqWithValue = function (seq, values) { - const r = []; + var r = []; - for (let i = 0, n = seq.length; i !== n; ++i) { - const u = seq[i]; + for (var i = 0, n = seq.length; i !== n; ++i) { + var u = seq[i]; if (u.id in values) r.push(u); } @@ -12317,18 +13046,18 @@ }; function WebGLShader(gl, type, string) { - const shader = gl.createShader(type); + var shader = gl.createShader(type); gl.shaderSource(shader, string); gl.compileShader(shader); return shader; } - let programIdCount = 0; + var programIdCount = 0; function addLineNumbers(string) { - const lines = string.split('\n'); + var lines = string.split('\n'); - for (let i = 0; i < lines.length; i++) { + for (var i = 0; i < lines.length; i++) { lines[i] = i + 1 + ': ' + lines[i]; } @@ -12368,27 +13097,27 @@ } function getShaderErrors(gl, shader, type) { - const status = gl.getShaderParameter(shader, 35713); - const log = gl.getShaderInfoLog(shader).trim(); + var status = gl.getShaderParameter(shader, 35713); + var log = gl.getShaderInfoLog(shader).trim(); if (status && log === '') return ''; // --enable-privileged-webgl-extension // console.log( '**' + type + '**', gl.getExtension( 'WEBGL_debug_shaders' ).getTranslatedShaderSource( shader ) ); - const source = gl.getShaderSource(shader); + var source = gl.getShaderSource(shader); return 'THREE.WebGLShader: gl.getShaderInfoLog() ' + type + '\n' + log + addLineNumbers(source); } function getTexelDecodingFunction(functionName, encoding) { - const components = getEncodingComponents(encoding); + var components = getEncodingComponents(encoding); return 'vec4 ' + functionName + '( vec4 value ) { return ' + components[0] + 'ToLinear' + components[1] + '; }'; } function getTexelEncodingFunction(functionName, encoding) { - const components = getEncodingComponents(encoding); + var components = getEncodingComponents(encoding); return 'vec4 ' + functionName + '( vec4 value ) { return LinearTo' + components[0] + components[1] + '; }'; } function getToneMappingFunction(functionName, toneMapping) { - let toneMappingName; + var toneMappingName; switch (toneMapping) { case LinearToneMapping: @@ -12420,15 +13149,15 @@ } 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.rendererExtensionShaderTextureLod ? '#extension GL_EXT_shader_texture_lod : enable' : '']; + var 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.rendererExtensionShaderTextureLod ? '#extension GL_EXT_shader_texture_lod : enable' : '']; return chunks.filter(filterEmptyLine).join('\n'); } function generateDefines(defines) { - const chunks = []; + var chunks = []; - for (const name in defines) { - const value = defines[name]; + for (var name in defines) { + var value = defines[name]; if (value === false) continue; chunks.push('#define ' + name + ' ' + value); } @@ -12437,12 +13166,12 @@ } function fetchAttributeLocations(gl, program) { - const attributes = {}; - const n = gl.getProgramParameter(program, 35721); + var attributes = {}; + var n = gl.getProgramParameter(program, 35721); - for (let i = 0; i < n; i++) { - const info = gl.getActiveAttrib(program, i); - const name = info.name; // console.log( 'THREE.WebGLProgram: ACTIVE VERTEX ATTRIBUTE:', name, i ); + for (var i = 0; i < n; i++) { + var info = gl.getActiveAttrib(program, i); + var name = info.name; // console.log( 'THREE.WebGLProgram: ACTIVE VERTEX ATTRIBUTE:', name, i ); attributes[name] = gl.getAttribLocation(program, name); } @@ -12463,14 +13192,14 @@ } // Resolve Includes - const includePattern = /^[ \t]*#include +<([\w\d./]+)>/gm; + var includePattern = /^[ \t]*#include +<([\w\d./]+)>/gm; function resolveIncludes(string) { return string.replace(includePattern, includeReplacer); } function includeReplacer(match, include) { - const string = ShaderChunk[include]; + var string = ShaderChunk[include]; if (string === undefined) { throw new Error('Can not resolve #include <' + include + '>'); @@ -12480,8 +13209,8 @@ } // 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; + var deprecatedUnrollLoopPattern = /#pragma unroll_loop[\s]+?for \( int i \= (\d+)\; i < (\d+)\; i \+\+ \) \{([\s\S]+?)(?=\})\}/g; + var 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); @@ -12493,9 +13222,9 @@ } function loopReplacer(match, start, end, snippet) { - let string = ''; + var string = ''; - for (let i = parseInt(start); i < parseInt(end); i++) { + for (var i = parseInt(start); i < parseInt(end); i++) { string += snippet.replace(/\[\s*i\s*\]/g, '[ ' + i + ' ]').replace(/UNROLLED_LOOP_INDEX/g, i); } @@ -12504,7 +13233,7 @@ function generatePrecision(parameters) { - let precisionstring = 'precision ' + parameters.precision + ' float;\nprecision ' + parameters.precision + ' int;'; + var precisionstring = 'precision ' + parameters.precision + ' float;\nprecision ' + parameters.precision + ' int;'; if (parameters.precision === 'highp') { precisionstring += '\n#define HIGH_PRECISION'; @@ -12518,7 +13247,7 @@ } function generateShadowMapTypeDefine(parameters) { - let shadowMapTypeDefine = 'SHADOWMAP_TYPE_BASIC'; + var shadowMapTypeDefine = 'SHADOWMAP_TYPE_BASIC'; if (parameters.shadowMapType === PCFShadowMap) { shadowMapTypeDefine = 'SHADOWMAP_TYPE_PCF'; @@ -12532,7 +13261,7 @@ } function generateEnvMapTypeDefine(parameters) { - let envMapTypeDefine = 'ENVMAP_TYPE_CUBE'; + var envMapTypeDefine = 'ENVMAP_TYPE_CUBE'; if (parameters.envMap) { switch (parameters.envMapMode) { @@ -12552,7 +13281,7 @@ } function generateEnvMapModeDefine(parameters) { - let envMapModeDefine = 'ENVMAP_MODE_REFLECTION'; + var envMapModeDefine = 'ENVMAP_MODE_REFLECTION'; if (parameters.envMap) { switch (parameters.envMapMode) { @@ -12567,7 +13296,7 @@ } function generateEnvMapBlendingDefine(parameters) { - let envMapBlendingDefine = 'ENVMAP_BLENDING_NONE'; + var envMapBlendingDefine = 'ENVMAP_BLENDING_NONE'; if (parameters.envMap) { switch (parameters.combine) { @@ -12589,20 +13318,20 @@ } function WebGLProgram(renderer, cacheKey, parameters, bindingStates) { - const gl = renderer.getContext(); - const defines = parameters.defines; - let vertexShader = parameters.vertexShader; - let fragmentShader = parameters.fragmentShader; - const shadowMapTypeDefine = generateShadowMapTypeDefine(parameters); - const envMapTypeDefine = generateEnvMapTypeDefine(parameters); - const envMapModeDefine = generateEnvMapModeDefine(parameters); - const envMapBlendingDefine = generateEnvMapBlendingDefine(parameters); - const gammaFactorDefine = renderer.gammaFactor > 0 ? renderer.gammaFactor : 1.0; - const customExtensions = parameters.isWebGL2 ? '' : generateExtensions(parameters); - const customDefines = generateDefines(defines); - const program = gl.createProgram(); - let prefixVertex, prefixFragment; - let versionString = parameters.glslVersion ? '#version ' + parameters.glslVersion + '\n' : ''; + var gl = renderer.getContext(); + var defines = parameters.defines; + var vertexShader = parameters.vertexShader; + var fragmentShader = parameters.fragmentShader; + var shadowMapTypeDefine = generateShadowMapTypeDefine(parameters); + var envMapTypeDefine = generateEnvMapTypeDefine(parameters); + var envMapModeDefine = generateEnvMapModeDefine(parameters); + var envMapBlendingDefine = generateEnvMapBlendingDefine(parameters); + var gammaFactorDefine = renderer.gammaFactor > 0 ? renderer.gammaFactor : 1.0; + var customExtensions = parameters.isWebGL2 ? '' : generateExtensions(parameters); + var customDefines = generateDefines(defines); + var program = gl.createProgram(); + var prefixVertex, prefixFragment; + var versionString = parameters.glslVersion ? '#version ' + parameters.glslVersion + '\n' : ''; if (parameters.isRawShaderMaterial) { prefixVertex = [customDefines].filter(filterEmptyLine).join('\n'); @@ -12640,12 +13369,12 @@ prefixFragment = ['#define varying in', parameters.glslVersion === GLSL3 ? '' : '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 ); + var vertexGlsl = versionString + prefixVertex + vertexShader; + var fragmentGlsl = versionString + prefixFragment + fragmentShader; // console.log( '*VERTEX*', vertexGlsl ); // console.log( '*FRAGMENT*', fragmentGlsl ); - const glVertexShader = WebGLShader(gl, 35633, vertexGlsl); - const glFragmentShader = WebGLShader(gl, 35632, fragmentGlsl); + var glVertexShader = WebGLShader(gl, 35633, vertexGlsl); + var glFragmentShader = WebGLShader(gl, 35632, fragmentGlsl); gl.attachShader(program, glVertexShader); gl.attachShader(program, glFragmentShader); // Force a particular attribute to index 0. @@ -12659,16 +13388,16 @@ gl.linkProgram(program); // 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; + var programLog = gl.getProgramInfoLog(program).trim(); + var vertexLog = gl.getShaderInfoLog(glVertexShader).trim(); + var fragmentLog = gl.getShaderInfoLog(glFragmentShader).trim(); + var runnable = true; + var haveDiagnostics = true; if (gl.getProgramParameter(program, 35714) === false) { runnable = false; - const vertexErrors = getShaderErrors(gl, glVertexShader, 'vertex'); - const fragmentErrors = getShaderErrors(gl, glFragmentShader, 'fragment'); + var vertexErrors = getShaderErrors(gl, glVertexShader, 'vertex'); + var fragmentErrors = getShaderErrors(gl, glFragmentShader, 'fragment'); console.error('THREE.WebGLProgram: shader error: ', gl.getError(), '35715', gl.getProgramParameter(program, 35715), 'gl.getProgramInfoLog', programLog, vertexErrors, fragmentErrors); } else if (programLog !== '') { console.warn('THREE.WebGLProgram: gl.getProgramInfoLog()', programLog); @@ -12699,7 +13428,7 @@ gl.deleteShader(glVertexShader); gl.deleteShader(glFragmentShader); // set up caching for uniform locations - let cachedUniforms; + var cachedUniforms; this.getUniforms = function () { if (cachedUniforms === undefined) { @@ -12710,7 +13439,7 @@ }; // set up caching for attribute locations - let cachedAttributes; + var cachedAttributes; this.getAttributes = function () { if (cachedAttributes === undefined) { @@ -12739,14 +13468,14 @@ } function WebGLPrograms(renderer, cubemaps, extensions, capabilities, bindingStates, clipping) { - const programs = []; - const isWebGL2 = capabilities.isWebGL2; - const logarithmicDepthBuffer = capabilities.logarithmicDepthBuffer; - const floatVertexTextures = capabilities.floatVertexTextures; - const maxVertexUniforms = capabilities.maxVertexUniforms; - const vertexTextures = capabilities.vertexTextures; - let precision = capabilities.precision; - const shaderIDs = { + var programs = []; + var isWebGL2 = capabilities.isWebGL2; + var logarithmicDepthBuffer = capabilities.logarithmicDepthBuffer; + var floatVertexTextures = capabilities.floatVertexTextures; + var maxVertexUniforms = capabilities.maxVertexUniforms; + var vertexTextures = capabilities.vertexTextures; + var precision = capabilities.precision; + var shaderIDs = { MeshDepthMaterial: 'depth', MeshDistanceMaterial: 'distanceRGBA', MeshNormalMaterial: 'normal', @@ -12763,11 +13492,11 @@ ShadowMaterial: 'shadow', SpriteMaterial: 'sprite' }; - const parameterNames = ['precision', 'isWebGL2', 'supportsVertexTextures', 'outputEncoding', 'instancing', 'instancingColor', 'map', 'mapEncoding', 'matcap', 'matcapEncoding', 'envMap', 'envMapMode', 'envMapEncoding', 'envMapCubeUV', 'lightMap', 'lightMapEncoding', 'aoMap', 'emissiveMap', 'emissiveMapEncoding', 'bumpMap', 'normalMap', 'objectSpaceNormalMap', 'tangentSpaceNormalMap', 'clearcoatMap', 'clearcoatRoughnessMap', 'clearcoatNormalMap', 'displacementMap', 'specularMap', 'roughnessMap', 'metalnessMap', 'gradientMap', 'alphaMap', 'combine', 'vertexColors', 'vertexTangents', 'vertexUvs', 'uvsVertexOnly', 'fog', 'useFog', 'fogExp2', 'flatShading', 'sizeAttenuation', 'logarithmicDepthBuffer', 'skinning', 'maxBones', 'useVertexTexture', 'morphTargets', 'morphNormals', 'maxMorphTargets', 'maxMorphNormals', 'premultipliedAlpha', 'numDirLights', 'numPointLights', 'numSpotLights', 'numHemiLights', 'numRectAreaLights', 'numDirLightShadows', 'numPointLightShadows', 'numSpotLightShadows', 'shadowMapEnabled', 'shadowMapType', 'toneMapping', 'physicallyCorrectLights', 'alphaTest', 'doubleSided', 'flipSided', 'numClippingPlanes', 'numClipIntersection', 'depthPacking', 'dithering', 'sheen', 'transmissionMap']; + var parameterNames = ['precision', 'isWebGL2', 'supportsVertexTextures', 'outputEncoding', 'instancing', 'instancingColor', 'map', 'mapEncoding', 'matcap', 'matcapEncoding', 'envMap', 'envMapMode', 'envMapEncoding', 'envMapCubeUV', 'lightMap', 'lightMapEncoding', 'aoMap', 'emissiveMap', 'emissiveMapEncoding', 'bumpMap', 'normalMap', 'objectSpaceNormalMap', 'tangentSpaceNormalMap', 'clearcoatMap', 'clearcoatRoughnessMap', 'clearcoatNormalMap', 'displacementMap', 'specularMap', 'roughnessMap', 'metalnessMap', 'gradientMap', 'alphaMap', 'combine', 'vertexColors', 'vertexTangents', 'vertexUvs', 'uvsVertexOnly', 'fog', 'useFog', 'fogExp2', 'flatShading', 'sizeAttenuation', 'logarithmicDepthBuffer', 'skinning', 'maxBones', 'useVertexTexture', 'morphTargets', 'morphNormals', 'maxMorphTargets', 'maxMorphNormals', 'premultipliedAlpha', 'numDirLights', 'numPointLights', 'numSpotLights', 'numHemiLights', 'numRectAreaLights', 'numDirLightShadows', 'numPointLightShadows', 'numSpotLightShadows', 'shadowMapEnabled', 'shadowMapType', 'toneMapping', 'physicallyCorrectLights', 'alphaTest', 'doubleSided', 'flipSided', 'numClippingPlanes', 'numClipIntersection', 'depthPacking', 'dithering', 'sheen', 'transmissionMap']; function getMaxBones(object) { - const skeleton = object.skeleton; - const bones = skeleton.bones; + var skeleton = object.skeleton; + var bones = skeleton.bones; if (floatVertexTextures) { return 1024; @@ -12778,9 +13507,9 @@ // - 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); + var nVertexUniforms = maxVertexUniforms; + var nVertexMatrices = Math.floor((nVertexUniforms - 20) / 4); + var maxBones = Math.min(nVertexMatrices, bones.length); if (maxBones < bones.length) { console.warn('THREE.WebGLRenderer: Skeleton has ' + bones.length + ' bones. This GPU supports ' + maxBones + '.'); @@ -12792,7 +13521,7 @@ } function getTextureEncodingFromMap(map) { - let encoding; + var encoding; if (map && map.isTexture) { encoding = map.encoding; @@ -12807,13 +13536,13 @@ } function getParameters(material, lights, shadows, scene, object) { - const fog = scene.fog; - const environment = material.isMeshStandardMaterial ? scene.environment : null; - const envMap = cubemaps.get(material.envMap || environment); - const shaderID = shaderIDs[material.type]; // heuristics to create shader parameters according to lights in the scene + var fog = scene.fog; + var environment = material.isMeshStandardMaterial ? scene.environment : null; + var envMap = cubemaps.get(material.envMap || environment); + var 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; + var maxBones = object.isSkinnedMesh ? getMaxBones(object) : 0; if (material.precision !== null) { precision = capabilities.getMaxPrecision(material.precision); @@ -12823,10 +13552,10 @@ } } - let vertexShader, fragmentShader; + var vertexShader, fragmentShader; if (shaderID) { - const shader = ShaderLib[shaderID]; + var shader = ShaderLib[shaderID]; vertexShader = shader.vertexShader; fragmentShader = shader.fragmentShader; } else { @@ -12834,8 +13563,8 @@ fragmentShader = material.fragmentShader; } - const currentRenderTarget = renderer.getRenderTarget(); - const parameters = { + var currentRenderTarget = renderer.getRenderTarget(); + var parameters = { isWebGL2: isWebGL2, shaderID: shaderID, shaderName: material.type, @@ -12929,7 +13658,7 @@ } function getProgramCacheKey(parameters) { - const array = []; + var array = []; if (parameters.shaderID) { array.push(parameters.shaderID); @@ -12939,14 +13668,14 @@ } if (parameters.defines !== undefined) { - for (const name in parameters.defines) { + for (var name in parameters.defines) { array.push(name); array.push(parameters.defines[name]); } } if (parameters.isRawShaderMaterial === false) { - for (let i = 0; i < parameterNames.length; i++) { + for (var i = 0; i < parameterNames.length; i++) { array.push(parameters[parameterNames[i]]); } @@ -12959,11 +13688,11 @@ } function getUniforms(material) { - const shaderID = shaderIDs[material.type]; - let uniforms; + var shaderID = shaderIDs[material.type]; + var uniforms; if (shaderID) { - const shader = ShaderLib[shaderID]; + var shader = ShaderLib[shaderID]; uniforms = UniformsUtils.clone(shader.uniforms); } else { uniforms = material.uniforms; @@ -12973,10 +13702,10 @@ } function acquireProgram(parameters, cacheKey) { - let program; // Check if code has been already compiled + var program; // Check if code has been already compiled - for (let p = 0, pl = programs.length; p < pl; p++) { - const preexistingProgram = programs[p]; + for (var p = 0, pl = programs.length; p < pl; p++) { + var preexistingProgram = programs[p]; if (preexistingProgram.cacheKey === cacheKey) { program = preexistingProgram; @@ -12996,7 +13725,7 @@ function releaseProgram(program) { if (--program.usedTimes === 0) { // Remove from unordered set - const i = programs.indexOf(program); + var i = programs.indexOf(program); programs[i] = programs[programs.length - 1]; programs.pop(); // Free WebGL resources @@ -13016,10 +13745,10 @@ } function WebGLProperties() { - let properties = new WeakMap(); + var properties = new WeakMap(); function get(object) { - let map = properties.get(object); + var map = properties.get(object); if (map === undefined) { map = {}; @@ -13078,11 +13807,11 @@ } function WebGLRenderList(properties) { - const renderItems = []; - let renderItemsIndex = 0; - const opaque = []; - const transparent = []; - const defaultProgram = { + var renderItems = []; + var renderItemsIndex = 0; + var opaque = []; + var transparent = []; + var defaultProgram = { id: -1 }; @@ -13093,8 +13822,8 @@ } function getNextRenderItem(object, geometry, material, groupOrder, z, group) { - let renderItem = renderItems[renderItemsIndex]; - const materialProperties = properties.get(material); + var renderItem = renderItems[renderItemsIndex]; + var materialProperties = properties.get(material); if (renderItem === undefined) { renderItem = { @@ -13126,12 +13855,12 @@ } function push(object, geometry, material, groupOrder, z, group) { - const renderItem = getNextRenderItem(object, geometry, material, groupOrder, z, group); + var renderItem = getNextRenderItem(object, geometry, material, groupOrder, z, group); (material.transparent === true ? transparent : opaque).push(renderItem); } function unshift(object, geometry, material, groupOrder, z, group) { - const renderItem = getNextRenderItem(object, geometry, material, groupOrder, z, group); + var renderItem = getNextRenderItem(object, geometry, material, groupOrder, z, group); (material.transparent === true ? transparent : opaque).unshift(renderItem); } @@ -13142,8 +13871,8 @@ function finish() { // Clear references from inactive renderItems in the list - for (let i = renderItemsIndex, il = renderItems.length; i < il; i++) { - const renderItem = renderItems[i]; + for (var i = renderItemsIndex, il = renderItems.length; i < il; i++) { + var renderItem = renderItems[i]; if (renderItem.id === null) break; renderItem.id = null; renderItem.object = null; @@ -13166,10 +13895,10 @@ } function WebGLRenderLists(properties) { - let lists = new WeakMap(); + var lists = new WeakMap(); function get(scene, renderCallDepth) { - let list; + var list; if (lists.has(scene) === false) { list = new WebGLRenderList(properties); @@ -13197,14 +13926,14 @@ } function UniformsCache() { - const lights = {}; + var lights = {}; return { - get: function (light) { + get: function get(light) { if (lights[light.id] !== undefined) { return lights[light.id]; } - let uniforms; + var uniforms; switch (light.type) { case 'DirectionalLight': @@ -13260,14 +13989,14 @@ } function ShadowUniformsCache() { - const lights = {}; + var lights = {}; return { - get: function (light) { + get: function get(light) { if (lights[light.id] !== undefined) { return lights[light.id]; } - let uniforms; + var uniforms; switch (light.type) { case 'DirectionalLight': @@ -13307,16 +14036,16 @@ }; } - let nextVersion = 0; + var 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(); - const state = { + var cache = new UniformsCache(); + var shadowCache = ShadowUniformsCache(); + var state = { version: 0, hash: { directionalLength: -1, @@ -13348,51 +14077,55 @@ hemi: [] }; - for (let i = 0; i < 9; i++) state.probe.push(new Vector3()); + for (var i = 0; i < 9; i++) { + state.probe.push(new Vector3()); + } - const vector3 = new Vector3(); - const matrix4 = new Matrix4(); - const matrix42 = new Matrix4(); + var vector3 = new Vector3(); + var matrix4 = new Matrix4(); + var matrix42 = new Matrix4(); function setup(lights) { - let r = 0, + var r = 0, g = 0, b = 0; - for (let i = 0; i < 9; i++) state.probe[i].set(0, 0, 0); + for (var _i = 0; _i < 9; _i++) { + state.probe[_i].set(0, 0, 0); + } - let directionalLength = 0; - let pointLength = 0; - let spotLength = 0; - let rectAreaLength = 0; - let hemiLength = 0; - let numDirectionalShadows = 0; - let numPointShadows = 0; - let numSpotShadows = 0; + var directionalLength = 0; + var pointLength = 0; + var spotLength = 0; + var rectAreaLength = 0; + var hemiLength = 0; + var numDirectionalShadows = 0; + var numPointShadows = 0; + var numSpotShadows = 0; lights.sort(shadowCastingLightsFirst); - 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; + for (var _i2 = 0, l = lights.length; _i2 < l; _i2++) { + var light = lights[_i2]; + var color = light.color; + var intensity = light.intensity; + var distance = light.distance; + var shadowMap = light.shadow && light.shadow.map ? light.shadow.map.texture : null; if (light.isAmbientLight) { r += color.r * intensity; g += color.g * intensity; b += color.b * intensity; } else if (light.isLightProbe) { - for (let j = 0; j < 9; j++) { + for (var j = 0; j < 9; j++) { state.probe[j].addScaledVector(light.sh.coefficients[j], intensity); } } else if (light.isDirectionalLight) { - const uniforms = cache.get(light); + var uniforms = cache.get(light); uniforms.color.copy(light.color).multiplyScalar(light.intensity); if (light.castShadow) { - const shadow = light.shadow; - const shadowUniforms = shadowCache.get(light); + var shadow = light.shadow; + var shadowUniforms = shadowCache.get(light); shadowUniforms.shadowBias = shadow.bias; shadowUniforms.shadowNormalBias = shadow.normalBias; shadowUniforms.shadowRadius = shadow.radius; @@ -13406,67 +14139,83 @@ state.directional[directionalLength] = uniforms; directionalLength++; } else if (light.isSpotLight) { - const uniforms = cache.get(light); - uniforms.position.setFromMatrixPosition(light.matrixWorld); - uniforms.color.copy(color).multiplyScalar(intensity); - uniforms.distance = distance; - uniforms.coneCos = Math.cos(light.angle); - uniforms.penumbraCos = Math.cos(light.angle * (1 - light.penumbra)); - uniforms.decay = light.decay; + var _uniforms = cache.get(light); + + _uniforms.position.setFromMatrixPosition(light.matrixWorld); + + _uniforms.color.copy(color).multiplyScalar(intensity); + + _uniforms.distance = distance; + _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); - shadowUniforms.shadowBias = shadow.bias; - shadowUniforms.shadowNormalBias = shadow.normalBias; - shadowUniforms.shadowRadius = shadow.radius; - shadowUniforms.shadowMapSize = shadow.mapSize; - state.spotShadow[spotLength] = shadowUniforms; + var _shadow = light.shadow; + + var _shadowUniforms = shadowCache.get(light); + + _shadowUniforms.shadowBias = _shadow.bias; + _shadowUniforms.shadowNormalBias = _shadow.normalBias; + _shadowUniforms.shadowRadius = _shadow.radius; + _shadowUniforms.shadowMapSize = _shadow.mapSize; + state.spotShadow[spotLength] = _shadowUniforms; state.spotShadowMap[spotLength] = shadowMap; state.spotShadowMatrix[spotLength] = light.shadow.matrix; numSpotShadows++; } - state.spot[spotLength] = uniforms; + state.spot[spotLength] = _uniforms; spotLength++; } else if (light.isRectAreaLight) { - const uniforms = cache.get(light); // (a) intensity is the total visible light emitted + var _uniforms2 = 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 - 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); - state.rectArea[rectAreaLength] = uniforms; + + _uniforms2.color.copy(color).multiplyScalar(intensity); + + _uniforms2.halfWidth.set(light.width * 0.5, 0.0, 0.0); + + _uniforms2.halfHeight.set(0.0, light.height * 0.5, 0.0); + + state.rectArea[rectAreaLength] = _uniforms2; rectAreaLength++; } else if (light.isPointLight) { - const uniforms = cache.get(light); - uniforms.color.copy(light.color).multiplyScalar(light.intensity); - uniforms.distance = light.distance; - uniforms.decay = light.decay; + var _uniforms3 = cache.get(light); + + _uniforms3.color.copy(light.color).multiplyScalar(light.intensity); + + _uniforms3.distance = light.distance; + _uniforms3.decay = light.decay; if (light.castShadow) { - const shadow = light.shadow; - const shadowUniforms = shadowCache.get(light); - shadowUniforms.shadowBias = shadow.bias; - shadowUniforms.shadowNormalBias = shadow.normalBias; - shadowUniforms.shadowRadius = shadow.radius; - shadowUniforms.shadowMapSize = shadow.mapSize; - shadowUniforms.shadowCameraNear = shadow.camera.near; - shadowUniforms.shadowCameraFar = shadow.camera.far; - state.pointShadow[pointLength] = shadowUniforms; + var _shadow2 = light.shadow; + + var _shadowUniforms2 = shadowCache.get(light); + + _shadowUniforms2.shadowBias = _shadow2.bias; + _shadowUniforms2.shadowNormalBias = _shadow2.normalBias; + _shadowUniforms2.shadowRadius = _shadow2.radius; + _shadowUniforms2.shadowMapSize = _shadow2.mapSize; + _shadowUniforms2.shadowCameraNear = _shadow2.camera.near; + _shadowUniforms2.shadowCameraFar = _shadow2.camera.far; + state.pointShadow[pointLength] = _shadowUniforms2; state.pointShadowMap[pointLength] = shadowMap; state.pointShadowMatrix[pointLength] = light.shadow.matrix; numPointShadows++; } - state.point[pointLength] = uniforms; + state.point[pointLength] = _uniforms3; pointLength++; } else if (light.isHemisphereLight) { - const uniforms = cache.get(light); - uniforms.skyColor.copy(light.color).multiplyScalar(intensity); - uniforms.groundColor.copy(light.groundColor).multiplyScalar(intensity); - state.hemi[hemiLength] = uniforms; + var _uniforms4 = cache.get(light); + + _uniforms4.skyColor.copy(light.color).multiplyScalar(intensity); + + _uniforms4.groundColor.copy(light.groundColor).multiplyScalar(intensity); + + state.hemi[hemiLength] = _uniforms4; hemiLength++; } } @@ -13493,7 +14242,7 @@ state.ambient[0] = r; state.ambient[1] = g; state.ambient[2] = b; - const hash = state.hash; + var 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; @@ -13523,56 +14272,78 @@ } function setupView(lights, camera) { - let directionalLength = 0; - let pointLength = 0; - let spotLength = 0; - let rectAreaLength = 0; - let hemiLength = 0; - const viewMatrix = camera.matrixWorldInverse; + var directionalLength = 0; + var pointLength = 0; + var spotLength = 0; + var rectAreaLength = 0; + var hemiLength = 0; + var viewMatrix = camera.matrixWorldInverse; - for (let i = 0, l = lights.length; i < l; i++) { - const light = lights[i]; + for (var _i3 = 0, l = lights.length; _i3 < l; _i3++) { + var light = lights[_i3]; if (light.isDirectionalLight) { - const uniforms = state.directional[directionalLength]; + var uniforms = state.directional[directionalLength]; uniforms.direction.setFromMatrixPosition(light.matrixWorld); vector3.setFromMatrixPosition(light.target.matrixWorld); uniforms.direction.sub(vector3); uniforms.direction.transformDirection(viewMatrix); directionalLength++; } else if (light.isSpotLight) { - const uniforms = state.spot[spotLength]; - uniforms.position.setFromMatrixPosition(light.matrixWorld); - uniforms.position.applyMatrix4(viewMatrix); - uniforms.direction.setFromMatrixPosition(light.matrixWorld); + var _uniforms5 = state.spot[spotLength]; + + _uniforms5.position.setFromMatrixPosition(light.matrixWorld); + + _uniforms5.position.applyMatrix4(viewMatrix); + + _uniforms5.direction.setFromMatrixPosition(light.matrixWorld); + vector3.setFromMatrixPosition(light.target.matrixWorld); - uniforms.direction.sub(vector3); - uniforms.direction.transformDirection(viewMatrix); + + _uniforms5.direction.sub(vector3); + + _uniforms5.direction.transformDirection(viewMatrix); + spotLength++; } 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 + var _uniforms6 = state.rectArea[rectAreaLength]; + + _uniforms6.position.setFromMatrixPosition(light.matrixWorld); + + _uniforms6.position.applyMatrix4(viewMatrix); // extract local rotation of light to derive width/height half vectors + matrix42.identity(); matrix4.copy(light.matrixWorld); matrix4.premultiply(viewMatrix); matrix42.extractRotation(matrix4); - uniforms.halfWidth.set(light.width * 0.5, 0.0, 0.0); - uniforms.halfHeight.set(0.0, light.height * 0.5, 0.0); - uniforms.halfWidth.applyMatrix4(matrix42); - uniforms.halfHeight.applyMatrix4(matrix42); + + _uniforms6.halfWidth.set(light.width * 0.5, 0.0, 0.0); + + _uniforms6.halfHeight.set(0.0, light.height * 0.5, 0.0); + + _uniforms6.halfWidth.applyMatrix4(matrix42); + + _uniforms6.halfHeight.applyMatrix4(matrix42); + rectAreaLength++; } else if (light.isPointLight) { - const uniforms = state.point[pointLength]; - uniforms.position.setFromMatrixPosition(light.matrixWorld); - uniforms.position.applyMatrix4(viewMatrix); + var _uniforms7 = state.point[pointLength]; + + _uniforms7.position.setFromMatrixPosition(light.matrixWorld); + + _uniforms7.position.applyMatrix4(viewMatrix); + pointLength++; } else if (light.isHemisphereLight) { - const uniforms = state.hemi[hemiLength]; - uniforms.direction.setFromMatrixPosition(light.matrixWorld); - uniforms.direction.transformDirection(viewMatrix); - uniforms.direction.normalize(); + var _uniforms8 = state.hemi[hemiLength]; + + _uniforms8.direction.setFromMatrixPosition(light.matrixWorld); + + _uniforms8.direction.transformDirection(viewMatrix); + + _uniforms8.direction.normalize(); + hemiLength++; } } @@ -13586,9 +14357,9 @@ } function WebGLRenderState(extensions, capabilities) { - const lights = new WebGLLights(extensions, capabilities); - const lightsArray = []; - const shadowsArray = []; + var lights = new WebGLLights(extensions, capabilities); + var lightsArray = []; + var shadowsArray = []; function init() { lightsArray.length = 0; @@ -13611,7 +14382,7 @@ lights.setupView(lightsArray, camera); } - const state = { + var state = { lightsArray: lightsArray, shadowsArray: shadowsArray, lights: lights @@ -13627,10 +14398,14 @@ } function WebGLRenderStates(extensions, capabilities) { - let renderStates = new WeakMap(); + var renderStates = new WeakMap(); + + function get(scene, renderCallDepth) { + if (renderCallDepth === void 0) { + renderCallDepth = 0; + } - function get(scene, renderCallDepth = 0) { - let renderState; + var renderState; if (renderStates.has(scene) === false) { renderState = new WebGLRenderState(extensions, capabilities); @@ -13675,26 +14450,36 @@ * } */ - class MeshDepthMaterial extends Material { - constructor(parameters) { - super(); - this.type = 'MeshDepthMaterial'; - this.depthPacking = BasicDepthPacking; - this.skinning = false; - this.morphTargets = false; - this.map = null; - this.alphaMap = null; - this.displacementMap = null; - this.displacementScale = 1; - this.displacementBias = 0; - this.wireframe = false; - this.wireframeLinewidth = 1; - this.fog = false; - this.setValues(parameters); + var MeshDepthMaterial = /*#__PURE__*/function (_Material) { + _inheritsLoose(MeshDepthMaterial, _Material); + + function MeshDepthMaterial(parameters) { + var _this; + + _this = _Material.call(this) || this; + _this.type = 'MeshDepthMaterial'; + _this.depthPacking = BasicDepthPacking; + _this.skinning = false; + _this.morphTargets = false; + _this.map = null; + _this.alphaMap = null; + _this.displacementMap = null; + _this.displacementScale = 1; + _this.displacementBias = 0; + _this.wireframe = false; + _this.wireframeLinewidth = 1; + _this.fog = false; + + _this.setValues(parameters); + + return _this; } - copy(source) { - super.copy(source); + var _proto = MeshDepthMaterial.prototype; + + _proto.copy = function copy(source) { + _Material.prototype.copy.call(this, source); + this.depthPacking = source.depthPacking; this.skinning = source.skinning; this.morphTargets = source.morphTargets; @@ -13706,9 +14491,10 @@ this.wireframe = source.wireframe; this.wireframeLinewidth = source.wireframeLinewidth; return this; - } + }; - } + return MeshDepthMaterial; + }(Material); MeshDepthMaterial.prototype.isMeshDepthMaterial = true; @@ -13733,26 +14519,36 @@ * } */ - class MeshDistanceMaterial extends Material { - constructor(parameters) { - super(); - this.type = 'MeshDistanceMaterial'; - this.referencePosition = new Vector3(); - this.nearDistance = 1; - this.farDistance = 1000; - this.skinning = false; - this.morphTargets = false; - this.map = null; - this.alphaMap = null; - this.displacementMap = null; - this.displacementScale = 1; - this.displacementBias = 0; - this.fog = false; - this.setValues(parameters); + var MeshDistanceMaterial = /*#__PURE__*/function (_Material) { + _inheritsLoose(MeshDistanceMaterial, _Material); + + function MeshDistanceMaterial(parameters) { + var _this; + + _this = _Material.call(this) || this; + _this.type = 'MeshDistanceMaterial'; + _this.referencePosition = new Vector3(); + _this.nearDistance = 1; + _this.farDistance = 1000; + _this.skinning = false; + _this.morphTargets = false; + _this.map = null; + _this.alphaMap = null; + _this.displacementMap = null; + _this.displacementScale = 1; + _this.displacementBias = 0; + _this.fog = false; + + _this.setValues(parameters); + + return _this; } - copy(source) { - super.copy(source); + var _proto = MeshDistanceMaterial.prototype; + + _proto.copy = function copy(source) { + _Material.prototype.copy.call(this, source); + this.referencePosition.copy(source.referencePosition); this.nearDistance = source.nearDistance; this.farDistance = source.farDistance; @@ -13764,9 +14560,10 @@ this.displacementScale = source.displacementScale; this.displacementBias = source.displacementBias; return this; - } + }; - } + return MeshDistanceMaterial; + }(Material); MeshDistanceMaterial.prototype.isMeshDistanceMaterial = true; @@ -13775,22 +14572,22 @@ var vsm_vert = "void main() {\n\tgl_Position = vec4( position, 1.0 );\n}"; function WebGLShadowMap(_renderer, _objects, _capabilities) { - let _frustum = new Frustum(); + var _frustum = new Frustum(); - const _shadowMapSize = new Vector2(), - _viewportSize = new Vector2(), - _viewport = new Vector4(), - _depthMaterials = [], - _distanceMaterials = [], - _materialCache = {}, - _maxTextureSize = _capabilities.maxTextureSize; + var _shadowMapSize = new Vector2(), + _viewportSize = new Vector2(), + _viewport = new Vector4(), + _depthMaterials = [], + _distanceMaterials = [], + _materialCache = {}, + _maxTextureSize = _capabilities.maxTextureSize; - const shadowSide = { + var shadowSide = { 0: BackSide, 1: FrontSide, 2: DoubleSide }; - const shadowMaterialVertical = new ShaderMaterial({ + var shadowMaterialVertical = new ShaderMaterial({ defines: { SAMPLE_RATE: 2.0 / 8.0, HALF_SAMPLE_RATE: 1.0 / 8.0 @@ -13809,12 +14606,12 @@ vertexShader: vsm_vert, fragmentShader: vsm_frag }); - const shadowMaterialHorizontal = shadowMaterialVertical.clone(); + var shadowMaterialHorizontal = shadowMaterialVertical.clone(); shadowMaterialHorizontal.defines.HORIZONTAL_PASS = 1; - const fullScreenTri = new BufferGeometry(); + var fullScreenTri = new BufferGeometry(); fullScreenTri.setAttribute('position', new BufferAttribute(new Float32Array([-1, -1, 0.5, 3, -1, 0.5, -1, 3, 0.5]), 3)); - const fullScreenMesh = new Mesh(fullScreenTri, shadowMaterialVertical); - const scope = this; + var fullScreenMesh = new Mesh(fullScreenTri, shadowMaterialVertical); + var scope = this; this.enabled = false; this.autoUpdate = true; this.needsUpdate = false; @@ -13825,13 +14622,13 @@ if (scope.autoUpdate === false && scope.needsUpdate === false) return; if (lights.length === 0) return; - const currentRenderTarget = _renderer.getRenderTarget(); + var currentRenderTarget = _renderer.getRenderTarget(); - const activeCubeFace = _renderer.getActiveCubeFace(); + var activeCubeFace = _renderer.getActiveCubeFace(); - const activeMipmapLevel = _renderer.getActiveMipmapLevel(); + var activeMipmapLevel = _renderer.getActiveMipmapLevel(); - const _state = _renderer.state; // Set GL state for depth map. + var _state = _renderer.state; // Set GL state for depth map. _state.setBlending(NoBlending); @@ -13842,9 +14639,9 @@ _state.setScissorTest(false); // render depth map - for (let i = 0, il = lights.length; i < il; i++) { - const light = lights[i]; - const shadow = light.shadow; + for (var i = 0, il = lights.length; i < il; i++) { + var light = lights[i]; + var shadow = light.shadow; if (shadow === undefined) { console.warn('THREE.WebGLShadowMap:', light, 'has no shadow.'); @@ -13855,7 +14652,7 @@ _shadowMapSize.copy(shadow.mapSize); - const shadowFrameExtents = shadow.getFrameExtents(); + var shadowFrameExtents = shadow.getFrameExtents(); _shadowMapSize.multiply(shadowFrameExtents); @@ -13876,7 +14673,7 @@ } if (shadow.map === null && !shadow.isPointLightShadow && this.type === VSMShadowMap) { - const pars = { + var pars = { minFilter: LinearFilter, magFilter: LinearFilter, format: RGBAFormat @@ -13888,12 +14685,12 @@ } if (shadow.map === null) { - const pars = { + var _pars = { minFilter: NearestFilter, magFilter: NearestFilter, format: RGBAFormat }; - shadow.map = new WebGLRenderTarget(_shadowMapSize.x, _shadowMapSize.y, pars); + shadow.map = new WebGLRenderTarget(_shadowMapSize.x, _shadowMapSize.y, _pars); shadow.map.texture.name = light.name + '.shadowMap'; shadow.camera.updateProjectionMatrix(); } @@ -13902,10 +14699,10 @@ _renderer.clear(); - const viewportCount = shadow.getViewportCount(); + var viewportCount = shadow.getViewportCount(); - for (let vp = 0; vp < viewportCount; vp++) { - const viewport = shadow.getViewport(vp); + for (var vp = 0; vp < viewportCount; vp++) { + var viewport = shadow.getViewport(vp); _viewport.set(_viewportSize.x * viewport.x, _viewportSize.y * viewport.y, _viewportSize.x * viewport.z, _viewportSize.y * viewport.w); @@ -13930,7 +14727,7 @@ }; function VSMPass(shadow, camera) { - const geometry = _objects.update(fullScreenMesh); // vertical pass + var geometry = _objects.update(fullScreenMesh); // vertical pass shadowMaterialVertical.uniforms.shadow_pass.value = shadow.map.texture; @@ -13956,8 +14753,8 @@ } function getDepthMaterialVariant(useMorphing, useSkinning, useInstancing) { - const index = useMorphing << 0 | useSkinning << 1 | useInstancing << 2; - let material = _depthMaterials[index]; + var index = useMorphing << 0 | useSkinning << 1 | useInstancing << 2; + var material = _depthMaterials[index]; if (material === undefined) { material = new MeshDepthMaterial({ @@ -13972,8 +14769,8 @@ } function getDistanceMaterialVariant(useMorphing, useSkinning, useInstancing) { - const index = useMorphing << 0 | useSkinning << 1 | useInstancing << 2; - let material = _distanceMaterials[index]; + var index = useMorphing << 0 | useSkinning << 1 | useInstancing << 2; + var material = _distanceMaterials[index]; if (material === undefined) { material = new MeshDistanceMaterial({ @@ -13987,9 +14784,9 @@ } function getDepthMaterial(object, geometry, material, light, shadowCameraNear, shadowCameraFar, type) { - let result = null; - let getMaterialVariant = getDepthMaterialVariant; - let customMaterial = object.customDepthMaterial; + var result = null; + var getMaterialVariant = getDepthMaterialVariant; + var customMaterial = object.customDepthMaterial; if (light.isPointLight === true) { getMaterialVariant = getDistanceMaterialVariant; @@ -13997,13 +14794,13 @@ } if (customMaterial === undefined) { - let useMorphing = false; + var useMorphing = false; if (material.morphTargets === true) { useMorphing = geometry.morphAttributes && geometry.morphAttributes.position && geometry.morphAttributes.position.length > 0; } - let useSkinning = false; + var useSkinning = false; if (object.isSkinnedMesh === true) { if (material.skinning === true) { @@ -14013,7 +14810,7 @@ } } - const useInstancing = object.isInstancedMesh === true; + var useInstancing = object.isInstancedMesh === true; result = getMaterialVariant(useMorphing, useSkinning, useInstancing); } else { result = customMaterial; @@ -14022,16 +14819,16 @@ if (_renderer.localClippingEnabled && material.clipShadows === true && material.clippingPlanes.length !== 0) { // in this case we need a unique material instance reflecting the // appropriate state - const keyA = result.uuid, - keyB = material.uuid; - let materialsForVariant = _materialCache[keyA]; + var keyA = result.uuid, + keyB = material.uuid; + var materialsForVariant = _materialCache[keyA]; if (materialsForVariant === undefined) { materialsForVariant = {}; _materialCache[keyA] = materialsForVariant; } - let cachedMaterial = materialsForVariant[keyB]; + var cachedMaterial = materialsForVariant[keyB]; if (cachedMaterial === undefined) { cachedMaterial = result.clone(); @@ -14067,64 +14864,66 @@ function renderObject(object, camera, shadowCamera, light, type) { if (object.visible === false) return; - const visible = object.layers.test(camera.layers); + var 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); + var geometry = _objects.update(object); - const material = object.material; + var material = object.material; if (Array.isArray(material)) { - const groups = geometry.groups; + var groups = geometry.groups; - for (let k = 0, kl = groups.length; k < kl; k++) { - const group = groups[k]; - const groupMaterial = material[group.materialIndex]; + for (var k = 0, kl = groups.length; k < kl; k++) { + var group = groups[k]; + var groupMaterial = material[group.materialIndex]; if (groupMaterial && groupMaterial.visible) { - const depthMaterial = getDepthMaterial(object, geometry, groupMaterial, light, shadowCamera.near, shadowCamera.far, type); + var 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); + var _depthMaterial = getDepthMaterial(object, geometry, material, light, shadowCamera.near, shadowCamera.far, type); - _renderer.renderBufferDirect(shadowCamera, null, geometry, depthMaterial, object, null); + _renderer.renderBufferDirect(shadowCamera, null, geometry, _depthMaterial, object, null); } } } - const children = object.children; + var children = object.children; - for (let i = 0, l = children.length; i < l; i++) { + for (var i = 0, l = children.length; i < l; i++) { renderObject(children[i], camera, shadowCamera, light, type); } } } function WebGLState(gl, extensions, capabilities) { - const isWebGL2 = capabilities.isWebGL2; + var _equationToGL, _factorToGL; + + var isWebGL2 = capabilities.isWebGL2; function ColorBuffer() { - let locked = false; - const color = new Vector4(); - let currentColorMask = null; - const currentColorClear = new Vector4(0, 0, 0, 0); + var locked = false; + var color = new Vector4(); + var currentColorMask = null; + var currentColorClear = new Vector4(0, 0, 0, 0); return { - setMask: function (colorMask) { + setMask: function setMask(colorMask) { if (currentColorMask !== colorMask && !locked) { gl.colorMask(colorMask, colorMask, colorMask, colorMask); currentColorMask = colorMask; } }, - setLocked: function (lock) { + setLocked: function setLocked(lock) { locked = lock; }, - setClear: function (r, g, b, a, premultipliedAlpha) { + setClear: function setClear(r, g, b, a, premultipliedAlpha) { if (premultipliedAlpha === true) { r *= a; g *= a; @@ -14138,7 +14937,7 @@ currentColorClear.copy(color); } }, - reset: function () { + reset: function reset() { locked = false; currentColorMask = null; currentColorClear.set(-1, 0, 0, 0); // set to invalid state @@ -14147,25 +14946,25 @@ } function DepthBuffer() { - let locked = false; - let currentDepthMask = null; - let currentDepthFunc = null; - let currentDepthClear = null; + var locked = false; + var currentDepthMask = null; + var currentDepthFunc = null; + var currentDepthClear = null; return { - setTest: function (depthTest) { + setTest: function setTest(depthTest) { if (depthTest) { enable(2929); } else { disable(2929); } }, - setMask: function (depthMask) { + setMask: function setMask(depthMask) { if (currentDepthMask !== depthMask && !locked) { gl.depthMask(depthMask); currentDepthMask = depthMask; } }, - setFunc: function (depthFunc) { + setFunc: function setFunc(depthFunc) { if (currentDepthFunc !== depthFunc) { if (depthFunc) { switch (depthFunc) { @@ -14211,16 +15010,16 @@ currentDepthFunc = depthFunc; } }, - setLocked: function (lock) { + setLocked: function setLocked(lock) { locked = lock; }, - setClear: function (depth) { + setClear: function setClear(depth) { if (currentDepthClear !== depth) { gl.clearDepth(depth); currentDepthClear = depth; } }, - reset: function () { + reset: function reset() { locked = false; currentDepthMask = null; currentDepthFunc = null; @@ -14230,17 +15029,17 @@ } function StencilBuffer() { - let locked = false; - let currentStencilMask = null; - let currentStencilFunc = null; - let currentStencilRef = null; - let currentStencilFuncMask = null; - let currentStencilFail = null; - let currentStencilZFail = null; - let currentStencilZPass = null; - let currentStencilClear = null; + var locked = false; + var currentStencilMask = null; + var currentStencilFunc = null; + var currentStencilRef = null; + var currentStencilFuncMask = null; + var currentStencilFail = null; + var currentStencilZFail = null; + var currentStencilZPass = null; + var currentStencilClear = null; return { - setTest: function (stencilTest) { + setTest: function setTest(stencilTest) { if (!locked) { if (stencilTest) { enable(2960); @@ -14249,13 +15048,13 @@ } } }, - setMask: function (stencilMask) { + setMask: function setMask(stencilMask) { if (currentStencilMask !== stencilMask && !locked) { gl.stencilMask(stencilMask); currentStencilMask = stencilMask; } }, - setFunc: function (stencilFunc, stencilRef, stencilMask) { + setFunc: function setFunc(stencilFunc, stencilRef, stencilMask) { if (currentStencilFunc !== stencilFunc || currentStencilRef !== stencilRef || currentStencilFuncMask !== stencilMask) { gl.stencilFunc(stencilFunc, stencilRef, stencilMask); currentStencilFunc = stencilFunc; @@ -14263,7 +15062,7 @@ currentStencilFuncMask = stencilMask; } }, - setOp: function (stencilFail, stencilZFail, stencilZPass) { + setOp: function setOp(stencilFail, stencilZFail, stencilZPass) { if (currentStencilFail !== stencilFail || currentStencilZFail !== stencilZFail || currentStencilZPass !== stencilZPass) { gl.stencilOp(stencilFail, stencilZFail, stencilZPass); currentStencilFail = stencilFail; @@ -14271,16 +15070,16 @@ currentStencilZPass = stencilZPass; } }, - setLocked: function (lock) { + setLocked: function setLocked(lock) { locked = lock; }, - setClear: function (stencil) { + setClear: function setClear(stencil) { if (currentStencilClear !== stencil) { gl.clearStencil(stencil); currentStencilClear = stencil; } }, - reset: function () { + reset: function reset() { locked = false; currentStencilMask = null; currentStencilFunc = null; @@ -14295,31 +15094,31 @@ } // - const colorBuffer = new ColorBuffer(); - const depthBuffer = new DepthBuffer(); - const stencilBuffer = new StencilBuffer(); - let enabledCapabilities = {}; - let xrFramebuffer = null; - let currentBoundFramebuffers = {}; - let currentProgram = null; - let currentBlendingEnabled = false; - let currentBlending = null; - let currentBlendEquation = null; - let currentBlendSrc = null; - let currentBlendDst = null; - let currentBlendEquationAlpha = null; - let currentBlendSrcAlpha = null; - let currentBlendDstAlpha = null; - let currentPremultipledAlpha = false; - let currentFlipSided = null; - let currentCullFace = null; - let currentLineWidth = null; - let currentPolygonOffsetFactor = null; - let currentPolygonOffsetUnits = null; - const maxTextures = gl.getParameter(35661); - let lineWidthAvailable = false; - let version = 0; - const glVersion = gl.getParameter(7938); + var colorBuffer = new ColorBuffer(); + var depthBuffer = new DepthBuffer(); + var stencilBuffer = new StencilBuffer(); + var enabledCapabilities = {}; + var xrFramebuffer = null; + var currentBoundFramebuffers = {}; + var currentProgram = null; + var currentBlendingEnabled = false; + var currentBlending = null; + var currentBlendEquation = null; + var currentBlendSrc = null; + var currentBlendDst = null; + var currentBlendEquationAlpha = null; + var currentBlendSrcAlpha = null; + var currentBlendDstAlpha = null; + var currentPremultipledAlpha = false; + var currentFlipSided = null; + var currentCullFace = null; + var currentLineWidth = null; + var currentPolygonOffsetFactor = null; + var currentPolygonOffsetUnits = null; + var maxTextures = gl.getParameter(35661); + var lineWidthAvailable = false; + var version = 0; + var glVersion = gl.getParameter(7938); if (glVersion.indexOf('WebGL') !== -1) { version = parseFloat(/^WebGL (\d)/.exec(glVersion)[1]); @@ -14329,27 +15128,27 @@ lineWidthAvailable = version >= 2.0; } - let currentTextureSlot = null; - let currentBoundTextures = {}; - const currentScissor = new Vector4(0, 0, gl.canvas.width, gl.canvas.height); - const currentViewport = new Vector4(0, 0, gl.canvas.width, gl.canvas.height); + var currentTextureSlot = null; + var currentBoundTextures = {}; + var currentScissor = new Vector4(0, 0, gl.canvas.width, gl.canvas.height); + var currentViewport = new Vector4(0, 0, gl.canvas.width, gl.canvas.height); function createTexture(type, target, count) { - const data = new Uint8Array(4); // 4 is required to match default unpack alignment of 4. + var data = new Uint8Array(4); // 4 is required to match default unpack alignment of 4. - const texture = gl.createTexture(); + var texture = gl.createTexture(); gl.bindTexture(type, texture); gl.texParameteri(type, 10241, 9728); gl.texParameteri(type, 10240, 9728); - for (let i = 0; i < count; i++) { + for (var i = 0; i < count; i++) { gl.texImage2D(target + i, 0, 6408, 1, 1, 0, 6408, 5121, data); } return texture; } - const emptyTextures = {}; + var emptyTextures = {}; emptyTextures[3553] = createTexture(3553, 3553, 1); emptyTextures[34067] = createTexture(34067, 34069, 6); // init @@ -14404,17 +15203,13 @@ return false; } - const equationToGL = { - [AddEquation]: 32774, - [SubtractEquation]: 32778, - [ReverseSubtractEquation]: 32779 - }; + var equationToGL = (_equationToGL = {}, _equationToGL[AddEquation] = 32774, _equationToGL[SubtractEquation] = 32778, _equationToGL[ReverseSubtractEquation] = 32779, _equationToGL); if (isWebGL2) { equationToGL[MinEquation] = 32775; equationToGL[MaxEquation] = 32776; } else { - const extension = extensions.get('EXT_blend_minmax'); + var extension = extensions.get('EXT_blend_minmax'); if (extension !== null) { equationToGL[MinEquation] = extension.MIN_EXT; @@ -14422,19 +15217,7 @@ } } - const factorToGL = { - [ZeroFactor]: 0, - [OneFactor]: 1, - [SrcColorFactor]: 768, - [SrcAlphaFactor]: 770, - [SrcAlphaSaturateFactor]: 776, - [DstColorFactor]: 774, - [DstAlphaFactor]: 772, - [OneMinusSrcColorFactor]: 769, - [OneMinusSrcAlphaFactor]: 771, - [OneMinusDstColorFactor]: 775, - [OneMinusDstAlphaFactor]: 773 - }; + var factorToGL = (_factorToGL = {}, _factorToGL[ZeroFactor] = 0, _factorToGL[OneFactor] = 1, _factorToGL[SrcColorFactor] = 768, _factorToGL[SrcAlphaFactor] = 770, _factorToGL[SrcAlphaSaturateFactor] = 776, _factorToGL[DstColorFactor] = 774, _factorToGL[DstAlphaFactor] = 772, _factorToGL[OneMinusSrcColorFactor] = 769, _factorToGL[OneMinusSrcAlphaFactor] = 771, _factorToGL[OneMinusDstColorFactor] = 775, _factorToGL[OneMinusDstAlphaFactor] = 773, _factorToGL); function setBlending(blending, blendEquation, blendSrc, blendDst, blendEquationAlpha, blendSrcAlpha, blendDstAlpha, premultipliedAlpha) { if (blending === NoBlending) { @@ -14541,7 +15324,7 @@ function setMaterial(material, frontFaceCW) { material.side === DoubleSide ? disable(2884) : enable(2884); - let flipSided = material.side === BackSide; + var flipSided = material.side === BackSide; if (frontFaceCW) flipSided = !flipSided; setFlipSided(flipSided); material.blending === NormalBlending && material.transparent === false ? setBlending(NoBlending) : setBlending(material.blending, material.blendEquation, material.blendSrc, material.blendDst, material.blendEquationAlpha, material.blendSrcAlpha, material.blendDstAlpha, material.premultipliedAlpha); @@ -14549,7 +15332,7 @@ depthBuffer.setTest(material.depthTest); depthBuffer.setMask(material.depthWrite); colorBuffer.setMask(material.colorWrite); - const stencilWrite = material.stencilWrite; + var stencilWrite = material.stencilWrite; stencilBuffer.setTest(stencilWrite); if (stencilWrite) { @@ -14639,7 +15422,7 @@ activeTexture(); } - let boundTexture = currentBoundTextures[currentTextureSlot]; + var boundTexture = currentBoundTextures[currentTextureSlot]; if (boundTexture === undefined) { boundTexture = { @@ -14657,7 +15440,7 @@ } function unbindTexture() { - const boundTexture = currentBoundTextures[currentTextureSlot]; + var boundTexture = currentBoundTextures[currentTextureSlot]; if (boundTexture !== undefined && boundTexture.type !== undefined) { gl.bindTexture(boundTexture.type, null); @@ -14803,20 +15586,22 @@ } function WebGLTextures(_gl, extensions, state, properties, capabilities, utils, info) { - const isWebGL2 = capabilities.isWebGL2; - const maxTextures = capabilities.maxTextures; - const maxCubemapSize = capabilities.maxCubemapSize; - const maxTextureSize = capabilities.maxTextureSize; - const maxSamples = capabilities.maxSamples; + var _wrappingToGL, _filterToGL; - const _videoTextures = new WeakMap(); + var isWebGL2 = capabilities.isWebGL2; + var maxTextures = capabilities.maxTextures; + var maxCubemapSize = capabilities.maxCubemapSize; + var maxTextureSize = capabilities.maxTextureSize; + var maxSamples = capabilities.maxSamples; - let _canvas; // cordova iOS (as of 5.0) still uses UIWebView, which provides OffscreenCanvas, + var _videoTextures = new WeakMap(); + + var _canvas; // 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; + var useOffscreenCanvas = false; try { useOffscreenCanvas = typeof OffscreenCanvas !== 'undefined' && new OffscreenCanvas(1, 1).getContext('2d') !== null; @@ -14829,7 +15614,7 @@ } function resizeImage(image, needsPowerOfTwo, needsNewCanvas, maxSize) { - let scale = 1; // handle case if texture exceeds max size + var scale = 1; // handle case if texture exceeds max size if (image.width > maxSize || image.height > maxSize) { scale = maxSize / Math.max(image.width, image.height); @@ -14839,15 +15624,15 @@ 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 ? MathUtils.floorPowerOfTwo : Math.floor; - const width = floor(scale * image.width); - const height = floor(scale * image.height); + var floor = needsPowerOfTwo ? MathUtils.floorPowerOfTwo : Math.floor; + var width = floor(scale * image.width); + var height = floor(scale * image.height); if (_canvas === undefined) _canvas = createCanvas(width, height); // cube textures can't reuse the same canvas - const canvas = needsNewCanvas ? createCanvas(width, height) : _canvas; + var canvas = needsNewCanvas ? createCanvas(width, height) : _canvas; canvas.width = width; canvas.height = height; - const context = canvas.getContext('2d'); + var context = canvas.getContext('2d'); context.drawImage(image, 0, 0, width, height); console.warn('THREE.WebGLRenderer: Texture has been resized from (' + image.width + 'x' + image.height + ') to (' + width + 'x' + height + ').'); return canvas; @@ -14879,7 +15664,7 @@ function generateMipmap(target, texture, width, height) { _gl.generateMipmap(target); - const textureProperties = properties.get(texture); + var textureProperties = properties.get(texture); textureProperties.__maxMipLevel = Math.log2(Math.max(width, height)); } @@ -14891,7 +15676,7 @@ console.warn('THREE.WebGLRenderer: Attempt to use non-existing WebGL internal format \'' + internalFormatName + '\''); } - let internalFormat = glFormat; + var internalFormat = glFormat; if (glFormat === 6403) { if (glType === 5126) internalFormat = 33326; @@ -14929,7 +15714,7 @@ function onTextureDispose(event) { - const texture = event.target; + var texture = event.target; texture.removeEventListener('dispose', onTextureDispose); deallocateTexture(texture); @@ -14941,7 +15726,7 @@ } function onRenderTargetDispose(event) { - const renderTarget = event.target; + var renderTarget = event.target; renderTarget.removeEventListener('dispose', onRenderTargetDispose); deallocateRenderTarget(renderTarget); info.memory.textures--; @@ -14949,7 +15734,7 @@ function deallocateTexture(texture) { - const textureProperties = properties.get(texture); + var textureProperties = properties.get(texture); if (textureProperties.__webglInit === undefined) return; _gl.deleteTexture(textureProperties.__webglTexture); @@ -14958,9 +15743,9 @@ } function deallocateRenderTarget(renderTarget) { - const texture = renderTarget.texture; - const renderTargetProperties = properties.get(renderTarget); - const textureProperties = properties.get(texture); + var texture = renderTarget.texture; + var renderTargetProperties = properties.get(renderTarget); + var textureProperties = properties.get(texture); if (!renderTarget) return; if (textureProperties.__webglTexture !== undefined) { @@ -14972,7 +15757,7 @@ } if (renderTarget.isWebGLCubeRenderTarget) { - for (let i = 0; i < 6; i++) { + for (var i = 0; i < 6; i++) { _gl.deleteFramebuffer(renderTargetProperties.__webglFramebuffer[i]); if (renderTargetProperties.__webglDepthbuffer) _gl.deleteRenderbuffer(renderTargetProperties.__webglDepthbuffer[i]); @@ -14991,14 +15776,14 @@ } // - let textureUnits = 0; + var textureUnits = 0; function resetTextureUnits() { textureUnits = 0; } function allocateTextureUnit() { - const textureUnit = textureUnits; + var textureUnit = textureUnits; if (textureUnit >= maxTextures) { console.warn('THREE.WebGLTextures: Trying to use ' + textureUnit + ' texture units while this GPU supports only ' + maxTextures); @@ -15010,11 +15795,11 @@ function setTexture2D(texture, slot) { - const textureProperties = properties.get(texture); + var textureProperties = properties.get(texture); if (texture.isVideoTexture) updateVideoTexture(texture); if (texture.version > 0 && textureProperties.__version !== texture.version) { - const image = texture.image; + var image = texture.image; if (image === undefined) { console.warn('THREE.WebGLRenderer: Texture marked for update but image is undefined'); @@ -15031,7 +15816,7 @@ } function setTexture2DArray(texture, slot) { - const textureProperties = properties.get(texture); + var textureProperties = properties.get(texture); if (texture.version > 0 && textureProperties.__version !== texture.version) { uploadTexture(textureProperties, texture, slot); @@ -15043,7 +15828,7 @@ } function setTexture3D(texture, slot) { - const textureProperties = properties.get(texture); + var textureProperties = properties.get(texture); if (texture.version > 0 && textureProperties.__version !== texture.version) { uploadTexture(textureProperties, texture, slot); @@ -15055,7 +15840,7 @@ } function setTextureCube(texture, slot) { - const textureProperties = properties.get(texture); + var textureProperties = properties.get(texture); if (texture.version > 0 && textureProperties.__version !== texture.version) { uploadCubeTexture(textureProperties, texture, slot); @@ -15066,19 +15851,8 @@ state.bindTexture(34067, textureProperties.__webglTexture); } - const wrappingToGL = { - [RepeatWrapping]: 10497, - [ClampToEdgeWrapping]: 33071, - [MirroredRepeatWrapping]: 33648 - }; - const filterToGL = { - [NearestFilter]: 9728, - [NearestMipmapNearestFilter]: 9984, - [NearestMipmapLinearFilter]: 9986, - [LinearFilter]: 9729, - [LinearMipmapNearestFilter]: 9985, - [LinearMipmapLinearFilter]: 9987 - }; + var wrappingToGL = (_wrappingToGL = {}, _wrappingToGL[RepeatWrapping] = 10497, _wrappingToGL[ClampToEdgeWrapping] = 33071, _wrappingToGL[MirroredRepeatWrapping] = 33648, _wrappingToGL); + var filterToGL = (_filterToGL = {}, _filterToGL[NearestFilter] = 9728, _filterToGL[NearestMipmapNearestFilter] = 9984, _filterToGL[NearestMipmapLinearFilter] = 9986, _filterToGL[LinearFilter] = 9729, _filterToGL[LinearMipmapNearestFilter] = 9985, _filterToGL[LinearMipmapLinearFilter] = 9987, _filterToGL); function setTextureParameters(textureType, texture, supportsMips) { if (supportsMips) { @@ -15116,7 +15890,7 @@ } if (extensions.has('EXT_texture_filter_anisotropic') === true) { - const extension = extensions.get('EXT_texture_filter_anisotropic'); + var 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 @@ -15139,7 +15913,7 @@ } function uploadTexture(textureProperties, texture, slot) { - let textureType = 3553; + var textureType = 3553; if (texture.isDataTexture2DArray) textureType = 35866; if (texture.isDataTexture3D) textureType = 32879; initTexture(textureProperties, texture); @@ -15154,15 +15928,15 @@ _gl.pixelStorei(37443, 0); - const needsPowerOfTwo = textureNeedsPowerOfTwo(texture) && isPowerOfTwo(texture.image) === false; - const image = resizeImage(texture.image, needsPowerOfTwo, false, maxTextureSize); - const supportsMips = isPowerOfTwo(image) || isWebGL2, - glFormat = utils.convert(texture.format); - let glType = utils.convert(texture.type), + var needsPowerOfTwo = textureNeedsPowerOfTwo(texture) && isPowerOfTwo(texture.image) === false; + var image = resizeImage(texture.image, needsPowerOfTwo, false, maxTextureSize); + var supportsMips = isPowerOfTwo(image) || isWebGL2, + glFormat = utils.convert(texture.format); + var glType = utils.convert(texture.type), glInternalFormat = getInternalFormat(texture.internalFormat, glFormat, glType); setTextureParameters(textureType, texture, supportsMips); - let mipmap; - const mipmaps = texture.mipmaps; + var mipmap; + var mipmaps = texture.mipmaps; if (texture.isDepthTexture) { // populate depth texture with dummy data @@ -15217,7 +15991,7 @@ // if there are no manual mipmaps // set 0 level mipmap and then use GL to generate other mipmap levels if (mipmaps.length > 0 && supportsMips) { - for (let i = 0, il = mipmaps.length; i < il; i++) { + for (var i = 0, il = mipmaps.length; i < il; i++) { mipmap = mipmaps[i]; state.texImage2D(3553, i, glInternalFormat, mipmap.width, mipmap.height, 0, glFormat, glType, mipmap.data); } @@ -15229,17 +16003,17 @@ textureProperties.__maxMipLevel = 0; } } else if (texture.isCompressedTexture) { - for (let i = 0, il = mipmaps.length; i < il; i++) { - mipmap = mipmaps[i]; + for (var _i = 0, _il = mipmaps.length; _i < _il; _i++) { + mipmap = mipmaps[_i]; if (texture.format !== RGBAFormat && texture.format !== RGBFormat) { if (glFormat !== null) { - state.compressedTexImage2D(3553, i, glInternalFormat, mipmap.width, mipmap.height, 0, mipmap.data); + state.compressedTexImage2D(3553, _i, glInternalFormat, mipmap.width, mipmap.height, 0, mipmap.data); } else { console.warn('THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()'); } } else { - state.texImage2D(3553, i, glInternalFormat, mipmap.width, mipmap.height, 0, glFormat, glType, mipmap.data); + state.texImage2D(3553, _i, glInternalFormat, mipmap.width, mipmap.height, 0, glFormat, glType, mipmap.data); } } @@ -15256,9 +16030,9 @@ // if there are no manual mipmaps // set 0 level mipmap and then use GL to generate other mipmap levels if (mipmaps.length > 0 && supportsMips) { - for (let i = 0, il = mipmaps.length; i < il; i++) { - mipmap = mipmaps[i]; - state.texImage2D(3553, i, glInternalFormat, glFormat, glType, mipmap); + for (var _i2 = 0, _il2 = mipmaps.length; _i2 < _il2; _i2++) { + mipmap = mipmaps[_i2]; + state.texImage2D(3553, _i2, glInternalFormat, glFormat, glType, mipmap); } texture.generateMipmaps = false; @@ -15291,11 +16065,11 @@ _gl.pixelStorei(37443, 0); - const isCompressed = texture && (texture.isCompressedTexture || texture.image[0].isCompressedTexture); - const isDataTexture = texture.image[0] && texture.image[0].isDataTexture; - const cubeImage = []; + var isCompressed = texture && (texture.isCompressedTexture || texture.image[0].isCompressedTexture); + var isDataTexture = texture.image[0] && texture.image[0].isDataTexture; + var cubeImage = []; - for (let i = 0; i < 6; i++) { + for (var i = 0; i < 6; i++) { if (!isCompressed && !isDataTexture) { cubeImage[i] = resizeImage(texture.image[i], false, true, maxCubemapSize); } else { @@ -15303,29 +16077,29 @@ } } - const image = cubeImage[0], - supportsMips = isPowerOfTwo(image) || isWebGL2, - glFormat = utils.convert(texture.format), - glType = utils.convert(texture.type), - glInternalFormat = getInternalFormat(texture.internalFormat, glFormat, glType); + var image = cubeImage[0], + supportsMips = isPowerOfTwo(image) || isWebGL2, + glFormat = utils.convert(texture.format), + glType = utils.convert(texture.type), + glInternalFormat = getInternalFormat(texture.internalFormat, glFormat, glType); setTextureParameters(34067, texture, supportsMips); - let mipmaps; + var mipmaps; if (isCompressed) { - for (let i = 0; i < 6; i++) { - mipmaps = cubeImage[i].mipmaps; + for (var _i3 = 0; _i3 < 6; _i3++) { + mipmaps = cubeImage[_i3].mipmaps; - for (let j = 0; j < mipmaps.length; j++) { - const mipmap = mipmaps[j]; + for (var j = 0; j < mipmaps.length; j++) { + var mipmap = mipmaps[j]; if (texture.format !== RGBAFormat && texture.format !== RGBFormat) { if (glFormat !== null) { - state.compressedTexImage2D(34069 + i, j, glInternalFormat, mipmap.width, mipmap.height, 0, mipmap.data); + state.compressedTexImage2D(34069 + _i3, j, glInternalFormat, mipmap.width, mipmap.height, 0, mipmap.data); } else { console.warn('THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .setTextureCube()'); } } else { - state.texImage2D(34069 + i, j, glInternalFormat, mipmap.width, mipmap.height, 0, glFormat, glType, mipmap.data); + state.texImage2D(34069 + _i3, j, glInternalFormat, mipmap.width, mipmap.height, 0, glFormat, glType, mipmap.data); } } } @@ -15334,21 +16108,21 @@ } else { mipmaps = texture.mipmaps; - for (let i = 0; i < 6; i++) { + for (var _i4 = 0; _i4 < 6; _i4++) { if (isDataTexture) { - state.texImage2D(34069 + i, 0, glInternalFormat, cubeImage[i].width, cubeImage[i].height, 0, glFormat, glType, cubeImage[i].data); + state.texImage2D(34069 + _i4, 0, glInternalFormat, cubeImage[_i4].width, cubeImage[_i4].height, 0, glFormat, glType, cubeImage[_i4].data); - for (let j = 0; j < mipmaps.length; j++) { - const mipmap = mipmaps[j]; - const mipmapImage = mipmap.image[i].image; - state.texImage2D(34069 + i, j + 1, glInternalFormat, mipmapImage.width, mipmapImage.height, 0, glFormat, glType, mipmapImage.data); + for (var _j = 0; _j < mipmaps.length; _j++) { + var _mipmap = mipmaps[_j]; + var mipmapImage = _mipmap.image[_i4].image; + state.texImage2D(34069 + _i4, _j + 1, glInternalFormat, mipmapImage.width, mipmapImage.height, 0, glFormat, glType, mipmapImage.data); } } else { - state.texImage2D(34069 + i, 0, glInternalFormat, glFormat, glType, cubeImage[i]); + state.texImage2D(34069 + _i4, 0, glInternalFormat, glFormat, glType, cubeImage[_i4]); - for (let j = 0; j < mipmaps.length; j++) { - const mipmap = mipmaps[j]; - state.texImage2D(34069 + i, j + 1, glInternalFormat, glFormat, glType, mipmap.image[i]); + for (var _j2 = 0; _j2 < mipmaps.length; _j2++) { + var _mipmap2 = mipmaps[_j2]; + state.texImage2D(34069 + _i4, _j2 + 1, glInternalFormat, glFormat, glType, _mipmap2.image[_i4]); } } } @@ -15368,10 +16142,10 @@ function setupFrameBufferTexture(framebuffer, renderTarget, attachment, textureTarget) { - const texture = renderTarget.texture; - const glFormat = utils.convert(texture.format); - const glType = utils.convert(texture.type); - const glInternalFormat = getInternalFormat(texture.internalFormat, glFormat, glType); + var texture = renderTarget.texture; + var glFormat = utils.convert(texture.format); + var glType = utils.convert(texture.type); + var glInternalFormat = getInternalFormat(texture.internalFormat, glFormat, glType); if (textureTarget === 32879 || textureTarget === 35866) { state.texImage3D(textureTarget, 0, glInternalFormat, renderTarget.width, renderTarget.height, renderTarget.depth, 0, glFormat, glType, null); @@ -15391,10 +16165,10 @@ _gl.bindRenderbuffer(36161, renderbuffer); if (renderTarget.depthBuffer && !renderTarget.stencilBuffer) { - let glInternalFormat = 33189; + var glInternalFormat = 33189; if (isMultisample) { - const depthTexture = renderTarget.depthTexture; + var depthTexture = renderTarget.depthTexture; if (depthTexture && depthTexture.isDepthTexture) { if (depthTexture.type === FloatType) { @@ -15404,7 +16178,7 @@ } } - const samples = getRenderTargetSamples(renderTarget); + var samples = getRenderTargetSamples(renderTarget); _gl.renderbufferStorageMultisample(36161, samples, glInternalFormat, renderTarget.width, renderTarget.height); } else { @@ -15414,26 +16188,27 @@ _gl.framebufferRenderbuffer(36160, 36096, 36161, renderbuffer); } else if (renderTarget.depthBuffer && renderTarget.stencilBuffer) { if (isMultisample) { - const samples = getRenderTargetSamples(renderTarget); + var _samples = getRenderTargetSamples(renderTarget); - _gl.renderbufferStorageMultisample(36161, samples, 35056, renderTarget.width, renderTarget.height); + _gl.renderbufferStorageMultisample(36161, _samples, 35056, renderTarget.width, renderTarget.height); } else { _gl.renderbufferStorage(36161, 34041, renderTarget.width, renderTarget.height); } _gl.framebufferRenderbuffer(36160, 33306, 36161, renderbuffer); } else { - const texture = renderTarget.texture; - const glFormat = utils.convert(texture.format); - const glType = utils.convert(texture.type); - const glInternalFormat = getInternalFormat(texture.internalFormat, glFormat, glType); + var texture = renderTarget.texture; + var glFormat = utils.convert(texture.format); + var glType = utils.convert(texture.type); + + var _glInternalFormat = getInternalFormat(texture.internalFormat, glFormat, glType); if (isMultisample) { - const samples = getRenderTargetSamples(renderTarget); + var _samples2 = getRenderTargetSamples(renderTarget); - _gl.renderbufferStorageMultisample(36161, samples, glInternalFormat, renderTarget.width, renderTarget.height); + _gl.renderbufferStorageMultisample(36161, _samples2, _glInternalFormat, renderTarget.width, renderTarget.height); } else { - _gl.renderbufferStorage(36161, glInternalFormat, renderTarget.width, renderTarget.height); + _gl.renderbufferStorage(36161, _glInternalFormat, renderTarget.width, renderTarget.height); } } @@ -15442,7 +16217,7 @@ function setupDepthTexture(framebuffer, renderTarget) { - const isCube = renderTarget && renderTarget.isWebGLCubeRenderTarget; + var isCube = renderTarget && renderTarget.isWebGLCubeRenderTarget; if (isCube) throw new Error('Depth Texture with cube render targets is not supported'); state.bindFramebuffer(36160, framebuffer); @@ -15459,7 +16234,7 @@ setTexture2D(renderTarget.depthTexture, 0); - const webglDepthTexture = properties.get(renderTarget.depthTexture).__webglTexture; + var webglDepthTexture = properties.get(renderTarget.depthTexture).__webglTexture; if (renderTarget.depthTexture.format === DepthFormat) { _gl.framebufferTexture2D(36160, 36096, 3553, webglDepthTexture, 0); @@ -15472,8 +16247,8 @@ function setupDepthRenderbuffer(renderTarget) { - const renderTargetProperties = properties.get(renderTarget); - const isCube = renderTarget.isWebGLCubeRenderTarget === true; + var renderTargetProperties = properties.get(renderTarget); + var isCube = renderTarget.isWebGLCubeRenderTarget === true; if (renderTarget.depthTexture) { if (isCube) throw new Error('target.depthTexture not supported in Cube render targets'); @@ -15482,7 +16257,7 @@ if (isCube) { renderTargetProperties.__webglDepthbuffer = []; - for (let i = 0; i < 6; i++) { + for (var i = 0; i < 6; i++) { state.bindFramebuffer(36160, renderTargetProperties.__webglFramebuffer[i]); renderTargetProperties.__webglDepthbuffer[i] = _gl.createRenderbuffer(); setupRenderBufferStorage(renderTargetProperties.__webglDepthbuffer[i], renderTarget, false); @@ -15499,17 +16274,17 @@ function setupRenderTarget(renderTarget) { - const texture = renderTarget.texture; - const renderTargetProperties = properties.get(renderTarget); - const textureProperties = properties.get(texture); + var texture = renderTarget.texture; + var renderTargetProperties = properties.get(renderTarget); + var textureProperties = properties.get(texture); renderTarget.addEventListener('dispose', onRenderTargetDispose); textureProperties.__webglTexture = _gl.createTexture(); textureProperties.__version = texture.version; info.memory.textures++; - const isCube = renderTarget.isWebGLCubeRenderTarget === true; - const isMultisample = renderTarget.isWebGLMultisampleRenderTarget === true; - const isRenderTarget3D = texture.isDataTexture3D || texture.isDataTexture2DArray; - const supportsMips = isPowerOfTwo(renderTarget) || isWebGL2; // Handles WebGL2 RGBFormat fallback - #18858 + var isCube = renderTarget.isWebGLCubeRenderTarget === true; + var isMultisample = renderTarget.isWebGLMultisampleRenderTarget === true; + var isRenderTarget3D = texture.isDataTexture3D || texture.isDataTexture2DArray; + var supportsMips = isPowerOfTwo(renderTarget) || isWebGL2; // Handles WebGL2 RGBFormat fallback - #18858 if (isWebGL2 && texture.format === RGBFormat && (texture.type === FloatType || texture.type === HalfFloatType)) { texture.format = RGBAFormat; @@ -15520,7 +16295,7 @@ if (isCube) { renderTargetProperties.__webglFramebuffer = []; - for (let i = 0; i < 6; i++) { + for (var i = 0; i < 6; i++) { renderTargetProperties.__webglFramebuffer[i] = _gl.createFramebuffer(); } } else { @@ -15533,10 +16308,10 @@ _gl.bindRenderbuffer(36161, renderTargetProperties.__webglColorRenderbuffer); - const glFormat = utils.convert(texture.format); - const glType = utils.convert(texture.type); - const glInternalFormat = getInternalFormat(texture.internalFormat, glFormat, glType); - const samples = getRenderTargetSamples(renderTarget); + var glFormat = utils.convert(texture.format); + var glType = utils.convert(texture.type); + var glInternalFormat = getInternalFormat(texture.internalFormat, glFormat, glType); + var samples = getRenderTargetSamples(renderTarget); _gl.renderbufferStorageMultisample(36161, samples, glInternalFormat, renderTarget.width, renderTarget.height); @@ -15563,8 +16338,8 @@ state.bindTexture(34067, textureProperties.__webglTexture); setTextureParameters(34067, texture, supportsMips); - for (let i = 0; i < 6; i++) { - setupFrameBufferTexture(renderTargetProperties.__webglFramebuffer[i], renderTarget, 36064, 34069 + i); + for (var _i5 = 0; _i5 < 6; _i5++) { + setupFrameBufferTexture(renderTargetProperties.__webglFramebuffer[_i5], renderTarget, 36064, 34069 + _i5); } if (textureNeedsGenerateMipmaps(texture, supportsMips)) { @@ -15573,12 +16348,12 @@ state.bindTexture(34067, null); } else { - let glTextureType = 3553; + var glTextureType = 3553; if (isRenderTarget3D) { // Render targets containing layers, i.e: Texture 3D and 2d arrays if (isWebGL2) { - const isTexture3D = texture.isDataTexture3D; + var isTexture3D = texture.isDataTexture3D; glTextureType = isTexture3D ? 32879 : 35866; } else { console.warn('THREE.DataTexture3D and THREE.DataTexture2DArray only supported with WebGL2.'); @@ -15603,13 +16378,13 @@ } function updateRenderTargetMipmap(renderTarget) { - const texture = renderTarget.texture; - const supportsMips = isPowerOfTwo(renderTarget) || isWebGL2; + var texture = renderTarget.texture; + var supportsMips = isPowerOfTwo(renderTarget) || isWebGL2; if (textureNeedsGenerateMipmaps(texture, supportsMips)) { - const target = renderTarget.isWebGLCubeRenderTarget ? 34067 : 3553; + var target = renderTarget.isWebGLCubeRenderTarget ? 34067 : 3553; - const webglTexture = properties.get(texture).__webglTexture; + var webglTexture = properties.get(texture).__webglTexture; state.bindTexture(target, webglTexture); generateMipmap(target, texture, renderTarget.width, renderTarget.height); @@ -15620,12 +16395,12 @@ function updateMultisampleRenderTarget(renderTarget) { if (renderTarget.isWebGLMultisampleRenderTarget) { if (isWebGL2) { - const renderTargetProperties = properties.get(renderTarget); + var renderTargetProperties = properties.get(renderTarget); state.bindFramebuffer(36008, renderTargetProperties.__webglMultisampledFramebuffer); state.bindFramebuffer(36009, renderTargetProperties.__webglFramebuffer); - const width = renderTarget.width; - const height = renderTarget.height; - let mask = 16384; + var width = renderTarget.width; + var height = renderTarget.height; + var mask = 16384; if (renderTarget.depthBuffer) mask |= 256; if (renderTarget.stencilBuffer) mask |= 1024; @@ -15643,7 +16418,7 @@ } function updateVideoTexture(texture) { - const frame = info.render.frame; // Check the last frame we updated the VideoTexture + var frame = info.render.frame; // Check the last frame we updated the VideoTexture if (_videoTextures.get(texture) !== frame) { _videoTextures.set(texture, frame); @@ -15653,8 +16428,8 @@ } // backwards compatibility - let warnedTexture2D = false; - let warnedTextureCube = false; + var warnedTexture2D = false; + var warnedTextureCube = false; function safeSetTexture2D(texture, slot) { if (texture && texture.isWebGLRenderTarget) { @@ -15697,10 +16472,10 @@ } function WebGLUtils(gl, extensions, capabilities) { - const isWebGL2 = capabilities.isWebGL2; + var isWebGL2 = capabilities.isWebGL2; function convert(p) { - let extension; + var extension; if (p === UnsignedByteType) return 5121; if (p === UnsignedShort4444Type) return 32819; if (p === UnsignedShort5551Type) return 32820; @@ -15822,23 +16597,39 @@ }; } - class ArrayCamera extends PerspectiveCamera { - constructor(array = []) { - super(); - this.cameras = array; + var ArrayCamera = /*#__PURE__*/function (_PerspectiveCamera) { + _inheritsLoose(ArrayCamera, _PerspectiveCamera); + + function ArrayCamera(array) { + var _this; + + if (array === void 0) { + array = []; + } + + _this = _PerspectiveCamera.call(this) || this; + _this.cameras = array; + return _this; } - } + return ArrayCamera; + }(PerspectiveCamera); ArrayCamera.prototype.isArrayCamera = true; - class Group extends Object3D { - constructor() { - super(); - this.type = 'Group'; + var Group = /*#__PURE__*/function (_Object3D) { + _inheritsLoose(Group, _Object3D); + + function Group() { + var _this; + + _this = _Object3D.call(this) || this; + _this.type = 'Group'; + return _this; } - } + return Group; + }(Object3D); Group.prototype.isGroup = true; @@ -15850,7 +16641,7 @@ Object.assign(WebXRController.prototype, { constructor: WebXRController, - getHandSpace: function () { + getHandSpace: function getHandSpace() { if (this._hand === null) { this._hand = new Group(); this._hand.matrixAutoUpdate = false; @@ -15863,7 +16654,7 @@ return this._hand; }, - getTargetRaySpace: function () { + getTargetRaySpace: function getTargetRaySpace() { if (this._targetRay === null) { this._targetRay = new Group(); this._targetRay.matrixAutoUpdate = false; @@ -15872,7 +16663,7 @@ return this._targetRay; }, - getGripSpace: function () { + getGripSpace: function getGripSpace() { if (this._grip === null) { this._grip = new Group(); this._grip.matrixAutoUpdate = false; @@ -15881,7 +16672,7 @@ return this._grip; }, - dispatchEvent: function (event) { + dispatchEvent: function dispatchEvent(event) { if (this._targetRay !== null) { this._targetRay.dispatchEvent(event); } @@ -15896,7 +16687,7 @@ return this; }, - disconnect: function (inputSource) { + disconnect: function disconnect(inputSource) { this.dispatchEvent({ type: 'disconnected', data: inputSource @@ -15916,13 +16707,13 @@ return this; }, - update: function (inputSource, frame, referenceSpace) { - let inputPose = null; - let gripPose = null; - let handPose = null; - const targetRay = this._targetRay; - const grip = this._grip; - const hand = this._hand; + update: function update(inputSource, frame, referenceSpace) { + var inputPose = null; + var gripPose = null; + var handPose = null; + var targetRay = this._targetRay; + var grip = this._grip; + var hand = this._hand; if (inputSource && frame.session.visibilityState !== 'visible-blurred') { if (targetRay !== null) { @@ -15937,21 +16728,23 @@ if (hand && inputSource.hand) { handPose = true; - for (const inputjoint of inputSource.hand.values()) { + for (var _iterator = _createForOfIteratorHelperLoose(inputSource.hand.values()), _step; !(_step = _iterator()).done;) { + var inputjoint = _step.value; // Update the joints groups with the XRJoint poses - const jointPose = frame.getJointPose(inputjoint, referenceSpace); + var 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; // ?? + var _joint = new Group(); + + _joint.matrixAutoUpdate = false; + _joint.visible = false; + hand.joints[inputjoint.jointName] = _joint; // ?? - hand.add(joint); + hand.add(_joint); } - const joint = hand.joints[inputjoint.jointName]; + var joint = hand.joints[inputjoint.jointName]; if (jointPose !== null) { joint.matrix.fromArray(jointPose.transform.matrix); @@ -15964,11 +16757,11 @@ // 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; + var indexTip = hand.joints['index-finger-tip']; + var thumbTip = hand.joints['thumb-tip']; + var distance = indexTip.position.distanceTo(thumbTip.position); + var distanceToPinch = 0.02; + var threshold = 0.005; if (hand.inputState.pinching && distance > distanceToPinch + threshold) { hand.inputState.pinching = false; @@ -16014,34 +16807,34 @@ }); function WebXRManager(renderer, gl) { - const scope = this; - const state = renderer.state; - let session = null; - let framebufferScaleFactor = 1.0; - let referenceSpace = null; - let referenceSpaceType = 'local-floor'; - let pose = null; - const controllers = []; - const inputSourcesMap = new Map(); // - - const cameraL = new PerspectiveCamera(); + var scope = this; + var state = renderer.state; + var session = null; + var framebufferScaleFactor = 1.0; + var referenceSpace = null; + var referenceSpaceType = 'local-floor'; + var pose = null; + var controllers = []; + var inputSourcesMap = new Map(); // + + var cameraL = new PerspectiveCamera(); cameraL.layers.enable(1); cameraL.viewport = new Vector4(); - const cameraR = new PerspectiveCamera(); + var cameraR = new PerspectiveCamera(); cameraR.layers.enable(2); cameraR.viewport = new Vector4(); - const cameras = [cameraL, cameraR]; - const cameraVR = new ArrayCamera(); + var cameras = [cameraL, cameraR]; + var cameraVR = new ArrayCamera(); cameraVR.layers.enable(1); cameraVR.layers.enable(2); - let _currentDepthNear = null; - let _currentDepthFar = null; // + var _currentDepthNear = null; + var _currentDepthFar = null; // this.enabled = false; this.isPresenting = false; this.getController = function (index) { - let controller = controllers[index]; + var controller = controllers[index]; if (controller === undefined) { controller = new WebXRController(); @@ -16052,7 +16845,7 @@ }; this.getControllerGrip = function (index) { - let controller = controllers[index]; + var controller = controllers[index]; if (controller === undefined) { controller = new WebXRController(); @@ -16063,7 +16856,7 @@ }; this.getHand = function (index) { - let controller = controllers[index]; + var controller = controllers[index]; if (controller === undefined) { controller = new WebXRController(); @@ -16075,7 +16868,7 @@ function onSessionEvent(event) { - const controller = inputSourcesMap.get(event.inputSource); + var controller = inputSourcesMap.get(event.inputSource); if (controller) { controller.dispatchEvent({ @@ -16127,57 +16920,87 @@ return session; }; - this.setSession = async function (value) { - session = value; + this.setSession = /*#__PURE__*/function () { + var _ref = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee(value) { + var attributes, layerInit, baseLayer; + return regeneratorRuntime.wrap(function _callee$(_context) { + while (1) { + switch (_context.prev = _context.next) { + case 0: + session = value; + + if (!(session !== null)) { + _context.next = 24; + break; + } - if (session !== null) { - session.addEventListener('select', onSessionEvent); - session.addEventListener('selectstart', onSessionEvent); - session.addEventListener('selectend', onSessionEvent); - session.addEventListener('squeeze', onSessionEvent); - session.addEventListener('squeezestart', onSessionEvent); - session.addEventListener('squeezeend', onSessionEvent); - session.addEventListener('end', onSessionEnd); - session.addEventListener('inputsourceschange', onInputSourcesChange); - const attributes = gl.getContextAttributes(); + session.addEventListener('select', onSessionEvent); + session.addEventListener('selectstart', onSessionEvent); + session.addEventListener('selectend', onSessionEvent); + session.addEventListener('squeeze', onSessionEvent); + session.addEventListener('squeezestart', onSessionEvent); + session.addEventListener('squeezeend', onSessionEvent); + session.addEventListener('end', onSessionEnd); + session.addEventListener('inputsourceschange', onInputSourcesChange); + attributes = gl.getContextAttributes(); + + if (!(attributes.xrCompatible !== true)) { + _context.next = 14; + break; + } - if (attributes.xrCompatible !== true) { - await gl.makeXRCompatible(); - } + _context.next = 14; + return gl.makeXRCompatible(); + + case 14: + layerInit = { + antialias: attributes.antialias, + alpha: attributes.alpha, + depth: attributes.depth, + stencil: attributes.stencil, + framebufferScaleFactor: framebufferScaleFactor + }; // eslint-disable-next-line no-undef + + baseLayer = new XRWebGLLayer(session, gl, layerInit); + session.updateRenderState({ + baseLayer: baseLayer + }); + _context.next = 19; + return session.requestReferenceSpace(referenceSpaceType); + + case 19: + referenceSpace = _context.sent; + animation.setContext(session); + animation.start(); + scope.isPresenting = true; + scope.dispatchEvent({ + type: 'sessionstart' + }); - const layerInit = { - antialias: attributes.antialias, - alpha: attributes.alpha, - depth: attributes.depth, - stencil: attributes.stencil, - framebufferScaleFactor: framebufferScaleFactor - }; // eslint-disable-next-line no-undef + case 24: + case "end": + return _context.stop(); + } + } + }, _callee); + })); - const baseLayer = new XRWebGLLayer(session, gl, layerInit); - session.updateRenderState({ - baseLayer: baseLayer - }); - referenceSpace = await session.requestReferenceSpace(referenceSpaceType); - animation.setContext(session); - animation.start(); - scope.isPresenting = true; - scope.dispatchEvent({ - type: 'sessionstart' - }); - } - }; + return function (_x) { + return _ref.apply(this, arguments); + }; + }(); function onInputSourcesChange(event) { - const inputSources = session.inputSources; // Assign inputSources to available controllers + var inputSources = session.inputSources; // Assign inputSources to available controllers - for (let i = 0; i < controllers.length; i++) { + for (var i = 0; i < controllers.length; i++) { inputSourcesMap.set(inputSources[i], controllers[i]); } // Notify disconnected - for (let i = 0; i < event.removed.length; i++) { - const inputSource = event.removed[i]; - const controller = inputSourcesMap.get(inputSource); + for (var _i = 0; _i < event.removed.length; _i++) { + var inputSource = event.removed[_i]; + var controller = inputSourcesMap.get(inputSource); if (controller) { controller.dispatchEvent({ @@ -16189,22 +17012,23 @@ } // Notify connected - for (let i = 0; i < event.added.length; i++) { - const inputSource = event.added[i]; - const controller = inputSourcesMap.get(inputSource); + for (var _i2 = 0; _i2 < event.added.length; _i2++) { + var _inputSource = event.added[_i2]; - if (controller) { - controller.dispatchEvent({ + var _controller = inputSourcesMap.get(_inputSource); + + if (_controller) { + _controller.dispatchEvent({ type: 'connected', - data: inputSource + data: _inputSource }); } } } // - const cameraLPos = new Vector3(); - const cameraRPos = new Vector3(); + var cameraLPos = new Vector3(); + var 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. @@ -16215,24 +17039,24 @@ 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 + var ipd = cameraLPos.distanceTo(cameraRPos); + var projL = cameraL.projectionMatrix.elements; + var 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]; - const bottomFov = (projL[9] - 1) / projL[5]; - 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 + var near = projL[14] / (projL[10] - 1); + var far = projL[14] / (projL[10] + 1); + var topFov = (projL[9] + 1) / projL[5]; + var bottomFov = (projL[9] - 1) / projL[5]; + var leftFov = (projL[8] - 1) / projL[0]; + var rightFov = (projR[8] + 1) / projR[0]; + var left = near * leftFov; + var 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? + var zOffset = ipd / (-leftFov + rightFov); + var xOffset = zOffset * -leftFov; // TODO: Better way to apply this offset? cameraL.matrixWorld.decompose(camera.position, camera.quaternion, camera.scale); camera.translateX(xOffset); @@ -16242,12 +17066,12 @@ // 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; - const right2 = right + (ipd - xOffset); - const top2 = topFov * far / far2 * near2; - const bottom2 = bottomFov * far / far2 * near2; + var near2 = near + zOffset; + var far2 = far + zOffset; + var left2 = left - xOffset; + var right2 = right + (ipd - xOffset); + var top2 = topFov * far / far2 * near2; + var bottom2 = bottomFov * far / far2 * near2; camera.projectionMatrix.makePerspective(left2, right2, top2, bottom2, near2, far2); } @@ -16275,11 +17099,11 @@ _currentDepthFar = cameraVR.far; } - const parent = camera.parent; - const cameras = cameraVR.cameras; + var parent = camera.parent; + var cameras = cameraVR.cameras; updateCamera(cameraVR, parent); - for (let i = 0; i < cameras.length; i++) { + for (var i = 0; i < cameras.length; i++) { updateCamera(cameras[i], parent); } // update camera and its children @@ -16287,10 +17111,10 @@ camera.matrixWorld.copy(cameraVR.matrixWorld); camera.matrix.copy(cameraVR.matrix); camera.matrix.decompose(camera.position, camera.quaternion, camera.scale); - const children = camera.children; + var children = camera.children; - for (let i = 0, l = children.length; i < l; i++) { - children[i].updateMatrixWorld(true); + for (var _i3 = 0, l = children.length; _i3 < l; _i3++) { + children[_i3].updateMatrixWorld(true); } // update projection matrix for proper view frustum culling @@ -16305,26 +17129,26 @@ }; // Animation Loop - let onAnimationFrameCallback = null; + var onAnimationFrameCallback = null; function onAnimationFrame(time, frame) { pose = frame.getViewerPose(referenceSpace); if (pose !== null) { - const views = pose.views; - const baseLayer = session.renderState.baseLayer; + var views = pose.views; + var baseLayer = session.renderState.baseLayer; state.bindXRFramebuffer(baseLayer.framebuffer); - let cameraVRNeedsUpdate = false; // check if it's necessary to rebuild cameraVR's camera list + var cameraVRNeedsUpdate = false; // 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]; - const viewport = baseLayer.getViewport(view); - const camera = cameras[i]; + for (var i = 0; i < views.length; i++) { + var view = views[i]; + var viewport = baseLayer.getViewport(view); + var camera = cameras[i]; camera.matrix.fromArray(view.transform.matrix); camera.projectionMatrix.fromArray(view.projectionMatrix); camera.viewport.set(viewport.x, viewport.y, viewport.width, viewport.height); @@ -16340,18 +17164,18 @@ } // - const inputSources = session.inputSources; + var inputSources = session.inputSources; - for (let i = 0; i < controllers.length; i++) { - const controller = controllers[i]; - const inputSource = inputSources[i]; + for (var _i4 = 0; _i4 < controllers.length; _i4++) { + var controller = controllers[_i4]; + var inputSource = inputSources[_i4]; controller.update(inputSource, frame, referenceSpace); } if (onAnimationFrameCallback) onAnimationFrameCallback(time, frame); } - const animation = new WebGLAnimation(); + var animation = new WebGLAnimation(); animation.setAnimationLoop(onAnimationFrame); this.setAnimationLoop = function (callback) { @@ -16448,7 +17272,7 @@ uniforms.specularMap.value = material.specularMap; } - const envMap = properties.get(material).envMap; + var envMap = properties.get(material).envMap; if (envMap) { uniforms.envMap.value = envMap; @@ -16456,7 +17280,7 @@ uniforms.reflectivity.value = material.reflectivity; uniforms.refractionRatio.value = material.refractionRatio; - const maxMipLevel = properties.get(envMap).__maxMipLevel; + var maxMipLevel = properties.get(envMap).__maxMipLevel; if (maxMipLevel !== undefined) { uniforms.maxMipLevel.value = maxMipLevel; @@ -16486,7 +17310,7 @@ // 12. clearcoat roughnessMap map - let uvScaleMap; + var uvScaleMap; if (material.map) { uvScaleMap = material.map; @@ -16530,7 +17354,7 @@ // 2. light map - let uv2ScaleMap; + var uv2ScaleMap; if (material.aoMap) { uv2ScaleMap = material.aoMap; @@ -16580,7 +17404,7 @@ // 2. alpha map - let uvScaleMap; + var uvScaleMap; if (material.map) { uvScaleMap = material.map; @@ -16613,7 +17437,7 @@ // 2. alpha map - let uvScaleMap; + var uvScaleMap; if (material.map) { uvScaleMap = material.map; @@ -16725,7 +17549,7 @@ uniforms.displacementBias.value = material.displacementBias; } - const envMap = properties.get(material).envMap; + var envMap = properties.get(material).envMap; if (envMap) { //uniforms.envMap.value = material.envMap; // part of uniforms common @@ -16836,7 +17660,7 @@ } function createCanvasElement() { - const canvas = document.createElementNS('http://www.w3.org/1999/xhtml', 'canvas'); + var canvas = document.createElementNS('http://www.w3.org/1999/xhtml', 'canvas'); canvas.style.display = 'block'; return canvas; } @@ -16844,23 +17668,23 @@ function WebGLRenderer(parameters) { parameters = 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; - - let currentRenderList = null; - let currentRenderState = null; // render() can be called from within a callback triggered by another render. + var _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; + + var currentRenderList = null; + var 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 + var renderListStack = []; + var renderStateStack = []; // public properties this.domElement = _canvas; // Debug configuration container @@ -16894,47 +17718,47 @@ this.maxMorphTargets = 8; this.maxMorphNormals = 4; // internal properties - const _this = this; + var _this = this; - let _isContextLost = false; // internal state cache + var _isContextLost = false; // internal state cache - let _currentActiveCubeFace = 0; - let _currentActiveMipmapLevel = 0; - let _currentRenderTarget = null; + var _currentActiveCubeFace = 0; + var _currentActiveMipmapLevel = 0; + var _currentRenderTarget = null; - let _currentMaterialId = -1; + var _currentMaterialId = -1; - let _currentCamera = null; + var _currentCamera = null; - const _currentViewport = new Vector4(); + var _currentViewport = new Vector4(); - const _currentScissor = new Vector4(); + var _currentScissor = new Vector4(); - let _currentScissorTest = null; // + var _currentScissorTest = null; // - let _width = _canvas.width; - let _height = _canvas.height; - let _pixelRatio = 1; - let _opaqueSort = null; - let _transparentSort = null; + var _width = _canvas.width; + var _height = _canvas.height; + var _pixelRatio = 1; + var _opaqueSort = null; + var _transparentSort = null; - const _viewport = new Vector4(0, 0, _width, _height); + var _viewport = new Vector4(0, 0, _width, _height); - const _scissor = new Vector4(0, 0, _width, _height); + var _scissor = new Vector4(0, 0, _width, _height); - let _scissorTest = false; // frustum + var _scissorTest = false; // frustum - const _frustum = new Frustum(); // clipping + var _frustum = new Frustum(); // clipping - let _clippingEnabled = false; - let _localClippingEnabled = false; // camera matrices cache + var _clippingEnabled = false; + var _localClippingEnabled = false; // camera matrices cache - const _projScreenMatrix = new Matrix4(); + var _projScreenMatrix = new Matrix4(); - const _vector3 = new Vector3(); + var _vector3 = new Vector3(); - const _emptyScene = { + var _emptyScene = { background: null, fog: null, environment: null, @@ -16947,13 +17771,13 @@ } // initialize - let _gl = _context; + var _gl = _context; function getContext(contextNames, contextAttributes) { - for (let i = 0; i < contextNames.length; i++) { - const contextName = contextNames[i]; + for (var i = 0; i < contextNames.length; i++) { + var contextName = contextNames[i]; - const context = _canvas.getContext(contextName, contextAttributes); + var context = _canvas.getContext(contextName, contextAttributes); if (context !== null) return context; } @@ -16962,7 +17786,7 @@ } try { - const contextAttributes = { + var contextAttributes = { alpha: _alpha, depth: _depth, stencil: _stencil, @@ -16978,7 +17802,7 @@ _canvas.addEventListener('webglcontextrestored', onContextRestore, false); if (_gl === null) { - const contextNames = ['webgl2', 'webgl', 'experimental-webgl']; + var contextNames = ['webgl2', 'webgl', 'experimental-webgl']; if (_this.isWebGL1Renderer === true) { contextNames.shift(); @@ -17010,11 +17834,11 @@ throw error; } - let extensions, capabilities, state, info; - let properties, textures, cubemaps, attributes, geometries, objects; - let programCache, materials, renderLists, renderStates, clipping, shadowMap; - let background, morphtargets, bufferRenderer, indexedBufferRenderer; - let utils, bindingStates; + var extensions, capabilities, state, info; + var properties, textures, cubemaps, attributes, geometries, objects; + var programCache, materials, renderLists, renderStates, clipping, shadowMap; + var background, morphtargets, bufferRenderer, indexedBufferRenderer; + var utils, bindingStates; function initGLContext() { extensions = new WebGLExtensions(_gl); @@ -17052,7 +17876,7 @@ initGLContext(); // xr - const xr = new WebXRManager(_this, _gl); + var xr = new WebXRManager(_this, _gl); this.xr = xr; // API this.getContext = function () { @@ -17064,12 +17888,12 @@ }; this.forceContextLoss = function () { - const extension = extensions.get('WEBGL_lose_context'); + var extension = extensions.get('WEBGL_lose_context'); if (extension) extension.loseContext(); }; this.forceContextRestore = function () { - const extension = extensions.get('WEBGL_lose_context'); + var extension = extensions.get('WEBGL_lose_context'); if (extension) extension.restoreContext(); }; @@ -17205,7 +18029,7 @@ }; this.clear = function (color, depth, stencil) { - let bits = 0; + var bits = 0; if (color === undefined || color) bits |= 16384; if (depth === undefined || depth) bits |= 256; if (stencil === undefined || stencil) bits |= 1024; @@ -17253,11 +18077,11 @@ { console.log('THREE.WebGLRenderer: Context Restored.'); _isContextLost = false; - const infoAutoReset = info.autoReset; - const shadowMapEnabled = shadowMap.enabled; - const shadowMapAutoUpdate = shadowMap.autoUpdate; - const shadowMapNeedsUpdate = shadowMap.needsUpdate; - const shadowMapType = shadowMap.type; + var infoAutoReset = info.autoReset; + var shadowMapEnabled = shadowMap.enabled; + var shadowMapAutoUpdate = shadowMap.autoUpdate; + var shadowMapNeedsUpdate = shadowMap.needsUpdate; + var shadowMapType = shadowMap.type; initGLContext(); info.autoReset = infoAutoReset; shadowMap.enabled = shadowMapEnabled; @@ -17267,7 +18091,7 @@ } function onMaterialDispose(event) { - const material = event.target; + var material = event.target; material.removeEventListener('dispose', onMaterialDispose); deallocateMaterial(material); } // Buffer deallocation @@ -17279,7 +18103,7 @@ } function releaseMaterialProgramReferences(material) { - const programs = properties.get(material).programs; + var programs = properties.get(material).programs; if (programs !== undefined) { programs.forEach(function (program) { @@ -17297,12 +18121,12 @@ this.renderBufferImmediate = function (object, program) { bindingStates.initAttributes(); - const buffers = properties.get(object); + var buffers = properties.get(object); if (object.hasPositions && !buffers.position) buffers.position = _gl.createBuffer(); if (object.hasNormals && !buffers.normal) buffers.normal = _gl.createBuffer(); if (object.hasUvs && !buffers.uv) buffers.uv = _gl.createBuffer(); if (object.hasColors && !buffers.color) buffers.color = _gl.createBuffer(); - const programAttributes = program.getAttributes(); + var programAttributes = program.getAttributes(); if (object.hasPositions) { _gl.bindBuffer(34962, buffers.position); @@ -17354,12 +18178,12 @@ 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, material, object); + var frontFaceCW = object.isMesh && object.matrixWorld.determinant() < 0; + var program = setProgram(camera, scene, material, object); state.setMaterial(material, frontFaceCW); // - let index = geometry.index; - const position = geometry.attributes.position; // + var index = geometry.index; + var position = geometry.attributes.position; // if (index === null) { if (position === undefined || position.count === 0) return; @@ -17368,7 +18192,7 @@ } // - let rangeFactor = 1; + var rangeFactor = 1; if (material.wireframe === true) { index = geometries.getWireframeAttribute(geometry); @@ -17380,8 +18204,8 @@ } bindingStates.setup(object, material, program, geometry, index); - let attribute; - let renderer = bufferRenderer; + var attribute; + var renderer = bufferRenderer; if (index !== null) { attribute = attributes.get(index); @@ -17390,14 +18214,14 @@ } // - const dataCount = index !== null ? index.count : position.count; - const rangeStart = geometry.drawRange.start * rangeFactor; - const rangeCount = geometry.drawRange.count * rangeFactor; - const groupStart = group !== null ? group.start * rangeFactor : 0; - const groupCount = group !== null ? group.count * rangeFactor : Infinity; - const drawStart = Math.max(rangeStart, groupStart); - const drawEnd = Math.min(dataCount, rangeStart + rangeCount, groupStart + groupCount) - 1; - const drawCount = Math.max(0, drawEnd - drawStart + 1); + var dataCount = index !== null ? index.count : position.count; + var rangeStart = geometry.drawRange.start * rangeFactor; + var rangeCount = geometry.drawRange.count * rangeFactor; + var groupStart = group !== null ? group.start * rangeFactor : 0; + var groupCount = group !== null ? group.count * rangeFactor : Infinity; + var drawStart = Math.max(rangeStart, groupStart); + var drawEnd = Math.min(dataCount, rangeStart + rangeCount, groupStart + groupCount) - 1; + var drawCount = Math.max(0, drawEnd - drawStart + 1); if (drawCount === 0) return; // if (object.isMesh) { @@ -17408,7 +18232,7 @@ renderer.setMode(4); } } else if (object.isLine) { - let lineWidth = material.linewidth; + var lineWidth = material.linewidth; if (lineWidth === undefined) lineWidth = 1; // Not using Line*Material state.setLineWidth(lineWidth * getTargetPixelRatio()); @@ -17429,7 +18253,7 @@ if (object.isInstancedMesh) { renderer.renderInstances(drawStart, drawCount, object.count); } else if (geometry.isInstancedBufferGeometry) { - const instanceCount = Math.min(geometry.instanceCount, geometry._maxInstanceCount); + var instanceCount = Math.min(geometry.instanceCount, geometry._maxInstanceCount); renderer.renderInstances(drawStart, drawCount, instanceCount); } else { renderer.render(drawStart, drawCount); @@ -17451,12 +18275,12 @@ }); currentRenderState.setupLights(); scene.traverse(function (object) { - const material = object.material; + var material = object.material; if (material) { if (Array.isArray(material)) { - for (let i = 0; i < material.length; i++) { - const material2 = material[i]; + for (var i = 0; i < material.length; i++) { + var material2 = material[i]; getProgram(material2, scene, object); } } else { @@ -17467,14 +18291,14 @@ }; // Animation Loop - let onAnimationFrameCallback = null; + var onAnimationFrameCallback = null; function onAnimationFrame(time) { if (xr.isPresenting) return; if (onAnimationFrameCallback) onAnimationFrameCallback(time); } - const animation = new WebGLAnimation(); + var animation = new WebGLAnimation(); animation.setAnimationLoop(onAnimationFrame); if (typeof window !== 'undefined') animation.setContext(window); @@ -17486,7 +18310,7 @@ this.render = function (scene, camera) { - let renderTarget, forceClear; + var renderTarget, forceClear; if (arguments[2] !== undefined) { console.warn('THREE.WebGLRenderer.render(): the renderTarget argument has been removed. Use .setRenderTarget() instead.'); @@ -17537,7 +18361,7 @@ if (_clippingEnabled === true) clipping.beginShadows(); - const shadowsArray = currentRenderState.state.shadowsArray; + var shadowsArray = currentRenderState.state.shadowsArray; shadowMap.render(shadowsArray, scene, camera); currentRenderState.setupLights(); currentRenderState.setupLightsView(camera); @@ -17552,8 +18376,8 @@ background.render(currentRenderList, scene, camera, forceClear); // render scene - const opaqueObjects = currentRenderList.opaque; - const transparentObjects = currentRenderList.transparent; + var opaqueObjects = currentRenderList.opaque; + var transparentObjects = currentRenderList.transparent; if (opaqueObjects.length > 0) renderObjects(opaqueObjects, scene, camera); if (transparentObjects.length > 0) renderObjects(transparentObjects, scene, camera); // @@ -17594,7 +18418,7 @@ function projectObject(object, camera, groupOrder, sortObjects) { if (object.visible === false) return; - const visible = object.layers.test(camera.layers); + var visible = object.layers.test(camera.layers); if (visible) { if (object.isGroup) { @@ -17613,8 +18437,8 @@ _vector3.setFromMatrixPosition(object.matrixWorld).applyMatrix4(_projScreenMatrix); } - const geometry = objects.update(object); - const material = object.material; + var geometry = objects.update(object); + var material = object.material; if (material.visible) { currentRenderList.push(object, geometry, material, groupOrder, _vector3.z, null); @@ -17640,49 +18464,50 @@ _vector3.setFromMatrixPosition(object.matrixWorld).applyMatrix4(_projScreenMatrix); } - const geometry = objects.update(object); - const material = object.material; + var _geometry = objects.update(object); - if (Array.isArray(material)) { - const groups = geometry.groups; + var _material = object.material; - for (let i = 0, l = groups.length; i < l; i++) { - const group = groups[i]; - const groupMaterial = material[group.materialIndex]; + if (Array.isArray(_material)) { + var groups = _geometry.groups; + + for (var i = 0, l = groups.length; i < l; i++) { + var group = groups[i]; + var groupMaterial = _material[group.materialIndex]; if (groupMaterial && groupMaterial.visible) { - currentRenderList.push(object, geometry, groupMaterial, groupOrder, _vector3.z, group); + currentRenderList.push(object, _geometry, groupMaterial, groupOrder, _vector3.z, group); } } - } else if (material.visible) { - currentRenderList.push(object, geometry, material, groupOrder, _vector3.z, null); + } else if (_material.visible) { + currentRenderList.push(object, _geometry, _material, groupOrder, _vector3.z, null); } } } } - const children = object.children; + var children = object.children; - for (let i = 0, l = children.length; i < l; i++) { - projectObject(children[i], camera, groupOrder, sortObjects); + for (var _i = 0, _l = children.length; _i < _l; _i++) { + projectObject(children[_i], camera, groupOrder, sortObjects); } } function renderObjects(renderList, scene, camera) { - const overrideMaterial = scene.isScene === true ? scene.overrideMaterial : null; + var 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; + for (var i = 0, l = renderList.length; i < l; i++) { + var renderItem = renderList[i]; + var object = renderItem.object; + var geometry = renderItem.geometry; + var material = overrideMaterial === null ? renderItem.material : overrideMaterial; + var group = renderItem.group; if (camera.isArrayCamera) { - const cameras = camera.cameras; + var cameras = camera.cameras; - for (let j = 0, jl = cameras.length; j < jl; j++) { - const camera2 = cameras[j]; + for (var j = 0, jl = cameras.length; j < jl; j++) { + var camera2 = cameras[j]; if (object.layers.test(camera2.layers)) { state.viewport(_currentViewport.copy(camera2.viewport)); @@ -17702,7 +18527,7 @@ object.normalMatrix.getNormalMatrix(object.modelViewMatrix); if (object.isImmediateRenderObject) { - const program = setProgram(camera, scene, material, object); + var program = setProgram(camera, scene, material, object); state.setMaterial(material); bindingStates.reset(); renderObjectImmediate(object, program); @@ -17716,13 +18541,13 @@ function getProgram(material, scene, object) { if (scene.isScene !== true) scene = _emptyScene; // scene could be a Mesh, Line, Points, ... - const materialProperties = properties.get(material); - const lights = currentRenderState.state.lights; - const shadowsArray = currentRenderState.state.shadowsArray; - 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 + var materialProperties = properties.get(material); + var lights = currentRenderState.state.lights; + var shadowsArray = currentRenderState.state.shadowsArray; + var lightsStateVersion = lights.state.version; + var parameters = programCache.getParameters(material, lights.state, shadowsArray, scene, object); + var programCacheKey = programCache.getProgramCacheKey(parameters); + var 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; @@ -17735,7 +18560,7 @@ materialProperties.programs = programs; } - let program = programs.get(programCacheKey); + var program = programs.get(programCacheKey); if (program !== undefined) { // early out if program and light state is identical @@ -17751,7 +18576,7 @@ materialProperties.uniforms = parameters.uniforms; } - const uniforms = materialProperties.uniforms; + var uniforms = materialProperties.uniforms; if (!material.isShaderMaterial && !material.isRawShaderMaterial || material.clipping === true) { uniforms.clippingPlanes = clipping.uniform; @@ -17784,15 +18609,15 @@ 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); + var progUniforms = program.getUniforms(); + var uniformsList = WebGLUniforms.seqWithValue(progUniforms.seq, uniforms); materialProperties.currentProgram = program; materialProperties.uniformsList = uniformsList; return program; } function updateCommonMaterialProperties(material, parameters) { - const materialProperties = properties.get(material); + var materialProperties = properties.get(material); materialProperties.outputEncoding = parameters.outputEncoding; materialProperties.instancing = parameters.instancing; materialProperties.numClippingPlanes = parameters.numClippingPlanes; @@ -17803,16 +18628,16 @@ if (scene.isScene !== true) scene = _emptyScene; // scene could be a Mesh, Line, Points, ... textures.resetTextureUnits(); - const fog = scene.fog; - const environment = material.isMeshStandardMaterial ? scene.environment : null; - const encoding = _currentRenderTarget === null ? _this.outputEncoding : _currentRenderTarget.texture.encoding; - const envMap = cubemaps.get(material.envMap || environment); - const materialProperties = properties.get(material); - const lights = currentRenderState.state.lights; + var fog = scene.fog; + var environment = material.isMeshStandardMaterial ? scene.environment : null; + var encoding = _currentRenderTarget === null ? _this.outputEncoding : _currentRenderTarget.texture.encoding; + var envMap = cubemaps.get(material.envMap || environment); + var materialProperties = properties.get(material); + var 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 + var 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) @@ -17821,7 +18646,7 @@ } // - let needsProgramChange = false; + var needsProgramChange = false; if (material.version === materialProperties.__version) { if (materialProperties.needsLights && materialProperties.lightsStateVersion !== lights.state.version) { @@ -17845,17 +18670,17 @@ } // - let program = materialProperties.currentProgram; + var 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; + var refreshProgram = false; + var refreshMaterial = false; + var refreshLights = false; + var p_uniforms = program.getUniforms(), + m_uniforms = materialProperties.uniforms; if (state.useProgram(program.program)) { refreshProgram = true; @@ -17888,7 +18713,7 @@ if (material.isShaderMaterial || material.isMeshPhongMaterial || material.isMeshToonMaterial || material.isMeshStandardMaterial || material.envMap) { - const uCamPos = p_uniforms.map.cameraPosition; + var uCamPos = p_uniforms.map.cameraPosition; if (uCamPos !== undefined) { uCamPos.setValue(_gl, _vector3.setFromMatrixPosition(camera.matrixWorld)); @@ -17910,10 +18735,10 @@ if (material.skinning) { p_uniforms.setOptional(_gl, object, 'bindMatrix'); p_uniforms.setOptional(_gl, object, 'bindMatrixInverse'); - const skeleton = object.skeleton; + var skeleton = object.skeleton; if (skeleton) { - const bones = skeleton.bones; + var bones = skeleton.bones; if (capabilities.floatVertexTextures) { if (skeleton.boneTexture === null) { @@ -17923,15 +18748,15 @@ // 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(bones.length * 4); // 4 pixels needed for 1 matrix + var size = Math.sqrt(bones.length * 4); // 4 pixels needed for 1 matrix size = MathUtils.ceilPowerOfTwo(size); size = Math.max(size, 4); - const boneMatrices = new Float32Array(size * size * 4); // 4 floats per RGBA pixel + var boneMatrices = new Float32Array(size * size * 4); // 4 floats per RGBA pixel boneMatrices.set(skeleton.boneMatrices); // copy current values - const boneTexture = new DataTexture(boneMatrices, size, size, RGBAFormat, FloatType); + var boneTexture = new DataTexture(boneMatrices, size, size, RGBAFormat, FloatType); skeleton.boneMatrices = boneMatrices; skeleton.boneTexture = boneTexture; skeleton.boneTextureSize = size; @@ -18019,7 +18844,15 @@ return _currentRenderTarget; }; - this.setRenderTarget = function (renderTarget, activeCubeFace = 0, activeMipmapLevel = 0) { + this.setRenderTarget = function (renderTarget, activeCubeFace, activeMipmapLevel) { + if (activeCubeFace === void 0) { + activeCubeFace = 0; + } + + if (activeMipmapLevel === void 0) { + activeMipmapLevel = 0; + } + _currentRenderTarget = renderTarget; _currentActiveCubeFace = activeCubeFace; _currentActiveMipmapLevel = activeMipmapLevel; @@ -18028,18 +18861,18 @@ textures.setupRenderTarget(renderTarget); } - let framebuffer = null; - let isCube = false; - let isRenderTarget3D = false; + var framebuffer = null; + var isCube = false; + var isRenderTarget3D = false; if (renderTarget) { - const texture = renderTarget.texture; + var texture = renderTarget.texture; if (texture.isDataTexture3D || texture.isDataTexture2DArray) { isRenderTarget3D = true; } - const __webglFramebuffer = properties.get(renderTarget).__webglFramebuffer; + var __webglFramebuffer = properties.get(renderTarget).__webglFramebuffer; if (renderTarget.isWebGLCubeRenderTarget) { framebuffer = __webglFramebuffer[activeCubeFace]; @@ -18069,14 +18902,15 @@ state.setScissorTest(_currentScissorTest); if (isCube) { - const textureProperties = properties.get(renderTarget.texture); + var textureProperties = properties.get(renderTarget.texture); _gl.framebufferTexture2D(36160, 36064, 34069 + activeCubeFace, textureProperties.__webglTexture, activeMipmapLevel); } else if (isRenderTarget3D) { - const textureProperties = properties.get(renderTarget.texture); - const layer = activeCubeFace || 0; + var _textureProperties = properties.get(renderTarget.texture); - _gl.framebufferTextureLayer(36160, 36064, textureProperties.__webglTexture, activeMipmapLevel || 0, layer); + var layer = activeCubeFace || 0; + + _gl.framebufferTextureLayer(36160, 36064, _textureProperties.__webglTexture, activeMipmapLevel || 0, layer); } }; @@ -18086,7 +18920,7 @@ return; } - let framebuffer = properties.get(renderTarget).__webglFramebuffer; + var framebuffer = properties.get(renderTarget).__webglFramebuffer; if (renderTarget.isWebGLCubeRenderTarget && activeCubeFaceIndex !== undefined) { framebuffer = framebuffer[activeCubeFaceIndex]; @@ -18096,16 +18930,16 @@ state.bindFramebuffer(36160, framebuffer); try { - const texture = renderTarget.texture; - const textureFormat = texture.format; - const textureType = texture.type; + var texture = renderTarget.texture; + var textureFormat = texture.format; + var textureType = texture.type; if (textureFormat !== RGBAFormat && utils.convert(textureFormat) !== _gl.getParameter(35739)) { 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')); + var 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(35738) && // 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 @@ -18124,17 +18958,22 @@ } } finally { // restore framebuffer of current render target if necessary - const framebuffer = _currentRenderTarget !== null ? properties.get(_currentRenderTarget).__webglFramebuffer : null; - state.bindFramebuffer(36160, framebuffer); + var _framebuffer = _currentRenderTarget !== null ? properties.get(_currentRenderTarget).__webglFramebuffer : null; + + state.bindFramebuffer(36160, _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); - const glFormat = utils.convert(texture.format); + this.copyFramebufferToTexture = function (position, texture, level) { + if (level === void 0) { + level = 0; + } + + var levelScale = Math.pow(2, -level); + var width = Math.floor(texture.image.width * levelScale); + var height = Math.floor(texture.image.height * levelScale); + var glFormat = utils.convert(texture.format); textures.setTexture2D(texture, 0); _gl.copyTexImage2D(3553, level, glFormat, position.x, position.y, width, height, 0); @@ -18142,11 +18981,15 @@ 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); + this.copyTextureToTexture = function (position, srcTexture, dstTexture, level) { + if (level === void 0) { + level = 0; + } + + var width = srcTexture.image.width; + var height = srcTexture.image.height; + var glFormat = utils.convert(dstTexture.format); + var 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 @@ -18171,20 +19014,23 @@ state.unbindTexture(); }; - this.copyTextureToTexture3D = function (sourceBox, position, srcTexture, dstTexture, level = 0) { + this.copyTextureToTexture3D = function (sourceBox, position, srcTexture, dstTexture, level) { + if (level === void 0) { + level = 0; + } + if (_this.isWebGL1Renderer) { console.warn('THREE.WebGLRenderer.copyTextureToTexture3D: can only be used with WebGL2.'); return; } - const { - width, - height, - data - } = srcTexture.image; - const glFormat = utils.convert(dstTexture.format); - const glType = utils.convert(dstTexture.type); - let glTarget; + var _srcTexture$image = srcTexture.image, + width = _srcTexture$image.width, + height = _srcTexture$image.height, + data = _srcTexture$image.data; + var glFormat = utils.convert(dstTexture.format); + var glType = utils.convert(dstTexture.type); + var glTarget; if (dstTexture.isDataTexture3D) { textures.setTexture3D(dstTexture, 0); @@ -18203,15 +19049,15 @@ _gl.pixelStorei(3317, dstTexture.unpackAlignment); - const unpackRowLen = _gl.getParameter(3314); + var unpackRowLen = _gl.getParameter(3314); - const unpackImageHeight = _gl.getParameter(32878); + var unpackImageHeight = _gl.getParameter(32878); - const unpackSkipPixels = _gl.getParameter(3316); + var unpackSkipPixels = _gl.getParameter(3316); - const unpackSkipRows = _gl.getParameter(3315); + var unpackSkipRows = _gl.getParameter(3315); - const unpackSkipImages = _gl.getParameter(32877); + var unpackSkipImages = _gl.getParameter(32877); _gl.pixelStorei(3314, width); @@ -18261,22 +19107,32 @@ } } - class WebGL1Renderer extends WebGLRenderer {} + var WebGL1Renderer = /*#__PURE__*/function (_WebGLRenderer) { + _inheritsLoose(WebGL1Renderer, _WebGLRenderer); + + function WebGL1Renderer() { + return _WebGLRenderer.apply(this, arguments) || this; + } + + return WebGL1Renderer; + }(WebGLRenderer); WebGL1Renderer.prototype.isWebGL1Renderer = true; - class FogExp2 { - constructor(color, density) { + var FogExp2 = /*#__PURE__*/function () { + function FogExp2(color, density) { this.name = ''; this.color = new Color(color); this.density = density !== undefined ? density : 0.00025; } - clone() { + var _proto = FogExp2.prototype; + + _proto.clone = function clone() { return new FogExp2(this.color, this.density); - } + }; - toJSON() + _proto.toJSON = function toJSON() /* meta */ { return { @@ -18284,25 +19140,28 @@ color: this.color.getHex(), density: this.density }; - } + }; - } + return FogExp2; + }(); FogExp2.prototype.isFogExp2 = true; - class Fog { - constructor(color, near, far) { + var Fog = /*#__PURE__*/function () { + function Fog(color, near, far) { this.name = ''; this.color = new Color(color); this.near = near !== undefined ? near : 1; this.far = far !== undefined ? far : 1000; } - clone() { + var _proto = Fog.prototype; + + _proto.clone = function clone() { return new Fog(this.color, this.near, this.far); - } + }; - toJSON() + _proto.toJSON = function toJSON() /* meta */ { return { @@ -18311,32 +19170,42 @@ near: this.near, far: this.far }; - } + }; - } + return Fog; + }(); Fog.prototype.isFog = true; - class Scene extends Object3D { - constructor() { - super(); - this.type = 'Scene'; - this.background = null; - this.environment = null; - this.fog = null; - this.overrideMaterial = null; - this.autoUpdate = true; // checked by the renderer + var Scene = /*#__PURE__*/function (_Object3D) { + _inheritsLoose(Scene, _Object3D); + + function Scene() { + var _this; + + _this = _Object3D.call(this) || this; + _this.type = 'Scene'; + _this.background = null; + _this.environment = null; + _this.fog = null; + _this.overrideMaterial = null; + _this.autoUpdate = true; // checked by the renderer if (typeof __THREE_DEVTOOLS__ !== 'undefined') { __THREE_DEVTOOLS__.dispatchEvent(new CustomEvent('observe', { - detail: this + detail: _assertThisInitialized(_this) })); // eslint-disable-line no-undef } + + return _this; } - copy(source, recursive) { - super.copy(source, recursive); + var _proto = Scene.prototype; + + _proto.copy = function copy(source, recursive) { + _Object3D.prototype.copy.call(this, source, recursive); + if (source.background !== null) this.background = source.background.clone(); if (source.environment !== null) this.environment = source.environment.clone(); if (source.fog !== null) this.fog = source.fog.clone(); @@ -18344,17 +19213,19 @@ this.autoUpdate = source.autoUpdate; this.matrixAutoUpdate = source.matrixAutoUpdate; return this; - } + }; + + _proto.toJSON = function toJSON(meta) { + var data = _Object3D.prototype.toJSON.call(this, meta); - toJSON(meta) { - const data = super.toJSON(meta); if (this.background !== null) data.object.background = this.background.toJSON(meta); if (this.environment !== null) data.object.environment = this.environment.toJSON(meta); if (this.fog !== null) data.object.fog = this.fog.toJSON(); return data; - } + }; - } + return Scene; + }(Object3D); Scene.prototype.isScene = true; @@ -18372,39 +19243,43 @@ } Object.defineProperty(InterleavedBuffer.prototype, 'needsUpdate', { - set: function (value) { + set: function set(value) { if (value === true) this.version++; } }); Object.assign(InterleavedBuffer.prototype, { isInterleavedBuffer: true, - onUploadCallback: function () {}, - setUsage: function (value) { + onUploadCallback: function onUploadCallback() {}, + setUsage: function setUsage(value) { this.usage = value; return this; }, - copy: function (source) { + copy: function copy(source) { this.array = new source.array.constructor(source.array); this.count = source.count; this.stride = source.stride; this.usage = source.usage; return this; }, - copyAt: function (index1, attribute, index2) { + copyAt: function copyAt(index1, attribute, index2) { index1 *= this.stride; index2 *= attribute.stride; - for (let i = 0, l = this.stride; i < l; i++) { + for (var i = 0, l = this.stride; i < l; i++) { this.array[index1 + i] = attribute.array[index2 + i]; } return this; }, - set: function (value, offset = 0) { + set: function set(value, offset) { + if (offset === void 0) { + offset = 0; + } + this.array.set(value, offset); return this; }, - clone: function (data) { + clone: function clone(data) { if (data.arrayBuffers === undefined) { data.arrayBuffers = {}; } @@ -18417,16 +19292,16 @@ 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 InterleavedBuffer(array, this.stride); + var array = new this.array.constructor(data.arrayBuffers[this.array.buffer._uuid]); + var ib = new InterleavedBuffer(array, this.stride); ib.setUsage(this.usage); return ib; }, - onUpload: function (callback) { + onUpload: function onUpload(callback) { this.onUploadCallback = callback; return this; }, - toJSON: function (data) { + toJSON: function toJSON(data) { if (data.arrayBuffers === undefined) { data.arrayBuffers = {}; } // generate UUID for array buffer if necessary @@ -18450,7 +19325,7 @@ } }); - const _vector$6 = new Vector3(); + var _vector$6 = new Vector3(); function InterleavedBufferAttribute(interleavedBuffer, itemSize, offset, normalized) { this.name = ''; @@ -18462,25 +19337,25 @@ Object.defineProperties(InterleavedBufferAttribute.prototype, { count: { - get: function () { + get: function get() { return this.data.count; } }, array: { - get: function () { + get: function get() { return this.data.array; } }, needsUpdate: { - set: function (value) { + set: function set(value) { this.data.needsUpdate = value; } } }); Object.assign(InterleavedBufferAttribute.prototype, { isInterleavedBufferAttribute: true, - applyMatrix4: function (m) { - for (let i = 0, l = this.data.count; i < l; i++) { + applyMatrix4: function applyMatrix4(m) { + for (var 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); @@ -18492,8 +19367,8 @@ return this; }, - applyNormalMatrix: function (m) { - for (let i = 0, l = this.count; i < l; i++) { + applyNormalMatrix: function applyNormalMatrix(m) { + for (var 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); @@ -18505,8 +19380,8 @@ return this; }, - transformDirection: function (m) { - for (let i = 0, l = this.count; i < l; i++) { + transformDirection: function transformDirection(m) { + for (var 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); @@ -18518,48 +19393,48 @@ return this; }, - setX: function (index, x) { + setX: function setX(index, x) { this.data.array[index * this.data.stride + this.offset] = x; return this; }, - setY: function (index, y) { + setY: function setY(index, y) { this.data.array[index * this.data.stride + this.offset + 1] = y; return this; }, - setZ: function (index, z) { + setZ: function setZ(index, z) { this.data.array[index * this.data.stride + this.offset + 2] = z; return this; }, - setW: function (index, w) { + setW: function setW(index, w) { this.data.array[index * this.data.stride + this.offset + 3] = w; return this; }, - getX: function (index) { + getX: function getX(index) { return this.data.array[index * this.data.stride + this.offset]; }, - getY: function (index) { + getY: function getY(index) { return this.data.array[index * this.data.stride + this.offset + 1]; }, - getZ: function (index) { + getZ: function getZ(index) { return this.data.array[index * this.data.stride + this.offset + 2]; }, - getW: function (index) { + getW: function getW(index) { return this.data.array[index * this.data.stride + this.offset + 3]; }, - setXY: function (index, x, y) { + setXY: function 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: function (index, x, y, z) { + setXYZ: function setXYZ(index, x, y, z) { index = index * this.data.stride + this.offset; this.data.array[index + 0] = x; this.data.array[index + 1] = y; this.data.array[index + 2] = z; return this; }, - setXYZW: function (index, x, y, z, w) { + setXYZW: function setXYZW(index, x, y, z, w) { index = index * this.data.stride + this.offset; this.data.array[index + 0] = x; this.data.array[index + 1] = y; @@ -18567,15 +19442,15 @@ this.data.array[index + 3] = w; return this; }, - clone: function (data) { + clone: function clone(data) { if (data === undefined) { console.log('THREE.InterleavedBufferAttribute.clone(): Cloning an interlaved buffer attribute will deinterleave buffer data.'); - const array = []; + var array = []; - for (let i = 0; i < this.count; i++) { - const index = i * this.data.stride + this.offset; + for (var i = 0; i < this.count; i++) { + var index = i * this.data.stride + this.offset; - for (let j = 0; j < this.itemSize; j++) { + for (var j = 0; j < this.itemSize; j++) { array.push(this.data.array[index + j]); } } @@ -18593,15 +19468,15 @@ return new InterleavedBufferAttribute(data.interleavedBuffers[this.data.uuid], this.itemSize, this.offset, this.normalized); } }, - toJSON: function (data) { + toJSON: function toJSON(data) { if (data === undefined) { console.log('THREE.InterleavedBufferAttribute.toJSON(): Serializing an interlaved buffer attribute will deinterleave buffer data.'); - const array = []; + var array = []; - for (let i = 0; i < this.count; i++) { - const index = i * this.data.stride + this.offset; + for (var i = 0; i < this.count; i++) { + var index = i * this.data.stride + this.offset; - for (let j = 0; j < this.itemSize; j++) { + for (var 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 @@ -18644,68 +19519,83 @@ * } */ - class SpriteMaterial extends Material { - constructor(parameters) { - super(); - this.type = 'SpriteMaterial'; - this.color = new Color(0xffffff); - this.map = null; - this.alphaMap = null; - this.rotation = 0; - this.sizeAttenuation = true; - this.transparent = true; - this.setValues(parameters); + var SpriteMaterial = /*#__PURE__*/function (_Material) { + _inheritsLoose(SpriteMaterial, _Material); + + function SpriteMaterial(parameters) { + var _this; + + _this = _Material.call(this) || this; + _this.type = 'SpriteMaterial'; + _this.color = new Color(0xffffff); + _this.map = null; + _this.alphaMap = null; + _this.rotation = 0; + _this.sizeAttenuation = true; + _this.transparent = true; + + _this.setValues(parameters); + + return _this; } - copy(source) { - super.copy(source); + var _proto = SpriteMaterial.prototype; + + _proto.copy = function copy(source) { + _Material.prototype.copy.call(this, source); + this.color.copy(source.color); this.map = source.map; this.alphaMap = source.alphaMap; this.rotation = source.rotation; this.sizeAttenuation = source.sizeAttenuation; return this; - } + }; - } + return SpriteMaterial; + }(Material); SpriteMaterial.prototype.isSpriteMaterial = true; - let _geometry; + var _geometry; + + var _intersectPoint = /*@__PURE__*/new Vector3(); + + var _worldScale = /*@__PURE__*/new Vector3(); - const _intersectPoint = /*@__PURE__*/new Vector3(); + var _mvPosition = /*@__PURE__*/new Vector3(); - const _worldScale = /*@__PURE__*/new Vector3(); + var _alignedPosition = /*@__PURE__*/new Vector2(); - const _mvPosition = /*@__PURE__*/new Vector3(); + var _rotatedPosition = /*@__PURE__*/new Vector2(); - const _alignedPosition = /*@__PURE__*/new Vector2(); + var _viewWorldMatrix = /*@__PURE__*/new Matrix4(); - const _rotatedPosition = /*@__PURE__*/new Vector2(); + var _vA$1 = /*@__PURE__*/new Vector3(); - const _viewWorldMatrix = /*@__PURE__*/new Matrix4(); + var _vB$1 = /*@__PURE__*/new Vector3(); - const _vA = /*@__PURE__*/new Vector3(); + var _vC$1 = /*@__PURE__*/new Vector3(); - const _vB = /*@__PURE__*/new Vector3(); + var _uvA$1 = /*@__PURE__*/new Vector2(); - const _vC = /*@__PURE__*/new Vector3(); + var _uvB$1 = /*@__PURE__*/new Vector2(); - const _uvA = /*@__PURE__*/new Vector2(); + var _uvC$1 = /*@__PURE__*/new Vector2(); - const _uvB = /*@__PURE__*/new Vector2(); + var Sprite = /*#__PURE__*/function (_Object3D) { + _inheritsLoose(Sprite, _Object3D); - const _uvC = /*@__PURE__*/new Vector2(); + function Sprite(material) { + var _this; - class Sprite extends Object3D { - constructor(material) { - super(); - this.type = 'Sprite'; + _this = _Object3D.call(this) || this; + _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); + var 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]); + var interleavedBuffer = new InterleavedBuffer(float32Array, 5); _geometry.setIndex([0, 1, 2, 0, 2, 3]); @@ -18714,12 +19604,15 @@ _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); + _this.geometry = _geometry; + _this.material = material !== undefined ? material : new SpriteMaterial(); + _this.center = new Vector2(0.5, 0.5); + return _this; } - raycast(raycaster, intersects) { + var _proto = Sprite.prototype; + + _proto.raycast = function raycast(raycaster, intersects) { if (raycaster.camera === null) { console.error('THREE.Sprite: "Raycaster.camera" needs to be set in order to raycast against sprites.'); } @@ -18736,60 +19629,62 @@ _worldScale.multiplyScalar(-_mvPosition.z); } - const rotation = this.material.rotation; - let sin, cos; + var rotation = this.material.rotation; + var 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); + var center = this.center; + transformVertex(_vA$1.set(-0.5, -0.5, 0), _mvPosition, center, _worldScale, sin, cos); + transformVertex(_vB$1.set(0.5, -0.5, 0), _mvPosition, center, _worldScale, sin, cos); + transformVertex(_vC$1.set(0.5, 0.5, 0), _mvPosition, center, _worldScale, sin, cos); - _uvA.set(0, 0); + _uvA$1.set(0, 0); - _uvB.set(1, 0); + _uvB$1.set(1, 0); - _uvC.set(1, 1); // check first triangle + _uvC$1.set(1, 1); // check first triangle - let intersect = raycaster.ray.intersectTriangle(_vA, _vB, _vC, false, _intersectPoint); + var intersect = raycaster.ray.intersectTriangle(_vA$1, _vB$1, _vC$1, false, _intersectPoint); if (intersect === null) { // check second triangle - transformVertex(_vB.set(-0.5, 0.5, 0), _mvPosition, center, _worldScale, sin, cos); + transformVertex(_vB$1.set(-0.5, 0.5, 0), _mvPosition, center, _worldScale, sin, cos); - _uvB.set(0, 1); + _uvB$1.set(0, 1); - intersect = raycaster.ray.intersectTriangle(_vA, _vC, _vB, false, _intersectPoint); + intersect = raycaster.ray.intersectTriangle(_vA$1, _vC$1, _vB$1, false, _intersectPoint); if (intersect === null) { return; } } - const distance = raycaster.ray.origin.distanceTo(_intersectPoint); + var distance = raycaster.ray.origin.distanceTo(_intersectPoint); if (distance < raycaster.near || distance > raycaster.far) return; intersects.push({ distance: distance, point: _intersectPoint.clone(), - uv: Triangle.getUV(_intersectPoint, _vA, _vB, _vC, _uvA, _uvB, _uvC, new Vector2()), + uv: Triangle.getUV(_intersectPoint, _vA$1, _vB$1, _vC$1, _uvA$1, _uvB$1, _uvC$1, new Vector2()), face: null, object: this }); - } + }; + + _proto.copy = function copy(source) { + _Object3D.prototype.copy.call(this, source); - copy(source) { - super.copy(source); if (source.center !== undefined) this.center.copy(source.center); this.material = source.material; return this; - } + }; - } + return Sprite; + }(Object3D); Sprite.prototype.isSprite = true; @@ -18812,16 +19707,20 @@ vertexPosition.applyMatrix4(_viewWorldMatrix); } - const _v1$2 = /*@__PURE__*/new Vector3(); + var _v1$5 = /*@__PURE__*/new Vector3(); + + var _v2$2 = /*@__PURE__*/new Vector3(); - const _v2$1 = /*@__PURE__*/new Vector3(); + var LOD = /*#__PURE__*/function (_Object3D) { + _inheritsLoose(LOD, _Object3D); - class LOD extends Object3D { - constructor() { - super(); - this._currentLevel = 0; - this.type = 'LOD'; - Object.defineProperties(this, { + function LOD() { + var _this; + + _this = _Object3D.call(this) || this; + _this._currentLevel = 0; + _this.type = 'LOD'; + Object.defineProperties(_assertThisInitialized(_this), { levels: { enumerable: true, value: [] @@ -18830,26 +19729,34 @@ value: true } }); - this.autoUpdate = true; + _this.autoUpdate = true; + return _this; } - copy(source) { - super.copy(source, false); - const levels = source.levels; + var _proto = LOD.prototype; + + _proto.copy = function copy(source) { + _Object3D.prototype.copy.call(this, source, false); + + var levels = source.levels; - for (let i = 0, l = levels.length; i < l; i++) { - const level = levels[i]; + for (var i = 0, l = levels.length; i < l; i++) { + var level = levels[i]; this.addLevel(level.object.clone(), level.distance); } this.autoUpdate = source.autoUpdate; return this; - } + }; + + _proto.addLevel = function addLevel(object, distance) { + if (distance === void 0) { + distance = 0; + } - addLevel(object, distance = 0) { distance = Math.abs(distance); - const levels = this.levels; - let l; + var levels = this.levels; + var l; for (l = 0; l < levels.length; l++) { if (distance < levels[l].distance) { @@ -18863,17 +19770,17 @@ }); this.add(object); return this; - } + }; - getCurrentLevel() { + _proto.getCurrentLevel = function getCurrentLevel() { return this._currentLevel; - } + }; - getObjectForDistance(distance) { - const levels = this.levels; + _proto.getObjectForDistance = function getObjectForDistance(distance) { + var levels = this.levels; if (levels.length > 0) { - let i, l; + var i, l; for (i = 1, l = levels.length; i < l; i++) { if (distance < levels[i].distance) { @@ -18885,30 +19792,30 @@ } return null; - } + }; - raycast(raycaster, intersects) { - const levels = this.levels; + _proto.raycast = function raycast(raycaster, intersects) { + var levels = this.levels; if (levels.length > 0) { - _v1$2.setFromMatrixPosition(this.matrixWorld); + _v1$5.setFromMatrixPosition(this.matrixWorld); - const distance = raycaster.ray.origin.distanceTo(_v1$2); + var distance = raycaster.ray.origin.distanceTo(_v1$5); this.getObjectForDistance(distance).raycast(raycaster, intersects); } - } + }; - update(camera) { - const levels = this.levels; + _proto.update = function update(camera) { + var levels = this.levels; if (levels.length > 1) { - _v1$2.setFromMatrixPosition(camera.matrixWorld); + _v1$5.setFromMatrixPosition(camera.matrixWorld); - _v2$1.setFromMatrixPosition(this.matrixWorld); + _v2$2.setFromMatrixPosition(this.matrixWorld); - const distance = _v1$2.distanceTo(_v2$1) / camera.zoom; + var distance = _v1$5.distanceTo(_v2$2) / camera.zoom; levels[0].object.visible = true; - let i, l; + var i, l; for (i = 1, l = levels.length; i < l; i++) { if (distance >= levels[i].distance) { @@ -18925,16 +19832,17 @@ levels[i].object.visible = false; } } - } + }; + + _proto.toJSON = function toJSON(meta) { + var data = _Object3D.prototype.toJSON.call(this, meta); - toJSON(meta) { - const data = super.toJSON(meta); if (this.autoUpdate === false) data.object.autoUpdate = false; data.object.levels = []; - const levels = this.levels; + var levels = this.levels; - for (let i = 0, l = levels.length; i < l; i++) { - const level = levels[i]; + for (var i = 0, l = levels.length; i < l; i++) { + var level = levels[i]; data.object.levels.push({ object: level.object.uuid, distance: level.distance @@ -18942,19 +19850,20 @@ } return data; - } + }; - } + return LOD; + }(Object3D); - const _basePosition = new Vector3(); + var _basePosition = new Vector3(); - const _skinIndex = new Vector4(); + var _skinIndex = new Vector4(); - const _skinWeight = new Vector4(); + var _skinWeight = new Vector4(); - const _vector$5 = new Vector3(); + var _vector$7 = new Vector3(); - const _matrix = new Matrix4(); + var _matrix$1 = new Matrix4(); function SkinnedMesh(geometry, material) { Mesh.call(this, geometry, material); @@ -18967,7 +19876,7 @@ SkinnedMesh.prototype = Object.assign(Object.create(Mesh.prototype), { constructor: SkinnedMesh, isSkinnedMesh: true, - copy: function (source) { + copy: function copy(source) { Mesh.prototype.copy.call(this, source); this.bindMode = source.bindMode; this.bindMatrix.copy(source.bindMatrix); @@ -18975,7 +19884,7 @@ this.skeleton = source.skeleton; return this; }, - bind: function (skeleton, bindMatrix) { + bind: function bind(skeleton, bindMatrix) { this.skeleton = skeleton; if (bindMatrix === undefined) { @@ -18987,19 +19896,19 @@ this.bindMatrix.copy(bindMatrix); this.bindMatrixInverse.copy(bindMatrix).invert(); }, - pose: function () { + pose: function pose() { this.skeleton.pose(); }, - normalizeSkinWeights: function () { - const vector = new Vector4(); - const skinWeight = this.geometry.attributes.skinWeight; + normalizeSkinWeights: function normalizeSkinWeights() { + var vector = new Vector4(); + var skinWeight = this.geometry.attributes.skinWeight; - for (let i = 0, l = skinWeight.count; i < l; i++) { + for (var 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(); + var scale = 1.0 / vector.manhattanLength(); if (scale !== Infinity) { vector.multiplyScalar(scale); @@ -19010,7 +19919,7 @@ skinWeight.setXYZW(i, vector.x, vector.y, vector.z, vector.w); } }, - updateMatrixWorld: function (force) { + updateMatrixWorld: function updateMatrixWorld(force) { Mesh.prototype.updateMatrixWorld.call(this, force); if (this.bindMode === 'attached') { @@ -19021,9 +19930,9 @@ console.warn('THREE.SkinnedMesh: Unrecognized bindMode: ' + this.bindMode); } }, - boneTransform: function (index, target) { - const skeleton = this.skeleton; - const geometry = this.geometry; + boneTransform: function boneTransform(index, target) { + var skeleton = this.skeleton; + var geometry = this.geometry; _skinIndex.fromBufferAttribute(geometry.attributes.skinIndex, index); @@ -19033,15 +19942,15 @@ target.set(0, 0, 0); - for (let i = 0; i < 4; i++) { - const weight = _skinWeight.getComponent(i); + for (var i = 0; i < 4; i++) { + var weight = _skinWeight.getComponent(i); if (weight !== 0) { - const boneIndex = _skinIndex.getComponent(i); + var boneIndex = _skinIndex.getComponent(i); - _matrix.multiplyMatrices(skeleton.bones[boneIndex].matrixWorld, skeleton.boneInverses[boneIndex]); + _matrix$1.multiplyMatrices(skeleton.bones[boneIndex].matrixWorld, skeleton.boneInverses[boneIndex]); - target.addScaledVector(_vector$5.copy(_basePosition).applyMatrix4(_matrix), weight); + target.addScaledVector(_vector$7.copy(_basePosition).applyMatrix4(_matrix$1), weight); } } @@ -19059,12 +19968,20 @@ isBone: true }); - const _offsetMatrix = /*@__PURE__*/new Matrix4(); + var _offsetMatrix = /*@__PURE__*/new Matrix4(); + + var _identityMatrix = /*@__PURE__*/new Matrix4(); + + var Skeleton = /*#__PURE__*/function () { + function Skeleton(bones, boneInverses) { + if (bones === void 0) { + bones = []; + } - const _identityMatrix = /*@__PURE__*/new Matrix4(); + if (boneInverses === void 0) { + boneInverses = []; + } - class Skeleton { - constructor(bones = [], boneInverses = []) { this.uuid = MathUtils.generateUUID(); this.bones = bones.slice(0); this.boneInverses = boneInverses; @@ -19075,9 +19992,11 @@ this.init(); } - init() { - const bones = this.bones; - const boneInverses = this.boneInverses; + var _proto = Skeleton.prototype; + + _proto.init = function init() { + var bones = this.bones; + var boneInverses = this.boneInverses; this.boneMatrices = new Float32Array(bones.length * 16); // calculate inverse bone matrices if necessary if (boneInverses.length === 0) { @@ -19088,18 +20007,18 @@ 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++) { + for (var i = 0, il = this.bones.length; i < il; i++) { this.boneInverses.push(new Matrix4()); } } } - } + }; - calculateInverses() { + _proto.calculateInverses = function calculateInverses() { this.boneInverses.length = 0; - for (let i = 0, il = this.bones.length; i < il; i++) { - const inverse = new Matrix4(); + for (var i = 0, il = this.bones.length; i < il; i++) { + var inverse = new Matrix4(); if (this.bones[i]) { inverse.copy(this.bones[i].matrixWorld).invert(); @@ -19107,12 +20026,12 @@ this.boneInverses.push(inverse); } - } + }; - pose() { + _proto.pose = function pose() { // recover the bind-time world matrices - for (let i = 0, il = this.bones.length; i < il; i++) { - const bone = this.bones[i]; + for (var i = 0, il = this.bones.length; i < il; i++) { + var bone = this.bones[i]; if (bone) { bone.matrixWorld.copy(this.boneInverses[i]).invert(); @@ -19120,31 +20039,32 @@ } // compute the local matrices, positions, rotations and scales - for (let i = 0, il = this.bones.length; i < il; i++) { - const bone = this.bones[i]; + for (var _i = 0, _il = this.bones.length; _i < _il; _i++) { + var _bone = this.bones[_i]; - if (bone) { - if (bone.parent && bone.parent.isBone) { - bone.matrix.copy(bone.parent.matrixWorld).invert(); - bone.matrix.multiply(bone.matrixWorld); + if (_bone) { + if (_bone.parent && _bone.parent.isBone) { + _bone.matrix.copy(_bone.parent.matrixWorld).invert(); + + _bone.matrix.multiply(_bone.matrixWorld); } else { - bone.matrix.copy(bone.matrixWorld); + _bone.matrix.copy(_bone.matrixWorld); } - bone.matrix.decompose(bone.position, bone.quaternion, bone.scale); + _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 + _proto.update = function update() { + var bones = this.bones; + var boneInverses = this.boneInverses; + var boneMatrices = this.boneMatrices; + var boneTexture = this.boneTexture; // flatten bone matrices to array - for (let i = 0, il = bones.length; i < il; i++) { + for (var 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; + var matrix = bones[i] ? bones[i].matrixWorld : _identityMatrix; _offsetMatrix.multiplyMatrices(matrix, boneInverses[i]); @@ -19154,15 +20074,15 @@ if (boneTexture !== null) { boneTexture.needsUpdate = true; } - } + }; - clone() { + _proto.clone = function clone() { return new Skeleton(this.bones, this.boneInverses); - } + }; - getBoneByName(name) { - for (let i = 0, il = this.bones.length; i < il; i++) { - const bone = this.bones[i]; + _proto.getBoneByName = function getBoneByName(name) { + for (var i = 0, il = this.bones.length; i < il; i++) { + var bone = this.bones[i]; if (bone.name === name) { return bone; @@ -19170,21 +20090,21 @@ } return undefined; - } + }; - dispose() { + _proto.dispose = function dispose() { if (this.boneTexture !== null) { this.boneTexture.dispose(); this.boneTexture = null; } - } + }; - fromJSON(json, bones) { + _proto.fromJSON = function 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]; + for (var i = 0, l = json.bones.length; i < l; i++) { + var uuid = json.bones[i]; + var bone = bones[uuid]; if (bone === undefined) { console.warn('THREE.Skeleton: No bone found with UUID:', uuid); @@ -19197,10 +20117,10 @@ this.init(); return this; - } + }; - toJSON() { - const data = { + _proto.toJSON = function toJSON() { + var data = { metadata: { version: 4.5, type: 'Skeleton', @@ -19210,61 +20130,115 @@ boneInverses: [] }; data.uuid = this.uuid; - const bones = this.bones; - const boneInverses = this.boneInverses; + var bones = this.bones; + var boneInverses = this.boneInverses; - for (let i = 0, l = bones.length; i < l; i++) { - const bone = bones[i]; + for (var i = 0, l = bones.length; i < l; i++) { + var bone = bones[i]; data.bones.push(bone.uuid); - const boneInverse = boneInverses[i]; + var boneInverse = boneInverses[i]; data.boneInverses.push(boneInverse.toArray()); } return data; - } + }; - } + return Skeleton; + }(); - const _instanceLocalMatrix = new Matrix4(); + var _instanceLocalMatrix = new Matrix4(); - const _instanceWorldMatrix = new Matrix4(); + var _instanceWorldMatrix = new Matrix4(); - const _instanceIntersects = []; + var _instanceIntersects = []; - const _mesh = new Mesh(); + var _box3 = new Box3(); + + var _mesh = new Mesh(); + + var _sphere$2 = new Sphere(); function InstancedMesh(geometry, material, count) { Mesh.call(this, geometry, material); this.instanceMatrix = new BufferAttribute(new Float32Array(count * 16), 16); this.instanceColor = null; this.count = count; - this.frustumCulled = false; + this.boundingBox = null; + this.boundingSphere = null; } InstancedMesh.prototype = Object.assign(Object.create(Mesh.prototype), { constructor: InstancedMesh, isInstancedMesh: true, - copy: function (source) { + computeBoundingBox: function computeBoundingBox() { + var geometry = this.geometry; + var count = this.count; + + if (this.boundingBox === null) { + this.boundingBox = new Box3(); + } + + if (geometry.boundingBox === null) { + geometry.computeBoundingBox(); + } + + this.boundingBox.makeEmpty(); + + for (var i = 0; i < count; i++) { + this.getMatrixAt(i, _instanceLocalMatrix); + + _box3.copy(geometry.boundingBox).applyMatrix4(_instanceLocalMatrix); + + this.boundingBox.union(_box3); + } + + return this; + }, + computeBoundingSphere: function computeBoundingSphere() { + var geometry = this.geometry; + var count = this.count; + + if (this.boundingSphere === null) { + this.boundingSphere = new Sphere(); + } + + if (geometry.boundingSphere === null) { + geometry.computeBoundingSphere(); + } + + this.boundingSphere.makeEmpty(); + + for (var i = 0; i < count; i++) { + this.getMatrixAt(i, _instanceLocalMatrix); + + _sphere$2.copy(geometry.boundingSphere).applyMatrix4(_instanceLocalMatrix); + + this.boundingSphere.union(_sphere$2); + } + + return this; + }, + copy: function copy(source) { Mesh.prototype.copy.call(this, source); this.instanceMatrix.copy(source.instanceMatrix); if (source.instanceColor !== null) this.instanceColor = source.instanceColor.clone(); this.count = source.count; return this; }, - getColorAt: function (index, color) { + getColorAt: function getColorAt(index, color) { color.fromArray(this.instanceColor.array, index * 3); }, - getMatrixAt: function (index, matrix) { + getMatrixAt: function getMatrixAt(index, matrix) { matrix.fromArray(this.instanceMatrix.array, index * 16); }, - raycast: function (raycaster, intersects) { - const matrixWorld = this.matrixWorld; - const raycastTimes = this.count; + raycast: function raycast(raycaster, intersects) { + var matrixWorld = this.matrixWorld; + var raycastTimes = this.count; _mesh.geometry = this.geometry; _mesh.material = this.material; if (_mesh.material === undefined) return; - for (let instanceId = 0; instanceId < raycastTimes; instanceId++) { + for (var instanceId = 0; instanceId < raycastTimes; instanceId++) { // calculate the world matrix for each instance this.getMatrixAt(instanceId, _instanceLocalMatrix); @@ -19276,8 +20250,8 @@ _mesh.raycast(raycaster, _instanceIntersects); // process the result of raycast - for (let i = 0, l = _instanceIntersects.length; i < l; i++) { - const intersect = _instanceIntersects[i]; + for (var i = 0, l = _instanceIntersects.length; i < l; i++) { + var intersect = _instanceIntersects[i]; intersect.instanceId = instanceId; intersect.object = this; intersects.push(intersect); @@ -19286,18 +20260,18 @@ _instanceIntersects.length = 0; } }, - setColorAt: function (index, color) { + setColorAt: function setColorAt(index, color) { if (this.instanceColor === null) { this.instanceColor = new BufferAttribute(new Float32Array(this.count * 3), 3); } color.toArray(this.instanceColor.array, index * 3); }, - setMatrixAt: function (index, matrix) { + setMatrixAt: function setMatrixAt(index, matrix) { matrix.toArray(this.instanceMatrix.array, index * 16); }, - updateMorphTargets: function () {}, - dispose: function () { + updateMorphTargets: function updateMorphTargets() {}, + dispose: function dispose() { this.dispatchEvent({ type: 'dispose' }); @@ -19315,43 +20289,62 @@ * } */ - class LineBasicMaterial extends Material { - constructor(parameters) { - super(); - this.type = 'LineBasicMaterial'; - this.color = new Color(0xffffff); - this.linewidth = 1; - this.linecap = 'round'; - this.linejoin = 'round'; - this.morphTargets = false; - this.setValues(parameters); + var LineBasicMaterial = /*#__PURE__*/function (_Material) { + _inheritsLoose(LineBasicMaterial, _Material); + + function LineBasicMaterial(parameters) { + var _this; + + _this = _Material.call(this) || this; + _this.type = 'LineBasicMaterial'; + _this.color = new Color(0xffffff); + _this.linewidth = 1; + _this.linecap = 'round'; + _this.linejoin = 'round'; + _this.morphTargets = false; + + _this.setValues(parameters); + + return _this; } - copy(source) { - super.copy(source); + var _proto = LineBasicMaterial.prototype; + + _proto.copy = function copy(source) { + _Material.prototype.copy.call(this, source); + this.color.copy(source.color); this.linewidth = source.linewidth; this.linecap = source.linecap; this.linejoin = source.linejoin; this.morphTargets = source.morphTargets; return this; - } + }; - } + return LineBasicMaterial; + }(Material); LineBasicMaterial.prototype.isLineBasicMaterial = true; - const _start$1 = new Vector3(); + var _start = new Vector3(); + + var _end = new Vector3(); + + var _inverseMatrix$1 = new Matrix4(); - const _end$1 = new Vector3(); + var _ray$1 = new Ray(); - const _inverseMatrix$1 = new Matrix4(); + var _sphere$3 = new Sphere(); - const _ray$1 = new Ray(); + function Line(geometry, material) { + if (geometry === void 0) { + geometry = new BufferGeometry(); + } - const _sphere$1 = new Sphere(); + if (material === void 0) { + material = new LineBasicMaterial(); + } - function Line(geometry = new BufferGeometry(), material = new LineBasicMaterial()) { Object3D.call(this); this.type = 'Line'; this.geometry = geometry; @@ -19362,28 +20355,28 @@ Line.prototype = Object.assign(Object.create(Object3D.prototype), { constructor: Line, isLine: true, - copy: function (source) { + copy: function copy(source) { Object3D.prototype.copy.call(this, source); this.material = source.material; this.geometry = source.geometry; return this; }, - computeLineDistances: function () { - const geometry = this.geometry; + computeLineDistances: function computeLineDistances() { + var geometry = this.geometry; if (geometry.isBufferGeometry) { // we assume non-indexed geometry if (geometry.index === null) { - const positionAttribute = geometry.attributes.position; - const lineDistances = [0]; + var positionAttribute = geometry.attributes.position; + var lineDistances = [0]; - for (let i = 1, l = positionAttribute.count; i < l; i++) { - _start$1.fromBufferAttribute(positionAttribute, i - 1); + for (var i = 1, l = positionAttribute.count; i < l; i++) { + _start.fromBufferAttribute(positionAttribute, i - 1); - _end$1.fromBufferAttribute(positionAttribute, i); + _end.fromBufferAttribute(positionAttribute, i); lineDistances[i] = lineDistances[i - 1]; - lineDistances[i] += _start$1.distanceTo(_end$1); + lineDistances[i] += _start.distanceTo(_end); } geometry.setAttribute('lineDistance', new Float32BufferAttribute(lineDistances, 1)); @@ -19396,54 +20389,54 @@ return this; }, - raycast: function (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 + raycast: function raycast(raycaster, intersects) { + var geometry = this.geometry; + var matrixWorld = this.matrixWorld; + var threshold = raycaster.params.Line.threshold; + var drawRange = geometry.drawRange; // Checking boundingSphere distance to ray if (geometry.boundingSphere === null) geometry.computeBoundingSphere(); - _sphere$1.copy(geometry.boundingSphere); + _sphere$3.copy(geometry.boundingSphere); - _sphere$1.applyMatrix4(matrixWorld); + _sphere$3.applyMatrix4(matrixWorld); - _sphere$1.radius += threshold; - if (raycaster.ray.intersectsSphere(_sphere$1) === false) return; // + _sphere$3.radius += threshold; + if (raycaster.ray.intersectsSphere(_sphere$3) === false) return; // _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(); - const vEnd = new Vector3(); - const interSegment = new Vector3(); - const interRay = new Vector3(); - const step = this.isLineSegments ? 2 : 1; + var localThreshold = threshold / ((this.scale.x + this.scale.y + this.scale.z) / 3); + var localThresholdSq = localThreshold * localThreshold; + var vStart = new Vector3(); + var vEnd = new Vector3(); + var interSegment = new Vector3(); + var interRay = new Vector3(); + var step = this.isLineSegments ? 2 : 1; if (geometry.isBufferGeometry) { - const index = geometry.index; - const attributes = geometry.attributes; - const positionAttribute = attributes.position; + var index = geometry.index; + var attributes = geometry.attributes; + var positionAttribute = attributes.position; if (index !== null) { - const start = Math.max(0, drawRange.start); - const end = Math.min(index.count, drawRange.start + drawRange.count); + var start = Math.max(0, drawRange.start); + var 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); + for (var i = start, l = end - 1; i < l; i += step) { + var a = index.getX(i); + var b = index.getX(i + 1); vStart.fromBufferAttribute(positionAttribute, a); vEnd.fromBufferAttribute(positionAttribute, b); - const distSq = _ray$1.distanceSqToSegment(vStart, vEnd, interRay, interSegment); + var distSq = _ray$1.distanceSqToSegment(vStart, vEnd, interRay, interSegment); if (distSq > localThresholdSq) continue; interRay.applyMatrix4(this.matrixWorld); //Move back to world space for distance calculation - const distance = raycaster.ray.origin.distanceTo(interRay); + var distance = raycaster.ray.origin.distanceTo(interRay); if (distance < raycaster.near || distance > raycaster.far) continue; intersects.push({ distance: distance, @@ -19457,26 +20450,28 @@ }); } } else { - const start = Math.max(0, drawRange.start); - const end = Math.min(positionAttribute.count, drawRange.start + drawRange.count); + var _start2 = Math.max(0, drawRange.start); - for (let i = start, l = end - 1; i < l; i += step) { - vStart.fromBufferAttribute(positionAttribute, i); - vEnd.fromBufferAttribute(positionAttribute, i + 1); + var _end2 = Math.min(positionAttribute.count, drawRange.start + drawRange.count); - const distSq = _ray$1.distanceSqToSegment(vStart, vEnd, interRay, interSegment); + for (var _i = _start2, _l = _end2 - 1; _i < _l; _i += step) { + vStart.fromBufferAttribute(positionAttribute, _i); + vEnd.fromBufferAttribute(positionAttribute, _i + 1); - if (distSq > localThresholdSq) continue; + var _distSq = _ray$1.distanceSqToSegment(vStart, vEnd, interRay, interSegment); + + if (_distSq > localThresholdSq) continue; interRay.applyMatrix4(this.matrixWorld); //Move back to world space for distance calculation - const distance = raycaster.ray.origin.distanceTo(interRay); - if (distance < raycaster.near || distance > raycaster.far) continue; + var _distance = raycaster.ray.origin.distanceTo(interRay); + + if (_distance < raycaster.near || _distance > raycaster.far) continue; intersects.push({ - distance: distance, + distance: _distance, // What do we want? intersection point on the ray or on the segment?? // point: raycaster.ray.at( distance ), point: interSegment.clone().applyMatrix4(this.matrixWorld), - index: i, + index: _i, face: null, faceIndex: null, object: this @@ -19487,29 +20482,29 @@ console.error('THREE.Line.raycast() no longer supports THREE.Geometry. Use THREE.BufferGeometry instead.'); } }, - updateMorphTargets: function () { - const geometry = this.geometry; + updateMorphTargets: function updateMorphTargets() { + var geometry = this.geometry; if (geometry.isBufferGeometry) { - const morphAttributes = geometry.morphAttributes; - const keys = Object.keys(morphAttributes); + var morphAttributes = geometry.morphAttributes; + var keys = Object.keys(morphAttributes); if (keys.length > 0) { - const morphAttribute = morphAttributes[keys[0]]; + var 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); + for (var m = 0, ml = morphAttribute.length; m < ml; m++) { + var name = morphAttribute[m].name || String(m); this.morphTargetInfluences.push(0); this.morphTargetDictionary[name] = m; } } } } else { - const morphTargets = geometry.morphTargets; + var morphTargets = geometry.morphTargets; if (morphTargets !== undefined && morphTargets.length > 0) { console.error('THREE.Line.updateMorphTargets() does not support THREE.Geometry. Use THREE.BufferGeometry instead.'); @@ -19518,9 +20513,9 @@ } }); - const _start = new Vector3(); + var _start$1 = new Vector3(); - const _end = new Vector3(); + var _end$1 = new Vector3(); function LineSegments(geometry, material) { Line.call(this, geometry, material); @@ -19530,22 +20525,22 @@ LineSegments.prototype = Object.assign(Object.create(Line.prototype), { constructor: LineSegments, isLineSegments: true, - computeLineDistances: function () { - const geometry = this.geometry; + computeLineDistances: function computeLineDistances() { + var geometry = this.geometry; if (geometry.isBufferGeometry) { // we assume non-indexed geometry if (geometry.index === null) { - const positionAttribute = geometry.attributes.position; - const lineDistances = []; + var positionAttribute = geometry.attributes.position; + var lineDistances = []; - for (let i = 0, l = positionAttribute.count; i < l; i += 2) { - _start.fromBufferAttribute(positionAttribute, i); + for (var i = 0, l = positionAttribute.count; i < l; i += 2) { + _start$1.fromBufferAttribute(positionAttribute, i); - _end.fromBufferAttribute(positionAttribute, i + 1); + _end$1.fromBufferAttribute(positionAttribute, i + 1); lineDistances[i] = i === 0 ? 0 : lineDistances[i - 1]; - lineDistances[i + 1] = lineDistances[i] + _start.distanceTo(_end); + lineDistances[i + 1] = lineDistances[i] + _start$1.distanceTo(_end$1); } geometry.setAttribute('lineDistance', new Float32BufferAttribute(lineDistances, 1)); @@ -19560,13 +20555,19 @@ } }); - class LineLoop extends Line { - constructor(geometry, material) { - super(geometry, material); - this.type = 'LineLoop'; + var LineLoop = /*#__PURE__*/function (_Line) { + _inheritsLoose(LineLoop, _Line); + + function LineLoop(geometry, material) { + var _this; + + _this = _Line.call(this, geometry, material) || this; + _this.type = 'LineLoop'; + return _this; } - } + return LineLoop; + }(Line); LineLoop.prototype.isLineLoop = true; @@ -19584,21 +20585,31 @@ * } */ - class PointsMaterial extends Material { - constructor(parameters) { - super(); - this.type = 'PointsMaterial'; - this.color = new Color(0xffffff); - this.map = null; - this.alphaMap = null; - this.size = 1; - this.sizeAttenuation = true; - this.morphTargets = false; - this.setValues(parameters); + var PointsMaterial = /*#__PURE__*/function (_Material) { + _inheritsLoose(PointsMaterial, _Material); + + function PointsMaterial(parameters) { + var _this; + + _this = _Material.call(this) || this; + _this.type = 'PointsMaterial'; + _this.color = new Color(0xffffff); + _this.map = null; + _this.alphaMap = null; + _this.size = 1; + _this.sizeAttenuation = true; + _this.morphTargets = false; + + _this.setValues(parameters); + + return _this; } - copy(source) { - super.copy(source); + var _proto = PointsMaterial.prototype; + + _proto.copy = function copy(source) { + _Material.prototype.copy.call(this, source); + this.color.copy(source.color); this.map = source.map; this.alphaMap = source.alphaMap; @@ -19606,21 +20617,30 @@ this.sizeAttenuation = source.sizeAttenuation; this.morphTargets = source.morphTargets; return this; - } + }; - } + return PointsMaterial; + }(Material); PointsMaterial.prototype.isPointsMaterial = true; - const _inverseMatrix = new Matrix4(); + var _inverseMatrix$2 = new Matrix4(); + + var _ray$2 = new Ray(); + + var _sphere$4 = new Sphere(); - const _ray = new Ray(); + var _position$1 = new Vector3(); - const _sphere = new Sphere(); + function Points(geometry, material) { + if (geometry === void 0) { + geometry = new BufferGeometry(); + } - const _position$2 = new Vector3(); + if (material === void 0) { + material = new PointsMaterial(); + } - function Points(geometry = new BufferGeometry(), material = new PointsMaterial()) { Object3D.call(this); this.type = 'Points'; this.geometry = geometry; @@ -19631,87 +20651,88 @@ Points.prototype = Object.assign(Object.create(Object3D.prototype), { constructor: Points, isPoints: true, - copy: function (source) { + copy: function copy(source) { Object3D.prototype.copy.call(this, source); this.material = source.material; this.geometry = source.geometry; return this; }, - raycast: function (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 + raycast: function raycast(raycaster, intersects) { + var geometry = this.geometry; + var matrixWorld = this.matrixWorld; + var threshold = raycaster.params.Points.threshold; + var drawRange = geometry.drawRange; // Checking boundingSphere distance to ray if (geometry.boundingSphere === null) geometry.computeBoundingSphere(); - _sphere.copy(geometry.boundingSphere); + _sphere$4.copy(geometry.boundingSphere); - _sphere.applyMatrix4(matrixWorld); + _sphere$4.applyMatrix4(matrixWorld); - _sphere.radius += threshold; - if (raycaster.ray.intersectsSphere(_sphere) === false) return; // + _sphere$4.radius += threshold; + if (raycaster.ray.intersectsSphere(_sphere$4) === false) return; // - _inverseMatrix.copy(matrixWorld).invert(); + _inverseMatrix$2.copy(matrixWorld).invert(); - _ray.copy(raycaster.ray).applyMatrix4(_inverseMatrix); + _ray$2.copy(raycaster.ray).applyMatrix4(_inverseMatrix$2); - const localThreshold = threshold / ((this.scale.x + this.scale.y + this.scale.z) / 3); - const localThresholdSq = localThreshold * localThreshold; + var localThreshold = threshold / ((this.scale.x + this.scale.y + this.scale.z) / 3); + var localThresholdSq = localThreshold * localThreshold; if (geometry.isBufferGeometry) { - const index = geometry.index; - const attributes = geometry.attributes; - const positionAttribute = attributes.position; + var index = geometry.index; + var attributes = geometry.attributes; + var positionAttribute = attributes.position; if (index !== null) { - const start = Math.max(0, drawRange.start); - const end = Math.min(index.count, drawRange.start + drawRange.count); + var start = Math.max(0, drawRange.start); + var end = Math.min(index.count, drawRange.start + drawRange.count); - for (let i = start, il = end; i < il; i++) { - const a = index.getX(i); + for (var i = start, il = end; i < il; i++) { + var a = index.getX(i); - _position$2.fromBufferAttribute(positionAttribute, a); + _position$1.fromBufferAttribute(positionAttribute, a); - testPoint(_position$2, a, localThresholdSq, matrixWorld, raycaster, intersects, this); + testPoint(_position$1, a, localThresholdSq, matrixWorld, raycaster, intersects, this); } } else { - const start = Math.max(0, drawRange.start); - const end = Math.min(positionAttribute.count, drawRange.start + drawRange.count); + var _start = Math.max(0, drawRange.start); - for (let i = start, l = end; i < l; i++) { - _position$2.fromBufferAttribute(positionAttribute, i); + var _end = Math.min(positionAttribute.count, drawRange.start + drawRange.count); - testPoint(_position$2, i, localThresholdSq, matrixWorld, raycaster, intersects, this); + for (var _i = _start, l = _end; _i < l; _i++) { + _position$1.fromBufferAttribute(positionAttribute, _i); + + testPoint(_position$1, _i, localThresholdSq, matrixWorld, raycaster, intersects, this); } } } else { console.error('THREE.Points.raycast() no longer supports THREE.Geometry. Use THREE.BufferGeometry instead.'); } }, - updateMorphTargets: function () { - const geometry = this.geometry; + updateMorphTargets: function updateMorphTargets() { + var geometry = this.geometry; if (geometry.isBufferGeometry) { - const morphAttributes = geometry.morphAttributes; - const keys = Object.keys(morphAttributes); + var morphAttributes = geometry.morphAttributes; + var keys = Object.keys(morphAttributes); if (keys.length > 0) { - const morphAttribute = morphAttributes[keys[0]]; + var 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); + for (var m = 0, ml = morphAttribute.length; m < ml; m++) { + var name = morphAttribute[m].name || String(m); this.morphTargetInfluences.push(0); this.morphTargetDictionary[name] = m; } } } } else { - const morphTargets = geometry.morphTargets; + var morphTargets = geometry.morphTargets; if (morphTargets !== undefined && morphTargets.length > 0) { console.error('THREE.Points.updateMorphTargets() does not support THREE.Geometry. Use THREE.BufferGeometry instead.'); @@ -19721,15 +20742,15 @@ }); function testPoint(point, index, localThresholdSq, matrixWorld, raycaster, intersects, object) { - const rayPointDistanceSq = _ray.distanceSqToPoint(point); + var rayPointDistanceSq = _ray$2.distanceSqToPoint(point); if (rayPointDistanceSq < localThresholdSq) { - const intersectPoint = new Vector3(); + var intersectPoint = new Vector3(); - _ray.closestPointToPoint(point, intersectPoint); + _ray$2.closestPointToPoint(point, intersectPoint); intersectPoint.applyMatrix4(matrixWorld); - const distance = raycaster.ray.origin.distanceTo(intersectPoint); + var distance = raycaster.ray.origin.distanceTo(intersectPoint); if (distance < raycaster.near || distance > raycaster.far) return; intersects.push({ distance: distance, @@ -19742,14 +20763,19 @@ } } - class VideoTexture extends Texture { - constructor(video, mapping, wrapS, wrapT, magFilter, minFilter, format, type, anisotropy) { - super(video, mapping, wrapS, wrapT, magFilter, minFilter, format, type, anisotropy); - this.format = format !== undefined ? format : RGBFormat; - this.minFilter = minFilter !== undefined ? minFilter : LinearFilter; - this.magFilter = magFilter !== undefined ? magFilter : LinearFilter; - this.generateMipmaps = false; - const scope = this; + var VideoTexture = /*#__PURE__*/function (_Texture) { + _inheritsLoose(VideoTexture, _Texture); + + function VideoTexture(video, mapping, wrapS, wrapT, magFilter, minFilter, format, type, anisotropy) { + var _this; + + _this = _Texture.call(this, video, mapping, wrapS, wrapT, magFilter, minFilter, format, type, anisotropy) || this; + _this.format = format !== undefined ? format : RGBFormat; + _this.minFilter = minFilter !== undefined ? minFilter : LinearFilter; + _this.magFilter = magFilter !== undefined ? magFilter : LinearFilter; + _this.generateMipmaps = false; + + var scope = _assertThisInitialized(_this); function updateVideo() { scope.needsUpdate = true; @@ -19759,57 +20785,78 @@ if ('requestVideoFrameCallback' in video) { video.requestVideoFrameCallback(updateVideo); } + + return _this; } - clone() { + var _proto = VideoTexture.prototype; + + _proto.clone = function clone() { return new this.constructor(this.image).copy(this); - } + }; - update() { - const video = this.image; - const hasVideoFrameCallback = ('requestVideoFrameCallback' in video); + _proto.update = function update() { + var video = this.image; + var hasVideoFrameCallback = ('requestVideoFrameCallback' in video); if (hasVideoFrameCallback === false && video.readyState >= video.HAVE_CURRENT_DATA) { this.needsUpdate = true; } - } + }; - } + return VideoTexture; + }(Texture); VideoTexture.prototype.isVideoTexture = true; - class CompressedTexture extends Texture { - constructor(mipmaps, width, height, format, type, mapping, wrapS, wrapT, magFilter, minFilter, anisotropy, encoding) { - super(null, mapping, wrapS, wrapT, magFilter, minFilter, format, type, anisotropy, encoding); - this.image = { - width: width, + var CompressedTexture = /*#__PURE__*/function (_Texture) { + _inheritsLoose(CompressedTexture, _Texture); + + function CompressedTexture(mipmaps, width, height, format, type, mapping, wrapS, wrapT, magFilter, minFilter, anisotropy, encoding) { + var _this; + + _this = _Texture.call(this, null, mapping, wrapS, wrapT, magFilter, minFilter, format, type, anisotropy, encoding) || this; + _this.image = { + 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; + _this.generateMipmaps = false; + return _this; } - } + return CompressedTexture; + }(Texture); CompressedTexture.prototype.isCompressedTexture = true; - class CanvasTexture extends Texture { - constructor(canvas, mapping, wrapS, wrapT, magFilter, minFilter, format, type, anisotropy) { - super(canvas, mapping, wrapS, wrapT, magFilter, minFilter, format, type, anisotropy); - this.needsUpdate = true; + var CanvasTexture = /*#__PURE__*/function (_Texture) { + _inheritsLoose(CanvasTexture, _Texture); + + function CanvasTexture(canvas, mapping, wrapS, wrapT, magFilter, minFilter, format, type, anisotropy) { + var _this; + + _this = _Texture.call(this, canvas, mapping, wrapS, wrapT, magFilter, minFilter, format, type, anisotropy) || this; + _this.needsUpdate = true; + return _this; } - } + return CanvasTexture; + }(Texture); CanvasTexture.prototype.isCanvasTexture = true; - class DepthTexture extends Texture { - constructor(width, height, type, mapping, wrapS, wrapT, magFilter, minFilter, anisotropy, format) { + var DepthTexture = /*#__PURE__*/function (_Texture) { + _inheritsLoose(DepthTexture, _Texture); + + function DepthTexture(width, height, type, mapping, wrapS, wrapT, magFilter, minFilter, anisotropy, format) { + var _this; + format = format !== undefined ? format : DepthFormat; if (format !== DepthFormat && format !== DepthStencilFormat) { @@ -19818,26 +20865,48 @@ if (type === undefined && format === DepthFormat) type = UnsignedShortType; if (type === undefined && format === DepthStencilFormat) type = UnsignedInt248Type; - super(null, mapping, wrapS, wrapT, magFilter, minFilter, format, type, anisotropy); - this.image = { + _this = _Texture.call(this, null, mapping, wrapS, wrapT, magFilter, minFilter, format, type, anisotropy) || this; + _this.image = { width: width, height: height }; - this.magFilter = magFilter !== undefined ? magFilter : NearestFilter; - this.minFilter = minFilter !== undefined ? minFilter : NearestFilter; - this.flipY = false; - this.generateMipmaps = false; + _this.magFilter = magFilter !== undefined ? magFilter : NearestFilter; + _this.minFilter = minFilter !== undefined ? minFilter : NearestFilter; + _this.flipY = false; + _this.generateMipmaps = false; + return _this; } - } + return DepthTexture; + }(Texture); DepthTexture.prototype.isDepthTexture = true; - class CircleGeometry extends BufferGeometry { - constructor(radius = 1, segments = 8, thetaStart = 0, thetaLength = Math.PI * 2) { - super(); - this.type = 'CircleGeometry'; - this.parameters = { + var CircleGeometry = /*#__PURE__*/function (_BufferGeometry) { + _inheritsLoose(CircleGeometry, _BufferGeometry); + + function CircleGeometry(radius, segments, thetaStart, thetaLength) { + var _this; + + if (radius === void 0) { + radius = 1; + } + + if (segments === void 0) { + segments = 8; + } + + if (thetaStart === void 0) { + thetaStart = 0; + } + + if (thetaLength === void 0) { + thetaLength = Math.PI * 2; + } + + _this = _BufferGeometry.call(this) || this; + _this.type = 'CircleGeometry'; + _this.parameters = { radius: radius, segments: segments, thetaStart: thetaStart, @@ -19845,20 +20914,20 @@ }; segments = Math.max(3, segments); // buffers - const indices = []; - const vertices = []; - const normals = []; - const uvs = []; // helper variables + var indices = []; + var vertices = []; + var normals = []; + var uvs = []; // helper variables - const vertex = new Vector3(); - const uv = new Vector2(); // center point + var vertex = new Vector3(); + var 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 + for (var s = 0, i = 3; s <= segments; s++, i += 3) { + var segment = thetaStart + s / segments * thetaLength; // vertex vertex.x = radius * Math.cos(segment); vertex.y = radius * Math.sin(segment); @@ -19872,24 +20941,66 @@ } // indices - for (let i = 1; i <= segments; i++) { - indices.push(i, i + 1, 0); + for (var _i = 1; _i <= segments; _i++) { + indices.push(_i, _i + 1, 0); } // 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.setIndex(indices); + + _this.setAttribute('position', new Float32BufferAttribute(vertices, 3)); + + _this.setAttribute('normal', new Float32BufferAttribute(normals, 3)); + + _this.setAttribute('uv', new Float32BufferAttribute(uvs, 2)); + + return _this; } - } + return CircleGeometry; + }(BufferGeometry); + + var CylinderGeometry = /*#__PURE__*/function (_BufferGeometry) { + _inheritsLoose(CylinderGeometry, _BufferGeometry); + + function CylinderGeometry(radiusTop, radiusBottom, height, radialSegments, heightSegments, openEnded, thetaStart, thetaLength) { + var _this; + + if (radiusTop === void 0) { + radiusTop = 1; + } + + if (radiusBottom === void 0) { + radiusBottom = 1; + } - class CylinderGeometry extends BufferGeometry { - constructor(radiusTop = 1, radiusBottom = 1, height = 1, radialSegments = 8, heightSegments = 1, openEnded = false, thetaStart = 0, thetaLength = Math.PI * 2) { - super(); - this.type = 'CylinderGeometry'; - this.parameters = { + if (height === void 0) { + height = 1; + } + + if (radialSegments === void 0) { + radialSegments = 8; + } + + if (heightSegments === void 0) { + heightSegments = 1; + } + + if (openEnded === void 0) { + openEnded = false; + } + + if (thetaStart === void 0) { + thetaStart = 0; + } + + if (thetaLength === void 0) { + thetaLength = Math.PI * 2; + } + + _this = _BufferGeometry.call(this) || this; + _this.type = 'CylinderGeometry'; + _this.parameters = { radiusTop: radiusTop, radiusBottom: radiusBottom, height: height, @@ -19899,19 +21010,21 @@ thetaStart: thetaStart, thetaLength: thetaLength }; - const scope = this; + + var scope = _assertThisInitialized(_this); + radialSegments = Math.floor(radialSegments); heightSegments = Math.floor(heightSegments); // buffers - const indices = []; - const vertices = []; - const normals = []; - const uvs = []; // helper variables + var indices = []; + var vertices = []; + var normals = []; + var uvs = []; // helper variables - let index = 0; - const indexArray = []; - const halfHeight = height / 2; - let groupStart = 0; // generate geometry + var index = 0; + var indexArray = []; + var halfHeight = height / 2; + var groupStart = 0; // generate geometry generateTorso(); @@ -19921,29 +21034,32 @@ } // 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.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 + var normal = new Vector3(); + var vertex = new Vector3(); + var groupCount = 0; // this will be used to calculate the normal - const slope = (radiusBottom - radiusTop) / height; // generate vertices, normals and uvs + var slope = (radiusBottom - radiusTop) / height; // 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 + for (var y = 0; y <= heightSegments; y++) { + var indexRow = []; + var v = y / heightSegments; // calculate the radius of the current row - const radius = v * (radiusBottom - radiusTop) + radiusTop; + var 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 + for (var x = 0; x <= radialSegments; x++) { + var u = x / radialSegments; + var theta = u * thetaLength + thetaStart; + var sinTheta = Math.sin(theta); + var cosTheta = Math.cos(theta); // vertex vertex.x = radius * sinTheta; vertex.y = -v * height + halfHeight; @@ -19963,13 +21079,13 @@ } // generate indices - for (let x = 0; x < radialSegments; x++) { - for (let y = 0; y < heightSegments; y++) { + for (var _x = 0; _x < radialSegments; _x++) { + for (var _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 + var a = indexArray[_y][_x]; + var b = indexArray[_y + 1][_x]; + var c = indexArray[_y + 1][_x + 1]; + var d = indexArray[_y][_x + 1]; // faces indices.push(a, b, d); indices.push(b, c, d); // update group counter @@ -19986,16 +21102,16 @@ function generateCap(top) { // save the index of the first center vertex - const centerIndexStart = index; - const uv = new Vector2(); - 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. + var centerIndexStart = index; + var uv = new Vector2(); + var vertex = new Vector3(); + var groupCount = 0; + var radius = top === true ? radiusTop : radiusBottom; + var 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++) { + for (var x = 1; x <= radialSegments; x++) { // vertex vertices.push(0, halfHeight * sign, 0); // normal @@ -20007,13 +21123,13 @@ } // save the index of the last center vertex - const centerIndexEnd = index; // now we generate the surrounding vertices, normals and uvs + var centerIndexEnd = index; // 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 + for (var _x2 = 0; _x2 <= radialSegments; _x2++) { + var u = _x2 / radialSegments; + var theta = u * thetaLength + thetaStart; + var cosTheta = Math.cos(theta); + var sinTheta = Math.sin(theta); // vertex vertex.x = radius * sinTheta; vertex.y = halfHeight * sign; @@ -20030,9 +21146,9 @@ } // generate indices - for (let x = 0; x < radialSegments; x++) { - const c = centerIndexStart + x; - const i = centerIndexEnd + x; + for (var _x3 = 0; _x3 < radialSegments; _x3++) { + var c = centerIndexStart + _x3; + var i = centerIndexEnd + _x3; if (top === true) { // face top @@ -20050,15 +21166,50 @@ groupStart += groupCount; } + + return _this; } - } + return CylinderGeometry; + }(BufferGeometry); + + var ConeGeometry = /*#__PURE__*/function (_CylinderGeometry) { + _inheritsLoose(ConeGeometry, _CylinderGeometry); + + function ConeGeometry(radius, height, radialSegments, heightSegments, openEnded, thetaStart, thetaLength) { + var _this; + + if (radius === void 0) { + radius = 1; + } + + if (height === void 0) { + height = 1; + } + + if (radialSegments === void 0) { + radialSegments = 8; + } + + if (heightSegments === void 0) { + heightSegments = 1; + } + + if (openEnded === void 0) { + openEnded = false; + } + + if (thetaStart === void 0) { + thetaStart = 0; + } + + if (thetaLength === void 0) { + thetaLength = Math.PI * 2; + } - class ConeGeometry extends CylinderGeometry { - constructor(radius = 1, height = 1, radialSegments = 8, heightSegments = 1, openEnded = false, thetaStart = 0, thetaLength = Math.PI * 2) { - super(0, radius, height, radialSegments, heightSegments, openEnded, thetaStart, thetaLength); - this.type = 'ConeGeometry'; - this.parameters = { + _this = _CylinderGeometry.call(this, 0, radius, height, radialSegments, heightSegments, openEnded, thetaStart, thetaLength) || this; + _this.type = 'ConeGeometry'; + _this.parameters = { radius: radius, height: height, radialSegments: radialSegments, @@ -20067,23 +21218,37 @@ thetaStart: thetaStart, thetaLength: thetaLength }; + return _this; } - } + return ConeGeometry; + }(CylinderGeometry); + + var PolyhedronGeometry = /*#__PURE__*/function (_BufferGeometry) { + _inheritsLoose(PolyhedronGeometry, _BufferGeometry); + + function PolyhedronGeometry(vertices, indices, radius, detail) { + var _this; + + if (radius === void 0) { + radius = 1; + } - class PolyhedronGeometry extends BufferGeometry { - constructor(vertices, indices, radius = 1, detail = 0) { - super(); - this.type = 'PolyhedronGeometry'; - this.parameters = { + if (detail === void 0) { + detail = 0; + } + + _this = _BufferGeometry.call(this) || this; + _this.type = 'PolyhedronGeometry'; + _this.parameters = { vertices: vertices, indices: indices, radius: radius, detail: detail }; // default buffer data - const vertexBuffer = []; - const uvBuffer = []; // the subdivision creates the vertex buffer data + var vertexBuffer = []; + var uvBuffer = []; // the subdivision creates the vertex buffer data subdivide(detail); // all vertices should lie on a conceptual sphere with a given radius @@ -20091,23 +21256,27 @@ 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)); + _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 + _this.computeVertexNormals(); // flat normals + } else { - this.normalizeNormals(); // smooth normals + _this.normalizeNormals(); // smooth normals + } // 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 + var a = new Vector3(); + var b = new Vector3(); + var 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) { + for (var i = 0; i < indices.length; i += 3) { // get the vertices of the face getVertexByIndex(indices[i + 0], a); getVertexByIndex(indices[i + 1], b); @@ -20118,17 +21287,17 @@ } function subdivideFace(a, b, c, detail) { - const cols = detail + 1; // we use this multidimensional array as a data structure for creating the subdivision + var cols = detail + 1; // we use this multidimensional array as a data structure for creating the subdivision - const v = []; // construct all of the vertices for this subdivision + var v = []; // construct all of the vertices for this subdivision - for (let i = 0; i <= cols; i++) { + for (var 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; + var aj = a.clone().lerp(c, i / cols); + var bj = b.clone().lerp(c, i / cols); + var rows = cols - i; - for (let j = 0; j <= rows; j++) { + for (var j = 0; j <= rows; j++) { if (j === 0 && i === cols) { v[i][j] = aj; } else { @@ -20138,27 +21307,27 @@ } // 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); + for (var _i = 0; _i < cols; _i++) { + for (var _j = 0; _j < 2 * (cols - _i) - 1; _j++) { + var k = Math.floor(_j / 2); - if (j % 2 === 0) { - pushVertex(v[i][k + 1]); - pushVertex(v[i + 1][k]); - pushVertex(v[i][k]); + if (_j % 2 === 0) { + pushVertex(v[_i][k + 1]); + pushVertex(v[_i + 1][k]); + pushVertex(v[_i][k]); } else { - pushVertex(v[i][k + 1]); - pushVertex(v[i + 1][k + 1]); - pushVertex(v[i + 1][k]); + pushVertex(v[_i][k + 1]); + pushVertex(v[_i + 1][k + 1]); + pushVertex(v[_i + 1][k]); } } } } function applyRadius(radius) { - const vertex = new Vector3(); // iterate over the entire buffer and apply the radius to each vertex + var vertex = new Vector3(); // iterate over the entire buffer and apply the radius to each vertex - for (let i = 0; i < vertexBuffer.length; i += 3) { + for (var i = 0; i < vertexBuffer.length; i += 3) { vertex.x = vertexBuffer[i + 0]; vertex.y = vertexBuffer[i + 1]; vertex.z = vertexBuffer[i + 2]; @@ -20170,14 +21339,14 @@ } function generateUVs() { - const vertex = new Vector3(); + var vertex = new Vector3(); - for (let i = 0; i < vertexBuffer.length; i += 3) { + for (var i = 0; i < vertexBuffer.length; i += 3) { vertex.x = vertexBuffer[i + 0]; vertex.y = vertexBuffer[i + 1]; vertex.z = vertexBuffer[i + 2]; - const u = azimuth(vertex) / 2 / Math.PI + 0.5; - const v = inclination(vertex) / Math.PI + 0.5; + var u = azimuth(vertex) / 2 / Math.PI + 0.5; + var v = inclination(vertex) / Math.PI + 0.5; uvBuffer.push(u, 1 - v); } @@ -20187,13 +21356,13 @@ function correctSeam() { // handle case when face straddles the seam, see #3269 - for (let i = 0; i < uvBuffer.length; i += 6) { + for (var 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 + var x0 = uvBuffer[i + 0]; + var x1 = uvBuffer[i + 2]; + var x2 = uvBuffer[i + 4]; + var max = Math.max(x0, x1, x2); + var 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; @@ -20208,22 +21377,22 @@ } function getVertexByIndex(index, vertex) { - const stride = index * 3; + var 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(); - const c = new Vector3(); - const centroid = new Vector3(); - 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) { + var a = new Vector3(); + var b = new Vector3(); + var c = new Vector3(); + var centroid = new Vector3(); + var uvA = new Vector2(); + var uvB = new Vector2(); + var uvC = new Vector2(); + + for (var 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]); c.set(vertexBuffer[i + 6], vertexBuffer[i + 7], vertexBuffer[i + 8]); @@ -20231,7 +21400,7 @@ uvB.set(uvBuffer[j + 2], uvBuffer[j + 3]); uvC.set(uvBuffer[j + 4], uvBuffer[j + 5]); centroid.copy(a).add(b).add(c).divideScalar(3); - const azi = azimuth(centroid); + var azi = azimuth(centroid); correctUV(uvA, j + 0, a, azi); correctUV(uvB, j + 2, b, azi); correctUV(uvC, j + 4, c, azi); @@ -20257,65 +21426,86 @@ function inclination(vector) { return Math.atan2(-vector.y, Math.sqrt(vector.x * vector.x + vector.z * vector.z)); } + + return _this; } - } + return PolyhedronGeometry; + }(BufferGeometry); - 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) + var DodecahedronGeometry = /*#__PURE__*/function (_PolyhedronGeometry) { + _inheritsLoose(DodecahedronGeometry, _PolyhedronGeometry); + + function DodecahedronGeometry(radius, detail) { + var _this; + + if (radius === void 0) { + radius = 1; + } + + if (detail === void 0) { + detail = 0; + } + + var t = (1 + Math.sqrt(5)) / 2; + var r = 1 / t; + var 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); - this.type = 'DodecahedronGeometry'; - this.parameters = { + var 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]; + _this = _PolyhedronGeometry.call(this, vertices, indices, radius, detail) || this; + _this.type = 'DodecahedronGeometry'; + _this.parameters = { radius: radius, detail: detail }; + return _this; } - } + return DodecahedronGeometry; + }(PolyhedronGeometry); + + var _v0$2 = new Vector3(); - const _v0 = new Vector3(); + var _v1$6 = new Vector3(); - const _v1$1 = new Vector3(); + var _normal$1 = new Vector3(); - const _normal = new Vector3(); + var _triangle = new Triangle(); - const _triangle = new Triangle(); + var EdgesGeometry = /*#__PURE__*/function (_BufferGeometry) { + _inheritsLoose(EdgesGeometry, _BufferGeometry); - class EdgesGeometry extends BufferGeometry { - constructor(geometry, thresholdAngle) { - super(); - this.type = 'EdgesGeometry'; - this.parameters = { + function EdgesGeometry(geometry, thresholdAngle) { + var _this; + + _this = _BufferGeometry.call(this) || this; + _this.type = 'EdgesGeometry'; + _this.parameters = { thresholdAngle: thresholdAngle }; thresholdAngle = thresholdAngle !== undefined ? thresholdAngle : 1; if (geometry.isGeometry === true) { console.error('THREE.EdgesGeometry no longer supports THREE.Geometry. Use THREE.BufferGeometry instead.'); - return; - } - - const precisionPoints = 4; - const precision = Math.pow(10, precisionPoints); - const thresholdDot = Math.cos(MathUtils.DEG2RAD * thresholdAngle); - const indexAttr = geometry.getIndex(); - const positionAttr = geometry.getAttribute('position'); - const indexCount = indexAttr ? indexAttr.count : positionAttr.count; - const indexArr = [0, 0, 0]; - const vertKeys = ['a', 'b', 'c']; - const hashes = new Array(3); - const edgeData = {}; - const vertices = []; - - for (let i = 0; i < indexCount; i += 3) { + return _assertThisInitialized(_this); + } + + var precisionPoints = 4; + var precision = Math.pow(10, precisionPoints); + var thresholdDot = Math.cos(MathUtils.DEG2RAD * thresholdAngle); + var indexAttr = geometry.getIndex(); + var positionAttr = geometry.getAttribute('position'); + var indexCount = indexAttr ? indexAttr.count : positionAttr.count; + var indexArr = [0, 0, 0]; + var vertKeys = ['a', 'b', 'c']; + var hashes = new Array(3); + var edgeData = {}; + var vertices = []; + + for (var i = 0; i < indexCount; i += 3) { if (indexAttr) { indexArr[0] = indexAttr.getX(i); indexArr[1] = indexAttr.getX(i + 1); @@ -20326,41 +21516,39 @@ indexArr[2] = i + 2; } - const { - a, - b, - c - } = _triangle; + var a = _triangle.a, + b = _triangle.b, + c = _triangle.c; a.fromBufferAttribute(positionAttr, indexArr[0]); b.fromBufferAttribute(positionAttr, indexArr[1]); c.fromBufferAttribute(positionAttr, indexArr[2]); - _triangle.getNormal(_normal); // create hashes for the edge from the vertices + _triangle.getNormal(_normal$1); // 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[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 if (hashes[0] === hashes[1] || hashes[1] === hashes[2] || hashes[2] === hashes[0]) { continue; } // iterate over every edge - for (let j = 0; j < 3; j++) { + for (var j = 0; j < 3; j++) { // get the first and next vertex making up the edge - const jNext = (j + 1) % 3; - const vecHash0 = hashes[j]; - const vecHash1 = hashes[jNext]; - const v0 = _triangle[vertKeys[j]]; - const v1 = _triangle[vertKeys[jNext]]; - const hash = `${vecHash0}_${vecHash1}`; - const reverseHash = `${vecHash1}_${vecHash0}`; + var jNext = (j + 1) % 3; + var vecHash0 = hashes[j]; + var vecHash1 = hashes[jNext]; + var v0 = _triangle[vertKeys[j]]; + var v1 = _triangle[vertKeys[jNext]]; + var hash = vecHash0 + "_" + vecHash1; + var 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. - if (_normal.dot(edgeData[reverseHash].normal) <= thresholdDot) { + if (_normal$1.dot(edgeData[reverseHash].normal) <= thresholdDot) { vertices.push(v0.x, v0.y, v0.z); vertices.push(v1.x, v1.y, v1.z); } @@ -20371,53 +21559,55 @@ edgeData[hash] = { index0: indexArr[j], index1: indexArr[jNext], - normal: _normal.clone() + normal: _normal$1.clone() }; } } } // iterate over all remaining, unmatched edges and add them to the vertex array - for (const key in edgeData) { + for (var key in edgeData) { if (edgeData[key]) { - const { - index0, - index1 - } = edgeData[key]; + var _edgeData$key = edgeData[key], + index0 = _edgeData$key.index0, + index1 = _edgeData$key.index1; - _v0.fromBufferAttribute(positionAttr, index0); + _v0$2.fromBufferAttribute(positionAttr, index0); - _v1$1.fromBufferAttribute(positionAttr, index1); + _v1$6.fromBufferAttribute(positionAttr, index1); - vertices.push(_v0.x, _v0.y, _v0.z); - vertices.push(_v1$1.x, _v1$1.y, _v1$1.z); + vertices.push(_v0$2.x, _v0$2.y, _v0$2.z); + vertices.push(_v1$6.x, _v1$6.y, _v1$6.z); } } - this.setAttribute('position', new Float32BufferAttribute(vertices, 3)); + _this.setAttribute('position', new Float32BufferAttribute(vertices, 3)); + + return _this; } - } + return EdgesGeometry; + }(BufferGeometry); /** * Port from https://github.com/mapbox/earcut (v2.2.2) */ - const Earcut = { - triangulate: function (data, holeIndices, dim) { + var Earcut = { + triangulate: function triangulate(data, holeIndices, dim) { dim = dim || 2; - const hasHoles = holeIndices && holeIndices.length; - const outerLen = hasHoles ? holeIndices[0] * dim : data.length; - let outerNode = linkedList(data, 0, outerLen, dim, true); - const triangles = []; + var hasHoles = holeIndices && holeIndices.length; + var outerLen = hasHoles ? holeIndices[0] * dim : data.length; + var outerNode = linkedList(data, 0, outerLen, dim, true); + var triangles = []; if (!outerNode || outerNode.next === outerNode.prev) return triangles; - let minX, minY, maxX, maxY, x, y, invSize; + var 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 (data.length > 80 * dim) { minX = maxX = data[0]; minY = maxY = data[1]; - for (let i = dim; i < outerLen; i += dim) { + for (var i = dim; i < outerLen; i += dim) { x = data[i]; y = data[i + 1]; if (x < minX) minX = x; @@ -20437,12 +21627,16 @@ }; // create a circular doubly linked list from polygon points in the specified winding order function linkedList(data, start, end, dim, clockwise) { - let i, last; + var 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); + 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); + for (i = end - dim; i >= start; i -= dim) { + last = insertNode(i, data[i], data[i + 1], last); + } } if (last && equals(last, last.next)) { @@ -20457,7 +21651,7 @@ function filterPoints(start, end) { if (!start) return start; if (!end) end = start; - let p = start, + var p = start, again; do { @@ -20481,7 +21675,7 @@ if (!ear) return; // interlink polygon nodes in z-order if (!pass && invSize) indexCurve(ear, minX, minY, invSize); - let stop = ear, + var stop = ear, prev, next; // iterate through ears, slicing them one by one @@ -20521,13 +21715,13 @@ function isEar(ear) { - const a = ear.prev, - b = ear, - c = ear.next; + var a = ear.prev, + 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 - let p = ear.next.next; + var 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; @@ -20538,20 +21732,20 @@ } function isEarHashed(ear, minX, minY, invSize) { - const a = ear.prev, - b = ear, - c = ear.next; + var a = ear.prev, + 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 - 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; + var 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; - const minZ = zOrder(minTX, minTY, minX, minY, invSize), - maxZ = zOrder(maxTX, maxTY, minX, minY, invSize); - let p = ear.prevZ, + var minZ = zOrder(minTX, minTY, minX, minY, invSize), + maxZ = zOrder(maxTX, maxTY, minX, minY, invSize); + var p = ear.prevZ, n = ear.nextZ; // look for points inside the triangle in both directions while (p && p.z >= minZ && n && n.z <= maxZ) { @@ -20578,11 +21772,11 @@ function cureLocalIntersections(start, triangles, dim) { - let p = start; + var p = start; do { - const a = p.prev, - b = p.next.next; + var a = p.prev, + 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); @@ -20603,15 +21797,15 @@ function splitEarcut(start, triangles, dim, minX, minY, invSize) { // look for a valid diagonal that divides the polygon into two - let a = start; + var a = start; do { - let b = a.next.next; + var 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 + var 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 @@ -20630,8 +21824,8 @@ function eliminateHoles(data, holeIndices, outerNode, dim) { - const queue = []; - let i, len, start, end, list; + var queue = []; + var i, len, start, end, list; for (i = 0, len = holeIndices.length; i < len; i++) { start = holeIndices[i] * dim; @@ -20660,7 +21854,7 @@ outerNode = findHoleBridge(hole, outerNode); if (outerNode) { - const b = splitPolygon(outerNode, hole); // filter collinear points around the cuts + var b = splitPolygon(outerNode, hole); // filter collinear points around the cuts filterPoints(outerNode, outerNode.next); filterPoints(b, b.next); @@ -20669,16 +21863,16 @@ function findHoleBridge(hole, outerNode) { - let p = outerNode; - const hx = hole.x; - const hy = hole.y; - let qx = -Infinity, + var p = outerNode; + var hx = hole.x; + var hy = hole.y; + var 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 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); + var x = p.x + (hy - p.y) * (p.next.x - p.x) / (p.next.y - p.y); if (x <= hx && x > qx) { qx = x; @@ -20701,10 +21895,10 @@ // 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; - let tanMin = Infinity, + var stop = m, + mx = m.x, + my = m.y; + var tanMin = Infinity, tan; p = m; @@ -20731,7 +21925,7 @@ function indexCurve(start, minX, minY, invSize) { - let p = start; + var p = start; do { if (p.z === null) p.z = zOrder(p.x, p.y, minX, minY, invSize); @@ -20748,7 +21942,7 @@ function sortLinked(list) { - let i, + var i, p, q, e, @@ -20821,7 +22015,7 @@ function getLeftmost(start) { - let p = start, + var p = start, leftmost = start; do { @@ -20857,10 +22051,10 @@ function intersects(p1, q1, p2, q2) { - const o1 = sign(area(p1, q1, p2)); - const o2 = sign(area(p1, q1, q2)); - const o3 = sign(area(p2, q2, p1)); - const o4 = sign(area(p2, q2, q1)); + var o1 = sign(area(p1, q1, p2)); + var o2 = sign(area(p1, q1, q2)); + var o3 = sign(area(p2, q2, p1)); + var o4 = sign(area(p2, q2, q1)); 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 @@ -20885,7 +22079,7 @@ function intersectsPolygon(a, b) { - let p = a; + var 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; @@ -20902,10 +22096,10 @@ function middleInside(a, b) { - let p = a, + var p = a, inside = false; - const px = (a.x + b.x) / 2, - py = (a.y + b.y) / 2; + var px = (a.x + b.x) / 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; @@ -20918,10 +22112,10 @@ 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; + var a2 = new Node(a.i, a.x, a.y), + b2 = new Node(b.i, b.x, b.y), + an = a.next, + bp = b.prev; a.next = b; b.prev = a; a2.next = an; @@ -20935,7 +22129,7 @@ function insertNode(i, x, y, last) { - const p = new Node(i, x, y); + var p = new Node(i, x, y); if (!last) { p.prev = p; @@ -20976,9 +22170,9 @@ } function signedArea(data, start, end, dim) { - let sum = 0; + var sum = 0; - for (let i = start, j = end - dim; i < end; i += dim) { + for (var i = start, j = end - dim; i < end; i += dim) { sum += (data[j] - data[i]) * (data[i + 1] + data[j + 1]); j = i; } @@ -20986,45 +22180,45 @@ return sum; } - const ShapeUtils = { + var ShapeUtils = { // calculate area of the contour polygon - area: function (contour) { - const n = contour.length; - let a = 0.0; + area: function area(contour) { + var n = contour.length; + var a = 0.0; - for (let p = n - 1, q = 0; q < n; p = q++) { + for (var 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; }, - isClockWise: function (pts) { + isClockWise: function isClockWise(pts) { return ShapeUtils.area(pts) < 0; }, - triangulateShape: function (contour, holes) { - const vertices = []; // flat array of vertices like [ x0,y0, x1,y1, x2,y2, ... ] + triangulateShape: function triangulateShape(contour, holes) { + var vertices = []; // flat array of vertices like [ x0,y0, x1,y1, x2,y2, ... ] - const holeIndices = []; // array of hole indices + var holeIndices = []; // array of hole indices - const faces = []; // final array of vertex indices like [ [ a,b,d ], [ b,c,d ] ] + var faces = []; // final array of vertex indices like [ [ a,b,d ], [ b,c,d ] ] removeDupEndPts(contour); addContour(vertices, contour); // - let holeIndex = contour.length; + var holeIndex = contour.length; holes.forEach(removeDupEndPts); - for (let i = 0; i < holes.length; i++) { + for (var i = 0; i < holes.length; i++) { holeIndices.push(holeIndex); holeIndex += holes[i].length; addContour(vertices, holes[i]); } // - const triangles = Earcut.triangulate(vertices, holeIndices); // + var triangles = Earcut.triangulate(vertices, holeIndices); // - for (let i = 0; i < triangles.length; i += 3) { - faces.push(triangles.slice(i, i + 3)); + for (var _i = 0; _i < triangles.length; _i += 3) { + faces.push(triangles.slice(_i, _i + 3)); } return faces; @@ -21032,7 +22226,7 @@ }; function removeDupEndPts(points) { - const l = points.length; + var l = points.length; if (l > 2 && points[l - 1].equals(points[0])) { points.pop(); @@ -21040,70 +22234,57 @@ } function addContour(vertices, contour) { - for (let i = 0; i < contour.length; i++) { + for (var i = 0; i < contour.length; i++) { vertices.push(contour[i].x); vertices.push(contour[i].y); } } - /** - * Creates extruded geometry from a path shape. - * - * parameters = { - * - * curveSegments: , // number of points on the curves - * steps: , // number of points for z-side extrusions / used for subdividing segments of extrude spline too - * depth: , // Depth to extrude the shape - * - * bevelEnabled: , // turn on bevel - * bevelThickness: , // how deep into the original shape bevel goes - * bevelSize: , // how far from shape outline (including bevelOffset) is bevel - * bevelOffset: , // how far from shape outline does bevel start - * bevelSegments: , // number of bevel layers - * - * extrudePath: // curve to extrude shape along - * - * UVGenerator: // object that provides UV generator functions - * - * } - */ + var ExtrudeGeometry = /*#__PURE__*/function (_BufferGeometry) { + _inheritsLoose(ExtrudeGeometry, _BufferGeometry); + + function ExtrudeGeometry(shapes, options) { + var _this; - class ExtrudeGeometry extends BufferGeometry { - constructor(shapes, options) { - super(); - this.type = 'ExtrudeGeometry'; - this.parameters = { + _this = _BufferGeometry.call(this) || this; + _this.type = 'ExtrudeGeometry'; + _this.parameters = { shapes: shapes, options: options }; shapes = Array.isArray(shapes) ? shapes : [shapes]; - const scope = this; - const verticesArray = []; - const uvArray = []; - for (let i = 0, l = shapes.length; i < l; i++) { - const shape = shapes[i]; + var scope = _assertThisInitialized(_this); + + var verticesArray = []; + var uvArray = []; + + for (var i = 0, l = shapes.length; i < l; i++) { + var shape = shapes[i]; addShape(shape); } // build geometry - this.setAttribute('position', new Float32BufferAttribute(verticesArray, 3)); - this.setAttribute('uv', new Float32BufferAttribute(uvArray, 2)); - this.computeVertexNormals(); // functions + _this.setAttribute('position', new Float32BufferAttribute(verticesArray, 3)); + + _this.setAttribute('uv', new Float32BufferAttribute(uvArray, 2)); + + _this.computeVertexNormals(); // functions + function addShape(shape) { - const placeholder = []; // options - - const curveSegments = options.curveSegments !== undefined ? options.curveSegments : 12; - const steps = options.steps !== undefined ? options.steps : 1; - let depth = options.depth !== undefined ? options.depth : 100; - let bevelEnabled = options.bevelEnabled !== undefined ? options.bevelEnabled : true; - let bevelThickness = options.bevelThickness !== undefined ? options.bevelThickness : 6; - let bevelSize = options.bevelSize !== undefined ? options.bevelSize : bevelThickness - 2; - 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 + var placeholder = []; // options + + var curveSegments = options.curveSegments !== undefined ? options.curveSegments : 12; + var steps = options.steps !== undefined ? options.steps : 1; + var depth = options.depth !== undefined ? options.depth : 100; + var bevelEnabled = options.bevelEnabled !== undefined ? options.bevelEnabled : true; + var bevelThickness = options.bevelThickness !== undefined ? options.bevelThickness : 6; + var bevelSize = options.bevelSize !== undefined ? options.bevelSize : bevelThickness - 2; + var bevelOffset = options.bevelOffset !== undefined ? options.bevelOffset : 0; + var bevelSegments = options.bevelSegments !== undefined ? options.bevelSegments : 3; + var extrudePath = options.extrudePath; + var uvgen = options.UVGenerator !== undefined ? options.UVGenerator : WorldUVGenerator; // deprecated options if (options.amount !== undefined) { console.warn('THREE.ExtrudeBufferGeometry: amount has been renamed to depth.'); @@ -21111,9 +22292,9 @@ } // - let extrudePts, + var extrudePts, extrudeByPath = false; - let splineTube, binormal, normal, position2; + var splineTube, binormal, normal, position2; if (extrudePath) { extrudePts = extrudePath.getSpacedPoints(steps); @@ -21138,16 +22319,16 @@ } // Variables initialization - const shapePoints = shape.extractPoints(curveSegments); - let vertices = shapePoints.shape; - const holes = shapePoints.holes; - const reverse = !ShapeUtils.isClockWise(vertices); + var shapePoints = shape.extractPoints(curveSegments); + var vertices = shapePoints.shape; + var holes = shapePoints.holes; + var 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 ... - for (let h = 0, hl = holes.length; h < hl; h++) { - const ahole = holes[h]; + for (var h = 0, hl = holes.length; h < hl; h++) { + var ahole = holes[h]; if (ShapeUtils.isClockWise(ahole)) { holes[h] = ahole.reverse(); @@ -21155,14 +22336,14 @@ } } - const faces = ShapeUtils.triangulateShape(vertices, holes); + var faces = ShapeUtils.triangulateShape(vertices, holes); /* Vertices */ - const contour = vertices; // vertices has all points but contour has only points of circumference + var contour = vertices; // vertices has all points but contour has only points of circumference - for (let h = 0, hl = holes.length; h < hl; h++) { - const ahole = holes[h]; - vertices = vertices.concat(ahole); + for (var _h = 0, _hl = holes.length; _h < _hl; _h++) { + var _ahole = holes[_h]; + vertices = vertices.concat(_ahole); } function scalePt2(pt, vec, size) { @@ -21170,8 +22351,8 @@ return vec.clone().multiplyScalar(size).add(pt); } - const vlen = vertices.length, - flen = faces.length; // Find directions for point movement + var vlen = vertices.length, + flen = faces.length; // Find directions for point movement function getBevelVec(inPt, inPrev, inNext) { // computes for inPt the corresponding point inPt' on a new contour @@ -21180,36 +22361,36 @@ // // 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 + var 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; - 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 + var v_prev_x = inPt.x - inPrev.x, + v_prev_y = inPt.y - inPrev.y; + var v_next_x = inNext.x - inPt.x, + v_next_y = inNext.y - inPt.y; + var 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; + var 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 + var v_prev_len = Math.sqrt(v_prev_lensq); + var 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 + var ptPrevShift_x = inPrev.x - v_prev_y / v_prev_len; + var ptPrevShift_y = inPrev.y + v_prev_x / v_prev_len; + var ptNextShift_x = inNext.x - v_next_y / v_next_len; + var 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 + var 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 - const v_trans_lensq = v_trans_x * v_trans_x + v_trans_y * v_trans_y; + var 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); @@ -21218,7 +22399,7 @@ } } else { // handle special case of collinear edges - let direction_eq = false; // assumes: opposite + var direction_eq = false; // assumes: opposite if (v_prev_x > Number.EPSILON) { if (v_next_x > Number.EPSILON) { @@ -21252,29 +22433,29 @@ return new Vector2(v_trans_x / shrink_by, v_trans_y / shrink_by); } - const contourMovements = []; + var contourMovements = []; - for (let i = 0, il = contour.length, j = il - 1, k = i + 1; i < il; i++, j++, k++) { + for (var _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) // console.log('i,j,k', i, j , k) - contourMovements[i] = getBevelVec(contour[i], contour[j], contour[k]); + contourMovements[_i] = getBevelVec(contour[_i], contour[j], contour[k]); } - const holesMovements = []; - let oneHoleMovements, + var holesMovements = []; + var oneHoleMovements, verticesMovements = contourMovements.concat(); - for (let h = 0, hl = holes.length; h < hl; h++) { - const ahole = holes[h]; + for (var _h2 = 0, _hl2 = holes.length; _h2 < _hl2; _h2++) { + var _ahole2 = holes[_h2]; 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) + for (var _i2 = 0, _il = _ahole2.length, _j = _il - 1, _k = _i2 + 1; _i2 < _il; _i2++, _j++, _k++) { + if (_j === _il) _j = 0; + if (_k === _il) _k = 0; // (j)---(i)---(k) - oneHoleMovements[i] = getBevelVec(ahole[i], ahole[j], ahole[k]); + oneHoleMovements[_i2] = getBevelVec(_ahole2[_i2], _ahole2[_j], _ahole2[_k]); } holesMovements.push(oneHoleMovements); @@ -21282,40 +22463,43 @@ } // Loop bevelSegments, 1 for the front, 1 for the back - for (let b = 0; b < bevelSegments; b++) { + for (var 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 + var t = b / bevelSegments; + var z = bevelThickness * Math.cos(t * Math.PI / 2); + + var _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); + + for (var _i3 = 0, _il2 = contour.length; _i3 < _il2; _i3++) { + var vert = scalePt2(contour[_i3], contourMovements[_i3], _bs); v(vert.x, vert.y, -z); } // expand holes - for (let h = 0, hl = holes.length; h < hl; h++) { - const ahole = holes[h]; - oneHoleMovements = holesMovements[h]; + for (var _h3 = 0, _hl3 = holes.length; _h3 < _hl3; _h3++) { + var _ahole3 = holes[_h3]; + oneHoleMovements = holesMovements[_h3]; + + for (var _i4 = 0, _il3 = _ahole3.length; _i4 < _il3; _i4++) { + var _vert = scalePt2(_ahole3[_i4], oneHoleMovements[_i4], _bs); - for (let i = 0, il = ahole.length; i < il; i++) { - const vert = scalePt2(ahole[i], oneHoleMovements[i], bs); - v(vert.x, vert.y, -z); + v(_vert.x, _vert.y, -z); } } } - const bs = bevelSize + bevelOffset; // Back facing vertices + var bs = bevelSize + bevelOffset; // Back facing vertices - for (let i = 0; i < vlen; i++) { - const vert = bevelEnabled ? scalePt2(vertices[i], verticesMovements[i], bs) : vertices[i]; + for (var _i5 = 0; _i5 < vlen; _i5++) { + var _vert2 = bevelEnabled ? scalePt2(vertices[_i5], verticesMovements[_i5], bs) : vertices[_i5]; if (!extrudeByPath) { - v(vert.x, vert.y, 0); + v(_vert2.x, _vert2.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); + normal.copy(splineTube.normals[0]).multiplyScalar(_vert2.x); + binormal.copy(splineTube.binormals[0]).multiplyScalar(_vert2.y); position2.copy(extrudePts[0]).add(normal).add(binormal); v(position2.x, position2.y, position2.z); } @@ -21323,16 +22507,16 @@ // 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]; + for (var s = 1; s <= steps; s++) { + for (var _i6 = 0; _i6 < vlen; _i6++) { + var _vert3 = bevelEnabled ? scalePt2(vertices[_i6], verticesMovements[_i6], bs) : vertices[_i6]; if (!extrudeByPath) { - v(vert.x, vert.y, depth / steps * s); + v(_vert3.x, _vert3.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); + normal.copy(splineTube.normals[s]).multiplyScalar(_vert3.x); + binormal.copy(splineTube.binormals[s]).multiplyScalar(_vert3.y); position2.copy(extrudePts[s]).add(normal).add(binormal); v(position2.x, position2.y, position2.z); } @@ -21341,28 +22525,32 @@ //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 + for (var _b = bevelSegments - 1; _b >= 0; _b--) { + var _t = _b / bevelSegments; + + var _z = bevelThickness * Math.cos(_t * Math.PI / 2); + + var _bs2 = bevelSize * Math.sin(_t * Math.PI / 2) + bevelOffset; // contract shape + + + for (var _i7 = 0, _il4 = contour.length; _i7 < _il4; _i7++) { + var _vert4 = scalePt2(contour[_i7], contourMovements[_i7], _bs2); - 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); + v(_vert4.x, _vert4.y, depth + _z); } // expand holes - for (let h = 0, hl = holes.length; h < hl; h++) { - const ahole = holes[h]; - oneHoleMovements = holesMovements[h]; + for (var _h4 = 0, _hl4 = holes.length; _h4 < _hl4; _h4++) { + var _ahole4 = holes[_h4]; + oneHoleMovements = holesMovements[_h4]; - for (let i = 0, il = ahole.length; i < il; i++) { - const vert = scalePt2(ahole[i], oneHoleMovements[i], bs); + for (var _i8 = 0, _il5 = _ahole4.length; _i8 < _il5; _i8++) { + var _vert5 = scalePt2(_ahole4[_i8], oneHoleMovements[_i8], _bs2); if (!extrudeByPath) { - v(vert.x, vert.y, depth + z); + v(_vert5.x, _vert5.y, depth + _z); } else { - v(vert.x, vert.y + extrudePts[steps - 1].y, extrudePts[steps - 1].x + z); + v(_vert5.x, _vert5.y + extrudePts[steps - 1].y, extrudePts[steps - 1].x + _z); } } } @@ -21376,36 +22564,36 @@ buildSideFaces(); ///// Internal functions function buildLidFaces() { - const start = verticesArray.length / 3; + var start = verticesArray.length / 3; if (bevelEnabled) { - let layer = 0; // steps + 1 + var layer = 0; // steps + 1 - let offset = vlen * layer; // Bottom faces + var offset = vlen * layer; // Bottom faces - for (let i = 0; i < flen; i++) { - const face = faces[i]; + for (var _i9 = 0; _i9 < flen; _i9++) { + var face = faces[_i9]; f3(face[2] + offset, face[1] + offset, face[0] + offset); } layer = steps + bevelSegments * 2; offset = vlen * layer; // Top faces - for (let i = 0; i < flen; i++) { - const face = faces[i]; - f3(face[0] + offset, face[1] + offset, face[2] + offset); + for (var _i10 = 0; _i10 < flen; _i10++) { + var _face = faces[_i10]; + f3(_face[0] + offset, _face[1] + offset, _face[2] + offset); } } else { // Bottom faces - for (let i = 0; i < flen; i++) { - const face = faces[i]; - f3(face[2], face[1], face[0]); + for (var _i11 = 0; _i11 < flen; _i11++) { + var _face2 = faces[_i11]; + f3(_face2[2], _face2[1], _face2[0]); } // 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); + for (var _i12 = 0; _i12 < flen; _i12++) { + var _face3 = faces[_i12]; + f3(_face3[0] + vlen * steps, _face3[1] + vlen * steps, _face3[2] + vlen * steps); } } @@ -21414,37 +22602,41 @@ function buildSideFaces() { - const start = verticesArray.length / 3; - let layeroffset = 0; + var start = verticesArray.length / 3; + var 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 + for (var _h5 = 0, _hl5 = holes.length; _h5 < _hl5; _h5++) { + var _ahole5 = holes[_h5]; + sidewalls(_ahole5, layeroffset); //, true - layeroffset += ahole.length; + layeroffset += _ahole5.length; } scope.addGroup(start, verticesArray.length / 3 - start, 1); } function sidewalls(contour, layeroffset) { - let i = contour.length; + var 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); - - 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; - f4(a, b, c, d); + var _j2 = i; + + var _k2 = i - 1; + + if (_k2 < 0) _k2 = contour.length - 1; //console.log('b', i,j, i-1, k,vertices.length); + + for (var _s = 0, sl = steps + bevelSegments * 2; _s < sl; _s++) { + var slen1 = vlen * _s; + var slen2 = vlen * (_s + 1); + + var a = layeroffset + _j2 + slen1, + _b2 = layeroffset + _k2 + slen1, + c = layeroffset + _k2 + slen2, + d = layeroffset + _j2 + slen2; + + f4(a, _b2, c, d); } } } @@ -21459,8 +22651,8 @@ addVertex(a); addVertex(b); addVertex(c); - const nextIndex = verticesArray.length / 3; - const uvs = uvgen.generateTopUV(scope, verticesArray, nextIndex - 3, nextIndex - 2, nextIndex - 1); + var nextIndex = verticesArray.length / 3; + var uvs = uvgen.generateTopUV(scope, verticesArray, nextIndex - 3, nextIndex - 2, nextIndex - 1); addUV(uvs[0]); addUV(uvs[1]); addUV(uvs[2]); @@ -21473,8 +22665,8 @@ addVertex(b); addVertex(c); addVertex(d); - const nextIndex = verticesArray.length / 3; - const uvs = uvgen.generateSideWallUV(scope, verticesArray, nextIndex - 6, nextIndex - 3, nextIndex - 2, nextIndex - 1); + var nextIndex = verticesArray.length / 3; + var uvs = uvgen.generateSideWallUV(scope, verticesArray, nextIndex - 6, nextIndex - 3, nextIndex - 2, nextIndex - 1); addUV(uvs[0]); addUV(uvs[1]); addUV(uvs[3]); @@ -21494,40 +22686,45 @@ uvArray.push(vector2.y); } } - } - toJSON() { - const data = BufferGeometry.prototype.toJSON.call(this); - const shapes = this.parameters.shapes; - const options = this.parameters.options; - return toJSON$1(shapes, options, data); + return _this; } - } + var _proto = ExtrudeGeometry.prototype; + + _proto.toJSON = function toJSON() { + var data = BufferGeometry.prototype.toJSON.call(this); + var shapes = this.parameters.shapes; + var options = this.parameters.options; + return _toJSON(shapes, options, data); + }; - const WorldUVGenerator = { - generateTopUV: function (geometry, vertices, indexA, indexB, indexC) { - const a_x = vertices[indexA * 3]; - const a_y = vertices[indexA * 3 + 1]; - const b_x = vertices[indexB * 3]; - const b_y = vertices[indexB * 3 + 1]; - const c_x = vertices[indexC * 3]; - const c_y = vertices[indexC * 3 + 1]; + return ExtrudeGeometry; + }(BufferGeometry); + + var WorldUVGenerator = { + generateTopUV: function generateTopUV(geometry, vertices, indexA, indexB, indexC) { + var a_x = vertices[indexA * 3]; + var a_y = vertices[indexA * 3 + 1]; + var b_x = vertices[indexB * 3]; + var b_y = vertices[indexB * 3 + 1]; + var c_x = vertices[indexC * 3]; + var c_y = vertices[indexC * 3 + 1]; return [new Vector2(a_x, a_y), new Vector2(b_x, b_y), new Vector2(c_x, c_y)]; }, - generateSideWallUV: function (geometry, vertices, indexA, indexB, indexC, indexD) { - const a_x = vertices[indexA * 3]; - const a_y = vertices[indexA * 3 + 1]; - const a_z = vertices[indexA * 3 + 2]; - const b_x = vertices[indexB * 3]; - const b_y = vertices[indexB * 3 + 1]; - const b_z = vertices[indexB * 3 + 2]; - const c_x = vertices[indexC * 3]; - const c_y = vertices[indexC * 3 + 1]; - const c_z = vertices[indexC * 3 + 2]; - const d_x = vertices[indexD * 3]; - const d_y = vertices[indexD * 3 + 1]; - const d_z = vertices[indexD * 3 + 2]; + generateSideWallUV: function generateSideWallUV(geometry, vertices, indexA, indexB, indexC, indexD) { + var a_x = vertices[indexA * 3]; + var a_y = vertices[indexA * 3 + 1]; + var a_z = vertices[indexA * 3 + 2]; + var b_x = vertices[indexB * 3]; + var b_y = vertices[indexB * 3 + 1]; + var b_z = vertices[indexB * 3 + 2]; + var c_x = vertices[indexC * 3]; + var c_y = vertices[indexC * 3 + 1]; + var c_z = vertices[indexC * 3 + 2]; + var d_x = vertices[indexD * 3]; + var d_y = vertices[indexD * 3 + 1]; + var d_z = vertices[indexD * 3 + 2]; if (Math.abs(a_y - b_y) < 0.01) { 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)]; @@ -21537,12 +22734,12 @@ } }; - function toJSON$1(shapes, options, data) { + function _toJSON(shapes, options, data) { data.shapes = []; if (Array.isArray(shapes)) { - for (let i = 0, l = shapes.length; i < l; i++) { - const shape = shapes[i]; + for (var i = 0, l = shapes.length; i < l; i++) { + var shape = shapes[i]; data.shapes.push(shape.uuid); } } else { @@ -21553,26 +22750,56 @@ return data; } - class IcosahedronGeometry extends PolyhedronGeometry { - constructor(radius = 1, detail = 0) { - const t = (1 + Math.sqrt(5)) / 2; - const vertices = [-1, t, 0, 1, t, 0, -1, -t, 0, 1, -t, 0, 0, -1, t, 0, 1, t, 0, -1, -t, 0, 1, -t, t, 0, -1, t, 0, 1, -t, 0, -1, -t, 0, 1]; - const indices = [0, 11, 5, 0, 5, 1, 0, 1, 7, 0, 7, 10, 0, 10, 11, 1, 5, 9, 5, 11, 4, 11, 10, 2, 10, 7, 6, 7, 1, 8, 3, 9, 4, 3, 4, 2, 3, 2, 6, 3, 6, 8, 3, 8, 9, 4, 9, 5, 2, 4, 11, 6, 2, 10, 8, 6, 7, 9, 8, 1]; - super(vertices, indices, radius, detail); - this.type = 'IcosahedronGeometry'; - this.parameters = { + var IcosahedronGeometry = /*#__PURE__*/function (_PolyhedronGeometry) { + _inheritsLoose(IcosahedronGeometry, _PolyhedronGeometry); + + function IcosahedronGeometry(radius, detail) { + var _this; + + if (radius === void 0) { + radius = 1; + } + + if (detail === void 0) { + detail = 0; + } + + var t = (1 + Math.sqrt(5)) / 2; + var vertices = [-1, t, 0, 1, t, 0, -1, -t, 0, 1, -t, 0, 0, -1, t, 0, 1, t, 0, -1, -t, 0, 1, -t, t, 0, -1, t, 0, 1, -t, 0, -1, -t, 0, 1]; + var indices = [0, 11, 5, 0, 5, 1, 0, 1, 7, 0, 7, 10, 0, 10, 11, 1, 5, 9, 5, 11, 4, 11, 10, 2, 10, 7, 6, 7, 1, 8, 3, 9, 4, 3, 4, 2, 3, 2, 6, 3, 6, 8, 3, 8, 9, 4, 9, 5, 2, 4, 11, 6, 2, 10, 8, 6, 7, 9, 8, 1]; + _this = _PolyhedronGeometry.call(this, vertices, indices, radius, detail) || this; + _this.type = 'IcosahedronGeometry'; + _this.parameters = { radius: radius, detail: detail }; + return _this; } - } + return IcosahedronGeometry; + }(PolyhedronGeometry); + + var LatheGeometry = /*#__PURE__*/function (_BufferGeometry) { + _inheritsLoose(LatheGeometry, _BufferGeometry); + + function LatheGeometry(points, segments, phiStart, phiLength) { + var _this; + + if (segments === void 0) { + segments = 12; + } + + if (phiStart === void 0) { + phiStart = 0; + } + + if (phiLength === void 0) { + phiLength = Math.PI * 2; + } - class LatheGeometry extends BufferGeometry { - constructor(points, segments = 12, phiStart = 0, phiLength = Math.PI * 2) { - super(); - this.type = 'LatheGeometry'; - this.parameters = { + _this = _BufferGeometry.call(this) || this; + _this.type = 'LatheGeometry'; + _this.parameters = { points: points, segments: segments, phiStart: phiStart, @@ -21582,20 +22809,20 @@ phiLength = MathUtils.clamp(phiLength, 0, Math.PI * 2); // buffers - const indices = []; - const vertices = []; - const uvs = []; // helper variables + var indices = []; + var vertices = []; + var uvs = []; // helper variables - const inverseSegments = 1.0 / segments; - const vertex = new Vector3(); - const uv = new Vector2(); // generate vertices and uvs + var inverseSegments = 1.0 / segments; + var vertex = new Vector3(); + var uv = new Vector2(); // generate vertices and uvs - for (let i = 0; i <= segments; i++) { - const phi = phiStart + i * inverseSegments * phiLength; - const sin = Math.sin(phi); - const cos = Math.cos(phi); + for (var i = 0; i <= segments; i++) { + var phi = phiStart + i * inverseSegments * phiLength; + var sin = Math.sin(phi); + var cos = Math.cos(phi); - for (let j = 0; j <= points.length - 1; j++) { + for (var j = 0; j <= points.length - 1; j++) { // vertex vertex.x = points[j].x * sin; vertex.y = points[j].y; @@ -21609,13 +22836,13 @@ } // indices - for (let i = 0; i < segments; i++) { - for (let j = 0; j < points.length - 1; j++) { - const base = j + i * points.length; - const a = base; - const b = base + points.length; - const c = base + points.length + 1; - const d = base + 1; // faces + for (var _i = 0; _i < segments; _i++) { + for (var _j = 0; _j < points.length - 1; _j++) { + var base = _j + _i * points.length; + var a = base; + var b = base + points.length; + var c = base + points.length + 1; + var d = base + 1; // faces indices.push(a, b, d); indices.push(b, c, d); @@ -21623,55 +22850,76 @@ } // build geometry - this.setIndex(indices); - this.setAttribute('position', new Float32BufferAttribute(vertices, 3)); - this.setAttribute('uv', new Float32BufferAttribute(uvs, 2)); // generate normals + _this.setIndex(indices); - this.computeVertexNormals(); // if the geometry is closed, we need to average the normals along the seam. + _this.setAttribute('position', new Float32BufferAttribute(vertices, 3)); + + _this.setAttribute('uv', new Float32BufferAttribute(uvs, 2)); // generate normals + + + _this.computeVertexNormals(); // if the geometry is closed, we need to average the normals along the seam. // because the corresponding vertices are identical (but still have different UVs). + if (phiLength === Math.PI * 2) { - const normals = this.attributes.normal.array; - const n1 = new Vector3(); - const n2 = new Vector3(); - const n = new Vector3(); // this is the buffer offset for the last line of vertices + var normals = _this.attributes.normal.array; + var n1 = new Vector3(); + var n2 = new Vector3(); + var n = new Vector3(); // this is the buffer offset for the last line of vertices - const base = segments * points.length * 3; + var _base = segments * points.length * 3; - for (let i = 0, j = 0; i < points.length; i++, j += 3) { + for (var _i2 = 0, _j2 = 0; _i2 < points.length; _i2++, _j2 += 3) { // select the normal of the vertex in the first line - n1.x = normals[j + 0]; - n1.y = normals[j + 1]; - n1.z = normals[j + 2]; // select the normal of the vertex in the last line + n1.x = normals[_j2 + 0]; + n1.y = normals[_j2 + 1]; + n1.z = normals[_j2 + 2]; // select the normal of the vertex in the last line - n2.x = normals[base + j + 0]; - n2.y = normals[base + j + 1]; - n2.z = normals[base + j + 2]; // average normals + n2.x = normals[_base + _j2 + 0]; + n2.y = normals[_base + _j2 + 1]; + n2.z = normals[_base + _j2 + 2]; // average normals n.addVectors(n1, n2).normalize(); // assign the new values to both normals - normals[j + 0] = normals[base + j + 0] = n.x; - normals[j + 1] = normals[base + j + 1] = n.y; - normals[j + 2] = normals[base + j + 2] = n.z; + normals[_j2 + 0] = normals[_base + _j2 + 0] = n.x; + normals[_j2 + 1] = normals[_base + _j2 + 1] = n.y; + normals[_j2 + 2] = normals[_base + _j2 + 2] = n.z; } } + + return _this; } - } + return LatheGeometry; + }(BufferGeometry); + + var OctahedronGeometry = /*#__PURE__*/function (_PolyhedronGeometry) { + _inheritsLoose(OctahedronGeometry, _PolyhedronGeometry); + + function OctahedronGeometry(radius, detail) { + var _this; - class OctahedronGeometry extends PolyhedronGeometry { - constructor(radius = 1, detail = 0) { - const vertices = [1, 0, 0, -1, 0, 0, 0, 1, 0, 0, -1, 0, 0, 0, 1, 0, 0, -1]; - const indices = [0, 2, 4, 0, 4, 3, 0, 3, 5, 0, 5, 2, 1, 2, 5, 1, 5, 3, 1, 3, 4, 1, 4, 2]; - super(vertices, indices, radius, detail); - this.type = 'OctahedronGeometry'; - this.parameters = { + if (radius === void 0) { + radius = 1; + } + + if (detail === void 0) { + detail = 0; + } + + var vertices = [1, 0, 0, -1, 0, 0, 0, 1, 0, 0, -1, 0, 0, 0, 1, 0, 0, -1]; + var indices = [0, 2, 4, 0, 4, 3, 0, 3, 5, 0, 5, 2, 1, 2, 5, 1, 5, 3, 1, 3, 4, 1, 4, 2]; + _this = _PolyhedronGeometry.call(this, vertices, indices, radius, detail) || this; + _this.type = 'OctahedronGeometry'; + _this.parameters = { radius: radius, detail: detail }; + return _this; } - } + return OctahedronGeometry; + }(PolyhedronGeometry); /** * Parametric Surfaces Geometry @@ -21687,29 +22935,29 @@ stacks: stacks }; // buffers - const indices = []; - const vertices = []; - const normals = []; - const uvs = []; - const EPS = 0.00001; - const normal = new Vector3(); - const p0 = new Vector3(), - p1 = new Vector3(); - const pu = new Vector3(), - pv = new Vector3(); + var indices = []; + var vertices = []; + var normals = []; + var uvs = []; + var EPS = 0.00001; + var normal = new Vector3(); + var p0 = new Vector3(), + p1 = new Vector3(); + var pu = new Vector3(), + pv = new Vector3(); if (func.length < 3) { console.error('THREE.ParametricGeometry: Function must now modify a Vector3 as third parameter.'); } // generate vertices, normals and uvs - const sliceCount = slices + 1; + var sliceCount = slices + 1; - for (let i = 0; i <= stacks; i++) { - const v = i / stacks; + for (var i = 0; i <= stacks; i++) { + var v = i / stacks; - for (let j = 0; j <= slices; j++) { - const u = j / slices; // vertex + for (var j = 0; j <= slices; j++) { + var u = j / slices; // vertex func(u, v, p0); vertices.push(p0.x, p0.y, p0.z); // normal @@ -21740,12 +22988,12 @@ } // generate indices - for (let i = 0; i < stacks; i++) { - for (let j = 0; j < slices; j++) { - const a = i * sliceCount + j; - const b = i * sliceCount + j + 1; - const c = (i + 1) * sliceCount + j + 1; - const d = (i + 1) * sliceCount + j; // faces one and two + for (var _i = 0; _i < stacks; _i++) { + for (var _j = 0; _j < slices; _j++) { + var a = _i * sliceCount + _j; + var b = _i * sliceCount + _j + 1; + var c = (_i + 1) * sliceCount + _j + 1; + var d = (_i + 1) * sliceCount + _j; // faces one and two indices.push(a, b, d); indices.push(b, c, d); @@ -21762,11 +23010,39 @@ ParametricGeometry.prototype = Object.create(BufferGeometry.prototype); ParametricGeometry.prototype.constructor = ParametricGeometry; - class RingGeometry extends BufferGeometry { - constructor(innerRadius = 0.5, outerRadius = 1, thetaSegments = 8, phiSegments = 1, thetaStart = 0, thetaLength = Math.PI * 2) { - super(); - this.type = 'RingGeometry'; - this.parameters = { + var RingGeometry = /*#__PURE__*/function (_BufferGeometry) { + _inheritsLoose(RingGeometry, _BufferGeometry); + + function RingGeometry(innerRadius, outerRadius, thetaSegments, phiSegments, thetaStart, thetaLength) { + var _this; + + if (innerRadius === void 0) { + innerRadius = 0.5; + } + + if (outerRadius === void 0) { + outerRadius = 1; + } + + if (thetaSegments === void 0) { + thetaSegments = 8; + } + + if (phiSegments === void 0) { + phiSegments = 1; + } + + if (thetaStart === void 0) { + thetaStart = 0; + } + + if (thetaLength === void 0) { + thetaLength = Math.PI * 2; + } + + _this = _BufferGeometry.call(this) || this; + _this.type = 'RingGeometry'; + _this.parameters = { innerRadius: innerRadius, outerRadius: outerRadius, thetaSegments: thetaSegments, @@ -21777,20 +23053,20 @@ thetaSegments = Math.max(3, thetaSegments); phiSegments = Math.max(1, phiSegments); // buffers - const indices = []; - const vertices = []; - const normals = []; - const uvs = []; // some helper variables + var indices = []; + var vertices = []; + var normals = []; + var 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 + var radius = innerRadius; + var radiusStep = (outerRadius - innerRadius) / phiSegments; + var vertex = new Vector3(); + var uv = new Vector2(); // generate vertices, normals and uvs - for (let j = 0; j <= phiSegments; j++) { - for (let i = 0; i <= thetaSegments; i++) { + for (var j = 0; j <= phiSegments; j++) { + for (var i = 0; i <= thetaSegments; i++) { // values are generate from the inside of the ring to the outside - const segment = thetaStart + i / thetaSegments * thetaLength; // vertex + var segment = thetaStart + i / thetaSegments * thetaLength; // vertex vertex.x = radius * Math.cos(segment); vertex.y = radius * Math.sin(segment); @@ -21808,15 +23084,16 @@ } // indices - for (let j = 0; j < phiSegments; j++) { - const thetaSegmentLevel = j * (thetaSegments + 1); + for (var _j = 0; _j < phiSegments; _j++) { + var thetaSegmentLevel = _j * (thetaSegments + 1); + + for (var _i = 0; _i < thetaSegments; _i++) { + var _segment = _i + thetaSegmentLevel; - 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 + var a = _segment; + var b = _segment + thetaSegments + 1; + var c = _segment + thetaSegments + 2; + var d = _segment + 1; // faces indices.push(a, b, d); indices.push(b, c, d); @@ -21824,37 +23101,53 @@ } // 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.setIndex(indices); + + _this.setAttribute('position', new Float32BufferAttribute(vertices, 3)); + + _this.setAttribute('normal', new Float32BufferAttribute(normals, 3)); + + _this.setAttribute('uv', new Float32BufferAttribute(uvs, 2)); + + return _this; } - } + return RingGeometry; + }(BufferGeometry); + + var ShapeGeometry = /*#__PURE__*/function (_BufferGeometry) { + _inheritsLoose(ShapeGeometry, _BufferGeometry); + + function ShapeGeometry(shapes, curveSegments) { + var _this; + + if (curveSegments === void 0) { + curveSegments = 12; + } - class ShapeGeometry extends BufferGeometry { - constructor(shapes, curveSegments = 12) { - super(); - this.type = 'ShapeGeometry'; - this.parameters = { + _this = _BufferGeometry.call(this) || this; + _this.type = 'ShapeGeometry'; + _this.parameters = { shapes: shapes, curveSegments: curveSegments }; // buffers - const indices = []; - const vertices = []; - const normals = []; - const uvs = []; // helper variables + var indices = []; + var vertices = []; + var normals = []; + var uvs = []; // helper variables - let groupStart = 0; - let groupCount = 0; // allow single and array values for "shapes" parameter + var groupStart = 0; + var groupCount = 0; // allow single and array values for "shapes" parameter if (Array.isArray(shapes) === false) { addShape(shapes); } else { - for (let i = 0; i < shapes.length; i++) { + for (var i = 0; i < shapes.length; i++) { addShape(shapes[i]); - this.addGroup(groupStart, groupCount, i); // enables MultiMaterial support + + _this.addGroup(groupStart, groupCount, i); // enables MultiMaterial support + groupStart += groupCount; groupCount = 0; @@ -21862,70 +23155,79 @@ } // 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.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 + 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 + var indexOffset = vertices.length / 3; + var points = shape.extractPoints(curveSegments); + var shapeVertices = points.shape; + var 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]; + for (var _i = 0, l = shapeHoles.length; _i < l; _i++) { + var shapeHole = shapeHoles[_i]; if (ShapeUtils.isClockWise(shapeHole) === true) { - shapeHoles[i] = shapeHole.reverse(); + shapeHoles[_i] = shapeHole.reverse(); } } - const faces = ShapeUtils.triangulateShape(shapeVertices, shapeHoles); // join vertices of inner and outer paths to a single array + var faces = ShapeUtils.triangulateShape(shapeVertices, shapeHoles); // 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); + for (var _i2 = 0, _l = shapeHoles.length; _i2 < _l; _i2++) { + var _shapeHole = shapeHoles[_i2]; + shapeVertices = shapeVertices.concat(_shapeHole); } // vertices, normals, uvs - for (let i = 0, l = shapeVertices.length; i < l; i++) { - const vertex = shapeVertices[i]; + for (var _i3 = 0, _l2 = shapeVertices.length; _i3 < _l2; _i3++) { + var vertex = shapeVertices[_i3]; vertices.push(vertex.x, vertex.y, 0); normals.push(0, 0, 1); uvs.push(vertex.x, vertex.y); // world uvs } // incides - for (let i = 0, l = faces.length; i < l; i++) { - const face = faces[i]; - const a = face[0] + indexOffset; - const b = face[1] + indexOffset; - const c = face[2] + indexOffset; + for (var _i4 = 0, _l3 = faces.length; _i4 < _l3; _i4++) { + var face = faces[_i4]; + var a = face[0] + indexOffset; + var b = face[1] + indexOffset; + var c = face[2] + indexOffset; indices.push(a, b, c); groupCount += 3; } } - } - toJSON() { - const data = BufferGeometry.prototype.toJSON.call(this); - const shapes = this.parameters.shapes; - return toJSON(shapes, data); + return _this; } - } + var _proto = ShapeGeometry.prototype; + + _proto.toJSON = function toJSON() { + var data = BufferGeometry.prototype.toJSON.call(this); + var shapes = this.parameters.shapes; + return _toJSON$1(shapes, data); + }; + + return ShapeGeometry; + }(BufferGeometry); - function toJSON(shapes, data) { + function _toJSON$1(shapes, data) { data.shapes = []; if (Array.isArray(shapes)) { - for (let i = 0, l = shapes.length; i < l; i++) { - const shape = shapes[i]; + for (var i = 0, l = shapes.length; i < l; i++) { + var shape = shapes[i]; data.shapes.push(shape.uuid); } } else { @@ -21935,11 +23237,43 @@ return data; } - class SphereGeometry extends BufferGeometry { - constructor(radius = 1, widthSegments = 8, heightSegments = 6, phiStart = 0, phiLength = Math.PI * 2, thetaStart = 0, thetaLength = Math.PI) { - super(); - this.type = 'SphereGeometry'; - this.parameters = { + var SphereGeometry = /*#__PURE__*/function (_BufferGeometry) { + _inheritsLoose(SphereGeometry, _BufferGeometry); + + function SphereGeometry(radius, widthSegments, heightSegments, phiStart, phiLength, thetaStart, thetaLength) { + var _this; + + if (radius === void 0) { + radius = 1; + } + + if (widthSegments === void 0) { + widthSegments = 8; + } + + if (heightSegments === void 0) { + heightSegments = 6; + } + + if (phiStart === void 0) { + phiStart = 0; + } + + if (phiLength === void 0) { + phiLength = Math.PI * 2; + } + + if (thetaStart === void 0) { + thetaStart = 0; + } + + if (thetaLength === void 0) { + thetaLength = Math.PI; + } + + _this = _BufferGeometry.call(this) || this; + _this.type = 'SphereGeometry'; + _this.parameters = { radius: radius, widthSegments: widthSegments, heightSegments: heightSegments, @@ -21950,22 +23284,22 @@ }; widthSegments = Math.max(3, Math.floor(widthSegments)); heightSegments = Math.max(2, Math.floor(heightSegments)); - const thetaEnd = Math.min(thetaStart + thetaLength, Math.PI); - let index = 0; - const grid = []; - const vertex = new Vector3(); - const normal = new Vector3(); // buffers + var thetaEnd = Math.min(thetaStart + thetaLength, Math.PI); + var index = 0; + var grid = []; + var vertex = new Vector3(); + var normal = new Vector3(); // buffers - const indices = []; - const vertices = []; - const normals = []; - const uvs = []; // generate vertices, normals and uvs + var indices = []; + var vertices = []; + var normals = []; + var uvs = []; // generate vertices, normals and uvs - for (let iy = 0; iy <= heightSegments; iy++) { - const verticesRow = []; - const v = iy / heightSegments; // special case for the poles + for (var iy = 0; iy <= heightSegments; iy++) { + var verticesRow = []; + var v = iy / heightSegments; // special case for the poles - let uOffset = 0; + var uOffset = 0; if (iy == 0 && thetaStart == 0) { uOffset = 0.5 / widthSegments; @@ -21973,8 +23307,8 @@ uOffset = -0.5 / widthSegments; } - for (let ix = 0; ix <= widthSegments; ix++) { - const u = ix / widthSegments; // vertex + for (var ix = 0; ix <= widthSegments; ix++) { + var 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); @@ -21992,84 +23326,121 @@ } // indices - for (let iy = 0; iy < heightSegments; iy++) { - for (let ix = 0; ix < widthSegments; ix++) { - const a = grid[iy][ix + 1]; - const b = grid[iy][ix]; - const c = grid[iy + 1][ix]; - const d = grid[iy + 1][ix + 1]; - if (iy !== 0 || thetaStart > 0) indices.push(a, b, d); - if (iy !== heightSegments - 1 || thetaEnd < Math.PI) indices.push(b, c, d); + for (var _iy = 0; _iy < heightSegments; _iy++) { + for (var _ix = 0; _ix < widthSegments; _ix++) { + var a = grid[_iy][_ix + 1]; + var b = grid[_iy][_ix]; + var c = grid[_iy + 1][_ix]; + var d = grid[_iy + 1][_ix + 1]; + if (_iy !== 0 || thetaStart > 0) indices.push(a, b, d); + if (_iy !== heightSegments - 1 || thetaEnd < Math.PI) indices.push(b, c, d); } } // 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.setIndex(indices); + + _this.setAttribute('position', new Float32BufferAttribute(vertices, 3)); + + _this.setAttribute('normal', new Float32BufferAttribute(normals, 3)); + + _this.setAttribute('uv', new Float32BufferAttribute(uvs, 2)); + + return _this; } - } + return SphereGeometry; + }(BufferGeometry); + + var TetrahedronGeometry = /*#__PURE__*/function (_PolyhedronGeometry) { + _inheritsLoose(TetrahedronGeometry, _PolyhedronGeometry); + + function TetrahedronGeometry(radius, detail) { + var _this; + + if (radius === void 0) { + radius = 1; + } + + if (detail === void 0) { + detail = 0; + } - class TetrahedronGeometry extends PolyhedronGeometry { - constructor(radius = 1, detail = 0) { - const vertices = [1, 1, 1, -1, -1, 1, -1, 1, -1, 1, -1, -1]; - const indices = [2, 1, 0, 0, 3, 2, 1, 3, 0, 2, 3, 1]; - super(vertices, indices, radius, detail); - this.type = 'TetrahedronGeometry'; - this.parameters = { + var vertices = [1, 1, 1, -1, -1, 1, -1, 1, -1, 1, -1, -1]; + var indices = [2, 1, 0, 0, 3, 2, 1, 3, 0, 2, 3, 1]; + _this = _PolyhedronGeometry.call(this, vertices, indices, radius, detail) || this; + _this.type = 'TetrahedronGeometry'; + _this.parameters = { radius: radius, detail: detail }; + return _this; } - } + return TetrahedronGeometry; + }(PolyhedronGeometry); - /** - * Text = 3D Text - * - * parameters = { - * font: , // font - * - * size: , // size of the text - * height: , // thickness to extrude text - * curveSegments: , // number of points on the curves - * - * bevelEnabled: , // turn on bevel - * bevelThickness: , // how deep into text bevel goes - * bevelSize: , // how far from text outline (including bevelOffset) is bevel - * bevelOffset: // how far from text outline does bevel start - * } - */ + var TextGeometry = /*#__PURE__*/function (_ExtrudeGeometry) { + _inheritsLoose(TextGeometry, _ExtrudeGeometry); + + function TextGeometry(text, parameters) { + var _this; - class TextGeometry extends ExtrudeGeometry { - constructor(text, parameters = {}) { - const font = parameters.font; + if (parameters === void 0) { + parameters = {}; + } + + var font = parameters.font; if (!(font && font.isFont)) { console.error('THREE.TextGeometry: font parameter is not an instance of THREE.Font.'); - return new BufferGeometry(); + return new BufferGeometry() || _assertThisInitialized(_this); } - const shapes = font.generateShapes(text, parameters.size); // translate parameters to ExtrudeGeometry API + var shapes = font.generateShapes(text, parameters.size); // translate parameters to ExtrudeGeometry API parameters.depth = parameters.height !== undefined ? parameters.height : 50; // defaults if (parameters.bevelThickness === undefined) parameters.bevelThickness = 10; if (parameters.bevelSize === undefined) parameters.bevelSize = 8; if (parameters.bevelEnabled === undefined) parameters.bevelEnabled = false; - super(shapes, parameters); - this.type = 'TextGeometry'; + _this = _ExtrudeGeometry.call(this, shapes, parameters) || this; + _this.type = 'TextGeometry'; + return _this; } - } + return TextGeometry; + }(ExtrudeGeometry); + + var TorusGeometry = /*#__PURE__*/function (_BufferGeometry) { + _inheritsLoose(TorusGeometry, _BufferGeometry); + + function TorusGeometry(radius, tube, radialSegments, tubularSegments, arc) { + var _this; + + if (radius === void 0) { + radius = 1; + } + + if (tube === void 0) { + tube = 0.4; + } + + if (radialSegments === void 0) { + radialSegments = 8; + } + + if (tubularSegments === void 0) { + tubularSegments = 6; + } + + if (arc === void 0) { + arc = Math.PI * 2; + } - class TorusGeometry extends BufferGeometry { - constructor(radius = 1, tube = 0.4, radialSegments = 8, tubularSegments = 6, arc = Math.PI * 2) { - super(); - this.type = 'TorusGeometry'; - this.parameters = { + _this = _BufferGeometry.call(this) || this; + _this.type = 'TorusGeometry'; + _this.parameters = { radius: radius, tube: tube, radialSegments: radialSegments, @@ -22079,19 +23450,19 @@ radialSegments = Math.floor(radialSegments); tubularSegments = Math.floor(tubularSegments); // buffers - const indices = []; - const vertices = []; - const normals = []; - const uvs = []; // helper variables + var indices = []; + var vertices = []; + var normals = []; + var uvs = []; // helper variables - const center = new Vector3(); - const vertex = new Vector3(); - const normal = new Vector3(); // generate vertices, normals and uvs + var center = new Vector3(); + var vertex = new Vector3(); + var 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 + for (var j = 0; j <= radialSegments; j++) { + for (var i = 0; i <= tubularSegments; i++) { + var u = i / tubularSegments * arc; + var 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); @@ -22109,13 +23480,13 @@ } // generate indices - for (let j = 1; j <= radialSegments; j++) { - for (let i = 1; i <= tubularSegments; i++) { + for (var _j = 1; _j <= radialSegments; _j++) { + for (var _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 + var a = (tubularSegments + 1) * _j + _i - 1; + var b = (tubularSegments + 1) * (_j - 1) + _i - 1; + var c = (tubularSegments + 1) * (_j - 1) + _i; + var d = (tubularSegments + 1) * _j + _i; // faces indices.push(a, b, d); indices.push(b, c, d); @@ -22123,45 +23494,79 @@ } // 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.setIndex(indices); - } + _this.setAttribute('position', new Float32BufferAttribute(vertices, 3)); - class TorusKnotGeometry extends BufferGeometry { - constructor(radius = 1, tube = 0.4, tubularSegments = 64, radialSegments = 8, p = 2, q = 3) { - super(); - this.type = 'TorusKnotGeometry'; - this.parameters = { - radius: radius, - tube: tube, - tubularSegments: tubularSegments, - radialSegments: radialSegments, - p: p, - q: q - }; - tubularSegments = Math.floor(tubularSegments); - radialSegments = Math.floor(radialSegments); // buffers + _this.setAttribute('normal', new Float32BufferAttribute(normals, 3)); - const indices = []; - const vertices = []; - const normals = []; - const uvs = []; // helper variables + _this.setAttribute('uv', new Float32BufferAttribute(uvs, 2)); - const vertex = new Vector3(); - const normal = new Vector3(); - const P1 = new Vector3(); - const P2 = new Vector3(); - const B = new Vector3(); - const T = new Vector3(); - const N = new Vector3(); // generate vertices, normals and uvs + return _this; + } - 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. + return TorusGeometry; + }(BufferGeometry); + + var TorusKnotGeometry = /*#__PURE__*/function (_BufferGeometry) { + _inheritsLoose(TorusKnotGeometry, _BufferGeometry); + + function TorusKnotGeometry(radius, tube, tubularSegments, radialSegments, p, q) { + var _this; + + if (radius === void 0) { + radius = 1; + } + + if (tube === void 0) { + tube = 0.4; + } + + if (tubularSegments === void 0) { + tubularSegments = 64; + } + + if (radialSegments === void 0) { + radialSegments = 8; + } + + if (p === void 0) { + p = 2; + } + + if (q === void 0) { + q = 3; + } + + _this = _BufferGeometry.call(this) || this; + _this.type = 'TorusKnotGeometry'; + _this.parameters = { + radius: radius, + tube: tube, + tubularSegments: tubularSegments, + radialSegments: radialSegments, + p: p, + q: q + }; + tubularSegments = Math.floor(tubularSegments); + radialSegments = Math.floor(radialSegments); // buffers + + var indices = []; + var vertices = []; + var normals = []; + var uvs = []; // helper variables + + var vertex = new Vector3(); + var normal = new Vector3(); + var P1 = new Vector3(); + var P2 = new Vector3(); + var B = new Vector3(); + var T = new Vector3(); + var N = new Vector3(); // generate vertices, normals and uvs + + for (var i = 0; i <= tubularSegments; ++i) { + // the radian "u" is used to calculate the position on the torus curve of the current tubular segement + var 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); @@ -22175,12 +23580,12 @@ B.normalize(); N.normalize(); - for (let j = 0; j <= radialSegments; ++j) { + for (var 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. + var v = j / radialSegments * Math.PI * 2; + var cx = -tube * Math.cos(v); + var 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); @@ -22197,13 +23602,13 @@ } // generate indices - for (let j = 1; j <= tubularSegments; j++) { - for (let i = 1; i <= radialSegments; i++) { + for (var _j = 1; _j <= tubularSegments; _j++) { + for (var _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 + var a = (radialSegments + 1) * (_j - 1) + (_i - 1); + var b = (radialSegments + 1) * _j + (_i - 1); + var c = (radialSegments + 1) * _j + _i; + var d = (radialSegments + 1) * (_j - 1) + _i; // faces indices.push(a, b, d); indices.push(b, c, d); @@ -22211,60 +23616,91 @@ } // 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.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 + function calculatePositionOnCurve(u, p, q, radius, position) { - const cu = Math.cos(u); - const su = Math.sin(u); - const quOverP = q / p * u; - const cs = Math.cos(quOverP); + var cu = Math.cos(u); + var su = Math.sin(u); + var quOverP = q / p * u; + var cs = Math.cos(quOverP); position.x = radius * (2 + cs) * 0.5 * cu; position.y = radius * (2 + cs) * su * 0.5; position.z = radius * Math.sin(quOverP) * 0.5; } + + return _this; } - } + return TorusKnotGeometry; + }(BufferGeometry); + + var TubeGeometry = /*#__PURE__*/function (_BufferGeometry) { + _inheritsLoose(TubeGeometry, _BufferGeometry); + + function TubeGeometry(path, tubularSegments, radius, radialSegments, closed) { + var _this; + + if (tubularSegments === void 0) { + tubularSegments = 64; + } + + if (radius === void 0) { + radius = 1; + } - class TubeGeometry extends BufferGeometry { - constructor(path, tubularSegments = 64, radius = 1, radialSegments = 8, closed = false) { - super(); - this.type = 'TubeGeometry'; - this.parameters = { + if (radialSegments === void 0) { + radialSegments = 8; + } + + if (closed === void 0) { + closed = false; + } + + _this = _BufferGeometry.call(this) || this; + _this.type = 'TubeGeometry'; + _this.parameters = { path: path, tubularSegments: tubularSegments, radius: radius, radialSegments: radialSegments, closed: closed }; - const frames = path.computeFrenetFrames(tubularSegments, closed); // expose internals + var frames = path.computeFrenetFrames(tubularSegments, closed); // expose internals - this.tangents = frames.tangents; - this.normals = frames.normals; - this.binormals = frames.binormals; // helper variables + _this.tangents = frames.tangents; + _this.normals = frames.normals; + _this.binormals = frames.binormals; // helper variables - const vertex = new Vector3(); - const normal = new Vector3(); - const uv = new Vector2(); - let P = new Vector3(); // buffer + var vertex = new Vector3(); + var normal = new Vector3(); + var uv = new Vector2(); + var P = new Vector3(); // buffer - const vertices = []; - const normals = []; - const uvs = []; - const indices = []; // create buffer data + var vertices = []; + var normals = []; + var uvs = []; + var indices = []; // 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.setIndex(indices); + + _this.setAttribute('position', new Float32BufferAttribute(vertices, 3)); + + _this.setAttribute('normal', new Float32BufferAttribute(normals, 3)); + + _this.setAttribute('uv', new Float32BufferAttribute(uvs, 2)); // functions + function generateBufferData() { - for (let i = 0; i < tubularSegments; i++) { + for (var i = 0; i < tubularSegments; i++) { generateSegment(i); } // if the geometry is not closed, generate the last row of vertices and normals // at the regular position on the given path @@ -22284,13 +23720,13 @@ // we use getPointAt to sample evenly distributed points from the given path 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 + var N = frames.normals[i]; + var 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 + for (var j = 0; j <= radialSegments; j++) { + var v = j / radialSegments * Math.PI * 2; + var sin = Math.sin(v); + var cos = -Math.cos(v); // normal normal.x = cos * N.x + sin * B.x; normal.y = cos * N.y + sin * B.y; @@ -22306,12 +23742,12 @@ } 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 + for (var j = 1; j <= tubularSegments; j++) { + for (var i = 1; i <= radialSegments; i++) { + var a = (radialSegments + 1) * (j - 1) + (i - 1); + var b = (radialSegments + 1) * j + (i - 1); + var c = (radialSegments + 1) * j + i; + var d = (radialSegments + 1) * (j - 1) + i; // faces indices.push(a, b, d); indices.push(b, c, d); @@ -22320,46 +23756,55 @@ } function generateUVs() { - for (let i = 0; i <= tubularSegments; i++) { - for (let j = 0; j <= radialSegments; j++) { + for (var i = 0; i <= tubularSegments; i++) { + for (var j = 0; j <= radialSegments; j++) { uv.x = i / tubularSegments; uv.y = j / radialSegments; uvs.push(uv.x, uv.y); } } } + + return _this; } - toJSON() { - const data = BufferGeometry.prototype.toJSON.call(this); + var _proto = TubeGeometry.prototype; + + _proto.toJSON = function toJSON() { + var data = BufferGeometry.prototype.toJSON.call(this); data.path = this.parameters.path.toJSON(); return data; - } + }; - } + return TubeGeometry; + }(BufferGeometry); + + var WireframeGeometry = /*#__PURE__*/function (_BufferGeometry) { + _inheritsLoose(WireframeGeometry, _BufferGeometry); - class WireframeGeometry extends BufferGeometry { - constructor(geometry) { - super(); - this.type = 'WireframeGeometry'; + function WireframeGeometry(geometry) { + var _this; + + _this = _BufferGeometry.call(this) || this; + _this.type = 'WireframeGeometry'; if (geometry.isGeometry === true) { console.error('THREE.WireframeGeometry no longer supports THREE.Geometry. Use THREE.BufferGeometry instead.'); - return; + return _assertThisInitialized(_this); } // buffer - const vertices = []; // helper variables + var vertices = []; // helper variables - const edge = [0, 0], - edges = {}; - const vertex = new Vector3(); + var edge = [0, 0], + edges = {}; + var vertex = new Vector3(); if (geometry.index !== null) { // indexed BufferGeometry - const position = geometry.attributes.position; - const indices = geometry.index; - let groups = geometry.groups; + var position = geometry.attributes.position; + var indices = geometry.index; + var groups = geometry.groups; if (groups.length === 0) { groups = [{ @@ -22370,19 +23815,19 @@ } // 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 start = group.start; - const count = group.count; + for (var o = 0, ol = groups.length; o < ol; ++o) { + var group = groups[o]; + var start = group.start; + var count = group.count; - for (let i = start, l = start + count; i < l; i += 3) { - for (let j = 0; j < 3; j++) { - const edge1 = indices.getX(i + j); - const edge2 = indices.getX(i + (j + 1) % 3); + for (var i = start, l = start + count; i < l; i += 3) { + for (var j = 0; j < 3; j++) { + var edge1 = indices.getX(i + j); + var edge2 = indices.getX(i + (j + 1) % 3); edge[0] = Math.min(edge1, edge2); // sorting prevents duplicates edge[1] = Math.max(edge1, edge2); - const key = edge[0] + ',' + edge[1]; + var key = edge[0] + ',' + edge[1]; if (edges[key] === undefined) { edges[key] = { @@ -22395,8 +23840,8 @@ } // generate vertices - for (const key in edges) { - const e = edges[key]; + for (var _key in edges) { + var e = edges[_key]; vertex.fromBufferAttribute(position, e.index1); vertices.push(vertex.x, vertex.y, vertex.z); vertex.fromBufferAttribute(position, e.index2); @@ -22404,27 +23849,30 @@ } } else { // non-indexed BufferGeometry - const position = geometry.attributes.position; + var _position = geometry.attributes.position; - for (let i = 0, l = position.count / 3; i < l; i++) { - for (let j = 0; j < 3; j++) { + for (var _i = 0, _l = _position.count / 3; _i < _l; _i++) { + for (var _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; - vertex.fromBufferAttribute(position, index1); + var index1 = 3 * _i + _j; + vertex.fromBufferAttribute(_position, index1); vertices.push(vertex.x, vertex.y, vertex.z); - const index2 = 3 * i + (j + 1) % 3; - vertex.fromBufferAttribute(position, index2); + var index2 = 3 * _i + (_j + 1) % 3; + vertex.fromBufferAttribute(_position, index2); vertices.push(vertex.x, vertex.y, vertex.z); } } } // build geometry - this.setAttribute('position', new Float32BufferAttribute(vertices, 3)); + _this.setAttribute('position', new Float32BufferAttribute(vertices, 3)); + + return _this; } - } + return WireframeGeometry; + }(BufferGeometry); var Geometries = /*#__PURE__*/Object.freeze({ __proto__: null, @@ -22478,32 +23926,49 @@ * } */ - class ShadowMaterial extends Material { - constructor(parameters) { - super(); - this.type = 'ShadowMaterial'; - this.color = new Color(0x000000); - this.transparent = true; - this.setValues(parameters); + var ShadowMaterial = /*#__PURE__*/function (_Material) { + _inheritsLoose(ShadowMaterial, _Material); + + function ShadowMaterial(parameters) { + var _this; + + _this = _Material.call(this) || this; + _this.type = 'ShadowMaterial'; + _this.color = new Color(0x000000); + _this.transparent = true; + + _this.setValues(parameters); + + return _this; } - copy(source) { - super.copy(source); + var _proto = ShadowMaterial.prototype; + + _proto.copy = function copy(source) { + _Material.prototype.copy.call(this, source); + this.color.copy(source.color); return this; - } + }; - } + return ShadowMaterial; + }(Material); ShadowMaterial.prototype.isShadowMaterial = true; - class RawShaderMaterial extends ShaderMaterial { - constructor(parameters) { - super(parameters); - this.type = 'RawShaderMaterial'; + var RawShaderMaterial = /*#__PURE__*/function (_ShaderMaterial) { + _inheritsLoose(RawShaderMaterial, _ShaderMaterial); + + function RawShaderMaterial(parameters) { + var _this; + + _this = _ShaderMaterial.call(this, parameters) || this; + _this.type = 'RawShaderMaterial'; + return _this; } - } + return RawShaderMaterial; + }(ShaderMaterial); RawShaderMaterial.prototype.isRawShaderMaterial = true; @@ -22684,10 +24149,10 @@ this.reflectivity = 0.5; // maps to F0 = 0.04 Object.defineProperty(this, 'ior', { - get: function () { + get: function get() { return (1 + 0.4 * this.reflectivity) / (1 - 0.4 * this.reflectivity); }, - set: function (ior) { + set: function set(ior) { this.reflectivity = MathUtils.clamp(2.5 * (ior - 1) / (ior + 1), 0, 1); } }); @@ -22777,49 +24242,59 @@ * } */ - class MeshPhongMaterial extends Material { - constructor(parameters) { - super(); - this.type = 'MeshPhongMaterial'; - this.color = new Color(0xffffff); // diffuse - - this.specular = new Color(0x111111); - this.shininess = 30; - this.map = null; - this.lightMap = null; - this.lightMapIntensity = 1.0; - this.aoMap = null; - this.aoMapIntensity = 1.0; - this.emissive = new Color(0x000000); - this.emissiveIntensity = 1.0; - this.emissiveMap = null; - this.bumpMap = null; - this.bumpScale = 1; - this.normalMap = null; - this.normalMapType = TangentSpaceNormalMap; - this.normalScale = new Vector2(1, 1); - this.displacementMap = null; - this.displacementScale = 1; - this.displacementBias = 0; - this.specularMap = null; - this.alphaMap = null; - this.envMap = null; - this.combine = MultiplyOperation; - this.reflectivity = 1; - this.refractionRatio = 0.98; - this.wireframe = false; - this.wireframeLinewidth = 1; - this.wireframeLinecap = 'round'; - this.wireframeLinejoin = 'round'; - this.skinning = false; - this.morphTargets = false; - this.morphNormals = false; - this.flatShading = false; - this.setValues(parameters); - } + var MeshPhongMaterial = /*#__PURE__*/function (_Material) { + _inheritsLoose(MeshPhongMaterial, _Material); + + function MeshPhongMaterial(parameters) { + var _this; + + _this = _Material.call(this) || this; + _this.type = 'MeshPhongMaterial'; + _this.color = new Color(0xffffff); // diffuse + + _this.specular = new Color(0x111111); + _this.shininess = 30; + _this.map = null; + _this.lightMap = null; + _this.lightMapIntensity = 1.0; + _this.aoMap = null; + _this.aoMapIntensity = 1.0; + _this.emissive = new Color(0x000000); + _this.emissiveIntensity = 1.0; + _this.emissiveMap = null; + _this.bumpMap = null; + _this.bumpScale = 1; + _this.normalMap = null; + _this.normalMapType = TangentSpaceNormalMap; + _this.normalScale = new Vector2(1, 1); + _this.displacementMap = null; + _this.displacementScale = 1; + _this.displacementBias = 0; + _this.specularMap = null; + _this.alphaMap = null; + _this.envMap = null; + _this.combine = MultiplyOperation; + _this.reflectivity = 1; + _this.refractionRatio = 0.98; + _this.wireframe = false; + _this.wireframeLinewidth = 1; + _this.wireframeLinecap = 'round'; + _this.wireframeLinejoin = 'round'; + _this.skinning = false; + _this.morphTargets = false; + _this.morphNormals = false; + _this.flatShading = false; + + _this.setValues(parameters); + + return _this; + } + + var _proto = MeshPhongMaterial.prototype; + + _proto.copy = function copy(source) { + _Material.prototype.copy.call(this, source); - copy(source) { - super.copy(source); this.color.copy(source.color); this.specular.copy(source.specular); this.shininess = source.shininess; @@ -22854,9 +24329,10 @@ this.morphNormals = source.morphNormals; this.flatShading = source.flatShading; return this; - } + }; - } + return MeshPhongMaterial; + }(Material); MeshPhongMaterial.prototype.isMeshPhongMaterial = true; @@ -22899,44 +24375,54 @@ * } */ - class MeshToonMaterial extends Material { - constructor(parameters) { - super(); - this.defines = { + var MeshToonMaterial = /*#__PURE__*/function (_Material) { + _inheritsLoose(MeshToonMaterial, _Material); + + function MeshToonMaterial(parameters) { + var _this; + + _this = _Material.call(this) || this; + _this.defines = { 'TOON': '' }; - this.type = 'MeshToonMaterial'; - this.color = new Color(0xffffff); - this.map = null; - this.gradientMap = null; - this.lightMap = null; - this.lightMapIntensity = 1.0; - this.aoMap = null; - this.aoMapIntensity = 1.0; - this.emissive = new Color(0x000000); - this.emissiveIntensity = 1.0; - this.emissiveMap = null; - this.bumpMap = null; - this.bumpScale = 1; - this.normalMap = null; - this.normalMapType = TangentSpaceNormalMap; - this.normalScale = new Vector2(1, 1); - this.displacementMap = null; - this.displacementScale = 1; - this.displacementBias = 0; - this.alphaMap = null; - this.wireframe = false; - this.wireframeLinewidth = 1; - this.wireframeLinecap = 'round'; - this.wireframeLinejoin = 'round'; - this.skinning = false; - this.morphTargets = false; - this.morphNormals = false; - this.setValues(parameters); - } + _this.type = 'MeshToonMaterial'; + _this.color = new Color(0xffffff); + _this.map = null; + _this.gradientMap = null; + _this.lightMap = null; + _this.lightMapIntensity = 1.0; + _this.aoMap = null; + _this.aoMapIntensity = 1.0; + _this.emissive = new Color(0x000000); + _this.emissiveIntensity = 1.0; + _this.emissiveMap = null; + _this.bumpMap = null; + _this.bumpScale = 1; + _this.normalMap = null; + _this.normalMapType = TangentSpaceNormalMap; + _this.normalScale = new Vector2(1, 1); + _this.displacementMap = null; + _this.displacementScale = 1; + _this.displacementBias = 0; + _this.alphaMap = null; + _this.wireframe = false; + _this.wireframeLinewidth = 1; + _this.wireframeLinecap = 'round'; + _this.wireframeLinejoin = 'round'; + _this.skinning = false; + _this.morphTargets = false; + _this.morphNormals = false; + + _this.setValues(parameters); + + return _this; + } + + var _proto = MeshToonMaterial.prototype; + + _proto.copy = function copy(source) { + _Material.prototype.copy.call(this, source); - copy(source) { - super.copy(source); this.color.copy(source.color); this.map = source.map; this.gradientMap = source.gradientMap; @@ -22964,9 +24450,10 @@ this.morphTargets = source.morphTargets; this.morphNormals = source.morphNormals; return this; - } + }; - } + return MeshToonMaterial; + }(Material); MeshToonMaterial.prototype.isMeshToonMaterial = true; @@ -22996,30 +24483,40 @@ * } */ - class MeshNormalMaterial extends Material { - constructor(parameters) { - super(); - this.type = 'MeshNormalMaterial'; - this.bumpMap = null; - this.bumpScale = 1; - this.normalMap = null; - this.normalMapType = TangentSpaceNormalMap; - this.normalScale = new Vector2(1, 1); - this.displacementMap = null; - this.displacementScale = 1; - this.displacementBias = 0; - this.wireframe = false; - this.wireframeLinewidth = 1; - this.fog = false; - this.skinning = false; - this.morphTargets = false; - this.morphNormals = false; - this.flatShading = false; - this.setValues(parameters); + var MeshNormalMaterial = /*#__PURE__*/function (_Material) { + _inheritsLoose(MeshNormalMaterial, _Material); + + function MeshNormalMaterial(parameters) { + var _this; + + _this = _Material.call(this) || this; + _this.type = 'MeshNormalMaterial'; + _this.bumpMap = null; + _this.bumpScale = 1; + _this.normalMap = null; + _this.normalMapType = TangentSpaceNormalMap; + _this.normalScale = new Vector2(1, 1); + _this.displacementMap = null; + _this.displacementScale = 1; + _this.displacementBias = 0; + _this.wireframe = false; + _this.wireframeLinewidth = 1; + _this.fog = false; + _this.skinning = false; + _this.morphTargets = false; + _this.morphNormals = false; + _this.flatShading = false; + + _this.setValues(parameters); + + return _this; } - copy(source) { - super.copy(source); + var _proto = MeshNormalMaterial.prototype; + + _proto.copy = function copy(source) { + _Material.prototype.copy.call(this, source); + this.bumpMap = source.bumpMap; this.bumpScale = source.bumpScale; this.normalMap = source.normalMap; @@ -23035,9 +24532,10 @@ this.morphNormals = source.morphNormals; this.flatShading = source.flatShading; return this; - } + }; - } + return MeshNormalMaterial; + }(Material); MeshNormalMaterial.prototype.isMeshNormalMaterial = true; @@ -23076,38 +24574,48 @@ * } */ - class MeshLambertMaterial extends Material { - constructor(parameters) { - super(); - this.type = 'MeshLambertMaterial'; - this.color = new Color(0xffffff); // diffuse + var MeshLambertMaterial = /*#__PURE__*/function (_Material) { + _inheritsLoose(MeshLambertMaterial, _Material); - this.map = null; - this.lightMap = null; - this.lightMapIntensity = 1.0; - this.aoMap = null; - this.aoMapIntensity = 1.0; - this.emissive = new Color(0x000000); - this.emissiveIntensity = 1.0; - this.emissiveMap = null; - this.specularMap = null; - this.alphaMap = null; - this.envMap = null; - this.combine = MultiplyOperation; - this.reflectivity = 1; - this.refractionRatio = 0.98; - this.wireframe = false; - this.wireframeLinewidth = 1; - this.wireframeLinecap = 'round'; - this.wireframeLinejoin = 'round'; - this.skinning = false; - this.morphTargets = false; - this.morphNormals = false; - this.setValues(parameters); + function MeshLambertMaterial(parameters) { + var _this; + + _this = _Material.call(this) || this; + _this.type = 'MeshLambertMaterial'; + _this.color = new Color(0xffffff); // diffuse + + _this.map = null; + _this.lightMap = null; + _this.lightMapIntensity = 1.0; + _this.aoMap = null; + _this.aoMapIntensity = 1.0; + _this.emissive = new Color(0x000000); + _this.emissiveIntensity = 1.0; + _this.emissiveMap = null; + _this.specularMap = null; + _this.alphaMap = null; + _this.envMap = null; + _this.combine = MultiplyOperation; + _this.reflectivity = 1; + _this.refractionRatio = 0.98; + _this.wireframe = false; + _this.wireframeLinewidth = 1; + _this.wireframeLinecap = 'round'; + _this.wireframeLinejoin = 'round'; + _this.skinning = false; + _this.morphTargets = false; + _this.morphNormals = false; + + _this.setValues(parameters); + + return _this; } - copy(source) { - super.copy(source); + var _proto = MeshLambertMaterial.prototype; + + _proto.copy = function copy(source) { + _Material.prototype.copy.call(this, source); + this.color.copy(source.color); this.map = source.map; this.lightMap = source.lightMap; @@ -23131,9 +24639,10 @@ this.morphTargets = source.morphTargets; this.morphNormals = source.morphNormals; return this; - } + }; - } + return MeshLambertMaterial; + }(Material); MeshLambertMaterial.prototype.isMeshLambertMaterial = true; @@ -23167,35 +24676,45 @@ * } */ - class MeshMatcapMaterial extends Material { - constructor(parameters) { - super(); - this.defines = { + var MeshMatcapMaterial = /*#__PURE__*/function (_Material) { + _inheritsLoose(MeshMatcapMaterial, _Material); + + function MeshMatcapMaterial(parameters) { + var _this; + + _this = _Material.call(this) || this; + _this.defines = { 'MATCAP': '' }; - this.type = 'MeshMatcapMaterial'; - this.color = new Color(0xffffff); // diffuse + _this.type = 'MeshMatcapMaterial'; + _this.color = new Color(0xffffff); // diffuse - this.matcap = null; - this.map = null; - this.bumpMap = null; - this.bumpScale = 1; - this.normalMap = null; - this.normalMapType = TangentSpaceNormalMap; - this.normalScale = new Vector2(1, 1); - this.displacementMap = null; - this.displacementScale = 1; - this.displacementBias = 0; - this.alphaMap = null; - this.skinning = false; - this.morphTargets = false; - this.morphNormals = false; - this.flatShading = false; - this.setValues(parameters); + _this.matcap = null; + _this.map = null; + _this.bumpMap = null; + _this.bumpScale = 1; + _this.normalMap = null; + _this.normalMapType = TangentSpaceNormalMap; + _this.normalScale = new Vector2(1, 1); + _this.displacementMap = null; + _this.displacementScale = 1; + _this.displacementBias = 0; + _this.alphaMap = null; + _this.skinning = false; + _this.morphTargets = false; + _this.morphNormals = false; + _this.flatShading = false; + + _this.setValues(parameters); + + return _this; } - copy(source) { - super.copy(source); + var _proto = MeshMatcapMaterial.prototype; + + _proto.copy = function copy(source) { + _Material.prototype.copy.call(this, source); + this.defines = { 'MATCAP': '' }; @@ -23216,9 +24735,10 @@ this.morphNormals = source.morphNormals; this.flatShading = source.flatShading; return this; - } + }; - } + return MeshMatcapMaterial; + }(Material); MeshMatcapMaterial.prototype.isMeshMatcapMaterial = true; @@ -23235,25 +24755,36 @@ * } */ - class LineDashedMaterial extends LineBasicMaterial { - constructor(parameters) { - super(); - this.type = 'LineDashedMaterial'; - this.scale = 1; - this.dashSize = 3; - this.gapSize = 1; - this.setValues(parameters); + var LineDashedMaterial = /*#__PURE__*/function (_LineBasicMaterial) { + _inheritsLoose(LineDashedMaterial, _LineBasicMaterial); + + function LineDashedMaterial(parameters) { + var _this; + + _this = _LineBasicMaterial.call(this) || this; + _this.type = 'LineDashedMaterial'; + _this.scale = 1; + _this.dashSize = 3; + _this.gapSize = 1; + + _this.setValues(parameters); + + return _this; } - copy(source) { - super.copy(source); + var _proto = LineDashedMaterial.prototype; + + _proto.copy = function copy(source) { + _LineBasicMaterial.prototype.copy.call(this, source); + this.scale = source.scale; this.dashSize = source.dashSize; this.gapSize = source.gapSize; return this; - } + }; - } + return LineDashedMaterial; + }(LineBasicMaterial); LineDashedMaterial.prototype.isLineDashedMaterial = true; @@ -23279,9 +24810,9 @@ Material: Material }); - const AnimationUtils = { + var AnimationUtils = { // same as Array.prototype.slice, but also works on typed arrays - arraySlice: function (array, from, to) { + arraySlice: function arraySlice(array, from, to) { if (AnimationUtils.isTypedArray(array)) { // in ios9 array.subarray(from, undefined) will return empty array // but array.subarray(from) or array.subarray(from, len) is correct @@ -23291,7 +24822,7 @@ return array.slice(from, to); }, // converts an array to a specific type - convertArray: function (array, type, forceClone) { + convertArray: function convertArray(array, type, forceClone) { if (!array || // let 'undefined' and 'null' pass !forceClone && array.constructor === type) return array; @@ -23301,32 +24832,34 @@ return Array.prototype.slice.call(array); // create Array }, - isTypedArray: function (object) { + isTypedArray: function isTypedArray(object) { return ArrayBuffer.isView(object) && !(object instanceof DataView); }, // returns an array by which times and values can be sorted - getKeyframeOrder: function (times) { + getKeyframeOrder: function getKeyframeOrder(times) { function compareTime(i, j) { return times[i] - times[j]; } - const n = times.length; - const result = new Array(n); + var n = times.length; + var result = new Array(n); - for (let i = 0; i !== n; ++i) result[i] = i; + for (var i = 0; i !== n; ++i) { + result[i] = i; + } result.sort(compareTime); return result; }, // uses the array previously returned by 'getKeyframeOrder' to sort data - sortedArray: function (values, stride, order) { - const nValues = values.length; - const result = new values.constructor(nValues); + sortedArray: function sortedArray(values, stride, order) { + var nValues = values.length; + var result = new values.constructor(nValues); - for (let i = 0, dstOffset = 0; dstOffset !== nValues; ++i) { - const srcOffset = order[i] * stride; + for (var i = 0, dstOffset = 0; dstOffset !== nValues; ++i) { + var srcOffset = order[i] * stride; - for (let j = 0; j !== stride; ++j) { + for (var j = 0; j !== stride; ++j) { result[dstOffset++] = values[srcOffset + j]; } } @@ -23334,8 +24867,8 @@ return result; }, // function for parsing AOS keyframe formats - flattenJSON: function (jsonKeys, times, values, valuePropertyName) { - let i = 1, + flattenJSON: function flattenJSON(jsonKeys, times, values, valuePropertyName) { + var i = 1, key = jsonKeys[0]; while (key !== undefined && key[valuePropertyName] === undefined) { @@ -23344,7 +24877,7 @@ if (key === undefined) return; // no data - let value = key[valuePropertyName]; + var value = key[valuePropertyName]; if (value === undefined) return; // no data if (Array.isArray(value)) { @@ -23384,23 +24917,27 @@ } while (key !== undefined); } }, - subclip: function (sourceClip, name, startFrame, endFrame, fps = 30) { - const clip = sourceClip.clone(); + subclip: function subclip(sourceClip, name, startFrame, endFrame, fps) { + if (fps === void 0) { + fps = 30; + } + + var clip = sourceClip.clone(); clip.name = name; - const tracks = []; + var tracks = []; - for (let i = 0; i < clip.tracks.length; ++i) { - const track = clip.tracks[i]; - const valueSize = track.getValueSize(); - const times = []; - const values = []; + for (var i = 0; i < clip.tracks.length; ++i) { + var track = clip.tracks[i]; + var valueSize = track.getValueSize(); + var times = []; + var values = []; - for (let j = 0; j < track.times.length; ++j) { - const frame = track.times[j] * fps; + for (var j = 0; j < track.times.length; ++j) { + var frame = track.times[j] * fps; if (frame < startFrame || frame >= endFrame) continue; times.push(track.times[j]); - for (let k = 0; k < valueSize; ++k) { + for (var k = 0; k < valueSize; ++k) { values.push(track.values[j * valueSize + k]); } } @@ -23413,96 +24950,118 @@ clip.tracks = tracks; // find minimum .times value across all tracks in the trimmed clip - let minStartTime = Infinity; + var minStartTime = Infinity; - for (let i = 0; i < clip.tracks.length; ++i) { - if (minStartTime > clip.tracks[i].times[0]) { - minStartTime = clip.tracks[i].times[0]; + for (var _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 - for (let i = 0; i < clip.tracks.length; ++i) { - clip.tracks[i].shift(-1 * minStartTime); + for (var _i2 = 0; _i2 < clip.tracks.length; ++_i2) { + clip.tracks[_i2].shift(-1 * minStartTime); } clip.resetDuration(); return clip; }, - makeClipAdditive: function (targetClip, referenceFrame = 0, referenceClip = targetClip, fps = 30) { + makeClipAdditive: function makeClipAdditive(targetClip, referenceFrame, referenceClip, fps) { + if (referenceFrame === void 0) { + referenceFrame = 0; + } + + if (referenceClip === void 0) { + referenceClip = targetClip; + } + + if (fps === void 0) { + 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 + var numTracks = referenceClip.tracks.length; + var 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 + var _loop = function _loop(i) { + var referenceTrack = referenceClip.tracks[i]; + var referenceTrackType = referenceTrack.ValueTypeName; // 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 + if (referenceTrackType === 'bool' || referenceTrackType === 'string') return "continue"; // Find the track in the target clip whose name and type matches the reference track - const targetTrack = targetClip.tracks.find(function (track) { + var 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 (targetTrack === undefined) return "continue"; + var referenceOffset = 0; + var referenceValueSize = referenceTrack.getValueSize(); if (referenceTrack.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline) { referenceOffset = referenceValueSize / 3; } - let targetOffset = 0; - const targetValueSize = targetTrack.getValueSize(); + var targetOffset = 0; + var 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 + var lastIndex = referenceTrack.times.length - 1; + var referenceValue = void 0; // 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; - const endIndex = referenceValueSize - referenceOffset; + var startIndex = referenceOffset; + var endIndex = referenceValueSize - referenceOffset; referenceValue = AnimationUtils.arraySlice(referenceTrack.values, startIndex, endIndex); } else if (referenceTime >= referenceTrack.times[lastIndex]) { // Reference frame is after the last keyframe, so just use the last keyframe - const startIndex = lastIndex * referenceValueSize + referenceOffset; - const endIndex = startIndex + referenceValueSize - referenceOffset; - referenceValue = AnimationUtils.arraySlice(referenceTrack.values, startIndex, endIndex); + var _startIndex = lastIndex * referenceValueSize + referenceOffset; + + var _endIndex = _startIndex + referenceValueSize - referenceOffset; + + referenceValue = AnimationUtils.arraySlice(referenceTrack.values, _startIndex, _endIndex); } else { // Interpolate to the reference value - const interpolant = referenceTrack.createInterpolant(); - const startIndex = referenceOffset; - const endIndex = referenceValueSize - referenceOffset; + var interpolant = referenceTrack.createInterpolant(); + var _startIndex2 = referenceOffset; + + var _endIndex2 = referenceValueSize - referenceOffset; + interpolant.evaluate(referenceTime); - referenceValue = AnimationUtils.arraySlice(interpolant.resultBuffer, startIndex, endIndex); + referenceValue = AnimationUtils.arraySlice(interpolant.resultBuffer, _startIndex2, _endIndex2); } // Conjugate the quaternion if (referenceTrackType === 'quaternion') { - const referenceQuat = new Quaternion().fromArray(referenceValue).normalize().conjugate(); + var referenceQuat = new Quaternion().fromArray(referenceValue).normalize().conjugate(); referenceQuat.toArray(referenceValue); } // Subtract the reference value from all of the track values - const numTimes = targetTrack.times.length; + var numTimes = targetTrack.times.length; - for (let j = 0; j < numTimes; ++j) { - const valueStart = j * targetValueSize + targetOffset; + for (var j = 0; j < numTimes; ++j) { + var 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 + var valueEnd = targetValueSize - targetOffset * 2; // Subtract each value for all other numeric track types - for (let k = 0; k < valueEnd; ++k) { + for (var k = 0; k < valueEnd; ++k) { targetTrack.values[valueStart + k] -= referenceValue[k]; } } } + }; + + for (var i = 0; i < numTracks; ++i) { + var _ret = _loop(i); + + if (_ret === "continue") continue; } targetClip.blendMode = AdditiveAnimationBlendMode; @@ -23539,15 +25098,15 @@ } Object.assign(Interpolant.prototype, { - evaluate: function (t) { - const pp = this.parameterPositions; - let i1 = this._cachedIndex, + evaluate: function evaluate(t) { + var pp = this.parameterPositions; + var i1 = this._cachedIndex, t1 = pp[i1], t0 = pp[i1 - 1]; validate_interval: { seek: { - let right; + var right; linear_scan: { //- See http://jsperf.com/comparison-to-undefined/3 @@ -23555,7 +25114,7 @@ //- //- if ( t >= t1 || t1 === undefined ) { forward_scan: if (!(t < t1)) { - for (let giveUpAt = i1 + 2;;) { + for (var giveUpAt = i1 + 2;;) { if (t1 === undefined) { if (t < t0) break forward_scan; // after end @@ -23584,7 +25143,7 @@ if (!(t >= t0)) { // looping? - const t1global = pp[1]; + var t1global = pp[1]; if (t < t1global) { i1 = 2; // + 1, using the scan for the details @@ -23593,14 +25152,14 @@ } // linear reverse scan - for (let giveUpAt = i1 - 2;;) { + for (var _giveUpAt = i1 - 2;;) { if (t0 === undefined) { // before start this._cachedIndex = 0; return this.beforeStart_(0, t, t1); } - if (i1 === giveUpAt) break; // this loop + if (i1 === _giveUpAt) break; // this loop t1 = t0; t0 = pp[--i1 - 1]; @@ -23624,7 +25183,7 @@ while (i1 < right) { - const mid = i1 + right >>> 1; + var mid = i1 + right >>> 1; if (t < pp[mid]) { right = mid; @@ -23661,29 +25220,29 @@ // Note: The indirection allows central control of many interpolants. // --- Protected interface DefaultSettings_: {}, - getSettings_: function () { + getSettings_: function getSettings_() { return this.settings || this.DefaultSettings_; }, - copySampleValue_: function (index) { + copySampleValue_: function copySampleValue_(index) { // copies a sample value to the result buffer - const result = this.resultBuffer, - values = this.sampleValues, - stride = this.valueSize, - offset = index * stride; + var result = this.resultBuffer, + values = this.sampleValues, + stride = this.valueSize, + offset = index * stride; - for (let i = 0; i !== stride; ++i) { + for (var i = 0; i !== stride; ++i) { result[i] = values[offset + i]; } return result; }, // Template methods for derived classes: - interpolate_: function () + interpolate_: function interpolate_() /* i1, t0, t, t1 */ { throw new Error('call to abstract method'); // implementations shall return this.resultBuffer }, - intervalChanged_: function () + intervalChanged_: function intervalChanged_() /* i1, t0, t1 */ {// empty } @@ -23718,9 +25277,9 @@ endingStart: ZeroCurvatureEnding, endingEnd: ZeroCurvatureEnding }, - intervalChanged_: function (i1, t0, t1) { - const pp = this.parameterPositions; - let iPrev = i1 - 2, + intervalChanged_: function intervalChanged_(i1, t0, t1) { + var pp = this.parameterPositions; + var iPrev = i1 - 2, iNext = i1 + 1, tPrev = pp[iPrev], tNext = pp[iNext]; @@ -23769,33 +25328,33 @@ } } - const halfDt = (t1 - t0) * 0.5, - stride = this.valueSize; + var halfDt = (t1 - t0) * 0.5, + stride = this.valueSize; this._weightPrev = halfDt / (t0 - tPrev); this._weightNext = halfDt / (tNext - t1); this._offsetPrev = iPrev * stride; this._offsetNext = iNext * stride; }, - interpolate_: function (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 - - 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 - - for (let i = 0; i !== stride; ++i) { + interpolate_: function interpolate_(i1, t0, t, t1) { + var 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 + + var sP = -wP * ppp + 2 * wP * pp - wP * p; + var s0 = (1 + wP) * ppp + (-1.5 - 2 * wP) * pp + (-0.5 + wP) * p + 1; + var s1 = (-1 - wN) * ppp + (1.5 + wN) * pp + 0.5 * p; + var sN = wN * ppp - wN * pp; // combine data linearly + + for (var i = 0; i !== stride; ++i) { result[i] = sP * values[oP + i] + s0 * values[o0 + i] + s1 * values[o1 + i] + sN * values[oN + i]; } @@ -23809,16 +25368,16 @@ LinearInterpolant.prototype = Object.assign(Object.create(Interpolant.prototype), { constructor: LinearInterpolant, - interpolate_: function (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; - - for (let i = 0; i !== stride; ++i) { + interpolate_: function interpolate_(i1, t0, t, t1) { + var result = this.resultBuffer, + values = this.sampleValues, + stride = this.valueSize, + offset1 = i1 * stride, + offset0 = offset1 - stride, + weight1 = (t - t0) / (t1 - t0), + weight0 = 1 - weight1; + + for (var i = 0; i !== stride; ++i) { result[i] = values[offset0 + i] * weight0 + values[offset1 + i] * weight1; } @@ -23838,15 +25397,15 @@ DiscreteInterpolant.prototype = Object.assign(Object.create(Interpolant.prototype), { constructor: DiscreteInterpolant, - interpolate_: function (i1 + interpolate_: function interpolate_(i1 /*, t0, t, t1 */ ) { return this.copySampleValue_(i1 - 1); } }); - class KeyframeTrack { - constructor(name, times, values, interpolation) { + var KeyframeTrack = /*#__PURE__*/function () { + function KeyframeTrack(name, times, values, interpolation) { if (name === undefined) throw new Error('THREE.KeyframeTrack: track name is undefined'); if (times === undefined || times.length === 0) throw new Error('THREE.KeyframeTrack: no keyframes in track named ' + name); this.name = name; @@ -23857,9 +25416,9 @@ // and automatic invocation of .toJSON): - static toJSON(track) { - const trackType = track.constructor; - let json; // derived classes can define a static toJSON method + KeyframeTrack.toJSON = function toJSON(track) { + var trackType = track.constructor; + var json; // derived classes can define a static toJSON method if (trackType.toJSON !== this.toJSON) { json = trackType.toJSON(track); @@ -23870,7 +25429,7 @@ 'times': AnimationUtils.convertArray(track.times, Array), 'values': AnimationUtils.convertArray(track.values, Array) }; - const interpolation = track.getInterpolation(); + var interpolation = track.getInterpolation(); if (interpolation !== track.DefaultInterpolation) { json.interpolation = interpolation; @@ -23880,22 +25439,24 @@ json.type = track.ValueTypeName; // mandatory return json; - } + }; - InterpolantFactoryMethodDiscrete(result) { + var _proto = KeyframeTrack.prototype; + + _proto.InterpolantFactoryMethodDiscrete = function InterpolantFactoryMethodDiscrete(result) { return new DiscreteInterpolant(this.times, this.values, this.getValueSize(), result); - } + }; - InterpolantFactoryMethodLinear(result) { + _proto.InterpolantFactoryMethodLinear = function InterpolantFactoryMethodLinear(result) { return new LinearInterpolant(this.times, this.values, this.getValueSize(), result); - } + }; - InterpolantFactoryMethodSmooth(result) { + _proto.InterpolantFactoryMethodSmooth = function InterpolantFactoryMethodSmooth(result) { return new CubicInterpolant(this.times, this.values, this.getValueSize(), result); - } + }; - setInterpolation(interpolation) { - let factoryMethod; + _proto.setInterpolation = function setInterpolation(interpolation) { + var factoryMethod; switch (interpolation) { case InterpolateDiscrete: @@ -23912,7 +25473,7 @@ } if (factoryMethod === undefined) { - const message = 'unsupported interpolation for ' + this.ValueTypeName + ' keyframe track named ' + this.name; + var 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 @@ -23929,9 +25490,9 @@ this.createInterpolant = factoryMethod; return this; - } + }; - getInterpolation() { + _proto.getInterpolation = function getInterpolation() { switch (this.createInterpolant) { case this.InterpolantFactoryMethodDiscrete: return InterpolateDiscrete; @@ -23942,31 +25503,31 @@ case this.InterpolantFactoryMethodSmooth: return InterpolateSmooth; } - } + }; - getValueSize() { + _proto.getValueSize = function getValueSize() { return this.values.length / this.times.length; } // move all keyframes either forwards or backwards in time + ; - - shift(timeOffset) { + _proto.shift = function shift(timeOffset) { if (timeOffset !== 0.0) { - const times = this.times; + var times = this.times; - for (let i = 0, n = times.length; i !== n; ++i) { + for (var 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(timeScale) { + _proto.scale = function scale(timeScale) { if (timeScale !== 1.0) { - const times = this.times; + var times = this.times; - for (let i = 0, n = times.length; i !== n; ++i) { + for (var i = 0, n = times.length; i !== n; ++i) { times[i] *= timeScale; } } @@ -23974,12 +25535,12 @@ 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 + ; - - trim(startTime, endTime) { - const times = this.times, - nKeys = times.length; - let from = 0, + _proto.trim = function trim(startTime, endTime) { + var times = this.times, + nKeys = times.length; + var from = 0, to = nKeys - 1; while (from !== nKeys && times[from] < startTime) { @@ -23999,37 +25560,37 @@ from = to - 1; } - const stride = this.getValueSize(); + var 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 + ; - - validate() { - let valid = true; - const valueSize = this.getValueSize(); + _proto.validate = function validate() { + var valid = true; + var 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; + var times = this.times, + values = this.values, + nKeys = times.length; if (nKeys === 0) { console.error('THREE.KeyframeTrack: Track is empty.', this); valid = false; } - let prevTime = null; + var prevTime = null; - for (let i = 0; i !== nKeys; i++) { - const currTime = times[i]; + for (var i = 0; i !== nKeys; i++) { + var currTime = times[i]; if (typeof currTime === 'number' && isNaN(currTime)) { console.error('THREE.KeyframeTrack: Time is not a valid number.', this, i, currTime); @@ -24048,11 +25609,11 @@ if (values !== undefined) { if (AnimationUtils.isTypedArray(values)) { - for (let i = 0, n = values.length; i !== n; ++i) { - const value = values[i]; + for (var _i = 0, n = values.length; _i !== n; ++_i) { + var value = values[_i]; if (isNaN(value)) { - console.error('THREE.KeyframeTrack: Value is not a valid number.', this, i, value); + console.error('THREE.KeyframeTrack: Value is not a valid number.', this, _i, value); valid = false; break; } @@ -24063,31 +25624,31 @@ 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) + ; - - optimize() { + _proto.optimize = function 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; - 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 + var times = AnimationUtils.arraySlice(this.times), + values = AnimationUtils.arraySlice(this.values), + stride = this.getValueSize(), + smoothInterpolation = this.getInterpolation() === InterpolateSmooth, + lastIndex = times.length - 1; + var writeIndex = 1; + + for (var i = 1; i < lastIndex; ++i) { + var keep = false; + var time = times[i]; + var 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; + var offset = i * stride, + offsetP = offset - stride, + offsetN = offset + stride; - for (let j = 0; j !== stride; ++j) { - const value = values[offset + j]; + for (var j = 0; j !== stride; ++j) { + var value = values[offset + j]; if (value !== values[offsetP + j] || value !== values[offsetN + j]) { keep = true; @@ -24103,11 +25664,11 @@ if (keep) { if (i !== writeIndex) { times[writeIndex] = times[i]; - const readOffset = i * stride, - writeOffset = writeIndex * stride; + var readOffset = i * stride, + writeOffset = writeIndex * stride; - for (let j = 0; j !== stride; ++j) { - values[writeOffset + j] = values[readOffset + j]; + for (var _j = 0; _j !== stride; ++_j) { + values[writeOffset + _j] = values[readOffset + _j]; } } @@ -24119,8 +25680,8 @@ 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]; + for (var _readOffset = lastIndex * stride, _writeOffset = writeIndex * stride, _j2 = 0; _j2 !== stride; ++_j2) { + values[_writeOffset + _j2] = values[_readOffset + _j2]; } ++writeIndex; @@ -24135,19 +25696,20 @@ } 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. + _proto.clone = function clone() { + var times = AnimationUtils.arraySlice(this.times, 0); + var values = AnimationUtils.arraySlice(this.values, 0); + var TypedKeyframeTrack = this.constructor; + var 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; - } + }; - } + return KeyframeTrack; + }(); KeyframeTrack.prototype.TimeBufferType = Float32Array; KeyframeTrack.prototype.ValueBufferType = Float32Array; @@ -24157,7 +25719,15 @@ * A Track of Boolean keyframe values. */ - class BooleanKeyframeTrack extends KeyframeTrack {} + var BooleanKeyframeTrack = /*#__PURE__*/function (_KeyframeTrack) { + _inheritsLoose(BooleanKeyframeTrack, _KeyframeTrack); + + function BooleanKeyframeTrack() { + return _KeyframeTrack.apply(this, arguments) || this; + } + + return BooleanKeyframeTrack; + }(KeyframeTrack); BooleanKeyframeTrack.prototype.ValueTypeName = 'bool'; BooleanKeyframeTrack.prototype.ValueBufferType = Array; @@ -24169,7 +25739,15 @@ * A Track of keyframe values that represent color. */ - class ColorKeyframeTrack extends KeyframeTrack {} + var ColorKeyframeTrack = /*#__PURE__*/function (_KeyframeTrack) { + _inheritsLoose(ColorKeyframeTrack, _KeyframeTrack); + + function ColorKeyframeTrack() { + return _KeyframeTrack.apply(this, arguments) || this; + } + + return ColorKeyframeTrack; + }(KeyframeTrack); ColorKeyframeTrack.prototype.ValueTypeName = 'color'; // ValueBufferType is inherited @@ -24177,7 +25755,15 @@ * A Track of numeric keyframe values. */ - class NumberKeyframeTrack extends KeyframeTrack {} + var NumberKeyframeTrack = /*#__PURE__*/function (_KeyframeTrack) { + _inheritsLoose(NumberKeyframeTrack, _KeyframeTrack); + + function NumberKeyframeTrack() { + return _KeyframeTrack.apply(this, arguments) || this; + } + + return NumberKeyframeTrack; + }(KeyframeTrack); NumberKeyframeTrack.prototype.ValueTypeName = 'number'; // ValueBufferType is inherited @@ -24191,14 +25777,14 @@ QuaternionLinearInterpolant.prototype = Object.assign(Object.create(Interpolant.prototype), { constructor: QuaternionLinearInterpolant, - interpolate_: function (i1, t0, t, t1) { - const result = this.resultBuffer, - values = this.sampleValues, - stride = this.valueSize, - alpha = (t - t0) / (t1 - t0); - let offset = i1 * stride; - - for (let end = offset + stride; offset !== end; offset += 4) { + interpolate_: function interpolate_(i1, t0, t, t1) { + var result = this.resultBuffer, + values = this.sampleValues, + stride = this.valueSize, + alpha = (t - t0) / (t1 - t0); + var offset = i1 * stride; + + for (var end = offset + stride; offset !== end; offset += 4) { Quaternion.slerpFlat(result, 0, values, offset - stride, values, offset, alpha); } @@ -24210,12 +25796,21 @@ * A Track of quaternion keyframe values. */ - class QuaternionKeyframeTrack extends KeyframeTrack { - InterpolantFactoryMethodLinear(result) { - return new QuaternionLinearInterpolant(this.times, this.values, this.getValueSize(), result); + var QuaternionKeyframeTrack = /*#__PURE__*/function (_KeyframeTrack) { + _inheritsLoose(QuaternionKeyframeTrack, _KeyframeTrack); + + function QuaternionKeyframeTrack() { + return _KeyframeTrack.apply(this, arguments) || this; } - } + var _proto = QuaternionKeyframeTrack.prototype; + + _proto.InterpolantFactoryMethodLinear = function InterpolantFactoryMethodLinear(result) { + return new QuaternionLinearInterpolant(this.times, this.values, this.getValueSize(), result); + }; + + return QuaternionKeyframeTrack; + }(KeyframeTrack); QuaternionKeyframeTrack.prototype.ValueTypeName = 'quaternion'; // ValueBufferType is inherited @@ -24226,7 +25821,15 @@ * A Track that interpolates Strings */ - class StringKeyframeTrack extends KeyframeTrack {} + var StringKeyframeTrack = /*#__PURE__*/function (_KeyframeTrack) { + _inheritsLoose(StringKeyframeTrack, _KeyframeTrack); + + function StringKeyframeTrack() { + return _KeyframeTrack.apply(this, arguments) || this; + } + + return StringKeyframeTrack; + }(KeyframeTrack); StringKeyframeTrack.prototype.ValueTypeName = 'string'; StringKeyframeTrack.prototype.ValueBufferType = Array; @@ -24238,12 +25841,28 @@ * A Track of vectored keyframe values. */ - class VectorKeyframeTrack extends KeyframeTrack {} + var VectorKeyframeTrack = /*#__PURE__*/function (_KeyframeTrack) { + _inheritsLoose(VectorKeyframeTrack, _KeyframeTrack); + + function VectorKeyframeTrack() { + return _KeyframeTrack.apply(this, arguments) || this; + } + + return VectorKeyframeTrack; + }(KeyframeTrack); VectorKeyframeTrack.prototype.ValueTypeName = 'vector'; // ValueBufferType is inherited - class AnimationClip { - constructor(name, duration = -1, tracks, blendMode = NormalAnimationBlendMode) { + var AnimationClip = /*#__PURE__*/function () { + function AnimationClip(name, duration, tracks, blendMode) { + if (duration === void 0) { + duration = -1; + } + + if (blendMode === void 0) { + blendMode = NormalAnimationBlendMode; + } + this.name = name; this.tracks = tracks; this.duration = duration; @@ -24255,24 +25874,24 @@ } } - static parse(json) { - const tracks = [], - jsonTracks = json.tracks, - frameTime = 1.0 / (json.fps || 1.0); + AnimationClip.parse = function parse(json) { + var tracks = [], + jsonTracks = json.tracks, + frameTime = 1.0 / (json.fps || 1.0); - for (let i = 0, n = jsonTracks.length; i !== n; ++i) { + for (var 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); + var clip = new this(json.name, json.duration, tracks, json.blendMode); clip.uuid = json.uuid; return clip; - } + }; - static toJSON(clip) { - const tracks = [], - clipTracks = clip.tracks; - const json = { + AnimationClip.toJSON = function toJSON(clip) { + var tracks = [], + clipTracks = clip.tracks; + var json = { 'name': clip.name, 'duration': clip.duration, 'tracks': tracks, @@ -24280,23 +25899,23 @@ 'blendMode': clip.blendMode }; - for (let i = 0, n = clipTracks.length; i !== n; ++i) { + for (var 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 = []; + AnimationClip.CreateFromMorphTargetSequence = function CreateFromMorphTargetSequence(name, morphTargetSequence, fps, noLoop) { + var numMorphTargets = morphTargetSequence.length; + var tracks = []; - for (let i = 0; i < numMorphTargets; i++) { - let times = []; - let values = []; + for (var i = 0; i < numMorphTargets; i++) { + var times = []; + var values = []; times.push((i + numMorphTargets - 1) % numMorphTargets, i, (i + 1) % numMorphTargets); values.push(0, 1, 0); - const order = AnimationUtils.getKeyframeOrder(times); + var 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. @@ -24310,39 +25929,39 @@ } return new this(name, -1, tracks); - } + }; - static findByName(objectOrClipArray, name) { - let clipArray = objectOrClipArray; + AnimationClip.findByName = function findByName(objectOrClipArray, name) { + var clipArray = objectOrClipArray; if (!Array.isArray(objectOrClipArray)) { - const o = objectOrClipArray; + var o = objectOrClipArray; clipArray = o.geometry && o.geometry.animations || o.animations; } - for (let i = 0; i < clipArray.length; i++) { + for (var 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 + AnimationClip.CreateClipsFromMorphTargetSequences = function CreateClipsFromMorphTargetSequences(morphTargets, fps, noLoop) { + var animationToMorphTargets = {}; // tested with https://regex101.com/ on trick sequences // such flamingo_flyA_003, flamingo_run1_003, crdeath0059 - const pattern = /^([\w-]*?)([\d]+)$/; // sort morph target names into animation groups based + var pattern = /^([\w-]*?)([\d]+)$/; // 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); + for (var i = 0, il = morphTargets.length; i < il; i++) { + var morphTarget = morphTargets[i]; + var parts = morphTarget.name.match(pattern); if (parts && parts.length > 1) { - const name = parts[1]; - let animationMorphTargets = animationToMorphTargets[name]; + var name = parts[1]; + var animationMorphTargets = animationToMorphTargets[name]; if (!animationMorphTargets) { animationToMorphTargets[name] = animationMorphTargets = []; @@ -24352,27 +25971,27 @@ } } - const clips = []; + var clips = []; - for (const name in animationToMorphTargets) { - clips.push(this.CreateFromMorphTargetSequence(name, animationToMorphTargets[name], fps, noLoop)); + for (var _name in animationToMorphTargets) { + clips.push(this.CreateFromMorphTargetSequence(_name, animationToMorphTargets[_name], fps, noLoop)); } return clips; } // parse the animation.hierarchy format + ; - - static parseAnimation(animation, bones) { + AnimationClip.parseAnimation = function parseAnimation(animation, bones) { if (!animation) { console.error('THREE.AnimationClip: No animation in JSONLoader data.'); return null; } - const addNonemptyTrack = function (trackType, trackName, animationKeys, propertyName, destTracks) { + var addNonemptyTrack = function addNonemptyTrack(trackType, trackName, animationKeys, propertyName, destTracks) { // only return track if there are actually keys. if (animationKeys.length !== 0) { - const times = []; - const values = []; + var times = []; + var values = []; AnimationUtils.flattenJSON(animationKeys, times, values, propertyName); // empty keys are filtered out, so check again if (times.length !== 0) { @@ -24381,27 +26000,27 @@ } }; - const tracks = []; - const clipName = animation.name || 'default'; - const fps = animation.fps || 30; - const blendMode = animation.blendMode; // automatic length determination in AnimationClip. + var tracks = []; + var clipName = animation.name || 'default'; + var fps = animation.fps || 30; + var blendMode = animation.blendMode; // automatic length determination in AnimationClip. - let duration = animation.length || -1; - const hierarchyTracks = animation.hierarchy || []; + var duration = animation.length || -1; + var hierarchyTracks = animation.hierarchy || []; - for (let h = 0; h < hierarchyTracks.length; h++) { - const animationKeys = hierarchyTracks[h].keys; // skip empty tracks + for (var h = 0; h < hierarchyTracks.length; h++) { + var animationKeys = hierarchyTracks[h].keys; // 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; + var morphTargetNames = {}; + var k = void 0; for (k = 0; k < animationKeys.length; k++) { if (animationKeys[k].morphTargets) { - for (let m = 0; m < animationKeys[k].morphTargets.length; m++) { + for (var m = 0; m < animationKeys[k].morphTargets.length; m++) { morphTargetNames[animationKeys[k].morphTargets[m]] = -1; } } @@ -24410,12 +26029,12 @@ // the morphTarget is named. - for (const morphTargetName in morphTargetNames) { - const times = []; - const values = []; + for (var morphTargetName in morphTargetNames) { + var times = []; + var values = []; - for (let m = 0; m !== animationKeys[k].morphTargets.length; ++m) { - const animationKey = animationKeys[k]; + for (var _m = 0; _m !== animationKeys[k].morphTargets.length; ++_m) { + var animationKey = animationKeys[k]; times.push(animationKey.time); values.push(animationKey.morphTarget === morphTargetName ? 1 : 0); } @@ -24426,7 +26045,7 @@ duration = morphTargetNames.length * (fps || 1.0); } else { // ...assume skeletal animation - const boneName = '.bones[' + bones[h].name + ']'; + var 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); @@ -24437,64 +26056,67 @@ return null; } - const clip = new this(clipName, duration, tracks, blendMode); + var clip = new this(clipName, duration, tracks, blendMode); return clip; - } + }; - resetDuration() { - const tracks = this.tracks; - let duration = 0; + var _proto = AnimationClip.prototype; - for (let i = 0, n = tracks.length; i !== n; ++i) { - const track = this.tracks[i]; + _proto.resetDuration = function resetDuration() { + var tracks = this.tracks; + var duration = 0; + + for (var i = 0, n = tracks.length; i !== n; ++i) { + var 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++) { + _proto.trim = function trim() { + for (var i = 0; i < this.tracks.length; i++) { this.tracks[i].trim(0, this.duration); } return this; - } + }; - validate() { - let valid = true; + _proto.validate = function validate() { + var valid = true; - for (let i = 0; i < this.tracks.length; i++) { + for (var 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++) { + _proto.optimize = function optimize() { + for (var i = 0; i < this.tracks.length; i++) { this.tracks[i].optimize(); } return this; - } + }; - clone() { - const tracks = []; + _proto.clone = function clone() { + var tracks = []; - for (let i = 0; i < this.tracks.length; i++) { + for (var 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() { + _proto.toJSON = function toJSON() { return this.constructor.toJSON(this); - } + }; - } + return AnimationClip; + }(); function getTrackTypeForValueTypeName(typeName) { switch (typeName.toLowerCase()) { @@ -24533,11 +26155,11 @@ throw new Error('THREE.KeyframeTrack: track type undefined, can not parse'); } - const trackType = getTrackTypeForValueTypeName(json.type); + var trackType = getTrackTypeForValueTypeName(json.type); if (json.times === undefined) { - const times = [], - values = []; + var times = [], + values = []; AnimationUtils.flattenJSON(json.keys, times, values, 'value'); json.times = times; json.values = values; @@ -24552,34 +26174,34 @@ } } - const Cache = { + var Cache = { enabled: false, files: {}, - add: function (key, file) { + add: function add(key, file) { if (this.enabled === false) return; // console.log( 'THREE.Cache', 'Adding key:', key ); this.files[key] = file; }, - get: function (key) { + get: function get(key) { if (this.enabled === false) return; // console.log( 'THREE.Cache', 'Checking key:', key ); return this.files[key]; }, - remove: function (key) { + remove: function remove(key) { delete this.files[key]; }, - clear: function () { + clear: function clear() { this.files = {}; } }; function LoadingManager(onLoad, onProgress, onError) { - const scope = this; - let isLoading = false; - let itemsLoaded = 0; - let itemsTotal = 0; - let urlModifier = undefined; - const handlers = []; // Refer to #5689 for the reason why we don't set .onStart + var scope = this; + var isLoading = false; + var itemsLoaded = 0; + var itemsTotal = 0; + var urlModifier = undefined; + var handlers = []; // Refer to #5689 for the reason why we don't set .onStart // in the constructor this.onStart = undefined; @@ -24640,7 +26262,7 @@ }; this.removeHandler = function (regex) { - const index = handlers.indexOf(regex); + var index = handlers.indexOf(regex); if (index !== -1) { handlers.splice(index, 2); @@ -24650,9 +26272,9 @@ }; this.getHandler = function (file) { - for (let i = 0, l = handlers.length; i < l; i += 2) { - const regex = handlers[i]; - const loader = handlers[i + 1]; + for (var i = 0, l = handlers.length; i < l; i += 2) { + var regex = handlers[i]; + var loader = handlers[i + 1]; if (regex.global) regex.lastIndex = 0; // see #17920 if (regex.test(file)) { @@ -24664,7 +26286,7 @@ }; } - const DefaultLoadingManager = new LoadingManager(); + var DefaultLoadingManager = new LoadingManager(); function Loader(manager) { this.manager = manager !== undefined ? manager : DefaultLoadingManager; @@ -24676,41 +26298,41 @@ } Object.assign(Loader.prototype, { - load: function () + load: function load() /* url, onLoad, onProgress, onError */ {}, - loadAsync: function (url, onProgress) { - const scope = this; + loadAsync: function loadAsync(url, onProgress) { + var scope = this; return new Promise(function (resolve, reject) { scope.load(url, resolve, onProgress, reject); }); }, - parse: function () + parse: function parse() /* data */ {}, - setCrossOrigin: function (crossOrigin) { + setCrossOrigin: function setCrossOrigin(crossOrigin) { this.crossOrigin = crossOrigin; return this; }, - setWithCredentials: function (value) { + setWithCredentials: function setWithCredentials(value) { this.withCredentials = value; return this; }, - setPath: function (path) { + setPath: function setPath(path) { this.path = path; return this; }, - setResourcePath: function (resourcePath) { + setResourcePath: function setResourcePath(resourcePath) { this.resourcePath = resourcePath; return this; }, - setRequestHeader: function (requestHeader) { + setRequestHeader: function setRequestHeader(requestHeader) { this.requestHeader = requestHeader; return this; } }); - const loading = {}; + var loading = {}; function FileLoader(manager) { Loader.call(this, manager); @@ -24718,12 +26340,12 @@ FileLoader.prototype = Object.assign(Object.create(Loader.prototype), { constructor: FileLoader, - load: function (url, onLoad, onProgress, onError) { + load: function 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); + var scope = this; + var cached = Cache.get(url); if (cached !== undefined) { scope.manager.itemStart(url); @@ -24745,27 +26367,27 @@ } // Check for data: URI - const dataUriRegex = /^data:(.*?)(;base64)?,(.*)$/; - const dataUriRegexResult = url.match(dataUriRegex); - let request; // Safari can not handle Data URIs through XMLHttpRequest so process manually + var dataUriRegex = /^data:(.*?)(;base64)?,(.*)$/; + var dataUriRegexResult = url.match(dataUriRegex); + var request; // Safari can not handle Data URIs through XMLHttpRequest so process manually if (dataUriRegexResult) { - const mimeType = dataUriRegexResult[1]; - const isBase64 = !!dataUriRegexResult[2]; - let data = dataUriRegexResult[3]; + var mimeType = dataUriRegexResult[1]; + var isBase64 = !!dataUriRegexResult[2]; + var data = dataUriRegexResult[3]; data = decodeURIComponent(data); if (isBase64) data = atob(data); try { - let response; - const responseType = (this.responseType || '').toLowerCase(); + var response; + var responseType = (this.responseType || '').toLowerCase(); switch (responseType) { case 'arraybuffer': case 'blob': - const view = new Uint8Array(data.length); + var view = new Uint8Array(data.length); - for (let i = 0; i < data.length; i++) { + for (var i = 0; i < data.length; i++) { view[i] = data.charCodeAt(i); } @@ -24780,7 +26402,7 @@ break; case 'document': - const parser = new DOMParser(); + var parser = new DOMParser(); response = parser.parseFromString(data, mimeType); break; @@ -24818,8 +26440,8 @@ request = new XMLHttpRequest(); request.open('GET', url, true); request.addEventListener('load', function (event) { - const response = this.response; - const callbacks = loading[url]; + var response = this.response; + var callbacks = loading[url]; delete loading[url]; if (this.status === 200 || this.status === 0) { @@ -24830,16 +26452,16 @@ Cache.add(url, response); - for (let i = 0, il = callbacks.length; i < il; i++) { - const callback = callbacks[i]; + for (var _i = 0, il = callbacks.length; _i < il; _i++) { + var callback = callbacks[_i]; if (callback.onLoad) callback.onLoad(response); } scope.manager.itemEnd(url); } else { - for (let i = 0, il = callbacks.length; i < il; i++) { - const callback = callbacks[i]; - if (callback.onError) callback.onError(event); + for (var _i2 = 0, _il = callbacks.length; _i2 < _il; _i2++) { + var _callback = callbacks[_i2]; + if (_callback.onError) _callback.onError(event); } scope.manager.itemError(url); @@ -24847,19 +26469,19 @@ } }, false); request.addEventListener('progress', function (event) { - const callbacks = loading[url]; + var callbacks = loading[url]; - for (let i = 0, il = callbacks.length; i < il; i++) { - const callback = callbacks[i]; + for (var _i3 = 0, il = callbacks.length; _i3 < il; _i3++) { + var callback = callbacks[_i3]; if (callback.onProgress) callback.onProgress(event); } }, false); request.addEventListener('error', function (event) { - const callbacks = loading[url]; + var callbacks = loading[url]; delete loading[url]; - for (let i = 0, il = callbacks.length; i < il; i++) { - const callback = callbacks[i]; + for (var _i4 = 0, il = callbacks.length; _i4 < il; _i4++) { + var callback = callbacks[_i4]; if (callback.onError) callback.onError(event); } @@ -24867,11 +26489,11 @@ scope.manager.itemEnd(url); }, false); request.addEventListener('abort', function (event) { - const callbacks = loading[url]; + var callbacks = loading[url]; delete loading[url]; - for (let i = 0, il = callbacks.length; i < il; i++) { - const callback = callbacks[i]; + for (var _i5 = 0, il = callbacks.length; _i5 < il; _i5++) { + var callback = callbacks[_i5]; if (callback.onError) callback.onError(event); } @@ -24882,7 +26504,7 @@ if (this.withCredentials !== undefined) request.withCredentials = this.withCredentials; if (request.overrideMimeType) request.overrideMimeType(this.mimeType !== undefined ? this.mimeType : 'text/plain'); - for (const header in this.requestHeader) { + for (var header in this.requestHeader) { request.setRequestHeader(header, this.requestHeader[header]); } @@ -24892,24 +26514,28 @@ scope.manager.itemStart(url); return request; }, - setResponseType: function (value) { + setResponseType: function setResponseType(value) { this.responseType = value; return this; }, - setMimeType: function (value) { + setMimeType: function setMimeType(value) { this.mimeType = value; return this; } }); - class AnimationLoader extends Loader { - constructor(manager) { - super(manager); + var AnimationLoader = /*#__PURE__*/function (_Loader) { + _inheritsLoose(AnimationLoader, _Loader); + + function AnimationLoader(manager) { + return _Loader.call(this, manager) || this; } - load(url, onLoad, onProgress, onError) { - const scope = this; - const loader = new FileLoader(this.manager); + var _proto = AnimationLoader.prototype; + + _proto.load = function load(url, onLoad, onProgress, onError) { + var scope = this; + var loader = new FileLoader(this.manager); loader.setPath(this.path); loader.setRequestHeader(this.requestHeader); loader.setWithCredentials(this.withCredentials); @@ -24926,20 +26552,21 @@ scope.manager.itemError(url); } }, onProgress, onError); - } + }; - parse(json) { - const animations = []; + _proto.parse = function parse(json) { + var animations = []; - for (let i = 0; i < json.length; i++) { - const clip = AnimationClip.parse(json[i]); + for (var i = 0; i < json.length; i++) { + var clip = AnimationClip.parse(json[i]); animations.push(clip); } return animations; - } + }; - } + return AnimationLoader; + }(Loader); /** * Abstract Base class to block based textures loader (dds, pvr, ...) @@ -24953,20 +26580,20 @@ CompressedTextureLoader.prototype = Object.assign(Object.create(Loader.prototype), { constructor: CompressedTextureLoader, - load: function (url, onLoad, onProgress, onError) { - const scope = this; - const images = []; - const texture = new CompressedTexture(); - const loader = new FileLoader(this.manager); + load: function load(url, onLoad, onProgress, onError) { + var scope = this; + var images = []; + var texture = new CompressedTexture(); + var loader = new FileLoader(this.manager); loader.setPath(this.path); loader.setResponseType('arraybuffer'); loader.setRequestHeader(this.requestHeader); loader.setWithCredentials(scope.withCredentials); - let loaded = 0; + var loaded = 0; function loadTexture(i) { loader.load(url[i], function (buffer) { - const texDatas = scope.parse(buffer, true); + var texDatas = scope.parse(buffer, true); images[i] = { width: texDatas.width, height: texDatas.height, @@ -24986,24 +26613,24 @@ } if (Array.isArray(url)) { - for (let i = 0, il = url.length; i < il; ++i) { + for (var 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); + var texDatas = scope.parse(buffer, true); if (texDatas.isCubemap) { - const faces = texDatas.mipmaps.length / texDatas.mipmapCount; + var faces = texDatas.mipmaps.length / texDatas.mipmapCount; - for (let f = 0; f < faces; f++) { + for (var 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]); + for (var _i = 0; _i < texDatas.mipmapCount; _i++) { + images[f].mipmaps.push(texDatas.mipmaps[f * texDatas.mipmapCount + _i]); images[f].format = texDatas.format; images[f].width = texDatas.width; images[f].height = texDatas.height; @@ -25031,16 +26658,20 @@ } }); - class ImageLoader extends Loader { - constructor(manager) { - super(manager); + var ImageLoader = /*#__PURE__*/function (_Loader) { + _inheritsLoose(ImageLoader, _Loader); + + function ImageLoader(manager) { + return _Loader.call(this, manager) || this; } - load(url, onLoad, onProgress, onError) { + var _proto = ImageLoader.prototype; + + _proto.load = function 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); + var scope = this; + var cached = Cache.get(url); if (cached !== undefined) { scope.manager.itemStart(url); @@ -25051,7 +26682,7 @@ return cached; } - const image = document.createElementNS('http://www.w3.org/1999/xhtml', 'img'); + var image = document.createElementNS('http://www.w3.org/1999/xhtml', 'img'); function onImageLoad() { image.removeEventListener('load', onImageLoad, false); @@ -25079,21 +26710,26 @@ scope.manager.itemStart(url); image.src = url; return image; - } + }; - } + return ImageLoader; + }(Loader); - class CubeTextureLoader extends Loader { - constructor(manager) { - super(manager); + var CubeTextureLoader = /*#__PURE__*/function (_Loader) { + _inheritsLoose(CubeTextureLoader, _Loader); + + function CubeTextureLoader(manager) { + return _Loader.call(this, manager) || this; } - load(urls, onLoad, onProgress, onError) { - const texture = new CubeTexture(); - const loader = new ImageLoader(this.manager); + var _proto = CubeTextureLoader.prototype; + + _proto.load = function load(urls, onLoad, onProgress, onError) { + var texture = new CubeTexture(); + var loader = new ImageLoader(this.manager); loader.setCrossOrigin(this.crossOrigin); loader.setPath(this.path); - let loaded = 0; + var loaded = 0; function loadTexture(i) { loader.load(urls[i], function (image) { @@ -25107,14 +26743,15 @@ }, undefined, onError); } - for (let i = 0; i < urls.length; ++i) { + for (var i = 0; i < urls.length; ++i) { loadTexture(i); } return texture; - } + }; - } + return CubeTextureLoader; + }(Loader); /** * Abstract Base class to load generic binary textures formats (rgbe, hdr, ...) @@ -25128,16 +26765,16 @@ DataTextureLoader.prototype = Object.assign(Object.create(Loader.prototype), { constructor: DataTextureLoader, - load: function (url, onLoad, onProgress, onError) { - const scope = this; - const texture = new DataTexture(); - const loader = new FileLoader(this.manager); + load: function load(url, onLoad, onProgress, onError) { + var scope = this; + var texture = new DataTexture(); + var loader = new FileLoader(this.manager); loader.setResponseType('arraybuffer'); loader.setRequestHeader(this.requestHeader); loader.setPath(this.path); loader.setWithCredentials(scope.withCredentials); loader.load(url, function (buffer) { - const texData = scope.parse(buffer); + var texData = scope.parse(buffer); if (!texData) return; if (texData.image !== undefined) { @@ -25196,15 +26833,15 @@ TextureLoader.prototype = Object.assign(Object.create(Loader.prototype), { constructor: TextureLoader, - load: function (url, onLoad, onProgress, onError) { - const texture = new Texture(); - const loader = new ImageLoader(this.manager); + load: function load(url, onLoad, onProgress, onError) { + var texture = new Texture(); + var loader = new ImageLoader(this.manager); loader.setCrossOrigin(this.crossOrigin); loader.setPath(this.path); loader.load(url, function (image) { texture.image = image; // JPEGs can't have an alpha channel, so memory can be saved by storing them as RGB. - const isJPEG = url.search(/\.jpe?g($|\?)/i) > 0 || url.search(/^data\:image\/jpeg/) === 0; + var isJPEG = url.search(/\.jpe?g($|\?)/i) > 0 || url.search(/^data\:image\/jpeg/) === 0; texture.format = isJPEG ? RGBFormat : RGBAFormat; texture.needsUpdate = true; @@ -25254,7 +26891,7 @@ Object.assign(Curve.prototype, { // Virtual base class method to overwrite and implement in subclasses // - t [0 .. 1] - getPoint: function () + getPoint: function getPoint() /* t, optionalTarget */ { console.warn('THREE.Curve: .getPoint() not implemented.'); @@ -25262,37 +26899,45 @@ }, // Get point at relative position in curve according to arc length // - u [0 .. 1] - getPointAt: function (u, optionalTarget) { - const t = this.getUtoTmapping(u); + getPointAt: function getPointAt(u, optionalTarget) { + var t = this.getUtoTmapping(u); return this.getPoint(t, optionalTarget); }, // Get sequence of points using getPoint( t ) - getPoints: function (divisions = 5) { - const points = []; + getPoints: function getPoints(divisions) { + if (divisions === void 0) { + divisions = 5; + } - for (let d = 0; d <= divisions; d++) { + var points = []; + + for (var d = 0; d <= divisions; d++) { points.push(this.getPoint(d / divisions)); } return points; }, // Get sequence of points using getPointAt( u ) - getSpacedPoints: function (divisions = 5) { - const points = []; + getSpacedPoints: function getSpacedPoints(divisions) { + if (divisions === void 0) { + divisions = 5; + } - for (let d = 0; d <= divisions; d++) { + var points = []; + + for (var d = 0; d <= divisions; d++) { points.push(this.getPointAt(d / divisions)); } return points; }, // Get total curve arc length - getLength: function () { - const lengths = this.getLengths(); + getLength: function getLength() { + var lengths = this.getLengths(); return lengths[lengths.length - 1]; }, // Get list of cumulative segment lengths - getLengths: function (divisions) { + getLengths: function getLengths(divisions) { if (divisions === undefined) divisions = this.arcLengthDivisions; if (this.cacheArcLengths && this.cacheArcLengths.length === divisions + 1 && !this.needsUpdate) { @@ -25300,13 +26945,13 @@ } this.needsUpdate = false; - const cache = []; - let current, + var cache = []; + var current, last = this.getPoint(0); - let sum = 0; + var sum = 0; cache.push(0); - for (let p = 1; p <= divisions; p++) { + for (var p = 1; p <= divisions; p++) { current = this.getPoint(p / divisions); sum += current.distanceTo(last); cache.push(sum); @@ -25316,16 +26961,16 @@ this.cacheArcLengths = cache; return cache; // { sums: cache, sum: sum }; Sum is in the last element. }, - updateArcLengths: function () { + updateArcLengths: function updateArcLengths() { this.needsUpdate = true; this.getLengths(); }, // Given u ( 0 .. 1 ), get a t to find p. This gives you points which are equidistant - getUtoTmapping: function (u, distance) { - const arcLengths = this.getLengths(); - let i = 0; - const il = arcLengths.length; - let targetArcLength; // The targeted u distance value to get + getUtoTmapping: function getUtoTmapping(u, distance) { + var arcLengths = this.getLengths(); + var i = 0; + var il = arcLengths.length; + var targetArcLength; // The targeted u distance value to get if (distance) { targetArcLength = distance; @@ -25334,7 +26979,7 @@ } // binary search for the index with largest value smaller than target u distance - let low = 0, + var low = 0, high = il - 1, comparison; @@ -25360,47 +27005,47 @@ } // 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 + var lengthBefore = arcLengths[i]; + var lengthAfter = arcLengths[i + 1]; + var segmentLength = lengthAfter - lengthBefore; // determine where we are between the 'before' and 'after' points - const segmentFraction = (targetArcLength - lengthBefore) / segmentLength; // add that fractional amount to t + var segmentFraction = (targetArcLength - lengthBefore) / segmentLength; // add that fractional amount to t - const t = (i + segmentFraction) / (il - 1); + var t = (i + segmentFraction) / (il - 1); return 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: function (t, optionalTarget) { - const delta = 0.0001; - let t1 = t - delta; - let t2 = t + delta; // Capping in case of danger + getTangent: function getTangent(t, optionalTarget) { + var delta = 0.0001; + var t1 = t - delta; + var t2 = t + delta; // Capping in case of danger if (t1 < 0) t1 = 0; if (t2 > 1) t2 = 1; - const pt1 = this.getPoint(t1); - const pt2 = this.getPoint(t2); - const tangent = optionalTarget || (pt1.isVector2 ? new Vector2() : new Vector3()); + var pt1 = this.getPoint(t1); + var pt2 = this.getPoint(t2); + var tangent = optionalTarget || (pt1.isVector2 ? new Vector2() : new Vector3()); tangent.copy(pt2).sub(pt1).normalize(); return tangent; }, - getTangentAt: function (u, optionalTarget) { - const t = this.getUtoTmapping(u); + getTangentAt: function getTangentAt(u, optionalTarget) { + var t = this.getUtoTmapping(u); return this.getTangent(t, optionalTarget); }, - computeFrenetFrames: function (segments, closed) { + computeFrenetFrames: function 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 - - for (let i = 0; i <= segments; i++) { - const u = i / segments; + var normal = new Vector3(); + var tangents = []; + var normals = []; + var binormals = []; + var vec = new Vector3(); + var mat = new Matrix4(); // compute the tangent vectors for each segment on the curve + + for (var i = 0; i <= segments; i++) { + var u = i / segments; tangents[i] = this.getTangentAt(u, new Vector3()); tangents[i].normalize(); } // select an initial normal vector perpendicular to the first tangent vector, @@ -25409,10 +27054,10 @@ normals[0] = new Vector3(); binormals[0] = new Vector3(); - let min = Number.MAX_VALUE; - const tx = Math.abs(tangents[0].x); - const ty = Math.abs(tangents[0].y); - const tz = Math.abs(tangents[0].z); + var min = Number.MAX_VALUE; + var tx = Math.abs(tangents[0].x); + var ty = Math.abs(tangents[0].y); + var tz = Math.abs(tangents[0].z); if (tx <= min) { min = tx; @@ -25432,34 +27077,36 @@ 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 - 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]); + for (var _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(MathUtils.clamp(tangents[i - 1].dot(tangents[i]), -1, 1)); // clamp for floating pt errors + var theta = Math.acos(MathUtils.clamp(tangents[_i - 1].dot(tangents[_i]), -1, 1)); // clamp for floating pt errors - normals[i].applyMatrix4(mat.makeRotationAxis(vec, theta)); + normals[_i].applyMatrix4(mat.makeRotationAxis(vec, theta)); } - binormals[i].crossVectors(tangents[i], normals[i]); + 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 (closed === true) { - let theta = Math.acos(MathUtils.clamp(normals[0].dot(normals[segments]), -1, 1)); - theta /= segments; + var _theta = Math.acos(MathUtils.clamp(normals[0].dot(normals[segments]), -1, 1)); + + _theta /= segments; if (tangents[0].dot(vec.crossVectors(normals[0], normals[segments])) > 0) { - theta = -theta; + _theta = -_theta; } - for (let i = 1; i <= segments; i++) { + for (var _i2 = 1; _i2 <= segments; _i2++) { // twist a little... - normals[i].applyMatrix4(mat.makeRotationAxis(tangents[i], theta * i)); - binormals[i].crossVectors(tangents[i], normals[i]); + normals[_i2].applyMatrix4(mat.makeRotationAxis(tangents[_i2], _theta * _i2)); + + binormals[_i2].crossVectors(tangents[_i2], normals[_i2]); } } @@ -25469,15 +27116,15 @@ binormals: binormals }; }, - clone: function () { + clone: function clone() { return new this.constructor().copy(this); }, - copy: function (source) { + copy: function copy(source) { this.arcLengthDivisions = source.arcLengthDivisions; return this; }, - toJSON: function () { - const data = { + toJSON: function toJSON() { + var data = { metadata: { version: 4.5, type: 'Curve', @@ -25488,71 +27135,115 @@ data.type = this.type; return data; }, - fromJSON: function (json) { + fromJSON: function fromJSON(json) { this.arcLengthDivisions = json.arcLengthDivisions; return this; } }); - class EllipseCurve extends Curve { - constructor(aX = 0, aY = 0, xRadius = 1, yRadius = 1, aStartAngle = 0, aEndAngle = Math.PI * 2, aClockwise = false, aRotation = 0) { - super(); - this.type = 'EllipseCurve'; - this.aX = aX; - this.aY = aY; - this.xRadius = xRadius; - this.yRadius = yRadius; - this.aStartAngle = aStartAngle; - this.aEndAngle = aEndAngle; - this.aClockwise = aClockwise; - this.aRotation = aRotation; - } + var EllipseCurve = /*#__PURE__*/function (_Curve) { + _inheritsLoose(EllipseCurve, _Curve); - 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 + function EllipseCurve(aX, aY, xRadius, yRadius, aStartAngle, aEndAngle, aClockwise, aRotation) { + var _this; - while (deltaAngle < 0) deltaAngle += twoPi; + if (aX === void 0) { + aX = 0; + } - while (deltaAngle > twoPi) deltaAngle -= twoPi; + if (aY === void 0) { + aY = 0; + } - if (deltaAngle < Number.EPSILON) { - if (samePoints) { - deltaAngle = 0; - } else { - deltaAngle = twoPi; - } + if (xRadius === void 0) { + xRadius = 1; } - if (this.aClockwise === true && !samePoints) { - if (deltaAngle === twoPi) { + if (yRadius === void 0) { + yRadius = 1; + } + + if (aStartAngle === void 0) { + aStartAngle = 0; + } + + if (aEndAngle === void 0) { + aEndAngle = Math.PI * 2; + } + + if (aClockwise === void 0) { + aClockwise = false; + } + + if (aRotation === void 0) { + aRotation = 0; + } + + _this = _Curve.call(this) || this; + _this.type = 'EllipseCurve'; + _this.aX = aX; + _this.aY = aY; + _this.xRadius = xRadius; + _this.yRadius = yRadius; + _this.aStartAngle = aStartAngle; + _this.aEndAngle = aEndAngle; + _this.aClockwise = aClockwise; + _this.aRotation = aRotation; + return _this; + } + + var _proto = EllipseCurve.prototype; + + _proto.getPoint = function getPoint(t, optionalTarget) { + var point = optionalTarget || new Vector2(); + var twoPi = Math.PI * 2; + var deltaAngle = this.aEndAngle - this.aStartAngle; + var 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; + } else { + deltaAngle = twoPi; + } + } + + if (this.aClockwise === true && !samePoints) { + if (deltaAngle === twoPi) { deltaAngle = -twoPi; } else { 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); + var angle = this.aStartAngle + t * deltaAngle; + var x = this.aX + this.xRadius * Math.cos(angle); + var 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. + var cos = Math.cos(this.aRotation); + var sin = Math.sin(this.aRotation); + var tx = x - this.aX; + var 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); - } + }; + + _proto.copy = function copy(source) { + _Curve.prototype.copy.call(this, source); - copy(source) { - super.copy(source); this.aX = source.aX; this.aY = source.aY; this.xRadius = source.xRadius; @@ -25562,10 +27253,11 @@ this.aClockwise = source.aClockwise; this.aRotation = source.aRotation; return this; - } + }; + + _proto.toJSON = function toJSON() { + var data = _Curve.prototype.toJSON.call(this); - toJSON() { - const data = super.toJSON(); data.aX = this.aX; data.aY = this.aY; data.xRadius = this.xRadius; @@ -25575,10 +27267,11 @@ data.aClockwise = this.aClockwise; data.aRotation = this.aRotation; return data; - } + }; + + _proto.fromJSON = function fromJSON(json) { + _Curve.prototype.fromJSON.call(this, json); - fromJSON(json) { - super.fromJSON(json); this.aX = json.aX; this.aY = json.aY; this.xRadius = json.xRadius; @@ -25588,19 +27281,26 @@ this.aClockwise = json.aClockwise; this.aRotation = json.aRotation; return this; - } + }; - } + return EllipseCurve; + }(Curve); EllipseCurve.prototype.isEllipseCurve = true; - class ArcCurve extends EllipseCurve { - constructor(aX, aY, aRadius, aStartAngle, aEndAngle, aClockwise) { - super(aX, aY, aRadius, aRadius, aStartAngle, aEndAngle, aClockwise); - this.type = 'ArcCurve'; + var ArcCurve = /*#__PURE__*/function (_EllipseCurve) { + _inheritsLoose(ArcCurve, _EllipseCurve); + + function ArcCurve(aX, aY, aRadius, aStartAngle, aEndAngle, aClockwise) { + var _this; + + _this = _EllipseCurve.call(this, aX, aY, aRadius, aRadius, aStartAngle, aEndAngle, aClockwise) || this; + _this.type = 'ArcCurve'; + return _this; } - } + return ArcCurve; + }(EllipseCurve); ArcCurve.prototype.isArcCurve = true; @@ -25624,7 +27324,7 @@ */ function CubicPoly() { - let c0 = 0, + var c0 = 0, c1 = 0, c2 = 0, c3 = 0; @@ -25645,49 +27345,76 @@ } return { - initCatmullRom: function (x0, x1, x2, x3, tension) { + initCatmullRom: function initCatmullRom(x0, x1, x2, x3, tension) { init(x1, x2, tension * (x2 - x0), tension * (x3 - x1)); }, - initNonuniformCatmullRom: function (x0, x1, x2, x3, dt0, dt1, dt2) { + initNonuniformCatmullRom: function initNonuniformCatmullRom(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] + var t1 = (x1 - x0) / dt0 - (x2 - x0) / (dt0 + dt1) + (x2 - x1) / dt1; + var 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); }, - calc: function (t) { - const t2 = t * t; - const t3 = t2 * t; + calc: function calc(t) { + var t2 = t * t; + var t3 = t2 * t; return c0 + c1 * t + c2 * t2 + c3 * t3; } }; } // - const tmp = new Vector3(); - const px = new CubicPoly(), - py = new CubicPoly(), - pz = new CubicPoly(); + var tmp = new Vector3(); + var px = new CubicPoly(), + py = new CubicPoly(), + pz = new CubicPoly(); + + var CatmullRomCurve3 = /*#__PURE__*/function (_Curve) { + _inheritsLoose(CatmullRomCurve3, _Curve); + + function CatmullRomCurve3(points, closed, curveType, tension) { + var _this; - class CatmullRomCurve3 extends Curve { - constructor(points = [], closed = false, curveType = 'centripetal', tension = 0.5) { - super(); - this.type = 'CatmullRomCurve3'; - this.points = points; - this.closed = closed; - this.curveType = curveType; - this.tension = tension; + if (points === void 0) { + points = []; + } + + if (closed === void 0) { + closed = false; + } + + if (curveType === void 0) { + curveType = 'centripetal'; + } + + if (tension === void 0) { + tension = 0.5; + } + + _this = _Curve.call(this) || this; + _this.type = 'CatmullRomCurve3'; + _this.points = points; + _this.closed = closed; + _this.curveType = curveType; + _this.tension = tension; + return _this; } - getPoint(t, optionalTarget = new Vector3()) { - const point = optionalTarget; - const points = this.points; - const l = points.length; - const p = (l - (this.closed ? 0 : 1)) * t; - let intPoint = Math.floor(p); - let weight = p - intPoint; + var _proto = CatmullRomCurve3.prototype; + + _proto.getPoint = function getPoint(t, optionalTarget) { + if (optionalTarget === void 0) { + optionalTarget = new Vector3(); + } + + var point = optionalTarget; + var points = this.points; + var l = points.length; + var p = (l - (this.closed ? 0 : 1)) * t; + var intPoint = Math.floor(p); + var weight = p - intPoint; if (this.closed) { intPoint += intPoint > 0 ? 0 : (Math.floor(Math.abs(intPoint) / l) + 1) * l; @@ -25696,7 +27423,7 @@ weight = 1; } - let p0, p3; // 4 points (p1 & p2 defined below) + var p0, p3; // 4 points (p1 & p2 defined below) if (this.closed || intPoint > 0) { p0 = points[(intPoint - 1) % l]; @@ -25706,8 +27433,8 @@ p0 = tmp; } - const p1 = points[intPoint % l]; - const p2 = points[(intPoint + 1) % l]; + var p1 = points[intPoint % l]; + var p2 = points[(intPoint + 1) % l]; if (this.closed || intPoint + 2 < l) { p3 = points[(intPoint + 2) % l]; @@ -25719,10 +27446,10 @@ 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 + var pow = this.curveType === 'chordal' ? 0.5 : 0.25; + var dt0 = Math.pow(p0.distanceToSquared(p1), pow); + var dt1 = Math.pow(p1.distanceToSquared(p2), pow); + var 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; @@ -25738,14 +27465,15 @@ point.set(px.calc(weight), py.calc(weight), pz.calc(weight)); return point; - } + }; + + _proto.copy = function copy(source) { + _Curve.prototype.copy.call(this, source); - copy(source) { - super.copy(source); this.points = []; - for (let i = 0, l = source.points.length; i < l; i++) { - const point = source.points[i]; + for (var i = 0, l = source.points.length; i < l; i++) { + var point = source.points[i]; this.points.push(point.clone()); } @@ -25753,14 +27481,15 @@ this.curveType = source.curveType; this.tension = source.tension; return this; - } + }; + + _proto.toJSON = function toJSON() { + var data = _Curve.prototype.toJSON.call(this); - toJSON() { - const data = super.toJSON(); data.points = []; - for (let i = 0, l = this.points.length; i < l; i++) { - const point = this.points[i]; + for (var i = 0, l = this.points.length; i < l; i++) { + var point = this.points[i]; data.points.push(point.toArray()); } @@ -25768,14 +27497,15 @@ data.curveType = this.curveType; data.tension = this.tension; return data; - } + }; + + _proto.fromJSON = function fromJSON(json) { + _Curve.prototype.fromJSON.call(this, json); - fromJSON(json) { - super.fromJSON(json); this.points = []; - for (let i = 0, l = json.points.length; i < l; i++) { - const point = json.points[i]; + for (var i = 0, l = json.points.length; i < l; i++) { + var point = json.points[i]; this.points.push(new Vector3().fromArray(point)); } @@ -25783,9 +27513,10 @@ this.curveType = json.curveType; this.tension = json.tension; return this; - } + }; - } + return CatmullRomCurve3; + }(Curve); CatmullRomCurve3.prototype.isCatmullRomCurve3 = true; @@ -25794,16 +27525,16 @@ * http://en.wikipedia.org/wiki/Bézier_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; + var v0 = (p2 - p0) * 0.5; + var v1 = (p3 - p1) * 0.5; + var t2 = t * t; + var 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; + var k = 1 - t; return k * k * p; } @@ -25821,12 +27552,12 @@ function CubicBezierP0(t, p) { - const k = 1 - t; + var k = 1 - t; return k * k * k * p; } function CubicBezierP1(t, p) { - const k = 1 - t; + var k = 1 - t; return 3 * k * k * t * p; } @@ -25842,118 +27573,199 @@ return CubicBezierP0(t, p0) + CubicBezierP1(t, p1) + CubicBezierP2(t, p2) + CubicBezierP3(t, p3); } - class CubicBezierCurve extends Curve { - constructor(v0 = new Vector2(), v1 = new Vector2(), v2 = new Vector2(), v3 = new Vector2()) { - super(); - this.type = 'CubicBezierCurve'; - this.v0 = v0; - this.v1 = v1; - 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; + var CubicBezierCurve = /*#__PURE__*/function (_Curve) { + _inheritsLoose(CubicBezierCurve, _Curve); + + function CubicBezierCurve(v0, v1, v2, v3) { + var _this; + + if (v0 === void 0) { + v0 = new Vector2(); + } + + if (v1 === void 0) { + v1 = new Vector2(); + } + + if (v2 === void 0) { + v2 = new Vector2(); + } + + if (v3 === void 0) { + v3 = new Vector2(); + } + + _this = _Curve.call(this) || this; + _this.type = 'CubicBezierCurve'; + _this.v0 = v0; + _this.v1 = v1; + _this.v2 = v2; + _this.v3 = v3; + return _this; + } + + var _proto = CubicBezierCurve.prototype; + + _proto.getPoint = function getPoint(t, optionalTarget) { + if (optionalTarget === void 0) { + optionalTarget = new Vector2(); + } + + var point = optionalTarget; + var v0 = this.v0, + 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; - } + }; + + _proto.copy = function copy(source) { + _Curve.prototype.copy.call(this, source); - copy(source) { - super.copy(source); this.v0.copy(source.v0); this.v1.copy(source.v1); this.v2.copy(source.v2); this.v3.copy(source.v3); return this; - } + }; + + _proto.toJSON = function toJSON() { + var data = _Curve.prototype.toJSON.call(this); - toJSON() { - const data = super.toJSON(); data.v0 = this.v0.toArray(); data.v1 = this.v1.toArray(); data.v2 = this.v2.toArray(); data.v3 = this.v3.toArray(); return data; - } + }; + + _proto.fromJSON = function fromJSON(json) { + _Curve.prototype.fromJSON.call(this, json); - fromJSON(json) { - super.fromJSON(json); this.v0.fromArray(json.v0); this.v1.fromArray(json.v1); this.v2.fromArray(json.v2); this.v3.fromArray(json.v3); return this; - } + }; - } + return CubicBezierCurve; + }(Curve); CubicBezierCurve.prototype.isCubicBezierCurve = true; - class CubicBezierCurve3 extends Curve { - constructor(v0 = new Vector3(), v1 = new Vector3(), v2 = new Vector3(), v3 = new Vector3()) { - super(); - this.type = 'CubicBezierCurve3'; - this.v0 = v0; - this.v1 = v1; - 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; + var CubicBezierCurve3 = /*#__PURE__*/function (_Curve) { + _inheritsLoose(CubicBezierCurve3, _Curve); + + function CubicBezierCurve3(v0, v1, v2, v3) { + var _this; + + if (v0 === void 0) { + v0 = new Vector3(); + } + + if (v1 === void 0) { + v1 = new Vector3(); + } + + if (v2 === void 0) { + v2 = new Vector3(); + } + + if (v3 === void 0) { + v3 = new Vector3(); + } + + _this = _Curve.call(this) || this; + _this.type = 'CubicBezierCurve3'; + _this.v0 = v0; + _this.v1 = v1; + _this.v2 = v2; + _this.v3 = v3; + return _this; + } + + var _proto = CubicBezierCurve3.prototype; + + _proto.getPoint = function getPoint(t, optionalTarget) { + if (optionalTarget === void 0) { + optionalTarget = new Vector3(); + } + + var point = optionalTarget; + var v0 = this.v0, + 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; - } + }; + + _proto.copy = function copy(source) { + _Curve.prototype.copy.call(this, source); - copy(source) { - super.copy(source); this.v0.copy(source.v0); this.v1.copy(source.v1); this.v2.copy(source.v2); this.v3.copy(source.v3); return this; - } + }; + + _proto.toJSON = function toJSON() { + var data = _Curve.prototype.toJSON.call(this); - toJSON() { - const data = super.toJSON(); data.v0 = this.v0.toArray(); data.v1 = this.v1.toArray(); data.v2 = this.v2.toArray(); data.v3 = this.v3.toArray(); return data; - } + }; + + _proto.fromJSON = function fromJSON(json) { + _Curve.prototype.fromJSON.call(this, json); - fromJSON(json) { - super.fromJSON(json); this.v0.fromArray(json.v0); this.v1.fromArray(json.v1); this.v2.fromArray(json.v2); this.v3.fromArray(json.v3); return this; - } + }; - } + return CubicBezierCurve3; + }(Curve); CubicBezierCurve3.prototype.isCubicBezierCurve3 = true; - class LineCurve extends Curve { - constructor(v1 = new Vector2(), v2 = new Vector2()) { - super(); - this.type = 'LineCurve'; - this.v1 = v1; - this.v2 = v2; + var LineCurve = /*#__PURE__*/function (_Curve) { + _inheritsLoose(LineCurve, _Curve); + + function LineCurve(v1, v2) { + var _this; + + if (v1 === void 0) { + v1 = new Vector2(); + } + + if (v2 === void 0) { + v2 = new Vector2(); + } + + _this = _Curve.call(this) || this; + _this.type = 'LineCurve'; + _this.v1 = v1; + _this.v2 = v2; + return _this; } - getPoint(t, optionalTarget = new Vector2()) { - const point = optionalTarget; + var _proto = LineCurve.prototype; + + _proto.getPoint = function getPoint(t, optionalTarget) { + if (optionalTarget === void 0) { + optionalTarget = new Vector2(); + } + + var point = optionalTarget; if (t === 1) { point.copy(this.v2); @@ -25964,54 +27776,77 @@ return point; } // Line curve is linear, so we can overwrite default getPointAt + ; - - getPointAt(u, optionalTarget) { + _proto.getPointAt = function getPointAt(u, optionalTarget) { return this.getPoint(u, optionalTarget); - } + }; - getTangent(t, optionalTarget) { - const tangent = optionalTarget || new Vector2(); + _proto.getTangent = function getTangent(t, optionalTarget) { + var tangent = optionalTarget || new Vector2(); tangent.copy(this.v2).sub(this.v1).normalize(); return tangent; - } + }; + + _proto.copy = function copy(source) { + _Curve.prototype.copy.call(this, source); - copy(source) { - super.copy(source); this.v1.copy(source.v1); this.v2.copy(source.v2); return this; - } + }; + + _proto.toJSON = function toJSON() { + var data = _Curve.prototype.toJSON.call(this); - toJSON() { - const data = super.toJSON(); data.v1 = this.v1.toArray(); data.v2 = this.v2.toArray(); return data; - } + }; + + _proto.fromJSON = function fromJSON(json) { + _Curve.prototype.fromJSON.call(this, json); - fromJSON(json) { - super.fromJSON(json); this.v1.fromArray(json.v1); this.v2.fromArray(json.v2); return this; - } + }; - } + return LineCurve; + }(Curve); LineCurve.prototype.isLineCurve = true; - class LineCurve3 extends Curve { - constructor(v1 = new Vector3(), v2 = new Vector3()) { - super(); - this.type = 'LineCurve3'; - this.isLineCurve3 = true; - this.v1 = v1; - this.v2 = v2; + var LineCurve3 = /*#__PURE__*/function (_Curve) { + _inheritsLoose(LineCurve3, _Curve); + + function LineCurve3(v1, v2) { + var _this; + + if (v1 === void 0) { + v1 = new Vector3(); + } + + if (v2 === void 0) { + v2 = new Vector3(); + } + + _this = _Curve.call(this) || this; + _this.type = 'LineCurve3'; + _this.isLineCurve3 = true; + _this.v1 = v1; + _this.v2 = v2; + return _this; } - getPoint(t, optionalTarget = new Vector3()) { - const point = optionalTarget; + var _proto = LineCurve3.prototype; + + _proto.getPoint = function getPoint(t, optionalTarget) { + if (optionalTarget === void 0) { + optionalTarget = new Vector3(); + } + + var point = optionalTarget; if (t === 1) { point.copy(this.v2); @@ -26022,185 +27857,262 @@ return point; } // Line curve is linear, so we can overwrite default getPointAt + ; - - getPointAt(u, optionalTarget) { + _proto.getPointAt = function getPointAt(u, optionalTarget) { return this.getPoint(u, optionalTarget); - } + }; + + _proto.copy = function copy(source) { + _Curve.prototype.copy.call(this, source); - copy(source) { - super.copy(source); this.v1.copy(source.v1); this.v2.copy(source.v2); return this; - } + }; + + _proto.toJSON = function toJSON() { + var data = _Curve.prototype.toJSON.call(this); - toJSON() { - const data = super.toJSON(); data.v1 = this.v1.toArray(); data.v2 = this.v2.toArray(); return data; - } + }; + + _proto.fromJSON = function fromJSON(json) { + _Curve.prototype.fromJSON.call(this, json); - fromJSON(json) { - super.fromJSON(json); this.v1.fromArray(json.v1); this.v2.fromArray(json.v2); return this; - } + }; - } + return LineCurve3; + }(Curve); + + var QuadraticBezierCurve = /*#__PURE__*/function (_Curve) { + _inheritsLoose(QuadraticBezierCurve, _Curve); + + function QuadraticBezierCurve(v0, v1, v2) { + var _this; + + if (v0 === void 0) { + v0 = new Vector2(); + } + + if (v1 === void 0) { + v1 = new Vector2(); + } + + if (v2 === void 0) { + v2 = new Vector2(); + } - class QuadraticBezierCurve extends Curve { - constructor(v0 = new Vector2(), v1 = new Vector2(), v2 = new Vector2()) { - super(); - this.type = 'QuadraticBezierCurve'; - this.v0 = v0; - this.v1 = v1; - this.v2 = v2; + _this = _Curve.call(this) || this; + _this.type = 'QuadraticBezierCurve'; + _this.v0 = v0; + _this.v1 = v1; + _this.v2 = v2; + return _this; } - getPoint(t, optionalTarget = new Vector2()) { - const point = optionalTarget; - const v0 = this.v0, - v1 = this.v1, - v2 = this.v2; + var _proto = QuadraticBezierCurve.prototype; + + _proto.getPoint = function getPoint(t, optionalTarget) { + if (optionalTarget === void 0) { + optionalTarget = new Vector2(); + } + + var point = optionalTarget; + var v0 = this.v0, + 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; - } + }; + + _proto.copy = function copy(source) { + _Curve.prototype.copy.call(this, source); - copy(source) { - super.copy(source); this.v0.copy(source.v0); this.v1.copy(source.v1); this.v2.copy(source.v2); return this; - } + }; + + _proto.toJSON = function toJSON() { + var data = _Curve.prototype.toJSON.call(this); - toJSON() { - const data = super.toJSON(); data.v0 = this.v0.toArray(); data.v1 = this.v1.toArray(); data.v2 = this.v2.toArray(); return data; - } + }; + + _proto.fromJSON = function fromJSON(json) { + _Curve.prototype.fromJSON.call(this, json); - fromJSON(json) { - super.fromJSON(json); this.v0.fromArray(json.v0); this.v1.fromArray(json.v1); this.v2.fromArray(json.v2); return this; - } + }; - } + return QuadraticBezierCurve; + }(Curve); QuadraticBezierCurve.prototype.isQuadraticBezierCurve = true; - class QuadraticBezierCurve3 extends Curve { - constructor(v0 = new Vector3(), v1 = new Vector3(), v2 = new Vector3()) { - super(); - this.type = 'QuadraticBezierCurve3'; - this.v0 = v0; - this.v1 = v1; - this.v2 = v2; + var QuadraticBezierCurve3 = /*#__PURE__*/function (_Curve) { + _inheritsLoose(QuadraticBezierCurve3, _Curve); + + function QuadraticBezierCurve3(v0, v1, v2) { + var _this; + + if (v0 === void 0) { + v0 = new Vector3(); + } + + if (v1 === void 0) { + v1 = new Vector3(); + } + + if (v2 === void 0) { + v2 = new Vector3(); + } + + _this = _Curve.call(this) || this; + _this.type = 'QuadraticBezierCurve3'; + _this.v0 = v0; + _this.v1 = v1; + _this.v2 = v2; + return _this; } - getPoint(t, optionalTarget = new Vector3()) { - const point = optionalTarget; - const v0 = this.v0, - v1 = this.v1, - v2 = this.v2; + var _proto = QuadraticBezierCurve3.prototype; + + _proto.getPoint = function getPoint(t, optionalTarget) { + if (optionalTarget === void 0) { + optionalTarget = new Vector3(); + } + + var point = optionalTarget; + var v0 = this.v0, + 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; - } + }; + + _proto.copy = function copy(source) { + _Curve.prototype.copy.call(this, source); - copy(source) { - super.copy(source); this.v0.copy(source.v0); this.v1.copy(source.v1); this.v2.copy(source.v2); return this; - } + }; + + _proto.toJSON = function toJSON() { + var data = _Curve.prototype.toJSON.call(this); - toJSON() { - const data = super.toJSON(); data.v0 = this.v0.toArray(); data.v1 = this.v1.toArray(); data.v2 = this.v2.toArray(); return data; - } + }; + + _proto.fromJSON = function fromJSON(json) { + _Curve.prototype.fromJSON.call(this, json); - fromJSON(json) { - super.fromJSON(json); this.v0.fromArray(json.v0); this.v1.fromArray(json.v1); this.v2.fromArray(json.v2); return this; - } + }; - } + return QuadraticBezierCurve3; + }(Curve); QuadraticBezierCurve3.prototype.isQuadraticBezierCurve3 = true; - class SplineCurve extends Curve { - constructor(points = []) { - super(); - this.type = 'SplineCurve'; - this.points = points; - } - - getPoint(t, optionalTarget = new Vector2()) { - const point = optionalTarget; - const points = this.points; - const p = (points.length - 1) * t; - const intPoint = Math.floor(p); - const weight = p - intPoint; - const p0 = points[intPoint === 0 ? intPoint : intPoint - 1]; - const p1 = points[intPoint]; - const p2 = points[intPoint > points.length - 2 ? points.length - 1 : intPoint + 1]; - const p3 = points[intPoint > points.length - 3 ? points.length - 1 : intPoint + 2]; + var SplineCurve = /*#__PURE__*/function (_Curve) { + _inheritsLoose(SplineCurve, _Curve); + + function SplineCurve(points) { + var _this; + + if (points === void 0) { + points = []; + } + + _this = _Curve.call(this) || this; + _this.type = 'SplineCurve'; + _this.points = points; + return _this; + } + + var _proto = SplineCurve.prototype; + + _proto.getPoint = function getPoint(t, optionalTarget) { + if (optionalTarget === void 0) { + optionalTarget = new Vector2(); + } + + var point = optionalTarget; + var points = this.points; + var p = (points.length - 1) * t; + var intPoint = Math.floor(p); + var weight = p - intPoint; + var p0 = points[intPoint === 0 ? intPoint : intPoint - 1]; + var p1 = points[intPoint]; + var p2 = points[intPoint > points.length - 2 ? points.length - 1 : intPoint + 1]; + var p3 = points[intPoint > points.length - 3 ? points.length - 1 : intPoint + 2]; point.set(CatmullRom(weight, p0.x, p1.x, p2.x, p3.x), CatmullRom(weight, p0.y, p1.y, p2.y, p3.y)); return point; - } + }; + + _proto.copy = function copy(source) { + _Curve.prototype.copy.call(this, source); - copy(source) { - super.copy(source); this.points = []; - for (let i = 0, l = source.points.length; i < l; i++) { - const point = source.points[i]; + for (var i = 0, l = source.points.length; i < l; i++) { + var point = source.points[i]; this.points.push(point.clone()); } return this; - } + }; + + _proto.toJSON = function toJSON() { + var data = _Curve.prototype.toJSON.call(this); - toJSON() { - const data = super.toJSON(); data.points = []; - for (let i = 0, l = this.points.length; i < l; i++) { - const point = this.points[i]; + for (var i = 0, l = this.points.length; i < l; i++) { + var point = this.points[i]; data.points.push(point.toArray()); } return data; - } + }; + + _proto.fromJSON = function fromJSON(json) { + _Curve.prototype.fromJSON.call(this, json); - fromJSON(json) { - super.fromJSON(json); this.points = []; - for (let i = 0, l = json.points.length; i < l; i++) { - const point = json.points[i]; + for (var i = 0, l = json.points.length; i < l; i++) { + var point = json.points[i]; this.points.push(new Vector2().fromArray(point)); } return this; - } + }; - } + return SplineCurve; + }(Curve); SplineCurve.prototype.isSplineCurve = true; @@ -26223,22 +28135,30 @@ * curves, but retains the api of a curve **************************************************************/ - class CurvePath extends Curve { - constructor() { - super(); - this.type = 'CurvePath'; - this.curves = []; - this.autoClose = false; // Automatically closes the path + var CurvePath = /*#__PURE__*/function (_Curve) { + _inheritsLoose(CurvePath, _Curve); + + function CurvePath() { + var _this; + + _this = _Curve.call(this) || this; + _this.type = 'CurvePath'; + _this.curves = []; + _this.autoClose = false; // Automatically closes the path + + return _this; } - add(curve) { + var _proto = CurvePath.prototype; + + _proto.add = function add(curve) { this.curves.push(curve); - } + }; - closePath() { + _proto.closePath = function 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); + var startPoint = this.curves[0].getPoint(0); + var endPoint = this.curves[this.curves.length - 1].getPoint(1); if (!startPoint.equals(endPoint)) { this.curves.push(new LineCurve(endPoint, startPoint)); @@ -26250,19 +28170,19 @@ // 2. Locate and identify type of curve // 3. Get t for the curve // 4. Return curve.getPointAt(t') + ; - - getPoint(t) { - const d = t * this.getLength(); - const curveLengths = this.getCurveLengths(); - let i = 0; // To think about boundaries points. + _proto.getPoint = function getPoint(t) { + var d = t * this.getLength(); + var curveLengths = this.getCurveLengths(); + var i = 0; // To think about boundaries points. while (i < curveLengths.length) { if (curveLengths[i] >= d) { - const diff = curveLengths[i] - d; - const curve = this.curves[i]; - const segmentLength = curve.getLength(); - const u = segmentLength === 0 ? 0 : 1 - diff / segmentLength; + var diff = curveLengths[i] - d; + var curve = this.curves[i]; + var segmentLength = curve.getLength(); + var u = segmentLength === 0 ? 0 : 1 - diff / segmentLength; return curve.getPointAt(u); } @@ -26273,23 +28193,23 @@ } // We cannot use the default THREE.Curve getPoint() with getLength() because in // THREE.Curve, getLength() depends on getPoint() but in THREE.CurvePath // getPoint() depends on getLength + ; - - getLength() { - const lens = this.getCurveLengths(); + _proto.getLength = function getLength() { + var lens = this.getCurveLengths(); return lens[lens.length - 1]; } // cacheLengths must be recalculated. + ; - - updateArcLengths() { + _proto.updateArcLengths = function updateArcLengths() { this.needsUpdate = true; this.cacheLengths = null; this.getCurveLengths(); } // Compute lengths and cache them // We cannot overwrite getLengths() because UtoT mapping uses it. + ; - - getCurveLengths() { + _proto.getCurveLengths = function getCurveLengths() { // We use cache values if curves and cache array are same length if (this.cacheLengths && this.cacheLengths.length === this.curves.length) { return this.cacheLengths; @@ -26297,22 +28217,26 @@ // Push sums into cached array - const lengths = []; - let sums = 0; + var lengths = []; + var sums = 0; - for (let i = 0, l = this.curves.length; i < l; i++) { + for (var i = 0, l = this.curves.length; i < l; i++) { sums += this.curves[i].getLength(); lengths.push(sums); } this.cacheLengths = lengths; return lengths; - } + }; + + _proto.getSpacedPoints = function getSpacedPoints(divisions) { + if (divisions === void 0) { + divisions = 40; + } - getSpacedPoints(divisions = 40) { - const points = []; + var points = []; - for (let i = 0; i <= divisions; i++) { + for (var i = 0; i <= divisions; i++) { points.push(this.getPoint(i / divisions)); } @@ -26321,19 +28245,23 @@ } return points; - } + }; + + _proto.getPoints = function getPoints(divisions) { + if (divisions === void 0) { + divisions = 12; + } - getPoints(divisions = 12) { - const points = []; - let last; + var points = []; + var last; - for (let i = 0, curves = this.curves; i < curves.length; i++) { - const curve = curves[i]; - const resolution = curve && curve.isEllipseCurve ? divisions * 2 : curve && (curve.isLineCurve || curve.isLineCurve3) ? 1 : curve && curve.isSplineCurve ? divisions * curve.points.length : divisions; - const pts = curve.getPoints(resolution); + for (var i = 0, curves = this.curves; i < curves.length; i++) { + var curve = curves[i]; + var resolution = curve && curve.isEllipseCurve ? divisions * 2 : curve && (curve.isLineCurve || curve.isLineCurve3) ? 1 : curve && curve.isSplineCurve ? divisions * curve.points.length : divisions; + var pts = curve.getPoints(resolution); - for (let j = 0; j < pts.length; j++) { - const point = pts[j]; + for (var j = 0; j < pts.length; j++) { + var point = pts[j]; if (last && last.equals(point)) continue; // ensures no consecutive points are duplicates points.push(point); @@ -26346,132 +28274,144 @@ } return points; - } + }; + + _proto.copy = function copy(source) { + _Curve.prototype.copy.call(this, source); - copy(source) { - super.copy(source); this.curves = []; - for (let i = 0, l = source.curves.length; i < l; i++) { - const curve = source.curves[i]; + for (var i = 0, l = source.curves.length; i < l; i++) { + var curve = source.curves[i]; this.curves.push(curve.clone()); } this.autoClose = source.autoClose; return this; - } + }; + + _proto.toJSON = function toJSON() { + var data = _Curve.prototype.toJSON.call(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]; + for (var i = 0, l = this.curves.length; i < l; i++) { + var curve = this.curves[i]; data.curves.push(curve.toJSON()); } return data; - } + }; + + _proto.fromJSON = function fromJSON(json) { + _Curve.prototype.fromJSON.call(this, json); - 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]; + for (var i = 0, l = json.curves.length; i < l; i++) { + var curve = json.curves[i]; this.curves.push(new Curves[curve.type]().fromJSON(curve)); } return this; - } + }; - } + return CurvePath; + }(Curve); + + var Path = /*#__PURE__*/function (_CurvePath) { + _inheritsLoose(Path, _CurvePath); + + function Path(points) { + var _this; - class Path extends CurvePath { - constructor(points) { - super(); - this.type = 'Path'; - this.currentPoint = new Vector2(); + _this = _CurvePath.call(this) || this; + _this.type = 'Path'; + _this.currentPoint = new Vector2(); if (points) { - this.setFromPoints(points); + _this.setFromPoints(points); } + + return _this; } - setFromPoints(points) { + var _proto = Path.prototype; + + _proto.setFromPoints = function setFromPoints(points) { this.moveTo(points[0].x, points[0].y); - for (let i = 1, l = points.length; i < l; i++) { + for (var i = 1, l = points.length; i < l; i++) { this.lineTo(points[i].x, points[i].y); } return this; - } + }; - moveTo(x, y) { + _proto.moveTo = function 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)); + _proto.lineTo = function lineTo(x, y) { + var 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)); + _proto.quadraticCurveTo = function quadraticCurveTo(aCPx, aCPy, aX, aY) { + var 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)); + _proto.bezierCurveTo = function bezierCurveTo(aCP1x, aCP1y, aCP2x, aCP2y, aX, aY) { + var 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 + _proto.splineThru = function splineThru(pts /*Array of Vector*/ ) { - const npts = [this.currentPoint.clone()].concat(pts); - const curve = new SplineCurve(npts); + var npts = [this.currentPoint.clone()].concat(pts); + var 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; + _proto.arc = function arc(aX, aY, aRadius, aStartAngle, aEndAngle, aClockwise) { + var x0 = this.currentPoint.x; + var y0 = this.currentPoint.y; this.absarc(aX + x0, aY + y0, aRadius, aStartAngle, aEndAngle, aClockwise); return this; - } + }; - absarc(aX, aY, aRadius, aStartAngle, aEndAngle, aClockwise) { + _proto.absarc = function 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; + _proto.ellipse = function ellipse(aX, aY, xRadius, yRadius, aStartAngle, aEndAngle, aClockwise, aRotation) { + var x0 = this.currentPoint.x; + var 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); + _proto.absellipse = function absellipse(aX, aY, xRadius, yRadius, aStartAngle, aEndAngle, aClockwise, aRotation) { + var 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); + var firstPoint = curve.getPoint(0); if (!firstPoint.equals(this.currentPoint)) { this.lineTo(firstPoint.x, firstPoint.y); @@ -26479,114 +28419,142 @@ } this.curves.push(curve); - const lastPoint = curve.getPoint(1); + var lastPoint = curve.getPoint(1); this.currentPoint.copy(lastPoint); return this; - } + }; + + _proto.copy = function copy(source) { + _CurvePath.prototype.copy.call(this, source); - copy(source) { - super.copy(source); this.currentPoint.copy(source.currentPoint); return this; - } + }; + + _proto.toJSON = function toJSON() { + var data = _CurvePath.prototype.toJSON.call(this); - toJSON() { - const data = super.toJSON(); data.currentPoint = this.currentPoint.toArray(); return data; - } + }; + + _proto.fromJSON = function fromJSON(json) { + _CurvePath.prototype.fromJSON.call(this, json); - fromJSON(json) { - super.fromJSON(json); this.currentPoint.fromArray(json.currentPoint); return this; - } + }; - } + return Path; + }(CurvePath); - class Shape extends Path { - constructor(points) { - super(points); - this.uuid = MathUtils.generateUUID(); - this.type = 'Shape'; - this.holes = []; + var Shape = /*#__PURE__*/function (_Path) { + _inheritsLoose(Shape, _Path); + + function Shape(points) { + var _this; + + _this = _Path.call(this, points) || this; + _this.uuid = MathUtils.generateUUID(); + _this.type = 'Shape'; + _this.holes = []; + return _this; } - getPointsHoles(divisions) { - const holesPts = []; + var _proto = Shape.prototype; + + _proto.getPointsHoles = function getPointsHoles(divisions) { + var holesPts = []; - for (let i = 0, l = this.holes.length; i < l; i++) { + for (var 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) + ; - - extractPoints(divisions) { + _proto.extractPoints = function extractPoints(divisions) { return { shape: this.getPoints(divisions), holes: this.getPointsHoles(divisions) }; - } + }; + + _proto.copy = function copy(source) { + _Path.prototype.copy.call(this, source); - copy(source) { - super.copy(source); this.holes = []; - for (let i = 0, l = source.holes.length; i < l; i++) { - const hole = source.holes[i]; + for (var i = 0, l = source.holes.length; i < l; i++) { + var hole = source.holes[i]; this.holes.push(hole.clone()); } return this; - } + }; + + _proto.toJSON = function toJSON() { + var data = _Path.prototype.toJSON.call(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]; + for (var i = 0, l = this.holes.length; i < l; i++) { + var hole = this.holes[i]; data.holes.push(hole.toJSON()); } return data; - } + }; + + _proto.fromJSON = function fromJSON(json) { + _Path.prototype.fromJSON.call(this, json); - 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]; + for (var i = 0, l = json.holes.length; i < l; i++) { + var hole = json.holes[i]; this.holes.push(new Path().fromJSON(hole)); } return this; - } + }; - } + return Shape; + }(Path); - class Light extends Object3D { - constructor(color, intensity = 1) { - super(); - this.type = 'Light'; - this.color = new Color(color); - this.intensity = intensity; + var Light = /*#__PURE__*/function (_Object3D) { + _inheritsLoose(Light, _Object3D); + + function Light(color, intensity) { + var _this; + + if (intensity === void 0) { + intensity = 1; + } + + _this = _Object3D.call(this) || this; + _this.type = 'Light'; + _this.color = new Color(color); + _this.intensity = intensity; + return _this; } - copy(source) { - super.copy(source); + var _proto = Light.prototype; + + _proto.copy = function copy(source) { + _Object3D.prototype.copy.call(this, source); + this.color.copy(source.color); this.intensity = source.intensity; return this; - } + }; + + _proto.toJSON = function toJSON(meta) { + var data = _Object3D.prototype.toJSON.call(this, meta); - toJSON(meta) { - const data = super.toJSON(meta); data.object.color = this.color.getHex(); data.object.intensity = this.intensity; if (this.groundColor !== undefined) data.object.groundColor = this.groundColor.getHex(); @@ -26596,39 +28564,51 @@ if (this.penumbra !== undefined) data.object.penumbra = this.penumbra; if (this.shadow !== undefined) data.object.shadow = this.shadow.toJSON(); return data; - } + }; - } + return Light; + }(Object3D); Light.prototype.isLight = true; - class HemisphereLight extends Light { - constructor(skyColor, groundColor, intensity) { - super(skyColor, intensity); - this.type = 'HemisphereLight'; - this.position.copy(Object3D.DefaultUp); - this.updateMatrix(); - this.groundColor = new Color(groundColor); + var HemisphereLight = /*#__PURE__*/function (_Light) { + _inheritsLoose(HemisphereLight, _Light); + + function HemisphereLight(skyColor, groundColor, intensity) { + var _this; + + _this = _Light.call(this, skyColor, intensity) || this; + _this.type = 'HemisphereLight'; + + _this.position.copy(Object3D.DefaultUp); + + _this.updateMatrix(); + + _this.groundColor = new Color(groundColor); + return _this; } - copy(source) { + var _proto = HemisphereLight.prototype; + + _proto.copy = function copy(source) { Light.prototype.copy.call(this, source); this.groundColor.copy(source.groundColor); return this; - } + }; - } + return HemisphereLight; + }(Light); HemisphereLight.prototype.isHemisphereLight = true; - const _projScreenMatrix$1 = /*@__PURE__*/new Matrix4(); + var _projScreenMatrix = /*@__PURE__*/new Matrix4(); - const _lightPositionWorld$1 = /*@__PURE__*/new Vector3(); + var _lightPositionWorld = /*@__PURE__*/new Vector3(); - const _lookTarget$1 = /*@__PURE__*/new Vector3(); + var _lookTarget = /*@__PURE__*/new Vector3(); - class LightShadow { - constructor(camera) { + var LightShadow = /*#__PURE__*/function () { + function LightShadow(camera) { this.camera = camera; this.bias = 0; this.normalBias = 0; @@ -26645,58 +28625,60 @@ this._viewports = [new Vector4(0, 0, 1, 1)]; } - getViewportCount() { + var _proto = LightShadow.prototype; + + _proto.getViewportCount = function getViewportCount() { return this._viewportCount; - } + }; - getFrustum() { + _proto.getFrustum = function getFrustum() { return this._frustum; - } + }; - updateMatrices(light) { - const shadowCamera = this.camera; - const shadowMatrix = this.matrix; + _proto.updateMatrices = function updateMatrices(light) { + var shadowCamera = this.camera; + var shadowMatrix = this.matrix; - _lightPositionWorld$1.setFromMatrixPosition(light.matrixWorld); + _lightPositionWorld.setFromMatrixPosition(light.matrixWorld); - shadowCamera.position.copy(_lightPositionWorld$1); + shadowCamera.position.copy(_lightPositionWorld); - _lookTarget$1.setFromMatrixPosition(light.target.matrixWorld); + _lookTarget.setFromMatrixPosition(light.target.matrixWorld); - shadowCamera.lookAt(_lookTarget$1); + shadowCamera.lookAt(_lookTarget); shadowCamera.updateMatrixWorld(); - _projScreenMatrix$1.multiplyMatrices(shadowCamera.projectionMatrix, shadowCamera.matrixWorldInverse); + _projScreenMatrix.multiplyMatrices(shadowCamera.projectionMatrix, shadowCamera.matrixWorldInverse); - this._frustum.setFromProjectionMatrix(_projScreenMatrix$1); + this._frustum.setFromProjectionMatrix(_projScreenMatrix); 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) { + _proto.getViewport = function getViewport(viewportIndex) { return this._viewports[viewportIndex]; - } + }; - getFrameExtents() { + _proto.getFrameExtents = function getFrameExtents() { return this._frameExtents; - } + }; - copy(source) { + _proto.copy = function copy(source) { this.camera = source.camera.clone(); this.bias = source.bias; this.radius = source.radius; this.mapSize.copy(source.mapSize); return this; - } + }; - clone() { + _proto.clone = function clone() { return new this.constructor().copy(this); - } + }; - toJSON() { - const object = {}; + _proto.toJSON = function toJSON() { + var object = {}; if (this.bias !== 0) object.bias = this.bias; if (this.normalBias !== 0) object.normalBias = this.normalBias; if (this.radius !== 1) object.radius = this.radius; @@ -26704,65 +28686,89 @@ object.camera = this.camera.toJSON(false).object; delete object.camera.matrix; return object; + }; + + return LightShadow; + }(); + + var SpotLightShadow = /*#__PURE__*/function (_LightShadow) { + _inheritsLoose(SpotLightShadow, _LightShadow); + + function SpotLightShadow() { + var _this; + + _this = _LightShadow.call(this, new PerspectiveCamera(50, 1, 0.5, 500)) || this; + _this.focus = 1; + return _this; } - } + var _proto = SpotLightShadow.prototype; + + _proto.updateMatrices = function updateMatrices(light) { + var camera = this.camera; + var fov = MathUtils.RAD2DEG * 2 * light.angle * this.focus; + var aspect = this.mapSize.width / this.mapSize.height; + var 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(); + } + + _LightShadow.prototype.updateMatrices.call(this, light); + }; + + return SpotLightShadow; + }(LightShadow); + + SpotLightShadow.prototype.isSpotLightShadow = true; + + var SpotLight = /*#__PURE__*/function (_Light) { + _inheritsLoose(SpotLight, _Light); + + function SpotLight(color, intensity, distance, angle, penumbra, decay) { + var _this; + + if (distance === void 0) { + distance = 0; + } - class SpotLightShadow extends LightShadow { - constructor() { - super(new PerspectiveCamera(50, 1, 0.5, 500)); - this.focus = 1; - } + if (angle === void 0) { + angle = Math.PI / 3; + } - updateMatrices(light) { - const camera = this.camera; - const fov = MathUtils.RAD2DEG * 2 * light.angle * this.focus; - const aspect = this.mapSize.width / this.mapSize.height; - const far = light.distance || camera.far; + if (penumbra === void 0) { + penumbra = 0; + } - if (fov !== camera.fov || aspect !== camera.aspect || far !== camera.far) { - camera.fov = fov; - camera.aspect = aspect; - camera.far = far; - camera.updateProjectionMatrix(); + if (decay === void 0) { + decay = 1; } - super.updateMatrices(light); - } + _this = _Light.call(this, color, intensity) || this; + _this.type = 'SpotLight'; - } + _this.position.copy(Object3D.DefaultUp); - SpotLightShadow.prototype.isSpotLightShadow = true; + _this.updateMatrix(); - class SpotLight extends Light { - constructor(color, intensity, distance = 0, angle = Math.PI / 3, penumbra = 0, decay = 1) { - super(color, intensity); - this.type = 'SpotLight'; - this.position.copy(Object3D.DefaultUp); - this.updateMatrix(); - this.target = new Object3D(); - this.distance = distance; - this.angle = angle; - this.penumbra = penumbra; - this.decay = decay; // for physically correct lights, should be 2. + _this.target = new Object3D(); + _this.distance = distance; + _this.angle = angle; + _this.penumbra = penumbra; + _this.decay = decay; // for physically correct lights, should be 2. - this.shadow = new SpotLightShadow(); + _this.shadow = new SpotLightShadow(); + return _this; } - get power() { - // intensity = power per solid angle. - // ref: equation (17) from https://seblagarde.files.wordpress.com/2015/07/course_notes_moving_frostbite_to_pbr_v32.pdf - return this.intensity * Math.PI; - } + var _proto = SpotLight.prototype; - set power(power) { - // intensity = power per solid angle. - // ref: equation (17) from https://seblagarde.files.wordpress.com/2015/07/course_notes_moving_frostbite_to_pbr_v32.pdf - this.intensity = power / Math.PI; - } + _proto.copy = function copy(source) { + _Light.prototype.copy.call(this, source); - copy(source) { - super.copy(source); this.distance = source.distance; this.angle = source.angle; this.penumbra = source.penumbra; @@ -26770,24 +28776,43 @@ this.target = source.target.clone(); this.shadow = source.shadow.clone(); return this; - } + }; - } + _createClass(SpotLight, [{ + key: "power", + get: function get() { + // intensity = power per solid angle. + // ref: equation (17) from https://seblagarde.files.wordpress.com/2015/07/course_notes_moving_frostbite_to_pbr_v32.pdf + return this.intensity * Math.PI; + }, + set: function set(power) { + // intensity = power per solid angle. + // ref: equation (17) from https://seblagarde.files.wordpress.com/2015/07/course_notes_moving_frostbite_to_pbr_v32.pdf + this.intensity = power / Math.PI; + } + }]); + + return SpotLight; + }(Light); SpotLight.prototype.isSpotLight = true; - const _projScreenMatrix = /*@__PURE__*/new Matrix4(); + var _projScreenMatrix$1 = /*@__PURE__*/new Matrix4(); + + var _lightPositionWorld$1 = /*@__PURE__*/new Vector3(); - const _lightPositionWorld = /*@__PURE__*/new Vector3(); + var _lookTarget$1 = /*@__PURE__*/new Vector3(); - const _lookTarget = /*@__PURE__*/new Vector3(); + var PointLightShadow = /*#__PURE__*/function (_LightShadow) { + _inheritsLoose(PointLightShadow, _LightShadow); - 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 + function PointLightShadow() { + var _this; + + _this = _LightShadow.call(this, new PerspectiveCamera(90, 1, 0.5, 500)) || this; + _this._frameExtents = new Vector2(4, 2); + _this._viewportCount = 6; + _this._viewports = [// These viewports map a cube-map onto a 2D texture with the // following orientation: // // xzXZ @@ -26806,87 +28831,148 @@ 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)]; + _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)]; + return _this; } - updateMatrices(light, viewportIndex = 0) { - const camera = this.camera; - const shadowMatrix = this.matrix; + var _proto = PointLightShadow.prototype; - _lightPositionWorld.setFromMatrixPosition(light.matrixWorld); + _proto.updateMatrices = function updateMatrices(light, viewportIndex) { + if (viewportIndex === void 0) { + viewportIndex = 0; + } + + var camera = this.camera; + var shadowMatrix = this.matrix; + + _lightPositionWorld$1.setFromMatrixPosition(light.matrixWorld); - camera.position.copy(_lightPositionWorld); + camera.position.copy(_lightPositionWorld$1); - _lookTarget.copy(camera.position); + _lookTarget$1.copy(camera.position); - _lookTarget.add(this._cubeDirections[viewportIndex]); + _lookTarget$1.add(this._cubeDirections[viewportIndex]); camera.up.copy(this._cubeUps[viewportIndex]); - camera.lookAt(_lookTarget); + camera.lookAt(_lookTarget$1); camera.updateMatrixWorld(); - shadowMatrix.makeTranslation(-_lightPositionWorld.x, -_lightPositionWorld.y, -_lightPositionWorld.z); + shadowMatrix.makeTranslation(-_lightPositionWorld$1.x, -_lightPositionWorld$1.y, -_lightPositionWorld$1.z); - _projScreenMatrix.multiplyMatrices(camera.projectionMatrix, camera.matrixWorldInverse); + _projScreenMatrix$1.multiplyMatrices(camera.projectionMatrix, camera.matrixWorldInverse); - this._frustum.setFromProjectionMatrix(_projScreenMatrix); - } + this._frustum.setFromProjectionMatrix(_projScreenMatrix$1); + }; - } + return PointLightShadow; + }(LightShadow); PointLightShadow.prototype.isPointLightShadow = true; - class PointLight extends Light { - constructor(color, intensity, distance = 0, decay = 1) { - super(color, intensity); - this.type = 'PointLight'; - this.distance = distance; - this.decay = decay; // for physically correct lights, should be 2. + var PointLight = /*#__PURE__*/function (_Light) { + _inheritsLoose(PointLight, _Light); - this.shadow = new PointLightShadow(); - } + function PointLight(color, intensity, distance, decay) { + var _this; - get power() { - // intensity = power per solid angle. - // ref: equation (15) from https://seblagarde.files.wordpress.com/2015/07/course_notes_moving_frostbite_to_pbr_v32.pdf - return this.intensity * 4 * Math.PI; - } + if (distance === void 0) { + distance = 0; + } + + if (decay === void 0) { + decay = 1; + } + + _this = _Light.call(this, color, intensity) || this; + _this.type = 'PointLight'; + _this.distance = distance; + _this.decay = decay; // for physically correct lights, should be 2. - set power(power) { - // intensity = power per solid angle. - // ref: equation (15) from https://seblagarde.files.wordpress.com/2015/07/course_notes_moving_frostbite_to_pbr_v32.pdf - this.intensity = power / (4 * Math.PI); + _this.shadow = new PointLightShadow(); + return _this; } - copy(source) { - super.copy(source); + var _proto = PointLight.prototype; + + _proto.copy = function copy(source) { + _Light.prototype.copy.call(this, source); + this.distance = source.distance; this.decay = source.decay; this.shadow = source.shadow.clone(); return this; - } + }; - } + _createClass(PointLight, [{ + key: "power", + get: function get() { + // intensity = power per solid angle. + // ref: equation (15) from https://seblagarde.files.wordpress.com/2015/07/course_notes_moving_frostbite_to_pbr_v32.pdf + return this.intensity * 4 * Math.PI; + }, + set: function set(power) { + // intensity = power per solid angle. + // ref: equation (15) from https://seblagarde.files.wordpress.com/2015/07/course_notes_moving_frostbite_to_pbr_v32.pdf + this.intensity = power / (4 * Math.PI); + } + }]); + + return PointLight; + }(Light); PointLight.prototype.isPointLight = true; - class OrthographicCamera extends Camera { - constructor(left = -1, right = 1, top = 1, bottom = -1, near = 0.1, far = 2000) { - super(); - this.type = 'OrthographicCamera'; - this.zoom = 1; - this.view = null; - this.left = left; - this.right = right; - this.top = top; - this.bottom = bottom; - this.near = near; - this.far = far; - this.updateProjectionMatrix(); + var OrthographicCamera = /*#__PURE__*/function (_Camera) { + _inheritsLoose(OrthographicCamera, _Camera); + + function OrthographicCamera(left, right, top, bottom, near, far) { + var _this; + + if (left === void 0) { + left = -1; + } + + if (right === void 0) { + right = 1; + } + + if (top === void 0) { + top = 1; + } + + if (bottom === void 0) { + bottom = -1; + } + + if (near === void 0) { + near = 0.1; + } + + if (far === void 0) { + far = 2000; + } + + _this = _Camera.call(this) || this; + _this.type = 'OrthographicCamera'; + _this.zoom = 1; + _this.view = null; + _this.left = left; + _this.right = right; + _this.top = top; + _this.bottom = bottom; + _this.near = near; + _this.far = far; + + _this.updateProjectionMatrix(); + + return _this; } - copy(source, recursive) { - super.copy(source, recursive); + var _proto = OrthographicCamera.prototype; + + _proto.copy = function copy(source, recursive) { + _Camera.prototype.copy.call(this, source, recursive); + this.left = source.left; this.right = source.right; this.top = source.top; @@ -26896,9 +28982,9 @@ this.zoom = source.zoom; this.view = source.view === null ? null : Object.assign({}, source.view); return this; - } + }; - setViewOffset(fullWidth, fullHeight, x, y, width, height) { + _proto.setViewOffset = function setViewOffset(fullWidth, fullHeight, x, y, width, height) { if (this.view === null) { this.view = { enabled: true, @@ -26919,29 +29005,29 @@ this.view.width = width; this.view.height = height; this.updateProjectionMatrix(); - } + }; - clearViewOffset() { + _proto.clearViewOffset = function 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); - const cx = (this.right + this.left) / 2; - const cy = (this.top + this.bottom) / 2; - let left = cx - dx; - let right = cx + dx; - let top = cy + dy; - let bottom = cy - dy; + _proto.updateProjectionMatrix = function updateProjectionMatrix() { + var dx = (this.right - this.left) / (2 * this.zoom); + var dy = (this.top - this.bottom) / (2 * this.zoom); + var cx = (this.right + this.left) / 2; + var cy = (this.top + this.bottom) / 2; + var left = cx - dx; + var right = cx + dx; + var top = cy + dy; + var 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; + var scaleW = (this.right - this.left) / this.view.fullWidth / this.zoom; + var scaleH = (this.top - this.bottom) / this.view.fullHeight / this.zoom; left += scaleW * this.view.offsetX; right = left + scaleW * this.view.width; top -= scaleH * this.view.offsetY; @@ -26950,10 +29036,10 @@ this.projectionMatrix.makeOrthographic(left, right, top, bottom, this.near, this.far); this.projectionMatrixInverse.copy(this.projectionMatrix).invert(); - } + }; - toJSON(meta) { - const data = Object3D.prototype.toJSON.call(this, meta); + _proto.toJSON = function toJSON(meta) { + var data = Object3D.prototype.toJSON.call(this, meta); data.object.zoom = this.zoom; data.object.left = this.left; data.object.right = this.right; @@ -26963,75 +29049,115 @@ data.object.far = this.far; if (this.view !== null) data.object.view = Object.assign({}, this.view); return data; - } + }; - } + return OrthographicCamera; + }(Camera); OrthographicCamera.prototype.isOrthographicCamera = true; - class DirectionalLightShadow extends LightShadow { - constructor() { - super(new OrthographicCamera(-5, 5, 5, -5, 0.5, 500)); + var DirectionalLightShadow = /*#__PURE__*/function (_LightShadow) { + _inheritsLoose(DirectionalLightShadow, _LightShadow); + + function DirectionalLightShadow() { + return _LightShadow.call(this, new OrthographicCamera(-5, 5, 5, -5, 0.5, 500)) || this; } - } + return DirectionalLightShadow; + }(LightShadow); DirectionalLightShadow.prototype.isDirectionalLightShadow = true; - class DirectionalLight extends Light { - constructor(color, intensity) { - super(color, intensity); - this.type = 'DirectionalLight'; - this.position.copy(Object3D.DefaultUp); - this.updateMatrix(); - this.target = new Object3D(); - this.shadow = new DirectionalLightShadow(); + var DirectionalLight = /*#__PURE__*/function (_Light) { + _inheritsLoose(DirectionalLight, _Light); + + function DirectionalLight(color, intensity) { + var _this; + + _this = _Light.call(this, color, intensity) || this; + _this.type = 'DirectionalLight'; + + _this.position.copy(Object3D.DefaultUp); + + _this.updateMatrix(); + + _this.target = new Object3D(); + _this.shadow = new DirectionalLightShadow(); + return _this; } - copy(source) { - super.copy(source); + var _proto = DirectionalLight.prototype; + + _proto.copy = function copy(source) { + _Light.prototype.copy.call(this, source); + this.target = source.target.clone(); this.shadow = source.shadow.clone(); return this; - } + }; - } + return DirectionalLight; + }(Light); DirectionalLight.prototype.isDirectionalLight = true; - class AmbientLight extends Light { - constructor(color, intensity) { - super(color, intensity); - this.type = 'AmbientLight'; + var AmbientLight = /*#__PURE__*/function (_Light) { + _inheritsLoose(AmbientLight, _Light); + + function AmbientLight(color, intensity) { + var _this; + + _this = _Light.call(this, color, intensity) || this; + _this.type = 'AmbientLight'; + return _this; } - } + return AmbientLight; + }(Light); AmbientLight.prototype.isAmbientLight = true; - class RectAreaLight extends Light { - constructor(color, intensity, width = 10, height = 10) { - super(color, intensity); - this.type = 'RectAreaLight'; - this.width = width; - this.height = height; + var RectAreaLight = /*#__PURE__*/function (_Light) { + _inheritsLoose(RectAreaLight, _Light); + + function RectAreaLight(color, intensity, width, height) { + var _this; + + if (width === void 0) { + width = 10; + } + + if (height === void 0) { + height = 10; + } + + _this = _Light.call(this, color, intensity) || this; + _this.type = 'RectAreaLight'; + _this.width = width; + _this.height = height; + return _this; } - copy(source) { - super.copy(source); + var _proto = RectAreaLight.prototype; + + _proto.copy = function copy(source) { + _Light.prototype.copy.call(this, source); + this.width = source.width; this.height = source.height; return this; - } + }; + + _proto.toJSON = function toJSON(meta) { + var data = _Light.prototype.toJSON.call(this, meta); - toJSON(meta) { - const data = super.toJSON(meta); data.object.width = this.width; data.object.height = this.height; return data; - } + }; - } + return RectAreaLight; + }(Light); RectAreaLight.prototype.isRectAreaLight = true; @@ -27044,39 +29170,41 @@ */ // 3-band SH defined by 9 coefficients - class SphericalHarmonics3 { - constructor() { + var SphericalHarmonics3 = /*#__PURE__*/function () { + function SphericalHarmonics3() { this.coefficients = []; - for (let i = 0; i < 9; i++) { + for (var i = 0; i < 9; i++) { this.coefficients.push(new Vector3()); } } - set(coefficients) { - for (let i = 0; i < 9; i++) { + var _proto = SphericalHarmonics3.prototype; + + _proto.set = function set(coefficients) { + for (var i = 0; i < 9; i++) { this.coefficients[i].copy(coefficients[i]); } return this; - } + }; - zero() { - for (let i = 0; i < 9; i++) { + _proto.zero = function zero() { + for (var 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 + ; - - getAt(normal, target) { + _proto.getAt = function 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 + var x = normal.x, + y = normal.y, + z = normal.z; + var coeff = this.coefficients; // band 0 target.copy(coeff[0]).multiplyScalar(0.282095); // band 1 @@ -27093,14 +29221,14 @@ } // 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) { + _proto.getIrradianceAt = function 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 + var x = normal.x, + y = normal.y, + z = normal.z; + var coeff = this.coefficients; // band 0 target.copy(coeff[0]).multiplyScalar(0.886227); // π * 0.282095 // band 1 @@ -27119,85 +29247,97 @@ target.addScaledVector(coeff[8], 0.429043 * (x * x - y * y)); // ( π / 4 ) * 0.546274 return target; - } + }; - add(sh) { - for (let i = 0; i < 9; i++) { + _proto.add = function add(sh) { + for (var i = 0; i < 9; i++) { this.coefficients[i].add(sh.coefficients[i]); } return this; - } + }; - addScaledSH(sh, s) { - for (let i = 0; i < 9; i++) { + _proto.addScaledSH = function addScaledSH(sh, s) { + for (var i = 0; i < 9; i++) { this.coefficients[i].addScaledVector(sh.coefficients[i], s); } return this; - } + }; - scale(s) { - for (let i = 0; i < 9; i++) { + _proto.scale = function scale(s) { + for (var i = 0; i < 9; i++) { this.coefficients[i].multiplyScalar(s); } return this; - } + }; - lerp(sh, alpha) { - for (let i = 0; i < 9; i++) { + _proto.lerp = function lerp(sh, alpha) { + for (var i = 0; i < 9; i++) { this.coefficients[i].lerp(sh.coefficients[i], alpha); } return this; - } + }; - equals(sh) { - for (let i = 0; i < 9; i++) { + _proto.equals = function equals(sh) { + for (var i = 0; i < 9; i++) { if (!this.coefficients[i].equals(sh.coefficients[i])) { return false; } } return true; - } + }; - copy(sh) { + _proto.copy = function copy(sh) { return this.set(sh.coefficients); - } + }; - clone() { + _proto.clone = function clone() { return new this.constructor().copy(this); - } + }; - fromArray(array, offset = 0) { - const coefficients = this.coefficients; + _proto.fromArray = function fromArray(array, offset) { + if (offset === void 0) { + offset = 0; + } - for (let i = 0; i < 9; i++) { + var coefficients = this.coefficients; + + for (var i = 0; i < 9; i++) { coefficients[i].fromArray(array, offset + i * 3); } return this; - } + }; + + _proto.toArray = function toArray(array, offset) { + if (array === void 0) { + array = []; + } + + if (offset === void 0) { + offset = 0; + } - toArray(array = [], offset = 0) { - const coefficients = this.coefficients; + var coefficients = this.coefficients; - for (let i = 0; i < 9; i++) { + for (var i = 0; i < 9; i++) { coefficients[i].toArray(array, offset + i * 3); } return array; } // evaluate the basis functions // shBasis is an Array[ 9 ] + ; - - static getBasisAt(normal, shBasis) { + SphericalHarmonics3.getBasisAt = function getBasisAt(normal, shBasis) { // normal is assumed to be unit length - const x = normal.x, - y = normal.y, - z = normal.z; // band 0 + var x = normal.x, + y = normal.y, + z = normal.z; // band 0 shBasis[0] = 0.282095; // band 1 @@ -27210,50 +29350,76 @@ shBasis[6] = 0.315392 * (3 * z * z - 1); shBasis[7] = 1.092548 * x * z; shBasis[8] = 0.546274 * (x * x - y * y); - } + }; - } + return SphericalHarmonics3; + }(); SphericalHarmonics3.prototype.isSphericalHarmonics3 = true; - class LightProbe extends Light { - constructor(sh = new SphericalHarmonics3(), intensity = 1) { - super(undefined, intensity); - this.sh = sh; + var LightProbe = /*#__PURE__*/function (_Light) { + _inheritsLoose(LightProbe, _Light); + + function LightProbe(sh, intensity) { + var _this; + + if (sh === void 0) { + sh = new SphericalHarmonics3(); + } + + if (intensity === void 0) { + intensity = 1; + } + + _this = _Light.call(this, undefined, intensity) || this; + _this.sh = sh; + return _this; } - copy(source) { - super.copy(source); + var _proto = LightProbe.prototype; + + _proto.copy = function copy(source) { + _Light.prototype.copy.call(this, source); + this.sh.copy(source.sh); return this; - } + }; - fromJSON(json) { + _proto.fromJSON = function fromJSON(json) { this.intensity = json.intensity; // TODO: Move this bit to Light.fromJSON(); this.sh.fromArray(json.sh); return this; - } + }; + + _proto.toJSON = function toJSON(meta) { + var data = _Light.prototype.toJSON.call(this, meta); - toJSON(meta) { - const data = super.toJSON(meta); data.object.sh = this.sh.toArray(); return data; - } + }; - } + return LightProbe; + }(Light); LightProbe.prototype.isLightProbe = true; - class MaterialLoader extends Loader { - constructor(manager) { - super(manager); - this.textures = {}; + var MaterialLoader = /*#__PURE__*/function (_Loader) { + _inheritsLoose(MaterialLoader, _Loader); + + function MaterialLoader(manager) { + var _this; + + _this = _Loader.call(this, manager) || this; + _this.textures = {}; + return _this; } - load(url, onLoad, onProgress, onError) { - const scope = this; - const loader = new FileLoader(scope.manager); + var _proto = MaterialLoader.prototype; + + _proto.load = function load(url, onLoad, onProgress, onError) { + var scope = this; + var loader = new FileLoader(scope.manager); loader.setPath(scope.path); loader.setRequestHeader(scope.requestHeader); loader.setWithCredentials(scope.withCredentials); @@ -27270,10 +29436,10 @@ scope.manager.itemError(url); } }, onProgress, onError); - } + }; - parse(json) { - const textures = this.textures; + _proto.parse = function parse(json) { + var textures = this.textures; function getTexture(name) { if (textures[name] === undefined) { @@ -27283,7 +29449,7 @@ return textures[name]; } - const material = new Materials[json.type](); + var material = new Materials[json.type](); if (json.uuid !== undefined) material.uuid = json.uuid; if (json.name !== undefined) material.name = json.name; if (json.color !== undefined && material.color !== undefined) material.color.setHex(json.color); @@ -27348,8 +29514,8 @@ if (json.uniforms !== undefined) { - for (const name in json.uniforms) { - const uniform = json.uniforms[name]; + for (var name in json.uniforms) { + var uniform = json.uniforms[name]; material.uniforms[name] = {}; switch (uniform.type) { @@ -27392,7 +29558,7 @@ if (json.fragmentShader !== undefined) material.fragmentShader = json.fragmentShader; if (json.extensions !== undefined) { - for (const key in json.extensions) { + for (var key in json.extensions) { material.extensions[key] = json.extensions[key]; } } // Deprecated @@ -27413,7 +29579,7 @@ if (json.normalMapType !== undefined) material.normalMapType = json.normalMapType; if (json.normalScale !== undefined) { - let normalScale = json.normalScale; + var normalScale = json.normalScale; if (Array.isArray(normalScale) === false) { // Blender exporter used to export a scalar. See #7459 @@ -27447,26 +29613,27 @@ if (json.transmission !== undefined) material.transmission = json.transmission; if (json.transmissionMap !== undefined) material.transmissionMap = getTexture(json.transmissionMap); return material; - } + }; - setTextures(value) { + _proto.setTextures = function setTextures(value) { this.textures = value; return this; - } + }; - } + return MaterialLoader; + }(Loader); - const LoaderUtils = { - decodeText: function (array) { + var LoaderUtils = { + decodeText: function 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. - let s = ''; + var s = ''; - for (let i = 0, il = array.length; i < il; i++) { + for (var i = 0, il = array.length; i < il; i++) { // Implicitly assumes little-endian. s += String.fromCharCode(array[i]); } @@ -27479,8 +29646,8 @@ return s; } }, - extractUrlBase: function (url) { - const index = url.lastIndexOf('/'); + extractUrlBase: function extractUrlBase(url) { + var index = url.lastIndexOf('/'); if (index === -1) return './'; return url.substr(0, index + 1); } @@ -27495,16 +29662,16 @@ InstancedBufferGeometry.prototype = Object.assign(Object.create(BufferGeometry.prototype), { constructor: InstancedBufferGeometry, isInstancedBufferGeometry: true, - copy: function (source) { + copy: function copy(source) { BufferGeometry.prototype.copy.call(this, source); this.instanceCount = source.instanceCount; return this; }, - clone: function () { + clone: function clone() { return new this.constructor().copy(this); }, - toJSON: function () { - const data = BufferGeometry.prototype.toJSON.call(this); + toJSON: function toJSON() { + var data = BufferGeometry.prototype.toJSON.call(this); data.instanceCount = this.instanceCount; data.isInstancedBufferGeometry = true; return data; @@ -27525,27 +29692,31 @@ InstancedBufferAttribute.prototype = Object.assign(Object.create(BufferAttribute.prototype), { constructor: InstancedBufferAttribute, isInstancedBufferAttribute: true, - copy: function (source) { + copy: function copy(source) { BufferAttribute.prototype.copy.call(this, source); this.meshPerAttribute = source.meshPerAttribute; return this; }, - toJSON: function () { - const data = BufferAttribute.prototype.toJSON.call(this); + toJSON: function toJSON() { + var data = BufferAttribute.prototype.toJSON.call(this); data.meshPerAttribute = this.meshPerAttribute; data.isInstancedBufferAttribute = true; return data; } }); - class BufferGeometryLoader extends Loader { - constructor(manager) { - super(manager); + var BufferGeometryLoader = /*#__PURE__*/function (_Loader) { + _inheritsLoose(BufferGeometryLoader, _Loader); + + function BufferGeometryLoader(manager) { + return _Loader.call(this, manager) || this; } - load(url, onLoad, onProgress, onError) { - const scope = this; - const loader = new FileLoader(scope.manager); + var _proto = BufferGeometryLoader.prototype; + + _proto.load = function load(url, onLoad, onProgress, onError) { + var scope = this; + var loader = new FileLoader(scope.manager); loader.setPath(scope.path); loader.setRequestHeader(scope.requestHeader); loader.setWithCredentials(scope.withCredentials); @@ -27562,19 +29733,19 @@ scope.manager.itemError(url); } }, onProgress, onError); - } + }; - parse(json) { - const interleavedBufferMap = {}; - const arrayBufferMap = {}; + _proto.parse = function parse(json) { + var interleavedBufferMap = {}; + var arrayBufferMap = {}; function getInterleavedBuffer(json, uuid) { if (interleavedBufferMap[uuid] !== undefined) return interleavedBufferMap[uuid]; - const interleavedBuffers = json.interleavedBuffers; - const interleavedBuffer = interleavedBuffers[uuid]; - const buffer = getArrayBuffer(json, interleavedBuffer.buffer); - const array = getTypedArray(interleavedBuffer.type, buffer); - const ib = new InterleavedBuffer(array, interleavedBuffer.stride); + var interleavedBuffers = json.interleavedBuffers; + var interleavedBuffer = interleavedBuffers[uuid]; + var buffer = getArrayBuffer(json, interleavedBuffer.buffer); + var array = getTypedArray(interleavedBuffer.type, buffer); + var ib = new InterleavedBuffer(array, interleavedBuffer.stride); ib.uuid = interleavedBuffer.uuid; interleavedBufferMap[uuid] = ib; return ib; @@ -27582,34 +29753,35 @@ function getArrayBuffer(json, uuid) { if (arrayBufferMap[uuid] !== undefined) return arrayBufferMap[uuid]; - const arrayBuffers = json.arrayBuffers; - const arrayBuffer = arrayBuffers[uuid]; - const ab = new Uint32Array(arrayBuffer).buffer; + var arrayBuffers = json.arrayBuffers; + var arrayBuffer = arrayBuffers[uuid]; + var ab = new Uint32Array(arrayBuffer).buffer; arrayBufferMap[uuid] = ab; return ab; } - const geometry = json.isInstancedBufferGeometry ? new InstancedBufferGeometry() : new BufferGeometry(); - const index = json.data.index; + var geometry = json.isInstancedBufferGeometry ? new InstancedBufferGeometry() : new BufferGeometry(); + var index = json.data.index; if (index !== undefined) { - const typedArray = getTypedArray(index.type, index.array); + var typedArray = getTypedArray(index.type, index.array); geometry.setIndex(new BufferAttribute(typedArray, 1)); } - const attributes = json.data.attributes; + var attributes = json.data.attributes; - for (const key in attributes) { - const attribute = attributes[key]; - let bufferAttribute; + for (var key in attributes) { + var attribute = attributes[key]; + var bufferAttribute = void 0; if (attribute.isInterleavedBufferAttribute) { - const interleavedBuffer = getInterleavedBuffer(json.data, attribute.data); + var interleavedBuffer = getInterleavedBuffer(json.data, attribute.data); bufferAttribute = new InterleavedBufferAttribute(interleavedBuffer, attribute.itemSize, attribute.offset, attribute.normalized); } else { - const typedArray = getTypedArray(attribute.type, attribute.array); - const bufferAttributeConstr = attribute.isInstancedBufferAttribute ? InstancedBufferAttribute : BufferAttribute; - bufferAttribute = new bufferAttributeConstr(typedArray, attribute.itemSize, attribute.normalized); + var _typedArray = getTypedArray(attribute.type, attribute.array); + + var bufferAttributeConstr = attribute.isInstancedBufferAttribute ? InstancedBufferAttribute : BufferAttribute; + bufferAttribute = new bufferAttributeConstr(_typedArray, attribute.itemSize, attribute.normalized); } if (attribute.name !== undefined) bufferAttribute.name = attribute.name; @@ -27623,52 +29795,55 @@ geometry.setAttribute(key, bufferAttribute); } - const morphAttributes = json.data.morphAttributes; + var morphAttributes = json.data.morphAttributes; if (morphAttributes) { - for (const key in morphAttributes) { - const attributeArray = morphAttributes[key]; - const array = []; + for (var _key in morphAttributes) { + var attributeArray = morphAttributes[_key]; + var array = []; + + for (var i = 0, il = attributeArray.length; i < il; i++) { + var _attribute = attributeArray[i]; - for (let i = 0, il = attributeArray.length; i < il; i++) { - const attribute = attributeArray[i]; - let bufferAttribute; + var _bufferAttribute = void 0; - if (attribute.isInterleavedBufferAttribute) { - const interleavedBuffer = getInterleavedBuffer(json.data, attribute.data); - bufferAttribute = new InterleavedBufferAttribute(interleavedBuffer, attribute.itemSize, attribute.offset, attribute.normalized); + if (_attribute.isInterleavedBufferAttribute) { + var _interleavedBuffer = getInterleavedBuffer(json.data, _attribute.data); + + _bufferAttribute = new InterleavedBufferAttribute(_interleavedBuffer, _attribute.itemSize, _attribute.offset, _attribute.normalized); } else { - const typedArray = getTypedArray(attribute.type, attribute.array); - bufferAttribute = new BufferAttribute(typedArray, attribute.itemSize, attribute.normalized); + var _typedArray2 = getTypedArray(_attribute.type, _attribute.array); + + _bufferAttribute = new BufferAttribute(_typedArray2, _attribute.itemSize, _attribute.normalized); } - if (attribute.name !== undefined) bufferAttribute.name = attribute.name; - array.push(bufferAttribute); + if (_attribute.name !== undefined) _bufferAttribute.name = _attribute.name; + array.push(_bufferAttribute); } - geometry.morphAttributes[key] = array; + geometry.morphAttributes[_key] = array; } } - const morphTargetsRelative = json.data.morphTargetsRelative; + var morphTargetsRelative = json.data.morphTargetsRelative; if (morphTargetsRelative) { geometry.morphTargetsRelative = true; } - const groups = json.data.groups || json.data.drawcalls || json.data.offsets; + var 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]; + for (var _i = 0, n = groups.length; _i !== n; ++_i) { + var group = groups[_i]; geometry.addGroup(group.start, group.count, group.materialIndex); } } - const boundingSphere = json.data.boundingSphere; + var boundingSphere = json.data.boundingSphere; if (boundingSphere !== undefined) { - const center = new Vector3(); + var center = new Vector3(); if (boundingSphere.center !== undefined) { center.fromArray(boundingSphere.center); @@ -27680,25 +29855,30 @@ if (json.name) geometry.name = json.name; if (json.userData) geometry.userData = json.userData; return geometry; - } + }; - } + return BufferGeometryLoader; + }(Loader); + + var ObjectLoader = /*#__PURE__*/function (_Loader) { + _inheritsLoose(ObjectLoader, _Loader); - class ObjectLoader extends Loader { - constructor(manager) { - super(manager); + function ObjectLoader(manager) { + return _Loader.call(this, manager) || this; } - load(url, onLoad, onProgress, onError) { - const scope = this; - const path = this.path === '' ? LoaderUtils.extractUrlBase(url) : this.path; + var _proto = ObjectLoader.prototype; + + _proto.load = function load(url, onLoad, onProgress, onError) { + var scope = this; + var path = this.path === '' ? LoaderUtils.extractUrlBase(url) : this.path; this.resourcePath = this.resourcePath || path; - const loader = new FileLoader(this.manager); + var loader = new FileLoader(this.manager); loader.setPath(this.path); loader.setRequestHeader(this.requestHeader); loader.setWithCredentials(this.withCredentials); loader.load(url, function (text) { - let json = null; + var json = null; try { json = JSON.parse(text); @@ -27708,7 +29888,7 @@ return; } - const metadata = json.metadata; + var metadata = json.metadata; if (metadata === undefined || metadata.type === undefined || metadata.type.toLowerCase() === 'geometry') { console.error('THREE.ObjectLoader: Can\'t load ' + url); @@ -27717,25 +29897,25 @@ scope.parse(json, onLoad); }, onProgress, onError); - } + }; - parse(json, onLoad) { - const animations = this.parseAnimations(json.animations); - const shapes = this.parseShapes(json.shapes); - const geometries = this.parseGeometries(json.geometries, shapes); - const images = this.parseImages(json.images, function () { + _proto.parse = function parse(json, onLoad) { + var animations = this.parseAnimations(json.animations); + var shapes = this.parseShapes(json.shapes); + var geometries = this.parseGeometries(json.geometries, shapes); + var images = this.parseImages(json.images, function () { if (onLoad !== undefined) onLoad(object); }); - const textures = this.parseTextures(json.textures, images); - const materials = this.parseMaterials(json.materials, textures); - const object = this.parseObject(json.object, geometries, materials, animations); - const skeletons = this.parseSkeletons(json.skeletons, object); + var textures = this.parseTextures(json.textures, images); + var materials = this.parseMaterials(json.materials, textures); + var object = this.parseObject(json.object, geometries, materials, animations); + var skeletons = this.parseSkeletons(json.skeletons, object); this.bindSkeletons(object, skeletons); // if (onLoad !== undefined) { - let hasImages = false; + var hasImages = false; - for (const uuid in images) { + for (var uuid in images) { if (images[uuid] instanceof HTMLImageElement) { hasImages = true; break; @@ -27746,49 +29926,49 @@ } return object; - } + }; - parseShapes(json) { - const shapes = {}; + _proto.parseShapes = function parseShapes(json) { + var shapes = {}; if (json !== undefined) { - for (let i = 0, l = json.length; i < l; i++) { - const shape = new Shape().fromJSON(json[i]); + for (var i = 0, l = json.length; i < l; i++) { + var shape = new Shape().fromJSON(json[i]); shapes[shape.uuid] = shape; } } return shapes; - } + }; - parseSkeletons(json, object) { - const skeletons = {}; - const bones = {}; // generate bone lookup table + _proto.parseSkeletons = function parseSkeletons(json, object) { + var skeletons = {}; + var bones = {}; // generate bone lookup table object.traverse(function (child) { if (child.isBone) bones[child.uuid] = child; }); // create skeletons if (json !== undefined) { - for (let i = 0, l = json.length; i < l; i++) { - const skeleton = new Skeleton().fromJSON(json[i], bones); + for (var i = 0, l = json.length; i < l; i++) { + var skeleton = new Skeleton().fromJSON(json[i], bones); skeletons[skeleton.uuid] = skeleton; } } return skeletons; - } + }; - parseGeometries(json, shapes) { - const geometries = {}; - let geometryShapes; + _proto.parseGeometries = function parseGeometries(json, shapes) { + var geometries = {}; + var geometryShapes; if (json !== undefined) { - const bufferGeometryLoader = new BufferGeometryLoader(); + var bufferGeometryLoader = new BufferGeometryLoader(); - for (let i = 0, l = json.length; i < l; i++) { - let geometry; - const data = json[i]; + for (var i = 0, l = json.length; i < l; i++) { + var geometry = void 0; + var data = json[i]; switch (data.type) { case 'PlaneGeometry': @@ -27868,8 +30048,8 @@ case 'ShapeBufferGeometry': geometryShapes = []; - for (let j = 0, jl = data.shapes.length; j < jl; j++) { - const shape = shapes[data.shapes[j]]; + for (var j = 0, jl = data.shapes.length; j < jl; j++) { + var shape = shapes[data.shapes[j]]; geometryShapes.push(shape); } @@ -27880,12 +30060,12 @@ case 'ExtrudeBufferGeometry': geometryShapes = []; - for (let j = 0, jl = data.shapes.length; j < jl; j++) { - const shape = shapes[data.shapes[j]]; - geometryShapes.push(shape); + for (var _j = 0, _jl = data.shapes.length; _j < _jl; _j++) { + var _shape = shapes[data.shapes[_j]]; + geometryShapes.push(_shape); } - const extrudePath = data.options.extrudePath; + var extrudePath = data.options.extrudePath; if (extrudePath !== undefined) { data.options.extrudePath = new Curves[extrudePath.type]().fromJSON(extrudePath); @@ -27916,26 +30096,26 @@ } return geometries; - } + }; - parseMaterials(json, textures) { - const cache = {}; // MultiMaterial + _proto.parseMaterials = function parseMaterials(json, textures) { + var cache = {}; // MultiMaterial - const materials = {}; + var materials = {}; if (json !== undefined) { - const loader = new MaterialLoader(); + var loader = new MaterialLoader(); loader.setTextures(textures); - for (let i = 0, l = json.length; i < l; i++) { - const data = json[i]; + for (var i = 0, l = json.length; i < l; i++) { + var data = json[i]; if (data.type === 'MultiMaterial') { // Deprecated - const array = []; + var array = []; - for (let j = 0; j < data.materials.length; j++) { - const material = data.materials[j]; + for (var j = 0; j < data.materials.length; j++) { + var material = data.materials[j]; if (cache[material.uuid] === undefined) { cache[material.uuid] = loader.parse(material); @@ -27956,26 +30136,26 @@ } return materials; - } + }; - parseAnimations(json) { - const animations = {}; + _proto.parseAnimations = function parseAnimations(json) { + var animations = {}; if (json !== undefined) { - for (let i = 0; i < json.length; i++) { - const data = json[i]; - const clip = AnimationClip.parse(data); + for (var i = 0; i < json.length; i++) { + var data = json[i]; + var clip = AnimationClip.parse(data); animations[clip.uuid] = clip; } } return animations; - } + }; - parseImages(json, onLoad) { - const scope = this; - const images = {}; - let loader; + _proto.parseImages = function parseImages(json, onLoad) { + var scope = this; + var images = {}; + var loader; function loadImage(url) { scope.manager.itemStart(url); @@ -27989,8 +30169,8 @@ function deserializeImage(image) { if (typeof image === 'string') { - const url = image; - const path = /^(\/\/)|([a-z]+:(\/\/)?)/i.test(url) ? url : scope.resourcePath + url; + var url = image; + var path = /^(\/\/)|([a-z]+:(\/\/)?)/i.test(url) ? url : scope.resourcePath + url; return loadImage(path); } else { if (image.data) { @@ -28006,21 +30186,21 @@ } if (json !== undefined && json.length > 0) { - const manager = new LoadingManager(onLoad); + var 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; + for (var i = 0, il = json.length; i < il; i++) { + var image = json[i]; + var url = image.url; if (Array.isArray(url)) { // load array of images e.g CubeTexture images[image.uuid] = []; - for (let j = 0, jl = url.length; j < jl; j++) { - const currentUrl = url[j]; - const deserializedImage = deserializeImage(currentUrl); + for (var j = 0, jl = url.length; j < jl; j++) { + var currentUrl = url[j]; + var deserializedImage = deserializeImage(currentUrl); if (deserializedImage !== null) { if (deserializedImage instanceof HTMLImageElement) { @@ -28033,30 +30213,30 @@ } } else { // load single image - const deserializedImage = deserializeImage(image.url); + var _deserializedImage = deserializeImage(image.url); - if (deserializedImage !== null) { - images[image.uuid] = deserializedImage; + if (_deserializedImage !== null) { + images[image.uuid] = _deserializedImage; } } } } return images; - } + }; - parseTextures(json, images) { + _proto.parseTextures = function 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 = {}; + var textures = {}; if (json !== undefined) { - for (let i = 0, l = json.length; i < l; i++) { - const data = json[i]; + for (var i = 0, l = json.length; i < l; i++) { + var data = json[i]; if (data.image === undefined) { console.warn('THREE.ObjectLoader: No "image" specified for', data.uuid); @@ -28066,8 +30246,8 @@ console.warn('THREE.ObjectLoader: Undefined image', data.image); } - let texture; - const image = images[data.image]; + var texture = void 0; + var image = images[data.image]; if (Array.isArray(image)) { texture = new CubeTexture(image); @@ -28109,10 +30289,10 @@ } return textures; - } + }; - parseObject(data, geometries, materials, animations) { - let object; + _proto.parseObject = function parseObject(data, geometries, materials, animations) { + var object; function getGeometry(name) { if (geometries[name] === undefined) { @@ -28126,10 +30306,10 @@ if (name === undefined) return undefined; if (Array.isArray(name)) { - const array = []; + var array = []; - for (let i = 0, l = name.length; i < l; i++) { - const uuid = name[i]; + for (var i = 0, l = name.length; i < l; i++) { + var uuid = name[i]; if (materials[uuid] === undefined) { console.warn('THREE.ObjectLoader: Undefined material', uuid); @@ -28148,7 +30328,7 @@ return materials[name]; } - let geometry, material; + var geometry, material; switch (data.type) { case 'Scene': @@ -28231,8 +30411,8 @@ case 'InstancedMesh': geometry = getGeometry(data.geometry); material = getMaterial(data.material); - const count = data.count; - const instanceMatrix = data.instanceMatrix; + var count = data.count; + var instanceMatrix = data.instanceMatrix; object = new InstancedMesh(geometry, material, count); object.instanceMatrix = new BufferAttribute(new Float32Array(instanceMatrix.array), 16); break; @@ -28306,29 +30486,29 @@ if (data.layers !== undefined) object.layers.mask = data.layers; if (data.children !== undefined) { - const children = data.children; + var children = data.children; - for (let i = 0; i < children.length; i++) { + for (var i = 0; i < children.length; i++) { object.add(this.parseObject(children[i], geometries, materials, animations)); } } if (data.animations !== undefined) { - const objectAnimations = data.animations; + var objectAnimations = data.animations; - for (let i = 0; i < objectAnimations.length; i++) { - const uuid = objectAnimations[i]; + for (var _i = 0; _i < objectAnimations.length; _i++) { + var uuid = objectAnimations[_i]; object.animations.push(animations[uuid]); } } if (data.type === 'LOD') { if (data.autoUpdate !== undefined) object.autoUpdate = data.autoUpdate; - const levels = data.levels; + var levels = data.levels; - for (let l = 0; l < levels.length; l++) { - const level = levels[l]; - const child = object.getObjectByProperty('uuid', level.object); + for (var l = 0; l < levels.length; l++) { + var level = levels[l]; + var child = object.getObjectByProperty('uuid', level.object); if (child !== undefined) { object.addLevel(child, level.distance); @@ -28337,13 +30517,13 @@ } return object; - } + }; - bindSkeletons(object, skeletons) { + _proto.bindSkeletons = function 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]; + var skeleton = skeletons[child.skeleton]; if (skeleton === undefined) { console.warn('THREE.ObjectLoader: No skeleton found with UUID:', child.skeleton); @@ -28354,16 +30534,17 @@ }); } /* DEPRECATED */ + ; - - setTexturePath(value) { + _proto.setTexturePath = function setTexturePath(value) { console.warn('THREE.ObjectLoader: .setTexturePath() has been renamed to .setResourcePath().'); return this.setResourcePath(value); - } + }; - } + return ObjectLoader; + }(Loader); - const TEXTURE_MAPPING = { + var TEXTURE_MAPPING = { UVMapping: UVMapping, CubeReflectionMapping: CubeReflectionMapping, CubeRefractionMapping: CubeRefractionMapping, @@ -28372,12 +30553,12 @@ CubeUVReflectionMapping: CubeUVReflectionMapping, CubeUVRefractionMapping: CubeUVRefractionMapping }; - const TEXTURE_WRAPPING = { + var TEXTURE_WRAPPING = { RepeatWrapping: RepeatWrapping, ClampToEdgeWrapping: ClampToEdgeWrapping, MirroredRepeatWrapping: MirroredRepeatWrapping }; - const TEXTURE_FILTER = { + var TEXTURE_FILTER = { NearestFilter: NearestFilter, NearestMipmapNearestFilter: NearestMipmapNearestFilter, NearestMipmapLinearFilter: NearestMipmapLinearFilter, @@ -28408,12 +30589,12 @@ this.options = options; return this; }, - load: function (url, onLoad, onProgress, onError) { + load: function 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); + var scope = this; + var cached = Cache.get(url); if (cached !== undefined) { scope.manager.itemStart(url); @@ -28424,7 +30605,7 @@ return cached; } - const fetchOptions = {}; + var fetchOptions = {}; fetchOptions.credentials = this.crossOrigin === 'anonymous' ? 'same-origin' : 'include'; fetchOptions.headers = this.requestHeader; fetch(url, fetchOptions).then(function (res) { @@ -28446,68 +30627,72 @@ } }); - class ShapePath { - constructor() { + var ShapePath = /*#__PURE__*/function () { + function ShapePath() { this.type = 'ShapePath'; this.color = new Color(); this.subPaths = []; this.currentPath = null; } - moveTo(x, y) { + var _proto = ShapePath.prototype; + + _proto.moveTo = function moveTo(x, y) { this.currentPath = new Path(); this.subPaths.push(this.currentPath); this.currentPath.moveTo(x, y); return this; - } + }; - lineTo(x, y) { + _proto.lineTo = function lineTo(x, y) { this.currentPath.lineTo(x, y); return this; - } + }; - quadraticCurveTo(aCPx, aCPy, aX, aY) { + _proto.quadraticCurveTo = function quadraticCurveTo(aCPx, aCPy, aX, aY) { this.currentPath.quadraticCurveTo(aCPx, aCPy, aX, aY); return this; - } + }; - bezierCurveTo(aCP1x, aCP1y, aCP2x, aCP2y, aX, aY) { + _proto.bezierCurveTo = function bezierCurveTo(aCP1x, aCP1y, aCP2x, aCP2y, aX, aY) { this.currentPath.bezierCurveTo(aCP1x, aCP1y, aCP2x, aCP2y, aX, aY); return this; - } + }; - splineThru(pts) { + _proto.splineThru = function splineThru(pts) { this.currentPath.splineThru(pts); return this; - } + }; - toShapes(isCCW, noHoles) { + _proto.toShapes = function toShapes(isCCW, noHoles) { function toShapesNoHoles(inSubpaths) { - const shapes = []; + var shapes = []; + + for (var i = 0, l = inSubpaths.length; i < l; i++) { + var _tmpPath = inSubpaths[i]; - 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); + var _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 + var 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; + var 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; + for (var p = polyLen - 1, q = 0; q < polyLen; p = q++) { + var edgeLowPt = inPolygon[p]; + var edgeHighPt = inPolygon[q]; + var edgeDx = edgeHighPt.x - edgeLowPt.x; + var edgeDy = edgeHighPt.y - edgeLowPt.y; if (Math.abs(edgeDy) > Number.EPSILON) { // not parallel @@ -28524,7 +30709,7 @@ 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); + var perpEdge = edgeDy * (inPt.x - edgeLowPt.x) - edgeDx * (inPt.y - edgeLowPt.y); if (perpEdge === 0) return true; // inPt is on contour ? if (perpEdge < 0) continue; @@ -28543,12 +30728,12 @@ return inside; } - const isClockWise = ShapeUtils.isClockWise; - const subPaths = this.subPaths; + var isClockWise = ShapeUtils.isClockWise; + var subPaths = this.subPaths; if (subPaths.length === 0) return []; if (noHoles === true) return toShapesNoHoles(subPaths); - let solid, tmpPath, tmpShape; - const shapes = []; + var solid, tmpPath, tmpShape; + var shapes = []; if (subPaths.length === 1) { tmpPath = subPaths[0]; @@ -28558,18 +30743,18 @@ return shapes; } - let holesFirst = !isClockWise(subPaths[0].getPoints()); + var holesFirst = !isClockWise(subPaths[0].getPoints()); holesFirst = isCCW ? !holesFirst : holesFirst; // console.log("Holes first", holesFirst); - const betterShapeHoles = []; - const newShapes = []; - let newShapeHoles = []; - let mainIdx = 0; - let tmpPoints; + var betterShapeHoles = []; + var newShapes = []; + var newShapeHoles = []; + var mainIdx = 0; + var tmpPoints; newShapes[mainIdx] = undefined; newShapeHoles[mainIdx] = []; - for (let i = 0, l = subPaths.length; i < l; i++) { + for (var i = 0, l = subPaths.length; i < l; i++) { tmpPath = subPaths[i]; tmpPoints = tmpPath.getPoints(); solid = isClockWise(tmpPoints); @@ -28596,24 +30781,24 @@ if (!newShapes[0]) return toShapesNoHoles(subPaths); if (newShapes.length > 1) { - let ambiguous = false; - const toChange = []; + var ambiguous = false; + var toChange = []; - for (let sIdx = 0, sLen = newShapes.length; sIdx < sLen; sIdx++) { + for (var 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 (var _sIdx = 0, _sLen = newShapes.length; _sIdx < _sLen; _sIdx++) { + var sho = newShapeHoles[_sIdx]; - for (let hIdx = 0; hIdx < sho.length; hIdx++) { - const ho = sho[hIdx]; - let hole_unassigned = true; + for (var hIdx = 0; hIdx < sho.length; hIdx++) { + var ho = sho[hIdx]; + var hole_unassigned = true; - for (let s2Idx = 0; s2Idx < newShapes.length; s2Idx++) { + for (var s2Idx = 0; s2Idx < newShapes.length; s2Idx++) { if (isPointInsidePolygon(ho.p, newShapes[s2Idx].p)) { - if (sIdx !== s2Idx) toChange.push({ - froms: sIdx, + if (_sIdx !== s2Idx) toChange.push({ + froms: _sIdx, tos: s2Idx, hole: hIdx }); @@ -28628,7 +30813,7 @@ } if (hole_unassigned) { - betterShapeHoles[sIdx].push(ho); + betterShapeHoles[_sIdx].push(ho); } } } // console.log("ambiguous: ", ambiguous); @@ -28640,59 +30825,67 @@ } } - let tmpHoles; + var tmpHoles; - for (let i = 0, il = newShapes.length; i < il; i++) { - tmpShape = newShapes[i].s; + for (var _i = 0, il = newShapes.length; _i < il; _i++) { + tmpShape = newShapes[_i].s; shapes.push(tmpShape); - tmpHoles = newShapeHoles[i]; + tmpHoles = newShapeHoles[_i]; - for (let j = 0, jl = tmpHoles.length; j < jl; j++) { + for (var j = 0, jl = tmpHoles.length; j < jl; j++) { tmpShape.holes.push(tmpHoles[j].h); } } //console.log("shape", shapes); return shapes; - } + }; - } + return ShapePath; + }(); - class Font { - constructor(data) { + var Font = /*#__PURE__*/function () { + function Font(data) { this.type = 'Font'; this.data = data; } - generateShapes(text, size = 100) { - const shapes = []; - const paths = createPaths(text, size, this.data); + var _proto = Font.prototype; + + _proto.generateShapes = function generateShapes(text, size) { + if (size === void 0) { + size = 100; + } + + var shapes = []; + var paths = createPaths(text, size, this.data); - for (let p = 0, pl = paths.length; p < pl; p++) { + for (var p = 0, pl = paths.length; p < pl; p++) { Array.prototype.push.apply(shapes, paths[p].toShapes()); } return shapes; - } + }; - } + return Font; + }(); function createPaths(text, size, data) { - const chars = Array.from(text); - const scale = size / data.resolution; - const line_height = (data.boundingBox.yMax - data.boundingBox.yMin + data.underlineThickness) * scale; - const paths = []; - let offsetX = 0, + var chars = Array.from(text); + var scale = size / data.resolution; + var line_height = (data.boundingBox.yMax - data.boundingBox.yMin + data.underlineThickness) * scale; + var paths = []; + var offsetX = 0, offsetY = 0; - for (let i = 0; i < chars.length; i++) { - const char = chars[i]; + for (var i = 0; i < chars.length; i++) { + var char = chars[i]; if (char === '\n') { offsetX = 0; offsetY -= line_height; } else { - const ret = createPath(char, scale, offsetX, offsetY, data); + var ret = createPath(char, scale, offsetX, offsetY, data); offsetX += ret.offsetX; paths.push(ret.path); } @@ -28702,21 +30895,21 @@ } function createPath(char, scale, offsetX, offsetY, data) { - const glyph = data.glyphs[char] || data.glyphs['?']; + var glyph = data.glyphs[char] || data.glyphs['?']; if (!glyph) { console.error('THREE.Font: character "' + char + '" does not exists in font family ' + data.familyName + '.'); return; } - const path = new ShapePath(); - let x, y, cpx, cpy, cpx1, cpy1, cpx2, cpy2; + var path = new ShapePath(); + var x, y, cpx, cpy, cpx1, cpy1, cpx2, cpy2; if (glyph.o) { - const outline = glyph._cachedOutline || (glyph._cachedOutline = glyph.o.split(' ')); + var outline = glyph._cachedOutline || (glyph._cachedOutline = glyph.o.split(' ')); - for (let i = 0, l = outline.length; i < l;) { - const action = outline[i++]; + for (var i = 0, l = outline.length; i < l;) { + var action = outline[i++]; switch (action) { case 'm': @@ -28764,19 +30957,23 @@ Font.prototype.isFont = true; - class FontLoader extends Loader { - constructor(manager) { - super(manager); + var FontLoader = /*#__PURE__*/function (_Loader) { + _inheritsLoose(FontLoader, _Loader); + + function FontLoader(manager) { + return _Loader.call(this, manager) || this; } - load(url, onLoad, onProgress, onError) { - const scope = this; - const loader = new FileLoader(this.manager); + var _proto = FontLoader.prototype; + + _proto.load = function load(url, onLoad, onProgress, onError) { + var scope = this; + var loader = new FileLoader(this.manager); loader.setPath(this.path); loader.setRequestHeader(this.requestHeader); loader.setWithCredentials(scope.withCredentials); loader.load(url, function (text) { - let json; + var json; try { json = JSON.parse(text); @@ -28785,40 +30982,45 @@ json = JSON.parse(text.substring(65, text.length - 2)); } - const font = scope.parse(json); + var font = scope.parse(json); if (onLoad) onLoad(font); }, onProgress, onError); - } + }; - parse(json) { + _proto.parse = function parse(json) { return new Font(json); - } + }; - } + return FontLoader; + }(Loader); - let _context; + var _context; - const AudioContext = { - getContext: function () { + var AudioContext = { + getContext: function getContext() { if (_context === undefined) { _context = new (window.AudioContext || window.webkitAudioContext)(); } return _context; }, - setContext: function (value) { + setContext: function setContext(value) { _context = value; } }; - class AudioLoader extends Loader { - constructor(manager) { - super(manager); + var AudioLoader = /*#__PURE__*/function (_Loader) { + _inheritsLoose(AudioLoader, _Loader); + + function AudioLoader(manager) { + return _Loader.call(this, manager) || this; } - load(url, onLoad, onProgress, onError) { - const scope = this; - const loader = new FileLoader(this.manager); + var _proto = AudioLoader.prototype; + + _proto.load = function load(url, onLoad, onProgress, onError) { + var scope = this; + var loader = new FileLoader(this.manager); loader.setResponseType('arraybuffer'); loader.setPath(this.path); loader.setRequestHeader(this.requestHeader); @@ -28827,8 +31029,8 @@ try { // Create a copy of the buffer. The `decodeAudioData` method // detaches the buffer when complete, preventing reuse. - const bufferCopy = buffer.slice(0); - const context = AudioContext.getContext(); + var bufferCopy = buffer.slice(0); + var context = AudioContext.getContext(); context.decodeAudioData(bufferCopy, function (audioBuffer) { onLoad(audioBuffer); }); @@ -28842,46 +31044,71 @@ scope.manager.itemError(url); } }, onProgress, onError); - } + }; - } + return AudioLoader; + }(Loader); - class HemisphereLightProbe extends LightProbe { - constructor(skyColor, groundColor, intensity = 1) { - super(undefined, intensity); - 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 ); + var HemisphereLightProbe = /*#__PURE__*/function (_LightProbe) { + _inheritsLoose(HemisphereLightProbe, _LightProbe); - 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); + function HemisphereLightProbe(skyColor, groundColor, intensity) { + var _this; + + if (intensity === void 0) { + intensity = 1; + } + + _this = _LightProbe.call(this, undefined, intensity) || this; + var color1 = new Color().set(skyColor); + var color2 = new Color().set(groundColor); + var sky = new Vector3(color1.r, color1.g, color1.b); + var ground = new Vector3(color2.r, color2.g, color2.b); // without extra factor of PI in the shader, should = 1 / Math.sqrt( Math.PI ); + + var c0 = Math.sqrt(Math.PI); + var 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); + + return _this; } - } + return HemisphereLightProbe; + }(LightProbe); 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 ); + var AmbientLightProbe = /*#__PURE__*/function (_LightProbe) { + _inheritsLoose(AmbientLightProbe, _LightProbe); - this.sh.coefficients[0].set(color1.r, color1.g, color1.b).multiplyScalar(2 * Math.sqrt(Math.PI)); + function AmbientLightProbe(color, intensity) { + var _this; + + if (intensity === void 0) { + intensity = 1; + } + + _this = _LightProbe.call(this, undefined, intensity) || this; + var 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)); + + return _this; } - } + return AmbientLightProbe; + }(LightProbe); AmbientLightProbe.prototype.isAmbientLightProbe = true; - const _eyeRight = new Matrix4(); + var _eyeRight = new Matrix4(); - const _eyeLeft = new Matrix4(); + var _eyeLeft = new Matrix4(); - class StereoCamera { - constructor() { + var StereoCamera = /*#__PURE__*/function () { + function StereoCamera() { this.type = 'StereoCamera'; this.aspect = 1; this.eyeSep = 0.064; @@ -28902,9 +31129,11 @@ }; } - 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; + var _proto = StereoCamera.prototype; + + _proto.update = function update(camera) { + var cache = this._cache; + var 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; @@ -28916,11 +31145,11 @@ cache.eyeSep = this.eyeSep; // Off-axis stereoscopic effect based on // http://paulbourke.net/stereographics/stereorender/ - const projectionMatrix = camera.projectionMatrix.clone(); - const eyeSepHalf = cache.eyeSep / 2; - const eyeSepOnProjection = eyeSepHalf * cache.near / cache.focus; - const ymax = cache.near * Math.tan(MathUtils.DEG2RAD * cache.fov * 0.5) / cache.zoom; - let xmin, xmax; // translate xOffset + var projectionMatrix = camera.projectionMatrix.clone(); + var eyeSepHalf = cache.eyeSep / 2; + var eyeSepOnProjection = eyeSepHalf * cache.near / cache.focus; + var ymax = cache.near * Math.tan(MathUtils.DEG2RAD * cache.fov * 0.5) / cache.zoom; + var xmin, xmax; // translate xOffset _eyeLeft.elements[12] = -eyeSepHalf; _eyeRight.elements[12] = eyeSepHalf; // for left eye @@ -28940,12 +31169,13 @@ this.cameraL.matrixWorld.copy(camera.matrixWorld).multiply(_eyeLeft); this.cameraR.matrixWorld.copy(camera.matrixWorld).multiply(_eyeRight); - } + }; - } + return StereoCamera; + }(); - class Clock { - constructor(autoStart) { + var Clock = /*#__PURE__*/function () { + function Clock(autoStart) { this.autoStart = autoStart !== undefined ? autoStart : true; this.startTime = 0; this.oldTime = 0; @@ -28953,26 +31183,28 @@ this.running = false; } - start() { + var _proto = Clock.prototype; + + _proto.start = function start() { this.startTime = now(); this.oldTime = this.startTime; this.elapsedTime = 0; this.running = true; - } + }; - stop() { + _proto.stop = function stop() { this.getElapsedTime(); this.running = false; this.autoStart = false; - } + }; - getElapsedTime() { + _proto.getElapsedTime = function getElapsedTime() { this.getDelta(); return this.elapsedTime; - } + }; - getDelta() { - let diff = 0; + _proto.getDelta = function getDelta() { + var diff = 0; if (this.autoStart && !this.running) { this.start(); @@ -28980,47 +31212,57 @@ } if (this.running) { - const newTime = now(); + var newTime = now(); diff = (newTime - this.oldTime) / 1000; this.oldTime = newTime; this.elapsedTime += diff; } return diff; - } + }; - } + return Clock; + }(); function now() { return (typeof performance === 'undefined' ? Date : performance).now(); // see #10732 } - const _position$1 = /*@__PURE__*/new Vector3(); + var _position$2 = /*@__PURE__*/new Vector3(); + + var _quaternion$3 = /*@__PURE__*/new Quaternion(); + + var _scale$1 = /*@__PURE__*/new Vector3(); + + var _orientation = /*@__PURE__*/new Vector3(); + + var AudioListener = /*#__PURE__*/function (_Object3D) { + _inheritsLoose(AudioListener, _Object3D); - const _quaternion$1 = /*@__PURE__*/new Quaternion(); + function AudioListener() { + var _this; - const _scale$1 = /*@__PURE__*/new Vector3(); + _this = _Object3D.call(this) || this; + _this.type = 'AudioListener'; + _this.context = AudioContext.getContext(); + _this.gain = _this.context.createGain(); - const _orientation$1 = /*@__PURE__*/new Vector3(); + _this.gain.connect(_this.context.destination); - class AudioListener extends Object3D { - constructor() { - super(); - this.type = 'AudioListener'; - this.context = AudioContext.getContext(); - this.gain = this.context.createGain(); - this.gain.connect(this.context.destination); - this.filter = null; - this.timeDelta = 0; // private + _this.filter = null; + _this.timeDelta = 0; // private - this._clock = new Clock(); + _this._clock = new Clock(); + return _this; } - getInput() { + var _proto = AudioListener.prototype; + + _proto.getInput = function getInput() { return this.gain; - } + }; - removeFilter() { + _proto.removeFilter = function removeFilter() { if (this.filter !== null) { this.gain.disconnect(this.filter); this.filter.disconnect(this.context.destination); @@ -29029,13 +31271,13 @@ } return this; - } + }; - getFilter() { + _proto.getFilter = function getFilter() { return this.filter; - } + }; - setFilter(value) { + _proto.setFilter = function setFilter(value) { if (this.filter !== null) { this.gain.disconnect(this.filter); this.filter.disconnect(this.context.destination); @@ -29047,109 +31289,124 @@ this.gain.connect(this.filter); this.filter.connect(this.context.destination); return this; - } + }; - getMasterVolume() { + _proto.getMasterVolume = function getMasterVolume() { return this.gain.gain.value; - } + }; - setMasterVolume(value) { + _proto.setMasterVolume = function setMasterVolume(value) { this.gain.gain.setTargetAtTime(value, this.context.currentTime, 0.01); return this; - } + }; + + _proto.updateMatrixWorld = function updateMatrixWorld(force) { + _Object3D.prototype.updateMatrixWorld.call(this, force); - updateMatrixWorld(force) { - super.updateMatrixWorld(force); - const listener = this.context.listener; - const up = this.up; + var listener = this.context.listener; + var up = this.up; this.timeDelta = this._clock.getDelta(); - this.matrixWorld.decompose(_position$1, _quaternion$1, _scale$1); + this.matrixWorld.decompose(_position$2, _quaternion$3, _scale$1); - _orientation$1.set(0, 0, -1).applyQuaternion(_quaternion$1); + _orientation.set(0, 0, -1).applyQuaternion(_quaternion$3); 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); - listener.positionZ.linearRampToValueAtTime(_position$1.z, endTime); - listener.forwardX.linearRampToValueAtTime(_orientation$1.x, endTime); - listener.forwardY.linearRampToValueAtTime(_orientation$1.y, endTime); - listener.forwardZ.linearRampToValueAtTime(_orientation$1.z, endTime); + var endTime = this.context.currentTime + this.timeDelta; + listener.positionX.linearRampToValueAtTime(_position$2.x, endTime); + listener.positionY.linearRampToValueAtTime(_position$2.y, endTime); + listener.positionZ.linearRampToValueAtTime(_position$2.z, endTime); + listener.forwardX.linearRampToValueAtTime(_orientation.x, endTime); + listener.forwardY.linearRampToValueAtTime(_orientation.y, endTime); + listener.forwardZ.linearRampToValueAtTime(_orientation.z, endTime); listener.upX.linearRampToValueAtTime(up.x, endTime); listener.upY.linearRampToValueAtTime(up.y, endTime); listener.upZ.linearRampToValueAtTime(up.z, endTime); } else { - listener.setPosition(_position$1.x, _position$1.y, _position$1.z); - listener.setOrientation(_orientation$1.x, _orientation$1.y, _orientation$1.z, up.x, up.y, up.z); + listener.setPosition(_position$2.x, _position$2.y, _position$2.z); + listener.setOrientation(_orientation.x, _orientation.y, _orientation.z, up.x, up.y, up.z); } - } - - } - - class Audio extends Object3D { - constructor(listener) { - super(); - this.type = 'Audio'; - this.listener = listener; - this.context = listener.context; - this.gain = this.context.createGain(); - this.gain.connect(listener.getInput()); - this.autoplay = false; - this.buffer = null; - this.detune = 0; - this.loop = false; - this.loopStart = 0; - this.loopEnd = 0; - this.offset = 0; - this.duration = undefined; - this.playbackRate = 1; - this.isPlaying = false; - this.hasPlaybackControl = true; - this.source = null; - this.sourceType = 'empty'; - this._startedAt = 0; - this._progress = 0; - this._connected = false; - this.filters = []; - } + }; - getOutput() { + return AudioListener; + }(Object3D); + + var Audio = /*#__PURE__*/function (_Object3D) { + _inheritsLoose(Audio, _Object3D); + + function Audio(listener) { + var _this; + + _this = _Object3D.call(this) || this; + _this.type = 'Audio'; + _this.listener = listener; + _this.context = listener.context; + _this.gain = _this.context.createGain(); + + _this.gain.connect(listener.getInput()); + + _this.autoplay = false; + _this.buffer = null; + _this.detune = 0; + _this.loop = false; + _this.loopStart = 0; + _this.loopEnd = 0; + _this.offset = 0; + _this.duration = undefined; + _this.playbackRate = 1; + _this.isPlaying = false; + _this.hasPlaybackControl = true; + _this.source = null; + _this.sourceType = 'empty'; + _this._startedAt = 0; + _this._progress = 0; + _this._connected = false; + _this.filters = []; + return _this; + } + + var _proto = Audio.prototype; + + _proto.getOutput = function getOutput() { return this.gain; - } + }; - setNodeSource(audioNode) { + _proto.setNodeSource = function setNodeSource(audioNode) { this.hasPlaybackControl = false; this.sourceType = 'audioNode'; this.source = audioNode; this.connect(); return this; - } + }; - setMediaElementSource(mediaElement) { + _proto.setMediaElementSource = function setMediaElementSource(mediaElement) { this.hasPlaybackControl = false; this.sourceType = 'mediaNode'; this.source = this.context.createMediaElementSource(mediaElement); this.connect(); return this; - } + }; - setMediaStreamSource(mediaStream) { + _proto.setMediaStreamSource = function setMediaStreamSource(mediaStream) { this.hasPlaybackControl = false; this.sourceType = 'mediaStreamNode'; this.source = this.context.createMediaStreamSource(mediaStream); this.connect(); return this; - } + }; - setBuffer(audioBuffer) { + _proto.setBuffer = function setBuffer(audioBuffer) { this.buffer = audioBuffer; this.sourceType = 'buffer'; if (this.autoplay) this.play(); return this; - } + }; + + _proto.play = function play(delay) { + if (delay === void 0) { + delay = 0; + } - play(delay = 0) { if (this.isPlaying === true) { console.warn('THREE.Audio: Audio is already playing.'); return; @@ -29161,7 +31418,7 @@ } this._startedAt = this.context.currentTime + delay; - const source = this.context.createBufferSource(); + var source = this.context.createBufferSource(); source.buffer = this.buffer; source.loop = this.loop; source.loopStart = this.loopStart; @@ -29173,9 +31430,9 @@ this.setDetune(this.detune); this.setPlaybackRate(this.playbackRate); return this.connect(); - } + }; - pause() { + _proto.pause = function pause() { if (this.hasPlaybackControl === false) { console.warn('THREE.Audio: this Audio has no playback control.'); return; @@ -29196,9 +31453,9 @@ } return this; - } + }; - stop() { + _proto.stop = function stop() { if (this.hasPlaybackControl === false) { console.warn('THREE.Audio: this Audio has no playback control.'); return; @@ -29209,13 +31466,13 @@ this.source.onended = null; this.isPlaying = false; return this; - } + }; - connect() { + _proto.connect = function connect() { if (this.filters.length > 0) { this.source.connect(this.filters[0]); - for (let i = 1, l = this.filters.length; i < l; i++) { + for (var i = 1, l = this.filters.length; i < l; i++) { this.filters[i - 1].connect(this.filters[i]); } @@ -29226,13 +31483,13 @@ this._connected = true; return this; - } + }; - disconnect() { + _proto.disconnect = function disconnect() { if (this.filters.length > 0) { this.source.disconnect(this.filters[0]); - for (let i = 1, l = this.filters.length; i < l; i++) { + for (var i = 1, l = this.filters.length; i < l; i++) { this.filters[i - 1].disconnect(this.filters[i]); } @@ -29243,13 +31500,13 @@ this._connected = false; return this; - } + }; - getFilters() { + _proto.getFilters = function getFilters() { return this.filters; - } + }; - setFilters(value) { + _proto.setFilters = function setFilters(value) { if (!value) value = []; if (this._connected === true) { @@ -29261,9 +31518,9 @@ } return this; - } + }; - setDetune(value) { + _proto.setDetune = function setDetune(value) { this.detune = value; if (this.source.detune === undefined) return; // only set detune when available @@ -29272,21 +31529,21 @@ } return this; - } + }; - getDetune() { + _proto.getDetune = function getDetune() { return this.detune; - } + }; - getFilter() { + _proto.getFilter = function getFilter() { return this.getFilters()[0]; - } + }; - setFilter(filter) { + _proto.setFilter = function setFilter(filter) { return this.setFilters(filter ? [filter] : []); - } + }; - setPlaybackRate(value) { + _proto.setPlaybackRate = function setPlaybackRate(value) { if (this.hasPlaybackControl === false) { console.warn('THREE.Audio: this Audio has no playback control.'); return; @@ -29299,26 +31556,26 @@ } return this; - } + }; - getPlaybackRate() { + _proto.getPlaybackRate = function getPlaybackRate() { return this.playbackRate; - } + }; - onEnded() { + _proto.onEnded = function onEnded() { this.isPlaying = false; - } + }; - getLoop() { + _proto.getLoop = function getLoop() { if (this.hasPlaybackControl === false) { console.warn('THREE.Audio: this Audio has no playback control.'); return false; } return this.loop; - } + }; - setLoop(value) { + _proto.setLoop = function setLoop(value) { if (this.hasPlaybackControl === false) { console.warn('THREE.Audio: this Audio has no playback control.'); return; @@ -29331,149 +31588,168 @@ } return this; - } + }; - setLoopStart(value) { + _proto.setLoopStart = function setLoopStart(value) { this.loopStart = value; return this; - } + }; - setLoopEnd(value) { + _proto.setLoopEnd = function setLoopEnd(value) { this.loopEnd = value; return this; - } + }; - getVolume() { + _proto.getVolume = function getVolume() { return this.gain.gain.value; - } + }; - setVolume(value) { + _proto.setVolume = function setVolume(value) { this.gain.gain.setTargetAtTime(value, this.context.currentTime, 0.01); return this; - } + }; - } + return Audio; + }(Object3D); + + var _position$3 = /*@__PURE__*/new Vector3(); + + var _quaternion$4 = /*@__PURE__*/new Quaternion(); + + var _scale$2 = /*@__PURE__*/new Vector3(); + + var _orientation$1 = /*@__PURE__*/new Vector3(); - const _position = /*@__PURE__*/new Vector3(); + var PositionalAudio = /*#__PURE__*/function (_Audio) { + _inheritsLoose(PositionalAudio, _Audio); - const _quaternion = /*@__PURE__*/new Quaternion(); + function PositionalAudio(listener) { + var _this; - const _scale = /*@__PURE__*/new Vector3(); + _this = _Audio.call(this, listener) || this; + _this.panner = _this.context.createPanner(); + _this.panner.panningModel = 'HRTF'; - const _orientation = /*@__PURE__*/new Vector3(); + _this.panner.connect(_this.gain); - class PositionalAudio extends Audio { - constructor(listener) { - super(listener); - this.panner = this.context.createPanner(); - this.panner.panningModel = 'HRTF'; - this.panner.connect(this.gain); + return _this; } - getOutput() { + var _proto = PositionalAudio.prototype; + + _proto.getOutput = function getOutput() { return this.panner; - } + }; - getRefDistance() { + _proto.getRefDistance = function getRefDistance() { return this.panner.refDistance; - } + }; - setRefDistance(value) { + _proto.setRefDistance = function setRefDistance(value) { this.panner.refDistance = value; return this; - } + }; - getRolloffFactor() { + _proto.getRolloffFactor = function getRolloffFactor() { return this.panner.rolloffFactor; - } + }; - setRolloffFactor(value) { + _proto.setRolloffFactor = function setRolloffFactor(value) { this.panner.rolloffFactor = value; return this; - } + }; - getDistanceModel() { + _proto.getDistanceModel = function getDistanceModel() { return this.panner.distanceModel; - } + }; - setDistanceModel(value) { + _proto.setDistanceModel = function setDistanceModel(value) { this.panner.distanceModel = value; return this; - } + }; - getMaxDistance() { + _proto.getMaxDistance = function getMaxDistance() { return this.panner.maxDistance; - } + }; - setMaxDistance(value) { + _proto.setMaxDistance = function setMaxDistance(value) { this.panner.maxDistance = value; return this; - } + }; - setDirectionalCone(coneInnerAngle, coneOuterAngle, coneOuterGain) { + _proto.setDirectionalCone = function setDirectionalCone(coneInnerAngle, coneOuterAngle, coneOuterGain) { this.panner.coneInnerAngle = coneInnerAngle; this.panner.coneOuterAngle = coneOuterAngle; this.panner.coneOuterGain = coneOuterGain; return this; - } + }; + + _proto.updateMatrixWorld = function updateMatrixWorld(force) { + _Audio.prototype.updateMatrixWorld.call(this, force); - updateMatrixWorld(force) { - super.updateMatrixWorld(force); if (this.hasPlaybackControl === true && this.isPlaying === false) return; - this.matrixWorld.decompose(_position, _quaternion, _scale); + this.matrixWorld.decompose(_position$3, _quaternion$4, _scale$2); - _orientation.set(0, 0, 1).applyQuaternion(_quaternion); + _orientation$1.set(0, 0, 1).applyQuaternion(_quaternion$4); - const panner = this.panner; + var 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); - panner.positionZ.linearRampToValueAtTime(_position.z, endTime); - panner.orientationX.linearRampToValueAtTime(_orientation.x, endTime); - panner.orientationY.linearRampToValueAtTime(_orientation.y, endTime); - panner.orientationZ.linearRampToValueAtTime(_orientation.z, endTime); + var endTime = this.context.currentTime + this.listener.timeDelta; + panner.positionX.linearRampToValueAtTime(_position$3.x, endTime); + panner.positionY.linearRampToValueAtTime(_position$3.y, endTime); + panner.positionZ.linearRampToValueAtTime(_position$3.z, endTime); + panner.orientationX.linearRampToValueAtTime(_orientation$1.x, endTime); + panner.orientationY.linearRampToValueAtTime(_orientation$1.y, endTime); + panner.orientationZ.linearRampToValueAtTime(_orientation$1.z, endTime); } else { - panner.setPosition(_position.x, _position.y, _position.z); - panner.setOrientation(_orientation.x, _orientation.y, _orientation.z); + panner.setPosition(_position$3.x, _position$3.y, _position$3.z); + panner.setOrientation(_orientation$1.x, _orientation$1.y, _orientation$1.z); } - } + }; - } + return PositionalAudio; + }(Audio); + + var AudioAnalyser = /*#__PURE__*/function () { + function AudioAnalyser(audio, fftSize) { + if (fftSize === void 0) { + fftSize = 2048; + } - class AudioAnalyser { - constructor(audio, fftSize = 2048) { this.analyser = audio.context.createAnalyser(); this.analyser.fftSize = fftSize; this.data = new Uint8Array(this.analyser.frequencyBinCount); audio.getOutput().connect(this.analyser); } - getFrequencyData() { + var _proto = AudioAnalyser.prototype; + + _proto.getFrequencyData = function getFrequencyData() { this.analyser.getByteFrequencyData(this.data); return this.data; - } + }; - getAverageFrequency() { - let value = 0; - const data = this.getFrequencyData(); + _proto.getAverageFrequency = function getAverageFrequency() { + var value = 0; + var data = this.getFrequencyData(); - for (let i = 0; i < data.length; i++) { + for (var i = 0; i < data.length; i++) { value += data[i]; } return value / data.length; - } + }; - } + return AudioAnalyser; + }(); - class PropertyMixer { - constructor(binding, typeName, valueSize) { + var PropertyMixer = /*#__PURE__*/function () { + function PropertyMixer(binding, typeName, valueSize) { this.binding = binding; this.valueSize = valueSize; - let mixFunction, mixFunctionAdditive, setIdentity; // buffer layout: [ incoming | accu0 | accu1 | orig | addAccu | (optional work) ] + var 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' @@ -29527,17 +31803,19 @@ } // accumulate data in the 'incoming' region into 'accu' - accumulate(accuIndex, weight) { + var _proto = PropertyMixer.prototype; + + _proto.accumulate = function 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; - let currentWeight = this.cumulativeWeight; + var buffer = this.buffer, + stride = this.valueSize, + offset = accuIndex * stride + stride; + var currentWeight = this.cumulativeWeight; if (currentWeight === 0) { // accuN := incoming * weight - for (let i = 0; i !== stride; ++i) { + for (var i = 0; i !== stride; ++i) { buffer[offset + i] = buffer[i]; } @@ -29545,19 +31823,19 @@ } else { // accuN := accuN + incoming * weight currentWeight += weight; - const mix = weight / currentWeight; + var mix = weight / currentWeight; this._mixBufferRegion(buffer, offset, 0, mix, stride); } this.cumulativeWeight = currentWeight; } // accumulate data in the 'incoming' region into 'add' + ; - - accumulateAdditive(weight) { - const buffer = this.buffer, - stride = this.valueSize, - offset = stride * this._addIndex; + _proto.accumulateAdditive = function accumulateAdditive(weight) { + var buffer = this.buffer, + stride = this.valueSize, + offset = stride * this._addIndex; if (this.cumulativeWeightAdditive === 0) { // add = identity @@ -29569,21 +31847,21 @@ this.cumulativeWeightAdditive += weight; } // 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; + ; + + _proto.apply = function apply(accuIndex) { + var stride = this.valueSize, + 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; + var originalValueOffset = stride * this._origIndex; this._mixBufferRegion(buffer, offset, originalValueOffset, 1 - weight, stride); } @@ -29593,7 +31871,7 @@ this._mixBufferRegionAdditive(buffer, offset, this._addIndex * stride, 1, stride); } - for (let i = stride, e = stride + stride; i !== e; ++i) { + for (var i = stride, e = stride + stride; i !== e; ++i) { if (buffer[i] !== buffer[i + stride]) { // value has changed -> update scene graph binding.setValue(buffer, offset); @@ -29601,16 +31879,16 @@ } } } // 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; + _proto.saveOriginalState = function saveOriginalState() { + var binding = this.binding; + var buffer = this.buffer, + 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) { + for (var i = stride, e = originalValueOffset; i !== e; ++i) { buffer[i] = buffer[originalValueOffset + i % stride]; } // Add to identity for additive @@ -29620,140 +31898,141 @@ this.cumulativeWeight = 0; this.cumulativeWeightAdditive = 0; } // apply the state previously taken via 'saveOriginalState' to the binding + ; - - restoreOriginalState() { - const originalValueOffset = this.valueSize * 3; + _proto.restoreOriginalState = function restoreOriginalState() { + var originalValueOffset = this.valueSize * 3; this.binding.setValue(this.buffer, originalValueOffset); - } + }; - _setAdditiveIdentityNumeric() { - const startIndex = this._addIndex * this.valueSize; - const endIndex = startIndex + this.valueSize; + _proto._setAdditiveIdentityNumeric = function _setAdditiveIdentityNumeric() { + var startIndex = this._addIndex * this.valueSize; + var endIndex = startIndex + this.valueSize; - for (let i = startIndex; i < endIndex; i++) { + for (var i = startIndex; i < endIndex; i++) { this.buffer[i] = 0; } - } + }; - _setAdditiveIdentityQuaternion() { + _proto._setAdditiveIdentityQuaternion = function _setAdditiveIdentityQuaternion() { this._setAdditiveIdentityNumeric(); this.buffer[this._addIndex * this.valueSize + 3] = 1; - } + }; - _setAdditiveIdentityOther() { - const startIndex = this._origIndex * this.valueSize; - const targetIndex = this._addIndex * this.valueSize; + _proto._setAdditiveIdentityOther = function _setAdditiveIdentityOther() { + var startIndex = this._origIndex * this.valueSize; + var targetIndex = this._addIndex * this.valueSize; - for (let i = 0; i < this.valueSize; i++) { + for (var i = 0; i < this.valueSize; i++) { this.buffer[targetIndex + i] = this.buffer[startIndex + i]; } } // mix functions + ; - - _select(buffer, dstOffset, srcOffset, t, stride) { + _proto._select = function _select(buffer, dstOffset, srcOffset, t, stride) { if (t >= 0.5) { - for (let i = 0; i !== stride; ++i) { + for (var i = 0; i !== stride; ++i) { buffer[dstOffset + i] = buffer[srcOffset + i]; } } - } + }; - _slerp(buffer, dstOffset, srcOffset, t) { + _proto._slerp = function _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 + _proto._slerpAdditive = function _slerpAdditive(buffer, dstOffset, srcOffset, t, stride) { + var workOffset = this._workIndex * stride; // 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; + _proto._lerp = function _lerp(buffer, dstOffset, srcOffset, t, stride) { + var s = 1 - t; - for (let i = 0; i !== stride; ++i) { - const j = dstOffset + i; + for (var i = 0; i !== stride; ++i) { + var 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; + _proto._lerpAdditive = function _lerpAdditive(buffer, dstOffset, srcOffset, t, stride) { + for (var i = 0; i !== stride; ++i) { + var j = dstOffset + i; buffer[j] = buffer[j] + buffer[srcOffset + i] * t; } - } + }; - } + return PropertyMixer; + }(); // Characters [].:/ are reserved for track binding syntax. - const _RESERVED_CHARS_RE = '\\[\\]\\.:\\/'; + var _RESERVED_CHARS_RE = '\\[\\]\\.:\\/'; - const _reservedRe = new RegExp('[' + _RESERVED_CHARS_RE + ']', 'g'); // Attempts to allow node names from any language. ES5's `\w` regexp matches + var _reservedRe = new RegExp('[' + _RESERVED_CHARS_RE + ']', 'g'); // 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 + ']'; + var _wordChar = '[^' + _RESERVED_CHARS_RE + ']'; - const _wordCharOrDot = '[^' + _RESERVED_CHARS_RE.replace('\\.', '') + ']'; // Parent directories, delimited by '/' or ':'. Currently unused, but must + var _wordCharOrDot = '[^' + _RESERVED_CHARS_RE.replace('\\.', '') + ']'; // 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 '-'. + var _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 + var _nodeRe = /(WCOD+)?/.source.replace('WCOD', _wordCharOrDot); // 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); // Property and accessor. May not contain reserved characters. Accessor may + var _objectRe = /(?:\.(WC+)(?:\[(.+)\])?)?/.source.replace('WC', _wordChar); // Property and accessor. May not contain reserved characters. Accessor may // contain any non-bracket characters. - const _propertyRe = /\.(WC+)(?:\[(.+)\])?/.source.replace('WC', _wordChar); + var _propertyRe = /\.(WC+)(?:\[(.+)\])?/.source.replace('WC', _wordChar); - const _trackRe = new RegExp('' + '^' + _directoryRe + _nodeRe + _objectRe + _propertyRe + '$'); + var _trackRe = new RegExp('' + '^' + _directoryRe + _nodeRe + _objectRe + _propertyRe + '$'); - const _supportedObjectNames = ['material', 'materials', 'bones']; + var _supportedObjectNames = ['material', 'materials', 'bones']; function Composite(targetGroup, path, optionalParsedPath) { - const parsedPath = optionalParsedPath || PropertyBinding.parseTrackName(path); + var parsedPath = optionalParsedPath || PropertyBinding.parseTrackName(path); this._targetGroup = targetGroup; this._bindings = targetGroup.subscribe_(path, parsedPath); } Object.assign(Composite.prototype, { - getValue: function (array, offset) { + getValue: function getValue(array, offset) { this.bind(); // bind all binding - const firstValidIndex = this._targetGroup.nCachedObjects_, - binding = this._bindings[firstValidIndex]; // and only call .getValue on the first + var firstValidIndex = this._targetGroup.nCachedObjects_, + binding = this._bindings[firstValidIndex]; // and only call .getValue on the first if (binding !== undefined) binding.getValue(array, offset); }, - setValue: function (array, offset) { - const bindings = this._bindings; + setValue: function setValue(array, offset) { + var bindings = this._bindings; - for (let i = this._targetGroup.nCachedObjects_, n = bindings.length; i !== n; ++i) { + for (var i = this._targetGroup.nCachedObjects_, n = bindings.length; i !== n; ++i) { bindings[i].setValue(array, offset); } }, - bind: function () { - const bindings = this._bindings; + bind: function bind() { + var bindings = this._bindings; - for (let i = this._targetGroup.nCachedObjects_, n = bindings.length; i !== n; ++i) { + for (var i = this._targetGroup.nCachedObjects_, n = bindings.length; i !== n; ++i) { bindings[i].bind(); } }, - unbind: function () { - const bindings = this._bindings; + unbind: function unbind() { + var bindings = this._bindings; - for (let i = this._targetGroup.nCachedObjects_, n = bindings.length; i !== n; ++i) { + for (var i = this._targetGroup.nCachedObjects_, n = bindings.length; i !== n; ++i) { bindings[i].unbind(); } } @@ -29768,7 +32047,7 @@ Object.assign(PropertyBinding, { Composite: Composite, - create: function (root, path, parsedPath) { + create: function create(root, path, parsedPath) { if (!(root && root.isAnimationObjectGroup)) { return new PropertyBinding(root, path, parsedPath); } else { @@ -29783,17 +32062,17 @@ * @param {string} name Node name to be sanitized. * @return {string} */ - sanitizeNodeName: function (name) { + sanitizeNodeName: function sanitizeNodeName(name) { return name.replace(/\s/g, '_').replace(_reservedRe, ''); }, - parseTrackName: function (trackName) { - const matches = _trackRe.exec(trackName); + parseTrackName: function parseTrackName(trackName) { + var matches = _trackRe.exec(trackName); if (!matches) { throw new Error('PropertyBinding: Cannot parse trackName: ' + trackName); } - const results = { + var results = { // directoryName: matches[ 1 ], // (tschw) currently unused nodeName: matches[2], objectName: matches[3], @@ -29802,10 +32081,10 @@ // required propertyIndex: matches[6] }; - const lastDot = results.nodeName && results.nodeName.lastIndexOf('.'); + var 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 + var 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). @@ -29822,14 +32101,14 @@ return results; }, - findNode: function (root, nodeName) { + findNode: function findNode(root, nodeName) { if (!nodeName || nodeName === '' || nodeName === '.' || nodeName === -1 || nodeName === root.name || nodeName === root.uuid) { return root; } // search into skeleton bones. if (root.skeleton) { - const bone = root.skeleton.getBoneByName(nodeName); + var bone = root.skeleton.getBoneByName(nodeName); if (bone !== undefined) { return bone; @@ -29838,22 +32117,22 @@ if (root.children) { - const searchNodeSubtree = function (children) { - for (let i = 0; i < children.length; i++) { - const childNode = children[i]; + var searchNodeSubtree = function searchNodeSubtree(children) { + for (var i = 0; i < children.length; i++) { + var childNode = children[i]; if (childNode.name === nodeName || childNode.uuid === nodeName) { return childNode; } - const result = searchNodeSubtree(childNode.children); + var result = searchNodeSubtree(childNode.children); if (result) return result; } return null; }; - const subTreeNode = searchNodeSubtree(root.children); + var subTreeNode = searchNodeSubtree(root.children); if (subTreeNode) { return subTreeNode; @@ -29866,8 +32145,8 @@ Object.assign(PropertyBinding.prototype, { // prototype, continued // these are used to "bind" a nonexistent property - _getValue_unavailable: function () {}, - _setValue_unavailable: function () {}, + _getValue_unavailable: function _getValue_unavailable() {}, + _setValue_unavailable: function _setValue_unavailable() {}, BindingType: { Direct: 0, EntireArray: 1, @@ -29882,9 +32161,9 @@ GetterByBindingType: [function getValue_direct(buffer, offset) { buffer[offset] = this.node[this.propertyName]; }, function getValue_array(buffer, offset) { - const source = this.resolvedProperty; + var source = this.resolvedProperty; - for (let i = 0, n = source.length; i !== n; ++i) { + for (var i = 0, n = source.length; i !== n; ++i) { buffer[offset++] = source[i]; } }, function getValue_arrayElement(buffer, offset) { @@ -29903,23 +32182,23 @@ this.targetObject.matrixWorldNeedsUpdate = true; }], [// EntireArray function setValue_array(buffer, offset) { - const dest = this.resolvedProperty; + var dest = this.resolvedProperty; - for (let i = 0, n = dest.length; i !== n; ++i) { + for (var i = 0, n = dest.length; i !== n; ++i) { dest[i] = buffer[offset++]; } }, function setValue_array_setNeedsUpdate(buffer, offset) { - const dest = this.resolvedProperty; + var dest = this.resolvedProperty; - for (let i = 0, n = dest.length; i !== n; ++i) { + for (var i = 0, n = dest.length; i !== n; ++i) { dest[i] = buffer[offset++]; } this.targetObject.needsUpdate = true; }, function setValue_array_setMatrixWorldNeedsUpdate(buffer, offset) { - const dest = this.resolvedProperty; + var dest = this.resolvedProperty; - for (let i = 0, n = dest.length; i !== n; ++i) { + for (var i = 0, n = dest.length; i !== n; ++i) { dest[i] = buffer[offset++]; } @@ -29956,12 +32235,12 @@ this.setValue(sourceArray, offset); }, // create getter / setter pair for a property in the scene graph - bind: function () { - let targetObject = this.node; - const parsedPath = this.parsedPath; - const objectName = parsedPath.objectName; - const propertyName = parsedPath.propertyName; - let propertyIndex = parsedPath.propertyIndex; + bind: function bind() { + var targetObject = this.node; + var parsedPath = this.parsedPath; + var objectName = parsedPath.objectName; + var propertyName = parsedPath.propertyName; + var propertyIndex = parsedPath.propertyIndex; if (!targetObject) { targetObject = PropertyBinding.findNode(this.rootNode, parsedPath.nodeName) || this.rootNode; @@ -29978,7 +32257,7 @@ } if (objectName) { - let objectIndex = parsedPath.objectIndex; // special cases were we need to reach deeper into the hierarchy to get the face materials.... + var objectIndex = parsedPath.objectIndex; // special cases were we need to reach deeper into the hierarchy to get the face materials.... switch (objectName) { case 'materials': @@ -30005,7 +32284,7 @@ targetObject = targetObject.skeleton.bones; // support resolving morphTarget names into indices. - for (let i = 0; i < targetObject.length; i++) { + for (var i = 0; i < targetObject.length; i++) { if (targetObject[i].name === objectIndex) { objectIndex = i; break; @@ -30034,16 +32313,16 @@ } // resolve property - const nodeProperty = targetObject[propertyName]; + var nodeProperty = targetObject[propertyName]; if (nodeProperty === undefined) { - const nodeName = parsedPath.nodeName; + var 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 - let versioning = this.Versioning.None; + var versioning = this.Versioning.None; this.targetObject = targetObject; if (targetObject.needsUpdate !== undefined) { @@ -30055,7 +32334,7 @@ } // determine how the property gets bound - let bindingType = this.BindingType.Direct; + var bindingType = this.BindingType.Direct; if (propertyIndex !== undefined) { // access a sub element of the property array (only primitives are supported right now) @@ -30100,7 +32379,7 @@ this.getValue = this.GetterByBindingType[bindingType]; this.setValue = this.SetterByBindingTypeAndVersioning[bindingType][versioning]; }, - unbind: function () { + unbind: function unbind() { this.node = null; // back to the prototype version of getValue / setValue // note: avoiding to mutate the shape of 'this' via 'delete' @@ -30144,18 +32423,18 @@ * target group or directly, but not both. */ - class AnimationObjectGroup { - constructor() { + var AnimationObjectGroup = /*#__PURE__*/function () { + function AnimationObjectGroup() { this.uuid = MathUtils.generateUUID(); // cached objects followed by the active ones this._objects = Array.prototype.slice.call(arguments); this.nCachedObjects_ = 0; // threshold // note: read by PropertyBinding.Composite - const indices = {}; + var indices = {}; this._indicesByUUID = indices; // for bookkeeping - for (let i = 0, n = arguments.length; i !== n; ++i) { + for (var i = 0, n = arguments.length; i !== n; ++i) { indices[arguments[i].uuid] = i; } @@ -30167,7 +32446,7 @@ this._bindingsIndicesByPath = {}; // inside: indices in these arrays - const scope = this; + var scope = this; this.stats = { objects: { get total() { @@ -30187,21 +32466,23 @@ }; } - add() { - const objects = this._objects, - indicesByUUID = this._indicesByUUID, - paths = this._paths, - parsedPaths = this._parsedPaths, - bindings = this._bindings, - nBindings = bindings.length; - let knownObject = undefined, + var _proto = AnimationObjectGroup.prototype; + + _proto.add = function add() { + var objects = this._objects, + indicesByUUID = this._indicesByUUID, + paths = this._paths, + parsedPaths = this._parsedPaths, + bindings = this._bindings, + nBindings = bindings.length; + var knownObject = undefined, nObjects = objects.length, nCachedObjects = this.nCachedObjects_; - for (let i = 0, n = arguments.length; i !== n; ++i) { - const object = arguments[i], - uuid = object.uuid; - let index = indicesByUUID[uuid]; + for (var i = 0, n = arguments.length; i !== n; ++i) { + var object = arguments[i], + uuid = object.uuid; + var index = indicesByUUID[uuid]; if (index === undefined) { // unknown object -> add it to the ACTIVE region @@ -30209,30 +32490,30 @@ indicesByUUID[uuid] = index; objects.push(object); // accounting is done, now do the same for all bindings - for (let j = 0, m = nBindings; j !== m; ++j) { + for (var 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 - const firstActiveIndex = --nCachedObjects, - lastCachedObject = objects[firstActiveIndex]; + var firstActiveIndex = --nCachedObjects, + 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 - for (let j = 0, m = nBindings; j !== m; ++j) { - const bindingsForPath = bindings[j], - lastCached = bindingsForPath[firstActiveIndex]; - let binding = bindingsForPath[index]; + for (var _j = 0, _m = nBindings; _j !== _m; ++_j) { + var bindingsForPath = bindings[_j], + lastCached = bindingsForPath[firstActiveIndex]; + var 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]); + binding = new PropertyBinding(object, paths[_j], parsedPaths[_j]); } bindingsForPath[firstActiveIndex] = binding; @@ -30245,33 +32526,33 @@ this.nCachedObjects_ = nCachedObjects; - } + }; - remove() { - const objects = this._objects, - indicesByUUID = this._indicesByUUID, - bindings = this._bindings, - nBindings = bindings.length; - let nCachedObjects = this.nCachedObjects_; + _proto.remove = function remove() { + var objects = this._objects, + indicesByUUID = this._indicesByUUID, + bindings = this._bindings, + nBindings = bindings.length; + var nCachedObjects = this.nCachedObjects_; - for (let i = 0, n = arguments.length; i !== n; ++i) { - const object = arguments[i], - uuid = object.uuid, - index = indicesByUUID[uuid]; + for (var i = 0, n = arguments.length; i !== n; ++i) { + var object = arguments[i], + uuid = object.uuid, + index = indicesByUUID[uuid]; if (index !== undefined && index >= nCachedObjects) { // move existing object into the CACHED region - const lastCachedIndex = nCachedObjects++, - firstActiveObject = objects[lastCachedIndex]; + var lastCachedIndex = nCachedObjects++, + 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 - for (let j = 0, m = nBindings; j !== m; ++j) { - const bindingsForPath = bindings[j], - firstActive = bindingsForPath[lastCachedIndex], - binding = bindingsForPath[index]; + for (var j = 0, m = nBindings; j !== m; ++j) { + var bindingsForPath = bindings[j], + firstActive = bindingsForPath[lastCachedIndex], + binding = bindingsForPath[index]; bindingsForPath[index] = firstActive; bindingsForPath[lastCachedIndex] = binding; } @@ -30281,30 +32562,30 @@ this.nCachedObjects_ = nCachedObjects; } // remove & forget - - - uncache() { - const objects = this._objects, - indicesByUUID = this._indicesByUUID, - bindings = this._bindings, - nBindings = bindings.length; - let nCachedObjects = this.nCachedObjects_, + ; + + _proto.uncache = function uncache() { + var objects = this._objects, + indicesByUUID = this._indicesByUUID, + bindings = this._bindings, + nBindings = bindings.length; + var nCachedObjects = this.nCachedObjects_, nObjects = objects.length; - for (let i = 0, n = arguments.length; i !== n; ++i) { - const object = arguments[i], - uuid = object.uuid, - index = indicesByUUID[uuid]; + for (var i = 0, n = arguments.length; i !== n; ++i) { + var object = arguments[i], + 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 + var firstActiveIndex = --nCachedObjects, + 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 @@ -30313,30 +32594,31 @@ objects[firstActiveIndex] = lastObject; 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]; + for (var j = 0, m = nBindings; j !== m; ++j) { + var bindingsForPath = bindings[j], + 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]; + var _lastIndex = --nObjects, + _lastObject = objects[_lastIndex]; - if (lastIndex > 0) { - indicesByUUID[lastObject.uuid] = index; + if (_lastIndex > 0) { + indicesByUUID[_lastObject.uuid] = index; } - objects[index] = lastObject; + objects[index] = _lastObject; 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]; - bindingsForPath[index] = bindingsForPath[lastIndex]; - bindingsForPath.pop(); + for (var _j2 = 0, _m2 = nBindings; _j2 !== _m2; ++_j2) { + var _bindingsForPath = bindings[_j2]; + _bindingsForPath[index] = _bindingsForPath[_lastIndex]; + + _bindingsForPath.pop(); } } // cached or active @@ -30347,48 +32629,48 @@ this.nCachedObjects_ = nCachedObjects; } // Internal interface used by befriended PropertyBinding.Composite: + ; - - subscribe_(path, parsedPath) { + _proto.subscribe_ = function 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; + var indicesByPath = this._bindingsIndicesByPath; + var index = indicesByPath[path]; + var 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); + var paths = this._paths, + 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]; + for (var i = nCachedObjects, n = objects.length; i !== n; ++i) { + var object = objects[i]; bindingsForPath[i] = new PropertyBinding(object, path, parsedPath); } return bindingsForPath; - } + }; - unsubscribe_(path) { + _proto.unsubscribe_ = function 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]; + var 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]; + var paths = this._paths, + parsedPaths = this._parsedPaths, + bindings = this._bindings, + lastBindingsIndex = bindings.length - 1, + lastBindings = bindings[lastBindingsIndex], + lastBindingsPath = path[lastBindingsIndex]; indicesByPath[lastBindingsPath] = index; bindings[index] = lastBindings; bindings.pop(); @@ -30397,28 +32679,37 @@ paths[index] = paths[lastBindingsIndex]; paths.pop(); } - } + }; - } + return AnimationObjectGroup; + }(); AnimationObjectGroup.prototype.isAnimationObjectGroup = true; - class AnimationAction { - constructor(mixer, clip, localRoot = null, blendMode = clip.blendMode) { + var AnimationAction = /*#__PURE__*/function () { + function AnimationAction(mixer, clip, localRoot, blendMode) { + if (localRoot === void 0) { + localRoot = null; + } + + if (blendMode === void 0) { + blendMode = clip.blendMode; + } + this._mixer = mixer; this._clip = clip; this._localRoot = localRoot; this.blendMode = blendMode; - const tracks = clip.tracks, - nTracks = tracks.length, - interpolants = new Array(nTracks); - const interpolantSettings = { + var tracks = clip.tracks, + nTracks = tracks.length, + interpolants = new Array(nTracks); + var interpolantSettings = { endingStart: ZeroCurvatureEnding, endingEnd: ZeroCurvatureEnding }; - for (let i = 0; i !== nTracks; ++i) { - const interpolant = tracks[i].createInterpolant(null); + for (var i = 0; i !== nTracks; ++i) { + var interpolant = tracks[i].createInterpolant(null); interpolants[i] = interpolant; interpolant.settings = interpolantSettings; } @@ -30460,19 +32751,21 @@ } // State & Scheduling - play() { + var _proto = AnimationAction.prototype; + + _proto.play = function play() { this._mixer._activateAction(this); return this; - } + }; - stop() { + _proto.stop = function stop() { this._mixer._deactivateAction(this); return this.reset(); - } + }; - reset() { + _proto.reset = function reset() { this.paused = false; this.enabled = true; this.time = 0; // restart clip @@ -30482,23 +32775,23 @@ this._startTime = null; // forget scheduling return this.stopFading().stopWarping(); - } + }; - isRunning() { + _proto.isRunning = function isRunning() { return this.enabled && !this.paused && this.timeScale !== 0 && this._startTime === null && this._mixer._isActiveAction(this); } // return true when play has been called + ; - - isScheduled() { + _proto.isScheduled = function isScheduled() { return this._mixer._isActiveAction(this); - } + }; - startAt(time) { + _proto.startAt = function startAt(time) { this._startTime = time; return this; - } + }; - setLoop(mode, repetitions) { + _proto.setLoop = function setLoop(mode, repetitions) { this.loop = mode; this.repetitions = repetitions; return this; @@ -30506,50 +32799,50 @@ // 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) { + _proto.setEffectiveWeight = function setEffectiveWeight(weight) { 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 + ; - - getEffectiveWeight() { + _proto.getEffectiveWeight = function getEffectiveWeight() { return this._effectiveWeight; - } + }; - fadeIn(duration) { + _proto.fadeIn = function fadeIn(duration) { return this._scheduleFading(duration, 0, 1); - } + }; - fadeOut(duration) { + _proto.fadeOut = function fadeOut(duration) { return this._scheduleFading(duration, 1, 0); - } + }; - crossFadeFrom(fadeOutAction, duration, warp) { + _proto.crossFadeFrom = function 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; + var fadeInDuration = this._clip.duration, + 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) { + _proto.crossFadeTo = function crossFadeTo(fadeInAction, duration, warp) { return fadeInAction.crossFadeFrom(this, duration, warp); - } + }; - stopFading() { - const weightInterpolant = this._weightInterpolant; + _proto.stopFading = function stopFading() { + var weightInterpolant = this._weightInterpolant; if (weightInterpolant !== null) { this._weightInterpolant = null; @@ -30562,56 +32855,56 @@ // 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) { + _proto.setEffectiveTimeScale = function setEffectiveTimeScale(timeScale) { this.timeScale = timeScale; this._effectiveTimeScale = this.paused ? 0 : timeScale; return this.stopWarping(); } // return the time scale considering warping and .paused + ; - - getEffectiveTimeScale() { + _proto.getEffectiveTimeScale = function getEffectiveTimeScale() { return this._effectiveTimeScale; - } + }; - setDuration(duration) { + _proto.setDuration = function setDuration(duration) { this.timeScale = this._clip.duration / duration; return this.stopWarping(); - } + }; - syncWith(action) { + _proto.syncWith = function syncWith(action) { this.time = action.time; this.timeScale = action.timeScale; return this.stopWarping(); - } + }; - halt(duration) { + _proto.halt = function halt(duration) { return this.warp(this._effectiveTimeScale, 0, duration); - } + }; - warp(startTimeScale, endTimeScale, duration) { - const mixer = this._mixer, - now = mixer.time, - timeScale = this.timeScale; - let interpolant = this._timeScaleInterpolant; + _proto.warp = function warp(startTimeScale, endTimeScale, duration) { + var mixer = this._mixer, + now = mixer.time, + timeScale = this.timeScale; + var interpolant = this._timeScaleInterpolant; if (interpolant === null) { interpolant = mixer._lendControlInterpolant(); this._timeScaleInterpolant = interpolant; } - const times = interpolant.parameterPositions, - values = interpolant.sampleValues; + var times = interpolant.parameterPositions, + 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; + _proto.stopWarping = function stopWarping() { + var timeScaleInterpolant = this._timeScaleInterpolant; if (timeScaleInterpolant !== null) { this._timeScaleInterpolant = null; @@ -30621,22 +32914,22 @@ return this; } // Object Accessors + ; - - getMixer() { + _proto.getMixer = function getMixer() { return this._mixer; - } + }; - getClip() { + _proto.getClip = function getClip() { return this._clip; - } + }; - getRoot() { + _proto.getRoot = function getRoot() { return this._localRoot || this._mixer._root; } // Interna + ; - - _update(time, deltaTime, timeDirection, accuIndex) { + _proto._update = function _update(time, deltaTime, timeDirection, accuIndex) { // called by the mixer if (!this.enabled) { // call ._updateWeight() to update ._effectiveWeight @@ -30645,11 +32938,11 @@ return; } - const startTime = this._startTime; + var startTime = this._startTime; if (startTime !== null) { // check for scheduled start of action - const timeRunning = (time - startTime) * timeDirection; + var timeRunning = (time - startTime) * timeDirection; if (timeRunning < 0 || timeDirection === 0) { return; // yet to come / don't decide when delta = 0 @@ -30664,20 +32957,21 @@ deltaTime *= this._updateTimeScale(time); - const clipTime = this._updateTime(deltaTime); // note: _updateTime may disable the action resulting in + var clipTime = this._updateTime(deltaTime); // note: _updateTime may disable the action resulting in // an effective weight of 0 - const weight = this._updateWeight(time); + var weight = this._updateWeight(time); if (weight > 0) { - const interpolants = this._interpolants; - const propertyMixers = this._propertyBindings; + var _interpolants = this._interpolants; + var propertyMixers = this._propertyBindings; switch (this.blendMode) { case AdditiveAnimationBlendMode: - for (let j = 0, m = interpolants.length; j !== m; ++j) { - interpolants[j].evaluate(clipTime); + for (var j = 0, m = _interpolants.length; j !== m; ++j) { + _interpolants[j].evaluate(clipTime); + propertyMixers[j].accumulateAdditive(weight); } @@ -30685,24 +32979,25 @@ case NormalAnimationBlendMode: default: - for (let j = 0, m = interpolants.length; j !== m; ++j) { - interpolants[j].evaluate(clipTime); - propertyMixers[j].accumulate(accuIndex, weight); + for (var _j = 0, _m = _interpolants.length; _j !== _m; ++_j) { + _interpolants[_j].evaluate(clipTime); + + propertyMixers[_j].accumulate(accuIndex, weight); } } } - } + }; - _updateWeight(time) { - let weight = 0; + _proto._updateWeight = function _updateWeight(time) { + var weight = 0; if (this.enabled) { weight = this.weight; - const interpolant = this._weightInterpolant; + var interpolant = this._weightInterpolant; if (interpolant !== null) { - const interpolantValue = interpolant.evaluate(time)[0]; + var interpolantValue = interpolant.evaluate(time)[0]; weight *= interpolantValue; if (time > interpolant.parameterPositions[1]) { @@ -30718,17 +33013,17 @@ this._effectiveWeight = weight; return weight; - } + }; - _updateTimeScale(time) { - let timeScale = 0; + _proto._updateTimeScale = function _updateTimeScale(time) { + var timeScale = 0; if (!this.paused) { timeScale = this.timeScale; - const interpolant = this._timeScaleInterpolant; + var interpolant = this._timeScaleInterpolant; if (interpolant !== null) { - const interpolantValue = interpolant.evaluate(time)[0]; + var interpolantValue = interpolant.evaluate(time)[0]; timeScale *= interpolantValue; if (time > interpolant.parameterPositions[1]) { @@ -30747,14 +33042,14 @@ 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; + _proto._updateTime = function _updateTime(deltaTime) { + var duration = this._clip.duration; + var loop = this.loop; + var time = this.time + deltaTime; + var loopCount = this._loopCount; + var pingPong = loop === LoopPingPong; if (deltaTime === 0) { if (loopCount === -1) return time; @@ -30806,11 +33101,11 @@ if (time >= duration || time < 0) { // wrap around - const loopDelta = Math.floor(time / duration); // signed + var loopDelta = Math.floor(time / duration); // signed time -= duration * loopDelta; loopCount += Math.abs(loopDelta); - const pending = this.repetitions - loopCount; + var pending = this.repetitions - loopCount; if (pending <= 0) { // have to stop (switch state, clamp time, fire event) @@ -30827,7 +33122,7 @@ // keep running if (pending === 1) { // entering the last round - const atStart = deltaTime < 0; + var atStart = deltaTime < 0; this._setEndings(atStart, !atStart, pingPong); } else { @@ -30854,10 +33149,10 @@ } return time; - } + }; - _setEndings(atStart, atEnd, pingPong) { - const settings = this._interpolantSettings; + _proto._setEndings = function _setEndings(atStart, atEnd, pingPong) { + var settings = this._interpolantSettings; if (pingPong) { settings.endingStart = ZeroSlopeEnding; @@ -30876,60 +33171,68 @@ settings.endingEnd = WrapAroundEnding; } } - } + }; - _scheduleFading(duration, weightNow, weightThen) { - const mixer = this._mixer, - now = mixer.time; - let interpolant = this._weightInterpolant; + _proto._scheduleFading = function _scheduleFading(duration, weightNow, weightThen) { + var mixer = this._mixer, + now = mixer.time; + var interpolant = this._weightInterpolant; if (interpolant === null) { interpolant = mixer._lendControlInterpolant(); this._weightInterpolant = interpolant; } - const times = interpolant.parameterPositions, - values = interpolant.sampleValues; + var times = interpolant.parameterPositions, + values = interpolant.sampleValues; times[0] = now; values[0] = weightNow; times[1] = now + duration; values[1] = weightThen; return this; - } + }; - } + return AnimationAction; + }(); - class AnimationMixer extends EventDispatcher { - constructor(root) { - super(); - this._root = root; + var AnimationMixer = /*#__PURE__*/function (_EventDispatcher) { + _inheritsLoose(AnimationMixer, _EventDispatcher); - this._initMemoryManager(); + function AnimationMixer(root) { + var _this; - this._accuIndex = 0; - this.time = 0; - this.timeScale = 1.0; + _this = _EventDispatcher.call(this) || this; + _this._root = root; + + _this._initMemoryManager(); + + _this._accuIndex = 0; + _this.time = 0; + _this.timeScale = 1.0; + return _this; } - _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; - let bindingsByName = bindingsByRoot[rootUuid]; + var _proto = AnimationMixer.prototype; + + _proto._bindAction = function _bindAction(action, prototypeAction) { + var root = action._localRoot || this._root, + tracks = action._clip.tracks, + nTracks = tracks.length, + bindings = action._propertyBindings, + interpolants = action._interpolants, + rootUuid = root.uuid, + bindingsByRoot = this._bindingsByRootAndName; + var bindingsByName = bindingsByRoot[rootUuid]; if (bindingsByName === undefined) { bindingsByName = {}; bindingsByRoot[rootUuid] = bindingsByName; } - for (let i = 0; i !== nTracks; ++i) { - const track = tracks[i], - trackName = track.name; - let binding = bindingsByName[trackName]; + for (var i = 0; i !== nTracks; ++i) { + var track = tracks[i], + trackName = track.name; + var binding = bindingsByName[trackName]; if (binding !== undefined) { bindings[i] = binding; @@ -30947,7 +33250,7 @@ continue; } - const path = prototypeAction && prototypeAction._propertyBindings[i].binding.parsedPath; + var path = prototypeAction && prototypeAction._propertyBindings[i].binding.parsedPath; binding = new PropertyMixer(PropertyBinding.create(root, trackName, path), track.ValueTypeName, track.getValueSize()); ++binding.referenceCount; @@ -30958,26 +33261,26 @@ interpolants[i].resultBuffer = binding.buffer; } - } + }; - _activateAction(action) { + _proto._activateAction = function _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]; + var 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; // increment reference counts / sort out state + var bindings = action._propertyBindings; // increment reference counts / sort out state - for (let i = 0, n = bindings.length; i !== n; ++i) { - const binding = bindings[i]; + for (var i = 0, n = bindings.length; i !== n; ++i) { + var binding = bindings[i]; if (binding.useCount++ === 0) { this._lendBinding(binding); @@ -30988,14 +33291,14 @@ this._lendAction(action); } - } + }; - _deactivateAction(action) { + _proto._deactivateAction = function _deactivateAction(action) { if (this._isActiveAction(action)) { - const bindings = action._propertyBindings; // decrement reference counts / sort out state + var bindings = action._propertyBindings; // decrement reference counts / sort out state - for (let i = 0, n = bindings.length; i !== n; ++i) { - const binding = bindings[i]; + for (var i = 0, n = bindings.length; i !== n; ++i) { + var binding = bindings[i]; if (--binding.useCount === 0) { binding.restoreOriginalState(); @@ -31007,9 +33310,9 @@ this._takeBackAction(action); } } // Memory manager + ; - - _initMemoryManager() { + _proto._initMemoryManager = function _initMemoryManager() { this._actions = []; // 'nActiveActions' followed by inactive ones this._nActiveActions = 0; @@ -31027,7 +33330,7 @@ this._controlInterpolants = []; // same game as above this._nActiveControlInterpolants = 0; - const scope = this; + var scope = this; this.stats = { actions: { get total() { @@ -31061,17 +33364,17 @@ } }; } // Memory management for AnimationAction objects + ; - - _isActiveAction(action) { - const index = action._cacheIndex; + _proto._isActiveAction = function _isActiveAction(action) { + var index = action._cacheIndex; return index !== null && index < this._nActiveActions; - } + }; - _addInactiveAction(action, clipUuid, rootUuid) { - const actions = this._actions, - actionsByClip = this._actionsByClip; - let actionsForClip = actionsByClip[clipUuid]; + _proto._addInactiveAction = function _addInactiveAction(action, clipUuid, rootUuid) { + var actions = this._actions, + actionsByClip = this._actionsByClip; + var actionsForClip = actionsByClip[clipUuid]; if (actionsForClip === undefined) { actionsForClip = { @@ -31081,7 +33384,7 @@ action._byClipCacheIndex = 0; actionsByClip[clipUuid] = actionsForClip; } else { - const knownActions = actionsForClip.knownActions; + var knownActions = actionsForClip.knownActions; action._byClipCacheIndex = knownActions.length; knownActions.push(action); } @@ -31089,28 +33392,28 @@ 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; + _proto._removeInactiveAction = function _removeInactiveAction(action) { + var actions = this._actions, + 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; + var clipUuid = action._clip.uuid, + 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; + var actionByRoot = actionsForClip.actionByRoot, + rootUuid = (action._localRoot || this._root).uuid; delete actionByRoot[rootUuid]; if (knownActionsForClip.length === 0) { @@ -31118,57 +33421,57 @@ } this._removeInactiveBindingsForAction(action); - } + }; - _removeInactiveBindingsForAction(action) { - const bindings = action._propertyBindings; + _proto._removeInactiveBindingsForAction = function _removeInactiveBindingsForAction(action) { + var bindings = action._propertyBindings; - for (let i = 0, n = bindings.length; i !== n; ++i) { - const binding = bindings[i]; + for (var i = 0, n = bindings.length; i !== n; ++i) { + var binding = bindings[i]; if (--binding.referenceCount === 0) { this._removeInactiveBinding(binding); } } - } + }; - _lendAction(action) { + _proto._lendAction = function _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]; + var actions = this._actions, + prevIndex = action._cacheIndex, + lastActiveIndex = this._nActiveActions++, + firstInactiveAction = actions[lastActiveIndex]; action._cacheIndex = lastActiveIndex; actions[lastActiveIndex] = action; firstInactiveAction._cacheIndex = prevIndex; actions[prevIndex] = firstInactiveAction; - } + }; - _takeBackAction(action) { + _proto._takeBackAction = function _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]; + var actions = this._actions, + 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 + ; - - _addInactiveBinding(binding, rootUuid, trackName) { - const bindingsByRoot = this._bindingsByRootAndName, - bindings = this._bindings; - let bindingByName = bindingsByRoot[rootUuid]; + _proto._addInactiveBinding = function _addInactiveBinding(binding, rootUuid, trackName) { + var bindingsByRoot = this._bindingsByRootAndName, + bindings = this._bindings; + var bindingByName = bindingsByRoot[rootUuid]; if (bindingByName === undefined) { bindingByName = {}; @@ -31178,17 +33481,17 @@ 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; + _proto._removeInactiveBinding = function _removeInactiveBinding(binding) { + var 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; lastInactiveBinding._cacheIndex = cacheIndex; bindings[cacheIndex] = lastInactiveBinding; bindings.pop(); @@ -31197,35 +33500,35 @@ if (Object.keys(bindingByName).length === 0) { delete bindingsByRoot[rootUuid]; } - } + }; - _lendBinding(binding) { - const bindings = this._bindings, - prevIndex = binding._cacheIndex, - lastActiveIndex = this._nActiveBindings++, - firstInactiveBinding = bindings[lastActiveIndex]; + _proto._lendBinding = function _lendBinding(binding) { + var bindings = this._bindings, + 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]; + _proto._takeBackBinding = function _takeBackBinding(binding) { + var bindings = this._bindings, + 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 + ; - - _lendControlInterpolant() { - const interpolants = this._controlInterpolants, - lastActiveIndex = this._nActiveControlInterpolants++; - let interpolant = interpolants[lastActiveIndex]; + _proto._lendControlInterpolant = function _lendControlInterpolant() { + var interpolants = this._controlInterpolants, + lastActiveIndex = this._nActiveControlInterpolants++; + var interpolant = interpolants[lastActiveIndex]; if (interpolant === undefined) { interpolant = new LinearInterpolant(new Float32Array(2), new Float32Array(2), 1, this._controlInterpolantsResultBuffer); @@ -31234,13 +33537,13 @@ } return interpolant; - } + }; - _takeBackControlInterpolant(interpolant) { - const interpolants = this._controlInterpolants, - prevIndex = interpolant.__cacheIndex, - firstInactiveIndex = --this._nActiveControlInterpolants, - lastActiveInterpolant = interpolants[firstInactiveIndex]; + _proto._takeBackControlInterpolant = function _takeBackControlInterpolant(interpolant) { + var interpolants = this._controlInterpolants, + prevIndex = interpolant.__cacheIndex, + firstInactiveIndex = --this._nActiveControlInterpolants, + lastActiveInterpolant = interpolants[firstInactiveIndex]; interpolant.__cacheIndex = firstInactiveIndex; interpolants[firstInactiveIndex] = interpolant; lastActiveInterpolant.__cacheIndex = prevIndex; @@ -31248,15 +33551,15 @@ } // 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; - 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; + _proto.clipAction = function clipAction(clip, optionalRoot, blendMode) { + var root = optionalRoot || this._root, + rootUuid = root.uuid; + var clipObject = typeof clip === 'string' ? AnimationClip.findByName(root, clip) : clip; + var clipUuid = clipObject !== null ? clipObject.uuid : clip; + var actionsForClip = this._actionsByClip[clipUuid]; + var prototypeAction = null; if (blendMode === undefined) { if (clipObject !== null) { @@ -31267,7 +33570,7 @@ } if (actionsForClip !== undefined) { - const existingAction = actionsForClip.actionByRoot[rootUuid]; + var existingAction = actionsForClip.actionByRoot[rootUuid]; if (existingAction !== undefined && existingAction.blendMode === blendMode) { return existingAction; @@ -31283,7 +33586,7 @@ if (clipObject === null) return null; // allocate all resources required to run it - const newAction = new AnimationAction(this, clipObject, optionalRoot, blendMode); + var newAction = new AnimationAction(this, clipObject, optionalRoot, blendMode); this._bindAction(newAction, prototypeAction); // and make the action known to the memory manager @@ -31292,14 +33595,14 @@ return newAction; } // 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]; + _proto.existingAction = function existingAction(clip, optionalRoot) { + var 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]; if (actionsForClip !== undefined) { return actionsForClip.actionByRoot[rootUuid] || null; @@ -31307,81 +33610,81 @@ return null; } // deactivates all previously scheduled actions + ; + _proto.stopAllAction = function stopAllAction() { + var actions = this._actions, + nActions = this._nActiveActions; - stopAllAction() { - const actions = this._actions, - nActions = this._nActiveActions; - - for (let i = nActions - 1; i >= 0; --i) { + for (var i = nActions - 1; i >= 0; --i) { actions[i].stop(); } return this; } // advance the time and update apply the animation + ; - - update(deltaTime) { + _proto.update = function 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 + var actions = this._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]; + for (var i = 0; i !== nActions; ++i) { + var action = actions[i]; action._update(time, deltaTime, timeDirection, accuIndex); } // update scene graph - const bindings = this._bindings, - nBindings = this._nActiveBindings; + var bindings = this._bindings, + nBindings = this._nActiveBindings; - for (let i = 0; i !== nBindings; ++i) { - bindings[i].apply(accuIndex); + for (var _i = 0; _i !== nBindings; ++_i) { + bindings[_i].apply(accuIndex); } return this; } // Allows you to seek to a specific time in an animation. + ; - - setTime(timeInSeconds) { + _proto.setTime = function setTime(timeInSeconds) { this.time = 0; // Zero out time attribute for AnimationMixer object; - for (let i = 0; i < this._actions.length; i++) { + for (var 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 + ; - - getRoot() { + _proto.getRoot = function getRoot() { return this._root; } // free all resources specific to a particular clip + ; - - uncacheClip(clip) { - const actions = this._actions, - clipUuid = clip.uuid, - actionsByClip = this._actionsByClip, - actionsForClip = actionsByClip[clipUuid]; + _proto.uncacheClip = function uncacheClip(clip) { + var actions = this._actions, + 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; + var actionsToRemove = actionsForClip.knownActions; - for (let i = 0, n = actionsToRemove.length; i !== n; ++i) { - const action = actionsToRemove[i]; + for (var i = 0, n = actionsToRemove.length; i !== n; ++i) { + var action = actionsToRemove[i]; this._deactivateAction(action); - const cacheIndex = action._cacheIndex, - lastInactiveAction = actions[actions.length - 1]; + var cacheIndex = action._cacheIndex, + lastInactiveAction = actions[actions.length - 1]; action._cacheIndex = null; action._byClipCacheIndex = null; lastInactiveAction._cacheIndex = cacheIndex; @@ -31394,15 +33697,15 @@ delete actionsByClip[clipUuid]; } } // free all resources specific to a particular root target object + ; + _proto.uncacheRoot = function uncacheRoot(root) { + var rootUuid = root.uuid, + actionsByClip = this._actionsByClip; - uncacheRoot(root) { - const rootUuid = root.uuid, - actionsByClip = this._actionsByClip; - - for (const clipUuid in actionsByClip) { - const actionByRoot = actionsByClip[clipUuid].actionByRoot, - action = actionByRoot[rootUuid]; + for (var clipUuid in actionsByClip) { + var actionByRoot = actionsByClip[clipUuid].actionByRoot, + action = actionByRoot[rootUuid]; if (action !== undefined) { this._deactivateAction(action); @@ -31411,36 +33714,37 @@ } } - const bindingsByRoot = this._bindingsByRootAndName, - bindingByName = bindingsByRoot[rootUuid]; + var bindingsByRoot = this._bindingsByRootAndName, + bindingByName = bindingsByRoot[rootUuid]; if (bindingByName !== undefined) { - for (const trackName in bindingByName) { - const binding = bindingByName[trackName]; + for (var trackName in bindingByName) { + var binding = bindingByName[trackName]; binding.restoreOriginalState(); this._removeInactiveBinding(binding); } } } // remove a targeted clip from the cache + ; - - uncacheAction(clip, optionalRoot) { - const action = this.existingAction(clip, optionalRoot); + _proto.uncacheAction = function uncacheAction(clip, optionalRoot) { + var action = this.existingAction(clip, optionalRoot); if (action !== null) { this._deactivateAction(action); this._removeInactiveAction(action); } - } + }; - } + return AnimationMixer; + }(EventDispatcher); AnimationMixer.prototype._controlInterpolantsResultBuffer = new Float32Array(1); - class Uniform { - constructor(value) { + var Uniform = /*#__PURE__*/function () { + function Uniform(value) { if (typeof value === 'string') { console.warn('THREE.Uniform: Type parameter is no longer needed.'); value = arguments[1]; @@ -31449,11 +33753,14 @@ this.value = value; } - clone() { + var _proto = Uniform.prototype; + + _proto.clone = function clone() { return new Uniform(this.value.clone === undefined ? this.value : this.value.clone()); - } + }; - } + return Uniform; + }(); function InstancedInterleavedBuffer(array, stride, meshPerAttribute) { InterleavedBuffer.call(this, array, stride); @@ -31463,18 +33770,18 @@ InstancedInterleavedBuffer.prototype = Object.assign(Object.create(InterleavedBuffer.prototype), { constructor: InstancedInterleavedBuffer, isInstancedInterleavedBuffer: true, - copy: function (source) { + copy: function copy(source) { InterleavedBuffer.prototype.copy.call(this, source); this.meshPerAttribute = source.meshPerAttribute; return this; }, - clone: function (data) { - const ib = InterleavedBuffer.prototype.clone.call(this, data); + clone: function clone(data) { + var ib = InterleavedBuffer.prototype.clone.call(this, data); ib.meshPerAttribute = this.meshPerAttribute; return ib; }, - toJSON: function (data) { - const json = InterleavedBuffer.prototype.toJSON.call(this, data); + toJSON: function toJSON(data) { + var json = InterleavedBuffer.prototype.toJSON.call(this, data); json.isInstancedInterleavedBuffer = true; json.meshPerAttribute = this.meshPerAttribute; return json; @@ -31491,32 +33798,40 @@ } Object.defineProperty(GLBufferAttribute.prototype, 'needsUpdate', { - set: function (value) { + set: function set(value) { if (value === true) this.version++; } }); Object.assign(GLBufferAttribute.prototype, { isGLBufferAttribute: true, - setBuffer: function (buffer) { + setBuffer: function setBuffer(buffer) { this.buffer = buffer; return this; }, - setType: function (type, elementSize) { + setType: function setType(type, elementSize) { this.type = type; this.elementSize = elementSize; return this; }, - setItemSize: function (itemSize) { + setItemSize: function setItemSize(itemSize) { this.itemSize = itemSize; return this; }, - setCount: function (count) { + setCount: function setCount(count) { this.count = count; return this; } }); - function Raycaster(origin, direction, near = 0, far = Infinity) { + function Raycaster(origin, direction, near, far) { + if (near === void 0) { + near = 0; + } + + if (far === void 0) { + far = Infinity; + } + this.ray = new Ray(origin, direction); // direction is assumed to be normalized (for accurate distance calculations) this.near = near; @@ -31536,7 +33851,7 @@ }; Object.defineProperties(this.params, { PointCloud: { - get: function () { + get: function get() { console.warn('THREE.Raycaster: params.PointCloud has been renamed to params.Points.'); return this.Points; } @@ -31548,26 +33863,26 @@ return a.distance - b.distance; } - function intersectObject(object, raycaster, intersects, recursive) { + function _intersectObject(object, raycaster, intersects, recursive) { if (object.layers.test(raycaster.layers)) { object.raycast(raycaster, intersects); } if (recursive === true) { - const children = object.children; + var children = object.children; - for (let i = 0, l = children.length; i < l; i++) { - intersectObject(children[i], raycaster, intersects, true); + for (var i = 0, l = children.length; i < l; i++) { + _intersectObject(children[i], raycaster, intersects, true); } } } Object.assign(Raycaster.prototype, { - set: function (origin, direction) { + set: function set(origin, direction) { // direction is assumed to be normalized (for accurate distance calculations) this.ray.set(origin, direction); }, - setFromCamera: function (coords, camera) { + setFromCamera: function setFromCamera(coords, camera) { if (camera && camera.isPerspectiveCamera) { this.ray.origin.setFromMatrixPosition(camera.matrixWorld); this.ray.direction.set(coords.x, coords.y, 0.5).unproject(camera).sub(this.ray.origin).normalize(); @@ -31581,14 +33896,31 @@ console.error('THREE.Raycaster: Unsupported camera type: ' + camera.type); } }, - intersectObject: function (object, recursive = false, intersects = []) { - intersectObject(object, this, intersects, recursive); + intersectObject: function intersectObject(object, recursive, intersects) { + if (recursive === void 0) { + recursive = false; + } + + if (intersects === void 0) { + intersects = []; + } + + _intersectObject(object, this, intersects, recursive); + intersects.sort(ascSort); return intersects; }, - intersectObjects: function (objects, recursive = false, intersects = []) { - for (let i = 0, l = objects.length; i < l; i++) { - intersectObject(objects[i], this, intersects, recursive); + intersectObjects: function intersectObjects(objects, recursive, intersects) { + if (recursive === void 0) { + recursive = false; + } + + if (intersects === void 0) { + intersects = []; + } + + for (var i = 0, l = objects.length; i < l; i++) { + _intersectObject(objects[i], this, intersects, recursive); } intersects.sort(ascSort); @@ -31603,8 +33935,20 @@ * The azimuthal angle (theta) is measured from the positive z-axis. */ - class Spherical { - constructor(radius = 1, phi = 0, theta = 0) { + var Spherical = /*#__PURE__*/function () { + function Spherical(radius, phi, theta) { + if (radius === void 0) { + radius = 1; + } + + if (phi === void 0) { + phi = 0; + } + + if (theta === void 0) { + theta = 0; + } + this.radius = radius; this.phi = phi; // polar angle @@ -31613,32 +33957,34 @@ return this; } - set(radius, phi, theta) { + var _proto = Spherical.prototype; + + _proto.set = function set(radius, phi, theta) { this.radius = radius; this.phi = phi; this.theta = theta; return this; - } + }; - copy(other) { + _proto.copy = function 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 + ; - - makeSafe() { - const EPS = 0.000001; + _proto.makeSafe = function makeSafe() { + var EPS = 0.000001; this.phi = Math.max(EPS, Math.min(Math.PI - EPS, this.phi)); return this; - } + }; - setFromVector3(v) { + _proto.setFromVector3 = function setFromVector3(v) { return this.setFromCartesianCoords(v.x, v.y, v.z); - } + }; - setFromCartesianCoords(x, y, z) { + _proto.setFromCartesianCoords = function setFromCartesianCoords(x, y, z) { this.radius = Math.sqrt(x * x + y * y + z * z); if (this.radius === 0) { @@ -31650,19 +33996,32 @@ } return this; - } + }; - clone() { + _proto.clone = function clone() { return new this.constructor().copy(this); - } + }; - } + return Spherical; + }(); /** * Ref: https://en.wikipedia.org/wiki/Cylindrical_coordinate_system */ - class Cylindrical { - constructor(radius = 1, theta = 0, y = 0) { + var Cylindrical = /*#__PURE__*/function () { + function Cylindrical(radius, theta, y) { + if (radius === void 0) { + radius = 1; + } + + if (theta === void 0) { + theta = 0; + } + + if (y === void 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 @@ -31672,135 +34031,148 @@ return this; } - set(radius, theta, y) { + var _proto = Cylindrical.prototype; + + _proto.set = function set(radius, theta, y) { this.radius = radius; this.theta = theta; this.y = y; return this; - } + }; - copy(other) { + _proto.copy = function copy(other) { this.radius = other.radius; this.theta = other.theta; this.y = other.y; return this; - } + }; - setFromVector3(v) { + _proto.setFromVector3 = function setFromVector3(v) { return this.setFromCartesianCoords(v.x, v.y, v.z); - } + }; - setFromCartesianCoords(x, y, z) { + _proto.setFromCartesianCoords = function setFromCartesianCoords(x, y, z) { this.radius = Math.sqrt(x * x + z * z); this.theta = Math.atan2(x, z); this.y = y; return this; - } + }; - clone() { + _proto.clone = function clone() { return new this.constructor().copy(this); - } + }; - } + return Cylindrical; + }(); + + var _vector$8 = /*@__PURE__*/new Vector2(); - const _vector$4 = /*@__PURE__*/new Vector2(); + var Box2 = /*#__PURE__*/function () { + function Box2(min, max) { + if (min === void 0) { + min = new Vector2(+Infinity, +Infinity); + } + + if (max === void 0) { + max = new Vector2(-Infinity, -Infinity); + } - class Box2 { - constructor(min = new Vector2(+Infinity, +Infinity), max = new Vector2(-Infinity, -Infinity)) { this.min = min; this.max = max; } - set(min, max) { + var _proto = Box2.prototype; + + _proto.set = function set(min, max) { this.min.copy(min); this.max.copy(max); return this; - } + }; - setFromPoints(points) { + _proto.setFromPoints = function setFromPoints(points) { this.makeEmpty(); - for (let i = 0, il = points.length; i < il; i++) { + for (var 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); + _proto.setFromCenterAndSize = function setFromCenterAndSize(center, size) { + var halfSize = _vector$8.copy(size).multiplyScalar(0.5); this.min.copy(center).sub(halfSize); this.max.copy(center).add(halfSize); return this; - } + }; - clone() { + _proto.clone = function clone() { return new this.constructor().copy(this); - } + }; - copy(box) { + _proto.copy = function copy(box) { this.min.copy(box.min); this.max.copy(box.max); return this; - } + }; - makeEmpty() { + _proto.makeEmpty = function makeEmpty() { this.min.x = this.min.y = +Infinity; this.max.x = this.max.y = -Infinity; return this; - } + }; - isEmpty() { + _proto.isEmpty = function 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) { + _proto.getCenter = function getCenter(target) { if (target === undefined) { console.warn('THREE.Box2: .getCenter() target is now required'); target = new Vector2(); } return this.isEmpty() ? target.set(0, 0) : target.addVectors(this.min, this.max).multiplyScalar(0.5); - } + }; - getSize(target) { + _proto.getSize = function getSize(target) { if (target === undefined) { console.warn('THREE.Box2: .getSize() target is now required'); target = new Vector2(); } return this.isEmpty() ? target.set(0, 0) : target.subVectors(this.max, this.min); - } + }; - expandByPoint(point) { + _proto.expandByPoint = function expandByPoint(point) { this.min.min(point); this.max.max(point); return this; - } + }; - expandByVector(vector) { + _proto.expandByVector = function expandByVector(vector) { this.min.sub(vector); this.max.add(vector); return this; - } + }; - expandByScalar(scalar) { + _proto.expandByScalar = function expandByScalar(scalar) { this.min.addScalar(-scalar); this.max.addScalar(scalar); return this; - } + }; - containsPoint(point) { + _proto.containsPoint = function 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) { + _proto.containsBox = function 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) { + _proto.getParameter = function getParameter(point, target) { // This can potentially have a divide by zero if the box // has a size dimension of 0. if (target === undefined) { @@ -31809,131 +34181,142 @@ } 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) { + _proto.intersectsBox = function 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) { + _proto.clampPoint = function clampPoint(point, target) { if (target === undefined) { console.warn('THREE.Box2: .clampPoint() target is now required'); target = new Vector2(); } return target.copy(point).clamp(this.min, this.max); - } + }; - distanceToPoint(point) { - const clampedPoint = _vector$4.copy(point).clamp(this.min, this.max); + _proto.distanceToPoint = function distanceToPoint(point) { + var clampedPoint = _vector$8.copy(point).clamp(this.min, this.max); return clampedPoint.sub(point).length(); - } + }; - intersect(box) { + _proto.intersect = function intersect(box) { this.min.max(box.min); this.max.min(box.max); return this; - } + }; - union(box) { + _proto.union = function union(box) { this.min.min(box.min); this.max.max(box.max); return this; - } + }; - translate(offset) { + _proto.translate = function translate(offset) { this.min.add(offset); this.max.add(offset); return this; - } + }; - equals(box) { + _proto.equals = function equals(box) { return box.min.equals(this.min) && box.max.equals(this.max); - } + }; - } + return Box2; + }(); Box2.prototype.isBox2 = true; - const _startP = /*@__PURE__*/new Vector3(); + var _startP = /*@__PURE__*/new Vector3(); + + var _startEnd = /*@__PURE__*/new Vector3(); + + var Line3 = /*#__PURE__*/function () { + function Line3(start, end) { + if (start === void 0) { + start = new Vector3(); + } - const _startEnd = /*@__PURE__*/new Vector3(); + if (end === void 0) { + end = new Vector3(); + } - class Line3 { - constructor(start = new Vector3(), end = new Vector3()) { this.start = start; this.end = end; } - set(start, end) { + var _proto = Line3.prototype; + + _proto.set = function set(start, end) { this.start.copy(start); this.end.copy(end); return this; - } + }; - copy(line) { + _proto.copy = function copy(line) { this.start.copy(line.start); this.end.copy(line.end); return this; - } + }; - getCenter(target) { + _proto.getCenter = function getCenter(target) { if (target === undefined) { console.warn('THREE.Line3: .getCenter() target is now required'); target = new Vector3(); } return target.addVectors(this.start, this.end).multiplyScalar(0.5); - } + }; - delta(target) { + _proto.delta = function delta(target) { if (target === undefined) { console.warn('THREE.Line3: .delta() target is now required'); target = new Vector3(); } return target.subVectors(this.end, this.start); - } + }; - distanceSq() { + _proto.distanceSq = function distanceSq() { return this.start.distanceToSquared(this.end); - } + }; - distance() { + _proto.distance = function distance() { return this.start.distanceTo(this.end); - } + }; - at(t, target) { + _proto.at = function at(t, target) { if (target === undefined) { console.warn('THREE.Line3: .at() target is now required'); target = new Vector3(); } return this.delta(target).multiplyScalar(t).add(this.start); - } + }; - closestPointToPointParameter(point, clampToLine) { + _proto.closestPointToPointParameter = function closestPointToPointParameter(point, clampToLine) { _startP.subVectors(point, this.start); _startEnd.subVectors(this.end, this.start); - const startEnd2 = _startEnd.dot(_startEnd); + var startEnd2 = _startEnd.dot(_startEnd); - const startEnd_startP = _startEnd.dot(_startP); + var startEnd_startP = _startEnd.dot(_startP); - let t = startEnd_startP / startEnd2; + var t = startEnd_startP / startEnd2; if (clampToLine) { t = MathUtils.clamp(t, 0, 1); } return t; - } + }; - closestPointToPoint(point, clampToLine, target) { - const t = this.closestPointToPointParameter(point, clampToLine); + _proto.closestPointToPoint = function closestPointToPoint(point, clampToLine, target) { + var t = this.closestPointToPointParameter(point, clampToLine); if (target === undefined) { console.warn('THREE.Line3: .closestPointToPoint() target is now required'); @@ -31941,23 +34324,24 @@ } return this.delta(target).multiplyScalar(t).add(this.start); - } + }; - applyMatrix4(matrix) { + _proto.applyMatrix4 = function applyMatrix4(matrix) { this.start.applyMatrix4(matrix); this.end.applyMatrix4(matrix); return this; - } + }; - equals(line) { + _proto.equals = function equals(line) { return line.start.equals(this.start) && line.end.equals(this.end); - } + }; - clone() { + _proto.clone = function clone() { return new this.constructor().copy(this); - } + }; - } + return Line3; + }(); function ImmediateRenderObject(material) { Object3D.call(this); @@ -31982,76 +34366,93 @@ ImmediateRenderObject.prototype.constructor = ImmediateRenderObject; ImmediateRenderObject.prototype.isImmediateRenderObject = true; - const _vector$3 = /*@__PURE__*/new Vector3(); + var _vector$9 = /*@__PURE__*/new Vector3(); - class SpotLightHelper extends Object3D { - constructor(light, color) { - super(); - this.light = light; - this.light.updateMatrixWorld(); - this.matrix = light.matrixWorld; - this.matrixAutoUpdate = false; - 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; + var SpotLightHelper = /*#__PURE__*/function (_Object3D) { + _inheritsLoose(SpotLightHelper, _Object3D); + + function SpotLightHelper(light, color) { + var _this; + + _this = _Object3D.call(this) || this; + _this.light = light; + + _this.light.updateMatrixWorld(); + + _this.matrix = light.matrixWorld; + _this.matrixAutoUpdate = false; + _this.color = color; + var geometry = new BufferGeometry(); + var 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 (var i = 0, j = 1, l = 32; i < l; i++, j++) { + var p1 = i / l * Math.PI * 2; + var 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({ + var material = new LineBasicMaterial({ fog: false, toneMapped: false }); - this.cone = new LineSegments(geometry, material); - this.add(this.cone); - this.update(); + _this.cone = new LineSegments(geometry, material); + + _this.add(_this.cone); + + _this.update(); + + return _this; } - dispose() { + var _proto = SpotLightHelper.prototype; + + _proto.dispose = function dispose() { this.cone.geometry.dispose(); this.cone.material.dispose(); - } + }; - update() { + _proto.update = function update() { this.light.updateMatrixWorld(); - const coneLength = this.light.distance ? this.light.distance : 1000; - const coneWidth = coneLength * Math.tan(this.light.angle); + var coneLength = this.light.distance ? this.light.distance : 1000; + var coneWidth = coneLength * Math.tan(this.light.angle); this.cone.scale.set(coneWidth, coneWidth, coneLength); - _vector$3.setFromMatrixPosition(this.light.target.matrixWorld); + _vector$9.setFromMatrixPosition(this.light.target.matrixWorld); - this.cone.lookAt(_vector$3); + this.cone.lookAt(_vector$9); if (this.color !== undefined) { this.cone.material.color.set(this.color); } else { this.cone.material.color.copy(this.light.color); } - } + }; - } + return SpotLightHelper; + }(Object3D); + + var _vector$a = /*@__PURE__*/new Vector3(); - const _vector$2 = /*@__PURE__*/new Vector3(); + var _boneMatrix = /*@__PURE__*/new Matrix4(); - const _boneMatrix = /*@__PURE__*/new Matrix4(); + var _matrixWorldInv = /*@__PURE__*/new Matrix4(); - const _matrixWorldInv = /*@__PURE__*/new Matrix4(); + var SkeletonHelper = /*#__PURE__*/function (_LineSegments) { + _inheritsLoose(SkeletonHelper, _LineSegments); - class SkeletonHelper extends LineSegments { - constructor(object) { - const bones = getBoneList(object); - const geometry = new BufferGeometry(); - const vertices = []; - const colors = []; - const color1 = new Color(0, 0, 1); - const color2 = new Color(0, 1, 0); + function SkeletonHelper(object) { + var _this; - for (let i = 0; i < bones.length; i++) { - const bone = bones[i]; + var bones = getBoneList(object); + var geometry = new BufferGeometry(); + var vertices = []; + var colors = []; + var color1 = new Color(0, 0, 1); + var color2 = new Color(0, 1, 0); + + for (var i = 0; i < bones.length; i++) { + var bone = bones[i]; if (bone.parent && bone.parent.isBone) { vertices.push(0, 0, 0); @@ -32063,84 +34464,96 @@ geometry.setAttribute('position', new Float32BufferAttribute(vertices, 3)); geometry.setAttribute('color', new Float32BufferAttribute(colors, 3)); - const material = new LineBasicMaterial({ + var material = new LineBasicMaterial({ vertexColors: true, depthTest: false, depthWrite: false, toneMapped: false, transparent: true }); - super(geometry, material); - this.type = 'SkeletonHelper'; - this.isSkeletonHelper = true; - this.root = object; - this.bones = bones; - this.matrix = object.matrixWorld; - this.matrixAutoUpdate = false; + _this = _LineSegments.call(this, geometry, material) || this; + _this.type = 'SkeletonHelper'; + _this.isSkeletonHelper = true; + _this.root = object; + _this.bones = bones; + _this.matrix = object.matrixWorld; + _this.matrixAutoUpdate = false; + return _this; } - updateMatrixWorld(force) { - const bones = this.bones; - const geometry = this.geometry; - const position = geometry.getAttribute('position'); + var _proto = SkeletonHelper.prototype; + + _proto.updateMatrixWorld = function updateMatrixWorld(force) { + var bones = this.bones; + var geometry = this.geometry; + var position = geometry.getAttribute('position'); _matrixWorldInv.copy(this.root.matrixWorld).invert(); - for (let i = 0, j = 0; i < bones.length; i++) { - const bone = bones[i]; + for (var i = 0, j = 0; i < bones.length; i++) { + var bone = bones[i]; if (bone.parent && bone.parent.isBone) { _boneMatrix.multiplyMatrices(_matrixWorldInv, bone.matrixWorld); - _vector$2.setFromMatrixPosition(_boneMatrix); + _vector$a.setFromMatrixPosition(_boneMatrix); - position.setXYZ(j, _vector$2.x, _vector$2.y, _vector$2.z); + position.setXYZ(j, _vector$a.x, _vector$a.y, _vector$a.z); _boneMatrix.multiplyMatrices(_matrixWorldInv, bone.parent.matrixWorld); - _vector$2.setFromMatrixPosition(_boneMatrix); + _vector$a.setFromMatrixPosition(_boneMatrix); - position.setXYZ(j + 1, _vector$2.x, _vector$2.y, _vector$2.z); + position.setXYZ(j + 1, _vector$a.x, _vector$a.y, _vector$a.z); j += 2; } } geometry.getAttribute('position').needsUpdate = true; - super.updateMatrixWorld(force); - } - } + _LineSegments.prototype.updateMatrixWorld.call(this, force); + }; + + return SkeletonHelper; + }(LineSegments); function getBoneList(object) { - const boneList = []; + var boneList = []; if (object && object.isBone) { boneList.push(object); } - for (let i = 0; i < object.children.length; i++) { + for (var i = 0; i < object.children.length; i++) { boneList.push.apply(boneList, getBoneList(object.children[i])); } return boneList; } - class PointLightHelper extends Mesh { - constructor(light, sphereSize, color) { - const geometry = new SphereGeometry(sphereSize, 4, 2); - const material = new MeshBasicMaterial({ + var PointLightHelper = /*#__PURE__*/function (_Mesh) { + _inheritsLoose(PointLightHelper, _Mesh); + + function PointLightHelper(light, sphereSize, color) { + var _this; + + var geometry = new SphereGeometry(sphereSize, 4, 2); + var material = new MeshBasicMaterial({ wireframe: true, fog: false, toneMapped: false }); - super(geometry, material); - this.light = light; - this.light.updateMatrixWorld(); - this.color = color; - this.type = 'PointLightHelper'; - this.matrix = this.light.matrixWorld; - this.matrixAutoUpdate = false; - this.update(); + _this = _Mesh.call(this, geometry, material) || this; + _this.light = light; + + _this.light.updateMatrixWorld(); + + _this.color = color; + _this.type = 'PointLightHelper'; + _this.matrix = _this.light.matrixWorld; + _this.matrixAutoUpdate = false; + + _this.update(); /* // TODO: delete this comment? const distanceGeometry = new THREE.IcosahedronBufferGeometry( 1, 2 ); @@ -32155,14 +34568,19 @@ } this.add( this.lightDistance ); */ + + + return _this; } - dispose() { + var _proto = PointLightHelper.prototype; + + _proto.dispose = function dispose() { this.geometry.dispose(); this.material.dispose(); - } + }; - update() { + _proto.update = function update() { if (this.color !== undefined) { this.material.color.set(this.color); } else { @@ -32178,83 +34596,117 @@ } */ - } + }; - } + return PointLightHelper; + }(Mesh); - const _vector$1 = /*@__PURE__*/new Vector3(); + var _vector$b = /*@__PURE__*/new Vector3(); - const _color1 = /*@__PURE__*/new Color(); + var _color1 = /*@__PURE__*/new Color(); - const _color2 = /*@__PURE__*/new Color(); + var _color2 = /*@__PURE__*/new Color(); - class HemisphereLightHelper extends Object3D { - constructor(light, size, color) { - super(); - this.light = light; - this.light.updateMatrixWorld(); - this.matrix = light.matrixWorld; - this.matrixAutoUpdate = false; - this.color = color; - const geometry = new OctahedronGeometry(size); + var HemisphereLightHelper = /*#__PURE__*/function (_Object3D) { + _inheritsLoose(HemisphereLightHelper, _Object3D); + + function HemisphereLightHelper(light, size, color) { + var _this; + + _this = _Object3D.call(this) || this; + _this.light = light; + + _this.light.updateMatrixWorld(); + + _this.matrix = light.matrixWorld; + _this.matrixAutoUpdate = false; + _this.color = color; + var geometry = new OctahedronGeometry(size); geometry.rotateY(Math.PI * 0.5); - this.material = new MeshBasicMaterial({ + _this.material = new MeshBasicMaterial({ wireframe: true, fog: false, toneMapped: false }); - if (this.color === undefined) this.material.vertexColors = true; - const position = geometry.getAttribute('position'); - const colors = new Float32Array(position.count * 3); + if (_this.color === undefined) _this.material.vertexColors = true; + var position = geometry.getAttribute('position'); + var colors = new Float32Array(position.count * 3); geometry.setAttribute('color', new BufferAttribute(colors, 3)); - this.add(new Mesh(geometry, this.material)); - this.update(); + + _this.add(new Mesh(geometry, _this.material)); + + _this.update(); + + return _this; } - dispose() { + var _proto = HemisphereLightHelper.prototype; + + _proto.dispose = function dispose() { this.children[0].geometry.dispose(); this.children[0].material.dispose(); - } + }; - update() { - const mesh = this.children[0]; + _proto.update = function update() { + var mesh = this.children[0]; if (this.color !== undefined) { this.material.color.set(this.color); } else { - const colors = mesh.geometry.getAttribute('color'); + var 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; + for (var i = 0, l = colors.count; i < l; i++) { + var 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()); - } + mesh.lookAt(_vector$b.setFromMatrixPosition(this.light.matrixWorld).negate()); + }; - } + return HemisphereLightHelper; + }(Object3D); + + var GridHelper = /*#__PURE__*/function (_LineSegments) { + _inheritsLoose(GridHelper, _LineSegments); + + function GridHelper(size, divisions, color1, color2) { + var _this; + + if (size === void 0) { + size = 10; + } + + if (divisions === void 0) { + divisions = 10; + } + + if (color1 === void 0) { + color1 = 0x444444; + } + + if (color2 === void 0) { + color2 = 0x888888; + } - class GridHelper extends LineSegments { - constructor(size = 10, divisions = 10, color1 = 0x444444, color2 = 0x888888) { color1 = new Color(color1); color2 = new Color(color2); - const center = divisions / 2; - const step = size / divisions; - const halfSize = size / 2; - const vertices = [], - colors = []; + var center = divisions / 2; + var step = size / divisions; + var halfSize = size / 2; + var vertices = [], + colors = []; - for (let i = 0, j = 0, k = -halfSize; i <= divisions; i++, k += step) { + for (var 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); - const color = i === center ? color1 : color2; + var color = i === center ? color1 : color2; color.toArray(colors, j); j += 3; color.toArray(colors, j); @@ -32265,116 +34717,166 @@ j += 3; } - const geometry = new BufferGeometry(); + var geometry = new BufferGeometry(); geometry.setAttribute('position', new Float32BufferAttribute(vertices, 3)); geometry.setAttribute('color', new Float32BufferAttribute(colors, 3)); - const material = new LineBasicMaterial({ + var material = new LineBasicMaterial({ vertexColors: true, toneMapped: false }); - super(geometry, material); - this.type = 'GridHelper'; + _this = _LineSegments.call(this, geometry, material) || this; + _this.type = 'GridHelper'; + return _this; } - } + return GridHelper; + }(LineSegments); + + var PolarGridHelper = /*#__PURE__*/function (_LineSegments) { + _inheritsLoose(PolarGridHelper, _LineSegments); + + function PolarGridHelper(radius, radials, circles, divisions, color1, color2) { + var _this; + + if (radius === void 0) { + radius = 10; + } + + if (radials === void 0) { + radials = 16; + } + + if (circles === void 0) { + circles = 8; + } + + if (divisions === void 0) { + divisions = 64; + } + + if (color1 === void 0) { + color1 = 0x444444; + } + + if (color2 === void 0) { + color2 = 0x888888; + } - class PolarGridHelper extends LineSegments { - constructor(radius = 10, radials = 16, circles = 8, divisions = 64, color1 = 0x444444, color2 = 0x888888) { color1 = new Color(color1); color2 = new Color(color2); - const vertices = []; - const colors = []; // create the radials + var vertices = []; + var colors = []; // create the radials - for (let i = 0; i <= radials; i++) { - const v = i / radials * (Math.PI * 2); - const x = Math.sin(v) * radius; - const z = Math.cos(v) * radius; + for (var i = 0; i <= radials; i++) { + var v = i / radials * (Math.PI * 2); + var x = Math.sin(v) * radius; + var z = Math.cos(v) * radius; vertices.push(0, 0, 0); vertices.push(x, 0, z); - const color = i & 1 ? color1 : color2; + var color = i & 1 ? color1 : color2; colors.push(color.r, color.g, color.b); colors.push(color.r, color.g, color.b); } // create the circles - for (let i = 0; i <= circles; i++) { - const color = i & 1 ? color1 : color2; - const r = radius - radius / circles * i; + for (var _i = 0; _i <= circles; _i++) { + var _color = _i & 1 ? color1 : color2; + + var r = radius - radius / circles * _i; - for (let j = 0; j < divisions; j++) { + for (var 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 + var _v = j / divisions * (Math.PI * 2); + + var _x = Math.sin(_v) * r; + + var _z = Math.cos(_v) * r; - v = (j + 1) / divisions * (Math.PI * 2); - x = Math.sin(v) * r; - z = Math.cos(v) * r; - vertices.push(x, 0, z); - colors.push(color.r, color.g, color.b); + vertices.push(_x, 0, _z); + colors.push(_color.r, _color.g, _color.b); // second vertex + + _v = (j + 1) / divisions * (Math.PI * 2); + _x = Math.sin(_v) * r; + _z = Math.cos(_v) * r; + vertices.push(_x, 0, _z); + colors.push(_color.r, _color.g, _color.b); } } - const geometry = new BufferGeometry(); + var geometry = new BufferGeometry(); geometry.setAttribute('position', new Float32BufferAttribute(vertices, 3)); geometry.setAttribute('color', new Float32BufferAttribute(colors, 3)); - const material = new LineBasicMaterial({ + var material = new LineBasicMaterial({ vertexColors: true, toneMapped: false }); - super(geometry, material); - this.type = 'PolarGridHelper'; + _this = _LineSegments.call(this, geometry, material) || this; + _this.type = 'PolarGridHelper'; + return _this; } - } + return PolarGridHelper; + }(LineSegments); - const _v1 = /*@__PURE__*/new Vector3(); + var _v1$7 = /*@__PURE__*/new Vector3(); - const _v2 = /*@__PURE__*/new Vector3(); + var _v2$3 = /*@__PURE__*/new Vector3(); - const _v3 = /*@__PURE__*/new Vector3(); + var _v3$1 = /*@__PURE__*/new Vector3(); - class DirectionalLightHelper extends Object3D { - constructor(light, size, color) { - super(); - this.light = light; - this.light.updateMatrixWorld(); - this.matrix = light.matrixWorld; - this.matrixAutoUpdate = false; - this.color = color; + var DirectionalLightHelper = /*#__PURE__*/function (_Object3D) { + _inheritsLoose(DirectionalLightHelper, _Object3D); + + function DirectionalLightHelper(light, size, color) { + var _this; + + _this = _Object3D.call(this) || this; + _this.light = light; + + _this.light.updateMatrixWorld(); + + _this.matrix = light.matrixWorld; + _this.matrixAutoUpdate = false; + _this.color = color; if (size === undefined) size = 1; - let geometry = new BufferGeometry(); + var geometry = new BufferGeometry(); geometry.setAttribute('position', new Float32BufferAttribute([-size, size, 0, size, size, 0, size, -size, 0, -size, -size, 0, -size, size, 0], 3)); - const material = new LineBasicMaterial({ + var material = new LineBasicMaterial({ fog: false, toneMapped: false }); - this.lightPlane = new Line(geometry, material); - this.add(this.lightPlane); + _this.lightPlane = new Line(geometry, material); + + _this.add(_this.lightPlane); + geometry = new BufferGeometry(); geometry.setAttribute('position', new Float32BufferAttribute([0, 0, 0, 0, 0, 1], 3)); - this.targetLine = new Line(geometry, material); - this.add(this.targetLine); - this.update(); + _this.targetLine = new Line(geometry, material); + + _this.add(_this.targetLine); + + _this.update(); + + return _this; } - dispose() { + var _proto = DirectionalLightHelper.prototype; + + _proto.dispose = function dispose() { this.lightPlane.geometry.dispose(); this.lightPlane.material.dispose(); this.targetLine.geometry.dispose(); this.targetLine.material.dispose(); - } + }; - update() { - _v1.setFromMatrixPosition(this.light.matrixWorld); + _proto.update = function update() { + _v1$7.setFromMatrixPosition(this.light.matrixWorld); - _v2.setFromMatrixPosition(this.light.target.matrixWorld); + _v2$3.setFromMatrixPosition(this.light.target.matrixWorld); - _v3.subVectors(_v2, _v1); + _v3$1.subVectors(_v2$3, _v1$7); - this.lightPlane.lookAt(_v2); + this.lightPlane.lookAt(_v2$3); if (this.color !== undefined) { this.lightPlane.material.color.set(this.color); @@ -32384,15 +34886,16 @@ this.targetLine.material.color.copy(this.light.color); } - this.targetLine.lookAt(_v2); - this.targetLine.scale.z = _v3.length(); - } + this.targetLine.lookAt(_v2$3); + this.targetLine.scale.z = _v3$1.length(); + }; - } + return DirectionalLightHelper; + }(Object3D); - const _vector = /*@__PURE__*/new Vector3(); + var _vector$c = /*@__PURE__*/new Vector3(); - const _camera = /*@__PURE__*/new Camera(); + var _camera = /*@__PURE__*/new Camera(); /** * - shows frustum, line of sight and up of the camera * - suitable for fast updates @@ -32401,23 +34904,27 @@ */ - class CameraHelper extends LineSegments { - constructor(camera) { - const geometry = new BufferGeometry(); - const material = new LineBasicMaterial({ + var CameraHelper = /*#__PURE__*/function (_LineSegments) { + _inheritsLoose(CameraHelper, _LineSegments); + + function CameraHelper(camera) { + var _this; + + var geometry = new BufferGeometry(); + var material = new LineBasicMaterial({ color: 0xffffff, vertexColors: true, toneMapped: false }); - const vertices = []; - const colors = []; - const pointMap = {}; // colors + var vertices = []; + var colors = []; + var 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 + var colorFrustum = new Color(0xffaa00); + var colorCone = new Color(0xff0000); + var colorUp = new Color(0x00aaff); + var colorTarget = new Color(0xffffff); + var colorCross = new Color(0x333333); // near addLine('n1', 'n2', colorFrustum); addLine('n2', 'n4', colorFrustum); @@ -32469,21 +34976,26 @@ geometry.setAttribute('position', new Float32BufferAttribute(vertices, 3)); geometry.setAttribute('color', new Float32BufferAttribute(colors, 3)); - super(geometry, material); - this.type = 'CameraHelper'; - this.camera = camera; - if (this.camera.updateProjectionMatrix) this.camera.updateProjectionMatrix(); - this.matrix = camera.matrixWorld; - this.matrixAutoUpdate = false; - this.pointMap = pointMap; - this.update(); + _this = _LineSegments.call(this, geometry, material) || this; + _this.type = 'CameraHelper'; + _this.camera = camera; + if (_this.camera.updateProjectionMatrix) _this.camera.updateProjectionMatrix(); + _this.matrix = camera.matrixWorld; + _this.matrixAutoUpdate = false; + _this.pointMap = pointMap; + + _this.update(); + + return _this; } - update() { - const geometry = this.geometry; - const pointMap = this.pointMap; - const w = 1, - h = 1; // we need just camera projection matrix inverse + var _proto = CameraHelper.prototype; + + _proto.update = function update() { + var geometry = this.geometry; + var pointMap = this.pointMap; + var w = 1, + h = 1; // we need just camera projection matrix inverse // world matrix must be identity _camera.projectionMatrixInverse.copy(this.camera.projectionMatrixInverse); // center / target @@ -32515,55 +35027,69 @@ setPoint('cn3', pointMap, geometry, _camera, 0, -h, -1); setPoint('cn4', pointMap, geometry, _camera, 0, h, -1); geometry.getAttribute('position').needsUpdate = true; - } + }; - } + return CameraHelper; + }(LineSegments); function setPoint(point, pointMap, geometry, camera, x, y, z) { - _vector.set(x, y, z).unproject(camera); + _vector$c.set(x, y, z).unproject(camera); - const points = pointMap[point]; + var points = pointMap[point]; if (points !== undefined) { - const position = geometry.getAttribute('position'); + var position = geometry.getAttribute('position'); - for (let i = 0, l = points.length; i < l; i++) { - position.setXYZ(points[i], _vector.x, _vector.y, _vector.z); + for (var i = 0, l = points.length; i < l; i++) { + position.setXYZ(points[i], _vector$c.x, _vector$c.y, _vector$c.z); } } } - const _box = /*@__PURE__*/new Box3(); + var _box$3 = /*@__PURE__*/new Box3(); + + var BoxHelper = /*#__PURE__*/function (_LineSegments) { + _inheritsLoose(BoxHelper, _LineSegments); + + function BoxHelper(object, color) { + var _this; + + if (color === void 0) { + color = 0xffff00; + } - 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]); - const positions = new Float32Array(8 * 3); - const geometry = new BufferGeometry(); + var 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]); + var positions = new Float32Array(8 * 3); + var geometry = new BufferGeometry(); geometry.setIndex(new BufferAttribute(indices, 1)); geometry.setAttribute('position', new BufferAttribute(positions, 3)); - super(geometry, new LineBasicMaterial({ + _this = _LineSegments.call(this, geometry, new LineBasicMaterial({ color: color, toneMapped: false - })); - this.object = object; - this.type = 'BoxHelper'; - this.matrixAutoUpdate = false; - this.update(); + })) || this; + _this.object = object; + _this.type = 'BoxHelper'; + _this.matrixAutoUpdate = false; + + _this.update(); + + return _this; } - update(object) { + var _proto = BoxHelper.prototype; + + _proto.update = function update(object) { if (object !== undefined) { console.warn('THREE.BoxHelper: .update() has no longer arguments.'); } if (this.object !== undefined) { - _box.setFromObject(this.object); + _box$3.setFromObject(this.object); } - if (_box.isEmpty()) return; - const min = _box.min; - const max = _box.max; + if (_box$3.isEmpty()) return; + var min = _box$3.min; + var max = _box$3.max; /* 5____4 1/___0/| @@ -32579,8 +35105,8 @@ 7: max.x, min.y, min.z */ - const position = this.geometry.attributes.position; - const array = position.array; + var position = this.geometry.attributes.position; + var array = position.array; array[0] = max.x; array[1] = max.y; array[2] = max.z; @@ -32607,98 +35133,161 @@ array[23] = min.z; position.needsUpdate = true; this.geometry.computeBoundingSphere(); - } + }; - setFromObject(object) { + _proto.setFromObject = function setFromObject(object) { this.object = object; this.update(); return this; - } + }; - copy(source) { + _proto.copy = function copy(source) { LineSegments.prototype.copy.call(this, source); this.object = source.object; return this; - } + }; - } + return BoxHelper; + }(LineSegments); + + var Box3Helper = /*#__PURE__*/function (_LineSegments) { + _inheritsLoose(Box3Helper, _LineSegments); + + function Box3Helper(box, color) { + var _this; - class Box3Helper extends LineSegments { - constructor(box, 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]); - const positions = [1, 1, 1, -1, 1, 1, -1, -1, 1, 1, -1, 1, 1, 1, -1, -1, 1, -1, -1, -1, -1, 1, -1, -1]; - const geometry = new BufferGeometry(); + if (color === void 0) { + color = 0xffff00; + } + + var 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]); + var positions = [1, 1, 1, -1, 1, 1, -1, -1, 1, 1, -1, 1, 1, 1, -1, -1, 1, -1, -1, -1, -1, 1, -1, -1]; + var geometry = new BufferGeometry(); geometry.setIndex(new BufferAttribute(indices, 1)); geometry.setAttribute('position', new Float32BufferAttribute(positions, 3)); - super(geometry, new LineBasicMaterial({ + _this = _LineSegments.call(this, geometry, new LineBasicMaterial({ color: color, toneMapped: false - })); - this.box = box; - this.type = 'Box3Helper'; - this.geometry.computeBoundingSphere(); + })) || this; + _this.box = box; + _this.type = 'Box3Helper'; + + _this.geometry.computeBoundingSphere(); + + return _this; } - updateMatrixWorld(force) { - const box = this.box; + var _proto = Box3Helper.prototype; + + _proto.updateMatrixWorld = function updateMatrixWorld(force) { + var box = this.box; if (box.isEmpty()) return; box.getCenter(this.position); box.getSize(this.scale); this.scale.multiplyScalar(0.5); - super.updateMatrixWorld(force); - } - } + _LineSegments.prototype.updateMatrixWorld.call(this, force); + }; + + return Box3Helper; + }(LineSegments); + + var PlaneHelper = /*#__PURE__*/function (_Line) { + _inheritsLoose(PlaneHelper, _Line); - class PlaneHelper extends Line { - constructor(plane, size = 1, hex = 0xffff00) { - const color = hex; - const positions = [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, 0, 1, 0, 0, 0]; - const geometry = new BufferGeometry(); + function PlaneHelper(plane, size, hex) { + var _this; + + if (size === void 0) { + size = 1; + } + + if (hex === void 0) { + hex = 0xffff00; + } + + var color = hex; + var positions = [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, 0, 1, 0, 0, 0]; + var geometry = new BufferGeometry(); geometry.setAttribute('position', new Float32BufferAttribute(positions, 3)); geometry.computeBoundingSphere(); - super(geometry, new LineBasicMaterial({ + _this = _Line.call(this, geometry, new LineBasicMaterial({ color: color, toneMapped: false - })); - this.type = 'PlaneHelper'; - this.plane = plane; - this.size = size; - const positions2 = [1, 1, 1, -1, 1, 1, -1, -1, 1, 1, 1, 1, -1, -1, 1, 1, -1, 1]; - const geometry2 = new BufferGeometry(); + })) || this; + _this.type = 'PlaneHelper'; + _this.plane = plane; + _this.size = size; + var positions2 = [1, 1, 1, -1, 1, 1, -1, -1, 1, 1, 1, 1, -1, -1, 1, 1, -1, 1]; + var geometry2 = new BufferGeometry(); geometry2.setAttribute('position', new Float32BufferAttribute(positions2, 3)); geometry2.computeBoundingSphere(); - this.add(new Mesh(geometry2, new MeshBasicMaterial({ + + _this.add(new Mesh(geometry2, new MeshBasicMaterial({ color: color, opacity: 0.2, transparent: true, depthWrite: false, toneMapped: false }))); + + return _this; } - updateMatrixWorld(force) { - let scale = -this.plane.constant; + var _proto = PlaneHelper.prototype; + + _proto.updateMatrixWorld = function updateMatrixWorld(force) { + var scale = -this.plane.constant; if (Math.abs(scale) < 1e-8) scale = 1e-8; // sign does not matter this.scale.set(0.5 * this.size, 0.5 * this.size, scale); this.children[0].material.side = scale < 0 ? BackSide : FrontSide; // renderer flips side when determinant < 0; flipping not wanted here this.lookAt(this.plane.normal); - super.updateMatrixWorld(force); - } - } + _Line.prototype.updateMatrixWorld.call(this, force); + }; - const _axis = /*@__PURE__*/new Vector3(); + return PlaneHelper; + }(Line); - let _lineGeometry, _coneGeometry; + var _axis = /*@__PURE__*/new Vector3(); + + var _lineGeometry, _coneGeometry; + + var ArrowHelper = /*#__PURE__*/function (_Object3D) { + _inheritsLoose(ArrowHelper, _Object3D); - 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'; + function ArrowHelper(dir, origin, length, color, headLength, headWidth) { + var _this; + + if (dir === void 0) { + dir = new Vector3(0, 0, 1); + } + + if (origin === void 0) { + origin = new Vector3(0, 0, 0); + } + + if (length === void 0) { + length = 1; + } + + if (color === void 0) { + color = 0xffff00; + } + + if (headLength === void 0) { + headLength = length * 0.2; + } + + if (headWidth === void 0) { + headWidth = headLength * 0.2; + } + + _this = _Object3D.call(this) || this; + _this.type = 'ArrowHelper'; if (_lineGeometry === undefined) { _lineGeometry = new BufferGeometry(); @@ -32710,24 +35299,34 @@ _coneGeometry.translate(0, -0.5, 0); } - this.position.copy(origin); - this.line = new Line(_lineGeometry, new LineBasicMaterial({ + _this.position.copy(origin); + + _this.line = new Line(_lineGeometry, new LineBasicMaterial({ color: color, toneMapped: false })); - this.line.matrixAutoUpdate = false; - this.add(this.line); - this.cone = new Mesh(_coneGeometry, new MeshBasicMaterial({ + _this.line.matrixAutoUpdate = false; + + _this.add(_this.line); + + _this.cone = new Mesh(_coneGeometry, new MeshBasicMaterial({ color: color, toneMapped: false })); - this.cone.matrixAutoUpdate = false; - this.add(this.cone); - this.setDirection(dir); - this.setLength(length, headLength, headWidth); + _this.cone.matrixAutoUpdate = false; + + _this.add(_this.cone); + + _this.setDirection(dir); + + _this.setLength(length, headLength, headWidth); + + return _this; } - setDirection(dir) { + var _proto = ArrowHelper.prototype; + + _proto.setDirection = function setDirection(dir) { // dir is assumed to be normalized if (dir.y > 0.99999) { this.quaternion.set(0, 0, 0, 1); @@ -32736,72 +35335,92 @@ } else { _axis.set(dir.z, 0, -dir.x).normalize(); - const radians = Math.acos(dir.y); + var radians = Math.acos(dir.y); this.quaternion.setFromAxisAngle(_axis, radians); } - } + }; + + _proto.setLength = function setLength(length, headLength, headWidth) { + if (headLength === void 0) { + headLength = length * 0.2; + } + + if (headWidth === void 0) { + headWidth = headLength * 0.2; + } - 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) { + _proto.setColor = function setColor(color) { this.line.material.color.set(color); this.cone.material.color.set(color); - } + }; + + _proto.copy = function copy(source) { + _Object3D.prototype.copy.call(this, source, false); - copy(source) { - super.copy(source, false); this.line.copy(source.line); this.cone.copy(source.cone); return this; - } + }; - } + return ArrowHelper; + }(Object3D); + + var AxesHelper = /*#__PURE__*/function (_LineSegments) { + _inheritsLoose(AxesHelper, _LineSegments); + + function AxesHelper(size) { + var _this; + + if (size === void 0) { + size = 1; + } - class AxesHelper extends LineSegments { - constructor(size = 1) { - const vertices = [0, 0, 0, size, 0, 0, 0, 0, 0, 0, size, 0, 0, 0, 0, 0, 0, size]; - const colors = [1, 0, 0, 1, 0.6, 0, 0, 1, 0, 0.6, 1, 0, 0, 0, 1, 0, 0.6, 1]; - const geometry = new BufferGeometry(); + var vertices = [0, 0, 0, size, 0, 0, 0, 0, 0, 0, size, 0, 0, 0, 0, 0, 0, size]; + var colors = [1, 0, 0, 1, 0.6, 0, 0, 1, 0, 0.6, 1, 0, 0, 0, 1, 0, 0.6, 1]; + var geometry = new BufferGeometry(); geometry.setAttribute('position', new Float32BufferAttribute(vertices, 3)); geometry.setAttribute('color', new Float32BufferAttribute(colors, 3)); - const material = new LineBasicMaterial({ + var material = new LineBasicMaterial({ vertexColors: true, toneMapped: false }); - super(geometry, material); - this.type = 'AxesHelper'; + _this = _LineSegments.call(this, geometry, material) || this; + _this.type = 'AxesHelper'; + return _this; } - } + return AxesHelper; + }(LineSegments); - const _floatView = new Float32Array(1); + var _floatView = new Float32Array(1); - const _int32View = new Int32Array(_floatView.buffer); + var _int32View = new Int32Array(_floatView.buffer); - const DataUtils = { + var DataUtils = { // Converts float32 to float16 (stored as uint16 value). - toHalfFloat: function (val) { + toHalfFloat: function toHalfFloat(val) { // 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; + var x = _int32View[0]; + var bits = x >> 16 & 0x8000; /* Get the sign */ - let m = x >> 12 & 0x07ff; + var m = x >> 12 & 0x07ff; /* Keep one extra bit for rounding */ - const e = x >> 23 & 0xff; + var e = x >> 23 & 0xff; /* Using int is faster here */ /* If zero, or denormal, or exponent underflows too much for a denormal @@ -32839,51 +35458,43 @@ } }; - 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 + var _ENCODINGS; + var LOD_MIN = 4; + var LOD_MAX = 8; + var 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 + var EXTRA_LOD_SIGMA = [0.125, 0.215, 0.35, 0.446, 0.526, 0.582]; + var 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, - [RGBM7Encoding]: 3, - [RGBM16Encoding]: 4, - [RGBDEncoding]: 5, - [GammaEncoding]: 6 - }; - const backgroundMaterial = new MeshBasicMaterial({ + var MAX_SAMPLES = 20; + var ENCODINGS = (_ENCODINGS = {}, _ENCODINGS[LinearEncoding] = 0, _ENCODINGS[sRGBEncoding] = 1, _ENCODINGS[RGBEEncoding] = 2, _ENCODINGS[RGBM7Encoding] = 3, _ENCODINGS[RGBM16Encoding] = 4, _ENCODINGS[RGBDEncoding] = 5, _ENCODINGS[GammaEncoding] = 6, _ENCODINGS); + var backgroundMaterial = new MeshBasicMaterial({ side: BackSide, depthWrite: false, depthTest: false }); - const backgroundBox = new Mesh(new BoxGeometry(), backgroundMaterial); + var backgroundBox = new Mesh(new BoxGeometry(), backgroundMaterial); - const _flatCamera = /*@__PURE__*/new OrthographicCamera(); + var _flatCamera = /*@__PURE__*/new OrthographicCamera(); - const { - _lodPlanes, - _sizeLods, - _sigmas - } = /*@__PURE__*/_createPlanes(); + var _createPlanes2 = /*@__PURE__*/_createPlanes(), + _lodPlanes = _createPlanes2._lodPlanes, + _sizeLods = _createPlanes2._sizeLods, + _sigmas = _createPlanes2._sigmas; - const _clearColor = /*@__PURE__*/new Color(); + var _clearColor = /*@__PURE__*/new Color(); - let _oldTarget = null; // Golden Ratio + var _oldTarget = null; // Golden Ratio - const PHI = (1 + Math.sqrt(5)) / 2; - const INV_PHI = 1 / PHI; // Vertices of a dodecahedron (except the opposites, which represent the + var PHI = (1 + Math.sqrt(5)) / 2; + var 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)]; + var _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 @@ -32897,15 +35508,15 @@ */ function convertLinearToRGBE(color) { - const maxComponent = Math.max(color.r, color.g, color.b); - const fExp = Math.min(Math.max(Math.ceil(Math.log2(maxComponent)), -128.0), 127.0); + var maxComponent = Math.max(color.r, color.g, color.b); + var fExp = Math.min(Math.max(Math.ceil(Math.log2(maxComponent)), -128.0), 127.0); color.multiplyScalar(Math.pow(2.0, -fExp)); - const alpha = (fExp + 128.0) / 255.0; + var alpha = (fExp + 128.0) / 255.0; return alpha; } - class PMREMGenerator { - constructor(renderer) { + var PMREMGenerator = /*#__PURE__*/function () { + function PMREMGenerator(renderer) { this._renderer = renderer; this._pingPongRenderTarget = null; this._blurMaterial = _getBlurShader(MAX_SAMPLES); @@ -32923,10 +35534,24 @@ */ - fromScene(scene, sigma = 0, near = 0.1, far = 100) { + var _proto = PMREMGenerator.prototype; + + _proto.fromScene = function fromScene(scene, sigma, near, far) { + if (sigma === void 0) { + sigma = 0; + } + + if (near === void 0) { + near = 0.1; + } + + if (far === void 0) { + far = 100; + } + _oldTarget = this._renderer.getRenderTarget(); - const cubeUVRenderTarget = this._allocateTargets(); + var cubeUVRenderTarget = this._allocateTargets(); this._sceneToCubeUV(scene, near, far, cubeUVRenderTarget); @@ -32945,9 +35570,9 @@ * (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) { + _proto.fromEquirectangular = function fromEquirectangular(equirectangular) { return this._fromTexture(equirectangular); } /** @@ -32955,18 +35580,18 @@ * (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) { + _proto.fromCubemap = function fromCubemap(cubemap) { return this._fromTexture(cubemap); } /** * 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() { + _proto.compileCubemapShader = function compileCubemapShader() { if (this._cubemapShader === null) { this._cubemapShader = _getCubemapShader(); @@ -32977,9 +35602,9 @@ * 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() { + _proto.compileEquirectangularShader = function compileEquirectangularShader() { if (this._equirectShader === null) { this._equirectShader = _getEquirectShader(); @@ -32991,21 +35616,21 @@ * 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() { + _proto.dispose = function dispose() { this._blurMaterial.dispose(); if (this._cubemapShader !== null) this._cubemapShader.dispose(); if (this._equirectShader !== null) this._equirectShader.dispose(); - for (let i = 0; i < _lodPlanes.length; i++) { + for (var i = 0; i < _lodPlanes.length; i++) { _lodPlanes[i].dispose(); } } // private interface + ; - - _cleanup(outputTarget) { + _proto._cleanup = function _cleanup(outputTarget) { this._pingPongRenderTarget.dispose(); this._renderer.setRenderTarget(_oldTarget); @@ -33013,12 +35638,12 @@ outputTarget.scissorTest = false; _setViewport(outputTarget, 0, 0, outputTarget.width, outputTarget.height); - } + }; - _fromTexture(texture) { + _proto._fromTexture = function _fromTexture(texture) { _oldTarget = this._renderer.getRenderTarget(); - const cubeUVRenderTarget = this._allocateTargets(texture); + var cubeUVRenderTarget = this._allocateTargets(texture); this._textureToCubeUV(texture, cubeUVRenderTarget); @@ -33027,11 +35652,11 @@ this._cleanup(cubeUVRenderTarget); return cubeUVRenderTarget; - } + }; - _allocateTargets(texture) { + _proto._allocateTargets = function _allocateTargets(texture) { // warning: null texture is valid - const params = { + var params = { magFilter: NearestFilter, minFilter: NearestFilter, generateMipmaps: false, @@ -33041,53 +35666,55 @@ depthBuffer: false }; - const cubeUVRenderTarget = _createRenderTarget(params); + var cubeUVRenderTarget = _createRenderTarget(params); cubeUVRenderTarget.depthBuffer = texture ? false : true; this._pingPongRenderTarget = _createRenderTarget(params); return cubeUVRenderTarget; - } + }; - _compileMaterial(material) { - const tmpMesh = new Mesh(_lodPlanes[0], material); + _proto._compileMaterial = function _compileMaterial(material) { + var tmpMesh = new Mesh(_lodPlanes[0], material); this._renderer.compile(tmpMesh, _flatCamera); - } + }; - _sceneToCubeUV(scene, near, far, cubeUVRenderTarget) { - const fov = 90; - const aspect = 1; - const cubeCamera = new PerspectiveCamera(fov, aspect, near, far); - const upSign = [1, -1, 1, 1, 1, 1]; - const forwardSign = [1, 1, 1, -1, -1, -1]; - const renderer = this._renderer; - const originalAutoClear = renderer.autoClear; - const outputEncoding = renderer.outputEncoding; - const toneMapping = renderer.toneMapping; + _proto._sceneToCubeUV = function _sceneToCubeUV(scene, near, far, cubeUVRenderTarget) { + var fov = 90; + var aspect = 1; + var cubeCamera = new PerspectiveCamera(fov, aspect, near, far); + var upSign = [1, -1, 1, 1, 1, 1]; + var forwardSign = [1, 1, 1, -1, -1, -1]; + var renderer = this._renderer; + var originalAutoClear = renderer.autoClear; + var outputEncoding = renderer.outputEncoding; + var toneMapping = renderer.toneMapping; renderer.getClearColor(_clearColor); renderer.toneMapping = NoToneMapping; renderer.outputEncoding = LinearEncoding; renderer.autoClear = false; - let useSolidColor = false; - const background = scene.background; + var useSolidColor = false; + var background = scene.background; if (background) { if (background.isColor) { backgroundMaterial.color.copy(background).convertSRGBToLinear(); scene.background = null; - const alpha = convertLinearToRGBE(backgroundMaterial.color); + var alpha = convertLinearToRGBE(backgroundMaterial.color); backgroundMaterial.opacity = alpha; useSolidColor = true; } } else { backgroundMaterial.color.copy(_clearColor).convertSRGBToLinear(); - const alpha = convertLinearToRGBE(backgroundMaterial.color); - backgroundMaterial.opacity = alpha; + + var _alpha = convertLinearToRGBE(backgroundMaterial.color); + + backgroundMaterial.opacity = _alpha; useSolidColor = true; } - for (let i = 0; i < 6; i++) { - const col = i % 3; + for (var i = 0; i < 6; i++) { + var col = i % 3; if (col == 0) { cubeCamera.up.set(0, upSign[i], 0); @@ -33114,10 +35741,10 @@ renderer.toneMapping = toneMapping; renderer.outputEncoding = outputEncoding; renderer.autoClear = originalAutoClear; - } + }; - _textureToCubeUV(texture, cubeUVRenderTarget) { - const renderer = this._renderer; + _proto._textureToCubeUV = function _textureToCubeUV(texture, cubeUVRenderTarget) { + var renderer = this._renderer; if (texture.isCubeTexture) { if (this._cubemapShader == null) { @@ -33129,9 +35756,9 @@ } } - const material = texture.isCubeTexture ? this._cubemapShader : this._equirectShader; - const mesh = new Mesh(_lodPlanes[0], material); - const uniforms = material.uniforms; + var material = texture.isCubeTexture ? this._cubemapShader : this._equirectShader; + var mesh = new Mesh(_lodPlanes[0], material); + var uniforms = material.uniforms; uniforms['envMap'].value = texture; if (!texture.isCubeTexture) { @@ -33145,16 +35772,16 @@ renderer.setRenderTarget(cubeUVRenderTarget); renderer.render(mesh, _flatCamera); - } + }; - _applyPMREM(cubeUVRenderTarget) { - const renderer = this._renderer; - const autoClear = renderer.autoClear; + _proto._applyPMREM = function _applyPMREM(cubeUVRenderTarget) { + var renderer = this._renderer; + var 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]; + for (var i = 1; i < TOTAL_LODS; i++) { + var sigma = Math.sqrt(_sigmas[i] * _sigmas[i] - _sigmas[i - 1] * _sigmas[i - 1]); + var poleAxis = _axisDirections[(i - 1) % _axisDirections.length]; this._blur(cubeUVRenderTarget, i - 1, i, sigma, poleAxis); } @@ -33168,43 +35795,44 @@ * 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; + _proto._blur = function _blur(cubeUVRenderTarget, lodIn, lodOut, sigma, poleAxis) { + var 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; + _proto._halfBlur = function _halfBlur(targetIn, targetOut, lodIn, lodOut, sigmaRadians, direction, poleAxis) { + var renderer = this._renderer; + var 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. - const STANDARD_DEVIATIONS = 3; - const blurMesh = new Mesh(_lodPlanes[lodOut], blurMaterial); - const blurUniforms = blurMaterial.uniforms; - const pixels = _sizeLods[lodIn] - 1; - 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; + var STANDARD_DEVIATIONS = 3; + var blurMesh = new Mesh(_lodPlanes[lodOut], blurMaterial); + var blurUniforms = blurMaterial.uniforms; + var pixels = _sizeLods[lodIn] - 1; + var radiansPerPixel = isFinite(sigmaRadians) ? Math.PI / (2 * pixels) : 2 * Math.PI / (2 * MAX_SAMPLES - 1); + var sigmaPixels = sigmaRadians / radiansPerPixel; + var 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}`); + 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; + var weights = []; + var sum = 0; - for (let i = 0; i < MAX_SAMPLES; ++i) { - const x = i / sigmaPixels; - const weight = Math.exp(-x * x / 2); + for (var i = 0; i < MAX_SAMPLES; ++i) { + var _x = i / sigmaPixels; + + var weight = Math.exp(-_x * _x / 2); weights.push(weight); if (i == 0) { @@ -33214,8 +35842,8 @@ } } - for (let i = 0; i < weights.length; i++) { - weights[i] = weights[i] / sum; + for (var _i = 0; _i < weights.length; _i++) { + weights[_i] = weights[_i] / sum; } blurUniforms['envMap'].value = targetIn.texture; @@ -33231,17 +35859,18 @@ blurUniforms['mipInt'].value = LOD_MAX - lodIn; blurUniforms['inputEncoding'].value = ENCODINGS[targetIn.texture.encoding]; blurUniforms['outputEncoding'].value = ENCODINGS[targetIn.texture.encoding]; - 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); + var outputSize = _sizeLods[lodOut]; + var x = 3 * Math.max(0, SIZE_MAX - 2 * outputSize); + var 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); - } + }; - } + return PMREMGenerator; + }(); function _isLDR(texture) { if (texture === undefined || texture.type !== UnsignedByteType) return false; @@ -33249,17 +35878,17 @@ } function _createPlanes() { - const _lodPlanes = []; - const _sizeLods = []; - const _sigmas = []; - let lod = LOD_MAX; + var _lodPlanes = []; + var _sizeLods = []; + var _sigmas = []; + var lod = LOD_MAX; - for (let i = 0; i < TOTAL_LODS; i++) { - const sizeLod = Math.pow(2, lod); + for (var i = 0; i < TOTAL_LODS; i++) { + var sizeLod = Math.pow(2, lod); _sizeLods.push(sizeLod); - let sigma = 1.0 / sizeLod; + var sigma = 1.0 / sizeLod; if (i > LOD_MAX - LOD_MIN) { sigma = EXTRA_LOD_SIGMA[i - LOD_MAX + LOD_MIN - 1]; @@ -33269,30 +35898,30 @@ _sigmas.push(sigma); - const texelSize = 1.0 / (sizeLod - 1); - const min = -texelSize / 2; - const max = 1 + texelSize / 2; - const uv1 = [min, min, max, min, max, max, min, min, max, max, min, max]; - const cubeFaces = 6; - const vertices = 6; - const positionSize = 3; - const uvSize = 2; - const faceIndexSize = 1; - 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; - const coordinates = [x, y, 0, x + 2 / 3, y, 0, x + 2 / 3, y + 1, 0, x, y, 0, x + 2 / 3, y + 1, 0, x, y + 1, 0]; + var texelSize = 1.0 / (sizeLod - 1); + var min = -texelSize / 2; + var max = 1 + texelSize / 2; + var uv1 = [min, min, max, min, max, max, min, min, max, max, min, max]; + var cubeFaces = 6; + var vertices = 6; + var positionSize = 3; + var uvSize = 2; + var faceIndexSize = 1; + var position = new Float32Array(positionSize * vertices * cubeFaces); + var uv = new Float32Array(uvSize * vertices * cubeFaces); + var faceIndex = new Float32Array(faceIndexSize * vertices * cubeFaces); + + for (var face = 0; face < cubeFaces; face++) { + var x = face % 3 * 2 / 3 - 1; + var y = face > 2 ? 0 : -1; + var coordinates = [x, y, 0, x + 2 / 3, y, 0, x + 2 / 3, y + 1, 0, x, y, 0, x + 2 / 3, y + 1, 0, x, y + 1, 0]; position.set(coordinates, positionSize * vertices * face); uv.set(uv1, uvSize * vertices * face); - const fill = [face, face, face, face, face, face]; + var fill = [face, face, face, face, face, face]; faceIndex.set(fill, faceIndexSize * vertices * face); } - const planes = new BufferGeometry(); + var planes = new BufferGeometry(); planes.setAttribute('position', new BufferAttribute(position, positionSize)); planes.setAttribute('uv', new BufferAttribute(uv, uvSize)); planes.setAttribute('faceIndex', new BufferAttribute(faceIndex, faceIndexSize)); @@ -33305,14 +35934,14 @@ } return { - _lodPlanes, - _sizeLods, - _sigmas + _lodPlanes: _lodPlanes, + _sizeLods: _sizeLods, + _sigmas: _sigmas }; } function _createRenderTarget(params) { - const cubeUVRenderTarget = new WebGLRenderTarget(3 * SIZE_MAX, 3 * SIZE_MAX, params); + var cubeUVRenderTarget = new WebGLRenderTarget(3 * SIZE_MAX, 3 * SIZE_MAX, params); cubeUVRenderTarget.texture.mapping = CubeUVReflectionMapping; cubeUVRenderTarget.texture.name = 'PMREM.cubeUv'; cubeUVRenderTarget.scissorTest = true; @@ -33325,9 +35954,9 @@ } function _getBlurShader(maxSamples) { - const weights = new Float32Array(maxSamples); - const poleAxis = new Vector3(0, 1, 0); - const shaderMaterial = new RawShaderMaterial({ + var weights = new Float32Array(maxSamples); + var poleAxis = new Vector3(0, 1, 0); + var shaderMaterial = new RawShaderMaterial({ name: 'SphericalGaussianBlur', defines: { 'n': maxSamples @@ -33364,71 +35993,7 @@ vertexShader: _getCommonVertexShader(), fragmentShader: /* glsl */ - ` - - precision mediump float; - precision mediump int; - - varying vec3 vOutputDirection; - - uniform sampler2D envMap; - uniform int samples; - uniform float weights[ n ]; - uniform bool latitudinal; - uniform float dTheta; - uniform float mipInt; - uniform vec3 poleAxis; - - ${_getEncodings()} - - #define ENVMAP_TYPE_CUBE_UV - #include - - vec3 getSample( float theta, vec3 axis ) { - - float cosTheta = cos( theta ); - // Rodrigues' axis-angle rotation - vec3 sampleDirection = vOutputDirection * cosTheta - + cross( axis, vOutputDirection ) * sin( theta ) - + axis * dot( axis, vOutputDirection ) * ( 1.0 - cosTheta ); - - return bilinearCubeUV( envMap, sampleDirection, mipInt ); - - } - - void main() { - - vec3 axis = latitudinal ? poleAxis : cross( poleAxis, vOutputDirection ); - - if ( all( equal( axis, vec3( 0.0 ) ) ) ) { - - axis = vec3( vOutputDirection.z, 0.0, - vOutputDirection.x ); - - } - - axis = normalize( axis ); - - gl_FragColor = vec4( 0.0, 0.0, 0.0, 1.0 ); - gl_FragColor.rgb += weights[ 0 ] * getSample( 0.0, axis ); - - for ( int i = 1; i < n; i++ ) { - - if ( i >= samples ) { - - break; - - } - - float theta = dTheta * float( i ); - gl_FragColor.rgb += weights[ i ] * getSample( -1.0 * theta, axis ); - gl_FragColor.rgb += weights[ i ] * getSample( theta, axis ); - - } - - gl_FragColor = linearToOutputTexel( gl_FragColor ); - - } - `, + "\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" + _getEncodings() + "\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: NoBlending, depthTest: false, depthWrite: false @@ -33437,8 +36002,8 @@ } function _getEquirectShader() { - const texelSize = new Vector2(1, 1); - const shaderMaterial = new RawShaderMaterial({ + var texelSize = new Vector2(1, 1); + var shaderMaterial = new RawShaderMaterial({ name: 'EquirectangularToCubeUV', uniforms: { 'envMap': { @@ -33457,45 +36022,7 @@ vertexShader: _getCommonVertexShader(), fragmentShader: /* glsl */ - ` - - precision mediump float; - precision mediump int; - - varying vec3 vOutputDirection; - - uniform sampler2D envMap; - uniform vec2 texelSize; - - ${_getEncodings()} - - #include - - void main() { - - gl_FragColor = vec4( 0.0, 0.0, 0.0, 1.0 ); - - vec3 outputDirection = normalize( vOutputDirection ); - vec2 uv = equirectUv( outputDirection ); - - vec2 f = fract( uv / texelSize - 0.5 ); - uv -= f * texelSize; - vec3 tl = envMapTexelToLinear( texture2D ( envMap, uv ) ).rgb; - uv.x += texelSize.x; - vec3 tr = envMapTexelToLinear( texture2D ( envMap, uv ) ).rgb; - uv.y += texelSize.y; - vec3 br = envMapTexelToLinear( texture2D ( envMap, uv ) ).rgb; - uv.x -= texelSize.x; - vec3 bl = envMapTexelToLinear( texture2D ( envMap, uv ) ).rgb; - - vec3 tm = mix( tl, tr, f.x ); - vec3 bm = mix( bl, br, f.x ); - gl_FragColor.rgb = mix( tm, bm, f.y ); - - gl_FragColor = linearToOutputTexel( gl_FragColor ); - - } - `, + "\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" + _getEncodings() + "\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: NoBlending, depthTest: false, depthWrite: false @@ -33504,7 +36031,7 @@ } function _getCubemapShader() { - const shaderMaterial = new RawShaderMaterial({ + var shaderMaterial = new RawShaderMaterial({ name: 'CubemapToCubeUV', uniforms: { 'envMap': { @@ -33520,25 +36047,7 @@ vertexShader: _getCommonVertexShader(), fragmentShader: /* glsl */ - ` - - precision mediump float; - precision mediump int; - - varying vec3 vOutputDirection; - - uniform samplerCube envMap; - - ${_getEncodings()} - - void main() { - - gl_FragColor = vec4( 0.0, 0.0, 0.0, 1.0 ); - gl_FragColor.rgb = envMapTexelToLinear( textureCube( envMap, vec3( - vOutputDirection.x, vOutputDirection.yz ) ) ).rgb; - gl_FragColor = linearToOutputTexel( gl_FragColor ); - - } - `, + "\n\n\t\t\tprecision mediump float;\n\t\t\tprecision mediump int;\n\n\t\t\tvarying vec3 vOutputDirection;\n\n\t\t\tuniform samplerCube envMap;\n\n\t\t\t" + _getEncodings() + "\n\n\t\t\tvoid main() {\n\n\t\t\t\tgl_FragColor = vec4( 0.0, 0.0, 0.0, 1.0 );\n\t\t\t\tgl_FragColor.rgb = envMapTexelToLinear( textureCube( envMap, vec3( - vOutputDirection.x, vOutputDirection.yz ) ) ).rgb;\n\t\t\t\tgl_FragColor = linearToOutputTexel( gl_FragColor );\n\n\t\t\t}\n\t\t", blending: NoBlending, depthTest: false, depthWrite: false @@ -33549,164 +36058,31 @@ function _getCommonVertexShader() { return ( /* glsl */ - ` - - precision mediump float; - precision mediump int; - - attribute vec3 position; - attribute vec2 uv; - attribute float faceIndex; - - varying vec3 vOutputDirection; - - // RH coordinate system; PMREM face-indexing convention - vec3 getDirection( vec2 uv, float face ) { - - uv = 2.0 * uv - 1.0; - - vec3 direction = vec3( uv, 1.0 ); - - if ( face == 0.0 ) { - - direction = direction.zyx; // ( 1, v, u ) pos x - - } else if ( face == 1.0 ) { - - direction = direction.xzy; - direction.xz *= -1.0; // ( -u, 1, -v ) pos y - - } else if ( face == 2.0 ) { - - direction.x *= -1.0; // ( -u, v, 1 ) pos z - - } else if ( face == 3.0 ) { - - direction = direction.zyx; - direction.xz *= -1.0; // ( -1, v, -u ) neg x - - } else if ( face == 4.0 ) { - - direction = direction.xzy; - direction.xy *= -1.0; // ( -u, -1, v ) neg y - - } else if ( face == 5.0 ) { - - direction.z *= -1.0; // ( u, v, -1 ) neg z - - } - - return direction; - - } - - void main() { - - vOutputDirection = getDirection( uv, faceIndex ); - gl_Position = vec4( position, 1.0 ); - - } - ` + "\n\n\t\tprecision mediump float;\n\t\tprecision mediump int;\n\n\t\tattribute vec3 position;\n\t\tattribute vec2 uv;\n\t\tattribute float faceIndex;\n\n\t\tvarying vec3 vOutputDirection;\n\n\t\t// RH coordinate system; PMREM face-indexing convention\n\t\tvec3 getDirection( vec2 uv, float face ) {\n\n\t\t\tuv = 2.0 * uv - 1.0;\n\n\t\t\tvec3 direction = vec3( uv, 1.0 );\n\n\t\t\tif ( face == 0.0 ) {\n\n\t\t\t\tdirection = direction.zyx; // ( 1, v, u ) pos x\n\n\t\t\t} else if ( face == 1.0 ) {\n\n\t\t\t\tdirection = direction.xzy;\n\t\t\t\tdirection.xz *= -1.0; // ( -u, 1, -v ) pos y\n\n\t\t\t} else if ( face == 2.0 ) {\n\n\t\t\t\tdirection.x *= -1.0; // ( -u, v, 1 ) pos z\n\n\t\t\t} else if ( face == 3.0 ) {\n\n\t\t\t\tdirection = direction.zyx;\n\t\t\t\tdirection.xz *= -1.0; // ( -1, v, -u ) neg x\n\n\t\t\t} else if ( face == 4.0 ) {\n\n\t\t\t\tdirection = direction.xzy;\n\t\t\t\tdirection.xy *= -1.0; // ( -u, -1, v ) neg y\n\n\t\t\t} else if ( face == 5.0 ) {\n\n\t\t\t\tdirection.z *= -1.0; // ( u, v, -1 ) neg z\n\n\t\t\t}\n\n\t\t\treturn direction;\n\n\t\t}\n\n\t\tvoid main() {\n\n\t\t\tvOutputDirection = getDirection( uv, faceIndex );\n\t\t\tgl_Position = vec4( position, 1.0 );\n\n\t\t}\n\t" ); } function _getEncodings() { return ( /* glsl */ - ` - - uniform int inputEncoding; - uniform int outputEncoding; - - #include - - vec4 inputTexelToLinear( vec4 value ) { - - if ( inputEncoding == 0 ) { - - return value; - - } else if ( inputEncoding == 1 ) { - - return sRGBToLinear( value ); - - } else if ( inputEncoding == 2 ) { - - return RGBEToLinear( value ); - - } else if ( inputEncoding == 3 ) { - - return RGBMToLinear( value, 7.0 ); - - } else if ( inputEncoding == 4 ) { - - return RGBMToLinear( value, 16.0 ); - - } else if ( inputEncoding == 5 ) { - - return RGBDToLinear( value, 256.0 ); - - } else { - - return GammaToLinear( value, 2.2 ); - - } - - } - - vec4 linearToOutputTexel( vec4 value ) { - - if ( outputEncoding == 0 ) { - - return value; - - } else if ( outputEncoding == 1 ) { - - return LinearTosRGB( value ); - - } else if ( outputEncoding == 2 ) { - - return LinearToRGBE( value ); - - } else if ( outputEncoding == 3 ) { - - return LinearToRGBM( value, 7.0 ); - - } else if ( outputEncoding == 4 ) { - - return LinearToRGBM( value, 16.0 ); - - } else if ( outputEncoding == 5 ) { - - return LinearToRGBD( value, 256.0 ); - - } else { - - return LinearToGamma( value, 2.2 ); - - } - - } - - vec4 envMapTexelToLinear( vec4 color ) { - - return inputTexelToLinear( color ); - - } - ` + "\n\n\t\tuniform int inputEncoding;\n\t\tuniform int outputEncoding;\n\n\t\t#include \n\n\t\tvec4 inputTexelToLinear( vec4 value ) {\n\n\t\t\tif ( inputEncoding == 0 ) {\n\n\t\t\t\treturn value;\n\n\t\t\t} else if ( inputEncoding == 1 ) {\n\n\t\t\t\treturn sRGBToLinear( value );\n\n\t\t\t} else if ( inputEncoding == 2 ) {\n\n\t\t\t\treturn RGBEToLinear( value );\n\n\t\t\t} else if ( inputEncoding == 3 ) {\n\n\t\t\t\treturn RGBMToLinear( value, 7.0 );\n\n\t\t\t} else if ( inputEncoding == 4 ) {\n\n\t\t\t\treturn RGBMToLinear( value, 16.0 );\n\n\t\t\t} else if ( inputEncoding == 5 ) {\n\n\t\t\t\treturn RGBDToLinear( value, 256.0 );\n\n\t\t\t} else {\n\n\t\t\t\treturn GammaToLinear( value, 2.2 );\n\n\t\t\t}\n\n\t\t}\n\n\t\tvec4 linearToOutputTexel( vec4 value ) {\n\n\t\t\tif ( outputEncoding == 0 ) {\n\n\t\t\t\treturn value;\n\n\t\t\t} else if ( outputEncoding == 1 ) {\n\n\t\t\t\treturn LinearTosRGB( value );\n\n\t\t\t} else if ( outputEncoding == 2 ) {\n\n\t\t\t\treturn LinearToRGBE( value );\n\n\t\t\t} else if ( outputEncoding == 3 ) {\n\n\t\t\t\treturn LinearToRGBM( value, 7.0 );\n\n\t\t\t} else if ( outputEncoding == 4 ) {\n\n\t\t\t\treturn LinearToRGBM( value, 16.0 );\n\n\t\t\t} else if ( outputEncoding == 5 ) {\n\n\t\t\t\treturn LinearToRGBD( value, 256.0 );\n\n\t\t\t} else {\n\n\t\t\t\treturn LinearToGamma( value, 2.2 );\n\n\t\t\t}\n\n\t\t}\n\n\t\tvec4 envMapTexelToLinear( vec4 color ) {\n\n\t\t\treturn inputTexelToLinear( color );\n\n\t\t}\n\t" ); } - const LineStrip = 0; - const LinePieces = 1; - const NoColors = 0; - const FaceColors = 1; - const VertexColors = 2; + var LineStrip = 0; + var LinePieces = 1; + var NoColors = 0; + var FaceColors = 1; + var VertexColors = 2; function MeshFaceMaterial(materials) { console.warn('THREE.MeshFaceMaterial has been removed. Use an Array instead.'); return materials; } - function MultiMaterial(materials = []) { + function MultiMaterial(materials) { + if (materials === void 0) { + materials = []; + } + console.warn('THREE.MultiMaterial has been removed. Use an Array instead.'); materials.isMultiMaterial = true; materials.materials = materials; @@ -33838,12 +36214,12 @@ }; Loader.Handlers = { - add: function () + add: function add() /* regex, loader */ { console.error('THREE.Loader: Handlers.add() has been removed. Use LoadingManager.addHandler() instead.'); }, - get: function () + get: function get() /* file */ { console.error('THREE.Loader: Handlers.get() has been removed. Use LoadingManager.getHandler() instead.'); @@ -34245,20 +36621,20 @@ Object.defineProperties(Object3D.prototype, { eulerOrder: { - get: function () { + get: function get() { console.warn('THREE.Object3D: .eulerOrder is now .rotation.order.'); return this.rotation.order; }, - set: function (value) { + set: function set(value) { console.warn('THREE.Object3D: .eulerOrder is now .rotation.order.'); this.rotation.order = value; } }, useQuaternion: { - get: function () { + get: function get() { console.warn('THREE.Object3D: .useQuaternion has been removed. The library now uses quaternions by default.'); }, - set: function () { + set: function set() { console.warn('THREE.Object3D: .useQuaternion has been removed. The library now uses quaternions by default.'); } } @@ -34270,11 +36646,11 @@ Object.defineProperties(Mesh.prototype, { drawMode: { - get: function () { + get: function get() { console.error('THREE.Mesh: .drawMode has been removed. The renderer now always assumes THREE.TrianglesDrawMode.'); return TrianglesDrawMode; }, - set: function () { + set: function set() { console.error('THREE.Mesh: .drawMode has been removed. The renderer now always assumes THREE.TrianglesDrawMode. Transform your geometry via BufferGeometryUtils.toTrianglesDrawMode() if necessary.'); } } @@ -34285,11 +36661,11 @@ }; Object.defineProperty(Curve.prototype, '__arcLengthDivisions', { - get: function () { + get: function get() { console.warn('THREE.Curve: .__arcLengthDivisions is now .arcLengthDivisions.'); return this.arcLengthDivisions; }, - set: function (value) { + set: function set(value) { console.warn('THREE.Curve: .__arcLengthDivisions is now .arcLengthDivisions.'); this.arcLengthDivisions = value; } @@ -34304,76 +36680,76 @@ Object.defineProperties(Light.prototype, { onlyShadow: { - set: function () { + set: function set() { console.warn('THREE.Light: .onlyShadow has been removed.'); } }, shadowCameraFov: { - set: function (value) { + set: function set(value) { console.warn('THREE.Light: .shadowCameraFov is now .shadow.camera.fov.'); this.shadow.camera.fov = value; } }, shadowCameraLeft: { - set: function (value) { + set: function set(value) { console.warn('THREE.Light: .shadowCameraLeft is now .shadow.camera.left.'); this.shadow.camera.left = value; } }, shadowCameraRight: { - set: function (value) { + set: function set(value) { console.warn('THREE.Light: .shadowCameraRight is now .shadow.camera.right.'); this.shadow.camera.right = value; } }, shadowCameraTop: { - set: function (value) { + set: function set(value) { console.warn('THREE.Light: .shadowCameraTop is now .shadow.camera.top.'); this.shadow.camera.top = value; } }, shadowCameraBottom: { - set: function (value) { + set: function set(value) { console.warn('THREE.Light: .shadowCameraBottom is now .shadow.camera.bottom.'); this.shadow.camera.bottom = value; } }, shadowCameraNear: { - set: function (value) { + set: function set(value) { console.warn('THREE.Light: .shadowCameraNear is now .shadow.camera.near.'); this.shadow.camera.near = value; } }, shadowCameraFar: { - set: function (value) { + set: function set(value) { console.warn('THREE.Light: .shadowCameraFar is now .shadow.camera.far.'); this.shadow.camera.far = value; } }, shadowCameraVisible: { - set: function () { + set: function set() { console.warn('THREE.Light: .shadowCameraVisible has been removed. Use new THREE.CameraHelper( light.shadow.camera ) instead.'); } }, shadowBias: { - set: function (value) { + set: function set(value) { console.warn('THREE.Light: .shadowBias is now .shadow.bias.'); this.shadow.bias = value; } }, shadowDarkness: { - set: function () { + set: function set() { console.warn('THREE.Light: .shadowDarkness has been removed.'); } }, shadowMapWidth: { - set: function (value) { + set: function set(value) { console.warn('THREE.Light: .shadowMapWidth is now .shadow.mapSize.width.'); this.shadow.mapSize.width = value; } }, shadowMapHeight: { - set: function (value) { + set: function set(value) { console.warn('THREE.Light: .shadowMapHeight is now .shadow.mapSize.height.'); this.shadow.mapSize.height = value; } @@ -34382,17 +36758,17 @@ Object.defineProperties(BufferAttribute.prototype, { length: { - get: function () { + get: function get() { console.warn('THREE.BufferAttribute: .length has been deprecated. Use .count instead.'); return this.array.length; } }, dynamic: { - get: function () { + get: function get() { console.warn('THREE.BufferAttribute: .dynamic has been deprecated. Use .usage instead.'); return this.usage === DynamicDrawUsage; }, - set: function () + set: function set() /* value */ { console.warn('THREE.BufferAttribute: .dynamic has been deprecated. Use .usage instead.'); @@ -34469,13 +36845,13 @@ Object.defineProperties(BufferGeometry.prototype, { drawcalls: { - get: function () { + get: function get() { console.error('THREE.BufferGeometry: .drawcalls has been renamed to .groups.'); return this.groups; } }, offsets: { - get: function () { + get: function get() { console.warn('THREE.BufferGeometry: .offsets has been renamed to .groups.'); return this.groups; } @@ -34483,11 +36859,11 @@ }); Object.defineProperties(InstancedBufferGeometry.prototype, { maxInstancedCount: { - get: function () { + get: function get() { console.warn('THREE.InstancedBufferGeometry: .maxInstancedCount has been renamed to .instanceCount.'); return this.instanceCount; }, - set: function (value) { + set: function set(value) { console.warn('THREE.InstancedBufferGeometry: .maxInstancedCount has been renamed to .instanceCount.'); this.instanceCount = value; } @@ -34495,11 +36871,11 @@ }); Object.defineProperties(Raycaster.prototype, { linePrecision: { - get: function () { + get: function get() { console.warn('THREE.Raycaster: .linePrecision has been deprecated. Use .params.Line.threshold instead.'); return this.params.Line.threshold; }, - set: function (value) { + set: function set(value) { console.warn('THREE.Raycaster: .linePrecision has been deprecated. Use .params.Line.threshold instead.'); this.params.Line.threshold = value; } @@ -34507,11 +36883,11 @@ }); Object.defineProperties(InterleavedBuffer.prototype, { dynamic: { - get: function () { + get: function get() { console.warn('THREE.InterleavedBuffer: .length has been deprecated. Use .usage instead.'); return this.usage === DynamicDrawUsage; }, - set: function (value) { + set: function set(value) { console.warn('THREE.InterleavedBuffer: .length has been deprecated. Use .usage instead.'); this.setUsage(value); } @@ -34557,42 +36933,42 @@ Object.defineProperties(Material.prototype, { wrapAround: { - get: function () { + get: function get() { console.warn('THREE.Material: .wrapAround has been removed.'); }, - set: function () { + set: function set() { console.warn('THREE.Material: .wrapAround has been removed.'); } }, overdraw: { - get: function () { + get: function get() { console.warn('THREE.Material: .overdraw has been removed.'); }, - set: function () { + set: function set() { console.warn('THREE.Material: .overdraw has been removed.'); } }, wrapRGB: { - get: function () { + get: function get() { console.warn('THREE.Material: .wrapRGB has been removed.'); return new Color(); } }, shading: { - get: function () { + get: function get() { console.error('THREE.' + this.type + ': .shading has been removed. Use the boolean .flatShading instead.'); }, - set: function (value) { + set: function set(value) { console.warn('THREE.' + this.type + ': .shading has been removed. Use the boolean .flatShading instead.'); this.flatShading = value === FlatShading; } }, stencilMask: { - get: function () { + get: function get() { console.warn('THREE.' + this.type + ': .stencilMask has been removed. Use .stencilFuncMask instead.'); return this.stencilFuncMask; }, - set: function (value) { + set: function set(value) { console.warn('THREE.' + this.type + ': .stencilMask has been removed. Use .stencilFuncMask instead.'); this.stencilFuncMask = value; } @@ -34600,11 +36976,11 @@ }); Object.defineProperties(MeshPhysicalMaterial.prototype, { transparency: { - get: function () { + get: function get() { console.warn('THREE.MeshPhysicalMaterial: .transparency has been renamed to .transmission.'); return this.transmission; }, - set: function (value) { + set: function set(value) { console.warn('THREE.MeshPhysicalMaterial: .transparency has been renamed to .transmission.'); this.transmission = value; } @@ -34612,11 +36988,11 @@ }); Object.defineProperties(ShaderMaterial.prototype, { derivatives: { - get: function () { + get: function get() { console.warn('THREE.ShaderMaterial: .derivatives has been moved to .extensions.derivatives.'); return this.extensions.derivatives; }, - set: function (value) { + set: function set(value) { console.warn('THREE. ShaderMaterial: .derivatives has been moved to .extensions.derivatives.'); this.extensions.derivatives = value; } @@ -34742,102 +37118,102 @@ Object.defineProperties(WebGLRenderer.prototype, { shadowMapEnabled: { - get: function () { + get: function get() { return this.shadowMap.enabled; }, - set: function (value) { + set: function set(value) { console.warn('THREE.WebGLRenderer: .shadowMapEnabled is now .shadowMap.enabled.'); this.shadowMap.enabled = value; } }, shadowMapType: { - get: function () { + get: function get() { return this.shadowMap.type; }, - set: function (value) { + set: function set(value) { console.warn('THREE.WebGLRenderer: .shadowMapType is now .shadowMap.type.'); this.shadowMap.type = value; } }, shadowMapCullFace: { - get: function () { + get: function get() { console.warn('THREE.WebGLRenderer: .shadowMapCullFace has been removed. Set Material.shadowSide instead.'); return undefined; }, - set: function () + set: function set() /* value */ { console.warn('THREE.WebGLRenderer: .shadowMapCullFace has been removed. Set Material.shadowSide instead.'); } }, context: { - get: function () { + get: function get() { console.warn('THREE.WebGLRenderer: .context has been removed. Use .getContext() instead.'); return this.getContext(); } }, vr: { - get: function () { + get: function get() { console.warn('THREE.WebGLRenderer: .vr has been renamed to .xr'); return this.xr; } }, gammaInput: { - get: function () { + get: function get() { console.warn('THREE.WebGLRenderer: .gammaInput has been removed. Set the encoding for textures via Texture.encoding instead.'); return false; }, - set: function () { + set: function set() { console.warn('THREE.WebGLRenderer: .gammaInput has been removed. Set the encoding for textures via Texture.encoding instead.'); } }, gammaOutput: { - get: function () { + get: function get() { console.warn('THREE.WebGLRenderer: .gammaOutput has been removed. Set WebGLRenderer.outputEncoding instead.'); return false; }, - set: function (value) { + set: function set(value) { console.warn('THREE.WebGLRenderer: .gammaOutput has been removed. Set WebGLRenderer.outputEncoding instead.'); this.outputEncoding = value === true ? sRGBEncoding : LinearEncoding; } }, toneMappingWhitePoint: { - get: function () { + get: function get() { console.warn('THREE.WebGLRenderer: .toneMappingWhitePoint has been removed.'); return 1.0; }, - set: function () { + set: function set() { console.warn('THREE.WebGLRenderer: .toneMappingWhitePoint has been removed.'); } } }); Object.defineProperties(WebGLShadowMap.prototype, { cullFace: { - get: function () { + get: function get() { console.warn('THREE.WebGLRenderer: .shadowMap.cullFace has been removed. Set Material.shadowSide instead.'); return undefined; }, - set: function () + set: function set() /* cullFace */ { console.warn('THREE.WebGLRenderer: .shadowMap.cullFace has been removed. Set Material.shadowSide instead.'); } }, renderReverseSided: { - get: function () { + get: function get() { console.warn('THREE.WebGLRenderer: .shadowMap.renderReverseSided has been removed. Set Material.shadowSide instead.'); return undefined; }, - set: function () { + set: function set() { console.warn('THREE.WebGLRenderer: .shadowMap.renderReverseSided has been removed. Set Material.shadowSide instead.'); } }, renderSingleSided: { - get: function () { + get: function get() { console.warn('THREE.WebGLRenderer: .shadowMap.renderSingleSided has been removed. Set Material.shadowSide instead.'); return undefined; }, - set: function () { + set: function set() { console.warn('THREE.WebGLRenderer: .shadowMap.renderSingleSided has been removed. Set Material.shadowSide instead.'); } } @@ -34849,101 +37225,101 @@ Object.defineProperties(WebGLRenderTarget.prototype, { wrapS: { - get: function () { + get: function get() { console.warn('THREE.WebGLRenderTarget: .wrapS is now .texture.wrapS.'); return this.texture.wrapS; }, - set: function (value) { + set: function set(value) { console.warn('THREE.WebGLRenderTarget: .wrapS is now .texture.wrapS.'); this.texture.wrapS = value; } }, wrapT: { - get: function () { + get: function get() { console.warn('THREE.WebGLRenderTarget: .wrapT is now .texture.wrapT.'); return this.texture.wrapT; }, - set: function (value) { + set: function set(value) { console.warn('THREE.WebGLRenderTarget: .wrapT is now .texture.wrapT.'); this.texture.wrapT = value; } }, magFilter: { - get: function () { + get: function get() { console.warn('THREE.WebGLRenderTarget: .magFilter is now .texture.magFilter.'); return this.texture.magFilter; }, - set: function (value) { + set: function set(value) { console.warn('THREE.WebGLRenderTarget: .magFilter is now .texture.magFilter.'); this.texture.magFilter = value; } }, minFilter: { - get: function () { + get: function get() { console.warn('THREE.WebGLRenderTarget: .minFilter is now .texture.minFilter.'); return this.texture.minFilter; }, - set: function (value) { + set: function set(value) { console.warn('THREE.WebGLRenderTarget: .minFilter is now .texture.minFilter.'); this.texture.minFilter = value; } }, anisotropy: { - get: function () { + get: function get() { console.warn('THREE.WebGLRenderTarget: .anisotropy is now .texture.anisotropy.'); return this.texture.anisotropy; }, - set: function (value) { + set: function set(value) { console.warn('THREE.WebGLRenderTarget: .anisotropy is now .texture.anisotropy.'); this.texture.anisotropy = value; } }, offset: { - get: function () { + get: function get() { console.warn('THREE.WebGLRenderTarget: .offset is now .texture.offset.'); return this.texture.offset; }, - set: function (value) { + set: function set(value) { console.warn('THREE.WebGLRenderTarget: .offset is now .texture.offset.'); this.texture.offset = value; } }, repeat: { - get: function () { + get: function get() { console.warn('THREE.WebGLRenderTarget: .repeat is now .texture.repeat.'); return this.texture.repeat; }, - set: function (value) { + set: function set(value) { console.warn('THREE.WebGLRenderTarget: .repeat is now .texture.repeat.'); this.texture.repeat = value; } }, format: { - get: function () { + get: function get() { console.warn('THREE.WebGLRenderTarget: .format is now .texture.format.'); return this.texture.format; }, - set: function (value) { + set: function set(value) { console.warn('THREE.WebGLRenderTarget: .format is now .texture.format.'); this.texture.format = value; } }, type: { - get: function () { + get: function get() { console.warn('THREE.WebGLRenderTarget: .type is now .texture.type.'); return this.texture.type; }, - set: function (value) { + set: function set(value) { console.warn('THREE.WebGLRenderTarget: .type is now .texture.type.'); this.texture.type = value; } }, generateMipmaps: { - get: function () { + get: function get() { console.warn('THREE.WebGLRenderTarget: .generateMipmaps is now .texture.generateMipmaps.'); return this.texture.generateMipmaps; }, - set: function (value) { + set: function set(value) { console.warn('THREE.WebGLRenderTarget: .generateMipmaps is now .texture.generateMipmaps.'); this.texture.generateMipmaps = value; } @@ -34952,8 +37328,8 @@ Audio.prototype.load = function (file) { console.warn('THREE.Audio: .load has been deprecated. Use THREE.AudioLoader instead.'); - const scope = this; - const audioLoader = new AudioLoader(); + var scope = this; + var audioLoader = new AudioLoader(); audioLoader.load(file, function (buffer) { scope.setBuffer(buffer); }); @@ -34980,18 +37356,18 @@ ImageUtils.loadTexture = function (url, mapping, onLoad, onError) { console.warn('THREE.ImageUtils.loadTexture has been deprecated. Use THREE.TextureLoader() instead.'); - const loader = new TextureLoader(); + var loader = new TextureLoader(); loader.setCrossOrigin(this.crossOrigin); - const texture = loader.load(url, onLoad, undefined, onError); + var texture = loader.load(url, onLoad, undefined, 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(); + var loader = new CubeTextureLoader(); loader.setCrossOrigin(this.crossOrigin); - const texture = loader.load(urls, onLoad, undefined, onError); + var texture = loader.load(urls, onLoad, undefined, onError); if (mapping) texture.mapping = mapping; return texture; }; @@ -35013,18 +37389,18 @@ console.error('THREE.JSONLoader has been removed.'); } // - const SceneUtils = { - createMultiMaterialObject: function () + var SceneUtils = { + createMultiMaterialObject: function createMultiMaterialObject() /* geometry, materials */ { console.error('THREE.SceneUtils has been moved to /examples/jsm/utils/SceneUtils.js'); }, - detach: function () + detach: function detach() /* child, parent, scene */ { console.error('THREE.SceneUtils has been moved to /examples/jsm/utils/SceneUtils.js'); }, - attach: function () + attach: function attach() /* child, scene, parent */ { console.error('THREE.SceneUtils has been moved to /examples/jsm/utils/SceneUtils.js'); diff --git a/build/three.min.js b/build/three.min.js index 2eefc2442c93d8..ecd717496ed124 100644 --- a/build/three.min.js +++ b/build/three.min.js @@ -3,4 +3,4 @@ * Copyright 2010-2021 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="127dev",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,y=1008,x=1009,_=1012,b=1014,w=1015,M=1016,S=1020,T=1022,E=1023,A=1026,L=1027,R=33776,C=33777,P=33778,D=33779,I=35840,N=35841,B=35842,O=35843,z=37492,F=37496,H=2300,G=2301,U=2302,k=2400,V=2401,W=2402,j=2500,q=2501,X=3e3,Y=3001,Z=3007,J=3002,Q=3004,K=3005,$=3006,tt=7680,et=35044,nt=35048,it="300 es";function rt(){}Object.assign(rt.prototype,{addEventListener:function(t,e){void 0===this._listeners&&(this._listeners={});const n=this._listeners;void 0===n[t]&&(n[t]=[]),-1===n[t].indexOf(e)&&n[t].push(e)},hasEventListener:function(t,e){if(void 0===this._listeners)return!1;const n=this._listeners;return void 0!==n[t]&&-1!==n[t].indexOf(e)},removeEventListener:function(t,e){if(void 0===this._listeners)return;const n=this._listeners[t];if(void 0!==n){const t=n.indexOf(e);-1!==t&&n.splice(t,1)}},dispatchEvent:function(t){if(void 0===this._listeners)return;const e=this._listeners[t.type];if(void 0!==e){t.target=this;const n=e.slice(0);for(let e=0,i=n.length;e>8&255]+st[t>>16&255]+st[t>>24&255]+"-"+st[255&e]+st[e>>8&255]+"-"+st[e>>16&15|64]+st[e>>24&255]+"-"+st[63&n|128]+st[n>>8&255]+"-"+st[n>>16&255]+st[n>>24&255]+st[255&i]+st[i>>8&255]+st[i>>16&255]+st[i>>24&255]).toUpperCase()},clamp:function(t,e,n){return Math.max(e,Math.min(n,t))},euclideanModulo:function(t,e){return(t%e+e)%e},mapLinear:function(t,e,n,i,r){return i+(t-e)*(r-i)/(n-e)},lerp:function(t,e,n){return(1-n)*t+n*e},damp:function(t,e,n,i){return ot.lerp(t,e,1-Math.exp(-n*i))},pingpong:function(t,e=1){return e-Math.abs(ot.euclideanModulo(t,2*e)-e)},smoothstep:function(t,e,n){return t<=e?0:t>=n?1:(t=(t-e)/(n-e))*t*(3-2*t)},smootherstep:function(t,e,n){return t<=e?0:t>=n?1:(t=(t-e)/(n-e))*t*t*(t*(6*t-15)+10)},randInt:function(t,e){return t+Math.floor(Math.random()*(e-t+1))},randFloat:function(t,e){return t+Math.random()*(e-t)},randFloatSpread:function(t){return t*(.5-Math.random())},seededRandom:function(t){return void 0!==t&&(at=t%2147483647),at=16807*at%2147483647,(at-1)/2147483646},degToRad:function(t){return t*ot.DEG2RAD},radToDeg:function(t){return t*ot.RAD2DEG},isPowerOfTwo:function(t){return 0==(t&t-1)&&0!==t},ceilPowerOfTwo:function(t){return Math.pow(2,Math.ceil(Math.log(t)/Math.LN2))},floorPowerOfTwo:function(t){return Math.pow(2,Math.floor(Math.log(t)/Math.LN2))},setQuaternionFromProperEuler:function(t,e,n,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 lt{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}}lt.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],y=i[4],x=i[7],_=i[2],b=i[5],w=i[8];return r[0]=s*m+a*v+o*_,r[3]=s*f+a*y+o*b,r[6]=s*g+a*x+o*w,r[1]=l*m+c*v+h*_,r[4]=l*f+c*y+h*b,r[7]=l*g+c*x+h*w,r[2]=u*m+d*v+p*_,r[5]=u*f+d*y+p*b,r[8]=u*g+d*x+p*w,this}multiplyScalar(t){const e=this.elements;return e[0]*=t,e[3]*=t,e[6]*=t,e[1]*=t,e[4]*=t,e[7]*=t,e[2]*=t,e[5]*=t,e[8]*=t,this}determinant(){const t=this.elements,e=t[0],n=t[1],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)}}let ht;ct.prototype.isMatrix3=!0;const ut={getDataURL:function(t){if(/^data:/i.test(t.src))return t.src;if("undefined"==typeof HTMLCanvasElement)return t.src;let e;if(t instanceof HTMLCanvasElement)e=t;else{void 0===ht&&(ht=document.createElementNS("http://www.w3.org/1999/xhtml","canvas")),ht.width=t.width,ht.height=t.height;const n=ht.getContext("2d");t instanceof ImageData?n.putImageData(t,0,0):n.drawImage(t,0,0,t.width,t.height),e=ht}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 dt=0;class pt extends rt{constructor(t=pt.DEFAULT_IMAGE,e=pt.DEFAULT_MAPPING,n=1001,i=1001,r=1006,s=1008,a=1023,o=1009,l=1,c=3e3){super(),Object.defineProperty(this,"id",{value:dt++}),this.uuid=ot.generateUUID(),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 lt(0,0),this.repeat=new lt(1,1),this.center=new lt(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.version=0,this.onUpdate=null}updateMatrix(){this.matrix.setUvTransform(this.offset.x,this.offset.y,this.repeat.x,this.repeat.y,this.rotation,this.center.x,this.center.y)}clone(){return(new this.constructor).copy(this)}copy(t){return this.name=t.name,this.image=t.image,this.mipmaps=t.mipmaps.slice(0),this.mapping=t.mapping,this.wrapS=t.wrapS,this.wrapT=t.wrapT,this.magFilter=t.magFilter,this.minFilter=t.minFilter,this.anisotropy=t.anisotropy,this.format=t.format,this.internalFormat=t.internalFormat,this.type=t.type,this.offset.copy(t.offset),this.repeat.copy(t.repeat),this.center.copy(t.center),this.rotation=t.rotation,this.matrixAutoUpdate=t.matrixAutoUpdate,this.matrix.copy(t.matrix),this.generateMipmaps=t.generateMipmaps,this.premultiplyAlpha=t.premultiplyAlpha,this.flipY=t.flipY,this.unpackAlignment=t.unpackAlignment,this.encoding=t.encoding,this}toJSON(t){const e=void 0===t||"string"==typeof t;if(!e&&void 0!==t.textures[this.uuid])return t.textures[this.uuid];const n={metadata:{version:4.5,type:"Texture",generator:"Texture.toJSON"},uuid:this.uuid,name:this.name,mapping:this.mapping,repeat:[this.repeat.x,this.repeat.y],offset:[this.offset.x,this.offset.y],center:[this.center.x,this.center.y],rotation:this.rotation,wrap:[this.wrapS,this.wrapT],format:this.format,type:this.type,encoding:this.encoding,minFilter:this.minFilter,magFilter:this.magFilter,anisotropy:this.anisotropy,flipY:this.flipY,premultiplyAlpha:this.premultiplyAlpha,unpackAlignment:this.unpackAlignment};if(void 0!==this.image){const i=this.image;if(void 0===i.uuid&&(i.uuid=ot.generateUUID()),!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 mt(t){return"undefined"!=typeof HTMLImageElement&&t instanceof HTMLImageElement||"undefined"!=typeof HTMLCanvasElement&&t instanceof HTMLCanvasElement||"undefined"!=typeof ImageBitmap&&t instanceof ImageBitmap?ut.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."),{})}pt.DEFAULT_IMAGE=void 0,pt.DEFAULT_MAPPING=i,pt.prototype.isTexture=!0;class ft{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}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(ot.clamp(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}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(){}}yt.prototype.isQuaternion=!0;class xt{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(bt.setFromEuler(t))}applyAxisAngle(t,e){return this.applyQuaternion(bt.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 _t.copy(this).projectOnVector(t),this.sub(_t)}reflect(t){return this.sub(_t.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(ot.clamp(n,-1,1))}distanceTo(t){return Math.sqrt(this.distanceToSquared(t))}distanceToSquared(t){const e=this.x-t.x,n=this.y-t.y,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}}xt.prototype.isVector3=!0;const _t=new xt,bt=new yt;class wt{constructor(t=new xt(1/0,1/0,1/0),e=new xt(-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 void 0===e&&(console.warn("THREE.Box3: .getParameter() target is now required"),e=new xt),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,St),St.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(Dt),It.subVectors(this.max,Dt),Et.subVectors(t.a,Dt),At.subVectors(t.b,Dt),Lt.subVectors(t.c,Dt),Rt.subVectors(At,Et),Ct.subVectors(Lt,At),Pt.subVectors(Et,Lt);let e=[0,-Rt.z,Rt.y,0,-Ct.z,Ct.y,0,-Pt.z,Pt.y,Rt.z,0,-Rt.x,Ct.z,0,-Ct.x,Pt.z,0,-Pt.x,-Rt.y,Rt.x,0,-Ct.y,Ct.x,0,-Pt.y,Pt.x,0];return!!Ot(e,Et,At,Lt,It)&&(e=[1,0,0,0,1,0,0,0,1],!!Ot(e,Et,At,Lt,It)&&(Nt.crossVectors(Rt,Ct),e=[Nt.x,Nt.y,Nt.z],Ot(e,Et,At,Lt,It)))}clampPoint(t,e){return void 0===e&&(console.warn("THREE.Box3: .clampPoint() target is now required"),e=new xt),e.copy(t).clamp(this.min,this.max)}distanceToPoint(t){return St.copy(t).clamp(this.min,this.max).sub(t).length()}getBoundingSphere(t){return void 0===t&&console.error("THREE.Box3: .getBoundingSphere() target is now required"),this.getCenter(t.center),t.radius=.5*this.getSize(St).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()||(Mt[0].set(this.min.x,this.min.y,this.min.z).applyMatrix4(t),Mt[1].set(this.min.x,this.min.y,this.max.z).applyMatrix4(t),Mt[2].set(this.min.x,this.max.y,this.min.z).applyMatrix4(t),Mt[3].set(this.min.x,this.max.y,this.max.z).applyMatrix4(t),Mt[4].set(this.max.x,this.min.y,this.min.z).applyMatrix4(t),Mt[5].set(this.max.x,this.min.y,this.max.z).applyMatrix4(t),Mt[6].set(this.max.x,this.max.y,this.min.z).applyMatrix4(t),Mt[7].set(this.max.x,this.max.y,this.max.z).applyMatrix4(t),this.setFromPoints(Mt)),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)}}wt.prototype.isBox3=!0;const Mt=[new xt,new xt,new xt,new xt,new xt,new xt,new xt,new xt],St=new xt,Tt=new wt,Et=new xt,At=new xt,Lt=new xt,Rt=new xt,Ct=new xt,Pt=new xt,Dt=new xt,It=new xt,Nt=new xt,Bt=new xt;function Ot(t,e,n,i,r){for(let s=0,a=t.length-3;s<=a;s+=3){Bt.fromArray(t,s);const a=r.x*Math.abs(Bt.x)+r.y*Math.abs(Bt.y)+r.z*Math.abs(Bt.z),o=e.dot(Bt),l=n.dot(Bt),c=i.dot(Bt);if(Math.max(-Math.max(o,l,c),Math.min(o,l,c))>a)return!1}return!0}const zt=new wt;class Ft{constructor(t=new xt,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):zt.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 void 0===t&&(console.warn("THREE.Sphere: .getBoundingBox() target is now required"),t=new wt),this.isEmpty()?(t.makeEmpty(),t):(t.set(this.center,this.center),t.expandByScalar(this.radius),t)}applyMatrix4(t){return this.center.applyMatrix4(t),this.radius=this.radius*t.getMaxScaleOnAxis(),this}translate(t){return this.center.add(t),this}equals(t){return t.center.equals(this.center)&&t.radius===this.radius}clone(){return(new this.constructor).copy(this)}}const Ht=new xt,Gt=new xt,Ut=new xt,kt=new xt,Vt=new xt,Wt=new xt,jt=new xt;class qt{constructor(t=new xt,e=new xt(0,0,-1)){this.origin=t,this.direction=e}set(t,e){return this.origin.copy(t),this.direction.copy(e),this}copy(t){return this.origin.copy(t.origin),this.direction.copy(t.direction),this}at(t,e){return void 0===e&&(console.warn("THREE.Ray: .at() target is now required"),e=new xt),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,Ht)),this}closestPointToPoint(t,e){void 0===e&&(console.warn("THREE.Ray: .closestPointToPoint() target is now required"),e=new xt),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=Ht.subVectors(t,this.origin).dot(this.direction);return e<0?this.origin.distanceToSquared(t):(Ht.copy(this.direction).multiplyScalar(e).add(this.origin),Ht.distanceToSquared(t))}distanceSqToSegment(t,e,n,i){Gt.copy(t).add(e).multiplyScalar(.5),Ut.copy(e).sub(t).normalize(),kt.copy(this.origin).sub(Gt);const r=.5*t.distanceTo(e),s=-this.direction.dot(Ut),a=kt.dot(this.direction),o=-kt.dot(Ut),l=kt.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(Ut).multiplyScalar(u).add(Gt),d}intersectSphere(t,e){Ht.subVectors(t.center,this.origin);const n=Ht.dot(this.direction),i=Ht.dot(Ht)-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,Ht)}intersectTriangle(t,e,n,i,r){Vt.subVectors(e,t),Wt.subVectors(n,t),jt.crossVectors(Vt,Wt);let s,a=this.direction.dot(jt);if(a>0){if(i)return null;s=1}else{if(!(a<0))return null;s=-1,a=-a}kt.subVectors(this.origin,t);const o=s*this.direction.dot(Wt.crossVectors(kt,Wt));if(o<0)return null;const l=s*this.direction.dot(Vt.cross(kt));if(l<0)return null;if(o+l>a)return null;const c=-s*kt.dot(jt);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 Xt{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 Xt).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/Yt.setFromMatrixColumn(t,0).length(),r=1/Yt.setFromMatrixColumn(t,1).length(),s=1/Yt.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(Jt,t,Qt)}lookAt(t,e,n){const i=this.elements;return te.subVectors(t,e),0===te.lengthSq()&&(te.z=1),te.normalize(),Kt.crossVectors(n,te),0===Kt.lengthSq()&&(1===Math.abs(n.z)?te.x+=1e-4:te.z+=1e-4,te.normalize(),Kt.crossVectors(n,te)),Kt.normalize(),$t.crossVectors(te,Kt),i[0]=Kt.x,i[4]=$t.x,i[8]=te.x,i[1]=Kt.y,i[5]=$t.y,i[9]=te.y,i[2]=Kt.z,i[6]=$t.z,i[10]=te.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],y=n[7],x=n[11],_=n[15],b=i[0],w=i[4],M=i[8],S=i[12],T=i[1],E=i[5],A=i[9],L=i[13],R=i[2],C=i[6],P=i[10],D=i[14],I=i[3],N=i[7],B=i[11],O=i[15];return r[0]=s*b+a*T+o*R+l*I,r[4]=s*w+a*E+o*C+l*N,r[8]=s*M+a*A+o*P+l*B,r[12]=s*S+a*L+o*D+l*O,r[1]=c*b+h*T+u*R+d*I,r[5]=c*w+h*E+u*C+d*N,r[9]=c*M+h*A+u*P+d*B,r[13]=c*S+h*L+u*D+d*O,r[2]=p*b+m*T+f*R+g*I,r[6]=p*w+m*E+f*C+g*N,r[10]=p*M+m*A+f*P+g*B,r[14]=p*S+m*L+f*D+g*O,r[3]=v*b+y*T+x*R+_*I,r[7]=v*w+y*E+x*C+_*N,r[11]=v*M+y*A+x*P+_*B,r[15]=v*S+y*L+x*D+_*O,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,y=p*u*l-c*f*l-p*o*d+s*f*d+c*o*g-s*u*g,x=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,b=e*v+n*y+i*x+r*_;if(0===b)return this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);const w=1/b;return t[0]=v*w,t[1]=(m*u*r-h*f*r-m*i*d+n*f*d+h*i*g-n*u*g)*w,t[2]=(a*f*r-m*o*r+m*i*l-n*f*l-a*i*g+n*o*g)*w,t[3]=(h*o*r-a*u*r-h*i*l+n*u*l+a*i*d-n*o*d)*w,t[4]=y*w,t[5]=(c*f*r-p*u*r+p*i*d-e*f*d-c*i*g+e*u*g)*w,t[6]=(p*o*r-s*f*r-p*i*l+e*f*l+s*i*g-e*o*g)*w,t[7]=(s*u*r-c*o*r+c*i*l-e*u*l-s*i*d+e*o*d)*w,t[8]=x*w,t[9]=(p*h*r-c*m*r-p*n*d+e*m*d+c*n*g-e*h*g)*w,t[10]=(s*m*r-p*a*r+p*n*l-e*m*l-s*n*g+e*a*g)*w,t[11]=(c*a*r-s*h*r-c*n*l+e*h*l+s*n*d-e*a*d)*w,t[12]=_*w,t[13]=(c*m*i-p*h*i+p*n*u-e*m*u-c*n*f+e*h*f)*w,t[14]=(p*a*i-s*m*i-p*n*o+e*m*o+s*n*f-e*a*f)*w,t[15]=(s*h*i-c*a*i+c*n*o-e*h*o-s*n*u+e*a*u)*w,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){return this.set(1,e,n,0,t,1,n,0,t,e,1,0,0,0,0,1),this}compose(t,e,n){const 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,y=o*c,x=o*h,_=n.x,b=n.y,w=n.z;return i[0]=(1-(m+g))*_,i[1]=(d+x)*_,i[2]=(p-y)*_,i[3]=0,i[4]=(d-x)*b,i[5]=(1-(u+g))*b,i[6]=(f+v)*b,i[7]=0,i[8]=(p+y)*w,i[9]=(f-v)*w,i[10]=(1-(u+m))*w,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=Yt.set(i[0],i[1],i[2]).length();const s=Yt.set(i[4],i[5],i[6]).length(),a=Yt.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],Zt.copy(this);const o=1/r,l=1/s,c=1/a;return Zt.elements[0]*=o,Zt.elements[1]*=o,Zt.elements[2]*=o,Zt.elements[4]*=l,Zt.elements[5]*=l,Zt.elements[6]*=l,Zt.elements[8]*=c,Zt.elements[9]*=c,Zt.elements[10]*=c,e.setFromRotationMatrix(Zt),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}}Xt.prototype.isMatrix4=!0;const Yt=new xt,Zt=new Xt,Jt=new xt(0,0,0),Qt=new xt(1,1,1),Kt=new xt,$t=new xt,te=new xt,ee=new Xt,ne=new yt;class ie{constructor(t=0,e=0,n=0,i=ie.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){return this._x=t,this._y=e,this._z=n,this._order=i||this._order,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._order)}copy(t){return this._x=t._x,this._y=t._y,this._z=t._z,this._order=t._order,this._onChangeCallback(),this}setFromRotationMatrix(t,e,n){const i=ot.clamp,r=t.elements,s=r[0],a=r[4],o=r[8],l=r[1],c=r[5],h=r[9],u=r[2],d=r[6],p=r[10];switch(e=e||this._order){case"XYZ":this._y=Math.asin(i(o,-1,1)),Math.abs(o)<.9999999?(this._x=Math.atan2(-h,p),this._z=Math.atan2(-a,s)):(this._x=Math.atan2(d,c),this._z=0);break;case"YXZ":this._x=Math.asin(-i(h,-1,1)),Math.abs(h)<.9999999?(this._y=Math.atan2(o,p),this._z=Math.atan2(l,c)):(this._y=Math.atan2(-u,s),this._z=0);break;case"ZXY":this._x=Math.asin(i(d,-1,1)),Math.abs(d)<.9999999?(this._y=Math.atan2(-u,p),this._z=Math.atan2(-a,c)):(this._y=0,this._z=Math.atan2(l,s));break;case"ZYX":this._y=Math.asin(-i(u,-1,1)),Math.abs(u)<.9999999?(this._x=Math.atan2(d,p),this._z=Math.atan2(l,s)):(this._x=0,this._z=Math.atan2(-a,c));break;case"YZX":this._z=Math.asin(i(l,-1,1)),Math.abs(l)<.9999999?(this._x=Math.atan2(-h,c),this._y=Math.atan2(-u,s)):(this._x=0,this._y=Math.atan2(o,p));break;case"XZY":this._z=Math.asin(-i(a,-1,1)),Math.abs(a)<.9999999?(this._x=Math.atan2(d,c),this._y=Math.atan2(o,s)):(this._x=Math.atan2(-h,p),this._y=0);break;default:console.warn("THREE.Euler: .setFromRotationMatrix() encountered an unknown order: "+e)}return this._order=e,!1!==n&&this._onChangeCallback(),this}setFromQuaternion(t,e,n){return ee.makeRotationFromQuaternion(t),this.setFromRotationMatrix(ee,e,n)}setFromVector3(t,e){return this.set(t.x,t.y,t.z,e||this._order)}reorder(t){return ne.setFromEuler(this),this.setFromQuaternion(ne,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 xt(this._x,this._y,this._z)}_onChange(t){return this._onChangeCallback=t,this}_onChangeCallback(){}}ie.prototype.isEuler=!0,ie.DefaultOrder="XYZ",ie.RotationOrders=["XYZ","YZX","ZXY","XZY","YXZ","ZYX"];class re{constructor(){this.mask=1}set(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:function(t){return(new this.constructor).copy(this,t)},copy:function(t,e=!0){if(this.name=t.name,this.up.copy(t.up),this.position.copy(t.position),this.rotation.order=t.rotation.order,this.quaternion.copy(t.quaternion),this.scale.copy(t.scale),this.matrix.copy(t.matrix),this.matrixWorld.copy(t.matrixWorld),this.matrixAutoUpdate=t.matrixAutoUpdate,this.matrixWorldNeedsUpdate=t.matrixWorldNeedsUpdate,this.layers.mask=t.layers.mask,this.visible=t.visible,this.castShadow=t.castShadow,this.receiveShadow=t.receiveShadow,this.frustumCulled=t.frustumCulled,this.renderOrder=t.renderOrder,this.userData=JSON.parse(JSON.stringify(t.userData)),!0===e)for(let e=0;e1?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 void 0===t&&(console.warn("THREE.Plane: .coplanarPoint() target is now required"),t=new xt),t.copy(this.normal).multiplyScalar(-this.constant)}applyMatrix4(t,e){const n=e||be.getNormalMatrix(t),i=this.coplanarPoint(xe).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)}}we.prototype.isPlane=!0;const Me=new xt,Se=new xt,Te=new xt,Ee=new xt,Ae=new xt,Le=new xt,Re=new xt,Ce=new xt,Pe=new xt,De=new xt;class Ie{constructor(t=new xt,e=new xt,n=new xt){this.a=t,this.b=e,this.c=n}static getNormal(t,e,n,i){void 0===i&&(console.warn("THREE.Triangle: .getNormal() target is now required"),i=new xt),i.subVectors(n,e),Me.subVectors(t,e),i.cross(Me);const r=i.lengthSq();return r>0?i.multiplyScalar(1/Math.sqrt(r)):i.set(0,0,0)}static getBarycoord(t,e,n,i,r){Me.subVectors(i,e),Se.subVectors(n,e),Te.subVectors(t,e);const s=Me.dot(Me),a=Me.dot(Se),o=Me.dot(Te),l=Se.dot(Se),c=Se.dot(Te),h=s*l-a*a;if(void 0===r&&(console.warn("THREE.Triangle: .getBarycoord() target is now required"),r=new xt),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,Ee),Ee.x>=0&&Ee.y>=0&&Ee.x+Ee.y<=1}static getUV(t,e,n,i,r,s,a,o){return this.getBarycoord(t,e,n,i,Ee),o.set(0,0),o.addScaledVector(r,Ee.x),o.addScaledVector(s,Ee.y),o.addScaledVector(a,Ee.z),o}static isFrontFacing(t,e,n,i){return Me.subVectors(n,e),Se.subVectors(t,e),Me.cross(Se).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}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 Me.subVectors(this.c,this.b),Se.subVectors(this.a,this.b),.5*Me.cross(Se).length()}getMidpoint(t){return void 0===t&&(console.warn("THREE.Triangle: .getMidpoint() target is now required"),t=new xt),t.addVectors(this.a,this.b).add(this.c).multiplyScalar(1/3)}getNormal(t){return Ie.getNormal(this.a,this.b,this.c,t)}getPlane(t){return void 0===t&&(console.warn("THREE.Triangle: .getPlane() target is now required"),t=new we),t.setFromCoplanarPoints(this.a,this.b,this.c)}getBarycoord(t,e){return Ie.getBarycoord(t,this.a,this.b,this.c,e)}getUV(t,e,n,i,r){return Ie.getUV(t,this.a,this.b,this.c,e,n,i,r)}containsPoint(t){return Ie.containsPoint(t,this.a,this.b,this.c)}isFrontFacing(t){return Ie.isFrontFacing(this.a,this.b,this.c,t)}intersectsBox(t){return t.intersectsTriangle(this)}closestPointToPoint(t,e){void 0===e&&(console.warn("THREE.Triangle: .closestPointToPoint() target is now required"),e=new xt);const n=this.a,i=this.b,r=this.c;let s,a;Ae.subVectors(i,n),Le.subVectors(r,n),Ce.subVectors(t,n);const o=Ae.dot(Ce),l=Le.dot(Ce);if(o<=0&&l<=0)return e.copy(n);Pe.subVectors(t,i);const c=Ae.dot(Pe),h=Le.dot(Pe);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(Ae,s);De.subVectors(t,r);const d=Ae.dot(De),p=Le.dot(De);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(Le,a);const f=c*p-d*h;if(f<=0&&h-c>=0&&d-p>=0)return Re.subVectors(r,i),a=(h-c)/(h-c+(d-p)),e.copy(i).addScaledVector(Re,a);const g=1/(f+m+u);return s=m*g,a=u*g,e.copy(n).addScaledVector(Ae,s).addScaledVector(Le,a)}equals(t){return t.a.equals(this.a)&&t.b.equals(this.b)&&t.c.equals(this.c)}}let Ne=0;function Be(){Object.defineProperty(this,"id",{value:Ne++}),this.uuid=ot.generateUUID(),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=tt,this.stencilZFail=tt,this.stencilZPass=tt,this.stencilWrite=!1,this.clippingPlanes=null,this.clipIntersection=!1,this.clipShadows=!1,this.shadowSide=null,this.colorWrite=!0,this.precision=null,this.polygonOffset=!1,this.polygonOffsetFactor=0,this.polygonOffsetUnits=0,this.dithering=!1,this.alphaTest=0,this.alphaToCoverage=!1,this.premultipliedAlpha=!1,this.visible=!0,this.toneMapped=!0,this.userData={},this.version=0}Be.prototype=Object.assign(Object.create(rt.prototype),{constructor:Be,isMaterial:!0,onBeforeCompile:function(){},customProgramCacheKey:function(){return this.onBeforeCompile.toString()},setValues:function(t){if(void 0!==t)for(const e in t){const n=t[e];if(void 0===n){console.warn("THREE.Material: '"+e+"' parameter is undefined.");continue}if("shading"===e){console.warn("THREE."+this.type+": .shading has been removed. Use the boolean .flatShading instead."),this.flatShading=1===n;continue}const 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:function(t){const e=void 0===t||"string"==typeof t;e&&(t={textures:{},images:{}});const n={metadata:{version:4.5,type:"Material",generator:"Material.toJSON"}};function 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),this.sheen&&this.sheen.isColor&&(n.sheen=this.sheen.getHex()),this.emissive&&this.emissive.isColor&&(n.emissive=this.emissive.getHex()),this.emissiveIntensity&&1!==this.emissiveIntensity&&(n.emissiveIntensity=this.emissiveIntensity),this.specular&&this.specular.isColor&&(n.specular=this.specular.getHex()),void 0!==this.shininess&&(n.shininess=this.shininess),void 0!==this.clearcoat&&(n.clearcoat=this.clearcoat),void 0!==this.clearcoatRoughness&&(n.clearcoatRoughness=this.clearcoatRoughness),this.clearcoatMap&&this.clearcoatMap.isTexture&&(n.clearcoatMap=this.clearcoatMap.toJSON(t).uuid),this.clearcoatRoughnessMap&&this.clearcoatRoughnessMap.isTexture&&(n.clearcoatRoughnessMap=this.clearcoatRoughnessMap.toJSON(t).uuid),this.clearcoatNormalMap&&this.clearcoatNormalMap.isTexture&&(n.clearcoatNormalMap=this.clearcoatNormalMap.toJSON(t).uuid,n.clearcoatNormalScale=this.clearcoatNormalScale.toArray()),this.map&&this.map.isTexture&&(n.map=this.map.toJSON(t).uuid),this.matcap&&this.matcap.isTexture&&(n.matcap=this.matcap.toJSON(t).uuid),this.alphaMap&&this.alphaMap.isTexture&&(n.alphaMap=this.alphaMap.toJSON(t).uuid),this.lightMap&&this.lightMap.isTexture&&(n.lightMap=this.lightMap.toJSON(t).uuid,n.lightMapIntensity=this.lightMapIntensity),this.aoMap&&this.aoMap.isTexture&&(n.aoMap=this.aoMap.toJSON(t).uuid,n.aoMapIntensity=this.aoMapIntensity),this.bumpMap&&this.bumpMap.isTexture&&(n.bumpMap=this.bumpMap.toJSON(t).uuid,n.bumpScale=this.bumpScale),this.normalMap&&this.normalMap.isTexture&&(n.normalMap=this.normalMap.toJSON(t).uuid,n.normalMapType=this.normalMapType,n.normalScale=this.normalScale.toArray()),this.displacementMap&&this.displacementMap.isTexture&&(n.displacementMap=this.displacementMap.toJSON(t).uuid,n.displacementScale=this.displacementScale,n.displacementBias=this.displacementBias),this.roughnessMap&&this.roughnessMap.isTexture&&(n.roughnessMap=this.roughnessMap.toJSON(t).uuid),this.metalnessMap&&this.metalnessMap.isTexture&&(n.metalnessMap=this.metalnessMap.toJSON(t).uuid),this.emissiveMap&&this.emissiveMap.isTexture&&(n.emissiveMap=this.emissiveMap.toJSON(t).uuid),this.specularMap&&this.specularMap.isTexture&&(n.specularMap=this.specularMap.toJSON(t).uuid),this.envMap&&this.envMap.isTexture&&(n.envMap=this.envMap.toJSON(t).uuid,n.reflectivity=this.reflectivity,n.refractionRatio=this.refractionRatio,void 0!==this.combine&&(n.combine=this.combine),void 0!==this.envMapIntensity&&(n.envMapIntensity=this.envMapIntensity)),this.gradientMap&&this.gradientMap.isTexture&&(n.gradientMap=this.gradientMap.toJSON(t).uuid),void 0!==this.size&&(n.size=this.size),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.morphTargets&&(n.morphTargets=!0),!0===this.morphNormals&&(n.morphNormals=!0),!0===this.skinning&&(n.skinning=!0),!0===this.flatShading&&(n.flatShading=this.flatShading),!1===this.visible&&(n.visible=!1),!1===this.toneMapped&&(n.toneMapped=!1),"{}"!==JSON.stringify(this.userData)&&(n.userData=this.userData),e){const e=i(t.textures),r=i(t.images);e.length>0&&(n.textures=e),r.length>0&&(n.images=r)}return n},clone:function(){return(new this.constructor).copy(this)},copy:function(t){this.name=t.name,this.fog=t.fog,this.blending=t.blending,this.side=t.side,this.vertexColors=t.vertexColors,this.opacity=t.opacity,this.transparent=t.transparent,this.blendSrc=t.blendSrc,this.blendDst=t.blendDst,this.blendEquation=t.blendEquation,this.blendSrcAlpha=t.blendSrcAlpha,this.blendDstAlpha=t.blendDstAlpha,this.blendEquationAlpha=t.blendEquationAlpha,this.depthFunc=t.depthFunc,this.depthTest=t.depthTest,this.depthWrite=t.depthWrite,this.stencilWriteMask=t.stencilWriteMask,this.stencilFunc=t.stencilFunc,this.stencilRef=t.stencilRef,this.stencilFuncMask=t.stencilFuncMask,this.stencilFail=t.stencilFail,this.stencilZFail=t.stencilZFail,this.stencilZPass=t.stencilZPass,this.stencilWrite=t.stencilWrite;const e=t.clippingPlanes;let n=null;if(null!==e){const t=e.length;n=new Array(t);for(let 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:function(){this.dispatchEvent({type:"dispose"})}}),Object.defineProperty(Be.prototype,"needsUpdate",{set:function(t){!0===t&&this.version++}});const Oe={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},ze={h:0,s:0,l:0},Fe={h:0,s:0,l:0};function He(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 Ge(t){return t<.04045?.0773993808*t:Math.pow(.9478672986*t+.0521327014,2.4)}function Ue(t){return t<.0031308?12.92*t:1.055*Math.pow(t,.41666)-.055}class ke{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=ot.euclideanModulo(t,1),e=ot.clamp(e,0,1),n=ot.clamp(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=He(r,i,t+1/3),this.g=He(r,i,t),this.b=He(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=Oe[t];return void 0!==e?this.setHex(e):console.warn("THREE.Color: Unknown color "+t),this}clone(){return new this.constructor(this.r,this.g,this.b)}copy(t){return this.r=t.r,this.g=t.g,this.b=t.b,this}copyGammaToLinear(t,e=2){return this.r=Math.pow(t.r,e),this.g=Math.pow(t.g,e),this.b=Math.pow(t.b,e),this}copyLinearToGamma(t,e=2){const n=e>0?1/e:1;return this.r=Math.pow(t.r,n),this.g=Math.pow(t.g,n),this.b=Math.pow(t.b,n),this}convertGammaToLinear(t){return this.copyGammaToLinear(this,t),this}convertLinearToGamma(t){return this.copyLinearToGamma(this,t),this}copySRGBToLinear(t){return this.r=Ge(t.r),this.g=Ge(t.g),this.b=Ge(t.b),this}copyLinearToSRGB(t){return this.r=Ue(t.r),this.g=Ue(t.g),this.b=Ue(t.b),this}convertSRGBToLinear(){return this.copySRGBToLinear(this),this}convertLinearToSRGB(){return this.copyLinearToSRGB(this),this}getHex(){return 255*this.r<<16^255*this.g<<8^255*this.b<<0}getHexString(){return("000000"+this.getHex().toString(16)).slice(-6)}getHSL(t){void 0===t&&(console.warn("THREE.Color: .getHSL() target is now required"),t={h:0,s:0,l:0});const e=this.r,n=this.g,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+(ne&&(e=t[n]);return e}Object.defineProperty(qe.prototype,"needsUpdate",{set:function(t){!0===t&&this.version++}}),Object.assign(qe.prototype,{isBufferAttribute:!0,onUploadCallback:function(){},setUsage:function(t){return this.usage=t,this},copy:function(t){return this.name=t.name,this.array=new t.array.constructor(t.array),this.itemSize=t.itemSize,this.count=t.count,this.normalized=t.normalized,this.usage=t.usage,this},copyAt:function(t,e,n){t*=this.itemSize,n*=e.itemSize;for(let i=0,r=this.itemSize;i65535?$e:Qe)(t,1):this.index=t,this},getAttribute:function(t){return this.attributes[t]},setAttribute:function(t,e){return this.attributes[t]=e,this},deleteAttribute:function(t){return delete this.attributes[t],this},hasAttribute:function(t){return void 0!==this.attributes[t]},addGroup:function(t,e,n=0){this.groups.push({start:t,count:e,materialIndex:n})},clearGroups:function(){this.groups=[]},setDrawRange:function(t,e){this.drawRange.start=t,this.drawRange.count=e},applyMatrix4:function(t){const e=this.attributes.position;void 0!==e&&(e.applyMatrix4(t),e.needsUpdate=!0);const n=this.attributes.normal;if(void 0!==n){const e=(new ct).getNormalMatrix(t);n.applyNormalMatrix(e),n.needsUpdate=!0}const i=this.attributes.tangent;return void 0!==i&&(i.transformDirection(t),i.needsUpdate=!0),null!==this.boundingBox&&this.computeBoundingBox(),null!==this.boundingSphere&&this.computeBoundingSphere(),this},rotateX:function(t){return ln.makeRotationX(t),this.applyMatrix4(ln),this},rotateY:function(t){return ln.makeRotationY(t),this.applyMatrix4(ln),this},rotateZ:function(t){return ln.makeRotationZ(t),this.applyMatrix4(ln),this},translate:function(t,e,n){return ln.makeTranslation(t,e,n),this.applyMatrix4(ln),this},scale:function(t,e,n){return ln.makeScale(t,e,n),this.applyMatrix4(ln),this},lookAt:function(t){return cn.lookAt(t),cn.updateMatrix(),this.applyMatrix4(cn.matrix),this},center:function(){return this.computeBoundingBox(),this.boundingBox.getCenter(hn).negate(),this.translate(hn.x,hn.y,hn.z),this},setFromPoints:function(t){const e=[];for(let n=0,i=t.length;n0&&(t.userData=this.userData),void 0!==this.parameters){const e=this.parameters;for(const n in e)void 0!==e[n]&&(t[n]=e[n]);return t}t.data={attributes:{}};const e=this.index;null!==e&&(t.data.index={type:e.array.constructor.name,array:Array.prototype.slice.call(e.array)});const n=this.attributes;for(const 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:function(){return(new mn).copy(this)},copy:function(t){this.index=null,this.attributes={},this.morphAttributes={},this.groups=[],this.boundingBox=null,this.boundingSphere=null;const e={};this.name=t.name;const n=t.index;null!==n&&this.setIndex(n.clone(e));const 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;tn.far?null:{distance:c,point:Pn.clone(),object:t}}(t,e,n,i,yn,xn,_n,Cn);if(p){o&&(An.fromBufferAttribute(o,c),Ln.fromBufferAttribute(o,h),Rn.fromBufferAttribute(o,u),p.uv=Ie.getUV(Cn,yn,xn,_n,An,Ln,Rn,new lt)),l&&(An.fromBufferAttribute(l,c),Ln.fromBufferAttribute(l,h),Rn.fromBufferAttribute(l,u),p.uv2=Ie.getUV(Cn,yn,xn,_n,An,Ln,Rn,new lt));const t={a:c,b:h,c:u,normal:new xt,materialIndex:0};Ie.getNormal(yn,xn,_n,t.normal),p.face=t}return p}Dn.prototype=Object.assign(Object.create(ye.prototype),{constructor:Dn,isMesh:!0,copy:function(t){return ye.prototype.copy.call(this,t),void 0!==t.morphTargetInfluences&&(this.morphTargetInfluences=t.morphTargetInfluences.slice()),void 0!==t.morphTargetDictionary&&(this.morphTargetDictionary=Object.assign({},t.morphTargetDictionary)),this.material=t.material,this.geometry=t.geometry,this},updateMorphTargets:function(){const t=this.geometry;if(t.isBufferGeometry){const e=t.morphAttributes,n=Object.keys(e);if(n.length>0){const t=e[n[0]];if(void 0!==t){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let e=0,n=t.length;e0&&console.error("THREE.Mesh.updateMorphTargets() no longer supports THREE.Geometry. Use THREE.BufferGeometry instead.")}},raycast:function(t,e){const n=this.geometry,i=this.material,r=this.matrixWorld;if(void 0===i)return;if(null===n.boundingSphere&&n.computeBoundingSphere(),vn.copy(n.boundingSphere),vn.applyMatrix4(r),!1===t.ray.intersectsSphere(vn))return;if(fn.copy(r).invert(),gn.copy(t.ray).applyMatrix4(fn),null!==n.boundingBox&&!1===gn.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;n0?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},Hn.prototype=Object.assign(Object.create(ye.prototype),{constructor:Hn,isCamera:!0,copy:function(t,e){return ye.prototype.copy.call(this,t,e),this.matrixWorldInverse.copy(t.matrixWorldInverse),this.projectionMatrix.copy(t.projectionMatrix),this.projectionMatrixInverse.copy(t.projectionMatrixInverse),this},getWorldDirection:function(t){void 0===t&&(console.warn("THREE.Camera: .getWorldDirection() target is now required"),t=new xt),this.updateWorldMatrix(!0,!1);const e=this.matrixWorld.elements;return t.set(-e[8],-e[9],-e[10]).normalize()},updateMatrixWorld:function(t){ye.prototype.updateMatrixWorld.call(this,t),this.matrixWorldInverse.copy(this.matrixWorld).invert()},updateWorldMatrix:function(t,e){ye.prototype.updateWorldMatrix.call(this,t,e),this.matrixWorldInverse.copy(this.matrixWorld).invert()},clone:function(){return(new this.constructor).copy(this)}}),Gn.prototype=Object.assign(Object.create(Hn.prototype),{constructor:Gn,isPerspectiveCamera:!0,copy:function(t,e){return Hn.prototype.copy.call(this,t,e),this.fov=t.fov,this.zoom=t.zoom,this.near=t.near,this.far=t.far,this.focus=t.focus,this.aspect=t.aspect,this.view=null===t.view?null:Object.assign({},t.view),this.filmGauge=t.filmGauge,this.filmOffset=t.filmOffset,this},setFocalLength:function(t){const e=.5*this.getFilmHeight()/t;this.fov=2*ot.RAD2DEG*Math.atan(e),this.updateProjectionMatrix()},getFocalLength:function(){const t=Math.tan(.5*ot.DEG2RAD*this.fov);return.5*this.getFilmHeight()/t},getEffectiveFOV:function(){return 2*ot.RAD2DEG*Math.atan(Math.tan(.5*ot.DEG2RAD*this.fov)/this.zoom)},getFilmWidth:function(){return this.filmGauge*Math.min(this.aspect,1)},getFilmHeight:function(){return this.filmGauge/Math.max(this.aspect,1)},setViewOffset:function(t,e,n,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:function(){null!==this.view&&(this.view.enabled=!1),this.updateProjectionMatrix()},updateProjectionMatrix:function(){const t=this.near;let e=t*Math.tan(.5*ot.DEG2RAD*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:function(t){const e=ye.prototype.toJSON.call(this,t);return e.object.fov=this.fov,e.object.zoom=this.zoom,e.object.near=this.near,e.object.far=this.far,e.object.focus=this.focus,e.object.aspect=this.aspect,null!==this.view&&(e.object.view=Object.assign({},this.view)),e.object.filmGauge=this.filmGauge,e.object.filmOffset=this.filmOffset,e}});const Un=90;class kn extends ye{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 Gn(Un,1,t,e);i.layers=this.layers,i.up.set(0,-1,0),i.lookAt(new xt(1,0,0)),this.add(i);const r=new Gn(Un,1,t,e);r.layers=this.layers,r.up.set(0,-1,0),r.lookAt(new xt(-1,0,0)),this.add(r);const s=new Gn(Un,1,t,e);s.layers=this.layers,s.up.set(0,0,1),s.lookAt(new xt(0,1,0)),this.add(s);const a=new Gn(Un,1,t,e);a.layers=this.layers,a.up.set(0,0,-1),a.lookAt(new xt(0,-1,0)),this.add(a);const o=new Gn(Un,1,t,e);o.layers=this.layers,o.up.set(0,-1,0),o.lookAt(new xt(0,0,1)),this.add(o);const l=new Gn(Un,1,t,e);l.layers=this.layers,l.up.set(0,-1,0),l.lookAt(new xt(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}}class Vn extends pt{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=void 0!==o?o:T,l,c,h),this._needsFlipEnvMap=!0,this.flipY=!1}get images(){return this.image}set images(t){this.image=t}}Vn.prototype.isCubeTexture=!0;class Wn extends gt{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 Vn(void 0,e.mapping,e.wrapS,e.wrapT,e.magFilter,e.minFilter,e.format,e.type,e.anisotropy,e.encoding),this.texture.generateMipmaps=void 0!==e.generateMipmaps&&e.generateMipmaps,this.texture.minFilter=void 0!==e.minFilter?e.minFilter:g,this.texture._needsFlipEnvMap=!1}fromEquirectangularTexture(t,e){this.texture.type=e.type,this.texture.format=E,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 Nn(5,5,5),r=new Fn({name:"CubemapFromEquirect",uniforms:Bn(n.uniforms),vertexShader:n.vertexShader,fragmentShader:n.fragmentShader,side:1,blending:0});r.uniforms.tEquirect.value=e;const s=new Dn(i,r),a=e.minFilter;e.minFilter===y&&(e.minFilter=g);return new kn(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)}}Wn.prototype.isWebGLCubeRenderTarget=!0;class jn extends pt{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={data:t||null,width:e||1,height:n||1},this.magFilter=void 0!==l?l:p,this.minFilter=void 0!==c?c:p,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1,this.needsUpdate=!0}}jn.prototype.isDataTexture=!0;const qn=new Ft,Xn=new xt;class Yn{constructor(t=new we,e=new we,n=new we,i=new we,r=new we,s=new we){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],y=n[15];return e[0].setComponents(a-i,h-o,m-u,y-f).normalize(),e[1].setComponents(a+i,h+o,m+u,y+f).normalize(),e[2].setComponents(a+r,h+l,m+d,y+g).normalize(),e[3].setComponents(a-r,h-l,m-d,y-g).normalize(),e[4].setComponents(a-s,h-c,m-p,y-v).normalize(),e[5].setComponents(a+s,h+c,m+p,y+v).normalize(),this}intersectsObject(t){const e=t.geometry;return null===e.boundingSphere&&e.computeBoundingSphere(),qn.copy(e.boundingSphere).applyMatrix4(t.matrixWorld),this.intersectsSphere(qn)}intersectsSprite(t){return qn.center.set(0,0,0),qn.radius=.7071067811865476,qn.applyMatrix4(t.matrixWorld),this.intersectsSphere(qn)}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,Xn.y=i.normal.y>0?t.max.y:t.min.y,Xn.z=i.normal.z>0?t.max.z:t.min.z,i.distanceToPoint(Xn)<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 Zn(){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 Jn(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 ) {\n\t\tdistanceFalloff *= pow2( saturate( 1.0 - pow4( lightDistance / cutoffDistance ) ) );\n\t}\n\treturn distanceFalloff;\n#else\n\tif( cutoffDistance > 0.0 && decayExponent > 0.0 ) {\n\t\treturn pow( saturate( -lightDistance / cutoffDistance + 1.0 ), decayExponent );\n\t}\n\treturn 1.0;\n#endif\n}\nvec3 BRDF_Diffuse_Lambert( const in vec3 diffuseColor ) {\n\treturn RECIPROCAL_PI * diffuseColor;\n}\nvec3 F_Schlick( const in vec3 specularColor, const in float dotLH ) {\n\tfloat fresnel = exp2( ( -5.55473 * dotLH - 6.98316 ) * dotLH );\n\treturn ( 1.0 - specularColor ) * fresnel + specularColor;\n}\nvec3 F_Schlick_RoughnessDependent( const in vec3 F0, const in float dotNV, const in float roughness ) {\n\tfloat fresnel = exp2( ( -5.55473 * dotNV - 6.98316 ) * dotNV );\n\tvec3 Fr = max( vec3( 1.0 - roughness ), F0 ) - F0;\n\treturn Fr * fresnel + F0;\n}\nfloat G_GGX_Smith( const in float alpha, const in float dotNL, const in float dotNV ) {\n\tfloat a2 = pow2( alpha );\n\tfloat gl = dotNL + sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNL ) );\n\tfloat gv = dotNV + sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNV ) );\n\treturn 1.0 / ( gl * gv );\n}\nfloat G_GGX_SmithCorrelated( const in float alpha, const in float dotNL, const in float dotNV ) {\n\tfloat a2 = pow2( alpha );\n\tfloat gv = dotNL * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNV ) );\n\tfloat gl = dotNV * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNL ) );\n\treturn 0.5 / max( gv + gl, EPSILON );\n}\nfloat D_GGX( const in float alpha, const in float dotNH ) {\n\tfloat a2 = pow2( alpha );\n\tfloat denom = pow2( dotNH ) * ( a2 - 1.0 ) + 1.0;\n\treturn RECIPROCAL_PI * a2 / pow2( denom );\n}\nvec3 BRDF_Specular_GGX( const in IncidentLight incidentLight, const in vec3 viewDir, const in vec3 normal, const in vec3 specularColor, const in float roughness ) {\n\tfloat alpha = pow2( roughness );\n\tvec3 halfDir = normalize( incidentLight.direction + viewDir );\n\tfloat dotNL = saturate( dot( normal, incidentLight.direction ) );\n\tfloat dotNV = saturate( dot( normal, viewDir ) );\n\tfloat dotNH = saturate( dot( normal, halfDir ) );\n\tfloat dotLH = saturate( dot( incidentLight.direction, halfDir ) );\n\tvec3 F = F_Schlick( specularColor, dotLH );\n\tfloat G = G_GGX_SmithCorrelated( alpha, dotNL, dotNV );\n\tfloat D = D_GGX( alpha, dotNH );\n\treturn F * ( G * D );\n}\nvec2 LTC_Uv( const in vec3 N, const in vec3 V, const in float roughness ) {\n\tconst float LUT_SIZE = 64.0;\n\tconst float LUT_SCALE = ( LUT_SIZE - 1.0 ) / LUT_SIZE;\n\tconst float LUT_BIAS = 0.5 / LUT_SIZE;\n\tfloat dotNV = saturate( dot( N, V ) );\n\tvec2 uv = vec2( roughness, sqrt( 1.0 - dotNV ) );\n\tuv = uv * LUT_SCALE + LUT_BIAS;\n\treturn uv;\n}\nfloat LTC_ClippedSphereFormFactor( const in vec3 f ) {\n\tfloat l = length( f );\n\treturn max( ( l * l + f.z ) / ( l + 1.0 ), 0.0 );\n}\nvec3 LTC_EdgeVectorFormFactor( const in vec3 v1, const in vec3 v2 ) {\n\tfloat x = dot( v1, v2 );\n\tfloat y = abs( x );\n\tfloat a = 0.8543985 + ( 0.4965155 + 0.0145206 * y ) * y;\n\tfloat b = 3.4175940 + ( 4.1616724 + y ) * y;\n\tfloat v = a / b;\n\tfloat theta_sintheta = ( x > 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}\nvec3 BRDF_Specular_GGX_Environment( const in vec3 viewDir, const in vec3 normal, const in vec3 specularColor, const in float roughness ) {\n\tfloat dotNV = saturate( dot( normal, viewDir ) );\n\tvec2 brdf = integrateSpecularBRDF( dotNV, roughness );\n\treturn specularColor * brdf.x + brdf.y;\n}\nvoid BRDF_Specular_Multiscattering_Environment( const in GeometricContext geometry, const in vec3 specularColor, const in float roughness, inout vec3 singleScatter, inout vec3 multiScatter ) {\n\tfloat dotNV = saturate( dot( geometry.normal, geometry.viewDir ) );\n\tvec3 F = F_Schlick_RoughnessDependent( specularColor, dotNV, roughness );\n\tvec2 brdf = integrateSpecularBRDF( dotNV, roughness );\n\tvec3 FssEss = F * brdf.x + brdf.y;\n\tfloat Ess = brdf.x + brdf.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}\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_Specular_BlinnPhong( const in IncidentLight incidentLight, const in GeometricContext geometry, const in vec3 specularColor, const in float shininess ) {\n\tvec3 halfDir = normalize( incidentLight.direction + geometry.viewDir );\n\tfloat dotNH = saturate( dot( geometry.normal, halfDir ) );\n\tfloat dotLH = saturate( dot( incidentLight.direction, halfDir ) );\n\tvec3 F = F_Schlick( specularColor, dotLH );\n\tfloat G = G_BlinnPhong_Implicit( );\n\tfloat D = D_BlinnPhong( shininess, dotNH );\n\treturn F * ( G * D );\n}\nfloat GGXRoughnessToBlinnExponent( const in float ggxRoughness ) {\n\treturn ( 2.0 / pow2( ggxRoughness + 0.0001 ) - 2.0 );\n}\nfloat BlinnExponentToGGXRoughness( const in float blinnExponent ) {\n\treturn sqrt( 2.0 / ( blinnExponent + 2.0 ) );\n}\n#if defined( USE_SHEEN )\nfloat D_Charlie(float roughness, float NoH) {\n\tfloat invAlpha = 1.0 / roughness;\n\tfloat cos2h = NoH * NoH;\n\tfloat sin2h = max(1.0 - cos2h, 0.0078125);\treturn (2.0 + invAlpha) * pow(sin2h, invAlpha * 0.5) / (2.0 * PI);\n}\nfloat V_Neubelt(float NoV, float NoL) {\n\treturn saturate(1.0 / (4.0 * (NoL + NoV - NoL * NoV)));\n}\nvec3 BRDF_Specular_Sheen( const in float roughness, const in vec3 L, const in GeometricContext geometry, vec3 specularColor ) {\n\tvec3 N = geometry.normal;\n\tvec3 V = geometry.viewDir;\n\tvec3 H = normalize( V + L );\n\tfloat dotNH = saturate( dot( N, H ) );\n\treturn specularColor * D_Charlie( roughness, dotNH ) * V_Neubelt( dot(N, V), dot(N, L) );\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:"#ifdef USE_COLOR\n\tdiffuseColor.rgb *= vColor;\n#endif",color_pars_fragment:"#ifdef USE_COLOR\n\tvarying vec3 vColor;\n#endif",color_pars_vertex:"#if defined( USE_COLOR ) || defined( USE_INSTANCING_COLOR )\n\tvarying vec3 vColor;\n#endif",color_vertex:"#if defined( USE_COLOR ) || defined( USE_INSTANCING_COLOR )\n\tvColor = vec3( 1.0 );\n#endif\n#ifdef USE_COLOR\n\tvColor.xyz *= color.xyz;\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 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 max3( vec3 v ) { return max( max( v.x, v.y ), v.z ); }\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 normal;\n\tvec3 viewDir;\n#ifdef CLEARCOAT\n\tvec3 clearcoatNormal;\n#endif\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}\nvec3 projectOnPlane(in vec3 point, in vec3 pointOnPlane, in vec3 planeNormal ) {\n\tfloat distance = dot( planeNormal, point - pointOnPlane );\n\treturn - distance * planeNormal + point;\n}\nfloat sideOfPlane( in vec3 point, in vec3 pointOnPlane, in vec3 planeNormal ) {\n\treturn sign( dot( point - pointOnPlane, planeNormal ) );\n}\nvec3 linePlaneIntersect( in vec3 pointOnLine, in vec3 lineDirection, in vec3 pointOnPlane, in vec3 planeNormal ) {\n\treturn lineDirection * ( dot( planeNormal, pointOnPlane - pointOnLine ) / dot( planeNormal, lineDirection ) ) + pointOnLine;\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 = vec2( - direction.x, direction.y ) / 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 = vec2( - direction.x, direction.z ) / 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:"\nvec4 LinearToLinear( in vec4 value ) {\n\treturn value;\n}\nvec4 GammaToLinear( in vec4 value, in float gammaFactor ) {\n\treturn vec4( pow( value.rgb, vec3( gammaFactor ) ), value.a );\n}\nvec4 LinearToGamma( in vec4 value, in float gammaFactor ) {\n\treturn vec4( pow( value.rgb, vec3( 1.0 / gammaFactor ) ), value.a );\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}\nvec4 RGBMToLinear( in vec4 value, in float maxRange ) {\n\treturn vec4( value.rgb * value.a * maxRange, 1.0 );\n}\nvec4 LinearToRGBM( in vec4 value, in float maxRange ) {\n\tfloat maxRGB = max( value.r, max( value.g, value.b ) );\n\tfloat M = clamp( maxRGB / maxRange, 0.0, 1.0 );\n\tM = ceil( M * 255.0 ) / 255.0;\n\treturn vec4( value.rgb / ( M * maxRange ), M );\n}\nvec4 RGBDToLinear( in vec4 value, in float maxRange ) {\n\treturn vec4( value.rgb * ( ( maxRange / 255.0 ) / value.a ), 1.0 );\n}\nvec4 LinearToRGBD( in vec4 value, in float maxRange ) {\n\tfloat maxRGB = max( value.r, max( value.g, value.b ) );\n\tfloat D = max( maxRange / maxRGB, 1.0 );\n\tD = clamp( floor( D ) / 255.0, 0.0, 1.0 );\n\treturn vec4( value.rgb * ( D * ( 255.0 / maxRange ) ), D );\n}\nconst mat3 cLogLuvM = mat3( 0.2209, 0.3390, 0.4184, 0.1138, 0.6780, 0.7319, 0.0102, 0.1130, 0.2969 );\nvec4 LinearToLogLuv( in vec4 value ) {\n\tvec3 Xp_Y_XYZp = cLogLuvM * value.rgb;\n\tXp_Y_XYZp = max( Xp_Y_XYZp, vec3( 1e-6, 1e-6, 1e-6 ) );\n\tvec4 vResult;\n\tvResult.xy = Xp_Y_XYZp.xy / Xp_Y_XYZp.z;\n\tfloat Le = 2.0 * log2(Xp_Y_XYZp.y) + 127.0;\n\tvResult.w = fract( Le );\n\tvResult.z = ( Le - ( floor( vResult.w * 255.0 ) ) / 255.0 ) / 255.0;\n\treturn vResult;\n}\nconst mat3 cLogLuvInverseM = mat3( 6.0014, -2.7008, -1.7996, -1.3320, 3.1029, -5.7721, 0.3008, -1.0882, 5.6268 );\nvec4 LogLuvToLinear( in vec4 value ) {\n\tfloat Le = value.z * 255.0 + value.w;\n\tvec3 Xp_Y_XYZp;\n\tXp_Y_XYZp.y = exp2( ( Le - 127.0 ) / 2.0 );\n\tXp_Y_XYZp.z = Xp_Y_XYZp.y / value.y;\n\tXp_Y_XYZp.x = value.x * Xp_Y_XYZp.z;\n\tvec3 vRGB = cLogLuvInverseM * Xp_Y_XYZp.rgb;\n\treturn vec4( max( vRGB, 0.0 ), 1.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#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#ifndef ENVMAP_TYPE_CUBE_UV\n\t\tenvColor = envMapTexelToLinear( envColor );\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\tuniform int maxMipLevel;\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\t#ifdef ENVMAP_MODE_REFRACTION\n\t\tuniform float refractionRatio;\n\t#endif\n\tvec3 getLightProbeIndirectIrradiance( const in GeometricContext geometry, const in int maxMIPLevel ) {\n\t\tvec3 worldNormal = inverseTransformDirection( geometry.normal, viewMatrix );\n\t\t#ifdef ENVMAP_TYPE_CUBE\n\t\t\tvec3 queryVec = vec3( flipEnvMap * worldNormal.x, worldNormal.yz );\n\t\t\t#ifdef TEXTURE_LOD_EXT\n\t\t\t\tvec4 envMapColor = textureCubeLodEXT( envMap, queryVec, float( maxMIPLevel ) );\n\t\t\t#else\n\t\t\t\tvec4 envMapColor = textureCube( envMap, queryVec, float( maxMIPLevel ) );\n\t\t\t#endif\n\t\t\tenvMapColor.rgb = envMapTexelToLinear( envMapColor ).rgb;\n\t\t#elif defined( ENVMAP_TYPE_CUBE_UV )\n\t\t\tvec4 envMapColor = textureCubeUV( envMap, worldNormal, 1.0 );\n\t\t#else\n\t\t\tvec4 envMapColor = vec4( 0.0 );\n\t\t#endif\n\t\treturn PI * envMapColor.rgb * envMapIntensity;\n\t}\n\tfloat getSpecularMIPLevel( const in float roughness, const in int maxMIPLevel ) {\n\t\tfloat maxMIPLevelScalar = float( maxMIPLevel );\n\t\tfloat sigma = PI * roughness * roughness / ( 1.0 + roughness );\n\t\tfloat desiredMIPLevel = maxMIPLevelScalar + log2( sigma );\n\t\treturn clamp( desiredMIPLevel, 0.0, maxMIPLevelScalar );\n\t}\n\tvec3 getLightProbeIndirectRadiance( const in vec3 viewDir, const in vec3 normal, const in float roughness, const in int maxMIPLevel ) {\n\t\t#ifdef ENVMAP_MODE_REFLECTION\n\t\t\tvec3 reflectVec = reflect( -viewDir, normal );\n\t\t\treflectVec = normalize( mix( reflectVec, normal, roughness * roughness) );\n\t\t#else\n\t\t\tvec3 reflectVec = refract( -viewDir, normal, refractionRatio );\n\t\t#endif\n\t\treflectVec = inverseTransformDirection( reflectVec, viewMatrix );\n\t\tfloat specularMIPLevel = getSpecularMIPLevel( roughness, maxMIPLevel );\n\t\t#ifdef ENVMAP_TYPE_CUBE\n\t\t\tvec3 queryReflectVec = vec3( flipEnvMap * reflectVec.x, reflectVec.yz );\n\t\t\t#ifdef TEXTURE_LOD_EXT\n\t\t\t\tvec4 envMapColor = textureCubeLodEXT( envMap, queryReflectVec, specularMIPLevel );\n\t\t\t#else\n\t\t\t\tvec4 envMapColor = textureCube( envMap, queryReflectVec, specularMIPLevel );\n\t\t\t#endif\n\t\t\tenvMapColor.rgb = envMapTexelToLinear( envMapColor ).rgb;\n\t\t#elif defined( ENVMAP_TYPE_CUBE_UV )\n\t\t\tvec4 envMapColor = textureCubeUV( envMap, reflectVec, roughness );\n\t\t#endif\n\t\treturn envMapColor.rgb * envMapIntensity;\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\tfogDepth = - mvPosition.z;\n#endif",fog_pars_vertex:"#ifdef USE_FOG\n\tvarying float fogDepth;\n#endif",fog_fragment:"#ifdef USE_FOG\n\t#ifdef FOG_EXP2\n\t\tfloat fogFactor = 1.0 - exp( - fogDensity * fogDensity * fogDepth * fogDepth );\n\t#else\n\t\tfloat fogFactor = smoothstep( fogNear, fogFar, fogDepth );\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 fogDepth;\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 texture2D( gradientMap, coord ).rgb;\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\treflectedLight.indirectDiffuse += PI * lightMapTexelToLinear( lightMapTexel ).rgb * lightMapIntensity;\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.normal = normalize( transformedNormal );\ngeometry.viewDir = ( isOrthographic ) ? vec3( 0, 0, 1 ) : normalize( -mvPosition.xyz );\nGeometricContext backGeometry;\nbackGeometry.position = geometry.position;\nbackGeometry.normal = -geometry.normal;\nbackGeometry.viewDir = geometry.viewDir;\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, geometry );\n#ifdef DOUBLE_SIDED\n\tvIndirectBack += getAmbientLightIrradiance( ambientLightColor );\n\tvIndirectBack += getLightProbeIrradiance( lightProbe, backGeometry );\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\tgetPointDirectLightIrradiance( pointLights[ i ], geometry, directLight );\n\t\tdotNL = dot( geometry.normal, directLight.direction );\n\t\tdirectLightColor_Diffuse = PI * 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\tgetSpotDirectLightIrradiance( spotLights[ i ], geometry, directLight );\n\t\tdotNL = dot( geometry.normal, directLight.direction );\n\t\tdirectLightColor_Diffuse = PI * 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\tgetDirectionalDirectLightIrradiance( directionalLights[ i ], geometry, directLight );\n\t\tdotNL = dot( geometry.normal, directLight.direction );\n\t\tdirectLightColor_Diffuse = PI * 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 ], geometry );\n\t\t#ifdef DOUBLE_SIDED\n\t\t\tvIndirectBack += getHemisphereLightIrradiance( hemisphereLights[ i ], backGeometry );\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 GeometricContext geometry ) {\n\tvec3 worldNormal = inverseTransformDirection( geometry.normal, viewMatrix );\n\tvec3 irradiance = shGetIrradianceAt( worldNormal, lightProbe );\n\treturn irradiance;\n}\nvec3 getAmbientLightIrradiance( const in vec3 ambientLightColor ) {\n\tvec3 irradiance = ambientLightColor;\n\t#ifndef PHYSICALLY_CORRECT_LIGHTS\n\t\tirradiance *= PI;\n\t#endif\n\treturn irradiance;\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 getDirectionalDirectLightIrradiance( const in DirectionalLight directionalLight, const in GeometricContext geometry, out IncidentLight directLight ) {\n\t\tdirectLight.color = directionalLight.color;\n\t\tdirectLight.direction = directionalLight.direction;\n\t\tdirectLight.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 getPointDirectLightIrradiance( const in PointLight pointLight, const in GeometricContext geometry, out IncidentLight directLight ) {\n\t\tvec3 lVector = pointLight.position - geometry.position;\n\t\tdirectLight.direction = normalize( lVector );\n\t\tfloat lightDistance = length( lVector );\n\t\tdirectLight.color = pointLight.color;\n\t\tdirectLight.color *= punctualLightIntensityToIrradianceFactor( lightDistance, pointLight.distance, pointLight.decay );\n\t\tdirectLight.visible = ( directLight.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 getSpotDirectLightIrradiance( const in SpotLight spotLight, const in GeometricContext geometry, out IncidentLight directLight ) {\n\t\tvec3 lVector = spotLight.position - geometry.position;\n\t\tdirectLight.direction = normalize( lVector );\n\t\tfloat lightDistance = length( lVector );\n\t\tfloat angleCos = dot( directLight.direction, spotLight.direction );\n\t\tif ( angleCos > spotLight.coneCos ) {\n\t\t\tfloat spotEffect = smoothstep( spotLight.coneCos, spotLight.penumbraCos, angleCos );\n\t\t\tdirectLight.color = spotLight.color;\n\t\t\tdirectLight.color *= spotEffect * punctualLightIntensityToIrradianceFactor( lightDistance, spotLight.distance, spotLight.decay );\n\t\t\tdirectLight.visible = true;\n\t\t} else {\n\t\t\tdirectLight.color = vec3( 0.0 );\n\t\t\tdirectLight.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 GeometricContext geometry ) {\n\t\tfloat dotNL = dot( geometry.normal, hemiLight.direction );\n\t\tfloat hemiDiffuseWeight = 0.5 * dotNL + 0.5;\n\t\tvec3 irradiance = mix( hemiLight.groundColor, hemiLight.skyColor, hemiDiffuseWeight );\n\t\t#ifndef PHYSICALLY_CORRECT_LIGHTS\n\t\t\tirradiance *= PI;\n\t\t#endif\n\t\treturn irradiance;\n\t}\n#endif",lights_toon_fragment:"ToonMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb;",lights_toon_pars_fragment:"varying vec3 vViewPosition;\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n#endif\nstruct ToonMaterial {\n\tvec3 diffuseColor;\n};\nvoid RE_Direct_Toon( const in IncidentLight directLight, const in GeometricContext geometry, const in ToonMaterial material, inout ReflectedLight reflectedLight ) {\n\tvec3 irradiance = getGradientIrradiance( geometry.normal, directLight.direction ) * directLight.color;\n\t#ifndef PHYSICALLY_CORRECT_LIGHTS\n\t\tirradiance *= PI;\n\t#endif\n\treflectedLight.directDiffuse += irradiance * BRDF_Diffuse_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_Diffuse_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;\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n#endif\nstruct BlinnPhongMaterial {\n\tvec3 diffuseColor;\n\tvec3 specularColor;\n\tfloat specularShininess;\n\tfloat specularStrength;\n};\nvoid RE_Direct_BlinnPhong( const in IncidentLight directLight, const in GeometricContext geometry, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight ) {\n\tfloat dotNL = saturate( dot( geometry.normal, directLight.direction ) );\n\tvec3 irradiance = dotNL * directLight.color;\n\t#ifndef PHYSICALLY_CORRECT_LIGHTS\n\t\tirradiance *= PI;\n\t#endif\n\treflectedLight.directDiffuse += irradiance * BRDF_Diffuse_Lambert( material.diffuseColor );\n\treflectedLight.directSpecular += irradiance * BRDF_Specular_BlinnPhong( directLight, geometry, 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_Diffuse_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.specularRoughness = max( roughnessFactor, 0.0525 );material.specularRoughness += geometryRoughness;\nmaterial.specularRoughness = min( material.specularRoughness, 1.0 );\n#ifdef REFLECTIVITY\n\tmaterial.specularColor = mix( vec3( MAXIMUM_SPECULAR_COEFFICIENT * pow2( reflectivity ) ), diffuseColor.rgb, metalnessFactor );\n#else\n\tmaterial.specularColor = mix( vec3( DEFAULT_SPECULAR_COEFFICIENT ), diffuseColor.rgb, metalnessFactor );\n#endif\n#ifdef CLEARCOAT\n\tmaterial.clearcoat = clearcoat;\n\tmaterial.clearcoatRoughness = clearcoatRoughness;\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 = sheen;\n#endif",lights_physical_pars_fragment:"struct PhysicalMaterial {\n\tvec3 diffuseColor;\n\tfloat specularRoughness;\n\tvec3 specularColor;\n#ifdef CLEARCOAT\n\tfloat clearcoat;\n\tfloat clearcoatRoughness;\n#endif\n#ifdef USE_SHEEN\n\tvec3 sheenColor;\n#endif\n};\n#define MAXIMUM_SPECULAR_COEFFICIENT 0.16\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}\n#if NUM_RECT_AREA_LIGHTS > 0\n\tvoid RE_Direct_RectArea_Physical( const in RectAreaLight rectAreaLight, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {\n\t\tvec3 normal = geometry.normal;\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.specularRoughness;\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\nvoid RE_Direct_Physical( const in IncidentLight directLight, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {\n\tfloat dotNL = saturate( dot( geometry.normal, directLight.direction ) );\n\tvec3 irradiance = dotNL * directLight.color;\n\t#ifndef PHYSICALLY_CORRECT_LIGHTS\n\t\tirradiance *= PI;\n\t#endif\n\t#ifdef CLEARCOAT\n\t\tfloat ccDotNL = saturate( dot( geometry.clearcoatNormal, directLight.direction ) );\n\t\tvec3 ccIrradiance = ccDotNL * directLight.color;\n\t\t#ifndef PHYSICALLY_CORRECT_LIGHTS\n\t\t\tccIrradiance *= PI;\n\t\t#endif\n\t\tfloat clearcoatDHR = material.clearcoat * clearcoatDHRApprox( material.clearcoatRoughness, ccDotNL );\n\t\treflectedLight.directSpecular += ccIrradiance * material.clearcoat * BRDF_Specular_GGX( directLight, geometry.viewDir, geometry.clearcoatNormal, vec3( DEFAULT_SPECULAR_COEFFICIENT ), material.clearcoatRoughness );\n\t#else\n\t\tfloat clearcoatDHR = 0.0;\n\t#endif\n\t#ifdef USE_SHEEN\n\t\treflectedLight.directSpecular += ( 1.0 - clearcoatDHR ) * irradiance * BRDF_Specular_Sheen(\n\t\t\tmaterial.specularRoughness,\n\t\t\tdirectLight.direction,\n\t\t\tgeometry,\n\t\t\tmaterial.sheenColor\n\t\t);\n\t#else\n\t\treflectedLight.directSpecular += ( 1.0 - clearcoatDHR ) * irradiance * BRDF_Specular_GGX( directLight, geometry.viewDir, geometry.normal, material.specularColor, material.specularRoughness);\n\t#endif\n\treflectedLight.directDiffuse += ( 1.0 - clearcoatDHR ) * irradiance * BRDF_Diffuse_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_Diffuse_Lambert( material.diffuseColor );\n}\nvoid RE_IndirectSpecular_Physical( const in vec3 radiance, const in vec3 irradiance, const in vec3 clearcoatRadiance, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight) {\n\t#ifdef CLEARCOAT\n\t\tfloat ccDotNV = saturate( dot( geometry.clearcoatNormal, geometry.viewDir ) );\n\t\treflectedLight.indirectSpecular += clearcoatRadiance * material.clearcoat * BRDF_Specular_GGX_Environment( geometry.viewDir, geometry.clearcoatNormal, vec3( DEFAULT_SPECULAR_COEFFICIENT ), material.clearcoatRoughness );\n\t\tfloat ccDotNL = ccDotNV;\n\t\tfloat clearcoatDHR = material.clearcoat * clearcoatDHRApprox( material.clearcoatRoughness, ccDotNL );\n\t#else\n\t\tfloat clearcoatDHR = 0.0;\n\t#endif\n\tfloat clearcoatInv = 1.0 - clearcoatDHR;\n\tvec3 singleScattering = vec3( 0.0 );\n\tvec3 multiScattering = vec3( 0.0 );\n\tvec3 cosineWeightedIrradiance = irradiance * RECIPROCAL_PI;\n\tBRDF_Specular_Multiscattering_Environment( geometry, material.specularColor, material.specularRoughness, 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}\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.normal = normal;\ngeometry.viewDir = ( isOrthographic ) ? vec3( 0, 0, 1 ) : normalize( vViewPosition );\n#ifdef CLEARCOAT\n\tgeometry.clearcoatNormal = 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\tgetPointDirectLightIrradiance( 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( directLight, geometry, material, reflectedLight );\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\tgetSpotDirectLightIrradiance( 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( directLight, geometry, material, reflectedLight );\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\tgetDirectionalDirectLightIrradiance( 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( directLight, geometry, material, reflectedLight );\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, 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, geometry );\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 ], geometry );\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#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 += getLightProbeIndirectIrradiance( geometry, maxMipLevel );\n\t#endif\n#endif\n#if defined( USE_ENVMAP ) && defined( RE_IndirectSpecular )\n\tradiance += getLightProbeIndirectRadiance( geometry.viewDir, geometry.normal, material.specularRoughness, maxMipLevel );\n\t#ifdef CLEARCOAT\n\t\tclearcoatRadiance += getLightProbeIndirectRadiance( geometry.viewDir, geometry.clearcoatNormal, material.clearcoatRoughness, maxMipLevel );\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( radiance, iblIrradiance, clearcoatRadiance, geometry, material, reflectedLight );\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\tobjectNormal += morphNormal0 * morphTargetInfluences[ 0 ];\n\tobjectNormal += morphNormal1 * morphTargetInfluences[ 1 ];\n\tobjectNormal += morphNormal2 * morphTargetInfluences[ 2 ];\n\tobjectNormal += morphNormal3 * morphTargetInfluences[ 3 ];\n#endif",morphtarget_pars_vertex:"#ifdef USE_MORPHTARGETS\n\tuniform float morphTargetBaseInfluence;\n\t#ifndef USE_MORPHNORMALS\n\t\tuniform float morphTargetInfluences[ 8 ];\n\t#else\n\t\tuniform float morphTargetInfluences[ 4 ];\n\t#endif\n#endif",morphtarget_vertex:"#ifdef USE_MORPHTARGETS\n\ttransformed *= morphTargetBaseInfluence;\n\ttransformed += morphTarget0 * morphTargetInfluences[ 0 ];\n\ttransformed += morphTarget1 * morphTargetInfluences[ 1 ];\n\ttransformed += morphTarget2 * morphTargetInfluences[ 2 ];\n\ttransformed += morphTarget3 * morphTargetInfluences[ 3 ];\n\t#ifndef USE_MORPHNORMALS\n\t\ttransformed += morphTarget4 * morphTargetInfluences[ 4 ];\n\t\ttransformed += morphTarget5 * morphTargetInfluences[ 5 ];\n\t\ttransformed += morphTarget6 * morphTargetInfluences[ 6 ];\n\t\ttransformed += morphTarget7 * morphTargetInfluences[ 7 ];\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\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",normalmap_pars_fragment:"#ifdef USE_NORMALMAP\n\tuniform sampler2D normalMap;\n\tuniform vec2 normalScale;\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\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}\n#endif",clearcoat_normal_fragment_begin:"#ifdef 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",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 ) { return color; }",transmissionmap_fragment:"#ifdef USE_TRANSMISSIONMAP\n\ttotalTransmission *= texture2D( transmissionMap, vUv ).r;\n#endif",transmissionmap_pars_fragment:"#ifdef USE_TRANSMISSIONMAP\n\tuniform sampler2D transmissionMap;\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 )\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_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}",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}",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}",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}",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 \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}",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}",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 \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}",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}",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}",equirect_vert:"varying vec3 vWorldDirection;\n#include \nvoid main() {\n\tvWorldDirection = transformDirection( position, modelMatrix );\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\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\n\t#include \n\t#include \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}",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 \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\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\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\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#include \n\t#ifdef USE_ENVMAP\n\t#include \n\t#include \n\t#include \n\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}",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 \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_Diffuse_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_Diffuse_Lambert( diffuseColor.rgb ) * getShadowMask();\n\t#include \n\tvec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance;\n\t#include \n\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\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}",meshmatcap_frag:"#define MATCAP\nuniform vec3 diffuse;\nuniform float opacity;\nuniform sampler2D matcap;\nvarying vec3 vViewPosition;\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 \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 USE_MATCAP\n\t\tvec4 matcapColor = texture2D( matcap, uv );\n\t\tmatcapColor = matcapTexelToLinear( matcapColor );\n\t#else\n\t\tvec4 matcapColor = vec4( 1.0 );\n\t#endif\n\tvec3 outgoingLight = diffuseColor.rgb * matcapColor.rgb;\n\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n}",meshmatcap_vert:"#define MATCAP\nvarying vec3 vViewPosition;\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 \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#ifndef FLAT_SHADED\n\t\tvNormal = normalize( transformedNormal );\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\tvViewPosition = - mvPosition.xyz;\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 \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\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n}",meshtoon_vert:"#define TOON\nvarying vec3 vViewPosition;\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 \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#ifndef FLAT_SHADED\n\tvNormal = normalize( transformedNormal );\n#endif\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}",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 \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\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n}",meshphong_vert:"#define PHONG\nvarying vec3 vViewPosition;\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 \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#ifndef FLAT_SHADED\n\tvNormal = normalize( transformedNormal );\n#endif\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}",meshphysical_frag:"#define STANDARD\n#ifdef PHYSICAL\n\t#define REFLECTIVITY\n\t#define CLEARCOAT\n\t#define TRANSMISSION\n#endif\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform float roughness;\nuniform float metalness;\nuniform float opacity;\n#ifdef TRANSMISSION\n\tuniform float transmission;\n#endif\n#ifdef REFLECTIVITY\n\tuniform float reflectivity;\n#endif\n#ifdef CLEARCOAT\n\tuniform float clearcoat;\n\tuniform float clearcoatRoughness;\n#endif\n#ifdef USE_SHEEN\n\tuniform vec3 sheen;\n#endif\nvarying vec3 vViewPosition;\n#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\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#ifdef TRANSMISSION\n\t\tfloat totalTransmission = transmission;\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\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#ifdef TRANSMISSION\n\t\tdiffuseColor.a *= mix( saturate( 1. - totalTransmission + linearToRelativeLuminance( reflectedLight.directSpecular + reflectedLight.indirectSpecular ) ), 1.0, metalness );\n\t#endif\n\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n}",meshphysical_vert:"#define STANDARD\nvarying vec3 vViewPosition;\n#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\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#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\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}",normal_frag:"#define NORMAL\nuniform float opacity;\n#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( TANGENTSPACE_NORMALMAP )\n\tvarying vec3 vViewPosition;\n#endif\n#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\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}",normal_vert:"#define NORMAL\n#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( TANGENTSPACE_NORMALMAP )\n\tvarying vec3 vViewPosition;\n#endif\n#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\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#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\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}",points_frag:"uniform vec3 diffuse;\nuniform float opacity;\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\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\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}",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}",shadow_vert:"#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}",sprite_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\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\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}"},$n={common:{diffuse:{value:new ke(15658734)},opacity:{value:1},map:{value:null},uvTransform:{value:new ct},uv2Transform:{value:new ct},alphaMap:{value:null}},specularmap:{specularMap:{value:null}},envmap:{envMap:{value:null},flipEnvMap:{value:-1},reflectivity:{value:1},refractionRatio:{value:.98},maxMipLevel:{value:0}},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},normalScale:{value:new lt(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 ke(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 ke(15658734)},opacity:{value:1},size:{value:1},scale:{value:1},map:{value:null},alphaMap:{value:null},uvTransform:{value:new ct}},sprite:{diffuse:{value:new ke(15658734)},opacity:{value:1},center:{value:new lt(.5,.5)},rotation:{value:0},map:{value:null},alphaMap:{value:null},uvTransform:{value:new ct}}},ti={basic:{uniforms:On([$n.common,$n.specularmap,$n.envmap,$n.aomap,$n.lightmap,$n.fog]),vertexShader:Kn.meshbasic_vert,fragmentShader:Kn.meshbasic_frag},lambert:{uniforms:On([$n.common,$n.specularmap,$n.envmap,$n.aomap,$n.lightmap,$n.emissivemap,$n.fog,$n.lights,{emissive:{value:new ke(0)}}]),vertexShader:Kn.meshlambert_vert,fragmentShader:Kn.meshlambert_frag},phong:{uniforms:On([$n.common,$n.specularmap,$n.envmap,$n.aomap,$n.lightmap,$n.emissivemap,$n.bumpmap,$n.normalmap,$n.displacementmap,$n.fog,$n.lights,{emissive:{value:new ke(0)},specular:{value:new ke(1118481)},shininess:{value:30}}]),vertexShader:Kn.meshphong_vert,fragmentShader:Kn.meshphong_frag},standard:{uniforms:On([$n.common,$n.envmap,$n.aomap,$n.lightmap,$n.emissivemap,$n.bumpmap,$n.normalmap,$n.displacementmap,$n.roughnessmap,$n.metalnessmap,$n.fog,$n.lights,{emissive:{value:new ke(0)},roughness:{value:1},metalness:{value:0},envMapIntensity:{value:1}}]),vertexShader:Kn.meshphysical_vert,fragmentShader:Kn.meshphysical_frag},toon:{uniforms:On([$n.common,$n.aomap,$n.lightmap,$n.emissivemap,$n.bumpmap,$n.normalmap,$n.displacementmap,$n.gradientmap,$n.fog,$n.lights,{emissive:{value:new ke(0)}}]),vertexShader:Kn.meshtoon_vert,fragmentShader:Kn.meshtoon_frag},matcap:{uniforms:On([$n.common,$n.bumpmap,$n.normalmap,$n.displacementmap,$n.fog,{matcap:{value:null}}]),vertexShader:Kn.meshmatcap_vert,fragmentShader:Kn.meshmatcap_frag},points:{uniforms:On([$n.points,$n.fog]),vertexShader:Kn.points_vert,fragmentShader:Kn.points_frag},dashed:{uniforms:On([$n.common,$n.fog,{scale:{value:1},dashSize:{value:1},totalSize:{value:2}}]),vertexShader:Kn.linedashed_vert,fragmentShader:Kn.linedashed_frag},depth:{uniforms:On([$n.common,$n.displacementmap]),vertexShader:Kn.depth_vert,fragmentShader:Kn.depth_frag},normal:{uniforms:On([$n.common,$n.bumpmap,$n.normalmap,$n.displacementmap,{opacity:{value:1}}]),vertexShader:Kn.normal_vert,fragmentShader:Kn.normal_frag},sprite:{uniforms:On([$n.sprite,$n.fog]),vertexShader:Kn.sprite_vert,fragmentShader:Kn.sprite_frag},background:{uniforms:{uvTransform:{value:new ct},t2D:{value:null}},vertexShader:Kn.background_vert,fragmentShader:Kn.background_frag},cube:{uniforms:On([$n.envmap,{opacity:{value:1}}]),vertexShader:Kn.cube_vert,fragmentShader:Kn.cube_frag},equirect:{uniforms:{tEquirect:{value:null}},vertexShader:Kn.equirect_vert,fragmentShader:Kn.equirect_frag},distanceRGBA:{uniforms:On([$n.common,$n.displacementmap,{referencePosition:{value:new xt},nearDistance:{value:1},farDistance:{value:1e3}}]),vertexShader:Kn.distanceRGBA_vert,fragmentShader:Kn.distanceRGBA_frag},shadow:{uniforms:On([$n.lights,$n.fog,{color:{value:new ke(0)},opacity:{value:1}}]),vertexShader:Kn.shadow_vert,fragmentShader:Kn.shadow_frag}};function ei(t,e,n,i,r){const s=new ke(0);let a,o,c=0,h=null,u=0,d=null;function p(t,e){n.buffers.color.setClear(t.r,t.g,t.b,e,r)}return{getClearColor:function(){return s},setClearColor:function(t,e=1){s.set(t),c=e,p(s,c)},getClearAlpha:function(){return c},setClearAlpha:function(t){c=t,p(s,c)},render:function(n,r,m,f){let g=!0===r.isScene?r.background:null;g&&g.isTexture&&(g=e.get(g));const v=t.xr,y=v.getSession&&v.getSession();y&&"additive"===y.environmentBlendMode&&(g=null),null===g?p(s,c):g&&g.isColor&&(p(g,1),f=!0),(t.autoClear||f)&&t.clear(t.autoClearColor,t.autoClearDepth,t.autoClearStencil),g&&(g.isCubeTexture||g.mapping===l)?(void 0===o&&(o=new Dn(new Nn(1,1,1),new Fn({name:"BackgroundCubeMaterial",uniforms:Bn(ti.cube.uniforms),vertexShader:ti.cube.vertexShader,fragmentShader:ti.cube.fragmentShader,side:1,depthTest:!1,depthWrite:!1,fog:!1})),o.geometry.deleteAttribute("normal"),o.geometry.deleteAttribute("uv"),o.onBeforeRender=function(t,e,n){this.matrixWorld.copyPosition(n.matrixWorld)},Object.defineProperty(o.material,"envMap",{get:function(){return this.uniforms.envMap.value}}),i.update(o)),o.material.uniforms.envMap.value=g,o.material.uniforms.flipEnvMap.value=g.isCubeTexture&&g._needsFlipEnvMap?-1:1,h===g&&u===g.version&&d===t.toneMapping||(o.material.needsUpdate=!0,h=g,u=g.version,d=t.toneMapping),n.unshift(o,o.geometry,o.material,0,0,null)):g&&g.isTexture&&(void 0===a&&(a=new Dn(new Qn(2,2),new Fn({name:"BackgroundMaterial",uniforms:Bn(ti.background.uniforms),vertexShader:ti.background.vertexShader,fragmentShader:ti.background.fragmentShader,side:0,depthTest:!1,depthWrite:!1,fog:!1})),a.geometry.deleteAttribute("normal"),Object.defineProperty(a.material,"map",{get:function(){return this.uniforms.t2D.value}}),i.update(a)),a.material.uniforms.t2D.value=g,!0===g.matrixAutoUpdate&&g.updateMatrix(),a.material.uniforms.uvTransform.value.copy(g.matrix),h===g&&u===g.version&&d===t.toneMapping||(a.material.needsUpdate=!0,h=g,u=g.version,d=t.toneMapping),n.unshift(a,a.geometry,a.material,0,0,null))}}}function ni(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){const s=l[e];if(void 0!==s){const e=s.normalized,r=s.itemSize,a=n.get(s);if(void 0===a)continue;const l=a.buffer,c=a.type,h=a.bytesPerElement;if(s.isInterleavedBufferAttribute){const n=s.data,a=n.stride,u=s.offset;n&&n.isInstancedInterleavedBuffer?(f(i,n.meshPerAttribute),void 0===o._maxInstanceCount&&(o._maxInstanceCount=n.meshPerAttribute*n.count)):m(i),t.bindBuffer(34962,l),v(i,r,c,e,a*h,u*h)}else s.isInstancedBufferAttribute?(f(i,s.meshPerAttribute),void 0===o._maxInstanceCount&&(o._maxInstanceCount=s.meshPerAttribute*s.count)):m(i),t.bindBuffer(34962,l),v(i,r,c,e,0,0)}else if("instanceMatrix"===e){const e=n.get(r.instanceMatrix);if(void 0===e)continue;const s=e.buffer,a=e.type;f(i+0,1),f(i+1,1),f(i+2,1),f(i+3,1),t.bindBuffer(34962,s),t.vertexAttribPointer(i+0,4,a,!1,64,0),t.vertexAttribPointer(i+1,4,a,!1,64,16),t.vertexAttribPointer(i+2,4,a,!1,64,32),t.vertexAttribPointer(i+3,4,a,!1,64,48)}else if("instanceColor"===e){const e=n.get(r.instanceColor);if(void 0===e)continue;const s=e.buffer,a=e.type;f(i,1),t.bindBuffer(34962,s),t.vertexAttribPointer(i,3,a,!1,12,0)}else if(void 0!==h){const n=h[e];if(void 0!==n)switch(n.length){case 2:t.vertexAttrib2fv(i,n);break;case 3:t.vertexAttrib3fv(i,n);break;case 4:t.vertexAttrib4fv(i,n);break;default:t.vertexAttrib1fv(i,n)}}}}g()}(r,l,u,y),null!==x&&t.bindBuffer(34963,n.get(x).buffer))},reset:y,resetDefaultState:x,dispose:function(){y();for(const t in o){const e=o[t];for(const t in e){const n=e[t];for(const t in n)u(n[t].object),delete n[t];delete e[t]}delete o[t]}},releaseStatesOfGeometry:function(t){if(void 0===o[t.id])return;const e=o[t.id];for(const t in e){const n=e[t];for(const t in n)u(n[t].object),delete n[t];delete e[t]}delete o[t.id]},releaseStatesOfProgram:function(t){for(const e in o){const n=o[e];if(void 0===n[t.id])continue;const i=n[t.id];for(const t in i)u(i[t].object),delete i[t];delete n[t.id]}},initAttributes:p,enableAttribute:m,disableUnusedAttributes:g}}function ii(t,e,n,i){const r=i.isWebGL2;let s;this.setMode=function(t){s=t},this.render=function(e,i){t.drawArrays(s,e,i),n.update(i,s,1)},this.renderInstances=function(i,a,o){if(0===o)return;let l,c;if(r)l=t,c="drawArraysInstanced";else if(l=e.get("ANGLE_instanced_arrays"),c="drawArraysInstancedANGLE",null===l)return void console.error("THREE.WebGLBufferRenderer: using THREE.InstancedBufferGeometry but hardware does not support extension ANGLE_instanced_arrays.");l[c](s,i,a,o),n.update(a,s,o)}}function ri(t,e,n){let i;function r(e){if("highp"===e){if(t.getShaderPrecisionFormat(35633,36338).precision>0&&t.getShaderPrecisionFormat(35632,36338).precision>0)return"highp";e="mediump"}return"mediump"===e&&t.getShaderPrecisionFormat(35633,36337).precision>0&&t.getShaderPrecisionFormat(35632,36337).precision>0?"mediump":"lowp"}const s="undefined"!=typeof WebGL2RenderingContext&&t instanceof WebGL2RenderingContext||"undefined"!=typeof WebGL2ComputeRenderingContext&&t instanceof WebGL2ComputeRenderingContext;let 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=!0===n.logarithmicDepthBuffer,c=t.getParameter(34930),h=t.getParameter(35660),u=t.getParameter(3379),d=t.getParameter(34076),p=t.getParameter(34921),m=t.getParameter(36347),f=t.getParameter(36348),g=t.getParameter(36349),v=h>0,y=s||e.has("OES_texture_float");return{isWebGL2:s,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:l,maxTextures:c,maxVertexTextures:h,maxTextureSize:u,maxCubemapSize:d,maxAttributes:p,maxVertexUniforms:m,maxVaryings:f,maxFragmentUniforms:g,vertexTextures:v,floatFragmentTextures:y,floatVertexTextures:v&&y,maxSamples:s?t.getParameter(36183):0}}function si(t){const e=this;let n=null,i=0,r=!1,s=!1;const a=new we,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=t.getRenderTarget(),o=new Wn(s.height/2);return o.fromEquirectangularTexture(t,r),e.set(r,o),t.setRenderTarget(a),r.addEventListener("dispose",i),n(o.texture,r.mapping)}return null}}}return r},dispose:function(){e=new WeakMap}}}function oi(t){const e={};function n(n){if(void 0!==e[n])return e[n];let i;switch(n){case"WEBGL_depth_texture":i=t.getExtension("WEBGL_depth_texture")||t.getExtension("MOZ_WEBGL_depth_texture")||t.getExtension("WEBKIT_WEBGL_depth_texture");break;case"EXT_texture_filter_anisotropic":i=t.getExtension("EXT_texture_filter_anisotropic")||t.getExtension("MOZ_EXT_texture_filter_anisotropic")||t.getExtension("WEBKIT_EXT_texture_filter_anisotropic");break;case"WEBGL_compressed_texture_s3tc":i=t.getExtension("WEBGL_compressed_texture_s3tc")||t.getExtension("MOZ_WEBGL_compressed_texture_s3tc")||t.getExtension("WEBKIT_WEBGL_compressed_texture_s3tc");break;case"WEBGL_compressed_texture_pvrtc":i=t.getExtension("WEBGL_compressed_texture_pvrtc")||t.getExtension("WEBKIT_WEBGL_compressed_texture_pvrtc");break;default:i=t.getExtension(n)}return e[n]=i,i}return{has:function(t){return null!==n(t)},init:function(t){t.isWebGL2?n("EXT_color_buffer_float"):(n("WEBGL_depth_texture"),n("OES_texture_float"),n("OES_texture_half_float"),n("OES_texture_half_float_linear"),n("OES_standard_derivatives"),n("OES_element_index_uint"),n("OES_vertex_array_object"),n("ANGLE_instanced_arrays")),n("OES_texture_float_linear"),n("EXT_color_buffer_half_float")},get:function(t){const e=n(t);return null===e&&console.warn("THREE.WebGLRenderer: "+t+" extension not supported."),e}}}function li(t,e,n,i){const r={},s=new WeakMap;function a(t){const o=t.target;null!==o.index&&e.remove(o.index);for(const t in o.attributes)e.remove(o.attributes[t]);o.removeEventListener("dispose",a),delete r[o.id];const l=s.get(o);l&&(e.remove(l),s.delete(o)),i.releaseStatesOfGeometry(o),!0===o.isInstancedBufferGeometry&&delete o._maxInstanceCount,n.memory.geometries--}function o(t){const n=[],i=t.index,r=t.attributes.position;let a=0;if(null!==i){const t=i.array;a=i.version;for(let e=0,i=t.length;e65535?$e:Qe)(n,1);o.version=a;const l=s.get(t);l&&e.remove(l),s.set(t,o)}return{get:function(t,e){return!0===r[e.id]||(e.addEventListener("dispose",a),r[e.id]=!0,n.memory.geometries++),e},update:function(t){const n=t.attributes;for(const t in n)e.update(n[t],34962);const i=t.morphAttributes;for(const t in i){const n=i[t];for(let t=0,i=n.length;t0)return t;const r=e*n;let s=bi[r];if(void 0===s&&(s=new Float32Array(r),bi[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 Ai(t,e){if(t.length!==e.length)return!1;for(let n=0,i=t.length;n/gm;function Mr(t){return t.replace(wr,Sr)}function Sr(t,e){const n=Kn[e];if(void 0===n)throw new Error("Can not resolve #include <"+e+">");return Mr(n)}const Tr=/#pragma unroll_loop[\s]+?for \( int i \= (\d+)\; i < (\d+)\; i \+\+ \) \{([\s\S]+?)(?=\})\}/g,Er=/#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 Ar(t){return t.replace(Er,Rr).replace(Tr,Lr)}function Lr(t,e,n,i){return console.warn("WebGLProgram: #pragma unroll_loop shader syntax is deprecated. Please use #pragma unroll_loop_start syntax instead."),Rr(t,e,n,i)}function Rr(t,e,n,i){let r="";for(let t=parseInt(e);t0?t.gammaFactor:1,v=n.isWebGL2?"":function(t){return[t.extensionDerivatives||t.envMapCubeUV||t.bumpMap||t.tangentSpaceNormalMap||t.clearcoatNormalMap||t.flatShading||"physical"===t.shaderID?"#extension GL_OES_standard_derivatives : enable":"",(t.extensionFragDepth||t.logarithmicDepthBuffer)&&t.rendererExtensionFragDepth?"#extension GL_EXT_frag_depth : enable":"",t.extensionDrawBuffers&&t.rendererExtensionDrawBuffers?"#extension GL_EXT_draw_buffers : require":"",(t.extensionShaderTextureLOD||t.envMap)&&t.rendererExtensionShaderTextureLod?"#extension GL_EXT_shader_texture_lod : enable":""].filter(xr).join("\n")}(n),y=function(t){const e=[];for(const n in t){const i=t[n];!1!==i&&e.push("#define "+n+" "+i)}return e.join("\n")}(o),x=a.createProgram();let _,b,w=n.glslVersion?"#version "+n.glslVersion+"\n":"";n.isRawShaderMaterial?(_=[y].filter(xr).join("\n"),_.length>0&&(_+="\n"),b=[v,y].filter(xr).join("\n"),b.length>0&&(b+="\n")):(_=[Cr(n),"#define SHADER_NAME "+n.shaderName,y,n.instancing?"#define USE_INSTANCING":"",n.instancingColor?"#define USE_INSTANCING_COLOR":"",n.supportsVertexTextures?"#define VERTEX_TEXTURES":"","#define GAMMA_FACTOR "+g,"#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.normalMap&&n.objectSpaceNormalMap?"#define OBJECTSPACE_NORMALMAP":"",n.normalMap&&n.tangentSpaceNormalMap?"#define TANGENTSPACE_NORMALMAP":"",n.clearcoatMap?"#define USE_CLEARCOATMAP":"",n.clearcoatRoughnessMap?"#define USE_CLEARCOAT_ROUGHNESSMAP":"",n.clearcoatNormalMap?"#define USE_CLEARCOAT_NORMALMAP":"",n.displacementMap&&n.supportsVertexTextures?"#define USE_DISPLACEMENTMAP":"",n.specularMap?"#define USE_SPECULARMAP":"",n.roughnessMap?"#define USE_ROUGHNESSMAP":"",n.metalnessMap?"#define USE_METALNESSMAP":"",n.alphaMap?"#define USE_ALPHAMAP":"",n.transmissionMap?"#define USE_TRANSMISSIONMAP":"",n.vertexTangents?"#define USE_TANGENT":"",n.vertexColors?"#define USE_COLOR":"",n.vertexUvs?"#define USE_UV":"",n.uvsVertexOnly?"#define UVS_VERTEX_ONLY":"",n.flatShading?"#define FLAT_SHADED":"",n.skinning?"#define USE_SKINNING":"",n.useVertexTexture?"#define BONE_TEXTURE":"",n.morphTargets?"#define USE_MORPHTARGETS":"",n.morphNormals&&!1===n.flatShading?"#define USE_MORPHNORMALS":"",n.doubleSided?"#define DOUBLE_SIDED":"",n.flipSided?"#define FLIP_SIDED":"",n.shadowMapEnabled?"#define USE_SHADOWMAP":"",n.shadowMapEnabled?"#define "+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","#ifdef USE_COLOR","\tattribute vec3 color;","#endif","#ifdef USE_MORPHTARGETS","\tattribute vec3 morphTarget0;","\tattribute vec3 morphTarget1;","\tattribute vec3 morphTarget2;","\tattribute vec3 morphTarget3;","\t#ifdef USE_MORPHNORMALS","\t\tattribute vec3 morphNormal0;","\t\tattribute vec3 morphNormal1;","\t\tattribute vec3 morphNormal2;","\t\tattribute vec3 morphNormal3;","\t#else","\t\tattribute vec3 morphTarget4;","\t\tattribute vec3 morphTarget5;","\t\tattribute vec3 morphTarget6;","\t\tattribute vec3 morphTarget7;","\t#endif","#endif","#ifdef USE_SKINNING","\tattribute vec4 skinIndex;","\tattribute vec4 skinWeight;","#endif","\n"].filter(xr).join("\n"),b=[v,Cr(n),"#define SHADER_NAME "+n.shaderName,y,n.alphaTest?"#define ALPHATEST "+n.alphaTest+(n.alphaTest%1?"":".0"):"","#define GAMMA_FACTOR "+g,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.normalMap&&n.objectSpaceNormalMap?"#define OBJECTSPACE_NORMALMAP":"",n.normalMap&&n.tangentSpaceNormalMap?"#define TANGENTSPACE_NORMALMAP":"",n.clearcoatMap?"#define USE_CLEARCOATMAP":"",n.clearcoatRoughnessMap?"#define USE_CLEARCOAT_ROUGHNESSMAP":"",n.clearcoatNormalMap?"#define USE_CLEARCOAT_NORMALMAP":"",n.specularMap?"#define USE_SPECULARMAP":"",n.roughnessMap?"#define USE_ROUGHNESSMAP":"",n.metalnessMap?"#define USE_METALNESSMAP":"",n.alphaMap?"#define USE_ALPHAMAP":"",n.sheen?"#define USE_SHEEN":"",n.transmissionMap?"#define USE_TRANSMISSIONMAP":"",n.vertexTangents?"#define USE_TANGENT":"",n.vertexColors||n.instancingColor?"#define USE_COLOR":"",n.vertexUvs?"#define USE_UV":"",n.uvsVertexOnly?"#define UVS_VERTEX_ONLY":"",n.gradientMap?"#define USE_GRADIENTMAP":"",n.flatShading?"#define FLAT_SHADED":"",n.doubleSided?"#define DOUBLE_SIDED":"",n.flipSided?"#define FLIP_SIDED":"",n.shadowMapEnabled?"#define USE_SHADOWMAP":"",n.shadowMapEnabled?"#define "+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?Kn.tonemapping_pars_fragment:"",0!==n.toneMapping?yr("toneMapping",n.toneMapping):"",n.dithering?"#define DITHERING":"",Kn.encodings_pars_fragment,n.map?gr("mapTexelToLinear",n.mapEncoding):"",n.matcap?gr("matcapTexelToLinear",n.matcapEncoding):"",n.envMap?gr("envMapTexelToLinear",n.envMapEncoding):"",n.emissiveMap?gr("emissiveMapTexelToLinear",n.emissiveMapEncoding):"",n.lightMap?gr("lightMapTexelToLinear",n.lightMapEncoding):"",vr("linearToOutputTexel",n.outputEncoding),n.depthPacking?"#define DEPTH_PACKING "+n.depthPacking:"","\n"].filter(xr).join("\n")),h=Mr(h),h=_r(h,n),h=br(h,n),u=Mr(u),u=_r(u,n),u=br(u,n),h=Ar(h),u=Ar(u),n.isWebGL2&&!0!==n.isRawShaderMaterial&&(w="#version 300 es\n",_=["#define attribute in","#define varying out","#define texture2D texture"].join("\n")+"\n"+_,b=["#define varying in",n.glslVersion===it?"":"out highp vec4 pc_fragColor;",n.glslVersion===it?"":"#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"+b);const M=w+b+u,S=dr(a,35633,w+_+h),T=dr(a,35632,M);if(a.attachShader(x,S),a.attachShader(x,T),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(S).trim(),n=a.getShaderInfoLog(T).trim();let i=!0,r=!0;if(!1===a.getProgramParameter(x,35714)){i=!1;const e=fr(a,S,"vertex"),n=fr(a,T,"fragment");console.error("THREE.WebGLProgram: shader error: ",a.getError(),"35715",a.getProgramParameter(x,35715),"gl.getProgramInfoLog",t,e,n)}else""!==t?console.warn("THREE.WebGLProgram: gl.getProgramInfoLog()",t):""!==e&&""!==n||(r=!1);r&&(this.diagnostics={runnable:i,programLog:t,vertexShader:{log:e,prefix:_},fragmentShader:{log:n,prefix:b}})}let E,A;return a.deleteShader(S),a.deleteShader(T),this.getUniforms=function(){return void 0===E&&(E=new ur(a,x)),E},this.getAttributes=function(){return void 0===A&&(A=function(t,e){const n={},i=t.getProgramParameter(e,35721);for(let r=0;r0,maxBones:S,useVertexTexture:u,morphTargets:r.morphTargets,morphNormals:r.morphNormals,maxMorphTargets:t.maxMorphTargets,maxMorphNormals:t.maxMorphNormals,numDirLights:a.directional.length,numPointLights:a.point.length,numSpotLights:a.spot.length,numRectAreaLights:a.rectArea.length,numHemiLights:a.hemi.length,numDirLightShadows:a.directionalShadowMap.length,numPointLightShadows:a.pointShadowMap.length,numSpotLightShadows:a.spotShadowMap.length,numClippingPlanes:s.numPlanes,numClipIntersection:s.numIntersection,dithering:r.dithering,shadowMapEnabled:t.shadowMap.enabled&&g.length>0,shadowMapType:t.shadowMap.type,toneMapping:r.toneMapped?t.toneMapping:0,physicallyCorrectLights:t.physicallyCorrectLights,premultipliedAlpha:r.premultipliedAlpha,alphaTest:r.alphaTest,doubleSided:2===r.side,flipSided:1===r.side,depthPacking:void 0!==r.depthPacking&&r.depthPacking,index0AttributeName:r.index0AttributeName,extensionDerivatives:r.extensions&&r.extensions.derivatives,extensionFragDepth:r.extensions&&r.extensions.fragDepth,extensionDrawBuffers:r.extensions&&r.extensions.drawBuffers,extensionShaderTextureLOD:r.extensions&&r.extensions.shaderTextureLOD,rendererExtensionFragDepth:o||n.has("EXT_frag_depth"),rendererExtensionDrawBuffers:o||n.has("WEBGL_draw_buffers"),rendererExtensionShaderTextureLod:o||n.has("EXT_shader_texture_lod"),customProgramCacheKey:r.customProgramCacheKey()}},getProgramCacheKey:function(e){const n=[];if(e.shaderID?n.push(e.shaderID):(n.push(e.fragmentShader),n.push(e.vertexShader)),void 0!==e.defines)for(const t in e.defines)n.push(t),n.push(e.defines[t]);if(!1===e.isRawShaderMaterial){for(let t=0;t1&&i.sort(t||Nr),r.length>1&&r.sort(e||Br)}}}function zr(t){let e=new WeakMap;return{get:function(n,i){let r;return!1===e.has(n)?(r=new Or(t),e.set(n,[r])):i>=e.get(n).length?(r=new Or(t),e.get(n).push(r)):r=e.get(n)[i],r},dispose:function(){e=new WeakMap}}}function Fr(){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 xt,color:new ke};break;case"SpotLight":n={position:new xt,direction:new xt,color:new ke,distance:0,coneCos:0,penumbraCos:0,decay:0};break;case"PointLight":n={position:new xt,color:new ke,distance:0,decay:0};break;case"HemisphereLight":n={direction:new xt,skyColor:new ke,groundColor:new ke};break;case"RectAreaLight":n={color:new ke,position:new xt,halfWidth:new xt,halfHeight:new xt}}return t[e.id]=n,n}}}let Hr=0;function Gr(t,e){return(e.castShadow?1:0)-(t.castShadow?1:0)}function Ur(t,e){const n=new Fr,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 lt};break;case"PointLight":n={shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new lt,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 xt);const s=new xt,a=new Xt,o=new Xt;return{setup:function(s){let a=0,o=0,l=0;for(let t=0;t<9;t++)r.probe[t].set(0,0,0);let c=0,h=0,u=0,d=0,p=0,m=0,f=0,g=0;s.sort(Gr);for(let t=0,e=s.length;t0&&(e.isWebGL2||!0===t.has("OES_texture_float_linear")?(r.rectAreaLTC1=$n.LTC_FLOAT_1,r.rectAreaLTC2=$n.LTC_FLOAT_2):!0===t.has("OES_texture_half_float_linear")?(r.rectAreaLTC1=$n.LTC_HALF_1,r.rectAreaLTC2=$n.LTC_HALF_2):console.error("THREE.WebGLRenderer: Unable to use RectAreaLight. Missing WebGL extensions.")),r.ambient[0]=a,r.ambient[1]=o,r.ambient[2]=l;const v=r.hash;v.directionalLength===c&&v.pointLength===h&&v.spotLength===u&&v.rectAreaLength===d&&v.hemiLength===p&&v.numDirectionalShadows===m&&v.numPointShadows===f&&v.numSpotShadows===g||(r.directional.length=c,r.spot.length=u,r.rectArea.length=d,r.point.length=h,r.hemi.length=p,r.directionalShadow.length=m,r.directionalShadowMap.length=m,r.pointShadow.length=f,r.pointShadowMap.length=f,r.spotShadow.length=g,r.spotShadowMap.length=g,r.directionalShadowMatrix.length=m,r.pointShadowMatrix.length=f,r.spotShadowMatrix.length=g,v.directionalLength=c,v.pointLength=h,v.spotLength=u,v.rectAreaLength=d,v.hemiLength=p,v.numDirectionalShadows=m,v.numPointShadows=f,v.numSpotShadows=g,r.version=Hr++)},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 kr(t,e),n.get(i).push(s)):s=n.get(i)[r],s},dispose:function(){n=new WeakMap}}}class Wr extends Be{constructor(t){super(),this.type="MeshDepthMaterial",this.depthPacking=3200,this.skinning=!1,this.morphTargets=!1,this.map=null,this.alphaMap=null,this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.wireframe=!1,this.wireframeLinewidth=1,this.fog=!1,this.setValues(t)}copy(t){return super.copy(t),this.depthPacking=t.depthPacking,this.skinning=t.skinning,this.morphTargets=t.morphTargets,this.map=t.map,this.alphaMap=t.alphaMap,this.displacementMap=t.displacementMap,this.displacementScale=t.displacementScale,this.displacementBias=t.displacementBias,this.wireframe=t.wireframe,this.wireframeLinewidth=t.wireframeLinewidth,this}}Wr.prototype.isMeshDepthMaterial=!0;class jr extends Be{constructor(t){super(),this.type="MeshDistanceMaterial",this.referencePosition=new xt,this.nearDistance=1,this.farDistance=1e3,this.skinning=!1,this.morphTargets=!1,this.map=null,this.alphaMap=null,this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.fog=!1,this.setValues(t)}copy(t){return super.copy(t),this.referencePosition.copy(t.referencePosition),this.nearDistance=t.nearDistance,this.farDistance=t.farDistance,this.skinning=t.skinning,this.morphTargets=t.morphTargets,this.map=t.map,this.alphaMap=t.alphaMap,this.displacementMap=t.displacementMap,this.displacementScale=t.displacementScale,this.displacementBias=t.displacementBias,this}}jr.prototype.isMeshDistanceMaterial=!0;function qr(t,e,n){let i=new Yn;const r=new lt,s=new lt,a=new ft,o=[],l=[],c={},h=n.maxTextureSize,u={0:1,1:0,2:2},d=new Fn({defines:{SAMPLE_RATE:2/8,HALF_SAMPLE_RATE:1/8},uniforms:{shadow_pass:{value:null},resolution:{value:new lt},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\tfloat mean = 0.0;\n\tfloat squared_mean = 0.0;\n\tfloat depth = unpackRGBAToDepth( texture2D( shadow_pass, ( gl_FragCoord.xy ) / resolution ) );\n\tfor ( float i = -1.0; i < 1.0 ; i += SAMPLE_RATE) {\n\t\t#ifdef HORIZONTAL_PASS\n\t\t\tvec2 distribution = unpackRGBATo2Half( texture2D( shadow_pass, ( gl_FragCoord.xy + vec2( i, 0.0 ) * radius ) / resolution ) );\n\t\t\tmean += distribution.x;\n\t\t\tsquared_mean += distribution.y * distribution.y + distribution.x * distribution.x;\n\t\t#else\n\t\t\tfloat depth = unpackRGBAToDepth( texture2D( shadow_pass, ( gl_FragCoord.xy + vec2( 0.0, i ) * radius ) / resolution ) );\n\t\t\tmean += depth;\n\t\t\tsquared_mean += depth * depth;\n\t\t#endif\n\t}\n\tmean = mean * HALF_SAMPLE_RATE;\n\tsquared_mean = squared_mean * HALF_SAMPLE_RATE;\n\tfloat std_dev = sqrt( squared_mean - mean * mean );\n\tgl_FragColor = pack2HalfToRGBA( vec2( mean, std_dev ) );\n}"}),m=d.clone();m.defines.HORIZONTAL_PASS=1;const f=new mn;f.setAttribute("position",new qe(new Float32Array([-1,-1,.5,3,-1,.5,-1,3,.5]),3));const v=new Dn(f,d),y=this;function x(n,i){const r=e.update(v);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 _(t,e,n){const i=t<<0|e<<1|n<<2;let r=o[i];return void 0===r&&(r=new Wr({depthPacking:3201,morphTargets:t,skinning:e}),o[i]=r),r}function b(t,e,n){const i=t<<0|e<<1|n<<2;let r=l[i];return void 0===r&&(r=new jr({morphTargets:t,skinning:e}),l[i]=r),r}function w(e,n,i,r,s,a,o){let l=null,h=_,d=e.customDepthMaterial;if(!0===r.isPointLight&&(h=b,d=e.customDistanceMaterial),void 0===d){let t=!1;!0===i.morphTargets&&(t=n.morphAttributes&&n.morphAttributes.position&&n.morphAttributes.position.length>0);let r=!1;!0===e.isSkinnedMesh&&(!0===i.skinning?r=!0:console.warn("THREE.WebGLShadowMap: THREE.SkinnedMesh with material.skinning set to false:",e));l=h(t,r,!0===e.isInstancedMesh)}else l=d;if(t.localClippingEnabled&&!0===i.clipShadows&&0!==i.clippingPlanes.length){const t=l.uuid,e=i.uuid;let n=c[t];void 0===n&&(n={},c[t]=n);let r=n[e];void 0===r&&(r=l.clone(),n[e]=r),l=r}return l.visible=i.visible,l.wireframe=i.wireframe,l.side=3===o?null!==i.shadowSide?i.shadowSide:i.side:null!==i.shadowSide?i.shadowSide:u[i.side],l.clipShadows=i.clipShadows,l.clippingPlanes=i.clippingPlanes,l.clipIntersection=i.clipIntersection,l.wireframeLinewidth=i.wireframeLinewidth,l.linewidth=i.linewidth,!0===r.isPointLight&&!0===l.isMeshDistanceMaterial&&(l.referencePosition.setFromMatrixPosition(r.matrixWorld),l.nearDistance=s,l.farDistance=a),l}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:E};u.map=new gt(r.x,r.y,t),u.map.texture.name=c.name+".shadowMap",u.mapPass=new gt(r.x,r.y,t),u.camera.updateProjectionMatrix()}if(null===u.map){const t={minFilter:p,magFilter:p,format:E};u.map=new gt(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!==R.indexOf("OpenGL ES")&&(L=parseFloat(/^OpenGL ES (\d)/.exec(R)[1]),A=L>=2);let C=null,P={};const D=new ft(0,0,t.canvas.width,t.canvas.height),I=new ft(0,0,t.canvas.width,t.canvas.height);function N(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?ot.floorPowerOfTwo:Math.floor,s=i(r*t.width),a=i(r*t.height);void 0===P&&(P=I(s,a));const o=n?I(s,a):P;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 ot.isPowerOfTwo(t.width)&&ot.isPowerOfTwo(t.height)}function O(t,e){return t.generateMipmaps&&e&&t.minFilter!==p&&t.minFilter!==g}function z(e,n,r,s){t.generateMipmap(e);i.get(n).__maxMipLevel=Math.log2(Math.max(r,s))}function F(n,i,r){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 s=i;return 6403===i&&(5126===r&&(s=33326),5131===r&&(s=33325),5121===r&&(s=33321)),6407===i&&(5126===r&&(s=34837),5131===r&&(s=34843),5121===r&&(s=32849)),6408===i&&(5126===r&&(s=34836),5131===r&&(s=34842),5121===r&&(s=32856)),33325!==s&&33326!==s&&34842!==s&&34836!==s||e.get("EXT_color_buffer_float"),s}function H(t){return t===p||t===m||t===f?9728:9729}function G(e){const n=e.target;n.removeEventListener("dispose",G),function(e){const n=i.get(e);if(void 0===n.__webglInit)return;t.deleteTexture(n.__webglTexture),i.remove(e)}(n),n.isVideoTexture&&C.delete(n),a.memory.textures--}function U(e){const n=e.target;n.removeEventListener("dispose",U),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);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);i.remove(n),i.remove(e)}(n),a.memory.textures--}let k=0;function V(t,e){const r=i.get(t);if(t.isVideoTexture&&function(t){const e=a.render.frame;C.get(t)!==e&&(C.set(t,e),t.update())}(t),t.version>0&&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 Z(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 W(e,r){const a=i.get(e);e.version>0&&a.__version!==e.version?function(e,i,r){if(6!==i.image.length)return;Y(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]:N(i.image[t],!1,!0,c);const u=h[0],d=B(u)||o,p=s.convert(i.format),m=s.convert(i.type),f=F(i.internalFormat,p,m);let g;if(X(34067,i,d),a){for(let t=0;t<6;t++){g=h[t].mipmaps;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 Y(e,n){void 0===e.__webglInit&&(e.__webglInit=!0,n.addEventListener("dispose",G),e.__webglTexture=t.createTexture(),a.memory.textures++)}function Z(e,i,r){let a=3553;i.isDataTexture2DArray&&(a=35866),i.isDataTexture3D&&(a=32879),Y(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=N(i.image,l,!1,x),h=B(c)||o,d=s.convert(i.format);let m,f=s.convert(i.type),v=F(i.internalFormat,d,f);X(a,i,h);const y=i.mipmaps;if(i.isDepthTexture)v=6402,o?v=i.type===w?36012:i.type===b?33190:i.type===S?35056:33189:i.type===w&&console.error("WebGLRenderer: Floating point depth texture requires WebGL2."),i.format===A&&6402===v&&i.type!==_&&i.type!==b&&(console.warn("THREE.WebGLRenderer: Use UnsignedShortType or UnsignedIntType for DepthFormat DepthTexture."),i.type=_,f=s.convert(i.type)),i.format===L&&6402===v&&(v=34041,i.type!==S&&(console.warn("THREE.WebGLRenderer: Use UnsignedInt248Type for DepthStencilFormat DepthTexture."),i.type=S,f=s.convert(i.type))),n.texImage2D(3553,0,v,c.width,c.height,0,d,f,null);else if(i.isDataTexture)if(y.length>0&&h){for(let t=0,e=y.length;t0&&h){for(let t=0,e=y.length;t=l&&console.warn("THREE.WebGLTextures: Trying to use "+t+" texture units while this GPU supports only "+l),k+=1,t},this.resetTextureUnits=function(){k=0},this.setTexture2D=V,this.setTexture2DArray=function(t,e){const r=i.get(t);t.version>0&&r.__version!==t.version?Z(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?Z(r,t,e):(n.activeTexture(33984+e),n.bindTexture(32879,r.__webglTexture))},this.setTextureCube=W,this.setupRenderTarget=function(e){const r=e.texture,l=i.get(e),c=i.get(r);e.addEventListener("dispose",U),c.__webglTexture=t.createTexture(),c.__version=r.version,a.memory.textures++;const h=!0===e.isWebGLCubeRenderTarget,u=!0===e.isWebGLMultisampleRenderTarget,d=r.isDataTexture3D||r.isDataTexture2DArray,p=B(e)||o;if(!o||r.format!==T||r.type!==w&&r.type!==M||(r.format=E,console.warn("THREE.WebGLRenderer: Rendering to textures with RGB format is not supported. Using RGBA format instead.")),h){l.__webglFramebuffer=[];for(let e=0;e<6;e++)l.__webglFramebuffer[e]=t.createFramebuffer()}else if(l.__webglFramebuffer=t.createFramebuffer(),u)if(o){l.__webglMultisampledFramebuffer=t.createFramebuffer(),l.__webglColorRenderbuffer=t.createRenderbuffer(),t.bindRenderbuffer(36161,l.__webglColorRenderbuffer);const i=s.convert(r.format),a=s.convert(r.type),o=F(r.internalFormat,i,a),c=$(e);t.renderbufferStorageMultisample(36161,c,o,e.width,e.height),n.bindFramebuffer(36160,l.__webglMultisampledFramebuffer),t.framebufferRenderbuffer(36160,36064,36161,l.__webglColorRenderbuffer),t.bindRenderbuffer(36161,null),e.depthBuffer&&(l.__webglDepthRenderbuffer=t.createRenderbuffer(),Q(l.__webglDepthRenderbuffer,e,!0)),n.bindFramebuffer(36160,null)}else console.warn("THREE.WebGLRenderer: WebGLMultisampleRenderTarget can only be used with WebGL2.");if(h){n.bindTexture(34067,c.__webglTexture),X(34067,r,p);for(let t=0;t<6;t++)J(l.__webglFramebuffer[t],e,36064,34069+t);O(r,p)&&z(34067,r,e.width,e.height),n.bindTexture(34067,null)}else{let t=3553;if(d)if(o){t=r.isDataTexture3D?32879:35866}else console.warn("THREE.DataTexture3D and THREE.DataTexture2DArray only supported with WebGL2.");n.bindTexture(t,c.__webglTexture),X(t,r,p),J(l.__webglFramebuffer,e,36064,t),O(r,p)&&z(3553,r,e.width,e.height),n.bindTexture(3553,null)}e.depthBuffer&&K(e)},this.updateRenderTargetMipmap=function(t){const e=t.texture;if(O(e,B(t)||o)){const r=t.isWebGLCubeRenderTarget?34067:3553,s=i.get(e).__webglTexture;n.bindTexture(r,s),z(r,e,t.width,t.height),n.bindTexture(r,null)}},this.updateMultisampleRenderTarget=function(e){if(e.isWebGLMultisampleRenderTarget)if(o){const r=i.get(e);n.bindFramebuffer(36008,r.__webglMultisampledFramebuffer),n.bindFramebuffer(36009,r.__webglFramebuffer);const s=e.width,a=e.height;let o=16384;e.depthBuffer&&(o|=256),e.stencilBuffer&&(o|=1024),t.blitFramebuffer(0,0,s,a,0,0,s,a,o,9728),n.bindFramebuffer(36160,r.__webglMultisampledFramebuffer)}else console.warn("THREE.WebGLRenderer: WebGLMultisampleRenderTarget can only be used with WebGL2.")},this.safeSetTexture2D=function(t,e){t&&t.isWebGLRenderTarget&&(!1===tt&&(console.warn("THREE.WebGLTextures.safeSetTexture2D: don't use render targets as textures. Use their .texture property instead."),tt=!0),t=t.texture),V(t,e)},this.safeSetTextureCube=function(t,e){t&&t.isWebGLCubeRenderTarget&&(!1===et&&(console.warn("THREE.WebGLTextures.safeSetTextureCube: don't use cube render targets as textures. Use their .texture property instead."),et=!0),t=t.texture),W(t,e)}}function Zr(t,e,n){const i=n.isWebGL2;return{convert:function(t){let n;if(t===x)return 5121;if(1017===t)return 32819;if(1018===t)return 32820;if(1019===t)return 33635;if(1010===t)return 5120;if(1011===t)return 5122;if(t===_)return 5123;if(1013===t)return 5124;if(t===b)return 5125;if(t===w)return 5126;if(t===M)return i?5131:(n=e.get("OES_texture_half_float"),null!==n?n.HALF_FLOAT_OES:null);if(1021===t)return 6406;if(t===T)return 6407;if(t===E)return 6408;if(1024===t)return 6409;if(1025===t)return 6410;if(t===A)return 6402;if(t===L)return 34041;if(1028===t)return 6403;if(1029===t)return 36244;if(1030===t)return 33319;if(1031===t)return 33320;if(1032===t)return 36248;if(1033===t)return 36249;if(t===R||t===C||t===P||t===D){if(n=e.get("WEBGL_compressed_texture_s3tc"),null===n)return null;if(t===R)return n.COMPRESSED_RGB_S3TC_DXT1_EXT;if(t===C)return n.COMPRESSED_RGBA_S3TC_DXT1_EXT;if(t===P)return n.COMPRESSED_RGBA_S3TC_DXT3_EXT;if(t===D)return n.COMPRESSED_RGBA_S3TC_DXT5_EXT}if(t===I||t===N||t===B||t===O){if(n=e.get("WEBGL_compressed_texture_pvrtc"),null===n)return null;if(t===I)return n.COMPRESSED_RGB_PVRTC_4BPPV1_IMG;if(t===N)return n.COMPRESSED_RGB_PVRTC_2BPPV1_IMG;if(t===B)return n.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG;if(t===O)return n.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG}if(36196===t)return n=e.get("WEBGL_compressed_texture_etc1"),null!==n?n.COMPRESSED_RGB_ETC1_WEBGL:null;if((t===z||t===F)&&(n=e.get("WEBGL_compressed_texture_etc"),null!==n)){if(t===z)return n.COMPRESSED_RGB8_ETC2;if(t===F)return n.COMPRESSED_RGBA8_ETC2_EAC}return 37808===t||37809===t||37810===t||37811===t||37812===t||37813===t||37814===t||37815===t||37816===t||37817===t||37818===t||37819===t||37820===t||37821===t||37840===t||37841===t||37842===t||37843===t||37844===t||37845===t||37846===t||37847===t||37848===t||37849===t||37850===t||37851===t||37852===t||37853===t?(n=e.get("WEBGL_compressed_texture_astc"),null!==n?t:null):36492===t?(n=e.get("EXT_texture_compression_bptc"),null!==n?t:null):t===S?i?34042:(n=e.get("WEBGL_depth_texture"),null!==n?n.UNSIGNED_INT_24_8_WEBGL:null):void 0}}}class Jr extends Gn{constructor(t=[]){super(),this.cameras=t}}Jr.prototype.isArrayCamera=!0;class Qr extends ye{constructor(){super(),this.type="Group"}}function Kr(){this._targetRay=null,this._grip=null,this._hand=null}function $r(t,e){const n=this,i=t.state;let r=null,s=1,a=null,o="local-floor",l=null;const c=[],h=new Map,u=new Gn;u.layers.enable(1),u.viewport=new ft;const d=new Gn;d.layers.enable(2),d.viewport=new ft;const p=[u,d],m=new Jr;m.layers.enable(1),m.layers.enable(2);let f=null,g=null;function v(t){const e=h.get(t.inputSource);e&&e.dispatchEvent({type:t.type,data:t.inputSource})}function y(){h.forEach((function(t,e){t.disconnect(e)})),h.clear(),f=null,g=null,i.bindXRFramebuffer(null),t.setRenderTarget(t.getRenderTarget()),S.stop(),n.isPresenting=!1,n.dispatchEvent({type:"sessionend"})}function x(t){const e=r.inputSources;for(let t=0;t0&&At(s,t,e),a.length>0&&At(a,t,e),null!==_&&(J.updateRenderTargetMipmap(_),J.updateMultisampleRenderTarget(_)),!0===t.isScene&&t.onAfterRender(f,t,e),q.buffers.depth.setTest(!0),q.buffers.depth.setMask(!0),q.buffers.color.setMask(!0),q.setPolygonOffset(!1),mt.resetDefaultState(),b=-1,S=null,m.pop(),d=m.length>0?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 y},this.getRenderTarget=function(){return _},this.setRenderTarget=function(t,e=0,n=0){_=t,v=e,y=n,t&&void 0===Z.get(t).__webglFramebuffer&&J.setupRenderTarget(t);let i=null,r=!1,s=!1;if(t){const n=t.texture;(n.isDataTexture3D||n.isDataTexture2DArray)&&(s=!0);const a=Z.get(t).__webglFramebuffer;t.isWebGLCubeRenderTarget?(i=a[e],r=!0):i=t.isWebGLMultisampleRenderTarget?Z.get(t).__webglMultisampledFramebuffer:a,T.copy(t.viewport),A.copy(t.scissor),L=t.scissorTest}else T.copy(N).multiplyScalar(P).floor(),A.copy(B).multiplyScalar(P).floor(),L=O;if(q.bindFramebuffer(36160,i),q.viewport(T),q.scissor(A),q.setScissorTest(L),r){const i=Z.get(t.texture);gt.framebufferTexture2D(36160,36064,34069+e,i.__webglTexture,n)}else if(s){const i=Z.get(t.texture),r=e||0;gt.framebufferTextureLayer(36160,36064,i.__webglTexture,n||0,r)}},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=Z.get(t).__webglFramebuffer;if(t.isWebGLCubeRenderTarget&&void 0!==a&&(o=o[a]),o){q.bindFramebuffer(36160,o);try{const a=t.texture,o=a.format,l=a.type;if(o!==E&&pt.convert(o)!==gt.getParameter(35739))return void console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in RGBA or implementation defined format.");const c=l===M&&(W.has("EXT_color_buffer_half_float")||j.isWebGL2&&W.has("EXT_color_buffer_float"));if(!(l===x||pt.convert(l)===gt.getParameter(35738)||l===w&&(j.isWebGL2||W.has("OES_texture_float")||W.has("WEBGL_color_buffer_float"))||c))return void console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in UnsignedByteType or implementation defined type.");36053===gt.checkFramebufferStatus(36160)?e>=0&&e<=t.width-i&&n>=0&&n<=t.height-r&>.readPixels(e,n,i,r,pt.convert(o),pt.convert(l),s):console.error("THREE.WebGLRenderer.readRenderTargetPixels: readPixels from renderTarget failed. Framebuffer not complete.")}finally{const t=null!==_?Z.get(_).__webglFramebuffer:null;q.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),a=pt.convert(e.format);J.setTexture2D(e,0),gt.copyTexImage2D(3553,n,a,t.x,t.y,r,s,0),q.unbindTexture()},this.copyTextureToTexture=function(t,e,n,i=0){const r=e.image.width,s=e.image.height,a=pt.convert(n.format),o=pt.convert(n.type);J.setTexture2D(n,0),gt.pixelStorei(37440,n.flipY),gt.pixelStorei(37441,n.premultiplyAlpha),gt.pixelStorei(3317,n.unpackAlignment),e.isDataTexture?gt.texSubImage2D(3553,i,t.x,t.y,r,s,a,o,e.image.data):e.isCompressedTexture?gt.compressedTexSubImage2D(3553,i,t.x,t.y,e.mipmaps[0].width,e.mipmaps[0].height,a,e.mipmaps[0].data):gt.texSubImage2D(3553,i,t.x,t.y,a,o,e.image),0===i&&n.generateMipmaps&>.generateMipmap(3553),q.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{width:s,height:a,data:o}=n.image,l=pt.convert(i.format),c=pt.convert(i.type);let h;if(i.isDataTexture3D)J.setTexture3D(i,0),h=32879;else{if(!i.isDataTexture2DArray)return void console.warn("THREE.WebGLRenderer.copyTextureToTexture3D: only supports THREE.DataTexture3D and THREE.DataTexture2DArray.");J.setTexture2DArray(i,0),h=35866}gt.pixelStorei(37440,i.flipY),gt.pixelStorei(37441,i.premultiplyAlpha),gt.pixelStorei(3317,i.unpackAlignment);const u=gt.getParameter(3314),d=gt.getParameter(32878),p=gt.getParameter(3316),m=gt.getParameter(3315),g=gt.getParameter(32877);gt.pixelStorei(3314,s),gt.pixelStorei(32878,a),gt.pixelStorei(3316,t.min.x),gt.pixelStorei(3315,t.min.y),gt.pixelStorei(32877,t.min.z),gt.texSubImage3D(h,r,e.x,e.y,e.z,t.max.x-t.min.x+1,t.max.y-t.min.y+1,t.max.z-t.min.z+1,l,c,o),gt.pixelStorei(3314,u),gt.pixelStorei(32878,d),gt.pixelStorei(3316,p),gt.pixelStorei(3315,m),gt.pixelStorei(32877,g),0===r&&i.generateMipmaps&>.generateMipmap(h),q.unbindTexture()},this.initTexture=function(t){J.setTexture2D(t,0),q.unbindTexture()},this.resetState=function(){v=0,y=0,_=null,q.reset(),mt.reset()},"undefined"!=typeof __THREE_DEVTOOLS__&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}Qr.prototype.isGroup=!0,Object.assign(Kr.prototype,{constructor:Kr,getHandSpace:function(){return null===this._hand&&(this._hand=new Qr,this._hand.matrixAutoUpdate=!1,this._hand.visible=!1,this._hand.joints={},this._hand.inputState={pinching:!1}),this._hand},getTargetRaySpace:function(){return null===this._targetRay&&(this._targetRay=new Qr,this._targetRay.matrixAutoUpdate=!1,this._targetRay.visible=!1),this._targetRay},getGripSpace:function(){return null===this._grip&&(this._grip=new Qr,this._grip.matrixAutoUpdate=!1,this._grip.visible=!1),this._grip},dispatchEvent:function(t){return null!==this._targetRay&&this._targetRay.dispatchEvent(t),null!==this._grip&&this._grip.dispatchEvent(t),null!==this._hand&&this._hand.dispatchEvent(t),this},disconnect:function(t){return this.dispatchEvent({type:"disconnected",data:t}),null!==this._targetRay&&(this._targetRay.visible=!1),null!==this._grip&&(this._grip.visible=!1),null!==this._hand&&(this._hand.visible=!1),this},update:function(t,e,n){let 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))),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 Qr;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)));return null!==a&&(a.visible=null!==i),null!==o&&(o.visible=null!==r),null!==l&&(l.visible=null!==s),this}}),Object.assign($r.prototype,rt.prototype);class ns extends es{}ns.prototype.isWebGL1Renderer=!0;class is{constructor(t,e){this.name="",this.color=new ke(t),this.density=void 0!==e?e:25e-5}clone(){return new is(this.color,this.density)}toJSON(){return{type:"FogExp2",color:this.color.getHex(),density:this.density}}}is.prototype.isFogExp2=!0;class rs{constructor(t,e,n){this.name="",this.color=new ke(t),this.near=void 0!==e?e:1,this.far=void 0!==n?n:1e3}clone(){return new rs(this.color,this.near,this.far)}toJSON(){return{type:"Fog",color:this.color.getHex(),near:this.near,far:this.far}}}rs.prototype.isFog=!0;class ss extends ye{constructor(){super(),this.type="Scene",this.background=null,this.environment=null,this.fog=null,this.overrideMaterial=null,this.autoUpdate=!0,"undefined"!=typeof __THREE_DEVTOOLS__&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}copy(t,e){return super.copy(t,e),null!==t.background&&(this.background=t.background.clone()),null!==t.environment&&(this.environment=t.environment.clone()),null!==t.fog&&(this.fog=t.fog.clone()),null!==t.overrideMaterial&&(this.overrideMaterial=t.overrideMaterial.clone()),this.autoUpdate=t.autoUpdate,this.matrixAutoUpdate=t.matrixAutoUpdate,this}toJSON(t){const e=super.toJSON(t);return null!==this.background&&(e.object.background=this.background.toJSON(t)),null!==this.environment&&(e.object.environment=this.environment.toJSON(t)),null!==this.fog&&(e.object.fog=this.fog.toJSON()),e}}function as(t,e){this.array=t,this.stride=e,this.count=void 0!==t?t.length/e:0,this.usage=et,this.updateRange={offset:0,count:-1},this.version=0,this.uuid=ot.generateUUID()}ss.prototype.isScene=!0,Object.defineProperty(as.prototype,"needsUpdate",{set:function(t){!0===t&&this.version++}}),Object.assign(as.prototype,{isInterleavedBuffer:!0,onUploadCallback:function(){},setUsage:function(t){return this.usage=t,this},copy:function(t){return this.array=new t.array.constructor(t.array),this.count=t.count,this.stride=t.stride,this.usage=t.usage,this},copyAt:function(t,e,n){t*=this.stride,n*=e.stride;for(let i=0,r=this.stride;it.far||e.push({distance:o,point:us.clone(),uv:Ie.getUV(us,vs,ys,xs,_s,bs,ws,new lt),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 Ss(t,e,n,i,r,s){ms.subVectors(t,n).addScalar(.5).multiply(i),void 0!==r?(fs.x=s*ms.x-r*ms.y,fs.y=r*ms.x+s*ms.y):fs.copy(ms),t.copy(e),t.x+=fs.x,t.y+=fs.y,t.applyMatrix4(gs)}Ms.prototype.isSprite=!0;const Ts=new xt,Es=new xt;class As extends ye{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){Ts.setFromMatrixPosition(this.matrixWorld);const n=t.ray.origin.distanceTo(Ts);this.getObjectForDistance(n).raycast(t,e)}}update(t){const e=this.levels;if(e.length>1){Ts.setFromMatrixPosition(t.matrixWorld),Es.setFromMatrixPosition(this.matrixWorld);const n=Ts.distanceTo(Es)/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;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:function(){const t=this.geometry;if(t.isBufferGeometry){const e=t.morphAttributes,n=Object.keys(e);if(n.length>0){const t=e[n[0]];if(void 0!==t){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let e=0,n=t.length;e0&&console.error("THREE.Line.updateMorphTargets() does not support THREE.Geometry. Use THREE.BufferGeometry instead.")}}});const Js=new xt,Qs=new xt;function Ks(t,e){Zs.call(this,t,e),this.type="LineSegments"}Ks.prototype=Object.assign(Object.create(Zs.prototype),{constructor:Ks,isLineSegments:!0,computeLineDistances:function(){const t=this.geometry;if(t.isBufferGeometry)if(null===t.index){const e=t.attributes.position,n=[];for(let t=0,i=e.count;tr.far)return;s.push({distance:l,distanceToRay:Math.sqrt(o),point:n,index:e,face:null,object:a})}}sa.prototype=Object.assign(Object.create(ye.prototype),{constructor:sa,isPoints:!0,copy:function(t){return ye.prototype.copy.call(this,t),this.material=t.material,this.geometry=t.geometry,this},raycast:function(t,e){const n=this.geometry,i=this.matrixWorld,r=t.params.Points.threshold,s=n.drawRange;if(null===n.boundingSphere&&n.computeBoundingSphere(),ia.copy(n.boundingSphere),ia.applyMatrix4(i),ia.radius+=r,!1===t.ray.intersectsSphere(ia))return;ea.copy(i).invert(),na.copy(t.ray).applyMatrix4(ea);const a=r/((this.scale.x+this.scale.y+this.scale.z)/3),o=a*a;if(n.isBufferGeometry){const r=n.index,a=n.attributes.position;if(null!==r){for(let n=Math.max(0,s.start),l=Math.min(r.count,s.start+s.count);n0){const t=e[n[0]];if(void 0!==t){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let e=0,n=t.length;e0&&console.error("THREE.Points.updateMorphTargets() does not support THREE.Geometry. Use THREE.BufferGeometry instead.")}}});class oa extends pt{constructor(t,e,n,i,r,s,a,o,l){super(t,e,n,i,r,s,a,o,l),this.format=void 0!==a?a:T,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)}}oa.prototype.isVideoTexture=!0;class la extends pt{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}}la.prototype.isCompressedTexture=!0;class ca extends pt{constructor(t,e,n,i,r,s,a,o,l){super(t,e,n,i,r,s,a,o,l),this.needsUpdate=!0}}ca.prototype.isCanvasTexture=!0;class ha extends pt{constructor(t,e,n,i,r,s,a,o,l,c){if((c=void 0!==c?c:A)!==A&&c!==L)throw new Error("DepthTexture format must be either THREE.DepthFormat or THREE.DepthStencilFormat");void 0===n&&c===A&&(n=_),void 0===n&&c===L&&(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}}ha.prototype.isDepthTexture=!0;class ua extends mn{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 xt,c=new lt;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 en(s,3)),this.setAttribute("normal",new en(a,3)),this.setAttribute("uv",new en(o,2))}}class da extends mn{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 lt,m=new xt;let v=0;const y=!0===n?t:e,x=!0===n?1:-1;for(let t=1;t<=i;t++)h.push(0,f*x,0),u.push(0,x,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=y*r,m.y=f*x,m.z=y*n,h.push(m.x,m.y,m.z),u.push(0,x,0),s.x=.5*n+.5,s.y=.5*r*x+.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 en(h,3)),this.setAttribute("normal",new en(u,3)),this.setAttribute("uv",new en(d,2))}}class pa extends da{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}}}class ma extends mn{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 en(r,3)),this.setAttribute("normal",new en(r.slice(),3)),this.setAttribute("uv",new en(s,2)),0===i?this.computeVertexNormals():this.normalizeNormals()}}class fa extends ma{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}}}const ga=new xt,va=new xt,ya=new xt,xa=new Ie;class _a extends mn{constructor(t,e){if(super(),this.type="EdgesGeometry",this.parameters={thresholdAngle:e},e=void 0!==e?e:1,!0===t.isGeometry)return void console.error("THREE.EdgesGeometry no longer supports THREE.Geometry. Use THREE.BufferGeometry instead.");const n=Math.pow(10,4),i=Math.cos(ot.DEG2RAD*e),r=t.getIndex(),s=t.getAttribute("position"),a=r?r.count:s.count,o=[0,0,0],l=["a","b","c"],c=new Array(3),h={},u=[];for(let t=0;t80*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 Sa(s,a,n,o,l,p),a};function wa(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=Va(s,t[s],t[s+1],a);return a&&za(a,a.next)&&(Wa(a),a=a.next),a}function Ma(t,e){if(!t)return t;e||(e=t);let n,i=t;do{if(n=!1,i.steiner||!za(i,i.next)&&0!==Oa(i.prev,i,i.next))i=i.next;else{if(Wa(i),i=e=i.prev,i===i.next)break;n=!0}}while(n||i!==e);return e}function Sa(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=Da(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?Ea(t,i,r,s):Ta(t))e.push(o.i/n),e.push(t.i/n),e.push(l.i/n),Wa(t),t=l.next,c=l.next;else if((t=l)===c){a?1===a?Sa(t=Aa(Ma(t),e,n),e,n,i,r,s,2):2===a&&La(t,e,n,i,r,s):Sa(Ma(t),e,n,i,r,s,1);break}}function Ta(t){const e=t.prev,n=t,i=t.next;if(Oa(e,n,i)>=0)return!1;let r=t.next.next;for(;r!==t.prev;){if(Na(e.x,e.y,n.x,n.y,i.x,i.y,r.x,r.y)&&Oa(r.prev,r,r.next)>=0)return!1;r=r.next}return!0}function Ea(t,e,n,i){const r=t.prev,s=t,a=t.next;if(Oa(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=Da(o,l,e,n,i),d=Da(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&&Na(r.x,r.y,s.x,s.y,a.x,a.y,p.x,p.y)&&Oa(p.prev,p,p.next)>=0)return!1;if(p=p.prevZ,m!==t.prev&&m!==t.next&&Na(r.x,r.y,s.x,s.y,a.x,a.y,m.x,m.y)&&Oa(m.prev,m,m.next)>=0)return!1;m=m.nextZ}for(;p&&p.z>=u;){if(p!==t.prev&&p!==t.next&&Na(r.x,r.y,s.x,s.y,a.x,a.y,p.x,p.y)&&Oa(p.prev,p,p.next)>=0)return!1;p=p.prevZ}for(;m&&m.z<=d;){if(m!==t.prev&&m!==t.next&&Na(r.x,r.y,s.x,s.y,a.x,a.y,m.x,m.y)&&Oa(m.prev,m,m.next)>=0)return!1;m=m.nextZ}return!0}function Aa(t,e,n){let i=t;do{const r=i.prev,s=i.next.next;!za(r,s)&&Fa(r,i,i.next,s)&&Ua(r,s)&&Ua(s,r)&&(e.push(r.i/n),e.push(i.i/n),e.push(s.i/n),Wa(i),Wa(i.next),i=t=s),i=i.next}while(i!==t);return Ma(i)}function La(t,e,n,i,r,s){let a=t;do{let t=a.next.next;for(;t!==a.prev;){if(a.i!==t.i&&Ba(a,t)){let o=ka(a,t);return a=Ma(a,a.next),o=Ma(o,o.next),Sa(a,e,n,i,r,s),void Sa(o,e,n,i,r,s)}t=t.next}a=a.next}while(a!==t)}function Ra(t,e){return t.x-e.x}function Ca(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&&Na(rs.x||n.x===s.x&&Pa(s,n)))&&(s=n,u=h)),n=n.next}while(n!==o);return s}(t,e)){const n=ka(e,t);Ma(e,e.next),Ma(n,n.next)}}function Pa(t,e){return Oa(t.prev,t,e.prev)<0&&Oa(e.next,t,t.next)<0}function Da(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 Ia(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 Ba(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&&Fa(n,n.next,t,e))return!0;n=n.next}while(n!==t);return!1}(t,e)&&(Ua(t,e)&&Ua(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)&&(Oa(t.prev,t,e.prev)||Oa(t,e.prev,e))||za(t,e)&&Oa(t.prev,t,t.next)>0&&Oa(e.prev,e,e.next)>0)}function Oa(t,e,n){return(e.y-t.y)*(n.x-e.x)-(e.x-t.x)*(n.y-e.y)}function za(t,e){return t.x===e.x&&t.y===e.y}function Fa(t,e,n,i){const r=Ga(Oa(t,e,n)),s=Ga(Oa(t,e,i)),a=Ga(Oa(n,i,t)),o=Ga(Oa(n,i,e));return r!==s&&a!==o||(!(0!==r||!Ha(t,n,e))||(!(0!==s||!Ha(t,i,e))||(!(0!==a||!Ha(n,t,i))||!(0!==o||!Ha(n,e,i)))))}function Ha(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 Ga(t){return t>0?1:t<0?-1:0}function Ua(t,e){return Oa(t.prev,t,t.next)<0?Oa(t,e,t.next)>=0&&Oa(t,t.prev,e)>=0:Oa(t,e,t.prev)<0||Oa(t,t.next,e)<0}function ka(t,e){const n=new ja(t.i,t.x,t.y),i=new ja(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 Va(t,e,n,i){const r=new ja(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 Wa(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 ja(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}const qa={area:function(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 Ya(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 lt(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 lt(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;t=0?(t(i-o,p,h),u.subVectors(c,h)):(t(i+o,p,h),u.subVectors(h,c)),p-o>=0?(t(i,p-o,h),d.subVectors(c,h)):(t(i,p+o,h),d.subVectors(h,c)),l.crossVectors(u,d).normalize(),s.push(l.x,l.y,l.z),a.push(i,p)}}for(let t=0;t0)&&d.push(e,r,l),(t!==n-1||o=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=Mo.arraySlice(i.values,t,e)}else{const t=i.createInterpolant(),e=o,n=l-o;t.evaluate(s),d=Mo.arraySlice(t.resultBuffer,e,n)}if("quaternion"===r){(new yt).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=Mo.arraySlice(n,r,s),this.values=Mo.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&&Mo.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=Mo.arraySlice(this.times),e=Mo.arraySlice(this.values),n=this.getValueSize(),i=this.getInterpolation()===U,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=Mo.arraySlice(t,0,s),this.values=Mo.arraySlice(e,0,s*n)):(this.times=t,this.values=e),this}clone(){const t=Mo.arraySlice(this.times,0),e=Mo.arraySlice(this.values,0),n=new(0,this.constructor)(this.name,t,e);return n.createInterpolant=this.createInterpolant,n}}Lo.prototype.TimeBufferType=Float32Array,Lo.prototype.ValueBufferType=Float32Array,Lo.prototype.DefaultInterpolation=G;class Ro extends Lo{}Ro.prototype.ValueTypeName="bool",Ro.prototype.ValueBufferType=Array,Ro.prototype.DefaultInterpolation=H,Ro.prototype.InterpolantFactoryMethodLinear=void 0,Ro.prototype.InterpolantFactoryMethodSmooth=void 0;class Co extends Lo{}Co.prototype.ValueTypeName="color";class Po extends Lo{}function Do(t,e,n,i){So.call(this,t,e,n,i)}Po.prototype.ValueTypeName="number",Do.prototype=Object.assign(Object.create(So.prototype),{constructor:Do,interpolate_:function(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)yt.slerpFlat(r,0,s,l-a,s,l,o);return r}});class Io extends Lo{InterpolantFactoryMethodLinear(t){return new Do(this.times,this.values,this.getValueSize(),t)}}Io.prototype.ValueTypeName="quaternion",Io.prototype.DefaultInterpolation=G,Io.prototype.InterpolantFactoryMethodSmooth=void 0;class No extends Lo{}No.prototype.ValueTypeName="string",No.prototype.ValueBufferType=Array,No.prototype.DefaultInterpolation=H,No.prototype.InterpolantFactoryMethodLinear=void 0,No.prototype.InterpolantFactoryMethodSmooth=void 0;class Bo extends Lo{}Bo.prototype.ValueTypeName="vector";class Oo{constructor(t,e=-1,n,i=2500){this.name=t,this.tracks=n,this.duration=e,this.blendMode=i,this.uuid=ot.generateUUID(),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(zo(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(Lo.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=[];Mo.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;t0||0===t.search(/^data\:image\/jpeg/);r.format=i?T:E,r.needsUpdate=!0,void 0!==e&&e(r)}),n,i),r}}),Object.assign(Zo.prototype,{getPoint:function(){return console.warn("THREE.Curve: .getPoint() not implemented."),null},getPointAt:function(t,e){const n=this.getUtoTmapping(t);return this.getPoint(n,e)},getPoints:function(t=5){const e=[];for(let n=0;n<=t;n++)e.push(this.getPoint(n/t));return e},getSpacedPoints:function(t=5){const e=[];for(let n=0;n<=t;n++)e.push(this.getPointAt(n/t));return e},getLength:function(){const t=this.getLengths();return t[t.length-1]},getLengths:function(t){if(void 0===t&&(t=this.arcLengthDivisions),this.cacheArcLengths&&this.cacheArcLengths.length===t+1&&!this.needsUpdate)return this.cacheArcLengths;this.needsUpdate=!1;const e=[];let n,i=this.getPoint(0),r=0;e.push(0);for(let s=1;s<=t;s++)n=this.getPoint(s/t),r+=n.distanceTo(i),e.push(r),i=n;return this.cacheArcLengths=e,e},updateArcLengths:function(){this.needsUpdate=!0,this.getLengths()},getUtoTmapping:function(t,e){const n=this.getLengths();let i=0;const r=n.length;let s;s=e||t*n[r-1];let a,o=0,l=r-1;for(;o<=l;)if(i=Math.floor(o+(l-o)/2),a=n[i]-s,a<0)o=i+1;else{if(!(a>0)){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:function(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 lt:new xt);return o.copy(a).sub(s).normalize(),o},getTangentAt:function(t,e){const n=this.getUtoTmapping(t);return this.getTangent(n,e)},computeFrenetFrames:function(t,e){const n=new xt,i=[],r=[],s=[],a=new xt,o=new Xt;for(let e=0;e<=t;e++){const n=e/t;i[e]=this.getTangentAt(n,new xt),i[e].normalize()}r[0]=new xt,s[0]=new xt;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(ot.clamp(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(ot.clamp(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:function(){return(new this.constructor).copy(this)},copy:function(t){return this.arcLengthDivisions=t.arcLengthDivisions,this},toJSON:function(){const t={metadata:{version:4.5,type:"Curve",generator:"Curve.toJSON"}};return t.arcLengthDivisions=this.arcLengthDivisions,t.type=this.type,t},fromJSON:function(t){return this.arcLengthDivisions=t.arcLengthDivisions,this}});class Jo extends Zo{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 lt,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]:($o.subVectors(i[0],i[1]).add(i[0]),a=$o);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(rl(a,o.x,l.x,c.x,h.x),rl(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=e){const t=n[i]-e,r=this.curves[i],s=r.getLength(),a=0===s?0:1-t/s;return r.getPointAt(a)}i++}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 vl extends gl{constructor(t){super(t),this.uuid=ot.generateUUID(),this.type="Shape",this.holes=[]}getPointsHoles(t){const e=[];for(let n=0,i=this.holes.length;n0: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 ke).setHex(r.value);break;case"v2":i.uniforms[e].value=(new lt).fromArray(r.value);break;case"v3":i.uniforms[e].value=(new xt).fromArray(r.value);break;case"v4":i.uniforms[e].value=(new ft).fromArray(r.value);break;case"m3":i.uniforms[e].value=(new ct).fromArray(r.value);break;case"m4":i.uniforms[e].value=(new Xt).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 lt).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.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 lt).fromArray(t.clearcoatNormalScale)),void 0!==t.transmission&&(i.transmission=t.transmission),void 0!==t.transmissionMap&&(i.transmissionMap=n(t.transmissionMap)),i}setTextures(t){return this.textures=t,this}}const Hl={decodeText:function(t){if("undefined"!=typeof TextDecoder)return(new TextDecoder).decode(t);let e="";for(let n=0,i=t.length;nNumber.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=qa.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 vl,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;t0){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){yt.slerpFlat(t,e,t,e,t,n,i)}_slerpAdditive(t,e,n,i,r){const s=this._workIndex*r;yt.multiplyQuaternionsFlat(t,s,t,e,t,n),yt.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 gc="\\[\\]\\.:\\/",vc=new RegExp("[\\[\\]\\.:\\/]","g"),yc="[^\\[\\]\\.:\\/]",xc="[^"+gc.replace("\\.","")+"]",_c=/((?:WC+[\/:])*)/.source.replace("WC",yc),bc=/(WCOD+)?/.source.replace("WCOD",xc),wc=/(?:\.(WC+)(?:\[(.+)\])?)?/.source.replace("WC",yc),Mc=/\.(WC+)(?:\[(.+)\])?/.source.replace("WC",yc),Sc=new RegExp("^"+_c+bc+wc+Mc+"$"),Tc=["material","materials","bones"];function Ec(t,e,n){const i=n||Ac.parseTrackName(e);this._targetGroup=t,this._bindings=t.subscribe_(e,i)}function Ac(t,e,n){this.path=e,this.parsedPath=n||Ac.parseTrackName(e),this.node=Ac.findNode(t,this.parsedPath.nodeName)||t,this.rootNode=t}Object.assign(Ec.prototype,{getValue:function(t,e){this.bind();const n=this._targetGroup.nCachedObjects_,i=this._bindings[n];void 0!==i&&i.getValue(t,e)},setValue:function(t,e){const n=this._bindings;for(let i=this._targetGroup.nCachedObjects_,r=n.length;i!==r;++i)n[i].setValue(t,e)},bind:function(){const t=this._bindings;for(let e=this._targetGroup.nCachedObjects_,n=t.length;e!==n;++e)t[e].bind()},unbind:function(){const t=this._bindings;for(let e=this._targetGroup.nCachedObjects_,n=t.length;e!==n;++e)t[e].unbind()}}),Object.assign(Ac,{Composite:Ec,create:function(t,e,n){return t&&t.isAnimationObjectGroup?new Ac.Composite(t,e,n):new Ac(t,e,n)},sanitizeNodeName:function(t){return t.replace(/\s/g,"_").replace(vc,"")},parseTrackName:function(t){const e=Sc.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!==Tc.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},findNode:function(t,e){if(!e||""===e||"."===e||-1===e||e===t.name||e===t.uuid)return t;if(t.skeleton){const n=t.skeleton.getBoneByName(e);if(void 0!==n)return n}if(t.children){const n=function(t){for(let 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 Ac(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()}}}Lc.prototype.isAnimationObjectGroup=!0;class Rc{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:k,endingEnd:k};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;switch(this.blendMode){case q:for(let n=0,i=t.length;n!==i;++n)t[n].evaluate(s),e[n].accumulateAdditive(a);break;case j:default: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=V,i.endingEnd=V):(i.endingStart=t?this.zeroSlopeAtStart?V:k:W,i.endingEnd=e?this.zeroSlopeAtEnd?V:k:W)}_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 Cc extends rt{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)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 fc(Ac.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 void 0===e&&(console.warn("THREE.Box2: .getParameter() target is now required"),e=new lt),e.set((t.x-this.min.x)/(this.max.x-this.min.x),(t.y-this.min.y)/(this.max.y-this.min.y))}intersectsBox(t){return!(t.max.xthis.max.x||t.max.ythis.max.y)}clampPoint(t,e){return void 0===e&&(console.warn("THREE.Box2: .clampPoint() target is now required"),e=new lt),e.copy(t).clamp(this.min,this.max)}distanceToPoint(t){return zc.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)}}Fc.prototype.isBox2=!0;const Hc=new xt,Gc=new xt;class Uc{constructor(t=new xt,e=new xt){this.start=t,this.end=e}set(t,e){return this.start.copy(t),this.end.copy(e),this}copy(t){return this.start.copy(t.start),this.end.copy(t.end),this}getCenter(t){return void 0===t&&(console.warn("THREE.Line3: .getCenter() target is now required"),t=new xt),t.addVectors(this.start,this.end).multiplyScalar(.5)}delta(t){return void 0===t&&(console.warn("THREE.Line3: .delta() target is now required"),t=new xt),t.subVectors(this.end,this.start)}distanceSq(){return this.start.distanceToSquared(this.end)}distance(){return this.start.distanceTo(this.end)}at(t,e){return void 0===e&&(console.warn("THREE.Line3: .at() target is now required"),e=new xt),this.delta(e).multiplyScalar(t).add(this.start)}closestPointToPointParameter(t,e){Hc.subVectors(t,this.start),Gc.subVectors(this.end,this.start);const n=Gc.dot(Gc);let i=Gc.dot(Hc)/n;return e&&(i=ot.clamp(i,0,1)),i}closestPointToPoint(t,e,n){const i=this.closestPointToPointParameter(t,e);return void 0===n&&(console.warn("THREE.Line3: .closestPointToPoint() target is now required"),n=new xt),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)}}function kc(t){ye.call(this),this.material=t,this.render=function(){},this.hasPositions=!1,this.hasNormals=!1,this.hasColors=!1,this.hasUvs=!1,this.positionArray=null,this.normalArray=null,this.colorArray=null,this.uvArray=null,this.count=0}kc.prototype=Object.create(ye.prototype),kc.prototype.constructor=kc,kc.prototype.isImmediateRenderObject=!0;const Vc=new xt;const Wc=new xt,jc=new Xt,qc=new Xt;class Xc extends Ks{constructor(t){const e=Yc(t),n=new mn,i=[],r=[],s=new ke(0,0,1),a=new ke(0,1,0);for(let t=0;t>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)}},mh=Math.pow(2,8),fh=[.125,.215,.35,.446,.526,.582],gh=5+fh.length,vh=20,yh={[X]:0,[Y]:1,[J]:2,[Q]:3,[K]:4,[$]:5,[Z]:6},xh=new Ve({side:1,depthWrite:!1,depthTest:!1}),_h=new Dn(new Nn,xh),bh=new Pl,{_lodPlanes:wh,_sizeLods:Mh,_sigmas:Sh}=Dh(),Th=new ke;let Eh=null;const Ah=(1+Math.sqrt(5))/2,Lh=1/Ah,Rh=[new xt(1,1,1),new xt(-1,1,1),new xt(1,1,-1),new xt(-1,1,-1),new xt(0,Ah,Lh),new xt(0,Ah,-Lh),new xt(Lh,0,Ah),new xt(-Lh,0,Ah),new xt(Ah,Lh,0),new xt(-Ah,Lh,0)];function Ch(t){const e=Math.max(t.r,t.g,t.b),n=Math.min(Math.max(Math.ceil(Math.log2(e)),-128),127);t.multiplyScalar(Math.pow(2,-n));return(n+128)/255}function Ph(t){return void 0!==t&&t.type===x&&(t.encoding===X||t.encoding===Y||t.encoding===Z)}function Dh(){const t=[],e=[],n=[];let i=8;for(let r=0;r4?a=fh[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),y=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];y.set(r,f*d*t)}const x=new mn;x.setAttribute("position",new qe(g,p)),x.setAttribute("uv",new qe(v,m)),x.setAttribute("faceIndex",new qe(y,f)),t.push(x),i>4&&i--}return{_lodPlanes:t,_sizeLods:e,_sigmas:n}}function Ih(t){const e=new gt(3*mh,3*mh,t);return e.texture.mapping=l,e.texture.name="PMREM.cubeUv",e.scissorTest=!0,e}function Nh(t,e,n,i,r){t.viewport.set(e,n,i,r),t.scissor.set(e,n,i,r)}function Bh(){const t=new lt(1,1);return new po({name:"EquirectangularToCubeUV",uniforms:{envMap:{value:null},texelSize:{value:t},inputEncoding:{value:yh[3e3]},outputEncoding:{value:yh[3e3]}},vertexShader:zh(),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${Fh()}\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 Oh(){return new po({name:"CubemapToCubeUV",uniforms:{envMap:{value:null},inputEncoding:{value:yh[3e3]},outputEncoding:{value:yh[3e3]}},vertexShader:zh(),fragmentShader:`\n\n\t\t\tprecision mediump float;\n\t\t\tprecision mediump int;\n\n\t\t\tvarying vec3 vOutputDirection;\n\n\t\t\tuniform samplerCube envMap;\n\n\t\t\t${Fh()}\n\n\t\t\tvoid main() {\n\n\t\t\t\tgl_FragColor = vec4( 0.0, 0.0, 0.0, 1.0 );\n\t\t\t\tgl_FragColor.rgb = envMapTexelToLinear( textureCube( envMap, vec3( - vOutputDirection.x, vOutputDirection.yz ) ) ).rgb;\n\t\t\t\tgl_FragColor = linearToOutputTexel( gl_FragColor );\n\n\t\t\t}\n\t\t`,blending:0,depthTest:!1,depthWrite:!1})}function zh(){return"\n\n\t\tprecision mediump float;\n\t\tprecision mediump int;\n\n\t\tattribute vec3 position;\n\t\tattribute vec2 uv;\n\t\tattribute float faceIndex;\n\n\t\tvarying vec3 vOutputDirection;\n\n\t\t// RH coordinate system; PMREM face-indexing convention\n\t\tvec3 getDirection( vec2 uv, float face ) {\n\n\t\t\tuv = 2.0 * uv - 1.0;\n\n\t\t\tvec3 direction = vec3( uv, 1.0 );\n\n\t\t\tif ( face == 0.0 ) {\n\n\t\t\t\tdirection = direction.zyx; // ( 1, v, u ) pos x\n\n\t\t\t} else if ( face == 1.0 ) {\n\n\t\t\t\tdirection = direction.xzy;\n\t\t\t\tdirection.xz *= -1.0; // ( -u, 1, -v ) pos y\n\n\t\t\t} else if ( face == 2.0 ) {\n\n\t\t\t\tdirection.x *= -1.0; // ( -u, v, 1 ) pos z\n\n\t\t\t} else if ( face == 3.0 ) {\n\n\t\t\t\tdirection = direction.zyx;\n\t\t\t\tdirection.xz *= -1.0; // ( -1, v, -u ) neg x\n\n\t\t\t} else if ( face == 4.0 ) {\n\n\t\t\t\tdirection = direction.xzy;\n\t\t\t\tdirection.xy *= -1.0; // ( -u, -1, v ) neg y\n\n\t\t\t} else if ( face == 5.0 ) {\n\n\t\t\t\tdirection.z *= -1.0; // ( u, v, -1 ) neg z\n\n\t\t\t}\n\n\t\t\treturn direction;\n\n\t\t}\n\n\t\tvoid main() {\n\n\t\t\tvOutputDirection = getDirection( uv, faceIndex );\n\t\t\tgl_Position = vec4( position, 1.0 );\n\n\t\t}\n\t"}function Fh(){return"\n\n\t\tuniform int inputEncoding;\n\t\tuniform int outputEncoding;\n\n\t\t#include \n\n\t\tvec4 inputTexelToLinear( vec4 value ) {\n\n\t\t\tif ( inputEncoding == 0 ) {\n\n\t\t\t\treturn value;\n\n\t\t\t} else if ( inputEncoding == 1 ) {\n\n\t\t\t\treturn sRGBToLinear( value );\n\n\t\t\t} else if ( inputEncoding == 2 ) {\n\n\t\t\t\treturn RGBEToLinear( value );\n\n\t\t\t} else if ( inputEncoding == 3 ) {\n\n\t\t\t\treturn RGBMToLinear( value, 7.0 );\n\n\t\t\t} else if ( inputEncoding == 4 ) {\n\n\t\t\t\treturn RGBMToLinear( value, 16.0 );\n\n\t\t\t} else if ( inputEncoding == 5 ) {\n\n\t\t\t\treturn RGBDToLinear( value, 256.0 );\n\n\t\t\t} else {\n\n\t\t\t\treturn GammaToLinear( value, 2.2 );\n\n\t\t\t}\n\n\t\t}\n\n\t\tvec4 linearToOutputTexel( vec4 value ) {\n\n\t\t\tif ( outputEncoding == 0 ) {\n\n\t\t\t\treturn value;\n\n\t\t\t} else if ( outputEncoding == 1 ) {\n\n\t\t\t\treturn LinearTosRGB( value );\n\n\t\t\t} else if ( outputEncoding == 2 ) {\n\n\t\t\t\treturn LinearToRGBE( value );\n\n\t\t\t} else if ( outputEncoding == 3 ) {\n\n\t\t\t\treturn LinearToRGBM( value, 7.0 );\n\n\t\t\t} else if ( outputEncoding == 4 ) {\n\n\t\t\t\treturn LinearToRGBM( value, 16.0 );\n\n\t\t\t} else if ( outputEncoding == 5 ) {\n\n\t\t\t\treturn LinearToRGBD( value, 256.0 );\n\n\t\t\t} else {\n\n\t\t\t\treturn LinearToGamma( value, 2.2 );\n\n\t\t\t}\n\n\t\t}\n\n\t\tvec4 envMapTexelToLinear( vec4 color ) {\n\n\t\t\treturn inputTexelToLinear( color );\n\n\t\t}\n\t"}Zo.create=function(t,e){return console.log("THREE.Curve.create() has been deprecated"),t.prototype=Object.create(Zo.prototype),t.prototype.constructor=t,t.prototype.getPoint=e,t},gl.prototype.fromPoints=function(t){return console.warn("THREE.Path: .fromPoints() has been renamed to .setFromPoints()."),this.setFromPoints(t)},Kc.prototype.setColors=function(){console.error("THREE.GridHelper: setColors() has been deprecated, pass them in the constructor instead.")},Xc.prototype.update=function(){console.error("THREE.SkeletonHelper: update() no longer needs to be called.")},Uo.prototype.extractUrlBase=function(t){return console.warn("THREE.Loader: .extractUrlBase() has been deprecated. Use THREE.LoaderUtils.extractUrlBase() instead."),Hl.extractUrlBase(t)},Uo.Handlers={add:function(){console.error("THREE.Loader: Handlers.add() has been removed. Use LoadingManager.addHandler() instead.")},get:function(){console.error("THREE.Loader: Handlers.get() has been removed. Use LoadingManager.getHandler() instead.")}},Fc.prototype.center=function(t){return console.warn("THREE.Box2: .center() has been renamed to .getCenter()."),this.getCenter(t)},Fc.prototype.empty=function(){return console.warn("THREE.Box2: .empty() has been renamed to .isEmpty()."),this.isEmpty()},Fc.prototype.isIntersectionBox=function(t){return console.warn("THREE.Box2: .isIntersectionBox() has been renamed to .intersectsBox()."),this.intersectsBox(t)},Fc.prototype.size=function(t){return console.warn("THREE.Box2: .size() has been renamed to .getSize()."),this.getSize(t)},wt.prototype.center=function(t){return console.warn("THREE.Box3: .center() has been renamed to .getCenter()."),this.getCenter(t)},wt.prototype.empty=function(){return console.warn("THREE.Box3: .empty() has been renamed to .isEmpty()."),this.isEmpty()},wt.prototype.isIntersectionBox=function(t){return console.warn("THREE.Box3: .isIntersectionBox() has been renamed to .intersectsBox()."),this.intersectsBox(t)},wt.prototype.isIntersectionSphere=function(t){return console.warn("THREE.Box3: .isIntersectionSphere() has been renamed to .intersectsSphere()."),this.intersectsSphere(t)},wt.prototype.size=function(t){return console.warn("THREE.Box3: .size() has been renamed to .getSize()."),this.getSize(t)},Ft.prototype.empty=function(){return console.warn("THREE.Sphere: .empty() has been renamed to .isEmpty()."),this.isEmpty()},Yn.prototype.setFromMatrix=function(t){return console.warn("THREE.Frustum: .setFromMatrix() has been renamed to .setFromProjectionMatrix()."),this.setFromProjectionMatrix(t)},Uc.prototype.center=function(t){return console.warn("THREE.Line3: .center() has been renamed to .getCenter()."),this.getCenter(t)},ot.random16=function(){return console.warn("THREE.Math: .random16() has been deprecated. Use Math.random() instead."),Math.random()},ot.nearestPowerOfTwo=function(t){return console.warn("THREE.Math: .nearestPowerOfTwo() has been renamed to .floorPowerOfTwo()."),ot.floorPowerOfTwo(t)},ot.nextPowerOfTwo=function(t){return console.warn("THREE.Math: .nextPowerOfTwo() has been renamed to .ceilPowerOfTwo()."),ot.ceilPowerOfTwo(t)},ct.prototype.flattenToArrayOffset=function(t,e){return console.warn("THREE.Matrix3: .flattenToArrayOffset() has been deprecated. Use .toArray() instead."),this.toArray(t,e)},ct.prototype.multiplyVector3=function(t){return console.warn("THREE.Matrix3: .multiplyVector3() has been removed. Use vector.applyMatrix3( matrix ) instead."),t.applyMatrix3(this)},ct.prototype.multiplyVector3Array=function(){console.error("THREE.Matrix3: .multiplyVector3Array() has been removed.")},ct.prototype.applyToBufferAttribute=function(t){return console.warn("THREE.Matrix3: .applyToBufferAttribute() has been removed. Use attribute.applyMatrix3( matrix ) instead."),t.applyMatrix3(this)},ct.prototype.applyToVector3Array=function(){console.error("THREE.Matrix3: .applyToVector3Array() has been removed.")},ct.prototype.getInverse=function(t){return console.warn("THREE.Matrix3: .getInverse() has been removed. Use matrixInv.copy( matrix ).invert(); instead."),this.copy(t).invert()},Xt.prototype.extractPosition=function(t){return console.warn("THREE.Matrix4: .extractPosition() has been renamed to .copyPosition()."),this.copyPosition(t)},Xt.prototype.flattenToArrayOffset=function(t,e){return console.warn("THREE.Matrix4: .flattenToArrayOffset() has been deprecated. Use .toArray() instead."),this.toArray(t,e)},Xt.prototype.getPosition=function(){return console.warn("THREE.Matrix4: .getPosition() has been removed. Use Vector3.setFromMatrixPosition( matrix ) instead."),(new xt).setFromMatrixColumn(this,3)},Xt.prototype.setRotationFromQuaternion=function(t){return console.warn("THREE.Matrix4: .setRotationFromQuaternion() has been renamed to .makeRotationFromQuaternion()."),this.makeRotationFromQuaternion(t)},Xt.prototype.multiplyToArray=function(){console.warn("THREE.Matrix4: .multiplyToArray() has been removed.")},Xt.prototype.multiplyVector3=function(t){return console.warn("THREE.Matrix4: .multiplyVector3() has been removed. Use vector.applyMatrix4( matrix ) instead."),t.applyMatrix4(this)},Xt.prototype.multiplyVector4=function(t){return console.warn("THREE.Matrix4: .multiplyVector4() has been removed. Use vector.applyMatrix4( matrix ) instead."),t.applyMatrix4(this)},Xt.prototype.multiplyVector3Array=function(){console.error("THREE.Matrix4: .multiplyVector3Array() has been removed.")},Xt.prototype.rotateAxis=function(t){console.warn("THREE.Matrix4: .rotateAxis() has been removed. Use Vector3.transformDirection( matrix ) instead."),t.transformDirection(this)},Xt.prototype.crossVector=function(t){return console.warn("THREE.Matrix4: .crossVector() has been removed. Use vector.applyMatrix4( matrix ) instead."),t.applyMatrix4(this)},Xt.prototype.translate=function(){console.error("THREE.Matrix4: .translate() has been removed.")},Xt.prototype.rotateX=function(){console.error("THREE.Matrix4: .rotateX() has been removed.")},Xt.prototype.rotateY=function(){console.error("THREE.Matrix4: .rotateY() has been removed.")},Xt.prototype.rotateZ=function(){console.error("THREE.Matrix4: .rotateZ() has been removed.")},Xt.prototype.rotateByAxis=function(){console.error("THREE.Matrix4: .rotateByAxis() has been removed.")},Xt.prototype.applyToBufferAttribute=function(t){return console.warn("THREE.Matrix4: .applyToBufferAttribute() has been removed. Use attribute.applyMatrix4( matrix ) instead."),t.applyMatrix4(this)},Xt.prototype.applyToVector3Array=function(){console.error("THREE.Matrix4: .applyToVector3Array() has been removed.")},Xt.prototype.makeFrustum=function(t,e,n,i,r,s){return console.warn("THREE.Matrix4: .makeFrustum() has been removed. Use .makePerspective( left, right, top, bottom, near, far ) instead."),this.makePerspective(t,e,i,n,r,s)},Xt.prototype.getInverse=function(t){return console.warn("THREE.Matrix4: .getInverse() has been removed. Use matrixInv.copy( matrix ).invert(); instead."),this.copy(t).invert()},we.prototype.isIntersectionLine=function(t){return console.warn("THREE.Plane: .isIntersectionLine() has been renamed to .intersectsLine()."),this.intersectsLine(t)},yt.prototype.multiplyVector3=function(t){return console.warn("THREE.Quaternion: .multiplyVector3() has been removed. Use is now vector.applyQuaternion( quaternion ) instead."),t.applyQuaternion(this)},yt.prototype.inverse=function(){return console.warn("THREE.Quaternion: .inverse() has been renamed to invert()."),this.invert()},qt.prototype.isIntersectionBox=function(t){return console.warn("THREE.Ray: .isIntersectionBox() has been renamed to .intersectsBox()."),this.intersectsBox(t)},qt.prototype.isIntersectionPlane=function(t){return console.warn("THREE.Ray: .isIntersectionPlane() has been renamed to .intersectsPlane()."),this.intersectsPlane(t)},qt.prototype.isIntersectionSphere=function(t){return console.warn("THREE.Ray: .isIntersectionSphere() has been renamed to .intersectsSphere()."),this.intersectsSphere(t)},Ie.prototype.area=function(){return console.warn("THREE.Triangle: .area() has been renamed to .getArea()."),this.getArea()},Ie.prototype.barycoordFromPoint=function(t,e){return console.warn("THREE.Triangle: .barycoordFromPoint() has been renamed to .getBarycoord()."),this.getBarycoord(t,e)},Ie.prototype.midpoint=function(t){return console.warn("THREE.Triangle: .midpoint() has been renamed to .getMidpoint()."),this.getMidpoint(t)},Ie.prototypenormal=function(t){return console.warn("THREE.Triangle: .normal() has been renamed to .getNormal()."),this.getNormal(t)},Ie.prototype.plane=function(t){return console.warn("THREE.Triangle: .plane() has been renamed to .getPlane()."),this.getPlane(t)},Ie.barycoordFromPoint=function(t,e,n,i,r){return console.warn("THREE.Triangle: .barycoordFromPoint() has been renamed to .getBarycoord()."),Ie.getBarycoord(t,e,n,i,r)},Ie.normal=function(t,e,n,i){return console.warn("THREE.Triangle: .normal() has been renamed to .getNormal()."),Ie.getNormal(t,e,n,i)},vl.prototype.extractAllPoints=function(t){return console.warn("THREE.Shape: .extractAllPoints() has been removed. Use .extractPoints() instead."),this.extractPoints(t)},vl.prototype.extrude=function(t){return console.warn("THREE.Shape: .extrude() has been removed. Use ExtrudeGeometry() instead."),new Za(this,t)},vl.prototype.makeGeometry=function(t){return console.warn("THREE.Shape: .makeGeometry() has been removed. Use ShapeGeometry() instead."),new no(this,t)},lt.prototype.fromAttribute=function(t,e,n){return console.warn("THREE.Vector2: .fromAttribute() has been renamed to .fromBufferAttribute()."),this.fromBufferAttribute(t,e,n)},lt.prototype.distanceToManhattan=function(t){return console.warn("THREE.Vector2: .distanceToManhattan() has been renamed to .manhattanDistanceTo()."),this.manhattanDistanceTo(t)},lt.prototype.lengthManhattan=function(){return console.warn("THREE.Vector2: .lengthManhattan() has been renamed to .manhattanLength()."),this.manhattanLength()},xt.prototype.setEulerFromRotationMatrix=function(){console.error("THREE.Vector3: .setEulerFromRotationMatrix() has been removed. Use Euler.setFromRotationMatrix() instead.")},xt.prototype.setEulerFromQuaternion=function(){console.error("THREE.Vector3: .setEulerFromQuaternion() has been removed. Use Euler.setFromQuaternion() instead.")},xt.prototype.getPositionFromMatrix=function(t){return console.warn("THREE.Vector3: .getPositionFromMatrix() has been renamed to .setFromMatrixPosition()."),this.setFromMatrixPosition(t)},xt.prototype.getScaleFromMatrix=function(t){return console.warn("THREE.Vector3: .getScaleFromMatrix() has been renamed to .setFromMatrixScale()."),this.setFromMatrixScale(t)},xt.prototype.getColumnFromMatrix=function(t,e){return console.warn("THREE.Vector3: .getColumnFromMatrix() has been renamed to .setFromMatrixColumn()."),this.setFromMatrixColumn(e,t)},xt.prototype.applyProjection=function(t){return console.warn("THREE.Vector3: .applyProjection() has been removed. Use .applyMatrix4( m ) instead."),this.applyMatrix4(t)},xt.prototype.fromAttribute=function(t,e,n){return console.warn("THREE.Vector3: .fromAttribute() has been renamed to .fromBufferAttribute()."),this.fromBufferAttribute(t,e,n)},xt.prototype.distanceToManhattan=function(t){return console.warn("THREE.Vector3: .distanceToManhattan() has been renamed to .manhattanDistanceTo()."),this.manhattanDistanceTo(t)},xt.prototype.lengthManhattan=function(){return console.warn("THREE.Vector3: .lengthManhattan() has been renamed to .manhattanLength()."),this.manhattanLength()},ft.prototype.fromAttribute=function(t,e,n){return console.warn("THREE.Vector4: .fromAttribute() has been renamed to .fromBufferAttribute()."),this.fromBufferAttribute(t,e,n)},ft.prototype.lengthManhattan=function(){return console.warn("THREE.Vector4: .lengthManhattan() has been renamed to .manhattanLength()."),this.manhattanLength()},ye.prototype.getChildByName=function(t){return console.warn("THREE.Object3D: .getChildByName() has been renamed to .getObjectByName()."),this.getObjectByName(t)},ye.prototype.renderDepth=function(){console.warn("THREE.Object3D: .renderDepth has been removed. Use .renderOrder, instead.")},ye.prototype.translate=function(t,e){return console.warn("THREE.Object3D: .translate() has been removed. Use .translateOnAxis( axis, distance ) instead."),this.translateOnAxis(e,t)},ye.prototype.getWorldRotation=function(){console.error("THREE.Object3D: .getWorldRotation() has been removed. Use THREE.Object3D.getWorldQuaternion( target ) instead.")},ye.prototype.applyMatrix=function(t){return console.warn("THREE.Object3D: .applyMatrix() has been renamed to .applyMatrix4()."),this.applyMatrix4(t)},Object.defineProperties(ye.prototype,{eulerOrder:{get:function(){return console.warn("THREE.Object3D: .eulerOrder is now .rotation.order."),this.rotation.order},set:function(t){console.warn("THREE.Object3D: .eulerOrder is now .rotation.order."),this.rotation.order=t}},useQuaternion:{get:function(){console.warn("THREE.Object3D: .useQuaternion has been removed. The library now uses quaternions by default.")},set:function(){console.warn("THREE.Object3D: .useQuaternion has been removed. The library now uses quaternions by default.")}}}),Dn.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(Dn.prototype,{drawMode:{get:function(){return console.error("THREE.Mesh: .drawMode has been removed. The renderer now always assumes THREE.TrianglesDrawMode."),0},set:function(){console.error("THREE.Mesh: .drawMode has been removed. The renderer now always assumes THREE.TrianglesDrawMode. Transform your geometry via BufferGeometryUtils.toTrianglesDrawMode() if necessary.")}}}),Is.prototype.initBones=function(){console.error("THREE.SkinnedMesh: initBones() has been removed.")},Object.defineProperty(Zo.prototype,"__arcLengthDivisions",{get:function(){return console.warn("THREE.Curve: .__arcLengthDivisions is now .arcLengthDivisions."),this.arcLengthDivisions},set:function(t){console.warn("THREE.Curve: .__arcLengthDivisions is now .arcLengthDivisions."),this.arcLengthDivisions=t}}),Gn.prototype.setLens=function(t,e){console.warn("THREE.PerspectiveCamera.setLens is deprecated. Use .setFocalLength and .filmGauge for a photographic setup."),void 0!==e&&(this.filmGauge=e),this.setFocalLength(t)},Object.defineProperties(yl.prototype,{onlyShadow:{set:function(){console.warn("THREE.Light: .onlyShadow has been removed.")}},shadowCameraFov:{set:function(t){console.warn("THREE.Light: .shadowCameraFov is now .shadow.camera.fov."),this.shadow.camera.fov=t}},shadowCameraLeft:{set:function(t){console.warn("THREE.Light: .shadowCameraLeft is now .shadow.camera.left."),this.shadow.camera.left=t}},shadowCameraRight:{set:function(t){console.warn("THREE.Light: .shadowCameraRight is now .shadow.camera.right."),this.shadow.camera.right=t}},shadowCameraTop:{set:function(t){console.warn("THREE.Light: .shadowCameraTop is now .shadow.camera.top."),this.shadow.camera.top=t}},shadowCameraBottom:{set:function(t){console.warn("THREE.Light: .shadowCameraBottom is now .shadow.camera.bottom."),this.shadow.camera.bottom=t}},shadowCameraNear:{set:function(t){console.warn("THREE.Light: .shadowCameraNear is now .shadow.camera.near."),this.shadow.camera.near=t}},shadowCameraFar:{set:function(t){console.warn("THREE.Light: .shadowCameraFar is now .shadow.camera.far."),this.shadow.camera.far=t}},shadowCameraVisible:{set:function(){console.warn("THREE.Light: .shadowCameraVisible has been removed. Use new THREE.CameraHelper( light.shadow.camera ) instead.")}},shadowBias:{set:function(t){console.warn("THREE.Light: .shadowBias is now .shadow.bias."),this.shadow.bias=t}},shadowDarkness:{set:function(){console.warn("THREE.Light: .shadowDarkness has been removed.")}},shadowMapWidth:{set:function(t){console.warn("THREE.Light: .shadowMapWidth is now .shadow.mapSize.width."),this.shadow.mapSize.width=t}},shadowMapHeight:{set:function(t){console.warn("THREE.Light: .shadowMapHeight is now .shadow.mapSize.height."),this.shadow.mapSize.height=t}}}),Object.defineProperties(qe.prototype,{length:{get:function(){return console.warn("THREE.BufferAttribute: .length has been deprecated. Use .count instead."),this.array.length}},dynamic:{get:function(){return console.warn("THREE.BufferAttribute: .dynamic has been deprecated. Use .usage instead."),this.usage===nt},set:function(){console.warn("THREE.BufferAttribute: .dynamic has been deprecated. Use .usage instead."),this.setUsage(nt)}}}),qe.prototype.setDynamic=function(t){return console.warn("THREE.BufferAttribute: .setDynamic() has been deprecated. Use .setUsage() instead."),this.setUsage(!0===t?nt:et),this},qe.prototype.copyIndicesArray=function(){console.error("THREE.BufferAttribute: .copyIndicesArray() has been removed.")},qe.prototype.setArray=function(){console.error("THREE.BufferAttribute: .setArray has been removed. Use BufferGeometry .setAttribute to replace/resize attribute buffers")},mn.prototype.addIndex=function(t){console.warn("THREE.BufferGeometry: .addIndex() has been renamed to .setIndex()."),this.setIndex(t)},mn.prototype.addAttribute=function(t,e){return console.warn("THREE.BufferGeometry: .addAttribute() has been renamed to .setAttribute()."),e&&e.isBufferAttribute||e&&e.isInterleavedBufferAttribute?"index"===t?(console.warn("THREE.BufferGeometry.addAttribute: Use .setIndex() for index attribute."),this.setIndex(e),this):this.setAttribute(t,e):(console.warn("THREE.BufferGeometry: .addAttribute() now expects ( name, attribute )."),this.setAttribute(t,new qe(arguments[1],arguments[2])))},mn.prototype.addDrawCall=function(t,e,n){void 0!==n&&console.warn("THREE.BufferGeometry: .addDrawCall() no longer supports indexOffset."),console.warn("THREE.BufferGeometry: .addDrawCall() is now .addGroup()."),this.addGroup(t,e)},mn.prototype.clearDrawCalls=function(){console.warn("THREE.BufferGeometry: .clearDrawCalls() is now .clearGroups()."),this.clearGroups()},mn.prototype.computeOffsets=function(){console.warn("THREE.BufferGeometry: .computeOffsets() has been removed.")},mn.prototype.removeAttribute=function(t){return console.warn("THREE.BufferGeometry: .removeAttribute() has been renamed to .deleteAttribute()."),this.deleteAttribute(t)},mn.prototype.applyMatrix=function(t){return console.warn("THREE.BufferGeometry: .applyMatrix() has been renamed to .applyMatrix4()."),this.applyMatrix4(t)},Object.defineProperties(mn.prototype,{drawcalls:{get:function(){return console.error("THREE.BufferGeometry: .drawcalls has been renamed to .groups."),this.groups}},offsets:{get:function(){return console.warn("THREE.BufferGeometry: .offsets has been renamed to .groups."),this.groups}}}),Object.defineProperties(Gl.prototype,{maxInstancedCount:{get:function(){return console.warn("THREE.InstancedBufferGeometry: .maxInstancedCount has been renamed to .instanceCount."),this.instanceCount},set:function(t){console.warn("THREE.InstancedBufferGeometry: .maxInstancedCount has been renamed to .instanceCount."),this.instanceCount=t}}}),Object.defineProperties(Nc.prototype,{linePrecision:{get:function(){return console.warn("THREE.Raycaster: .linePrecision has been deprecated. Use .params.Line.threshold instead."),this.params.Line.threshold},set:function(t){console.warn("THREE.Raycaster: .linePrecision has been deprecated. Use .params.Line.threshold instead."),this.params.Line.threshold=t}}}),Object.defineProperties(as.prototype,{dynamic:{get:function(){return console.warn("THREE.InterleavedBuffer: .length has been deprecated. Use .usage instead."),this.usage===nt},set:function(t){console.warn("THREE.InterleavedBuffer: .length has been deprecated. Use .usage instead."),this.setUsage(t)}}}),as.prototype.setDynamic=function(t){return console.warn("THREE.InterleavedBuffer: .setDynamic() has been deprecated. Use .setUsage() instead."),this.setUsage(!0===t?nt:et),this},as.prototype.setArray=function(){console.error("THREE.InterleavedBuffer: .setArray has been removed. Use BufferGeometry .setAttribute to replace/resize attribute buffers")},Za.prototype.getArrays=function(){console.error("THREE.ExtrudeGeometry: .getArrays() has been removed.")},Za.prototype.addShapeList=function(){console.error("THREE.ExtrudeGeometry: .addShapeList() has been removed.")},Za.prototype.addShape=function(){console.error("THREE.ExtrudeGeometry: .addShape() has been removed.")},ss.prototype.dispose=function(){console.error("THREE.Scene: .dispose() has been removed.")},Pc.prototype.onUpdate=function(){return console.warn("THREE.Uniform: .onUpdate() has been removed. Use object.onBeforeRender() instead."),this},Object.defineProperties(Be.prototype,{wrapAround:{get:function(){console.warn("THREE.Material: .wrapAround has been removed.")},set:function(){console.warn("THREE.Material: .wrapAround has been removed.")}},overdraw:{get:function(){console.warn("THREE.Material: .overdraw has been removed.")},set:function(){console.warn("THREE.Material: .overdraw has been removed.")}},wrapRGB:{get:function(){return console.warn("THREE.Material: .wrapRGB has been removed."),new ke}},shading:{get:function(){console.error("THREE."+this.type+": .shading has been removed. Use the boolean .flatShading instead.")},set:function(t){console.warn("THREE."+this.type+": .shading has been removed. Use the boolean .flatShading instead."),this.flatShading=1===t}},stencilMask:{get:function(){return console.warn("THREE."+this.type+": .stencilMask has been removed. Use .stencilFuncMask instead."),this.stencilFuncMask},set:function(t){console.warn("THREE."+this.type+": .stencilMask has been removed. Use .stencilFuncMask instead."),this.stencilFuncMask=t}}}),Object.defineProperties(fo.prototype,{transparency:{get:function(){return console.warn("THREE.MeshPhysicalMaterial: .transparency has been renamed to .transmission."),this.transmission},set:function(t){console.warn("THREE.MeshPhysicalMaterial: .transparency has been renamed to .transmission."),this.transmission=t}}}),Object.defineProperties(Fn.prototype,{derivatives:{get:function(){return console.warn("THREE.ShaderMaterial: .derivatives has been moved to .extensions.derivatives."),this.extensions.derivatives},set:function(t){console.warn("THREE. ShaderMaterial: .derivatives has been moved to .extensions.derivatives."),this.extensions.derivatives=t}}}),es.prototype.clearTarget=function(t,e,n,i){console.warn("THREE.WebGLRenderer: .clearTarget() has been deprecated. Use .setRenderTarget() and .clear() instead."),this.setRenderTarget(t),this.clear(e,n,i)},es.prototype.animate=function(t){console.warn("THREE.WebGLRenderer: .animate() is now .setAnimationLoop()."),this.setAnimationLoop(t)},es.prototype.getCurrentRenderTarget=function(){return console.warn("THREE.WebGLRenderer: .getCurrentRenderTarget() is now .getRenderTarget()."),this.getRenderTarget()},es.prototype.getMaxAnisotropy=function(){return console.warn("THREE.WebGLRenderer: .getMaxAnisotropy() is now .capabilities.getMaxAnisotropy()."),this.capabilities.getMaxAnisotropy()},es.prototype.getPrecision=function(){return console.warn("THREE.WebGLRenderer: .getPrecision() is now .capabilities.precision."),this.capabilities.precision},es.prototype.resetGLState=function(){return console.warn("THREE.WebGLRenderer: .resetGLState() is now .state.reset()."),this.state.reset()},es.prototype.supportsFloatTextures=function(){return console.warn("THREE.WebGLRenderer: .supportsFloatTextures() is now .extensions.get( 'OES_texture_float' )."),this.extensions.get("OES_texture_float")},es.prototype.supportsHalfFloatTextures=function(){return console.warn("THREE.WebGLRenderer: .supportsHalfFloatTextures() is now .extensions.get( 'OES_texture_half_float' )."),this.extensions.get("OES_texture_half_float")},es.prototype.supportsStandardDerivatives=function(){return console.warn("THREE.WebGLRenderer: .supportsStandardDerivatives() is now .extensions.get( 'OES_standard_derivatives' )."),this.extensions.get("OES_standard_derivatives")},es.prototype.supportsCompressedTextureS3TC=function(){return console.warn("THREE.WebGLRenderer: .supportsCompressedTextureS3TC() is now .extensions.get( 'WEBGL_compressed_texture_s3tc' )."),this.extensions.get("WEBGL_compressed_texture_s3tc")},es.prototype.supportsCompressedTexturePVRTC=function(){return console.warn("THREE.WebGLRenderer: .supportsCompressedTexturePVRTC() is now .extensions.get( 'WEBGL_compressed_texture_pvrtc' )."),this.extensions.get("WEBGL_compressed_texture_pvrtc")},es.prototype.supportsBlendMinMax=function(){return console.warn("THREE.WebGLRenderer: .supportsBlendMinMax() is now .extensions.get( 'EXT_blend_minmax' )."),this.extensions.get("EXT_blend_minmax")},es.prototype.supportsVertexTextures=function(){return console.warn("THREE.WebGLRenderer: .supportsVertexTextures() is now .capabilities.vertexTextures."),this.capabilities.vertexTextures},es.prototype.supportsInstancedArrays=function(){return console.warn("THREE.WebGLRenderer: .supportsInstancedArrays() is now .extensions.get( 'ANGLE_instanced_arrays' )."),this.extensions.get("ANGLE_instanced_arrays")},es.prototype.enableScissorTest=function(t){console.warn("THREE.WebGLRenderer: .enableScissorTest() is now .setScissorTest()."),this.setScissorTest(t)},es.prototype.initMaterial=function(){console.warn("THREE.WebGLRenderer: .initMaterial() has been removed.")},es.prototype.addPrePlugin=function(){console.warn("THREE.WebGLRenderer: .addPrePlugin() has been removed.")},es.prototype.addPostPlugin=function(){console.warn("THREE.WebGLRenderer: .addPostPlugin() has been removed.")},es.prototype.updateShadowMap=function(){console.warn("THREE.WebGLRenderer: .updateShadowMap() has been removed.")},es.prototype.setFaceCulling=function(){console.warn("THREE.WebGLRenderer: .setFaceCulling() has been removed.")},es.prototype.allocTextureUnit=function(){console.warn("THREE.WebGLRenderer: .allocTextureUnit() has been removed.")},es.prototype.setTexture=function(){console.warn("THREE.WebGLRenderer: .setTexture() has been removed.")},es.prototype.setTexture2D=function(){console.warn("THREE.WebGLRenderer: .setTexture2D() has been removed.")},es.prototype.setTextureCube=function(){console.warn("THREE.WebGLRenderer: .setTextureCube() has been removed.")},es.prototype.getActiveMipMapLevel=function(){return console.warn("THREE.WebGLRenderer: .getActiveMipMapLevel() is now .getActiveMipmapLevel()."),this.getActiveMipmapLevel()},Object.defineProperties(es.prototype,{shadowMapEnabled:{get:function(){return this.shadowMap.enabled},set:function(t){console.warn("THREE.WebGLRenderer: .shadowMapEnabled is now .shadowMap.enabled."),this.shadowMap.enabled=t}},shadowMapType:{get:function(){return this.shadowMap.type},set:function(t){console.warn("THREE.WebGLRenderer: .shadowMapType is now .shadowMap.type."),this.shadowMap.type=t}},shadowMapCullFace:{get:function(){console.warn("THREE.WebGLRenderer: .shadowMapCullFace has been removed. Set Material.shadowSide instead.")},set:function(){console.warn("THREE.WebGLRenderer: .shadowMapCullFace has been removed. Set Material.shadowSide instead.")}},context:{get:function(){return console.warn("THREE.WebGLRenderer: .context has been removed. Use .getContext() instead."),this.getContext()}},vr:{get:function(){return console.warn("THREE.WebGLRenderer: .vr has been renamed to .xr"),this.xr}},gammaInput:{get:function(){return console.warn("THREE.WebGLRenderer: .gammaInput has been removed. Set the encoding for textures via Texture.encoding instead."),!1},set:function(){console.warn("THREE.WebGLRenderer: .gammaInput has been removed. Set the encoding for textures via Texture.encoding instead.")}},gammaOutput:{get:function(){return console.warn("THREE.WebGLRenderer: .gammaOutput has been removed. Set WebGLRenderer.outputEncoding instead."),!1},set:function(t){console.warn("THREE.WebGLRenderer: .gammaOutput has been removed. Set WebGLRenderer.outputEncoding instead."),this.outputEncoding=!0===t?Y:X}},toneMappingWhitePoint:{get:function(){return console.warn("THREE.WebGLRenderer: .toneMappingWhitePoint has been removed."),1},set:function(){console.warn("THREE.WebGLRenderer: .toneMappingWhitePoint has been removed.")}}}),Object.defineProperties(qr.prototype,{cullFace:{get:function(){console.warn("THREE.WebGLRenderer: .shadowMap.cullFace has been removed. Set Material.shadowSide instead.")},set:function(){console.warn("THREE.WebGLRenderer: .shadowMap.cullFace has been removed. Set Material.shadowSide instead.")}},renderReverseSided:{get:function(){console.warn("THREE.WebGLRenderer: .shadowMap.renderReverseSided has been removed. Set Material.shadowSide instead.")},set:function(){console.warn("THREE.WebGLRenderer: .shadowMap.renderReverseSided has been removed. Set Material.shadowSide instead.")}},renderSingleSided:{get:function(){console.warn("THREE.WebGLRenderer: .shadowMap.renderSingleSided has been removed. Set Material.shadowSide instead.")},set:function(){console.warn("THREE.WebGLRenderer: .shadowMap.renderSingleSided has been removed. Set Material.shadowSide instead.")}}}),Object.defineProperties(gt.prototype,{wrapS:{get:function(){return console.warn("THREE.WebGLRenderTarget: .wrapS is now .texture.wrapS."),this.texture.wrapS},set:function(t){console.warn("THREE.WebGLRenderTarget: .wrapS is now .texture.wrapS."),this.texture.wrapS=t}},wrapT:{get:function(){return console.warn("THREE.WebGLRenderTarget: .wrapT is now .texture.wrapT."),this.texture.wrapT},set:function(t){console.warn("THREE.WebGLRenderTarget: .wrapT is now .texture.wrapT."),this.texture.wrapT=t}},magFilter:{get:function(){return console.warn("THREE.WebGLRenderTarget: .magFilter is now .texture.magFilter."),this.texture.magFilter},set:function(t){console.warn("THREE.WebGLRenderTarget: .magFilter is now .texture.magFilter."),this.texture.magFilter=t}},minFilter:{get:function(){return console.warn("THREE.WebGLRenderTarget: .minFilter is now .texture.minFilter."),this.texture.minFilter},set:function(t){console.warn("THREE.WebGLRenderTarget: .minFilter is now .texture.minFilter."),this.texture.minFilter=t}},anisotropy:{get:function(){return console.warn("THREE.WebGLRenderTarget: .anisotropy is now .texture.anisotropy."),this.texture.anisotropy},set:function(t){console.warn("THREE.WebGLRenderTarget: .anisotropy is now .texture.anisotropy."),this.texture.anisotropy=t}},offset:{get:function(){return console.warn("THREE.WebGLRenderTarget: .offset is now .texture.offset."),this.texture.offset},set:function(t){console.warn("THREE.WebGLRenderTarget: .offset is now .texture.offset."),this.texture.offset=t}},repeat:{get:function(){return console.warn("THREE.WebGLRenderTarget: .repeat is now .texture.repeat."),this.texture.repeat},set:function(t){console.warn("THREE.WebGLRenderTarget: .repeat is now .texture.repeat."),this.texture.repeat=t}},format:{get:function(){return console.warn("THREE.WebGLRenderTarget: .format is now .texture.format."),this.texture.format},set:function(t){console.warn("THREE.WebGLRenderTarget: .format is now .texture.format."),this.texture.format=t}},type:{get:function(){return console.warn("THREE.WebGLRenderTarget: .type is now .texture.type."),this.texture.type},set:function(t){console.warn("THREE.WebGLRenderTarget: .type is now .texture.type."),this.texture.type=t}},generateMipmaps:{get:function(){return console.warn("THREE.WebGLRenderTarget: .generateMipmaps is now .texture.generateMipmaps."),this.texture.generateMipmaps},set:function(t){console.warn("THREE.WebGLRenderTarget: .generateMipmaps is now .texture.generateMipmaps."),this.texture.generateMipmaps=t}}}),cc.prototype.load=function(t){console.warn("THREE.Audio: .load has been deprecated. Use THREE.AudioLoader instead.");const e=this;return(new Kl).load(t,(function(t){e.setBuffer(t)})),this},mc.prototype.getData=function(){return console.warn("THREE.AudioAnalyser: .getData() is now .getFrequencyData()."),this.getFrequencyData()},kn.prototype.updateCubeMap=function(t,e){return console.warn("THREE.CubeCamera: .updateCubeMap() is now .update()."),this.update(t,e)},kn.prototype.clear=function(t,e,n,i){return console.warn("THREE.CubeCamera: .clear() is now .renderTarget.clear()."),this.renderTarget.clear(t,e,n,i)},ut.crossOrigin=void 0,ut.loadTexture=function(t,e,n,i){console.warn("THREE.ImageUtils.loadTexture has been deprecated. Use THREE.TextureLoader() instead.");const r=new Yo;r.setCrossOrigin(this.crossOrigin);const s=r.load(t,n,void 0,i);return e&&(s.mapping=e),s},ut.loadTextureCube=function(t,e,n,i){console.warn("THREE.ImageUtils.loadTextureCube has been deprecated. Use THREE.CubeTextureLoader() instead.");const r=new qo;r.setCrossOrigin(this.crossOrigin);const s=r.load(t,n,void 0,i);return e&&(s.mapping=e),s},ut.loadCompressedTexture=function(){console.error("THREE.ImageUtils.loadCompressedTexture has been removed. Use THREE.DDSLoader instead.")},ut.loadCompressedTextureCube=function(){console.error("THREE.ImageUtils.loadCompressedTextureCube has been removed. Use THREE.DDSLoader instead.")};const Hh={createMultiMaterialObject:function(){console.error("THREE.SceneUtils has been moved to /examples/jsm/utils/SceneUtils.js")},detach:function(){console.error("THREE.SceneUtils has been moved to /examples/jsm/utils/SceneUtils.js")},attach:function(){console.error("THREE.SceneUtils has been moved to /examples/jsm/utils/SceneUtils.js")}};"undefined"!=typeof __THREE_DEVTOOLS__&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("register",{detail:{revision:e}})),"undefined"!=typeof window&&(window.__THREE__?console.warn("WARNING: Multiple instances of Three.js being imported."):window.__THREE__=e),t.ACESFilmicToneMapping=4,t.AddEquation=n,t.AddOperation=2,t.AdditiveAnimationBlendMode=q,t.AdditiveBlending=2,t.AlphaFormat=1021,t.AlwaysDepth=1,t.AlwaysStencilFunc=519,t.AmbientLight=Nl,t.AmbientLightProbe=tc,t.AnimationClip=Oo,t.AnimationLoader=class extends Uo{constructor(t){super(t)}load(t,e,n,i){const r=this,s=new Vo(this.manager);s.setPath(this.path),s.setRequestHeader(this.requestHeader),s.setWithCredentials(this.withCredentials),s.load(t,(function(n){try{e(r.parse(JSON.parse(n)))}catch(e){i?i(e):console.error(e),r.manager.itemError(t)}}),n,i)}parse(t){const e=[];for(let n=0;n.99999)this.quaternion.set(0,0,0,1);else if(t.y<-.99999)this.quaternion.set(1,0,0,0);else{oh.set(t.z,0,-t.x).normalize();const e=Math.acos(t.y);this.quaternion.setFromAxisAngle(oh,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=cc,t.AudioAnalyser=mc,t.AudioContext=Ql,t.AudioListener=class extends ye{constructor(){super(),this.type="AudioListener",this.context=Ql.getContext(),this.gain=this.context.createGain(),this.gain.connect(this.context.destination),this.filter=null,this.timeDelta=0,this._clock=new ic}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(sc,ac,oc),lc.set(0,0,-1).applyQuaternion(ac),e.positionX){const t=this.context.currentTime+this.timeDelta;e.positionX.linearRampToValueAtTime(sc.x,t),e.positionY.linearRampToValueAtTime(sc.y,t),e.positionZ.linearRampToValueAtTime(sc.z,t),e.forwardX.linearRampToValueAtTime(lc.x,t),e.forwardY.linearRampToValueAtTime(lc.y,t),e.forwardZ.linearRampToValueAtTime(lc.z,t),e.upX.linearRampToValueAtTime(n.x,t),e.upY.linearRampToValueAtTime(n.y,t),e.upZ.linearRampToValueAtTime(n.z,t)}else e.setPosition(sc.x,sc.y,sc.z),e.setOrientation(lc.x,lc.y,lc.z,n.x,n.y,n.z)}},t.AudioLoader=Kl,t.AxesHelper=hh,t.AxisHelper=function(t){return console.warn("THREE.AxisHelper has been renamed to THREE.AxesHelper."),new hh(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 Xo(t)},t.Bone=Ns,t.BooleanKeyframeTrack=Ro,t.BoundingBoxHelper=function(t,e){return console.warn("THREE.BoundingBoxHelper has been deprecated. Creating a THREE.BoxHelper instead."),new ah(t,e)},t.Box2=Fc,t.Box3=wt,t.Box3Helper=class extends Ks{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 mn;i.setIndex(new qe(n,1)),i.setAttribute("position",new en([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 Vs({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=Nn,t.BoxGeometry=Nn,t.BoxHelper=ah,t.BufferAttribute=qe,t.BufferGeometry=mn,t.BufferGeometryLoader=kl,t.ByteType=1010,t.Cache=Fo,t.Camera=Hn,t.CameraHelper=class extends Ks{constructor(t){const e=new mn,n=new Vs({color:16777215,vertexColors:!0,toneMapped:!1}),i=[],r=[],s={},a=new ke(16755200),o=new ke(16711680),l=new ke(43775),c=new ke(16777215),h=new ke(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 en(i,3)),e.setAttribute("color",new en(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;ih.projectionMatrixInverse.copy(this.camera.projectionMatrixInverse),rh("c",e,t,ih,0,0,-1),rh("t",e,t,ih,0,0,1),rh("n1",e,t,ih,-1,-1,-1),rh("n2",e,t,ih,1,-1,-1),rh("n3",e,t,ih,-1,1,-1),rh("n4",e,t,ih,1,1,-1),rh("f1",e,t,ih,-1,-1,1),rh("f2",e,t,ih,1,-1,1),rh("f3",e,t,ih,-1,1,1),rh("f4",e,t,ih,1,1,1),rh("u1",e,t,ih,.7,1.1,-1),rh("u2",e,t,ih,-.7,1.1,-1),rh("u3",e,t,ih,0,2,-1),rh("cf1",e,t,ih,-1,0,1),rh("cf2",e,t,ih,1,0,1),rh("cf3",e,t,ih,0,-1,1),rh("cf4",e,t,ih,0,1,1),rh("cn1",e,t,ih,-1,0,-1),rh("cn2",e,t,ih,1,0,-1),rh("cn3",e,t,ih,0,-1,-1),rh("cn4",e,t,ih,0,1,-1),t.getAttribute("position").needsUpdate=!0}},t.CanvasRenderer=function(){console.error("THREE.CanvasRenderer has been removed")},t.CanvasTexture=ca,t.CatmullRomCurve3=il,t.CineonToneMapping=3,t.CircleBufferGeometry=ua,t.CircleGeometry=ua,t.ClampToEdgeWrapping=u,t.Clock=ic,t.Color=ke,t.ColorKeyframeTrack=Co,t.CompressedTexture=la,t.CompressedTextureLoader=Wo,t.ConeBufferGeometry=pa,t.ConeGeometry=pa,t.CubeCamera=kn,t.CubeReflectionMapping=r,t.CubeRefractionMapping=s,t.CubeTexture=Vn,t.CubeTextureLoader=qo,t.CubeUVReflectionMapping=l,t.CubeUVRefractionMapping=c,t.CubicBezierCurve=ol,t.CubicBezierCurve3=ll,t.CubicInterpolant=To,t.CullFaceBack=1,t.CullFaceFront=2,t.CullFaceFrontBack=3,t.CullFaceNone=0,t.Curve=Zo,t.CurvePath=fl,t.CustomBlending=5,t.CustomToneMapping=5,t.CylinderBufferGeometry=da,t.CylinderGeometry=da,t.Cylindrical=class{constructor(t=1,e=0,n=0){return this.radius=t,this.theta=e,this.y=n,this}set(t,e,n){return this.radius=t,this.theta=e,this.y=n,this}copy(t){return this.radius=t.radius,this.theta=t.theta,this.y=t.y,this}setFromVector3(t){return this.setFromCartesianCoords(t.x,t.y,t.z)}setFromCartesianCoords(t,e,n){return this.radius=Math.sqrt(t*t+n*n),this.theta=Math.atan2(t,n),this.y=e,this}clone(){return(new this.constructor).copy(this)}},t.DataTexture=jn,t.DataTexture2DArray=fi,t.DataTexture3D=gi,t.DataTextureLoader=Xo,t.DataUtils=ph,t.DecrementStencilOp=7683,t.DecrementWrapStencilOp=34056,t.DefaultLoadingManager=Go,t.DepthFormat=A,t.DepthStencilFormat=L,t.DepthTexture=ha,t.DirectionalLight=Il,t.DirectionalLightHelper=class extends ye{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 mn;i.setAttribute("position",new en([-e,e,0,e,e,0,e,-e,0,-e,-e,0,-e,e,0],3));const r=new Vs({fog:!1,toneMapped:!1});this.lightPlane=new Zs(i,r),this.add(this.lightPlane),i=new mn,i.setAttribute("position",new en([0,0,0,0,0,1],3)),this.targetLine=new Zs(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(){$c.setFromMatrixPosition(this.light.matrixWorld),th.setFromMatrixPosition(this.light.target.matrixWorld),eh.subVectors(th,$c),this.lightPlane.lookAt(th),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(th),this.targetLine.scale.z=eh.length()}},t.DiscreteInterpolant=Ao,t.DodecahedronBufferGeometry=fa,t.DodecahedronGeometry=fa,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 qe(t,e).setUsage(nt)},t.DynamicCopyUsage=35050,t.DynamicDrawUsage=nt,t.DynamicReadUsage=35049,t.EdgesGeometry=_a,t.EdgesHelper=function(t,e){return console.warn("THREE.EdgesHelper has been removed. Use THREE.EdgesGeometry instead."),new Ks(new _a(t.geometry),new Vs({color:void 0!==e?e:16777215}))},t.EllipseCurve=Jo,t.EqualDepth=4,t.EqualStencilFunc=514,t.EquirectangularReflectionMapping=a,t.EquirectangularRefractionMapping=o,t.Euler=ie,t.EventDispatcher=rt,t.ExtrudeBufferGeometry=Za,t.ExtrudeGeometry=Za,t.FaceColors=1,t.FileLoader=Vo,t.FlatShading=1,t.Float16BufferAttribute=tn,t.Float32Attribute=function(t,e){return console.warn("THREE.Float32Attribute has been removed. Use new THREE.Float32BufferAttribute() instead."),new en(t,e)},t.Float32BufferAttribute=en,t.Float64Attribute=function(t,e){return console.warn("THREE.Float64Attribute has been removed. Use new THREE.Float64BufferAttribute() instead."),new nn(t,e)},t.Float64BufferAttribute=nn,t.FloatType=w,t.Fog=rs,t.FogExp2=is,t.Font=Yl,t.FontLoader=class extends Uo{constructor(t){super(t)}load(t,e,n,i){const r=this,s=new Vo(this.manager);s.setPath(this.path),s.setRequestHeader(this.requestHeader),s.setWithCredentials(r.withCredentials),s.load(t,(function(t){let n;try{n=JSON.parse(t)}catch(e){console.warn("THREE.FontLoader: typeface.js support is being deprecated. Use typeface.json instead."),n=JSON.parse(t.substring(65,t.length-2))}const i=r.parse(n);e&&e(i)}),n,i)}parse(t){return new Yl(t)}},t.FrontSide=0,t.Frustum=Yn,t.GLBufferAttribute=Ic,t.GLSL1="100",t.GLSL3=it,t.GammaEncoding=Z,t.GreaterDepth=6,t.GreaterEqualDepth=5,t.GreaterEqualStencilFunc=518,t.GreaterStencilFunc=516,t.GridHelper=Kc,t.Group=Qr,t.HalfFloatType=M,t.HemisphereLight=xl,t.HemisphereLightHelper=class extends ye{constructor(t,e,n){super(),this.light=t,this.light.updateMatrixWorld(),this.matrix=t.matrixWorld,this.matrixAutoUpdate=!1,this.color=n;const i=new $a(e);i.rotateY(.5*Math.PI),this.material=new Ve({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 qe(s,3)),this.add(new Dn(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");Jc.copy(this.light.color),Qc.copy(this.light.groundColor);for(let t=0,n=e.count;t0){const n=new Ho(e);r=new jo(n),r.setCrossOrigin(this.crossOrigin);for(let e=0,n=t.length;e\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})}(vh),this._equirectShader=null,this._cubemapShader=null,this._compileMaterial(this._blurMaterial)}fromScene(t,e=0,n=.1,i=100){Eh=this._renderer.getRenderTarget();const r=this._allocateTargets();return this._sceneToCubeUV(t,n,i,r),e>0&&this._blur(r,0,0,e),this._applyPMREM(r),this._cleanup(r),r}fromEquirectangular(t){return this._fromTexture(t)}fromCubemap(t){return this._fromTexture(t)}compileCubemapShader(){null===this._cubemapShader&&(this._cubemapShader=Oh(),this._compileMaterial(this._cubemapShader))}compileEquirectangularShader(){null===this._equirectShader&&(this._equirectShader=Bh(),this._compileMaterial(this._equirectShader))}dispose(){this._blurMaterial.dispose(),null!==this._cubemapShader&&this._cubemapShader.dispose(),null!==this._equirectShader&&this._equirectShader.dispose();for(let t=0;t2?mh:0,mh,mh),o.setRenderTarget(i),u&&o.render(_h,r),o.render(t,r)}o.toneMapping=h,o.outputEncoding=c,o.autoClear=l}_textureToCubeUV(t,e){const n=this._renderer;t.isCubeTexture?null==this._cubemapShader&&(this._cubemapShader=Oh()):null==this._equirectShader&&(this._equirectShader=Bh());const i=t.isCubeTexture?this._cubemapShader:this._equirectShader,r=new Dn(wh[0],i),s=i.uniforms;s.envMap.value=t,t.isCubeTexture||s.texelSize.value.set(1/t.image.width,1/t.image.height),s.inputEncoding.value=yh[t.encoding],s.outputEncoding.value=yh[e.texture.encoding],Nh(e,0,0,3*mh,2*mh),n.setRenderTarget(e),n.render(r,bh)}_applyPMREM(t){const e=this._renderer,n=e.autoClear;e.autoClear=!1;for(let e=1;evh&&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,bh)}},t.ParametricBufferGeometry=to,t.ParametricGeometry=to,t.Particle=function(t){return console.warn("THREE.Particle has been renamed to THREE.Sprite."),new Ms(t)},t.ParticleBasicMaterial=function(t){return console.warn("THREE.ParticleBasicMaterial has been renamed to THREE.PointsMaterial."),new ta(t)},t.ParticleSystem=function(t,e){return console.warn("THREE.ParticleSystem has been renamed to THREE.Points."),new sa(t,e)},t.ParticleSystemMaterial=function(t){return console.warn("THREE.ParticleSystemMaterial has been renamed to THREE.PointsMaterial."),new ta(t)},t.Path=gl,t.PerspectiveCamera=Gn,t.Plane=we,t.PlaneBufferGeometry=Qn,t.PlaneGeometry=Qn,t.PlaneHelper=class extends Zs{constructor(t,e=1,n=16776960){const i=n,r=new mn;r.setAttribute("position",new en([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,0,1,0,0,0],3)),r.computeBoundingSphere(),super(r,new Vs({color:i,toneMapped:!1})),this.type="PlaneHelper",this.plane=t,this.size=e;const s=new mn;s.setAttribute("position",new en([1,1,1,-1,1,1,-1,-1,1,1,1,1,-1,-1,1,1,-1,1],3)),s.computeBoundingSphere(),this.add(new Dn(s,new Ve({color:i,opacity:.2,transparent:!0,depthWrite:!1,toneMapped:!1})))}updateMatrixWorld(t){let e=-this.plane.constant;Math.abs(e)<1e-8&&(e=1e-8),this.scale.set(.5*this.size,.5*this.size,e),this.children[0].material.side=e<0?1:0,this.lookAt(this.plane.normal),super.updateMatrixWorld(t)}},t.PointCloud=function(t,e){return console.warn("THREE.PointCloud has been renamed to THREE.Points."),new sa(t,e)},t.PointCloudMaterial=function(t){return console.warn("THREE.PointCloudMaterial has been renamed to THREE.PointsMaterial."),new ta(t)},t.PointLight=Cl,t.PointLightHelper=class extends Dn{constructor(t,e,n){super(new io(e,4,2),new Ve({wireframe:!0,fog:!1,toneMapped:!1})),this.light=t,this.light.updateMatrixWorld(),this.color=n,this.type="PointLightHelper",this.matrix=this.light.matrixWorld,this.matrixAutoUpdate=!1,this.update()}dispose(){this.geometry.dispose(),this.material.dispose()}update(){void 0!==this.color?this.material.color.set(this.color):this.material.color.copy(this.light.color)}},t.Points=sa,t.PointsMaterial=ta,t.PolarGridHelper=class extends Ks{constructor(t=10,e=16,n=8,i=64,r=4473924,s=8947848){r=new ke(r),s=new ke(s);const a=[],o=[];for(let n=0;n<=e;n++){const i=n/e*(2*Math.PI),l=Math.sin(i)*t,c=Math.cos(i)*t;a.push(0,0,0),a.push(l,0,c);const h=1&n?r:s;o.push(h.r,h.g,h.b),o.push(h.r,h.g,h.b)}for(let e=0;e<=n;e++){const l=1&e?r:s,c=t-t/n*e;for(let t=0;tt.length)&&(e=t.length);for(var n=0,r=new Array(e);n=t.length?{done:!0}:{done:!1,value:t[r++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}return(n=t[Symbol.iterator]()).next.bind(n)}function ht(){}Object.assign(ht.prototype,{addEventListener:function(t,e){void 0===this._listeners&&(this._listeners={});var n=this._listeners;void 0===n[t]&&(n[t]=[]),-1===n[t].indexOf(e)&&n[t].push(e)},hasEventListener:function(t,e){if(void 0===this._listeners)return!1;var n=this._listeners;return void 0!==n[t]&&-1!==n[t].indexOf(e)},removeEventListener:function(t,e){if(void 0!==this._listeners){var n=this._listeners[t];if(void 0!==n){var r=n.indexOf(e);-1!==r&&n.splice(r,1)}}},dispatchEvent:function(t){if(void 0!==this._listeners){var e=this._listeners[t.type];if(void 0!==e){t.target=this;for(var n=e.slice(0),r=0,i=n.length;r>8&255]+dt[t>>16&255]+dt[t>>24&255]+"-"+dt[255&e]+dt[e>>8&255]+"-"+dt[e>>16&15|64]+dt[e>>24&255]+"-"+dt[63&n|128]+dt[n>>8&255]+"-"+dt[n>>16&255]+dt[n>>24&255]+dt[255&r]+dt[r>>8&255]+dt[r>>16&255]+dt[r>>24&255]).toUpperCase()},clamp:function(t,e,n){return Math.max(e,Math.min(n,t))},euclideanModulo:function(t,e){return(t%e+e)%e},mapLinear:function(t,e,n,r,i){return r+(t-e)*(i-r)/(n-e)},lerp:function(t,e,n){return(1-n)*t+n*e},damp:function(t,e,n,r){return mt.lerp(t,e,1-Math.exp(-n*r))},pingpong:function(t,e){return void 0===e&&(e=1),e-Math.abs(mt.euclideanModulo(t,2*e)-e)},smoothstep:function(t,e,n){return t<=e?0:t>=n?1:(t=(t-e)/(n-e))*t*(3-2*t)},smootherstep:function(t,e,n){return t<=e?0:t>=n?1:(t=(t-e)/(n-e))*t*t*(t*(6*t-15)+10)},randInt:function(t,e){return t+Math.floor(Math.random()*(e-t+1))},randFloat:function(t,e){return t+Math.random()*(e-t)},randFloatSpread:function(t){return t*(.5-Math.random())},seededRandom:function(t){return void 0!==t&&(ft=t%2147483647),((ft=16807*ft%2147483647)-1)/2147483646},degToRad:function(t){return t*mt.DEG2RAD},radToDeg:function(t){return t*mt.RAD2DEG},isPowerOfTwo:function(t){return 0==(t&t-1)&&0!==t},ceilPowerOfTwo:function(t){return Math.pow(2,Math.ceil(Math.log(t)/Math.LN2))},floorPowerOfTwo:function(t){return Math.pow(2,Math.floor(Math.log(t)/Math.LN2))},setQuaternionFromProperEuler:function(t,e,n,r,i){var a=Math.cos,o=Math.sin,s=a(n/2),l=o(n/2),u=a((e+r)/2),c=o((e+r)/2),h=a((e-r)/2),d=o((e-r)/2),p=a((r-e)/2),f=o((r-e)/2);switch(i){case"XYX":t.set(s*c,l*h,l*d,s*u);break;case"YZY":t.set(l*d,s*c,l*h,s*u);break;case"ZXZ":t.set(l*h,l*d,s*c,s*u);break;case"XZX":t.set(s*c,l*f,l*p,s*u);break;case"YXY":t.set(l*p,s*c,l*f,s*u);break;case"ZYZ":t.set(l*f,l*p,s*c,s*u);break;default:console.warn("THREE.MathUtils: .setQuaternionFromProperEuler() encountered an unknown order: "+i)}}},vt=function(){function t(t,e){void 0===t&&(t=0),void 0===e&&(e=0),this.x=t,this.y=e}var e=t.prototype;return e.set=function(t,e){return this.x=t,this.y=e,this},e.setScalar=function(t){return this.x=t,this.y=t,this},e.setX=function(t){return this.x=t,this},e.setY=function(t){return this.y=t,this},e.setComponent=function(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},e.getComponent=function(t){switch(t){case 0:return this.x;case 1:return this.y;default:throw new Error("index is out of range: "+t)}},e.clone=function(){return new this.constructor(this.x,this.y)},e.copy=function(t){return this.x=t.x,this.y=t.y,this},e.add=function(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)},e.addScalar=function(t){return this.x+=t,this.y+=t,this},e.addVectors=function(t,e){return this.x=t.x+e.x,this.y=t.y+e.y,this},e.addScaledVector=function(t,e){return this.x+=t.x*e,this.y+=t.y*e,this},e.sub=function(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)},e.subScalar=function(t){return this.x-=t,this.y-=t,this},e.subVectors=function(t,e){return this.x=t.x-e.x,this.y=t.y-e.y,this},e.multiply=function(t){return this.x*=t.x,this.y*=t.y,this},e.multiplyScalar=function(t){return this.x*=t,this.y*=t,this},e.divide=function(t){return this.x/=t.x,this.y/=t.y,this},e.divideScalar=function(t){return this.multiplyScalar(1/t)},e.applyMatrix3=function(t){var e=this.x,n=this.y,r=t.elements;return this.x=r[0]*e+r[3]*n+r[6],this.y=r[1]*e+r[4]*n+r[7],this},e.min=function(t){return this.x=Math.min(this.x,t.x),this.y=Math.min(this.y,t.y),this},e.max=function(t){return this.x=Math.max(this.x,t.x),this.y=Math.max(this.y,t.y),this},e.clamp=function(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},e.clampScalar=function(t,e){return this.x=Math.max(t,Math.min(e,this.x)),this.y=Math.max(t,Math.min(e,this.y)),this},e.clampLength=function(t,e){var n=this.length();return this.divideScalar(n||1).multiplyScalar(Math.max(t,Math.min(e,n)))},e.floor=function(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this},e.ceil=function(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this},e.round=function(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this},e.roundToZero=function(){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},e.negate=function(){return this.x=-this.x,this.y=-this.y,this},e.dot=function(t){return this.x*t.x+this.y*t.y},e.cross=function(t){return this.x*t.y-this.y*t.x},e.lengthSq=function(){return this.x*this.x+this.y*this.y},e.length=function(){return Math.sqrt(this.x*this.x+this.y*this.y)},e.manhattanLength=function(){return Math.abs(this.x)+Math.abs(this.y)},e.normalize=function(){return this.divideScalar(this.length()||1)},e.angle=function(){var t=Math.atan2(-this.y,-this.x)+Math.PI;return t},e.distanceTo=function(t){return Math.sqrt(this.distanceToSquared(t))},e.distanceToSquared=function(t){var e=this.x-t.x,n=this.y-t.y;return e*e+n*n},e.manhattanDistanceTo=function(t){return Math.abs(this.x-t.x)+Math.abs(this.y-t.y)},e.setLength=function(t){return this.normalize().multiplyScalar(t)},e.lerp=function(t,e){return this.x+=(t.x-this.x)*e,this.y+=(t.y-this.y)*e,this},e.lerpVectors=function(t,e,n){return this.x=t.x+(e.x-t.x)*n,this.y=t.y+(e.y-t.y)*n,this},e.equals=function(t){return t.x===this.x&&t.y===this.y},e.fromArray=function(t,e){return void 0===e&&(e=0),this.x=t[e],this.y=t[e+1],this},e.toArray=function(t,e){return void 0===t&&(t=[]),void 0===e&&(e=0),t[e]=this.x,t[e+1]=this.y,t},e.fromBufferAttribute=function(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},e.rotateAround=function(t,e){var n=Math.cos(e),r=Math.sin(e),i=this.x-t.x,a=this.y-t.y;return this.x=i*n-a*r+t.x,this.y=i*r+a*n+t.y,this},e.random=function(){return this.x=Math.random(),this.y=Math.random(),this},ot(t,[{key:"width",get:function(){return this.x},set:function(t){this.x=t}},{key:"height",get:function(){return this.y},set:function(t){this.y=t}}]),t}();vt.prototype.isVector2=!0;var gt,yt=function(){function t(){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.")}var e=t.prototype;return e.set=function(t,e,n,r,i,a,o,s,l){var u=this.elements;return u[0]=t,u[1]=r,u[2]=o,u[3]=e,u[4]=i,u[5]=s,u[6]=n,u[7]=a,u[8]=l,this},e.identity=function(){return this.set(1,0,0,0,1,0,0,0,1),this},e.copy=function(t){var 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},e.extractBasis=function(t,e,n){return t.setFromMatrix3Column(this,0),e.setFromMatrix3Column(this,1),n.setFromMatrix3Column(this,2),this},e.setFromMatrix4=function(t){var 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},e.multiply=function(t){return this.multiplyMatrices(this,t)},e.premultiply=function(t){return this.multiplyMatrices(t,this)},e.multiplyMatrices=function(t,e){var n=t.elements,r=e.elements,i=this.elements,a=n[0],o=n[3],s=n[6],l=n[1],u=n[4],c=n[7],h=n[2],d=n[5],p=n[8],f=r[0],m=r[3],v=r[6],g=r[1],y=r[4],x=r[7],_=r[2],b=r[5],w=r[8];return i[0]=a*f+o*g+s*_,i[3]=a*m+o*y+s*b,i[6]=a*v+o*x+s*w,i[1]=l*f+u*g+c*_,i[4]=l*m+u*y+c*b,i[7]=l*v+u*x+c*w,i[2]=h*f+d*g+p*_,i[5]=h*m+d*y+p*b,i[8]=h*v+d*x+p*w,this},e.multiplyScalar=function(t){var 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},e.determinant=function(){var t=this.elements,e=t[0],n=t[1],r=t[2],i=t[3],a=t[4],o=t[5],s=t[6],l=t[7],u=t[8];return e*a*u-e*o*l-n*i*u+n*o*s+r*i*l-r*a*s},e.invert=function(){var t=this.elements,e=t[0],n=t[1],r=t[2],i=t[3],a=t[4],o=t[5],s=t[6],l=t[7],u=t[8],c=u*a-o*l,h=o*s-u*i,d=l*i-a*s,p=e*c+n*h+r*d;if(0===p)return this.set(0,0,0,0,0,0,0,0,0);var f=1/p;return t[0]=c*f,t[1]=(r*l-u*n)*f,t[2]=(o*n-r*a)*f,t[3]=h*f,t[4]=(u*e-r*s)*f,t[5]=(r*i-o*e)*f,t[6]=d*f,t[7]=(n*s-l*e)*f,t[8]=(a*e-n*i)*f,this},e.transpose=function(){var t,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},e.getNormalMatrix=function(t){return this.setFromMatrix4(t).invert().transpose()},e.transposeIntoArray=function(t){var 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},e.setUvTransform=function(t,e,n,r,i,a,o){var s=Math.cos(i),l=Math.sin(i);return this.set(n*s,n*l,-n*(s*a+l*o)+a+t,-r*l,r*s,-r*(-l*a+s*o)+o+e,0,0,1),this},e.scale=function(t,e){var n=this.elements;return n[0]*=t,n[3]*=t,n[6]*=t,n[1]*=e,n[4]*=e,n[7]*=e,this},e.rotate=function(t){var e=Math.cos(t),n=Math.sin(t),r=this.elements,i=r[0],a=r[3],o=r[6],s=r[1],l=r[4],u=r[7];return r[0]=e*i+n*s,r[3]=e*a+n*l,r[6]=e*o+n*u,r[1]=-n*i+e*s,r[4]=-n*a+e*l,r[7]=-n*o+e*u,this},e.translate=function(t,e){var 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},e.equals=function(t){for(var e=this.elements,n=t.elements,r=0;r<9;r++)if(e[r]!==n[r])return!1;return!0},e.fromArray=function(t,e){void 0===e&&(e=0);for(var n=0;n<9;n++)this.elements[n]=t[n+e];return this},e.toArray=function(t,e){void 0===t&&(t=[]),void 0===e&&(e=0);var 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.clone=function(){return(new this.constructor).fromArray(this.elements)},t}();yt.prototype.isMatrix3=!0;var xt={getDataURL:function(t){if(/^data:/i.test(t.src))return t.src;if("undefined"==typeof HTMLCanvasElement)return t.src;var e;if(t instanceof HTMLCanvasElement)e=t;else{void 0===gt&&(gt=document.createElementNS("http://www.w3.org/1999/xhtml","canvas")),gt.width=t.width,gt.height=t.height;var n=gt.getContext("2d");t instanceof ImageData?n.putImageData(t,0,0):n.drawImage(t,0,0,t.width,t.height),e=gt}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")}},_t=0,bt=function(t){function e(n,r,i,a,o,s,l,u,c,d){var p;return void 0===n&&(n=e.DEFAULT_IMAGE),void 0===r&&(r=e.DEFAULT_MAPPING),void 0===i&&(i=h),void 0===a&&(a=h),void 0===o&&(o=v),void 0===s&&(s=y),void 0===l&&(l=E),void 0===u&&(u=x),void 0===c&&(c=1),void 0===d&&(d=X),p=t.call(this)||this,Object.defineProperty(lt(p),"id",{value:_t++}),p.uuid=mt.generateUUID(),p.name="",p.image=n,p.mipmaps=[],p.mapping=r,p.wrapS=i,p.wrapT=a,p.magFilter=o,p.minFilter=s,p.anisotropy=c,p.format=l,p.internalFormat=null,p.type=u,p.offset=new vt(0,0),p.repeat=new vt(1,1),p.center=new vt(0,0),p.rotation=0,p.matrixAutoUpdate=!0,p.matrix=new yt,p.generateMipmaps=!0,p.premultiplyAlpha=!1,p.flipY=!0,p.unpackAlignment=4,p.encoding=d,p.version=0,p.onUpdate=null,p}st(e,t);var n=e.prototype;return n.updateMatrix=function(){this.matrix.setUvTransform(this.offset.x,this.offset.y,this.repeat.x,this.repeat.y,this.rotation,this.center.x,this.center.y)},n.clone=function(){return(new this.constructor).copy(this)},n.copy=function(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},n.toJSON=function(t){var e=void 0===t||"string"==typeof t;if(!e&&void 0!==t.textures[this.uuid])return t.textures[this.uuid];var 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){var r=this.image;if(void 0===r.uuid&&(r.uuid=mt.generateUUID()),!e&&void 0===t.images[r.uuid]){var i;if(Array.isArray(r)){i=[];for(var a=0,o=r.length;a1)switch(this.wrapS){case c:t.x=t.x-Math.floor(t.x);break;case h: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 c:t.y=t.y-Math.floor(t.y);break;case h: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},ot(e,[{key:"needsUpdate",set:function(t){!0===t&&this.version++}}]),e}(ht);function wt(t){return"undefined"!=typeof HTMLImageElement&&t instanceof HTMLImageElement||"undefined"!=typeof HTMLCanvasElement&&t instanceof HTMLCanvasElement||"undefined"!=typeof ImageBitmap&&t instanceof ImageBitmap?xt.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."),{})}bt.DEFAULT_IMAGE=void 0,bt.DEFAULT_MAPPING=r,bt.prototype.isTexture=!0;var Mt=function(){function t(t,e,n,r){void 0===t&&(t=0),void 0===e&&(e=0),void 0===n&&(n=0),void 0===r&&(r=1),this.x=t,this.y=e,this.z=n,this.w=r}var e=t.prototype;return e.set=function(t,e,n,r){return this.x=t,this.y=e,this.z=n,this.w=r,this},e.setScalar=function(t){return this.x=t,this.y=t,this.z=t,this.w=t,this},e.setX=function(t){return this.x=t,this},e.setY=function(t){return this.y=t,this},e.setZ=function(t){return this.z=t,this},e.setW=function(t){return this.w=t,this},e.setComponent=function(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},e.getComponent=function(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)}},e.clone=function(){return new this.constructor(this.x,this.y,this.z,this.w)},e.copy=function(t){return this.x=t.x,this.y=t.y,this.z=t.z,this.w=void 0!==t.w?t.w:1,this},e.add=function(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)},e.addScalar=function(t){return this.x+=t,this.y+=t,this.z+=t,this.w+=t,this},e.addVectors=function(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},e.addScaledVector=function(t,e){return this.x+=t.x*e,this.y+=t.y*e,this.z+=t.z*e,this.w+=t.w*e,this},e.sub=function(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)},e.subScalar=function(t){return this.x-=t,this.y-=t,this.z-=t,this.w-=t,this},e.subVectors=function(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},e.multiply=function(t){return this.x*=t.x,this.y*=t.y,this.z*=t.z,this.w*=t.w,this},e.multiplyScalar=function(t){return this.x*=t,this.y*=t,this.z*=t,this.w*=t,this},e.applyMatrix4=function(t){var e=this.x,n=this.y,r=this.z,i=this.w,a=t.elements;return this.x=a[0]*e+a[4]*n+a[8]*r+a[12]*i,this.y=a[1]*e+a[5]*n+a[9]*r+a[13]*i,this.z=a[2]*e+a[6]*n+a[10]*r+a[14]*i,this.w=a[3]*e+a[7]*n+a[11]*r+a[15]*i,this},e.divideScalar=function(t){return this.multiplyScalar(1/t)},e.setAxisAngleFromQuaternion=function(t){this.w=2*Math.acos(t.w);var 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},e.setAxisAngleFromRotationMatrix=function(t){var e,n,r,i,a=.01,o=.1,s=t.elements,l=s[0],u=s[4],c=s[8],h=s[1],d=s[5],p=s[9],f=s[2],m=s[6],v=s[10];if(Math.abs(u-h)y&&g>x?gx?y=0?1:-1,y=1-v*v;if(y>Number.EPSILON){var x=Math.sqrt(y),_=Math.atan2(x,v*g);m=Math.sin(m*_)/x,o=Math.sin(o*_)/x}var b=o*g;if(s=s*m+h*b,l=l*m+d*b,u=u*m+p*b,c=c*m+f*b,m===1-o){var w=1/Math.sqrt(s*s+l*l+u*u+c*c);s*=w,l*=w,u*=w,c*=w}}t[e]=s,t[e+1]=l,t[e+2]=u,t[e+3]=c},t.multiplyQuaternionsFlat=function(t,e,n,r,i,a){var o=n[r],s=n[r+1],l=n[r+2],u=n[r+3],c=i[a],h=i[a+1],d=i[a+2],p=i[a+3];return t[e]=o*p+u*c+s*d-l*h,t[e+1]=s*p+u*h+l*c-o*d,t[e+2]=l*p+u*d+o*h-s*c,t[e+3]=u*p-o*c-s*h-l*d,t};var e=t.prototype;return e.set=function(t,e,n,r){return this._x=t,this._y=e,this._z=n,this._w=r,this._onChangeCallback(),this},e.clone=function(){return new this.constructor(this._x,this._y,this._z,this._w)},e.copy=function(t){return this._x=t.x,this._y=t.y,this._z=t.z,this._w=t.w,this._onChangeCallback(),this},e.setFromEuler=function(t,e){if(!t||!t.isEuler)throw new Error("THREE.Quaternion: .setFromEuler() now expects an Euler rotation rather than a Vector3 and order.");var n=t._x,r=t._y,i=t._z,a=t._order,o=Math.cos,s=Math.sin,l=o(n/2),u=o(r/2),c=o(i/2),h=s(n/2),d=s(r/2),p=s(i/2);switch(a){case"XYZ":this._x=h*u*c+l*d*p,this._y=l*d*c-h*u*p,this._z=l*u*p+h*d*c,this._w=l*u*c-h*d*p;break;case"YXZ":this._x=h*u*c+l*d*p,this._y=l*d*c-h*u*p,this._z=l*u*p-h*d*c,this._w=l*u*c+h*d*p;break;case"ZXY":this._x=h*u*c-l*d*p,this._y=l*d*c+h*u*p,this._z=l*u*p+h*d*c,this._w=l*u*c-h*d*p;break;case"ZYX":this._x=h*u*c-l*d*p,this._y=l*d*c+h*u*p,this._z=l*u*p-h*d*c,this._w=l*u*c+h*d*p;break;case"YZX":this._x=h*u*c+l*d*p,this._y=l*d*c+h*u*p,this._z=l*u*p-h*d*c,this._w=l*u*c-h*d*p;break;case"XZY":this._x=h*u*c-l*d*p,this._y=l*d*c-h*u*p,this._z=l*u*p+h*d*c,this._w=l*u*c+h*d*p;break;default:console.warn("THREE.Quaternion: .setFromEuler() encountered an unknown order: "+a)}return!1!==e&&this._onChangeCallback(),this},e.setFromAxisAngle=function(t,e){var n=e/2,r=Math.sin(n);return this._x=t.x*r,this._y=t.y*r,this._z=t.z*r,this._w=Math.cos(n),this._onChangeCallback(),this},e.setFromRotationMatrix=function(t){var e=t.elements,n=e[0],r=e[4],i=e[8],a=e[1],o=e[5],s=e[9],l=e[2],u=e[6],c=e[10],h=n+o+c;if(h>0){var d=.5/Math.sqrt(h+1);this._w=.25/d,this._x=(u-s)*d,this._y=(i-l)*d,this._z=(a-r)*d}else if(n>o&&n>c){var p=2*Math.sqrt(1+n-o-c);this._w=(u-s)/p,this._x=.25*p,this._y=(r+a)/p,this._z=(i+l)/p}else if(o>c){var f=2*Math.sqrt(1+o-n-c);this._w=(i-l)/f,this._x=(r+a)/f,this._y=.25*f,this._z=(s+u)/f}else{var m=2*Math.sqrt(1+c-n-o);this._w=(a-r)/m,this._x=(i+l)/m,this._y=(s+u)/m,this._z=.25*m}return this._onChangeCallback(),this},e.setFromUnitVectors=function(t,e){var 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()},e.angleTo=function(t){return 2*Math.acos(Math.abs(mt.clamp(this.dot(t),-1,1)))},e.rotateTowards=function(t,e){var n=this.angleTo(t);if(0===n)return this;var r=Math.min(1,e/n);return this.slerp(t,r),this},e.identity=function(){return this.set(0,0,0,1)},e.invert=function(){return this.conjugate()},e.conjugate=function(){return this._x*=-1,this._y*=-1,this._z*=-1,this._onChangeCallback(),this},e.dot=function(t){return this._x*t._x+this._y*t._y+this._z*t._z+this._w*t._w},e.lengthSq=function(){return this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w},e.length=function(){return Math.sqrt(this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w)},e.normalize=function(){var 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},e.multiply=function(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)},e.premultiply=function(t){return this.multiplyQuaternions(t,this)},e.multiplyQuaternions=function(t,e){var n=t._x,r=t._y,i=t._z,a=t._w,o=e._x,s=e._y,l=e._z,u=e._w;return this._x=n*u+a*o+r*l-i*s,this._y=r*u+a*s+i*o-n*l,this._z=i*u+a*l+n*s-r*o,this._w=a*u-n*o-r*s-i*l,this._onChangeCallback(),this},e.slerp=function(t,e){if(0===e)return this;if(1===e)return this.copy(t);var n=this._x,r=this._y,i=this._z,a=this._w,o=a*t._w+n*t._x+r*t._y+i*t._z;if(o<0?(this._w=-t._w,this._x=-t._x,this._y=-t._y,this._z=-t._z,o=-o):this.copy(t),o>=1)return this._w=a,this._x=n,this._y=r,this._z=i,this;var s=1-o*o;if(s<=Number.EPSILON){var l=1-e;return this._w=l*a+e*this._w,this._x=l*n+e*this._x,this._y=l*r+e*this._y,this._z=l*i+e*this._z,this.normalize(),this._onChangeCallback(),this}var u=Math.sqrt(s),c=Math.atan2(u,o),h=Math.sin((1-e)*c)/u,d=Math.sin(e*c)/u;return this._w=a*h+this._w*d,this._x=n*h+this._x*d,this._y=r*h+this._y*d,this._z=i*h+this._z*d,this._onChangeCallback(),this},e.equals=function(t){return t._x===this._x&&t._y===this._y&&t._z===this._z&&t._w===this._w},e.fromArray=function(t,e){return void 0===e&&(e=0),this._x=t[e],this._y=t[e+1],this._z=t[e+2],this._w=t[e+3],this._onChangeCallback(),this},e.toArray=function(t,e){return void 0===t&&(t=[]),void 0===e&&(e=0),t[e]=this._x,t[e+1]=this._y,t[e+2]=this._z,t[e+3]=this._w,t},e.fromBufferAttribute=function(t,e){return this._x=t.getX(e),this._y=t.getY(e),this._z=t.getZ(e),this._w=t.getW(e),this},e._onChange=function(t){return this._onChangeCallback=t,this},e._onChangeCallback=function(){},ot(t,[{key:"x",get:function(){return this._x},set:function(t){this._x=t,this._onChangeCallback()}},{key:"y",get:function(){return this._y},set:function(t){this._y=t,this._onChangeCallback()}},{key:"z",get:function(){return this._z},set:function(t){this._z=t,this._onChangeCallback()}},{key:"w",get:function(){return this._w},set:function(t){this._w=t,this._onChangeCallback()}}]),t}();Et.prototype.isQuaternion=!0;var At=function(){function t(t,e,n){void 0===t&&(t=0),void 0===e&&(e=0),void 0===n&&(n=0),this.x=t,this.y=e,this.z=n}var e=t.prototype;return e.set=function(t,e,n){return void 0===n&&(n=this.z),this.x=t,this.y=e,this.z=n,this},e.setScalar=function(t){return this.x=t,this.y=t,this.z=t,this},e.setX=function(t){return this.x=t,this},e.setY=function(t){return this.y=t,this},e.setZ=function(t){return this.z=t,this},e.setComponent=function(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},e.getComponent=function(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)}},e.clone=function(){return new this.constructor(this.x,this.y,this.z)},e.copy=function(t){return this.x=t.x,this.y=t.y,this.z=t.z,this},e.add=function(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)},e.addScalar=function(t){return this.x+=t,this.y+=t,this.z+=t,this},e.addVectors=function(t,e){return this.x=t.x+e.x,this.y=t.y+e.y,this.z=t.z+e.z,this},e.addScaledVector=function(t,e){return this.x+=t.x*e,this.y+=t.y*e,this.z+=t.z*e,this},e.sub=function(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)},e.subScalar=function(t){return this.x-=t,this.y-=t,this.z-=t,this},e.subVectors=function(t,e){return this.x=t.x-e.x,this.y=t.y-e.y,this.z=t.z-e.z,this},e.multiply=function(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)},e.multiplyScalar=function(t){return this.x*=t,this.y*=t,this.z*=t,this},e.multiplyVectors=function(t,e){return this.x=t.x*e.x,this.y=t.y*e.y,this.z=t.z*e.z,this},e.applyEuler=function(t){return t&&t.isEuler||console.error("THREE.Vector3: .applyEuler() now expects an Euler rotation rather than a Vector3 and order."),this.applyQuaternion(Rt.setFromEuler(t))},e.applyAxisAngle=function(t,e){return this.applyQuaternion(Rt.setFromAxisAngle(t,e))},e.applyMatrix3=function(t){var e=this.x,n=this.y,r=this.z,i=t.elements;return this.x=i[0]*e+i[3]*n+i[6]*r,this.y=i[1]*e+i[4]*n+i[7]*r,this.z=i[2]*e+i[5]*n+i[8]*r,this},e.applyNormalMatrix=function(t){return this.applyMatrix3(t).normalize()},e.applyMatrix4=function(t){var e=this.x,n=this.y,r=this.z,i=t.elements,a=1/(i[3]*e+i[7]*n+i[11]*r+i[15]);return this.x=(i[0]*e+i[4]*n+i[8]*r+i[12])*a,this.y=(i[1]*e+i[5]*n+i[9]*r+i[13])*a,this.z=(i[2]*e+i[6]*n+i[10]*r+i[14])*a,this},e.applyQuaternion=function(t){var e=this.x,n=this.y,r=this.z,i=t.x,a=t.y,o=t.z,s=t.w,l=s*e+a*r-o*n,u=s*n+o*e-i*r,c=s*r+i*n-a*e,h=-i*e-a*n-o*r;return this.x=l*s+h*-i+u*-o-c*-a,this.y=u*s+h*-a+c*-i-l*-o,this.z=c*s+h*-o+l*-a-u*-i,this},e.project=function(t){return this.applyMatrix4(t.matrixWorldInverse).applyMatrix4(t.projectionMatrix)},e.unproject=function(t){return this.applyMatrix4(t.projectionMatrixInverse).applyMatrix4(t.matrixWorld)},e.transformDirection=function(t){var e=this.x,n=this.y,r=this.z,i=t.elements;return this.x=i[0]*e+i[4]*n+i[8]*r,this.y=i[1]*e+i[5]*n+i[9]*r,this.z=i[2]*e+i[6]*n+i[10]*r,this.normalize()},e.divide=function(t){return this.x/=t.x,this.y/=t.y,this.z/=t.z,this},e.divideScalar=function(t){return this.multiplyScalar(1/t)},e.min=function(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},e.max=function(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},e.clamp=function(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},e.clampScalar=function(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},e.clampLength=function(t,e){var n=this.length();return this.divideScalar(n||1).multiplyScalar(Math.max(t,Math.min(e,n)))},e.floor=function(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this},e.ceil=function(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this},e.round=function(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this},e.roundToZero=function(){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},e.negate=function(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this},e.dot=function(t){return this.x*t.x+this.y*t.y+this.z*t.z},e.lengthSq=function(){return this.x*this.x+this.y*this.y+this.z*this.z},e.length=function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z)},e.manhattanLength=function(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)},e.normalize=function(){return this.divideScalar(this.length()||1)},e.setLength=function(t){return this.normalize().multiplyScalar(t)},e.lerp=function(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},e.lerpVectors=function(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},e.cross=function(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)},e.crossVectors=function(t,e){var n=t.x,r=t.y,i=t.z,a=e.x,o=e.y,s=e.z;return this.x=r*s-i*o,this.y=i*a-n*s,this.z=n*o-r*a,this},e.projectOnVector=function(t){var e=t.lengthSq();if(0===e)return this.set(0,0,0);var n=t.dot(this)/e;return this.copy(t).multiplyScalar(n)},e.projectOnPlane=function(t){return Lt.copy(this).projectOnVector(t),this.sub(Lt)},e.reflect=function(t){return this.sub(Lt.copy(t).multiplyScalar(2*this.dot(t)))},e.angleTo=function(t){var e=Math.sqrt(this.lengthSq()*t.lengthSq());if(0===e)return Math.PI/2;var n=this.dot(t)/e;return Math.acos(mt.clamp(n,-1,1))},e.distanceTo=function(t){return Math.sqrt(this.distanceToSquared(t))},e.distanceToSquared=function(t){var e=this.x-t.x,n=this.y-t.y,r=this.z-t.z;return e*e+n*n+r*r},e.manhattanDistanceTo=function(t){return Math.abs(this.x-t.x)+Math.abs(this.y-t.y)+Math.abs(this.z-t.z)},e.setFromSpherical=function(t){return this.setFromSphericalCoords(t.radius,t.phi,t.theta)},e.setFromSphericalCoords=function(t,e,n){var r=Math.sin(e)*t;return this.x=r*Math.sin(n),this.y=Math.cos(e)*t,this.z=r*Math.cos(n),this},e.setFromCylindrical=function(t){return this.setFromCylindricalCoords(t.radius,t.theta,t.y)},e.setFromCylindricalCoords=function(t,e,n){return this.x=t*Math.sin(e),this.y=n,this.z=t*Math.cos(e),this},e.setFromMatrixPosition=function(t){var e=t.elements;return this.x=e[12],this.y=e[13],this.z=e[14],this},e.setFromMatrixScale=function(t){var e=this.setFromMatrixColumn(t,0).length(),n=this.setFromMatrixColumn(t,1).length(),r=this.setFromMatrixColumn(t,2).length();return this.x=e,this.y=n,this.z=r,this},e.setFromMatrixColumn=function(t,e){return this.fromArray(t.elements,4*e)},e.setFromMatrix3Column=function(t,e){return this.fromArray(t.elements,3*e)},e.equals=function(t){return t.x===this.x&&t.y===this.y&&t.z===this.z},e.fromArray=function(t,e){return void 0===e&&(e=0),this.x=t[e],this.y=t[e+1],this.z=t[e+2],this},e.toArray=function(t,e){return void 0===t&&(t=[]),void 0===e&&(e=0),t[e]=this.x,t[e+1]=this.y,t[e+2]=this.z,t},e.fromBufferAttribute=function(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},e.random=function(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this},t}();At.prototype.isVector3=!0;var Lt=new At,Rt=new Et,Ct=function(){function t(t,e){void 0===t&&(t=new At(1/0,1/0,1/0)),void 0===e&&(e=new At(-1/0,-1/0,-1/0)),this.min=t,this.max=e}var e=t.prototype;return e.set=function(t,e){return this.min.copy(t),this.max.copy(e),this},e.setFromArray=function(t){for(var e=1/0,n=1/0,r=1/0,i=-1/0,a=-1/0,o=-1/0,s=0,l=t.length;si&&(i=u),c>a&&(a=c),h>o&&(o=h)}return this.min.set(e,n,r),this.max.set(i,a,o),this},e.setFromBufferAttribute=function(t){for(var e=1/0,n=1/0,r=1/0,i=-1/0,a=-1/0,o=-1/0,s=0,l=t.count;si&&(i=u),c>a&&(a=c),h>o&&(o=h)}return this.min.set(e,n,r),this.max.set(i,a,o),this},e.setFromPoints=function(t){this.makeEmpty();for(var e=0,n=t.length;ethis.max.x||t.ythis.max.y||t.zthis.max.z)},e.containsBox=function(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},e.getParameter=function(t,e){return void 0===e&&(console.warn("THREE.Box3: .getParameter() target is now required"),e=new At),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))},e.intersectsBox=function(t){return!(t.max.xthis.max.x||t.max.ythis.max.y||t.max.zthis.max.z)},e.intersectsSphere=function(t){return this.clampPoint(t.center,Dt),Dt.distanceToSquared(t.center)<=t.radius*t.radius},e.intersectsPlane=function(t){var 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},e.intersectsTriangle=function(t){if(this.isEmpty())return!1;this.getCenter(Gt),Ut.subVectors(this.max,Gt),Nt.subVectors(t.a,Gt),Bt.subVectors(t.b,Gt),Ot.subVectors(t.c,Gt),zt.subVectors(Bt,Nt),Ft.subVectors(Ot,Bt),Ht.subVectors(Nt,Ot);var e=[0,-zt.z,zt.y,0,-Ft.z,Ft.y,0,-Ht.z,Ht.y,zt.z,0,-zt.x,Ft.z,0,-Ft.x,Ht.z,0,-Ht.x,-zt.y,zt.x,0,-Ft.y,Ft.x,0,-Ht.y,Ht.x,0];return!!Wt(e,Nt,Bt,Ot,Ut)&&(!!Wt(e=[1,0,0,0,1,0,0,0,1],Nt,Bt,Ot,Ut)&&(kt.crossVectors(zt,Ft),Wt(e=[kt.x,kt.y,kt.z],Nt,Bt,Ot,Ut)))},e.clampPoint=function(t,e){return void 0===e&&(console.warn("THREE.Box3: .clampPoint() target is now required"),e=new At),e.copy(t).clamp(this.min,this.max)},e.distanceToPoint=function(t){return Dt.copy(t).clamp(this.min,this.max).sub(t).length()},e.getBoundingSphere=function(t){return void 0===t&&console.error("THREE.Box3: .getBoundingSphere() target is now required"),this.getCenter(t.center),t.radius=.5*this.getSize(Dt).length(),t},e.intersect=function(t){return this.min.max(t.min),this.max.min(t.max),this.isEmpty()&&this.makeEmpty(),this},e.union=function(t){return this.min.min(t.min),this.max.max(t.max),this},e.applyMatrix4=function(t){return this.isEmpty()||(Pt[0].set(this.min.x,this.min.y,this.min.z).applyMatrix4(t),Pt[1].set(this.min.x,this.min.y,this.max.z).applyMatrix4(t),Pt[2].set(this.min.x,this.max.y,this.min.z).applyMatrix4(t),Pt[3].set(this.min.x,this.max.y,this.max.z).applyMatrix4(t),Pt[4].set(this.max.x,this.min.y,this.min.z).applyMatrix4(t),Pt[5].set(this.max.x,this.min.y,this.max.z).applyMatrix4(t),Pt[6].set(this.max.x,this.max.y,this.min.z).applyMatrix4(t),Pt[7].set(this.max.x,this.max.y,this.max.z).applyMatrix4(t),this.setFromPoints(Pt)),this},e.translate=function(t){return this.min.add(t),this.max.add(t),this},e.equals=function(t){return t.min.equals(this.min)&&t.max.equals(this.max)},t}();Ct.prototype.isBox3=!0;var Pt=[new At,new At,new At,new At,new At,new At,new At,new At],Dt=new At,It=new Ct,Nt=new At,Bt=new At,Ot=new At,zt=new At,Ft=new At,Ht=new At,Gt=new At,Ut=new At,kt=new At,Vt=new At;function Wt(t,e,n,r,i){for(var a=0,o=t.length-3;a<=o;a+=3){Vt.fromArray(t,a);var s=i.x*Math.abs(Vt.x)+i.y*Math.abs(Vt.y)+i.z*Math.abs(Vt.z),l=e.dot(Vt),u=n.dot(Vt),c=r.dot(Vt);if(Math.max(-Math.max(l,u,c),Math.min(l,u,c))>s)return!1}return!0}var jt=new Ct,qt=new At,Xt=new At,Yt=new At,Zt=function(){function t(t,e){void 0===t&&(t=new At),void 0===e&&(e=-1),this.center=t,this.radius=e}var e=t.prototype;return e.set=function(t,e){return this.center.copy(t),this.radius=e,this},e.setFromPoints=function(t,e){var n=this.center;void 0!==e?n.copy(e):jt.setFromPoints(t).getCenter(n);for(var r=0,i=0,a=t.length;ithis.radius*this.radius&&(e.sub(this.center).normalize(),e.multiplyScalar(this.radius).add(this.center)),e},e.getBoundingBox=function(t){return void 0===t&&(console.warn("THREE.Sphere: .getBoundingBox() target is now required"),t=new Ct),this.isEmpty()?(t.makeEmpty(),t):(t.set(this.center,this.center),t.expandByScalar(this.radius),t)},e.applyMatrix4=function(t){return this.center.applyMatrix4(t),this.radius=this.radius*t.getMaxScaleOnAxis(),this},e.translate=function(t){return this.center.add(t),this},e.expandByPoint=function(t){Yt.subVectors(t,this.center);var e=Yt.lengthSq();if(e>this.radius*this.radius){var n=Math.sqrt(e),r=.5*(n-this.radius);this.center.add(Yt.multiplyScalar(r/n)),this.radius+=r}return this},e.union=function(t){return Xt.subVectors(t.center,this.center).normalize().multiplyScalar(t.radius),this.expandByPoint(qt.copy(t.center).add(Xt)),this.expandByPoint(qt.copy(t.center).sub(Xt)),this},e.equals=function(t){return t.center.equals(this.center)&&t.radius===this.radius},e.clone=function(){return(new this.constructor).copy(this)},t}(),Jt=new At,Qt=new At,Kt=new At,$t=new At,te=new At,ee=new At,ne=new At,re=function(){function t(t,e){void 0===t&&(t=new At),void 0===e&&(e=new At(0,0,-1)),this.origin=t,this.direction=e}var e=t.prototype;return e.set=function(t,e){return this.origin.copy(t),this.direction.copy(e),this},e.copy=function(t){return this.origin.copy(t.origin),this.direction.copy(t.direction),this},e.at=function(t,e){return void 0===e&&(console.warn("THREE.Ray: .at() target is now required"),e=new At),e.copy(this.direction).multiplyScalar(t).add(this.origin)},e.lookAt=function(t){return this.direction.copy(t).sub(this.origin).normalize(),this},e.recast=function(t){return this.origin.copy(this.at(t,Jt)),this},e.closestPointToPoint=function(t,e){void 0===e&&(console.warn("THREE.Ray: .closestPointToPoint() target is now required"),e=new At),e.subVectors(t,this.origin);var n=e.dot(this.direction);return n<0?e.copy(this.origin):e.copy(this.direction).multiplyScalar(n).add(this.origin)},e.distanceToPoint=function(t){return Math.sqrt(this.distanceSqToPoint(t))},e.distanceSqToPoint=function(t){var e=Jt.subVectors(t,this.origin).dot(this.direction);return e<0?this.origin.distanceToSquared(t):(Jt.copy(this.direction).multiplyScalar(e).add(this.origin),Jt.distanceToSquared(t))},e.distanceSqToSegment=function(t,e,n,r){Qt.copy(t).add(e).multiplyScalar(.5),Kt.copy(e).sub(t).normalize(),$t.copy(this.origin).sub(Qt);var i,a,o,s,l=.5*t.distanceTo(e),u=-this.direction.dot(Kt),c=$t.dot(this.direction),h=-$t.dot(Kt),d=$t.lengthSq(),p=Math.abs(1-u*u);if(p>0)if(a=u*c-h,s=l*p,(i=u*h-c)>=0)if(a>=-s)if(a<=s){var f=1/p;o=(i*=f)*(i+u*(a*=f)+2*c)+a*(u*i+a+2*h)+d}else a=l,o=-(i=Math.max(0,-(u*a+c)))*i+a*(a+2*h)+d;else a=-l,o=-(i=Math.max(0,-(u*a+c)))*i+a*(a+2*h)+d;else a<=-s?o=-(i=Math.max(0,-(-u*l+c)))*i+(a=i>0?-l:Math.min(Math.max(-l,-h),l))*(a+2*h)+d:a<=s?(i=0,o=(a=Math.min(Math.max(-l,-h),l))*(a+2*h)+d):o=-(i=Math.max(0,-(u*l+c)))*i+(a=i>0?l:Math.min(Math.max(-l,-h),l))*(a+2*h)+d;else a=u>0?-l:l,o=-(i=Math.max(0,-(u*a+c)))*i+a*(a+2*h)+d;return n&&n.copy(this.direction).multiplyScalar(i).add(this.origin),r&&r.copy(Kt).multiplyScalar(a).add(Qt),o},e.intersectSphere=function(t,e){Jt.subVectors(t.center,this.origin);var n=Jt.dot(this.direction),r=Jt.dot(Jt)-n*n,i=t.radius*t.radius;if(r>i)return null;var a=Math.sqrt(i-r),o=n-a,s=n+a;return o<0&&s<0?null:o<0?this.at(s,e):this.at(o,e)},e.intersectsSphere=function(t){return this.distanceSqToPoint(t.center)<=t.radius*t.radius},e.distanceToPlane=function(t){var e=t.normal.dot(this.direction);if(0===e)return 0===t.distanceToPoint(this.origin)?0:null;var n=-(this.origin.dot(t.normal)+t.constant)/e;return n>=0?n:null},e.intersectPlane=function(t,e){var n=this.distanceToPlane(t);return null===n?null:this.at(n,e)},e.intersectsPlane=function(t){var e=t.distanceToPoint(this.origin);return 0===e||t.normal.dot(this.direction)*e<0},e.intersectBox=function(t,e){var n,r,i,a,o,s,l=1/this.direction.x,u=1/this.direction.y,c=1/this.direction.z,h=this.origin;return l>=0?(n=(t.min.x-h.x)*l,r=(t.max.x-h.x)*l):(n=(t.max.x-h.x)*l,r=(t.min.x-h.x)*l),u>=0?(i=(t.min.y-h.y)*u,a=(t.max.y-h.y)*u):(i=(t.max.y-h.y)*u,a=(t.min.y-h.y)*u),n>a||i>r?null:((i>n||n!=n)&&(n=i),(a=0?(o=(t.min.z-h.z)*c,s=(t.max.z-h.z)*c):(o=(t.max.z-h.z)*c,s=(t.min.z-h.z)*c),n>s||o>r?null:((o>n||n!=n)&&(n=o),(s=0?n:r,e)))},e.intersectsBox=function(t){return null!==this.intersectBox(t,Jt)},e.intersectTriangle=function(t,e,n,r,i){te.subVectors(e,t),ee.subVectors(n,t),ne.crossVectors(te,ee);var a,o=this.direction.dot(ne);if(o>0){if(r)return null;a=1}else{if(!(o<0))return null;a=-1,o=-o}$t.subVectors(this.origin,t);var s=a*this.direction.dot(ee.crossVectors($t,ee));if(s<0)return null;var l=a*this.direction.dot(te.cross($t));if(l<0)return null;if(s+l>o)return null;var u=-a*$t.dot(ne);return u<0?null:this.at(u/o,i)},e.applyMatrix4=function(t){return this.origin.applyMatrix4(t),this.direction.transformDirection(t),this},e.equals=function(t){return t.origin.equals(this.origin)&&t.direction.equals(this.direction)},e.clone=function(){return(new this.constructor).copy(this)},t}(),ie=function(){function t(){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.")}var e=t.prototype;return e.set=function(t,e,n,r,i,a,o,s,l,u,c,h,d,p,f,m){var v=this.elements;return v[0]=t,v[4]=e,v[8]=n,v[12]=r,v[1]=i,v[5]=a,v[9]=o,v[13]=s,v[2]=l,v[6]=u,v[10]=c,v[14]=h,v[3]=d,v[7]=p,v[11]=f,v[15]=m,this},e.identity=function(){return this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1),this},e.clone=function(){return(new t).fromArray(this.elements)},e.copy=function(t){var 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},e.copyPosition=function(t){var e=this.elements,n=t.elements;return e[12]=n[12],e[13]=n[13],e[14]=n[14],this},e.setFromMatrix3=function(t){var 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},e.extractBasis=function(t,e,n){return t.setFromMatrixColumn(this,0),e.setFromMatrixColumn(this,1),n.setFromMatrixColumn(this,2),this},e.makeBasis=function(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},e.extractRotation=function(t){var e=this.elements,n=t.elements,r=1/ae.setFromMatrixColumn(t,0).length(),i=1/ae.setFromMatrixColumn(t,1).length(),a=1/ae.setFromMatrixColumn(t,2).length();return e[0]=n[0]*r,e[1]=n[1]*r,e[2]=n[2]*r,e[3]=0,e[4]=n[4]*i,e[5]=n[5]*i,e[6]=n[6]*i,e[7]=0,e[8]=n[8]*a,e[9]=n[9]*a,e[10]=n[10]*a,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,this},e.makeRotationFromEuler=function(t){t&&t.isEuler||console.error("THREE.Matrix4: .makeRotationFromEuler() now expects a Euler rotation rather than a Vector3 and order.");var e=this.elements,n=t.x,r=t.y,i=t.z,a=Math.cos(n),o=Math.sin(n),s=Math.cos(r),l=Math.sin(r),u=Math.cos(i),c=Math.sin(i);if("XYZ"===t.order){var h=a*u,d=a*c,p=o*u,f=o*c;e[0]=s*u,e[4]=-s*c,e[8]=l,e[1]=d+p*l,e[5]=h-f*l,e[9]=-o*s,e[2]=f-h*l,e[6]=p+d*l,e[10]=a*s}else if("YXZ"===t.order){var m=s*u,v=s*c,g=l*u,y=l*c;e[0]=m+y*o,e[4]=g*o-v,e[8]=a*l,e[1]=a*c,e[5]=a*u,e[9]=-o,e[2]=v*o-g,e[6]=y+m*o,e[10]=a*s}else if("ZXY"===t.order){var x=s*u,_=s*c,b=l*u,w=l*c;e[0]=x-w*o,e[4]=-a*c,e[8]=b+_*o,e[1]=_+b*o,e[5]=a*u,e[9]=w-x*o,e[2]=-a*l,e[6]=o,e[10]=a*s}else if("ZYX"===t.order){var M=a*u,S=a*c,T=o*u,E=o*c;e[0]=s*u,e[4]=T*l-S,e[8]=M*l+E,e[1]=s*c,e[5]=E*l+M,e[9]=S*l-T,e[2]=-l,e[6]=o*s,e[10]=a*s}else if("YZX"===t.order){var A=a*s,L=a*l,R=o*s,C=o*l;e[0]=s*u,e[4]=C-A*c,e[8]=R*c+L,e[1]=c,e[5]=a*u,e[9]=-o*u,e[2]=-l*u,e[6]=L*c+R,e[10]=A-C*c}else if("XZY"===t.order){var P=a*s,D=a*l,I=o*s,N=o*l;e[0]=s*u,e[4]=-c,e[8]=l*u,e[1]=P*c+N,e[5]=a*u,e[9]=D*c-I,e[2]=I*c-D,e[6]=o*u,e[10]=N*c+P}return e[3]=0,e[7]=0,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,this},e.makeRotationFromQuaternion=function(t){return this.compose(se,t,le)},e.lookAt=function(t,e,n){var r=this.elements;return he.subVectors(t,e),0===he.lengthSq()&&(he.z=1),he.normalize(),ue.crossVectors(n,he),0===ue.lengthSq()&&(1===Math.abs(n.z)?he.x+=1e-4:he.z+=1e-4,he.normalize(),ue.crossVectors(n,he)),ue.normalize(),ce.crossVectors(he,ue),r[0]=ue.x,r[4]=ce.x,r[8]=he.x,r[1]=ue.y,r[5]=ce.y,r[9]=he.y,r[2]=ue.z,r[6]=ce.z,r[10]=he.z,this},e.multiply=function(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)},e.premultiply=function(t){return this.multiplyMatrices(t,this)},e.multiplyMatrices=function(t,e){var n=t.elements,r=e.elements,i=this.elements,a=n[0],o=n[4],s=n[8],l=n[12],u=n[1],c=n[5],h=n[9],d=n[13],p=n[2],f=n[6],m=n[10],v=n[14],g=n[3],y=n[7],x=n[11],_=n[15],b=r[0],w=r[4],M=r[8],S=r[12],T=r[1],E=r[5],A=r[9],L=r[13],R=r[2],C=r[6],P=r[10],D=r[14],I=r[3],N=r[7],B=r[11],O=r[15];return i[0]=a*b+o*T+s*R+l*I,i[4]=a*w+o*E+s*C+l*N,i[8]=a*M+o*A+s*P+l*B,i[12]=a*S+o*L+s*D+l*O,i[1]=u*b+c*T+h*R+d*I,i[5]=u*w+c*E+h*C+d*N,i[9]=u*M+c*A+h*P+d*B,i[13]=u*S+c*L+h*D+d*O,i[2]=p*b+f*T+m*R+v*I,i[6]=p*w+f*E+m*C+v*N,i[10]=p*M+f*A+m*P+v*B,i[14]=p*S+f*L+m*D+v*O,i[3]=g*b+y*T+x*R+_*I,i[7]=g*w+y*E+x*C+_*N,i[11]=g*M+y*A+x*P+_*B,i[15]=g*S+y*L+x*D+_*O,this},e.multiplyScalar=function(t){var 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},e.determinant=function(){var t=this.elements,e=t[0],n=t[4],r=t[8],i=t[12],a=t[1],o=t[5],s=t[9],l=t[13],u=t[2],c=t[6],h=t[10],d=t[14];return t[3]*(+i*s*c-r*l*c-i*o*h+n*l*h+r*o*d-n*s*d)+t[7]*(+e*s*d-e*l*h+i*a*h-r*a*d+r*l*u-i*s*u)+t[11]*(+e*l*c-e*o*d-i*a*c+n*a*d+i*o*u-n*l*u)+t[15]*(-r*o*u-e*s*c+e*o*h+r*a*c-n*a*h+n*s*u)},e.transpose=function(){var t,e=this.elements;return t=e[1],e[1]=e[4],e[4]=t,t=e[2],e[2]=e[8],e[8]=t,t=e[6],e[6]=e[9],e[9]=t,t=e[3],e[3]=e[12],e[12]=t,t=e[7],e[7]=e[13],e[13]=t,t=e[11],e[11]=e[14],e[14]=t,this},e.setPosition=function(t,e,n){var r=this.elements;return t.isVector3?(r[12]=t.x,r[13]=t.y,r[14]=t.z):(r[12]=t,r[13]=e,r[14]=n),this},e.invert=function(){var t=this.elements,e=t[0],n=t[1],r=t[2],i=t[3],a=t[4],o=t[5],s=t[6],l=t[7],u=t[8],c=t[9],h=t[10],d=t[11],p=t[12],f=t[13],m=t[14],v=t[15],g=c*m*l-f*h*l+f*s*d-o*m*d-c*s*v+o*h*v,y=p*h*l-u*m*l-p*s*d+a*m*d+u*s*v-a*h*v,x=u*f*l-p*c*l+p*o*d-a*f*d-u*o*v+a*c*v,_=p*c*s-u*f*s-p*o*h+a*f*h+u*o*m-a*c*m,b=e*g+n*y+r*x+i*_;if(0===b)return this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);var w=1/b;return t[0]=g*w,t[1]=(f*h*i-c*m*i-f*r*d+n*m*d+c*r*v-n*h*v)*w,t[2]=(o*m*i-f*s*i+f*r*l-n*m*l-o*r*v+n*s*v)*w,t[3]=(c*s*i-o*h*i-c*r*l+n*h*l+o*r*d-n*s*d)*w,t[4]=y*w,t[5]=(u*m*i-p*h*i+p*r*d-e*m*d-u*r*v+e*h*v)*w,t[6]=(p*s*i-a*m*i-p*r*l+e*m*l+a*r*v-e*s*v)*w,t[7]=(a*h*i-u*s*i+u*r*l-e*h*l-a*r*d+e*s*d)*w,t[8]=x*w,t[9]=(p*c*i-u*f*i-p*n*d+e*f*d+u*n*v-e*c*v)*w,t[10]=(a*f*i-p*o*i+p*n*l-e*f*l-a*n*v+e*o*v)*w,t[11]=(u*o*i-a*c*i-u*n*l+e*c*l+a*n*d-e*o*d)*w,t[12]=_*w,t[13]=(u*f*r-p*c*r+p*n*h-e*f*h-u*n*m+e*c*m)*w,t[14]=(p*o*r-a*f*r-p*n*s+e*f*s+a*n*m-e*o*m)*w,t[15]=(a*c*r-u*o*r+u*n*s-e*c*s-a*n*h+e*o*h)*w,this},e.scale=function(t){var e=this.elements,n=t.x,r=t.y,i=t.z;return e[0]*=n,e[4]*=r,e[8]*=i,e[1]*=n,e[5]*=r,e[9]*=i,e[2]*=n,e[6]*=r,e[10]*=i,e[3]*=n,e[7]*=r,e[11]*=i,this},e.getMaxScaleOnAxis=function(){var t=this.elements,e=t[0]*t[0]+t[1]*t[1]+t[2]*t[2],n=t[4]*t[4]+t[5]*t[5]+t[6]*t[6],r=t[8]*t[8]+t[9]*t[9]+t[10]*t[10];return Math.sqrt(Math.max(e,n,r))},e.makeTranslation=function(t,e,n){return this.set(1,0,0,t,0,1,0,e,0,0,1,n,0,0,0,1),this},e.makeRotationX=function(t){var 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},e.makeRotationY=function(t){var 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},e.makeRotationZ=function(t){var 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},e.makeRotationAxis=function(t,e){var n=Math.cos(e),r=Math.sin(e),i=1-n,a=t.x,o=t.y,s=t.z,l=i*a,u=i*o;return this.set(l*a+n,l*o-r*s,l*s+r*o,0,l*o+r*s,u*o+n,u*s-r*a,0,l*s-r*o,u*s+r*a,i*s*s+n,0,0,0,0,1),this},e.makeScale=function(t,e,n){return this.set(t,0,0,0,0,e,0,0,0,0,n,0,0,0,0,1),this},e.makeShear=function(t,e,n){return this.set(1,e,n,0,t,1,n,0,t,e,1,0,0,0,0,1),this},e.compose=function(t,e,n){var r=this.elements,i=e._x,a=e._y,o=e._z,s=e._w,l=i+i,u=a+a,c=o+o,h=i*l,d=i*u,p=i*c,f=a*u,m=a*c,v=o*c,g=s*l,y=s*u,x=s*c,_=n.x,b=n.y,w=n.z;return r[0]=(1-(f+v))*_,r[1]=(d+x)*_,r[2]=(p-y)*_,r[3]=0,r[4]=(d-x)*b,r[5]=(1-(h+v))*b,r[6]=(m+g)*b,r[7]=0,r[8]=(p+y)*w,r[9]=(m-g)*w,r[10]=(1-(h+f))*w,r[11]=0,r[12]=t.x,r[13]=t.y,r[14]=t.z,r[15]=1,this},e.decompose=function(t,e,n){var r=this.elements,i=ae.set(r[0],r[1],r[2]).length(),a=ae.set(r[4],r[5],r[6]).length(),o=ae.set(r[8],r[9],r[10]).length();this.determinant()<0&&(i=-i),t.x=r[12],t.y=r[13],t.z=r[14],oe.copy(this);var s=1/i,l=1/a,u=1/o;return oe.elements[0]*=s,oe.elements[1]*=s,oe.elements[2]*=s,oe.elements[4]*=l,oe.elements[5]*=l,oe.elements[6]*=l,oe.elements[8]*=u,oe.elements[9]*=u,oe.elements[10]*=u,e.setFromRotationMatrix(oe),n.x=i,n.y=a,n.z=o,this},e.makePerspective=function(t,e,n,r,i,a){void 0===a&&console.warn("THREE.Matrix4: .makePerspective() has been redefined and has a new signature. Please check the docs.");var o=this.elements,s=2*i/(e-t),l=2*i/(n-r),u=(e+t)/(e-t),c=(n+r)/(n-r),h=-(a+i)/(a-i),d=-2*a*i/(a-i);return o[0]=s,o[4]=0,o[8]=u,o[12]=0,o[1]=0,o[5]=l,o[9]=c,o[13]=0,o[2]=0,o[6]=0,o[10]=h,o[14]=d,o[3]=0,o[7]=0,o[11]=-1,o[15]=0,this},e.makeOrthographic=function(t,e,n,r,i,a){var o=this.elements,s=1/(e-t),l=1/(n-r),u=1/(a-i),c=(e+t)*s,h=(n+r)*l,d=(a+i)*u;return o[0]=2*s,o[4]=0,o[8]=0,o[12]=-c,o[1]=0,o[5]=2*l,o[9]=0,o[13]=-h,o[2]=0,o[6]=0,o[10]=-2*u,o[14]=-d,o[3]=0,o[7]=0,o[11]=0,o[15]=1,this},e.equals=function(t){for(var e=this.elements,n=t.elements,r=0;r<16;r++)if(e[r]!==n[r])return!1;return!0},e.fromArray=function(t,e){void 0===e&&(e=0);for(var n=0;n<16;n++)this.elements[n]=t[n+e];return this},e.toArray=function(t,e){void 0===t&&(t=[]),void 0===e&&(e=0);var 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},t}();ie.prototype.isMatrix4=!0;var ae=new At,oe=new ie,se=new At(0,0,0),le=new At(1,1,1),ue=new At,ce=new At,he=new At,de=new ie,pe=new Et,fe=function(){function t(e,n,r,i){void 0===e&&(e=0),void 0===n&&(n=0),void 0===r&&(r=0),void 0===i&&(i=t.DefaultOrder),this._x=e,this._y=n,this._z=r,this._order=i}var e=t.prototype;return e.set=function(t,e,n,r){return this._x=t,this._y=e,this._z=n,this._order=r||this._order,this._onChangeCallback(),this},e.clone=function(){return new this.constructor(this._x,this._y,this._z,this._order)},e.copy=function(t){return this._x=t._x,this._y=t._y,this._z=t._z,this._order=t._order,this._onChangeCallback(),this},e.setFromRotationMatrix=function(t,e,n){var r=mt.clamp,i=t.elements,a=i[0],o=i[4],s=i[8],l=i[1],u=i[5],c=i[9],h=i[2],d=i[6],p=i[10];switch(e=e||this._order){case"XYZ":this._y=Math.asin(r(s,-1,1)),Math.abs(s)<.9999999?(this._x=Math.atan2(-c,p),this._z=Math.atan2(-o,a)):(this._x=Math.atan2(d,u),this._z=0);break;case"YXZ":this._x=Math.asin(-r(c,-1,1)),Math.abs(c)<.9999999?(this._y=Math.atan2(s,p),this._z=Math.atan2(l,u)):(this._y=Math.atan2(-h,a),this._z=0);break;case"ZXY":this._x=Math.asin(r(d,-1,1)),Math.abs(d)<.9999999?(this._y=Math.atan2(-h,p),this._z=Math.atan2(-o,u)):(this._y=0,this._z=Math.atan2(l,a));break;case"ZYX":this._y=Math.asin(-r(h,-1,1)),Math.abs(h)<.9999999?(this._x=Math.atan2(d,p),this._z=Math.atan2(l,a)):(this._x=0,this._z=Math.atan2(-o,u));break;case"YZX":this._z=Math.asin(r(l,-1,1)),Math.abs(l)<.9999999?(this._x=Math.atan2(-c,u),this._y=Math.atan2(-h,a)):(this._x=0,this._y=Math.atan2(s,p));break;case"XZY":this._z=Math.asin(-r(o,-1,1)),Math.abs(o)<.9999999?(this._x=Math.atan2(d,u),this._y=Math.atan2(s,a)):(this._x=Math.atan2(-c,p),this._y=0);break;default:console.warn("THREE.Euler: .setFromRotationMatrix() encountered an unknown order: "+e)}return this._order=e,!1!==n&&this._onChangeCallback(),this},e.setFromQuaternion=function(t,e,n){return de.makeRotationFromQuaternion(t),this.setFromRotationMatrix(de,e,n)},e.setFromVector3=function(t,e){return this.set(t.x,t.y,t.z,e||this._order)},e.reorder=function(t){return pe.setFromEuler(this),this.setFromQuaternion(pe,t)},e.equals=function(t){return t._x===this._x&&t._y===this._y&&t._z===this._z&&t._order===this._order},e.fromArray=function(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},e.toArray=function(t,e){return void 0===t&&(t=[]),void 0===e&&(e=0),t[e]=this._x,t[e+1]=this._y,t[e+2]=this._z,t[e+3]=this._order,t},e.toVector3=function(t){return t?t.set(this._x,this._y,this._z):new At(this._x,this._y,this._z)},e._onChange=function(t){return this._onChangeCallback=t,this},e._onChangeCallback=function(){},ot(t,[{key:"x",get:function(){return this._x},set:function(t){this._x=t,this._onChangeCallback()}},{key:"y",get:function(){return this._y},set:function(t){this._y=t,this._onChangeCallback()}},{key:"z",get:function(){return this._z},set:function(t){this._z=t,this._onChangeCallback()}},{key:"order",get:function(){return this._order},set:function(t){this._order=t,this._onChangeCallback()}}]),t}();fe.prototype.isEuler=!0,fe.DefaultOrder="XYZ",fe.RotationOrders=["XYZ","YZX","ZXY","XZY","YXZ","ZYX"];var me=function(){function t(){this.mask=1}var e=t.prototype;return e.set=function(t){this.mask=1<1){for(var e=0;e1){for(var e=0;e0){r.children=[];for(var p=0;p0){r.animations=[];for(var f=0;f0&&(n.geometries=v),g.length>0&&(n.materials=g),y.length>0&&(n.textures=y),x.length>0&&(n.images=x),_.length>0&&(n.shapes=_),b.length>0&&(n.skeletons=b),w.length>0&&(n.animations=w)}return n.object=r,n;function M(t){var e=[];for(var n in t){var r=t[n];delete r.metadata,e.push(r)}return e}},clone:function(t){return(new this.constructor).copy(this,t)},copy:function(t,e){if(void 0===e&&(e=!0),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(var n=0;n1?null:e.copy(n).multiplyScalar(i).add(t.start)},e.intersectsLine=function(t){var e=this.distanceToPoint(t.start),n=this.distanceToPoint(t.end);return e<0&&n>0||n<0&&e>0},e.intersectsBox=function(t){return t.intersectsPlane(this)},e.intersectsSphere=function(t){return t.intersectsPlane(this)},e.coplanarPoint=function(t){return void 0===t&&(console.warn("THREE.Plane: .coplanarPoint() target is now required"),t=new At),t.copy(this.normal).multiplyScalar(-this.constant)},e.applyMatrix4=function(t,e){var n=e||De.getNormalMatrix(t),r=this.coplanarPoint(Ce).applyMatrix4(t),i=this.normal.applyMatrix3(n).normalize();return this.constant=-r.dot(i),this},e.translate=function(t){return this.constant-=t.dot(this.normal),this},e.equals=function(t){return t.normal.equals(this.normal)&&t.constant===this.constant},e.clone=function(){return(new this.constructor).copy(this)},t}();Ie.prototype.isPlane=!0;var Ne=new At,Be=new At,Oe=new At,ze=new At,Fe=new At,He=new At,Ge=new At,Ue=new At,ke=new At,Ve=new At,We=function(){function t(t,e,n){void 0===t&&(t=new At),void 0===e&&(e=new At),void 0===n&&(n=new At),this.a=t,this.b=e,this.c=n}t.getNormal=function(t,e,n,r){void 0===r&&(console.warn("THREE.Triangle: .getNormal() target is now required"),r=new At),r.subVectors(n,e),Ne.subVectors(t,e),r.cross(Ne);var i=r.lengthSq();return i>0?r.multiplyScalar(1/Math.sqrt(i)):r.set(0,0,0)},t.getBarycoord=function(t,e,n,r,i){Ne.subVectors(r,e),Be.subVectors(n,e),Oe.subVectors(t,e);var a=Ne.dot(Ne),o=Ne.dot(Be),s=Ne.dot(Oe),l=Be.dot(Be),u=Be.dot(Oe),c=a*l-o*o;if(void 0===i&&(console.warn("THREE.Triangle: .getBarycoord() target is now required"),i=new At),0===c)return i.set(-2,-1,-1);var h=1/c,d=(l*s-o*u)*h,p=(a*u-o*s)*h;return i.set(1-d-p,p,d)},t.containsPoint=function(t,e,n,r){return this.getBarycoord(t,e,n,r,ze),ze.x>=0&&ze.y>=0&&ze.x+ze.y<=1},t.getUV=function(t,e,n,r,i,a,o,s){return this.getBarycoord(t,e,n,r,ze),s.set(0,0),s.addScaledVector(i,ze.x),s.addScaledVector(a,ze.y),s.addScaledVector(o,ze.z),s},t.isFrontFacing=function(t,e,n,r){return Ne.subVectors(n,e),Be.subVectors(t,e),Ne.cross(Be).dot(r)<0};var e=t.prototype;return e.set=function(t,e,n){return this.a.copy(t),this.b.copy(e),this.c.copy(n),this},e.setFromPointsAndIndices=function(t,e,n,r){return this.a.copy(t[e]),this.b.copy(t[n]),this.c.copy(t[r]),this},e.clone=function(){return(new this.constructor).copy(this)},e.copy=function(t){return this.a.copy(t.a),this.b.copy(t.b),this.c.copy(t.c),this},e.getArea=function(){return Ne.subVectors(this.c,this.b),Be.subVectors(this.a,this.b),.5*Ne.cross(Be).length()},e.getMidpoint=function(t){return void 0===t&&(console.warn("THREE.Triangle: .getMidpoint() target is now required"),t=new At),t.addVectors(this.a,this.b).add(this.c).multiplyScalar(1/3)},e.getNormal=function(e){return t.getNormal(this.a,this.b,this.c,e)},e.getPlane=function(t){return void 0===t&&(console.warn("THREE.Triangle: .getPlane() target is now required"),t=new Ie),t.setFromCoplanarPoints(this.a,this.b,this.c)},e.getBarycoord=function(e,n){return t.getBarycoord(e,this.a,this.b,this.c,n)},e.getUV=function(e,n,r,i,a){return t.getUV(e,this.a,this.b,this.c,n,r,i,a)},e.containsPoint=function(e){return t.containsPoint(e,this.a,this.b,this.c)},e.isFrontFacing=function(e){return t.isFrontFacing(this.a,this.b,this.c,e)},e.intersectsBox=function(t){return t.intersectsTriangle(this)},e.closestPointToPoint=function(t,e){void 0===e&&(console.warn("THREE.Triangle: .closestPointToPoint() target is now required"),e=new At);var n,r,i=this.a,a=this.b,o=this.c;Fe.subVectors(a,i),He.subVectors(o,i),Ue.subVectors(t,i);var s=Fe.dot(Ue),l=He.dot(Ue);if(s<=0&&l<=0)return e.copy(i);ke.subVectors(t,a);var u=Fe.dot(ke),c=He.dot(ke);if(u>=0&&c<=u)return e.copy(a);var h=s*c-u*l;if(h<=0&&s>=0&&u<=0)return n=s/(s-u),e.copy(i).addScaledVector(Fe,n);Ve.subVectors(t,o);var d=Fe.dot(Ve),p=He.dot(Ve);if(p>=0&&d<=p)return e.copy(o);var f=d*l-s*p;if(f<=0&&l>=0&&p<=0)return r=l/(l-p),e.copy(i).addScaledVector(He,r);var m=u*p-d*c;if(m<=0&&c-u>=0&&d-p>=0)return Ge.subVectors(o,a),r=(c-u)/(c-u+(d-p)),e.copy(a).addScaledVector(Ge,r);var v=1/(m+f+h);return n=f*v,r=h*v,e.copy(i).addScaledVector(Fe,n).addScaledVector(He,r)},e.equals=function(t){return t.a.equals(this.a)&&t.b.equals(this.b)&&t.c.equals(this.c)},t}(),je=0;function qe(){Object.defineProperty(this,"id",{value:je++}),this.uuid=mt.generateUUID(),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=tt,this.stencilZFail=tt,this.stencilZPass=tt,this.stencilWrite=!1,this.clippingPlanes=null,this.clipIntersection=!1,this.clipShadows=!1,this.shadowSide=null,this.colorWrite=!0,this.precision=null,this.polygonOffset=!1,this.polygonOffsetFactor=0,this.polygonOffsetUnits=0,this.dithering=!1,this.alphaTest=0,this.alphaToCoverage=!1,this.premultipliedAlpha=!1,this.visible=!0,this.toneMapped=!0,this.userData={},this.version=0}qe.prototype=Object.assign(Object.create(ht.prototype),{constructor:qe,isMaterial:!0,onBeforeCompile:function(){},customProgramCacheKey:function(){return this.onBeforeCompile.toString()},setValues:function(t){if(void 0!==t)for(var e in t){var n=t[e];if(void 0!==n)if("shading"!==e){var r=this[e];void 0!==r?r&&r.isColor?r.set(n):r&&r.isVector3&&n&&n.isVector3?r.copy(n):this[e]=n:console.warn("THREE."+this.type+": '"+e+"' is not a property of this material.")}else console.warn("THREE."+this.type+": .shading has been removed. Use the boolean .flatShading instead."),this.flatShading=1===n;else console.warn("THREE.Material: '"+e+"' parameter is undefined.")}},toJSON:function(t){var e=void 0===t||"string"==typeof t;e&&(t={textures:{},images:{}});var n={metadata:{version:4.5,type:"Material",generator:"Material.toJSON"}};function r(t){var e=[];for(var n in t){var r=t[n];delete r.metadata,e.push(r)}return e}if(n.uuid=this.uuid,n.type=this.type,""!==this.name&&(n.name=this.name),this.color&&this.color.isColor&&(n.color=this.color.getHex()),void 0!==this.roughness&&(n.roughness=this.roughness),void 0!==this.metalness&&(n.metalness=this.metalness),this.sheen&&this.sheen.isColor&&(n.sheen=this.sheen.getHex()),this.emissive&&this.emissive.isColor&&(n.emissive=this.emissive.getHex()),this.emissiveIntensity&&1!==this.emissiveIntensity&&(n.emissiveIntensity=this.emissiveIntensity),this.specular&&this.specular.isColor&&(n.specular=this.specular.getHex()),void 0!==this.shininess&&(n.shininess=this.shininess),void 0!==this.clearcoat&&(n.clearcoat=this.clearcoat),void 0!==this.clearcoatRoughness&&(n.clearcoatRoughness=this.clearcoatRoughness),this.clearcoatMap&&this.clearcoatMap.isTexture&&(n.clearcoatMap=this.clearcoatMap.toJSON(t).uuid),this.clearcoatRoughnessMap&&this.clearcoatRoughnessMap.isTexture&&(n.clearcoatRoughnessMap=this.clearcoatRoughnessMap.toJSON(t).uuid),this.clearcoatNormalMap&&this.clearcoatNormalMap.isTexture&&(n.clearcoatNormalMap=this.clearcoatNormalMap.toJSON(t).uuid,n.clearcoatNormalScale=this.clearcoatNormalScale.toArray()),this.map&&this.map.isTexture&&(n.map=this.map.toJSON(t).uuid),this.matcap&&this.matcap.isTexture&&(n.matcap=this.matcap.toJSON(t).uuid),this.alphaMap&&this.alphaMap.isTexture&&(n.alphaMap=this.alphaMap.toJSON(t).uuid),this.lightMap&&this.lightMap.isTexture&&(n.lightMap=this.lightMap.toJSON(t).uuid,n.lightMapIntensity=this.lightMapIntensity),this.aoMap&&this.aoMap.isTexture&&(n.aoMap=this.aoMap.toJSON(t).uuid,n.aoMapIntensity=this.aoMapIntensity),this.bumpMap&&this.bumpMap.isTexture&&(n.bumpMap=this.bumpMap.toJSON(t).uuid,n.bumpScale=this.bumpScale),this.normalMap&&this.normalMap.isTexture&&(n.normalMap=this.normalMap.toJSON(t).uuid,n.normalMapType=this.normalMapType,n.normalScale=this.normalScale.toArray()),this.displacementMap&&this.displacementMap.isTexture&&(n.displacementMap=this.displacementMap.toJSON(t).uuid,n.displacementScale=this.displacementScale,n.displacementBias=this.displacementBias),this.roughnessMap&&this.roughnessMap.isTexture&&(n.roughnessMap=this.roughnessMap.toJSON(t).uuid),this.metalnessMap&&this.metalnessMap.isTexture&&(n.metalnessMap=this.metalnessMap.toJSON(t).uuid),this.emissiveMap&&this.emissiveMap.isTexture&&(n.emissiveMap=this.emissiveMap.toJSON(t).uuid),this.specularMap&&this.specularMap.isTexture&&(n.specularMap=this.specularMap.toJSON(t).uuid),this.envMap&&this.envMap.isTexture&&(n.envMap=this.envMap.toJSON(t).uuid,n.reflectivity=this.reflectivity,n.refractionRatio=this.refractionRatio,void 0!==this.combine&&(n.combine=this.combine),void 0!==this.envMapIntensity&&(n.envMapIntensity=this.envMapIntensity)),this.gradientMap&&this.gradientMap.isTexture&&(n.gradientMap=this.gradientMap.toJSON(t).uuid),void 0!==this.size&&(n.size=this.size),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.morphTargets&&(n.morphTargets=!0),!0===this.morphNormals&&(n.morphNormals=!0),!0===this.skinning&&(n.skinning=!0),!0===this.flatShading&&(n.flatShading=this.flatShading),!1===this.visible&&(n.visible=!1),!1===this.toneMapped&&(n.toneMapped=!1),"{}"!==JSON.stringify(this.userData)&&(n.userData=this.userData),e){var i=r(t.textures),a=r(t.images);i.length>0&&(n.textures=i),a.length>0&&(n.images=a)}return n},clone:function(){return(new this.constructor).copy(this)},copy:function(t){this.name=t.name,this.fog=t.fog,this.blending=t.blending,this.side=t.side,this.vertexColors=t.vertexColors,this.opacity=t.opacity,this.transparent=t.transparent,this.blendSrc=t.blendSrc,this.blendDst=t.blendDst,this.blendEquation=t.blendEquation,this.blendSrcAlpha=t.blendSrcAlpha,this.blendDstAlpha=t.blendDstAlpha,this.blendEquationAlpha=t.blendEquationAlpha,this.depthFunc=t.depthFunc,this.depthTest=t.depthTest,this.depthWrite=t.depthWrite,this.stencilWriteMask=t.stencilWriteMask,this.stencilFunc=t.stencilFunc,this.stencilRef=t.stencilRef,this.stencilFuncMask=t.stencilFuncMask,this.stencilFail=t.stencilFail,this.stencilZFail=t.stencilZFail,this.stencilZPass=t.stencilZPass,this.stencilWrite=t.stencilWrite;var e=t.clippingPlanes,n=null;if(null!==e){var r=e.length;n=new Array(r);for(var i=0;i!==r;++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:function(){this.dispatchEvent({type:"dispose"})}}),Object.defineProperty(qe.prototype,"needsUpdate",{set:function(t){!0===t&&this.version++}});var Xe={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},Ye={h:0,s:0,l:0},Ze={h:0,s:0,l:0};function Je(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 Qe(t){return t<.04045?.0773993808*t:Math.pow(.9478672986*t+.0521327014,2.4)}function Ke(t){return t<.0031308?12.92*t:1.055*Math.pow(t,.41666)-.055}var $e=function(){function t(t,e,n){return void 0===e&&void 0===n?this.set(t):this.setRGB(t,e,n)}var e=t.prototype;return e.set=function(t){return t&&t.isColor?this.copy(t):"number"==typeof t?this.setHex(t):"string"==typeof t&&this.setStyle(t),this},e.setScalar=function(t){return this.r=t,this.g=t,this.b=t,this},e.setHex=function(t){return t=Math.floor(t),this.r=(t>>16&255)/255,this.g=(t>>8&255)/255,this.b=(255&t)/255,this},e.setRGB=function(t,e,n){return this.r=t,this.g=e,this.b=n,this},e.setHSL=function(t,e,n){if(t=mt.euclideanModulo(t,1),e=mt.clamp(e,0,1),n=mt.clamp(n,0,1),0===e)this.r=this.g=this.b=n;else{var r=n<=.5?n*(1+e):n+e-n*e,i=2*n-r;this.r=Je(i,r,t+1/3),this.g=Je(i,r,t),this.b=Je(i,r,t-1/3)}return this},e.setStyle=function(t){function e(e){void 0!==e&&parseFloat(e)<1&&console.warn("THREE.Color: Alpha component of "+t+" will be ignored.")}var n;if(n=/^((?:rgb|hsl)a?)\(([^\)]*)\)/.exec(t)){var r,i=n[1],a=n[2];switch(i){case"rgb":case"rgba":if(r=/^\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(a))return this.r=Math.min(255,parseInt(r[1],10))/255,this.g=Math.min(255,parseInt(r[2],10))/255,this.b=Math.min(255,parseInt(r[3],10))/255,e(r[4]),this;if(r=/^\s*(\d+)\%\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(a))return this.r=Math.min(100,parseInt(r[1],10))/100,this.g=Math.min(100,parseInt(r[2],10))/100,this.b=Math.min(100,parseInt(r[3],10))/100,e(r[4]),this;break;case"hsl":case"hsla":if(r=/^\s*(\d*\.?\d+)\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(a)){var o=parseFloat(r[1])/360,s=parseInt(r[2],10)/100,l=parseInt(r[3],10)/100;return e(r[4]),this.setHSL(o,s,l)}}}else if(n=/^\#([A-Fa-f\d]+)$/.exec(t)){var u=n[1],c=u.length;if(3===c)return this.r=parseInt(u.charAt(0)+u.charAt(0),16)/255,this.g=parseInt(u.charAt(1)+u.charAt(1),16)/255,this.b=parseInt(u.charAt(2)+u.charAt(2),16)/255,this;if(6===c)return this.r=parseInt(u.charAt(0)+u.charAt(1),16)/255,this.g=parseInt(u.charAt(2)+u.charAt(3),16)/255,this.b=parseInt(u.charAt(4)+u.charAt(5),16)/255,this}return t&&t.length>0?this.setColorName(t):this},e.setColorName=function(t){var e=Xe[t];return void 0!==e?this.setHex(e):console.warn("THREE.Color: Unknown color "+t),this},e.clone=function(){return new this.constructor(this.r,this.g,this.b)},e.copy=function(t){return this.r=t.r,this.g=t.g,this.b=t.b,this},e.copyGammaToLinear=function(t,e){return void 0===e&&(e=2),this.r=Math.pow(t.r,e),this.g=Math.pow(t.g,e),this.b=Math.pow(t.b,e),this},e.copyLinearToGamma=function(t,e){void 0===e&&(e=2);var n=e>0?1/e:1;return this.r=Math.pow(t.r,n),this.g=Math.pow(t.g,n),this.b=Math.pow(t.b,n),this},e.convertGammaToLinear=function(t){return this.copyGammaToLinear(this,t),this},e.convertLinearToGamma=function(t){return this.copyLinearToGamma(this,t),this},e.copySRGBToLinear=function(t){return this.r=Qe(t.r),this.g=Qe(t.g),this.b=Qe(t.b),this},e.copyLinearToSRGB=function(t){return this.r=Ke(t.r),this.g=Ke(t.g),this.b=Ke(t.b),this},e.convertSRGBToLinear=function(){return this.copySRGBToLinear(this),this},e.convertLinearToSRGB=function(){return this.copyLinearToSRGB(this),this},e.getHex=function(){return 255*this.r<<16^255*this.g<<8^255*this.b<<0},e.getHexString=function(){return("000000"+this.getHex().toString(16)).slice(-6)},e.getHSL=function(t){void 0===t&&(console.warn("THREE.Color: .getHSL() target is now required"),t={h:0,s:0,l:0});var e,n,r=this.r,i=this.g,a=this.b,o=Math.max(r,i,a),s=Math.min(r,i,a),l=(s+o)/2;if(s===o)e=0,n=0;else{var u=o-s;switch(n=l<=.5?u/(o+s):u/(2-o-s),o){case r:e=(i-a)/u+(ie&&(e=t[n]);return e}Object.defineProperty(rn.prototype,"needsUpdate",{set:function(t){!0===t&&this.version++}}),Object.assign(rn.prototype,{isBufferAttribute:!0,onUploadCallback:function(){},setUsage:function(t){return this.usage=t,this},copy:function(t){return this.name=t.name,this.array=new t.array.constructor(t.array),this.itemSize=t.itemSize,this.count=t.count,this.normalized=t.normalized,this.usage=t.usage,this},copyAt:function(t,e,n){t*=this.itemSize,n*=e.itemSize;for(var r=0,i=this.itemSize;r65535?hn:un)(t,1):this.index=t,this},getAttribute:function(t){return this.attributes[t]},setAttribute:function(t,e){return this.attributes[t]=e,this},deleteAttribute:function(t){return delete this.attributes[t],this},hasAttribute:function(t){return void 0!==this.attributes[t]},addGroup:function(t,e,n){void 0===n&&(n=0),this.groups.push({start:t,count:e,materialIndex:n})},clearGroups:function(){this.groups=[]},setDrawRange:function(t,e){this.drawRange.start=t,this.drawRange.count=e},applyMatrix4:function(t){var e=this.attributes.position;void 0!==e&&(e.applyMatrix4(t),e.needsUpdate=!0);var n=this.attributes.normal;if(void 0!==n){var r=(new yt).getNormalMatrix(t);n.applyNormalMatrix(r),n.needsUpdate=!0}var i=this.attributes.tangent;return void 0!==i&&(i.transformDirection(t),i.needsUpdate=!0),null!==this.boundingBox&&this.computeBoundingBox(),null!==this.boundingSphere&&this.computeBoundingSphere(),this},rotateX:function(t){return xn.makeRotationX(t),this.applyMatrix4(xn),this},rotateY:function(t){return xn.makeRotationY(t),this.applyMatrix4(xn),this},rotateZ:function(t){return xn.makeRotationZ(t),this.applyMatrix4(xn),this},translate:function(t,e,n){return xn.makeTranslation(t,e,n),this.applyMatrix4(xn),this},scale:function(t,e,n){return xn.makeScale(t,e,n),this.applyMatrix4(xn),this},lookAt:function(t){return _n.lookAt(t),_n.updateMatrix(),this.applyMatrix4(_n.matrix),this},center:function(){return this.computeBoundingBox(),this.boundingBox.getCenter(bn).negate(),this.translate(bn.x,bn.y,bn.z),this},setFromPoints:function(t){for(var e=[],n=0,r=t.length;n0&&(t.userData=this.userData),void 0!==this.parameters){var e=this.parameters;for(var n in e)void 0!==e[n]&&(t[n]=e[n]);return t}t.data={attributes:{}};var r=this.index;null!==r&&(t.data.index={type:r.array.constructor.name,array:Array.prototype.slice.call(r.array)});var i=this.attributes;for(var a in i){var o=i[a];t.data.attributes[a]=o.toJSON(t.data)}var s={},l=!1;for(var u in this.morphAttributes){for(var c=this.morphAttributes[u],h=[],d=0,p=c.length;d0&&(s[u]=h,l=!0)}l&&(t.data.morphAttributes=s,t.data.morphTargetsRelative=this.morphTargetsRelative);var m=this.groups;m.length>0&&(t.data.groups=JSON.parse(JSON.stringify(m)));var v=this.boundingSphere;return null!==v&&(t.data.boundingSphere={center:v.center.toArray(),radius:v.radius}),t},clone:function(){return(new Tn).copy(this)},copy:function(t){this.index=null,this.attributes={},this.morphAttributes={},this.groups=[],this.boundingBox=null,this.boundingSphere=null;var e={};this.name=t.name;var n=t.index;null!==n&&this.setIndex(n.clone(e));var r=t.attributes;for(var i in r){var a=r[i];this.setAttribute(i,a.clone(e))}var o=t.morphAttributes;for(var s in o){for(var l=[],u=o[s],c=0,h=u.length;cn.far?null:{distance:l,point:kn.clone(),object:t}}(t,e,n,r,Rn,Cn,Pn,Un);if(g){s&&(Fn.fromBufferAttribute(s,u),Hn.fromBufferAttribute(s,c),Gn.fromBufferAttribute(s,h),g.uv=We.getUV(Un,Rn,Cn,Pn,Fn,Hn,Gn,new vt)),l&&(Fn.fromBufferAttribute(l,u),Hn.fromBufferAttribute(l,c),Gn.fromBufferAttribute(l,h),g.uv2=We.getUV(Un,Rn,Cn,Pn,Fn,Hn,Gn,new vt));var y={a:u,b:c,c:h,normal:new At,materialIndex:0};We.getNormal(Rn,Cn,Pn,y.normal),g.face=y}return g}Vn.prototype=Object.assign(Object.create(Re.prototype),{constructor:Vn,isMesh:!0,copy:function(t){return Re.prototype.copy.call(this,t),void 0!==t.morphTargetInfluences&&(this.morphTargetInfluences=t.morphTargetInfluences.slice()),void 0!==t.morphTargetDictionary&&(this.morphTargetDictionary=Object.assign({},t.morphTargetDictionary)),this.material=t.material,this.geometry=t.geometry,this},updateMorphTargets:function(){var t=this.geometry;if(t.isBufferGeometry){var e=t.morphAttributes,n=Object.keys(e);if(n.length>0){var r=e[n[0]];if(void 0!==r){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(var i=0,a=r.length;i0&&console.error("THREE.Mesh.updateMorphTargets() no longer supports THREE.Geometry. Use THREE.BufferGeometry instead.")}},raycast:function(t,e){var n,r=this.geometry,i=this.material,a=this.matrixWorld;if(void 0!==i&&(null===r.boundingSphere&&r.computeBoundingSphere(),Ln.copy(r.boundingSphere),Ln.applyMatrix4(a),!1!==t.ray.intersectsSphere(Ln)&&(En.copy(a).invert(),An.copy(t.ray).applyMatrix4(En),null===r.boundingBox||!1!==An.intersectsBox(r.boundingBox))))if(r.isBufferGeometry){var o=r.index,s=r.attributes.position,l=r.morphAttributes.position,u=r.morphTargetsRelative,c=r.attributes.uv,h=r.attributes.uv2,d=r.groups,p=r.drawRange;if(null!==o)if(Array.isArray(i))for(var f=0,m=d.length;f0?1:-1,h.push(A.x,A.y,A.z),d.push(C/m),d.push(1-L/v),T+=1}for(var D=0;D0&&(e.defines=this.defines),e.vertexShader=this.vertexShader,e.fragmentShader=this.fragmentShader;var i={};for(var a in this.extensions)!0===this.extensions[a]&&(i[a]=!0);return Object.keys(i).length>0&&(e.extensions=i),e},Jn.prototype=Object.assign(Object.create(Re.prototype),{constructor:Jn,isCamera:!0,copy:function(t,e){return Re.prototype.copy.call(this,t,e),this.matrixWorldInverse.copy(t.matrixWorldInverse),this.projectionMatrix.copy(t.projectionMatrix),this.projectionMatrixInverse.copy(t.projectionMatrixInverse),this},getWorldDirection:function(t){void 0===t&&(console.warn("THREE.Camera: .getWorldDirection() target is now required"),t=new At),this.updateWorldMatrix(!0,!1);var e=this.matrixWorld.elements;return t.set(-e[8],-e[9],-e[10]).normalize()},updateMatrixWorld:function(t){Re.prototype.updateMatrixWorld.call(this,t),this.matrixWorldInverse.copy(this.matrixWorld).invert()},updateWorldMatrix:function(t,e){Re.prototype.updateWorldMatrix.call(this,t,e),this.matrixWorldInverse.copy(this.matrixWorld).invert()},clone:function(){return(new this.constructor).copy(this)}}),Qn.prototype=Object.assign(Object.create(Jn.prototype),{constructor:Qn,isPerspectiveCamera:!0,copy:function(t,e){return Jn.prototype.copy.call(this,t,e),this.fov=t.fov,this.zoom=t.zoom,this.near=t.near,this.far=t.far,this.focus=t.focus,this.aspect=t.aspect,this.view=null===t.view?null:Object.assign({},t.view),this.filmGauge=t.filmGauge,this.filmOffset=t.filmOffset,this},setFocalLength:function(t){var e=.5*this.getFilmHeight()/t;this.fov=2*mt.RAD2DEG*Math.atan(e),this.updateProjectionMatrix()},getFocalLength:function(){var t=Math.tan(.5*mt.DEG2RAD*this.fov);return.5*this.getFilmHeight()/t},getEffectiveFOV:function(){return 2*mt.RAD2DEG*Math.atan(Math.tan(.5*mt.DEG2RAD*this.fov)/this.zoom)},getFilmWidth:function(){return this.filmGauge*Math.min(this.aspect,1)},getFilmHeight:function(){return this.filmGauge/Math.max(this.aspect,1)},setViewOffset:function(t,e,n,r,i,a){this.aspect=t/e,null===this.view&&(this.view={enabled:!0,fullWidth:1,fullHeight:1,offsetX:0,offsetY:0,width:1,height:1}),this.view.enabled=!0,this.view.fullWidth=t,this.view.fullHeight=e,this.view.offsetX=n,this.view.offsetY=r,this.view.width=i,this.view.height=a,this.updateProjectionMatrix()},clearViewOffset:function(){null!==this.view&&(this.view.enabled=!1),this.updateProjectionMatrix()},updateProjectionMatrix:function(){var t=this.near,e=t*Math.tan(.5*mt.DEG2RAD*this.fov)/this.zoom,n=2*e,r=this.aspect*n,i=-.5*r,a=this.view;if(null!==this.view&&this.view.enabled){var o=a.fullWidth,s=a.fullHeight;i+=a.offsetX*r/o,e-=a.offsetY*n/s,r*=a.width/o,n*=a.height/s}var l=this.filmOffset;0!==l&&(i+=t*l/this.getFilmWidth()),this.projectionMatrix.makePerspective(i,i+r,e,e-n,t,this.far),this.projectionMatrixInverse.copy(this.projectionMatrix).invert()},toJSON:function(t){var e=Re.prototype.toJSON.call(this,t);return e.object.fov=this.fov,e.object.zoom=this.zoom,e.object.near=this.near,e.object.far=this.far,e.object.focus=this.focus,e.object.aspect=this.aspect,null!==this.view&&(e.object.view=Object.assign({},this.view)),e.object.filmGauge=this.filmGauge,e.object.filmOffset=this.filmOffset,e}});var Kn=90,$n=function(t){function e(e,n,r){var i;if((i=t.call(this)||this).type="CubeCamera",!0!==r.isWebGLCubeRenderTarget)return console.error("THREE.CubeCamera: The constructor now expects an instance of WebGLCubeRenderTarget as third parameter."),lt(i);i.renderTarget=r;var a=new Qn(Kn,1,e,n);a.layers=i.layers,a.up.set(0,-1,0),a.lookAt(new At(1,0,0)),i.add(a);var o=new Qn(Kn,1,e,n);o.layers=i.layers,o.up.set(0,-1,0),o.lookAt(new At(-1,0,0)),i.add(o);var s=new Qn(Kn,1,e,n);s.layers=i.layers,s.up.set(0,0,1),s.lookAt(new At(0,1,0)),i.add(s);var l=new Qn(Kn,1,e,n);l.layers=i.layers,l.up.set(0,0,-1),l.lookAt(new At(0,-1,0)),i.add(l);var u=new Qn(Kn,1,e,n);u.layers=i.layers,u.up.set(0,-1,0),u.lookAt(new At(0,0,1)),i.add(u);var c=new Qn(Kn,1,e,n);return c.layers=i.layers,c.up.set(0,-1,0),c.lookAt(new At(0,0,-1)),i.add(c),i}return st(e,t),e.prototype.update=function(t,e){null===this.parent&&this.updateMatrixWorld();var n=this.renderTarget,r=this.children,i=r[0],a=r[1],o=r[2],s=r[3],l=r[4],u=r[5],c=t.xr.enabled,h=t.getRenderTarget();t.xr.enabled=!1;var d=n.texture.generateMipmaps;n.texture.generateMipmaps=!1,t.setRenderTarget(n,0),t.render(e,i),t.setRenderTarget(n,1),t.render(e,a),t.setRenderTarget(n,2),t.render(e,o),t.setRenderTarget(n,3),t.render(e,s),t.setRenderTarget(n,4),t.render(e,l),n.texture.generateMipmaps=d,t.setRenderTarget(n,5),t.render(e,u),t.setRenderTarget(h),t.xr.enabled=c},e}(Re),tr=function(t){function e(e,n,r,a,o,s,l,u,c,h){var d;return e=void 0!==e?e:[],n=void 0!==n?n:i,l=void 0!==l?l:T,(d=t.call(this,e,n,r,a,o,s,l,u,c,h)||this)._needsFlipEnvMap=!0,d.flipY=!1,d}return st(e,t),ot(e,[{key:"images",get:function(){return this.image},set:function(t){this.image=t}}]),e}(bt);tr.prototype.isCubeTexture=!0;var er=function(t){function e(e,n,r){var i;return Number.isInteger(n)&&(console.warn("THREE.WebGLCubeRenderTarget: constructor signature is now WebGLCubeRenderTarget( size, options )"),n=r),i=t.call(this,e,e,n)||this,n=n||{},i.texture=new tr(void 0,n.mapping,n.wrapS,n.wrapT,n.magFilter,n.minFilter,n.format,n.type,n.anisotropy,n.encoding),i.texture.generateMipmaps=void 0!==n.generateMipmaps&&n.generateMipmaps,i.texture.minFilter=void 0!==n.minFilter?n.minFilter:v,i.texture._needsFlipEnvMap=!1,i}st(e,t);var n=e.prototype;return n.fromEquirectangularTexture=function(t,e){this.texture.type=e.type,this.texture.format=E,this.texture.encoding=e.encoding,this.texture.generateMipmaps=e.generateMipmaps,this.texture.minFilter=e.minFilter,this.texture.magFilter=e.magFilter;var n={tEquirect:{value:null}},r="\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",i="\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",a=new jn(5,5,5),o=new Zn({name:"CubemapFromEquirect",uniforms:qn(n),vertexShader:r,fragmentShader:i,side:1,blending:0});o.uniforms.tEquirect.value=e;var s=new Vn(a,o),l=e.minFilter;return e.minFilter===y&&(e.minFilter=v),new $n(1,10,this).update(t,s),e.minFilter=l,s.geometry.dispose(),s.material.dispose(),this},n.clear=function(t,e,n,r){for(var i=t.getRenderTarget(),a=0;a<6;a++)t.setRenderTarget(this,a),t.clear(e,n,r);t.setRenderTarget(i)},e}(St);er.prototype.isWebGLCubeRenderTarget=!0;var nr=function(t){function e(e,n,r,i,a,o,s,l,u,c,h,d){var f;return(f=t.call(this,null,o,s,l,u,c,i,a,h,d)||this).image={data:e||null,width:n||1,height:r||1},f.magFilter=void 0!==u?u:p,f.minFilter=void 0!==c?c:p,f.generateMipmaps=!1,f.flipY=!1,f.unpackAlignment=1,f.needsUpdate=!0,f}return st(e,t),e}(bt);nr.prototype.isDataTexture=!0;var rr=new Zt,ir=new At,ar=function(){function t(t,e,n,r,i,a){void 0===t&&(t=new Ie),void 0===e&&(e=new Ie),void 0===n&&(n=new Ie),void 0===r&&(r=new Ie),void 0===i&&(i=new Ie),void 0===a&&(a=new Ie),this.planes=[t,e,n,r,i,a]}var e=t.prototype;return e.set=function(t,e,n,r,i,a){var o=this.planes;return o[0].copy(t),o[1].copy(e),o[2].copy(n),o[3].copy(r),o[4].copy(i),o[5].copy(a),this},e.copy=function(t){for(var e=this.planes,n=0;n<6;n++)e[n].copy(t.planes[n]);return this},e.setFromProjectionMatrix=function(t){var e=this.planes,n=t.elements,r=n[0],i=n[1],a=n[2],o=n[3],s=n[4],l=n[5],u=n[6],c=n[7],h=n[8],d=n[9],p=n[10],f=n[11],m=n[12],v=n[13],g=n[14],y=n[15];return e[0].setComponents(o-r,c-s,f-h,y-m).normalize(),e[1].setComponents(o+r,c+s,f+h,y+m).normalize(),e[2].setComponents(o+i,c+l,f+d,y+v).normalize(),e[3].setComponents(o-i,c-l,f-d,y-v).normalize(),e[4].setComponents(o-a,c-u,f-p,y-g).normalize(),e[5].setComponents(o+a,c+u,f+p,y+g).normalize(),this},e.intersectsObject=function(t){if(void 0!==t.boundingSphere)null===t.boundingSphere&&t.computeBoundingSphere(),rr.copy(t.boundingSphere).applyMatrix4(t.matrixWorld);else{var e=t.geometry;null===e.boundingSphere&&e.computeBoundingSphere(),rr.copy(e.boundingSphere).applyMatrix4(t.matrixWorld)}return this.intersectsSphere(rr)},e.intersectsSprite=function(t){return rr.center.set(0,0,0),rr.radius=.7071067811865476,rr.applyMatrix4(t.matrixWorld),this.intersectsSphere(rr)},e.intersectsSphere=function(t){for(var e=this.planes,n=t.center,r=-t.radius,i=0;i<6;i++){if(e[i].distanceToPoint(n)0?t.max.x:t.min.x,ir.y=r.normal.y>0?t.max.y:t.min.y,ir.z=r.normal.z>0?t.max.z:t.min.z,r.distanceToPoint(ir)<0)return!1}return!0},e.containsPoint=function(t){for(var e=this.planes,n=0;n<6;n++)if(e[n].distanceToPoint(t)<0)return!1;return!0},e.clone=function(){return(new this.constructor).copy(this)},t}();function or(){var t=null,e=!1,n=null,r=null;function i(e,a){n(e,a),r=t.requestAnimationFrame(i)}return{start:function(){!0!==e&&null!==n&&(r=t.requestAnimationFrame(i),e=!0)},stop:function(){t.cancelAnimationFrame(r),e=!1},setAnimationLoop:function(t){n=t},setContext:function(e){t=e}}}function sr(t,e){var n=e.isWebGL2,r=new WeakMap;return{get:function(t){return t.isInterleavedBufferAttribute&&(t=t.data),r.get(t)},remove:function(e){e.isInterleavedBufferAttribute&&(e=e.data);var n=r.get(e);n&&(t.deleteBuffer(n.buffer),r.delete(e))},update:function(e,i){if(e.isGLBufferAttribute){var a=r.get(e);(!a||a.version 0.0 ) {\n\t\tdistanceFalloff *= pow2( saturate( 1.0 - pow4( lightDistance / cutoffDistance ) ) );\n\t}\n\treturn distanceFalloff;\n#else\n\tif( cutoffDistance > 0.0 && decayExponent > 0.0 ) {\n\t\treturn pow( saturate( -lightDistance / cutoffDistance + 1.0 ), decayExponent );\n\t}\n\treturn 1.0;\n#endif\n}\nvec3 BRDF_Diffuse_Lambert( const in vec3 diffuseColor ) {\n\treturn RECIPROCAL_PI * diffuseColor;\n}\nvec3 F_Schlick( const in vec3 specularColor, const in float dotLH ) {\n\tfloat fresnel = exp2( ( -5.55473 * dotLH - 6.98316 ) * dotLH );\n\treturn ( 1.0 - specularColor ) * fresnel + specularColor;\n}\nvec3 F_Schlick_RoughnessDependent( const in vec3 F0, const in float dotNV, const in float roughness ) {\n\tfloat fresnel = exp2( ( -5.55473 * dotNV - 6.98316 ) * dotNV );\n\tvec3 Fr = max( vec3( 1.0 - roughness ), F0 ) - F0;\n\treturn Fr * fresnel + F0;\n}\nfloat G_GGX_Smith( const in float alpha, const in float dotNL, const in float dotNV ) {\n\tfloat a2 = pow2( alpha );\n\tfloat gl = dotNL + sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNL ) );\n\tfloat gv = dotNV + sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNV ) );\n\treturn 1.0 / ( gl * gv );\n}\nfloat G_GGX_SmithCorrelated( const in float alpha, const in float dotNL, const in float dotNV ) {\n\tfloat a2 = pow2( alpha );\n\tfloat gv = dotNL * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNV ) );\n\tfloat gl = dotNV * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNL ) );\n\treturn 0.5 / max( gv + gl, EPSILON );\n}\nfloat D_GGX( const in float alpha, const in float dotNH ) {\n\tfloat a2 = pow2( alpha );\n\tfloat denom = pow2( dotNH ) * ( a2 - 1.0 ) + 1.0;\n\treturn RECIPROCAL_PI * a2 / pow2( denom );\n}\nvec3 BRDF_Specular_GGX( const in IncidentLight incidentLight, const in vec3 viewDir, const in vec3 normal, const in vec3 specularColor, const in float roughness ) {\n\tfloat alpha = pow2( roughness );\n\tvec3 halfDir = normalize( incidentLight.direction + viewDir );\n\tfloat dotNL = saturate( dot( normal, incidentLight.direction ) );\n\tfloat dotNV = saturate( dot( normal, viewDir ) );\n\tfloat dotNH = saturate( dot( normal, halfDir ) );\n\tfloat dotLH = saturate( dot( incidentLight.direction, halfDir ) );\n\tvec3 F = F_Schlick( specularColor, dotLH );\n\tfloat G = G_GGX_SmithCorrelated( alpha, dotNL, dotNV );\n\tfloat D = D_GGX( alpha, dotNH );\n\treturn F * ( G * D );\n}\nvec2 LTC_Uv( const in vec3 N, const in vec3 V, const in float roughness ) {\n\tconst float LUT_SIZE = 64.0;\n\tconst float LUT_SCALE = ( LUT_SIZE - 1.0 ) / LUT_SIZE;\n\tconst float LUT_BIAS = 0.5 / LUT_SIZE;\n\tfloat dotNV = saturate( dot( N, V ) );\n\tvec2 uv = vec2( roughness, sqrt( 1.0 - dotNV ) );\n\tuv = uv * LUT_SCALE + LUT_BIAS;\n\treturn uv;\n}\nfloat LTC_ClippedSphereFormFactor( const in vec3 f ) {\n\tfloat l = length( f );\n\treturn max( ( l * l + f.z ) / ( l + 1.0 ), 0.0 );\n}\nvec3 LTC_EdgeVectorFormFactor( const in vec3 v1, const in vec3 v2 ) {\n\tfloat x = dot( v1, v2 );\n\tfloat y = abs( x );\n\tfloat a = 0.8543985 + ( 0.4965155 + 0.0145206 * y ) * y;\n\tfloat b = 3.4175940 + ( 4.1616724 + y ) * y;\n\tfloat v = a / b;\n\tfloat theta_sintheta = ( x > 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}\nvec3 BRDF_Specular_GGX_Environment( const in vec3 viewDir, const in vec3 normal, const in vec3 specularColor, const in float roughness ) {\n\tfloat dotNV = saturate( dot( normal, viewDir ) );\n\tvec2 brdf = integrateSpecularBRDF( dotNV, roughness );\n\treturn specularColor * brdf.x + brdf.y;\n}\nvoid BRDF_Specular_Multiscattering_Environment( const in GeometricContext geometry, const in vec3 specularColor, const in float roughness, inout vec3 singleScatter, inout vec3 multiScatter ) {\n\tfloat dotNV = saturate( dot( geometry.normal, geometry.viewDir ) );\n\tvec3 F = F_Schlick_RoughnessDependent( specularColor, dotNV, roughness );\n\tvec2 brdf = integrateSpecularBRDF( dotNV, roughness );\n\tvec3 FssEss = F * brdf.x + brdf.y;\n\tfloat Ess = brdf.x + brdf.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}\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_Specular_BlinnPhong( const in IncidentLight incidentLight, const in GeometricContext geometry, const in vec3 specularColor, const in float shininess ) {\n\tvec3 halfDir = normalize( incidentLight.direction + geometry.viewDir );\n\tfloat dotNH = saturate( dot( geometry.normal, halfDir ) );\n\tfloat dotLH = saturate( dot( incidentLight.direction, halfDir ) );\n\tvec3 F = F_Schlick( specularColor, dotLH );\n\tfloat G = G_BlinnPhong_Implicit( );\n\tfloat D = D_BlinnPhong( shininess, dotNH );\n\treturn F * ( G * D );\n}\nfloat GGXRoughnessToBlinnExponent( const in float ggxRoughness ) {\n\treturn ( 2.0 / pow2( ggxRoughness + 0.0001 ) - 2.0 );\n}\nfloat BlinnExponentToGGXRoughness( const in float blinnExponent ) {\n\treturn sqrt( 2.0 / ( blinnExponent + 2.0 ) );\n}\n#if defined( USE_SHEEN )\nfloat D_Charlie(float roughness, float NoH) {\n\tfloat invAlpha = 1.0 / roughness;\n\tfloat cos2h = NoH * NoH;\n\tfloat sin2h = max(1.0 - cos2h, 0.0078125);\treturn (2.0 + invAlpha) * pow(sin2h, invAlpha * 0.5) / (2.0 * PI);\n}\nfloat V_Neubelt(float NoV, float NoL) {\n\treturn saturate(1.0 / (4.0 * (NoL + NoV - NoL * NoV)));\n}\nvec3 BRDF_Specular_Sheen( const in float roughness, const in vec3 L, const in GeometricContext geometry, vec3 specularColor ) {\n\tvec3 N = geometry.normal;\n\tvec3 V = geometry.viewDir;\n\tvec3 H = normalize( V + L );\n\tfloat dotNH = saturate( dot( N, H ) );\n\treturn specularColor * D_Charlie( roughness, dotNH ) * V_Neubelt( dot(N, V), dot(N, L) );\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:"#ifdef USE_COLOR\n\tdiffuseColor.rgb *= vColor;\n#endif",color_pars_fragment:"#ifdef USE_COLOR\n\tvarying vec3 vColor;\n#endif",color_pars_vertex:"#if defined( USE_COLOR ) || defined( USE_INSTANCING_COLOR )\n\tvarying vec3 vColor;\n#endif",color_vertex:"#if defined( USE_COLOR ) || defined( USE_INSTANCING_COLOR )\n\tvColor = vec3( 1.0 );\n#endif\n#ifdef USE_COLOR\n\tvColor.xyz *= color.xyz;\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 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 max3( vec3 v ) { return max( max( v.x, v.y ), v.z ); }\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 normal;\n\tvec3 viewDir;\n#ifdef CLEARCOAT\n\tvec3 clearcoatNormal;\n#endif\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}\nvec3 projectOnPlane(in vec3 point, in vec3 pointOnPlane, in vec3 planeNormal ) {\n\tfloat distance = dot( planeNormal, point - pointOnPlane );\n\treturn - distance * planeNormal + point;\n}\nfloat sideOfPlane( in vec3 point, in vec3 pointOnPlane, in vec3 planeNormal ) {\n\treturn sign( dot( point - pointOnPlane, planeNormal ) );\n}\nvec3 linePlaneIntersect( in vec3 pointOnLine, in vec3 lineDirection, in vec3 pointOnPlane, in vec3 planeNormal ) {\n\treturn lineDirection * ( dot( planeNormal, pointOnPlane - pointOnLine ) / dot( planeNormal, lineDirection ) ) + pointOnLine;\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 = vec2( - direction.x, direction.y ) / 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 = vec2( - direction.x, direction.z ) / 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:"\nvec4 LinearToLinear( in vec4 value ) {\n\treturn value;\n}\nvec4 GammaToLinear( in vec4 value, in float gammaFactor ) {\n\treturn vec4( pow( value.rgb, vec3( gammaFactor ) ), value.a );\n}\nvec4 LinearToGamma( in vec4 value, in float gammaFactor ) {\n\treturn vec4( pow( value.rgb, vec3( 1.0 / gammaFactor ) ), value.a );\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}\nvec4 RGBMToLinear( in vec4 value, in float maxRange ) {\n\treturn vec4( value.rgb * value.a * maxRange, 1.0 );\n}\nvec4 LinearToRGBM( in vec4 value, in float maxRange ) {\n\tfloat maxRGB = max( value.r, max( value.g, value.b ) );\n\tfloat M = clamp( maxRGB / maxRange, 0.0, 1.0 );\n\tM = ceil( M * 255.0 ) / 255.0;\n\treturn vec4( value.rgb / ( M * maxRange ), M );\n}\nvec4 RGBDToLinear( in vec4 value, in float maxRange ) {\n\treturn vec4( value.rgb * ( ( maxRange / 255.0 ) / value.a ), 1.0 );\n}\nvec4 LinearToRGBD( in vec4 value, in float maxRange ) {\n\tfloat maxRGB = max( value.r, max( value.g, value.b ) );\n\tfloat D = max( maxRange / maxRGB, 1.0 );\n\tD = clamp( floor( D ) / 255.0, 0.0, 1.0 );\n\treturn vec4( value.rgb * ( D * ( 255.0 / maxRange ) ), D );\n}\nconst mat3 cLogLuvM = mat3( 0.2209, 0.3390, 0.4184, 0.1138, 0.6780, 0.7319, 0.0102, 0.1130, 0.2969 );\nvec4 LinearToLogLuv( in vec4 value ) {\n\tvec3 Xp_Y_XYZp = cLogLuvM * value.rgb;\n\tXp_Y_XYZp = max( Xp_Y_XYZp, vec3( 1e-6, 1e-6, 1e-6 ) );\n\tvec4 vResult;\n\tvResult.xy = Xp_Y_XYZp.xy / Xp_Y_XYZp.z;\n\tfloat Le = 2.0 * log2(Xp_Y_XYZp.y) + 127.0;\n\tvResult.w = fract( Le );\n\tvResult.z = ( Le - ( floor( vResult.w * 255.0 ) ) / 255.0 ) / 255.0;\n\treturn vResult;\n}\nconst mat3 cLogLuvInverseM = mat3( 6.0014, -2.7008, -1.7996, -1.3320, 3.1029, -5.7721, 0.3008, -1.0882, 5.6268 );\nvec4 LogLuvToLinear( in vec4 value ) {\n\tfloat Le = value.z * 255.0 + value.w;\n\tvec3 Xp_Y_XYZp;\n\tXp_Y_XYZp.y = exp2( ( Le - 127.0 ) / 2.0 );\n\tXp_Y_XYZp.z = Xp_Y_XYZp.y / value.y;\n\tXp_Y_XYZp.x = value.x * Xp_Y_XYZp.z;\n\tvec3 vRGB = cLogLuvInverseM * Xp_Y_XYZp.rgb;\n\treturn vec4( max( vRGB, 0.0 ), 1.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#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#ifndef ENVMAP_TYPE_CUBE_UV\n\t\tenvColor = envMapTexelToLinear( envColor );\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\tuniform int maxMipLevel;\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\t#ifdef ENVMAP_MODE_REFRACTION\n\t\tuniform float refractionRatio;\n\t#endif\n\tvec3 getLightProbeIndirectIrradiance( const in GeometricContext geometry, const in int maxMIPLevel ) {\n\t\tvec3 worldNormal = inverseTransformDirection( geometry.normal, viewMatrix );\n\t\t#ifdef ENVMAP_TYPE_CUBE\n\t\t\tvec3 queryVec = vec3( flipEnvMap * worldNormal.x, worldNormal.yz );\n\t\t\t#ifdef TEXTURE_LOD_EXT\n\t\t\t\tvec4 envMapColor = textureCubeLodEXT( envMap, queryVec, float( maxMIPLevel ) );\n\t\t\t#else\n\t\t\t\tvec4 envMapColor = textureCube( envMap, queryVec, float( maxMIPLevel ) );\n\t\t\t#endif\n\t\t\tenvMapColor.rgb = envMapTexelToLinear( envMapColor ).rgb;\n\t\t#elif defined( ENVMAP_TYPE_CUBE_UV )\n\t\t\tvec4 envMapColor = textureCubeUV( envMap, worldNormal, 1.0 );\n\t\t#else\n\t\t\tvec4 envMapColor = vec4( 0.0 );\n\t\t#endif\n\t\treturn PI * envMapColor.rgb * envMapIntensity;\n\t}\n\tfloat getSpecularMIPLevel( const in float roughness, const in int maxMIPLevel ) {\n\t\tfloat maxMIPLevelScalar = float( maxMIPLevel );\n\t\tfloat sigma = PI * roughness * roughness / ( 1.0 + roughness );\n\t\tfloat desiredMIPLevel = maxMIPLevelScalar + log2( sigma );\n\t\treturn clamp( desiredMIPLevel, 0.0, maxMIPLevelScalar );\n\t}\n\tvec3 getLightProbeIndirectRadiance( const in vec3 viewDir, const in vec3 normal, const in float roughness, const in int maxMIPLevel ) {\n\t\t#ifdef ENVMAP_MODE_REFLECTION\n\t\t\tvec3 reflectVec = reflect( -viewDir, normal );\n\t\t\treflectVec = normalize( mix( reflectVec, normal, roughness * roughness) );\n\t\t#else\n\t\t\tvec3 reflectVec = refract( -viewDir, normal, refractionRatio );\n\t\t#endif\n\t\treflectVec = inverseTransformDirection( reflectVec, viewMatrix );\n\t\tfloat specularMIPLevel = getSpecularMIPLevel( roughness, maxMIPLevel );\n\t\t#ifdef ENVMAP_TYPE_CUBE\n\t\t\tvec3 queryReflectVec = vec3( flipEnvMap * reflectVec.x, reflectVec.yz );\n\t\t\t#ifdef TEXTURE_LOD_EXT\n\t\t\t\tvec4 envMapColor = textureCubeLodEXT( envMap, queryReflectVec, specularMIPLevel );\n\t\t\t#else\n\t\t\t\tvec4 envMapColor = textureCube( envMap, queryReflectVec, specularMIPLevel );\n\t\t\t#endif\n\t\t\tenvMapColor.rgb = envMapTexelToLinear( envMapColor ).rgb;\n\t\t#elif defined( ENVMAP_TYPE_CUBE_UV )\n\t\t\tvec4 envMapColor = textureCubeUV( envMap, reflectVec, roughness );\n\t\t#endif\n\t\treturn envMapColor.rgb * envMapIntensity;\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\tfogDepth = - mvPosition.z;\n#endif",fog_pars_vertex:"#ifdef USE_FOG\n\tvarying float fogDepth;\n#endif",fog_fragment:"#ifdef USE_FOG\n\t#ifdef FOG_EXP2\n\t\tfloat fogFactor = 1.0 - exp( - fogDensity * fogDensity * fogDepth * fogDepth );\n\t#else\n\t\tfloat fogFactor = smoothstep( fogNear, fogFar, fogDepth );\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 fogDepth;\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 texture2D( gradientMap, coord ).rgb;\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\treflectedLight.indirectDiffuse += PI * lightMapTexelToLinear( lightMapTexel ).rgb * lightMapIntensity;\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.normal = normalize( transformedNormal );\ngeometry.viewDir = ( isOrthographic ) ? vec3( 0, 0, 1 ) : normalize( -mvPosition.xyz );\nGeometricContext backGeometry;\nbackGeometry.position = geometry.position;\nbackGeometry.normal = -geometry.normal;\nbackGeometry.viewDir = geometry.viewDir;\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, geometry );\n#ifdef DOUBLE_SIDED\n\tvIndirectBack += getAmbientLightIrradiance( ambientLightColor );\n\tvIndirectBack += getLightProbeIrradiance( lightProbe, backGeometry );\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\tgetPointDirectLightIrradiance( pointLights[ i ], geometry, directLight );\n\t\tdotNL = dot( geometry.normal, directLight.direction );\n\t\tdirectLightColor_Diffuse = PI * 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\tgetSpotDirectLightIrradiance( spotLights[ i ], geometry, directLight );\n\t\tdotNL = dot( geometry.normal, directLight.direction );\n\t\tdirectLightColor_Diffuse = PI * 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\tgetDirectionalDirectLightIrradiance( directionalLights[ i ], geometry, directLight );\n\t\tdotNL = dot( geometry.normal, directLight.direction );\n\t\tdirectLightColor_Diffuse = PI * 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 ], geometry );\n\t\t#ifdef DOUBLE_SIDED\n\t\t\tvIndirectBack += getHemisphereLightIrradiance( hemisphereLights[ i ], backGeometry );\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 GeometricContext geometry ) {\n\tvec3 worldNormal = inverseTransformDirection( geometry.normal, viewMatrix );\n\tvec3 irradiance = shGetIrradianceAt( worldNormal, lightProbe );\n\treturn irradiance;\n}\nvec3 getAmbientLightIrradiance( const in vec3 ambientLightColor ) {\n\tvec3 irradiance = ambientLightColor;\n\t#ifndef PHYSICALLY_CORRECT_LIGHTS\n\t\tirradiance *= PI;\n\t#endif\n\treturn irradiance;\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 getDirectionalDirectLightIrradiance( const in DirectionalLight directionalLight, const in GeometricContext geometry, out IncidentLight directLight ) {\n\t\tdirectLight.color = directionalLight.color;\n\t\tdirectLight.direction = directionalLight.direction;\n\t\tdirectLight.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 getPointDirectLightIrradiance( const in PointLight pointLight, const in GeometricContext geometry, out IncidentLight directLight ) {\n\t\tvec3 lVector = pointLight.position - geometry.position;\n\t\tdirectLight.direction = normalize( lVector );\n\t\tfloat lightDistance = length( lVector );\n\t\tdirectLight.color = pointLight.color;\n\t\tdirectLight.color *= punctualLightIntensityToIrradianceFactor( lightDistance, pointLight.distance, pointLight.decay );\n\t\tdirectLight.visible = ( directLight.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 getSpotDirectLightIrradiance( const in SpotLight spotLight, const in GeometricContext geometry, out IncidentLight directLight ) {\n\t\tvec3 lVector = spotLight.position - geometry.position;\n\t\tdirectLight.direction = normalize( lVector );\n\t\tfloat lightDistance = length( lVector );\n\t\tfloat angleCos = dot( directLight.direction, spotLight.direction );\n\t\tif ( angleCos > spotLight.coneCos ) {\n\t\t\tfloat spotEffect = smoothstep( spotLight.coneCos, spotLight.penumbraCos, angleCos );\n\t\t\tdirectLight.color = spotLight.color;\n\t\t\tdirectLight.color *= spotEffect * punctualLightIntensityToIrradianceFactor( lightDistance, spotLight.distance, spotLight.decay );\n\t\t\tdirectLight.visible = true;\n\t\t} else {\n\t\t\tdirectLight.color = vec3( 0.0 );\n\t\t\tdirectLight.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 GeometricContext geometry ) {\n\t\tfloat dotNL = dot( geometry.normal, hemiLight.direction );\n\t\tfloat hemiDiffuseWeight = 0.5 * dotNL + 0.5;\n\t\tvec3 irradiance = mix( hemiLight.groundColor, hemiLight.skyColor, hemiDiffuseWeight );\n\t\t#ifndef PHYSICALLY_CORRECT_LIGHTS\n\t\t\tirradiance *= PI;\n\t\t#endif\n\t\treturn irradiance;\n\t}\n#endif",lights_toon_fragment:"ToonMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb;",lights_toon_pars_fragment:"varying vec3 vViewPosition;\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n#endif\nstruct ToonMaterial {\n\tvec3 diffuseColor;\n};\nvoid RE_Direct_Toon( const in IncidentLight directLight, const in GeometricContext geometry, const in ToonMaterial material, inout ReflectedLight reflectedLight ) {\n\tvec3 irradiance = getGradientIrradiance( geometry.normal, directLight.direction ) * directLight.color;\n\t#ifndef PHYSICALLY_CORRECT_LIGHTS\n\t\tirradiance *= PI;\n\t#endif\n\treflectedLight.directDiffuse += irradiance * BRDF_Diffuse_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_Diffuse_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;\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n#endif\nstruct BlinnPhongMaterial {\n\tvec3 diffuseColor;\n\tvec3 specularColor;\n\tfloat specularShininess;\n\tfloat specularStrength;\n};\nvoid RE_Direct_BlinnPhong( const in IncidentLight directLight, const in GeometricContext geometry, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight ) {\n\tfloat dotNL = saturate( dot( geometry.normal, directLight.direction ) );\n\tvec3 irradiance = dotNL * directLight.color;\n\t#ifndef PHYSICALLY_CORRECT_LIGHTS\n\t\tirradiance *= PI;\n\t#endif\n\treflectedLight.directDiffuse += irradiance * BRDF_Diffuse_Lambert( material.diffuseColor );\n\treflectedLight.directSpecular += irradiance * BRDF_Specular_BlinnPhong( directLight, geometry, 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_Diffuse_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.specularRoughness = max( roughnessFactor, 0.0525 );material.specularRoughness += geometryRoughness;\nmaterial.specularRoughness = min( material.specularRoughness, 1.0 );\n#ifdef REFLECTIVITY\n\tmaterial.specularColor = mix( vec3( MAXIMUM_SPECULAR_COEFFICIENT * pow2( reflectivity ) ), diffuseColor.rgb, metalnessFactor );\n#else\n\tmaterial.specularColor = mix( vec3( DEFAULT_SPECULAR_COEFFICIENT ), diffuseColor.rgb, metalnessFactor );\n#endif\n#ifdef CLEARCOAT\n\tmaterial.clearcoat = clearcoat;\n\tmaterial.clearcoatRoughness = clearcoatRoughness;\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 = sheen;\n#endif",lights_physical_pars_fragment:"struct PhysicalMaterial {\n\tvec3 diffuseColor;\n\tfloat specularRoughness;\n\tvec3 specularColor;\n#ifdef CLEARCOAT\n\tfloat clearcoat;\n\tfloat clearcoatRoughness;\n#endif\n#ifdef USE_SHEEN\n\tvec3 sheenColor;\n#endif\n};\n#define MAXIMUM_SPECULAR_COEFFICIENT 0.16\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}\n#if NUM_RECT_AREA_LIGHTS > 0\n\tvoid RE_Direct_RectArea_Physical( const in RectAreaLight rectAreaLight, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {\n\t\tvec3 normal = geometry.normal;\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.specularRoughness;\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\nvoid RE_Direct_Physical( const in IncidentLight directLight, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {\n\tfloat dotNL = saturate( dot( geometry.normal, directLight.direction ) );\n\tvec3 irradiance = dotNL * directLight.color;\n\t#ifndef PHYSICALLY_CORRECT_LIGHTS\n\t\tirradiance *= PI;\n\t#endif\n\t#ifdef CLEARCOAT\n\t\tfloat ccDotNL = saturate( dot( geometry.clearcoatNormal, directLight.direction ) );\n\t\tvec3 ccIrradiance = ccDotNL * directLight.color;\n\t\t#ifndef PHYSICALLY_CORRECT_LIGHTS\n\t\t\tccIrradiance *= PI;\n\t\t#endif\n\t\tfloat clearcoatDHR = material.clearcoat * clearcoatDHRApprox( material.clearcoatRoughness, ccDotNL );\n\t\treflectedLight.directSpecular += ccIrradiance * material.clearcoat * BRDF_Specular_GGX( directLight, geometry.viewDir, geometry.clearcoatNormal, vec3( DEFAULT_SPECULAR_COEFFICIENT ), material.clearcoatRoughness );\n\t#else\n\t\tfloat clearcoatDHR = 0.0;\n\t#endif\n\t#ifdef USE_SHEEN\n\t\treflectedLight.directSpecular += ( 1.0 - clearcoatDHR ) * irradiance * BRDF_Specular_Sheen(\n\t\t\tmaterial.specularRoughness,\n\t\t\tdirectLight.direction,\n\t\t\tgeometry,\n\t\t\tmaterial.sheenColor\n\t\t);\n\t#else\n\t\treflectedLight.directSpecular += ( 1.0 - clearcoatDHR ) * irradiance * BRDF_Specular_GGX( directLight, geometry.viewDir, geometry.normal, material.specularColor, material.specularRoughness);\n\t#endif\n\treflectedLight.directDiffuse += ( 1.0 - clearcoatDHR ) * irradiance * BRDF_Diffuse_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_Diffuse_Lambert( material.diffuseColor );\n}\nvoid RE_IndirectSpecular_Physical( const in vec3 radiance, const in vec3 irradiance, const in vec3 clearcoatRadiance, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight) {\n\t#ifdef CLEARCOAT\n\t\tfloat ccDotNV = saturate( dot( geometry.clearcoatNormal, geometry.viewDir ) );\n\t\treflectedLight.indirectSpecular += clearcoatRadiance * material.clearcoat * BRDF_Specular_GGX_Environment( geometry.viewDir, geometry.clearcoatNormal, vec3( DEFAULT_SPECULAR_COEFFICIENT ), material.clearcoatRoughness );\n\t\tfloat ccDotNL = ccDotNV;\n\t\tfloat clearcoatDHR = material.clearcoat * clearcoatDHRApprox( material.clearcoatRoughness, ccDotNL );\n\t#else\n\t\tfloat clearcoatDHR = 0.0;\n\t#endif\n\tfloat clearcoatInv = 1.0 - clearcoatDHR;\n\tvec3 singleScattering = vec3( 0.0 );\n\tvec3 multiScattering = vec3( 0.0 );\n\tvec3 cosineWeightedIrradiance = irradiance * RECIPROCAL_PI;\n\tBRDF_Specular_Multiscattering_Environment( geometry, material.specularColor, material.specularRoughness, 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}\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.normal = normal;\ngeometry.viewDir = ( isOrthographic ) ? vec3( 0, 0, 1 ) : normalize( vViewPosition );\n#ifdef CLEARCOAT\n\tgeometry.clearcoatNormal = 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\tgetPointDirectLightIrradiance( 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( directLight, geometry, material, reflectedLight );\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\tgetSpotDirectLightIrradiance( 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( directLight, geometry, material, reflectedLight );\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\tgetDirectionalDirectLightIrradiance( 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( directLight, geometry, material, reflectedLight );\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, 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, geometry );\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 ], geometry );\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#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 += getLightProbeIndirectIrradiance( geometry, maxMipLevel );\n\t#endif\n#endif\n#if defined( USE_ENVMAP ) && defined( RE_IndirectSpecular )\n\tradiance += getLightProbeIndirectRadiance( geometry.viewDir, geometry.normal, material.specularRoughness, maxMipLevel );\n\t#ifdef CLEARCOAT\n\t\tclearcoatRadiance += getLightProbeIndirectRadiance( geometry.viewDir, geometry.clearcoatNormal, material.clearcoatRoughness, maxMipLevel );\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( radiance, iblIrradiance, clearcoatRadiance, geometry, material, reflectedLight );\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\tobjectNormal += morphNormal0 * morphTargetInfluences[ 0 ];\n\tobjectNormal += morphNormal1 * morphTargetInfluences[ 1 ];\n\tobjectNormal += morphNormal2 * morphTargetInfluences[ 2 ];\n\tobjectNormal += morphNormal3 * morphTargetInfluences[ 3 ];\n#endif",morphtarget_pars_vertex:"#ifdef USE_MORPHTARGETS\n\tuniform float morphTargetBaseInfluence;\n\t#ifndef USE_MORPHNORMALS\n\t\tuniform float morphTargetInfluences[ 8 ];\n\t#else\n\t\tuniform float morphTargetInfluences[ 4 ];\n\t#endif\n#endif",morphtarget_vertex:"#ifdef USE_MORPHTARGETS\n\ttransformed *= morphTargetBaseInfluence;\n\ttransformed += morphTarget0 * morphTargetInfluences[ 0 ];\n\ttransformed += morphTarget1 * morphTargetInfluences[ 1 ];\n\ttransformed += morphTarget2 * morphTargetInfluences[ 2 ];\n\ttransformed += morphTarget3 * morphTargetInfluences[ 3 ];\n\t#ifndef USE_MORPHNORMALS\n\t\ttransformed += morphTarget4 * morphTargetInfluences[ 4 ];\n\t\ttransformed += morphTarget5 * morphTargetInfluences[ 5 ];\n\t\ttransformed += morphTarget6 * morphTargetInfluences[ 6 ];\n\t\ttransformed += morphTarget7 * morphTargetInfluences[ 7 ];\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\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",normalmap_pars_fragment:"#ifdef USE_NORMALMAP\n\tuniform sampler2D normalMap;\n\tuniform vec2 normalScale;\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\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}\n#endif",clearcoat_normal_fragment_begin:"#ifdef 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",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 ) { return color; }",transmissionmap_fragment:"#ifdef USE_TRANSMISSIONMAP\n\ttotalTransmission *= texture2D( transmissionMap, vUv ).r;\n#endif",transmissionmap_pars_fragment:"#ifdef USE_TRANSMISSIONMAP\n\tuniform sampler2D transmissionMap;\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 )\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_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}",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}",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}",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}",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 \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}",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}",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 \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}",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}",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}",equirect_vert:"varying vec3 vWorldDirection;\n#include \nvoid main() {\n\tvWorldDirection = transformDirection( position, modelMatrix );\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\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\n\t#include \n\t#include \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}",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 \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\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\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\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#include \n\t#ifdef USE_ENVMAP\n\t#include \n\t#include \n\t#include \n\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}",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 \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_Diffuse_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_Diffuse_Lambert( diffuseColor.rgb ) * getShadowMask();\n\t#include \n\tvec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance;\n\t#include \n\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\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}",meshmatcap_frag:"#define MATCAP\nuniform vec3 diffuse;\nuniform float opacity;\nuniform sampler2D matcap;\nvarying vec3 vViewPosition;\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 \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 USE_MATCAP\n\t\tvec4 matcapColor = texture2D( matcap, uv );\n\t\tmatcapColor = matcapTexelToLinear( matcapColor );\n\t#else\n\t\tvec4 matcapColor = vec4( 1.0 );\n\t#endif\n\tvec3 outgoingLight = diffuseColor.rgb * matcapColor.rgb;\n\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n}",meshmatcap_vert:"#define MATCAP\nvarying vec3 vViewPosition;\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 \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#ifndef FLAT_SHADED\n\t\tvNormal = normalize( transformedNormal );\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\tvViewPosition = - mvPosition.xyz;\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 \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\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n}",meshtoon_vert:"#define TOON\nvarying vec3 vViewPosition;\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 \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#ifndef FLAT_SHADED\n\tvNormal = normalize( transformedNormal );\n#endif\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}",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 \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\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n}",meshphong_vert:"#define PHONG\nvarying vec3 vViewPosition;\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 \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#ifndef FLAT_SHADED\n\tvNormal = normalize( transformedNormal );\n#endif\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}",meshphysical_frag:"#define STANDARD\n#ifdef PHYSICAL\n\t#define REFLECTIVITY\n\t#define CLEARCOAT\n\t#define TRANSMISSION\n#endif\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform float roughness;\nuniform float metalness;\nuniform float opacity;\n#ifdef TRANSMISSION\n\tuniform float transmission;\n#endif\n#ifdef REFLECTIVITY\n\tuniform float reflectivity;\n#endif\n#ifdef CLEARCOAT\n\tuniform float clearcoat;\n\tuniform float clearcoatRoughness;\n#endif\n#ifdef USE_SHEEN\n\tuniform vec3 sheen;\n#endif\nvarying vec3 vViewPosition;\n#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\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#ifdef TRANSMISSION\n\t\tfloat totalTransmission = transmission;\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\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#ifdef TRANSMISSION\n\t\tdiffuseColor.a *= mix( saturate( 1. - totalTransmission + linearToRelativeLuminance( reflectedLight.directSpecular + reflectedLight.indirectSpecular ) ), 1.0, metalness );\n\t#endif\n\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n}",meshphysical_vert:"#define STANDARD\nvarying vec3 vViewPosition;\n#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\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#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\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}",normal_frag:"#define NORMAL\nuniform float opacity;\n#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( TANGENTSPACE_NORMALMAP )\n\tvarying vec3 vViewPosition;\n#endif\n#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\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}",normal_vert:"#define NORMAL\n#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( TANGENTSPACE_NORMALMAP )\n\tvarying vec3 vViewPosition;\n#endif\n#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\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#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\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}",points_frag:"uniform vec3 diffuse;\nuniform float opacity;\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\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\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}",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}",shadow_vert:"#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}",sprite_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\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\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}"},cr={common:{diffuse:{value:new $e(15658734)},opacity:{value:1},map:{value:null},uvTransform:{value:new yt},uv2Transform:{value:new yt},alphaMap:{value:null}},specularmap:{specularMap:{value:null}},envmap:{envMap:{value:null},flipEnvMap:{value:-1},reflectivity:{value:1},refractionRatio:{value:.98},maxMipLevel:{value:0}},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},normalScale:{value:new vt(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 $e(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 $e(15658734)},opacity:{value:1},size:{value:1},scale:{value:1},map:{value:null},alphaMap:{value:null},uvTransform:{value:new yt}},sprite:{diffuse:{value:new $e(15658734)},opacity:{value:1},center:{value:new vt(.5,.5)},rotation:{value:0},map:{value:null},alphaMap:{value:null},uvTransform:{value:new yt}}},hr={basic:{uniforms:Xn([cr.common,cr.specularmap,cr.envmap,cr.aomap,cr.lightmap,cr.fog]),vertexShader:ur.meshbasic_vert,fragmentShader:ur.meshbasic_frag},lambert:{uniforms:Xn([cr.common,cr.specularmap,cr.envmap,cr.aomap,cr.lightmap,cr.emissivemap,cr.fog,cr.lights,{emissive:{value:new $e(0)}}]),vertexShader:ur.meshlambert_vert,fragmentShader:ur.meshlambert_frag},phong:{uniforms:Xn([cr.common,cr.specularmap,cr.envmap,cr.aomap,cr.lightmap,cr.emissivemap,cr.bumpmap,cr.normalmap,cr.displacementmap,cr.fog,cr.lights,{emissive:{value:new $e(0)},specular:{value:new $e(1118481)},shininess:{value:30}}]),vertexShader:ur.meshphong_vert,fragmentShader:ur.meshphong_frag},standard:{uniforms:Xn([cr.common,cr.envmap,cr.aomap,cr.lightmap,cr.emissivemap,cr.bumpmap,cr.normalmap,cr.displacementmap,cr.roughnessmap,cr.metalnessmap,cr.fog,cr.lights,{emissive:{value:new $e(0)},roughness:{value:1},metalness:{value:0},envMapIntensity:{value:1}}]),vertexShader:ur.meshphysical_vert,fragmentShader:ur.meshphysical_frag},toon:{uniforms:Xn([cr.common,cr.aomap,cr.lightmap,cr.emissivemap,cr.bumpmap,cr.normalmap,cr.displacementmap,cr.gradientmap,cr.fog,cr.lights,{emissive:{value:new $e(0)}}]),vertexShader:ur.meshtoon_vert,fragmentShader:ur.meshtoon_frag},matcap:{uniforms:Xn([cr.common,cr.bumpmap,cr.normalmap,cr.displacementmap,cr.fog,{matcap:{value:null}}]),vertexShader:ur.meshmatcap_vert,fragmentShader:ur.meshmatcap_frag},points:{uniforms:Xn([cr.points,cr.fog]),vertexShader:ur.points_vert,fragmentShader:ur.points_frag},dashed:{uniforms:Xn([cr.common,cr.fog,{scale:{value:1},dashSize:{value:1},totalSize:{value:2}}]),vertexShader:ur.linedashed_vert,fragmentShader:ur.linedashed_frag},depth:{uniforms:Xn([cr.common,cr.displacementmap]),vertexShader:ur.depth_vert,fragmentShader:ur.depth_frag},normal:{uniforms:Xn([cr.common,cr.bumpmap,cr.normalmap,cr.displacementmap,{opacity:{value:1}}]),vertexShader:ur.normal_vert,fragmentShader:ur.normal_frag},sprite:{uniforms:Xn([cr.sprite,cr.fog]),vertexShader:ur.sprite_vert,fragmentShader:ur.sprite_frag},background:{uniforms:{uvTransform:{value:new yt},t2D:{value:null}},vertexShader:ur.background_vert,fragmentShader:ur.background_frag},cube:{uniforms:Xn([cr.envmap,{opacity:{value:1}}]),vertexShader:ur.cube_vert,fragmentShader:ur.cube_frag},equirect:{uniforms:{tEquirect:{value:null}},vertexShader:ur.equirect_vert,fragmentShader:ur.equirect_frag},distanceRGBA:{uniforms:Xn([cr.common,cr.displacementmap,{referencePosition:{value:new At},nearDistance:{value:1},farDistance:{value:1e3}}]),vertexShader:ur.distanceRGBA_vert,fragmentShader:ur.distanceRGBA_frag},shadow:{uniforms:Xn([cr.lights,cr.fog,{color:{value:new $e(0)},opacity:{value:1}}]),vertexShader:ur.shadow_vert,fragmentShader:ur.shadow_frag}};function dr(t,e,n,r,i){var a,o,s=new $e(0),u=0,c=null,h=0,d=null;function p(t,e){n.buffers.color.setClear(t.r,t.g,t.b,e,i)}return{getClearColor:function(){return s},setClearColor:function(t,e){void 0===e&&(e=1),s.set(t),p(s,u=e)},getClearAlpha:function(){return u},setClearAlpha:function(t){p(s,u=t)},render:function(n,i,f,m){var v=!0===i.isScene?i.background:null;v&&v.isTexture&&(v=e.get(v));var g=t.xr,y=g.getSession&&g.getSession();y&&"additive"===y.environmentBlendMode&&(v=null),null===v?p(s,u):v&&v.isColor&&(p(v,1),m=!0),(t.autoClear||m)&&t.clear(t.autoClearColor,t.autoClearDepth,t.autoClearStencil),v&&(v.isCubeTexture||v.mapping===l)?(void 0===o&&((o=new Vn(new jn(1,1,1),new Zn({name:"BackgroundCubeMaterial",uniforms:qn(hr.cube.uniforms),vertexShader:hr.cube.vertexShader,fragmentShader:hr.cube.fragmentShader,side:1,depthTest:!1,depthWrite:!1,fog:!1}))).geometry.deleteAttribute("normal"),o.geometry.deleteAttribute("uv"),o.onBeforeRender=function(t,e,n){this.matrixWorld.copyPosition(n.matrixWorld)},Object.defineProperty(o.material,"envMap",{get:function(){return this.uniforms.envMap.value}}),r.update(o)),o.material.uniforms.envMap.value=v,o.material.uniforms.flipEnvMap.value=v.isCubeTexture&&v._needsFlipEnvMap?-1:1,c===v&&h===v.version&&d===t.toneMapping||(o.material.needsUpdate=!0,c=v,h=v.version,d=t.toneMapping),n.unshift(o,o.geometry,o.material,0,0,null)):v&&v.isTexture&&(void 0===a&&((a=new Vn(new lr(2,2),new Zn({name:"BackgroundMaterial",uniforms:qn(hr.background.uniforms),vertexShader:hr.background.vertexShader,fragmentShader:hr.background.fragmentShader,side:0,depthTest:!1,depthWrite:!1,fog:!1}))).geometry.deleteAttribute("normal"),Object.defineProperty(a.material,"map",{get:function(){return this.uniforms.t2D.value}}),r.update(a)),a.material.uniforms.t2D.value=v,!0===v.matrixAutoUpdate&&v.updateMatrix(),a.material.uniforms.uvTransform.value.copy(v.matrix),c===v&&h===v.version&&d===t.toneMapping||(a.material.needsUpdate=!0,c=v,h=v.version,d=t.toneMapping),n.unshift(a,a.geometry,a.material,0,0,null))}}}function pr(t,e,n,r){var i=t.getParameter(34921),a=r.isWebGL2?null:e.get("OES_vertex_array_object"),o=r.isWebGL2||null!==a,s={},l=d(null),u=l;function c(e){return r.isWebGL2?t.bindVertexArray(e):a.bindVertexArrayOES(e)}function h(e){return r.isWebGL2?t.deleteVertexArray(e):a.deleteVertexArrayOES(e)}function d(t){for(var e=[],n=[],r=[],a=0;a=0){var y=l[h];if(void 0!==y){var x=y.normalized,_=y.itemSize,b=n.get(y);if(void 0===b)continue;var w=b.buffer,M=b.type,S=b.bytesPerElement;if(y.isInterleavedBufferAttribute){var T=y.data,E=T.stride,A=y.offset;T&&T.isInstancedInterleavedBuffer?(m(d,T.meshPerAttribute),void 0===s._maxInstanceCount&&(s._maxInstanceCount=T.meshPerAttribute*T.count)):f(d),t.bindBuffer(34962,w),g(d,_,M,x,E*S,A*S)}else y.isInstancedBufferAttribute?(m(d,y.meshPerAttribute),void 0===s._maxInstanceCount&&(s._maxInstanceCount=y.meshPerAttribute*y.count)):f(d),t.bindBuffer(34962,w),g(d,_,M,x,0,0)}else if("instanceMatrix"===h){var L=n.get(i.instanceMatrix);if(void 0===L)continue;var R=L.buffer,C=L.type;m(d+0,1),m(d+1,1),m(d+2,1),m(d+3,1),t.bindBuffer(34962,R),t.vertexAttribPointer(d+0,4,C,!1,64,0),t.vertexAttribPointer(d+1,4,C,!1,64,16),t.vertexAttribPointer(d+2,4,C,!1,64,32),t.vertexAttribPointer(d+3,4,C,!1,64,48)}else if("instanceColor"===h){var P=n.get(i.instanceColor);if(void 0===P)continue;var D=P.buffer,I=P.type;m(d,1),t.bindBuffer(34962,D),t.vertexAttribPointer(d,3,I,!1,12,0)}else if(void 0!==c){var N=c[h];if(void 0!==N)switch(N.length){case 2:t.vertexAttrib2fv(d,N);break;case 3:t.vertexAttrib3fv(d,N);break;case 4:t.vertexAttrib4fv(d,N);break;default:t.vertexAttrib1fv(d,N)}}}}v()}(i,l,h,y),null!==x&&t.bindBuffer(34963,n.get(x).buffer))},reset:y,resetDefaultState:x,dispose:function(){for(var t in y(),s){var e=s[t];for(var n in e){var r=e[n];for(var i in r)h(r[i].object),delete r[i];delete e[n]}delete s[t]}},releaseStatesOfGeometry:function(t){if(void 0!==s[t.id]){var e=s[t.id];for(var n in e){var r=e[n];for(var i in r)h(r[i].object),delete r[i];delete e[n]}delete s[t.id]}},releaseStatesOfProgram:function(t){for(var e in s){var n=s[e];if(void 0!==n[t.id]){var r=n[t.id];for(var i in r)h(r[i].object),delete r[i];delete n[t.id]}}},initAttributes:p,enableAttribute:f,disableUnusedAttributes:v}}function fr(t,e,n,r){var i,a=r.isWebGL2;this.setMode=function(t){i=t},this.render=function(e,r){t.drawArrays(i,e,r),n.update(r,i,1)},this.renderInstances=function(r,o,s){if(0!==s){var l,u;if(a)l=t,u="drawArraysInstanced";else if(u="drawArraysInstancedANGLE",null===(l=e.get("ANGLE_instanced_arrays")))return void console.error("THREE.WebGLBufferRenderer: using THREE.InstancedBufferGeometry but hardware does not support extension ANGLE_instanced_arrays.");l[u](i,r,o,s),n.update(o,i,s)}}}function mr(t,e,n){var r;function i(e){if("highp"===e){if(t.getShaderPrecisionFormat(35633,36338).precision>0&&t.getShaderPrecisionFormat(35632,36338).precision>0)return"highp";e="mediump"}return"mediump"===e&&t.getShaderPrecisionFormat(35633,36337).precision>0&&t.getShaderPrecisionFormat(35632,36337).precision>0?"mediump":"lowp"}var a="undefined"!=typeof WebGL2RenderingContext&&t instanceof WebGL2RenderingContext||"undefined"!=typeof WebGL2ComputeRenderingContext&&t instanceof WebGL2ComputeRenderingContext,o=void 0!==n.precision?n.precision:"highp",s=i(o);s!==o&&(console.warn("THREE.WebGLRenderer:",o,"not supported, using",s,"instead."),o=s);var l=!0===n.logarithmicDepthBuffer,u=t.getParameter(34930),c=t.getParameter(35660),h=t.getParameter(3379),d=t.getParameter(34076),p=t.getParameter(34921),f=t.getParameter(36347),m=t.getParameter(36348),v=t.getParameter(36349),g=c>0,y=a||e.has("OES_texture_float");return{isWebGL2:a,getMaxAnisotropy:function(){if(void 0!==r)return r;if(!0===e.has("EXT_texture_filter_anisotropic")){var n=e.get("EXT_texture_filter_anisotropic");r=t.getParameter(n.MAX_TEXTURE_MAX_ANISOTROPY_EXT)}else r=0;return r},getMaxPrecision:i,precision:o,logarithmicDepthBuffer:l,maxTextures:u,maxVertexTextures:c,maxTextureSize:h,maxCubemapSize:d,maxAttributes:p,maxVertexUniforms:f,maxVaryings:m,maxFragmentUniforms:v,vertexTextures:g,floatFragmentTextures:y,floatVertexTextures:g&&y,maxSamples:a?t.getParameter(36183):0}}function vr(t){var e=this,n=null,r=0,i=!1,a=!1,o=new Ie,s=new yt,l={value:null,needsUpdate:!1};function u(){l.value!==n&&(l.value=n,l.needsUpdate=r>0),e.numPlanes=r,e.numIntersection=0}function c(t,n,r,i){var a=null!==t?t.length:0,u=null;if(0!==a){if(u=l.value,!0!==i||null===u){var c=r+4*a,h=n.matrixWorldInverse;s.getNormalMatrix(h),(null===u||u.length0){var u=t.getRenderTarget(),c=new er(l.height/2);return c.fromEquirectangularTexture(t,i),e.set(i,c),t.setRenderTarget(u),i.addEventListener("dispose",r),n(c.texture,i.mapping)}return null}}return i},dispose:function(){e=new WeakMap}}}function yr(t){var e={};function n(n){if(void 0!==e[n])return e[n];var r;switch(n){case"WEBGL_depth_texture":r=t.getExtension("WEBGL_depth_texture")||t.getExtension("MOZ_WEBGL_depth_texture")||t.getExtension("WEBKIT_WEBGL_depth_texture");break;case"EXT_texture_filter_anisotropic":r=t.getExtension("EXT_texture_filter_anisotropic")||t.getExtension("MOZ_EXT_texture_filter_anisotropic")||t.getExtension("WEBKIT_EXT_texture_filter_anisotropic");break;case"WEBGL_compressed_texture_s3tc":r=t.getExtension("WEBGL_compressed_texture_s3tc")||t.getExtension("MOZ_WEBGL_compressed_texture_s3tc")||t.getExtension("WEBKIT_WEBGL_compressed_texture_s3tc");break;case"WEBGL_compressed_texture_pvrtc":r=t.getExtension("WEBGL_compressed_texture_pvrtc")||t.getExtension("WEBKIT_WEBGL_compressed_texture_pvrtc");break;default:r=t.getExtension(n)}return e[n]=r,r}return{has:function(t){return null!==n(t)},init:function(t){t.isWebGL2?n("EXT_color_buffer_float"):(n("WEBGL_depth_texture"),n("OES_texture_float"),n("OES_texture_half_float"),n("OES_texture_half_float_linear"),n("OES_standard_derivatives"),n("OES_element_index_uint"),n("OES_vertex_array_object"),n("ANGLE_instanced_arrays")),n("OES_texture_float_linear"),n("EXT_color_buffer_half_float")},get:function(t){var e=n(t);return null===e&&console.warn("THREE.WebGLRenderer: "+t+" extension not supported."),e}}}function xr(t,e,n,r){var i={},a=new WeakMap;function o(t){var s=t.target;for(var l in null!==s.index&&e.remove(s.index),s.attributes)e.remove(s.attributes[l]);s.removeEventListener("dispose",o),delete i[s.id];var u=a.get(s);u&&(e.remove(u),a.delete(s)),r.releaseStatesOfGeometry(s),!0===s.isInstancedBufferGeometry&&delete s._maxInstanceCount,n.memory.geometries--}function s(t){var n=[],r=t.index,i=t.attributes.position,o=0;if(null!==r){var s=r.array;o=r.version;for(var l=0,u=s.length;l65535?hn:un)(n,1);x.version=o;var _=a.get(t);_&&e.remove(_),a.set(t,x)}return{get:function(t,e){return!0===i[e.id]||(e.addEventListener("dispose",o),i[e.id]=!0,n.memory.geometries++),e},update:function(t){var n=t.attributes;for(var r in n)e.update(n[r],34962);var i=t.morphAttributes;for(var a in i)for(var o=i[a],s=0,l=o.length;s0)return t;var i=e*n,a=Dr[i];if(void 0===a&&(a=new Float32Array(i),Dr[i]=a),0!==e){r.toArray(a,0);for(var o=1,s=0;o!==e;++o)s+=n,t[o].toArray(a,s)}return a}function Fr(t,e){if(t.length!==e.length)return!1;for(var n=0,r=t.length;n/gm;function Ii(t){return t.replace(Di,Ni)}function Ni(t,e){var n=ur[e];if(void 0===n)throw new Error("Can not resolve #include <"+e+">");return Ii(n)}var Bi=/#pragma unroll_loop[\s]+?for \( int i \= (\d+)\; i < (\d+)\; i \+\+ \) \{([\s\S]+?)(?=\})\}/g,Oi=/#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 zi(t){return t.replace(Oi,Hi).replace(Bi,Fi)}function Fi(t,e,n,r){return console.warn("WebGLProgram: #pragma unroll_loop shader syntax is deprecated. Please use #pragma unroll_loop_start syntax instead."),Hi(t,e,n,r)}function Hi(t,e,n,r){for(var i="",a=parseInt(e);a0?t.gammaFactor:1,w=n.isWebGL2?"":function(t){return[t.extensionDerivatives||t.envMapCubeUV||t.bumpMap||t.tangentSpaceNormalMap||t.clearcoatNormalMap||t.flatShading||"physical"===t.shaderID?"#extension GL_OES_standard_derivatives : enable":"",(t.extensionFragDepth||t.logarithmicDepthBuffer)&&t.rendererExtensionFragDepth?"#extension GL_EXT_frag_depth : enable":"",t.extensionDrawBuffers&&t.rendererExtensionDrawBuffers?"#extension GL_EXT_draw_buffers : require":"",(t.extensionShaderTextureLOD||t.envMap)&&t.rendererExtensionShaderTextureLod?"#extension GL_EXT_shader_texture_lod : enable":""].filter(Ri).join("\n")}(n),M=function(t){var e=[];for(var n in t){var r=t[n];!1!==r&&e.push("#define "+n+" "+r)}return e.join("\n")}(f),S=p.createProgram(),T=n.glslVersion?"#version "+n.glslVersion+"\n":"";n.isRawShaderMaterial?((o=[M].filter(Ri).join("\n")).length>0&&(o+="\n"),(s=[w,M].filter(Ri).join("\n")).length>0&&(s+="\n")):(o=[Gi(n),"#define SHADER_NAME "+n.shaderName,M,n.instancing?"#define USE_INSTANCING":"",n.instancingColor?"#define USE_INSTANCING_COLOR":"",n.supportsVertexTextures?"#define VERTEX_TEXTURES":"","#define GAMMA_FACTOR "+b,"#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 "+x:"",n.lightMap?"#define USE_LIGHTMAP":"",n.aoMap?"#define USE_AOMAP":"",n.emissiveMap?"#define USE_EMISSIVEMAP":"",n.bumpMap?"#define USE_BUMPMAP":"",n.normalMap?"#define USE_NORMALMAP":"",n.normalMap&&n.objectSpaceNormalMap?"#define OBJECTSPACE_NORMALMAP":"",n.normalMap&&n.tangentSpaceNormalMap?"#define TANGENTSPACE_NORMALMAP":"",n.clearcoatMap?"#define USE_CLEARCOATMAP":"",n.clearcoatRoughnessMap?"#define USE_CLEARCOAT_ROUGHNESSMAP":"",n.clearcoatNormalMap?"#define USE_CLEARCOAT_NORMALMAP":"",n.displacementMap&&n.supportsVertexTextures?"#define USE_DISPLACEMENTMAP":"",n.specularMap?"#define USE_SPECULARMAP":"",n.roughnessMap?"#define USE_ROUGHNESSMAP":"",n.metalnessMap?"#define USE_METALNESSMAP":"",n.alphaMap?"#define USE_ALPHAMAP":"",n.transmissionMap?"#define USE_TRANSMISSIONMAP":"",n.vertexTangents?"#define USE_TANGENT":"",n.vertexColors?"#define USE_COLOR":"",n.vertexUvs?"#define USE_UV":"",n.uvsVertexOnly?"#define UVS_VERTEX_ONLY":"",n.flatShading?"#define FLAT_SHADED":"",n.skinning?"#define USE_SKINNING":"",n.useVertexTexture?"#define BONE_TEXTURE":"",n.morphTargets?"#define USE_MORPHTARGETS":"",n.morphNormals&&!1===n.flatShading?"#define USE_MORPHNORMALS":"",n.doubleSided?"#define DOUBLE_SIDED":"",n.flipSided?"#define FLIP_SIDED":"",n.shadowMapEnabled?"#define USE_SHADOWMAP":"",n.shadowMapEnabled?"#define "+g:"",n.sizeAttenuation?"#define USE_SIZEATTENUATION":"",n.logarithmicDepthBuffer?"#define USE_LOGDEPTHBUF":"",n.logarithmicDepthBuffer&&n.rendererExtensionFragDepth?"#define USE_LOGDEPTHBUF_EXT":"","uniform mat4 modelMatrix;","uniform mat4 modelViewMatrix;","uniform mat4 projectionMatrix;","uniform mat4 viewMatrix;","uniform mat3 normalMatrix;","uniform vec3 cameraPosition;","uniform bool isOrthographic;","#ifdef USE_INSTANCING","\tattribute mat4 instanceMatrix;","#endif","#ifdef USE_INSTANCING_COLOR","\tattribute vec3 instanceColor;","#endif","attribute vec3 position;","attribute vec3 normal;","attribute vec2 uv;","#ifdef USE_TANGENT","\tattribute vec4 tangent;","#endif","#ifdef USE_COLOR","\tattribute vec3 color;","#endif","#ifdef USE_MORPHTARGETS","\tattribute vec3 morphTarget0;","\tattribute vec3 morphTarget1;","\tattribute vec3 morphTarget2;","\tattribute vec3 morphTarget3;","\t#ifdef USE_MORPHNORMALS","\t\tattribute vec3 morphNormal0;","\t\tattribute vec3 morphNormal1;","\t\tattribute vec3 morphNormal2;","\t\tattribute vec3 morphNormal3;","\t#else","\t\tattribute vec3 morphTarget4;","\t\tattribute vec3 morphTarget5;","\t\tattribute vec3 morphTarget6;","\t\tattribute vec3 morphTarget7;","\t#endif","#endif","#ifdef USE_SKINNING","\tattribute vec4 skinIndex;","\tattribute vec4 skinWeight;","#endif","\n"].filter(Ri).join("\n"),s=[w,Gi(n),"#define SHADER_NAME "+n.shaderName,M,n.alphaTest?"#define ALPHATEST "+n.alphaTest+(n.alphaTest%1?"":".0"):"","#define GAMMA_FACTOR "+b,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 "+y:"",n.envMap?"#define "+x:"",n.envMap?"#define "+_:"",n.lightMap?"#define USE_LIGHTMAP":"",n.aoMap?"#define USE_AOMAP":"",n.emissiveMap?"#define USE_EMISSIVEMAP":"",n.bumpMap?"#define USE_BUMPMAP":"",n.normalMap?"#define USE_NORMALMAP":"",n.normalMap&&n.objectSpaceNormalMap?"#define OBJECTSPACE_NORMALMAP":"",n.normalMap&&n.tangentSpaceNormalMap?"#define TANGENTSPACE_NORMALMAP":"",n.clearcoatMap?"#define USE_CLEARCOATMAP":"",n.clearcoatRoughnessMap?"#define USE_CLEARCOAT_ROUGHNESSMAP":"",n.clearcoatNormalMap?"#define USE_CLEARCOAT_NORMALMAP":"",n.specularMap?"#define USE_SPECULARMAP":"",n.roughnessMap?"#define USE_ROUGHNESSMAP":"",n.metalnessMap?"#define USE_METALNESSMAP":"",n.alphaMap?"#define USE_ALPHAMAP":"",n.sheen?"#define USE_SHEEN":"",n.transmissionMap?"#define USE_TRANSMISSIONMAP":"",n.vertexTangents?"#define USE_TANGENT":"",n.vertexColors||n.instancingColor?"#define USE_COLOR":"",n.vertexUvs?"#define USE_UV":"",n.uvsVertexOnly?"#define UVS_VERTEX_ONLY":"",n.gradientMap?"#define USE_GRADIENTMAP":"",n.flatShading?"#define FLAT_SHADED":"",n.doubleSided?"#define DOUBLE_SIDED":"",n.flipSided?"#define FLIP_SIDED":"",n.shadowMapEnabled?"#define USE_SHADOWMAP":"",n.shadowMapEnabled?"#define "+g:"",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?ur.tonemapping_pars_fragment:"",0!==n.toneMapping?Li("toneMapping",n.toneMapping):"",n.dithering?"#define DITHERING":"",ur.encodings_pars_fragment,n.map?Ai("mapTexelToLinear",n.mapEncoding):"",n.matcap?Ai("matcapTexelToLinear",n.matcapEncoding):"",n.envMap?Ai("envMapTexelToLinear",n.envMapEncoding):"",n.emissiveMap?Ai("emissiveMapTexelToLinear",n.emissiveMapEncoding):"",n.lightMap?Ai("lightMapTexelToLinear",n.lightMapEncoding):"",(c="linearToOutputTexel",h=n.outputEncoding,d=Ti(h),"vec4 "+c+"( vec4 value ) { return LinearTo"+d[0]+d[1]+"; }"),n.depthPacking?"#define DEPTH_PACKING "+n.depthPacking:"","\n"].filter(Ri).join("\n")),m=Pi(m=Ci(m=Ii(m),n),n),v=Pi(v=Ci(v=Ii(v),n),n),m=zi(m),v=zi(v),n.isWebGL2&&!0!==n.isRawShaderMaterial&&(T="#version 300 es\n",o=["#define attribute in","#define varying out","#define texture2D texture"].join("\n")+"\n"+o,s=["#define varying in",n.glslVersion===rt?"":"out highp vec4 pc_fragColor;",n.glslVersion===rt?"":"#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"+s);var E,A,L=T+s+v,R=Mi(p,35633,T+o+m),C=Mi(p,35632,L);if(p.attachShader(S,R),p.attachShader(S,C),void 0!==n.index0AttributeName?p.bindAttribLocation(S,0,n.index0AttributeName):!0===n.morphTargets&&p.bindAttribLocation(S,0,"position"),p.linkProgram(S),t.debug.checkShaderErrors){var P=p.getProgramInfoLog(S).trim(),D=p.getShaderInfoLog(R).trim(),I=p.getShaderInfoLog(C).trim(),N=!0,B=!0;if(!1===p.getProgramParameter(S,35714)){N=!1;var O=Ei(p,R,"vertex"),z=Ei(p,C,"fragment");console.error("THREE.WebGLProgram: shader error: ",p.getError(),"35715",p.getProgramParameter(S,35715),"gl.getProgramInfoLog",P,O,z)}else""!==P?console.warn("THREE.WebGLProgram: gl.getProgramInfoLog()",P):""!==D&&""!==I||(B=!1);B&&(this.diagnostics={runnable:N,programLog:P,vertexShader:{log:D,prefix:o},fragmentShader:{log:I,prefix:s}})}return p.deleteShader(R),p.deleteShader(C),this.getUniforms=function(){return void 0===E&&(E=new wi(p,S)),E},this.getAttributes=function(){return void 0===A&&(A=function(t,e){for(var n={},r=t.getProgramParameter(e,35721),i=0;i0,maxBones:E,useVertexTexture:h,morphTargets:i.morphTargets,morphNormals:i.morphNormals,maxMorphTargets:t.maxMorphTargets,maxMorphNormals:t.maxMorphNormals,numDirLights:o.directional.length,numPointLights:o.point.length,numSpotLights:o.spot.length,numRectAreaLights:o.rectArea.length,numHemiLights:o.hemi.length,numDirLightShadows:o.directionalShadowMap.length,numPointLightShadows:o.pointShadowMap.length,numSpotLightShadows:o.spotShadowMap.length,numClippingPlanes:a.numPlanes,numClipIntersection:a.numIntersection,dithering:i.dithering,shadowMapEnabled:t.shadowMap.enabled&&v.length>0,shadowMapType:t.shadowMap.type,toneMapping:i.toneMapped?t.toneMapping:0,physicallyCorrectLights:t.physicallyCorrectLights,premultipliedAlpha:i.premultipliedAlpha,alphaTest:i.alphaTest,doubleSided:2===i.side,flipSided:1===i.side,depthPacking:void 0!==i.depthPacking&&i.depthPacking,index0AttributeName:i.index0AttributeName,extensionDerivatives:i.extensions&&i.extensions.derivatives,extensionFragDepth:i.extensions&&i.extensions.fragDepth,extensionDrawBuffers:i.extensions&&i.extensions.drawBuffers,extensionShaderTextureLOD:i.extensions&&i.extensions.shaderTextureLOD,rendererExtensionFragDepth:s||n.has("EXT_frag_depth"),rendererExtensionDrawBuffers:s||n.has("WEBGL_draw_buffers"),rendererExtensionShaderTextureLod:s||n.has("EXT_shader_texture_lod"),customProgramCacheKey:i.customProgramCacheKey()}},getProgramCacheKey:function(e){var n=[];if(e.shaderID?n.push(e.shaderID):(n.push(e.fragmentShader),n.push(e.vertexShader)),void 0!==e.defines)for(var r in e.defines)n.push(r),n.push(e.defines[r]);if(!1===e.isRawShaderMaterial){for(var i=0;i1&&r.sort(t||Wi),i.length>1&&i.sort(e||ji)}}}function Xi(t){var e=new WeakMap;return{get:function(n,r){var i;return!1===e.has(n)?(i=new qi(t),e.set(n,[i])):r>=e.get(n).length?(i=new qi(t),e.get(n).push(i)):i=e.get(n)[r],i},dispose:function(){e=new WeakMap}}}function Yi(){var t={};return{get:function(e){if(void 0!==t[e.id])return t[e.id];var n;switch(e.type){case"DirectionalLight":n={direction:new At,color:new $e};break;case"SpotLight":n={position:new At,direction:new At,color:new $e,distance:0,coneCos:0,penumbraCos:0,decay:0};break;case"PointLight":n={position:new At,color:new $e,distance:0,decay:0};break;case"HemisphereLight":n={direction:new At,skyColor:new $e,groundColor:new $e};break;case"RectAreaLight":n={color:new $e,position:new At,halfWidth:new At,halfHeight:new At}}return t[e.id]=n,n}}}var Zi=0;function Ji(t,e){return(e.castShadow?1:0)-(t.castShadow?1:0)}function Qi(t,e){for(var n,r=new Yi,i=(n={},{get:function(t){if(void 0!==n[t.id])return n[t.id];var e;switch(t.type){case"DirectionalLight":case"SpotLight":e={shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new vt};break;case"PointLight":e={shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new vt,shadowCameraNear:1,shadowCameraFar:1e3}}return n[t.id]=e,e}}),a={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:[]},o=0;o<9;o++)a.probe.push(new At);var s=new At,l=new ie,u=new ie;return{setup:function(n){for(var o=0,s=0,l=0,u=0;u<9;u++)a.probe[u].set(0,0,0);var c=0,h=0,d=0,p=0,f=0,m=0,v=0,g=0;n.sort(Ji);for(var y=0,x=n.length;y0&&(e.isWebGL2||!0===t.has("OES_texture_float_linear")?(a.rectAreaLTC1=cr.LTC_FLOAT_1,a.rectAreaLTC2=cr.LTC_FLOAT_2):!0===t.has("OES_texture_half_float_linear")?(a.rectAreaLTC1=cr.LTC_HALF_1,a.rectAreaLTC2=cr.LTC_HALF_2):console.error("THREE.WebGLRenderer: Unable to use RectAreaLight. Missing WebGL extensions.")),a.ambient[0]=o,a.ambient[1]=s,a.ambient[2]=l;var z=a.hash;z.directionalLength===c&&z.pointLength===h&&z.spotLength===d&&z.rectAreaLength===p&&z.hemiLength===f&&z.numDirectionalShadows===m&&z.numPointShadows===v&&z.numSpotShadows===g||(a.directional.length=c,a.spot.length=d,a.rectArea.length=p,a.point.length=h,a.hemi.length=f,a.directionalShadow.length=m,a.directionalShadowMap.length=m,a.pointShadow.length=v,a.pointShadowMap.length=v,a.spotShadow.length=g,a.spotShadowMap.length=g,a.directionalShadowMatrix.length=m,a.pointShadowMatrix.length=v,a.spotShadowMatrix.length=g,z.directionalLength=c,z.pointLength=h,z.spotLength=d,z.rectAreaLength=p,z.hemiLength=f,z.numDirectionalShadows=m,z.numPointShadows=v,z.numSpotShadows=g,a.version=Zi++)},setupView:function(t,e){for(var n=0,r=0,i=0,o=0,c=0,h=e.matrixWorldInverse,d=0,p=t.length;d=n.get(r).length?(a=new Ki(t,e),n.get(r).push(a)):a=n.get(r)[i],a},dispose:function(){n=new WeakMap}}}var ta=function(t){function e(e){var n;return(n=t.call(this)||this).type="MeshDepthMaterial",n.depthPacking=3200,n.skinning=!1,n.morphTargets=!1,n.map=null,n.alphaMap=null,n.displacementMap=null,n.displacementScale=1,n.displacementBias=0,n.wireframe=!1,n.wireframeLinewidth=1,n.fog=!1,n.setValues(e),n}return st(e,t),e.prototype.copy=function(e){return t.prototype.copy.call(this,e),this.depthPacking=e.depthPacking,this.skinning=e.skinning,this.morphTargets=e.morphTargets,this.map=e.map,this.alphaMap=e.alphaMap,this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this},e}(qe);ta.prototype.isMeshDepthMaterial=!0;var ea=function(t){function e(e){var n;return(n=t.call(this)||this).type="MeshDistanceMaterial",n.referencePosition=new At,n.nearDistance=1,n.farDistance=1e3,n.skinning=!1,n.morphTargets=!1,n.map=null,n.alphaMap=null,n.displacementMap=null,n.displacementScale=1,n.displacementBias=0,n.fog=!1,n.setValues(e),n}return st(e,t),e.prototype.copy=function(e){return t.prototype.copy.call(this,e),this.referencePosition.copy(e.referencePosition),this.nearDistance=e.nearDistance,this.farDistance=e.farDistance,this.skinning=e.skinning,this.morphTargets=e.morphTargets,this.map=e.map,this.alphaMap=e.alphaMap,this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this},e}(qe);ea.prototype.isMeshDistanceMaterial=!0;function na(t,e,n){var r=new ar,i=new vt,a=new vt,o=new Mt,s=[],l=[],u={},c=n.maxTextureSize,h={0:1,1:0,2:2},d=new Zn({defines:{SAMPLE_RATE:2/8,HALF_SAMPLE_RATE:1/8},uniforms:{shadow_pass:{value:null},resolution:{value:new vt},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\tfloat mean = 0.0;\n\tfloat squared_mean = 0.0;\n\tfloat depth = unpackRGBAToDepth( texture2D( shadow_pass, ( gl_FragCoord.xy ) / resolution ) );\n\tfor ( float i = -1.0; i < 1.0 ; i += SAMPLE_RATE) {\n\t\t#ifdef HORIZONTAL_PASS\n\t\t\tvec2 distribution = unpackRGBATo2Half( texture2D( shadow_pass, ( gl_FragCoord.xy + vec2( i, 0.0 ) * radius ) / resolution ) );\n\t\t\tmean += distribution.x;\n\t\t\tsquared_mean += distribution.y * distribution.y + distribution.x * distribution.x;\n\t\t#else\n\t\t\tfloat depth = unpackRGBAToDepth( texture2D( shadow_pass, ( gl_FragCoord.xy + vec2( 0.0, i ) * radius ) / resolution ) );\n\t\t\tmean += depth;\n\t\t\tsquared_mean += depth * depth;\n\t\t#endif\n\t}\n\tmean = mean * HALF_SAMPLE_RATE;\n\tsquared_mean = squared_mean * HALF_SAMPLE_RATE;\n\tfloat std_dev = sqrt( squared_mean - mean * mean );\n\tgl_FragColor = pack2HalfToRGBA( vec2( mean, std_dev ) );\n}"}),f=d.clone();f.defines.HORIZONTAL_PASS=1;var m=new Tn;m.setAttribute("position",new rn(new Float32Array([-1,-1,.5,3,-1,.5,-1,3,.5]),3));var g=new Vn(m,d),y=this;function x(n,r){var i=e.update(g);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(r,null,i,d,g,null),f.uniforms.shadow_pass.value=n.mapPass.texture,f.uniforms.resolution.value=n.mapSize,f.uniforms.radius.value=n.radius,t.setRenderTarget(n.map),t.clear(),t.renderBufferDirect(r,null,i,f,g,null)}function _(t,e,n){var r=t<<0|e<<1|n<<2,i=s[r];return void 0===i&&(i=new ta({depthPacking:3201,morphTargets:t,skinning:e}),s[r]=i),i}function b(t,e,n){var r=t<<0|e<<1|n<<2,i=l[r];return void 0===i&&(i=new ea({morphTargets:t,skinning:e}),l[r]=i),i}function w(e,n,r,i,a,o,s){var l=null,c=_,d=e.customDepthMaterial;if(!0===i.isPointLight&&(c=b,d=e.customDistanceMaterial),void 0===d){var p=!1;!0===r.morphTargets&&(p=n.morphAttributes&&n.morphAttributes.position&&n.morphAttributes.position.length>0);var f=!1;!0===e.isSkinnedMesh&&(!0===r.skinning?f=!0:console.warn("THREE.WebGLShadowMap: THREE.SkinnedMesh with material.skinning set to false:",e)),l=c(p,f,!0===e.isInstancedMesh)}else l=d;if(t.localClippingEnabled&&!0===r.clipShadows&&0!==r.clippingPlanes.length){var m=l.uuid,v=r.uuid,g=u[m];void 0===g&&(g={},u[m]=g);var y=g[v];void 0===y&&(y=l.clone(),g[v]=y),l=y}return l.visible=r.visible,l.wireframe=r.wireframe,l.side=3===s?null!==r.shadowSide?r.shadowSide:r.side:null!==r.shadowSide?r.shadowSide:h[r.side],l.clipShadows=r.clipShadows,l.clippingPlanes=r.clippingPlanes,l.clipIntersection=r.clipIntersection,l.wireframeLinewidth=r.wireframeLinewidth,l.linewidth=r.linewidth,!0===i.isPointLight&&!0===l.isMeshDistanceMaterial&&(l.referencePosition.setFromMatrixPosition(i.matrixWorld),l.nearDistance=a,l.farDistance=o),l}function M(n,i,a,o,s){if(!1!==n.visible){if(n.layers.test(i.layers)&&(n.isMesh||n.isLine||n.isPoints)&&(n.castShadow||n.receiveShadow&&3===s)&&(!n.frustumCulled||r.intersectsObject(n))){n.modelViewMatrix.multiplyMatrices(a.matrixWorldInverse,n.matrixWorld);var l=e.update(n),u=n.material;if(Array.isArray(u))for(var c=l.groups,h=0,d=c.length;hc||i.y>c)&&(i.x>c&&(a.x=Math.floor(c/b.x),i.x=a.x*b.x,_.mapSize.x=a.x),i.y>c&&(a.y=Math.floor(c/b.y),i.y=a.y*b.y,_.mapSize.y=a.y)),null===_.map&&!_.isPointLightShadow&&3===this.type){var w={minFilter:v,magFilter:v,format:E};_.map=new St(i.x,i.y,w),_.map.texture.name=g.name+".shadowMap",_.mapPass=new St(i.x,i.y,w),_.camera.updateProjectionMatrix()}if(null===_.map){var S={minFilter:p,magFilter:p,format:E};_.map=new St(i.x,i.y,S),_.map.texture.name=g.name+".shadowMap",_.camera.updateProjectionMatrix()}t.setRenderTarget(_.map),t.clear();for(var T=_.getViewportCount(),A=0;A=1):-1!==P.indexOf("OpenGL ES")&&(C=parseFloat(/^OpenGL ES (\d)/.exec(P)[1]),R=C>=2);var D=null,I={},N=new Mt(0,0,t.canvas.width,t.canvas.height),B=new Mt(0,0,t.canvas.width,t.canvas.height);function O(e,n,r){var i=new Uint8Array(4),a=t.createTexture();t.bindTexture(e,a),t.texParameteri(e,10241,9728),t.texParameteri(e,10240,9728);for(var o=0;or||t.height>r)&&(i=r/Math.max(t.width,t.height)),i<1||!0===e){if("undefined"!=typeof HTMLImageElement&&t instanceof HTMLImageElement||"undefined"!=typeof HTMLCanvasElement&&t instanceof HTMLCanvasElement||"undefined"!=typeof ImageBitmap&&t instanceof ImageBitmap){var a=e?mt.floorPowerOfTwo:Math.floor,o=a(i*t.width),s=a(i*t.height);void 0===u&&(u=P(o,s));var l=n?P(o,s):u;return l.width=o,l.height=s,l.getContext("2d").drawImage(t,0,0,o,s),console.warn("THREE.WebGLRenderer: Texture has been resized from ("+t.width+"x"+t.height+") to ("+o+"x"+s+")."),l}return"data"in t&&console.warn("THREE.WebGLRenderer: Image in DataTexture is too big ("+t.width+"x"+t.height+")."),t}return t}function I(t){return mt.isPowerOfTwo(t.width)&&mt.isPowerOfTwo(t.height)}function N(t,e){return t.generateMipmaps&&e&&t.minFilter!==p&&t.minFilter!==v}function B(e,n,i,a){t.generateMipmap(e),r.get(n).__maxMipLevel=Math.log2(Math.max(i,a))}function O(n,r,i){if(!1===c)return r;if(null!==n){if(void 0!==t[n])return t[n];console.warn("THREE.WebGLRenderer: Attempt to use non-existing WebGL internal format '"+n+"'")}var a=r;return 6403===r&&(5126===i&&(a=33326),5131===i&&(a=33325),5121===i&&(a=33321)),6407===r&&(5126===i&&(a=34837),5131===i&&(a=34843),5121===i&&(a=32849)),6408===r&&(5126===i&&(a=34836),5131===i&&(a=34842),5121===i&&(a=32856)),33325!==a&&33326!==a&&34842!==a&&34836!==a||e.get("EXT_color_buffer_float"),a}function z(t){return t===p||t===f||t===m?9728:9729}function F(e){var n=e.target;n.removeEventListener("dispose",F),function(e){var n=r.get(e);if(void 0===n.__webglInit)return;t.deleteTexture(n.__webglTexture),r.remove(e)}(n),n.isVideoTexture&&R.delete(n),o.memory.textures--}function H(e){var n=e.target;n.removeEventListener("dispose",H),function(e){var n=e.texture,i=r.get(e),a=r.get(n);if(!e)return;void 0!==a.__webglTexture&&t.deleteTexture(a.__webglTexture);e.depthTexture&&e.depthTexture.dispose();if(e.isWebGLCubeRenderTarget)for(var o=0;o<6;o++)t.deleteFramebuffer(i.__webglFramebuffer[o]),i.__webglDepthbuffer&&t.deleteRenderbuffer(i.__webglDepthbuffer[o]);else t.deleteFramebuffer(i.__webglFramebuffer),i.__webglDepthbuffer&&t.deleteRenderbuffer(i.__webglDepthbuffer),i.__webglMultisampledFramebuffer&&t.deleteFramebuffer(i.__webglMultisampledFramebuffer),i.__webglColorRenderbuffer&&t.deleteRenderbuffer(i.__webglColorRenderbuffer),i.__webglDepthRenderbuffer&&t.deleteRenderbuffer(i.__webglDepthRenderbuffer);r.remove(n),r.remove(e)}(n),o.memory.textures--}var G=0;function U(t,e){var i=r.get(t);if(t.isVideoTexture&&function(t){var e=o.render.frame;R.get(t)!==e&&(R.set(t,e),t.update())}(t),t.version>0&&i.__version!==t.version){var a=t.image;if(void 0===a)console.warn("THREE.WebGLRenderer: Texture marked for update but image is undefined");else{if(!1!==a.complete)return void X(i,t,e);console.warn("THREE.WebGLRenderer: Texture marked for update but image is incomplete")}}n.activeTexture(33984+e),n.bindTexture(3553,i.__webglTexture)}function k(e,i){var o=r.get(e);e.version>0&&o.__version!==e.version?function(e,r,i){if(6!==r.image.length)return;q(e,r),n.activeTexture(33984+i),n.bindTexture(34067,e.__webglTexture),t.pixelStorei(37440,r.flipY),t.pixelStorei(37441,r.premultiplyAlpha),t.pixelStorei(3317,r.unpackAlignment),t.pixelStorei(37443,0);for(var o=r&&(r.isCompressedTexture||r.image[0].isCompressedTexture),s=r.image[0]&&r.image[0].isDataTexture,l=[],u=0;u<6;u++)l[u]=o||s?s?r.image[u].image:r.image[u]:D(r.image[u],!1,!0,g);var h,d=l[0],p=I(d)||c,f=a.convert(r.format),m=a.convert(r.type),v=O(r.internalFormat,f,m);if(j(34067,r,p),o){for(var y=0;y<6;y++){h=l[y].mipmaps;for(var x=0;x1||r.get(a).__currentAnisotropy)&&(t.texParameterf(n,s.TEXTURE_MAX_ANISOTROPY_EXT,Math.min(a.anisotropy,i.getMaxAnisotropy())),r.get(a).__currentAnisotropy=a.anisotropy)}}function q(e,n){void 0===e.__webglInit&&(e.__webglInit=!0,n.addEventListener("dispose",F),e.__webglTexture=t.createTexture(),o.memory.textures++)}function X(e,r,i){var o=3553;r.isDataTexture2DArray&&(o=35866),r.isDataTexture3D&&(o=32879),q(e,r),n.activeTexture(33984+i),n.bindTexture(o,e.__webglTexture),t.pixelStorei(37440,r.flipY),t.pixelStorei(37441,r.premultiplyAlpha),t.pixelStorei(3317,r.unpackAlignment),t.pixelStorei(37443,0);var s,l=function(t){return!c&&(t.wrapS!==h||t.wrapT!==h||t.minFilter!==p&&t.minFilter!==v)}(r)&&!1===I(r.image),u=D(r.image,l,!1,y),d=I(u)||c,f=a.convert(r.format),m=a.convert(r.type),g=O(r.internalFormat,f,m);j(o,r,d);var x=r.mipmaps;if(r.isDepthTexture)g=6402,c?g=r.type===w?36012:r.type===b?33190:r.type===S?35056:33189:r.type===w&&console.error("WebGLRenderer: Floating point depth texture requires WebGL2."),r.format===A&&6402===g&&r.type!==_&&r.type!==b&&(console.warn("THREE.WebGLRenderer: Use UnsignedShortType or UnsignedIntType for DepthFormat DepthTexture."),r.type=_,m=a.convert(r.type)),r.format===L&&6402===g&&(g=34041,r.type!==S&&(console.warn("THREE.WebGLRenderer: Use UnsignedInt248Type for DepthStencilFormat DepthTexture."),r.type=S,m=a.convert(r.type))),n.texImage2D(3553,0,g,u.width,u.height,0,f,m,null);else if(r.isDataTexture)if(x.length>0&&d){for(var M=0,R=x.length;M0&&d){for(var z=0,F=x.length;z=d&&console.warn("THREE.WebGLTextures: Trying to use "+t+" texture units while this GPU supports only "+d),G+=1,t},this.resetTextureUnits=function(){G=0},this.setTexture2D=U,this.setTexture2DArray=function(t,e){var i=r.get(t);t.version>0&&i.__version!==t.version?X(i,t,e):(n.activeTexture(33984+e),n.bindTexture(35866,i.__webglTexture))},this.setTexture3D=function(t,e){var i=r.get(t);t.version>0&&i.__version!==t.version?X(i,t,e):(n.activeTexture(33984+e),n.bindTexture(32879,i.__webglTexture))},this.setTextureCube=k,this.setupRenderTarget=function(e){var i=e.texture,s=r.get(e),l=r.get(i);e.addEventListener("dispose",H),l.__webglTexture=t.createTexture(),l.__version=i.version,o.memory.textures++;var u=!0===e.isWebGLCubeRenderTarget,h=!0===e.isWebGLMultisampleRenderTarget,d=i.isDataTexture3D||i.isDataTexture2DArray,p=I(e)||c;if(!c||i.format!==T||i.type!==w&&i.type!==M||(i.format=E,console.warn("THREE.WebGLRenderer: Rendering to textures with RGB format is not supported. Using RGBA format instead.")),u){s.__webglFramebuffer=[];for(var f=0;f<6;f++)s.__webglFramebuffer[f]=t.createFramebuffer()}else if(s.__webglFramebuffer=t.createFramebuffer(),h)if(c){s.__webglMultisampledFramebuffer=t.createFramebuffer(),s.__webglColorRenderbuffer=t.createRenderbuffer(),t.bindRenderbuffer(36161,s.__webglColorRenderbuffer);var m=a.convert(i.format),v=a.convert(i.type),g=O(i.internalFormat,m,v),y=Q(e);t.renderbufferStorageMultisample(36161,y,g,e.width,e.height),n.bindFramebuffer(36160,s.__webglMultisampledFramebuffer),t.framebufferRenderbuffer(36160,36064,36161,s.__webglColorRenderbuffer),t.bindRenderbuffer(36161,null),e.depthBuffer&&(s.__webglDepthRenderbuffer=t.createRenderbuffer(),Z(s.__webglDepthRenderbuffer,e,!0)),n.bindFramebuffer(36160,null)}else console.warn("THREE.WebGLRenderer: WebGLMultisampleRenderTarget can only be used with WebGL2.");if(u){n.bindTexture(34067,l.__webglTexture),j(34067,i,p);for(var x=0;x<6;x++)Y(s.__webglFramebuffer[x],e,36064,34069+x);N(i,p)&&B(34067,i,e.width,e.height),n.bindTexture(34067,null)}else{var _=3553;if(d)if(c)_=i.isDataTexture3D?32879:35866;else console.warn("THREE.DataTexture3D and THREE.DataTexture2DArray only supported with WebGL2.");n.bindTexture(_,l.__webglTexture),j(_,i,p),Y(s.__webglFramebuffer,e,36064,_),N(i,p)&&B(3553,i,e.width,e.height),n.bindTexture(3553,null)}e.depthBuffer&&J(e)},this.updateRenderTargetMipmap=function(t){var e=t.texture;if(N(e,I(t)||c)){var i=t.isWebGLCubeRenderTarget?34067:3553,a=r.get(e).__webglTexture;n.bindTexture(i,a),B(i,e,t.width,t.height),n.bindTexture(i,null)}},this.updateMultisampleRenderTarget=function(e){if(e.isWebGLMultisampleRenderTarget)if(c){var i=r.get(e);n.bindFramebuffer(36008,i.__webglMultisampledFramebuffer),n.bindFramebuffer(36009,i.__webglFramebuffer);var a=e.width,o=e.height,s=16384;e.depthBuffer&&(s|=256),e.stencilBuffer&&(s|=1024),t.blitFramebuffer(0,0,a,o,0,0,a,o,s,9728),n.bindFramebuffer(36160,i.__webglMultisampledFramebuffer)}else console.warn("THREE.WebGLRenderer: WebGLMultisampleRenderTarget can only be used with WebGL2.")},this.safeSetTexture2D=function(t,e){t&&t.isWebGLRenderTarget&&(!1===K&&(console.warn("THREE.WebGLTextures.safeSetTexture2D: don't use render targets as textures. Use their .texture property instead."),K=!0),t=t.texture),U(t,e)},this.safeSetTextureCube=function(t,e){t&&t.isWebGLCubeRenderTarget&&(!1===$&&(console.warn("THREE.WebGLTextures.safeSetTextureCube: don't use cube render targets as textures. Use their .texture property instead."),$=!0),t=t.texture),k(t,e)}}function aa(t,e,n){var r=n.isWebGL2;return{convert:function(t){var n;if(t===x)return 5121;if(1017===t)return 32819;if(1018===t)return 32820;if(1019===t)return 33635;if(1010===t)return 5120;if(1011===t)return 5122;if(t===_)return 5123;if(1013===t)return 5124;if(t===b)return 5125;if(t===w)return 5126;if(t===M)return r?5131:null!==(n=e.get("OES_texture_half_float"))?n.HALF_FLOAT_OES:null;if(1021===t)return 6406;if(t===T)return 6407;if(t===E)return 6408;if(1024===t)return 6409;if(1025===t)return 6410;if(t===A)return 6402;if(t===L)return 34041;if(1028===t)return 6403;if(1029===t)return 36244;if(1030===t)return 33319;if(1031===t)return 33320;if(1032===t)return 36248;if(1033===t)return 36249;if(t===R||t===C||t===P||t===D){if(null===(n=e.get("WEBGL_compressed_texture_s3tc")))return null;if(t===R)return n.COMPRESSED_RGB_S3TC_DXT1_EXT;if(t===C)return n.COMPRESSED_RGBA_S3TC_DXT1_EXT;if(t===P)return n.COMPRESSED_RGBA_S3TC_DXT3_EXT;if(t===D)return n.COMPRESSED_RGBA_S3TC_DXT5_EXT}if(t===I||t===N||t===B||t===O){if(null===(n=e.get("WEBGL_compressed_texture_pvrtc")))return null;if(t===I)return n.COMPRESSED_RGB_PVRTC_4BPPV1_IMG;if(t===N)return n.COMPRESSED_RGB_PVRTC_2BPPV1_IMG;if(t===B)return n.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG;if(t===O)return n.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG}if(36196===t)return null!==(n=e.get("WEBGL_compressed_texture_etc1"))?n.COMPRESSED_RGB_ETC1_WEBGL:null;if((t===z||t===F)&&null!==(n=e.get("WEBGL_compressed_texture_etc"))){if(t===z)return n.COMPRESSED_RGB8_ETC2;if(t===F)return n.COMPRESSED_RGBA8_ETC2_EAC}return 37808===t||37809===t||37810===t||37811===t||37812===t||37813===t||37814===t||37815===t||37816===t||37817===t||37818===t||37819===t||37820===t||37821===t||37840===t||37841===t||37842===t||37843===t||37844===t||37845===t||37846===t||37847===t||37848===t||37849===t||37850===t||37851===t||37852===t||37853===t?null!==(n=e.get("WEBGL_compressed_texture_astc"))?t:null:36492===t?null!==(n=e.get("EXT_texture_compression_bptc"))?t:null:t===S?r?34042:null!==(n=e.get("WEBGL_depth_texture"))?n.UNSIGNED_INT_24_8_WEBGL:null:void 0}}}var oa=function(t){function e(e){var n;return void 0===e&&(e=[]),(n=t.call(this)||this).cameras=e,n}return st(e,t),e}(Qn);oa.prototype.isArrayCamera=!0;var sa=function(t){function e(){var e;return(e=t.call(this)||this).type="Group",e}return st(e,t),e}(Re);function la(){this._targetRay=null,this._grip=null,this._hand=null}function ua(t,e){var n=this,r=t.state,i=null,a=1,o=null,s="local-floor",l=null,u=[],c=new Map,h=new Qn;h.layers.enable(1),h.viewport=new Mt;var d=new Qn;d.layers.enable(2),d.viewport=new Mt;var p=[h,d],f=new oa;f.layers.enable(1),f.layers.enable(2);var m=null,v=null;function g(t){var e=c.get(t.inputSource);e&&e.dispatchEvent({type:t.type,data:t.inputSource})}function y(){c.forEach((function(t,e){t.disconnect(e)})),c.clear(),m=null,v=null,r.bindXRFramebuffer(null),t.setRenderTarget(t.getRenderTarget()),S.stop(),n.isPresenting=!1,n.dispatchEvent({type:"sessionend"})}function x(t){for(var e=i.inputSources,n=0;n0&&Ct(a,t,e),o.length>0&&Ct(o,t,e),null!==b&&(Q.updateRenderTargetMipmap(b),Q.updateMultisampleRenderTarget(b)),!0===t.isScene&&t.onAfterRender(v,t,e),Y.buffers.depth.setTest(!0),Y.buffers.depth.setMask(!0),Y.buffers.color.setMask(!0),Y.setPolygonOffset(!1),pt.resetDefaultState(),S=-1,T=null,m.pop(),p=m.length>0?m[m.length-1]:null,f.pop(),d=f.length>0?f[f.length-1]:null}}else console.error("THREE.WebGLRenderer.render: camera is not an instance of THREE.Camera.")},this.getActiveCubeFace=function(){return y},this.getActiveMipmapLevel=function(){return _},this.getRenderTarget=function(){return b},this.setRenderTarget=function(t,e,n){void 0===e&&(e=0),void 0===n&&(n=0),b=t,y=e,_=n,t&&void 0===J.get(t).__webglFramebuffer&&Q.setupRenderTarget(t);var r=null,i=!1,a=!1;if(t){var o=t.texture;(o.isDataTexture3D||o.isDataTexture2DArray)&&(a=!0);var s=J.get(t).__webglFramebuffer;t.isWebGLCubeRenderTarget?(r=s[e],i=!0):r=t.isWebGLMultisampleRenderTarget?J.get(t).__webglMultisampledFramebuffer:s,A.copy(t.viewport),L.copy(t.scissor),R=t.scissorTest}else A.copy(B).multiplyScalar(D).floor(),L.copy(O).multiplyScalar(D).floor(),R=z;if(Y.bindFramebuffer(36160,r),Y.viewport(A),Y.scissor(L),Y.setScissorTest(R),i){var l=J.get(t.texture);ft.framebufferTexture2D(36160,36064,34069+e,l.__webglTexture,n)}else if(a){var u=J.get(t.texture),c=e||0;ft.framebufferTextureLayer(36160,36064,u.__webglTexture,n||0,c)}},this.readRenderTargetPixels=function(t,e,n,r,i,a,o){if(t&&t.isWebGLRenderTarget){var s=J.get(t).__webglFramebuffer;if(t.isWebGLCubeRenderTarget&&void 0!==o&&(s=s[o]),s){Y.bindFramebuffer(36160,s);try{var l=t.texture,u=l.format,c=l.type;if(u!==E&&dt.convert(u)!==ft.getParameter(35739))return void console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in RGBA or implementation defined format.");var h=c===M&&(j.has("EXT_color_buffer_half_float")||q.isWebGL2&&j.has("EXT_color_buffer_float"));if(!(c===x||dt.convert(c)===ft.getParameter(35738)||c===w&&(q.isWebGL2||j.has("OES_texture_float")||j.has("WEBGL_color_buffer_float"))||h))return void console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in UnsignedByteType or implementation defined type.");36053===ft.checkFramebufferStatus(36160)?e>=0&&e<=t.width-r&&n>=0&&n<=t.height-i&&ft.readPixels(e,n,r,i,dt.convert(u),dt.convert(c),a):console.error("THREE.WebGLRenderer.readRenderTargetPixels: readPixels from renderTarget failed. Framebuffer not complete.")}finally{var d=null!==b?J.get(b).__webglFramebuffer:null;Y.bindFramebuffer(36160,d)}}}else console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.")},this.copyFramebufferToTexture=function(t,e,n){void 0===n&&(n=0);var r=Math.pow(2,-n),i=Math.floor(e.image.width*r),a=Math.floor(e.image.height*r),o=dt.convert(e.format);Q.setTexture2D(e,0),ft.copyTexImage2D(3553,n,o,t.x,t.y,i,a,0),Y.unbindTexture()},this.copyTextureToTexture=function(t,e,n,r){void 0===r&&(r=0);var i=e.image.width,a=e.image.height,o=dt.convert(n.format),s=dt.convert(n.type);Q.setTexture2D(n,0),ft.pixelStorei(37440,n.flipY),ft.pixelStorei(37441,n.premultiplyAlpha),ft.pixelStorei(3317,n.unpackAlignment),e.isDataTexture?ft.texSubImage2D(3553,r,t.x,t.y,i,a,o,s,e.image.data):e.isCompressedTexture?ft.compressedTexSubImage2D(3553,r,t.x,t.y,e.mipmaps[0].width,e.mipmaps[0].height,o,e.mipmaps[0].data):ft.texSubImage2D(3553,r,t.x,t.y,o,s,e.image),0===r&&n.generateMipmaps&&ft.generateMipmap(3553),Y.unbindTexture()},this.copyTextureToTexture3D=function(t,e,n,r,i){if(void 0===i&&(i=0),v.isWebGL1Renderer)console.warn("THREE.WebGLRenderer.copyTextureToTexture3D: can only be used with WebGL2.");else{var a,o=n.image,s=o.width,l=o.height,u=o.data,c=dt.convert(r.format),h=dt.convert(r.type);if(r.isDataTexture3D)Q.setTexture3D(r,0),a=32879;else{if(!r.isDataTexture2DArray)return void console.warn("THREE.WebGLRenderer.copyTextureToTexture3D: only supports THREE.DataTexture3D and THREE.DataTexture2DArray.");Q.setTexture2DArray(r,0),a=35866}ft.pixelStorei(37440,r.flipY),ft.pixelStorei(37441,r.premultiplyAlpha),ft.pixelStorei(3317,r.unpackAlignment);var d=ft.getParameter(3314),p=ft.getParameter(32878),f=ft.getParameter(3316),m=ft.getParameter(3315),g=ft.getParameter(32877);ft.pixelStorei(3314,s),ft.pixelStorei(32878,l),ft.pixelStorei(3316,t.min.x),ft.pixelStorei(3315,t.min.y),ft.pixelStorei(32877,t.min.z),ft.texSubImage3D(a,i,e.x,e.y,e.z,t.max.x-t.min.x+1,t.max.y-t.min.y+1,t.max.z-t.min.z+1,c,h,u),ft.pixelStorei(3314,d),ft.pixelStorei(32878,p),ft.pixelStorei(3316,f),ft.pixelStorei(3315,m),ft.pixelStorei(32877,g),0===i&&r.generateMipmaps&&ft.generateMipmap(a),Y.unbindTexture()}},this.initTexture=function(t){Q.setTexture2D(t,0),Y.unbindTexture()},this.resetState=function(){y=0,_=0,b=null,Y.reset(),pt.reset()},"undefined"!=typeof __THREE_DEVTOOLS__&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}sa.prototype.isGroup=!0,Object.assign(la.prototype,{constructor:la,getHandSpace:function(){return null===this._hand&&(this._hand=new sa,this._hand.matrixAutoUpdate=!1,this._hand.visible=!1,this._hand.joints={},this._hand.inputState={pinching:!1}),this._hand},getTargetRaySpace:function(){return null===this._targetRay&&(this._targetRay=new sa,this._targetRay.matrixAutoUpdate=!1,this._targetRay.visible=!1),this._targetRay},getGripSpace:function(){return null===this._grip&&(this._grip=new sa,this._grip.matrixAutoUpdate=!1,this._grip.visible=!1),this._grip},dispatchEvent:function(t){return null!==this._targetRay&&this._targetRay.dispatchEvent(t),null!==this._grip&&this._grip.dispatchEvent(t),null!==this._hand&&this._hand.dispatchEvent(t),this},disconnect:function(t){return this.dispatchEvent({type:"disconnected",data:t}),null!==this._targetRay&&(this._targetRay.visible=!1),null!==this._grip&&(this._grip.visible=!1),null!==this._hand&&(this._hand.visible=!1),this},update:function(t,e,n){var r=null,i=null,a=null,o=this._targetRay,s=this._grip,l=this._hand;if(t&&"visible-blurred"!==e.session.visibilityState)if(null!==o&&null!==(r=e.getPose(t.targetRaySpace,n))&&(o.matrix.fromArray(r.transform.matrix),o.matrix.decompose(o.position,o.rotation,o.scale)),l&&t.hand){a=!0;for(var u,c=ct(t.hand.values());!(u=c()).done;){var h=u.value,d=e.getJointPose(h,n);if(void 0===l.joints[h.jointName]){var p=new sa;p.matrixAutoUpdate=!1,p.visible=!1,l.joints[h.jointName]=p,l.add(p)}var f=l.joints[h.jointName];null!==d&&(f.matrix.fromArray(d.transform.matrix),f.matrix.decompose(f.position,f.rotation,f.scale),f.jointRadius=d.radius),f.visible=null!==d}var m=l.joints["index-finger-tip"],v=l.joints["thumb-tip"],g=m.position.distanceTo(v.position);l.inputState.pinching&&g>.025?(l.inputState.pinching=!1,this.dispatchEvent({type:"pinchend",handedness:t.handedness,target:this})):!l.inputState.pinching&&g<=.015&&(l.inputState.pinching=!0,this.dispatchEvent({type:"pinchstart",handedness:t.handedness,target:this}))}else null!==s&&t.gripSpace&&null!==(i=e.getPose(t.gripSpace,n))&&(s.matrix.fromArray(i.transform.matrix),s.matrix.decompose(s.position,s.rotation,s.scale));return null!==o&&(o.visible=null!==r),null!==s&&(s.visible=null!==i),null!==l&&(l.visible=null!==a),this}}),Object.assign(ua.prototype,ht.prototype);var da=function(t){function e(){return t.apply(this,arguments)||this}return st(e,t),e}(ha);da.prototype.isWebGL1Renderer=!0;var pa=function(){function t(t,e){this.name="",this.color=new $e(t),this.density=void 0!==e?e:25e-5}var e=t.prototype;return e.clone=function(){return new t(this.color,this.density)},e.toJSON=function(){return{type:"FogExp2",color:this.color.getHex(),density:this.density}},t}();pa.prototype.isFogExp2=!0;var fa=function(){function t(t,e,n){this.name="",this.color=new $e(t),this.near=void 0!==e?e:1,this.far=void 0!==n?n:1e3}var e=t.prototype;return e.clone=function(){return new t(this.color,this.near,this.far)},e.toJSON=function(){return{type:"Fog",color:this.color.getHex(),near:this.near,far:this.far}},t}();fa.prototype.isFog=!0;var ma=function(t){function e(){var e;return(e=t.call(this)||this).type="Scene",e.background=null,e.environment=null,e.fog=null,e.overrideMaterial=null,e.autoUpdate=!0,"undefined"!=typeof __THREE_DEVTOOLS__&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:lt(e)})),e}st(e,t);var n=e.prototype;return n.copy=function(e,n){return t.prototype.copy.call(this,e,n),null!==e.background&&(this.background=e.background.clone()),null!==e.environment&&(this.environment=e.environment.clone()),null!==e.fog&&(this.fog=e.fog.clone()),null!==e.overrideMaterial&&(this.overrideMaterial=e.overrideMaterial.clone()),this.autoUpdate=e.autoUpdate,this.matrixAutoUpdate=e.matrixAutoUpdate,this},n.toJSON=function(e){var n=t.prototype.toJSON.call(this,e);return null!==this.background&&(n.object.background=this.background.toJSON(e)),null!==this.environment&&(n.object.environment=this.environment.toJSON(e)),null!==this.fog&&(n.object.fog=this.fog.toJSON()),n},e}(Re);function va(t,e){this.array=t,this.stride=e,this.count=void 0!==t?t.length/e:0,this.usage=et,this.updateRange={offset:0,count:-1},this.version=0,this.uuid=mt.generateUUID()}ma.prototype.isScene=!0,Object.defineProperty(va.prototype,"needsUpdate",{set:function(t){!0===t&&this.version++}}),Object.assign(va.prototype,{isInterleavedBuffer:!0,onUploadCallback:function(){},setUsage:function(t){return this.usage=t,this},copy:function(t){return this.array=new t.array.constructor(t.array),this.count=t.count,this.stride=t.stride,this.usage=t.usage,this},copyAt:function(t,e,n){t*=this.stride,n*=e.stride;for(var r=0,i=this.stride;rt.far||e.push({distance:s,point:ba.clone(),uv:We.getUV(ba,Aa,La,Ra,Ca,Pa,Da,new vt),face:null,object:this})}},n.copy=function(e){return t.prototype.copy.call(this,e),void 0!==e.center&&this.center.copy(e.center),this.material=e.material,this},e}(Re);function Na(t,e,n,r,i,a){Sa.subVectors(t,n).addScalar(.5).multiply(r),void 0!==i?(Ta.x=a*Sa.x-i*Sa.y,Ta.y=i*Sa.x+a*Sa.y):Ta.copy(Sa),t.copy(e),t.x+=Ta.x,t.y+=Ta.y,t.applyMatrix4(Ea)}Ia.prototype.isSprite=!0;var Ba=new At,Oa=new At,za=function(t){function e(){var e;return(e=t.call(this)||this)._currentLevel=0,e.type="LOD",Object.defineProperties(lt(e),{levels:{enumerable:!0,value:[]},isLOD:{value:!0}}),e.autoUpdate=!0,e}st(e,t);var n=e.prototype;return n.copy=function(e){t.prototype.copy.call(this,e,!1);for(var n=e.levels,r=0,i=n.length;r0){var n,r;for(n=1,r=e.length;n0){Ba.setFromMatrixPosition(this.matrixWorld);var n=t.ray.origin.distanceTo(Ba);this.getObjectForDistance(n).raycast(t,e)}},n.update=function(t){var e=this.levels;if(e.length>1){Ba.setFromMatrixPosition(t.matrixWorld),Oa.setFromMatrixPosition(this.matrixWorld);var n,r,i=Ba.distanceTo(Oa)/t.zoom;for(e[0].object.visible=!0,n=1,r=e.length;n=e[n].distance;n++)e[n-1].object.visible=!1,e[n].object.visible=!0;for(this._currentLevel=n-1;ns)){h.applyMatrix4(this.matrixWorld);var x=t.ray.origin.distanceTo(h);xt.far||e.push({distance:x,point:c.clone().applyMatrix4(this.matrixWorld),index:m,face:null,faceIndex:null,object:this})}}else for(var _=Math.max(0,a.start),b=Math.min(f.count,a.start+a.count)-1;_s)){h.applyMatrix4(this.matrixWorld);var w=t.ray.origin.distanceTo(h);wt.far||e.push({distance:w,point:c.clone().applyMatrix4(this.matrixWorld),index:_,face:null,faceIndex:null,object:this})}}}else n.isGeometry&&console.error("THREE.Line.raycast() no longer supports THREE.Geometry. Use THREE.BufferGeometry instead.")}},updateMorphTargets:function(){var t=this.geometry;if(t.isBufferGeometry){var e=t.morphAttributes,n=Object.keys(e);if(n.length>0){var r=e[n[0]];if(void 0!==r){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(var i=0,a=r.length;i0&&console.error("THREE.Line.updateMorphTargets() does not support THREE.Geometry. Use THREE.BufferGeometry instead.")}}});var lo=new At,uo=new At;function co(t,e){so.call(this,t,e),this.type="LineSegments"}co.prototype=Object.assign(Object.create(so.prototype),{constructor:co,isLineSegments:!0,computeLineDistances:function(){var t=this.geometry;if(t.isBufferGeometry)if(null===t.index){for(var e=t.attributes.position,n=[],r=0,i=e.count;ri.far)return;a.push({distance:u,distanceToRay:Math.sqrt(s),point:l,index:e,face:null,object:o})}}yo.prototype=Object.assign(Object.create(Re.prototype),{constructor:yo,isPoints:!0,copy:function(t){return Re.prototype.copy.call(this,t),this.material=t.material,this.geometry=t.geometry,this},raycast:function(t,e){var n=this.geometry,r=this.matrixWorld,i=t.params.Points.threshold,a=n.drawRange;if(null===n.boundingSphere&&n.computeBoundingSphere(),vo.copy(n.boundingSphere),vo.applyMatrix4(r),vo.radius+=i,!1!==t.ray.intersectsSphere(vo)){fo.copy(r).invert(),mo.copy(t.ray).applyMatrix4(fo);var o=i/((this.scale.x+this.scale.y+this.scale.z)/3),s=o*o;if(n.isBufferGeometry){var l=n.index,u=n.attributes.position;if(null!==l)for(var c=Math.max(0,a.start),h=Math.min(l.count,a.start+a.count);c0){var r=e[n[0]];if(void 0!==r){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(var i=0,a=r.length;i0&&console.error("THREE.Points.updateMorphTargets() does not support THREE.Geometry. Use THREE.BufferGeometry instead.")}}});var _o=function(t){function e(e,n,r,i,a,o,s,l,u){var c;(c=t.call(this,e,n,r,i,a,o,s,l,u)||this).format=void 0!==s?s:T,c.minFilter=void 0!==o?o:v,c.magFilter=void 0!==a?a:v,c.generateMipmaps=!1;var h=lt(c);return"requestVideoFrameCallback"in e&&e.requestVideoFrameCallback((function t(){h.needsUpdate=!0,e.requestVideoFrameCallback(t)})),c}st(e,t);var n=e.prototype;return n.clone=function(){return new this.constructor(this.image).copy(this)},n.update=function(){var t=this.image;!1==="requestVideoFrameCallback"in t&&t.readyState>=t.HAVE_CURRENT_DATA&&(this.needsUpdate=!0)},e}(bt);_o.prototype.isVideoTexture=!0;var bo=function(t){function e(e,n,r,i,a,o,s,l,u,c,h,d){var p;return(p=t.call(this,null,o,s,l,u,c,i,a,h,d)||this).image={width:n,height:r},p.mipmaps=e,p.flipY=!1,p.generateMipmaps=!1,p}return st(e,t),e}(bt);bo.prototype.isCompressedTexture=!0;var wo=function(t){function e(e,n,r,i,a,o,s,l,u){var c;return(c=t.call(this,e,n,r,i,a,o,s,l,u)||this).needsUpdate=!0,c}return st(e,t),e}(bt);wo.prototype.isCanvasTexture=!0;var Mo=function(t){function e(e,n,r,i,a,o,s,l,u,c){var h;if((c=void 0!==c?c:A)!==A&&c!==L)throw new Error("DepthTexture format must be either THREE.DepthFormat or THREE.DepthStencilFormat");return void 0===r&&c===A&&(r=_),void 0===r&&c===L&&(r=S),(h=t.call(this,null,i,a,o,s,l,c,r,u)||this).image={width:e,height:n},h.magFilter=void 0!==s?s:p,h.minFilter=void 0!==l?l:p,h.flipY=!1,h.generateMipmaps=!1,h}return st(e,t),e}(bt);Mo.prototype.isDepthTexture=!0;var So=function(t){function e(e,n,r,i){var a;void 0===e&&(e=1),void 0===n&&(n=8),void 0===r&&(r=0),void 0===i&&(i=2*Math.PI),(a=t.call(this)||this).type="CircleGeometry",a.parameters={radius:e,segments:n,thetaStart:r,thetaLength:i},n=Math.max(3,n);var o=[],s=[],l=[],u=[],c=new At,h=new vt;s.push(0,0,0),l.push(0,0,1),u.push(.5,.5);for(var d=0,p=3;d<=n;d++,p+=3){var f=r+d/n*i;c.x=e*Math.cos(f),c.y=e*Math.sin(f),s.push(c.x,c.y,c.z),l.push(0,0,1),h.x=(s[p]/e+1)/2,h.y=(s[p+1]/e+1)/2,u.push(h.x,h.y)}for(var m=1;m<=n;m++)o.push(m,m+1,0);return a.setIndex(o),a.setAttribute("position",new pn(s,3)),a.setAttribute("normal",new pn(l,3)),a.setAttribute("uv",new pn(u,2)),a}return st(e,t),e}(Tn),To=function(t){function e(e,n,r,i,a,o,s,l){var u;void 0===e&&(e=1),void 0===n&&(n=1),void 0===r&&(r=1),void 0===i&&(i=8),void 0===a&&(a=1),void 0===o&&(o=!1),void 0===s&&(s=0),void 0===l&&(l=2*Math.PI),(u=t.call(this)||this).type="CylinderGeometry",u.parameters={radiusTop:e,radiusBottom:n,height:r,radialSegments:i,heightSegments:a,openEnded:o,thetaStart:s,thetaLength:l};var c=lt(u);i=Math.floor(i),a=Math.floor(a);var h=[],d=[],p=[],f=[],m=0,v=[],g=r/2,y=0;function x(t){for(var r=m,a=new vt,o=new At,u=0,v=!0===t?e:n,x=!0===t?1:-1,_=1;_<=i;_++)d.push(0,g*x,0),p.push(0,x,0),f.push(.5,.5),m++;for(var b=m,w=0;w<=i;w++){var M=w/i*l+s,S=Math.cos(M),T=Math.sin(M);o.x=v*T,o.y=g*x,o.z=v*S,d.push(o.x,o.y,o.z),p.push(0,x,0),a.x=.5*S+.5,a.y=.5*T*x+.5,f.push(a.x,a.y),m++}for(var E=0;E0&&x(!0),n>0&&x(!1)),u.setIndex(h),u.setAttribute("position",new pn(d,3)),u.setAttribute("normal",new pn(p,3)),u.setAttribute("uv",new pn(f,2)),u}return st(e,t),e}(Tn),Eo=function(t){function e(e,n,r,i,a,o,s){var l;return void 0===e&&(e=1),void 0===n&&(n=1),void 0===r&&(r=8),void 0===i&&(i=1),void 0===a&&(a=!1),void 0===o&&(o=0),void 0===s&&(s=2*Math.PI),(l=t.call(this,0,e,n,r,i,a,o,s)||this).type="ConeGeometry",l.parameters={radius:e,height:n,radialSegments:r,heightSegments:i,openEnded:a,thetaStart:o,thetaLength:s},l}return st(e,t),e}(To),Ao=function(t){function e(e,n,r,i){var a;void 0===r&&(r=1),void 0===i&&(i=0),(a=t.call(this)||this).type="PolyhedronGeometry",a.parameters={vertices:e,indices:n,radius:r,detail:i};var o=[],s=[];function l(t,e,n,r){for(var i=r+1,a=[],o=0;o<=i;o++){a[o]=[];for(var s=t.clone().lerp(n,o/i),l=e.clone().lerp(n,o/i),c=i-o,h=0;h<=c;h++)a[o][h]=0===h&&o===i?s:s.clone().lerp(l,h/c)}for(var d=0;d.9&&a<.1&&(e<.2&&(s[t+0]+=1),n<.2&&(s[t+2]+=1),r<.2&&(s[t+4]+=1))}}()}(),a.setAttribute("position",new pn(o,3)),a.setAttribute("normal",new pn(o.slice(),3)),a.setAttribute("uv",new pn(s,2)),0===i?a.computeVertexNormals():a.normalizeNormals(),a}return st(e,t),e}(Tn),Lo=function(t){function e(e,n){var r;void 0===e&&(e=1),void 0===n&&(n=0);var i=(1+Math.sqrt(5))/2,a=1/i,o=[-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,-a,-i,0,-a,i,0,a,-i,0,a,i,-a,-i,0,-a,i,0,a,-i,0,a,i,0,-i,0,-a,i,0,-a,-i,0,a,i,0,a];return(r=t.call(this,o,[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],e,n)||this).type="DodecahedronGeometry",r.parameters={radius:e,detail:n},r}return st(e,t),e}(Ao),Ro=new At,Co=new At,Po=new At,Do=new We,Io=function(t){function e(e,n){var r;if((r=t.call(this)||this).type="EdgesGeometry",r.parameters={thresholdAngle:n},n=void 0!==n?n:1,!0===e.isGeometry)return console.error("THREE.EdgesGeometry no longer supports THREE.Geometry. Use THREE.BufferGeometry instead."),lt(r);for(var i=Math.pow(10,4),a=Math.cos(mt.DEG2RAD*n),o=e.getIndex(),s=e.getAttribute("position"),l=o?o.count:s.count,u=[0,0,0],c=["a","b","c"],h=new Array(3),d={},p=[],f=0;f80*n){r=a=t[0],i=o=t[1];for(var f=n;fa&&(a=s),l>o&&(o=l);u=0!==(u=Math.max(a-r,o-i))?1/u:0}return zo(d,p,n,r,i,u),p};function Bo(t,e,n,r,i){var a,o;if(i===function(t,e,n,r){for(var i=0,a=e,o=n-r;a0)for(a=e;a=e;a-=r)o=ns(a,t[a],t[a+1],o);return o&&Jo(o,o.next)&&(rs(o),o=o.next),o}function Oo(t,e){if(!t)return t;e||(e=t);var n,r=t;do{if(n=!1,r.steiner||!Jo(r,r.next)&&0!==Zo(r.prev,r,r.next))r=r.next;else{if(rs(r),(r=e=r.prev)===r.next)break;n=!0}}while(n||r!==e);return e}function zo(t,e,n,r,i,a,o){if(t){!o&&a&&function(t,e,n,r){var i=t;do{null===i.z&&(i.z=jo(i.x,i.y,e,n,r)),i.prevZ=i.prev,i.nextZ=i.next,i=i.next}while(i!==t);i.prevZ.nextZ=null,i.prevZ=null,function(t){var e,n,r,i,a,o,s,l,u=1;do{for(n=t,t=null,a=null,o=0;n;){for(o++,r=n,s=0,e=0;e0||l>0&&r;)0!==s&&(0===l||!r||n.z<=r.z)?(i=n,n=n.nextZ,s--):(i=r,r=r.nextZ,l--),a?a.nextZ=i:t=i,i.prevZ=a,a=i;n=r}a.nextZ=null,u*=2}while(o>1)}(i)}(t,r,i,a);for(var s,l,u=t;t.prev!==t.next;)if(s=t.prev,l=t.next,a?Ho(t,r,i,a):Fo(t))e.push(s.i/n),e.push(t.i/n),e.push(l.i/n),rs(t),t=l.next,u=l.next;else if((t=l)===u){o?1===o?zo(t=Go(Oo(t),e,n),e,n,r,i,a,2):2===o&&Uo(t,e,n,r,i,a):zo(Oo(t),e,n,r,i,a,1);break}}}function Fo(t){var e=t.prev,n=t,r=t.next;if(Zo(e,n,r)>=0)return!1;for(var i=t.next.next;i!==t.prev;){if(Xo(e.x,e.y,n.x,n.y,r.x,r.y,i.x,i.y)&&Zo(i.prev,i,i.next)>=0)return!1;i=i.next}return!0}function Ho(t,e,n,r){var i=t.prev,a=t,o=t.next;if(Zo(i,a,o)>=0)return!1;for(var s=i.xa.x?i.x>o.x?i.x:o.x:a.x>o.x?a.x:o.x,c=i.y>a.y?i.y>o.y?i.y:o.y:a.y>o.y?a.y:o.y,h=jo(s,l,e,n,r),d=jo(u,c,e,n,r),p=t.prevZ,f=t.nextZ;p&&p.z>=h&&f&&f.z<=d;){if(p!==t.prev&&p!==t.next&&Xo(i.x,i.y,a.x,a.y,o.x,o.y,p.x,p.y)&&Zo(p.prev,p,p.next)>=0)return!1;if(p=p.prevZ,f!==t.prev&&f!==t.next&&Xo(i.x,i.y,a.x,a.y,o.x,o.y,f.x,f.y)&&Zo(f.prev,f,f.next)>=0)return!1;f=f.nextZ}for(;p&&p.z>=h;){if(p!==t.prev&&p!==t.next&&Xo(i.x,i.y,a.x,a.y,o.x,o.y,p.x,p.y)&&Zo(p.prev,p,p.next)>=0)return!1;p=p.prevZ}for(;f&&f.z<=d;){if(f!==t.prev&&f!==t.next&&Xo(i.x,i.y,a.x,a.y,o.x,o.y,f.x,f.y)&&Zo(f.prev,f,f.next)>=0)return!1;f=f.nextZ}return!0}function Go(t,e,n){var r=t;do{var i=r.prev,a=r.next.next;!Jo(i,a)&&Qo(i,r,r.next,a)&&ts(i,a)&&ts(a,i)&&(e.push(i.i/n),e.push(r.i/n),e.push(a.i/n),rs(r),rs(r.next),r=t=a),r=r.next}while(r!==t);return Oo(r)}function Uo(t,e,n,r,i,a){var o=t;do{for(var s=o.next.next;s!==o.prev;){if(o.i!==s.i&&Yo(o,s)){var l=es(o,s);return o=Oo(o,o.next),l=Oo(l,l.next),zo(o,e,n,r,i,a),void zo(l,e,n,r,i,a)}s=s.next}o=o.next}while(o!==t)}function ko(t,e){return t.x-e.x}function Vo(t,e){if(e=function(t,e){var n,r=e,i=t.x,a=t.y,o=-1/0;do{if(a<=r.y&&a>=r.next.y&&r.next.y!==r.y){var s=r.x+(a-r.y)*(r.next.x-r.x)/(r.next.y-r.y);if(s<=i&&s>o){if(o=s,s===i){if(a===r.y)return r;if(a===r.next.y)return r.next}n=r.x=r.x&&r.x>=c&&i!==r.x&&Xo(an.x||r.x===n.x&&Wo(n,r)))&&(n=r,d=l)),r=r.next}while(r!==u);return n}(t,e)){var n=es(e,t);Oo(e,e.next),Oo(n,n.next)}}function Wo(t,e){return Zo(t.prev,t,e.prev)<0&&Zo(e.next,t,t.next)<0}function jo(t,e,n,r,i){return(t=1431655765&((t=858993459&((t=252645135&((t=16711935&((t=32767*(t-n)*i)|t<<8))|t<<4))|t<<2))|t<<1))|(e=1431655765&((e=858993459&((e=252645135&((e=16711935&((e=32767*(e-r)*i)|e<<8))|e<<4))|e<<2))|e<<1))<<1}function qo(t){var e=t,n=t;do{(e.x=0&&(t-o)*(r-s)-(n-o)*(e-s)>=0&&(n-o)*(a-s)-(i-o)*(r-s)>=0}function Yo(t,e){return t.next.i!==e.i&&t.prev.i!==e.i&&!function(t,e){var n=t;do{if(n.i!==t.i&&n.next.i!==t.i&&n.i!==e.i&&n.next.i!==e.i&&Qo(n,n.next,t,e))return!0;n=n.next}while(n!==t);return!1}(t,e)&&(ts(t,e)&&ts(e,t)&&function(t,e){var n=t,r=!1,i=(t.x+e.x)/2,a=(t.y+e.y)/2;do{n.y>a!=n.next.y>a&&n.next.y!==n.y&&i<(n.next.x-n.x)*(a-n.y)/(n.next.y-n.y)+n.x&&(r=!r),n=n.next}while(n!==t);return r}(t,e)&&(Zo(t.prev,t,e.prev)||Zo(t,e.prev,e))||Jo(t,e)&&Zo(t.prev,t,t.next)>0&&Zo(e.prev,e,e.next)>0)}function Zo(t,e,n){return(e.y-t.y)*(n.x-e.x)-(e.x-t.x)*(n.y-e.y)}function Jo(t,e){return t.x===e.x&&t.y===e.y}function Qo(t,e,n,r){var i=$o(Zo(t,e,n)),a=$o(Zo(t,e,r)),o=$o(Zo(n,r,t)),s=$o(Zo(n,r,e));return i!==a&&o!==s||(!(0!==i||!Ko(t,n,e))||(!(0!==a||!Ko(t,r,e))||(!(0!==o||!Ko(n,t,r))||!(0!==s||!Ko(n,e,r)))))}function Ko(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 $o(t){return t>0?1:t<0?-1:0}function ts(t,e){return Zo(t.prev,t,t.next)<0?Zo(t,e,t.next)>=0&&Zo(t,t.prev,e)>=0:Zo(t,e,t.prev)<0||Zo(t,t.next,e)<0}function es(t,e){var n=new is(t.i,t.x,t.y),r=new is(e.i,e.x,e.y),i=t.next,a=e.prev;return t.next=e,e.prev=t,n.next=i,i.prev=n,r.next=n,n.prev=r,a.next=r,r.prev=a,r}function ns(t,e,n,r){var i=new is(t,e,n);return r?(i.next=r.next,i.prev=r,r.next.prev=i,r.next=i):(i.prev=i,i.next=i),i}function rs(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 is(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}var as={area:function(t){for(var e=t.length,n=0,r=e-1,i=0;i2&&t[e-1].equals(t[0])&&t.pop()}function ss(t,e){for(var n=0;nNumber.EPSILON){var d=Math.sqrt(c),p=Math.sqrt(l*l+u*u),f=e.x-s/d,m=e.y+o/d,v=((n.x-u/p-f)*u-(n.y+l/p-m)*l)/(o*u-s*l),g=(r=f+o*v-t.x)*r+(i=m+s*v-t.y)*i;if(g<=2)return new vt(r,i);a=Math.sqrt(g/2)}else{var y=!1;o>Number.EPSILON?l>Number.EPSILON&&(y=!0):o<-Number.EPSILON?l<-Number.EPSILON&&(y=!0):Math.sign(s)===Math.sign(u)&&(y=!0),y?(r=-s,i=o,a=Math.sqrt(c)):(r=o,i=s,a=Math.sqrt(c/2))}return new vt(r/a,i/a)}for(var z=[],F=0,H=R.length,G=H-1,U=F+1;F=0;yt--){for(var xt=yt/p,_t=c*Math.cos(xt*Math.PI/2),bt=h*Math.sin(xt*Math.PI/2)+d,wt=0,Mt=R.length;wt=0;){var r=n,i=n-1;i<0&&(i=t.length-1);for(var a=0,o=s+2*p;a=0?(t(g-s,m,c),h.subVectors(u,c)):(t(g+s,m,c),h.subVectors(c,u)),m-s>=0?(t(g,m-s,c),d.subVectors(u,c)):(t(g,m+s,c),d.subVectors(c,u)),l.crossVectors(h,d).normalize(),a.push(l.x,l.y,l.z),o.push(g,m)}for(var y=0;y0)&&f.push(E,A,R),(S!==r-1||u=r)){c.push(l.times[d]);for(var f=0;fa.tracks[v].times[0]&&(m=a.tracks[v].times[0]);for(var g=0;g=r.times[h]){var m=h*l+s,v=m+l-s;d=Bs.arraySlice(r.values,m,v)}else{var g=r.createInterpolant(),y=s,x=l-s;g.evaluate(a),d=Bs.arraySlice(g.resultBuffer,y,x)}"quaternion"===i&&(new Et).fromArray(d).normalize().conjugate().toArray(d);for(var _=o.times.length,b=0;b<_;++b){var w=b*c+u;if("quaternion"===i)Et.multiplyQuaternionsFlat(o.values,w,d,0,o.values,w);else for(var M=c-2*u,S=0;S=i)break t;var s=e[1];t=(i=e[--n-1]))break e}a=n,n=0}for(;n>>1;te;)--a;if(++a,0!==i||a!==r){i>=a&&(i=(a=Math.max(a,1))-1);var o=this.getValueSize();this.times=Bs.arraySlice(n,i,a),this.values=Bs.arraySlice(this.values,i*o,a*o)}return this},e.validate=function(){var t=!0,e=this.getValueSize();e-Math.floor(e)!=0&&(console.error("THREE.KeyframeTrack: Invalid value size in track.",this),t=!1);var n=this.times,r=this.values,i=n.length;0===i&&(console.error("THREE.KeyframeTrack: Track is empty.",this),t=!1);for(var a=null,o=0;o!==i;o++){var s=n[o];if("number"==typeof s&&isNaN(s)){console.error("THREE.KeyframeTrack: Time is not a valid number.",this,o,s),t=!1;break}if(null!==a&&a>s){console.error("THREE.KeyframeTrack: Out of order keys.",this,o,s,a),t=!1;break}a=s}if(void 0!==r&&Bs.isTypedArray(r))for(var l=0,u=r.length;l!==u;++l){var c=r[l];if(isNaN(c)){console.error("THREE.KeyframeTrack: Value is not a valid number.",this,l,c),t=!1;break}}return t},e.optimize=function(){for(var t=Bs.arraySlice(this.times),e=Bs.arraySlice(this.values),n=this.getValueSize(),r=this.getInterpolation()===U,i=t.length-1,a=1,o=1;o0){t[a]=t[i];for(var g=i*n,y=a*n,x=0;x!==n;++x)e[y+x]=e[g+x];++a}return a!==t.length?(this.times=Bs.arraySlice(t,0,a),this.values=Bs.arraySlice(e,0,a*n)):(this.times=t,this.values=e),this},e.clone=function(){var t=Bs.arraySlice(this.times,0),e=Bs.arraySlice(this.values,0),n=new(0,this.constructor)(this.name,t,e);return n.createInterpolant=this.createInterpolant,n},t}();Gs.prototype.TimeBufferType=Float32Array,Gs.prototype.ValueBufferType=Float32Array,Gs.prototype.DefaultInterpolation=G;var Us=function(t){function e(){return t.apply(this,arguments)||this}return st(e,t),e}(Gs);Us.prototype.ValueTypeName="bool",Us.prototype.ValueBufferType=Array,Us.prototype.DefaultInterpolation=H,Us.prototype.InterpolantFactoryMethodLinear=void 0,Us.prototype.InterpolantFactoryMethodSmooth=void 0;var ks=function(t){function e(){return t.apply(this,arguments)||this}return st(e,t),e}(Gs);ks.prototype.ValueTypeName="color";var Vs=function(t){function e(){return t.apply(this,arguments)||this}return st(e,t),e}(Gs);function Ws(t,e,n,r){Os.call(this,t,e,n,r)}Vs.prototype.ValueTypeName="number",Ws.prototype=Object.assign(Object.create(Os.prototype),{constructor:Ws,interpolate_:function(t,e,n,r){for(var i=this.resultBuffer,a=this.sampleValues,o=this.valueSize,s=(n-e)/(r-e),l=t*o,u=l+o;l!==u;l+=4)Et.slerpFlat(i,0,a,l-o,a,l,s);return i}});var js=function(t){function e(){return t.apply(this,arguments)||this}return st(e,t),e.prototype.InterpolantFactoryMethodLinear=function(t){return new Ws(this.times,this.values,this.getValueSize(),t)},e}(Gs);js.prototype.ValueTypeName="quaternion",js.prototype.DefaultInterpolation=G,js.prototype.InterpolantFactoryMethodSmooth=void 0;var qs=function(t){function e(){return t.apply(this,arguments)||this}return st(e,t),e}(Gs);qs.prototype.ValueTypeName="string",qs.prototype.ValueBufferType=Array,qs.prototype.DefaultInterpolation=H,qs.prototype.InterpolantFactoryMethodLinear=void 0,qs.prototype.InterpolantFactoryMethodSmooth=void 0;var Xs=function(t){function e(){return t.apply(this,arguments)||this}return st(e,t),e}(Gs);Xs.prototype.ValueTypeName="vector";var Ys=function(){function t(t,e,n,r){void 0===e&&(e=-1),void 0===r&&(r=j),this.name=t,this.tracks=n,this.duration=e,this.blendMode=r,this.uuid=mt.generateUUID(),this.duration<0&&this.resetDuration()}t.parse=function(t){for(var e=[],n=t.tracks,r=1/(t.fps||1),i=0,a=n.length;i!==a;++i)e.push(Zs(n[i]).scale(r));var o=new this(t.name,t.duration,e,t.blendMode);return o.uuid=t.uuid,o},t.toJSON=function(t){for(var e=[],n=t.tracks,r={name:t.name,duration:t.duration,tracks:e,uuid:t.uuid,blendMode:t.blendMode},i=0,a=n.length;i!==a;++i)e.push(Gs.toJSON(n[i]));return r},t.CreateFromMorphTargetSequence=function(t,e,n,r){for(var i=e.length,a=[],o=0;o1){var u=l[1],c=r[u];c||(r[u]=c=[]),c.push(s)}}var h=[];for(var d in r)h.push(this.CreateFromMorphTargetSequence(d,r[d],e,n));return h},t.parseAnimation=function(t,e){if(!t)return console.error("THREE.AnimationClip: No animation in JSONLoader data."),null;for(var n=function(t,e,n,r,i){if(0!==n.length){var a=[],o=[];Bs.flattenJSON(n,a,o,r),0!==a.length&&i.push(new t(e,a,o))}},r=[],i=t.name||"default",a=t.fps||30,o=t.blendMode,s=t.length||-1,l=t.hierarchy||[],u=0;u0||0===t.search(/^data\:image\/jpeg/);i.format=r?T:E,i.needsUpdate=!0,void 0!==e&&e(i)}),n,r),i}}),Object.assign(ll.prototype,{getPoint:function(){return console.warn("THREE.Curve: .getPoint() not implemented."),null},getPointAt:function(t,e){var n=this.getUtoTmapping(t);return this.getPoint(n,e)},getPoints:function(t){void 0===t&&(t=5);for(var e=[],n=0;n<=t;n++)e.push(this.getPoint(n/t));return e},getSpacedPoints:function(t){void 0===t&&(t=5);for(var e=[],n=0;n<=t;n++)e.push(this.getPointAt(n/t));return e},getLength:function(){var t=this.getLengths();return t[t.length-1]},getLengths:function(t){if(void 0===t&&(t=this.arcLengthDivisions),this.cacheArcLengths&&this.cacheArcLengths.length===t+1&&!this.needsUpdate)return this.cacheArcLengths;this.needsUpdate=!1;var e,n=[],r=this.getPoint(0),i=0;n.push(0);for(var a=1;a<=t;a++)i+=(e=this.getPoint(a/t)).distanceTo(r),n.push(i),r=e;return this.cacheArcLengths=n,n},updateArcLengths:function(){this.needsUpdate=!0,this.getLengths()},getUtoTmapping:function(t,e){var n,r=this.getLengths(),i=0,a=r.length;n=e||t*r[a-1];for(var o,s=0,l=a-1;s<=l;)if((o=r[i=Math.floor(s+(l-s)/2)]-n)<0)s=i+1;else{if(!(o>0)){l=i;break}l=i-1}if(r[i=l]===n)return i/(a-1);var u=r[i];return(i+(n-u)/(r[i+1]-u))/(a-1)},getTangent:function(t,e){var n=1e-4,r=t-n,i=t+n;r<0&&(r=0),i>1&&(i=1);var a=this.getPoint(r),o=this.getPoint(i),s=e||(a.isVector2?new vt:new At);return s.copy(o).sub(a).normalize(),s},getTangentAt:function(t,e){var n=this.getUtoTmapping(t);return this.getTangent(n,e)},computeFrenetFrames:function(t,e){for(var n=new At,r=[],i=[],a=[],o=new At,s=new ie,l=0;l<=t;l++){var u=l/t;r[l]=this.getTangentAt(u,new At),r[l].normalize()}i[0]=new At,a[0]=new At;var c=Number.MAX_VALUE,h=Math.abs(r[0].x),d=Math.abs(r[0].y),p=Math.abs(r[0].z);h<=c&&(c=h,n.set(1,0,0)),d<=c&&(c=d,n.set(0,1,0)),p<=c&&n.set(0,0,1),o.crossVectors(r[0],n).normalize(),i[0].crossVectors(r[0],o),a[0].crossVectors(r[0],i[0]);for(var f=1;f<=t;f++){if(i[f]=i[f-1].clone(),a[f]=a[f-1].clone(),o.crossVectors(r[f-1],r[f]),o.length()>Number.EPSILON){o.normalize();var m=Math.acos(mt.clamp(r[f-1].dot(r[f]),-1,1));i[f].applyMatrix4(s.makeRotationAxis(o,m))}a[f].crossVectors(r[f],i[f])}if(!0===e){var v=Math.acos(mt.clamp(i[0].dot(i[t]),-1,1));v/=t,r[0].dot(o.crossVectors(i[0],i[t]))>0&&(v=-v);for(var g=1;g<=t;g++)i[g].applyMatrix4(s.makeRotationAxis(r[g],v*g)),a[g].crossVectors(r[g],i[g])}return{tangents:r,normals:i,binormals:a}},clone:function(){return(new this.constructor).copy(this)},copy:function(t){return this.arcLengthDivisions=t.arcLengthDivisions,this},toJSON:function(){var t={metadata:{version:4.5,type:"Curve",generator:"Curve.toJSON"}};return t.arcLengthDivisions=this.arcLengthDivisions,t.type=this.type,t},fromJSON:function(t){return this.arcLengthDivisions=t.arcLengthDivisions,this}});var ul=function(t){function e(e,n,r,i,a,o,s,l){var u;return void 0===e&&(e=0),void 0===n&&(n=0),void 0===r&&(r=1),void 0===i&&(i=1),void 0===a&&(a=0),void 0===o&&(o=2*Math.PI),void 0===s&&(s=!1),void 0===l&&(l=0),(u=t.call(this)||this).type="EllipseCurve",u.aX=e,u.aY=n,u.xRadius=r,u.yRadius=i,u.aStartAngle=a,u.aEndAngle=o,u.aClockwise=s,u.aRotation=l,u}st(e,t);var n=e.prototype;return n.getPoint=function(t,e){for(var n=e||new vt,r=2*Math.PI,i=this.aEndAngle-this.aStartAngle,a=Math.abs(i)r;)i-=r;i0?0:(Math.floor(Math.abs(l)/o)+1)*o:0===u&&l===o-1&&(l=o-2,u=1),this.closed||l>0?n=a[(l-1)%o]:(dl.subVectors(a[0],a[1]).add(a[0]),n=dl);var c=a[l%o],h=a[(l+1)%o];if(this.closed||l+2r.length-2?r.length-1:a+1],c=r[a>r.length-3?r.length-1:a+2];return n.set(gl(o,s.x,l.x,u.x,c.x),gl(o,s.y,l.y,u.y,c.y)),n},n.copy=function(e){t.prototype.copy.call(this,e),this.points=[];for(var n=0,r=e.points.length;n=e){var i=n[r]-e,a=this.curves[r],o=a.getLength(),s=0===o?0:1-i/o;return a.getPointAt(s)}r++}return null},n.getLength=function(){var t=this.getCurveLengths();return t[t.length-1]},n.updateArcLengths=function(){this.needsUpdate=!0,this.cacheLengths=null,this.getCurveLengths()},n.getCurveLengths=function(){if(this.cacheLengths&&this.cacheLengths.length===this.curves.length)return this.cacheLengths;for(var t=[],e=0,n=0,r=this.curves.length;n1&&!n[n.length-1].equals(n[0])&&n.push(n[0]),n},n.copy=function(e){t.prototype.copy.call(this,e),this.curves=[];for(var n=0,r=e.curves.length;n0){var u=l.getPoint(0);u.equals(this.currentPoint)||this.lineTo(u.x,u.y)}this.curves.push(l);var c=l.getPoint(1);return this.currentPoint.copy(c),this},n.copy=function(e){return t.prototype.copy.call(this,e),this.currentPoint.copy(e.currentPoint),this},n.toJSON=function(){var e=t.prototype.toJSON.call(this);return e.currentPoint=this.currentPoint.toArray(),e},n.fromJSON=function(e){return t.prototype.fromJSON.call(this,e),this.currentPoint.fromArray(e.currentPoint),this},e}(Ll),Cl=function(t){function e(e){var n;return(n=t.call(this,e)||this).uuid=mt.generateUUID(),n.type="Shape",n.holes=[],n}st(e,t);var n=e.prototype;return n.getPointsHoles=function(t){for(var e=[],n=0,r=this.holes.length;n0:r.vertexColors=t.vertexColors),void 0!==t.uniforms)for(var i in t.uniforms){var a=t.uniforms[i];switch(r.uniforms[i]={},a.type){case"t":r.uniforms[i].value=n(a.value);break;case"c":r.uniforms[i].value=(new $e).setHex(a.value);break;case"v2":r.uniforms[i].value=(new vt).fromArray(a.value);break;case"v3":r.uniforms[i].value=(new At).fromArray(a.value);break;case"v4":r.uniforms[i].value=(new Mt).fromArray(a.value);break;case"m3":r.uniforms[i].value=(new yt).fromArray(a.value);break;case"m4":r.uniforms[i].value=(new ie).fromArray(a.value);break;default:r.uniforms[i].value=a.value}}if(void 0!==t.defines&&(r.defines=t.defines),void 0!==t.vertexShader&&(r.vertexShader=t.vertexShader),void 0!==t.fragmentShader&&(r.fragmentShader=t.fragmentShader),void 0!==t.extensions)for(var o in t.extensions)r.extensions[o]=t.extensions[o];if(void 0!==t.shading&&(r.flatShading=1===t.shading),void 0!==t.size&&(r.size=t.size),void 0!==t.sizeAttenuation&&(r.sizeAttenuation=t.sizeAttenuation),void 0!==t.map&&(r.map=n(t.map)),void 0!==t.matcap&&(r.matcap=n(t.matcap)),void 0!==t.alphaMap&&(r.alphaMap=n(t.alphaMap)),void 0!==t.bumpMap&&(r.bumpMap=n(t.bumpMap)),void 0!==t.bumpScale&&(r.bumpScale=t.bumpScale),void 0!==t.normalMap&&(r.normalMap=n(t.normalMap)),void 0!==t.normalMapType&&(r.normalMapType=t.normalMapType),void 0!==t.normalScale){var s=t.normalScale;!1===Array.isArray(s)&&(s=[s,s]),r.normalScale=(new vt).fromArray(s)}return void 0!==t.displacementMap&&(r.displacementMap=n(t.displacementMap)),void 0!==t.displacementScale&&(r.displacementScale=t.displacementScale),void 0!==t.displacementBias&&(r.displacementBias=t.displacementBias),void 0!==t.roughnessMap&&(r.roughnessMap=n(t.roughnessMap)),void 0!==t.metalnessMap&&(r.metalnessMap=n(t.metalnessMap)),void 0!==t.emissiveMap&&(r.emissiveMap=n(t.emissiveMap)),void 0!==t.emissiveIntensity&&(r.emissiveIntensity=t.emissiveIntensity),void 0!==t.specularMap&&(r.specularMap=n(t.specularMap)),void 0!==t.envMap&&(r.envMap=n(t.envMap)),void 0!==t.envMapIntensity&&(r.envMapIntensity=t.envMapIntensity),void 0!==t.reflectivity&&(r.reflectivity=t.reflectivity),void 0!==t.refractionRatio&&(r.refractionRatio=t.refractionRatio),void 0!==t.lightMap&&(r.lightMap=n(t.lightMap)),void 0!==t.lightMapIntensity&&(r.lightMapIntensity=t.lightMapIntensity),void 0!==t.aoMap&&(r.aoMap=n(t.aoMap)),void 0!==t.aoMapIntensity&&(r.aoMapIntensity=t.aoMapIntensity),void 0!==t.gradientMap&&(r.gradientMap=n(t.gradientMap)),void 0!==t.clearcoatMap&&(r.clearcoatMap=n(t.clearcoatMap)),void 0!==t.clearcoatRoughnessMap&&(r.clearcoatRoughnessMap=n(t.clearcoatRoughnessMap)),void 0!==t.clearcoatNormalMap&&(r.clearcoatNormalMap=n(t.clearcoatNormalMap)),void 0!==t.clearcoatNormalScale&&(r.clearcoatNormalScale=(new vt).fromArray(t.clearcoatNormalScale)),void 0!==t.transmission&&(r.transmission=t.transmission),void 0!==t.transmissionMap&&(r.transmissionMap=n(t.transmissionMap)),r},n.setTextures=function(t){return this.textures=t,this},e}($s),Kl={decodeText:function(t){if("undefined"!=typeof TextDecoder)return(new TextDecoder).decode(t);for(var e="",n=0,r=t.length;n0){var o=new Qs(e);(n=new il(o)).setCrossOrigin(this.crossOrigin);for(var s=0,l=t.length;sNumber.EPSILON){if(u<0&&(o=e[a],l=-l,s=e[i],u=-u),t.ys.y)continue;if(t.y===o.y){if(t.x===o.x)return!0}else{var c=u*(t.x-o.x)-l*(t.y-o.y);if(0===c)return!0;if(c<0)continue;r=!r}}else{if(t.y!==o.y)continue;if(s.x<=t.x&&t.x<=o.x||o.x<=t.x&&t.x<=s.x)return!0}}return r}var i,a,o,s=as.isClockWise,l=this.subPaths;if(0===l.length)return[];if(!0===e)return n(l);var u=[];if(1===l.length)return a=l[0],(o=new Cl).curves=a.curves,u.push(o),u;var c=!s(l[0].getPoints());c=t?!c:c;var h,d,p=[],f=[],m=[],v=0;f[v]=void 0,m[v]=[];for(var g=0,y=l.length;g1){for(var x=!1,_=[],b=0,w=f.length;b0&&(x||(m=p))}for(var C=0,P=f.length;C0){this.source.connect(this.filters[0]);for(var t=1,e=this.filters.length;t0){this.source.disconnect(this.filters[0]);for(var t=1,e=this.filters.length;t0&&this._mixBufferRegionAdditive(n,r,this._addIndex*e,1,e);for(var l=e,u=e+e;l!==u;++l)if(n[l]!==n[l+e]){o.setValue(n,r);break}},e.saveOriginalState=function(){var t=this.binding,e=this.buffer,n=this.valueSize,r=n*this._origIndex;t.getValue(e,r);for(var i=n,a=r;i!==a;++i)e[i]=e[r+i%n];this._setIdentity(),this.cumulativeWeight=0,this.cumulativeWeightAdditive=0},e.restoreOriginalState=function(){var t=3*this.valueSize;this.binding.setValue(this.buffer,t)},e._setAdditiveIdentityNumeric=function(){for(var t=this._addIndex*this.valueSize,e=t+this.valueSize,n=t;n=.5)for(var a=0;a!==i;++a)t[e+a]=t[n+a]},e._slerp=function(t,e,n,r){Et.slerpFlat(t,e,t,e,t,n,r)},e._slerpAdditive=function(t,e,n,r,i){var a=this._workIndex*i;Et.multiplyQuaternionsFlat(t,a,t,e,t,n),Et.slerpFlat(t,e,t,e,t,a,r)},e._lerp=function(t,e,n,r,i){for(var a=1-r,o=0;o!==i;++o){var s=e+o;t[s]=t[s]*a+t[n+o]*r}},e._lerpAdditive=function(t,e,n,r,i){for(var a=0;a!==i;++a){var o=e+a;t[o]=t[o]+t[n+a]*r}},t}(),Nu="\\[\\]\\.:\\/",Bu=new RegExp("[\\[\\]\\.:\\/]","g"),Ou="[^\\[\\]\\.:\\/]",zu="[^"+Nu.replace("\\.","")+"]",Fu=/((?:WC+[\/:])*)/.source.replace("WC",Ou),Hu=/(WCOD+)?/.source.replace("WCOD",zu),Gu=/(?:\.(WC+)(?:\[(.+)\])?)?/.source.replace("WC",Ou),Uu=/\.(WC+)(?:\[(.+)\])?/.source.replace("WC",Ou),ku=new RegExp("^"+Fu+Hu+Gu+Uu+"$"),Vu=["material","materials","bones"];function Wu(t,e,n){var r=n||ju.parseTrackName(e);this._targetGroup=t,this._bindings=t.subscribe_(e,r)}function ju(t,e,n){this.path=e,this.parsedPath=n||ju.parseTrackName(e),this.node=ju.findNode(t,this.parsedPath.nodeName)||t,this.rootNode=t}Object.assign(Wu.prototype,{getValue:function(t,e){this.bind();var n=this._targetGroup.nCachedObjects_,r=this._bindings[n];void 0!==r&&r.getValue(t,e)},setValue:function(t,e){for(var n=this._bindings,r=this._targetGroup.nCachedObjects_,i=n.length;r!==i;++r)n[r].setValue(t,e)},bind:function(){for(var t=this._bindings,e=this._targetGroup.nCachedObjects_,n=t.length;e!==n;++e)t[e].bind()},unbind:function(){for(var t=this._bindings,e=this._targetGroup.nCachedObjects_,n=t.length;e!==n;++e)t[e].unbind()}}),Object.assign(ju,{Composite:Wu,create:function(t,e,n){return t&&t.isAnimationObjectGroup?new ju.Composite(t,e,n):new ju(t,e,n)},sanitizeNodeName:function(t){return t.replace(/\s/g,"_").replace(Bu,"")},parseTrackName:function(t){var e=ku.exec(t);if(!e)throw new Error("PropertyBinding: Cannot parse trackName: "+t);var n={nodeName:e[2],objectName:e[3],objectIndex:e[4],propertyName:e[5],propertyIndex:e[6]},r=n.nodeName&&n.nodeName.lastIndexOf(".");if(void 0!==r&&-1!==r){var i=n.nodeName.substring(r+1);-1!==Vu.indexOf(i)&&(n.nodeName=n.nodeName.substring(0,r),n.objectName=i)}if(null===n.propertyName||0===n.propertyName.length)throw new Error("PropertyBinding: can not parse propertyName from trackName: "+t);return n},findNode:function(t,e){if(!e||""===e||"."===e||-1===e||e===t.name||e===t.uuid)return t;if(t.skeleton){var n=t.skeleton.getBoneByName(e);if(void 0!==n)return n}if(t.children){var r=function t(n){for(var r=0;r=i){var c=i++,h=t[c];e[h.uuid]=u,t[u]=h,e[l]=c,t[c]=s;for(var d=0,p=r;d!==p;++d){var f=n[d],m=f[c],v=f[u];f[u]=m,f[c]=v}}}this.nCachedObjects_=i},e.uncache=function(){for(var t=this._objects,e=this._indicesByUUID,n=this._bindings,r=n.length,i=this.nCachedObjects_,a=t.length,o=0,s=arguments.length;o!==s;++o){var l=arguments[o],u=l.uuid,c=e[u];if(void 0!==c)if(delete e[u],c0&&(e[b.uuid]=c),t[c]=b,t.pop();for(var w=0,M=r;w!==M;++w){var S=n[w];S[c]=S[_],S.pop()}}}this.nCachedObjects_=i},e.subscribe_=function(t,e){var n=this._bindingsIndicesByPath,r=n[t],i=this._bindings;if(void 0!==r)return i[r];var a=this._paths,o=this._parsedPaths,s=this._objects,l=s.length,u=this.nCachedObjects_,c=new Array(l);r=i.length,n[t]=r,a.push(t),o.push(e),i.push(c);for(var h=u,d=s.length;h!==d;++h){var p=s[h];c[h]=new ju(p,t,e)}return c},e.unsubscribe_=function(t){var e=this._bindingsIndicesByPath,n=e[t];if(void 0!==n){var r=this._paths,i=this._parsedPaths,a=this._bindings,o=a.length-1,s=a[o];e[t[o]]=n,a[n]=s,a.pop(),i[n]=i[o],i.pop(),r[n]=r[o],r.pop()}},t}();qu.prototype.isAnimationObjectGroup=!0;var Xu=function(){function t(t,e,n,r){void 0===n&&(n=null),void 0===r&&(r=e.blendMode),this._mixer=t,this._clip=e,this._localRoot=n,this.blendMode=r;for(var i=e.tracks,a=i.length,o=new Array(a),s={endingStart:k,endingEnd:k},l=0;l!==a;++l){var u=i[l].createInterpolant(null);o[l]=u,u.settings=s}this._interpolantSettings=s,this._interpolants=o,this._propertyBindings=new Array(a),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}var e=t.prototype;return e.play=function(){return this._mixer._activateAction(this),this},e.stop=function(){return this._mixer._deactivateAction(this),this.reset()},e.reset=function(){return this.paused=!1,this.enabled=!0,this.time=0,this._loopCount=-1,this._startTime=null,this.stopFading().stopWarping()},e.isRunning=function(){return this.enabled&&!this.paused&&0!==this.timeScale&&null===this._startTime&&this._mixer._isActiveAction(this)},e.isScheduled=function(){return this._mixer._isActiveAction(this)},e.startAt=function(t){return this._startTime=t,this},e.setLoop=function(t,e){return this.loop=t,this.repetitions=e,this},e.setEffectiveWeight=function(t){return this.weight=t,this._effectiveWeight=this.enabled?t:0,this.stopFading()},e.getEffectiveWeight=function(){return this._effectiveWeight},e.fadeIn=function(t){return this._scheduleFading(t,0,1)},e.fadeOut=function(t){return this._scheduleFading(t,1,0)},e.crossFadeFrom=function(t,e,n){if(t.fadeOut(e),this.fadeIn(e),n){var r=this._clip.duration,i=t._clip.duration,a=i/r,o=r/i;t.warp(1,a,e),this.warp(o,1,e)}return this},e.crossFadeTo=function(t,e,n){return t.crossFadeFrom(this,e,n)},e.stopFading=function(){var t=this._weightInterpolant;return null!==t&&(this._weightInterpolant=null,this._mixer._takeBackControlInterpolant(t)),this},e.setEffectiveTimeScale=function(t){return this.timeScale=t,this._effectiveTimeScale=this.paused?0:t,this.stopWarping()},e.getEffectiveTimeScale=function(){return this._effectiveTimeScale},e.setDuration=function(t){return this.timeScale=this._clip.duration/t,this.stopWarping()},e.syncWith=function(t){return this.time=t.time,this.timeScale=t.timeScale,this.stopWarping()},e.halt=function(t){return this.warp(this._effectiveTimeScale,0,t)},e.warp=function(t,e,n){var r=this._mixer,i=r.time,a=this.timeScale,o=this._timeScaleInterpolant;null===o&&(o=r._lendControlInterpolant(),this._timeScaleInterpolant=o);var s=o.parameterPositions,l=o.sampleValues;return s[0]=i,s[1]=i+n,l[0]=t/a,l[1]=e/a,this},e.stopWarping=function(){var t=this._timeScaleInterpolant;return null!==t&&(this._timeScaleInterpolant=null,this._mixer._takeBackControlInterpolant(t)),this},e.getMixer=function(){return this._mixer},e.getClip=function(){return this._clip},e.getRoot=function(){return this._localRoot||this._mixer._root},e._update=function(t,e,n,r){if(this.enabled){var i=this._startTime;if(null!==i){var a=(t-i)*n;if(a<0||0===n)return;this._startTime=null,e=n*a}e*=this._updateTimeScale(t);var o=this._updateTime(e),s=this._updateWeight(t);if(s>0){var l=this._interpolants,u=this._propertyBindings;switch(this.blendMode){case q:for(var c=0,h=l.length;c!==h;++c)l[c].evaluate(o),u[c].accumulateAdditive(s);break;case j:default:for(var d=0,p=l.length;d!==p;++d)l[d].evaluate(o),u[d].accumulate(r,s)}}}else this._updateWeight(t)},e._updateWeight=function(t){var e=0;if(this.enabled){e=this.weight;var n=this._weightInterpolant;if(null!==n){var r=n.evaluate(t)[0];e*=r,t>n.parameterPositions[1]&&(this.stopFading(),0===r&&(this.enabled=!1))}}return this._effectiveWeight=e,e},e._updateTimeScale=function(t){var e=0;if(!this.paused){e=this.timeScale;var 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},e._updateTime=function(t){var e=this._clip.duration,n=this.loop,r=this.time+t,i=this._loopCount,a=2202===n;if(0===t)return-1===i?r:a&&1==(1&i)?e-r:r;if(2200===n){-1===i&&(this._loopCount=0,this._setEndings(!0,!0,!1));t:{if(r>=e)r=e;else{if(!(r<0)){this.time=r;break t}r=0}this.clampWhenFinished?this.paused=!0:this.enabled=!1,this.time=r,this._mixer.dispatchEvent({type:"finished",action:this,direction:t<0?-1:1})}}else{if(-1===i&&(t>=0?(i=0,this._setEndings(!0,0===this.repetitions,a)):this._setEndings(0===this.repetitions,!0,a)),r>=e||r<0){var o=Math.floor(r/e);r-=e*o,i+=Math.abs(o);var s=this.repetitions-i;if(s<=0)this.clampWhenFinished?this.paused=!0:this.enabled=!1,r=t>0?e:0,this.time=r,this._mixer.dispatchEvent({type:"finished",action:this,direction:t>0?1:-1});else{if(1===s){var l=t<0;this._setEndings(l,!l,a)}else this._setEndings(!1,!1,a);this._loopCount=i,this.time=r,this._mixer.dispatchEvent({type:"loop",action:this,loopDelta:o})}}else this.time=r;if(a&&1==(1&i))return e-r}return r},e._setEndings=function(t,e,n){var r=this._interpolantSettings;n?(r.endingStart=V,r.endingEnd=V):(r.endingStart=t?this.zeroSlopeAtStart?V:k:W,r.endingEnd=e?this.zeroSlopeAtEnd?V:k:W)},e._scheduleFading=function(t,e,n){var r=this._mixer,i=r.time,a=this._weightInterpolant;null===a&&(a=r._lendControlInterpolant(),this._weightInterpolant=a);var o=a.parameterPositions,s=a.sampleValues;return o[0]=i,s[0]=e,o[1]=i+t,s[1]=n,this},t}(),Yu=function(t){function e(e){var n;return(n=t.call(this)||this)._root=e,n._initMemoryManager(),n._accuIndex=0,n.time=0,n.timeScale=1,n}st(e,t);var n=e.prototype;return n._bindAction=function(t,e){var n=t._localRoot||this._root,r=t._clip.tracks,i=r.length,a=t._propertyBindings,o=t._interpolants,s=n.uuid,l=this._bindingsByRootAndName,u=l[s];void 0===u&&(u={},l[s]=u);for(var c=0;c!==i;++c){var h=r[c],d=h.name,p=u[d];if(void 0!==p)a[c]=p;else{if(void 0!==(p=a[c])){null===p._cacheIndex&&(++p.referenceCount,this._addInactiveBinding(p,s,d));continue}var f=e&&e._propertyBindings[c].binding.parsedPath;++(p=new Iu(ju.create(n,d,f),h.ValueTypeName,h.getValueSize())).referenceCount,this._addInactiveBinding(p,s,d),a[c]=p}o[c].resultBuffer=p.buffer}},n._activateAction=function(t){if(!this._isActiveAction(t)){if(null===t._cacheIndex){var e=(t._localRoot||this._root).uuid,n=t._clip.uuid,r=this._actionsByClip[n];this._bindAction(t,r&&r.knownActions[0]),this._addInactiveAction(t,n,e)}for(var i=t._propertyBindings,a=0,o=i.length;a!==o;++a){var s=i[a];0==s.useCount++&&(this._lendBinding(s),s.saveOriginalState())}this._lendAction(t)}},n._deactivateAction=function(t){if(this._isActiveAction(t)){for(var e=t._propertyBindings,n=0,r=e.length;n!==r;++n){var i=e[n];0==--i.useCount&&(i.restoreOriginalState(),this._takeBackBinding(i))}this._takeBackAction(t)}},n._initMemoryManager=function(){this._actions=[],this._nActiveActions=0,this._actionsByClip={},this._bindings=[],this._nActiveBindings=0,this._bindingsByRootAndName={},this._controlInterpolants=[],this._nActiveControlInterpolants=0;var 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}}}},n._isActiveAction=function(t){var e=t._cacheIndex;return null!==e&&e=0;--e)t[e].stop();return this},n.update=function(t){t*=this.timeScale;for(var e=this._actions,n=this._nActiveActions,r=this.time+=t,i=Math.sign(t),a=this._accuIndex^=1,o=0;o!==n;++o){e[o]._update(r,t,i,a)}for(var s=this._bindings,l=this._nActiveBindings,u=0;u!==l;++u)s[u].apply(a);return this},n.setTime=function(t){this.time=0;for(var e=0;ethis.max.x||t.ythis.max.y)},e.containsBox=function(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},e.getParameter=function(t,e){return void 0===e&&(console.warn("THREE.Box2: .getParameter() target is now required"),e=new vt),e.set((t.x-this.min.x)/(this.max.x-this.min.x),(t.y-this.min.y)/(this.max.y-this.min.y))},e.intersectsBox=function(t){return!(t.max.xthis.max.x||t.max.ythis.max.y)},e.clampPoint=function(t,e){return void 0===e&&(console.warn("THREE.Box2: .clampPoint() target is now required"),e=new vt),e.copy(t).clamp(this.min,this.max)},e.distanceToPoint=function(t){return rc.copy(t).clamp(this.min,this.max).sub(t).length()},e.intersect=function(t){return this.min.max(t.min),this.max.min(t.max),this},e.union=function(t){return this.min.min(t.min),this.max.max(t.max),this},e.translate=function(t){return this.min.add(t),this.max.add(t),this},e.equals=function(t){return t.min.equals(this.min)&&t.max.equals(this.max)},t}();ic.prototype.isBox2=!0;var ac=new At,oc=new At,sc=function(){function t(t,e){void 0===t&&(t=new At),void 0===e&&(e=new At),this.start=t,this.end=e}var e=t.prototype;return e.set=function(t,e){return this.start.copy(t),this.end.copy(e),this},e.copy=function(t){return this.start.copy(t.start),this.end.copy(t.end),this},e.getCenter=function(t){return void 0===t&&(console.warn("THREE.Line3: .getCenter() target is now required"),t=new At),t.addVectors(this.start,this.end).multiplyScalar(.5)},e.delta=function(t){return void 0===t&&(console.warn("THREE.Line3: .delta() target is now required"),t=new At),t.subVectors(this.end,this.start)},e.distanceSq=function(){return this.start.distanceToSquared(this.end)},e.distance=function(){return this.start.distanceTo(this.end)},e.at=function(t,e){return void 0===e&&(console.warn("THREE.Line3: .at() target is now required"),e=new At),this.delta(e).multiplyScalar(t).add(this.start)},e.closestPointToPointParameter=function(t,e){ac.subVectors(t,this.start),oc.subVectors(this.end,this.start);var n=oc.dot(oc),r=oc.dot(ac)/n;return e&&(r=mt.clamp(r,0,1)),r},e.closestPointToPoint=function(t,e,n){var r=this.closestPointToPointParameter(t,e);return void 0===n&&(console.warn("THREE.Line3: .closestPointToPoint() target is now required"),n=new At),this.delta(n).multiplyScalar(r).add(this.start)},e.applyMatrix4=function(t){return this.start.applyMatrix4(t),this.end.applyMatrix4(t),this},e.equals=function(t){return t.start.equals(this.start)&&t.end.equals(this.end)},e.clone=function(){return(new this.constructor).copy(this)},t}();function lc(t){Re.call(this),this.material=t,this.render=function(){},this.hasPositions=!1,this.hasNormals=!1,this.hasColors=!1,this.hasUvs=!1,this.positionArray=null,this.normalArray=null,this.colorArray=null,this.uvArray=null,this.count=0}lc.prototype=Object.create(Re.prototype),lc.prototype.constructor=lc,lc.prototype.isImmediateRenderObject=!0;var uc=new At,cc=function(t){function e(e,n){var r;(r=t.call(this)||this).light=e,r.light.updateMatrixWorld(),r.matrix=e.matrixWorld,r.matrixAutoUpdate=!1,r.color=n;for(var i=new Tn,a=[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],o=0,s=1;o<32;o++,s++){var l=o/32*Math.PI*2,u=s/32*Math.PI*2;a.push(Math.cos(l),Math.sin(l),1,Math.cos(u),Math.sin(u),1)}i.setAttribute("position",new pn(a,3));var c=new eo({fog:!1,toneMapped:!1});return r.cone=new co(i,c),r.add(r.cone),r.update(),r}st(e,t);var n=e.prototype;return n.dispose=function(){this.cone.geometry.dispose(),this.cone.material.dispose()},n.update=function(){this.light.updateMatrixWorld();var t=this.light.distance?this.light.distance:1e3,e=t*Math.tan(this.light.angle);this.cone.scale.set(e,e,t),uc.setFromMatrixPosition(this.light.target.matrixWorld),this.cone.lookAt(uc),void 0!==this.color?this.cone.material.color.set(this.color):this.cone.material.color.copy(this.light.color)},e}(Re),hc=new At,dc=new ie,pc=new ie,fc=function(t){function e(e){for(var n,r=mc(e),i=new Tn,a=[],o=[],s=new $e(0,0,1),l=new $e(0,1,0),u=0;u.99999)this.quaternion.set(0,0,0,1);else if(t.y<-.99999)this.quaternion.set(1,0,0,0);else{Fc.set(t.z,0,-t.x).normalize();var e=Math.acos(t.y);this.quaternion.setFromAxisAngle(Fc,e)}},n.setLength=function(t,e,n){void 0===e&&(e=.2*t),void 0===n&&(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()},n.setColor=function(t){this.line.material.color.set(t),this.cone.material.color.set(t)},n.copy=function(e){return t.prototype.copy.call(this,e,!1),this.line.copy(e.line),this.cone.copy(e.cone),this},e}(Re),Gc=function(t){function e(e){var n;void 0===e&&(e=1);var r=[0,0,0,e,0,0,0,0,0,0,e,0,0,0,0,0,0,e],i=new Tn;i.setAttribute("position",new pn(r,3)),i.setAttribute("color",new pn([1,0,0,1,.6,0,0,1,0,.6,1,0,0,0,1,0,.6,1],3));var a=new eo({vertexColors:!0,toneMapped:!1});return(n=t.call(this,i,a)||this).type="AxesHelper",n}return st(e,t),e}(co),Uc=new Float32Array(1),kc=new Int32Array(Uc.buffer),Vc={toHalfFloat:function(t){Uc[0]=t;var e=kc[0],n=e>>16&32768,r=e>>12&2047,i=e>>23&255;return i<103?n:i>142?(n|=31744,n|=(255==i?0:1)&&8388607&e):i<113?n|=((r|=2048)>>114-i)+(r>>113-i&1):(n|=i-112<<10|r>>1,n+=1&r)}},Wc=Math.pow(2,8),jc=[.125,.215,.35,.446,.526,.582],qc=5+jc.length,Xc=20,Yc=((Ic={})[3e3]=0,Ic[3001]=1,Ic[3002]=2,Ic[3004]=3,Ic[3005]=4,Ic[3006]=5,Ic[3007]=6,Ic),Zc=new tn({side:1,depthWrite:!1,depthTest:!1}),Jc=new Vn(new jn,Zc),Qc=new Wl,Kc=ch(),$c=Kc._lodPlanes,th=Kc._sizeLods,eh=Kc._sigmas,nh=new $e,rh=null,ih=(1+Math.sqrt(5))/2,ah=1/ih,oh=[new At(1,1,1),new At(-1,1,1),new At(1,1,-1),new At(-1,1,-1),new At(0,ih,ah),new At(0,ih,-ah),new At(ah,0,ih),new At(-ah,0,ih),new At(ih,ah,0),new At(-ih,ah,0)];function sh(t){var e=Math.max(t.r,t.g,t.b),n=Math.min(Math.max(Math.ceil(Math.log2(e)),-128),127);return t.multiplyScalar(Math.pow(2,-n)),(n+128)/255}var lh=function(){function t(t){var e,n,r;this._renderer=t,this._pingPongRenderTarget=null,this._blurMaterial=(e=Xc,n=new Float32Array(e),r=new At(0,1,0),new Ts({name:"SphericalGaussianBlur",defines:{n:e},uniforms:{envMap:{value:null},samples:{value:1},weights:{value:n},latitudinal:{value:!1},dTheta:{value:0},mipInt:{value:0},poleAxis:{value:r},inputEncoding:{value:Yc[3e3]},outputEncoding:{value:Yc[3e3]}},vertexShader:"\n\n\t\tprecision mediump float;\n\t\tprecision mediump int;\n\n\t\tattribute vec3 position;\n\t\tattribute vec2 uv;\n\t\tattribute float faceIndex;\n\n\t\tvarying vec3 vOutputDirection;\n\n\t\t// RH coordinate system; PMREM face-indexing convention\n\t\tvec3 getDirection( vec2 uv, float face ) {\n\n\t\t\tuv = 2.0 * uv - 1.0;\n\n\t\t\tvec3 direction = vec3( uv, 1.0 );\n\n\t\t\tif ( face == 0.0 ) {\n\n\t\t\t\tdirection = direction.zyx; // ( 1, v, u ) pos x\n\n\t\t\t} else if ( face == 1.0 ) {\n\n\t\t\t\tdirection = direction.xzy;\n\t\t\t\tdirection.xz *= -1.0; // ( -u, 1, -v ) pos y\n\n\t\t\t} else if ( face == 2.0 ) {\n\n\t\t\t\tdirection.x *= -1.0; // ( -u, v, 1 ) pos z\n\n\t\t\t} else if ( face == 3.0 ) {\n\n\t\t\t\tdirection = direction.zyx;\n\t\t\t\tdirection.xz *= -1.0; // ( -1, v, -u ) neg x\n\n\t\t\t} else if ( face == 4.0 ) {\n\n\t\t\t\tdirection = direction.xzy;\n\t\t\t\tdirection.xy *= -1.0; // ( -u, -1, v ) neg y\n\n\t\t\t} else if ( face == 5.0 ) {\n\n\t\t\t\tdirection.z *= -1.0; // ( u, v, -1 ) neg z\n\n\t\t\t}\n\n\t\t\treturn direction;\n\n\t\t}\n\n\t\tvoid main() {\n\n\t\t\tvOutputDirection = getDirection( uv, faceIndex );\n\t\t\tgl_Position = vec4( position, 1.0 );\n\n\t\t}\n\t",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\n\n\t\tuniform int inputEncoding;\n\t\tuniform int outputEncoding;\n\n\t\t#include \n\n\t\tvec4 inputTexelToLinear( vec4 value ) {\n\n\t\t\tif ( inputEncoding == 0 ) {\n\n\t\t\t\treturn value;\n\n\t\t\t} else if ( inputEncoding == 1 ) {\n\n\t\t\t\treturn sRGBToLinear( value );\n\n\t\t\t} else if ( inputEncoding == 2 ) {\n\n\t\t\t\treturn RGBEToLinear( value );\n\n\t\t\t} else if ( inputEncoding == 3 ) {\n\n\t\t\t\treturn RGBMToLinear( value, 7.0 );\n\n\t\t\t} else if ( inputEncoding == 4 ) {\n\n\t\t\t\treturn RGBMToLinear( value, 16.0 );\n\n\t\t\t} else if ( inputEncoding == 5 ) {\n\n\t\t\t\treturn RGBDToLinear( value, 256.0 );\n\n\t\t\t} else {\n\n\t\t\t\treturn GammaToLinear( value, 2.2 );\n\n\t\t\t}\n\n\t\t}\n\n\t\tvec4 linearToOutputTexel( vec4 value ) {\n\n\t\t\tif ( outputEncoding == 0 ) {\n\n\t\t\t\treturn value;\n\n\t\t\t} else if ( outputEncoding == 1 ) {\n\n\t\t\t\treturn LinearTosRGB( value );\n\n\t\t\t} else if ( outputEncoding == 2 ) {\n\n\t\t\t\treturn LinearToRGBE( value );\n\n\t\t\t} else if ( outputEncoding == 3 ) {\n\n\t\t\t\treturn LinearToRGBM( value, 7.0 );\n\n\t\t\t} else if ( outputEncoding == 4 ) {\n\n\t\t\t\treturn LinearToRGBM( value, 16.0 );\n\n\t\t\t} else if ( outputEncoding == 5 ) {\n\n\t\t\t\treturn LinearToRGBD( value, 256.0 );\n\n\t\t\t} else {\n\n\t\t\t\treturn LinearToGamma( value, 2.2 );\n\n\t\t\t}\n\n\t\t}\n\n\t\tvec4 envMapTexelToLinear( vec4 color ) {\n\n\t\t\treturn inputTexelToLinear( color );\n\n\t\t}\n\t\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})),this._equirectShader=null,this._cubemapShader=null,this._compileMaterial(this._blurMaterial)}var e=t.prototype;return e.fromScene=function(t,e,n,r){void 0===e&&(e=0),void 0===n&&(n=.1),void 0===r&&(r=100),rh=this._renderer.getRenderTarget();var i=this._allocateTargets();return this._sceneToCubeUV(t,n,r,i),e>0&&this._blur(i,0,0,e),this._applyPMREM(i),this._cleanup(i),i},e.fromEquirectangular=function(t){return this._fromTexture(t)},e.fromCubemap=function(t){return this._fromTexture(t)},e.compileCubemapShader=function(){null===this._cubemapShader&&(this._cubemapShader=fh(),this._compileMaterial(this._cubemapShader))},e.compileEquirectangularShader=function(){null===this._equirectShader&&(this._equirectShader=ph(),this._compileMaterial(this._equirectShader))},e.dispose=function(){this._blurMaterial.dispose(),null!==this._cubemapShader&&this._cubemapShader.dispose(),null!==this._equirectShader&&this._equirectShader.dispose();for(var t=0;t<$c.length;t++)$c[t].dispose()},e._cleanup=function(t){this._pingPongRenderTarget.dispose(),this._renderer.setRenderTarget(rh),t.scissorTest=!1,dh(t,0,0,t.width,t.height)},e._fromTexture=function(t){rh=this._renderer.getRenderTarget();var e=this._allocateTargets(t);return this._textureToCubeUV(t,e),this._applyPMREM(e),this._cleanup(e),e},e._allocateTargets=function(t){var e={magFilter:p,minFilter:p,generateMipmaps:!1,type:x,format:1023,encoding:uh(t)?t.encoding:J,depthBuffer:!1},n=hh(e);return n.depthBuffer=!t,this._pingPongRenderTarget=hh(e),n},e._compileMaterial=function(t){var e=new Vn($c[0],t);this._renderer.compile(e,Qc)},e._sceneToCubeUV=function(t,e,n,r){var i=new Qn(90,1,e,n),a=[1,-1,1,1,1,1],o=[1,1,1,-1,-1,-1],s=this._renderer,l=s.autoClear,u=s.outputEncoding,c=s.toneMapping;s.getClearColor(nh),s.toneMapping=0,s.outputEncoding=X,s.autoClear=!1;var h=!1,d=t.background;if(d){if(d.isColor){Zc.color.copy(d).convertSRGBToLinear(),t.background=null;var p=sh(Zc.color);Zc.opacity=p,h=!0}}else{Zc.color.copy(nh).convertSRGBToLinear();var f=sh(Zc.color);Zc.opacity=f,h=!0}for(var m=0;m<6;m++){var v=m%3;0==v?(i.up.set(0,a[m],0),i.lookAt(o[m],0,0)):1==v?(i.up.set(0,0,a[m]),i.lookAt(0,o[m],0)):(i.up.set(0,a[m],0),i.lookAt(0,0,o[m])),dh(r,v*Wc,m>2?Wc:0,Wc,Wc),s.setRenderTarget(r),h&&s.render(Jc,i),s.render(t,i)}s.toneMapping=c,s.outputEncoding=u,s.autoClear=l},e._textureToCubeUV=function(t,e){var n=this._renderer;t.isCubeTexture?null==this._cubemapShader&&(this._cubemapShader=fh()):null==this._equirectShader&&(this._equirectShader=ph());var r=t.isCubeTexture?this._cubemapShader:this._equirectShader,i=new Vn($c[0],r),a=r.uniforms;a.envMap.value=t,t.isCubeTexture||a.texelSize.value.set(1/t.image.width,1/t.image.height),a.inputEncoding.value=Yc[t.encoding],a.outputEncoding.value=Yc[e.texture.encoding],dh(e,0,0,3*Wc,2*Wc),n.setRenderTarget(e),n.render(i,Qc)},e._applyPMREM=function(t){var e=this._renderer,n=e.autoClear;e.autoClear=!1;for(var r=1;rXc&&console.warn("sigmaRadians, "+i+", is too large and will clip, as it requested "+f+" samples when the maximum is set to "+Xc);for(var m=[],v=0,g=0;g4?r-8+4:0),3*b,2*b),s.setRenderTarget(e),s.render(u,Qc)},t}();function uh(t){return void 0!==t&&t.type===x&&(t.encoding===X||t.encoding===Y||t.encoding===Z)}function ch(){for(var t=[],e=[],n=[],r=8,i=0;i4?o=jc[i-8+4-1]:0==i&&(o=0),n.push(o);for(var s=1/(a-1),l=-s/2,u=1+s/2,c=[l,l,u,l,u,u,l,l,u,u,l,u],h=new Float32Array(108),d=new Float32Array(72),p=new Float32Array(36),f=0;f<6;f++){var m=f%3*2/3-1,v=f>2?0:-1,g=[m,v,0,m+2/3,v,0,m+2/3,v+1,0,m,v,0,m+2/3,v+1,0,m,v+1,0];h.set(g,18*f),d.set(c,12*f);var y=[f,f,f,f,f,f];p.set(y,6*f)}var x=new Tn;x.setAttribute("position",new rn(h,3)),x.setAttribute("uv",new rn(d,2)),x.setAttribute("faceIndex",new rn(p,1)),t.push(x),r>4&&r--}return{_lodPlanes:t,_sizeLods:e,_sigmas:n}}function hh(t){var e=new St(3*Wc,3*Wc,t);return e.texture.mapping=l,e.texture.name="PMREM.cubeUv",e.scissorTest=!0,e}function dh(t,e,n,r,i){t.viewport.set(e,n,r,i),t.scissor.set(e,n,r,i)}function ph(){var t=new vt(1,1);return new Ts({name:"EquirectangularToCubeUV",uniforms:{envMap:{value:null},texelSize:{value:t},inputEncoding:{value:Yc[3e3]},outputEncoding:{value:Yc[3e3]}},vertexShader:"\n\n\t\tprecision mediump float;\n\t\tprecision mediump int;\n\n\t\tattribute vec3 position;\n\t\tattribute vec2 uv;\n\t\tattribute float faceIndex;\n\n\t\tvarying vec3 vOutputDirection;\n\n\t\t// RH coordinate system; PMREM face-indexing convention\n\t\tvec3 getDirection( vec2 uv, float face ) {\n\n\t\t\tuv = 2.0 * uv - 1.0;\n\n\t\t\tvec3 direction = vec3( uv, 1.0 );\n\n\t\t\tif ( face == 0.0 ) {\n\n\t\t\t\tdirection = direction.zyx; // ( 1, v, u ) pos x\n\n\t\t\t} else if ( face == 1.0 ) {\n\n\t\t\t\tdirection = direction.xzy;\n\t\t\t\tdirection.xz *= -1.0; // ( -u, 1, -v ) pos y\n\n\t\t\t} else if ( face == 2.0 ) {\n\n\t\t\t\tdirection.x *= -1.0; // ( -u, v, 1 ) pos z\n\n\t\t\t} else if ( face == 3.0 ) {\n\n\t\t\t\tdirection = direction.zyx;\n\t\t\t\tdirection.xz *= -1.0; // ( -1, v, -u ) neg x\n\n\t\t\t} else if ( face == 4.0 ) {\n\n\t\t\t\tdirection = direction.xzy;\n\t\t\t\tdirection.xy *= -1.0; // ( -u, -1, v ) neg y\n\n\t\t\t} else if ( face == 5.0 ) {\n\n\t\t\t\tdirection.z *= -1.0; // ( u, v, -1 ) neg z\n\n\t\t\t}\n\n\t\t\treturn direction;\n\n\t\t}\n\n\t\tvoid main() {\n\n\t\t\tvOutputDirection = getDirection( uv, faceIndex );\n\t\t\tgl_Position = vec4( position, 1.0 );\n\n\t\t}\n\t",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\n\n\t\tuniform int inputEncoding;\n\t\tuniform int outputEncoding;\n\n\t\t#include \n\n\t\tvec4 inputTexelToLinear( vec4 value ) {\n\n\t\t\tif ( inputEncoding == 0 ) {\n\n\t\t\t\treturn value;\n\n\t\t\t} else if ( inputEncoding == 1 ) {\n\n\t\t\t\treturn sRGBToLinear( value );\n\n\t\t\t} else if ( inputEncoding == 2 ) {\n\n\t\t\t\treturn RGBEToLinear( value );\n\n\t\t\t} else if ( inputEncoding == 3 ) {\n\n\t\t\t\treturn RGBMToLinear( value, 7.0 );\n\n\t\t\t} else if ( inputEncoding == 4 ) {\n\n\t\t\t\treturn RGBMToLinear( value, 16.0 );\n\n\t\t\t} else if ( inputEncoding == 5 ) {\n\n\t\t\t\treturn RGBDToLinear( value, 256.0 );\n\n\t\t\t} else {\n\n\t\t\t\treturn GammaToLinear( value, 2.2 );\n\n\t\t\t}\n\n\t\t}\n\n\t\tvec4 linearToOutputTexel( vec4 value ) {\n\n\t\t\tif ( outputEncoding == 0 ) {\n\n\t\t\t\treturn value;\n\n\t\t\t} else if ( outputEncoding == 1 ) {\n\n\t\t\t\treturn LinearTosRGB( value );\n\n\t\t\t} else if ( outputEncoding == 2 ) {\n\n\t\t\t\treturn LinearToRGBE( value );\n\n\t\t\t} else if ( outputEncoding == 3 ) {\n\n\t\t\t\treturn LinearToRGBM( value, 7.0 );\n\n\t\t\t} else if ( outputEncoding == 4 ) {\n\n\t\t\t\treturn LinearToRGBM( value, 16.0 );\n\n\t\t\t} else if ( outputEncoding == 5 ) {\n\n\t\t\t\treturn LinearToRGBD( value, 256.0 );\n\n\t\t\t} else {\n\n\t\t\t\treturn LinearToGamma( value, 2.2 );\n\n\t\t\t}\n\n\t\t}\n\n\t\tvec4 envMapTexelToLinear( vec4 color ) {\n\n\t\t\treturn inputTexelToLinear( color );\n\n\t\t}\n\t\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 fh(){return new Ts({name:"CubemapToCubeUV",uniforms:{envMap:{value:null},inputEncoding:{value:Yc[3e3]},outputEncoding:{value:Yc[3e3]}},vertexShader:"\n\n\t\tprecision mediump float;\n\t\tprecision mediump int;\n\n\t\tattribute vec3 position;\n\t\tattribute vec2 uv;\n\t\tattribute float faceIndex;\n\n\t\tvarying vec3 vOutputDirection;\n\n\t\t// RH coordinate system; PMREM face-indexing convention\n\t\tvec3 getDirection( vec2 uv, float face ) {\n\n\t\t\tuv = 2.0 * uv - 1.0;\n\n\t\t\tvec3 direction = vec3( uv, 1.0 );\n\n\t\t\tif ( face == 0.0 ) {\n\n\t\t\t\tdirection = direction.zyx; // ( 1, v, u ) pos x\n\n\t\t\t} else if ( face == 1.0 ) {\n\n\t\t\t\tdirection = direction.xzy;\n\t\t\t\tdirection.xz *= -1.0; // ( -u, 1, -v ) pos y\n\n\t\t\t} else if ( face == 2.0 ) {\n\n\t\t\t\tdirection.x *= -1.0; // ( -u, v, 1 ) pos z\n\n\t\t\t} else if ( face == 3.0 ) {\n\n\t\t\t\tdirection = direction.zyx;\n\t\t\t\tdirection.xz *= -1.0; // ( -1, v, -u ) neg x\n\n\t\t\t} else if ( face == 4.0 ) {\n\n\t\t\t\tdirection = direction.xzy;\n\t\t\t\tdirection.xy *= -1.0; // ( -u, -1, v ) neg y\n\n\t\t\t} else if ( face == 5.0 ) {\n\n\t\t\t\tdirection.z *= -1.0; // ( u, v, -1 ) neg z\n\n\t\t\t}\n\n\t\t\treturn direction;\n\n\t\t}\n\n\t\tvoid main() {\n\n\t\t\tvOutputDirection = getDirection( uv, faceIndex );\n\t\t\tgl_Position = vec4( position, 1.0 );\n\n\t\t}\n\t",fragmentShader:"\n\n\t\t\tprecision mediump float;\n\t\t\tprecision mediump int;\n\n\t\t\tvarying vec3 vOutputDirection;\n\n\t\t\tuniform samplerCube envMap;\n\n\t\t\t\n\n\t\tuniform int inputEncoding;\n\t\tuniform int outputEncoding;\n\n\t\t#include \n\n\t\tvec4 inputTexelToLinear( vec4 value ) {\n\n\t\t\tif ( inputEncoding == 0 ) {\n\n\t\t\t\treturn value;\n\n\t\t\t} else if ( inputEncoding == 1 ) {\n\n\t\t\t\treturn sRGBToLinear( value );\n\n\t\t\t} else if ( inputEncoding == 2 ) {\n\n\t\t\t\treturn RGBEToLinear( value );\n\n\t\t\t} else if ( inputEncoding == 3 ) {\n\n\t\t\t\treturn RGBMToLinear( value, 7.0 );\n\n\t\t\t} else if ( inputEncoding == 4 ) {\n\n\t\t\t\treturn RGBMToLinear( value, 16.0 );\n\n\t\t\t} else if ( inputEncoding == 5 ) {\n\n\t\t\t\treturn RGBDToLinear( value, 256.0 );\n\n\t\t\t} else {\n\n\t\t\t\treturn GammaToLinear( value, 2.2 );\n\n\t\t\t}\n\n\t\t}\n\n\t\tvec4 linearToOutputTexel( vec4 value ) {\n\n\t\t\tif ( outputEncoding == 0 ) {\n\n\t\t\t\treturn value;\n\n\t\t\t} else if ( outputEncoding == 1 ) {\n\n\t\t\t\treturn LinearTosRGB( value );\n\n\t\t\t} else if ( outputEncoding == 2 ) {\n\n\t\t\t\treturn LinearToRGBE( value );\n\n\t\t\t} else if ( outputEncoding == 3 ) {\n\n\t\t\t\treturn LinearToRGBM( value, 7.0 );\n\n\t\t\t} else if ( outputEncoding == 4 ) {\n\n\t\t\t\treturn LinearToRGBM( value, 16.0 );\n\n\t\t\t} else if ( outputEncoding == 5 ) {\n\n\t\t\t\treturn LinearToRGBD( value, 256.0 );\n\n\t\t\t} else {\n\n\t\t\t\treturn LinearToGamma( value, 2.2 );\n\n\t\t\t}\n\n\t\t}\n\n\t\tvec4 envMapTexelToLinear( vec4 color ) {\n\n\t\t\treturn inputTexelToLinear( color );\n\n\t\t}\n\t\n\n\t\t\tvoid main() {\n\n\t\t\t\tgl_FragColor = vec4( 0.0, 0.0, 0.0, 1.0 );\n\t\t\t\tgl_FragColor.rgb = envMapTexelToLinear( textureCube( envMap, vec3( - vOutputDirection.x, vOutputDirection.yz ) ) ).rgb;\n\t\t\t\tgl_FragColor = linearToOutputTexel( gl_FragColor );\n\n\t\t\t}\n\t\t",blending:0,depthTest:!1,depthWrite:!1})}ll.create=function(t,e){return console.log("THREE.Curve.create() has been deprecated"),t.prototype=Object.create(ll.prototype),t.prototype.constructor=t,t.prototype.getPoint=e,t},Rl.prototype.fromPoints=function(t){return console.warn("THREE.Path: .fromPoints() has been renamed to .setFromPoints()."),this.setFromPoints(t)},bc.prototype.setColors=function(){console.error("THREE.GridHelper: setColors() has been deprecated, pass them in the constructor instead.")},fc.prototype.update=function(){console.error("THREE.SkeletonHelper: update() no longer needs to be called.")},$s.prototype.extractUrlBase=function(t){return console.warn("THREE.Loader: .extractUrlBase() has been deprecated. Use THREE.LoaderUtils.extractUrlBase() instead."),Kl.extractUrlBase(t)},$s.Handlers={add:function(){console.error("THREE.Loader: Handlers.add() has been removed. Use LoadingManager.addHandler() instead.")},get:function(){console.error("THREE.Loader: Handlers.get() has been removed. Use LoadingManager.getHandler() instead.")}},ic.prototype.center=function(t){return console.warn("THREE.Box2: .center() has been renamed to .getCenter()."),this.getCenter(t)},ic.prototype.empty=function(){return console.warn("THREE.Box2: .empty() has been renamed to .isEmpty()."),this.isEmpty()},ic.prototype.isIntersectionBox=function(t){return console.warn("THREE.Box2: .isIntersectionBox() has been renamed to .intersectsBox()."),this.intersectsBox(t)},ic.prototype.size=function(t){return console.warn("THREE.Box2: .size() has been renamed to .getSize()."),this.getSize(t)},Ct.prototype.center=function(t){return console.warn("THREE.Box3: .center() has been renamed to .getCenter()."),this.getCenter(t)},Ct.prototype.empty=function(){return console.warn("THREE.Box3: .empty() has been renamed to .isEmpty()."),this.isEmpty()},Ct.prototype.isIntersectionBox=function(t){return console.warn("THREE.Box3: .isIntersectionBox() has been renamed to .intersectsBox()."),this.intersectsBox(t)},Ct.prototype.isIntersectionSphere=function(t){return console.warn("THREE.Box3: .isIntersectionSphere() has been renamed to .intersectsSphere()."),this.intersectsSphere(t)},Ct.prototype.size=function(t){return console.warn("THREE.Box3: .size() has been renamed to .getSize()."),this.getSize(t)},Zt.prototype.empty=function(){return console.warn("THREE.Sphere: .empty() has been renamed to .isEmpty()."),this.isEmpty()},ar.prototype.setFromMatrix=function(t){return console.warn("THREE.Frustum: .setFromMatrix() has been renamed to .setFromProjectionMatrix()."),this.setFromProjectionMatrix(t)},sc.prototype.center=function(t){return console.warn("THREE.Line3: .center() has been renamed to .getCenter()."),this.getCenter(t)},mt.random16=function(){return console.warn("THREE.Math: .random16() has been deprecated. Use Math.random() instead."),Math.random()},mt.nearestPowerOfTwo=function(t){return console.warn("THREE.Math: .nearestPowerOfTwo() has been renamed to .floorPowerOfTwo()."),mt.floorPowerOfTwo(t)},mt.nextPowerOfTwo=function(t){return console.warn("THREE.Math: .nextPowerOfTwo() has been renamed to .ceilPowerOfTwo()."),mt.ceilPowerOfTwo(t)},yt.prototype.flattenToArrayOffset=function(t,e){return console.warn("THREE.Matrix3: .flattenToArrayOffset() has been deprecated. Use .toArray() instead."),this.toArray(t,e)},yt.prototype.multiplyVector3=function(t){return console.warn("THREE.Matrix3: .multiplyVector3() has been removed. Use vector.applyMatrix3( matrix ) instead."),t.applyMatrix3(this)},yt.prototype.multiplyVector3Array=function(){console.error("THREE.Matrix3: .multiplyVector3Array() has been removed.")},yt.prototype.applyToBufferAttribute=function(t){return console.warn("THREE.Matrix3: .applyToBufferAttribute() has been removed. Use attribute.applyMatrix3( matrix ) instead."),t.applyMatrix3(this)},yt.prototype.applyToVector3Array=function(){console.error("THREE.Matrix3: .applyToVector3Array() has been removed.")},yt.prototype.getInverse=function(t){return console.warn("THREE.Matrix3: .getInverse() has been removed. Use matrixInv.copy( matrix ).invert(); instead."),this.copy(t).invert()},ie.prototype.extractPosition=function(t){return console.warn("THREE.Matrix4: .extractPosition() has been renamed to .copyPosition()."),this.copyPosition(t)},ie.prototype.flattenToArrayOffset=function(t,e){return console.warn("THREE.Matrix4: .flattenToArrayOffset() has been deprecated. Use .toArray() instead."),this.toArray(t,e)},ie.prototype.getPosition=function(){return console.warn("THREE.Matrix4: .getPosition() has been removed. Use Vector3.setFromMatrixPosition( matrix ) instead."),(new At).setFromMatrixColumn(this,3)},ie.prototype.setRotationFromQuaternion=function(t){return console.warn("THREE.Matrix4: .setRotationFromQuaternion() has been renamed to .makeRotationFromQuaternion()."),this.makeRotationFromQuaternion(t)},ie.prototype.multiplyToArray=function(){console.warn("THREE.Matrix4: .multiplyToArray() has been removed.")},ie.prototype.multiplyVector3=function(t){return console.warn("THREE.Matrix4: .multiplyVector3() has been removed. Use vector.applyMatrix4( matrix ) instead."),t.applyMatrix4(this)},ie.prototype.multiplyVector4=function(t){return console.warn("THREE.Matrix4: .multiplyVector4() has been removed. Use vector.applyMatrix4( matrix ) instead."),t.applyMatrix4(this)},ie.prototype.multiplyVector3Array=function(){console.error("THREE.Matrix4: .multiplyVector3Array() has been removed.")},ie.prototype.rotateAxis=function(t){console.warn("THREE.Matrix4: .rotateAxis() has been removed. Use Vector3.transformDirection( matrix ) instead."),t.transformDirection(this)},ie.prototype.crossVector=function(t){return console.warn("THREE.Matrix4: .crossVector() has been removed. Use vector.applyMatrix4( matrix ) instead."),t.applyMatrix4(this)},ie.prototype.translate=function(){console.error("THREE.Matrix4: .translate() has been removed.")},ie.prototype.rotateX=function(){console.error("THREE.Matrix4: .rotateX() has been removed.")},ie.prototype.rotateY=function(){console.error("THREE.Matrix4: .rotateY() has been removed.")},ie.prototype.rotateZ=function(){console.error("THREE.Matrix4: .rotateZ() has been removed.")},ie.prototype.rotateByAxis=function(){console.error("THREE.Matrix4: .rotateByAxis() has been removed.")},ie.prototype.applyToBufferAttribute=function(t){return console.warn("THREE.Matrix4: .applyToBufferAttribute() has been removed. Use attribute.applyMatrix4( matrix ) instead."),t.applyMatrix4(this)},ie.prototype.applyToVector3Array=function(){console.error("THREE.Matrix4: .applyToVector3Array() has been removed.")},ie.prototype.makeFrustum=function(t,e,n,r,i,a){return console.warn("THREE.Matrix4: .makeFrustum() has been removed. Use .makePerspective( left, right, top, bottom, near, far ) instead."),this.makePerspective(t,e,r,n,i,a)},ie.prototype.getInverse=function(t){return console.warn("THREE.Matrix4: .getInverse() has been removed. Use matrixInv.copy( matrix ).invert(); instead."),this.copy(t).invert()},Ie.prototype.isIntersectionLine=function(t){return console.warn("THREE.Plane: .isIntersectionLine() has been renamed to .intersectsLine()."),this.intersectsLine(t)},Et.prototype.multiplyVector3=function(t){return console.warn("THREE.Quaternion: .multiplyVector3() has been removed. Use is now vector.applyQuaternion( quaternion ) instead."),t.applyQuaternion(this)},Et.prototype.inverse=function(){return console.warn("THREE.Quaternion: .inverse() has been renamed to invert()."),this.invert()},re.prototype.isIntersectionBox=function(t){return console.warn("THREE.Ray: .isIntersectionBox() has been renamed to .intersectsBox()."),this.intersectsBox(t)},re.prototype.isIntersectionPlane=function(t){return console.warn("THREE.Ray: .isIntersectionPlane() has been renamed to .intersectsPlane()."),this.intersectsPlane(t)},re.prototype.isIntersectionSphere=function(t){return console.warn("THREE.Ray: .isIntersectionSphere() has been renamed to .intersectsSphere()."),this.intersectsSphere(t)},We.prototype.area=function(){return console.warn("THREE.Triangle: .area() has been renamed to .getArea()."),this.getArea()},We.prototype.barycoordFromPoint=function(t,e){return console.warn("THREE.Triangle: .barycoordFromPoint() has been renamed to .getBarycoord()."),this.getBarycoord(t,e)},We.prototype.midpoint=function(t){return console.warn("THREE.Triangle: .midpoint() has been renamed to .getMidpoint()."),this.getMidpoint(t)},We.prototypenormal=function(t){return console.warn("THREE.Triangle: .normal() has been renamed to .getNormal()."),this.getNormal(t)},We.prototype.plane=function(t){return console.warn("THREE.Triangle: .plane() has been renamed to .getPlane()."),this.getPlane(t)},We.barycoordFromPoint=function(t,e,n,r,i){return console.warn("THREE.Triangle: .barycoordFromPoint() has been renamed to .getBarycoord()."),We.getBarycoord(t,e,n,r,i)},We.normal=function(t,e,n,r){return console.warn("THREE.Triangle: .normal() has been renamed to .getNormal()."),We.getNormal(t,e,n,r)},Cl.prototype.extractAllPoints=function(t){return console.warn("THREE.Shape: .extractAllPoints() has been removed. Use .extractPoints() instead."),this.extractPoints(t)},Cl.prototype.extrude=function(t){return console.warn("THREE.Shape: .extrude() has been removed. Use ExtrudeGeometry() instead."),new ls(this,t)},Cl.prototype.makeGeometry=function(t){return console.warn("THREE.Shape: .makeGeometry() has been removed. Use ShapeGeometry() instead."),new ms(this,t)},vt.prototype.fromAttribute=function(t,e,n){return console.warn("THREE.Vector2: .fromAttribute() has been renamed to .fromBufferAttribute()."),this.fromBufferAttribute(t,e,n)},vt.prototype.distanceToManhattan=function(t){return console.warn("THREE.Vector2: .distanceToManhattan() has been renamed to .manhattanDistanceTo()."),this.manhattanDistanceTo(t)},vt.prototype.lengthManhattan=function(){return console.warn("THREE.Vector2: .lengthManhattan() has been renamed to .manhattanLength()."),this.manhattanLength()},At.prototype.setEulerFromRotationMatrix=function(){console.error("THREE.Vector3: .setEulerFromRotationMatrix() has been removed. Use Euler.setFromRotationMatrix() instead.")},At.prototype.setEulerFromQuaternion=function(){console.error("THREE.Vector3: .setEulerFromQuaternion() has been removed. Use Euler.setFromQuaternion() instead.")},At.prototype.getPositionFromMatrix=function(t){return console.warn("THREE.Vector3: .getPositionFromMatrix() has been renamed to .setFromMatrixPosition()."),this.setFromMatrixPosition(t)},At.prototype.getScaleFromMatrix=function(t){return console.warn("THREE.Vector3: .getScaleFromMatrix() has been renamed to .setFromMatrixScale()."),this.setFromMatrixScale(t)},At.prototype.getColumnFromMatrix=function(t,e){return console.warn("THREE.Vector3: .getColumnFromMatrix() has been renamed to .setFromMatrixColumn()."),this.setFromMatrixColumn(e,t)},At.prototype.applyProjection=function(t){return console.warn("THREE.Vector3: .applyProjection() has been removed. Use .applyMatrix4( m ) instead."),this.applyMatrix4(t)},At.prototype.fromAttribute=function(t,e,n){return console.warn("THREE.Vector3: .fromAttribute() has been renamed to .fromBufferAttribute()."),this.fromBufferAttribute(t,e,n)},At.prototype.distanceToManhattan=function(t){return console.warn("THREE.Vector3: .distanceToManhattan() has been renamed to .manhattanDistanceTo()."),this.manhattanDistanceTo(t)},At.prototype.lengthManhattan=function(){return console.warn("THREE.Vector3: .lengthManhattan() has been renamed to .manhattanLength()."),this.manhattanLength()},Mt.prototype.fromAttribute=function(t,e,n){return console.warn("THREE.Vector4: .fromAttribute() has been renamed to .fromBufferAttribute()."),this.fromBufferAttribute(t,e,n)},Mt.prototype.lengthManhattan=function(){return console.warn("THREE.Vector4: .lengthManhattan() has been renamed to .manhattanLength()."),this.manhattanLength()},Re.prototype.getChildByName=function(t){return console.warn("THREE.Object3D: .getChildByName() has been renamed to .getObjectByName()."),this.getObjectByName(t)},Re.prototype.renderDepth=function(){console.warn("THREE.Object3D: .renderDepth has been removed. Use .renderOrder, instead.")},Re.prototype.translate=function(t,e){return console.warn("THREE.Object3D: .translate() has been removed. Use .translateOnAxis( axis, distance ) instead."),this.translateOnAxis(e,t)},Re.prototype.getWorldRotation=function(){console.error("THREE.Object3D: .getWorldRotation() has been removed. Use THREE.Object3D.getWorldQuaternion( target ) instead.")},Re.prototype.applyMatrix=function(t){return console.warn("THREE.Object3D: .applyMatrix() has been renamed to .applyMatrix4()."),this.applyMatrix4(t)},Object.defineProperties(Re.prototype,{eulerOrder:{get:function(){return console.warn("THREE.Object3D: .eulerOrder is now .rotation.order."),this.rotation.order},set:function(t){console.warn("THREE.Object3D: .eulerOrder is now .rotation.order."),this.rotation.order=t}},useQuaternion:{get:function(){console.warn("THREE.Object3D: .useQuaternion has been removed. The library now uses quaternions by default.")},set:function(){console.warn("THREE.Object3D: .useQuaternion has been removed. The library now uses quaternions by default.")}}}),Vn.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(Vn.prototype,{drawMode:{get:function(){return console.error("THREE.Mesh: .drawMode has been removed. The renderer now always assumes THREE.TrianglesDrawMode."),0},set:function(){console.error("THREE.Mesh: .drawMode has been removed. The renderer now always assumes THREE.TrianglesDrawMode. Transform your geometry via BufferGeometryUtils.toTrianglesDrawMode() if necessary.")}}}),Va.prototype.initBones=function(){console.error("THREE.SkinnedMesh: initBones() has been removed.")},Object.defineProperty(ll.prototype,"__arcLengthDivisions",{get:function(){return console.warn("THREE.Curve: .__arcLengthDivisions is now .arcLengthDivisions."),this.arcLengthDivisions},set:function(t){console.warn("THREE.Curve: .__arcLengthDivisions is now .arcLengthDivisions."),this.arcLengthDivisions=t}}),Qn.prototype.setLens=function(t,e){console.warn("THREE.PerspectiveCamera.setLens is deprecated. Use .setFocalLength and .filmGauge for a photographic setup."),void 0!==e&&(this.filmGauge=e),this.setFocalLength(t)},Object.defineProperties(Pl.prototype,{onlyShadow:{set:function(){console.warn("THREE.Light: .onlyShadow has been removed.")}},shadowCameraFov:{set:function(t){console.warn("THREE.Light: .shadowCameraFov is now .shadow.camera.fov."),this.shadow.camera.fov=t}},shadowCameraLeft:{set:function(t){console.warn("THREE.Light: .shadowCameraLeft is now .shadow.camera.left."),this.shadow.camera.left=t}},shadowCameraRight:{set:function(t){console.warn("THREE.Light: .shadowCameraRight is now .shadow.camera.right."),this.shadow.camera.right=t}},shadowCameraTop:{set:function(t){console.warn("THREE.Light: .shadowCameraTop is now .shadow.camera.top."),this.shadow.camera.top=t}},shadowCameraBottom:{set:function(t){console.warn("THREE.Light: .shadowCameraBottom is now .shadow.camera.bottom."),this.shadow.camera.bottom=t}},shadowCameraNear:{set:function(t){console.warn("THREE.Light: .shadowCameraNear is now .shadow.camera.near."),this.shadow.camera.near=t}},shadowCameraFar:{set:function(t){console.warn("THREE.Light: .shadowCameraFar is now .shadow.camera.far."),this.shadow.camera.far=t}},shadowCameraVisible:{set:function(){console.warn("THREE.Light: .shadowCameraVisible has been removed. Use new THREE.CameraHelper( light.shadow.camera ) instead.")}},shadowBias:{set:function(t){console.warn("THREE.Light: .shadowBias is now .shadow.bias."),this.shadow.bias=t}},shadowDarkness:{set:function(){console.warn("THREE.Light: .shadowDarkness has been removed.")}},shadowMapWidth:{set:function(t){console.warn("THREE.Light: .shadowMapWidth is now .shadow.mapSize.width."),this.shadow.mapSize.width=t}},shadowMapHeight:{set:function(t){console.warn("THREE.Light: .shadowMapHeight is now .shadow.mapSize.height."),this.shadow.mapSize.height=t}}}),Object.defineProperties(rn.prototype,{length:{get:function(){return console.warn("THREE.BufferAttribute: .length has been deprecated. Use .count instead."),this.array.length}},dynamic:{get:function(){return console.warn("THREE.BufferAttribute: .dynamic has been deprecated. Use .usage instead."),this.usage===nt},set:function(){console.warn("THREE.BufferAttribute: .dynamic has been deprecated. Use .usage instead."),this.setUsage(nt)}}}),rn.prototype.setDynamic=function(t){return console.warn("THREE.BufferAttribute: .setDynamic() has been deprecated. Use .setUsage() instead."),this.setUsage(!0===t?nt:et),this},rn.prototype.copyIndicesArray=function(){console.error("THREE.BufferAttribute: .copyIndicesArray() has been removed.")},rn.prototype.setArray=function(){console.error("THREE.BufferAttribute: .setArray has been removed. Use BufferGeometry .setAttribute to replace/resize attribute buffers")},Tn.prototype.addIndex=function(t){console.warn("THREE.BufferGeometry: .addIndex() has been renamed to .setIndex()."),this.setIndex(t)},Tn.prototype.addAttribute=function(t,e){return console.warn("THREE.BufferGeometry: .addAttribute() has been renamed to .setAttribute()."),e&&e.isBufferAttribute||e&&e.isInterleavedBufferAttribute?"index"===t?(console.warn("THREE.BufferGeometry.addAttribute: Use .setIndex() for index attribute."),this.setIndex(e),this):this.setAttribute(t,e):(console.warn("THREE.BufferGeometry: .addAttribute() now expects ( name, attribute )."),this.setAttribute(t,new rn(arguments[1],arguments[2])))},Tn.prototype.addDrawCall=function(t,e,n){void 0!==n&&console.warn("THREE.BufferGeometry: .addDrawCall() no longer supports indexOffset."),console.warn("THREE.BufferGeometry: .addDrawCall() is now .addGroup()."),this.addGroup(t,e)},Tn.prototype.clearDrawCalls=function(){console.warn("THREE.BufferGeometry: .clearDrawCalls() is now .clearGroups()."),this.clearGroups()},Tn.prototype.computeOffsets=function(){console.warn("THREE.BufferGeometry: .computeOffsets() has been removed.")},Tn.prototype.removeAttribute=function(t){return console.warn("THREE.BufferGeometry: .removeAttribute() has been renamed to .deleteAttribute()."),this.deleteAttribute(t)},Tn.prototype.applyMatrix=function(t){return console.warn("THREE.BufferGeometry: .applyMatrix() has been renamed to .applyMatrix4()."),this.applyMatrix4(t)},Object.defineProperties(Tn.prototype,{drawcalls:{get:function(){return console.error("THREE.BufferGeometry: .drawcalls has been renamed to .groups."),this.groups}},offsets:{get:function(){return console.warn("THREE.BufferGeometry: .offsets has been renamed to .groups."),this.groups}}}),Object.defineProperties($l.prototype,{maxInstancedCount:{get:function(){return console.warn("THREE.InstancedBufferGeometry: .maxInstancedCount has been renamed to .instanceCount."),this.instanceCount},set:function(t){console.warn("THREE.InstancedBufferGeometry: .maxInstancedCount has been renamed to .instanceCount."),this.instanceCount=t}}}),Object.defineProperties(Ku.prototype,{linePrecision:{get:function(){return console.warn("THREE.Raycaster: .linePrecision has been deprecated. Use .params.Line.threshold instead."),this.params.Line.threshold},set:function(t){console.warn("THREE.Raycaster: .linePrecision has been deprecated. Use .params.Line.threshold instead."),this.params.Line.threshold=t}}}),Object.defineProperties(va.prototype,{dynamic:{get:function(){return console.warn("THREE.InterleavedBuffer: .length has been deprecated. Use .usage instead."),this.usage===nt},set:function(t){console.warn("THREE.InterleavedBuffer: .length has been deprecated. Use .usage instead."),this.setUsage(t)}}}),va.prototype.setDynamic=function(t){return console.warn("THREE.InterleavedBuffer: .setDynamic() has been deprecated. Use .setUsage() instead."),this.setUsage(!0===t?nt:et),this},va.prototype.setArray=function(){console.error("THREE.InterleavedBuffer: .setArray has been removed. Use BufferGeometry .setAttribute to replace/resize attribute buffers")},ls.prototype.getArrays=function(){console.error("THREE.ExtrudeGeometry: .getArrays() has been removed.")},ls.prototype.addShapeList=function(){console.error("THREE.ExtrudeGeometry: .addShapeList() has been removed.")},ls.prototype.addShape=function(){console.error("THREE.ExtrudeGeometry: .addShape() has been removed.")},ma.prototype.dispose=function(){console.error("THREE.Scene: .dispose() has been removed.")},Zu.prototype.onUpdate=function(){return console.warn("THREE.Uniform: .onUpdate() has been removed. Use object.onBeforeRender() instead."),this},Object.defineProperties(qe.prototype,{wrapAround:{get:function(){console.warn("THREE.Material: .wrapAround has been removed.")},set:function(){console.warn("THREE.Material: .wrapAround has been removed.")}},overdraw:{get:function(){console.warn("THREE.Material: .overdraw has been removed.")},set:function(){console.warn("THREE.Material: .overdraw has been removed.")}},wrapRGB:{get:function(){return console.warn("THREE.Material: .wrapRGB has been removed."),new $e}},shading:{get:function(){console.error("THREE."+this.type+": .shading has been removed. Use the boolean .flatShading instead.")},set:function(t){console.warn("THREE."+this.type+": .shading has been removed. Use the boolean .flatShading instead."),this.flatShading=1===t}},stencilMask:{get:function(){return console.warn("THREE."+this.type+": .stencilMask has been removed. Use .stencilFuncMask instead."),this.stencilFuncMask},set:function(t){console.warn("THREE."+this.type+": .stencilMask has been removed. Use .stencilFuncMask instead."),this.stencilFuncMask=t}}}),Object.defineProperties(As.prototype,{transparency:{get:function(){return console.warn("THREE.MeshPhysicalMaterial: .transparency has been renamed to .transmission."),this.transmission},set:function(t){console.warn("THREE.MeshPhysicalMaterial: .transparency has been renamed to .transmission."),this.transmission=t}}}),Object.defineProperties(Zn.prototype,{derivatives:{get:function(){return console.warn("THREE.ShaderMaterial: .derivatives has been moved to .extensions.derivatives."),this.extensions.derivatives},set:function(t){console.warn("THREE. ShaderMaterial: .derivatives has been moved to .extensions.derivatives."),this.extensions.derivatives=t}}}),ha.prototype.clearTarget=function(t,e,n,r){console.warn("THREE.WebGLRenderer: .clearTarget() has been deprecated. Use .setRenderTarget() and .clear() instead."),this.setRenderTarget(t),this.clear(e,n,r)},ha.prototype.animate=function(t){console.warn("THREE.WebGLRenderer: .animate() is now .setAnimationLoop()."),this.setAnimationLoop(t)},ha.prototype.getCurrentRenderTarget=function(){return console.warn("THREE.WebGLRenderer: .getCurrentRenderTarget() is now .getRenderTarget()."),this.getRenderTarget()},ha.prototype.getMaxAnisotropy=function(){return console.warn("THREE.WebGLRenderer: .getMaxAnisotropy() is now .capabilities.getMaxAnisotropy()."),this.capabilities.getMaxAnisotropy()},ha.prototype.getPrecision=function(){return console.warn("THREE.WebGLRenderer: .getPrecision() is now .capabilities.precision."),this.capabilities.precision},ha.prototype.resetGLState=function(){return console.warn("THREE.WebGLRenderer: .resetGLState() is now .state.reset()."),this.state.reset()},ha.prototype.supportsFloatTextures=function(){return console.warn("THREE.WebGLRenderer: .supportsFloatTextures() is now .extensions.get( 'OES_texture_float' )."),this.extensions.get("OES_texture_float")},ha.prototype.supportsHalfFloatTextures=function(){return console.warn("THREE.WebGLRenderer: .supportsHalfFloatTextures() is now .extensions.get( 'OES_texture_half_float' )."),this.extensions.get("OES_texture_half_float")},ha.prototype.supportsStandardDerivatives=function(){return console.warn("THREE.WebGLRenderer: .supportsStandardDerivatives() is now .extensions.get( 'OES_standard_derivatives' )."),this.extensions.get("OES_standard_derivatives")},ha.prototype.supportsCompressedTextureS3TC=function(){return console.warn("THREE.WebGLRenderer: .supportsCompressedTextureS3TC() is now .extensions.get( 'WEBGL_compressed_texture_s3tc' )."),this.extensions.get("WEBGL_compressed_texture_s3tc")},ha.prototype.supportsCompressedTexturePVRTC=function(){return console.warn("THREE.WebGLRenderer: .supportsCompressedTexturePVRTC() is now .extensions.get( 'WEBGL_compressed_texture_pvrtc' )."),this.extensions.get("WEBGL_compressed_texture_pvrtc")},ha.prototype.supportsBlendMinMax=function(){return console.warn("THREE.WebGLRenderer: .supportsBlendMinMax() is now .extensions.get( 'EXT_blend_minmax' )."),this.extensions.get("EXT_blend_minmax")},ha.prototype.supportsVertexTextures=function(){return console.warn("THREE.WebGLRenderer: .supportsVertexTextures() is now .capabilities.vertexTextures."),this.capabilities.vertexTextures},ha.prototype.supportsInstancedArrays=function(){return console.warn("THREE.WebGLRenderer: .supportsInstancedArrays() is now .extensions.get( 'ANGLE_instanced_arrays' )."),this.extensions.get("ANGLE_instanced_arrays")},ha.prototype.enableScissorTest=function(t){console.warn("THREE.WebGLRenderer: .enableScissorTest() is now .setScissorTest()."),this.setScissorTest(t)},ha.prototype.initMaterial=function(){console.warn("THREE.WebGLRenderer: .initMaterial() has been removed.")},ha.prototype.addPrePlugin=function(){console.warn("THREE.WebGLRenderer: .addPrePlugin() has been removed.")},ha.prototype.addPostPlugin=function(){console.warn("THREE.WebGLRenderer: .addPostPlugin() has been removed.")},ha.prototype.updateShadowMap=function(){console.warn("THREE.WebGLRenderer: .updateShadowMap() has been removed.")},ha.prototype.setFaceCulling=function(){console.warn("THREE.WebGLRenderer: .setFaceCulling() has been removed.")},ha.prototype.allocTextureUnit=function(){console.warn("THREE.WebGLRenderer: .allocTextureUnit() has been removed.")},ha.prototype.setTexture=function(){console.warn("THREE.WebGLRenderer: .setTexture() has been removed.")},ha.prototype.setTexture2D=function(){console.warn("THREE.WebGLRenderer: .setTexture2D() has been removed.")},ha.prototype.setTextureCube=function(){console.warn("THREE.WebGLRenderer: .setTextureCube() has been removed.")},ha.prototype.getActiveMipMapLevel=function(){return console.warn("THREE.WebGLRenderer: .getActiveMipMapLevel() is now .getActiveMipmapLevel()."),this.getActiveMipmapLevel()},Object.defineProperties(ha.prototype,{shadowMapEnabled:{get:function(){return this.shadowMap.enabled},set:function(t){console.warn("THREE.WebGLRenderer: .shadowMapEnabled is now .shadowMap.enabled."),this.shadowMap.enabled=t}},shadowMapType:{get:function(){return this.shadowMap.type},set:function(t){console.warn("THREE.WebGLRenderer: .shadowMapType is now .shadowMap.type."),this.shadowMap.type=t}},shadowMapCullFace:{get:function(){console.warn("THREE.WebGLRenderer: .shadowMapCullFace has been removed. Set Material.shadowSide instead.")},set:function(){console.warn("THREE.WebGLRenderer: .shadowMapCullFace has been removed. Set Material.shadowSide instead.")}},context:{get:function(){return console.warn("THREE.WebGLRenderer: .context has been removed. Use .getContext() instead."),this.getContext()}},vr:{get:function(){return console.warn("THREE.WebGLRenderer: .vr has been renamed to .xr"),this.xr}},gammaInput:{get:function(){return console.warn("THREE.WebGLRenderer: .gammaInput has been removed. Set the encoding for textures via Texture.encoding instead."),!1},set:function(){console.warn("THREE.WebGLRenderer: .gammaInput has been removed. Set the encoding for textures via Texture.encoding instead.")}},gammaOutput:{get:function(){return console.warn("THREE.WebGLRenderer: .gammaOutput has been removed. Set WebGLRenderer.outputEncoding instead."),!1},set:function(t){console.warn("THREE.WebGLRenderer: .gammaOutput has been removed. Set WebGLRenderer.outputEncoding instead."),this.outputEncoding=!0===t?Y:X}},toneMappingWhitePoint:{get:function(){return console.warn("THREE.WebGLRenderer: .toneMappingWhitePoint has been removed."),1},set:function(){console.warn("THREE.WebGLRenderer: .toneMappingWhitePoint has been removed.")}}}),Object.defineProperties(na.prototype,{cullFace:{get:function(){console.warn("THREE.WebGLRenderer: .shadowMap.cullFace has been removed. Set Material.shadowSide instead.")},set:function(){console.warn("THREE.WebGLRenderer: .shadowMap.cullFace has been removed. Set Material.shadowSide instead.")}},renderReverseSided:{get:function(){console.warn("THREE.WebGLRenderer: .shadowMap.renderReverseSided has been removed. Set Material.shadowSide instead.")},set:function(){console.warn("THREE.WebGLRenderer: .shadowMap.renderReverseSided has been removed. Set Material.shadowSide instead.")}},renderSingleSided:{get:function(){console.warn("THREE.WebGLRenderer: .shadowMap.renderSingleSided has been removed. Set Material.shadowSide instead.")},set:function(){console.warn("THREE.WebGLRenderer: .shadowMap.renderSingleSided has been removed. Set Material.shadowSide instead.")}}}),Object.defineProperties(St.prototype,{wrapS:{get:function(){return console.warn("THREE.WebGLRenderTarget: .wrapS is now .texture.wrapS."),this.texture.wrapS},set:function(t){console.warn("THREE.WebGLRenderTarget: .wrapS is now .texture.wrapS."),this.texture.wrapS=t}},wrapT:{get:function(){return console.warn("THREE.WebGLRenderTarget: .wrapT is now .texture.wrapT."),this.texture.wrapT},set:function(t){console.warn("THREE.WebGLRenderTarget: .wrapT is now .texture.wrapT."),this.texture.wrapT=t}},magFilter:{get:function(){return console.warn("THREE.WebGLRenderTarget: .magFilter is now .texture.magFilter."),this.texture.magFilter},set:function(t){console.warn("THREE.WebGLRenderTarget: .magFilter is now .texture.magFilter."),this.texture.magFilter=t}},minFilter:{get:function(){return console.warn("THREE.WebGLRenderTarget: .minFilter is now .texture.minFilter."),this.texture.minFilter},set:function(t){console.warn("THREE.WebGLRenderTarget: .minFilter is now .texture.minFilter."),this.texture.minFilter=t}},anisotropy:{get:function(){return console.warn("THREE.WebGLRenderTarget: .anisotropy is now .texture.anisotropy."),this.texture.anisotropy},set:function(t){console.warn("THREE.WebGLRenderTarget: .anisotropy is now .texture.anisotropy."),this.texture.anisotropy=t}},offset:{get:function(){return console.warn("THREE.WebGLRenderTarget: .offset is now .texture.offset."),this.texture.offset},set:function(t){console.warn("THREE.WebGLRenderTarget: .offset is now .texture.offset."),this.texture.offset=t}},repeat:{get:function(){return console.warn("THREE.WebGLRenderTarget: .repeat is now .texture.repeat."),this.texture.repeat},set:function(t){console.warn("THREE.WebGLRenderTarget: .repeat is now .texture.repeat."),this.texture.repeat=t}},format:{get:function(){return console.warn("THREE.WebGLRenderTarget: .format is now .texture.format."),this.texture.format},set:function(t){console.warn("THREE.WebGLRenderTarget: .format is now .texture.format."),this.texture.format=t}},type:{get:function(){return console.warn("THREE.WebGLRenderTarget: .type is now .texture.type."),this.texture.type},set:function(t){console.warn("THREE.WebGLRenderTarget: .type is now .texture.type."),this.texture.type=t}},generateMipmaps:{get:function(){return console.warn("THREE.WebGLRenderTarget: .generateMipmaps is now .texture.generateMipmaps."),this.texture.generateMipmaps},set:function(t){console.warn("THREE.WebGLRenderTarget: .generateMipmaps is now .texture.generateMipmaps."),this.texture.generateMipmaps=t}}}),Eu.prototype.load=function(t){console.warn("THREE.Audio: .load has been deprecated. Use THREE.AudioLoader instead.");var e=this;return(new pu).load(t,(function(t){e.setBuffer(t)})),this},Du.prototype.getData=function(){return console.warn("THREE.AudioAnalyser: .getData() is now .getFrequencyData()."),this.getFrequencyData()},$n.prototype.updateCubeMap=function(t,e){return console.warn("THREE.CubeCamera: .updateCubeMap() is now .update()."),this.update(t,e)},$n.prototype.clear=function(t,e,n,r){return console.warn("THREE.CubeCamera: .clear() is now .renderTarget.clear()."),this.renderTarget.clear(t,e,n,r)},xt.crossOrigin=void 0,xt.loadTexture=function(t,e,n,r){console.warn("THREE.ImageUtils.loadTexture has been deprecated. Use THREE.TextureLoader() instead.");var i=new sl;i.setCrossOrigin(this.crossOrigin);var a=i.load(t,n,void 0,r);return e&&(a.mapping=e),a},xt.loadTextureCube=function(t,e,n,r){console.warn("THREE.ImageUtils.loadTextureCube has been deprecated. Use THREE.CubeTextureLoader() instead.");var i=new al;i.setCrossOrigin(this.crossOrigin);var a=i.load(t,n,void 0,r);return e&&(a.mapping=e),a},xt.loadCompressedTexture=function(){console.error("THREE.ImageUtils.loadCompressedTexture has been removed. Use THREE.DDSLoader instead.")},xt.loadCompressedTextureCube=function(){console.error("THREE.ImageUtils.loadCompressedTextureCube has been removed. Use THREE.DDSLoader instead.")};var mh={createMultiMaterialObject:function(){console.error("THREE.SceneUtils has been moved to /examples/jsm/utils/SceneUtils.js")},detach:function(){console.error("THREE.SceneUtils has been moved to /examples/jsm/utils/SceneUtils.js")},attach:function(){console.error("THREE.SceneUtils has been moved to /examples/jsm/utils/SceneUtils.js")}};"undefined"!=typeof __THREE_DEVTOOLS__&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("register",{detail:{revision:e}})),"undefined"!=typeof window&&(window.__THREE__?console.warn("WARNING: Multiple instances of Three.js being imported."):window.__THREE__=e),t.ACESFilmicToneMapping=4,t.AddEquation=n,t.AddOperation=2,t.AdditiveAnimationBlendMode=q,t.AdditiveBlending=2,t.AlphaFormat=1021,t.AlwaysDepth=1,t.AlwaysStencilFunc=519,t.AmbientLight=Xl,t.AmbientLightProbe=mu,t.AnimationClip=Ys,t.AnimationLoader=nl,t.AnimationMixer=Yu,t.AnimationObjectGroup=qu,t.AnimationUtils=Bs,t.ArcCurve=cl,t.ArrayCamera=oa,t.ArrowHelper=Hc,t.Audio=Eu,t.AudioAnalyser=Du,t.AudioContext=du,t.AudioListener=Tu,t.AudioLoader=pu,t.AxesHelper=Gc,t.AxisHelper=function(t){return console.warn("THREE.AxisHelper has been renamed to THREE.AxesHelper."),new Gc(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 ol(t)},t.Bone=Wa,t.BooleanKeyframeTrack=Us,t.BoundingBoxHelper=function(t,e){return console.warn("THREE.BoundingBoxHelper has been deprecated. Creating a THREE.BoxHelper instead."),new Bc(t,e)},t.Box2=ic,t.Box3=Ct,t.Box3Helper=Oc,t.BoxBufferGeometry=jn,t.BoxGeometry=jn,t.BoxHelper=Bc,t.BufferAttribute=rn,t.BufferGeometry=Tn,t.BufferGeometryLoader=eu,t.ByteType=1010,t.Cache=Js,t.Camera=Jn,t.CameraHelper=Rc,t.CanvasRenderer=function(){console.error("THREE.CanvasRenderer has been removed")},t.CanvasTexture=wo,t.CatmullRomCurve3=vl,t.CineonToneMapping=3,t.CircleBufferGeometry=So,t.CircleGeometry=So,t.ClampToEdgeWrapping=h,t.Clock=xu,t.Color=$e,t.ColorKeyframeTrack=ks,t.CompressedTexture=bo,t.CompressedTextureLoader=rl,t.ConeBufferGeometry=Eo,t.ConeGeometry=Eo,t.CubeCamera=$n,t.CubeReflectionMapping=i,t.CubeRefractionMapping=a,t.CubeTexture=tr,t.CubeTextureLoader=al,t.CubeUVReflectionMapping=l,t.CubeUVRefractionMapping=u,t.CubicBezierCurve=_l,t.CubicBezierCurve3=bl,t.CubicInterpolant=zs,t.CullFaceBack=1,t.CullFaceFront=2,t.CullFaceFrontBack=3,t.CullFaceNone=0,t.Curve=ll,t.CurvePath=Ll,t.CustomBlending=5,t.CustomToneMapping=5,t.CylinderBufferGeometry=To,t.CylinderGeometry=To,t.Cylindrical=nc,t.DataTexture=nr,t.DataTexture2DArray=Er,t.DataTexture3D=Ar,t.DataTextureLoader=ol,t.DataUtils=Vc,t.DecrementStencilOp=7683,t.DecrementWrapStencilOp=34056,t.DefaultLoadingManager=Ks,t.DepthFormat=A,t.DepthStencilFormat=L,t.DepthTexture=Mo,t.DirectionalLight=ql,t.DirectionalLightHelper=Ec,t.DiscreteInterpolant=Hs,t.DodecahedronBufferGeometry=Lo,t.DodecahedronGeometry=Lo,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 rn(t,e).setUsage(nt)},t.DynamicCopyUsage=35050,t.DynamicDrawUsage=nt,t.DynamicReadUsage=35049,t.EdgesGeometry=Io,t.EdgesHelper=function(t,e){return console.warn("THREE.EdgesHelper has been removed. Use THREE.EdgesGeometry instead."),new co(new Io(t.geometry),new eo({color:void 0!==e?e:16777215}))},t.EllipseCurve=ul,t.EqualDepth=4,t.EqualStencilFunc=514,t.EquirectangularReflectionMapping=o,t.EquirectangularRefractionMapping=s,t.Euler=fe,t.EventDispatcher=ht,t.ExtrudeBufferGeometry=ls,t.ExtrudeGeometry=ls,t.FaceColors=1,t.FileLoader=el,t.FlatShading=1,t.Float16BufferAttribute=dn,t.Float32Attribute=function(t,e){return console.warn("THREE.Float32Attribute has been removed. Use new THREE.Float32BufferAttribute() instead."),new pn(t,e)},t.Float32BufferAttribute=pn,t.Float64Attribute=function(t,e){return console.warn("THREE.Float64Attribute has been removed. Use new THREE.Float64BufferAttribute() instead."),new fn(t,e)},t.Float64BufferAttribute=fn,t.FloatType=w,t.Fog=fa,t.FogExp2=pa,t.Font=lu,t.FontLoader=hu,t.FrontSide=0,t.Frustum=ar,t.GLBufferAttribute=Qu,t.GLSL1="100",t.GLSL3=rt,t.GammaEncoding=Z,t.GreaterDepth=6,t.GreaterEqualDepth=5,t.GreaterEqualStencilFunc=518,t.GreaterStencilFunc=516,t.GridHelper=bc,t.Group=sa,t.HalfFloatType=M,t.HemisphereLight=Dl,t.HemisphereLightHelper=_c,t.HemisphereLightProbe=fu,t.IcosahedronBufferGeometry=cs,t.IcosahedronGeometry=cs,t.ImageBitmapLoader=ou,t.ImageLoader=il,t.ImageUtils=xt,t.ImmediateRenderObject=lc,t.IncrementStencilOp=7682,t.IncrementWrapStencilOp=34055,t.InstancedBufferAttribute=tu,t.InstancedBufferGeometry=$l,t.InstancedInterleavedBuffer=Ju,t.InstancedMesh=to,t.Int16Attribute=function(t,e){return console.warn("THREE.Int16Attribute has been removed. Use new THREE.Int16BufferAttribute() instead."),new ln(t,e)},t.Int16BufferAttribute=ln,t.Int32Attribute=function(t,e){return console.warn("THREE.Int32Attribute has been removed. Use new THREE.Int32BufferAttribute() instead."),new cn(t,e)},t.Int32BufferAttribute=cn,t.Int8Attribute=function(t,e){return console.warn("THREE.Int8Attribute has been removed. Use new THREE.Int8BufferAttribute() instead."),new an(t,e)},t.Int8BufferAttribute=an,t.IntType=1013,t.InterleavedBuffer=va,t.InterleavedBufferAttribute=ya,t.Interpolant=Os,t.InterpolateDiscrete=H,t.InterpolateLinear=G,t.InterpolateSmooth=U,t.InvertStencilOp=5386,t.JSONLoader=function(){console.error("THREE.JSONLoader has been removed.")},t.KeepStencilOp=tt,t.KeyframeTrack=Gs,t.LOD=za,t.LatheBufferGeometry=hs,t.LatheGeometry=hs,t.Layers=me,t.LensFlare=function(){console.error("THREE.LensFlare has been moved to /examples/jsm/objects/Lensflare.js")},t.LessDepth=2,t.LessEqualDepth=3,t.LessEqualStencilFunc=515,t.LessStencilFunc=513,t.Light=Pl,t.LightProbe=Jl,t.Line=so,t.Line3=sc,t.LineBasicMaterial=eo,t.LineCurve=wl,t.LineCurve3=Ml,t.LineDashedMaterial=Is,t.LineLoop=ho,t.LinePieces=1,t.LineSegments=co,t.LineStrip=0,t.LinearEncoding=X,t.LinearFilter=v,t.LinearInterpolant=Fs,t.LinearMipMapLinearFilter=1008,t.LinearMipMapNearestFilter=1007,t.LinearMipmapLinearFilter=y,t.LinearMipmapNearestFilter=g,t.LinearToneMapping=1,t.Loader=$s,t.LoaderUtils=Kl,t.LoadingManager=Qs,t.LogLuvEncoding=3003,t.LoopOnce=2200,t.LoopPingPong=2202,t.LoopRepeat=2201,t.LuminanceAlphaFormat=1025,t.LuminanceFormat=1024,t.MOUSE={LEFT:0,MIDDLE:1,RIGHT:2,ROTATE:0,DOLLY:1,PAN:2},t.Material=qe,t.MaterialLoader=Ql,t.Math=mt,t.MathUtils=mt,t.Matrix3=yt,t.Matrix4=ie,t.MaxEquation=104,t.Mesh=Vn,t.MeshBasicMaterial=tn,t.MeshDepthMaterial=ta,t.MeshDistanceMaterial=ea,t.MeshFaceMaterial=function(t){return console.warn("THREE.MeshFaceMaterial has been removed. Use an Array instead."),t},t.MeshLambertMaterial=Ps,t.MeshMatcapMaterial=Ds,t.MeshNormalMaterial=Cs,t.MeshPhongMaterial=Ls,t.MeshPhysicalMaterial=As,t.MeshStandardMaterial=Es,t.MeshToonMaterial=Rs,t.MinEquation=103,t.MirroredRepeatWrapping=d,t.MixOperation=1,t.MultiMaterial=function(t){return void 0===t&&(t=[]),console.warn("THREE.MultiMaterial has been removed. Use an Array instead."),t.isMultiMaterial=!0,t.materials=t,t.clone=function(){return t.slice()},t},t.MultiplyBlending=4,t.MultiplyOperation=0,t.NearestFilter=p,t.NearestMipMapLinearFilter=1005,t.NearestMipMapNearestFilter=1004,t.NearestMipmapLinearFilter=m,t.NearestMipmapNearestFilter=f,t.NeverDepth=0,t.NeverStencilFunc=512,t.NoBlending=0,t.NoColors=0,t.NoToneMapping=0,t.NormalAnimationBlendMode=j,t.NormalBlending=1,t.NotEqualDepth=7,t.NotEqualStencilFunc=517,t.NumberKeyframeTrack=Vs,t.Object3D=Re,t.ObjectLoader=nu,t.ObjectSpaceNormalMap=1,t.OctahedronBufferGeometry=ds,t.OctahedronGeometry=ds,t.OneFactor=201,t.OneMinusDstAlphaFactor=207,t.OneMinusDstColorFactor=209,t.OneMinusSrcAlphaFactor=205,t.OneMinusSrcColorFactor=203,t.OrthographicCamera=Wl,t.PCFShadowMap=1,t.PCFSoftShadowMap=2,t.PMREMGenerator=lh,t.ParametricBufferGeometry=ps,t.ParametricGeometry=ps,t.Particle=function(t){return console.warn("THREE.Particle has been renamed to THREE.Sprite."),new Ia(t)},t.ParticleBasicMaterial=function(t){return console.warn("THREE.ParticleBasicMaterial has been renamed to THREE.PointsMaterial."),new po(t)},t.ParticleSystem=function(t,e){return console.warn("THREE.ParticleSystem has been renamed to THREE.Points."),new yo(t,e)},t.ParticleSystemMaterial=function(t){return console.warn("THREE.ParticleSystemMaterial has been renamed to THREE.PointsMaterial."),new po(t)},t.Path=Rl,t.PerspectiveCamera=Qn,t.Plane=Ie,t.PlaneBufferGeometry=lr,t.PlaneGeometry=lr,t.PlaneHelper=zc,t.PointCloud=function(t,e){return console.warn("THREE.PointCloud has been renamed to THREE.Points."),new yo(t,e)},t.PointCloudMaterial=function(t){return console.warn("THREE.PointCloudMaterial has been renamed to THREE.PointsMaterial."),new po(t)},t.PointLight=Vl,t.PointLightHelper=vc,t.Points=yo,t.PointsMaterial=po,t.PolarGridHelper=wc,t.PolyhedronBufferGeometry=Ao,t.PolyhedronGeometry=Ao,t.PositionalAudio=Pu,t.PropertyBinding=ju,t.PropertyMixer=Iu,t.QuadraticBezierCurve=Sl,t.QuadraticBezierCurve3=Tl,t.Quaternion=Et,t.QuaternionKeyframeTrack=js,t.QuaternionLinearInterpolant=Ws,t.REVISION=e,t.RGBADepthPacking=3201,t.RGBAFormat=E,t.RGBAIntegerFormat=1033,t.RGBA_ASTC_10x10_Format=37819,t.RGBA_ASTC_10x5_Format=37816,t.RGBA_ASTC_10x6_Format=37817,t.RGBA_ASTC_10x8_Format=37818,t.RGBA_ASTC_12x10_Format=37820,t.RGBA_ASTC_12x12_Format=37821,t.RGBA_ASTC_4x4_Format=37808,t.RGBA_ASTC_5x4_Format=37809,t.RGBA_ASTC_5x5_Format=37810,t.RGBA_ASTC_6x5_Format=37811,t.RGBA_ASTC_6x6_Format=37812,t.RGBA_ASTC_8x5_Format=37813,t.RGBA_ASTC_8x6_Format=37814,t.RGBA_ASTC_8x8_Format=37815,t.RGBA_BPTC_Format=36492,t.RGBA_ETC2_EAC_Format=F,t.RGBA_PVRTC_2BPPV1_Format=O,t.RGBA_PVRTC_4BPPV1_Format=B,t.RGBA_S3TC_DXT1_Format=C,t.RGBA_S3TC_DXT3_Format=P,t.RGBA_S3TC_DXT5_Format=D,t.RGBDEncoding=$,t.RGBEEncoding=J,t.RGBEFormat=1023,t.RGBFormat=T,t.RGBIntegerFormat=1032,t.RGBM16Encoding=K,t.RGBM7Encoding=Q,t.RGB_ETC1_Format=36196,t.RGB_ETC2_Format=z,t.RGB_PVRTC_2BPPV1_Format=N,t.RGB_PVRTC_4BPPV1_Format=I,t.RGB_S3TC_DXT1_Format=R,t.RGFormat=1030,t.RGIntegerFormat=1031,t.RawShaderMaterial=Ts,t.Ray=re,t.Raycaster=Ku,t.RectAreaLight=Yl,t.RedFormat=1028,t.RedIntegerFormat=1029,t.ReinhardToneMapping=2,t.RepeatWrapping=c,t.ReplaceStencilOp=7681,t.ReverseSubtractEquation=102,t.RingBufferGeometry=fs,t.RingGeometry=fs,t.SRGB8_ALPHA8_ASTC_10x10_Format=37851,t.SRGB8_ALPHA8_ASTC_10x5_Format=37848,t.SRGB8_ALPHA8_ASTC_10x6_Format=37849,t.SRGB8_ALPHA8_ASTC_10x8_Format=37850,t.SRGB8_ALPHA8_ASTC_12x10_Format=37852,t.SRGB8_ALPHA8_ASTC_12x12_Format=37853,t.SRGB8_ALPHA8_ASTC_4x4_Format=37840,t.SRGB8_ALPHA8_ASTC_5x4_Format=37841,t.SRGB8_ALPHA8_ASTC_5x5_Format=37842,t.SRGB8_ALPHA8_ASTC_6x5_Format=37843,t.SRGB8_ALPHA8_ASTC_6x6_Format=37844,t.SRGB8_ALPHA8_ASTC_8x5_Format=37845,t.SRGB8_ALPHA8_ASTC_8x6_Format=37846,t.SRGB8_ALPHA8_ASTC_8x8_Format=37847,t.Scene=ma,t.SceneUtils=mh,t.ShaderChunk=ur,t.ShaderLib=hr,t.ShaderMaterial=Zn,t.ShadowMaterial=Ss,t.Shape=Cl,t.ShapeBufferGeometry=ms,t.ShapeGeometry=ms,t.ShapePath=su,t.ShapeUtils=as,t.ShortType=1011,t.Skeleton=Xa,t.SkeletonHelper=fc,t.SkinnedMesh=Va,t.SmoothShading=2,t.Sphere=Zt,t.SphereBufferGeometry=vs,t.SphereGeometry=vs,t.Spherical=ec,t.SphericalHarmonics3=Zl,t.SplineCurve=El,t.SpotLight=Fl,t.SpotLightHelper=cc,t.Sprite=Ia,t.SpriteMaterial=_a,t.SrcAlphaFactor=204,t.SrcAlphaSaturateFactor=210,t.SrcColorFactor=202,t.StaticCopyUsage=35046,t.StaticDrawUsage=et,t.StaticReadUsage=35045,t.StereoCamera=yu,t.StreamCopyUsage=35042,t.StreamDrawUsage=35040,t.StreamReadUsage=35041,t.StringKeyframeTrack=qs,t.SubtractEquation=101,t.SubtractiveBlending=3,t.TOUCH={ROTATE:0,PAN:1,DOLLY_PAN:2,DOLLY_ROTATE:3},t.TangentSpaceNormalMap=0,t.TetrahedronBufferGeometry=gs,t.TetrahedronGeometry=gs,t.TextBufferGeometry=ys,t.TextGeometry=ys,t.Texture=bt,t.TextureLoader=sl,t.TorusBufferGeometry=xs,t.TorusGeometry=xs,t.TorusKnotBufferGeometry=_s,t.TorusKnotGeometry=_s,t.Triangle=We,t.TriangleFanDrawMode=2,t.TriangleStripDrawMode=1,t.TrianglesDrawMode=0,t.TubeBufferGeometry=bs,t.TubeGeometry=bs,t.UVMapping=r,t.Uint16Attribute=function(t,e){return console.warn("THREE.Uint16Attribute has been removed. Use new THREE.Uint16BufferAttribute() instead."),new un(t,e)},t.Uint16BufferAttribute=un,t.Uint32Attribute=function(t,e){return console.warn("THREE.Uint32Attribute has been removed. Use new THREE.Uint32BufferAttribute() instead."),new hn(t,e)},t.Uint32BufferAttribute=hn,t.Uint8Attribute=function(t,e){return console.warn("THREE.Uint8Attribute has been removed. Use new THREE.Uint8BufferAttribute() instead."),new on(t,e)},t.Uint8BufferAttribute=on,t.Uint8ClampedAttribute=function(t,e){return console.warn("THREE.Uint8ClampedAttribute has been removed. Use new THREE.Uint8ClampedBufferAttribute() instead."),new sn(t,e)},t.Uint8ClampedBufferAttribute=sn,t.Uniform=Zu,t.UniformsLib=cr,t.UniformsUtils=Yn,t.UnsignedByteType=x,t.UnsignedInt248Type=S,t.UnsignedIntType=b,t.UnsignedShort4444Type=1017,t.UnsignedShort5551Type=1018,t.UnsignedShort565Type=1019,t.UnsignedShortType=_,t.VSMShadowMap=3,t.Vector2=vt,t.Vector3=At,t.Vector4=Mt,t.VectorKeyframeTrack=Xs,t.Vertex=function(t,e,n){return console.warn("THREE.Vertex has been removed. Use THREE.Vector3 instead."),new At(t,e,n)},t.VertexColors=2,t.VideoTexture=_o,t.WebGL1Renderer=da,t.WebGLCubeRenderTarget=er,t.WebGLMultisampleRenderTarget=Tt,t.WebGLRenderTarget=St,t.WebGLRenderTargetCube=function(t,e,n){return console.warn("THREE.WebGLRenderTargetCube( width, height, options ) is now WebGLCubeRenderTarget( size, options )."),new er(t,n)},t.WebGLRenderer=ha,t.WebGLUtils=aa,t.WireframeGeometry=ws,t.WireframeHelper=function(t,e){return console.warn("THREE.WireframeHelper has been removed. Use THREE.WireframeGeometry instead."),new co(new ws(t.geometry),new eo({color:void 0!==e?e:16777215}))},t.WrapAroundEnding=W,t.XHRLoader=function(t){return console.warn("THREE.XHRLoader has been renamed to THREE.FileLoader."),new el(t)},t.ZeroCurvatureEnding=k,t.ZeroFactor=200,t.ZeroSlopeEnding=V,t.ZeroStencilOp=0,t.sRGBEncoding=Y,Object.defineProperty(t,"__esModule",{value:!0})})); diff --git a/build/three.module.js b/build/three.module.js index 19c3c378501b8f..810ce17bb999bb 100644 --- a/build/three.module.js +++ b/build/three.module.js @@ -3415,13 +3415,13 @@ class Vector3 { } - return this.applyQuaternion( _quaternion$4.setFromEuler( euler ) ); + return this.applyQuaternion( _quaternion.setFromEuler( euler ) ); } applyAxisAngle( axis, angle ) { - return this.applyQuaternion( _quaternion$4.setFromAxisAngle( axis, angle ) ); + return this.applyQuaternion( _quaternion.setFromAxisAngle( axis, angle ) ); } @@ -3723,9 +3723,9 @@ class Vector3 { projectOnPlane( planeNormal ) { - _vector$c.copy( this ).projectOnVector( planeNormal ); + _vector.copy( this ).projectOnVector( planeNormal ); - return this.sub( _vector$c ); + return this.sub( _vector ); } @@ -3734,7 +3734,7 @@ class Vector3 { // 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 ) ) ); + return this.sub( _vector.copy( normal ).multiplyScalar( 2 * this.dot( normal ) ) ); } @@ -3900,8 +3900,8 @@ class Vector3 { Vector3.prototype.isVector3 = true; -const _vector$c = /*@__PURE__*/ new Vector3(); -const _quaternion$4 = /*@__PURE__*/ new Quaternion(); +const _vector = /*@__PURE__*/ new Vector3(); +const _quaternion = /*@__PURE__*/ new Quaternion(); class Box3 { @@ -4003,7 +4003,7 @@ class Box3 { setFromCenterAndSize( center, size ) { - const halfSize = _vector$b.copy( size ).multiplyScalar( 0.5 ); + const halfSize = _vector$1.copy( size ).multiplyScalar( 0.5 ); this.min.copy( center ).sub( halfSize ); this.max.copy( center ).add( halfSize ); @@ -4112,20 +4112,37 @@ class Box3 { object.updateWorldMatrix( false, false ); - const geometry = object.geometry; - - if ( geometry !== undefined ) { + if ( object.boundingBox !== undefined ) { - if ( geometry.boundingBox === null ) { + if ( object.boundingBox === null ) { - geometry.computeBoundingBox(); + object.computeBoundingBox(); } - _box$3.copy( geometry.boundingBox ); - _box$3.applyMatrix4( object.matrixWorld ); + _box.copy( object.boundingBox ); + _box.applyMatrix4( object.matrixWorld ); + + this.union( _box ); + + } else { + + const geometry = object.geometry; + + if ( geometry !== undefined ) { + + if ( geometry.boundingBox === null ) { + + geometry.computeBoundingBox(); - this.union( _box$3 ); + } + + _box.copy( geometry.boundingBox ); + _box.applyMatrix4( object.matrixWorld ); + + this.union( _box ); + + } } @@ -4189,10 +4206,10 @@ class Box3 { intersectsSphere( sphere ) { // Find the point on the AABB closest to the sphere center. - this.clampPoint( sphere.center, _vector$b ); + this.clampPoint( sphere.center, _vector$1 ); // If that point is inside the sphere, the AABB and sphere intersect. - return _vector$b.distanceToSquared( sphere.center ) <= ( sphere.radius * sphere.radius ); + return _vector$1.distanceToSquared( sphere.center ) <= ( sphere.radius * sphere.radius ); } @@ -4256,14 +4273,14 @@ class Box3 { _extents.subVectors( this.max, _center ); // translate triangle to aabb origin - _v0$2.subVectors( triangle.a, _center ); - _v1$6.subVectors( triangle.b, _center ); - _v2$3.subVectors( triangle.c, _center ); + _v0.subVectors( triangle.a, _center ); + _v1.subVectors( triangle.b, _center ); + _v2.subVectors( triangle.c, _center ); // compute edge vectors for triangle - _f0.subVectors( _v1$6, _v0$2 ); - _f1.subVectors( _v2$3, _v1$6 ); - _f2.subVectors( _v0$2, _v2$3 ); + _f0.subVectors( _v1, _v0 ); + _f1.subVectors( _v2, _v1 ); + _f2.subVectors( _v0, _v2 ); // 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 @@ -4273,7 +4290,7 @@ class Box3 { _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$6, _v2$3, _extents ) ) { + if ( ! satForAxes( axes, _v0, _v1, _v2, _extents ) ) { return false; @@ -4281,7 +4298,7 @@ class Box3 { // test 3 face normals from the aabb axes = [ 1, 0, 0, 0, 1, 0, 0, 0, 1 ]; - if ( ! satForAxes( axes, _v0$2, _v1$6, _v2$3, _extents ) ) { + if ( ! satForAxes( axes, _v0, _v1, _v2, _extents ) ) { return false; @@ -4292,7 +4309,7 @@ class Box3 { _triangleNormal.crossVectors( _f0, _f1 ); axes = [ _triangleNormal.x, _triangleNormal.y, _triangleNormal.z ]; - return satForAxes( axes, _v0$2, _v1$6, _v2$3, _extents ); + return satForAxes( axes, _v0, _v1, _v2, _extents ); } @@ -4311,7 +4328,7 @@ class Box3 { distanceToPoint( point ) { - const clampedPoint = _vector$b.copy( point ).clamp( this.min, this.max ); + const clampedPoint = _vector$1.copy( point ).clamp( this.min, this.max ); return clampedPoint.sub( point ).length(); @@ -4328,7 +4345,7 @@ class Box3 { this.getCenter( target.center ); - target.radius = this.getSize( _vector$b ).length() * 0.5; + target.radius = this.getSize( _vector$1 ).length() * 0.5; return target; @@ -4406,15 +4423,15 @@ const _points = [ /*@__PURE__*/ new Vector3() ]; -const _vector$b = /*@__PURE__*/ new Vector3(); +const _vector$1 = /*@__PURE__*/ new Vector3(); -const _box$3 = /*@__PURE__*/ new Box3(); +const _box = /*@__PURE__*/ new Box3(); // triangle centered vertices -const _v0$2 = /*@__PURE__*/ new Vector3(); -const _v1$6 = /*@__PURE__*/ new Vector3(); -const _v2$3 = /*@__PURE__*/ new Vector3(); +const _v0 = /*@__PURE__*/ new Vector3(); +const _v1 = /*@__PURE__*/ new Vector3(); +const _v2 = /*@__PURE__*/ new Vector3(); // triangle edge vectors @@ -4453,7 +4470,10 @@ function satForAxes( axes, v0, v1, v2, extents ) { } -const _box$2 = /*@__PURE__*/ new Box3(); +const _box$1 = /*@__PURE__*/ new Box3(); +const _v1$1 = /*@__PURE__*/ new Vector3(); +const _toFarthestPoint = /*@__PURE__*/ new Vector3(); +const _toPoint = /*@__PURE__*/ new Vector3(); class Sphere { @@ -4483,7 +4503,7 @@ class Sphere { } else { - _box$2.setFromPoints( points ).getCenter( center ); + _box$1.setFromPoints( points ).getCenter( center ); } @@ -4622,6 +4642,49 @@ class Sphere { } + expandByPoint( point ) { + + // from https://github.com/juj/MathGeoLib/blob/2940b99b99cfe575dd45103ef20f4019dee15b54/src/Geometry/Sphere.cpp#L649-L671 + + _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, + // 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. + + _toFarthestPoint.subVectors( sphere.center, this.center ).normalize().multiplyScalar( sphere.radius ); + + this.expandByPoint( _v1$1.copy( sphere.center ).add( _toFarthestPoint ) ); + this.expandByPoint( _v1$1.copy( sphere.center ).sub( _toFarthestPoint ) ); + + return this; + + } + equals( sphere ) { return sphere.center.equals( this.center ) && ( sphere.radius === this.radius ); @@ -4636,14 +4699,14 @@ class Sphere { } -const _vector$a = /*@__PURE__*/ new Vector3(); +const _vector$2 = /*@__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(); +const _normal = /*@__PURE__*/ new Vector3(); class Ray { @@ -4695,7 +4758,7 @@ class Ray { recast( t ) { - this.origin.copy( this.at( t, _vector$a ) ); + this.origin.copy( this.at( t, _vector$2 ) ); return this; @@ -4732,7 +4795,7 @@ class Ray { distanceSqToPoint( point ) { - const directionDistance = _vector$a.subVectors( point, this.origin ).dot( this.direction ); + const directionDistance = _vector$2.subVectors( point, this.origin ).dot( this.direction ); // point behind the ray @@ -4742,9 +4805,9 @@ class Ray { } - _vector$a.copy( this.direction ).multiplyScalar( directionDistance ).add( this.origin ); + _vector$2.copy( this.direction ).multiplyScalar( directionDistance ).add( this.origin ); - return _vector$a.distanceToSquared( point ); + return _vector$2.distanceToSquared( point ); } @@ -4869,9 +4932,9 @@ class Ray { 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; + _vector$2.subVectors( sphere.center, this.origin ); + const tca = _vector$2.dot( this.direction ); + const d2 = _vector$2.dot( _vector$2 ) - tca * tca; const radius2 = sphere.radius * sphere.radius; if ( d2 > radius2 ) return null; @@ -5041,7 +5104,7 @@ class Ray { intersectsBox( box ) { - return this.intersectBox( box, _vector$a ) !== null; + return this.intersectBox( box, _vector$2 ) !== null; } @@ -5053,14 +5116,14 @@ class Ray { _edge1.subVectors( b, a ); _edge2.subVectors( c, a ); - _normal$1.crossVectors( _edge1, _edge2 ); + _normal.crossVectors( _edge1, _edge2 ); // 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 DdN = this.direction.dot( _normal ); let sign; if ( DdN > 0 ) { @@ -5106,7 +5169,7 @@ class Ray { } // Line intersects triangle, check if ray does. - const QdN = - sign * _diff.dot( _normal$1 ); + const QdN = - sign * _diff.dot( _normal ); // t < 0, no intersection if ( QdN < 0 ) { @@ -5271,9 +5334,9 @@ class Matrix4 { 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(); + const scaleX = 1 / _v1$2.setFromMatrixColumn( m, 0 ).length(); + const scaleY = 1 / _v1$2.setFromMatrixColumn( m, 1 ).length(); + const scaleZ = 1 / _v1$2.setFromMatrixColumn( m, 2 ).length(); te[ 0 ] = me[ 0 ] * scaleX; te[ 1 ] = me[ 1 ] * scaleX; @@ -5871,9 +5934,9 @@ class Matrix4 { 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(); + let sx = _v1$2.set( te[ 0 ], te[ 1 ], te[ 2 ] ).length(); + const sy = _v1$2.set( te[ 4 ], te[ 5 ], te[ 6 ] ).length(); + const sz = _v1$2.set( te[ 8 ], te[ 9 ], te[ 10 ] ).length(); // if determine is negative, we need to invert one scale const det = this.determinant(); @@ -5884,25 +5947,25 @@ class Matrix4 { position.z = te[ 14 ]; // scale the rotation part - _m1$2.copy( this ); + _m1.copy( this ); const invSX = 1 / sx; const invSY = 1 / sy; const invSZ = 1 / sz; - _m1$2.elements[ 0 ] *= invSX; - _m1$2.elements[ 1 ] *= invSX; - _m1$2.elements[ 2 ] *= invSX; + _m1.elements[ 0 ] *= invSX; + _m1.elements[ 1 ] *= invSX; + _m1.elements[ 2 ] *= invSX; - _m1$2.elements[ 4 ] *= invSY; - _m1$2.elements[ 5 ] *= invSY; - _m1$2.elements[ 6 ] *= invSY; + _m1.elements[ 4 ] *= invSY; + _m1.elements[ 5 ] *= invSY; + _m1.elements[ 6 ] *= invSY; - _m1$2.elements[ 8 ] *= invSZ; - _m1$2.elements[ 9 ] *= invSZ; - _m1$2.elements[ 10 ] *= invSZ; + _m1.elements[ 8 ] *= invSZ; + _m1.elements[ 9 ] *= invSZ; + _m1.elements[ 10 ] *= invSZ; - quaternion.setFromRotationMatrix( _m1$2 ); + quaternion.setFromRotationMatrix( _m1 ); scale.x = sx; scale.y = sy; @@ -6017,16 +6080,16 @@ class Matrix4 { Matrix4.prototype.isMatrix4 = true; -const _v1$5 = /*@__PURE__*/ new Vector3(); -const _m1$2 = /*@__PURE__*/ new Matrix4(); +const _v1$2 = /*@__PURE__*/ new Vector3(); +const _m1 = /*@__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(); +const _matrix = /*@__PURE__*/ new Matrix4(); +const _quaternion$1 = /*@__PURE__*/ new Quaternion(); class Euler { @@ -6262,9 +6325,9 @@ class Euler { setFromQuaternion( q, order, update ) { - _matrix$1.makeRotationFromQuaternion( q ); + _matrix.makeRotationFromQuaternion( q ); - return this.setFromRotationMatrix( _matrix$1, order, update ); + return this.setFromRotationMatrix( _matrix, order, update ); } @@ -6278,9 +6341,9 @@ class Euler { // WARNING: this discards revolution information -bhouston - _quaternion$3.setFromEuler( this ); + _quaternion$1.setFromEuler( this ); - return this.setFromQuaternion( _quaternion$3, newOrder ); + return this.setFromQuaternion( _quaternion$1, newOrder ); } @@ -6399,13 +6462,13 @@ class Layers { let _object3DId = 0; -const _v1$4 = new Vector3(); +const _v1$3 = new Vector3(); const _q1 = new Quaternion(); const _m1$1 = new Matrix4(); const _target = new Vector3(); -const _position$3 = new Vector3(); -const _scale$2 = new Vector3(); +const _position = new Vector3(); +const _scale = new Vector3(); const _quaternion$2 = new Quaternion(); const _xAxis = new Vector3( 1, 0, 0 ); @@ -6609,9 +6672,9 @@ Object3D.prototype = Object.assign( Object.create( EventDispatcher.prototype ), // translate object by distance along axis in object space // axis is assumed to be normalized - _v1$4.copy( axis ).applyQuaternion( this.quaternion ); + _v1$3.copy( axis ).applyQuaternion( this.quaternion ); - this.position.add( _v1$4.multiplyScalar( distance ) ); + this.position.add( _v1$3.multiplyScalar( distance ) ); return this; @@ -6665,15 +6728,15 @@ Object3D.prototype = Object.assign( Object.create( EventDispatcher.prototype ), this.updateWorldMatrix( true, false ); - _position$3.setFromMatrixPosition( this.matrixWorld ); + _position.setFromMatrixPosition( this.matrixWorld ); if ( this.isCamera || this.isLight ) { - _m1$1.lookAt( _position$3, _target, this.up ); + _m1$1.lookAt( _position, _target, this.up ); } else { - _m1$1.lookAt( _target, _position$3, this.up ); + _m1$1.lookAt( _target, _position, this.up ); } @@ -6866,7 +6929,7 @@ Object3D.prototype = Object.assign( Object.create( EventDispatcher.prototype ), this.updateWorldMatrix( true, false ); - this.matrixWorld.decompose( _position$3, target, _scale$2 ); + this.matrixWorld.decompose( _position, target, _scale ); return target; @@ -6883,7 +6946,7 @@ Object3D.prototype = Object.assign( Object.create( EventDispatcher.prototype ), this.updateWorldMatrix( true, false ); - this.matrixWorld.decompose( _position$3, _quaternion$2, target ); + this.matrixWorld.decompose( _position, _quaternion$2, target ); return target; @@ -7300,7 +7363,7 @@ Object3D.prototype = Object.assign( Object.create( EventDispatcher.prototype ), } ); const _vector1 = /*@__PURE__*/ new Vector3(); -const _vector2$1 = /*@__PURE__*/ new Vector3(); +const _vector2 = /*@__PURE__*/ new Vector3(); const _normalMatrix = /*@__PURE__*/ new Matrix3(); class Plane { @@ -7343,7 +7406,7 @@ class Plane { setFromCoplanarPoints( a, b, c ) { - const normal = _vector1.subVectors( c, b ).cross( _vector2$1.subVectors( a, b ) ).normalize(); + 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)? @@ -7522,9 +7585,9 @@ class Plane { Plane.prototype.isPlane = 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 _v1$4 = /*@__PURE__*/ new Vector3(); +const _v2$1 = /*@__PURE__*/ new Vector3(); +const _v3 = /*@__PURE__*/ new Vector3(); const _vab = /*@__PURE__*/ new Vector3(); const _vac = /*@__PURE__*/ new Vector3(); @@ -7572,14 +7635,14 @@ class Triangle { static getBarycoord( point, a, b, c, target ) { _v0$1.subVectors( c, a ); - _v1$3.subVectors( b, a ); - _v2$2.subVectors( point, a ); + _v1$4.subVectors( b, a ); + _v2$1.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 dot01 = _v0$1.dot( _v1$4 ); + const dot02 = _v0$1.dot( _v2$1 ); + const dot11 = _v1$4.dot( _v1$4 ); + const dot12 = _v1$4.dot( _v2$1 ); const denom = ( dot00 * dot11 - dot01 * dot01 ); @@ -7610,20 +7673,20 @@ class Triangle { static containsPoint( point, a, b, c ) { - this.getBarycoord( point, a, b, c, _v3$1 ); + this.getBarycoord( point, a, b, c, _v3 ); - return ( _v3$1.x >= 0 ) && ( _v3$1.y >= 0 ) && ( ( _v3$1.x + _v3$1.y ) <= 1 ); + return ( _v3.x >= 0 ) && ( _v3.y >= 0 ) && ( ( _v3.x + _v3.y ) <= 1 ); } static getUV( point, p1, p2, p3, uv1, uv2, uv3, target ) { - this.getBarycoord( point, p1, p2, p3, _v3$1 ); + this.getBarycoord( point, p1, p2, p3, _v3 ); target.set( 0, 0 ); - target.addScaledVector( uv1, _v3$1.x ); - target.addScaledVector( uv2, _v3$1.y ); - target.addScaledVector( uv3, _v3$1.z ); + target.addScaledVector( uv1, _v3.x ); + target.addScaledVector( uv2, _v3.y ); + target.addScaledVector( uv3, _v3.z ); return target; @@ -7632,10 +7695,10 @@ class Triangle { static isFrontFacing( a, b, c, direction ) { _v0$1.subVectors( c, b ); - _v1$3.subVectors( a, b ); + _v1$4.subVectors( a, b ); // strictly front facing - return ( _v0$1.cross( _v1$3 ).dot( direction ) < 0 ) ? true : false; + return ( _v0$1.cross( _v1$4 ).dot( direction ) < 0 ) ? true : false; } @@ -7678,9 +7741,9 @@ class Triangle { getArea() { _v0$1.subVectors( this.c, this.b ); - _v1$3.subVectors( this.a, this.b ); + _v1$4.subVectors( this.a, this.b ); - return _v0$1.cross( _v1$3 ).length() * 0.5; + return _v0$1.cross( _v1$4 ).length() * 0.5; } @@ -9014,8 +9077,8 @@ class MeshBasicMaterial extends Material { MeshBasicMaterial.prototype.isMeshBasicMaterial = true; -const _vector$9 = new Vector3(); -const _vector2 = new Vector2(); +const _vector$3 = new Vector3(); +const _vector2$1 = new Vector2(); function BufferAttribute( array, itemSize, normalized ) { @@ -9210,10 +9273,10 @@ Object.assign( BufferAttribute.prototype, { for ( let i = 0, l = this.count; i < l; i ++ ) { - _vector2.fromBufferAttribute( this, i ); - _vector2.applyMatrix3( m ); + _vector2$1.fromBufferAttribute( this, i ); + _vector2$1.applyMatrix3( m ); - this.setXY( i, _vector2.x, _vector2.y ); + this.setXY( i, _vector2$1.x, _vector2$1.y ); } @@ -9221,10 +9284,10 @@ Object.assign( BufferAttribute.prototype, { for ( let i = 0, l = this.count; i < l; i ++ ) { - _vector$9.fromBufferAttribute( this, i ); - _vector$9.applyMatrix3( m ); + _vector$3.fromBufferAttribute( this, i ); + _vector$3.applyMatrix3( m ); - this.setXYZ( i, _vector$9.x, _vector$9.y, _vector$9.z ); + this.setXYZ( i, _vector$3.x, _vector$3.y, _vector$3.z ); } @@ -9238,13 +9301,13 @@ Object.assign( BufferAttribute.prototype, { 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$3.x = this.getX( i ); + _vector$3.y = this.getY( i ); + _vector$3.z = this.getZ( i ); - _vector$9.applyMatrix4( m ); + _vector$3.applyMatrix4( m ); - this.setXYZ( i, _vector$9.x, _vector$9.y, _vector$9.z ); + this.setXYZ( i, _vector$3.x, _vector$3.y, _vector$3.z ); } @@ -9256,13 +9319,13 @@ Object.assign( BufferAttribute.prototype, { 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$3.x = this.getX( i ); + _vector$3.y = this.getY( i ); + _vector$3.z = this.getZ( i ); - _vector$9.applyNormalMatrix( m ); + _vector$3.applyNormalMatrix( m ); - this.setXYZ( i, _vector$9.x, _vector$9.y, _vector$9.z ); + this.setXYZ( i, _vector$3.x, _vector$3.y, _vector$3.z ); } @@ -9274,13 +9337,13 @@ Object.assign( BufferAttribute.prototype, { 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$3.x = this.getX( i ); + _vector$3.y = this.getY( i ); + _vector$3.z = this.getZ( i ); - _vector$9.transformDirection( m ); + _vector$3.transformDirection( m ); - this.setXYZ( i, _vector$9.x, _vector$9.y, _vector$9.z ); + this.setXYZ( i, _vector$3.x, _vector$3.y, _vector$3.z ); } @@ -9557,12 +9620,12 @@ function getTypedArray( type, buffer ) { let _id = 0; -const _m1 = new Matrix4(); +const _m1$2 = new Matrix4(); const _obj = new Object3D(); const _offset = new Vector3(); -const _box$1 = new Box3(); +const _box$2 = new Box3(); const _boxMorphTargets = new Box3(); -const _vector$8 = new Vector3(); +const _vector$4 = new Vector3(); function BufferGeometry() { @@ -9725,9 +9788,9 @@ BufferGeometry.prototype = Object.assign( Object.create( EventDispatcher.prototy // rotate geometry around world x-axis - _m1.makeRotationX( angle ); + _m1$2.makeRotationX( angle ); - this.applyMatrix4( _m1 ); + this.applyMatrix4( _m1$2 ); return this; @@ -9737,9 +9800,9 @@ BufferGeometry.prototype = Object.assign( Object.create( EventDispatcher.prototy // rotate geometry around world y-axis - _m1.makeRotationY( angle ); + _m1$2.makeRotationY( angle ); - this.applyMatrix4( _m1 ); + this.applyMatrix4( _m1$2 ); return this; @@ -9749,9 +9812,9 @@ BufferGeometry.prototype = Object.assign( Object.create( EventDispatcher.prototy // rotate geometry around world z-axis - _m1.makeRotationZ( angle ); + _m1$2.makeRotationZ( angle ); - this.applyMatrix4( _m1 ); + this.applyMatrix4( _m1$2 ); return this; @@ -9761,9 +9824,9 @@ BufferGeometry.prototype = Object.assign( Object.create( EventDispatcher.prototy // translate geometry - _m1.makeTranslation( x, y, z ); + _m1$2.makeTranslation( x, y, z ); - this.applyMatrix4( _m1 ); + this.applyMatrix4( _m1$2 ); return this; @@ -9773,9 +9836,9 @@ BufferGeometry.prototype = Object.assign( Object.create( EventDispatcher.prototy // scale geometry - _m1.makeScale( x, y, z ); + _m1$2.makeScale( x, y, z ); - this.applyMatrix4( _m1 ); + this.applyMatrix4( _m1$2 ); return this; @@ -9857,20 +9920,20 @@ BufferGeometry.prototype = Object.assign( Object.create( EventDispatcher.prototy for ( let i = 0, il = morphAttributesPosition.length; i < il; i ++ ) { const morphAttribute = morphAttributesPosition[ i ]; - _box$1.setFromBufferAttribute( morphAttribute ); + _box$2.setFromBufferAttribute( morphAttribute ); if ( this.morphTargetsRelative ) { - _vector$8.addVectors( this.boundingBox.min, _box$1.min ); - this.boundingBox.expandByPoint( _vector$8 ); + _vector$4.addVectors( this.boundingBox.min, _box$2.min ); + this.boundingBox.expandByPoint( _vector$4 ); - _vector$8.addVectors( this.boundingBox.max, _box$1.max ); - this.boundingBox.expandByPoint( _vector$8 ); + _vector$4.addVectors( this.boundingBox.max, _box$2.max ); + this.boundingBox.expandByPoint( _vector$4 ); } else { - this.boundingBox.expandByPoint( _box$1.min ); - this.boundingBox.expandByPoint( _box$1.max ); + this.boundingBox.expandByPoint( _box$2.min ); + this.boundingBox.expandByPoint( _box$2.max ); } @@ -9919,7 +9982,7 @@ BufferGeometry.prototype = Object.assign( Object.create( EventDispatcher.prototy const center = this.boundingSphere.center; - _box$1.setFromBufferAttribute( position ); + _box$2.setFromBufferAttribute( position ); // process morph attributes if present @@ -9932,16 +9995,16 @@ BufferGeometry.prototype = Object.assign( Object.create( EventDispatcher.prototy if ( this.morphTargetsRelative ) { - _vector$8.addVectors( _box$1.min, _boxMorphTargets.min ); - _box$1.expandByPoint( _vector$8 ); + _vector$4.addVectors( _box$2.min, _boxMorphTargets.min ); + _box$2.expandByPoint( _vector$4 ); - _vector$8.addVectors( _box$1.max, _boxMorphTargets.max ); - _box$1.expandByPoint( _vector$8 ); + _vector$4.addVectors( _box$2.max, _boxMorphTargets.max ); + _box$2.expandByPoint( _vector$4 ); } else { - _box$1.expandByPoint( _boxMorphTargets.min ); - _box$1.expandByPoint( _boxMorphTargets.max ); + _box$2.expandByPoint( _boxMorphTargets.min ); + _box$2.expandByPoint( _boxMorphTargets.max ); } @@ -9949,7 +10012,7 @@ BufferGeometry.prototype = Object.assign( Object.create( EventDispatcher.prototy } - _box$1.getCenter( center ); + _box$2.getCenter( center ); // second, try to find a boundingSphere with a radius smaller than the // boundingSphere of the boundingBox: sqrt(3) smaller in the best case @@ -9958,9 +10021,9 @@ BufferGeometry.prototype = Object.assign( Object.create( EventDispatcher.prototy for ( let i = 0, il = position.count; i < il; i ++ ) { - _vector$8.fromBufferAttribute( position, i ); + _vector$4.fromBufferAttribute( position, i ); - maxRadiusSq = Math.max( maxRadiusSq, center.distanceToSquared( _vector$8 ) ); + maxRadiusSq = Math.max( maxRadiusSq, center.distanceToSquared( _vector$4 ) ); } @@ -9975,16 +10038,16 @@ BufferGeometry.prototype = Object.assign( Object.create( EventDispatcher.prototy for ( let j = 0, jl = morphAttribute.count; j < jl; j ++ ) { - _vector$8.fromBufferAttribute( morphAttribute, j ); + _vector$4.fromBufferAttribute( morphAttribute, j ); if ( morphTargetsRelative ) { _offset.fromBufferAttribute( position, j ); - _vector$8.add( _offset ); + _vector$4.add( _offset ); } - maxRadiusSq = Math.max( maxRadiusSq, center.distanceToSquared( _vector$8 ) ); + maxRadiusSq = Math.max( maxRadiusSq, center.distanceToSquared( _vector$4 ) ); } @@ -10320,11 +10383,11 @@ BufferGeometry.prototype = Object.assign( Object.create( EventDispatcher.prototy for ( let i = 0, il = normals.count; i < il; i ++ ) { - _vector$8.fromBufferAttribute( normals, i ); + _vector$4.fromBufferAttribute( normals, i ); - _vector$8.normalize(); + _vector$4.normalize(); - normals.setXYZ( i, _vector$8.x, _vector$8.y, _vector$8.z ); + normals.setXYZ( i, _vector$4.x, _vector$4.y, _vector$4.z ); } @@ -10680,13 +10743,13 @@ BufferGeometry.prototype = Object.assign( Object.create( EventDispatcher.prototy } ); -const _inverseMatrix$2 = new Matrix4(); -const _ray$2 = new Ray(); -const _sphere$3 = new Sphere(); +const _inverseMatrix = new Matrix4(); +const _ray = new Ray(); +const _sphere = new Sphere(); -const _vA$1 = new Vector3(); -const _vB$1 = new Vector3(); -const _vC$1 = new Vector3(); +const _vA = new Vector3(); +const _vB = new Vector3(); +const _vC = new Vector3(); const _tempA = new Vector3(); const _tempB = new Vector3(); @@ -10696,9 +10759,9 @@ const _morphA = new Vector3(); const _morphB = new Vector3(); const _morphC = new Vector3(); -const _uvA$1 = new Vector2(); -const _uvB$1 = new Vector2(); -const _uvC$1 = new Vector2(); +const _uvA = new Vector2(); +const _uvB = new Vector2(); +const _uvC = new Vector2(); const _intersectionPoint = new Vector3(); const _intersectionPointWorld = new Vector3(); @@ -10802,21 +10865,21 @@ Mesh.prototype = Object.assign( Object.create( Object3D.prototype ), { if ( geometry.boundingSphere === null ) geometry.computeBoundingSphere(); - _sphere$3.copy( geometry.boundingSphere ); - _sphere$3.applyMatrix4( matrixWorld ); + _sphere.copy( geometry.boundingSphere ); + _sphere.applyMatrix4( matrixWorld ); - if ( raycaster.ray.intersectsSphere( _sphere$3 ) === false ) return; + if ( raycaster.ray.intersectsSphere( _sphere ) === false ) return; // - _inverseMatrix$2.copy( matrixWorld ).invert(); - _ray$2.copy( raycaster.ray ).applyMatrix4( _inverseMatrix$2 ); + _inverseMatrix.copy( matrixWorld ).invert(); + _ray.copy( raycaster.ray ).applyMatrix4( _inverseMatrix ); // Check boundingBox before continuing if ( geometry.boundingBox !== null ) { - if ( _ray$2.intersectsBox( geometry.boundingBox ) === false ) return; + if ( _ray.intersectsBox( geometry.boundingBox ) === false ) return; } @@ -10853,7 +10916,7 @@ Mesh.prototype = Object.assign( Object.create( Object3D.prototype ), { 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 ); + intersection = checkBufferGeometryIntersection( this, groupMaterial, raycaster, _ray, position, morphPosition, morphTargetsRelative, uv, uv2, a, b, c ); if ( intersection ) { @@ -10878,7 +10941,7 @@ Mesh.prototype = Object.assign( Object.create( Object3D.prototype ), { 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 ); + intersection = checkBufferGeometryIntersection( this, material, raycaster, _ray, position, morphPosition, morphTargetsRelative, uv, uv2, a, b, c ); if ( intersection ) { @@ -10911,7 +10974,7 @@ Mesh.prototype = Object.assign( Object.create( Object3D.prototype ), { const b = j + 1; const c = j + 2; - intersection = checkBufferGeometryIntersection( this, groupMaterial, raycaster, _ray$2, position, morphPosition, morphTargetsRelative, uv, uv2, a, b, c ); + intersection = checkBufferGeometryIntersection( this, groupMaterial, raycaster, _ray, position, morphPosition, morphTargetsRelative, uv, uv2, a, b, c ); if ( intersection ) { @@ -10936,7 +10999,7 @@ Mesh.prototype = Object.assign( Object.create( Object3D.prototype ), { const b = i + 1; const c = i + 2; - intersection = checkBufferGeometryIntersection( this, material, raycaster, _ray$2, position, morphPosition, morphTargetsRelative, uv, uv2, a, b, c ); + intersection = checkBufferGeometryIntersection( this, material, raycaster, _ray, position, morphPosition, morphTargetsRelative, uv, uv2, a, b, c ); if ( intersection ) { @@ -10994,9 +11057,9 @@ function checkIntersection( object, material, raycaster, ray, pA, pB, pC, point 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 ); + _vA.fromBufferAttribute( position, a ); + _vB.fromBufferAttribute( position, b ); + _vC.fromBufferAttribute( position, c ); const morphInfluences = object.morphTargetInfluences; @@ -11025,49 +11088,49 @@ function checkBufferGeometryIntersection( object, material, raycaster, ray, posi } else { - _morphA.addScaledVector( _tempA.sub( _vA$1 ), influence ); - _morphB.addScaledVector( _tempB.sub( _vB$1 ), influence ); - _morphC.addScaledVector( _tempC.sub( _vC$1 ), influence ); + _morphA.addScaledVector( _tempA.sub( _vA ), influence ); + _morphB.addScaledVector( _tempB.sub( _vB ), influence ); + _morphC.addScaledVector( _tempC.sub( _vC ), influence ); } } - _vA$1.add( _morphA ); - _vB$1.add( _morphB ); - _vC$1.add( _morphC ); + _vA.add( _morphA ); + _vB.add( _morphB ); + _vC.add( _morphC ); } if ( object.isSkinnedMesh && material.skinning ) { - object.boneTransform( a, _vA$1 ); - object.boneTransform( b, _vB$1 ); - object.boneTransform( c, _vC$1 ); + object.boneTransform( a, _vA ); + object.boneTransform( b, _vB ); + object.boneTransform( c, _vC ); } - const intersection = checkIntersection( object, material, raycaster, ray, _vA$1, _vB$1, _vC$1, _intersectionPoint ); + const intersection = checkIntersection( object, material, raycaster, ray, _vA, _vB, _vC, _intersectionPoint ); if ( intersection ) { if ( uv ) { - _uvA$1.fromBufferAttribute( uv, a ); - _uvB$1.fromBufferAttribute( uv, b ); - _uvC$1.fromBufferAttribute( uv, c ); + _uvA.fromBufferAttribute( uv, a ); + _uvB.fromBufferAttribute( uv, b ); + _uvC.fromBufferAttribute( uv, c ); - intersection.uv = Triangle.getUV( _intersectionPoint, _vA$1, _vB$1, _vC$1, _uvA$1, _uvB$1, _uvC$1, new Vector2() ); + intersection.uv = Triangle.getUV( _intersectionPoint, _vA, _vB, _vC, _uvA, _uvB, _uvC, new Vector2() ); } if ( uv2 ) { - _uvA$1.fromBufferAttribute( uv2, a ); - _uvB$1.fromBufferAttribute( uv2, b ); - _uvC$1.fromBufferAttribute( uv2, c ); + _uvA.fromBufferAttribute( uv2, a ); + _uvB.fromBufferAttribute( uv2, b ); + _uvC.fromBufferAttribute( uv2, c ); - intersection.uv2 = Triangle.getUV( _intersectionPoint, _vA$1, _vB$1, _vC$1, _uvA$1, _uvB$1, _uvC$1, new Vector2() ); + intersection.uv2 = Triangle.getUV( _intersectionPoint, _vA, _vB, _vC, _uvA, _uvB, _uvC, new Vector2() ); } @@ -11079,7 +11142,7 @@ function checkBufferGeometryIntersection( object, material, raycaster, ray, posi materialIndex: 0 }; - Triangle.getNormal( _vA$1, _vB$1, _vC$1, face.normal ); + Triangle.getNormal( _vA, _vB, _vC, face.normal ); intersection.face = face; @@ -12129,8 +12192,8 @@ class DataTexture extends Texture { DataTexture.prototype.isDataTexture = true; -const _sphere$2 = /*@__PURE__*/ new Sphere(); -const _vector$7 = /*@__PURE__*/ new Vector3(); +const _sphere$1 = /*@__PURE__*/ new Sphere(); +const _vector$5 = /*@__PURE__*/ new Vector3(); class Frustum { @@ -12191,23 +12254,33 @@ class Frustum { intersectsObject( object ) { - const geometry = object.geometry; + if ( object.boundingSphere !== undefined ) { - if ( geometry.boundingSphere === null ) geometry.computeBoundingSphere(); + if ( object.boundingSphere === null ) object.computeBoundingSphere(); + + _sphere$1.copy( object.boundingSphere ).applyMatrix4( object.matrixWorld ); - _sphere$2.copy( geometry.boundingSphere ).applyMatrix4( object.matrixWorld ); + } else { + + const geometry = object.geometry; - return this.intersectsSphere( _sphere$2 ); + if ( geometry.boundingSphere === null ) geometry.computeBoundingSphere(); + + _sphere$1.copy( geometry.boundingSphere ).applyMatrix4( object.matrixWorld ); + + } + + return this.intersectsSphere( _sphere$1 ); } intersectsSprite( sprite ) { - _sphere$2.center.set( 0, 0, 0 ); - _sphere$2.radius = 0.7071067811865476; - _sphere$2.applyMatrix4( sprite.matrixWorld ); + _sphere$1.center.set( 0, 0, 0 ); + _sphere$1.radius = 0.7071067811865476; + _sphere$1.applyMatrix4( sprite.matrixWorld ); - return this.intersectsSphere( _sphere$2 ); + return this.intersectsSphere( _sphere$1 ); } @@ -12243,11 +12316,11 @@ class Frustum { // 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; + _vector$5.x = plane.normal.x > 0 ? box.max.x : box.min.x; + _vector$5.y = plane.normal.y > 0 ? box.max.y : box.min.y; + _vector$5.z = plane.normal.z > 0 ? box.max.z : box.min.z; - if ( plane.distanceToPoint( _vector$7 ) < 0 ) { + if ( plane.distanceToPoint( _vector$5 ) < 0 ) { return false; @@ -25749,13 +25822,13 @@ 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 _vA$1 = /*@__PURE__*/ new Vector3(); +const _vB$1 = /*@__PURE__*/ new Vector3(); +const _vC$1 = /*@__PURE__*/ new Vector3(); -const _uvA = /*@__PURE__*/ new Vector2(); -const _uvB = /*@__PURE__*/ new Vector2(); -const _uvC = /*@__PURE__*/ new Vector2(); +const _uvA$1 = /*@__PURE__*/ new Vector2(); +const _uvB$1 = /*@__PURE__*/ new Vector2(); +const _uvC$1 = /*@__PURE__*/ new Vector2(); class Sprite extends Object3D { @@ -25824,24 +25897,24 @@ class Sprite extends Object3D { 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 ); + transformVertex( _vA$1.set( - 0.5, - 0.5, 0 ), _mvPosition, center, _worldScale, sin, cos ); + transformVertex( _vB$1.set( 0.5, - 0.5, 0 ), _mvPosition, center, _worldScale, sin, cos ); + transformVertex( _vC$1.set( 0.5, 0.5, 0 ), _mvPosition, center, _worldScale, sin, cos ); - _uvA.set( 0, 0 ); - _uvB.set( 1, 0 ); - _uvC.set( 1, 1 ); + _uvA$1.set( 0, 0 ); + _uvB$1.set( 1, 0 ); + _uvC$1.set( 1, 1 ); // check first triangle - let intersect = raycaster.ray.intersectTriangle( _vA, _vB, _vC, false, _intersectPoint ); + let intersect = raycaster.ray.intersectTriangle( _vA$1, _vB$1, _vC$1, 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 ); + transformVertex( _vB$1.set( - 0.5, 0.5, 0 ), _mvPosition, center, _worldScale, sin, cos ); + _uvB$1.set( 0, 1 ); - intersect = raycaster.ray.intersectTriangle( _vA, _vC, _vB, false, _intersectPoint ); + intersect = raycaster.ray.intersectTriangle( _vA$1, _vC$1, _vB$1, false, _intersectPoint ); if ( intersect === null ) { return; @@ -25858,7 +25931,7 @@ class Sprite extends Object3D { distance: distance, point: _intersectPoint.clone(), - uv: Triangle.getUV( _intersectPoint, _vA, _vB, _vC, _uvA, _uvB, _uvC, new Vector2() ), + uv: Triangle.getUV( _intersectPoint, _vA$1, _vB$1, _vC$1, _uvA$1, _uvB$1, _uvC$1, new Vector2() ), face: null, object: this @@ -25909,8 +25982,8 @@ function transformVertex( vertexPosition, mvPosition, center, scale, sin, cos ) } -const _v1$2 = /*@__PURE__*/ new Vector3(); -const _v2$1 = /*@__PURE__*/ new Vector3(); +const _v1$5 = /*@__PURE__*/ new Vector3(); +const _v2$2 = /*@__PURE__*/ new Vector3(); class LOD extends Object3D { @@ -26020,9 +26093,9 @@ class LOD extends Object3D { if ( levels.length > 0 ) { - _v1$2.setFromMatrixPosition( this.matrixWorld ); + _v1$5.setFromMatrixPosition( this.matrixWorld ); - const distance = raycaster.ray.origin.distanceTo( _v1$2 ); + const distance = raycaster.ray.origin.distanceTo( _v1$5 ); this.getObjectForDistance( distance ).raycast( raycaster, intersects ); @@ -26036,10 +26109,10 @@ class LOD extends Object3D { if ( levels.length > 1 ) { - _v1$2.setFromMatrixPosition( camera.matrixWorld ); - _v2$1.setFromMatrixPosition( this.matrixWorld ); + _v1$5.setFromMatrixPosition( camera.matrixWorld ); + _v2$2.setFromMatrixPosition( this.matrixWorld ); - const distance = _v1$2.distanceTo( _v2$1 ) / camera.zoom; + const distance = _v1$5.distanceTo( _v2$2 ) / camera.zoom; levels[ 0 ].object.visible = true; @@ -26104,8 +26177,8 @@ const _basePosition = new Vector3(); const _skinIndex = new Vector4(); const _skinWeight = new Vector4(); -const _vector$5 = new Vector3(); -const _matrix = new Matrix4(); +const _vector$7 = new Vector3(); +const _matrix$1 = new Matrix4(); function SkinnedMesh( geometry, material ) { @@ -26235,9 +26308,9 @@ SkinnedMesh.prototype = Object.assign( Object.create( Mesh.prototype ), { const boneIndex = _skinIndex.getComponent( i ); - _matrix.multiplyMatrices( skeleton.bones[ boneIndex ].matrixWorld, skeleton.boneInverses[ boneIndex ] ); + _matrix$1.multiplyMatrices( skeleton.bones[ boneIndex ].matrixWorld, skeleton.boneInverses[ boneIndex ] ); - target.addScaledVector( _vector$5.copy( _basePosition ).applyMatrix4( _matrix ), weight ); + target.addScaledVector( _vector$7.copy( _basePosition ).applyMatrix4( _matrix$1 ), weight ); } @@ -26514,7 +26587,9 @@ const _instanceWorldMatrix = new Matrix4(); const _instanceIntersects = []; +const _box3 = new Box3(); const _mesh = new Mesh(); +const _sphere$2 = new Sphere(); function InstancedMesh( geometry, material, count ) { @@ -26525,7 +26600,8 @@ function InstancedMesh( geometry, material, count ) { this.count = count; - this.frustumCulled = false; + this.boundingBox = null; + this.boundingSphere = null; } @@ -26535,6 +26611,72 @@ InstancedMesh.prototype = Object.assign( Object.create( Mesh.prototype ), { isInstancedMesh: true, + computeBoundingBox: function () { + + const geometry = this.geometry; + const count = this.count; + + if ( this.boundingBox === null ) { + + this.boundingBox = new Box3(); + + } + + if ( geometry.boundingBox === null ) { + + geometry.computeBoundingBox(); + + } + + this.boundingBox.makeEmpty(); + + for ( let i = 0; i < count; i ++ ) { + + this.getMatrixAt( i, _instanceLocalMatrix ); + + _box3.copy( geometry.boundingBox ).applyMatrix4( _instanceLocalMatrix ); + + this.boundingBox.union( _box3 ); + + } + + return this; + + }, + + computeBoundingSphere: function () { + + const geometry = this.geometry; + const count = this.count; + + if ( this.boundingSphere === null ) { + + this.boundingSphere = new Sphere(); + + } + + if ( geometry.boundingSphere === null ) { + + geometry.computeBoundingSphere(); + + } + + this.boundingSphere.makeEmpty(); + + for ( let i = 0; i < count; i ++ ) { + + this.getMatrixAt( i, _instanceLocalMatrix ); + + _sphere$2.copy( geometry.boundingSphere ).applyMatrix4( _instanceLocalMatrix ); + + this.boundingSphere.union( _sphere$2 ); + + } + + return this; + + }, + copy: function ( source ) { Mesh.prototype.copy.call( this, source ); @@ -26684,11 +26826,11 @@ class LineBasicMaterial extends Material { LineBasicMaterial.prototype.isLineBasicMaterial = true; -const _start$1 = new Vector3(); -const _end$1 = new Vector3(); +const _start = new Vector3(); +const _end = new Vector3(); const _inverseMatrix$1 = new Matrix4(); const _ray$1 = new Ray(); -const _sphere$1 = new Sphere(); +const _sphere$3 = new Sphere(); function Line( geometry = new BufferGeometry(), material = new LineBasicMaterial() ) { @@ -26735,11 +26877,11 @@ Line.prototype = Object.assign( Object.create( Object3D.prototype ), { for ( let i = 1, l = positionAttribute.count; i < l; i ++ ) { - _start$1.fromBufferAttribute( positionAttribute, i - 1 ); - _end$1.fromBufferAttribute( positionAttribute, i ); + _start.fromBufferAttribute( positionAttribute, i - 1 ); + _end.fromBufferAttribute( positionAttribute, i ); lineDistances[ i ] = lineDistances[ i - 1 ]; - lineDistances[ i ] += _start$1.distanceTo( _end$1 ); + lineDistances[ i ] += _start.distanceTo( _end ); } @@ -26772,11 +26914,11 @@ Line.prototype = Object.assign( Object.create( Object3D.prototype ), { if ( geometry.boundingSphere === null ) geometry.computeBoundingSphere(); - _sphere$1.copy( geometry.boundingSphere ); - _sphere$1.applyMatrix4( matrixWorld ); - _sphere$1.radius += threshold; + _sphere$3.copy( geometry.boundingSphere ); + _sphere$3.applyMatrix4( matrixWorld ); + _sphere$3.radius += threshold; - if ( raycaster.ray.intersectsSphere( _sphere$1 ) === false ) return; + if ( raycaster.ray.intersectsSphere( _sphere$3 ) === false ) return; // @@ -26928,8 +27070,8 @@ Line.prototype = Object.assign( Object.create( Object3D.prototype ), { } ); -const _start = new Vector3(); -const _end = new Vector3(); +const _start$1 = new Vector3(); +const _end$1 = new Vector3(); function LineSegments( geometry, material ) { @@ -26960,11 +27102,11 @@ LineSegments.prototype = Object.assign( Object.create( Line.prototype ), { for ( let i = 0, l = positionAttribute.count; i < l; i += 2 ) { - _start.fromBufferAttribute( positionAttribute, i ); - _end.fromBufferAttribute( positionAttribute, i + 1 ); + _start$1.fromBufferAttribute( positionAttribute, i ); + _end$1.fromBufferAttribute( positionAttribute, i + 1 ); lineDistances[ i ] = ( i === 0 ) ? 0 : lineDistances[ i - 1 ]; - lineDistances[ i + 1 ] = lineDistances[ i ] + _start.distanceTo( _end ); + lineDistances[ i + 1 ] = lineDistances[ i ] + _start$1.distanceTo( _end$1 ); } @@ -27062,10 +27204,10 @@ class PointsMaterial extends Material { PointsMaterial.prototype.isPointsMaterial = true; -const _inverseMatrix = new Matrix4(); -const _ray = new Ray(); -const _sphere = new Sphere(); -const _position$2 = new Vector3(); +const _inverseMatrix$2 = new Matrix4(); +const _ray$2 = new Ray(); +const _sphere$4 = new Sphere(); +const _position$1 = new Vector3(); function Points( geometry = new BufferGeometry(), material = new PointsMaterial() ) { @@ -27108,16 +27250,16 @@ Points.prototype = Object.assign( Object.create( Object3D.prototype ), { if ( geometry.boundingSphere === null ) geometry.computeBoundingSphere(); - _sphere.copy( geometry.boundingSphere ); - _sphere.applyMatrix4( matrixWorld ); - _sphere.radius += threshold; + _sphere$4.copy( geometry.boundingSphere ); + _sphere$4.applyMatrix4( matrixWorld ); + _sphere$4.radius += threshold; - if ( raycaster.ray.intersectsSphere( _sphere ) === false ) return; + if ( raycaster.ray.intersectsSphere( _sphere$4 ) === false ) return; // - _inverseMatrix.copy( matrixWorld ).invert(); - _ray.copy( raycaster.ray ).applyMatrix4( _inverseMatrix ); + _inverseMatrix$2.copy( matrixWorld ).invert(); + _ray$2.copy( raycaster.ray ).applyMatrix4( _inverseMatrix$2 ); const localThreshold = threshold / ( ( this.scale.x + this.scale.y + this.scale.z ) / 3 ); const localThresholdSq = localThreshold * localThreshold; @@ -27137,9 +27279,9 @@ Points.prototype = Object.assign( Object.create( Object3D.prototype ), { const a = index.getX( i ); - _position$2.fromBufferAttribute( positionAttribute, a ); + _position$1.fromBufferAttribute( positionAttribute, a ); - testPoint( _position$2, a, localThresholdSq, matrixWorld, raycaster, intersects, this ); + testPoint( _position$1, a, localThresholdSq, matrixWorld, raycaster, intersects, this ); } @@ -27150,9 +27292,9 @@ Points.prototype = Object.assign( Object.create( Object3D.prototype ), { for ( let i = start, l = end; i < l; i ++ ) { - _position$2.fromBufferAttribute( positionAttribute, i ); + _position$1.fromBufferAttribute( positionAttribute, i ); - testPoint( _position$2, i, localThresholdSq, matrixWorld, raycaster, intersects, this ); + testPoint( _position$1, i, localThresholdSq, matrixWorld, raycaster, intersects, this ); } @@ -27215,13 +27357,13 @@ Points.prototype = Object.assign( Object.create( Object3D.prototype ), { function testPoint( point, index, localThresholdSq, matrixWorld, raycaster, intersects, object ) { - const rayPointDistanceSq = _ray.distanceSqToPoint( point ); + const rayPointDistanceSq = _ray$2.distanceSqToPoint( point ); if ( rayPointDistanceSq < localThresholdSq ) { const intersectPoint = new Vector3(); - _ray.closestPointToPoint( point, intersectPoint ); + _ray$2.closestPointToPoint( point, intersectPoint ); intersectPoint.applyMatrix4( matrixWorld ); const distance = raycaster.ray.origin.distanceTo( intersectPoint ); @@ -28082,9 +28224,9 @@ class DodecahedronGeometry extends PolyhedronGeometry { } -const _v0 = new Vector3(); -const _v1$1 = new Vector3(); -const _normal = new Vector3(); +const _v0$2 = new Vector3(); +const _v1$6 = new Vector3(); +const _normal$1 = new Vector3(); const _triangle = new Triangle(); class EdgesGeometry extends BufferGeometry { @@ -28142,7 +28284,7 @@ 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$1 ); // 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 ) }`; @@ -28173,7 +28315,7 @@ class EdgesGeometry extends BufferGeometry { // 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. - if ( _normal.dot( edgeData[ reverseHash ].normal ) <= thresholdDot ) { + if ( _normal$1.dot( edgeData[ reverseHash ].normal ) <= thresholdDot ) { vertices.push( v0.x, v0.y, v0.z ); vertices.push( v1.x, v1.y, v1.z ); @@ -28189,7 +28331,7 @@ class EdgesGeometry extends BufferGeometry { index0: indexArr[ j ], index1: indexArr[ jNext ], - normal: _normal.clone(), + normal: _normal$1.clone(), }; @@ -28205,11 +28347,11 @@ class EdgesGeometry extends BufferGeometry { if ( edgeData[ key ] ) { const { index0, index1 } = edgeData[ key ]; - _v0.fromBufferAttribute( positionAttr, index0 ); - _v1$1.fromBufferAttribute( positionAttr, index1 ); + _v0$2.fromBufferAttribute( positionAttr, index0 ); + _v1$6.fromBufferAttribute( positionAttr, index1 ); - vertices.push( _v0.x, _v0.y, _v0.z ); - vertices.push( _v1$1.x, _v1$1.y, _v1$1.z ); + vertices.push( _v0$2.x, _v0$2.y, _v0$2.z ); + vertices.push( _v1$6.x, _v1$6.y, _v1$6.z ); } @@ -29787,7 +29929,7 @@ class ExtrudeGeometry extends BufferGeometry { const shapes = this.parameters.shapes; const options = this.parameters.options; - return toJSON$1( shapes, options, data ); + return toJSON( shapes, options, data ); } @@ -29851,7 +29993,7 @@ const WorldUVGenerator = { }; -function toJSON$1( shapes, options, data ) { +function toJSON( shapes, options, data ) { data.shapes = []; @@ -30442,13 +30584,13 @@ class ShapeGeometry extends BufferGeometry { const shapes = this.parameters.shapes; - return toJSON( shapes, data ); + return toJSON$1( shapes, data ); } } -function toJSON( shapes, data ) { +function toJSON$1( shapes, data ) { data.shapes = []; @@ -37163,9 +37305,9 @@ class HemisphereLight extends Light { HemisphereLight.prototype.isHemisphereLight = true; -const _projScreenMatrix$1 = /*@__PURE__*/ new Matrix4(); -const _lightPositionWorld$1 = /*@__PURE__*/ new Vector3(); -const _lookTarget$1 = /*@__PURE__*/ new Vector3(); +const _projScreenMatrix = /*@__PURE__*/ new Matrix4(); +const _lightPositionWorld = /*@__PURE__*/ new Vector3(); +const _lookTarget = /*@__PURE__*/ new Vector3(); class LightShadow { @@ -37216,15 +37358,15 @@ class LightShadow { const shadowCamera = this.camera; const shadowMatrix = this.matrix; - _lightPositionWorld$1.setFromMatrixPosition( light.matrixWorld ); - shadowCamera.position.copy( _lightPositionWorld$1 ); + _lightPositionWorld.setFromMatrixPosition( light.matrixWorld ); + shadowCamera.position.copy( _lightPositionWorld ); - _lookTarget$1.setFromMatrixPosition( light.target.matrixWorld ); - shadowCamera.lookAt( _lookTarget$1 ); + _lookTarget.setFromMatrixPosition( light.target.matrixWorld ); + shadowCamera.lookAt( _lookTarget ); shadowCamera.updateMatrixWorld(); - _projScreenMatrix$1.multiplyMatrices( shadowCamera.projectionMatrix, shadowCamera.matrixWorldInverse ); - this._frustum.setFromProjectionMatrix( _projScreenMatrix$1 ); + _projScreenMatrix.multiplyMatrices( shadowCamera.projectionMatrix, shadowCamera.matrixWorldInverse ); + this._frustum.setFromProjectionMatrix( _projScreenMatrix ); shadowMatrix.set( 0.5, 0.0, 0.0, 0.5, @@ -37381,9 +37523,9 @@ class SpotLight extends Light { SpotLight.prototype.isSpotLight = true; -const _projScreenMatrix = /*@__PURE__*/ new Matrix4(); -const _lightPositionWorld = /*@__PURE__*/ new Vector3(); -const _lookTarget = /*@__PURE__*/ new Vector3(); +const _projScreenMatrix$1 = /*@__PURE__*/ new Matrix4(); +const _lightPositionWorld$1 = /*@__PURE__*/ new Vector3(); +const _lookTarget$1 = /*@__PURE__*/ new Vector3(); class PointLightShadow extends LightShadow { @@ -37440,19 +37582,19 @@ class PointLightShadow extends LightShadow { const camera = this.camera; const shadowMatrix = this.matrix; - _lightPositionWorld.setFromMatrixPosition( light.matrixWorld ); - camera.position.copy( _lightPositionWorld ); + _lightPositionWorld$1.setFromMatrixPosition( light.matrixWorld ); + camera.position.copy( _lightPositionWorld$1 ); - _lookTarget.copy( camera.position ); - _lookTarget.add( this._cubeDirections[ viewportIndex ] ); + _lookTarget$1.copy( camera.position ); + _lookTarget$1.add( this._cubeDirections[ viewportIndex ] ); camera.up.copy( this._cubeUps[ viewportIndex ] ); - camera.lookAt( _lookTarget ); + camera.lookAt( _lookTarget$1 ); camera.updateMatrixWorld(); - shadowMatrix.makeTranslation( - _lightPositionWorld.x, - _lightPositionWorld.y, - _lightPositionWorld.z ); + shadowMatrix.makeTranslation( - _lightPositionWorld$1.x, - _lightPositionWorld$1.y, - _lightPositionWorld$1.z ); - _projScreenMatrix.multiplyMatrices( camera.projectionMatrix, camera.matrixWorldInverse ); - this._frustum.setFromProjectionMatrix( _projScreenMatrix ); + _projScreenMatrix$1.multiplyMatrices( camera.projectionMatrix, camera.matrixWorldInverse ); + this._frustum.setFromProjectionMatrix( _projScreenMatrix$1 ); } @@ -40632,10 +40774,10 @@ function now() { } -const _position$1 = /*@__PURE__*/ new Vector3(); -const _quaternion$1 = /*@__PURE__*/ new Quaternion(); +const _position$2 = /*@__PURE__*/ new Vector3(); +const _quaternion$3 = /*@__PURE__*/ new Quaternion(); const _scale$1 = /*@__PURE__*/ new Vector3(); -const _orientation$1 = /*@__PURE__*/ new Vector3(); +const _orientation = /*@__PURE__*/ new Vector3(); class AudioListener extends Object3D { @@ -40731,9 +40873,9 @@ class AudioListener extends Object3D { this.timeDelta = this._clock.getDelta(); - this.matrixWorld.decompose( _position$1, _quaternion$1, _scale$1 ); + this.matrixWorld.decompose( _position$2, _quaternion$3, _scale$1 ); - _orientation$1.set( 0, 0, - 1 ).applyQuaternion( _quaternion$1 ); + _orientation.set( 0, 0, - 1 ).applyQuaternion( _quaternion$3 ); if ( listener.positionX ) { @@ -40741,20 +40883,20 @@ class AudioListener extends Object3D { const endTime = this.context.currentTime + this.timeDelta; - listener.positionX.linearRampToValueAtTime( _position$1.x, endTime ); - listener.positionY.linearRampToValueAtTime( _position$1.y, endTime ); - listener.positionZ.linearRampToValueAtTime( _position$1.z, endTime ); - listener.forwardX.linearRampToValueAtTime( _orientation$1.x, endTime ); - listener.forwardY.linearRampToValueAtTime( _orientation$1.y, endTime ); - listener.forwardZ.linearRampToValueAtTime( _orientation$1.z, endTime ); + listener.positionX.linearRampToValueAtTime( _position$2.x, endTime ); + listener.positionY.linearRampToValueAtTime( _position$2.y, endTime ); + listener.positionZ.linearRampToValueAtTime( _position$2.z, endTime ); + listener.forwardX.linearRampToValueAtTime( _orientation.x, endTime ); + listener.forwardY.linearRampToValueAtTime( _orientation.y, endTime ); + listener.forwardZ.linearRampToValueAtTime( _orientation.z, endTime ); listener.upX.linearRampToValueAtTime( up.x, endTime ); listener.upY.linearRampToValueAtTime( up.y, endTime ); listener.upZ.linearRampToValueAtTime( up.z, endTime ); } else { - listener.setPosition( _position$1.x, _position$1.y, _position$1.z ); - listener.setOrientation( _orientation$1.x, _orientation$1.y, _orientation$1.z, up.x, up.y, up.z ); + listener.setPosition( _position$2.x, _position$2.y, _position$2.z ); + listener.setOrientation( _orientation.x, _orientation.y, _orientation.z, up.x, up.y, up.z ); } @@ -41150,10 +41292,10 @@ class Audio extends Object3D { } -const _position = /*@__PURE__*/ new Vector3(); -const _quaternion = /*@__PURE__*/ new Quaternion(); -const _scale = /*@__PURE__*/ new Vector3(); -const _orientation = /*@__PURE__*/ new Vector3(); +const _position$3 = /*@__PURE__*/ new Vector3(); +const _quaternion$4 = /*@__PURE__*/ new Quaternion(); +const _scale$2 = /*@__PURE__*/ new Vector3(); +const _orientation$1 = /*@__PURE__*/ new Vector3(); class PositionalAudio extends Audio { @@ -41245,9 +41387,9 @@ class PositionalAudio extends Audio { if ( this.hasPlaybackControl === true && this.isPlaying === false ) return; - this.matrixWorld.decompose( _position, _quaternion, _scale ); + this.matrixWorld.decompose( _position$3, _quaternion$4, _scale$2 ); - _orientation.set( 0, 0, 1 ).applyQuaternion( _quaternion ); + _orientation$1.set( 0, 0, 1 ).applyQuaternion( _quaternion$4 ); const panner = this.panner; @@ -41257,17 +41399,17 @@ class PositionalAudio extends Audio { const endTime = this.context.currentTime + this.listener.timeDelta; - panner.positionX.linearRampToValueAtTime( _position.x, endTime ); - panner.positionY.linearRampToValueAtTime( _position.y, endTime ); - panner.positionZ.linearRampToValueAtTime( _position.z, endTime ); - panner.orientationX.linearRampToValueAtTime( _orientation.x, endTime ); - panner.orientationY.linearRampToValueAtTime( _orientation.y, endTime ); - panner.orientationZ.linearRampToValueAtTime( _orientation.z, endTime ); + panner.positionX.linearRampToValueAtTime( _position$3.x, endTime ); + panner.positionY.linearRampToValueAtTime( _position$3.y, endTime ); + panner.positionZ.linearRampToValueAtTime( _position$3.z, endTime ); + panner.orientationX.linearRampToValueAtTime( _orientation$1.x, endTime ); + panner.orientationY.linearRampToValueAtTime( _orientation$1.y, endTime ); + panner.orientationZ.linearRampToValueAtTime( _orientation$1.z, endTime ); } else { - panner.setPosition( _position.x, _position.y, _position.z ); - panner.setOrientation( _orientation.x, _orientation.y, _orientation.z ); + panner.setPosition( _position$3.x, _position$3.y, _position$3.z ); + panner.setOrientation( _orientation$1.x, _orientation$1.y, _orientation$1.z ); } @@ -44537,7 +44679,7 @@ class Cylindrical { } -const _vector$4 = /*@__PURE__*/ new Vector2(); +const _vector$8 = /*@__PURE__*/ new Vector2(); class Box2 { @@ -44573,7 +44715,7 @@ class Box2 { setFromCenterAndSize( center, size ) { - const halfSize = _vector$4.copy( size ).multiplyScalar( 0.5 ); + const halfSize = _vector$8.copy( size ).multiplyScalar( 0.5 ); this.min.copy( center ).sub( halfSize ); this.max.copy( center ).add( halfSize ); @@ -44723,7 +44865,7 @@ class Box2 { distanceToPoint( point ) { - const clampedPoint = _vector$4.copy( point ).clamp( this.min, this.max ); + const clampedPoint = _vector$8.copy( point ).clamp( this.min, this.max ); return clampedPoint.sub( point ).length(); } @@ -44930,7 +45072,7 @@ ImmediateRenderObject.prototype.constructor = ImmediateRenderObject; ImmediateRenderObject.prototype.isImmediateRenderObject = true; -const _vector$3 = /*@__PURE__*/ new Vector3(); +const _vector$9 = /*@__PURE__*/ new Vector3(); class SpotLightHelper extends Object3D { @@ -44994,9 +45136,9 @@ class SpotLightHelper extends Object3D { this.cone.scale.set( coneWidth, coneWidth, coneLength ); - _vector$3.setFromMatrixPosition( this.light.target.matrixWorld ); + _vector$9.setFromMatrixPosition( this.light.target.matrixWorld ); - this.cone.lookAt( _vector$3 ); + this.cone.lookAt( _vector$9 ); if ( this.color !== undefined ) { @@ -45012,7 +45154,7 @@ class SpotLightHelper extends Object3D { } -const _vector$2 = /*@__PURE__*/ new Vector3(); +const _vector$a = /*@__PURE__*/ new Vector3(); const _boneMatrix = /*@__PURE__*/ new Matrix4(); const _matrixWorldInv = /*@__PURE__*/ new Matrix4(); @@ -45080,12 +45222,12 @@ class SkeletonHelper extends LineSegments { 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 ); + _vector$a.setFromMatrixPosition( _boneMatrix ); + position.setXYZ( j, _vector$a.x, _vector$a.y, _vector$a.z ); _boneMatrix.multiplyMatrices( _matrixWorldInv, bone.parent.matrixWorld ); - _vector$2.setFromMatrixPosition( _boneMatrix ); - position.setXYZ( j + 1, _vector$2.x, _vector$2.y, _vector$2.z ); + _vector$a.setFromMatrixPosition( _boneMatrix ); + position.setXYZ( j + 1, _vector$a.x, _vector$a.y, _vector$a.z ); j += 2; @@ -45207,7 +45349,7 @@ class PointLightHelper extends Mesh { } -const _vector$1 = /*@__PURE__*/ new Vector3(); +const _vector$b = /*@__PURE__*/ new Vector3(); const _color1 = /*@__PURE__*/ new Color(); const _color2 = /*@__PURE__*/ new Color(); @@ -45275,7 +45417,7 @@ class HemisphereLightHelper extends Object3D { } - mesh.lookAt( _vector$1.setFromMatrixPosition( this.light.matrixWorld ).negate() ); + mesh.lookAt( _vector$b.setFromMatrixPosition( this.light.matrixWorld ).negate() ); } @@ -45399,9 +45541,9 @@ class PolarGridHelper extends LineSegments { } -const _v1 = /*@__PURE__*/ new Vector3(); -const _v2 = /*@__PURE__*/ new Vector3(); -const _v3 = /*@__PURE__*/ new Vector3(); +const _v1$7 = /*@__PURE__*/ new Vector3(); +const _v2$3 = /*@__PURE__*/ new Vector3(); +const _v3$1 = /*@__PURE__*/ new Vector3(); class DirectionalLightHelper extends Object3D { @@ -45453,11 +45595,11 @@ class DirectionalLightHelper extends Object3D { update() { - _v1.setFromMatrixPosition( this.light.matrixWorld ); - _v2.setFromMatrixPosition( this.light.target.matrixWorld ); - _v3.subVectors( _v2, _v1 ); + _v1$7.setFromMatrixPosition( this.light.matrixWorld ); + _v2$3.setFromMatrixPosition( this.light.target.matrixWorld ); + _v3$1.subVectors( _v2$3, _v1$7 ); - this.lightPlane.lookAt( _v2 ); + this.lightPlane.lookAt( _v2$3 ); if ( this.color !== undefined ) { @@ -45471,14 +45613,14 @@ class DirectionalLightHelper extends Object3D { } - this.targetLine.lookAt( _v2 ); - this.targetLine.scale.z = _v3.length(); + this.targetLine.lookAt( _v2$3 ); + this.targetLine.scale.z = _v3$1.length(); } } -const _vector = /*@__PURE__*/ new Vector3(); +const _vector$c = /*@__PURE__*/ new Vector3(); const _camera = /*@__PURE__*/ new Camera(); /** @@ -45654,7 +45796,7 @@ class CameraHelper extends LineSegments { function setPoint( point, pointMap, geometry, camera, x, y, z ) { - _vector.set( x, y, z ).unproject( camera ); + _vector$c.set( x, y, z ).unproject( camera ); const points = pointMap[ point ]; @@ -45664,7 +45806,7 @@ function setPoint( point, pointMap, geometry, camera, x, y, z ) { for ( let i = 0, l = points.length; i < l; i ++ ) { - position.setXYZ( points[ i ], _vector.x, _vector.y, _vector.z ); + position.setXYZ( points[ i ], _vector$c.x, _vector$c.y, _vector$c.z ); } @@ -45672,7 +45814,7 @@ function setPoint( point, pointMap, geometry, camera, x, y, z ) { } -const _box = /*@__PURE__*/ new Box3(); +const _box$3 = /*@__PURE__*/ new Box3(); class BoxHelper extends LineSegments { @@ -45706,14 +45848,14 @@ class BoxHelper extends LineSegments { if ( this.object !== undefined ) { - _box.setFromObject( this.object ); + _box$3.setFromObject( this.object ); } - if ( _box.isEmpty() ) return; + if ( _box$3.isEmpty() ) return; - const min = _box.min; - const max = _box.max; + const min = _box$3.min; + const max = _box$3.max; /* 5____4 diff --git a/examples/jsm/modifiers/CurveModifier.js b/examples/jsm/modifiers/CurveModifier.js index de975d93b44b47..75a05fd4986533 100644 --- a/examples/jsm/modifiers/CurveModifier.js +++ b/examples/jsm/modifiers/CurveModifier.js @@ -291,6 +291,7 @@ export class InstancedFlow extends Flow { ); this.object3D.setMatrixAt( index, matrix ); this.object3D.instanceMatrix.needsUpdate = true; + this.object3D.computeBoundingSphere(); } diff --git a/examples/jsm/physics/AmmoPhysics.js b/examples/jsm/physics/AmmoPhysics.js index e67178b567b47c..c829e8c728fb65 100644 --- a/examples/jsm/physics/AmmoPhysics.js +++ b/examples/jsm/physics/AmmoPhysics.js @@ -223,6 +223,7 @@ async function AmmoPhysics() { } mesh.instanceMatrix.needsUpdate = true; + mesh.computeBoundingSphere(); } else if ( mesh.isMesh ) { diff --git a/examples/webgl_buffergeometry_instancing_interleaved.html b/examples/webgl_buffergeometry_instancing_interleaved.html index 37e1775332e896..71634b55825f25 100644 --- a/examples/webgl_buffergeometry_instancing_interleaved.html +++ b/examples/webgl_buffergeometry_instancing_interleaved.html @@ -208,6 +208,7 @@ } mesh.instanceMatrix.needsUpdate = true; + mesh.computeBoundingSphere(); lastTime = time; diff --git a/examples/webgl_instancing_dynamic.html b/examples/webgl_instancing_dynamic.html index e2c22e20dc4fff..1467e0a3e5f54d 100644 --- a/examples/webgl_instancing_dynamic.html +++ b/examples/webgl_instancing_dynamic.html @@ -12,6 +12,8 @@ import * as THREE from '../build/three.module.js'; + import { OrbitControls } from './jsm/controls/OrbitControls.js'; + import Stats from './jsm/libs/stats.module.js'; import { GUI } from './jsm/libs/dat.gui.module.js'; @@ -29,7 +31,6 @@ camera = new THREE.PerspectiveCamera( 60, window.innerWidth / window.innerHeight, 0.1, 100 ); camera.position.set( amount * 0.9, amount * 0.9, amount * 0.9 ); - camera.lookAt( 0, 0, 0 ); scene = new THREE.Scene(); @@ -70,6 +71,10 @@ window.addEventListener( 'resize', onWindowResize ); + const controls = new OrbitControls( camera, renderer.domElement ); + controls.minDistance = 10; + controls.maxDistance = 50; + } function onWindowResize() { @@ -126,6 +131,7 @@ } mesh.instanceMatrix.needsUpdate = true; + mesh.computeBoundingSphere(); } diff --git a/examples/webgl_instancing_modified.html b/examples/webgl_instancing_modified.html index d30c48c7c0a587..dcdf67e6adc1fd 100644 --- a/examples/webgl_instancing_modified.html +++ b/examples/webgl_instancing_modified.html @@ -183,6 +183,7 @@ } mesh.instanceMatrix.needsUpdate = true; + mesh.computeBoundingSphere(); } diff --git a/examples/webgl_instancing_scatter.html b/examples/webgl_instancing_scatter.html index 2d2724b81126c7..f6eaeb88600f91 100644 --- a/examples/webgl_instancing_scatter.html +++ b/examples/webgl_instancing_scatter.html @@ -297,6 +297,9 @@ stemMesh.instanceMatrix.needsUpdate = true; blossomMesh.instanceMatrix.needsUpdate = true; + stemMesh.computeBoundingSphere(); + blossomMesh.computeBoundingSphere(); + } renderer.render( scene, camera ); diff --git a/src/math/Box3.js b/src/math/Box3.js index 028ec7140657cf..75c8b9cff219d7 100644 --- a/src/math/Box3.js +++ b/src/math/Box3.js @@ -209,21 +209,38 @@ class Box3 { object.updateWorldMatrix( false, false ); - const geometry = object.geometry; + if ( object.boundingBox !== undefined ) { - if ( geometry !== undefined ) { + if ( object.boundingBox === null ) { - if ( geometry.boundingBox === null ) { - - geometry.computeBoundingBox(); + object.computeBoundingBox(); } - _box.copy( geometry.boundingBox ); + _box.copy( object.boundingBox ); _box.applyMatrix4( object.matrixWorld ); this.union( _box ); + } else { + + const geometry = object.geometry; + + if ( geometry !== undefined ) { + + if ( geometry.boundingBox === null ) { + + geometry.computeBoundingBox(); + + } + + _box.copy( geometry.boundingBox ); + _box.applyMatrix4( object.matrixWorld ); + + this.union( _box ); + + } + } const children = object.children; diff --git a/src/math/Frustum.js b/src/math/Frustum.js index fc6b928a31ff5b..03ab34a309f7f4 100644 --- a/src/math/Frustum.js +++ b/src/math/Frustum.js @@ -64,11 +64,21 @@ class Frustum { intersectsObject( object ) { - const geometry = object.geometry; + if ( object.boundingSphere !== undefined ) { - if ( geometry.boundingSphere === null ) geometry.computeBoundingSphere(); + if ( object.boundingSphere === null ) object.computeBoundingSphere(); - _sphere.copy( geometry.boundingSphere ).applyMatrix4( object.matrixWorld ); + _sphere.copy( object.boundingSphere ).applyMatrix4( object.matrixWorld ); + + } else { + + const geometry = object.geometry; + + if ( geometry.boundingSphere === null ) geometry.computeBoundingSphere(); + + _sphere.copy( geometry.boundingSphere ).applyMatrix4( object.matrixWorld ); + + } return this.intersectsSphere( _sphere ); diff --git a/src/objects/InstancedMesh.js b/src/objects/InstancedMesh.js index 14d00cd5b60952..25f65cfa274ab3 100644 --- a/src/objects/InstancedMesh.js +++ b/src/objects/InstancedMesh.js @@ -1,13 +1,17 @@ import { BufferAttribute } from '../core/BufferAttribute.js'; import { Mesh } from './Mesh.js'; +import { Box3 } from '../math/Box3.js'; import { Matrix4 } from '../math/Matrix4.js'; +import { Sphere } from '../math/Sphere.js'; const _instanceLocalMatrix = new Matrix4(); const _instanceWorldMatrix = new Matrix4(); const _instanceIntersects = []; +const _box3 = new Box3(); const _mesh = new Mesh(); +const _sphere = new Sphere(); function InstancedMesh( geometry, material, count ) { @@ -18,7 +22,8 @@ function InstancedMesh( geometry, material, count ) { this.count = count; - this.frustumCulled = false; + this.boundingBox = null; + this.boundingSphere = null; } @@ -28,6 +33,72 @@ InstancedMesh.prototype = Object.assign( Object.create( Mesh.prototype ), { isInstancedMesh: true, + computeBoundingBox: function () { + + const geometry = this.geometry; + const count = this.count; + + if ( this.boundingBox === null ) { + + this.boundingBox = new Box3(); + + } + + if ( geometry.boundingBox === null ) { + + geometry.computeBoundingBox(); + + } + + this.boundingBox.makeEmpty(); + + for ( let i = 0; i < count; i ++ ) { + + this.getMatrixAt( i, _instanceLocalMatrix ); + + _box3.copy( geometry.boundingBox ).applyMatrix4( _instanceLocalMatrix ); + + this.boundingBox.union( _box3 ); + + } + + return this; + + }, + + computeBoundingSphere: function () { + + const geometry = this.geometry; + const count = this.count; + + if ( this.boundingSphere === null ) { + + this.boundingSphere = new Sphere(); + + } + + if ( geometry.boundingSphere === null ) { + + geometry.computeBoundingSphere(); + + } + + this.boundingSphere.makeEmpty(); + + for ( let i = 0; i < count; i ++ ) { + + this.getMatrixAt( i, _instanceLocalMatrix ); + + _sphere.copy( geometry.boundingSphere ).applyMatrix4( _instanceLocalMatrix ); + + this.boundingSphere.union( _sphere ); + + } + + return this; + + }, + copy: function ( source ) { Mesh.prototype.copy.call( this, source );