diff --git a/build/three.js b/build/three.js index 658aa884f3ff65726d84dec82f894a3f4c3180a8..f76c5744930d537fd3dfec18518e06532b5e19e5 100644 --- a/build/three.js +++ b/build/three.js @@ -36,7 +36,7 @@ // IE 8 has a broken Object.defineProperty that only works on DOM objects. define({}, ""); } catch (err) { - define = function define(obj, key, value) { + define = function (obj, key, value) { return obj[key] = value; }; } @@ -520,7 +520,7 @@ Context.prototype = { constructor: Context, - reset: function reset(skipTempReset) { + reset: function (skipTempReset) { this.prev = 0; this.next = 0; // Resetting context._sent for legacy support of Babel's // function.sent implementation. @@ -541,7 +541,7 @@ } } }, - stop: function stop() { + stop: function () { this.done = true; var rootEntry = this.tryEntries[0]; var rootRecord = rootEntry.completion; @@ -552,7 +552,7 @@ return this.rval; }, - dispatchException: function dispatchException(exception) { + dispatchException: function (exception) { if (this.done) { throw exception; } @@ -609,7 +609,7 @@ } } }, - abrupt: function abrupt(type, arg) { + abrupt: function (type, arg) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; @@ -637,7 +637,7 @@ return this.complete(record); }, - complete: function complete(record, afterLoc) { + complete: function (record, afterLoc) { if (record.type === "throw") { throw record.arg; } @@ -654,7 +654,7 @@ return ContinueSentinel; }, - finish: function finish(finallyLoc) { + finish: function (finallyLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; @@ -665,7 +665,7 @@ } } }, - "catch": function _catch(tryLoc) { + "catch": function (tryLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; @@ -685,7 +685,7 @@ throw new Error("illegal catch attempt"); }, - delegateYield: function delegateYield(iterable, resultName, nextLoc) { + delegateYield: function (iterable, resultName, nextLoc) { this.delegate = { iterator: values(iterable), resultName: resultName, @@ -727,8 +727,8 @@ Function("r", "regeneratorRuntime = r")(runtime); } - var REVISION = '127dev'; - var MOUSE = { + const REVISION = '127dev'; + const MOUSE = { LEFT: 0, MIDDLE: 1, RIGHT: 2, @@ -736,321 +736,203 @@ DOLLY: 1, PAN: 2 }; - var TOUCH = { + const TOUCH = { ROTATE: 0, PAN: 1, DOLLY_PAN: 2, DOLLY_ROTATE: 3 }; - 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; - - _setPrototypeOf(subClass, superClass); - } - - function _setPrototypeOf(o, p) { - _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { - o.__proto__ = p; - return o; - }; - - return _setPrototypeOf(o, p); - } - - 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); - } + 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'; /** * https://github.com/mrdoob/eventdispatcher.js/ @@ -1058,9 +940,9 @@ function EventDispatcher() {} Object.assign(EventDispatcher.prototype, { - addEventListener: function addEventListener(type, listener) { + addEventListener: function (type, listener) { if (this._listeners === undefined) this._listeners = {}; - var listeners = this._listeners; + const listeners = this._listeners; if (listeners[type] === undefined) { listeners[type] = []; @@ -1070,151 +952,147 @@ listeners[type].push(listener); } }, - hasEventListener: function hasEventListener(type, listener) { + hasEventListener: function (type, listener) { if (this._listeners === undefined) return false; - var listeners = this._listeners; + const listeners = this._listeners; return listeners[type] !== undefined && listeners[type].indexOf(listener) !== -1; }, - removeEventListener: function removeEventListener(type, listener) { + removeEventListener: function (type, listener) { if (this._listeners === undefined) return; - var listeners = this._listeners; - var listenerArray = listeners[type]; + const listeners = this._listeners; + const listenerArray = listeners[type]; if (listenerArray !== undefined) { - var index = listenerArray.indexOf(listener); + const index = listenerArray.indexOf(listener); if (index !== -1) { listenerArray.splice(index, 1); } } }, - dispatchEvent: function dispatchEvent(event) { + dispatchEvent: function (event) { if (this._listeners === undefined) return; - var listeners = this._listeners; - var listenerArray = listeners[event.type]; + const listeners = this._listeners; + const listenerArray = listeners[event.type]; if (listenerArray !== undefined) { event.target = this; // Make a copy, in case listeners are removed while iterating. - var array = listenerArray.slice(0); + const array = listenerArray.slice(0); - for (var i = 0, l = array.length; i < l; i++) { + for (let i = 0, l = array.length; i < l; i++) { array[i].call(this, event); } } } }); - var _lut = []; + const _lut = []; - for (var i = 0; i < 256; i++) { + for (let i = 0; i < 256; i++) { _lut[i] = (i < 16 ? '0' : '') + i.toString(16); } - var _seed = 1234567; - var MathUtils = { + let _seed = 1234567; + const MathUtils = { DEG2RAD: Math.PI / 180, RAD2DEG: 180 / Math.PI, - generateUUID: function generateUUID() { + generateUUID: function () { // http://stackoverflow.com/questions/105034/how-to-create-a-guid-uuid-in-javascript/21963136#21963136 - 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. + 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. return uuid.toUpperCase(); }, - clamp: function clamp(value, min, max) { + clamp: function (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 euclideanModulo(n, m) { + euclideanModulo: function (n, m) { return (n % m + m) % m; }, // Linear mapping from range to range - mapLinear: function mapLinear(x, a1, a2, b1, b2) { + mapLinear: function (x, a1, a2, b1, b2) { return b1 + (x - a1) * (b2 - b1) / (a2 - a1); }, // https://en.wikipedia.org/wiki/Linear_interpolation - lerp: function lerp(x, y, t) { + lerp: function (x, y, t) { return (1 - t) * x + t * y; }, // http://www.rorydriscoll.com/2016/03/07/frame-rate-independent-damping-using-lerp/ - damp: function damp(x, y, lambda, dt) { + damp: function (x, y, lambda, dt) { return MathUtils.lerp(x, y, 1 - Math.exp(-lambda * dt)); }, // https://www.desmos.com/calculator/vcsjnyz7x4 - pingpong: function pingpong(x, length) { - if (length === void 0) { - length = 1; - } - + pingpong: function (x, length = 1) { return length - Math.abs(MathUtils.euclideanModulo(x, length * 2) - length); }, // http://en.wikipedia.org/wiki/Smoothstep - smoothstep: function smoothstep(x, min, max) { + smoothstep: function (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 smootherstep(x, min, max) { + smootherstep: function (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 randInt(low, high) { + randInt: function (low, high) { return low + Math.floor(Math.random() * (high - low + 1)); }, // Random float from interval - randFloat: function randFloat(low, high) { + randFloat: function (low, high) { return low + Math.random() * (high - low); }, // Random float from <-range/2, range/2> interval - randFloatSpread: function randFloatSpread(range) { + randFloatSpread: function (range) { return range * (0.5 - Math.random()); }, // Deterministic pseudo-random float in the interval [ 0, 1 ] - seededRandom: function seededRandom(s) { + seededRandom: function (s) { if (s !== undefined) _seed = s % 2147483647; // Park-Miller algorithm _seed = _seed * 16807 % 2147483647; return (_seed - 1) / 2147483646; }, - degToRad: function degToRad(degrees) { + degToRad: function (degrees) { return degrees * MathUtils.DEG2RAD; }, - radToDeg: function radToDeg(radians) { + radToDeg: function (radians) { return radians * MathUtils.RAD2DEG; }, - isPowerOfTwo: function isPowerOfTwo(value) { + isPowerOfTwo: function (value) { return (value & value - 1) === 0 && value !== 0; }, - ceilPowerOfTwo: function ceilPowerOfTwo(value) { + ceilPowerOfTwo: function (value) { return Math.pow(2, Math.ceil(Math.log(value) / Math.LN2)); }, - floorPowerOfTwo: function floorPowerOfTwo(value) { + floorPowerOfTwo: function (value) { return Math.pow(2, Math.floor(Math.log(value) / Math.LN2)); }, - setQuaternionFromProperEuler: function setQuaternionFromProperEuler(q, a, b, c, order) { + setQuaternionFromProperEuler: function (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 - 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); + 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); switch (order) { case 'XYX': @@ -1247,45 +1125,51 @@ } }; - var Vector2 = /*#__PURE__*/function () { - function Vector2(x, y) { - if (x === void 0) { - x = 0; - } - - if (y === void 0) { - y = 0; - } - + class Vector2 { + constructor(x = 0, y = 0) { this.x = x; this.y = y; } - var _proto = Vector2.prototype; + get width() { + return this.x; + } + + set width(value) { + this.x = value; + } + + get height() { + return this.y; + } + + set height(value) { + this.y = value; + } - _proto.set = function set(x, y) { + set(x, y) { this.x = x; this.y = y; return this; - }; + } - _proto.setScalar = function setScalar(scalar) { + setScalar(scalar) { this.x = scalar; this.y = scalar; return this; - }; + } - _proto.setX = function setX(x) { + setX(x) { this.x = x; return this; - }; + } - _proto.setY = function setY(y) { + setY(y) { this.y = y; return this; - }; + } - _proto.setComponent = function setComponent(index, value) { + setComponent(index, value) { switch (index) { case 0: this.x = value; @@ -1300,9 +1184,9 @@ } return this; - }; + } - _proto.getComponent = function getComponent(index) { + getComponent(index) { switch (index) { case 0: return this.x; @@ -1313,19 +1197,19 @@ default: throw new Error('index is out of range: ' + index); } - }; + } - _proto.clone = function clone() { + clone() { return new this.constructor(this.x, this.y); - }; + } - _proto.copy = function copy(v) { + copy(v) { this.x = v.x; this.y = v.y; return this; - }; + } - _proto.add = function add(v, w) { + 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); @@ -1334,27 +1218,27 @@ this.x += v.x; this.y += v.y; return this; - }; + } - _proto.addScalar = function addScalar(s) { + addScalar(s) { this.x += s; this.y += s; return this; - }; + } - _proto.addVectors = function addVectors(a, b) { + addVectors(a, b) { this.x = a.x + b.x; this.y = a.y + b.y; return this; - }; + } - _proto.addScaledVector = function addScaledVector(v, s) { + addScaledVector(v, s) { this.x += v.x * s; this.y += v.y * s; return this; - }; + } - _proto.sub = function sub(v, w) { + 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); @@ -1363,200 +1247,188 @@ this.x -= v.x; this.y -= v.y; return this; - }; + } - _proto.subScalar = function subScalar(s) { + subScalar(s) { this.x -= s; this.y -= s; return this; - }; + } - _proto.subVectors = function subVectors(a, b) { + subVectors(a, b) { this.x = a.x - b.x; this.y = a.y - b.y; return this; - }; + } - _proto.multiply = function multiply(v) { + multiply(v) { this.x *= v.x; this.y *= v.y; return this; - }; + } - _proto.multiplyScalar = function multiplyScalar(scalar) { + multiplyScalar(scalar) { this.x *= scalar; this.y *= scalar; return this; - }; + } - _proto.divide = function divide(v) { + divide(v) { this.x /= v.x; this.y /= v.y; return this; - }; + } - _proto.divideScalar = function divideScalar(scalar) { + divideScalar(scalar) { return this.multiplyScalar(1 / scalar); - }; + } - _proto.applyMatrix3 = function applyMatrix3(m) { - var x = this.x, - y = this.y; - var e = m.elements; + applyMatrix3(m) { + const x = this.x, + y = this.y; + const e = m.elements; this.x = e[0] * x + e[3] * y + e[6]; this.y = e[1] * x + e[4] * y + e[7]; return this; - }; + } - _proto.min = function min(v) { + min(v) { this.x = Math.min(this.x, v.x); this.y = Math.min(this.y, v.y); return this; - }; + } - _proto.max = function max(v) { + max(v) { this.x = Math.max(this.x, v.x); this.y = Math.max(this.y, v.y); return this; - }; + } - _proto.clamp = function clamp(min, max) { + 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; - }; + } - _proto.clampScalar = function clampScalar(minVal, maxVal) { + 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; - }; + } - _proto.clampLength = function clampLength(min, max) { - var length = this.length(); + clampLength(min, max) { + const length = this.length(); return this.divideScalar(length || 1).multiplyScalar(Math.max(min, Math.min(max, length))); - }; + } - _proto.floor = function floor() { + floor() { this.x = Math.floor(this.x); this.y = Math.floor(this.y); return this; - }; + } - _proto.ceil = function ceil() { + ceil() { this.x = Math.ceil(this.x); this.y = Math.ceil(this.y); return this; - }; + } - _proto.round = function round() { + round() { this.x = Math.round(this.x); this.y = Math.round(this.y); return this; - }; + } - _proto.roundToZero = function roundToZero() { + 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; - }; + } - _proto.negate = function negate() { + negate() { this.x = -this.x; this.y = -this.y; return this; - }; + } - _proto.dot = function dot(v) { + dot(v) { return this.x * v.x + this.y * v.y; - }; + } - _proto.cross = function cross(v) { + cross(v) { return this.x * v.y - this.y * v.x; - }; + } - _proto.lengthSq = function lengthSq() { + lengthSq() { return this.x * this.x + this.y * this.y; - }; + } - _proto.length = function length() { + length() { return Math.sqrt(this.x * this.x + this.y * this.y); - }; + } - _proto.manhattanLength = function manhattanLength() { + manhattanLength() { return Math.abs(this.x) + Math.abs(this.y); - }; + } - _proto.normalize = function normalize() { + normalize() { return this.divideScalar(this.length() || 1); - }; + } - _proto.angle = function angle() { + angle() { // computes the angle in radians with respect to the positive x-axis - var angle = Math.atan2(-this.y, -this.x) + Math.PI; + const angle = Math.atan2(-this.y, -this.x) + Math.PI; return angle; - }; + } - _proto.distanceTo = function distanceTo(v) { + distanceTo(v) { return Math.sqrt(this.distanceToSquared(v)); - }; + } - _proto.distanceToSquared = function distanceToSquared(v) { - var dx = this.x - v.x, - dy = this.y - v.y; + distanceToSquared(v) { + const dx = this.x - v.x, + dy = this.y - v.y; return dx * dx + dy * dy; - }; + } - _proto.manhattanDistanceTo = function manhattanDistanceTo(v) { + manhattanDistanceTo(v) { return Math.abs(this.x - v.x) + Math.abs(this.y - v.y); - }; + } - _proto.setLength = function setLength(length) { + setLength(length) { return this.normalize().multiplyScalar(length); - }; + } - _proto.lerp = function lerp(v, alpha) { + lerp(v, alpha) { this.x += (v.x - this.x) * alpha; this.y += (v.y - this.y) * alpha; return this; - }; + } - _proto.lerpVectors = function lerpVectors(v1, v2, alpha) { + lerpVectors(v1, v2, alpha) { this.x = v1.x + (v2.x - v1.x) * alpha; this.y = v1.y + (v2.y - v1.y) * alpha; return this; - }; + } - _proto.equals = function equals(v) { + 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; - }; + } - _proto.fromBufferAttribute = function fromBufferAttribute(attribute, index, offset) { + fromBufferAttribute(attribute, index, offset) { if (offset !== undefined) { console.warn('THREE.Vector2: offset has been removed from .fromBufferAttribute().'); } @@ -1564,49 +1436,30 @@ this.x = attribute.getX(index); this.y = attribute.getY(index); return this; - }; + } - _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; + rotateAround(center, angle) { + const c = Math.cos(angle), + s = Math.sin(angle); + const x = this.x - center.x; + const y = this.y - center.y; this.x = x * c - y * s + center.x; this.y = x * s + y * c + center.y; return this; - }; + } - _proto.random = function random() { + 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; - var Matrix3 = /*#__PURE__*/function () { - function Matrix3() { + class Matrix3 { + constructor() { this.elements = [1, 0, 0, 0, 1, 0, 0, 0, 1]; if (arguments.length > 0) { @@ -1614,10 +1467,8 @@ } } - var _proto = Matrix3.prototype; - - _proto.set = function set(n11, n12, n13, n21, n22, n23, n31, n32, n33) { - var te = this.elements; + set(n11, n12, n13, n21, n22, n23, n31, n32, n33) { + const te = this.elements; te[0] = n11; te[1] = n21; te[2] = n31; @@ -1628,16 +1479,16 @@ te[7] = n23; te[8] = n33; return this; - }; + } - _proto.identity = function identity() { + identity() { this.set(1, 0, 0, 0, 1, 0, 0, 0, 1); return this; - }; + } - _proto.copy = function copy(m) { - var te = this.elements; - var me = m.elements; + copy(m) { + const te = this.elements; + const me = m.elements; te[0] = me[0]; te[1] = me[1]; te[2] = me[2]; @@ -1648,51 +1499,51 @@ te[7] = me[7]; te[8] = me[8]; return this; - }; + } - _proto.extractBasis = function extractBasis(xAxis, yAxis, zAxis) { + extractBasis(xAxis, yAxis, zAxis) { xAxis.setFromMatrix3Column(this, 0); yAxis.setFromMatrix3Column(this, 1); zAxis.setFromMatrix3Column(this, 2); return this; - }; + } - _proto.setFromMatrix4 = function setFromMatrix4(m) { - var me = m.elements; + setFromMatrix4(m) { + const me = m.elements; this.set(me[0], me[4], me[8], me[1], me[5], me[9], me[2], me[6], me[10]); return this; - }; + } - _proto.multiply = function multiply(m) { + multiply(m) { return this.multiplyMatrices(this, m); - }; + } - _proto.premultiply = function premultiply(m) { + premultiply(m) { return this.multiplyMatrices(m, this); - }; + } - _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]; + 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]; te[0] = a11 * b11 + a12 * b21 + a13 * b31; te[3] = a11 * b12 + a12 * b22 + a13 * b32; te[6] = a11 * b13 + a12 * b23 + a13 * b33; @@ -1703,10 +1554,10 @@ te[5] = a31 * b12 + a32 * b22 + a33 * b32; te[8] = a31 * b13 + a32 * b23 + a33 * b33; return this; - }; + } - _proto.multiplyScalar = function multiplyScalar(s) { - var te = this.elements; + multiplyScalar(s) { + const te = this.elements; te[0] *= s; te[3] *= s; te[6] *= s; @@ -1717,39 +1568,39 @@ te[5] *= s; te[8] *= s; return this; - }; + } - _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]; + 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]; return a * e * i - a * f * h - b * d * i + b * f * g + c * d * h - c * e * g; - }; + } - _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; + 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; if (det === 0) return this.set(0, 0, 0, 0, 0, 0, 0, 0, 0); - var detInv = 1 / det; + const detInv = 1 / det; te[0] = t11 * detInv; te[1] = (n31 * n23 - n33 * n21) * detInv; te[2] = (n32 * n21 - n31 * n22) * detInv; @@ -1760,11 +1611,11 @@ te[7] = (n21 * n13 - n23 * n11) * detInv; te[8] = (n22 * n11 - n21 * n12) * detInv; return this; - }; + } - _proto.transpose = function transpose() { - var tmp; - var m = this.elements; + transpose() { + let tmp; + const m = this.elements; tmp = m[1]; m[1] = m[3]; m[3] = tmp; @@ -1775,14 +1626,14 @@ m[5] = m[7]; m[7] = tmp; return this; - }; + } - _proto.getNormalMatrix = function getNormalMatrix(matrix4) { + getNormalMatrix(matrix4) { return this.setFromMatrix4(matrix4).invert().transpose(); - }; + } - _proto.transposeIntoArray = function transposeIntoArray(r) { - var m = this.elements; + transposeIntoArray(r) { + const m = this.elements; r[0] = m[0]; r[1] = m[3]; r[2] = m[6]; @@ -1793,17 +1644,17 @@ r[7] = m[5]; r[8] = m[8]; return this; - }; + } - _proto.setUvTransform = function setUvTransform(tx, ty, sx, sy, rotation, cx, cy) { - var c = Math.cos(rotation); - var s = Math.sin(rotation); + setUvTransform(tx, ty, sx, sy, rotation, cx, cy) { + const c = Math.cos(rotation); + const s = Math.sin(rotation); this.set(sx * c, sx * s, -sx * (c * cx + s * cy) + cx + tx, -sy * s, sy * c, -sy * (-s * cx + c * cy) + cy + ty, 0, 0, 1); return this; - }; + } - _proto.scale = function scale(sx, sy) { - var te = this.elements; + scale(sx, sy) { + const te = this.elements; te[0] *= sx; te[3] *= sx; te[6] *= sx; @@ -1811,18 +1662,18 @@ te[4] *= sy; te[7] *= sy; return this; - }; + } - _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]; + 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]; te[0] = c * a11 + s * a21; te[3] = c * a12 + s * a22; te[6] = c * a13 + s * a23; @@ -1830,10 +1681,10 @@ te[4] = -s * a12 + c * a22; te[7] = -s * a13 + c * a23; return this; - }; + } - _proto.translate = function translate(tx, ty) { - var te = this.elements; + translate(tx, ty) { + const te = this.elements; te[0] += tx * te[2]; te[3] += tx * te[5]; te[6] += tx * te[8]; @@ -1841,41 +1692,29 @@ te[4] += ty * te[5]; te[7] += ty * te[8]; return this; - }; + } - _proto.equals = function equals(matrix) { - var te = this.elements; - var me = matrix.elements; + equals(matrix) { + const te = this.elements; + const me = matrix.elements; - for (var i = 0; i < 9; i++) { + for (let 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; - } + } - for (var i = 0; i < 9; i++) { + fromArray(array, offset = 0) { + for (let 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; - } + } - var te = this.elements; + toArray(array = [], offset = 0) { + const te = this.elements; array[offset] = te[0]; array[offset + 1] = te[1]; array[offset + 2] = te[2]; @@ -1886,21 +1725,20 @@ array[offset + 7] = te[7]; array[offset + 8] = te[8]; return array; - }; + } - _proto.clone = function clone() { + clone() { return new this.constructor().fromArray(this.elements); - }; + } - return Matrix3; - }(); + } Matrix3.prototype.isMatrix3 = true; - var _canvas; + let _canvas; - var ImageUtils = { - getDataURL: function getDataURL(image) { + const ImageUtils = { + getDataURL: function (image) { if (/^data:/i.test(image.src)) { return image.src; } @@ -1909,7 +1747,7 @@ return image.src; } - var canvas; + let canvas; if (image instanceof HTMLCanvasElement) { canvas = image; @@ -1918,7 +1756,7 @@ _canvas.width = image.width; _canvas.height = image.height; - var context = _canvas.getContext('2d'); + const context = _canvas.getContext('2d'); if (image instanceof ImageData) { context.putImageData(image, 0, 0); @@ -1938,103 +1776,56 @@ } }; - 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; - } + let textureId = 0; - _this = _EventDispatcher.call(this) || this; - Object.defineProperty(_assertThisInitialized(_this), 'id', { + 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', { 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; - return _this; + this.encoding = encoding; + this.version = 0; + this.onUpdate = null; } - var _proto = Texture.prototype; - - _proto.updateMatrix = function updateMatrix() { + updateMatrix() { this.matrix.setUvTransform(this.offset.x, this.offset.y, this.repeat.x, this.repeat.y, this.rotation, this.center.x, this.center.y); - }; + } - _proto.clone = function clone() { + clone() { return new this.constructor().copy(this); - }; + } - _proto.copy = function copy(source) { + copy(source) { this.name = source.name; this.image = source.image; this.mipmaps = source.mipmaps.slice(0); @@ -2059,16 +1850,16 @@ this.unpackAlignment = source.unpackAlignment; this.encoding = source.encoding; return this; - }; + } - _proto.toJSON = function toJSON(meta) { - var isRootObject = meta === undefined || typeof meta === 'string'; + toJSON(meta) { + const isRootObject = meta === undefined || typeof meta === 'string'; if (!isRootObject && meta.textures[this.uuid] !== undefined) { return meta.textures[this.uuid]; } - var output = { + const output = { metadata: { version: 4.5, type: 'Texture', @@ -2095,20 +1886,20 @@ if (this.image !== undefined) { // TODO: Move to THREE.Image - var image = this.image; + const image = this.image; if (image.uuid === undefined) { image.uuid = MathUtils.generateUUID(); // UGH } if (!isRootObject && meta.images[image.uuid] === undefined) { - var url; + let url; if (Array.isArray(image)) { // process array of images e.g. CubeTexture url = []; - for (var i = 0, l = image.length; i < l; i++) { + for (let i = 0, l = image.length; i < l; i++) { // check cube texture with data textures if (image[i].isDataTexture) { url.push(serializeImage(image[i].image)); @@ -2135,15 +1926,15 @@ } return output; - }; + } - _proto.dispose = function dispose() { + dispose() { this.dispatchEvent({ type: 'dispose' }); - }; + } - _proto.transformUv = function transformUv(uv) { + transformUv(uv) { if (this.mapping !== UVMapping) return uv; uv.applyMatrix3(this.matrix); @@ -2194,17 +1985,13 @@ } return uv; - }; + } - _createClass(Texture, [{ - key: "needsUpdate", - set: function set(value) { - if (value === true) this.version++; - } - }]); + set needsUpdate(value) { + if (value === true) this.version++; + } - return Texture; - }(EventDispatcher); + } Texture.DEFAULT_IMAGE = undefined; Texture.DEFAULT_MAPPING = UVMapping; @@ -2230,69 +2017,67 @@ } } - 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; - } - + class Vector4 { + constructor(x = 0, y = 0, z = 0, w = 1) { this.x = x; this.y = y; this.z = z; this.w = w; } - var _proto = Vector4.prototype; + get width() { + return this.z; + } + + set width(value) { + this.z = value; + } + + get height() { + return this.w; + } + + set height(value) { + this.w = value; + } - _proto.set = function set(x, y, z, w) { + set(x, y, z, w) { this.x = x; this.y = y; this.z = z; this.w = w; return this; - }; + } - _proto.setScalar = function setScalar(scalar) { + setScalar(scalar) { this.x = scalar; this.y = scalar; this.z = scalar; this.w = scalar; return this; - }; + } - _proto.setX = function setX(x) { + setX(x) { this.x = x; return this; - }; + } - _proto.setY = function setY(y) { + setY(y) { this.y = y; return this; - }; + } - _proto.setZ = function setZ(z) { + setZ(z) { this.z = z; return this; - }; + } - _proto.setW = function setW(w) { + setW(w) { this.w = w; return this; - }; + } - _proto.setComponent = function setComponent(index, value) { + setComponent(index, value) { switch (index) { case 0: this.x = value; @@ -2315,9 +2100,9 @@ } return this; - }; + } - _proto.getComponent = function getComponent(index) { + getComponent(index) { switch (index) { case 0: return this.x; @@ -2334,21 +2119,21 @@ default: throw new Error('index is out of range: ' + index); } - }; + } - _proto.clone = function clone() { + clone() { return new this.constructor(this.x, this.y, this.z, this.w); - }; + } - _proto.copy = function copy(v) { + copy(v) { this.x = v.x; this.y = v.y; this.z = v.z; this.w = v.w !== undefined ? v.w : 1; return this; - }; + } - _proto.add = function add(v, w) { + 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); @@ -2359,33 +2144,33 @@ this.z += v.z; this.w += v.w; return this; - }; + } - _proto.addScalar = function addScalar(s) { + addScalar(s) { this.x += s; this.y += s; this.z += s; this.w += s; return this; - }; + } - _proto.addVectors = function addVectors(a, b) { + 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; - }; + } - _proto.addScaledVector = function addScaledVector(v, s) { + 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; - }; + } - _proto.sub = function sub(v, w) { + 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); @@ -2396,62 +2181,62 @@ this.z -= v.z; this.w -= v.w; return this; - }; + } - _proto.subScalar = function subScalar(s) { + subScalar(s) { this.x -= s; this.y -= s; this.z -= s; this.w -= s; return this; - }; + } - _proto.subVectors = function subVectors(a, b) { + 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; - }; + } - _proto.multiply = function multiply(v) { + multiply(v) { this.x *= v.x; this.y *= v.y; this.z *= v.z; this.w *= v.w; return this; - }; + } - _proto.multiplyScalar = function multiplyScalar(scalar) { + multiplyScalar(scalar) { this.x *= scalar; this.y *= scalar; this.z *= scalar; this.w *= scalar; return this; - }; + } - _proto.applyMatrix4 = function applyMatrix4(m) { - var x = this.x, - y = this.y, - z = this.z, - w = this.w; - var e = m.elements; + applyMatrix4(m) { + const x = this.x, + y = this.y, + z = this.z, + w = this.w; + const e = m.elements; this.x = e[0] * x + e[4] * y + e[8] * z + e[12] * w; this.y = e[1] * x + e[5] * y + e[9] * z + e[13] * w; 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; - }; + } - _proto.divideScalar = function divideScalar(scalar) { + divideScalar(scalar) { return this.multiplyScalar(1 / scalar); - }; + } - _proto.setAxisAngleFromQuaternion = function setAxisAngleFromQuaternion(q) { + 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); - var s = Math.sqrt(1 - q.w * q.w); + const s = Math.sqrt(1 - q.w * q.w); if (s < 0.0001) { this.x = 1; @@ -2464,27 +2249,27 @@ } return this; - }; + } - _proto.setAxisAngleFromRotationMatrix = function setAxisAngleFromRotationMatrix(m) { + 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) - var angle, x, y, z; // variables for result + let angle, x, y, z; // variables for result - var epsilon = 0.01, - // margin to allow for rounding errors + const 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 @@ -2498,12 +2283,12 @@ angle = Math.PI; - 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; + 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; if (xx > yy && xx > zz) { // m11 is the largest diagonal term @@ -2545,7 +2330,7 @@ } // as we have reached here there are no singularities so we can handle normally - var s = Math.sqrt((m32 - m23) * (m32 - m23) + (m13 - m31) * (m13 - m31) + (m21 - m12) * (m21 - m12)); // used to normalize + let s = Math.sqrt((m32 - m23) * (m32 - m23) + (m13 - m31) * (m13 - m31) + (m21 - m12) * (m21 - m12)); // used to normalize if (Math.abs(s) < 0.001) s = 1; // prevent divide by zero, should not happen if matrix is orthogonal and should be // caught by singularity test above, but I've left it in just in case @@ -2555,159 +2340,147 @@ this.z = (m21 - m12) / s; this.w = Math.acos((m11 + m22 + m33 - 1) / 2); return this; - }; + } - _proto.min = function min(v) { + 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; - }; + } - _proto.max = function max(v) { + 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; - }; + } - _proto.clamp = function clamp(min, max) { + 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; - }; + } - _proto.clampScalar = function clampScalar(minVal, maxVal) { + 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; - }; + } - _proto.clampLength = function clampLength(min, max) { - var length = this.length(); + clampLength(min, max) { + const length = this.length(); return this.divideScalar(length || 1).multiplyScalar(Math.max(min, Math.min(max, length))); - }; + } - _proto.floor = function floor() { + 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; - }; + } - _proto.ceil = function ceil() { + 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; - }; + } - _proto.round = function round() { + 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; - }; + } - _proto.roundToZero = function roundToZero() { + 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; - }; + } - _proto.negate = function negate() { + negate() { this.x = -this.x; this.y = -this.y; this.z = -this.z; this.w = -this.w; return this; - }; + } - _proto.dot = function dot(v) { + dot(v) { return this.x * v.x + this.y * v.y + this.z * v.z + this.w * v.w; - }; + } - _proto.lengthSq = function lengthSq() { + lengthSq() { return this.x * this.x + this.y * this.y + this.z * this.z + this.w * this.w; - }; + } - _proto.length = function length() { + length() { return Math.sqrt(this.x * this.x + this.y * this.y + this.z * this.z + this.w * this.w); - }; + } - _proto.manhattanLength = function manhattanLength() { + manhattanLength() { return Math.abs(this.x) + Math.abs(this.y) + Math.abs(this.z) + Math.abs(this.w); - }; + } - _proto.normalize = function normalize() { + normalize() { return this.divideScalar(this.length() || 1); - }; + } - _proto.setLength = function setLength(length) { + setLength(length) { return this.normalize().multiplyScalar(length); - }; + } - _proto.lerp = function lerp(v, alpha) { + 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; - }; + } - _proto.lerpVectors = function lerpVectors(v1, v2, alpha) { + 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; - }; + } - _proto.equals = function equals(v) { + 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; - }; + } - _proto.fromBufferAttribute = function fromBufferAttribute(attribute, index, offset) { + fromBufferAttribute(attribute, index, offset) { if (offset !== undefined) { console.warn('THREE.Vector4: offset has been removed from .fromBufferAttribute().'); } @@ -2717,36 +2490,17 @@ this.z = attribute.getZ(index); this.w = attribute.getW(index); return this; - }; + } - _proto.random = function random() { + 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; @@ -2756,49 +2510,38 @@ * depthBuffer/stencilBuffer: Booleans to indicate if we should generate these buffers */ - 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); + 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); 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; - return _this; - } - - var _proto = WebGLRenderTarget.prototype; - - _proto.setTexture = function 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; + } + + 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; @@ -2811,13 +2554,13 @@ this.viewport.set(0, 0, width, height); this.scissor.set(0, 0, width, height); - }; + } - _proto.clone = function clone() { + clone() { return new this.constructor().copy(this); - }; + } - _proto.copy = function copy(source) { + copy(source) { this.width = source.width; this.height = source.height; this.depth = source.depth; @@ -2827,82 +2570,56 @@ this.stencilBuffer = source.stencilBuffer; this.depthTexture = source.depthTexture; return this; - }; + } - _proto.dispose = function dispose() { + dispose() { this.dispatchEvent({ type: 'dispose' }); - }; + } - return WebGLRenderTarget; - }(EventDispatcher); + } WebGLRenderTarget.prototype.isWebGLRenderTarget = true; - 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; + class WebGLMultisampleRenderTarget extends WebGLRenderTarget { + constructor(width, height, options) { + super(width, height, options); + this.samples = 4; } - var _proto = WebGLMultisampleRenderTarget.prototype; - - _proto.copy = function copy(source) { - _WebGLRenderTarget.prototype.copy.call(this, source); - + copy(source) { + super.copy.call(this, source); this.samples = source.samples; return this; - }; + } - return WebGLMultisampleRenderTarget; - }(WebGLRenderTarget); + } WebGLMultisampleRenderTarget.prototype.isWebGLMultisampleRenderTarget = true; - 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; - } - + class Quaternion { + constructor(x = 0, y = 0, z = 0, w = 1) { this._x = x; this._y = y; this._z = z; this._w = w; } - Quaternion.slerp = function slerp(qa, qb, qm, t) { + static slerp(qa, qb, qm, t) { return qm.copy(qa).slerp(qb, t); - }; + } - Quaternion.slerpFlat = function slerpFlat(dst, dstOffset, src0, srcOffset0, src1, srcOffset1, t) { + static slerpFlat(dst, dstOffset, src0, srcOffset0, src1, srcOffset1, t) { // fuzz-free, array-based Quaternion SLERP operation - var x0 = src0[srcOffset0 + 0], + let x0 = src0[srcOffset0 + 0], y0 = src0[srcOffset0 + 1], z0 = src0[srcOffset0 + 2], w0 = src0[srcOffset0 + 3]; - var x1 = src1[srcOffset1 + 0], - y1 = src1[srcOffset1 + 1], - z1 = src1[srcOffset1 + 2], - w1 = src1[srcOffset1 + 3]; + const x1 = src1[srcOffset1 + 0], + y1 = src1[srcOffset1 + 1], + z1 = src1[srcOffset1 + 2], + w1 = src1[srcOffset1 + 3]; if (t === 0) { dst[dstOffset + 0] = x0; @@ -2921,26 +2638,26 @@ } if (w0 !== w1 || x0 !== x1 || y0 !== y1 || z0 !== z1) { - 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: + 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: if (sqrSin > Number.EPSILON) { - var sin = Math.sqrt(sqrSin), - len = Math.atan2(sin, cos * dir); + const sin = Math.sqrt(sqrSin), + len = Math.atan2(sin, cos * dir); s = Math.sin(s * len) / sin; t = Math.sin(t * len) / sin; } - var tDir = t * dir; + const tDir = t * dir; x0 = x0 * s + x1 * tDir; y0 = y0 * s + y1 * tDir; z0 = z0 * s + z1 * tDir; w0 = w0 * s + w1 * tDir; // Normalize in case we just did a lerp: if (s === 1 - t) { - var f = 1 / Math.sqrt(x0 * x0 + y0 * y0 + z0 * z0 + w0 * w0); + const f = 1 / Math.sqrt(x0 * x0 + y0 * y0 + z0 * z0 + w0 * w0); x0 *= f; y0 *= f; z0 *= f; @@ -2952,27 +2669,65 @@ dst[dstOffset + 1] = y0; dst[dstOffset + 2] = z0; dst[dstOffset + 3] = w0; - }; + } - 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]; + 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]; 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(); + } - var _proto = Quaternion.prototype; + get w() { + return this._w; + } + + set w(value) { + this._w = value; + + this._onChangeCallback(); + } - _proto.set = function set(x, y, z, w) { + set(x, y, z, w) { this._x = x; this._y = y; this._z = z; @@ -2981,13 +2736,13 @@ this._onChangeCallback(); return this; - }; + } - _proto.clone = function clone() { + clone() { return new this.constructor(this._x, this._y, this._z, this._w); - }; + } - _proto.copy = function copy(quaternion) { + copy(quaternion) { this._x = quaternion.x; this._y = quaternion.y; this._z = quaternion.z; @@ -2996,28 +2751,28 @@ this._onChangeCallback(); return this; - }; + } - _proto.setFromEuler = function setFromEuler(euler, update) { + setFromEuler(euler, update) { if (!(euler && euler.isEuler)) { throw new Error('THREE.Quaternion: .setFromEuler() now expects an Euler rotation rather than a Vector3 and order.'); } - var x = euler._x, - y = euler._y, - z = euler._z, - order = euler._order; // http://www.mathworks.com/matlabcentral/fileexchange/ + const 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 - 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); + 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); switch (order) { case 'XYZ': @@ -3068,13 +2823,13 @@ if (update !== false) this._onChangeCallback(); return this; - }; + } - _proto.setFromAxisAngle = function setFromAxisAngle(axis, angle) { + setFromAxisAngle(axis, angle) { // http://www.euclideanspace.com/maths/geometry/rotations/conversions/angleToQuaternion/index.htm // assumes axis is normalized - var halfAngle = angle / 2, - s = Math.sin(halfAngle); + const halfAngle = angle / 2, + s = Math.sin(halfAngle); this._x = axis.x * s; this._y = axis.y * s; this._z = axis.z * s; @@ -3083,61 +2838,58 @@ this._onChangeCallback(); return this; - }; + } - _proto.setFromRotationMatrix = function setFromRotationMatrix(m) { + 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) - 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; + const te = m.elements, + m11 = te[0], + m12 = te[4], + m13 = te[8], + m21 = te[1], + m22 = te[5], + m23 = te[9], + m31 = te[2], + m32 = te[6], + m33 = te[10], + trace = m11 + m22 + m33; if (trace > 0) { - var s = 0.5 / Math.sqrt(trace + 1.0); + const 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) { - 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; + 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; } else if (m22 > m33) { - 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; + 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; } else { - 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; + 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; } this._onChangeCallback(); return this; - }; + } - _proto.setFromUnitVectors = function setFromUnitVectors(vFrom, vTo) { + setFromUnitVectors(vFrom, vTo) { // assumes direction vectors vFrom and vTo are normalized - var EPS = 0.000001; - var r = vFrom.dot(vTo) + 1; + const EPS = 0.000001; + let r = vFrom.dot(vTo) + 1; if (r < EPS) { r = 0; @@ -3162,30 +2914,30 @@ } return this.normalize(); - }; + } - _proto.angleTo = function angleTo(q) { + angleTo(q) { return 2 * Math.acos(Math.abs(MathUtils.clamp(this.dot(q), -1, 1))); - }; + } - _proto.rotateTowards = function rotateTowards(q, step) { - var angle = this.angleTo(q); + rotateTowards(q, step) { + const angle = this.angleTo(q); if (angle === 0) return this; - var t = Math.min(1, step / angle); + const t = Math.min(1, step / angle); this.slerp(q, t); return this; - }; + } - _proto.identity = function identity() { + identity() { return this.set(0, 0, 0, 1); - }; + } - _proto.invert = function invert() { + invert() { // quaternion is assumed to have unit length return this.conjugate(); - }; + } - _proto.conjugate = function conjugate() { + conjugate() { this._x *= -1; this._y *= -1; this._z *= -1; @@ -3193,22 +2945,22 @@ this._onChangeCallback(); return this; - }; + } - _proto.dot = function dot(v) { + dot(v) { return this._x * v._x + this._y * v._y + this._z * v._z + this._w * v._w; - }; + } - _proto.lengthSq = function lengthSq() { + lengthSq() { return this._x * this._x + this._y * this._y + this._z * this._z + this._w * this._w; - }; + } - _proto.length = function length() { + length() { return Math.sqrt(this._x * this._x + this._y * this._y + this._z * this._z + this._w * this._w); - }; + } - _proto.normalize = function normalize() { - var l = this.length(); + normalize() { + let l = this.length(); if (l === 0) { this._x = 0; @@ -3226,31 +2978,31 @@ this._onChangeCallback(); return this; - }; + } - _proto.multiply = function multiply(q, p) { + 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); - }; + } - _proto.premultiply = function premultiply(q) { + premultiply(q) { return this.multiplyQuaternions(q, this); - }; + } - _proto.multiplyQuaternions = function multiplyQuaternions(a, b) { + multiplyQuaternions(a, b) { // from http://www.euclideanspace.com/maths/algebra/realNormedAlgebra/quaternions/code/index.htm - 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; + 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; 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; @@ -3259,17 +3011,17 @@ this._onChangeCallback(); return this; - }; + } - _proto.slerp = function slerp(qb, t) { + slerp(qb, t) { if (t === 0) return this; if (t === 1) return this.copy(qb); - var x = this._x, - y = this._y, - z = this._z, - w = this._w; // http://www.euclideanspace.com/maths/algebra/realNormedAlgebra/quaternions/slerp/ + const x = this._x, + y = this._y, + z = this._z, + w = this._w; // http://www.euclideanspace.com/maths/algebra/realNormedAlgebra/quaternions/slerp/ - var cosHalfTheta = w * qb._w + x * qb._x + y * qb._y + z * qb._z; + let cosHalfTheta = w * qb._w + x * qb._x + y * qb._y + z * qb._z; if (cosHalfTheta < 0) { this._w = -qb._w; @@ -3289,10 +3041,10 @@ return this; } - var sqrSinHalfTheta = 1.0 - cosHalfTheta * cosHalfTheta; + const sqrSinHalfTheta = 1.0 - cosHalfTheta * cosHalfTheta; if (sqrSinHalfTheta <= Number.EPSILON) { - var s = 1 - t; + const s = 1 - t; this._w = s * w + t * this._w; this._x = s * x + t * this._x; this._y = s * y + t * this._y; @@ -3304,10 +3056,10 @@ return this; } - 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; + 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; this._w = w * ratioA + this._w * ratioB; this._x = x * ratioA + this._x * ratioB; this._y = y * ratioA + this._y * ratioB; @@ -3316,17 +3068,13 @@ this._onChangeCallback(); return this; - }; + } - _proto.equals = function equals(quaternion) { + 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]; @@ -3335,139 +3083,74 @@ 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; - }; + } - _proto.fromBufferAttribute = function fromBufferAttribute(attribute, index) { + 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; - }; + } - _proto._onChange = function _onChange(callback) { + _onChange(callback) { this._onChangeCallback = callback; return this; - }; - - _proto._onChangeCallback = function _onChangeCallback() {}; - - _createClass(Quaternion, [{ - 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: "w", - get: function get() { - return this._w; - }, - set: function set(value) { - this._w = value; + } - this._onChangeCallback(); - } - }]); + _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; } - var _proto = Vector3.prototype; - - _proto.set = function set(x, y, z) { + 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; - }; + } - _proto.setScalar = function setScalar(scalar) { + setScalar(scalar) { this.x = scalar; this.y = scalar; this.z = scalar; return this; - }; + } - _proto.setX = function setX(x) { + setX(x) { this.x = x; return this; - }; + } - _proto.setY = function setY(y) { + setY(y) { this.y = y; return this; - }; + } - _proto.setZ = function setZ(z) { + setZ(z) { this.z = z; return this; - }; + } - _proto.setComponent = function setComponent(index, value) { + setComponent(index, value) { switch (index) { case 0: this.x = value; @@ -3486,9 +3169,9 @@ } return this; - }; + } - _proto.getComponent = function getComponent(index) { + getComponent(index) { switch (index) { case 0: return this.x; @@ -3502,20 +3185,20 @@ default: throw new Error('index is out of range: ' + index); } - }; + } - _proto.clone = function clone() { + clone() { return new this.constructor(this.x, this.y, this.z); - }; + } - _proto.copy = function copy(v) { + copy(v) { this.x = v.x; this.y = v.y; this.z = v.z; return this; - }; + } - _proto.add = function add(v, w) { + 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); @@ -3525,30 +3208,30 @@ this.y += v.y; this.z += v.z; return this; - }; + } - _proto.addScalar = function addScalar(s) { + addScalar(s) { this.x += s; this.y += s; this.z += s; return this; - }; + } - _proto.addVectors = function addVectors(a, b) { + addVectors(a, b) { this.x = a.x + b.x; this.y = a.y + b.y; this.z = a.z + b.z; return this; - }; + } - _proto.addScaledVector = function addScaledVector(v, s) { + addScaledVector(v, s) { this.x += v.x * s; this.y += v.y * s; this.z += v.z * s; return this; - }; + } - _proto.sub = function sub(v, w) { + 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); @@ -3558,23 +3241,23 @@ this.y -= v.y; this.z -= v.z; return this; - }; + } - _proto.subScalar = function subScalar(s) { + subScalar(s) { this.x -= s; this.y -= s; this.z -= s; return this; - }; + } - _proto.subVectors = function subVectors(a, b) { + subVectors(a, b) { this.x = a.x - b.x; this.y = a.y - b.y; this.z = a.z - b.z; return this; - }; + } - _proto.multiply = function multiply(v, w) { + 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); @@ -3584,365 +3267,353 @@ this.y *= v.y; this.z *= v.z; return this; - }; + } - _proto.multiplyScalar = function multiplyScalar(scalar) { + multiplyScalar(scalar) { this.x *= scalar; this.y *= scalar; this.z *= scalar; return this; - }; + } - _proto.multiplyVectors = function multiplyVectors(a, b) { + multiplyVectors(a, b) { this.x = a.x * b.x; this.y = a.y * b.y; this.z = a.z * b.z; return this; - }; + } - _proto.applyEuler = function applyEuler(euler) { + 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.setFromEuler(euler)); - }; + } - _proto.applyAxisAngle = function applyAxisAngle(axis, angle) { + applyAxisAngle(axis, angle) { return this.applyQuaternion(_quaternion.setFromAxisAngle(axis, angle)); - }; + } - _proto.applyMatrix3 = function applyMatrix3(m) { - var x = this.x, - y = this.y, - z = this.z; - var e = m.elements; + applyMatrix3(m) { + const x = this.x, + y = this.y, + z = this.z; + const e = m.elements; this.x = e[0] * x + e[3] * y + e[6] * z; this.y = e[1] * x + e[4] * y + e[7] * z; this.z = e[2] * x + e[5] * y + e[8] * z; return this; - }; + } - _proto.applyNormalMatrix = function applyNormalMatrix(m) { + applyNormalMatrix(m) { return this.applyMatrix3(m).normalize(); - }; + } - _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]); + 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]); 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; - }; + } - _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 + 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 - 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 + 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 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; - }; + } - _proto.project = function project(camera) { + project(camera) { return this.applyMatrix4(camera.matrixWorldInverse).applyMatrix4(camera.projectionMatrix); - }; + } - _proto.unproject = function unproject(camera) { + unproject(camera) { return this.applyMatrix4(camera.projectionMatrixInverse).applyMatrix4(camera.matrixWorld); - }; + } - _proto.transformDirection = function transformDirection(m) { + transformDirection(m) { // input: THREE.Matrix4 affine matrix // vector interpreted as a direction - var x = this.x, - y = this.y, - z = this.z; - var e = m.elements; + const x = this.x, + y = this.y, + z = this.z; + const e = m.elements; this.x = e[0] * x + e[4] * y + e[8] * z; this.y = e[1] * x + e[5] * y + e[9] * z; this.z = e[2] * x + e[6] * y + e[10] * z; return this.normalize(); - }; + } - _proto.divide = function divide(v) { + divide(v) { this.x /= v.x; this.y /= v.y; this.z /= v.z; return this; - }; + } - _proto.divideScalar = function divideScalar(scalar) { + divideScalar(scalar) { return this.multiplyScalar(1 / scalar); - }; + } - _proto.min = function min(v) { + 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; - }; + } - _proto.max = function max(v) { + 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; - }; + } - _proto.clamp = function clamp(min, max) { + 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; - }; + } - _proto.clampScalar = function clampScalar(minVal, maxVal) { + 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; - }; + } - _proto.clampLength = function clampLength(min, max) { - var length = this.length(); + clampLength(min, max) { + const length = this.length(); return this.divideScalar(length || 1).multiplyScalar(Math.max(min, Math.min(max, length))); - }; + } - _proto.floor = function floor() { + floor() { this.x = Math.floor(this.x); this.y = Math.floor(this.y); this.z = Math.floor(this.z); return this; - }; + } - _proto.ceil = function ceil() { + ceil() { this.x = Math.ceil(this.x); this.y = Math.ceil(this.y); this.z = Math.ceil(this.z); return this; - }; + } - _proto.round = function round() { + round() { this.x = Math.round(this.x); this.y = Math.round(this.y); this.z = Math.round(this.z); return this; - }; + } - _proto.roundToZero = function roundToZero() { + 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; - }; + } - _proto.negate = function negate() { + negate() { this.x = -this.x; this.y = -this.y; this.z = -this.z; return this; - }; + } - _proto.dot = function dot(v) { + dot(v) { return this.x * v.x + this.y * v.y + this.z * v.z; } // TODO lengthSquared? - ; - _proto.lengthSq = function lengthSq() { + + lengthSq() { return this.x * this.x + this.y * this.y + this.z * this.z; - }; + } - _proto.length = function length() { + length() { return Math.sqrt(this.x * this.x + this.y * this.y + this.z * this.z); - }; + } - _proto.manhattanLength = function manhattanLength() { + manhattanLength() { return Math.abs(this.x) + Math.abs(this.y) + Math.abs(this.z); - }; + } - _proto.normalize = function normalize() { + normalize() { return this.divideScalar(this.length() || 1); - }; + } - _proto.setLength = function setLength(length) { + setLength(length) { return this.normalize().multiplyScalar(length); - }; + } - _proto.lerp = function lerp(v, alpha) { + 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; - }; + } - _proto.lerpVectors = function lerpVectors(v1, v2, alpha) { + 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; - }; + } - _proto.cross = function cross(v, w) { + 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); - }; + } - _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; + crossVectors(a, b) { + const ax = a.x, + ay = a.y, + az = a.z; + const 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; - }; + } - _proto.projectOnVector = function projectOnVector(v) { - var denominator = v.lengthSq(); + projectOnVector(v) { + const denominator = v.lengthSq(); if (denominator === 0) return this.set(0, 0, 0); - var scalar = v.dot(this) / denominator; + const scalar = v.dot(this) / denominator; return this.copy(v).multiplyScalar(scalar); - }; + } - _proto.projectOnPlane = function projectOnPlane(planeNormal) { + projectOnPlane(planeNormal) { _vector.copy(this).projectOnVector(planeNormal); return this.sub(_vector); - }; + } - _proto.reflect = function reflect(normal) { + reflect(normal) { // reflect incident vector off plane orthogonal to normal // normal is assumed to have unit length return this.sub(_vector.copy(normal).multiplyScalar(2 * this.dot(normal))); - }; + } - _proto.angleTo = function angleTo(v) { - var denominator = Math.sqrt(this.lengthSq() * v.lengthSq()); + angleTo(v) { + const denominator = Math.sqrt(this.lengthSq() * v.lengthSq()); if (denominator === 0) return Math.PI / 2; - var theta = this.dot(v) / denominator; // clamp, to handle numerical problems + const theta = this.dot(v) / denominator; // clamp, to handle numerical problems return Math.acos(MathUtils.clamp(theta, -1, 1)); - }; + } - _proto.distanceTo = function distanceTo(v) { + distanceTo(v) { return Math.sqrt(this.distanceToSquared(v)); - }; + } - _proto.distanceToSquared = function distanceToSquared(v) { - var dx = this.x - v.x, - dy = this.y - v.y, - dz = this.z - v.z; + distanceToSquared(v) { + const dx = this.x - v.x, + dy = this.y - v.y, + dz = this.z - v.z; return dx * dx + dy * dy + dz * dz; - }; + } - _proto.manhattanDistanceTo = function manhattanDistanceTo(v) { + manhattanDistanceTo(v) { return Math.abs(this.x - v.x) + Math.abs(this.y - v.y) + Math.abs(this.z - v.z); - }; + } - _proto.setFromSpherical = function setFromSpherical(s) { + setFromSpherical(s) { return this.setFromSphericalCoords(s.radius, s.phi, s.theta); - }; + } - _proto.setFromSphericalCoords = function setFromSphericalCoords(radius, phi, theta) { - var sinPhiRadius = Math.sin(phi) * radius; + setFromSphericalCoords(radius, phi, theta) { + const 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; - }; + } - _proto.setFromCylindrical = function setFromCylindrical(c) { + setFromCylindrical(c) { return this.setFromCylindricalCoords(c.radius, c.theta, c.y); - }; + } - _proto.setFromCylindricalCoords = function setFromCylindricalCoords(radius, theta, y) { + setFromCylindricalCoords(radius, theta, y) { this.x = radius * Math.sin(theta); this.y = y; this.z = radius * Math.cos(theta); return this; - }; + } - _proto.setFromMatrixPosition = function setFromMatrixPosition(m) { - var e = m.elements; + setFromMatrixPosition(m) { + const e = m.elements; this.x = e[12]; this.y = e[13]; this.z = e[14]; return this; - }; + } - _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(); + setFromMatrixScale(m) { + const sx = this.setFromMatrixColumn(m, 0).length(); + const sy = this.setFromMatrixColumn(m, 1).length(); + const sz = this.setFromMatrixColumn(m, 2).length(); this.x = sx; this.y = sy; this.z = sz; return this; - }; + } - _proto.setFromMatrixColumn = function setFromMatrixColumn(m, index) { + setFromMatrixColumn(m, index) { return this.fromArray(m.elements, index * 4); - }; + } - _proto.setFromMatrix3Column = function setFromMatrix3Column(m, index) { + setFromMatrix3Column(m, index) { return this.fromArray(m.elements, index * 3); - }; + } - _proto.equals = function equals(v) { + 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; - }; + } - _proto.fromBufferAttribute = function fromBufferAttribute(attribute, index, offset) { + fromBufferAttribute(attribute, index, offset) { if (offset !== undefined) { console.warn('THREE.Vector3: offset has been removed from .fromBufferAttribute().'); } @@ -3951,58 +3622,47 @@ this.y = attribute.getY(index); this.z = attribute.getZ(index); return this; - }; + } - _proto.random = function random() { + random() { this.x = Math.random(); this.y = Math.random(); this.z = Math.random(); return this; - }; + } - return Vector3; - }(); + } Vector3.prototype.isVector3 = true; - var _vector = /*@__PURE__*/new Vector3(); - - var _quaternion = /*@__PURE__*/new Quaternion(); + const _vector = /*@__PURE__*/new Vector3(); - 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); - } + const _quaternion = /*@__PURE__*/new Quaternion(); + class Box3 { + constructor(min = new Vector3(+Infinity, +Infinity, +Infinity), max = new Vector3(-Infinity, -Infinity, -Infinity)) { this.min = min; this.max = max; } - var _proto = Box3.prototype; - - _proto.set = function set(min, max) { + set(min, max) { this.min.copy(min); this.max.copy(max); return this; - }; + } - _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]; + 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]; if (x < minX) minX = x; if (y < minY) minY = y; if (z < minZ) minZ = z; @@ -4014,20 +3674,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; - _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); + 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); if (x < minX) minX = x; if (y < minY) minY = y; if (z < minZ) minZ = z; @@ -4039,93 +3699,93 @@ this.min.set(minX, minY, minZ); this.max.set(maxX, maxY, maxZ); return this; - }; + } - _proto.setFromPoints = function setFromPoints(points) { + setFromPoints(points) { this.makeEmpty(); - for (var i = 0, il = points.length; i < il; i++) { + for (let i = 0, il = points.length; i < il; i++) { this.expandByPoint(points[i]); } return this; - }; + } - _proto.setFromCenterAndSize = function setFromCenterAndSize(center, size) { - var halfSize = _vector$1.copy(size).multiplyScalar(0.5); + setFromCenterAndSize(center, size) { + const halfSize = _vector$1.copy(size).multiplyScalar(0.5); this.min.copy(center).sub(halfSize); this.max.copy(center).add(halfSize); return this; - }; + } - _proto.setFromObject = function setFromObject(object) { + setFromObject(object) { this.makeEmpty(); return this.expandByObject(object); - }; + } - _proto.clone = function clone() { + clone() { return new this.constructor().copy(this); - }; + } - _proto.copy = function copy(box) { + copy(box) { this.min.copy(box.min); this.max.copy(box.max); return this; - }; + } - _proto.makeEmpty = function makeEmpty() { + makeEmpty() { this.min.x = this.min.y = this.min.z = +Infinity; this.max.x = this.max.y = this.max.z = -Infinity; return this; - }; + } - _proto.isEmpty = function isEmpty() { + 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; - }; + } - _proto.getCenter = function getCenter(target) { + 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); - }; + } - _proto.getSize = function getSize(target) { + 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); - }; + } - _proto.expandByPoint = function expandByPoint(point) { + expandByPoint(point) { this.min.min(point); this.max.max(point); return this; - }; + } - _proto.expandByVector = function expandByVector(vector) { + expandByVector(vector) { this.min.sub(vector); this.max.add(vector); return this; - }; + } - _proto.expandByScalar = function expandByScalar(scalar) { + expandByScalar(scalar) { this.min.addScalar(-scalar); this.max.addScalar(scalar); return this; - }; + } - _proto.expandByObject = function expandByObject(object) { + 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); - var geometry = object.geometry; + const geometry = object.geometry; if (geometry !== undefined) { if (geometry.boundingBox === null) { @@ -4139,24 +3799,24 @@ this.union(_box); } - var children = object.children; + const children = object.children; - for (var i = 0, l = children.length; i < l; i++) { + for (let i = 0, l = children.length; i < l; i++) { this.expandByObject(children[i]); } return this; - }; + } - _proto.containsPoint = function containsPoint(point) { + 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; - }; + } - _proto.containsBox = function containsBox(box) { + 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; - }; + } - _proto.getParameter = function getParameter(point, target) { + getParameter(point, target) { // This can potentially have a divide by zero if the box // has a size dimension of 0. if (target === undefined) { @@ -4165,24 +3825,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)); - }; + } - _proto.intersectsBox = function intersectsBox(box) { + 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; - }; + } - _proto.intersectsSphere = function intersectsSphere(sphere) { + intersectsSphere(sphere) { // Find the point on the AABB closest to the sphere center. this.clampPoint(sphere.center, _vector$1); // If that point is inside the sphere, the AABB and sphere intersect. return _vector$1.distanceToSquared(sphere.center) <= sphere.radius * sphere.radius; - }; + } - _proto.intersectsPlane = function intersectsPlane(plane) { + 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. - var min, max; + let min, max; if (plane.normal.x > 0) { min = plane.normal.x * this.min.x; @@ -4209,9 +3869,9 @@ } return min <= -plane.constant && max >= -plane.constant; - }; + } - _proto.intersectsTriangle = function intersectsTriangle(triangle) { + intersectsTriangle(triangle) { if (this.isEmpty()) { return false; } // compute box center and extents @@ -4238,7 +3898,7 @@ // axis_ij = u_i x f_j (u0, u1, u2 = face normals of aabb = x,y,z axes vectors since aabb is axis aligned) - 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]; + let axes = [0, -_f0.z, _f0.y, 0, -_f1.z, _f1.y, 0, -_f2.z, _f2.y, _f0.z, 0, -_f0.x, _f1.z, 0, -_f1.x, _f2.z, 0, -_f2.x, -_f0.y, _f0.x, 0, -_f1.y, _f1.x, 0, -_f2.y, _f2.x, 0]; if (!satForAxes(axes, _v0, _v1, _v2, _extents)) { return false; @@ -4257,24 +3917,24 @@ axes = [_triangleNormal.x, _triangleNormal.y, _triangleNormal.z]; return satForAxes(axes, _v0, _v1, _v2, _extents); - }; + } - _proto.clampPoint = function clampPoint(point, target) { + 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); - }; + } - _proto.distanceToPoint = function distanceToPoint(point) { - var clampedPoint = _vector$1.copy(point).clamp(this.min, this.max); + distanceToPoint(point) { + const clampedPoint = _vector$1.copy(point).clamp(this.min, this.max); return clampedPoint.sub(point).length(); - }; + } - _proto.getBoundingSphere = function getBoundingSphere(target) { + getBoundingSphere(target) { if (target === undefined) { console.error('THREE.Box3: .getBoundingSphere() target is now required'); //target = new Sphere(); // removed to avoid cyclic dependency } @@ -4282,23 +3942,23 @@ this.getCenter(target.center); target.radius = this.getSize(_vector$1).length() * 0.5; return target; - }; + } - _proto.intersect = function intersect(box) { + 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; - }; + } - _proto.union = function union(box) { + union(box) { this.min.min(box.min); this.max.max(box.max); return this; - }; + } - _proto.applyMatrix4 = function applyMatrix4(matrix) { + 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 @@ -4328,60 +3988,59 @@ this.setFromPoints(_points); return this; - }; + } - _proto.translate = function translate(offset) { + translate(offset) { this.min.add(offset); this.max.add(offset); return this; - }; + } - _proto.equals = function equals(box) { + equals(box) { return box.min.equals(this.min) && box.max.equals(this.max); - }; + } - return Box3; - }(); + } Box3.prototype.isBox3 = true; - 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 _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 _vector$1 = /*@__PURE__*/new Vector3(); + const _vector$1 = /*@__PURE__*/new Vector3(); - var _box = /*@__PURE__*/new Box3(); // triangle centered vertices + const _box = /*@__PURE__*/new Box3(); // triangle centered vertices - var _v0 = /*@__PURE__*/new Vector3(); + const _v0 = /*@__PURE__*/new Vector3(); - var _v1 = /*@__PURE__*/new Vector3(); + const _v1 = /*@__PURE__*/new Vector3(); - var _v2 = /*@__PURE__*/new Vector3(); // triangle edge vectors + const _v2 = /*@__PURE__*/new Vector3(); // triangle edge vectors - var _f0 = /*@__PURE__*/new Vector3(); + const _f0 = /*@__PURE__*/new Vector3(); - var _f1 = /*@__PURE__*/new Vector3(); + const _f1 = /*@__PURE__*/new Vector3(); - var _f2 = /*@__PURE__*/new Vector3(); + const _f2 = /*@__PURE__*/new Vector3(); - var _center = /*@__PURE__*/new Vector3(); + const _center = /*@__PURE__*/new Vector3(); - var _extents = /*@__PURE__*/new Vector3(); + const _extents = /*@__PURE__*/new Vector3(); - var _triangleNormal = /*@__PURE__*/new Vector3(); + const _triangleNormal = /*@__PURE__*/new Vector3(); - var _testAxis = /*@__PURE__*/new Vector3(); + const _testAxis = /*@__PURE__*/new Vector3(); function satForAxes(axes, v0, v1, v2, extents) { - for (var i = 0, j = axes.length - 3; i <= j; i += 3) { + for (let i = 0, j = axes.length - 3; i <= j; i += 3) { _testAxis.fromArray(axes, i); // project the aabb 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 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 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 + 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 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 @@ -4393,32 +4052,22 @@ return true; } - var _box$1 = /*@__PURE__*/new Box3(); - - var Sphere = /*#__PURE__*/function () { - function Sphere(center, radius) { - if (center === void 0) { - center = new Vector3(); - } - - if (radius === void 0) { - radius = -1; - } + const _box$1 = /*@__PURE__*/new Box3(); + class Sphere { + constructor(center = new Vector3(), radius = -1) { this.center = center; this.radius = radius; } - var _proto = Sphere.prototype; - - _proto.set = function set(center, radius) { + set(center, radius) { this.center.copy(center); this.radius = radius; return this; - }; + } - _proto.setFromPoints = function setFromPoints(points, optionalCenter) { - var center = this.center; + setFromPoints(points, optionalCenter) { + const center = this.center; if (optionalCenter !== undefined) { center.copy(optionalCenter); @@ -4426,55 +4075,55 @@ _box$1.setFromPoints(points).getCenter(center); } - var maxRadiusSq = 0; + let maxRadiusSq = 0; - for (var i = 0, il = points.length; i < il; i++) { + for (let i = 0, il = points.length; i < il; i++) { maxRadiusSq = Math.max(maxRadiusSq, center.distanceToSquared(points[i])); } this.radius = Math.sqrt(maxRadiusSq); return this; - }; + } - _proto.copy = function copy(sphere) { + copy(sphere) { this.center.copy(sphere.center); this.radius = sphere.radius; return this; - }; + } - _proto.isEmpty = function isEmpty() { + isEmpty() { return this.radius < 0; - }; + } - _proto.makeEmpty = function makeEmpty() { + makeEmpty() { this.center.set(0, 0, 0); this.radius = -1; return this; - }; + } - _proto.containsPoint = function containsPoint(point) { + containsPoint(point) { return point.distanceToSquared(this.center) <= this.radius * this.radius; - }; + } - _proto.distanceToPoint = function distanceToPoint(point) { + distanceToPoint(point) { return point.distanceTo(this.center) - this.radius; - }; + } - _proto.intersectsSphere = function intersectsSphere(sphere) { - var radiusSum = this.radius + sphere.radius; + intersectsSphere(sphere) { + const radiusSum = this.radius + sphere.radius; return sphere.center.distanceToSquared(this.center) <= radiusSum * radiusSum; - }; + } - _proto.intersectsBox = function intersectsBox(box) { + intersectsBox(box) { return box.intersectsSphere(this); - }; + } - _proto.intersectsPlane = function intersectsPlane(plane) { + intersectsPlane(plane) { return Math.abs(plane.distanceToPoint(this.center)) <= this.radius; - }; + } - _proto.clampPoint = function clampPoint(point, target) { - var deltaLengthSq = this.center.distanceToSquared(point); + clampPoint(point, target) { + const deltaLengthSq = this.center.distanceToSquared(point); if (target === undefined) { console.warn('THREE.Sphere: .clampPoint() target is now required'); @@ -4489,9 +4138,9 @@ } return target; - }; + } - _proto.getBoundingBox = function getBoundingBox(target) { + getBoundingBox(target) { if (target === undefined) { console.warn('THREE.Sphere: .getBoundingBox() target is now required'); target = new Box3(); @@ -4506,113 +4155,102 @@ target.set(this.center, this.center); target.expandByScalar(this.radius); return target; - }; + } - _proto.applyMatrix4 = function applyMatrix4(matrix) { + applyMatrix4(matrix) { this.center.applyMatrix4(matrix); this.radius = this.radius * matrix.getMaxScaleOnAxis(); return this; - }; + } - _proto.translate = function translate(offset) { + translate(offset) { this.center.add(offset); return this; - }; + } - _proto.equals = function equals(sphere) { + equals(sphere) { return sphere.center.equals(this.center) && sphere.radius === this.radius; - }; + } - _proto.clone = function clone() { + clone() { return new this.constructor().copy(this); - }; - - return Sphere; - }(); - - var _vector$2 = /*@__PURE__*/new Vector3(); + } - var _segCenter = /*@__PURE__*/new Vector3(); + } - var _segDir = /*@__PURE__*/new Vector3(); + const _vector$2 = /*@__PURE__*/new Vector3(); - var _diff = /*@__PURE__*/new Vector3(); + const _segCenter = /*@__PURE__*/new Vector3(); - var _edge1 = /*@__PURE__*/new Vector3(); + const _segDir = /*@__PURE__*/new Vector3(); - var _edge2 = /*@__PURE__*/new Vector3(); + const _diff = /*@__PURE__*/new Vector3(); - var _normal = /*@__PURE__*/new Vector3(); + const _edge1 = /*@__PURE__*/new Vector3(); - var Ray = /*#__PURE__*/function () { - function Ray(origin, direction) { - if (origin === void 0) { - origin = new Vector3(); - } + const _edge2 = /*@__PURE__*/new Vector3(); - if (direction === void 0) { - direction = new Vector3(0, 0, -1); - } + const _normal = /*@__PURE__*/new Vector3(); + class Ray { + constructor(origin = new Vector3(), direction = new Vector3(0, 0, -1)) { this.origin = origin; this.direction = direction; } - var _proto = Ray.prototype; - - _proto.set = function set(origin, direction) { + set(origin, direction) { this.origin.copy(origin); this.direction.copy(direction); return this; - }; + } - _proto.copy = function copy(ray) { + copy(ray) { this.origin.copy(ray.origin); this.direction.copy(ray.direction); return this; - }; + } - _proto.at = function at(t, target) { + 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); - }; + } - _proto.lookAt = function lookAt(v) { + lookAt(v) { this.direction.copy(v).sub(this.origin).normalize(); return this; - }; + } - _proto.recast = function recast(t) { + recast(t) { this.origin.copy(this.at(t, _vector$2)); return this; - }; + } - _proto.closestPointToPoint = function closestPointToPoint(point, target) { + closestPointToPoint(point, target) { if (target === undefined) { console.warn('THREE.Ray: .closestPointToPoint() target is now required'); target = new Vector3(); } target.subVectors(point, this.origin); - var directionDistance = target.dot(this.direction); + const directionDistance = target.dot(this.direction); if (directionDistance < 0) { return target.copy(this.origin); } return target.copy(this.direction).multiplyScalar(directionDistance).add(this.origin); - }; + } - _proto.distanceToPoint = function distanceToPoint(point) { + distanceToPoint(point) { return Math.sqrt(this.distanceSqToPoint(point)); - }; + } - _proto.distanceSqToPoint = function distanceSqToPoint(point) { - var directionDistance = _vector$2.subVectors(point, this.origin).dot(this.direction); // point behind the ray + distanceSqToPoint(point) { + const directionDistance = _vector$2.subVectors(point, this.origin).dot(this.direction); // point behind the ray if (directionDistance < 0) { @@ -4622,9 +4260,9 @@ _vector$2.copy(this.direction).multiplyScalar(directionDistance).add(this.origin); return _vector$2.distanceToSquared(point); - }; + } - _proto.distanceSqToSegment = function distanceSqToSegment(v0, v1, optionalPointOnRay, optionalPointOnSegment) { + 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 @@ -4637,17 +4275,17 @@ _diff.copy(this.origin).sub(_segCenter); - var segExtent = v0.distanceTo(v1) * 0.5; - var a01 = -this.direction.dot(_segDir); + const segExtent = v0.distanceTo(v1) * 0.5; + const a01 = -this.direction.dot(_segDir); - var b0 = _diff.dot(this.direction); + const b0 = _diff.dot(this.direction); - var b1 = -_diff.dot(_segDir); + const b1 = -_diff.dot(_segDir); - var c = _diff.lengthSq(); + const c = _diff.lengthSq(); - var det = Math.abs(1 - a01 * a01); - var s0, s1, sqrDist, extDet; + const det = Math.abs(1 - a01 * a01); + let s0, s1, sqrDist, extDet; if (det > 0) { // The ray and segment are not parallel. @@ -4660,7 +4298,7 @@ if (s1 <= extDet) { // region 0 // Minimum at interior points of ray and segment. - var invDet = 1 / det; + const invDet = 1 / det; s0 *= invDet; s1 *= invDet; sqrDist = s0 * (s0 + a01 * s1 + 2 * b0) + s1 * (a01 * s0 + s1 + 2 * b1) + c; @@ -4710,21 +4348,21 @@ } return sqrDist; - }; + } - _proto.intersectSphere = function intersectSphere(sphere, target) { + intersectSphere(sphere, target) { _vector$2.subVectors(sphere.center, this.origin); - var tca = _vector$2.dot(this.direction); + const tca = _vector$2.dot(this.direction); - var d2 = _vector$2.dot(_vector$2) - tca * tca; - var radius2 = sphere.radius * sphere.radius; + const d2 = _vector$2.dot(_vector$2) - tca * tca; + const radius2 = sphere.radius * sphere.radius; if (d2 > radius2) return null; - var thc = Math.sqrt(radius2 - d2); // t0 = first intersect point - entrance on front of sphere + const thc = Math.sqrt(radius2 - d2); // t0 = first intersect point - entrance on front of sphere - var t0 = tca - thc; // t1 = second intersect point - exit point on back of sphere + const t0 = tca - thc; // t1 = second intersect point - exit point on back of sphere - var t1 = tca + thc; // test to see if both t0 and t1 are behind the ray - if so, return null + const 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, @@ -4733,14 +4371,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); - }; + } - _proto.intersectsSphere = function intersectsSphere(sphere) { + intersectsSphere(sphere) { return this.distanceSqToPoint(sphere.center) <= sphere.radius * sphere.radius; - }; + } - _proto.distanceToPlane = function distanceToPlane(plane) { - var denominator = plane.normal.dot(this.direction); + distanceToPlane(plane) { + const denominator = plane.normal.dot(this.direction); if (denominator === 0) { // line is coplanar, return origin @@ -4752,30 +4390,30 @@ return null; } - var t = -(this.origin.dot(plane.normal) + plane.constant) / denominator; // Return if the ray never intersects the plane + const t = -(this.origin.dot(plane.normal) + plane.constant) / denominator; // Return if the ray never intersects the plane return t >= 0 ? t : null; - }; + } - _proto.intersectPlane = function intersectPlane(plane, target) { - var t = this.distanceToPlane(plane); + intersectPlane(plane, target) { + const t = this.distanceToPlane(plane); if (t === null) { return null; } return this.at(t, target); - }; + } - _proto.intersectsPlane = function intersectsPlane(plane) { + intersectsPlane(plane) { // check if the ray lies on the plane first - var distToPoint = plane.distanceToPoint(this.origin); + const distToPoint = plane.distanceToPoint(this.origin); if (distToPoint === 0) { return true; } - var denominator = plane.normal.dot(this.direction); + const denominator = plane.normal.dot(this.direction); if (denominator * distToPoint < 0) { return true; @@ -4783,14 +4421,14 @@ return false; - }; + } - _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; + 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; if (invdirx >= 0) { tmin = (box.min.x - origin.x) * invdirx; @@ -4828,13 +4466,13 @@ if (tmax < 0) return null; return this.at(tmin >= 0 ? tmin : tmax, target); - }; + } - _proto.intersectsBox = function intersectsBox(box) { + intersectsBox(box) { return this.intersectBox(box, _vector$2) !== null; - }; + } - _proto.intersectTriangle = function intersectTriangle(a, b, c, backfaceCulling, target) { + 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); @@ -4848,8 +4486,8 @@ // |Dot(D,N)|*t = -sign(Dot(D,N))*Dot(Q,N) - var DdN = this.direction.dot(_normal); - var sign; + let DdN = this.direction.dot(_normal); + let sign; if (DdN > 0) { if (backfaceCulling) return null; @@ -4863,13 +4501,13 @@ _diff.subVectors(this.origin, a); - var DdQxE2 = sign * this.direction.dot(_edge2.crossVectors(_diff, _edge2)); // b1 < 0, no intersection + const DdQxE2 = sign * this.direction.dot(_edge2.crossVectors(_diff, _edge2)); // b1 < 0, no intersection if (DdQxE2 < 0) { return null; } - var DdE1xQ = sign * this.direction.dot(_edge1.cross(_diff)); // b2 < 0, no intersection + const DdE1xQ = sign * this.direction.dot(_edge1.cross(_diff)); // b2 < 0, no intersection if (DdE1xQ < 0) { return null; @@ -4881,7 +4519,7 @@ } // Line intersects triangle, check if ray does. - var QdN = -sign * _diff.dot(_normal); // t < 0, no intersection + const QdN = -sign * _diff.dot(_normal); // t < 0, no intersection if (QdN < 0) { @@ -4890,27 +4528,26 @@ return this.at(QdN / DdN, target); - }; + } - _proto.applyMatrix4 = function applyMatrix4(matrix4) { + applyMatrix4(matrix4) { this.origin.applyMatrix4(matrix4); this.direction.transformDirection(matrix4); return this; - }; + } - _proto.equals = function equals(ray) { + equals(ray) { return ray.origin.equals(this.origin) && ray.direction.equals(this.direction); - }; + } - _proto.clone = function clone() { + clone() { return new this.constructor().copy(this); - }; + } - return Ray; - }(); + } - var Matrix4 = /*#__PURE__*/function () { - function Matrix4() { + class Matrix4 { + constructor() { this.elements = [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1]; if (arguments.length > 0) { @@ -4918,10 +4555,8 @@ } } - 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; + set(n11, n12, n13, n14, n21, n22, n23, n24, n31, n32, n33, n34, n41, n42, n43, n44) { + const te = this.elements; te[0] = n11; te[4] = n12; te[8] = n13; @@ -4939,20 +4574,20 @@ te[11] = n43; te[15] = n44; return this; - }; + } - _proto.identity = function identity() { + identity() { this.set(1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1); return this; - }; + } - _proto.clone = function clone() { + clone() { return new Matrix4().fromArray(this.elements); - }; + } - _proto.copy = function copy(m) { - var te = this.elements; - var me = m.elements; + copy(m) { + const te = this.elements; + const me = m.elements; te[0] = me[0]; te[1] = me[1]; te[2] = me[2]; @@ -4970,45 +4605,45 @@ te[14] = me[14]; te[15] = me[15]; return this; - }; + } - _proto.copyPosition = function copyPosition(m) { - var te = this.elements, - me = m.elements; + copyPosition(m) { + const te = this.elements, + me = m.elements; te[12] = me[12]; te[13] = me[13]; te[14] = me[14]; return this; - }; + } - _proto.setFromMatrix3 = function setFromMatrix3(m) { - var me = m.elements; + setFromMatrix3(m) { + const me = m.elements; this.set(me[0], me[3], me[6], 0, me[1], me[4], me[7], 0, me[2], me[5], me[8], 0, 0, 0, 0, 1); return this; - }; + } - _proto.extractBasis = function extractBasis(xAxis, yAxis, zAxis) { + extractBasis(xAxis, yAxis, zAxis) { xAxis.setFromMatrixColumn(this, 0); yAxis.setFromMatrixColumn(this, 1); zAxis.setFromMatrixColumn(this, 2); return this; - }; + } - _proto.makeBasis = function makeBasis(xAxis, yAxis, zAxis) { + 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; - }; + } - _proto.extractRotation = function extractRotation(m) { + extractRotation(m) { // this method does not support reflection matrices - var te = this.elements; - var me = m.elements; + const te = this.elements; + const me = m.elements; - var scaleX = 1 / _v1$1.setFromMatrixColumn(m, 0).length(); + const scaleX = 1 / _v1$1.setFromMatrixColumn(m, 0).length(); - var scaleY = 1 / _v1$1.setFromMatrixColumn(m, 1).length(); + const scaleY = 1 / _v1$1.setFromMatrixColumn(m, 1).length(); - var scaleZ = 1 / _v1$1.setFromMatrixColumn(m, 2).length(); + const scaleZ = 1 / _v1$1.setFromMatrixColumn(m, 2).length(); te[0] = me[0] * scaleX; te[1] = me[1] * scaleX; @@ -5027,29 +4662,29 @@ te[14] = 0; te[15] = 1; return this; - }; + } - _proto.makeRotationFromEuler = function makeRotationFromEuler(euler) { + makeRotationFromEuler(euler) { if (!(euler && euler.isEuler)) { console.error('THREE.Matrix4: .makeRotationFromEuler() now expects a Euler rotation rather than a Vector3 and order.'); } - 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); + 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); if (euler.order === 'XYZ') { - var ae = a * e, - af = a * f, - be = b * e, - bf = b * f; + const ae = a * e, + af = a * f, + be = b * e, + bf = b * f; te[0] = c * e; te[4] = -c * f; te[8] = d; @@ -5060,10 +4695,10 @@ te[6] = be + af * d; te[10] = a * c; } else if (euler.order === 'YXZ') { - var ce = c * e, - cf = c * f, - de = d * e, - df = d * f; + const 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; @@ -5074,40 +4709,38 @@ te[6] = df + ce * b; te[10] = a * c; } else if (euler.order === 'ZXY') { - var _ce = c * e, - _cf = c * f, - _de = d * e, - _df = d * f; - - te[0] = _ce - _df * b; + const 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') { - var _ae = a * e, - _af = a * f, - _be = b * e, - _bf = b * f; - + const 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') { - var ac = a * c, - ad = a * d, - bc = b * c, - bd = b * d; + const 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; @@ -5118,20 +4751,19 @@ te[6] = ad * f + bc; te[10] = ac - bd * f; } else if (euler.order === 'XZY') { - var _ac = a * c, - _ad = a * d, - _bc = b * c, - _bd = b * d; - + const 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 @@ -5144,14 +4776,14 @@ te[14] = 0; te[15] = 1; return this; - }; + } - _proto.makeRotationFromQuaternion = function makeRotationFromQuaternion(q) { + makeRotationFromQuaternion(q) { return this.compose(_zero, q, _one); - }; + } - _proto.lookAt = function lookAt(eye, target, up) { - var te = this.elements; + lookAt(eye, target, up) { + const te = this.elements; _z.subVectors(eye, target); @@ -5191,57 +4823,57 @@ te[6] = _y.z; te[10] = _z.z; return this; - }; + } - _proto.multiply = function multiply(m, n) { + 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); - }; + } - _proto.premultiply = function premultiply(m) { + premultiply(m) { return this.multiplyMatrices(m, this); - }; + } - _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]; + 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]; 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; @@ -5259,10 +4891,10 @@ te[11] = a41 * b13 + a42 * b23 + a43 * b33 + a44 * b43; te[15] = a41 * b14 + a42 * b24 + a43 * b34 + a44 * b44; return this; - }; + } - _proto.multiplyScalar = function multiplyScalar(s) { - var te = this.elements; + multiplyScalar(s) { + const te = this.elements; te[0] *= s; te[4] *= s; te[8] *= s; @@ -5280,34 +4912,34 @@ te[11] *= s; te[15] *= s; return this; - }; + } - _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 + 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 //( 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); - }; + } - _proto.transpose = function transpose() { - var te = this.elements; - var tmp; + transpose() { + const te = this.elements; + let tmp; tmp = te[1]; te[1] = te[4]; te[4] = tmp; @@ -5327,10 +4959,10 @@ te[11] = te[14]; te[14] = tmp; return this; - }; + } - _proto.setPosition = function setPosition(x, y, z) { - var te = this.elements; + setPosition(x, y, z) { + const te = this.elements; if (x.isVector3) { te[12] = x.x; @@ -5343,34 +4975,34 @@ } return this; - }; + } - _proto.invert = function invert() { + invert() { // based on http://www.euclideanspace.com/maths/algebra/matrix/functions/inverse/fourD/index.htm - 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; + 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; if (det === 0) return this.set(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0); - var detInv = 1 / det; + const 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; @@ -5388,13 +5020,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; - }; + } - _proto.scale = function scale(v) { - var te = this.elements; - var x = v.x, - y = v.y, - z = v.z; + scale(v) { + const te = this.elements; + const x = v.x, + y = v.y, + z = v.z; te[0] *= x; te[4] *= y; te[8] *= z; @@ -5408,87 +5040,87 @@ te[7] *= y; te[11] *= z; return this; - }; + } - _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]; + 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]; return Math.sqrt(Math.max(scaleXSq, scaleYSq, scaleZSq)); - }; + } - _proto.makeTranslation = function makeTranslation(x, y, z) { + makeTranslation(x, y, z) { this.set(1, 0, 0, x, 0, 1, 0, y, 0, 0, 1, z, 0, 0, 0, 1); return this; - }; + } - _proto.makeRotationX = function makeRotationX(theta) { - var c = Math.cos(theta), - s = Math.sin(theta); + makeRotationX(theta) { + const 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; - }; + } - _proto.makeRotationY = function makeRotationY(theta) { - var c = Math.cos(theta), - s = Math.sin(theta); + makeRotationY(theta) { + const 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; - }; + } - _proto.makeRotationZ = function makeRotationZ(theta) { - var c = Math.cos(theta), - s = Math.sin(theta); + makeRotationZ(theta) { + const 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; - }; + } - _proto.makeRotationAxis = function makeRotationAxis(axis, angle) { + makeRotationAxis(axis, angle) { // Based on http://www.gamedev.net/reference/articles/article1199.asp - 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; + 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; 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; - }; + } - _proto.makeScale = function makeScale(x, y, z) { + makeScale(x, y, z) { this.set(x, 0, 0, 0, 0, y, 0, 0, 0, 0, z, 0, 0, 0, 0, 1); return this; - }; + } - _proto.makeShear = function makeShear(x, y, z) { + makeShear(x, y, z) { this.set(1, y, z, 0, x, 1, z, 0, x, y, 1, 0, 0, 0, 0, 1); return this; - }; + } - _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; + 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; te[0] = (1 - (yy + zz)) * sx; te[1] = (xy + wz) * sx; te[2] = (xz - wy) * sx; @@ -5506,19 +5138,19 @@ te[14] = position.z; te[15] = 1; return this; - }; + } - _proto.decompose = function decompose(position, quaternion, scale) { - var te = this.elements; + decompose(position, quaternion, scale) { + const te = this.elements; - var sx = _v1$1.set(te[0], te[1], te[2]).length(); + let sx = _v1$1.set(te[0], te[1], te[2]).length(); - var sy = _v1$1.set(te[4], te[5], te[6]).length(); + const sy = _v1$1.set(te[4], te[5], te[6]).length(); - var sz = _v1$1.set(te[8], te[9], te[10]).length(); // if determine is negative, we need to invert one scale + const sz = _v1$1.set(te[8], te[9], te[10]).length(); // if determine is negative, we need to invert one scale - var det = this.determinant(); + const det = this.determinant(); if (det < 0) sx = -sx; position.x = te[12]; position.y = te[13]; @@ -5526,9 +5158,9 @@ _m1.copy(this); - var invSX = 1 / sx; - var invSY = 1 / sy; - var invSZ = 1 / sz; + const invSX = 1 / sx; + const invSY = 1 / sy; + const invSZ = 1 / sz; _m1.elements[0] *= invSX; _m1.elements[1] *= invSX; _m1.elements[2] *= invSX; @@ -5543,20 +5175,20 @@ scale.y = sy; scale.z = sz; return this; - }; + } - _proto.makePerspective = function makePerspective(left, right, top, bottom, near, far) { + 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.'); } - 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); + 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); te[0] = x; te[4] = 0; te[8] = a; @@ -5574,16 +5206,16 @@ te[11] = -1; te[15] = 0; return this; - }; + } - _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; + 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; te[0] = 2 * w; te[4] = 0; te[8] = 0; @@ -5601,41 +5233,29 @@ te[11] = 0; te[15] = 1; return this; - }; + } - _proto.equals = function equals(matrix) { - var te = this.elements; - var me = matrix.elements; + equals(matrix) { + const te = this.elements; + const me = matrix.elements; - for (var i = 0; i < 16; i++) { + for (let i = 0; i < 16; i++) { if (te[i] !== me[i]) return false; } return true; - }; - - _proto.fromArray = function fromArray(array, offset) { - if (offset === void 0) { - offset = 0; - } + } - for (var i = 0; i < 16; i++) { + fromArray(array, offset = 0) { + for (let 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; - } + } - var te = this.elements; + toArray(array = [], offset = 0) { + const te = this.elements; array[offset] = te[0]; array[offset + 1] = te[1]; array[offset + 2] = te[2]; @@ -5653,58 +5273,79 @@ array[offset + 14] = te[14]; array[offset + 15] = te[15]; return array; - }; + } - return Matrix4; - }(); + } Matrix4.prototype.isMatrix4 = true; - var _v1$1 = /*@__PURE__*/new Vector3(); - - var _m1 = /*@__PURE__*/new Matrix4(); - - var _zero = /*@__PURE__*/new Vector3(0, 0, 0); + const _v1$1 = /*@__PURE__*/new Vector3(); - var _one = /*@__PURE__*/new Vector3(1, 1, 1); + const _m1 = /*@__PURE__*/new Matrix4(); - var _x = /*@__PURE__*/new Vector3(); + const _zero = /*@__PURE__*/new Vector3(0, 0, 0); - var _y = /*@__PURE__*/new Vector3(); + const _one = /*@__PURE__*/new Vector3(1, 1, 1); - var _z = /*@__PURE__*/new Vector3(); + const _x = /*@__PURE__*/new Vector3(); - var _matrix = /*@__PURE__*/new Matrix4(); + const _y = /*@__PURE__*/new Vector3(); - var _quaternion$1 = /*@__PURE__*/new Quaternion(); + const _z = /*@__PURE__*/new Vector3(); - var Euler = /*#__PURE__*/function () { - function Euler(x, y, z, order) { - if (x === void 0) { - x = 0; - } - - if (y === void 0) { - y = 0; - } - - if (z === void 0) { - z = 0; - } + const _matrix = /*@__PURE__*/new Matrix4(); - if (order === void 0) { - order = Euler.DefaultOrder; - } + const _quaternion$1 = /*@__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 _proto = Euler.prototype; + get x() { + return this._x; + } + + set x(value) { + this._x = value; + + this._onChangeCallback(); + } + + get y() { + return this._y; + } + + set y(value) { + this._y = value; + + this._onChangeCallback(); + } + + get z() { + return this._z; + } + + set z(value) { + this._z = value; + + this._onChangeCallback(); + } + + get order() { + return this._order; + } + + set order(value) { + this._order = value; + + this._onChangeCallback(); + } - _proto.set = function set(x, y, z, order) { + set(x, y, z, order) { this._x = x; this._y = y; this._z = z; @@ -5713,13 +5354,13 @@ this._onChangeCallback(); return this; - }; + } - _proto.clone = function clone() { + clone() { return new this.constructor(this._x, this._y, this._z, this._order); - }; + } - _proto.copy = function copy(euler) { + copy(euler) { this._x = euler._x; this._y = euler._y; this._z = euler._z; @@ -5728,21 +5369,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) - _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]; + 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]; order = order || this._order; switch (order) { @@ -5831,30 +5472,30 @@ this._order = order; if (update !== false) this._onChangeCallback(); return this; - }; + } - _proto.setFromQuaternion = function setFromQuaternion(q, order, update) { + setFromQuaternion(q, order, update) { _matrix.makeRotationFromQuaternion(q); return this.setFromRotationMatrix(_matrix, order, update); - }; + } - _proto.setFromVector3 = function setFromVector3(v, order) { + setFromVector3(v, order) { return this.set(v.x, v.y, v.z, order || this._order); - }; + } - _proto.reorder = function reorder(newOrder) { + reorder(newOrder) { // WARNING: this discards revolution information -bhouston _quaternion$1.setFromEuler(this); return this.setFromQuaternion(_quaternion$1, newOrder); - }; + } - _proto.equals = function equals(euler) { + equals(euler) { return euler._x === this._x && euler._y === this._y && euler._z === this._z && euler._order === this._order; - }; + } - _proto.fromArray = function fromArray(array) { + fromArray(array) { this._x = array[0]; this._y = array[1]; this._z = array[2]; @@ -5863,152 +5504,98 @@ 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; - }; + } - _proto.toVector3 = function toVector3(optionalResult) { + toVector3(optionalResult) { if (optionalResult) { return optionalResult.set(this._x, this._y, this._z); } else { return new Vector3(this._x, this._y, this._z); } - }; + } - _proto._onChange = function _onChange(callback) { + _onChange(callback) { this._onChangeCallback = callback; return this; - }; - - _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(); - } - }]); + _onChangeCallback() {} - return Euler; - }(); + } Euler.prototype.isEuler = true; Euler.DefaultOrder = 'XYZ'; Euler.RotationOrders = ['XYZ', 'YZX', 'ZXY', 'XZY', 'YXZ', 'ZYX']; - var Layers = /*#__PURE__*/function () { - function Layers() { + class Layers { + constructor() { this.mask = 1 | 0; } - var _proto = Layers.prototype; - - _proto.set = function set(channel) { + set(channel) { this.mask = 1 << channel | 0; - }; + } - _proto.enable = function enable(channel) { + enable(channel) { this.mask |= 1 << channel | 0; - }; + } - _proto.enableAll = function enableAll() { + enableAll() { this.mask = 0xffffffff | 0; - }; + } - _proto.toggle = function toggle(channel) { + toggle(channel) { this.mask ^= 1 << channel | 0; - }; + } - _proto.disable = function disable(channel) { + disable(channel) { this.mask &= ~(1 << channel | 0); - }; + } - _proto.disableAll = function disableAll() { + disableAll() { this.mask = 0; - }; + } - _proto.test = function test(layers) { + test(layers) { return (this.mask & layers.mask) !== 0; - }; + } - return Layers; - }(); + } - var _object3DId = 0; + let _object3DId = 0; - var _v1$2 = new Vector3(); + const _v1$2 = new Vector3(); - var _q1 = new Quaternion(); + const _q1 = new Quaternion(); - var _m1$1 = new Matrix4(); + const _m1$1 = new Matrix4(); - var _target = new Vector3(); + const _target = new Vector3(); - var _position = new Vector3(); + const _position = new Vector3(); - var _scale = new Vector3(); + const _scale = new Vector3(); - var _quaternion$2 = new Quaternion(); + const _quaternion$2 = new Quaternion(); - var _xAxis = new Vector3(1, 0, 0); + const _xAxis = new Vector3(1, 0, 0); - var _yAxis = new Vector3(0, 1, 0); + const _yAxis = new Vector3(0, 1, 0); - var _zAxis = new Vector3(0, 0, 1); + const _zAxis = new Vector3(0, 0, 1); - var _addedEvent = { + const _addedEvent = { type: 'added' }; - var _removedEvent = { + const _removedEvent = { type: 'removed' }; @@ -6022,10 +5609,10 @@ this.parent = null; this.children = []; this.up = Object3D.DefaultUp.clone(); - var position = new Vector3(); - var rotation = new Euler(); - var quaternion = new Quaternion(); - var scale = new Vector3(1, 1, 1); + const position = new Vector3(); + const rotation = new Euler(); + const quaternion = new Quaternion(); + const scale = new Vector3(1, 1, 1); function onRotationChange() { quaternion.setFromEuler(rotation, false); @@ -6086,33 +5673,33 @@ Object3D.prototype = Object.assign(Object.create(EventDispatcher.prototype), { constructor: Object3D, isObject3D: true, - onBeforeRender: function onBeforeRender() {}, - onAfterRender: function onAfterRender() {}, - applyMatrix4: function applyMatrix4(matrix) { + onBeforeRender: function () {}, + onAfterRender: function () {}, + applyMatrix4: function (matrix) { if (this.matrixAutoUpdate) this.updateMatrix(); this.matrix.premultiply(matrix); this.matrix.decompose(this.position, this.quaternion, this.scale); }, - applyQuaternion: function applyQuaternion(q) { + applyQuaternion: function (q) { this.quaternion.premultiply(q); return this; }, - setRotationFromAxisAngle: function setRotationFromAxisAngle(axis, angle) { + setRotationFromAxisAngle: function (axis, angle) { // assumes axis is normalized this.quaternion.setFromAxisAngle(axis, angle); }, - setRotationFromEuler: function setRotationFromEuler(euler) { + setRotationFromEuler: function (euler) { this.quaternion.setFromEuler(euler, true); }, - setRotationFromMatrix: function setRotationFromMatrix(m) { + setRotationFromMatrix: function (m) { // assumes the upper 3x3 of m is a pure rotation matrix (i.e, unscaled) this.quaternion.setFromRotationMatrix(m); }, - setRotationFromQuaternion: function setRotationFromQuaternion(q) { + setRotationFromQuaternion: function (q) { // assumes q is normalized this.quaternion.copy(q); }, - rotateOnAxis: function rotateOnAxis(axis, angle) { + rotateOnAxis: function (axis, angle) { // rotate object on axis in object space // axis is assumed to be normalized _q1.setFromAxisAngle(axis, angle); @@ -6120,7 +5707,7 @@ this.quaternion.multiply(_q1); return this; }, - rotateOnWorldAxis: function rotateOnWorldAxis(axis, angle) { + rotateOnWorldAxis: function (axis, angle) { // rotate object on axis in world space // axis is assumed to be normalized // method assumes no rotated parent @@ -6129,16 +5716,16 @@ this.quaternion.premultiply(_q1); return this; }, - rotateX: function rotateX(angle) { + rotateX: function (angle) { return this.rotateOnAxis(_xAxis, angle); }, - rotateY: function rotateY(angle) { + rotateY: function (angle) { return this.rotateOnAxis(_yAxis, angle); }, - rotateZ: function rotateZ(angle) { + rotateZ: function (angle) { return this.rotateOnAxis(_zAxis, angle); }, - translateOnAxis: function translateOnAxis(axis, distance) { + translateOnAxis: function (axis, distance) { // translate object by distance along axis in object space // axis is assumed to be normalized _v1$2.copy(axis).applyQuaternion(this.quaternion); @@ -6146,22 +5733,22 @@ this.position.add(_v1$2.multiplyScalar(distance)); return this; }, - translateX: function translateX(distance) { + translateX: function (distance) { return this.translateOnAxis(_xAxis, distance); }, - translateY: function translateY(distance) { + translateY: function (distance) { return this.translateOnAxis(_yAxis, distance); }, - translateZ: function translateZ(distance) { + translateZ: function (distance) { return this.translateOnAxis(_zAxis, distance); }, - localToWorld: function localToWorld(vector) { + localToWorld: function (vector) { return vector.applyMatrix4(this.matrixWorld); }, - worldToLocal: function worldToLocal(vector) { + worldToLocal: function (vector) { return vector.applyMatrix4(_m1$1.copy(this.matrixWorld).invert()); }, - lookAt: function lookAt(x, y, z) { + lookAt: function (x, y, z) { // This method does not support objects having non-uniformly-scaled parent(s) if (x.isVector3) { _target.copy(x); @@ -6169,7 +5756,7 @@ _target.set(x, y, z); } - var parent = this.parent; + const parent = this.parent; this.updateWorldMatrix(true, false); _position.setFromMatrixPosition(this.matrixWorld); @@ -6190,9 +5777,9 @@ this.quaternion.premultiply(_q1.invert()); } }, - add: function add(object) { + add: function (object) { if (arguments.length > 1) { - for (var i = 0; i < arguments.length; i++) { + for (let i = 0; i < arguments.length; i++) { this.add(arguments[i]); } @@ -6218,16 +5805,16 @@ return this; }, - remove: function remove(object) { + remove: function (object) { if (arguments.length > 1) { - for (var i = 0; i < arguments.length; i++) { + for (let i = 0; i < arguments.length; i++) { this.remove(arguments[i]); } return this; } - var index = this.children.indexOf(object); + const index = this.children.indexOf(object); if (index !== -1) { object.parent = null; @@ -6237,9 +5824,9 @@ return this; }, - clear: function clear() { - for (var i = 0; i < this.children.length; i++) { - var object = this.children[i]; + clear: function () { + for (let i = 0; i < this.children.length; i++) { + const object = this.children[i]; object.parent = null; object.dispatchEvent(_removedEvent); } @@ -6247,7 +5834,7 @@ this.children.length = 0; return this; }, - attach: function attach(object) { + attach: function (object) { // adds object as a child of this, while maintaining the object's world transform this.updateWorldMatrix(true, false); @@ -6264,18 +5851,18 @@ object.updateWorldMatrix(false, true); return this; }, - getObjectById: function getObjectById(id) { + getObjectById: function (id) { return this.getObjectByProperty('id', id); }, - getObjectByName: function getObjectByName(name) { + getObjectByName: function (name) { return this.getObjectByProperty('name', name); }, - getObjectByProperty: function getObjectByProperty(name, value) { + getObjectByProperty: function (name, value) { if (this[name] === value) return this; - for (var i = 0, l = this.children.length; i < l; i++) { - var child = this.children[i]; - var object = child.getObjectByProperty(name, value); + for (let i = 0, l = this.children.length; i < l; i++) { + const child = this.children[i]; + const object = child.getObjectByProperty(name, value); if (object !== undefined) { return object; @@ -6284,7 +5871,7 @@ return undefined; }, - getWorldPosition: function getWorldPosition(target) { + getWorldPosition: function (target) { if (target === undefined) { console.warn('THREE.Object3D: .getWorldPosition() target is now required'); target = new Vector3(); @@ -6293,7 +5880,7 @@ this.updateWorldMatrix(true, false); return target.setFromMatrixPosition(this.matrixWorld); }, - getWorldQuaternion: function getWorldQuaternion(target) { + getWorldQuaternion: function (target) { if (target === undefined) { console.warn('THREE.Object3D: .getWorldQuaternion() target is now required'); target = new Quaternion(); @@ -6303,7 +5890,7 @@ this.matrixWorld.decompose(_position, target, _scale); return target; }, - getWorldScale: function getWorldScale(target) { + getWorldScale: function (target) { if (target === undefined) { console.warn('THREE.Object3D: .getWorldScale() target is now required'); target = new Vector3(); @@ -6313,47 +5900,47 @@ this.matrixWorld.decompose(_position, _quaternion$2, target); return target; }, - getWorldDirection: function getWorldDirection(target) { + getWorldDirection: function (target) { if (target === undefined) { console.warn('THREE.Object3D: .getWorldDirection() target is now required'); target = new Vector3(); } this.updateWorldMatrix(true, false); - var e = this.matrixWorld.elements; + const e = this.matrixWorld.elements; return target.set(e[8], e[9], e[10]).normalize(); }, - raycast: function raycast() {}, - traverse: function traverse(callback) { + raycast: function () {}, + traverse: function (callback) { callback(this); - var children = this.children; + const children = this.children; - for (var i = 0, l = children.length; i < l; i++) { + for (let i = 0, l = children.length; i < l; i++) { children[i].traverse(callback); } }, - traverseVisible: function traverseVisible(callback) { + traverseVisible: function (callback) { if (this.visible === false) return; callback(this); - var children = this.children; + const children = this.children; - for (var i = 0, l = children.length; i < l; i++) { + for (let i = 0, l = children.length; i < l; i++) { children[i].traverseVisible(callback); } }, - traverseAncestors: function traverseAncestors(callback) { - var parent = this.parent; + traverseAncestors: function (callback) { + const parent = this.parent; if (parent !== null) { callback(parent); parent.traverseAncestors(callback); } }, - updateMatrix: function updateMatrix() { + updateMatrix: function () { this.matrix.compose(this.position, this.quaternion, this.scale); this.matrixWorldNeedsUpdate = true; }, - updateMatrixWorld: function updateMatrixWorld(force) { + updateMatrixWorld: function (force) { if (this.matrixAutoUpdate) this.updateMatrix(); if (this.matrixWorldNeedsUpdate || force) { @@ -6368,14 +5955,14 @@ } // update children - var children = this.children; + const children = this.children; - for (var i = 0, l = children.length; i < l; i++) { + for (let i = 0, l = children.length; i < l; i++) { children[i].updateMatrixWorld(force); } }, - updateWorldMatrix: function updateWorldMatrix(updateParents, updateChildren) { - var parent = this.parent; + updateWorldMatrix: function (updateParents, updateChildren) { + const parent = this.parent; if (updateParents === true && parent !== null) { parent.updateWorldMatrix(true, false); @@ -6391,17 +5978,17 @@ if (updateChildren === true) { - var children = this.children; + const children = this.children; - for (var i = 0, l = children.length; i < l; i++) { + for (let i = 0, l = children.length; i < l; i++) { children[i].updateWorldMatrix(false, true); } } }, - toJSON: function toJSON(meta) { + toJSON: function (meta) { // meta is a string when called from JSON.stringify - var isRootObject = meta === undefined || typeof meta === 'string'; - var output = {}; // meta is a hash used to collect geometries, materials. + const isRootObject = meta === undefined || typeof meta === 'string'; + const output = {}; // meta is a hash used to collect geometries, materials. // not providing it implies that this is the root object // being serialized. @@ -6424,7 +6011,7 @@ } // standard Object3D serialization - var object = {}; + const object = {}; object.uuid = this.uuid; object.type = this.type; if (this.name !== '') object.name = this.name; @@ -6455,14 +6042,14 @@ if (this.isMesh || this.isLine || this.isPoints) { object.geometry = serialize(meta.geometries, this.geometry); - var parameters = this.geometry.parameters; + const parameters = this.geometry.parameters; if (parameters !== undefined && parameters.shapes !== undefined) { - var shapes = parameters.shapes; + const shapes = parameters.shapes; if (Array.isArray(shapes)) { - for (var i = 0, l = shapes.length; i < l; i++) { - var shape = shapes[i]; + for (let i = 0, l = shapes.length; i < l; i++) { + const shape = shapes[i]; serialize(meta.shapes, shape); } } else { @@ -6483,10 +6070,10 @@ if (this.material !== undefined) { if (Array.isArray(this.material)) { - var uuids = []; + const uuids = []; - for (var _i = 0, _l = this.material.length; _i < _l; _i++) { - uuids.push(serialize(meta.materials, this.material[_i])); + for (let i = 0, l = this.material.length; i < l; i++) { + uuids.push(serialize(meta.materials, this.material[i])); } object.material = uuids; @@ -6499,8 +6086,8 @@ if (this.children.length > 0) { object.children = []; - for (var _i2 = 0; _i2 < this.children.length; _i2++) { - object.children.push(this.children[_i2].toJSON(meta).object); + for (let i = 0; i < this.children.length; i++) { + object.children.push(this.children[i].toJSON(meta).object); } } // @@ -6508,27 +6095,25 @@ if (this.animations.length > 0) { object.animations = []; - for (var _i3 = 0; _i3 < this.animations.length; _i3++) { - var animation = this.animations[_i3]; + for (let i = 0; i < this.animations.length; i++) { + const animation = this.animations[i]; object.animations.push(serialize(meta.animations, animation)); } } if (isRootObject) { - 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); + 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); 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; } @@ -6539,10 +6124,10 @@ // and return as array function extractFromCache(cache) { - var values = []; + const values = []; - for (var key in cache) { - var data = cache[key]; + for (const key in cache) { + const data = cache[key]; delete data.metadata; values.push(data); } @@ -6550,14 +6135,10 @@ return values; } }, - clone: function clone(recursive) { + clone: function (recursive) { return new this.constructor().copy(this, recursive); }, - copy: function copy(source, recursive) { - if (recursive === void 0) { - recursive = true; - } - + copy: function (source, recursive = true) { this.name = source.name; this.up.copy(source.up); this.position.copy(source.position); @@ -6577,8 +6158,8 @@ this.userData = JSON.parse(JSON.stringify(source.userData)); if (recursive === true) { - for (var i = 0; i < source.children.length; i++) { - var child = source.children[i]; + for (let i = 0; i < source.children.length; i++) { + const child = source.children[i]; this.add(child.clone()); } } @@ -6587,100 +6168,90 @@ } }); - var _vector1 = /*@__PURE__*/new Vector3(); - - var _vector2 = /*@__PURE__*/new Vector3(); + const _vector1 = /*@__PURE__*/new Vector3(); - var _normalMatrix = /*@__PURE__*/new Matrix3(); - - var Plane = /*#__PURE__*/function () { - function Plane(normal, constant) { - if (normal === void 0) { - normal = new Vector3(1, 0, 0); - } + const _vector2 = /*@__PURE__*/new Vector3(); - if (constant === void 0) { - constant = 0; - } + const _normalMatrix = /*@__PURE__*/new Matrix3(); + class Plane { + constructor(normal = new Vector3(1, 0, 0), constant = 0) { // normal is assumed to be normalized this.normal = normal; this.constant = constant; } - var _proto = Plane.prototype; - - _proto.set = function set(normal, constant) { + set(normal, constant) { this.normal.copy(normal); this.constant = constant; return this; - }; + } - _proto.setComponents = function setComponents(x, y, z, w) { + setComponents(x, y, z, w) { this.normal.set(x, y, z); this.constant = w; return this; - }; + } - _proto.setFromNormalAndCoplanarPoint = function setFromNormalAndCoplanarPoint(normal, point) { + setFromNormalAndCoplanarPoint(normal, point) { this.normal.copy(normal); this.constant = -point.dot(this.normal); return this; - }; + } - _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)? + setFromCoplanarPoints(a, b, c) { + const normal = _vector1.subVectors(c, b).cross(_vector2.subVectors(a, b)).normalize(); // Q: should an error be thrown if normal is zero (e.g. degenerate plane)? this.setFromNormalAndCoplanarPoint(normal, a); return this; - }; + } - _proto.copy = function copy(plane) { + copy(plane) { this.normal.copy(plane.normal); this.constant = plane.constant; return this; - }; + } - _proto.normalize = function normalize() { + normalize() { // Note: will lead to a divide by zero if the plane is invalid. - var inverseNormalLength = 1.0 / this.normal.length(); + const inverseNormalLength = 1.0 / this.normal.length(); this.normal.multiplyScalar(inverseNormalLength); this.constant *= inverseNormalLength; return this; - }; + } - _proto.negate = function negate() { + negate() { this.constant *= -1; this.normal.negate(); return this; - }; + } - _proto.distanceToPoint = function distanceToPoint(point) { + distanceToPoint(point) { return this.normal.dot(point) + this.constant; - }; + } - _proto.distanceToSphere = function distanceToSphere(sphere) { + distanceToSphere(sphere) { return this.distanceToPoint(sphere.center) - sphere.radius; - }; + } - _proto.projectPoint = function projectPoint(point, target) { + 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); - }; + } - _proto.intersectLine = function intersectLine(line, target) { + intersectLine(line, target) { if (target === undefined) { console.warn('THREE.Plane: .intersectLine() target is now required'); target = new Vector3(); } - var direction = line.delta(_vector1); - var denominator = this.normal.dot(direction); + const direction = line.delta(_vector1); + const denominator = this.normal.dot(direction); if (denominator === 0) { // line is coplanar, return origin @@ -6692,106 +6263,93 @@ return undefined; } - var t = -(line.start.dot(this.normal) + this.constant) / denominator; + const t = -(line.start.dot(this.normal) + this.constant) / denominator; if (t < 0 || t > 1) { return undefined; } return target.copy(direction).multiplyScalar(t).add(line.start); - }; + } - _proto.intersectsLine = function intersectsLine(line) { + intersectsLine(line) { // Note: this tests if a line intersects the plane, not whether it (or its end-points) are coplanar with it. - var startSign = this.distanceToPoint(line.start); - var endSign = this.distanceToPoint(line.end); + const startSign = this.distanceToPoint(line.start); + const endSign = this.distanceToPoint(line.end); return startSign < 0 && endSign > 0 || endSign < 0 && startSign > 0; - }; + } - _proto.intersectsBox = function intersectsBox(box) { + intersectsBox(box) { return box.intersectsPlane(this); - }; + } - _proto.intersectsSphere = function intersectsSphere(sphere) { + intersectsSphere(sphere) { return sphere.intersectsPlane(this); - }; + } - _proto.coplanarPoint = function coplanarPoint(target) { + 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); - }; + } - _proto.applyMatrix4 = function applyMatrix4(matrix, optionalNormalMatrix) { - var normalMatrix = optionalNormalMatrix || _normalMatrix.getNormalMatrix(matrix); + applyMatrix4(matrix, optionalNormalMatrix) { + const normalMatrix = optionalNormalMatrix || _normalMatrix.getNormalMatrix(matrix); - var referencePoint = this.coplanarPoint(_vector1).applyMatrix4(matrix); - var normal = this.normal.applyMatrix3(normalMatrix).normalize(); + const referencePoint = this.coplanarPoint(_vector1).applyMatrix4(matrix); + const normal = this.normal.applyMatrix3(normalMatrix).normalize(); this.constant = -referencePoint.dot(normal); return this; - }; + } - _proto.translate = function translate(offset) { + translate(offset) { this.constant -= offset.dot(this.normal); return this; - }; + } - _proto.equals = function equals(plane) { + equals(plane) { return plane.normal.equals(this.normal) && plane.constant === this.constant; - }; + } - _proto.clone = function clone() { + clone() { return new this.constructor().copy(this); - }; + } - return Plane; - }(); + } Plane.prototype.isPlane = true; - var _v0$1 = /*@__PURE__*/new Vector3(); - - var _v1$3 = /*@__PURE__*/new Vector3(); - - var _v2$1 = /*@__PURE__*/new Vector3(); - - var _v3 = /*@__PURE__*/new Vector3(); + const _v0$1 = /*@__PURE__*/new Vector3(); - var _vab = /*@__PURE__*/new Vector3(); + const _v1$3 = /*@__PURE__*/new Vector3(); - var _vac = /*@__PURE__*/new Vector3(); + const _v2$1 = /*@__PURE__*/new Vector3(); - var _vbc = /*@__PURE__*/new Vector3(); + const _v3 = /*@__PURE__*/new Vector3(); - var _vap = /*@__PURE__*/new Vector3(); + const _vab = /*@__PURE__*/new Vector3(); - var _vbp = /*@__PURE__*/new Vector3(); + const _vac = /*@__PURE__*/new Vector3(); - var _vcp = /*@__PURE__*/new Vector3(); + const _vbc = /*@__PURE__*/new Vector3(); - var Triangle = /*#__PURE__*/function () { - function Triangle(a, b, c) { - if (a === void 0) { - a = new Vector3(); - } + const _vap = /*@__PURE__*/new Vector3(); - if (b === void 0) { - b = new Vector3(); - } + const _vbp = /*@__PURE__*/new Vector3(); - if (c === void 0) { - c = new Vector3(); - } + const _vcp = /*@__PURE__*/new Vector3(); + class Triangle { + constructor(a = new Vector3(), b = new Vector3(), c = new Vector3()) { this.a = a; this.b = b; this.c = c; } - Triangle.getNormal = function getNormal(a, b, c, target) { + static getNormal(a, b, c, target) { if (target === undefined) { console.warn('THREE.Triangle: .getNormal() target is now required'); target = new Vector3(); @@ -6802,7 +6360,7 @@ _v0$1.subVectors(a, b); target.cross(_v0$1); - var targetLengthSq = target.lengthSq(); + const targetLengthSq = target.lengthSq(); if (targetLengthSq > 0) { return target.multiplyScalar(1 / Math.sqrt(targetLengthSq)); @@ -6811,26 +6369,26 @@ return target.set(0, 0, 0); } // static/instance method to calculate barycentric coordinates // based on: http://www.blackpawn.com/texts/pointinpoly/default.html - ; - Triangle.getBarycoord = function getBarycoord(point, a, b, c, target) { + + static getBarycoord(point, a, b, c, target) { _v0$1.subVectors(c, a); _v1$3.subVectors(b, a); _v2$1.subVectors(point, a); - var dot00 = _v0$1.dot(_v0$1); + const dot00 = _v0$1.dot(_v0$1); - var dot01 = _v0$1.dot(_v1$3); + const dot01 = _v0$1.dot(_v1$3); - var dot02 = _v0$1.dot(_v2$1); + const dot02 = _v0$1.dot(_v2$1); - var dot11 = _v1$3.dot(_v1$3); + const dot11 = _v1$3.dot(_v1$3); - var dot12 = _v1$3.dot(_v2$1); + const dot12 = _v1$3.dot(_v2$1); - var denom = dot00 * dot11 - dot01 * dot01; + const denom = dot00 * dot11 - dot01 * dot01; if (target === undefined) { console.warn('THREE.Triangle: .getBarycoord() target is now required'); @@ -6844,123 +6402,121 @@ return target.set(-2, -1, -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 + 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 return target.set(1 - u - v, v, u); - }; + } - Triangle.containsPoint = function containsPoint(point, a, b, c) { + static containsPoint(point, a, b, c) { this.getBarycoord(point, a, b, c, _v3); return _v3.x >= 0 && _v3.y >= 0 && _v3.x + _v3.y <= 1; - }; + } - Triangle.getUV = function getUV(point, p1, p2, p3, uv1, uv2, uv3, target) { + static getUV(point, p1, p2, p3, uv1, uv2, uv3, target) { this.getBarycoord(point, p1, p2, p3, _v3); target.set(0, 0); target.addScaledVector(uv1, _v3.x); target.addScaledVector(uv2, _v3.y); target.addScaledVector(uv3, _v3.z); return target; - }; + } - Triangle.isFrontFacing = function isFrontFacing(a, b, c, direction) { + static isFrontFacing(a, b, c, direction) { _v0$1.subVectors(c, b); _v1$3.subVectors(a, b); // strictly front facing return _v0$1.cross(_v1$3).dot(direction) < 0 ? true : false; - }; - - var _proto = Triangle.prototype; + } - _proto.set = function set(a, b, c) { + set(a, b, c) { this.a.copy(a); this.b.copy(b); this.c.copy(c); return this; - }; + } - _proto.setFromPointsAndIndices = function setFromPointsAndIndices(points, i0, i1, i2) { + setFromPointsAndIndices(points, i0, i1, i2) { this.a.copy(points[i0]); this.b.copy(points[i1]); this.c.copy(points[i2]); return this; - }; + } - _proto.clone = function clone() { + clone() { return new this.constructor().copy(this); - }; + } - _proto.copy = function copy(triangle) { + copy(triangle) { this.a.copy(triangle.a); this.b.copy(triangle.b); this.c.copy(triangle.c); return this; - }; + } - _proto.getArea = function getArea() { + getArea() { _v0$1.subVectors(this.c, this.b); _v1$3.subVectors(this.a, this.b); return _v0$1.cross(_v1$3).length() * 0.5; - }; + } - _proto.getMidpoint = function getMidpoint(target) { + 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); - }; + } - _proto.getNormal = function getNormal(target) { + getNormal(target) { return Triangle.getNormal(this.a, this.b, this.c, target); - }; + } - _proto.getPlane = function getPlane(target) { + 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); - }; + } - _proto.getBarycoord = function getBarycoord(point, target) { + getBarycoord(point, target) { return Triangle.getBarycoord(point, this.a, this.b, this.c, target); - }; + } - _proto.getUV = function getUV(point, uv1, uv2, uv3, target) { + getUV(point, uv1, uv2, uv3, target) { return Triangle.getUV(point, this.a, this.b, this.c, uv1, uv2, uv3, target); - }; + } - _proto.containsPoint = function containsPoint(point) { + containsPoint(point) { return Triangle.containsPoint(point, this.a, this.b, this.c); - }; + } - _proto.isFrontFacing = function isFrontFacing(direction) { + isFrontFacing(direction) { return Triangle.isFrontFacing(this.a, this.b, this.c, direction); - }; + } - _proto.intersectsBox = function intersectsBox(box) { + intersectsBox(box) { return box.intersectsTriangle(this); - }; + } - _proto.closestPointToPoint = function closestPointToPoint(p, target) { + closestPointToPoint(p, target) { if (target === undefined) { console.warn('THREE.Triangle: .closestPointToPoint() target is now required'); target = new Vector3(); } - var a = this.a, - b = this.b, - c = this.c; - var v, w; // algorithm thanks to Real-Time Collision Detection by Christer Ericson, + const a = this.a, + b = this.b, + c = this.c; + let v, w; // algorithm thanks to Real-Time Collision Detection by Christer Ericson, // published by Morgan Kaufmann Publishers, (c) 2005 Elsevier Inc., // under the accompanying license; see chapter 5.1.5 for detailed explanation. // basically, we're distinguishing which of the voronoi regions of the triangle @@ -6972,9 +6528,9 @@ _vap.subVectors(p, a); - var d1 = _vab.dot(_vap); + const d1 = _vab.dot(_vap); - var d2 = _vac.dot(_vap); + const d2 = _vac.dot(_vap); if (d1 <= 0 && d2 <= 0) { // vertex region of A; barycentric coords (1, 0, 0) @@ -6983,16 +6539,16 @@ _vbp.subVectors(p, b); - var d3 = _vab.dot(_vbp); + const d3 = _vab.dot(_vbp); - var d4 = _vac.dot(_vbp); + const d4 = _vac.dot(_vbp); if (d3 >= 0 && d4 <= d3) { // vertex region of B; barycentric coords (0, 1, 0) return target.copy(b); } - var vc = d1 * d4 - d3 * d2; + const vc = d1 * d4 - d3 * d2; if (vc <= 0 && d1 >= 0 && d3 <= 0) { v = d1 / (d1 - d3); // edge region of AB; barycentric coords (1-v, v, 0) @@ -7002,16 +6558,16 @@ _vcp.subVectors(p, c); - var d5 = _vab.dot(_vcp); + const d5 = _vab.dot(_vcp); - var d6 = _vac.dot(_vcp); + const d6 = _vac.dot(_vcp); if (d6 >= 0 && d5 <= d6) { // vertex region of C; barycentric coords (0, 0, 1) return target.copy(c); } - var vb = d5 * d2 - d1 * d6; + const vb = d5 * d2 - d1 * d6; if (vb <= 0 && d2 >= 0 && d6 <= 0) { w = d2 / (d2 - d6); // edge region of AC; barycentric coords (1-w, 0, w) @@ -7019,7 +6575,7 @@ return target.copy(a).addScaledVector(_vac, w); } - var va = d3 * d6 - d5 * d4; + const va = d3 * d6 - d5 * d4; if (va <= 0 && d4 - d3 >= 0 && d5 - d6 >= 0) { _vbc.subVectors(c, b); @@ -7030,21 +6586,20 @@ } // face region - var denom = 1 / (va + vb + vc); // u = va * denom + const denom = 1 / (va + vb + vc); // u = va * denom v = vb * denom; w = vc * denom; return target.copy(a).addScaledVector(_vab, v).addScaledVector(_vac, w); - }; + } - _proto.equals = function equals(triangle) { + equals(triangle) { return triangle.a.equals(this.a) && triangle.b.equals(this.b) && triangle.c.equals(this.c); - }; + } - return Triangle; - }(); + } - var materialId = 0; + let materialId = 0; function Material() { Object.defineProperty(this, 'id', { @@ -7099,17 +6654,17 @@ Material.prototype = Object.assign(Object.create(EventDispatcher.prototype), { constructor: Material, isMaterial: true, - onBeforeCompile: function onBeforeCompile() + onBeforeCompile: function () /* shaderobject, renderer */ {}, - customProgramCacheKey: function customProgramCacheKey() { + customProgramCacheKey: function () { return this.onBeforeCompile.toString(); }, - setValues: function setValues(values) { + setValues: function (values) { if (values === undefined) return; - for (var key in values) { - var newValue = values[key]; + for (const key in values) { + const newValue = values[key]; if (newValue === undefined) { console.warn('THREE.Material: \'' + key + '\' parameter is undefined.'); @@ -7123,7 +6678,7 @@ continue; } - var currentValue = this[key]; + const currentValue = this[key]; if (currentValue === undefined) { console.warn('THREE.' + this.type + ': \'' + key + '\' is not a property of this material.'); @@ -7139,8 +6694,8 @@ } } }, - toJSON: function toJSON(meta) { - var isRoot = meta === undefined || typeof meta === 'string'; + toJSON: function (meta) { + const isRoot = meta === undefined || typeof meta === 'string'; if (isRoot) { meta = { @@ -7149,7 +6704,7 @@ }; } - var data = { + const data = { metadata: { version: 4.5, type: 'Material', @@ -7277,30 +6832,30 @@ if (JSON.stringify(this.userData) !== '{}') data.userData = this.userData; // TODO: Copied from Object3D.toJSON function extractFromCache(cache) { - var values = []; + const values = []; - for (var key in cache) { - var _data = cache[key]; - delete _data.metadata; - values.push(_data); + for (const key in cache) { + const data = cache[key]; + delete data.metadata; + values.push(data); } return values; } if (isRoot) { - var textures = extractFromCache(meta.textures); - var images = extractFromCache(meta.images); + const textures = extractFromCache(meta.textures); + const images = extractFromCache(meta.images); if (textures.length > 0) data.textures = textures; if (images.length > 0) data.images = images; } return data; }, - clone: function clone() { + clone: function () { return new this.constructor().copy(this); }, - copy: function copy(source) { + copy: function (source) { this.name = source.name; this.fog = source.fog; this.blending = source.blending; @@ -7325,14 +6880,14 @@ this.stencilZFail = source.stencilZFail; this.stencilZPass = source.stencilZPass; this.stencilWrite = source.stencilWrite; - var srcPlanes = source.clippingPlanes; - var dstPlanes = null; + const srcPlanes = source.clippingPlanes; + let dstPlanes = null; if (srcPlanes !== null) { - var n = srcPlanes.length; + const n = srcPlanes.length; dstPlanes = new Array(n); - for (var i = 0; i !== n; ++i) { + for (let i = 0; i !== n; ++i) { dstPlanes[i] = srcPlanes[i].clone(); } } @@ -7355,19 +6910,19 @@ this.userData = JSON.parse(JSON.stringify(source.userData)); return this; }, - dispose: function dispose() { + dispose: function () { this.dispatchEvent({ type: 'dispose' }); } }); Object.defineProperty(Material.prototype, 'needsUpdate', { - set: function set(value) { + set: function (value) { if (value === true) this.version++; } }); - var _colorKeywords = { + const _colorKeywords = { 'aliceblue': 0xF0F8FF, 'antiquewhite': 0xFAEBD7, 'aqua': 0x00FFFF, @@ -7517,12 +7072,12 @@ 'yellow': 0xFFFF00, 'yellowgreen': 0x9ACD32 }; - var _hslA = { + const _hslA = { h: 0, s: 0, l: 0 }; - var _hslB = { + const _hslB = { h: 0, s: 0, l: 0 @@ -7545,8 +7100,8 @@ return c < 0.0031308 ? c * 12.92 : 1.055 * Math.pow(c, 0.41666) - 0.055; } - var Color = /*#__PURE__*/function () { - function Color(r, g, b) { + class Color { + constructor(r, g, b) { if (g === undefined && b === undefined) { // r is THREE.Color, hex or string return this.set(r); @@ -7555,9 +7110,7 @@ return this.setRGB(r, g, b); } - var _proto = Color.prototype; - - _proto.set = function set(value) { + set(value) { if (value && value.isColor) { this.copy(value); } else if (typeof value === 'number') { @@ -7567,31 +7120,31 @@ } return this; - }; + } - _proto.setScalar = function setScalar(scalar) { + setScalar(scalar) { this.r = scalar; this.g = scalar; this.b = scalar; return this; - }; + } - _proto.setHex = function setHex(hex) { + 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; - }; + } - _proto.setRGB = function setRGB(r, g, b) { + setRGB(r, g, b) { this.r = r; this.g = g; this.b = b; return this; - }; + } - _proto.setHSL = function setHSL(h, s, l) { + 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); @@ -7600,17 +7153,17 @@ if (s === 0) { this.r = this.g = this.b = l; } else { - var p = l <= 0.5 ? l * (1 + s) : l + s - l * s; - var q = 2 * l - p; + const p = l <= 0.5 ? l * (1 + s) : l + s - l * s; + const 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; - }; + } - _proto.setStyle = function setStyle(style) { + setStyle(style) { function handleAlpha(string) { if (string === undefined) return; @@ -7619,13 +7172,13 @@ } } - var m; + let m; if (m = /^((?:rgb|hsl)a?)\(([^\)]*)\)/.exec(style)) { // rgb / hsl - var color; - var name = m[1]; - var components = m[2]; + let color; + const name = m[1]; + const components = m[2]; switch (name) { case 'rgb': @@ -7654,9 +7207,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) - var h = parseFloat(color[1]) / 360; - var s = parseInt(color[2], 10) / 100; - var l = parseInt(color[3], 10) / 100; + const h = parseFloat(color[1]) / 360; + const s = parseInt(color[2], 10) / 100; + const l = parseInt(color[3], 10) / 100; handleAlpha(color[4]); return this.setHSL(h, s, l); } @@ -7665,8 +7218,8 @@ } } else if (m = /^\#([A-Fa-f\d]+)$/.exec(style)) { // hex color - var hex = m[1]; - var size = hex.length; + const hex = m[1]; + const size = hex.length; if (size === 3) { // #ff0 @@ -7688,11 +7241,11 @@ } return this; - }; + } - _proto.setColorName = function setColorName(style) { + setColorName(style) { // color keywords - var hex = _colorKeywords[style]; + const hex = _colorKeywords[style]; if (hex !== undefined) { // red @@ -7703,85 +7256,77 @@ } return this; - }; + } - _proto.clone = function clone() { + clone() { return new this.constructor(this.r, this.g, this.b); - }; + } - _proto.copy = function copy(color) { + 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; - }; - - _proto.copyLinearToGamma = function copyLinearToGamma(color, gammaFactor) { - if (gammaFactor === void 0) { - gammaFactor = 2.0; - } + } - var safeInverse = gammaFactor > 0 ? 1.0 / gammaFactor : 1.0; + copyLinearToGamma(color, gammaFactor = 2.0) { + const 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; - }; + } - _proto.convertGammaToLinear = function convertGammaToLinear(gammaFactor) { + convertGammaToLinear(gammaFactor) { this.copyGammaToLinear(this, gammaFactor); return this; - }; + } - _proto.convertLinearToGamma = function convertLinearToGamma(gammaFactor) { + convertLinearToGamma(gammaFactor) { this.copyLinearToGamma(this, gammaFactor); return this; - }; + } - _proto.copySRGBToLinear = function copySRGBToLinear(color) { + copySRGBToLinear(color) { this.r = SRGBToLinear(color.r); this.g = SRGBToLinear(color.g); this.b = SRGBToLinear(color.b); return this; - }; + } - _proto.copyLinearToSRGB = function copyLinearToSRGB(color) { + copyLinearToSRGB(color) { this.r = LinearToSRGB(color.r); this.g = LinearToSRGB(color.g); this.b = LinearToSRGB(color.b); return this; - }; + } - _proto.convertSRGBToLinear = function convertSRGBToLinear() { + convertSRGBToLinear() { this.copySRGBToLinear(this); return this; - }; + } - _proto.convertLinearToSRGB = function convertLinearToSRGB() { + convertLinearToSRGB() { this.copyLinearToSRGB(this); return this; - }; + } - _proto.getHex = function getHex() { + getHex() { return this.r * 255 << 16 ^ this.g * 255 << 8 ^ this.b * 255 << 0; - }; + } - _proto.getHexString = function getHexString() { + getHexString() { return ('000000' + this.getHex().toString(16)).slice(-6); - }; + } - _proto.getHSL = function getHSL(target) { + getHSL(target) { // h,s,l ranges are in 0.0 - 1.0 if (target === undefined) { console.warn('THREE.Color: .getHSL() target is now required'); @@ -7792,19 +7337,19 @@ }; } - 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; + 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; if (min === max) { hue = 0; saturation = 0; } else { - var delta = max - min; + const delta = max - min; saturation = lightness <= 0.5 ? delta / (max + min) : delta / (2 - max - min); switch (max) { @@ -7828,118 +7373,106 @@ target.s = saturation; target.l = lightness; return target; - }; + } - _proto.getStyle = function getStyle() { + getStyle() { return 'rgb(' + (this.r * 255 | 0) + ',' + (this.g * 255 | 0) + ',' + (this.b * 255 | 0) + ')'; - }; + } - _proto.offsetHSL = function offsetHSL(h, s, l) { + 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; - }; + } - _proto.add = function add(color) { + add(color) { this.r += color.r; this.g += color.g; this.b += color.b; return this; - }; + } - _proto.addColors = function addColors(color1, color2) { + addColors(color1, color2) { this.r = color1.r + color2.r; this.g = color1.g + color2.g; this.b = color1.b + color2.b; return this; - }; + } - _proto.addScalar = function addScalar(s) { + addScalar(s) { this.r += s; this.g += s; this.b += s; return this; - }; + } - _proto.sub = function sub(color) { + 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; - }; + } - _proto.multiply = function multiply(color) { + multiply(color) { this.r *= color.r; this.g *= color.g; this.b *= color.b; return this; - }; + } - _proto.multiplyScalar = function multiplyScalar(s) { + multiplyScalar(s) { this.r *= s; this.g *= s; this.b *= s; return this; - }; + } - _proto.lerp = function lerp(color, alpha) { + 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; - }; + } - _proto.lerpColors = function lerpColors(color1, color2, alpha) { + 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; - }; + } - _proto.lerpHSL = function lerpHSL(color, alpha) { + lerpHSL(color, alpha) { this.getHSL(_hslA); color.getHSL(_hslB); - 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); + 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); this.setHSL(h, s, l); return this; - }; + } - _proto.equals = function equals(c) { + 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; - }; + } - _proto.fromBufferAttribute = function fromBufferAttribute(attribute, index) { + fromBufferAttribute(attribute, index) { this.r = attribute.getX(index); this.g = attribute.getY(index); this.b = attribute.getZ(index); @@ -7952,14 +7485,13 @@ } return this; - }; + } - _proto.toJSON = function toJSON() { + toJSON() { return this.getHex(); - }; + } - return Color; - }(); + } Color.NAMES = _colorKeywords; Color.prototype.isColor = true; @@ -7999,44 +7531,34 @@ * } */ - var MeshBasicMaterial = /*#__PURE__*/function (_Material) { - _inheritsLoose(MeshBasicMaterial, _Material); - - 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); + class MeshBasicMaterial extends Material { + constructor(parameters) { + super(); + this.type = 'MeshBasicMaterial'; + this.color = new Color(0xffffff); // emissive - return _this; + 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); } - var _proto = MeshBasicMaterial.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.lightMap = source.lightMap; @@ -8056,16 +7578,15 @@ this.skinning = source.skinning; this.morphTargets = source.morphTargets; return this; - }; + } - return MeshBasicMaterial; - }(Material); + } MeshBasicMaterial.prototype.isMeshBasicMaterial = true; - var _vector$3 = new Vector3(); + const _vector$3 = new Vector3(); - var _vector2$1 = new Vector2(); + const _vector2$1 = new Vector2(); function BufferAttribute(array, itemSize, normalized) { if (Array.isArray(array)) { @@ -8086,18 +7607,18 @@ } Object.defineProperty(BufferAttribute.prototype, 'needsUpdate', { - set: function set(value) { + set: function (value) { if (value === true) this.version++; } }); Object.assign(BufferAttribute.prototype, { isBufferAttribute: true, - onUploadCallback: function onUploadCallback() {}, - setUsage: function setUsage(value) { + onUploadCallback: function () {}, + setUsage: function (value) { this.usage = value; return this; }, - copy: function copy(source) { + copy: function (source) { this.name = source.name; this.array = new source.array.constructor(source.array); this.itemSize = source.itemSize; @@ -8106,26 +7627,26 @@ this.usage = source.usage; return this; }, - copyAt: function copyAt(index1, attribute, index2) { + copyAt: function (index1, attribute, index2) { index1 *= this.itemSize; index2 *= attribute.itemSize; - for (var i = 0, l = this.itemSize; i < l; i++) { + for (let i = 0, l = this.itemSize; i < l; i++) { this.array[index1 + i] = attribute.array[index2 + i]; } return this; }, - copyArray: function copyArray(array) { + copyArray: function (array) { this.array.set(array); return this; }, - copyColorsArray: function copyColorsArray(colors) { - var array = this.array; - var offset = 0; + copyColorsArray: function (colors) { + const array = this.array; + let offset = 0; - for (var i = 0, l = colors.length; i < l; i++) { - var color = colors[i]; + for (let i = 0, l = colors.length; i < l; i++) { + let color = colors[i]; if (color === undefined) { console.warn('THREE.BufferAttribute.copyColorsArray(): color is undefined', i); @@ -8139,12 +7660,12 @@ return this; }, - copyVector2sArray: function copyVector2sArray(vectors) { - var array = this.array; - var offset = 0; + copyVector2sArray: function (vectors) { + const array = this.array; + let offset = 0; - for (var i = 0, l = vectors.length; i < l; i++) { - var vector = vectors[i]; + for (let i = 0, l = vectors.length; i < l; i++) { + let vector = vectors[i]; if (vector === undefined) { console.warn('THREE.BufferAttribute.copyVector2sArray(): vector is undefined', i); @@ -8157,12 +7678,12 @@ return this; }, - copyVector3sArray: function copyVector3sArray(vectors) { - var array = this.array; - var offset = 0; + copyVector3sArray: function (vectors) { + const array = this.array; + let offset = 0; - for (var i = 0, l = vectors.length; i < l; i++) { - var vector = vectors[i]; + for (let i = 0, l = vectors.length; i < l; i++) { + let vector = vectors[i]; if (vector === undefined) { console.warn('THREE.BufferAttribute.copyVector3sArray(): vector is undefined', i); @@ -8176,12 +7697,12 @@ return this; }, - copyVector4sArray: function copyVector4sArray(vectors) { - var array = this.array; - var offset = 0; + copyVector4sArray: function (vectors) { + const array = this.array; + let offset = 0; - for (var i = 0, l = vectors.length; i < l; i++) { - var vector = vectors[i]; + for (let i = 0, l = vectors.length; i < l; i++) { + let vector = vectors[i]; if (vector === undefined) { console.warn('THREE.BufferAttribute.copyVector4sArray(): vector is undefined', i); @@ -8196,9 +7717,9 @@ return this; }, - applyMatrix3: function applyMatrix3(m) { + applyMatrix3: function (m) { if (this.itemSize === 2) { - for (var i = 0, l = this.count; i < l; i++) { + for (let i = 0, l = this.count; i < l; i++) { _vector2$1.fromBufferAttribute(this, i); _vector2$1.applyMatrix3(m); @@ -8206,19 +7727,19 @@ this.setXY(i, _vector2$1.x, _vector2$1.y); } } else if (this.itemSize === 3) { - for (var _i = 0, _l = this.count; _i < _l; _i++) { - _vector$3.fromBufferAttribute(this, _i); + for (let i = 0, l = this.count; i < l; i++) { + _vector$3.fromBufferAttribute(this, i); _vector$3.applyMatrix3(m); - this.setXYZ(_i, _vector$3.x, _vector$3.y, _vector$3.z); + this.setXYZ(i, _vector$3.x, _vector$3.y, _vector$3.z); } } return this; }, - applyMatrix4: function applyMatrix4(m) { - for (var i = 0, l = this.count; i < l; i++) { + applyMatrix4: function (m) { + for (let 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); @@ -8230,8 +7751,8 @@ return this; }, - applyNormalMatrix: function applyNormalMatrix(m) { - for (var i = 0, l = this.count; i < l; i++) { + applyNormalMatrix: function (m) { + for (let 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); @@ -8243,8 +7764,8 @@ return this; }, - transformDirection: function transformDirection(m) { - for (var i = 0, l = this.count; i < l; i++) { + transformDirection: function (m) { + for (let 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); @@ -8256,56 +7777,52 @@ return this; }, - set: function set(value, offset) { - if (offset === void 0) { - offset = 0; - } - + set: function (value, offset = 0) { this.array.set(value, offset); return this; }, - getX: function getX(index) { + getX: function (index) { return this.array[index * this.itemSize]; }, - setX: function setX(index, x) { + setX: function (index, x) { this.array[index * this.itemSize] = x; return this; }, - getY: function getY(index) { + getY: function (index) { return this.array[index * this.itemSize + 1]; }, - setY: function setY(index, y) { + setY: function (index, y) { this.array[index * this.itemSize + 1] = y; return this; }, - getZ: function getZ(index) { + getZ: function (index) { return this.array[index * this.itemSize + 2]; }, - setZ: function setZ(index, z) { + setZ: function (index, z) { this.array[index * this.itemSize + 2] = z; return this; }, - getW: function getW(index) { + getW: function (index) { return this.array[index * this.itemSize + 3]; }, - setW: function setW(index, w) { + setW: function (index, w) { this.array[index * this.itemSize + 3] = w; return this; }, - setXY: function setXY(index, x, y) { + setXY: function (index, x, y) { index *= this.itemSize; this.array[index + 0] = x; this.array[index + 1] = y; return this; }, - setXYZ: function setXYZ(index, x, y, z) { + setXYZ: function (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 setXYZW(index, x, y, z, w) { + setXYZW: function (index, x, y, z, w) { index *= this.itemSize; this.array[index + 0] = x; this.array[index + 1] = y; @@ -8313,14 +7830,14 @@ this.array[index + 3] = w; return this; }, - onUpload: function onUpload(callback) { + onUpload: function (callback) { this.onUploadCallback = callback; return this; }, - clone: function clone() { + clone: function () { return new this.constructor(this.array, this.itemSize).copy(this); }, - toJSON: function toJSON() { + toJSON: function () { return { itemSize: this.itemSize, type: this.array.constructor.name, @@ -8403,16 +7920,16 @@ function arrayMax(array) { if (array.length === 0) return -Infinity; - var max = array[0]; + let max = array[0]; - for (var i = 1, l = array.length; i < l; ++i) { + for (let i = 1, l = array.length; i < l; ++i) { if (array[i] > max) max = array[i]; } return max; } - var TYPED_ARRAYS = { + const TYPED_ARRAYS = { Int8Array: Int8Array, Uint8Array: Uint8Array, Uint8ClampedArray: Uint8ClampedArray, @@ -8428,19 +7945,19 @@ return new TYPED_ARRAYS[type](buffer); } - var _id = 0; + let _id = 0; - var _m1$2 = new Matrix4(); + const _m1$2 = new Matrix4(); - var _obj = new Object3D(); + const _obj = new Object3D(); - var _offset = new Vector3(); + const _offset = new Vector3(); - var _box$2 = new Box3(); + const _box$2 = new Box3(); - var _boxMorphTargets = new Box3(); + const _boxMorphTargets = new Box3(); - var _vector$4 = new Vector3(); + const _vector$4 = new Vector3(); function BufferGeometry() { Object.defineProperty(this, 'id', { @@ -8466,10 +7983,10 @@ BufferGeometry.prototype = Object.assign(Object.create(EventDispatcher.prototype), { constructor: BufferGeometry, isBufferGeometry: true, - getIndex: function getIndex() { + getIndex: function () { return this.index; }, - setIndex: function setIndex(index) { + setIndex: function (index) { if (Array.isArray(index)) { this.index = new (arrayMax(index) > 65535 ? Uint32BufferAttribute : Uint16BufferAttribute)(index, 1); } else { @@ -8478,55 +7995,51 @@ return this; }, - getAttribute: function getAttribute(name) { + getAttribute: function (name) { return this.attributes[name]; }, - setAttribute: function setAttribute(name, attribute) { + setAttribute: function (name, attribute) { this.attributes[name] = attribute; return this; }, - deleteAttribute: function deleteAttribute(name) { + deleteAttribute: function (name) { delete this.attributes[name]; return this; }, - hasAttribute: function hasAttribute(name) { + hasAttribute: function (name) { return this.attributes[name] !== undefined; }, - addGroup: function addGroup(start, count, materialIndex) { - if (materialIndex === void 0) { - materialIndex = 0; - } - + addGroup: function (start, count, materialIndex = 0) { this.groups.push({ start: start, count: count, materialIndex: materialIndex }); }, - clearGroups: function clearGroups() { + clearGroups: function () { this.groups = []; }, - setDrawRange: function setDrawRange(start, count) { + setDrawRange: function (start, count) { this.drawRange.start = start; this.drawRange.count = count; }, - applyMatrix4: function applyMatrix4(matrix) { - var position = this.attributes.position; + applyMatrix4: function (matrix) { + const position = this.attributes.position; if (position !== undefined) { position.applyMatrix4(matrix); position.needsUpdate = true; } - var normal = this.attributes.normal; + const normal = this.attributes.normal; if (normal !== undefined) { - var normalMatrix = new Matrix3().getNormalMatrix(matrix); + const normalMatrix = new Matrix3().getNormalMatrix(matrix); normal.applyNormalMatrix(normalMatrix); normal.needsUpdate = true; } - var tangent = this.attributes.tangent; + const tangent = this.attributes.tangent; if (tangent !== undefined) { tangent.transformDirection(matrix); @@ -8543,42 +8056,42 @@ return this; }, - rotateX: function rotateX(angle) { + rotateX: function (angle) { // rotate geometry around world x-axis _m1$2.makeRotationX(angle); this.applyMatrix4(_m1$2); return this; }, - rotateY: function rotateY(angle) { + rotateY: function (angle) { // rotate geometry around world y-axis _m1$2.makeRotationY(angle); this.applyMatrix4(_m1$2); return this; }, - rotateZ: function rotateZ(angle) { + rotateZ: function (angle) { // rotate geometry around world z-axis _m1$2.makeRotationZ(angle); this.applyMatrix4(_m1$2); return this; }, - translate: function translate(x, y, z) { + translate: function (x, y, z) { // translate geometry _m1$2.makeTranslation(x, y, z); this.applyMatrix4(_m1$2); return this; }, - scale: function scale(x, y, z) { + scale: function (x, y, z) { // scale geometry _m1$2.makeScale(x, y, z); this.applyMatrix4(_m1$2); return this; }, - lookAt: function lookAt(vector) { + lookAt: function (vector) { _obj.lookAt(vector); _obj.updateMatrix(); @@ -8586,30 +8099,30 @@ this.applyMatrix4(_obj.matrix); return this; }, - center: function center() { + center: function () { this.computeBoundingBox(); this.boundingBox.getCenter(_offset).negate(); this.translate(_offset.x, _offset.y, _offset.z); return this; }, - setFromPoints: function setFromPoints(points) { - var position = []; + setFromPoints: function (points) { + const position = []; - for (var i = 0, l = points.length; i < l; i++) { - var point = points[i]; + for (let i = 0, l = points.length; i < l; i++) { + const point = points[i]; position.push(point.x, point.y, point.z || 0); } this.setAttribute('position', new Float32BufferAttribute(position, 3)); return this; }, - computeBoundingBox: function computeBoundingBox() { + computeBoundingBox: function () { if (this.boundingBox === null) { this.boundingBox = new Box3(); } - var position = this.attributes.position; - var morphAttributesPosition = this.morphAttributes.position; + const position = this.attributes.position; + const morphAttributesPosition = this.morphAttributes.position; if (position && position.isGLBufferAttribute) { console.error('THREE.BufferGeometry.computeBoundingBox(): GLBufferAttribute requires a manual bounding box. Alternatively set "mesh.frustumCulled" to "false".', this); @@ -8621,8 +8134,8 @@ this.boundingBox.setFromBufferAttribute(position); // process morph attributes if present if (morphAttributesPosition) { - for (var i = 0, il = morphAttributesPosition.length; i < il; i++) { - var morphAttribute = morphAttributesPosition[i]; + for (let i = 0, il = morphAttributesPosition.length; i < il; i++) { + const morphAttribute = morphAttributesPosition[i]; _box$2.setFromBufferAttribute(morphAttribute); @@ -8648,13 +8161,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() { + computeBoundingSphere: function () { if (this.boundingSphere === null) { this.boundingSphere = new Sphere(); } - var position = this.attributes.position; - var morphAttributesPosition = this.morphAttributes.position; + const position = this.attributes.position; + const morphAttributesPosition = this.morphAttributes.position; if (position && position.isGLBufferAttribute) { console.error('THREE.BufferGeometry.computeBoundingSphere(): GLBufferAttribute requires a manual bounding sphere. Alternatively set "mesh.frustumCulled" to "false".', this); @@ -8664,14 +8177,14 @@ if (position) { // first, find the center of the bounding sphere - var center = this.boundingSphere.center; + const center = this.boundingSphere.center; _box$2.setFromBufferAttribute(position); // process morph attributes if present if (morphAttributesPosition) { - for (var i = 0, il = morphAttributesPosition.length; i < il; i++) { - var morphAttribute = morphAttributesPosition[i]; + for (let i = 0, il = morphAttributesPosition.length; i < il; i++) { + const morphAttribute = morphAttributesPosition[i]; _boxMorphTargets.setFromBufferAttribute(morphAttribute); @@ -8695,22 +8208,22 @@ // boundingSphere of the boundingBox: sqrt(3) smaller in the best case - var maxRadiusSq = 0; + let maxRadiusSq = 0; - for (var _i = 0, _il = position.count; _i < _il; _i++) { - _vector$4.fromBufferAttribute(position, _i); + for (let i = 0, il = position.count; i < il; i++) { + _vector$4.fromBufferAttribute(position, i); maxRadiusSq = Math.max(maxRadiusSq, center.distanceToSquared(_vector$4)); } // process morph attributes if present if (morphAttributesPosition) { - for (var _i2 = 0, _il2 = morphAttributesPosition.length; _i2 < _il2; _i2++) { - var _morphAttribute = morphAttributesPosition[_i2]; - var morphTargetsRelative = this.morphTargetsRelative; + for (let i = 0, il = morphAttributesPosition.length; i < il; i++) { + const morphAttribute = morphAttributesPosition[i]; + const morphTargetsRelative = this.morphTargetsRelative; - for (var j = 0, jl = _morphAttribute.count; j < jl; j++) { - _vector$4.fromBufferAttribute(_morphAttribute, j); + for (let j = 0, jl = morphAttribute.count; j < jl; j++) { + _vector$4.fromBufferAttribute(morphAttribute, j); if (morphTargetsRelative) { _offset.fromBufferAttribute(position, j); @@ -8730,11 +8243,11 @@ } } }, - computeFaceNormals: function computeFaceNormals() {// backwards compatibility + computeFaceNormals: function () {// backwards compatibility }, - computeTangents: function computeTangents() { - var index = this.index; - var attributes = this.attributes; // based on http://www.terathon.com/code/tangent.html + computeTangents: function () { + const index = this.index; + const attributes = this.attributes; // based on http://www.terathon.com/code/tangent.html // (per vertex tangents) if (index === null || attributes.position === undefined || attributes.normal === undefined || attributes.uv === undefined) { @@ -8742,33 +8255,33 @@ return; } - var indices = index.array; - var positions = attributes.position.array; - var normals = attributes.normal.array; - var uvs = attributes.uv.array; - var nVertices = positions.length / 3; + const indices = index.array; + const positions = attributes.position.array; + const normals = attributes.normal.array; + const uvs = attributes.uv.array; + const nVertices = positions.length / 3; if (attributes.tangent === undefined) { this.setAttribute('tangent', new BufferAttribute(new Float32Array(4 * nVertices), 4)); } - var tangents = attributes.tangent.array; - var tan1 = [], - tan2 = []; + const tangents = attributes.tangent.array; + const tan1 = [], + tan2 = []; - for (var i = 0; i < nVertices; i++) { + for (let i = 0; i < nVertices; i++) { tan1[i] = new Vector3(); tan2[i] = 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(); + 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(); function handleTriangle(a, b, c) { vA.fromArray(positions, a * 3); @@ -8781,7 +8294,7 @@ vC.sub(vA); uvB.sub(uvA); uvC.sub(uvA); - var r = 1.0 / (uvB.x * uvC.y - uvC.x * uvB.y); // silently ignore degenerate uv triangles having coincident or colinear vertices + const r = 1.0 / (uvB.x * uvC.y - uvC.x * uvB.y); // silently ignore degenerate uv triangles having coincident or colinear vertices if (!isFinite(r)) return; sdir.copy(vB).multiplyScalar(uvC.y).addScaledVector(vC, -uvB.y).multiplyScalar(r); @@ -8794,7 +8307,7 @@ tan2[c].add(tdir); } - var groups = this.groups; + let groups = this.groups; if (groups.length === 0) { groups = [{ @@ -8803,81 +8316,81 @@ }]; } - for (var _i3 = 0, il = groups.length; _i3 < il; ++_i3) { - var group = groups[_i3]; - var start = group.start; - var count = group.count; + for (let i = 0, il = groups.length; i < il; ++i) { + const group = groups[i]; + const start = group.start; + const count = group.count; - for (var j = start, jl = start + count; j < jl; j += 3) { + for (let j = start, jl = start + count; j < jl; j += 3) { handleTriangle(indices[j + 0], indices[j + 1], indices[j + 2]); } } - var tmp = new Vector3(), - tmp2 = new Vector3(); - var n = new Vector3(), - n2 = new Vector3(); + const tmp = new Vector3(), + tmp2 = new Vector3(); + const n = new Vector3(), + n2 = new Vector3(); function handleVertex(v) { n.fromArray(normals, v * 3); n2.copy(n); - var t = tan1[v]; // Gram-Schmidt orthogonalize + const t = tan1[v]; // Gram-Schmidt orthogonalize tmp.copy(t); tmp.sub(n.multiplyScalar(n.dot(t))).normalize(); // Calculate handedness tmp2.crossVectors(n2, t); - var test = tmp2.dot(tan2[v]); - var w = test < 0.0 ? -1.0 : 1.0; + const test = tmp2.dot(tan2[v]); + const 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 (var _i4 = 0, _il3 = groups.length; _i4 < _il3; ++_i4) { - var _group = groups[_i4]; - var _start = _group.start; - var _count = _group.count; + for (let i = 0, il = groups.length; i < il; ++i) { + const group = groups[i]; + const start = group.start; + const count = group.count; - for (var _j = _start, _jl = _start + _count; _j < _jl; _j += 3) { - handleVertex(indices[_j + 0]); - handleVertex(indices[_j + 1]); - handleVertex(indices[_j + 2]); + for (let j = start, jl = start + count; j < jl; j += 3) { + handleVertex(indices[j + 0]); + handleVertex(indices[j + 1]); + handleVertex(indices[j + 2]); } } }, - computeVertexNormals: function computeVertexNormals() { - var index = this.index; - var positionAttribute = this.getAttribute('position'); + computeVertexNormals: function () { + const index = this.index; + const positionAttribute = this.getAttribute('position'); if (positionAttribute !== undefined) { - var normalAttribute = this.getAttribute('normal'); + let normalAttribute = this.getAttribute('normal'); if (normalAttribute === undefined) { normalAttribute = new BufferAttribute(new Float32Array(positionAttribute.count * 3), 3); this.setAttribute('normal', normalAttribute); } else { // reset existing normals to zero - for (var i = 0, il = normalAttribute.count; i < il; i++) { + for (let i = 0, il = normalAttribute.count; i < il; i++) { normalAttribute.setXYZ(i, 0, 0, 0); } } - 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 + 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 if (index) { - 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); + 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); pA.fromBufferAttribute(positionAttribute, vA); pB.fromBufferAttribute(positionAttribute, vB); pC.fromBufferAttribute(positionAttribute, vC); @@ -8896,16 +8409,16 @@ } } else { // non-indexed elements (unconnected triangle soup) - 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); + 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); cb.subVectors(pC, pB); ab.subVectors(pA, pB); cb.cross(ab); - 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); + 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); } } @@ -8913,7 +8426,7 @@ normalAttribute.needsUpdate = true; } }, - merge: function merge(geometry, offset) { + merge: function (geometry, offset) { if (!(geometry && geometry.isBufferGeometry)) { console.error('THREE.BufferGeometry.merge(): geometry not an instance of THREE.BufferGeometry.', geometry); return; @@ -8924,28 +8437,28 @@ console.warn('THREE.BufferGeometry.merge(): Overwriting original geometry, starting at offset=0. ' + 'Use BufferGeometryUtils.mergeBufferGeometries() for lossless merge.'); } - var attributes = this.attributes; + const attributes = this.attributes; - for (var key in attributes) { + for (const key in attributes) { if (geometry.attributes[key] === undefined) continue; - 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++) { + 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++) { attributeArray1[j] = attributeArray2[i]; } } return this; }, - normalizeNormals: function normalizeNormals() { - var normals = this.attributes.normal; + normalizeNormals: function () { + const normals = this.attributes.normal; - for (var i = 0, il = normals.count; i < il; i++) { + for (let i = 0, il = normals.count; i < il; i++) { _vector$4.fromBufferAttribute(normals, i); _vector$4.normalize(); @@ -8953,19 +8466,19 @@ normals.setXYZ(i, _vector$4.x, _vector$4.y, _vector$4.z); } }, - toNonIndexed: function toNonIndexed() { + toNonIndexed: function () { function convertBufferAttribute(attribute, indices) { - var array = attribute.array; - var itemSize = attribute.itemSize; - var normalized = attribute.normalized; - var array2 = new array.constructor(indices.length * itemSize); - var index = 0, + const array = attribute.array; + const itemSize = attribute.itemSize; + const normalized = attribute.normalized; + const array2 = new array.constructor(indices.length * itemSize); + let index = 0, index2 = 0; - for (var i = 0, l = indices.length; i < l; i++) { + for (let i = 0, l = indices.length; i < l; i++) { index = indices[i] * itemSize; - for (var j = 0; j < itemSize; j++) { + for (let j = 0; j < itemSize; j++) { array2[index2++] = array[index++]; } } @@ -8979,47 +8492,45 @@ return this; } - var geometry2 = new BufferGeometry(); - var indices = this.index.array; - var attributes = this.attributes; // attributes + const geometry2 = new BufferGeometry(); + const indices = this.index.array; + const attributes = this.attributes; // attributes - for (var name in attributes) { - var attribute = attributes[name]; - var newAttribute = convertBufferAttribute(attribute, indices); + for (const name in attributes) { + const attribute = attributes[name]; + const newAttribute = convertBufferAttribute(attribute, indices); geometry2.setAttribute(name, newAttribute); } // morph attributes - var morphAttributes = this.morphAttributes; + const 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]; - - var _newAttribute = convertBufferAttribute(_attribute, indices); - - morphArray.push(_newAttribute); + for (let i = 0, il = morphAttribute.length; i < il; i++) { + const attribute = morphAttribute[i]; + const newAttribute = convertBufferAttribute(attribute, indices); + morphArray.push(newAttribute); } - geometry2.morphAttributes[_name] = morphArray; + geometry2.morphAttributes[name] = morphArray; } geometry2.morphTargetsRelative = this.morphTargetsRelative; // groups - var groups = this.groups; + const groups = this.groups; - for (var _i7 = 0, l = groups.length; _i7 < l; _i7++) { - var group = groups[_i7]; + for (let i = 0, l = groups.length; i < l; i++) { + const group = groups[i]; geometry2.addGroup(group.start, group.count, group.materialIndex); } return geometry2; }, - toJSON: function toJSON() { - var data = { + toJSON: function () { + const data = { metadata: { version: 4.5, type: 'BufferGeometry', @@ -9033,9 +8544,9 @@ if (Object.keys(this.userData).length > 0) data.userData = this.userData; if (this.parameters !== undefined) { - var parameters = this.parameters; + const parameters = this.parameters; - for (var key in parameters) { + for (const key in parameters) { if (parameters[key] !== undefined) data[key] = parameters[key]; } @@ -9045,7 +8556,7 @@ data.data = { attributes: {} }; - var index = this.index; + const index = this.index; if (index !== null) { data.data.index = { @@ -9054,33 +8565,31 @@ }; } - var attributes = this.attributes; + const attributes = this.attributes; - for (var _key in attributes) { - var attribute = attributes[_key]; - var attributeData = attribute.toJSON(data.data); + for (const key in attributes) { + const attribute = attributes[key]; + const attributeData = attribute.toJSON(data.data); if (attribute.name !== '') attributeData.name = attribute.name; - data.data.attributes[_key] = attributeData; + data.data.attributes[key] = attributeData; } - var morphAttributes = {}; - var hasMorphAttributes = false; - - for (var _key2 in this.morphAttributes) { - var attributeArray = this.morphAttributes[_key2]; - var array = []; - - for (var i = 0, il = attributeArray.length; i < il; i++) { - var _attribute2 = attributeArray[i]; + const morphAttributes = {}; + let hasMorphAttributes = false; - var _attributeData = _attribute2.toJSON(data.data); + for (const key in this.morphAttributes) { + const attributeArray = this.morphAttributes[key]; + const array = []; - if (_attribute2.name !== '') _attributeData.name = _attribute2.name; - array.push(_attributeData); + for (let i = 0, il = attributeArray.length; i < il; i++) { + const attribute = attributeArray[i]; + const attributeData = attribute.toJSON(data.data); + if (attribute.name !== '') attributeData.name = attribute.name; + array.push(attributeData); } if (array.length > 0) { - morphAttributes[_key2] = array; + morphAttributes[key] = array; hasMorphAttributes = true; } } @@ -9090,13 +8599,13 @@ data.data.morphTargetsRelative = this.morphTargetsRelative; } - var groups = this.groups; + const groups = this.groups; if (groups.length > 0) { data.data.groups = JSON.parse(JSON.stringify(groups)); } - var boundingSphere = this.boundingSphere; + const boundingSphere = this.boundingSphere; if (boundingSphere !== null) { data.data.boundingSphere = { @@ -9107,7 +8616,7 @@ return data; }, - clone: function clone() { + clone: function () { /* // Handle primitives const parameters = this.parameters; @@ -9124,7 +8633,7 @@ */ return new BufferGeometry().copy(this); }, - copy: function copy(source) { + copy: function (source) { // reset this.index = null; this.attributes = {}; @@ -9133,56 +8642,56 @@ this.boundingBox = null; this.boundingSphere = null; // used for storing cloned, shared data - var data = {}; // name + const data = {}; // name this.name = source.name; // index - var index = source.index; + const index = source.index; if (index !== null) { this.setIndex(index.clone(data)); } // attributes - var attributes = source.attributes; + const attributes = source.attributes; - for (var name in attributes) { - var attribute = attributes[name]; + for (const name in attributes) { + const attribute = attributes[name]; this.setAttribute(name, attribute.clone(data)); } // morph attributes - var morphAttributes = source.morphAttributes; + const morphAttributes = source.morphAttributes; - for (var _name2 in morphAttributes) { - var array = []; - var morphAttribute = morphAttributes[_name2]; // morphAttribute: array of Float32BufferAttributes + for (const name in morphAttributes) { + const array = []; + const morphAttribute = morphAttributes[name]; // morphAttribute: array of Float32BufferAttributes - for (var i = 0, l = morphAttribute.length; i < l; i++) { + for (let i = 0, l = morphAttribute.length; i < l; i++) { array.push(morphAttribute[i].clone(data)); } - this.morphAttributes[_name2] = array; + this.morphAttributes[name] = array; } this.morphTargetsRelative = source.morphTargetsRelative; // groups - var groups = source.groups; + const groups = source.groups; - for (var _i8 = 0, _l = groups.length; _i8 < _l; _i8++) { - var group = groups[_i8]; + for (let i = 0, l = groups.length; i < l; i++) { + const group = groups[i]; this.addGroup(group.start, group.count, group.materialIndex); } // bounding box - var boundingBox = source.boundingBox; + const boundingBox = source.boundingBox; if (boundingBox !== null) { this.boundingBox = boundingBox.clone(); } // bounding sphere - var boundingSphere = source.boundingSphere; + const boundingSphere = source.boundingSphere; if (boundingSphere !== null) { this.boundingSphere = boundingSphere.clone(); @@ -9195,56 +8704,48 @@ this.userData = source.userData; return this; }, - dispose: function dispose() { + dispose: function () { this.dispatchEvent({ type: 'dispose' }); } }); - var _inverseMatrix = new Matrix4(); + const _inverseMatrix = new Matrix4(); - var _ray = new Ray(); + const _ray = new Ray(); - var _sphere = new Sphere(); + const _sphere = new Sphere(); - var _vA = new Vector3(); + const _vA = new Vector3(); - var _vB = new Vector3(); + const _vB = new Vector3(); - var _vC = new Vector3(); + const _vC = 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 = new Vector2(); - var _uvB = new Vector2(); + const _uvB = new Vector2(); - var _uvC = new Vector2(); + const _uvC = 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(); - } - - if (material === void 0) { - material = new MeshBasicMaterial(); - } + const _intersectionPointWorld = new Vector3(); + function Mesh(geometry = new BufferGeometry(), material = new MeshBasicMaterial()) { Object3D.call(this); this.type = 'Mesh'; this.geometry = geometry; @@ -9255,7 +8756,7 @@ Mesh.prototype = Object.assign(Object.create(Object3D.prototype), { constructor: Mesh, isMesh: true, - copy: function copy(source) { + copy: function (source) { Object3D.prototype.copy.call(this, source); if (source.morphTargetInfluences !== undefined) { @@ -9270,39 +8771,39 @@ this.geometry = source.geometry; return this; }, - updateMorphTargets: function updateMorphTargets() { - var geometry = this.geometry; + updateMorphTargets: function () { + const geometry = this.geometry; if (geometry.isBufferGeometry) { - var morphAttributes = geometry.morphAttributes; - var keys = Object.keys(morphAttributes); + const morphAttributes = geometry.morphAttributes; + const keys = Object.keys(morphAttributes); if (keys.length > 0) { - var morphAttribute = morphAttributes[keys[0]]; + const morphAttribute = morphAttributes[keys[0]]; if (morphAttribute !== undefined) { this.morphTargetInfluences = []; this.morphTargetDictionary = {}; - for (var m = 0, ml = morphAttribute.length; m < ml; m++) { - var name = morphAttribute[m].name || String(m); + for (let m = 0, ml = morphAttribute.length; m < ml; m++) { + const name = morphAttribute[m].name || String(m); this.morphTargetInfluences.push(0); this.morphTargetDictionary[name] = m; } } } } else { - var morphTargets = geometry.morphTargets; + const morphTargets = geometry.morphTargets; if (morphTargets !== undefined && morphTargets.length > 0) { console.error('THREE.Mesh.updateMorphTargets() no longer supports THREE.Geometry. Use THREE.BufferGeometry instead.'); } } }, - raycast: function raycast(raycaster, intersects) { - var geometry = this.geometry; - var material = this.material; - var matrixWorld = this.matrixWorld; + raycast: function (raycaster, intersects) { + const geometry = this.geometry; + const material = this.material; + const matrixWorld = this.matrixWorld; if (material === undefined) return; // Checking boundingSphere distance to ray if (geometry.boundingSphere === null) geometry.computeBoundingSphere(); @@ -9322,31 +8823,31 @@ if (_ray.intersectsBox(geometry.boundingBox) === false) return; } - var intersection; + let intersection; if (geometry.isBufferGeometry) { - 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; + 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; if (index !== null) { // indexed buffer geometry if (Array.isArray(material)) { - 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); + 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, position, morphPosition, morphTargetsRelative, uv, uv2, a, b, c); if (intersection) { @@ -9358,21 +8859,17 @@ } } } else { - 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); - - var _b = index.getX(_i + 1); + const start = Math.max(0, drawRange.start); + const end = Math.min(index.count, drawRange.start + drawRange.count); - var _c = index.getX(_i + 2); - - intersection = checkBufferGeometryIntersection(this, material, raycaster, _ray, position, morphPosition, morphTargetsRelative, uv, uv2, _a, _b, _c); + 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, 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); } @@ -9381,47 +8878,38 @@ } else if (position !== undefined) { // non-indexed buffer geometry if (Array.isArray(material)) { - 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); + 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, position, morphPosition, morphTargetsRelative, uv, uv2, a, b, c); 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 { - 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; + const start = Math.max(0, drawRange.start); + const end = Math.min(position.count, drawRange.start + drawRange.count); - var _c3 = _i3 + 2; - - intersection = checkBufferGeometryIntersection(this, material, raycaster, _ray, position, morphPosition, morphTargetsRelative, uv, uv2, _a3, _b3, _c3); + 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, position, morphPosition, morphTargetsRelative, uv, uv2, a, b, c); if (intersection) { - intersection.faceIndex = Math.floor(_i3 / 3); // triangle number in non-indexed buffer semantics + intersection.faceIndex = Math.floor(i / 3); // triangle number in non-indexed buffer semantics intersects.push(intersection); } @@ -9435,7 +8923,7 @@ }); function checkIntersection(object, material, raycaster, ray, pA, pB, pC, point) { - var intersect; + let intersect; if (material.side === BackSide) { intersect = ray.intersectTriangle(pC, pB, pA, true, point); @@ -9449,7 +8937,7 @@ _intersectionPointWorld.applyMatrix4(object.matrixWorld); - var distance = raycaster.ray.origin.distanceTo(_intersectionPointWorld); + const distance = raycaster.ray.origin.distanceTo(_intersectionPointWorld); if (distance < raycaster.near || distance > raycaster.far) return null; return { distance: distance, @@ -9465,7 +8953,7 @@ _vC.fromBufferAttribute(position, c); - var morphInfluences = object.morphTargetInfluences; + const morphInfluences = object.morphTargetInfluences; if (material.morphTargets && morphPosition && morphInfluences) { _morphA.set(0, 0, 0); @@ -9474,9 +8962,9 @@ _morphC.set(0, 0, 0); - for (var i = 0, il = morphPosition.length; i < il; i++) { - var influence = morphInfluences[i]; - var morphAttribute = morphPosition[i]; + for (let i = 0, il = morphPosition.length; i < il; i++) { + const influence = morphInfluences[i]; + const morphAttribute = morphPosition[i]; if (influence === 0) continue; _tempA.fromBufferAttribute(morphAttribute, a); @@ -9513,7 +9001,7 @@ object.boneTransform(c, _vC); } - var intersection = checkIntersection(object, material, raycaster, ray, _vA, _vB, _vC, _intersectionPoint); + const intersection = checkIntersection(object, material, raycaster, ray, _vA, _vB, _vC, _intersectionPoint); if (intersection) { if (uv) { @@ -9536,7 +9024,7 @@ intersection.uv2 = Triangle.getUV(_intersectionPoint, _vA, _vB, _vC, _uvA, _uvB, _uvC, new Vector2()); } - var face = { + const face = { a: a, b: b, c: c, @@ -9550,39 +9038,11 @@ return intersection; } - var BoxGeometry = /*#__PURE__*/function (_BufferGeometry) { - _inheritsLoose(BoxGeometry, _BufferGeometry); - - function BoxGeometry(width, height, depth, widthSegments, heightSegments, depthSegments) { - var _this; - - if (width === void 0) { - width = 1; - } - - 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 = { + 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, @@ -9590,21 +9050,19 @@ heightSegments: heightSegments, depthSegments: depthSegments }; - - var scope = _assertThisInitialized(_this); // segments - + const scope = 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 + const indices = []; + const vertices = []; + const normals = []; + const uvs = []; // helper variables - var numberOfVertices = 0; - var groupStart = 0; // build each side of the box geometry + let numberOfVertices = 0; + let groupStart = 0; // build each side of the box geometry buildPlane('z', 'y', 'x', -1, -1, depth, height, width, depthSegments, heightSegments, 0); // px @@ -9619,31 +9077,28 @@ 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) { - 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 + 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 vector[u] = x * udir; vector[v] = y * vdir; @@ -9668,12 +9123,12 @@ // 3. so we need to generate six (2*3) indices per segment - 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 + 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 indices.push(a, b, d); indices.push(b, c, d); // increase counter @@ -9689,24 +9144,21 @@ numberOfVertices += vertexCounter; } - - return _this; } - return BoxGeometry; - }(BufferGeometry); + } /** * Uniform Utilities */ function cloneUniforms(src) { - var dst = {}; + const dst = {}; - for (var u in src) { + for (const u in src) { dst[u] = {}; - for (var p in src[u]) { - var property = src[u][p]; + for (const p in src[u]) { + const property = src[u][p]; if (property && (property.isColor || property.isMatrix3 || property.isMatrix4 || property.isVector2 || property.isVector3 || property.isVector4 || property.isTexture || property.isQuaternion)) { dst[u][p] = property.clone(); @@ -9721,12 +9173,12 @@ return dst; } function mergeUniforms(uniforms) { - var merged = {}; + const merged = {}; - for (var u = 0; u < uniforms.length; u++) { - var tmp = cloneUniforms(uniforms[u]); + for (let u = 0; u < uniforms.length; u++) { + const tmp = cloneUniforms(uniforms[u]); - for (var p in tmp) { + for (const p in tmp) { merged[p] = tmp[p]; } } @@ -9734,7 +9186,7 @@ return merged; } // Legacy - var UniformsUtils = { + const UniformsUtils = { clone: cloneUniforms, merge: mergeUniforms }; @@ -9837,13 +9289,13 @@ }; ShaderMaterial.prototype.toJSON = function (meta) { - var data = Material.prototype.toJSON.call(this, meta); + const data = Material.prototype.toJSON.call(this, meta); data.glslVersion = this.glslVersion; data.uniforms = {}; - for (var name in this.uniforms) { - var uniform = this.uniforms[name]; - var value = uniform.value; + for (const name in this.uniforms) { + const uniform = this.uniforms[name]; + const value = uniform.value; if (value && value.isTexture) { data.uniforms[name] = { @@ -9890,9 +9342,9 @@ if (Object.keys(this.defines).length > 0) data.defines = this.defines; data.vertexShader = this.vertexShader; data.fragmentShader = this.fragmentShader; - var extensions = {}; + const extensions = {}; - for (var key in this.extensions) { + for (const key in this.extensions) { if (this.extensions[key] === true) extensions[key] = true; } @@ -9911,53 +9363,37 @@ Camera.prototype = Object.assign(Object.create(Object3D.prototype), { constructor: Camera, isCamera: true, - copy: function copy(source, recursive) { + copy: function (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 getWorldDirection(target) { + getWorldDirection: function (target) { if (target === undefined) { console.warn('THREE.Camera: .getWorldDirection() target is now required'); target = new Vector3(); } this.updateWorldMatrix(true, false); - var e = this.matrixWorld.elements; + const e = this.matrixWorld.elements; return target.set(-e[8], -e[9], -e[10]).normalize(); }, - updateMatrixWorld: function updateMatrixWorld(force) { + updateMatrixWorld: function (force) { Object3D.prototype.updateMatrixWorld.call(this, force); this.matrixWorldInverse.copy(this.matrixWorld).invert(); }, - updateWorldMatrix: function updateWorldMatrix(updateParents, updateChildren) { + updateWorldMatrix: function (updateParents, updateChildren) { Object3D.prototype.updateWorldMatrix.call(this, updateParents, updateChildren); this.matrixWorldInverse.copy(this.matrixWorld).invert(); }, - clone: function clone() { + clone: function () { return new this.constructor().copy(this); } }); - 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; - } - + function PerspectiveCamera(fov = 50, aspect = 1, near = 0.1, far = 2000) { Camera.call(this); this.type = 'PerspectiveCamera'; this.fov = fov; @@ -9977,7 +9413,7 @@ PerspectiveCamera.prototype = Object.assign(Object.create(Camera.prototype), { constructor: PerspectiveCamera, isPerspectiveCamera: true, - copy: function copy(source, recursive) { + copy: function (source, recursive) { Camera.prototype.copy.call(this, source, recursive); this.fov = source.fov; this.zoom = source.zoom; @@ -9999,9 +9435,9 @@ * * Values for focal length and film gauge must have the same unit. */ - setFocalLength: function setFocalLength(focalLength) { + setFocalLength: function (focalLength) { /** see {@link http://www.bobatkins.com/photography/technical/field_of_view.html} */ - var vExtentSlope = 0.5 * this.getFilmHeight() / focalLength; + const vExtentSlope = 0.5 * this.getFilmHeight() / focalLength; this.fov = MathUtils.RAD2DEG * 2 * Math.atan(vExtentSlope); this.updateProjectionMatrix(); }, @@ -10009,18 +9445,18 @@ /** * Calculates the focal length from the current .fov and .filmGauge. */ - getFocalLength: function getFocalLength() { - var vExtentSlope = Math.tan(MathUtils.DEG2RAD * 0.5 * this.fov); + getFocalLength: function () { + const vExtentSlope = Math.tan(MathUtils.DEG2RAD * 0.5 * this.fov); return 0.5 * this.getFilmHeight() / vExtentSlope; }, - getEffectiveFOV: function getEffectiveFOV() { + getEffectiveFOV: function () { return MathUtils.RAD2DEG * 2 * Math.atan(Math.tan(MathUtils.DEG2RAD * 0.5 * this.fov) / this.zoom); }, - getFilmWidth: function getFilmWidth() { + getFilmWidth: function () { // film not completely covered in portrait format (aspect < 1) return this.filmGauge * Math.min(this.aspect, 1); }, - getFilmHeight: function getFilmHeight() { + getFilmHeight: function () { // film not completely covered in landscape format (aspect > 1) return this.filmGauge / Math.max(this.aspect, 1); }, @@ -10060,7 +9496,7 @@ * * Note there is no reason monitors have to be the same size or in a grid. */ - setViewOffset: function setViewOffset(fullWidth, fullHeight, x, y, width, height) { + setViewOffset: function (fullWidth, fullHeight, x, y, width, height) { this.aspect = fullWidth / fullHeight; if (this.view === null) { @@ -10084,37 +9520,37 @@ this.view.height = height; this.updateProjectionMatrix(); }, - clearViewOffset: function clearViewOffset() { + clearViewOffset: function () { if (this.view !== null) { this.view.enabled = false; } this.updateProjectionMatrix(); }, - 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; + 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; if (this.view !== null && this.view.enabled) { - var fullWidth = view.fullWidth, - fullHeight = view.fullHeight; + const fullWidth = view.fullWidth, + fullHeight = view.fullHeight; left += view.offsetX * width / fullWidth; top -= view.offsetY * height / fullHeight; width *= view.width / fullWidth; height *= view.height / fullHeight; } - var skew = this.filmOffset; + const skew = this.filmOffset; if (skew !== 0) left += near * skew / this.getFilmWidth(); this.projectionMatrix.makePerspective(left, left + width, top, top - height, near, this.far); this.projectionMatrixInverse.copy(this.projectionMatrix).invert(); }, - toJSON: function toJSON(meta) { - var data = Object3D.prototype.toJSON.call(this, meta); + toJSON: function (meta) { + const data = Object3D.prototype.toJSON.call(this, meta); data.object.fov = this.fov; data.object.zoom = this.zoom; data.object.near = this.near; @@ -10128,85 +9564,60 @@ } }); - var fov = 90, - aspect = 1; - - var CubeCamera = /*#__PURE__*/function (_Object3D) { - _inheritsLoose(CubeCamera, _Object3D); - - function CubeCamera(near, far, renderTarget) { - var _this; + const fov = 90, + aspect = 1; - _this = _Object3D.call(this) || this; - _this.type = 'CubeCamera'; + class CubeCamera extends Object3D { + constructor(near, far, renderTarget) { + super(); + this.type = 'CubeCamera'; if (renderTarget.isWebGLCubeRenderTarget !== true) { console.error('THREE.CubeCamera: The constructor now expects an instance of WebGLCubeRenderTarget as third parameter.'); - return _assertThisInitialized(_this); + return; } - _this.renderTarget = renderTarget; - var cameraPX = new PerspectiveCamera(fov, aspect, near, far); - cameraPX.layers = _this.layers; + this.renderTarget = renderTarget; + const 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); - - var cameraNX = new PerspectiveCamera(fov, aspect, near, far); - cameraNX.layers = _this.layers; + this.add(cameraPX); + const 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); - - var cameraPY = new PerspectiveCamera(fov, aspect, near, far); - cameraPY.layers = _this.layers; + this.add(cameraNX); + const 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); - - var cameraNY = new PerspectiveCamera(fov, aspect, near, far); - cameraNY.layers = _this.layers; + this.add(cameraPY); + const 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); - - var cameraPZ = new PerspectiveCamera(fov, aspect, near, far); - cameraPZ.layers = _this.layers; + this.add(cameraNY); + const 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); - - var cameraNZ = new PerspectiveCamera(fov, aspect, near, far); - cameraNZ.layers = _this.layers; + this.add(cameraPZ); + const 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); - - return _this; + this.add(cameraNZ); } - var _proto = CubeCamera.prototype; - - _proto.update = function update(renderer, scene) { + update(renderer, scene) { if (this.parent === null) this.updateMatrixWorld(); - 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(); + const renderTarget = this.renderTarget; + const [cameraPX, cameraNX, cameraPY, cameraNY, cameraPZ, cameraNZ] = this.children; + const currentXrEnabled = renderer.xr.enabled; + const currentRenderTarget = renderer.getRenderTarget(); renderer.xr.enabled = false; - var generateMipmaps = renderTarget.texture.generateMipmaps; + const generateMipmaps = renderTarget.texture.generateMipmaps; renderTarget.texture.generateMipmaps = false; renderer.setRenderTarget(renderTarget, 0); renderer.render(scene, cameraPX); @@ -10223,21 +9634,16 @@ 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; - _this = _Texture.call(this, images, mapping, wrapS, wrapT, magFilter, minFilter, format, type, anisotropy, encoding) || this; // Why CubeTexture._needsFlipEnvMap is necessary: + super(images, mapping, wrapS, wrapT, magFilter, minFilter, format, type, anisotropy, encoding); // 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, @@ -10246,49 +9652,38 @@ // 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; - return _this; + this._needsFlipEnvMap = true; + this.flipY = false; } - _createClass(CubeTexture, [{ - key: "images", - get: function get() { - return this.image; - }, - set: function set(value) { - this.image = value; - } - }]); - - return CubeTexture; - }(Texture); + get images() { + return this.image; + } - CubeTexture.prototype.isCubeTexture = true; + set images(value) { + this.image = value; + } - var WebGLCubeRenderTarget = /*#__PURE__*/function (_WebGLRenderTarget) { - _inheritsLoose(WebGLCubeRenderTarget, _WebGLRenderTarget); + } - function WebGLCubeRenderTarget(size, options, dummy) { - var _this; + CubeTexture.prototype.isCubeTexture = true; + class WebGLCubeRenderTarget extends WebGLRenderTarget { + constructor(size, options, dummy) { if (Number.isInteger(options)) { console.warn('THREE.WebGLCubeRenderTarget: constructor signature is now WebGLCubeRenderTarget( size, options )'); options = dummy; } - _this = _WebGLRenderTarget.call(this, size, size, options) || this; + super(size, size, options); 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; - return _this; + 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; } - var _proto = WebGLCubeRenderTarget.prototype; - - _proto.fromEquirectangularTexture = function fromEquirectangularTexture(renderer, texture) { + fromEquirectangularTexture(renderer, texture) { this.texture.type = texture.type; this.texture.format = RGBAFormat; // see #18859 @@ -10296,7 +9691,7 @@ this.texture.generateMipmaps = texture.generateMipmaps; this.texture.minFilter = texture.minFilter; this.texture.magFilter = texture.magFilter; - var shader = { + const shader = { uniforms: { tEquirect: { value: null @@ -10304,13 +9699,48 @@ }, vertexShader: /* glsl */ - "\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", + ` + + 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 + + } + `, fragmentShader: /* glsl */ - "\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" + ` + + uniform sampler2D tEquirect; + + varying vec3 vWorldDirection; + + #include + + void main() { + + vec3 direction = normalize( vWorldDirection ); + + vec2 sampleUV = equirectUv( direction ); + + gl_FragColor = texture2D( tEquirect, sampleUV ); + + } + ` }; - var geometry = new BoxGeometry(5, 5, 5); - var material = new ShaderMaterial({ + const geometry = new BoxGeometry(5, 5, 5); + const material = new ShaderMaterial({ name: 'CubemapFromEquirect', uniforms: cloneUniforms(shader.uniforms), vertexShader: shader.vertexShader, @@ -10319,97 +9749,64 @@ blending: NoBlending }); material.uniforms.tEquirect.value = texture; - var mesh = new Mesh(geometry, material); - var currentMinFilter = texture.minFilter; // Avoid blurred poles + const mesh = new Mesh(geometry, material); + const currentMinFilter = texture.minFilter; // Avoid blurred poles if (texture.minFilter === LinearMipmapLinearFilter) texture.minFilter = LinearFilter; - var camera = new CubeCamera(1, 10, this); + const camera = new CubeCamera(1, 10, this); camera.update(renderer, mesh); texture.minFilter = currentMinFilter; mesh.geometry.dispose(); mesh.material.dispose(); return this; - }; + } - _proto.clear = function clear(renderer, color, depth, stencil) { - var currentRenderTarget = renderer.getRenderTarget(); + clear(renderer, color, depth, stencil) { + const currentRenderTarget = renderer.getRenderTarget(); - for (var i = 0; i < 6; i++) { + for (let i = 0; i < 6; i++) { renderer.setRenderTarget(this, i); renderer.clear(color, depth, stencil); } renderer.setRenderTarget(currentRenderTarget); - }; + } - return WebGLCubeRenderTarget; - }(WebGLRenderTarget); + } WebGLCubeRenderTarget.prototype.isWebGLCubeRenderTarget = true; - 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 = { + 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 = { 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; - return _this; + 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 DataTexture; - }(Texture); + } DataTexture.prototype.isDataTexture = true; - var _sphere$1 = /*@__PURE__*/new Sphere(); - - 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(); - } + const _sphere$1 = /*@__PURE__*/new Sphere(); - if (p5 === void 0) { - p5 = new Plane(); - } + const _vector$5 = /*@__PURE__*/new Vector3(); + class Frustum { + constructor(p0 = new Plane(), p1 = new Plane(), p2 = new Plane(), p3 = new Plane(), p4 = new Plane(), p5 = new Plane()) { this.planes = [p0, p1, p2, p3, p4, p5]; } - var _proto = Frustum.prototype; - - _proto.set = function set(p0, p1, p2, p3, p4, p5) { - var planes = this.planes; + set(p0, p1, p2, p3, p4, p5) { + const planes = this.planes; planes[0].copy(p0); planes[1].copy(p1); planes[2].copy(p2); @@ -10417,37 +9814,37 @@ planes[4].copy(p4); planes[5].copy(p5); return this; - }; + } - _proto.copy = function copy(frustum) { - var planes = this.planes; + copy(frustum) { + const planes = this.planes; - for (var i = 0; i < 6; i++) { + for (let i = 0; i < 6; i++) { planes[i].copy(frustum.planes[i]); } return this; - }; + } - _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]; + 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]; 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(); @@ -10455,18 +9852,18 @@ 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; - }; + } - _proto.intersectsObject = function intersectsObject(object) { - var geometry = object.geometry; + intersectsObject(object) { + const geometry = object.geometry; if (geometry.boundingSphere === null) geometry.computeBoundingSphere(); _sphere$1.copy(geometry.boundingSphere).applyMatrix4(object.matrixWorld); return this.intersectsSphere(_sphere$1); - }; + } - _proto.intersectsSprite = function intersectsSprite(sprite) { + intersectsSprite(sprite) { _sphere$1.center.set(0, 0, 0); _sphere$1.radius = 0.7071067811865476; @@ -10474,15 +9871,15 @@ _sphere$1.applyMatrix4(sprite.matrixWorld); return this.intersectsSphere(_sphere$1); - }; + } - _proto.intersectsSphere = function intersectsSphere(sphere) { - var planes = this.planes; - var center = sphere.center; - var negRadius = -sphere.radius; + intersectsSphere(sphere) { + const planes = this.planes; + const center = sphere.center; + const negRadius = -sphere.radius; - for (var i = 0; i < 6; i++) { - var distance = planes[i].distanceToPoint(center); + for (let i = 0; i < 6; i++) { + const distance = planes[i].distanceToPoint(center); if (distance < negRadius) { return false; @@ -10490,13 +9887,13 @@ } return true; - }; + } - _proto.intersectsBox = function intersectsBox(box) { - var planes = this.planes; + intersectsBox(box) { + const planes = this.planes; - for (var i = 0; i < 6; i++) { - var plane = planes[i]; // corner at max distance + for (let i = 0; i < 6; i++) { + const plane = planes[i]; // corner at max distance _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; @@ -10508,32 +9905,31 @@ } return true; - }; + } - _proto.containsPoint = function containsPoint(point) { - var planes = this.planes; + containsPoint(point) { + const planes = this.planes; - for (var i = 0; i < 6; i++) { + for (let i = 0; i < 6; i++) { if (planes[i].distanceToPoint(point) < 0) { return false; } } return true; - }; + } - _proto.clone = function clone() { + clone() { return new this.constructor().copy(this); - }; + } - return Frustum; - }(); + } function WebGLAnimation() { - var context = null; - var isAnimating = false; - var animationLoop = null; - var requestId = null; + let context = null; + let isAnimating = false; + let animationLoop = null; + let requestId = null; function onAnimationFrame(time, frame) { animationLoop(time, frame); @@ -10541,37 +9937,37 @@ } return { - start: function start() { + start: function () { if (isAnimating === true) return; if (animationLoop === null) return; requestId = context.requestAnimationFrame(onAnimationFrame); isAnimating = true; }, - stop: function stop() { + stop: function () { context.cancelAnimationFrame(requestId); isAnimating = false; }, - setAnimationLoop: function setAnimationLoop(callback) { + setAnimationLoop: function (callback) { animationLoop = callback; }, - setContext: function setContext(value) { + setContext: function (value) { context = value; } }; } function WebGLAttributes(gl, capabilities) { - var isWebGL2 = capabilities.isWebGL2; - var buffers = new WeakMap(); + const isWebGL2 = capabilities.isWebGL2; + const buffers = new WeakMap(); function createBuffer(attribute, bufferType) { - var array = attribute.array; - var usage = attribute.usage; - var buffer = gl.createBuffer(); + const array = attribute.array; + const usage = attribute.usage; + const buffer = gl.createBuffer(); gl.bindBuffer(bufferType, buffer); gl.bufferData(bufferType, array, usage); attribute.onUploadCallback(); - var type = 5126; + let type = 5126; if (array instanceof Float32Array) { type = 5126; @@ -10608,8 +10004,8 @@ } function updateBuffer(buffer, attribute, bufferType) { - var array = attribute.array; - var updateRange = attribute.updateRange; + const array = attribute.array; + const updateRange = attribute.updateRange; gl.bindBuffer(bufferType, buffer); if (updateRange.count === -1) { @@ -10634,7 +10030,7 @@ function remove(attribute) { if (attribute.isInterleavedBufferAttribute) attribute = attribute.data; - var data = buffers.get(attribute); + const data = buffers.get(attribute); if (data) { gl.deleteBuffer(data.buffer); @@ -10644,7 +10040,7 @@ function update(attribute, bufferType) { if (attribute.isGLBufferAttribute) { - var cached = buffers.get(attribute); + const cached = buffers.get(attribute); if (!cached || cached.version < attribute.version) { buffers.set(attribute, { @@ -10659,7 +10055,7 @@ } if (attribute.isInterleavedBufferAttribute) attribute = attribute.data; - var data = buffers.get(attribute); + const data = buffers.get(attribute); if (data === undefined) { buffers.set(attribute, createBuffer(attribute, bufferType)); @@ -10676,55 +10072,35 @@ }; } - 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 = { + class PlaneGeometry extends BufferGeometry { + constructor(width = 1, height = 1, widthSegments = 1, heightSegments = 1) { + super(); + this.type = 'PlaneGeometry'; + this.parameters = { width: width, height: height, widthSegments: widthSegments, heightSegments: heightSegments }; - 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; + 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; vertices.push(x, -y, 0); normals.push(0, 0, 1); uvs.push(ix / gridX); @@ -10732,30 +10108,24 @@ } } - 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; + 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; 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)); - - return _this; + 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 PlaneGeometry; - }(BufferGeometry); + } var alphamap_fragment = "#ifdef USE_ALPHAMAP\n\tdiffuseColor.a *= texture2D( alphaMap, vUv ).g;\n#endif"; @@ -11015,7 +10385,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}"; - var ShaderChunk = { + const ShaderChunk = { alphamap_fragment: alphamap_fragment, alphamap_pars_fragment: alphamap_pars_fragment, alphatest_fragment: alphatest_fragment, @@ -11151,7 +10521,7 @@ * Uniforms library for shared webgl shaders */ - var UniformsLib = { + const UniformsLib = { common: { diffuse: { value: new Color(0xeeeeee) @@ -11426,7 +10796,7 @@ } }; - var ShaderLib = { + const ShaderLib = { basic: { uniforms: mergeUniforms([UniformsLib.common, UniformsLib.specularmap, UniformsLib.envmap, UniformsLib.aomap, UniformsLib.lightmap, UniformsLib.fog]), vertexShader: ShaderChunk.meshbasic_vert, @@ -11629,16 +10999,16 @@ }; function WebGLBackground(renderer, cubemaps, state, objects, premultipliedAlpha) { - var clearColor = new Color(0x000000); - var clearAlpha = 0; - var planeMesh; - var boxMesh; - var currentBackground = null; - var currentBackgroundVersion = 0; - var currentTonemapping = null; + const clearColor = new Color(0x000000); + let clearAlpha = 0; + let planeMesh; + let boxMesh; + let currentBackground = null; + let currentBackgroundVersion = 0; + let currentTonemapping = null; function render(renderList, scene, camera, forceClear) { - var background = scene.isScene === true ? scene.background : null; + let background = scene.isScene === true ? scene.background : null; if (background && background.isTexture) { background = cubemaps.get(background); @@ -11646,8 +11016,8 @@ // TODO: Reconsider this. - var xr = renderer.xr; - var session = xr.getSession && xr.getSession(); + const xr = renderer.xr; + const session = xr.getSession && xr.getSession(); if (session && session.environmentBlendMode === 'additive') { background = null; @@ -11685,7 +11055,7 @@ Object.defineProperty(boxMesh.material, 'envMap', { - get: function get() { + get: function () { return this.uniforms.envMap.value; } }); @@ -11719,7 +11089,7 @@ planeMesh.geometry.deleteAttribute('normal'); // enable code injection for non-built-in material Object.defineProperty(planeMesh.material, 'map', { - get: function get() { + get: function () { return this.uniforms.t2D.value; } }); @@ -11751,22 +11121,18 @@ } return { - getClearColor: function getClearColor() { + getClearColor: function () { return clearColor; }, - setClearColor: function setClearColor(color, alpha) { - if (alpha === void 0) { - alpha = 1; - } - + setClearColor: function (color, alpha = 1) { clearColor.set(color); clearAlpha = alpha; setClear(clearColor, clearAlpha); }, - getClearAlpha: function getClearAlpha() { + getClearAlpha: function () { return clearAlpha; }, - setClearAlpha: function setClearAlpha(alpha) { + setClearAlpha: function (alpha) { clearAlpha = alpha; setClear(clearColor, clearAlpha); }, @@ -11775,18 +11141,18 @@ } function WebGLBindingStates(gl, extensions, attributes, capabilities) { - 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; + 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; function setup(object, material, program, geometry, index) { - var updateBuffers = false; + let updateBuffers = false; if (vaoAvailable) { - var state = getBindingState(geometry, program, material); + const state = getBindingState(geometry, program, material); if (currentState !== state) { currentState = state; @@ -11796,7 +11162,7 @@ updateBuffers = needsUpdate(geometry, index); if (updateBuffers) saveCache(geometry, index); } else { - var wireframe = material.wireframe === true; + const wireframe = material.wireframe === true; if (currentState.geometry !== geometry.id || currentState.program !== program.id || currentState.wireframe !== wireframe) { currentState.geometry = geometry.id; @@ -11839,22 +11205,22 @@ } function getBindingState(geometry, program, material) { - var wireframe = material.wireframe === true; - var programMap = bindingStates[geometry.id]; + const wireframe = material.wireframe === true; + let programMap = bindingStates[geometry.id]; if (programMap === undefined) { programMap = {}; bindingStates[geometry.id] = programMap; } - var stateMap = programMap[program.id]; + let stateMap = programMap[program.id]; if (stateMap === undefined) { stateMap = {}; programMap[program.id] = stateMap; } - var state = stateMap[wireframe]; + let state = stateMap[wireframe]; if (state === undefined) { state = createBindingState(createVertexArrayObject()); @@ -11865,11 +11231,11 @@ } function createBindingState(vao) { - var newAttributes = []; - var enabledAttributes = []; - var attributeDivisors = []; + const newAttributes = []; + const enabledAttributes = []; + const attributeDivisors = []; - for (var i = 0; i < maxVertexAttributes; i++) { + for (let i = 0; i < maxVertexAttributes; i++) { newAttributes[i] = 0; enabledAttributes[i] = 0; attributeDivisors[i] = 0; @@ -11890,13 +11256,13 @@ } function needsUpdate(geometry, index) { - var cachedAttributes = currentState.attributes; - var geometryAttributes = geometry.attributes; - var attributesNum = 0; + const cachedAttributes = currentState.attributes; + const geometryAttributes = geometry.attributes; + let attributesNum = 0; - for (var key in geometryAttributes) { - var cachedAttribute = cachedAttributes[key]; - var geometryAttribute = geometryAttributes[key]; + for (const key in geometryAttributes) { + const cachedAttribute = cachedAttributes[key]; + const geometryAttribute = geometryAttributes[key]; if (cachedAttribute === undefined) return true; if (cachedAttribute.attribute !== geometryAttribute) return true; if (cachedAttribute.data !== geometryAttribute.data) return true; @@ -11909,13 +11275,13 @@ } function saveCache(geometry, index) { - var cache = {}; - var attributes = geometry.attributes; - var attributesNum = 0; + const cache = {}; + const attributes = geometry.attributes; + let attributesNum = 0; - for (var key in attributes) { - var attribute = attributes[key]; - var data = {}; + for (const key in attributes) { + const attribute = attributes[key]; + const data = {}; data.attribute = attribute; if (attribute.data) { @@ -11932,9 +11298,9 @@ } function initAttributes() { - var newAttributes = currentState.newAttributes; + const newAttributes = currentState.newAttributes; - for (var i = 0, il = newAttributes.length; i < il; i++) { + for (let i = 0, il = newAttributes.length; i < il; i++) { newAttributes[i] = 0; } } @@ -11944,9 +11310,9 @@ } function enableAttributeAndDivisor(attribute, meshPerAttribute) { - var newAttributes = currentState.newAttributes; - var enabledAttributes = currentState.enabledAttributes; - var attributeDivisors = currentState.attributeDivisors; + const newAttributes = currentState.newAttributes; + const enabledAttributes = currentState.enabledAttributes; + const attributeDivisors = currentState.attributeDivisors; newAttributes[attribute] = 1; if (enabledAttributes[attribute] === 0) { @@ -11955,19 +11321,17 @@ } if (attributeDivisors[attribute] !== meshPerAttribute) { - var _extension = capabilities.isWebGL2 ? gl : extensions.get('ANGLE_instanced_arrays'); - - _extension[capabilities.isWebGL2 ? 'vertexAttribDivisor' : 'vertexAttribDivisorANGLE'](attribute, meshPerAttribute); - + const extension = capabilities.isWebGL2 ? gl : extensions.get('ANGLE_instanced_arrays'); + extension[capabilities.isWebGL2 ? 'vertexAttribDivisor' : 'vertexAttribDivisorANGLE'](attribute, meshPerAttribute); attributeDivisors[attribute] = meshPerAttribute; } } function disableUnusedAttributes() { - var newAttributes = currentState.newAttributes; - var enabledAttributes = currentState.enabledAttributes; + const newAttributes = currentState.newAttributes; + const enabledAttributes = currentState.enabledAttributes; - for (var i = 0, il = enabledAttributes.length; i < il; i++) { + for (let i = 0, il = enabledAttributes.length; i < il; i++) { if (enabledAttributes[i] !== newAttributes[i]) { gl.disableVertexAttribArray(i); enabledAttributes[i] = 0; @@ -11989,30 +11353,30 @@ } initAttributes(); - var geometryAttributes = geometry.attributes; - var programAttributes = program.getAttributes(); - var materialDefaultAttributeValues = material.defaultAttributeValues; + const geometryAttributes = geometry.attributes; + const programAttributes = program.getAttributes(); + const materialDefaultAttributeValues = material.defaultAttributeValues; - for (var name in programAttributes) { - var programAttribute = programAttributes[name]; + for (const name in programAttributes) { + const programAttribute = programAttributes[name]; if (programAttribute >= 0) { - var geometryAttribute = geometryAttributes[name]; + const geometryAttribute = geometryAttributes[name]; if (geometryAttribute !== undefined) { - var normalized = geometryAttribute.normalized; - var size = geometryAttribute.itemSize; - var attribute = attributes.get(geometryAttribute); // TODO Attribute may not be available on context restore + const normalized = geometryAttribute.normalized; + const size = geometryAttribute.itemSize; + const attribute = attributes.get(geometryAttribute); // TODO Attribute may not be available on context restore if (attribute === undefined) continue; - var buffer = attribute.buffer; - var type = attribute.type; - var bytesPerElement = attribute.bytesPerElement; + const buffer = attribute.buffer; + const type = attribute.type; + const bytesPerElement = attribute.bytesPerElement; if (geometryAttribute.isInterleavedBufferAttribute) { - var data = geometryAttribute.data; - var stride = data.stride; - var offset = geometryAttribute.offset; + const data = geometryAttribute.data; + const stride = data.stride; + const offset = geometryAttribute.offset; if (data && data.isInstancedInterleavedBuffer) { enableAttributeAndDivisor(programAttribute, data.meshPerAttribute); @@ -12041,33 +11405,31 @@ vertexAttribPointer(programAttribute, size, type, normalized, 0, 0); } } else if (name === 'instanceMatrix') { - var _attribute = attributes.get(object.instanceMatrix); // TODO Attribute may not be available on context restore - + const attribute = attributes.get(object.instanceMatrix); // TODO Attribute may not be available on context restore - if (_attribute === undefined) continue; - var _buffer = _attribute.buffer; - var _type = _attribute.type; + if (attribute === undefined) continue; + const buffer = attribute.buffer; + const 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') { - var _attribute2 = attributes.get(object.instanceColor); // TODO Attribute may not be available on context restore - + const attribute = attributes.get(object.instanceColor); // TODO Attribute may not be available on context restore - if (_attribute2 === undefined) continue; - var _buffer2 = _attribute2.buffer; - var _type2 = _attribute2.type; + if (attribute === undefined) continue; + const buffer = attribute.buffer; + const type = attribute.type; enableAttributeAndDivisor(programAttribute, 1); - gl.bindBuffer(34962, _buffer2); - gl.vertexAttribPointer(programAttribute, 3, _type2, false, 12, 0); + gl.bindBuffer(34962, buffer); + gl.vertexAttribPointer(programAttribute, 3, type, false, 12, 0); } else if (materialDefaultAttributeValues !== undefined) { - var value = materialDefaultAttributeValues[name]; + const value = materialDefaultAttributeValues[name]; if (value !== undefined) { switch (value.length) { @@ -12097,13 +11459,13 @@ function dispose() { reset(); - for (var geometryId in bindingStates) { - var programMap = bindingStates[geometryId]; + for (const geometryId in bindingStates) { + const programMap = bindingStates[geometryId]; - for (var programId in programMap) { - var stateMap = programMap[programId]; + for (const programId in programMap) { + const stateMap = programMap[programId]; - for (var wireframe in stateMap) { + for (const wireframe in stateMap) { deleteVertexArrayObject(stateMap[wireframe].object); delete stateMap[wireframe]; } @@ -12117,12 +11479,12 @@ function releaseStatesOfGeometry(geometry) { if (bindingStates[geometry.id] === undefined) return; - var programMap = bindingStates[geometry.id]; + const programMap = bindingStates[geometry.id]; - for (var programId in programMap) { - var stateMap = programMap[programId]; + for (const programId in programMap) { + const stateMap = programMap[programId]; - for (var wireframe in stateMap) { + for (const wireframe in stateMap) { deleteVertexArrayObject(stateMap[wireframe].object); delete stateMap[wireframe]; } @@ -12134,12 +11496,12 @@ } function releaseStatesOfProgram(program) { - for (var geometryId in bindingStates) { - var programMap = bindingStates[geometryId]; + for (const geometryId in bindingStates) { + const programMap = bindingStates[geometryId]; if (programMap[program.id] === undefined) continue; - var stateMap = programMap[program.id]; + const stateMap = programMap[program.id]; - for (var wireframe in stateMap) { + for (const wireframe in stateMap) { deleteVertexArrayObject(stateMap[wireframe].object); delete stateMap[wireframe]; } @@ -12176,8 +11538,8 @@ } function WebGLBufferRenderer(gl, extensions, info, capabilities) { - var isWebGL2 = capabilities.isWebGL2; - var mode; + const isWebGL2 = capabilities.isWebGL2; + let mode; function setMode(value) { mode = value; @@ -12190,7 +11552,7 @@ function renderInstances(start, count, primcount) { if (primcount === 0) return; - var extension, methodName; + let extension, methodName; if (isWebGL2) { extension = gl; @@ -12216,13 +11578,13 @@ } function WebGLCapabilities(gl, extensions, parameters) { - var maxAnisotropy; + let maxAnisotropy; function getMaxAnisotropy() { if (maxAnisotropy !== undefined) return maxAnisotropy; if (extensions.has('EXT_texture_filter_anisotropic') === true) { - var extension = extensions.get('EXT_texture_filter_anisotropic'); + const extension = extensions.get('EXT_texture_filter_anisotropic'); maxAnisotropy = gl.getParameter(extension.MAX_TEXTURE_MAX_ANISOTROPY_EXT); } else { maxAnisotropy = 0; @@ -12251,30 +11613,30 @@ /* eslint-disable no-undef */ - var isWebGL2 = typeof WebGL2RenderingContext !== 'undefined' && gl instanceof WebGL2RenderingContext || typeof WebGL2ComputeRenderingContext !== 'undefined' && gl instanceof WebGL2ComputeRenderingContext; + const isWebGL2 = typeof WebGL2RenderingContext !== 'undefined' && gl instanceof WebGL2RenderingContext || typeof WebGL2ComputeRenderingContext !== 'undefined' && gl instanceof WebGL2ComputeRenderingContext; /* eslint-enable no-undef */ - var precision = parameters.precision !== undefined ? parameters.precision : 'highp'; - var maxPrecision = getMaxPrecision(precision); + let precision = parameters.precision !== undefined ? parameters.precision : 'highp'; + const maxPrecision = getMaxPrecision(precision); if (maxPrecision !== precision) { console.warn('THREE.WebGLRenderer:', precision, 'not supported, using', maxPrecision, 'instead.'); precision = maxPrecision; } - 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; + 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; return { isWebGL2: isWebGL2, getMaxAnisotropy: getMaxAnisotropy, @@ -12297,14 +11659,14 @@ } function WebGLClipping(properties) { - var scope = this; - var globalState = null, + const scope = this; + let globalState = null, numGlobalPlanes = 0, localClippingEnabled = false, renderingShadows = false; - var plane = new Plane(), - viewNormalMatrix = new Matrix3(), - uniform = { + const plane = new Plane(), + viewNormalMatrix = new Matrix3(), + uniform = { value: null, needsUpdate: false }; @@ -12313,7 +11675,7 @@ this.numIntersection = 0; this.init = function (planes, enableLocalClipping, camera) { - var enabled = planes.length !== 0 || enableLocalClipping || // enable state of previous frame - the clipping code has to + const enabled = planes.length !== 0 || enableLocalClipping || // enable state of previous frame - the clipping code has to // run another frame in order to reset the state: numGlobalPlanes !== 0 || localClippingEnabled; localClippingEnabled = enableLocalClipping; @@ -12333,10 +11695,10 @@ }; this.setState = function (material, camera, useCache) { - var planes = material.clippingPlanes, - clipIntersection = material.clipIntersection, - clipShadows = material.clipShadows; - var materialProperties = properties.get(material); + const planes = material.clippingPlanes, + clipIntersection = material.clipIntersection, + clipShadows = material.clipShadows; + const materialProperties = properties.get(material); if (!localClippingEnabled || planes === null || planes.length === 0 || renderingShadows && !clipShadows) { // there's no local clipping @@ -12347,14 +11709,14 @@ resetGlobalState(); } } else { - var nGlobal = renderingShadows ? 0 : numGlobalPlanes, - lGlobal = nGlobal * 4; - var dstArray = materialProperties.clippingState || null; + const nGlobal = renderingShadows ? 0 : numGlobalPlanes, + lGlobal = nGlobal * 4; + let dstArray = materialProperties.clippingState || null; uniform.value = dstArray; // ensure unique state dstArray = projectPlanes(planes, camera, lGlobal, useCache); - for (var i = 0; i !== lGlobal; ++i) { + for (let i = 0; i !== lGlobal; ++i) { dstArray[i] = globalState[i]; } @@ -12375,22 +11737,22 @@ } function projectPlanes(planes, camera, dstOffset, skipTransform) { - var nPlanes = planes !== null ? planes.length : 0; - var dstArray = null; + const nPlanes = planes !== null ? planes.length : 0; + let dstArray = null; if (nPlanes !== 0) { dstArray = uniform.value; if (skipTransform !== true || dstArray === null) { - var flatSize = dstOffset + nPlanes * 4, - viewMatrix = camera.matrixWorldInverse; + const flatSize = dstOffset + nPlanes * 4, + viewMatrix = camera.matrixWorldInverse; viewNormalMatrix.getNormalMatrix(viewMatrix); if (dstArray === null || dstArray.length < flatSize) { dstArray = new Float32Array(flatSize); } - for (var i = 0, i4 = dstOffset; i !== nPlanes; ++i, i4 += 4) { + for (let i = 0, i4 = dstOffset; i !== nPlanes; ++i, i4 += 4) { plane.copy(planes[i]).applyMatrix4(viewMatrix, viewNormalMatrix); plane.normal.toArray(dstArray, i4); dstArray[i4 + 3] = plane.constant; @@ -12408,7 +11770,7 @@ } function WebGLCubeMaps(renderer) { - var cubemaps = new WeakMap(); + let cubemaps = new WeakMap(); function mapTextureMapping(texture, mapping) { if (mapping === EquirectangularReflectionMapping) { @@ -12422,18 +11784,18 @@ function get(texture) { if (texture && texture.isTexture) { - var mapping = texture.mapping; + const mapping = texture.mapping; if (mapping === EquirectangularReflectionMapping || mapping === EquirectangularRefractionMapping) { if (cubemaps.has(texture)) { - var cubemap = cubemaps.get(texture).texture; + const cubemap = cubemaps.get(texture).texture; return mapTextureMapping(cubemap, texture.mapping); } else { - var image = texture.image; + const image = texture.image; if (image && image.height > 0) { - var currentRenderTarget = renderer.getRenderTarget(); - var renderTarget = new WebGLCubeRenderTarget(image.height / 2); + const currentRenderTarget = renderer.getRenderTarget(); + const renderTarget = new WebGLCubeRenderTarget(image.height / 2); renderTarget.fromEquirectangularTexture(renderer, texture); cubemaps.set(texture, renderTarget); renderer.setRenderTarget(currentRenderTarget); @@ -12451,9 +11813,9 @@ } function onTextureDispose(event) { - var texture = event.target; + const texture = event.target; texture.removeEventListener('dispose', onTextureDispose); - var cubemap = cubemaps.get(texture); + const cubemap = cubemaps.get(texture); if (cubemap !== undefined) { cubemaps.delete(texture); @@ -12472,14 +11834,14 @@ } function WebGLExtensions(gl) { - var extensions = {}; + const extensions = {}; function getExtension(name) { if (extensions[name] !== undefined) { return extensions[name]; } - var extension; + let extension; switch (name) { case 'WEBGL_depth_texture': @@ -12507,10 +11869,10 @@ } return { - has: function has(name) { + has: function (name) { return getExtension(name) !== null; }, - init: function init(capabilities) { + init: function (capabilities) { if (capabilities.isWebGL2) { getExtension('EXT_color_buffer_float'); } else { @@ -12527,8 +11889,8 @@ getExtension('OES_texture_float_linear'); getExtension('EXT_color_buffer_half_float'); }, - get: function get(name) { - var extension = getExtension(name); + get: function (name) { + const extension = getExtension(name); if (extension === null) { console.warn('THREE.WebGLRenderer: ' + name + ' extension not supported.'); @@ -12540,23 +11902,23 @@ } function WebGLGeometries(gl, attributes, info, bindingStates) { - var geometries = {}; - var wireframeAttributes = new WeakMap(); + const geometries = {}; + const wireframeAttributes = new WeakMap(); function onGeometryDispose(event) { - var geometry = event.target; + const geometry = event.target; if (geometry.index !== null) { attributes.remove(geometry.index); } - for (var name in geometry.attributes) { + for (const name in geometry.attributes) { attributes.remove(geometry.attributes[name]); } geometry.removeEventListener('dispose', onGeometryDispose); delete geometries[geometry.id]; - var attribute = wireframeAttributes.get(geometry); + const attribute = wireframeAttributes.get(geometry); if (attribute) { attributes.remove(attribute); @@ -12582,70 +11944,67 @@ } function update(geometry) { - var geometryAttributes = geometry.attributes; // Updating index buffer in VAO now. See WebGLBindingStates. + const geometryAttributes = geometry.attributes; // Updating index buffer in VAO now. See WebGLBindingStates. - for (var name in geometryAttributes) { + for (const name in geometryAttributes) { attributes.update(geometryAttributes[name], 34962); } // morph targets - var morphAttributes = geometry.morphAttributes; + const morphAttributes = geometry.morphAttributes; - for (var _name in morphAttributes) { - var array = morphAttributes[_name]; + for (const name in morphAttributes) { + const array = morphAttributes[name]; - for (var i = 0, l = array.length; i < l; i++) { + for (let i = 0, l = array.length; i < l; i++) { attributes.update(array[i], 34962); } } } function updateWireframeAttribute(geometry) { - var indices = []; - var geometryIndex = geometry.index; - var geometryPosition = geometry.attributes.position; - var version = 0; + const indices = []; + const geometryIndex = geometry.index; + const geometryPosition = geometry.attributes.position; + let version = 0; if (geometryIndex !== null) { - var array = geometryIndex.array; + const array = geometryIndex.array; version = geometryIndex.version; - 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]; + 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]; indices.push(a, b, b, c, c, a); } } else { - var _array = geometryPosition.array; + const array = geometryPosition.array; version = geometryPosition.version; - 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); + 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); } } - var attribute = new (arrayMax(indices) > 65535 ? Uint32BufferAttribute : Uint16BufferAttribute)(indices, 1); + const attribute = new (arrayMax(indices) > 65535 ? Uint32BufferAttribute : Uint16BufferAttribute)(indices, 1); attribute.version = version; // Updating index buffer in VAO now. See WebGLBindingStates // - var previousAttribute = wireframeAttributes.get(geometry); + const previousAttribute = wireframeAttributes.get(geometry); if (previousAttribute) attributes.remove(previousAttribute); // wireframeAttributes.set(geometry, attribute); } function getWireframeAttribute(geometry) { - var currentAttribute = wireframeAttributes.get(geometry); + const currentAttribute = wireframeAttributes.get(geometry); if (currentAttribute) { - var geometryIndex = geometry.index; + const geometryIndex = geometry.index; if (geometryIndex !== null) { // if the attribute is obsolete, create a new one @@ -12668,14 +12027,14 @@ } function WebGLIndexedBufferRenderer(gl, extensions, info, capabilities) { - var isWebGL2 = capabilities.isWebGL2; - var mode; + const isWebGL2 = capabilities.isWebGL2; + let mode; function setMode(value) { mode = value; } - var type, bytesPerElement; + let type, bytesPerElement; function setIndex(value) { type = value.type; @@ -12689,7 +12048,7 @@ function renderInstances(start, count, primcount) { if (primcount === 0) return; - var extension, methodName; + let extension, methodName; if (isWebGL2) { extension = gl; @@ -12716,11 +12075,11 @@ } function WebGLInfo(gl) { - var memory = { + const memory = { geometries: 0, textures: 0 }; - var render = { + const render = { frame: 0, calls: 0, triangles: 0, @@ -12785,89 +12144,89 @@ } function WebGLMorphtargets(gl) { - var influencesList = {}; - var morphInfluences = new Float32Array(8); - var workInfluences = []; + const influencesList = {}; + const morphInfluences = new Float32Array(8); + const workInfluences = []; - for (var i = 0; i < 8; i++) { + for (let i = 0; i < 8; i++) { workInfluences[i] = [i, 0]; } function update(object, geometry, material, program) { - var objectInfluences = object.morphTargetInfluences; // When object doesn't have morph target influences defined, we treat it as a 0-length array + const 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 - var length = objectInfluences === undefined ? 0 : objectInfluences.length; - var influences = influencesList[geometry.id]; + const length = objectInfluences === undefined ? 0 : objectInfluences.length; + let influences = influencesList[geometry.id]; if (influences === undefined) { // initialise list influences = []; - for (var _i = 0; _i < length; _i++) { - influences[_i] = [_i, 0]; + for (let i = 0; i < length; i++) { + influences[i] = [i, 0]; } influencesList[geometry.id] = influences; } // Collect influences - for (var _i2 = 0; _i2 < length; _i2++) { - var influence = influences[_i2]; - influence[0] = _i2; - influence[1] = objectInfluences[_i2]; + for (let i = 0; i < length; i++) { + const influence = influences[i]; + influence[0] = i; + influence[1] = objectInfluences[i]; } influences.sort(absNumericalSort); - 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]; + 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]; } else { - workInfluences[_i3][0] = Number.MAX_SAFE_INTEGER; - workInfluences[_i3][1] = 0; + workInfluences[i][0] = Number.MAX_SAFE_INTEGER; + workInfluences[i][1] = 0; } } workInfluences.sort(numericalSort); - var morphTargets = material.morphTargets && geometry.morphAttributes.position; - var morphNormals = material.morphNormals && geometry.morphAttributes.normal; - var morphInfluencesSum = 0; + const morphTargets = material.morphTargets && geometry.morphAttributes.position; + const morphNormals = material.morphNormals && geometry.morphAttributes.normal; + let morphInfluencesSum = 0; - for (var _i4 = 0; _i4 < 8; _i4++) { - var _influence = workInfluences[_i4]; - var index = _influence[0]; - var value = _influence[1]; + for (let i = 0; i < 8; i++) { + const influence = workInfluences[i]; + const index = influence[0]; + const value = influence[1]; if (index !== Number.MAX_SAFE_INTEGER && value) { - if (morphTargets && geometry.getAttribute('morphTarget' + _i4) !== morphTargets[index]) { - geometry.setAttribute('morphTarget' + _i4, morphTargets[index]); + if (morphTargets && geometry.getAttribute('morphTarget' + i) !== morphTargets[index]) { + geometry.setAttribute('morphTarget' + i, morphTargets[index]); } - if (morphNormals && geometry.getAttribute('morphNormal' + _i4) !== morphNormals[index]) { - geometry.setAttribute('morphNormal' + _i4, morphNormals[index]); + if (morphNormals && geometry.getAttribute('morphNormal' + i) !== morphNormals[index]) { + geometry.setAttribute('morphNormal' + i, morphNormals[index]); } - morphInfluences[_i4] = value; + morphInfluences[i] = value; morphInfluencesSum += value; } else { - if (morphTargets && geometry.hasAttribute('morphTarget' + _i4) === true) { - geometry.deleteAttribute('morphTarget' + _i4); + if (morphTargets && geometry.hasAttribute('morphTarget' + i) === true) { + geometry.deleteAttribute('morphTarget' + i); } - if (morphNormals && geometry.hasAttribute('morphNormal' + _i4) === true) { - geometry.deleteAttribute('morphNormal' + _i4); + if (morphNormals && geometry.hasAttribute('morphNormal' + i) === true) { + geometry.deleteAttribute('morphNormal' + i); } - morphInfluences[_i4] = 0; + morphInfluences[i] = 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) - var morphBaseInfluence = geometry.morphTargetsRelative ? 1 : 1 - morphInfluencesSum; + const morphBaseInfluence = geometry.morphTargetsRelative ? 1 : 1 - morphInfluencesSum; program.getUniforms().setValue(gl, 'morphTargetBaseInfluence', morphBaseInfluence); program.getUniforms().setValue(gl, 'morphTargetInfluences', morphInfluences); } @@ -12878,12 +12237,12 @@ } function WebGLObjects(gl, geometries, attributes, info) { - var updateMap = new WeakMap(); + let updateMap = new WeakMap(); function update(object) { - var frame = info.render.frame; - var geometry = object.geometry; - var buffergeometry = geometries.get(object, geometry); // Update once per frame + const frame = info.render.frame; + const geometry = object.geometry; + const buffergeometry = geometries.get(object, geometry); // Update once per frame if (updateMap.get(buffergeometry) !== frame) { geometries.update(buffergeometry); @@ -12910,7 +12269,7 @@ } function onInstancedMeshDispose(event) { - var instancedMesh = event.target; + const instancedMesh = event.target; instancedMesh.removeEventListener('dispose', onInstancedMeshDispose); attributes.remove(instancedMesh.instanceMatrix); if (instancedMesh.instanceColor !== null) attributes.remove(instancedMesh.instanceColor); @@ -12922,71 +12281,29 @@ }; } - 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 + class DataTexture2DArray extends Texture { + constructor(data = null, width = 1, height = 1, depth = 1) { + super(null); + this.image = { + data, + width, + height, + depth }; - _this.magFilter = NearestFilter; - _this.minFilter = NearestFilter; - _this.wrapR = ClampToEdgeWrapping; - _this.generateMipmaps = false; - _this.flipY = false; - _this.needsUpdate = true; - return _this; + this.magFilter = NearestFilter; + this.minFilter = NearestFilter; + this.wrapR = ClampToEdgeWrapping; + this.generateMipmaps = false; + this.flipY = false; + this.needsUpdate = true; } - return DataTexture2DArray; - }(Texture); + } DataTexture2DArray.prototype.isDataTexture2DArray = true; - 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; - } - + class DataTexture3D extends Texture { + constructor(data = null, width = 1, height = 1, depth = 1) { // We're going to add .setXXX() methods for setting properties later. // Users can still set in DataTexture3D directly. // @@ -12994,24 +12311,22 @@ // texture.anisotropy = 16; // // See #14839 - _this = _Texture.call(this, null) || this; - _this.image = { - data: data, - width: width, - height: height, - depth: depth + super(null); + this.image = { + data, + width, + height, + depth }; - _this.magFilter = NearestFilter; - _this.minFilter = NearestFilter; - _this.wrapR = ClampToEdgeWrapping; - _this.generateMipmaps = false; - _this.flipY = false; - _this.needsUpdate = true; - return _this; + this.magFilter = NearestFilter; + this.minFilter = NearestFilter; + this.wrapR = ClampToEdgeWrapping; + this.generateMipmaps = false; + this.flipY = false; + this.needsUpdate = true; } - return DataTexture3D; - }(Texture); + } DataTexture3D.prototype.isDataTexture3D = true; @@ -13057,26 +12372,26 @@ * like .set for an optional property of the object * */ - var emptyTexture = new Texture(); - var emptyTexture2dArray = new DataTexture2DArray(); - var emptyTexture3d = new DataTexture3D(); - var emptyCubeTexture = new CubeTexture(); // --- Utilities --- + const emptyTexture = new Texture(); + const emptyTexture2dArray = new DataTexture2DArray(); + const emptyTexture3d = new DataTexture3D(); + const emptyCubeTexture = new CubeTexture(); // --- Utilities --- // Array Caches (provide typed arrays for temporary by size) - var arrayCacheF32 = []; - var arrayCacheI32 = []; // Float32Array caches used for uploading Matrix uniforms + const arrayCacheF32 = []; + const arrayCacheI32 = []; // Float32Array caches used for uploading Matrix uniforms - var mat4array = new Float32Array(16); - var mat3array = new Float32Array(9); - var mat2array = new Float32Array(4); // Flattening for arrays of vectors and matrices + const mat4array = new Float32Array(16); + const mat3array = new Float32Array(9); + const mat2array = new Float32Array(4); // Flattening for arrays of vectors and matrices function flatten(array, nBlocks, blockSize) { - var firstElem = array[0]; + const firstElem = array[0]; if (firstElem <= 0 || firstElem > 0) return array; // unoptimized: ! isNaN( firstElem ) // see http://jacksondunstan.com/articles/983 - var n = nBlocks * blockSize; - var r = arrayCacheF32[n]; + const n = nBlocks * blockSize; + let r = arrayCacheF32[n]; if (r === undefined) { r = new Float32Array(n); @@ -13086,7 +12401,7 @@ if (nBlocks !== 0) { firstElem.toArray(r, 0); - for (var i = 1, offset = 0; i !== nBlocks; ++i) { + for (let i = 1, offset = 0; i !== nBlocks; ++i) { offset += blockSize; array[i].toArray(r, offset); } @@ -13098,7 +12413,7 @@ function arraysEqual(a, b) { if (a.length !== b.length) return false; - for (var i = 0, l = a.length; i < l; i++) { + for (let i = 0, l = a.length; i < l; i++) { if (a[i] !== b[i]) return false; } @@ -13106,21 +12421,21 @@ } function copyArray(a, b) { - for (var i = 0, l = b.length; i < l; i++) { + for (let i = 0, l = b.length; i < l; i++) { a[i] = b[i]; } } // Texture unit allocation function allocTexUnits(textures, n) { - var r = arrayCacheI32[n]; + let r = arrayCacheI32[n]; if (r === undefined) { r = new Int32Array(n); arrayCacheI32[n] = r; } - for (var i = 0; i !== n; ++i) { + for (let i = 0; i !== n; ++i) { r[i] = textures.allocateTextureUnit(); } @@ -13132,7 +12447,7 @@ function setValueV1f(gl, v) { - var cache = this.cache; + const cache = this.cache; if (cache[0] === v) return; gl.uniform1f(this.addr, v); cache[0] = v; @@ -13140,7 +12455,7 @@ function setValueV2f(gl, v) { - var cache = this.cache; + const cache = this.cache; if (v.x !== undefined) { if (cache[0] !== v.x || cache[1] !== v.y) { @@ -13156,7 +12471,7 @@ } function setValueV3f(gl, v) { - var cache = this.cache; + const cache = this.cache; if (v.x !== undefined) { if (cache[0] !== v.x || cache[1] !== v.y || cache[2] !== v.z) { @@ -13180,7 +12495,7 @@ } function setValueV4f(gl, v) { - var cache = this.cache; + const cache = this.cache; if (v.x !== undefined) { if (cache[0] !== v.x || cache[1] !== v.y || cache[2] !== v.z || cache[3] !== v.w) { @@ -13199,8 +12514,8 @@ function setValueM2(gl, v) { - var cache = this.cache; - var elements = v.elements; + const cache = this.cache; + const elements = v.elements; if (elements === undefined) { if (arraysEqual(cache, v)) return; @@ -13215,8 +12530,8 @@ } function setValueM3(gl, v) { - var cache = this.cache; - var elements = v.elements; + const cache = this.cache; + const elements = v.elements; if (elements === undefined) { if (arraysEqual(cache, v)) return; @@ -13231,8 +12546,8 @@ } function setValueM4(gl, v) { - var cache = this.cache; - var elements = v.elements; + const cache = this.cache; + const elements = v.elements; if (elements === undefined) { if (arraysEqual(cache, v)) return; @@ -13248,8 +12563,8 @@ function setValueT1(gl, v, textures) { - var cache = this.cache; - var unit = textures.allocateTextureUnit(); + const cache = this.cache; + const unit = textures.allocateTextureUnit(); if (cache[0] !== unit) { gl.uniform1i(this.addr, unit); @@ -13260,8 +12575,8 @@ } function setValueT2DArray1(gl, v, textures) { - var cache = this.cache; - var unit = textures.allocateTextureUnit(); + const cache = this.cache; + const unit = textures.allocateTextureUnit(); if (cache[0] !== unit) { gl.uniform1i(this.addr, unit); @@ -13272,8 +12587,8 @@ } function setValueT3D1(gl, v, textures) { - var cache = this.cache; - var unit = textures.allocateTextureUnit(); + const cache = this.cache; + const unit = textures.allocateTextureUnit(); if (cache[0] !== unit) { gl.uniform1i(this.addr, unit); @@ -13284,8 +12599,8 @@ } function setValueT6(gl, v, textures) { - var cache = this.cache; - var unit = textures.allocateTextureUnit(); + const cache = this.cache; + const unit = textures.allocateTextureUnit(); if (cache[0] !== unit) { gl.uniform1i(this.addr, unit); @@ -13297,28 +12612,28 @@ function setValueV1i(gl, v) { - var cache = this.cache; + const cache = this.cache; if (cache[0] === v) return; gl.uniform1i(this.addr, v); cache[0] = v; } function setValueV2i(gl, v) { - var cache = this.cache; + const cache = this.cache; if (arraysEqual(cache, v)) return; gl.uniform2iv(this.addr, v); copyArray(cache, v); } function setValueV3i(gl, v) { - var cache = this.cache; + const cache = this.cache; if (arraysEqual(cache, v)) return; gl.uniform3iv(this.addr, v); copyArray(cache, v); } function setValueV4i(gl, v) { - var cache = this.cache; + const cache = this.cache; if (arraysEqual(cache, v)) return; gl.uniform4iv(this.addr, v); copyArray(cache, v); @@ -13326,7 +12641,7 @@ function setValueV1ui(gl, v) { - var cache = this.cache; + const cache = this.cache; if (cache[0] === v) return; gl.uniform1ui(this.addr, v); cache[0] = v; @@ -13453,53 +12768,53 @@ function setValueV2fArray(gl, v) { - var data = flatten(v, this.size, 2); + const data = flatten(v, this.size, 2); gl.uniform2fv(this.addr, data); } function setValueV3fArray(gl, v) { - var data = flatten(v, this.size, 3); + const data = flatten(v, this.size, 3); gl.uniform3fv(this.addr, data); } function setValueV4fArray(gl, v) { - var data = flatten(v, this.size, 4); + const data = flatten(v, this.size, 4); gl.uniform4fv(this.addr, data); } // Array of matrices (flat or from THREE clases) function setValueM2Array(gl, v) { - var data = flatten(v, this.size, 4); + const data = flatten(v, this.size, 4); gl.uniformMatrix2fv(this.addr, false, data); } function setValueM3Array(gl, v) { - var data = flatten(v, this.size, 9); + const data = flatten(v, this.size, 9); gl.uniformMatrix3fv(this.addr, false, data); } function setValueM4Array(gl, v) { - var data = flatten(v, this.size, 16); + const data = flatten(v, this.size, 16); gl.uniformMatrix4fv(this.addr, false, data); } // Array of textures (2D / Cube) function setValueT1Array(gl, v, textures) { - var n = v.length; - var units = allocTexUnits(textures, n); + const n = v.length; + const units = allocTexUnits(textures, n); gl.uniform1iv(this.addr, units); - for (var i = 0; i !== n; ++i) { + for (let i = 0; i !== n; ++i) { textures.safeSetTexture2D(v[i] || emptyTexture, units[i]); } } function setValueT6Array(gl, v, textures) { - var n = v.length; - var units = allocTexUnits(textures, n); + const n = v.length; + const units = allocTexUnits(textures, n); gl.uniform1iv(this.addr, units); - for (var i = 0; i !== n; ++i) { + for (let i = 0; i !== n; ++i) { textures.safeSetTextureCube(v[i] || emptyCubeTexture, units[i]); } } // Helper to pick the right setter for a pure (bottom-level) array @@ -13596,7 +12911,7 @@ } PureArrayUniform.prototype.updateCache = function (data) { - var cache = this.cache; + const cache = this.cache; if (data instanceof Float32Array && cache.length !== data.length) { this.cache = new Float32Array(data.length); @@ -13612,17 +12927,17 @@ } StructuredUniform.prototype.setValue = function (gl, value, textures) { - var seq = this.seq; + const seq = this.seq; - for (var i = 0, n = seq.length; i !== n; ++i) { - var u = seq[i]; + for (let i = 0, n = seq.length; i !== n; ++i) { + const u = seq[i]; u.setValue(gl, value[u.id], textures); } }; // --- Top-level --- // Parser - builds up the property tree from the path strings - var RePathPart = /(\w+)(\])?(\[|\.)?/g; // extracts + const 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) @@ -13637,17 +12952,17 @@ } function parseUniform(activeInfo, addr, container) { - var path = activeInfo.name, - pathLength = path.length; // reset RegExp object, because of the early exit of a previous run + const path = activeInfo.name, + pathLength = path.length; // reset RegExp object, because of the early exit of a previous run RePathPart.lastIndex = 0; while (true) { - var match = RePathPart.exec(path), - matchEnd = RePathPart.lastIndex; - var id = match[1]; - var idIsIndex = match[2] === ']', - subscript = match[3]; + const match = RePathPart.exec(path), + matchEnd = RePathPart.lastIndex; + let id = match[1]; + const idIsIndex = match[2] === ']', + subscript = match[3]; if (idIsIndex) id = id | 0; // convert to integer if (subscript === undefined || subscript === '[' && matchEnd + 2 === pathLength) { @@ -13656,8 +12971,8 @@ break; } else { // step into inner node / create it in case it doesn't exist - var map = container.map; - var next = map[id]; + const map = container.map; + let next = map[id]; if (next === undefined) { next = new StructuredUniform(id); @@ -13673,30 +12988,30 @@ function WebGLUniforms(gl, program) { this.seq = []; this.map = {}; - var n = gl.getProgramParameter(program, 35718); + const n = gl.getProgramParameter(program, 35718); - for (var i = 0; i < n; ++i) { - var info = gl.getActiveUniform(program, i), - addr = gl.getUniformLocation(program, info.name); + for (let i = 0; i < n; ++i) { + const info = gl.getActiveUniform(program, i), + addr = gl.getUniformLocation(program, info.name); parseUniform(info, addr, this); } } WebGLUniforms.prototype.setValue = function (gl, name, value, textures) { - var u = this.map[name]; + const u = this.map[name]; if (u !== undefined) u.setValue(gl, value, textures); }; WebGLUniforms.prototype.setOptional = function (gl, object, name) { - var v = object[name]; + const v = object[name]; if (v !== undefined) this.setValue(gl, name, v); }; // Static interface WebGLUniforms.upload = function (gl, seq, values, textures) { - for (var i = 0, n = seq.length; i !== n; ++i) { - var u = seq[i], - v = values[u.id]; + for (let i = 0, n = seq.length; i !== n; ++i) { + const u = seq[i], + v = values[u.id]; if (v.needsUpdate !== false) { // note: always updating when .needsUpdate is undefined @@ -13706,10 +13021,10 @@ }; WebGLUniforms.seqWithValue = function (seq, values) { - var r = []; + const r = []; - for (var i = 0, n = seq.length; i !== n; ++i) { - var u = seq[i]; + for (let i = 0, n = seq.length; i !== n; ++i) { + const u = seq[i]; if (u.id in values) r.push(u); } @@ -13717,18 +13032,18 @@ }; function WebGLShader(gl, type, string) { - var shader = gl.createShader(type); + const shader = gl.createShader(type); gl.shaderSource(shader, string); gl.compileShader(shader); return shader; } - var programIdCount = 0; + let programIdCount = 0; function addLineNumbers(string) { - var lines = string.split('\n'); + const lines = string.split('\n'); - for (var i = 0; i < lines.length; i++) { + for (let i = 0; i < lines.length; i++) { lines[i] = i + 1 + ': ' + lines[i]; } @@ -13768,27 +13083,27 @@ } function getShaderErrors(gl, shader, type) { - var status = gl.getShaderParameter(shader, 35713); - var log = gl.getShaderInfoLog(shader).trim(); + const status = gl.getShaderParameter(shader, 35713); + const log = gl.getShaderInfoLog(shader).trim(); if (status && log === '') return ''; // --enable-privileged-webgl-extension // console.log( '**' + type + '**', gl.getExtension( 'WEBGL_debug_shaders' ).getTranslatedShaderSource( shader ) ); - var source = gl.getShaderSource(shader); + const source = gl.getShaderSource(shader); return 'THREE.WebGLShader: gl.getShaderInfoLog() ' + type + '\n' + log + addLineNumbers(source); } function getTexelDecodingFunction(functionName, encoding) { - var components = getEncodingComponents(encoding); + const components = getEncodingComponents(encoding); return 'vec4 ' + functionName + '( vec4 value ) { return ' + components[0] + 'ToLinear' + components[1] + '; }'; } function getTexelEncodingFunction(functionName, encoding) { - var components = getEncodingComponents(encoding); + const components = getEncodingComponents(encoding); return 'vec4 ' + functionName + '( vec4 value ) { return LinearTo' + components[0] + components[1] + '; }'; } function getToneMappingFunction(functionName, toneMapping) { - var toneMappingName; + let toneMappingName; switch (toneMapping) { case LinearToneMapping: @@ -13820,15 +13135,15 @@ } function generateExtensions(parameters) { - 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' : '']; + 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' : '']; return chunks.filter(filterEmptyLine).join('\n'); } function generateDefines(defines) { - var chunks = []; + const chunks = []; - for (var name in defines) { - var value = defines[name]; + for (const name in defines) { + const value = defines[name]; if (value === false) continue; chunks.push('#define ' + name + ' ' + value); } @@ -13837,12 +13152,12 @@ } function fetchAttributeLocations(gl, program) { - var attributes = {}; - var n = gl.getProgramParameter(program, 35721); + const attributes = {}; + const n = gl.getProgramParameter(program, 35721); - 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 ); + 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 ); attributes[name] = gl.getAttribLocation(program, name); } @@ -13863,14 +13178,14 @@ } // Resolve Includes - var includePattern = /^[ \t]*#include +<([\w\d./]+)>/gm; + const includePattern = /^[ \t]*#include +<([\w\d./]+)>/gm; function resolveIncludes(string) { return string.replace(includePattern, includeReplacer); } function includeReplacer(match, include) { - var string = ShaderChunk[include]; + const string = ShaderChunk[include]; if (string === undefined) { throw new Error('Can not resolve #include <' + include + '>'); @@ -13880,8 +13195,8 @@ } // Unroll Loops - 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; + const deprecatedUnrollLoopPattern = /#pragma unroll_loop[\s]+?for \( int i \= (\d+)\; i < (\d+)\; i \+\+ \) \{([\s\S]+?)(?=\})\}/g; + const unrollLoopPattern = /#pragma unroll_loop_start\s+for\s*\(\s*int\s+i\s*=\s*(\d+)\s*;\s*i\s*<\s*(\d+)\s*;\s*i\s*\+\+\s*\)\s*{([\s\S]+?)}\s+#pragma unroll_loop_end/g; function unrollLoops(string) { return string.replace(unrollLoopPattern, loopReplacer).replace(deprecatedUnrollLoopPattern, deprecatedLoopReplacer); @@ -13893,9 +13208,9 @@ } function loopReplacer(match, start, end, snippet) { - var string = ''; + let string = ''; - for (var i = parseInt(start); i < parseInt(end); i++) { + for (let i = parseInt(start); i < parseInt(end); i++) { string += snippet.replace(/\[\s*i\s*\]/g, '[ ' + i + ' ]').replace(/UNROLLED_LOOP_INDEX/g, i); } @@ -13904,7 +13219,7 @@ function generatePrecision(parameters) { - var precisionstring = 'precision ' + parameters.precision + ' float;\nprecision ' + parameters.precision + ' int;'; + let precisionstring = 'precision ' + parameters.precision + ' float;\nprecision ' + parameters.precision + ' int;'; if (parameters.precision === 'highp') { precisionstring += '\n#define HIGH_PRECISION'; @@ -13918,7 +13233,7 @@ } function generateShadowMapTypeDefine(parameters) { - var shadowMapTypeDefine = 'SHADOWMAP_TYPE_BASIC'; + let shadowMapTypeDefine = 'SHADOWMAP_TYPE_BASIC'; if (parameters.shadowMapType === PCFShadowMap) { shadowMapTypeDefine = 'SHADOWMAP_TYPE_PCF'; @@ -13932,7 +13247,7 @@ } function generateEnvMapTypeDefine(parameters) { - var envMapTypeDefine = 'ENVMAP_TYPE_CUBE'; + let envMapTypeDefine = 'ENVMAP_TYPE_CUBE'; if (parameters.envMap) { switch (parameters.envMapMode) { @@ -13952,7 +13267,7 @@ } function generateEnvMapModeDefine(parameters) { - var envMapModeDefine = 'ENVMAP_MODE_REFLECTION'; + let envMapModeDefine = 'ENVMAP_MODE_REFLECTION'; if (parameters.envMap) { switch (parameters.envMapMode) { @@ -13967,7 +13282,7 @@ } function generateEnvMapBlendingDefine(parameters) { - var envMapBlendingDefine = 'ENVMAP_BLENDING_NONE'; + let envMapBlendingDefine = 'ENVMAP_BLENDING_NONE'; if (parameters.envMap) { switch (parameters.combine) { @@ -13989,20 +13304,20 @@ } function WebGLProgram(renderer, cacheKey, parameters, bindingStates) { - 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' : ''; + 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' : ''; if (parameters.isRawShaderMaterial) { prefixVertex = [customDefines].filter(filterEmptyLine).join('\n'); @@ -14040,12 +13355,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; } - var vertexGlsl = versionString + prefixVertex + vertexShader; - var fragmentGlsl = versionString + prefixFragment + fragmentShader; // console.log( '*VERTEX*', vertexGlsl ); + const vertexGlsl = versionString + prefixVertex + vertexShader; + const fragmentGlsl = versionString + prefixFragment + fragmentShader; // console.log( '*VERTEX*', vertexGlsl ); // console.log( '*FRAGMENT*', fragmentGlsl ); - var glVertexShader = WebGLShader(gl, 35633, vertexGlsl); - var glFragmentShader = WebGLShader(gl, 35632, fragmentGlsl); + const glVertexShader = WebGLShader(gl, 35633, vertexGlsl); + const glFragmentShader = WebGLShader(gl, 35632, fragmentGlsl); gl.attachShader(program, glVertexShader); gl.attachShader(program, glFragmentShader); // Force a particular attribute to index 0. @@ -14059,16 +13374,16 @@ gl.linkProgram(program); // check for link errors if (renderer.debug.checkShaderErrors) { - var programLog = gl.getProgramInfoLog(program).trim(); - var vertexLog = gl.getShaderInfoLog(glVertexShader).trim(); - var fragmentLog = gl.getShaderInfoLog(glFragmentShader).trim(); - var runnable = true; - var haveDiagnostics = true; + const programLog = gl.getProgramInfoLog(program).trim(); + const vertexLog = gl.getShaderInfoLog(glVertexShader).trim(); + const fragmentLog = gl.getShaderInfoLog(glFragmentShader).trim(); + let runnable = true; + let haveDiagnostics = true; if (gl.getProgramParameter(program, 35714) === false) { runnable = false; - var vertexErrors = getShaderErrors(gl, glVertexShader, 'vertex'); - var fragmentErrors = getShaderErrors(gl, glFragmentShader, 'fragment'); + const vertexErrors = getShaderErrors(gl, glVertexShader, 'vertex'); + const 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); @@ -14099,7 +13414,7 @@ gl.deleteShader(glVertexShader); gl.deleteShader(glFragmentShader); // set up caching for uniform locations - var cachedUniforms; + let cachedUniforms; this.getUniforms = function () { if (cachedUniforms === undefined) { @@ -14110,7 +13425,7 @@ }; // set up caching for attribute locations - var cachedAttributes; + let cachedAttributes; this.getAttributes = function () { if (cachedAttributes === undefined) { @@ -14139,14 +13454,14 @@ } function WebGLPrograms(renderer, cubemaps, extensions, capabilities, bindingStates, clipping) { - 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 = { + 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 = { MeshDepthMaterial: 'depth', MeshDistanceMaterial: 'distanceRGBA', MeshNormalMaterial: 'normal', @@ -14163,11 +13478,11 @@ ShadowMaterial: 'shadow', SpriteMaterial: 'sprite' }; - 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']; + 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']; function getMaxBones(object) { - var skeleton = object.skeleton; - var bones = skeleton.bones; + const skeleton = object.skeleton; + const bones = skeleton.bones; if (floatVertexTextures) { return 1024; @@ -14178,9 +13493,9 @@ // - leave some extra space for other uniforms // - limit here is ANGLE's 254 max uniform vectors // (up to 54 should be safe) - var nVertexUniforms = maxVertexUniforms; - var nVertexMatrices = Math.floor((nVertexUniforms - 20) / 4); - var maxBones = Math.min(nVertexMatrices, bones.length); + const nVertexUniforms = maxVertexUniforms; + const nVertexMatrices = Math.floor((nVertexUniforms - 20) / 4); + const maxBones = Math.min(nVertexMatrices, bones.length); if (maxBones < bones.length) { console.warn('THREE.WebGLRenderer: Skeleton has ' + bones.length + ' bones. This GPU supports ' + maxBones + '.'); @@ -14192,7 +13507,7 @@ } function getTextureEncodingFromMap(map) { - var encoding; + let encoding; if (map && map.isTexture) { encoding = map.encoding; @@ -14207,13 +13522,13 @@ } function getParameters(material, lights, shadows, scene, object) { - 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 + 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 // (not to blow over maxLights budget) - var maxBones = object.isSkinnedMesh ? getMaxBones(object) : 0; + const maxBones = object.isSkinnedMesh ? getMaxBones(object) : 0; if (material.precision !== null) { precision = capabilities.getMaxPrecision(material.precision); @@ -14223,10 +13538,10 @@ } } - var vertexShader, fragmentShader; + let vertexShader, fragmentShader; if (shaderID) { - var shader = ShaderLib[shaderID]; + const shader = ShaderLib[shaderID]; vertexShader = shader.vertexShader; fragmentShader = shader.fragmentShader; } else { @@ -14234,8 +13549,8 @@ fragmentShader = material.fragmentShader; } - var currentRenderTarget = renderer.getRenderTarget(); - var parameters = { + const currentRenderTarget = renderer.getRenderTarget(); + const parameters = { isWebGL2: isWebGL2, shaderID: shaderID, shaderName: material.type, @@ -14329,7 +13644,7 @@ } function getProgramCacheKey(parameters) { - var array = []; + const array = []; if (parameters.shaderID) { array.push(parameters.shaderID); @@ -14339,14 +13654,14 @@ } if (parameters.defines !== undefined) { - for (var name in parameters.defines) { + for (const name in parameters.defines) { array.push(name); array.push(parameters.defines[name]); } } if (parameters.isRawShaderMaterial === false) { - for (var i = 0; i < parameterNames.length; i++) { + for (let i = 0; i < parameterNames.length; i++) { array.push(parameters[parameterNames[i]]); } @@ -14359,11 +13674,11 @@ } function getUniforms(material) { - var shaderID = shaderIDs[material.type]; - var uniforms; + const shaderID = shaderIDs[material.type]; + let uniforms; if (shaderID) { - var shader = ShaderLib[shaderID]; + const shader = ShaderLib[shaderID]; uniforms = UniformsUtils.clone(shader.uniforms); } else { uniforms = material.uniforms; @@ -14373,10 +13688,10 @@ } function acquireProgram(parameters, cacheKey) { - var program; // Check if code has been already compiled + let program; // Check if code has been already compiled - for (var p = 0, pl = programs.length; p < pl; p++) { - var preexistingProgram = programs[p]; + for (let p = 0, pl = programs.length; p < pl; p++) { + const preexistingProgram = programs[p]; if (preexistingProgram.cacheKey === cacheKey) { program = preexistingProgram; @@ -14396,7 +13711,7 @@ function releaseProgram(program) { if (--program.usedTimes === 0) { // Remove from unordered set - var i = programs.indexOf(program); + const i = programs.indexOf(program); programs[i] = programs[programs.length - 1]; programs.pop(); // Free WebGL resources @@ -14416,10 +13731,10 @@ } function WebGLProperties() { - var properties = new WeakMap(); + let properties = new WeakMap(); function get(object) { - var map = properties.get(object); + let map = properties.get(object); if (map === undefined) { map = {}; @@ -14478,11 +13793,11 @@ } function WebGLRenderList(properties) { - var renderItems = []; - var renderItemsIndex = 0; - var opaque = []; - var transparent = []; - var defaultProgram = { + const renderItems = []; + let renderItemsIndex = 0; + const opaque = []; + const transparent = []; + const defaultProgram = { id: -1 }; @@ -14493,8 +13808,8 @@ } function getNextRenderItem(object, geometry, material, groupOrder, z, group) { - var renderItem = renderItems[renderItemsIndex]; - var materialProperties = properties.get(material); + let renderItem = renderItems[renderItemsIndex]; + const materialProperties = properties.get(material); if (renderItem === undefined) { renderItem = { @@ -14526,12 +13841,12 @@ } function push(object, geometry, material, groupOrder, z, group) { - var renderItem = getNextRenderItem(object, geometry, material, groupOrder, z, group); + const renderItem = getNextRenderItem(object, geometry, material, groupOrder, z, group); (material.transparent === true ? transparent : opaque).push(renderItem); } function unshift(object, geometry, material, groupOrder, z, group) { - var renderItem = getNextRenderItem(object, geometry, material, groupOrder, z, group); + const renderItem = getNextRenderItem(object, geometry, material, groupOrder, z, group); (material.transparent === true ? transparent : opaque).unshift(renderItem); } @@ -14542,8 +13857,8 @@ function finish() { // Clear references from inactive renderItems in the list - for (var i = renderItemsIndex, il = renderItems.length; i < il; i++) { - var renderItem = renderItems[i]; + for (let i = renderItemsIndex, il = renderItems.length; i < il; i++) { + const renderItem = renderItems[i]; if (renderItem.id === null) break; renderItem.id = null; renderItem.object = null; @@ -14566,10 +13881,10 @@ } function WebGLRenderLists(properties) { - var lists = new WeakMap(); + let lists = new WeakMap(); function get(scene, renderCallDepth) { - var list; + let list; if (lists.has(scene) === false) { list = new WebGLRenderList(properties); @@ -14597,14 +13912,14 @@ } function UniformsCache() { - var lights = {}; + const lights = {}; return { - get: function get(light) { + get: function (light) { if (lights[light.id] !== undefined) { return lights[light.id]; } - var uniforms; + let uniforms; switch (light.type) { case 'DirectionalLight': @@ -14660,14 +13975,14 @@ } function ShadowUniformsCache() { - var lights = {}; + const lights = {}; return { - get: function get(light) { + get: function (light) { if (lights[light.id] !== undefined) { return lights[light.id]; } - var uniforms; + let uniforms; switch (light.type) { case 'DirectionalLight': @@ -14707,16 +14022,16 @@ }; } - var nextVersion = 0; + let nextVersion = 0; function shadowCastingLightsFirst(lightA, lightB) { return (lightB.castShadow ? 1 : 0) - (lightA.castShadow ? 1 : 0); } function WebGLLights(extensions, capabilities) { - var cache = new UniformsCache(); - var shadowCache = ShadowUniformsCache(); - var state = { + const cache = new UniformsCache(); + const shadowCache = ShadowUniformsCache(); + const state = { version: 0, hash: { directionalLength: -1, @@ -14748,55 +14063,51 @@ hemi: [] }; - for (var i = 0; i < 9; i++) { - state.probe.push(new Vector3()); - } + for (let i = 0; i < 9; i++) state.probe.push(new Vector3()); - var vector3 = new Vector3(); - var matrix4 = new Matrix4(); - var matrix42 = new Matrix4(); + const vector3 = new Vector3(); + const matrix4 = new Matrix4(); + const matrix42 = new Matrix4(); function setup(lights) { - var r = 0, + let r = 0, g = 0, b = 0; - for (var _i = 0; _i < 9; _i++) { - state.probe[_i].set(0, 0, 0); - } + for (let i = 0; i < 9; i++) state.probe[i].set(0, 0, 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; + let directionalLength = 0; + let pointLength = 0; + let spotLength = 0; + let rectAreaLength = 0; + let hemiLength = 0; + let numDirectionalShadows = 0; + let numPointShadows = 0; + let numSpotShadows = 0; lights.sort(shadowCastingLightsFirst); - 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; + for (let i = 0, l = lights.length; i < l; i++) { + const light = lights[i]; + const color = light.color; + const intensity = light.intensity; + const distance = light.distance; + const shadowMap = light.shadow && light.shadow.map ? light.shadow.map.texture : null; if (light.isAmbientLight) { r += color.r * intensity; g += color.g * intensity; b += color.b * intensity; } else if (light.isLightProbe) { - for (var j = 0; j < 9; j++) { + for (let j = 0; j < 9; j++) { state.probe[j].addScaledVector(light.sh.coefficients[j], intensity); } } else if (light.isDirectionalLight) { - var uniforms = cache.get(light); + const uniforms = cache.get(light); uniforms.color.copy(light.color).multiplyScalar(light.intensity); if (light.castShadow) { - var shadow = light.shadow; - var shadowUniforms = shadowCache.get(light); + const shadow = light.shadow; + const shadowUniforms = shadowCache.get(light); shadowUniforms.shadowBias = shadow.bias; shadowUniforms.shadowNormalBias = shadow.normalBias; shadowUniforms.shadowRadius = shadow.radius; @@ -14810,83 +14121,67 @@ state.directional[directionalLength] = uniforms; directionalLength++; } else if (light.isSpotLight) { - 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; + 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; if (light.castShadow) { - 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; + 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; state.spotShadowMap[spotLength] = shadowMap; state.spotShadowMatrix[spotLength] = light.shadow.matrix; numSpotShadows++; } - state.spot[spotLength] = _uniforms; + state.spot[spotLength] = uniforms; spotLength++; } else if (light.isRectAreaLight) { - var _uniforms2 = cache.get(light); // (a) intensity is the total visible light emitted + const uniforms = cache.get(light); // (a) intensity is the total visible light emitted //uniforms.color.copy( color ).multiplyScalar( intensity / ( light.width * light.height * Math.PI ) ); // (b) intensity is the brightness of the light - - _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; + 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; rectAreaLength++; } else if (light.isPointLight) { - var _uniforms3 = cache.get(light); - - _uniforms3.color.copy(light.color).multiplyScalar(light.intensity); - - _uniforms3.distance = light.distance; - _uniforms3.decay = light.decay; + const uniforms = cache.get(light); + uniforms.color.copy(light.color).multiplyScalar(light.intensity); + uniforms.distance = light.distance; + uniforms.decay = light.decay; if (light.castShadow) { - 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; + 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; state.pointShadowMap[pointLength] = shadowMap; state.pointShadowMatrix[pointLength] = light.shadow.matrix; numPointShadows++; } - state.point[pointLength] = _uniforms3; + state.point[pointLength] = uniforms; pointLength++; } else if (light.isHemisphereLight) { - var _uniforms4 = cache.get(light); - - _uniforms4.skyColor.copy(light.color).multiplyScalar(intensity); - - _uniforms4.groundColor.copy(light.groundColor).multiplyScalar(intensity); - - state.hemi[hemiLength] = _uniforms4; + const uniforms = cache.get(light); + uniforms.skyColor.copy(light.color).multiplyScalar(intensity); + uniforms.groundColor.copy(light.groundColor).multiplyScalar(intensity); + state.hemi[hemiLength] = uniforms; hemiLength++; } } @@ -14913,7 +14208,7 @@ state.ambient[0] = r; state.ambient[1] = g; state.ambient[2] = b; - var hash = state.hash; + const hash = state.hash; if (hash.directionalLength !== directionalLength || hash.pointLength !== pointLength || hash.spotLength !== spotLength || hash.rectAreaLength !== rectAreaLength || hash.hemiLength !== hemiLength || hash.numDirectionalShadows !== numDirectionalShadows || hash.numPointShadows !== numPointShadows || hash.numSpotShadows !== numSpotShadows) { state.directional.length = directionalLength; @@ -14943,78 +14238,56 @@ } function setupView(lights, camera) { - var directionalLength = 0; - var pointLength = 0; - var spotLength = 0; - var rectAreaLength = 0; - var hemiLength = 0; - var viewMatrix = camera.matrixWorldInverse; + let directionalLength = 0; + let pointLength = 0; + let spotLength = 0; + let rectAreaLength = 0; + let hemiLength = 0; + const viewMatrix = camera.matrixWorldInverse; - for (var _i3 = 0, l = lights.length; _i3 < l; _i3++) { - var light = lights[_i3]; + for (let i = 0, l = lights.length; i < l; i++) { + const light = lights[i]; if (light.isDirectionalLight) { - var uniforms = state.directional[directionalLength]; + const 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) { - var _uniforms5 = state.spot[spotLength]; - - _uniforms5.position.setFromMatrixPosition(light.matrixWorld); - - _uniforms5.position.applyMatrix4(viewMatrix); - - _uniforms5.direction.setFromMatrixPosition(light.matrixWorld); - + const uniforms = state.spot[spotLength]; + uniforms.position.setFromMatrixPosition(light.matrixWorld); + uniforms.position.applyMatrix4(viewMatrix); + uniforms.direction.setFromMatrixPosition(light.matrixWorld); vector3.setFromMatrixPosition(light.target.matrixWorld); - - _uniforms5.direction.sub(vector3); - - _uniforms5.direction.transformDirection(viewMatrix); - + uniforms.direction.sub(vector3); + uniforms.direction.transformDirection(viewMatrix); spotLength++; } else if (light.isRectAreaLight) { - 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 - + 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 matrix42.identity(); matrix4.copy(light.matrixWorld); matrix4.premultiply(viewMatrix); matrix42.extractRotation(matrix4); - - _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); - + 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); rectAreaLength++; } else if (light.isPointLight) { - var _uniforms7 = state.point[pointLength]; - - _uniforms7.position.setFromMatrixPosition(light.matrixWorld); - - _uniforms7.position.applyMatrix4(viewMatrix); - + const uniforms = state.point[pointLength]; + uniforms.position.setFromMatrixPosition(light.matrixWorld); + uniforms.position.applyMatrix4(viewMatrix); pointLength++; } else if (light.isHemisphereLight) { - var _uniforms8 = state.hemi[hemiLength]; - - _uniforms8.direction.setFromMatrixPosition(light.matrixWorld); - - _uniforms8.direction.transformDirection(viewMatrix); - - _uniforms8.direction.normalize(); - + const uniforms = state.hemi[hemiLength]; + uniforms.direction.setFromMatrixPosition(light.matrixWorld); + uniforms.direction.transformDirection(viewMatrix); + uniforms.direction.normalize(); hemiLength++; } } @@ -15028,9 +14301,9 @@ } function WebGLRenderState(extensions, capabilities) { - var lights = new WebGLLights(extensions, capabilities); - var lightsArray = []; - var shadowsArray = []; + const lights = new WebGLLights(extensions, capabilities); + const lightsArray = []; + const shadowsArray = []; function init() { lightsArray.length = 0; @@ -15053,7 +14326,7 @@ lights.setupView(lightsArray, camera); } - var state = { + const state = { lightsArray: lightsArray, shadowsArray: shadowsArray, lights: lights @@ -15069,14 +14342,10 @@ } function WebGLRenderStates(extensions, capabilities) { - var renderStates = new WeakMap(); - - function get(scene, renderCallDepth) { - if (renderCallDepth === void 0) { - renderCallDepth = 0; - } + let renderStates = new WeakMap(); - var renderState; + function get(scene, renderCallDepth = 0) { + let renderState; if (renderStates.has(scene) === false) { renderState = new WebGLRenderState(extensions, capabilities); @@ -15121,36 +14390,26 @@ * } */ - 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; + 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 _proto = MeshDepthMaterial.prototype; - - _proto.copy = function copy(source) { - _Material.prototype.copy.call(this, source); - + copy(source) { + super.copy(source); this.depthPacking = source.depthPacking; this.skinning = source.skinning; this.morphTargets = source.morphTargets; @@ -15162,10 +14421,9 @@ this.wireframe = source.wireframe; this.wireframeLinewidth = source.wireframeLinewidth; return this; - }; + } - return MeshDepthMaterial; - }(Material); + } MeshDepthMaterial.prototype.isMeshDepthMaterial = true; @@ -15190,36 +14448,26 @@ * } */ - 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; + 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 _proto = MeshDistanceMaterial.prototype; - - _proto.copy = function copy(source) { - _Material.prototype.copy.call(this, source); - + copy(source) { + super.copy(source); this.referencePosition.copy(source.referencePosition); this.nearDistance = source.nearDistance; this.farDistance = source.farDistance; @@ -15231,10 +14479,9 @@ this.displacementScale = source.displacementScale; this.displacementBias = source.displacementBias; return this; - }; + } - return MeshDistanceMaterial; - }(Material); + } MeshDistanceMaterial.prototype.isMeshDistanceMaterial = true; @@ -15243,21 +14490,21 @@ var vsm_vert = "void main() {\n\tgl_Position = vec4( position, 1.0 );\n}"; function WebGLShadowMap(_renderer, _objects, maxTextureSize) { - var _frustum = new Frustum(); + let _frustum = new Frustum(); - var _shadowMapSize = new Vector2(), - _viewportSize = new Vector2(), - _viewport = new Vector4(), - _depthMaterials = [], - _distanceMaterials = [], - _materialCache = {}; + const _shadowMapSize = new Vector2(), + _viewportSize = new Vector2(), + _viewport = new Vector4(), + _depthMaterials = [], + _distanceMaterials = [], + _materialCache = {}; - var shadowSide = { + const shadowSide = { 0: BackSide, 1: FrontSide, 2: DoubleSide }; - var shadowMaterialVertical = new ShaderMaterial({ + const shadowMaterialVertical = new ShaderMaterial({ defines: { SAMPLE_RATE: 2.0 / 8.0, HALF_SAMPLE_RATE: 1.0 / 8.0 @@ -15276,12 +14523,12 @@ vertexShader: vsm_vert, fragmentShader: vsm_frag }); - var shadowMaterialHorizontal = shadowMaterialVertical.clone(); + const shadowMaterialHorizontal = shadowMaterialVertical.clone(); shadowMaterialHorizontal.defines.HORIZONTAL_PASS = 1; - var fullScreenTri = new BufferGeometry(); + const fullScreenTri = new BufferGeometry(); fullScreenTri.setAttribute('position', new BufferAttribute(new Float32Array([-1, -1, 0.5, 3, -1, 0.5, -1, 3, 0.5]), 3)); - var fullScreenMesh = new Mesh(fullScreenTri, shadowMaterialVertical); - var scope = this; + const fullScreenMesh = new Mesh(fullScreenTri, shadowMaterialVertical); + const scope = this; this.enabled = false; this.autoUpdate = true; this.needsUpdate = false; @@ -15292,13 +14539,13 @@ if (scope.autoUpdate === false && scope.needsUpdate === false) return; if (lights.length === 0) return; - var currentRenderTarget = _renderer.getRenderTarget(); + const currentRenderTarget = _renderer.getRenderTarget(); - var activeCubeFace = _renderer.getActiveCubeFace(); + const activeCubeFace = _renderer.getActiveCubeFace(); - var activeMipmapLevel = _renderer.getActiveMipmapLevel(); + const activeMipmapLevel = _renderer.getActiveMipmapLevel(); - var _state = _renderer.state; // Set GL state for depth map. + const _state = _renderer.state; // Set GL state for depth map. _state.setBlending(NoBlending); @@ -15309,9 +14556,9 @@ _state.setScissorTest(false); // render depth map - for (var i = 0, il = lights.length; i < il; i++) { - var light = lights[i]; - var shadow = light.shadow; + for (let i = 0, il = lights.length; i < il; i++) { + const light = lights[i]; + const shadow = light.shadow; if (shadow === undefined) { console.warn('THREE.WebGLShadowMap:', light, 'has no shadow.'); @@ -15322,7 +14569,7 @@ _shadowMapSize.copy(shadow.mapSize); - var shadowFrameExtents = shadow.getFrameExtents(); + const shadowFrameExtents = shadow.getFrameExtents(); _shadowMapSize.multiply(shadowFrameExtents); @@ -15343,7 +14590,7 @@ } if (shadow.map === null && !shadow.isPointLightShadow && this.type === VSMShadowMap) { - var pars = { + const pars = { minFilter: LinearFilter, magFilter: LinearFilter, format: RGBAFormat @@ -15355,12 +14602,12 @@ } if (shadow.map === null) { - var _pars = { + const 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(); } @@ -15369,10 +14616,10 @@ _renderer.clear(); - var viewportCount = shadow.getViewportCount(); + const viewportCount = shadow.getViewportCount(); - for (var vp = 0; vp < viewportCount; vp++) { - var viewport = shadow.getViewport(vp); + for (let vp = 0; vp < viewportCount; vp++) { + const viewport = shadow.getViewport(vp); _viewport.set(_viewportSize.x * viewport.x, _viewportSize.y * viewport.y, _viewportSize.x * viewport.z, _viewportSize.y * viewport.w); @@ -15397,7 +14644,7 @@ }; function VSMPass(shadow, camera) { - var geometry = _objects.update(fullScreenMesh); // vertical pass + const geometry = _objects.update(fullScreenMesh); // vertical pass shadowMaterialVertical.uniforms.shadow_pass.value = shadow.map.texture; @@ -15423,8 +14670,8 @@ } function getDepthMaterialVariant(useMorphing, useSkinning, useInstancing) { - var index = useMorphing << 0 | useSkinning << 1 | useInstancing << 2; - var material = _depthMaterials[index]; + const index = useMorphing << 0 | useSkinning << 1 | useInstancing << 2; + let material = _depthMaterials[index]; if (material === undefined) { material = new MeshDepthMaterial({ @@ -15439,8 +14686,8 @@ } function getDistanceMaterialVariant(useMorphing, useSkinning, useInstancing) { - var index = useMorphing << 0 | useSkinning << 1 | useInstancing << 2; - var material = _distanceMaterials[index]; + const index = useMorphing << 0 | useSkinning << 1 | useInstancing << 2; + let material = _distanceMaterials[index]; if (material === undefined) { material = new MeshDistanceMaterial({ @@ -15454,9 +14701,9 @@ } function getDepthMaterial(object, geometry, material, light, shadowCameraNear, shadowCameraFar, type) { - var result = null; - var getMaterialVariant = getDepthMaterialVariant; - var customMaterial = object.customDepthMaterial; + let result = null; + let getMaterialVariant = getDepthMaterialVariant; + let customMaterial = object.customDepthMaterial; if (light.isPointLight === true) { getMaterialVariant = getDistanceMaterialVariant; @@ -15464,13 +14711,13 @@ } if (customMaterial === undefined) { - var useMorphing = false; + let useMorphing = false; if (material.morphTargets === true) { useMorphing = geometry.morphAttributes && geometry.morphAttributes.position && geometry.morphAttributes.position.length > 0; } - var useSkinning = false; + let useSkinning = false; if (object.isSkinnedMesh === true) { if (material.skinning === true) { @@ -15480,7 +14727,7 @@ } } - var useInstancing = object.isInstancedMesh === true; + const useInstancing = object.isInstancedMesh === true; result = getMaterialVariant(useMorphing, useSkinning, useInstancing); } else { result = customMaterial; @@ -15489,16 +14736,16 @@ if (_renderer.localClippingEnabled && material.clipShadows === true && material.clippingPlanes.length !== 0) { // in this case we need a unique material instance reflecting the // appropriate state - var keyA = result.uuid, - keyB = material.uuid; - var materialsForVariant = _materialCache[keyA]; + const keyA = result.uuid, + keyB = material.uuid; + let materialsForVariant = _materialCache[keyA]; if (materialsForVariant === undefined) { materialsForVariant = {}; _materialCache[keyA] = materialsForVariant; } - var cachedMaterial = materialsForVariant[keyB]; + let cachedMaterial = materialsForVariant[keyB]; if (cachedMaterial === undefined) { cachedMaterial = result.clone(); @@ -15534,66 +14781,64 @@ function renderObject(object, camera, shadowCamera, light, type) { if (object.visible === false) return; - var visible = object.layers.test(camera.layers); + const visible = object.layers.test(camera.layers); if (visible && (object.isMesh || object.isLine || object.isPoints)) { if ((object.castShadow || object.receiveShadow && type === VSMShadowMap) && (!object.frustumCulled || _frustum.intersectsObject(object))) { object.modelViewMatrix.multiplyMatrices(shadowCamera.matrixWorldInverse, object.matrixWorld); - var geometry = _objects.update(object); + const geometry = _objects.update(object); - var material = object.material; + const material = object.material; if (Array.isArray(material)) { - var groups = geometry.groups; + const groups = geometry.groups; - for (var k = 0, kl = groups.length; k < kl; k++) { - var group = groups[k]; - var groupMaterial = material[group.materialIndex]; + for (let k = 0, kl = groups.length; k < kl; k++) { + const group = groups[k]; + const groupMaterial = material[group.materialIndex]; if (groupMaterial && groupMaterial.visible) { - var depthMaterial = getDepthMaterial(object, geometry, groupMaterial, light, shadowCamera.near, shadowCamera.far, type); + const depthMaterial = getDepthMaterial(object, geometry, groupMaterial, light, shadowCamera.near, shadowCamera.far, type); _renderer.renderBufferDirect(shadowCamera, null, geometry, depthMaterial, object, group); } } } else if (material.visible) { - var _depthMaterial = getDepthMaterial(object, geometry, material, light, shadowCamera.near, shadowCamera.far, type); + const 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); } } } - var children = object.children; + const children = object.children; - for (var i = 0, l = children.length; i < l; i++) { + for (let i = 0, l = children.length; i < l; i++) { renderObject(children[i], camera, shadowCamera, light, type); } } } function WebGLState(gl, extensions, capabilities) { - var _equationToGL, _factorToGL; - - var isWebGL2 = capabilities.isWebGL2; + const isWebGL2 = capabilities.isWebGL2; function ColorBuffer() { - var locked = false; - var color = new Vector4(); - var currentColorMask = null; - var currentColorClear = new Vector4(0, 0, 0, 0); + let locked = false; + const color = new Vector4(); + let currentColorMask = null; + const currentColorClear = new Vector4(0, 0, 0, 0); return { - setMask: function setMask(colorMask) { + setMask: function (colorMask) { if (currentColorMask !== colorMask && !locked) { gl.colorMask(colorMask, colorMask, colorMask, colorMask); currentColorMask = colorMask; } }, - setLocked: function setLocked(lock) { + setLocked: function (lock) { locked = lock; }, - setClear: function setClear(r, g, b, a, premultipliedAlpha) { + setClear: function (r, g, b, a, premultipliedAlpha) { if (premultipliedAlpha === true) { r *= a; g *= a; @@ -15607,7 +14852,7 @@ currentColorClear.copy(color); } }, - reset: function reset() { + reset: function () { locked = false; currentColorMask = null; currentColorClear.set(-1, 0, 0, 0); // set to invalid state @@ -15616,25 +14861,25 @@ } function DepthBuffer() { - var locked = false; - var currentDepthMask = null; - var currentDepthFunc = null; - var currentDepthClear = null; + let locked = false; + let currentDepthMask = null; + let currentDepthFunc = null; + let currentDepthClear = null; return { - setTest: function setTest(depthTest) { + setTest: function (depthTest) { if (depthTest) { enable(2929); } else { disable(2929); } }, - setMask: function setMask(depthMask) { + setMask: function (depthMask) { if (currentDepthMask !== depthMask && !locked) { gl.depthMask(depthMask); currentDepthMask = depthMask; } }, - setFunc: function setFunc(depthFunc) { + setFunc: function (depthFunc) { if (currentDepthFunc !== depthFunc) { if (depthFunc) { switch (depthFunc) { @@ -15680,16 +14925,16 @@ currentDepthFunc = depthFunc; } }, - setLocked: function setLocked(lock) { + setLocked: function (lock) { locked = lock; }, - setClear: function setClear(depth) { + setClear: function (depth) { if (currentDepthClear !== depth) { gl.clearDepth(depth); currentDepthClear = depth; } }, - reset: function reset() { + reset: function () { locked = false; currentDepthMask = null; currentDepthFunc = null; @@ -15699,17 +14944,17 @@ } function StencilBuffer() { - 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; + 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; return { - setTest: function setTest(stencilTest) { + setTest: function (stencilTest) { if (!locked) { if (stencilTest) { enable(2960); @@ -15718,13 +14963,13 @@ } } }, - setMask: function setMask(stencilMask) { + setMask: function (stencilMask) { if (currentStencilMask !== stencilMask && !locked) { gl.stencilMask(stencilMask); currentStencilMask = stencilMask; } }, - setFunc: function setFunc(stencilFunc, stencilRef, stencilMask) { + setFunc: function (stencilFunc, stencilRef, stencilMask) { if (currentStencilFunc !== stencilFunc || currentStencilRef !== stencilRef || currentStencilFuncMask !== stencilMask) { gl.stencilFunc(stencilFunc, stencilRef, stencilMask); currentStencilFunc = stencilFunc; @@ -15732,7 +14977,7 @@ currentStencilFuncMask = stencilMask; } }, - setOp: function setOp(stencilFail, stencilZFail, stencilZPass) { + setOp: function (stencilFail, stencilZFail, stencilZPass) { if (currentStencilFail !== stencilFail || currentStencilZFail !== stencilZFail || currentStencilZPass !== stencilZPass) { gl.stencilOp(stencilFail, stencilZFail, stencilZPass); currentStencilFail = stencilFail; @@ -15740,16 +14985,16 @@ currentStencilZPass = stencilZPass; } }, - setLocked: function setLocked(lock) { + setLocked: function (lock) { locked = lock; }, - setClear: function setClear(stencil) { + setClear: function (stencil) { if (currentStencilClear !== stencil) { gl.clearStencil(stencil); currentStencilClear = stencil; } }, - reset: function reset() { + reset: function () { locked = false; currentStencilMask = null; currentStencilFunc = null; @@ -15764,29 +15009,29 @@ } // - var colorBuffer = new ColorBuffer(); - var depthBuffer = new DepthBuffer(); - var stencilBuffer = new StencilBuffer(); - var enabledCapabilities = {}; - 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); + const colorBuffer = new ColorBuffer(); + const depthBuffer = new DepthBuffer(); + const stencilBuffer = new StencilBuffer(); + let enabledCapabilities = {}; + 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); if (glVersion.indexOf('WebGL') !== -1) { version = parseFloat(/^WebGL (\d)/.exec(glVersion)[1]); @@ -15796,27 +15041,27 @@ lineWidthAvailable = version >= 2.0; } - var currentTextureSlot = null; - var currentBoundTextures = {}; - var currentScissor = new Vector4(); - var currentViewport = new Vector4(); + let currentTextureSlot = null; + let currentBoundTextures = {}; + const currentScissor = new Vector4(); + const currentViewport = new Vector4(); function createTexture(type, target, count) { - var data = new Uint8Array(4); // 4 is required to match default unpack alignment of 4. + const data = new Uint8Array(4); // 4 is required to match default unpack alignment of 4. - var texture = gl.createTexture(); + const texture = gl.createTexture(); gl.bindTexture(type, texture); gl.texParameteri(type, 10241, 9728); gl.texParameteri(type, 10240, 9728); - for (var i = 0; i < count; i++) { + for (let i = 0; i < count; i++) { gl.texImage2D(target + i, 0, 6408, 1, 1, 0, 6408, 5121, data); } return texture; } - var emptyTextures = {}; + const emptyTextures = {}; emptyTextures[3553] = createTexture(3553, 3553, 1); emptyTextures[34067] = createTexture(34067, 34069, 6); // init @@ -15854,13 +15099,17 @@ return false; } - var equationToGL = (_equationToGL = {}, _equationToGL[AddEquation] = 32774, _equationToGL[SubtractEquation] = 32778, _equationToGL[ReverseSubtractEquation] = 32779, _equationToGL); + const equationToGL = { + [AddEquation]: 32774, + [SubtractEquation]: 32778, + [ReverseSubtractEquation]: 32779 + }; if (isWebGL2) { equationToGL[MinEquation] = 32775; equationToGL[MaxEquation] = 32776; } else { - var extension = extensions.get('EXT_blend_minmax'); + const extension = extensions.get('EXT_blend_minmax'); if (extension !== null) { equationToGL[MinEquation] = extension.MIN_EXT; @@ -15868,7 +15117,19 @@ } } - 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); + const factorToGL = { + [ZeroFactor]: 0, + [OneFactor]: 1, + [SrcColorFactor]: 768, + [SrcAlphaFactor]: 770, + [SrcAlphaSaturateFactor]: 776, + [DstColorFactor]: 774, + [DstAlphaFactor]: 772, + [OneMinusSrcColorFactor]: 769, + [OneMinusSrcAlphaFactor]: 771, + [OneMinusDstColorFactor]: 775, + [OneMinusDstAlphaFactor]: 773 + }; function setBlending(blending, blendEquation, blendSrc, blendDst, blendEquationAlpha, blendSrcAlpha, blendDstAlpha, premultipliedAlpha) { if (blending === NoBlending) { @@ -15975,7 +15236,7 @@ function setMaterial(material, frontFaceCW) { material.side === DoubleSide ? disable(2884) : enable(2884); - var flipSided = material.side === BackSide; + let 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); @@ -15983,7 +15244,7 @@ depthBuffer.setTest(material.depthTest); depthBuffer.setMask(material.depthWrite); colorBuffer.setMask(material.colorWrite); - var stencilWrite = material.stencilWrite; + const stencilWrite = material.stencilWrite; stencilBuffer.setTest(stencilWrite); if (stencilWrite) { @@ -16073,7 +15334,7 @@ activeTexture(); } - var boundTexture = currentBoundTextures[currentTextureSlot]; + let boundTexture = currentBoundTextures[currentTextureSlot]; if (boundTexture === undefined) { boundTexture = { @@ -16091,7 +15352,7 @@ } function unbindTexture() { - var boundTexture = currentBoundTextures[currentTextureSlot]; + const boundTexture = currentBoundTextures[currentTextureSlot]; if (boundTexture !== undefined && boundTexture.type !== undefined) { gl.bindTexture(boundTexture.type, null); @@ -16222,22 +15483,20 @@ } function WebGLTextures(_gl, extensions, state, properties, capabilities, utils, info) { - var _wrappingToGL, _filterToGL; + const isWebGL2 = capabilities.isWebGL2; + const maxTextures = capabilities.maxTextures; + const maxCubemapSize = capabilities.maxCubemapSize; + const maxTextureSize = capabilities.maxTextureSize; + const maxSamples = capabilities.maxSamples; - var isWebGL2 = capabilities.isWebGL2; - var maxTextures = capabilities.maxTextures; - var maxCubemapSize = capabilities.maxCubemapSize; - var maxTextureSize = capabilities.maxTextureSize; - var maxSamples = capabilities.maxSamples; + const _videoTextures = new WeakMap(); - var _videoTextures = new WeakMap(); - - var _canvas; // cordova iOS (as of 5.0) still uses UIWebView, which provides OffscreenCanvas, + let _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). - var useOffscreenCanvas = false; + let useOffscreenCanvas = false; try { useOffscreenCanvas = typeof OffscreenCanvas !== 'undefined' && new OffscreenCanvas(1, 1).getContext('2d') !== null; @@ -16250,7 +15509,7 @@ } function resizeImage(image, needsPowerOfTwo, needsNewCanvas, maxSize) { - var scale = 1; // handle case if texture exceeds max size + let scale = 1; // handle case if texture exceeds max size if (image.width > maxSize || image.height > maxSize) { scale = maxSize / Math.max(image.width, image.height); @@ -16260,15 +15519,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) { - var floor = needsPowerOfTwo ? MathUtils.floorPowerOfTwo : Math.floor; - var width = floor(scale * image.width); - var height = floor(scale * image.height); + const floor = needsPowerOfTwo ? MathUtils.floorPowerOfTwo : Math.floor; + const width = floor(scale * image.width); + const height = floor(scale * image.height); if (_canvas === undefined) _canvas = createCanvas(width, height); // cube textures can't reuse the same canvas - var canvas = needsNewCanvas ? createCanvas(width, height) : _canvas; + const canvas = needsNewCanvas ? createCanvas(width, height) : _canvas; canvas.width = width; canvas.height = height; - var context = canvas.getContext('2d'); + const 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; @@ -16300,7 +15559,7 @@ function generateMipmap(target, texture, width, height) { _gl.generateMipmap(target); - var textureProperties = properties.get(texture); + const textureProperties = properties.get(texture); textureProperties.__maxMipLevel = Math.log2(Math.max(width, height)); } @@ -16312,7 +15571,7 @@ console.warn('THREE.WebGLRenderer: Attempt to use non-existing WebGL internal format \'' + internalFormatName + '\''); } - var internalFormat = glFormat; + let internalFormat = glFormat; if (glFormat === 6403) { if (glType === 5126) internalFormat = 33326; @@ -16350,7 +15609,7 @@ function onTextureDispose(event) { - var texture = event.target; + const texture = event.target; texture.removeEventListener('dispose', onTextureDispose); deallocateTexture(texture); @@ -16362,7 +15621,7 @@ } function onRenderTargetDispose(event) { - var renderTarget = event.target; + const renderTarget = event.target; renderTarget.removeEventListener('dispose', onRenderTargetDispose); deallocateRenderTarget(renderTarget); info.memory.textures--; @@ -16370,7 +15629,7 @@ function deallocateTexture(texture) { - var textureProperties = properties.get(texture); + const textureProperties = properties.get(texture); if (textureProperties.__webglInit === undefined) return; _gl.deleteTexture(textureProperties.__webglTexture); @@ -16379,9 +15638,9 @@ } function deallocateRenderTarget(renderTarget) { - var texture = renderTarget.texture; - var renderTargetProperties = properties.get(renderTarget); - var textureProperties = properties.get(texture); + const texture = renderTarget.texture; + const renderTargetProperties = properties.get(renderTarget); + const textureProperties = properties.get(texture); if (!renderTarget) return; if (textureProperties.__webglTexture !== undefined) { @@ -16393,7 +15652,7 @@ } if (renderTarget.isWebGLCubeRenderTarget) { - for (var i = 0; i < 6; i++) { + for (let i = 0; i < 6; i++) { _gl.deleteFramebuffer(renderTargetProperties.__webglFramebuffer[i]); if (renderTargetProperties.__webglDepthbuffer) _gl.deleteRenderbuffer(renderTargetProperties.__webglDepthbuffer[i]); @@ -16412,14 +15671,14 @@ } // - var textureUnits = 0; + let textureUnits = 0; function resetTextureUnits() { textureUnits = 0; } function allocateTextureUnit() { - var textureUnit = textureUnits; + const textureUnit = textureUnits; if (textureUnit >= maxTextures) { console.warn('THREE.WebGLTextures: Trying to use ' + textureUnit + ' texture units while this GPU supports only ' + maxTextures); @@ -16431,11 +15690,11 @@ function setTexture2D(texture, slot) { - var textureProperties = properties.get(texture); + const textureProperties = properties.get(texture); if (texture.isVideoTexture) updateVideoTexture(texture); if (texture.version > 0 && textureProperties.__version !== texture.version) { - var image = texture.image; + const image = texture.image; if (image === undefined) { console.warn('THREE.WebGLRenderer: Texture marked for update but image is undefined'); @@ -16452,7 +15711,7 @@ } function setTexture2DArray(texture, slot) { - var textureProperties = properties.get(texture); + const textureProperties = properties.get(texture); if (texture.version > 0 && textureProperties.__version !== texture.version) { uploadTexture(textureProperties, texture, slot); @@ -16464,7 +15723,7 @@ } function setTexture3D(texture, slot) { - var textureProperties = properties.get(texture); + const textureProperties = properties.get(texture); if (texture.version > 0 && textureProperties.__version !== texture.version) { uploadTexture(textureProperties, texture, slot); @@ -16476,7 +15735,7 @@ } function setTextureCube(texture, slot) { - var textureProperties = properties.get(texture); + const textureProperties = properties.get(texture); if (texture.version > 0 && textureProperties.__version !== texture.version) { uploadCubeTexture(textureProperties, texture, slot); @@ -16487,8 +15746,19 @@ state.bindTexture(34067, textureProperties.__webglTexture); } - 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); + const wrappingToGL = { + [RepeatWrapping]: 10497, + [ClampToEdgeWrapping]: 33071, + [MirroredRepeatWrapping]: 33648 + }; + const filterToGL = { + [NearestFilter]: 9728, + [NearestMipmapNearestFilter]: 9984, + [NearestMipmapLinearFilter]: 9986, + [LinearFilter]: 9729, + [LinearMipmapNearestFilter]: 9985, + [LinearMipmapLinearFilter]: 9987 + }; function setTextureParameters(textureType, texture, supportsMips) { if (supportsMips) { @@ -16526,7 +15796,7 @@ } if (extensions.has('EXT_texture_filter_anisotropic') === true) { - var extension = extensions.get('EXT_texture_filter_anisotropic'); + const extension = extensions.get('EXT_texture_filter_anisotropic'); if (texture.type === FloatType && extensions.has('OES_texture_float_linear') === false) return; // verify extension for WebGL 1 and WebGL 2 if (isWebGL2 === false && texture.type === HalfFloatType && extensions.has('OES_texture_half_float_linear') === false) return; // verify extension for WebGL 1 only @@ -16549,7 +15819,7 @@ } function uploadTexture(textureProperties, texture, slot) { - var textureType = 3553; + let textureType = 3553; if (texture.isDataTexture2DArray) textureType = 35866; if (texture.isDataTexture3D) textureType = 32879; initTexture(textureProperties, texture); @@ -16564,15 +15834,15 @@ _gl.pixelStorei(37443, 0); - 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), + 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), glInternalFormat = getInternalFormat(texture.internalFormat, glFormat, glType); setTextureParameters(textureType, texture, supportsMips); - var mipmap; - var mipmaps = texture.mipmaps; + let mipmap; + const mipmaps = texture.mipmaps; if (texture.isDepthTexture) { // populate depth texture with dummy data @@ -16627,7 +15897,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 (var i = 0, il = mipmaps.length; i < il; i++) { + for (let 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); } @@ -16639,17 +15909,17 @@ textureProperties.__maxMipLevel = 0; } } else if (texture.isCompressedTexture) { - for (var _i = 0, _il = mipmaps.length; _i < _il; _i++) { - mipmap = mipmaps[_i]; + for (let 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); } } @@ -16666,9 +15936,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 (var _i2 = 0, _il2 = mipmaps.length; _i2 < _il2; _i2++) { - mipmap = mipmaps[_i2]; - state.texImage2D(3553, _i2, glInternalFormat, glFormat, glType, mipmap); + for (let i = 0, il = mipmaps.length; i < il; i++) { + mipmap = mipmaps[i]; + state.texImage2D(3553, i, glInternalFormat, glFormat, glType, mipmap); } texture.generateMipmaps = false; @@ -16701,11 +15971,11 @@ _gl.pixelStorei(37443, 0); - var isCompressed = texture && (texture.isCompressedTexture || texture.image[0].isCompressedTexture); - var isDataTexture = texture.image[0] && texture.image[0].isDataTexture; - var cubeImage = []; + const isCompressed = texture && (texture.isCompressedTexture || texture.image[0].isCompressedTexture); + const isDataTexture = texture.image[0] && texture.image[0].isDataTexture; + const cubeImage = []; - for (var i = 0; i < 6; i++) { + for (let i = 0; i < 6; i++) { if (!isCompressed && !isDataTexture) { cubeImage[i] = resizeImage(texture.image[i], false, true, maxCubemapSize); } else { @@ -16713,29 +15983,29 @@ } } - var image = cubeImage[0], - supportsMips = isPowerOfTwo(image) || isWebGL2, - glFormat = utils.convert(texture.format), - glType = utils.convert(texture.type), - glInternalFormat = getInternalFormat(texture.internalFormat, glFormat, glType); + const 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); - var mipmaps; + let mipmaps; if (isCompressed) { - for (var _i3 = 0; _i3 < 6; _i3++) { - mipmaps = cubeImage[_i3].mipmaps; + for (let i = 0; i < 6; i++) { + mipmaps = cubeImage[i].mipmaps; - for (var j = 0; j < mipmaps.length; j++) { - var mipmap = mipmaps[j]; + for (let j = 0; j < mipmaps.length; j++) { + const mipmap = mipmaps[j]; if (texture.format !== RGBAFormat && texture.format !== RGBFormat) { if (glFormat !== null) { - state.compressedTexImage2D(34069 + _i3, j, glInternalFormat, mipmap.width, mipmap.height, 0, mipmap.data); + state.compressedTexImage2D(34069 + i, 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 + _i3, j, glInternalFormat, mipmap.width, mipmap.height, 0, glFormat, glType, mipmap.data); + state.texImage2D(34069 + i, j, glInternalFormat, mipmap.width, mipmap.height, 0, glFormat, glType, mipmap.data); } } } @@ -16744,21 +16014,21 @@ } else { mipmaps = texture.mipmaps; - for (var _i4 = 0; _i4 < 6; _i4++) { + for (let i = 0; i < 6; i++) { if (isDataTexture) { - state.texImage2D(34069 + _i4, 0, glInternalFormat, cubeImage[_i4].width, cubeImage[_i4].height, 0, glFormat, glType, cubeImage[_i4].data); + state.texImage2D(34069 + i, 0, glInternalFormat, cubeImage[i].width, cubeImage[i].height, 0, glFormat, glType, cubeImage[i].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); + 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); } } else { - state.texImage2D(34069 + _i4, 0, glInternalFormat, glFormat, glType, cubeImage[_i4]); + state.texImage2D(34069 + i, 0, glInternalFormat, glFormat, glType, cubeImage[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]); + for (let j = 0; j < mipmaps.length; j++) { + const mipmap = mipmaps[j]; + state.texImage2D(34069 + i, j + 1, glInternalFormat, glFormat, glType, mipmap.image[i]); } } } @@ -16778,10 +16048,10 @@ function setupFrameBufferTexture(framebuffer, renderTarget, attachment, textureTarget) { - var texture = renderTarget.texture; - var glFormat = utils.convert(texture.format); - var glType = utils.convert(texture.type); - var glInternalFormat = getInternalFormat(texture.internalFormat, glFormat, glType); + const texture = renderTarget.texture; + const glFormat = utils.convert(texture.format); + const glType = utils.convert(texture.type); + const 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); @@ -16801,10 +16071,10 @@ _gl.bindRenderbuffer(36161, renderbuffer); if (renderTarget.depthBuffer && !renderTarget.stencilBuffer) { - var glInternalFormat = 33189; + let glInternalFormat = 33189; if (isMultisample) { - var depthTexture = renderTarget.depthTexture; + const depthTexture = renderTarget.depthTexture; if (depthTexture && depthTexture.isDepthTexture) { if (depthTexture.type === FloatType) { @@ -16814,7 +16084,7 @@ } } - var samples = getRenderTargetSamples(renderTarget); + const samples = getRenderTargetSamples(renderTarget); _gl.renderbufferStorageMultisample(36161, samples, glInternalFormat, renderTarget.width, renderTarget.height); } else { @@ -16824,27 +16094,26 @@ _gl.framebufferRenderbuffer(36160, 36096, 36161, renderbuffer); } else if (renderTarget.depthBuffer && renderTarget.stencilBuffer) { if (isMultisample) { - var _samples = getRenderTargetSamples(renderTarget); + const 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 { - var texture = renderTarget.texture; - var glFormat = utils.convert(texture.format); - var glType = utils.convert(texture.type); - - var _glInternalFormat = getInternalFormat(texture.internalFormat, glFormat, glType); + const texture = renderTarget.texture; + const glFormat = utils.convert(texture.format); + const glType = utils.convert(texture.type); + const glInternalFormat = getInternalFormat(texture.internalFormat, glFormat, glType); if (isMultisample) { - var _samples2 = getRenderTargetSamples(renderTarget); + const samples = getRenderTargetSamples(renderTarget); - _gl.renderbufferStorageMultisample(36161, _samples2, _glInternalFormat, renderTarget.width, renderTarget.height); + _gl.renderbufferStorageMultisample(36161, samples, glInternalFormat, renderTarget.width, renderTarget.height); } else { - _gl.renderbufferStorage(36161, _glInternalFormat, renderTarget.width, renderTarget.height); + _gl.renderbufferStorage(36161, glInternalFormat, renderTarget.width, renderTarget.height); } } @@ -16853,7 +16122,7 @@ function setupDepthTexture(framebuffer, renderTarget) { - var isCube = renderTarget && renderTarget.isWebGLCubeRenderTarget; + const isCube = renderTarget && renderTarget.isWebGLCubeRenderTarget; if (isCube) throw new Error('Depth Texture with cube render targets is not supported'); _gl.bindFramebuffer(36160, framebuffer); @@ -16871,7 +16140,7 @@ setTexture2D(renderTarget.depthTexture, 0); - var webglDepthTexture = properties.get(renderTarget.depthTexture).__webglTexture; + const webglDepthTexture = properties.get(renderTarget.depthTexture).__webglTexture; if (renderTarget.depthTexture.format === DepthFormat) { _gl.framebufferTexture2D(36160, 36096, 3553, webglDepthTexture, 0); @@ -16884,8 +16153,8 @@ function setupDepthRenderbuffer(renderTarget) { - var renderTargetProperties = properties.get(renderTarget); - var isCube = renderTarget.isWebGLCubeRenderTarget === true; + const renderTargetProperties = properties.get(renderTarget); + const isCube = renderTarget.isWebGLCubeRenderTarget === true; if (renderTarget.depthTexture) { if (isCube) throw new Error('target.depthTexture not supported in Cube render targets'); @@ -16894,7 +16163,7 @@ if (isCube) { renderTargetProperties.__webglDepthbuffer = []; - for (var i = 0; i < 6; i++) { + for (let i = 0; i < 6; i++) { _gl.bindFramebuffer(36160, renderTargetProperties.__webglFramebuffer[i]); renderTargetProperties.__webglDepthbuffer[i] = _gl.createRenderbuffer(); @@ -16913,16 +16182,16 @@ function setupRenderTarget(renderTarget) { - var texture = renderTarget.texture; - var renderTargetProperties = properties.get(renderTarget); - var textureProperties = properties.get(texture); + const texture = renderTarget.texture; + const renderTargetProperties = properties.get(renderTarget); + const textureProperties = properties.get(texture); renderTarget.addEventListener('dispose', onRenderTargetDispose); textureProperties.__webglTexture = _gl.createTexture(); info.memory.textures++; - 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 + 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 if (isWebGL2 && texture.format === RGBFormat && (texture.type === FloatType || texture.type === HalfFloatType)) { texture.format = RGBAFormat; @@ -16933,7 +16202,7 @@ if (isCube) { renderTargetProperties.__webglFramebuffer = []; - for (var i = 0; i < 6; i++) { + for (let i = 0; i < 6; i++) { renderTargetProperties.__webglFramebuffer[i] = _gl.createFramebuffer(); } } else { @@ -16946,10 +16215,10 @@ _gl.bindRenderbuffer(36161, renderTargetProperties.__webglColorRenderbuffer); - var glFormat = utils.convert(texture.format); - var glType = utils.convert(texture.type); - var glInternalFormat = getInternalFormat(texture.internalFormat, glFormat, glType); - var samples = getRenderTargetSamples(renderTarget); + const glFormat = utils.convert(texture.format); + const glType = utils.convert(texture.type); + const glInternalFormat = getInternalFormat(texture.internalFormat, glFormat, glType); + const samples = getRenderTargetSamples(renderTarget); _gl.renderbufferStorageMultisample(36161, samples, glInternalFormat, renderTarget.width, renderTarget.height); @@ -16976,8 +16245,8 @@ state.bindTexture(34067, textureProperties.__webglTexture); setTextureParameters(34067, texture, supportsMips); - for (var _i5 = 0; _i5 < 6; _i5++) { - setupFrameBufferTexture(renderTargetProperties.__webglFramebuffer[_i5], renderTarget, 36064, 34069 + _i5); + for (let i = 0; i < 6; i++) { + setupFrameBufferTexture(renderTargetProperties.__webglFramebuffer[i], renderTarget, 36064, 34069 + i); } if (textureNeedsGenerateMipmaps(texture, supportsMips)) { @@ -16986,12 +16255,12 @@ state.bindTexture(34067, null); } else { - var glTextureType = 3553; + let glTextureType = 3553; if (isRenderTarget3D) { // Render targets containing layers, i.e: Texture 3D and 2d arrays if (isWebGL2) { - var isTexture3D = texture.isDataTexture3D; + const isTexture3D = texture.isDataTexture3D; glTextureType = isTexture3D ? 32879 : 35866; } else { console.warn('THREE.DataTexture3D and THREE.DataTexture2DArray only supported with WebGL2.'); @@ -17016,13 +16285,13 @@ } function updateRenderTargetMipmap(renderTarget) { - var texture = renderTarget.texture; - var supportsMips = isPowerOfTwo(renderTarget) || isWebGL2; + const texture = renderTarget.texture; + const supportsMips = isPowerOfTwo(renderTarget) || isWebGL2; if (textureNeedsGenerateMipmaps(texture, supportsMips)) { - var target = renderTarget.isWebGLCubeRenderTarget ? 34067 : 3553; + const target = renderTarget.isWebGLCubeRenderTarget ? 34067 : 3553; - var webglTexture = properties.get(texture).__webglTexture; + const webglTexture = properties.get(texture).__webglTexture; state.bindTexture(target, webglTexture); generateMipmap(target, texture, renderTarget.width, renderTarget.height); @@ -17033,15 +16302,15 @@ function updateMultisampleRenderTarget(renderTarget) { if (renderTarget.isWebGLMultisampleRenderTarget) { if (isWebGL2) { - var renderTargetProperties = properties.get(renderTarget); + const renderTargetProperties = properties.get(renderTarget); _gl.bindFramebuffer(36008, renderTargetProperties.__webglMultisampledFramebuffer); _gl.bindFramebuffer(36009, renderTargetProperties.__webglFramebuffer); - var width = renderTarget.width; - var height = renderTarget.height; - var mask = 16384; + const width = renderTarget.width; + const height = renderTarget.height; + let mask = 16384; if (renderTarget.depthBuffer) mask |= 256; if (renderTarget.stencilBuffer) mask |= 1024; @@ -17060,7 +16329,7 @@ } function updateVideoTexture(texture) { - var frame = info.render.frame; // Check the last frame we updated the VideoTexture + const frame = info.render.frame; // Check the last frame we updated the VideoTexture if (_videoTextures.get(texture) !== frame) { _videoTextures.set(texture, frame); @@ -17070,8 +16339,8 @@ } // backwards compatibility - var warnedTexture2D = false; - var warnedTextureCube = false; + let warnedTexture2D = false; + let warnedTextureCube = false; function safeSetTexture2D(texture, slot) { if (texture && texture.isWebGLRenderTarget) { @@ -17114,10 +16383,10 @@ } function WebGLUtils(gl, extensions, capabilities) { - var isWebGL2 = capabilities.isWebGL2; + const isWebGL2 = capabilities.isWebGL2; function convert(p) { - var extension; + let extension; if (p === UnsignedByteType) return 5121; if (p === UnsignedShort4444Type) return 32819; if (p === UnsignedShort5551Type) return 32820; @@ -17239,11 +16508,7 @@ }; } - function ArrayCamera(array) { - if (array === void 0) { - array = []; - } - + function ArrayCamera(array = []) { PerspectiveCamera.call(this); this.cameras = array; } @@ -17253,19 +16518,13 @@ isArrayCamera: true }); - var Group = /*#__PURE__*/function (_Object3D) { - _inheritsLoose(Group, _Object3D); - - function Group() { - var _this; - - _this = _Object3D.call(this) || this; - _this.type = 'Group'; - return _this; + class Group extends Object3D { + constructor() { + super(); + this.type = 'Group'; } - return Group; - }(Object3D); + } Group.prototype.isGroup = true; @@ -17277,7 +16536,7 @@ Object.assign(WebXRController.prototype, { constructor: WebXRController, - getHandSpace: function getHandSpace() { + getHandSpace: function () { if (this._hand === null) { this._hand = new Group(); this._hand.matrixAutoUpdate = false; @@ -17290,7 +16549,7 @@ return this._hand; }, - getTargetRaySpace: function getTargetRaySpace() { + getTargetRaySpace: function () { if (this._targetRay === null) { this._targetRay = new Group(); this._targetRay.matrixAutoUpdate = false; @@ -17299,7 +16558,7 @@ return this._targetRay; }, - getGripSpace: function getGripSpace() { + getGripSpace: function () { if (this._grip === null) { this._grip = new Group(); this._grip.matrixAutoUpdate = false; @@ -17308,7 +16567,7 @@ return this._grip; }, - dispatchEvent: function dispatchEvent(event) { + dispatchEvent: function (event) { if (this._targetRay !== null) { this._targetRay.dispatchEvent(event); } @@ -17323,7 +16582,7 @@ return this; }, - disconnect: function disconnect(inputSource) { + disconnect: function (inputSource) { this.dispatchEvent({ type: 'disconnected', data: inputSource @@ -17343,13 +16602,13 @@ return this; }, - 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; + 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; if (inputSource && frame.session.visibilityState !== 'visible-blurred') { if (targetRay !== null) { @@ -17364,23 +16623,21 @@ if (hand && inputSource.hand) { handPose = true; - for (var _iterator = _createForOfIteratorHelperLoose(inputSource.hand.values()), _step; !(_step = _iterator()).done;) { - var inputjoint = _step.value; + for (const inputjoint of inputSource.hand.values()) { // Update the joints groups with the XRJoint poses - var jointPose = frame.getJointPose(inputjoint, referenceSpace); + const jointPose = frame.getJointPose(inputjoint, referenceSpace); if (hand.joints[inputjoint.jointName] === undefined) { // The transform of this joint will be updated with the joint pose on each frame - var _joint = new Group(); + const joint = new Group(); + joint.matrixAutoUpdate = false; + joint.visible = false; + hand.joints[inputjoint.jointName] = joint; // ?? - _joint.matrixAutoUpdate = false; - _joint.visible = false; - hand.joints[inputjoint.jointName] = _joint; // ?? - - hand.add(_joint); + hand.add(joint); } - var joint = hand.joints[inputjoint.jointName]; + const joint = hand.joints[inputjoint.jointName]; if (jointPose !== null) { joint.matrix.fromArray(jointPose.transform.matrix); @@ -17393,11 +16650,11 @@ // Check pinchz - 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; + const indexTip = hand.joints['index-finger-tip']; + const thumbTip = hand.joints['thumb-tip']; + const distance = indexTip.position.distanceTo(thumbTip.position); + const distanceToPinch = 0.02; + const threshold = 0.005; if (hand.inputState.pinching && distance > distanceToPinch + threshold) { hand.inputState.pinching = false; @@ -17443,33 +16700,33 @@ }); function WebXRManager(renderer, gl) { - var scope = this; - 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(); + const scope = this; + 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(); cameraL.layers.enable(1); cameraL.viewport = new Vector4(); - var cameraR = new PerspectiveCamera(); + const cameraR = new PerspectiveCamera(); cameraR.layers.enable(2); cameraR.viewport = new Vector4(); - var cameras = [cameraL, cameraR]; - var cameraVR = new ArrayCamera(); + const cameras = [cameraL, cameraR]; + const cameraVR = new ArrayCamera(); cameraVR.layers.enable(1); cameraVR.layers.enable(2); - var _currentDepthNear = null; - var _currentDepthFar = null; // + let _currentDepthNear = null; + let _currentDepthFar = null; // this.enabled = false; this.isPresenting = false; this.getController = function (index) { - var controller = controllers[index]; + let controller = controllers[index]; if (controller === undefined) { controller = new WebXRController(); @@ -17480,7 +16737,7 @@ }; this.getControllerGrip = function (index) { - var controller = controllers[index]; + let controller = controllers[index]; if (controller === undefined) { controller = new WebXRController(); @@ -17491,7 +16748,7 @@ }; this.getHand = function (index) { - var controller = controllers[index]; + let controller = controllers[index]; if (controller === undefined) { controller = new WebXRController(); @@ -17503,7 +16760,7 @@ function onSessionEvent(event) { - var controller = inputSourcesMap.get(event.inputSource); + const controller = inputSourcesMap.get(event.inputSource); if (controller) { controller.dispatchEvent({ @@ -17555,87 +16812,57 @@ return session; }; - 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; - } + this.setSession = async function (value) { + session = value; - 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 (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(); - _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' - }); + if (attributes.xrCompatible !== true) { + await gl.makeXRCompatible(); + } - case 24: - case "end": - return _context.stop(); - } - } - }, _callee); - })); + const layerInit = { + antialias: attributes.antialias, + alpha: attributes.alpha, + depth: attributes.depth, + stencil: attributes.stencil, + framebufferScaleFactor: framebufferScaleFactor + }; // eslint-disable-next-line no-undef - return function (_x) { - return _ref.apply(this, arguments); - }; - }(); + 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' + }); + } + }; function onInputSourcesChange(event) { - var inputSources = session.inputSources; // Assign inputSources to available controllers + const inputSources = session.inputSources; // Assign inputSources to available controllers - for (var i = 0; i < controllers.length; i++) { + for (let i = 0; i < controllers.length; i++) { inputSourcesMap.set(inputSources[i], controllers[i]); } // Notify disconnected - for (var _i = 0; _i < event.removed.length; _i++) { - var inputSource = event.removed[_i]; - var controller = inputSourcesMap.get(inputSource); + for (let i = 0; i < event.removed.length; i++) { + const inputSource = event.removed[i]; + const controller = inputSourcesMap.get(inputSource); if (controller) { controller.dispatchEvent({ @@ -17647,23 +16874,22 @@ } // Notify connected - for (var _i2 = 0; _i2 < event.added.length; _i2++) { - var _inputSource = event.added[_i2]; - - var _controller = inputSourcesMap.get(_inputSource); + for (let i = 0; i < event.added.length; i++) { + const inputSource = event.added[i]; + const controller = inputSourcesMap.get(inputSource); - if (_controller) { - _controller.dispatchEvent({ + if (controller) { + controller.dispatchEvent({ type: 'connected', - data: _inputSource + data: inputSource }); } } } // - var cameraLPos = new Vector3(); - var cameraRPos = new Vector3(); + const cameraLPos = new Vector3(); + const cameraRPos = new Vector3(); /** * Assumes 2 cameras that are parallel and share an X-axis, and that * the cameras' projection and world matrices have already been set. @@ -17674,24 +16900,24 @@ function setProjectionFromUnion(camera, cameraL, cameraR) { cameraLPos.setFromMatrixPosition(cameraL.matrixWorld); cameraRPos.setFromMatrixPosition(cameraR.matrixWorld); - 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 + 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 // most likely identical top and bottom frustum extents. // Use the left camera for these values. - 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 + 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 // left camera. xOffset should be roughly half `ipd`. - var zOffset = ipd / (-leftFov + rightFov); - var xOffset = zOffset * -leftFov; // TODO: Better way to apply this offset? + const zOffset = ipd / (-leftFov + rightFov); + const xOffset = zOffset * -leftFov; // TODO: Better way to apply this offset? cameraL.matrixWorld.decompose(camera.position, camera.quaternion, camera.scale); camera.translateX(xOffset); @@ -17701,12 +16927,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. - 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; + 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; camera.projectionMatrix.makePerspective(left2, right2, top2, bottom2, near2, far2); } @@ -17734,11 +16960,11 @@ _currentDepthFar = cameraVR.far; } - var parent = camera.parent; - var cameras = cameraVR.cameras; + const parent = camera.parent; + const cameras = cameraVR.cameras; updateCamera(cameraVR, parent); - for (var i = 0; i < cameras.length; i++) { + for (let i = 0; i < cameras.length; i++) { updateCamera(cameras[i], parent); } // update camera and its children @@ -17746,10 +16972,10 @@ camera.matrixWorld.copy(cameraVR.matrixWorld); camera.matrix.copy(cameraVR.matrix); camera.matrix.decompose(camera.position, camera.quaternion, camera.scale); - var children = camera.children; + const children = camera.children; - for (var _i3 = 0, l = children.length; _i3 < l; _i3++) { - children[_i3].updateMatrixWorld(true); + for (let i = 0, l = children.length; i < l; i++) { + children[i].updateMatrixWorld(true); } // update projection matrix for proper view frustum culling @@ -17764,26 +16990,26 @@ }; // Animation Loop - var onAnimationFrameCallback = null; + let onAnimationFrameCallback = null; function onAnimationFrame(time, frame) { pose = frame.getViewerPose(referenceSpace); if (pose !== null) { - var views = pose.views; - var baseLayer = session.renderState.baseLayer; + const views = pose.views; + const baseLayer = session.renderState.baseLayer; renderer.setFramebuffer(baseLayer.framebuffer); - var cameraVRNeedsUpdate = false; // check if it's necessary to rebuild cameraVR's camera list + let 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 (var i = 0; i < views.length; i++) { - var view = views[i]; - var viewport = baseLayer.getViewport(view); - var camera = cameras[i]; + for (let i = 0; i < views.length; i++) { + const view = views[i]; + const viewport = baseLayer.getViewport(view); + const 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); @@ -17799,18 +17025,18 @@ } // - var inputSources = session.inputSources; + const inputSources = session.inputSources; - for (var _i4 = 0; _i4 < controllers.length; _i4++) { - var controller = controllers[_i4]; - var inputSource = inputSources[_i4]; + for (let i = 0; i < controllers.length; i++) { + const controller = controllers[i]; + const inputSource = inputSources[i]; controller.update(inputSource, frame, referenceSpace); } if (onAnimationFrameCallback) onAnimationFrameCallback(time, frame); } - var animation = new WebGLAnimation(); + const animation = new WebGLAnimation(); animation.setAnimationLoop(onAnimationFrame); this.setAnimationLoop = function (callback) { @@ -17907,7 +17133,7 @@ uniforms.specularMap.value = material.specularMap; } - var envMap = properties.get(material).envMap; + const envMap = properties.get(material).envMap; if (envMap) { uniforms.envMap.value = envMap; @@ -17915,7 +17141,7 @@ uniforms.reflectivity.value = material.reflectivity; uniforms.refractionRatio.value = material.refractionRatio; - var maxMipLevel = properties.get(envMap).__maxMipLevel; + const maxMipLevel = properties.get(envMap).__maxMipLevel; if (maxMipLevel !== undefined) { uniforms.maxMipLevel.value = maxMipLevel; @@ -17945,7 +17171,7 @@ // 12. clearcoat roughnessMap map - var uvScaleMap; + let uvScaleMap; if (material.map) { uvScaleMap = material.map; @@ -17989,7 +17215,7 @@ // 2. light map - var uv2ScaleMap; + let uv2ScaleMap; if (material.aoMap) { uv2ScaleMap = material.aoMap; @@ -18039,7 +17265,7 @@ // 2. alpha map - var uvScaleMap; + let uvScaleMap; if (material.map) { uvScaleMap = material.map; @@ -18072,7 +17298,7 @@ // 2. alpha map - var uvScaleMap; + let uvScaleMap; if (material.map) { uvScaleMap = material.map; @@ -18184,7 +17410,7 @@ uniforms.displacementBias.value = material.displacementBias; } - var envMap = properties.get(material).envMap; + const envMap = properties.get(material).envMap; if (envMap) { //uniforms.envMap.value = material.envMap; // part of uniforms common @@ -18295,7 +17521,7 @@ } function createCanvasElement() { - var canvas = document.createElementNS('http://www.w3.org/1999/xhtml', 'canvas'); + const canvas = document.createElementNS('http://www.w3.org/1999/xhtml', 'canvas'); canvas.style.display = 'block'; return canvas; } @@ -18303,23 +17529,23 @@ function WebGLRenderer(parameters) { parameters = parameters || {}; - 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. + 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. // We track this so that the nested render call gets its list and state isolated from the parent render call. - var renderListStack = []; - var renderStateStack = []; // public properties + const renderListStack = []; + const renderStateStack = []; // public properties this.domElement = _canvas; // Debug configuration container @@ -18353,49 +17579,49 @@ this.maxMorphTargets = 8; this.maxMorphNormals = 4; // internal properties - var _this = this; + const _this = this; - var _isContextLost = false; // internal state cache + let _isContextLost = false; // internal state cache - var _framebuffer = null; - var _currentActiveCubeFace = 0; - var _currentActiveMipmapLevel = 0; - var _currentRenderTarget = null; - var _currentFramebuffer = null; + let _framebuffer = null; + let _currentActiveCubeFace = 0; + let _currentActiveMipmapLevel = 0; + let _currentRenderTarget = null; + let _currentFramebuffer = null; - var _currentMaterialId = -1; + let _currentMaterialId = -1; - var _currentCamera = null; + let _currentCamera = null; - var _currentViewport = new Vector4(); + const _currentViewport = new Vector4(); - var _currentScissor = new Vector4(); + const _currentScissor = new Vector4(); - var _currentScissorTest = null; // + let _currentScissorTest = null; // - var _width = _canvas.width; - var _height = _canvas.height; - var _pixelRatio = 1; - var _opaqueSort = null; - var _transparentSort = null; + let _width = _canvas.width; + let _height = _canvas.height; + let _pixelRatio = 1; + let _opaqueSort = null; + let _transparentSort = null; - var _viewport = new Vector4(0, 0, _width, _height); + const _viewport = new Vector4(0, 0, _width, _height); - var _scissor = new Vector4(0, 0, _width, _height); + const _scissor = new Vector4(0, 0, _width, _height); - var _scissorTest = false; // frustum + let _scissorTest = false; // frustum - var _frustum = new Frustum(); // clipping + const _frustum = new Frustum(); // clipping - var _clippingEnabled = false; - var _localClippingEnabled = false; // camera matrices cache + let _clippingEnabled = false; + let _localClippingEnabled = false; // camera matrices cache - var _projScreenMatrix = new Matrix4(); + const _projScreenMatrix = new Matrix4(); - var _vector3 = new Vector3(); + const _vector3 = new Vector3(); - var _emptyScene = { + const _emptyScene = { background: null, fog: null, environment: null, @@ -18408,13 +17634,13 @@ } // initialize - var _gl = _context; + let _gl = _context; function getContext(contextNames, contextAttributes) { - for (var i = 0; i < contextNames.length; i++) { - var contextName = contextNames[i]; + for (let i = 0; i < contextNames.length; i++) { + const contextName = contextNames[i]; - var context = _canvas.getContext(contextName, contextAttributes); + const context = _canvas.getContext(contextName, contextAttributes); if (context !== null) return context; } @@ -18423,7 +17649,7 @@ } try { - var contextAttributes = { + const contextAttributes = { alpha: _alpha, depth: _depth, stencil: _stencil, @@ -18439,7 +17665,7 @@ _canvas.addEventListener('webglcontextrestored', onContextRestore, false); if (_gl === null) { - var contextNames = ['webgl2', 'webgl', 'experimental-webgl']; + const contextNames = ['webgl2', 'webgl', 'experimental-webgl']; if (_this.isWebGL1Renderer === true) { contextNames.shift(); @@ -18471,11 +17697,11 @@ throw error; } - var extensions, capabilities, state, info; - var properties, textures, cubemaps, attributes, geometries, objects; - var programCache, materials, renderLists, renderStates, clipping; - var background, morphtargets, bufferRenderer, indexedBufferRenderer; - var utils, bindingStates; + let extensions, capabilities, state, info; + let properties, textures, cubemaps, attributes, geometries, objects; + let programCache, materials, renderLists, renderStates, clipping; + let background, morphtargets, bufferRenderer, indexedBufferRenderer; + let utils, bindingStates; function initGLContext() { extensions = new WebGLExtensions(_gl); @@ -18513,10 +17739,10 @@ initGLContext(); // xr - var xr = new WebXRManager(_this, _gl); + const xr = new WebXRManager(_this, _gl); this.xr = xr; // shadow map - var shadowMap = new WebGLShadowMap(_this, objects, capabilities.maxTextureSize); + const shadowMap = new WebGLShadowMap(_this, objects, capabilities.maxTextureSize); this.shadowMap = shadowMap; // API this.getContext = function () { @@ -18528,12 +17754,12 @@ }; this.forceContextLoss = function () { - var extension = extensions.get('WEBGL_lose_context'); + const extension = extensions.get('WEBGL_lose_context'); if (extension) extension.loseContext(); }; this.forceContextRestore = function () { - var extension = extensions.get('WEBGL_lose_context'); + const extension = extensions.get('WEBGL_lose_context'); if (extension) extension.restoreContext(); }; @@ -18669,7 +17895,7 @@ }; this.clear = function (color, depth, stencil) { - var bits = 0; + let bits = 0; if (color === undefined || color) bits |= 16384; if (depth === undefined || depth) bits |= 256; if (stencil === undefined || stencil) bits |= 1024; @@ -18721,7 +17947,7 @@ } function onMaterialDispose(event) { - var material = event.target; + const material = event.target; material.removeEventListener('dispose', onMaterialDispose); deallocateMaterial(material); } // Buffer deallocation @@ -18733,7 +17959,7 @@ } function releaseMaterialProgramReference(material) { - var programInfo = properties.get(material).program; + const programInfo = properties.get(material).program; if (programInfo !== undefined) { programCache.releaseProgram(programInfo); @@ -18749,12 +17975,12 @@ this.renderBufferImmediate = function (object, program) { bindingStates.initAttributes(); - var buffers = properties.get(object); + const 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(); - var programAttributes = program.getAttributes(); + const programAttributes = program.getAttributes(); if (object.hasPositions) { _gl.bindBuffer(34962, buffers.position); @@ -18806,12 +18032,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) - var frontFaceCW = object.isMesh && object.matrixWorld.determinant() < 0; - var program = setProgram(camera, scene, material, object); + const frontFaceCW = object.isMesh && object.matrixWorld.determinant() < 0; + const program = setProgram(camera, scene, material, object); state.setMaterial(material, frontFaceCW); // - var index = geometry.index; - var position = geometry.attributes.position; // + let index = geometry.index; + const position = geometry.attributes.position; // if (index === null) { if (position === undefined || position.count === 0) return; @@ -18820,7 +18046,7 @@ } // - var rangeFactor = 1; + let rangeFactor = 1; if (material.wireframe === true) { index = geometries.getWireframeAttribute(geometry); @@ -18832,8 +18058,8 @@ } bindingStates.setup(object, material, program, geometry, index); - var attribute; - var renderer = bufferRenderer; + let attribute; + let renderer = bufferRenderer; if (index !== null) { attribute = attributes.get(index); @@ -18842,14 +18068,14 @@ } // - 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); + 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); if (drawCount === 0) return; // if (object.isMesh) { @@ -18860,7 +18086,7 @@ renderer.setMode(4); } } else if (object.isLine) { - var lineWidth = material.linewidth; + let lineWidth = material.linewidth; if (lineWidth === undefined) lineWidth = 1; // Not using Line*Material state.setLineWidth(lineWidth * getTargetPixelRatio()); @@ -18881,7 +18107,7 @@ if (object.isInstancedMesh) { renderer.renderInstances(drawStart, drawCount, object.count); } else if (geometry.isInstancedBufferGeometry) { - var instanceCount = Math.min(geometry.instanceCount, geometry._maxInstanceCount); + const instanceCount = Math.min(geometry.instanceCount, geometry._maxInstanceCount); renderer.renderInstances(drawStart, drawCount, instanceCount); } else { renderer.render(drawStart, drawCount); @@ -18902,14 +18128,14 @@ } }); currentRenderState.setupLights(); - var compiled = new WeakMap(); + const compiled = new WeakMap(); scene.traverse(function (object) { - var material = object.material; + const material = object.material; if (material) { if (Array.isArray(material)) { - for (var i = 0; i < material.length; i++) { - var material2 = material[i]; + for (let i = 0; i < material.length; i++) { + const material2 = material[i]; if (compiled.has(material2) === false) { initMaterial(material2, scene, object); @@ -18925,14 +18151,14 @@ }; // Animation Loop - var onAnimationFrameCallback = null; + let onAnimationFrameCallback = null; function onAnimationFrame(time) { if (xr.isPresenting) return; if (onAnimationFrameCallback) onAnimationFrameCallback(time); } - var animation = new WebGLAnimation(); + const animation = new WebGLAnimation(); animation.setAnimationLoop(onAnimationFrame); if (typeof window !== 'undefined') animation.setContext(window); @@ -18944,7 +18170,7 @@ this.render = function (scene, camera) { - var renderTarget, forceClear; + let renderTarget, forceClear; if (arguments[2] !== undefined) { console.warn('THREE.WebGLRenderer.render(): the renderTarget argument has been removed. Use .setRenderTarget() instead.'); @@ -18999,7 +18225,7 @@ if (_clippingEnabled === true) clipping.beginShadows(); - var shadowsArray = currentRenderState.state.shadowsArray; + const shadowsArray = currentRenderState.state.shadowsArray; shadowMap.render(shadowsArray, scene, camera); currentRenderState.setupLights(); currentRenderState.setupLightsView(camera); @@ -19014,8 +18240,8 @@ background.render(currentRenderList, scene, camera, forceClear); // render scene - var opaqueObjects = currentRenderList.opaque; - var transparentObjects = currentRenderList.transparent; + const opaqueObjects = currentRenderList.opaque; + const transparentObjects = currentRenderList.transparent; if (opaqueObjects.length > 0) renderObjects(opaqueObjects, scene, camera); if (transparentObjects.length > 0) renderObjects(transparentObjects, scene, camera); // @@ -19053,7 +18279,7 @@ function projectObject(object, camera, groupOrder, sortObjects) { if (object.visible === false) return; - var visible = object.layers.test(camera.layers); + const visible = object.layers.test(camera.layers); if (visible) { if (object.isGroup) { @@ -19072,8 +18298,8 @@ _vector3.setFromMatrixPosition(object.matrixWorld).applyMatrix4(_projScreenMatrix); } - var geometry = objects.update(object); - var material = object.material; + const geometry = objects.update(object); + const material = object.material; if (material.visible) { currentRenderList.push(object, geometry, material, groupOrder, _vector3.z, null); @@ -19099,50 +18325,49 @@ _vector3.setFromMatrixPosition(object.matrixWorld).applyMatrix4(_projScreenMatrix); } - var _geometry = objects.update(object); - - var _material = object.material; + const geometry = objects.update(object); + const material = object.material; - if (Array.isArray(_material)) { - var groups = _geometry.groups; + if (Array.isArray(material)) { + const groups = geometry.groups; - for (var i = 0, l = groups.length; i < l; i++) { - var group = groups[i]; - var groupMaterial = _material[group.materialIndex]; + for (let i = 0, l = groups.length; i < l; i++) { + const group = groups[i]; + const groupMaterial = material[group.materialIndex]; if (groupMaterial && groupMaterial.visible) { - currentRenderList.push(object, _geometry, groupMaterial, groupOrder, _vector3.z, group); + 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); } } } } - var children = object.children; + const children = object.children; - for (var _i = 0, _l = children.length; _i < _l; _i++) { - projectObject(children[_i], camera, groupOrder, sortObjects); + for (let i = 0, l = children.length; i < l; i++) { + projectObject(children[i], camera, groupOrder, sortObjects); } } function renderObjects(renderList, scene, camera) { - var overrideMaterial = scene.isScene === true ? scene.overrideMaterial : null; + const overrideMaterial = scene.isScene === true ? scene.overrideMaterial : null; - 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; + for (let i = 0, l = renderList.length; i < l; i++) { + const renderItem = renderList[i]; + const object = renderItem.object; + const geometry = renderItem.geometry; + const material = overrideMaterial === null ? renderItem.material : overrideMaterial; + const group = renderItem.group; if (camera.isArrayCamera) { - var cameras = camera.cameras; + const cameras = camera.cameras; - for (var j = 0, jl = cameras.length; j < jl; j++) { - var camera2 = cameras[j]; + for (let j = 0, jl = cameras.length; j < jl; j++) { + const camera2 = cameras[j]; if (object.layers.test(camera2.layers)) { state.viewport(_currentViewport.copy(camera2.viewport)); @@ -19162,7 +18387,7 @@ object.normalMatrix.getNormalMatrix(object.modelViewMatrix); if (object.isImmediateRenderObject) { - var program = setProgram(camera, scene, material, object); + const program = setProgram(camera, scene, material, object); state.setMaterial(material); bindingStates.reset(); renderObjectImmediate(object, program); @@ -19176,14 +18401,14 @@ function initMaterial(material, scene, object) { if (scene.isScene !== true) scene = _emptyScene; // scene could be a Mesh, Line, Points, ... - 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 program = materialProperties.program; - var programChange = true; // always update environment and fog - changing these trigger an initMaterial call, but it's possible that the program doesn't change + 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 program = materialProperties.program; + let programChange = true; // always update environment and fog - changing these trigger an initMaterial call, but it's possible that the program doesn't change materialProperties.environment = material.isMeshStandardMaterial ? scene.environment : null; materialProperties.fog = scene.fog; @@ -19214,7 +18439,7 @@ materialProperties.outputEncoding = parameters.outputEncoding; } - var uniforms = materialProperties.uniforms; + const uniforms = materialProperties.uniforms; if (!material.isShaderMaterial && !material.isRawShaderMaterial || material.clipping === true) { materialProperties.numClippingPlanes = clipping.numPlanes; @@ -19248,8 +18473,8 @@ uniforms.pointShadowMatrix.value = lights.state.pointShadowMatrix; // TODO (abelnation): add area lights shadow info to uniforms } - var progUniforms = materialProperties.program.getUniforms(); - var uniformsList = WebGLUniforms.seqWithValue(progUniforms.seq, uniforms); + const progUniforms = materialProperties.program.getUniforms(); + const uniformsList = WebGLUniforms.seqWithValue(progUniforms.seq, uniforms); materialProperties.uniformsList = uniformsList; } @@ -19257,16 +18482,16 @@ if (scene.isScene !== true) scene = _emptyScene; // scene could be a Mesh, Line, Points, ... textures.resetTextureUnits(); - 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; + 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; if (_clippingEnabled === true) { if (_localClippingEnabled === true || camera !== _currentCamera) { - var useCache = camera === _currentCamera && material.id === _currentMaterialId; // we might want to call this function with some ClippingGroup + const useCache = camera === _currentCamera && material.id === _currentMaterialId; // we might want to call this function with some ClippingGroup // object instead of the material, once it becomes feasible // (#8465, #8379) @@ -19293,12 +18518,12 @@ materialProperties.__version = material.version; } - var refreshProgram = false; - var refreshMaterial = false; - var refreshLights = false; - var program = materialProperties.program, - p_uniforms = program.getUniforms(), - m_uniforms = materialProperties.uniforms; + let refreshProgram = false; + let refreshMaterial = false; + let refreshLights = false; + const program = materialProperties.program, + p_uniforms = program.getUniforms(), + m_uniforms = materialProperties.uniforms; if (state.useProgram(program.program)) { refreshProgram = true; @@ -19331,7 +18556,7 @@ if (material.isShaderMaterial || material.isMeshPhongMaterial || material.isMeshToonMaterial || material.isMeshStandardMaterial || material.envMap) { - var uCamPos = p_uniforms.map.cameraPosition; + const uCamPos = p_uniforms.map.cameraPosition; if (uCamPos !== undefined) { uCamPos.setValue(_gl, _vector3.setFromMatrixPosition(camera.matrixWorld)); @@ -19353,10 +18578,10 @@ if (material.skinning) { p_uniforms.setOptional(_gl, object, 'bindMatrix'); p_uniforms.setOptional(_gl, object, 'bindMatrixInverse'); - var skeleton = object.skeleton; + const skeleton = object.skeleton; if (skeleton) { - var bones = skeleton.bones; + const bones = skeleton.bones; if (capabilities.floatVertexTextures) { if (skeleton.boneTexture === null) { @@ -19366,15 +18591,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) - var size = Math.sqrt(bones.length * 4); // 4 pixels needed for 1 matrix + let size = Math.sqrt(bones.length * 4); // 4 pixels needed for 1 matrix size = MathUtils.ceilPowerOfTwo(size); size = Math.max(size, 4); - var boneMatrices = new Float32Array(size * size * 4); // 4 floats per RGBA pixel + const boneMatrices = new Float32Array(size * size * 4); // 4 floats per RGBA pixel boneMatrices.set(skeleton.boneMatrices); // copy current values - var boneTexture = new DataTexture(boneMatrices, size, size, RGBAFormat, FloatType); + const boneTexture = new DataTexture(boneMatrices, size, size, RGBAFormat, FloatType); skeleton.boneMatrices = boneMatrices; skeleton.boneTexture = boneTexture; skeleton.boneTextureSize = size; @@ -19468,15 +18693,7 @@ return _currentRenderTarget; }; - this.setRenderTarget = function (renderTarget, activeCubeFace, activeMipmapLevel) { - if (activeCubeFace === void 0) { - activeCubeFace = 0; - } - - if (activeMipmapLevel === void 0) { - activeMipmapLevel = 0; - } - + this.setRenderTarget = function (renderTarget, activeCubeFace = 0, activeMipmapLevel = 0) { _currentRenderTarget = renderTarget; _currentActiveCubeFace = activeCubeFace; _currentActiveMipmapLevel = activeMipmapLevel; @@ -19485,18 +18702,18 @@ textures.setupRenderTarget(renderTarget); } - var framebuffer = _framebuffer; - var isCube = false; - var isRenderTarget3D = false; + let framebuffer = _framebuffer; + let isCube = false; + let isRenderTarget3D = false; if (renderTarget) { - var texture = renderTarget.texture; + const texture = renderTarget.texture; if (texture.isDataTexture3D || texture.isDataTexture2DArray) { isRenderTarget3D = true; } - var __webglFramebuffer = properties.get(renderTarget).__webglFramebuffer; + const __webglFramebuffer = properties.get(renderTarget).__webglFramebuffer; if (renderTarget.isWebGLCubeRenderTarget) { framebuffer = __webglFramebuffer[activeCubeFace]; @@ -19531,15 +18748,14 @@ state.setScissorTest(_currentScissorTest); if (isCube) { - var textureProperties = properties.get(renderTarget.texture); + const textureProperties = properties.get(renderTarget.texture); _gl.framebufferTexture2D(36160, 36064, 34069 + activeCubeFace, textureProperties.__webglTexture, activeMipmapLevel); } else if (isRenderTarget3D) { - var _textureProperties = properties.get(renderTarget.texture); - - var layer = activeCubeFace || 0; + const textureProperties = properties.get(renderTarget.texture); + const layer = activeCubeFace || 0; - _gl.framebufferTextureLayer(36160, 36064, _textureProperties.__webglTexture, activeMipmapLevel || 0, layer); + _gl.framebufferTextureLayer(36160, 36064, textureProperties.__webglTexture, activeMipmapLevel || 0, layer); } }; @@ -19549,14 +18765,14 @@ return; } - var framebuffer = properties.get(renderTarget).__webglFramebuffer; + let framebuffer = properties.get(renderTarget).__webglFramebuffer; if (renderTarget.isWebGLCubeRenderTarget && activeCubeFaceIndex !== undefined) { framebuffer = framebuffer[activeCubeFaceIndex]; } if (framebuffer) { - var restore = false; + let restore = false; if (framebuffer !== _currentFramebuffer) { _gl.bindFramebuffer(36160, framebuffer); @@ -19565,16 +18781,16 @@ } try { - var texture = renderTarget.texture; - var textureFormat = texture.format; - var textureType = texture.type; + const texture = renderTarget.texture; + const textureFormat = texture.format; + const 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; } - var halfFloatSupportedByExt = textureType === HalfFloatType && (extensions.has('EXT_color_buffer_half_float') || capabilities.isWebGL2 && extensions.has('EXT_color_buffer_float')); + const halfFloatSupportedByExt = textureType === HalfFloatType && (extensions.has('EXT_color_buffer_half_float') || capabilities.isWebGL2 && extensions.has('EXT_color_buffer_float')); if (textureType !== UnsignedByteType && utils.convert(textureType) !== _gl.getParameter(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 @@ -19599,15 +18815,11 @@ } }; - 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); + 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); textures.setTexture2D(texture, 0); _gl.copyTexImage2D(3553, level, glFormat, position.x, position.y, width, height, 0); @@ -19615,15 +18827,11 @@ state.unbindTexture(); }; - 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); + this.copyTextureToTexture = function (position, srcTexture, dstTexture, level = 0) { + const width = srcTexture.image.width; + const height = srcTexture.image.height; + const glFormat = utils.convert(dstTexture.format); + const glType = utils.convert(dstTexture.type); textures.setTexture2D(dstTexture, 0); // As another texture upload may have changed pixelStorei // parameters, make sure they are correct for the dstTexture @@ -19648,23 +18856,20 @@ state.unbindTexture(); }; - this.copyTextureToTexture3D = function (sourceBox, position, srcTexture, dstTexture, level) { - if (level === void 0) { - level = 0; - } - + this.copyTextureToTexture3D = function (sourceBox, position, srcTexture, dstTexture, level = 0) { if (_this.isWebGL1Renderer) { console.warn('THREE.WebGLRenderer.copyTextureToTexture3D: can only be used with WebGL2.'); return; } - 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; + const { + width, + height, + data + } = srcTexture.image; + const glFormat = utils.convert(dstTexture.format); + const glType = utils.convert(dstTexture.type); + let glTarget; if (dstTexture.isDataTexture3D) { textures.setTexture3D(dstTexture, 0); @@ -19683,15 +18888,15 @@ _gl.pixelStorei(3317, dstTexture.unpackAlignment); - var unpackRowLen = _gl.getParameter(3314); + const unpackRowLen = _gl.getParameter(3314); - var unpackImageHeight = _gl.getParameter(32878); + const unpackImageHeight = _gl.getParameter(32878); - var unpackSkipPixels = _gl.getParameter(3316); + const unpackSkipPixels = _gl.getParameter(3316); - var unpackSkipRows = _gl.getParameter(3315); + const unpackSkipRows = _gl.getParameter(3315); - var unpackSkipImages = _gl.getParameter(32877); + const unpackSkipImages = _gl.getParameter(32877); _gl.pixelStorei(3314, width); @@ -19738,32 +18943,22 @@ } } - var WebGL1Renderer = /*#__PURE__*/function (_WebGLRenderer) { - _inheritsLoose(WebGL1Renderer, _WebGLRenderer); - - function WebGL1Renderer() { - return _WebGLRenderer.apply(this, arguments) || this; - } - - return WebGL1Renderer; - }(WebGLRenderer); + class WebGL1Renderer extends WebGLRenderer {} WebGL1Renderer.prototype.isWebGL1Renderer = true; - var FogExp2 = /*#__PURE__*/function () { - function FogExp2(color, density) { + class FogExp2 { + constructor(color, density) { this.name = ''; this.color = new Color(color); this.density = density !== undefined ? density : 0.00025; } - var _proto = FogExp2.prototype; - - _proto.clone = function clone() { + clone() { return new FogExp2(this.color, this.density); - }; + } - _proto.toJSON = function toJSON() + toJSON() /* meta */ { return { @@ -19771,28 +18966,25 @@ color: this.color.getHex(), density: this.density }; - }; + } - return FogExp2; - }(); + } FogExp2.prototype.isFogExp2 = true; - var Fog = /*#__PURE__*/function () { - function Fog(color, near, far) { + class Fog { + constructor(color, near, far) { this.name = ''; this.color = new Color(color); this.near = near !== undefined ? near : 1; this.far = far !== undefined ? far : 1000; } - var _proto = Fog.prototype; - - _proto.clone = function clone() { + clone() { return new Fog(this.color, this.near, this.far); - }; + } - _proto.toJSON = function toJSON() + toJSON() /* meta */ { return { @@ -19801,42 +18993,32 @@ near: this.near, far: this.far }; - }; + } - return Fog; - }(); + } Fog.prototype.isFog = true; - 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 + 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 if (typeof __THREE_DEVTOOLS__ !== 'undefined') { __THREE_DEVTOOLS__.dispatchEvent(new CustomEvent('observe', { - detail: _assertThisInitialized(_this) + detail: this })); // eslint-disable-line no-undef } - - return _this; } - var _proto = Scene.prototype; - - _proto.copy = function copy(source, recursive) { - _Object3D.prototype.copy.call(this, source, recursive); - + copy(source, recursive) { + super.copy(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(); @@ -19844,19 +19026,17 @@ 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; @@ -19874,43 +19054,39 @@ } Object.defineProperty(InterleavedBuffer.prototype, 'needsUpdate', { - set: function set(value) { + set: function (value) { if (value === true) this.version++; } }); Object.assign(InterleavedBuffer.prototype, { isInterleavedBuffer: true, - onUploadCallback: function onUploadCallback() {}, - setUsage: function setUsage(value) { + onUploadCallback: function () {}, + setUsage: function (value) { this.usage = value; return this; }, - copy: function copy(source) { + copy: function (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 copyAt(index1, attribute, index2) { + copyAt: function (index1, attribute, index2) { index1 *= this.stride; index2 *= attribute.stride; - for (var i = 0, l = this.stride; i < l; i++) { + for (let i = 0, l = this.stride; i < l; i++) { this.array[index1 + i] = attribute.array[index2 + i]; } return this; }, - set: function set(value, offset) { - if (offset === void 0) { - offset = 0; - } - + set: function (value, offset = 0) { this.array.set(value, offset); return this; }, - clone: function clone(data) { + clone: function (data) { if (data.arrayBuffers === undefined) { data.arrayBuffers = {}; } @@ -19923,16 +19099,16 @@ data.arrayBuffers[this.array.buffer._uuid] = this.array.slice(0).buffer; } - var array = new this.array.constructor(data.arrayBuffers[this.array.buffer._uuid]); - var ib = new InterleavedBuffer(array, this.stride); + const array = new this.array.constructor(data.arrayBuffers[this.array.buffer._uuid]); + const ib = new InterleavedBuffer(array, this.stride); ib.setUsage(this.usage); return ib; }, - onUpload: function onUpload(callback) { + onUpload: function (callback) { this.onUploadCallback = callback; return this; }, - toJSON: function toJSON(data) { + toJSON: function (data) { if (data.arrayBuffers === undefined) { data.arrayBuffers = {}; } // generate UUID for array buffer if necessary @@ -19956,7 +19132,7 @@ } }); - var _vector$6 = new Vector3(); + const _vector$6 = new Vector3(); function InterleavedBufferAttribute(interleavedBuffer, itemSize, offset, normalized) { this.name = ''; @@ -19968,25 +19144,25 @@ Object.defineProperties(InterleavedBufferAttribute.prototype, { count: { - get: function get() { + get: function () { return this.data.count; } }, array: { - get: function get() { + get: function () { return this.data.array; } }, needsUpdate: { - set: function set(value) { + set: function (value) { this.data.needsUpdate = value; } } }); Object.assign(InterleavedBufferAttribute.prototype, { isInterleavedBufferAttribute: true, - applyMatrix4: function applyMatrix4(m) { - for (var i = 0, l = this.data.count; i < l; i++) { + applyMatrix4: function (m) { + for (let i = 0, l = this.data.count; i < l; i++) { _vector$6.x = this.getX(i); _vector$6.y = this.getY(i); _vector$6.z = this.getZ(i); @@ -19998,48 +19174,48 @@ return this; }, - setX: function setX(index, x) { + setX: function (index, x) { this.data.array[index * this.data.stride + this.offset] = x; return this; }, - setY: function setY(index, y) { + setY: function (index, y) { this.data.array[index * this.data.stride + this.offset + 1] = y; return this; }, - setZ: function setZ(index, z) { + setZ: function (index, z) { this.data.array[index * this.data.stride + this.offset + 2] = z; return this; }, - setW: function setW(index, w) { + setW: function (index, w) { this.data.array[index * this.data.stride + this.offset + 3] = w; return this; }, - getX: function getX(index) { + getX: function (index) { return this.data.array[index * this.data.stride + this.offset]; }, - getY: function getY(index) { + getY: function (index) { return this.data.array[index * this.data.stride + this.offset + 1]; }, - getZ: function getZ(index) { + getZ: function (index) { return this.data.array[index * this.data.stride + this.offset + 2]; }, - getW: function getW(index) { + getW: function (index) { return this.data.array[index * this.data.stride + this.offset + 3]; }, - setXY: function setXY(index, x, y) { + setXY: function (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 setXYZ(index, x, y, z) { + setXYZ: function (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 setXYZW(index, x, y, z, w) { + setXYZW: function (index, x, y, z, w) { index = index * this.data.stride + this.offset; this.data.array[index + 0] = x; this.data.array[index + 1] = y; @@ -20047,15 +19223,15 @@ this.data.array[index + 3] = w; return this; }, - clone: function clone(data) { + clone: function (data) { if (data === undefined) { console.log('THREE.InterleavedBufferAttribute.clone(): Cloning an interlaved buffer attribute will deinterleave buffer data.'); - var array = []; + const array = []; - for (var i = 0; i < this.count; i++) { - var index = i * this.data.stride + this.offset; + for (let i = 0; i < this.count; i++) { + const index = i * this.data.stride + this.offset; - for (var j = 0; j < this.itemSize; j++) { + for (let j = 0; j < this.itemSize; j++) { array.push(this.data.array[index + j]); } } @@ -20073,15 +19249,15 @@ return new InterleavedBufferAttribute(data.interleavedBuffers[this.data.uuid], this.itemSize, this.offset, this.normalized); } }, - toJSON: function toJSON(data) { + toJSON: function (data) { if (data === undefined) { console.log('THREE.InterleavedBufferAttribute.toJSON(): Serializing an interlaved buffer attribute will deinterleave buffer data.'); - var array = []; + const array = []; - for (var i = 0; i < this.count; i++) { - var index = i * this.data.stride + this.offset; + for (let i = 0; i < this.count; i++) { + const index = i * this.data.stride + this.offset; - for (var j = 0; j < this.itemSize; j++) { + for (let j = 0; j < this.itemSize; j++) { array.push(this.data.array[index + j]); } } // deinterleave data and save it as an ordinary buffer attribute for now @@ -20124,83 +19300,68 @@ * } */ - 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; + 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 _proto = SpriteMaterial.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.alphaMap = source.alphaMap; this.rotation = source.rotation; this.sizeAttenuation = source.sizeAttenuation; return this; - }; + } - return SpriteMaterial; - }(Material); + } SpriteMaterial.prototype.isSpriteMaterial = true; - var _geometry; - - var _intersectPoint = /*@__PURE__*/new Vector3(); - - var _worldScale = /*@__PURE__*/new Vector3(); + let _geometry; - var _mvPosition = /*@__PURE__*/new Vector3(); + const _intersectPoint = /*@__PURE__*/new Vector3(); - var _alignedPosition = /*@__PURE__*/new Vector2(); + const _worldScale = /*@__PURE__*/new Vector3(); - var _rotatedPosition = /*@__PURE__*/new Vector2(); + const _mvPosition = /*@__PURE__*/new Vector3(); - var _viewWorldMatrix = /*@__PURE__*/new Matrix4(); + const _alignedPosition = /*@__PURE__*/new Vector2(); - var _vA$1 = /*@__PURE__*/new Vector3(); + const _rotatedPosition = /*@__PURE__*/new Vector2(); - var _vB$1 = /*@__PURE__*/new Vector3(); + const _viewWorldMatrix = /*@__PURE__*/new Matrix4(); - var _vC$1 = /*@__PURE__*/new Vector3(); + const _vA$1 = /*@__PURE__*/new Vector3(); - var _uvA$1 = /*@__PURE__*/new Vector2(); + const _vB$1 = /*@__PURE__*/new Vector3(); - var _uvB$1 = /*@__PURE__*/new Vector2(); + const _vC$1 = /*@__PURE__*/new Vector3(); - var _uvC$1 = /*@__PURE__*/new Vector2(); + const _uvA$1 = /*@__PURE__*/new Vector2(); - var Sprite = /*#__PURE__*/function (_Object3D) { - _inheritsLoose(Sprite, _Object3D); + const _uvB$1 = /*@__PURE__*/new Vector2(); - function Sprite(material) { - var _this; + const _uvC$1 = /*@__PURE__*/new Vector2(); - _this = _Object3D.call(this) || this; - _this.type = 'Sprite'; + class Sprite extends Object3D { + constructor(material) { + super(); + this.type = 'Sprite'; if (_geometry === undefined) { _geometry = new BufferGeometry(); - 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); + const float32Array = new Float32Array([-0.5, -0.5, 0, 0, 0, 0.5, -0.5, 0, 1, 0, 0.5, 0.5, 0, 1, 1, -0.5, 0.5, 0, 0, 1]); + const interleavedBuffer = new InterleavedBuffer(float32Array, 5); _geometry.setIndex([0, 1, 2, 0, 2, 3]); @@ -20209,15 +19370,12 @@ _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); - return _this; + this.geometry = _geometry; + this.material = material !== undefined ? material : new SpriteMaterial(); + this.center = new Vector2(0.5, 0.5); } - var _proto = Sprite.prototype; - - _proto.raycast = function raycast(raycaster, intersects) { + raycast(raycaster, intersects) { if (raycaster.camera === null) { console.error('THREE.Sprite: "Raycaster.camera" needs to be set in order to raycast against sprites.'); } @@ -20234,15 +19392,15 @@ _worldScale.multiplyScalar(-_mvPosition.z); } - var rotation = this.material.rotation; - var sin, cos; + const rotation = this.material.rotation; + let sin, cos; if (rotation !== 0) { cos = Math.cos(rotation); sin = Math.sin(rotation); } - var center = this.center; + const 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); @@ -20254,7 +19412,7 @@ _uvC$1.set(1, 1); // check first triangle - var intersect = raycaster.ray.intersectTriangle(_vA$1, _vB$1, _vC$1, false, _intersectPoint); + let intersect = raycaster.ray.intersectTriangle(_vA$1, _vB$1, _vC$1, false, _intersectPoint); if (intersect === null) { // check second triangle @@ -20269,7 +19427,7 @@ } } - var distance = raycaster.ray.origin.distanceTo(_intersectPoint); + const distance = raycaster.ray.origin.distanceTo(_intersectPoint); if (distance < raycaster.near || distance > raycaster.far) return; intersects.push({ distance: distance, @@ -20278,18 +19436,16 @@ 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; @@ -20312,20 +19468,16 @@ vertexPosition.applyMatrix4(_viewWorldMatrix); } - var _v1$4 = /*@__PURE__*/new Vector3(); - - var _v2$2 = /*@__PURE__*/new Vector3(); + const _v1$4 = /*@__PURE__*/new Vector3(); - var LOD = /*#__PURE__*/function (_Object3D) { - _inheritsLoose(LOD, _Object3D); + const _v2$2 = /*@__PURE__*/new Vector3(); - function LOD() { - var _this; - - _this = _Object3D.call(this) || this; - _this._currentLevel = 0; - _this.type = 'LOD'; - Object.defineProperties(_assertThisInitialized(_this), { + class LOD extends Object3D { + constructor() { + super(); + this._currentLevel = 0; + this.type = 'LOD'; + Object.defineProperties(this, { levels: { enumerable: true, value: [] @@ -20334,34 +19486,26 @@ value: true } }); - _this.autoUpdate = true; - return _this; + this.autoUpdate = true; } - var _proto = LOD.prototype; - - _proto.copy = function copy(source) { - _Object3D.prototype.copy.call(this, source, false); - - var levels = source.levels; + copy(source) { + super.copy(source, false); + const levels = source.levels; - for (var i = 0, l = levels.length; i < l; i++) { - var level = levels[i]; + for (let i = 0, l = levels.length; i < l; i++) { + const level = levels[i]; this.addLevel(level.object.clone(), level.distance); } this.autoUpdate = source.autoUpdate; return this; - }; - - _proto.addLevel = function addLevel(object, distance) { - if (distance === void 0) { - distance = 0; - } + } + addLevel(object, distance = 0) { distance = Math.abs(distance); - var levels = this.levels; - var l; + const levels = this.levels; + let l; for (l = 0; l < levels.length; l++) { if (distance < levels[l].distance) { @@ -20375,17 +19519,17 @@ }); this.add(object); return this; - }; + } - _proto.getCurrentLevel = function getCurrentLevel() { + getCurrentLevel() { return this._currentLevel; - }; + } - _proto.getObjectForDistance = function getObjectForDistance(distance) { - var levels = this.levels; + getObjectForDistance(distance) { + const levels = this.levels; if (levels.length > 0) { - var i, l; + let i, l; for (i = 1, l = levels.length; i < l; i++) { if (distance < levels[i].distance) { @@ -20397,30 +19541,30 @@ } return null; - }; + } - _proto.raycast = function raycast(raycaster, intersects) { - var levels = this.levels; + raycast(raycaster, intersects) { + const levels = this.levels; if (levels.length > 0) { _v1$4.setFromMatrixPosition(this.matrixWorld); - var distance = raycaster.ray.origin.distanceTo(_v1$4); + const distance = raycaster.ray.origin.distanceTo(_v1$4); this.getObjectForDistance(distance).raycast(raycaster, intersects); } - }; + } - _proto.update = function update(camera) { - var levels = this.levels; + update(camera) { + const levels = this.levels; if (levels.length > 1) { _v1$4.setFromMatrixPosition(camera.matrixWorld); _v2$2.setFromMatrixPosition(this.matrixWorld); - var distance = _v1$4.distanceTo(_v2$2) / camera.zoom; + const distance = _v1$4.distanceTo(_v2$2) / camera.zoom; levels[0].object.visible = true; - var i, l; + let i, l; for (i = 1, l = levels.length; i < l; i++) { if (distance >= levels[i].distance) { @@ -20437,17 +19581,16 @@ 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 = []; - var levels = this.levels; + const levels = this.levels; - for (var i = 0, l = levels.length; i < l; i++) { - var level = levels[i]; + for (let i = 0, l = levels.length; i < l; i++) { + const level = levels[i]; data.object.levels.push({ object: level.object.uuid, distance: level.distance @@ -20455,20 +19598,19 @@ } return data; - }; + } - return LOD; - }(Object3D); + } - var _basePosition = new Vector3(); + const _basePosition = new Vector3(); - var _skinIndex = new Vector4(); + const _skinIndex = new Vector4(); - var _skinWeight = new Vector4(); + const _skinWeight = new Vector4(); - var _vector$7 = new Vector3(); + const _vector$7 = new Vector3(); - var _matrix$1 = new Matrix4(); + const _matrix$1 = new Matrix4(); function SkinnedMesh(geometry, material) { Mesh.call(this, geometry, material); @@ -20481,7 +19623,7 @@ SkinnedMesh.prototype = Object.assign(Object.create(Mesh.prototype), { constructor: SkinnedMesh, isSkinnedMesh: true, - copy: function copy(source) { + copy: function (source) { Mesh.prototype.copy.call(this, source); this.bindMode = source.bindMode; this.bindMatrix.copy(source.bindMatrix); @@ -20489,7 +19631,7 @@ this.skeleton = source.skeleton; return this; }, - bind: function bind(skeleton, bindMatrix) { + bind: function (skeleton, bindMatrix) { this.skeleton = skeleton; if (bindMatrix === undefined) { @@ -20501,19 +19643,19 @@ this.bindMatrix.copy(bindMatrix); this.bindMatrixInverse.copy(bindMatrix).invert(); }, - pose: function pose() { + pose: function () { this.skeleton.pose(); }, - normalizeSkinWeights: function normalizeSkinWeights() { - var vector = new Vector4(); - var skinWeight = this.geometry.attributes.skinWeight; + normalizeSkinWeights: function () { + const vector = new Vector4(); + const skinWeight = this.geometry.attributes.skinWeight; - for (var i = 0, l = skinWeight.count; i < l; i++) { + for (let i = 0, l = skinWeight.count; i < l; i++) { vector.x = skinWeight.getX(i); vector.y = skinWeight.getY(i); vector.z = skinWeight.getZ(i); vector.w = skinWeight.getW(i); - var scale = 1.0 / vector.manhattanLength(); + const scale = 1.0 / vector.manhattanLength(); if (scale !== Infinity) { vector.multiplyScalar(scale); @@ -20524,7 +19666,7 @@ skinWeight.setXYZW(i, vector.x, vector.y, vector.z, vector.w); } }, - updateMatrixWorld: function updateMatrixWorld(force) { + updateMatrixWorld: function (force) { Mesh.prototype.updateMatrixWorld.call(this, force); if (this.bindMode === 'attached') { @@ -20535,9 +19677,9 @@ console.warn('THREE.SkinnedMesh: Unrecognized bindMode: ' + this.bindMode); } }, - boneTransform: function boneTransform(index, target) { - var skeleton = this.skeleton; - var geometry = this.geometry; + boneTransform: function (index, target) { + const skeleton = this.skeleton; + const geometry = this.geometry; _skinIndex.fromBufferAttribute(geometry.attributes.skinIndex, index); @@ -20547,11 +19689,11 @@ target.set(0, 0, 0); - for (var i = 0; i < 4; i++) { - var weight = _skinWeight.getComponent(i); + for (let i = 0; i < 4; i++) { + const weight = _skinWeight.getComponent(i); if (weight !== 0) { - var boneIndex = _skinIndex.getComponent(i); + const boneIndex = _skinIndex.getComponent(i); _matrix$1.multiplyMatrices(skeleton.bones[boneIndex].matrixWorld, skeleton.boneInverses[boneIndex]); @@ -20573,20 +19715,12 @@ isBone: true }); - var _offsetMatrix = /*@__PURE__*/new Matrix4(); - - var _identityMatrix = /*@__PURE__*/new Matrix4(); - - var Skeleton = /*#__PURE__*/function () { - function Skeleton(bones, boneInverses) { - if (bones === void 0) { - bones = []; - } + const _offsetMatrix = /*@__PURE__*/new Matrix4(); - if (boneInverses === void 0) { - boneInverses = []; - } + const _identityMatrix = /*@__PURE__*/new Matrix4(); + class Skeleton { + constructor(bones = [], boneInverses = []) { this.uuid = MathUtils.generateUUID(); this.bones = bones.slice(0); this.boneInverses = boneInverses; @@ -20597,11 +19731,9 @@ this.init(); } - var _proto = Skeleton.prototype; - - _proto.init = function init() { - var bones = this.bones; - var boneInverses = this.boneInverses; + init() { + const bones = this.bones; + const boneInverses = this.boneInverses; this.boneMatrices = new Float32Array(bones.length * 16); // calculate inverse bone matrices if necessary if (boneInverses.length === 0) { @@ -20612,18 +19744,18 @@ console.warn('THREE.Skeleton: Number of inverse bone matrices does not match amount of bones.'); this.boneInverses = []; - for (var i = 0, il = this.bones.length; i < il; i++) { + for (let i = 0, il = this.bones.length; i < il; i++) { this.boneInverses.push(new Matrix4()); } } } - }; + } - _proto.calculateInverses = function calculateInverses() { + calculateInverses() { this.boneInverses.length = 0; - for (var i = 0, il = this.bones.length; i < il; i++) { - var inverse = new Matrix4(); + for (let i = 0, il = this.bones.length; i < il; i++) { + const inverse = new Matrix4(); if (this.bones[i]) { inverse.copy(this.bones[i].matrixWorld).invert(); @@ -20631,12 +19763,12 @@ this.boneInverses.push(inverse); } - }; + } - _proto.pose = function pose() { + pose() { // recover the bind-time world matrices - for (var i = 0, il = this.bones.length; i < il; i++) { - var bone = this.bones[i]; + for (let i = 0, il = this.bones.length; i < il; i++) { + const bone = this.bones[i]; if (bone) { bone.matrixWorld.copy(this.boneInverses[i]).invert(); @@ -20644,32 +19776,31 @@ } // compute the local matrices, positions, rotations and scales - 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(); + for (let i = 0, il = this.bones.length; i < il; i++) { + const bone = this.bones[i]; - _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); } } - }; + } - _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 + update() { + const bones = this.bones; + const boneInverses = this.boneInverses; + const boneMatrices = this.boneMatrices; + const boneTexture = this.boneTexture; // flatten bone matrices to array - for (var i = 0, il = bones.length; i < il; i++) { + for (let i = 0, il = bones.length; i < il; i++) { // compute the offset between the current and the original transform - var matrix = bones[i] ? bones[i].matrixWorld : _identityMatrix; + const matrix = bones[i] ? bones[i].matrixWorld : _identityMatrix; _offsetMatrix.multiplyMatrices(matrix, boneInverses[i]); @@ -20679,15 +19810,15 @@ if (boneTexture !== null) { boneTexture.needsUpdate = true; } - }; + } - _proto.clone = function clone() { + clone() { return new Skeleton(this.bones, this.boneInverses); - }; + } - _proto.getBoneByName = function getBoneByName(name) { - for (var i = 0, il = this.bones.length; i < il; i++) { - var bone = this.bones[i]; + getBoneByName(name) { + for (let i = 0, il = this.bones.length; i < il; i++) { + const bone = this.bones[i]; if (bone.name === name) { return bone; @@ -20695,21 +19826,21 @@ } return undefined; - }; + } - _proto.dispose = function dispose() { + dispose() { if (this.boneTexture !== null) { this.boneTexture.dispose(); this.boneTexture = null; } - }; + } - _proto.fromJSON = function fromJSON(json, bones) { + fromJSON(json, bones) { this.uuid = json.uuid; - for (var i = 0, l = json.bones.length; i < l; i++) { - var uuid = json.bones[i]; - var bone = bones[uuid]; + for (let i = 0, l = json.bones.length; i < l; i++) { + const uuid = json.bones[i]; + let bone = bones[uuid]; if (bone === undefined) { console.warn('THREE.Skeleton: No bone found with UUID:', uuid); @@ -20722,10 +19853,10 @@ this.init(); return this; - }; + } - _proto.toJSON = function toJSON() { - var data = { + toJSON() { + const data = { metadata: { version: 4.5, type: 'Skeleton', @@ -20735,29 +19866,28 @@ boneInverses: [] }; data.uuid = this.uuid; - var bones = this.bones; - var boneInverses = this.boneInverses; + const bones = this.bones; + const boneInverses = this.boneInverses; - for (var i = 0, l = bones.length; i < l; i++) { - var bone = bones[i]; + for (let i = 0, l = bones.length; i < l; i++) { + const bone = bones[i]; data.bones.push(bone.uuid); - var boneInverse = boneInverses[i]; + const boneInverse = boneInverses[i]; data.boneInverses.push(boneInverse.toArray()); } return data; - }; + } - return Skeleton; - }(); + } - var _instanceLocalMatrix = new Matrix4(); + const _instanceLocalMatrix = new Matrix4(); - var _instanceWorldMatrix = new Matrix4(); + const _instanceWorldMatrix = new Matrix4(); - var _instanceIntersects = []; + const _instanceIntersects = []; - var _mesh = new Mesh(); + const _mesh = new Mesh(); function InstancedMesh(geometry, material, count) { Mesh.call(this, geometry, material); @@ -20770,27 +19900,27 @@ InstancedMesh.prototype = Object.assign(Object.create(Mesh.prototype), { constructor: InstancedMesh, isInstancedMesh: true, - copy: function copy(source) { + copy: function (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 getColorAt(index, color) { + getColorAt: function (index, color) { color.fromArray(this.instanceColor.array, index * 3); }, - getMatrixAt: function getMatrixAt(index, matrix) { + getMatrixAt: function (index, matrix) { matrix.fromArray(this.instanceMatrix.array, index * 16); }, - raycast: function raycast(raycaster, intersects) { - var matrixWorld = this.matrixWorld; - var raycastTimes = this.count; + raycast: function (raycaster, intersects) { + const matrixWorld = this.matrixWorld; + const raycastTimes = this.count; _mesh.geometry = this.geometry; _mesh.material = this.material; if (_mesh.material === undefined) return; - for (var instanceId = 0; instanceId < raycastTimes; instanceId++) { + for (let instanceId = 0; instanceId < raycastTimes; instanceId++) { // calculate the world matrix for each instance this.getMatrixAt(instanceId, _instanceLocalMatrix); @@ -20802,8 +19932,8 @@ _mesh.raycast(raycaster, _instanceIntersects); // process the result of raycast - for (var i = 0, l = _instanceIntersects.length; i < l; i++) { - var intersect = _instanceIntersects[i]; + for (let i = 0, l = _instanceIntersects.length; i < l; i++) { + const intersect = _instanceIntersects[i]; intersect.instanceId = instanceId; intersect.object = this; intersects.push(intersect); @@ -20812,18 +19942,18 @@ _instanceIntersects.length = 0; } }, - setColorAt: function setColorAt(index, color) { + setColorAt: function (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 setMatrixAt(index, matrix) { + setMatrixAt: function (index, matrix) { matrix.toArray(this.instanceMatrix.array, index * 16); }, - updateMorphTargets: function updateMorphTargets() {}, - dispose: function dispose() { + updateMorphTargets: function () {}, + dispose: function () { this.dispatchEvent({ type: 'dispose' }); @@ -20841,62 +19971,43 @@ * } */ - 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; + 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 _proto = LineBasicMaterial.prototype; - - _proto.copy = function copy(source) { - _Material.prototype.copy.call(this, source); - + copy(source) { + super.copy(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; - var _start = new Vector3(); - - var _end = new Vector3(); - - var _inverseMatrix$1 = new Matrix4(); + const _start = new Vector3(); - var _ray$1 = new Ray(); + const _end = new Vector3(); - var _sphere$2 = new Sphere(); + const _inverseMatrix$1 = new Matrix4(); - function Line(geometry, material) { - if (geometry === void 0) { - geometry = new BufferGeometry(); - } + const _ray$1 = new Ray(); - if (material === void 0) { - material = new LineBasicMaterial(); - } + const _sphere$2 = new Sphere(); + function Line(geometry = new BufferGeometry(), material = new LineBasicMaterial()) { Object3D.call(this); this.type = 'Line'; this.geometry = geometry; @@ -20907,22 +20018,22 @@ Line.prototype = Object.assign(Object.create(Object3D.prototype), { constructor: Line, isLine: true, - copy: function copy(source) { + copy: function (source) { Object3D.prototype.copy.call(this, source); this.material = source.material; this.geometry = source.geometry; return this; }, - computeLineDistances: function computeLineDistances() { - var geometry = this.geometry; + computeLineDistances: function () { + const geometry = this.geometry; if (geometry.isBufferGeometry) { // we assume non-indexed geometry if (geometry.index === null) { - var positionAttribute = geometry.attributes.position; - var lineDistances = [0]; + const positionAttribute = geometry.attributes.position; + const lineDistances = [0]; - for (var i = 1, l = positionAttribute.count; i < l; i++) { + for (let i = 1, l = positionAttribute.count; i < l; i++) { _start.fromBufferAttribute(positionAttribute, i - 1); _end.fromBufferAttribute(positionAttribute, i); @@ -20941,10 +20052,10 @@ return this; }, - raycast: function raycast(raycaster, intersects) { - var geometry = this.geometry; - var matrixWorld = this.matrixWorld; - var threshold = raycaster.params.Line.threshold; // Checking boundingSphere distance to ray + raycast: function (raycaster, intersects) { + const geometry = this.geometry; + const matrixWorld = this.matrixWorld; + const threshold = raycaster.params.Line.threshold; // Checking boundingSphere distance to ray if (geometry.boundingSphere === null) geometry.computeBoundingSphere(); @@ -20959,34 +20070,34 @@ _ray$1.copy(raycaster.ray).applyMatrix4(_inverseMatrix$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; + 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; if (geometry.isBufferGeometry) { - var index = geometry.index; - var attributes = geometry.attributes; - var positionAttribute = attributes.position; + const index = geometry.index; + const attributes = geometry.attributes; + const positionAttribute = attributes.position; if (index !== null) { - var indices = index.array; + const indices = index.array; - for (var i = 0, l = indices.length - 1; i < l; i += step) { - var a = indices[i]; - var b = indices[i + 1]; + for (let i = 0, l = indices.length - 1; i < l; i += step) { + const a = indices[i]; + const b = indices[i + 1]; vStart.fromBufferAttribute(positionAttribute, a); vEnd.fromBufferAttribute(positionAttribute, b); - var distSq = _ray$1.distanceSqToSegment(vStart, vEnd, interRay, interSegment); + const distSq = _ray$1.distanceSqToSegment(vStart, vEnd, interRay, interSegment); if (distSq > localThresholdSq) continue; interRay.applyMatrix4(this.matrixWorld); //Move back to world space for distance calculation - var distance = raycaster.ray.origin.distanceTo(interRay); + const distance = raycaster.ray.origin.distanceTo(interRay); if (distance < raycaster.near || distance > raycaster.far) continue; intersects.push({ distance: distance, @@ -21000,24 +20111,23 @@ }); } } else { - for (var _i = 0, _l = positionAttribute.count - 1; _i < _l; _i += step) { - vStart.fromBufferAttribute(positionAttribute, _i); - vEnd.fromBufferAttribute(positionAttribute, _i + 1); + for (let i = 0, l = positionAttribute.count - 1; i < l; i += step) { + vStart.fromBufferAttribute(positionAttribute, i); + vEnd.fromBufferAttribute(positionAttribute, i + 1); - var _distSq = _ray$1.distanceSqToSegment(vStart, vEnd, interRay, interSegment); + const distSq = _ray$1.distanceSqToSegment(vStart, vEnd, interRay, interSegment); - if (_distSq > localThresholdSq) continue; + if (distSq > localThresholdSq) continue; interRay.applyMatrix4(this.matrixWorld); //Move back to world space for distance calculation - var _distance = raycaster.ray.origin.distanceTo(interRay); - - if (_distance < raycaster.near || _distance > raycaster.far) continue; + const 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 @@ -21028,29 +20138,29 @@ console.error('THREE.Line.raycast() no longer supports THREE.Geometry. Use THREE.BufferGeometry instead.'); } }, - updateMorphTargets: function updateMorphTargets() { - var geometry = this.geometry; + updateMorphTargets: function () { + const geometry = this.geometry; if (geometry.isBufferGeometry) { - var morphAttributes = geometry.morphAttributes; - var keys = Object.keys(morphAttributes); + const morphAttributes = geometry.morphAttributes; + const keys = Object.keys(morphAttributes); if (keys.length > 0) { - var morphAttribute = morphAttributes[keys[0]]; + const morphAttribute = morphAttributes[keys[0]]; if (morphAttribute !== undefined) { this.morphTargetInfluences = []; this.morphTargetDictionary = {}; - for (var m = 0, ml = morphAttribute.length; m < ml; m++) { - var name = morphAttribute[m].name || String(m); + for (let m = 0, ml = morphAttribute.length; m < ml; m++) { + const name = morphAttribute[m].name || String(m); this.morphTargetInfluences.push(0); this.morphTargetDictionary[name] = m; } } } } else { - var morphTargets = geometry.morphTargets; + const morphTargets = geometry.morphTargets; if (morphTargets !== undefined && morphTargets.length > 0) { console.error('THREE.Line.updateMorphTargets() does not support THREE.Geometry. Use THREE.BufferGeometry instead.'); @@ -21059,9 +20169,9 @@ } }); - var _start$1 = new Vector3(); + const _start$1 = new Vector3(); - var _end$1 = new Vector3(); + const _end$1 = new Vector3(); function LineSegments(geometry, material) { Line.call(this, geometry, material); @@ -21071,16 +20181,16 @@ LineSegments.prototype = Object.assign(Object.create(Line.prototype), { constructor: LineSegments, isLineSegments: true, - computeLineDistances: function computeLineDistances() { - var geometry = this.geometry; + computeLineDistances: function () { + const geometry = this.geometry; if (geometry.isBufferGeometry) { // we assume non-indexed geometry if (geometry.index === null) { - var positionAttribute = geometry.attributes.position; - var lineDistances = []; + const positionAttribute = geometry.attributes.position; + const lineDistances = []; - for (var i = 0, l = positionAttribute.count; i < l; i += 2) { + for (let i = 0, l = positionAttribute.count; i < l; i += 2) { _start$1.fromBufferAttribute(positionAttribute, i); _end$1.fromBufferAttribute(positionAttribute, i + 1); @@ -21101,19 +20211,13 @@ } }); - 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; + class LineLoop extends Line { + constructor(geometry, material) { + super(geometry, material); + this.type = 'LineLoop'; } - return LineLoop; - }(Line); + } LineLoop.prototype.isLineLoop = true; @@ -21131,31 +20235,21 @@ * } */ - 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; + 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 _proto = PointsMaterial.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.alphaMap = source.alphaMap; @@ -21163,30 +20257,21 @@ this.sizeAttenuation = source.sizeAttenuation; this.morphTargets = source.morphTargets; return this; - }; + } - return PointsMaterial; - }(Material); + } PointsMaterial.prototype.isPointsMaterial = true; - var _inverseMatrix$2 = new Matrix4(); - - var _ray$2 = new Ray(); - - var _sphere$3 = new Sphere(); + const _inverseMatrix$2 = new Matrix4(); - var _position$1 = new Vector3(); + const _ray$2 = new Ray(); - function Points(geometry, material) { - if (geometry === void 0) { - geometry = new BufferGeometry(); - } + const _sphere$3 = new Sphere(); - if (material === void 0) { - material = new PointsMaterial(); - } + const _position$1 = new Vector3(); + function Points(geometry = new BufferGeometry(), material = new PointsMaterial()) { Object3D.call(this); this.type = 'Points'; this.geometry = geometry; @@ -21197,16 +20282,16 @@ Points.prototype = Object.assign(Object.create(Object3D.prototype), { constructor: Points, isPoints: true, - copy: function copy(source) { + copy: function (source) { Object3D.prototype.copy.call(this, source); this.material = source.material; this.geometry = source.geometry; return this; }, - raycast: function raycast(raycaster, intersects) { - var geometry = this.geometry; - var matrixWorld = this.matrixWorld; - var threshold = raycaster.params.Points.threshold; // Checking boundingSphere distance to ray + raycast: function (raycaster, intersects) { + const geometry = this.geometry; + const matrixWorld = this.matrixWorld; + const threshold = raycaster.params.Points.threshold; // Checking boundingSphere distance to ray if (geometry.boundingSphere === null) geometry.computeBoundingSphere(); @@ -21221,58 +20306,58 @@ _ray$2.copy(raycaster.ray).applyMatrix4(_inverseMatrix$2); - var localThreshold = threshold / ((this.scale.x + this.scale.y + this.scale.z) / 3); - var localThresholdSq = localThreshold * localThreshold; + const localThreshold = threshold / ((this.scale.x + this.scale.y + this.scale.z) / 3); + const localThresholdSq = localThreshold * localThreshold; if (geometry.isBufferGeometry) { - var index = geometry.index; - var attributes = geometry.attributes; - var positionAttribute = attributes.position; + const index = geometry.index; + const attributes = geometry.attributes; + const positionAttribute = attributes.position; if (index !== null) { - var indices = index.array; + const indices = index.array; - for (var i = 0, il = indices.length; i < il; i++) { - var a = indices[i]; + for (let i = 0, il = indices.length; i < il; i++) { + const a = indices[i]; _position$1.fromBufferAttribute(positionAttribute, a); testPoint(_position$1, a, localThresholdSq, matrixWorld, raycaster, intersects, this); } } else { - for (var _i = 0, l = positionAttribute.count; _i < l; _i++) { - _position$1.fromBufferAttribute(positionAttribute, _i); + for (let i = 0, l = positionAttribute.count; i < l; i++) { + _position$1.fromBufferAttribute(positionAttribute, i); - testPoint(_position$1, _i, localThresholdSq, matrixWorld, raycaster, intersects, this); + 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 updateMorphTargets() { - var geometry = this.geometry; + updateMorphTargets: function () { + const geometry = this.geometry; if (geometry.isBufferGeometry) { - var morphAttributes = geometry.morphAttributes; - var keys = Object.keys(morphAttributes); + const morphAttributes = geometry.morphAttributes; + const keys = Object.keys(morphAttributes); if (keys.length > 0) { - var morphAttribute = morphAttributes[keys[0]]; + const morphAttribute = morphAttributes[keys[0]]; if (morphAttribute !== undefined) { this.morphTargetInfluences = []; this.morphTargetDictionary = {}; - for (var m = 0, ml = morphAttribute.length; m < ml; m++) { - var name = morphAttribute[m].name || String(m); + for (let m = 0, ml = morphAttribute.length; m < ml; m++) { + const name = morphAttribute[m].name || String(m); this.morphTargetInfluences.push(0); this.morphTargetDictionary[name] = m; } } } } else { - var morphTargets = geometry.morphTargets; + const morphTargets = geometry.morphTargets; if (morphTargets !== undefined && morphTargets.length > 0) { console.error('THREE.Points.updateMorphTargets() does not support THREE.Geometry. Use THREE.BufferGeometry instead.'); @@ -21282,15 +20367,15 @@ }); function testPoint(point, index, localThresholdSq, matrixWorld, raycaster, intersects, object) { - var rayPointDistanceSq = _ray$2.distanceSqToPoint(point); + const rayPointDistanceSq = _ray$2.distanceSqToPoint(point); if (rayPointDistanceSq < localThresholdSq) { - var intersectPoint = new Vector3(); + const intersectPoint = new Vector3(); _ray$2.closestPointToPoint(point, intersectPoint); intersectPoint.applyMatrix4(matrixWorld); - var distance = raycaster.ray.origin.distanceTo(intersectPoint); + const distance = raycaster.ray.origin.distanceTo(intersectPoint); if (distance < raycaster.near || distance > raycaster.far) return; intersects.push({ distance: distance, @@ -21303,19 +20388,14 @@ } } - 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); + 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; function updateVideo() { scope.needsUpdate = true; @@ -21325,78 +20405,57 @@ if ('requestVideoFrameCallback' in video) { video.requestVideoFrameCallback(updateVideo); } - - return _this; } - var _proto = VideoTexture.prototype; - - _proto.clone = function clone() { + clone() { return new this.constructor(this.image).copy(this); - }; + } - _proto.update = function update() { - var video = this.image; - var hasVideoFrameCallback = ('requestVideoFrameCallback' in video); + update() { + const video = this.image; + const hasVideoFrameCallback = ('requestVideoFrameCallback' in video); if (hasVideoFrameCallback === false && video.readyState >= video.HAVE_CURRENT_DATA) { this.needsUpdate = true; } - }; + } - return VideoTexture; - }(Texture); + } VideoTexture.prototype.isVideoTexture = true; - 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 = { + 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, 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; - return _this; + this.generateMipmaps = false; } - return CompressedTexture; - }(Texture); + } CompressedTexture.prototype.isCompressedTexture = 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; + 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; } - return CanvasTexture; - }(Texture); + } CanvasTexture.prototype.isCanvasTexture = true; - var DepthTexture = /*#__PURE__*/function (_Texture) { - _inheritsLoose(DepthTexture, _Texture); - - function DepthTexture(width, height, type, mapping, wrapS, wrapT, magFilter, minFilter, anisotropy, format) { - var _this; - + class DepthTexture extends Texture { + constructor(width, height, type, mapping, wrapS, wrapT, magFilter, minFilter, anisotropy, format) { format = format !== undefined ? format : DepthFormat; if (format !== DepthFormat && format !== DepthStencilFormat) { @@ -21405,48 +20464,26 @@ if (type === undefined && format === DepthFormat) type = UnsignedShortType; if (type === undefined && format === DepthStencilFormat) type = UnsignedInt248Type; - _this = _Texture.call(this, null, mapping, wrapS, wrapT, magFilter, minFilter, format, type, anisotropy) || this; - _this.image = { + super(null, mapping, wrapS, wrapT, magFilter, minFilter, format, type, anisotropy); + this.image = { width: width, height: height }; - _this.magFilter = magFilter !== undefined ? magFilter : NearestFilter; - _this.minFilter = minFilter !== undefined ? minFilter : NearestFilter; - _this.flipY = false; - _this.generateMipmaps = false; - return _this; + this.magFilter = magFilter !== undefined ? magFilter : NearestFilter; + this.minFilter = minFilter !== undefined ? minFilter : NearestFilter; + this.flipY = false; + this.generateMipmaps = false; } - return DepthTexture; - }(Texture); + } DepthTexture.prototype.isDepthTexture = true; - 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 = { + class CircleGeometry extends BufferGeometry { + constructor(radius = 1, segments = 8, thetaStart = 0, thetaLength = Math.PI * 2) { + super(); + this.type = 'CircleGeometry'; + this.parameters = { radius: radius, segments: segments, thetaStart: thetaStart, @@ -21454,20 +20491,20 @@ }; segments = Math.max(3, segments); // buffers - var indices = []; - var vertices = []; - var normals = []; - var uvs = []; // helper variables + const indices = []; + const vertices = []; + const normals = []; + const uvs = []; // helper variables - var vertex = new Vector3(); - var uv = new Vector2(); // center point + const vertex = new Vector3(); + const uv = new Vector2(); // center point vertices.push(0, 0, 0); normals.push(0, 0, 1); uvs.push(0.5, 0.5); - for (var s = 0, i = 3; s <= segments; s++, i += 3) { - var segment = thetaStart + s / segments * thetaLength; // vertex + for (let s = 0, i = 3; s <= segments; s++, i += 3) { + const segment = thetaStart + s / segments * thetaLength; // vertex vertex.x = radius * Math.cos(segment); vertex.y = radius * Math.sin(segment); @@ -21481,66 +20518,24 @@ } // indices - for (var _i = 1; _i <= segments; _i++) { - indices.push(_i, _i + 1, 0); + for (let 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)); - - return _this; + 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 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; - } - - 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 = { + 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 = { radiusTop: radiusTop, radiusBottom: radiusBottom, height: height, @@ -21550,21 +20545,19 @@ thetaStart: thetaStart, thetaLength: thetaLength }; - - var scope = _assertThisInitialized(_this); - + const scope = this; radialSegments = Math.floor(radialSegments); heightSegments = Math.floor(heightSegments); // buffers - var indices = []; - var vertices = []; - var normals = []; - var uvs = []; // helper variables + const indices = []; + const vertices = []; + const normals = []; + const uvs = []; // helper variables - var index = 0; - var indexArray = []; - var halfHeight = height / 2; - var groupStart = 0; // generate geometry + let index = 0; + const indexArray = []; + const halfHeight = height / 2; + let groupStart = 0; // generate geometry generateTorso(); @@ -21574,32 +20567,29 @@ } // 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() { - var normal = new Vector3(); - var vertex = new Vector3(); - var groupCount = 0; // this will be used to calculate the normal + const normal = new Vector3(); + const vertex = new Vector3(); + let groupCount = 0; // this will be used to calculate the normal - var slope = (radiusBottom - radiusTop) / height; // generate vertices, normals and uvs + const slope = (radiusBottom - radiusTop) / height; // generate vertices, normals and uvs - for (var y = 0; y <= heightSegments; y++) { - var indexRow = []; - var v = y / heightSegments; // calculate the radius of the current row + for (let y = 0; y <= heightSegments; y++) { + const indexRow = []; + const v = y / heightSegments; // calculate the radius of the current row - var radius = v * (radiusBottom - radiusTop) + radiusTop; + const radius = v * (radiusBottom - radiusTop) + radiusTop; - 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 + 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 vertex.x = radius * sinTheta; vertex.y = -v * height + halfHeight; @@ -21619,13 +20609,13 @@ } // generate indices - for (var _x = 0; _x < radialSegments; _x++) { - for (var _y = 0; _y < heightSegments; _y++) { + for (let x = 0; x < radialSegments; x++) { + for (let y = 0; y < heightSegments; y++) { // we use the index array to access the correct indices - 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 + 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 indices.push(a, b, d); indices.push(b, c, d); // update group counter @@ -21642,16 +20632,16 @@ function generateCap(top) { // save the index of the first center vertex - 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. + 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. // because the geometry needs one set of uvs per face, // we must generate a center vertex per face/segment - for (var x = 1; x <= radialSegments; x++) { + for (let x = 1; x <= radialSegments; x++) { // vertex vertices.push(0, halfHeight * sign, 0); // normal @@ -21663,13 +20653,13 @@ } // save the index of the last center vertex - var centerIndexEnd = index; // now we generate the surrounding vertices, normals and uvs + const centerIndexEnd = index; // now we generate the surrounding vertices, normals and uvs - 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 + 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 vertex.x = radius * sinTheta; vertex.y = halfHeight * sign; @@ -21686,9 +20676,9 @@ } // generate indices - for (var _x3 = 0; _x3 < radialSegments; _x3++) { - var c = centerIndexStart + _x3; - var i = centerIndexEnd + _x3; + for (let x = 0; x < radialSegments; x++) { + const c = centerIndexStart + x; + const i = centerIndexEnd + x; if (top === true) { // face top @@ -21706,50 +20696,15 @@ 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; - } + } - _this = _CylinderGeometry.call(this, 0, radius, height, radialSegments, heightSegments, openEnded, thetaStart, thetaLength) || this; - _this.type = 'ConeGeometry'; - _this.parameters = { + 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 = { radius: radius, height: height, radialSegments: radialSegments, @@ -21758,37 +20713,23 @@ 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; - } - - if (detail === void 0) { - detail = 0; - } + } - _this = _BufferGeometry.call(this) || this; - _this.type = 'PolyhedronGeometry'; - _this.parameters = { + class PolyhedronGeometry extends BufferGeometry { + constructor(vertices, indices, radius = 1, detail = 0) { + super(); + this.type = 'PolyhedronGeometry'; + this.parameters = { vertices: vertices, indices: indices, radius: radius, detail: detail }; // default buffer data - var vertexBuffer = []; - var uvBuffer = []; // the subdivision creates the vertex buffer data + const vertexBuffer = []; + const uvBuffer = []; // the subdivision creates the vertex buffer data subdivide(detail); // all vertices should lie on a conceptual sphere with a given radius @@ -21796,27 +20737,23 @@ 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) { - 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 + 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 - for (var i = 0; i < indices.length; i += 3) { + for (let i = 0; i < indices.length; i += 3) { // get the vertices of the face getVertexByIndex(indices[i + 0], a); getVertexByIndex(indices[i + 1], b); @@ -21827,17 +20764,17 @@ } function subdivideFace(a, b, c, detail) { - var cols = detail + 1; // we use this multidimensional array as a data structure for creating the subdivision + const cols = detail + 1; // we use this multidimensional array as a data structure for creating the subdivision - var v = []; // construct all of the vertices for this subdivision + const v = []; // construct all of the vertices for this subdivision - for (var i = 0; i <= cols; i++) { + for (let i = 0; i <= cols; i++) { v[i] = []; - var aj = a.clone().lerp(c, i / cols); - var bj = b.clone().lerp(c, i / cols); - var rows = cols - i; + const aj = a.clone().lerp(c, i / cols); + const bj = b.clone().lerp(c, i / cols); + const rows = cols - i; - for (var j = 0; j <= rows; j++) { + for (let j = 0; j <= rows; j++) { if (j === 0 && i === cols) { v[i][j] = aj; } else { @@ -21847,27 +20784,27 @@ } // construct all of the faces - for (var _i = 0; _i < cols; _i++) { - for (var _j = 0; _j < 2 * (cols - _i) - 1; _j++) { - var k = Math.floor(_j / 2); + for (let i = 0; i < cols; i++) { + for (let j = 0; j < 2 * (cols - i) - 1; j++) { + const k = Math.floor(j / 2); - if (_j % 2 === 0) { - pushVertex(v[_i][k + 1]); - pushVertex(v[_i + 1][k]); - 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) { - var vertex = new Vector3(); // iterate over the entire buffer and apply the radius to each vertex + const vertex = new Vector3(); // iterate over the entire buffer and apply the radius to each vertex - for (var i = 0; i < vertexBuffer.length; i += 3) { + for (let i = 0; i < vertexBuffer.length; i += 3) { vertex.x = vertexBuffer[i + 0]; vertex.y = vertexBuffer[i + 1]; vertex.z = vertexBuffer[i + 2]; @@ -21879,14 +20816,14 @@ } function generateUVs() { - var vertex = new Vector3(); + const vertex = new Vector3(); - for (var i = 0; i < vertexBuffer.length; i += 3) { + for (let i = 0; i < vertexBuffer.length; i += 3) { vertex.x = vertexBuffer[i + 0]; vertex.y = vertexBuffer[i + 1]; vertex.z = vertexBuffer[i + 2]; - var u = azimuth(vertex) / 2 / Math.PI + 0.5; - var v = inclination(vertex) / Math.PI + 0.5; + const u = azimuth(vertex) / 2 / Math.PI + 0.5; + const v = inclination(vertex) / Math.PI + 0.5; uvBuffer.push(u, 1 - v); } @@ -21896,13 +20833,13 @@ function correctSeam() { // handle case when face straddles the seam, see #3269 - for (var i = 0; i < uvBuffer.length; i += 6) { + for (let i = 0; i < uvBuffer.length; i += 6) { // uv data of a single face - 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 + 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 if (max > 0.9 && min < 0.1) { if (x0 < 0.2) uvBuffer[i + 0] += 1; @@ -21917,22 +20854,22 @@ } function getVertexByIndex(index, vertex) { - var stride = index * 3; + const stride = index * 3; vertex.x = vertices[stride + 0]; vertex.y = vertices[stride + 1]; vertex.z = vertices[stride + 2]; } function correctUVs() { - 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) { + 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) { 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]); @@ -21940,7 +20877,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); - var azi = azimuth(centroid); + const azi = azimuth(centroid); correctUV(uvA, j + 0, a, azi); correctUV(uvB, j + 2, b, azi); correctUV(uvC, j + 4, c, azi); @@ -21966,86 +20903,65 @@ function inclination(vector) { return Math.atan2(-vector.y, Math.sqrt(vector.x * vector.x + vector.z * vector.z)); } - - return _this; } - return PolyhedronGeometry; - }(BufferGeometry); - - 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) + class DodecahedronGeometry extends PolyhedronGeometry { + constructor(radius = 1, detail = 0) { + const t = (1 + Math.sqrt(5)) / 2; + const r = 1 / t; + const vertices = [// (±1, ±1, ±1) -1, -1, -1, -1, -1, 1, -1, 1, -1, -1, 1, 1, 1, -1, -1, 1, -1, 1, 1, 1, -1, 1, 1, 1, // (0, ±1/φ, ±φ) 0, -r, -t, 0, -r, t, 0, r, -t, 0, r, t, // (±1/φ, ±φ, 0) -r, -t, 0, -r, t, 0, r, -t, 0, r, t, 0, // (±φ, 0, ±1/φ) -t, 0, -r, t, 0, -r, -t, 0, r, t, 0, r]; - 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 = { + 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 = { radius: radius, detail: detail }; - return _this; } - return DodecahedronGeometry; - }(PolyhedronGeometry); - - var _v0$2 = new Vector3(); - - var _v1$5 = new Vector3(); + } - var _normal$1 = new Vector3(); + const _v0$2 = new Vector3(); - var _triangle = new Triangle(); + const _v1$5 = new Vector3(); - var EdgesGeometry = /*#__PURE__*/function (_BufferGeometry) { - _inheritsLoose(EdgesGeometry, _BufferGeometry); + const _normal$1 = new Vector3(); - function EdgesGeometry(geometry, thresholdAngle) { - var _this; + const _triangle = new Triangle(); - _this = _BufferGeometry.call(this) || this; - _this.type = 'EdgesGeometry'; - _this.parameters = { + class EdgesGeometry extends BufferGeometry { + constructor(geometry, thresholdAngle) { + super(); + 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 _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) { + 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) { if (indexAttr) { indexArr[0] = indexAttr.getX(i); indexArr[1] = indexAttr.getX(i + 1); @@ -22056,9 +20972,11 @@ indexArr[2] = i + 2; } - var a = _triangle.a, - b = _triangle.b, - c = _triangle.c; + const { + a, + b, + c + } = _triangle; a.fromBufferAttribute(positionAttr, indexArr[0]); b.fromBufferAttribute(positionAttr, indexArr[1]); c.fromBufferAttribute(positionAttr, indexArr[2]); @@ -22066,24 +20984,24 @@ _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 (var j = 0; j < 3; j++) { + for (let j = 0; j < 3; j++) { // get the first and next vertex making up the edge - 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; + 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}`; if (reverseHash in edgeData && edgeData[reverseHash]) { // if we found a sibling edge add it into the vertex array if @@ -22106,11 +21024,12 @@ } // iterate over all remaining, unmatched edges and add them to the vertex array - for (var key in edgeData) { + for (const key in edgeData) { if (edgeData[key]) { - var _edgeData$key = edgeData[key], - index0 = _edgeData$key.index0, - index1 = _edgeData$key.index1; + const { + index0, + index1 + } = edgeData[key]; _v0$2.fromBufferAttribute(positionAttr, index0); @@ -22121,33 +21040,30 @@ } } - _this.setAttribute('position', new Float32BufferAttribute(vertices, 3)); - - return _this; + this.setAttribute('position', new Float32BufferAttribute(vertices, 3)); } - return EdgesGeometry; - }(BufferGeometry); + } /** * Port from https://github.com/mapbox/earcut (v2.2.2) */ - var Earcut = { - triangulate: function triangulate(data, holeIndices, dim) { + const Earcut = { + triangulate: function (data, holeIndices, dim) { dim = dim || 2; - var hasHoles = holeIndices && holeIndices.length; - var outerLen = hasHoles ? holeIndices[0] * dim : data.length; - var outerNode = linkedList(data, 0, outerLen, dim, true); - var triangles = []; + const hasHoles = holeIndices && holeIndices.length; + const outerLen = hasHoles ? holeIndices[0] * dim : data.length; + let outerNode = linkedList(data, 0, outerLen, dim, true); + const triangles = []; if (!outerNode || outerNode.next === outerNode.prev) return triangles; - var minX, minY, maxX, maxY, x, y, invSize; + let minX, minY, maxX, maxY, x, y, invSize; if (hasHoles) outerNode = eliminateHoles(data, holeIndices, outerNode, dim); // if the shape is not too simple, we'll use z-order curve hash later; calculate polygon bbox if (data.length > 80 * dim) { minX = maxX = data[0]; minY = maxY = data[1]; - for (var i = dim; i < outerLen; i += dim) { + for (let i = dim; i < outerLen; i += dim) { x = data[i]; y = data[i + 1]; if (x < minX) minX = x; @@ -22167,16 +21083,12 @@ }; // create a circular doubly linked list from polygon points in the specified winding order function linkedList(data, start, end, dim, clockwise) { - var i, last; + let i, last; if (clockwise === signedArea(data, start, end, dim) > 0) { - for (i = start; i < end; i += dim) { - last = insertNode(i, data[i], data[i + 1], last); - } + 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)) { @@ -22191,7 +21103,7 @@ function filterPoints(start, end) { if (!start) return start; if (!end) end = start; - var p = start, + let p = start, again; do { @@ -22215,7 +21127,7 @@ if (!ear) return; // interlink polygon nodes in z-order if (!pass && invSize) indexCurve(ear, minX, minY, invSize); - var stop = ear, + let stop = ear, prev, next; // iterate through ears, slicing them one by one @@ -22255,13 +21167,13 @@ function isEar(ear) { - var a = ear.prev, - b = ear, - c = ear.next; + const 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 - var p = ear.next.next; + let p = ear.next.next; while (p !== ear.prev) { if (pointInTriangle(a.x, a.y, b.x, b.y, c.x, c.y, p.x, p.y) && area(p.prev, p, p.next) >= 0) return false; @@ -22272,20 +21184,20 @@ } function isEarHashed(ear, minX, minY, invSize) { - var a = ear.prev, - b = ear, - c = ear.next; + const 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 - 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 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 minZ = zOrder(minTX, minTY, minX, minY, invSize), - maxZ = zOrder(maxTX, maxTY, minX, minY, invSize); - var p = ear.prevZ, + const minZ = zOrder(minTX, minTY, minX, minY, invSize), + maxZ = zOrder(maxTX, maxTY, minX, minY, invSize); + let p = ear.prevZ, n = ear.nextZ; // look for points inside the triangle in both directions while (p && p.z >= minZ && n && n.z <= maxZ) { @@ -22312,11 +21224,11 @@ function cureLocalIntersections(start, triangles, dim) { - var p = start; + let p = start; do { - var a = p.prev, - b = p.next.next; + const 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); @@ -22337,15 +21249,15 @@ function splitEarcut(start, triangles, dim, minX, minY, invSize) { // look for a valid diagonal that divides the polygon into two - var a = start; + let a = start; do { - var b = a.next.next; + let b = a.next.next; while (b !== a.prev) { if (a.i !== b.i && isValidDiagonal(a, b)) { // split the polygon in two by the diagonal - var c = splitPolygon(a, b); // filter colinear points around the cuts + let c = splitPolygon(a, b); // filter colinear points around the cuts a = filterPoints(a, a.next); c = filterPoints(c, c.next); // run earcut on each half @@ -22364,8 +21276,8 @@ function eliminateHoles(data, holeIndices, outerNode, dim) { - var queue = []; - var i, len, start, end, list; + const queue = []; + let i, len, start, end, list; for (i = 0, len = holeIndices.length; i < len; i++) { start = holeIndices[i] * dim; @@ -22394,7 +21306,7 @@ outerNode = findHoleBridge(hole, outerNode); if (outerNode) { - var b = splitPolygon(outerNode, hole); // filter collinear points around the cuts + const b = splitPolygon(outerNode, hole); // filter collinear points around the cuts filterPoints(outerNode, outerNode.next); filterPoints(b, b.next); @@ -22403,16 +21315,16 @@ function findHoleBridge(hole, outerNode) { - var p = outerNode; - var hx = hole.x; - var hy = hole.y; - var qx = -Infinity, + let p = outerNode; + const hx = hole.x; + const hy = hole.y; + let qx = -Infinity, m; // find a segment intersected by a ray from the hole's leftmost point to the left; // segment's endpoint with lesser x will be potential connection point do { if (hy <= p.y && hy >= p.next.y && p.next.y !== p.y) { - var x = p.x + (hy - p.y) * (p.next.x - p.x) / (p.next.y - p.y); + const x = p.x + (hy - p.y) * (p.next.x - p.x) / (p.next.y - p.y); if (x <= hx && x > qx) { qx = x; @@ -22435,10 +21347,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 - var stop = m, - mx = m.x, - my = m.y; - var tanMin = Infinity, + const stop = m, + mx = m.x, + my = m.y; + let tanMin = Infinity, tan; p = m; @@ -22465,7 +21377,7 @@ function indexCurve(start, minX, minY, invSize) { - var p = start; + let p = start; do { if (p.z === null) p.z = zOrder(p.x, p.y, minX, minY, invSize); @@ -22482,7 +21394,7 @@ function sortLinked(list) { - var i, + let i, p, q, e, @@ -22555,7 +21467,7 @@ function getLeftmost(start) { - var p = start, + let p = start, leftmost = start; do { @@ -22591,10 +21503,10 @@ function intersects(p1, q1, p2, q2) { - 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)); + 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)); 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 @@ -22619,7 +21531,7 @@ function intersectsPolygon(a, b) { - var p = a; + let p = a; do { if (p.i !== a.i && p.next.i !== a.i && p.i !== b.i && p.next.i !== b.i && intersects(p, p.next, a, b)) return true; @@ -22636,10 +21548,10 @@ function middleInside(a, b) { - var p = a, + let p = a, inside = false; - var px = (a.x + b.x) / 2, - py = (a.y + b.y) / 2; + const 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; @@ -22652,10 +21564,10 @@ function splitPolygon(a, b) { - 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; + 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; a.next = b; b.prev = a; a2.next = an; @@ -22669,7 +21581,7 @@ function insertNode(i, x, y, last) { - var p = new Node(i, x, y); + const p = new Node(i, x, y); if (!last) { p.prev = p; @@ -22710,9 +21622,9 @@ } function signedArea(data, start, end, dim) { - var sum = 0; + let sum = 0; - for (var i = start, j = end - dim; i < end; i += dim) { + for (let i = start, j = end - dim; i < end; i += dim) { sum += (data[j] - data[i]) * (data[i + 1] + data[j + 1]); j = i; } @@ -22720,45 +21632,45 @@ return sum; } - var ShapeUtils = { + const ShapeUtils = { // calculate area of the contour polygon - area: function area(contour) { - var n = contour.length; - var a = 0.0; + area: function (contour) { + const n = contour.length; + let a = 0.0; - for (var p = n - 1, q = 0; q < n; p = q++) { + for (let p = n - 1, q = 0; q < n; p = q++) { a += contour[p].x * contour[q].y - contour[q].x * contour[p].y; } return a * 0.5; }, - isClockWise: function isClockWise(pts) { + isClockWise: function (pts) { return ShapeUtils.area(pts) < 0; }, - triangulateShape: function triangulateShape(contour, holes) { - var vertices = []; // flat array of vertices like [ x0,y0, x1,y1, x2,y2, ... ] + triangulateShape: function (contour, holes) { + const vertices = []; // flat array of vertices like [ x0,y0, x1,y1, x2,y2, ... ] - var holeIndices = []; // array of hole indices + const holeIndices = []; // array of hole indices - var faces = []; // final array of vertex indices like [ [ a,b,d ], [ b,c,d ] ] + const faces = []; // final array of vertex indices like [ [ a,b,d ], [ b,c,d ] ] removeDupEndPts(contour); addContour(vertices, contour); // - var holeIndex = contour.length; + let holeIndex = contour.length; holes.forEach(removeDupEndPts); - for (var i = 0; i < holes.length; i++) { + for (let i = 0; i < holes.length; i++) { holeIndices.push(holeIndex); holeIndex += holes[i].length; addContour(vertices, holes[i]); } // - var triangles = Earcut.triangulate(vertices, holeIndices); // + const triangles = Earcut.triangulate(vertices, holeIndices); // - for (var _i = 0; _i < triangles.length; _i += 3) { - faces.push(triangles.slice(_i, _i + 3)); + for (let i = 0; i < triangles.length; i += 3) { + faces.push(triangles.slice(i, i + 3)); } return faces; @@ -22766,7 +21678,7 @@ }; function removeDupEndPts(points) { - var l = points.length; + const l = points.length; if (l > 2 && points[l - 1].equals(points[0])) { points.pop(); @@ -22774,57 +21686,70 @@ } function addContour(vertices, contour) { - for (var i = 0; i < contour.length; i++) { + for (let i = 0; i < contour.length; i++) { vertices.push(contour[i].x); vertices.push(contour[i].y); } } - var ExtrudeGeometry = /*#__PURE__*/function (_BufferGeometry) { - _inheritsLoose(ExtrudeGeometry, _BufferGeometry); - - function ExtrudeGeometry(shapes, options) { - var _this; + /** + * 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 + * + * } + */ - _this = _BufferGeometry.call(this) || this; - _this.type = 'ExtrudeGeometry'; - _this.parameters = { + class ExtrudeGeometry extends BufferGeometry { + constructor(shapes, options) { + super(); + this.type = 'ExtrudeGeometry'; + this.parameters = { shapes: shapes, options: options }; shapes = Array.isArray(shapes) ? shapes : [shapes]; + const scope = this; + const verticesArray = []; + const uvArray = []; - var scope = _assertThisInitialized(_this); - - var verticesArray = []; - var uvArray = []; - - for (var i = 0, l = shapes.length; i < l; i++) { - var shape = shapes[i]; + for (let i = 0, l = shapes.length; i < l; i++) { + const 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) { - 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 + 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 if (options.amount !== undefined) { console.warn('THREE.ExtrudeBufferGeometry: amount has been renamed to depth.'); @@ -22832,9 +21757,9 @@ } // - var extrudePts, + let extrudePts, extrudeByPath = false; - var splineTube, binormal, normal, position2; + let splineTube, binormal, normal, position2; if (extrudePath) { extrudePts = extrudePath.getSpacedPoints(steps); @@ -22859,16 +21784,16 @@ } // Variables initialization - var shapePoints = shape.extractPoints(curveSegments); - var vertices = shapePoints.shape; - var holes = shapePoints.holes; - var reverse = !ShapeUtils.isClockWise(vertices); + const shapePoints = shape.extractPoints(curveSegments); + let vertices = shapePoints.shape; + const holes = shapePoints.holes; + const reverse = !ShapeUtils.isClockWise(vertices); if (reverse) { vertices = vertices.reverse(); // Maybe we should also check if holes are in the opposite direction, just to be safe ... - for (var h = 0, hl = holes.length; h < hl; h++) { - var ahole = holes[h]; + for (let h = 0, hl = holes.length; h < hl; h++) { + const ahole = holes[h]; if (ShapeUtils.isClockWise(ahole)) { holes[h] = ahole.reverse(); @@ -22876,14 +21801,14 @@ } } - var faces = ShapeUtils.triangulateShape(vertices, holes); + const faces = ShapeUtils.triangulateShape(vertices, holes); /* Vertices */ - var contour = vertices; // vertices has all points but contour has only points of circumference + const contour = vertices; // vertices has all points but contour has only points of circumference - for (var _h = 0, _hl = holes.length; _h < _hl; _h++) { - var _ahole = holes[_h]; - vertices = vertices.concat(_ahole); + for (let h = 0, hl = holes.length; h < hl; h++) { + const ahole = holes[h]; + vertices = vertices.concat(ahole); } function scalePt2(pt, vec, size) { @@ -22891,8 +21816,8 @@ return vec.clone().multiplyScalar(size).add(pt); } - var vlen = vertices.length, - flen = faces.length; // Find directions for point movement + const 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 @@ -22901,36 +21826,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. - var v_trans_x, v_trans_y, shrink_by; // resulting translation vector for inPt + let v_trans_x, v_trans_y, shrink_by; // resulting translation vector for inPt // good reading for geometry algorithms (here: line-line intersection) // http://geomalgorithms.com/a05-_intersect-1.html - 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 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 collinear0 = v_prev_x * v_next_y - v_prev_y * v_next_x; + const collinear0 = v_prev_x * v_next_y - v_prev_y * v_next_x; if (Math.abs(collinear0) > Number.EPSILON) { // not collinear // length of vectors for normalizing - 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 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 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 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 sf = ((ptNextShift_x - ptPrevShift_x) * v_next_y - (ptNextShift_y - ptPrevShift_y) * v_next_x) / (v_prev_x * v_next_y - v_prev_y * v_next_x); // vector from inPt to intersection point + const sf = ((ptNextShift_x - ptPrevShift_x) * v_next_y - (ptNextShift_y - ptPrevShift_y) * v_next_x) / (v_prev_x * v_next_y - v_prev_y * v_next_x); // vector from inPt to intersection point v_trans_x = ptPrevShift_x + v_prev_x * sf - inPt.x; v_trans_y = ptPrevShift_y + v_prev_y * sf - inPt.y; // Don't normalize!, otherwise sharp corners become ugly // but prevent crazy spikes - var v_trans_lensq = v_trans_x * v_trans_x + v_trans_y * v_trans_y; + const v_trans_lensq = v_trans_x * v_trans_x + v_trans_y * v_trans_y; if (v_trans_lensq <= 2) { return new Vector2(v_trans_x, v_trans_y); @@ -22939,7 +21864,7 @@ } } else { // handle special case of collinear edges - var direction_eq = false; // assumes: opposite + let direction_eq = false; // assumes: opposite if (v_prev_x > Number.EPSILON) { if (v_next_x > Number.EPSILON) { @@ -22973,29 +21898,29 @@ return new Vector2(v_trans_x / shrink_by, v_trans_y / shrink_by); } - var contourMovements = []; + const contourMovements = []; - for (var _i = 0, il = contour.length, j = il - 1, k = _i + 1; _i < il; _i++, j++, k++) { + for (let i = 0, il = contour.length, j = il - 1, k = i + 1; i < il; i++, j++, k++) { if (j === il) j = 0; if (k === il) k = 0; // (j)---(i)---(k) // 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]); } - var holesMovements = []; - var oneHoleMovements, + const holesMovements = []; + let oneHoleMovements, verticesMovements = contourMovements.concat(); - for (var _h2 = 0, _hl2 = holes.length; _h2 < _hl2; _h2++) { - var _ahole2 = holes[_h2]; + for (let h = 0, hl = holes.length; h < hl; h++) { + const ahole = holes[h]; oneHoleMovements = []; - 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) + 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) - oneHoleMovements[_i2] = getBevelVec(_ahole2[_i2], _ahole2[_j], _ahole2[_k]); + oneHoleMovements[i] = getBevelVec(ahole[i], ahole[j], ahole[k]); } holesMovements.push(oneHoleMovements); @@ -23003,43 +21928,40 @@ } // Loop bevelSegments, 1 for the front, 1 for the back - for (var b = 0; b < bevelSegments; b++) { + for (let b = 0; b < bevelSegments; b++) { //for ( b = bevelSegments; b > 0; b -- ) { - 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 + 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 _i3 = 0, _il2 = contour.length; _i3 < _il2; _i3++) { - var vert = scalePt2(contour[_i3], contourMovements[_i3], _bs); + for (let i = 0, il = contour.length; i < il; i++) { + const vert = scalePt2(contour[i], contourMovements[i], bs); v(vert.x, vert.y, -z); } // expand holes - 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 h = 0, hl = holes.length; h < hl; h++) { + const ahole = holes[h]; + oneHoleMovements = holesMovements[h]; - v(_vert.x, _vert.y, -z); + for (let i = 0, il = ahole.length; i < il; i++) { + const vert = scalePt2(ahole[i], oneHoleMovements[i], bs); + v(vert.x, vert.y, -z); } } } - var bs = bevelSize + bevelOffset; // Back facing vertices + const bs = bevelSize + bevelOffset; // Back facing vertices - for (var _i5 = 0; _i5 < vlen; _i5++) { - var _vert2 = bevelEnabled ? scalePt2(vertices[_i5], verticesMovements[_i5], bs) : vertices[_i5]; + for (let i = 0; i < vlen; i++) { + const vert = bevelEnabled ? scalePt2(vertices[i], verticesMovements[i], bs) : vertices[i]; if (!extrudeByPath) { - v(_vert2.x, _vert2.y, 0); + v(vert.x, vert.y, 0); } else { // v( vert.x, vert.y + extrudePts[ 0 ].y, extrudePts[ 0 ].x ); - normal.copy(splineTube.normals[0]).multiplyScalar(_vert2.x); - binormal.copy(splineTube.binormals[0]).multiplyScalar(_vert2.y); + normal.copy(splineTube.normals[0]).multiplyScalar(vert.x); + binormal.copy(splineTube.binormals[0]).multiplyScalar(vert.y); position2.copy(extrudePts[0]).add(normal).add(binormal); v(position2.x, position2.y, position2.z); } @@ -23047,16 +21969,16 @@ // Including front facing vertices - 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]; + for (let s = 1; s <= steps; s++) { + for (let i = 0; i < vlen; i++) { + const vert = bevelEnabled ? scalePt2(vertices[i], verticesMovements[i], bs) : vertices[i]; if (!extrudeByPath) { - v(_vert3.x, _vert3.y, depth / steps * s); + v(vert.x, vert.y, depth / steps * s); } else { // v( vert.x, vert.y + extrudePts[ s - 1 ].y, extrudePts[ s - 1 ].x ); - normal.copy(splineTube.normals[s]).multiplyScalar(_vert3.x); - binormal.copy(splineTube.binormals[s]).multiplyScalar(_vert3.y); + normal.copy(splineTube.normals[s]).multiplyScalar(vert.x); + binormal.copy(splineTube.binormals[s]).multiplyScalar(vert.y); position2.copy(extrudePts[s]).add(normal).add(binormal); v(position2.x, position2.y, position2.z); } @@ -23065,32 +21987,28 @@ //for ( b = 1; b <= bevelSegments; b ++ ) { - 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 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 - v(_vert4.x, _vert4.y, depth + _z); + for (let i = 0, il = contour.length; i < il; i++) { + const vert = scalePt2(contour[i], contourMovements[i], bs); + v(vert.x, vert.y, depth + z); } // expand holes - for (var _h4 = 0, _hl4 = holes.length; _h4 < _hl4; _h4++) { - var _ahole4 = holes[_h4]; - oneHoleMovements = holesMovements[_h4]; + for (let h = 0, hl = holes.length; h < hl; h++) { + const ahole = holes[h]; + oneHoleMovements = holesMovements[h]; - for (var _i8 = 0, _il5 = _ahole4.length; _i8 < _il5; _i8++) { - var _vert5 = scalePt2(_ahole4[_i8], oneHoleMovements[_i8], _bs2); + for (let i = 0, il = ahole.length; i < il; i++) { + const vert = scalePt2(ahole[i], oneHoleMovements[i], bs); if (!extrudeByPath) { - v(_vert5.x, _vert5.y, depth + _z); + v(vert.x, vert.y, depth + z); } else { - v(_vert5.x, _vert5.y + extrudePts[steps - 1].y, extrudePts[steps - 1].x + _z); + v(vert.x, vert.y + extrudePts[steps - 1].y, extrudePts[steps - 1].x + z); } } } @@ -23104,36 +22022,36 @@ buildSideFaces(); ///// Internal functions function buildLidFaces() { - var start = verticesArray.length / 3; + const start = verticesArray.length / 3; if (bevelEnabled) { - var layer = 0; // steps + 1 + let layer = 0; // steps + 1 - var offset = vlen * layer; // Bottom faces + let offset = vlen * layer; // Bottom faces - for (var _i9 = 0; _i9 < flen; _i9++) { - var face = faces[_i9]; + for (let i = 0; i < flen; i++) { + const face = faces[i]; f3(face[2] + offset, face[1] + offset, face[0] + offset); } layer = steps + bevelSegments * 2; offset = vlen * layer; // Top faces - for (var _i10 = 0; _i10 < flen; _i10++) { - var _face = faces[_i10]; - f3(_face[0] + offset, _face[1] + offset, _face[2] + offset); + for (let i = 0; i < flen; i++) { + const face = faces[i]; + f3(face[0] + offset, face[1] + offset, face[2] + offset); } } else { // Bottom faces - for (var _i11 = 0; _i11 < flen; _i11++) { - var _face2 = faces[_i11]; - f3(_face2[2], _face2[1], _face2[0]); + for (let i = 0; i < flen; i++) { + const face = faces[i]; + f3(face[2], face[1], face[0]); } // Top faces - for (var _i12 = 0; _i12 < flen; _i12++) { - var _face3 = faces[_i12]; - f3(_face3[0] + vlen * steps, _face3[1] + vlen * steps, _face3[2] + vlen * steps); + for (let i = 0; i < flen; i++) { + const face = faces[i]; + f3(face[0] + vlen * steps, face[1] + vlen * steps, face[2] + vlen * steps); } } @@ -23142,41 +22060,37 @@ function buildSideFaces() { - var start = verticesArray.length / 3; - var layeroffset = 0; + const start = verticesArray.length / 3; + let layeroffset = 0; sidewalls(contour, layeroffset); layeroffset += contour.length; - for (var _h5 = 0, _hl5 = holes.length; _h5 < _hl5; _h5++) { - var _ahole5 = holes[_h5]; - sidewalls(_ahole5, layeroffset); //, true + for (let h = 0, hl = holes.length; h < hl; h++) { + const ahole = holes[h]; + sidewalls(ahole, layeroffset); //, true - layeroffset += _ahole5.length; + layeroffset += ahole.length; } scope.addGroup(start, verticesArray.length / 3 - start, 1); } function sidewalls(contour, layeroffset) { - var i = contour.length; + let i = contour.length; while (--i >= 0) { - 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); + 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); } } } @@ -23191,8 +22105,8 @@ addVertex(a); addVertex(b); addVertex(c); - var nextIndex = verticesArray.length / 3; - var uvs = uvgen.generateTopUV(scope, verticesArray, nextIndex - 3, nextIndex - 2, nextIndex - 1); + const nextIndex = verticesArray.length / 3; + const uvs = uvgen.generateTopUV(scope, verticesArray, nextIndex - 3, nextIndex - 2, nextIndex - 1); addUV(uvs[0]); addUV(uvs[1]); addUV(uvs[2]); @@ -23205,8 +22119,8 @@ addVertex(b); addVertex(c); addVertex(d); - var nextIndex = verticesArray.length / 3; - var uvs = uvgen.generateSideWallUV(scope, verticesArray, nextIndex - 6, nextIndex - 3, nextIndex - 2, nextIndex - 1); + const nextIndex = verticesArray.length / 3; + const uvs = uvgen.generateSideWallUV(scope, verticesArray, nextIndex - 6, nextIndex - 3, nextIndex - 2, nextIndex - 1); addUV(uvs[0]); addUV(uvs[1]); addUV(uvs[3]); @@ -23226,45 +22140,40 @@ uvArray.push(vector2.y); } } - - return _this; } - var _proto = ExtrudeGeometry.prototype; + toJSON() { + const data = BufferGeometry.prototype.toJSON.call(this); + const shapes = this.parameters.shapes; + const options = this.parameters.options; + return toJSON(shapes, options, data); + } - _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); - }; + } - 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]; + 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 [new Vector2(a_x, a_y), new Vector2(b_x, b_y), new Vector2(c_x, c_y)]; }, - 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]; + 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]; 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)]; @@ -23274,12 +22183,12 @@ } }; - function _toJSON(shapes, options, data) { + function toJSON(shapes, options, data) { data.shapes = []; if (Array.isArray(shapes)) { - for (var i = 0, l = shapes.length; i < l; i++) { - var shape = shapes[i]; + for (let i = 0, l = shapes.length; i < l; i++) { + const shape = shapes[i]; data.shapes.push(shape.uuid); } } else { @@ -23290,56 +22199,26 @@ return data; } - 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 = { + 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 = { 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; - } + } - _this = _BufferGeometry.call(this) || this; - _this.type = 'LatheGeometry'; - _this.parameters = { + class LatheGeometry extends BufferGeometry { + constructor(points, segments = 12, phiStart = 0, phiLength = Math.PI * 2) { + super(); + this.type = 'LatheGeometry'; + this.parameters = { points: points, segments: segments, phiStart: phiStart, @@ -23349,20 +22228,20 @@ phiLength = MathUtils.clamp(phiLength, 0, Math.PI * 2); // buffers - var indices = []; - var vertices = []; - var uvs = []; // helper variables + const indices = []; + const vertices = []; + const uvs = []; // helper variables - var inverseSegments = 1.0 / segments; - var vertex = new Vector3(); - var uv = new Vector2(); // generate vertices and uvs + const inverseSegments = 1.0 / segments; + const vertex = new Vector3(); + const uv = new Vector2(); // generate vertices and uvs - 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 i = 0; i <= segments; i++) { + const phi = phiStart + i * inverseSegments * phiLength; + const sin = Math.sin(phi); + const cos = Math.cos(phi); - for (var j = 0; j <= points.length - 1; j++) { + for (let j = 0; j <= points.length - 1; j++) { // vertex vertex.x = points[j].x * sin; vertex.y = points[j].y; @@ -23376,13 +22255,13 @@ } // indices - 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 + 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 indices.push(a, b, d); indices.push(b, c, d); @@ -23390,76 +22269,55 @@ } // build geometry - _this.setIndex(indices); + this.setIndex(indices); + this.setAttribute('position', new Float32BufferAttribute(vertices, 3)); + this.setAttribute('uv', new Float32BufferAttribute(uvs, 2)); // generate normals - _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. + 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) { - 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 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 _base = segments * points.length * 3; + const base = segments * points.length * 3; - for (var _i2 = 0, _j2 = 0; _i2 < points.length; _i2++, _j2 += 3) { + for (let i = 0, j = 0; i < points.length; i++, j += 3) { // select the normal of the vertex in the first 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 + 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 - n2.x = normals[_base + _j2 + 0]; - n2.y = normals[_base + _j2 + 1]; - n2.z = normals[_base + _j2 + 2]; // average normals + n2.x = normals[base + j + 0]; + n2.y = normals[base + j + 1]; + n2.z = normals[base + j + 2]; // average normals n.addVectors(n1, n2).normalize(); // assign the new values to both normals - 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; + 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; } } - - return _this; } - return LatheGeometry; - }(BufferGeometry); - - var OctahedronGeometry = /*#__PURE__*/function (_PolyhedronGeometry) { - _inheritsLoose(OctahedronGeometry, _PolyhedronGeometry); - - function OctahedronGeometry(radius, detail) { - var _this; - - 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 = { + 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 = { radius: radius, detail: detail }; - return _this; } - return OctahedronGeometry; - }(PolyhedronGeometry); + } /** * Parametric Surfaces Geometry @@ -23475,29 +22333,29 @@ stacks: stacks }; // buffers - 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(); + 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(); if (func.length < 3) { console.error('THREE.ParametricGeometry: Function must now modify a Vector3 as third parameter.'); } // generate vertices, normals and uvs - var sliceCount = slices + 1; + const sliceCount = slices + 1; - for (var i = 0; i <= stacks; i++) { - var v = i / stacks; + for (let i = 0; i <= stacks; i++) { + const v = i / stacks; - for (var j = 0; j <= slices; j++) { - var u = j / slices; // vertex + for (let j = 0; j <= slices; j++) { + const u = j / slices; // vertex func(u, v, p0); vertices.push(p0.x, p0.y, p0.z); // normal @@ -23528,12 +22386,12 @@ } // generate indices - 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 + 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 indices.push(a, b, d); indices.push(b, c, d); @@ -23550,39 +22408,11 @@ ParametricGeometry.prototype = Object.create(BufferGeometry.prototype); ParametricGeometry.prototype.constructor = ParametricGeometry; - 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 = { + 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 = { innerRadius: innerRadius, outerRadius: outerRadius, thetaSegments: thetaSegments, @@ -23593,20 +22423,20 @@ thetaSegments = Math.max(3, thetaSegments); phiSegments = Math.max(1, phiSegments); // buffers - var indices = []; - var vertices = []; - var normals = []; - var uvs = []; // some helper variables + const indices = []; + const vertices = []; + const normals = []; + const uvs = []; // some helper variables - var radius = innerRadius; - var radiusStep = (outerRadius - innerRadius) / phiSegments; - var vertex = new Vector3(); - var uv = new Vector2(); // generate vertices, normals and uvs + let radius = innerRadius; + const radiusStep = (outerRadius - innerRadius) / phiSegments; + const vertex = new Vector3(); + const uv = new Vector2(); // generate vertices, normals and uvs - for (var j = 0; j <= phiSegments; j++) { - for (var i = 0; i <= thetaSegments; i++) { + for (let j = 0; j <= phiSegments; j++) { + for (let i = 0; i <= thetaSegments; i++) { // values are generate from the inside of the ring to the outside - var segment = thetaStart + i / thetaSegments * thetaLength; // vertex + const segment = thetaStart + i / thetaSegments * thetaLength; // vertex vertex.x = radius * Math.cos(segment); vertex.y = radius * Math.sin(segment); @@ -23624,16 +22454,15 @@ } // indices - 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 j = 0; j < phiSegments; j++) { + const thetaSegmentLevel = j * (thetaSegments + 1); - var a = _segment; - var b = _segment + thetaSegments + 1; - var c = _segment + thetaSegments + 2; - var d = _segment + 1; // faces + 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 indices.push(a, b, d); indices.push(b, c, d); @@ -23641,53 +22470,37 @@ } // 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)); - - return _this; + 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 RingGeometry; - }(BufferGeometry); - - var ShapeGeometry = /*#__PURE__*/function (_BufferGeometry) { - _inheritsLoose(ShapeGeometry, _BufferGeometry); - - function ShapeGeometry(shapes, curveSegments) { - var _this; - - if (curveSegments === void 0) { - curveSegments = 12; - } + } - _this = _BufferGeometry.call(this) || this; - _this.type = 'ShapeGeometry'; - _this.parameters = { + class ShapeGeometry extends BufferGeometry { + constructor(shapes, curveSegments = 12) { + super(); + this.type = 'ShapeGeometry'; + this.parameters = { shapes: shapes, curveSegments: curveSegments }; // buffers - var indices = []; - var vertices = []; - var normals = []; - var uvs = []; // helper variables + const indices = []; + const vertices = []; + const normals = []; + const uvs = []; // helper variables - var groupStart = 0; - var groupCount = 0; // allow single and array values for "shapes" parameter + let groupStart = 0; + let groupCount = 0; // allow single and array values for "shapes" parameter if (Array.isArray(shapes) === false) { addShape(shapes); } else { - for (var i = 0; i < shapes.length; i++) { + for (let 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; @@ -23695,79 +22508,70 @@ } // 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) { - var indexOffset = vertices.length / 3; - var points = shape.extractPoints(curveSegments); - var shapeVertices = points.shape; - var shapeHoles = points.holes; // check direction of vertices + const indexOffset = vertices.length / 3; + const points = shape.extractPoints(curveSegments); + let shapeVertices = points.shape; + const shapeHoles = points.holes; // check direction of vertices if (ShapeUtils.isClockWise(shapeVertices) === false) { shapeVertices = shapeVertices.reverse(); } - for (var _i = 0, l = shapeHoles.length; _i < l; _i++) { - var shapeHole = shapeHoles[_i]; + for (let i = 0, l = shapeHoles.length; i < l; i++) { + const shapeHole = shapeHoles[i]; if (ShapeUtils.isClockWise(shapeHole) === true) { - shapeHoles[_i] = shapeHole.reverse(); + shapeHoles[i] = shapeHole.reverse(); } } - var faces = ShapeUtils.triangulateShape(shapeVertices, shapeHoles); // join vertices of inner and outer paths to a single array + const faces = ShapeUtils.triangulateShape(shapeVertices, shapeHoles); // join vertices of inner and outer paths to a single array - for (var _i2 = 0, _l = shapeHoles.length; _i2 < _l; _i2++) { - var _shapeHole = shapeHoles[_i2]; - shapeVertices = shapeVertices.concat(_shapeHole); + for (let i = 0, l = shapeHoles.length; i < l; i++) { + const shapeHole = shapeHoles[i]; + shapeVertices = shapeVertices.concat(shapeHole); } // vertices, normals, uvs - for (var _i3 = 0, _l2 = shapeVertices.length; _i3 < _l2; _i3++) { - var vertex = shapeVertices[_i3]; + for (let i = 0, l = shapeVertices.length; i < l; i++) { + const vertex = shapeVertices[i]; vertices.push(vertex.x, vertex.y, 0); normals.push(0, 0, 1); uvs.push(vertex.x, vertex.y); // world uvs } // incides - 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; + 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; indices.push(a, b, c); groupCount += 3; } } - - 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); - }; + toJSON() { + const data = BufferGeometry.prototype.toJSON.call(this); + const shapes = this.parameters.shapes; + return toJSON$1(shapes, data); + } - return ShapeGeometry; - }(BufferGeometry); + } - function _toJSON$1(shapes, data) { + function toJSON$1(shapes, data) { data.shapes = []; if (Array.isArray(shapes)) { - for (var i = 0, l = shapes.length; i < l; i++) { - var shape = shapes[i]; + for (let i = 0, l = shapes.length; i < l; i++) { + const shape = shapes[i]; data.shapes.push(shape.uuid); } } else { @@ -23777,43 +22581,11 @@ return data; } - 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 = { + 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 = { radius: radius, widthSegments: widthSegments, heightSegments: heightSegments, @@ -23824,22 +22596,22 @@ }; widthSegments = Math.max(3, Math.floor(widthSegments)); heightSegments = Math.max(2, Math.floor(heightSegments)); - var thetaEnd = Math.min(thetaStart + thetaLength, Math.PI); - var index = 0; - var grid = []; - var vertex = new Vector3(); - var normal = new Vector3(); // buffers + const thetaEnd = Math.min(thetaStart + thetaLength, Math.PI); + let index = 0; + const grid = []; + const vertex = new Vector3(); + const normal = new Vector3(); // buffers - var indices = []; - var vertices = []; - var normals = []; - var uvs = []; // generate vertices, normals and uvs + const indices = []; + const vertices = []; + const normals = []; + const uvs = []; // generate vertices, normals and uvs - for (var iy = 0; iy <= heightSegments; iy++) { - var verticesRow = []; - var v = iy / heightSegments; // special case for the poles + for (let iy = 0; iy <= heightSegments; iy++) { + const verticesRow = []; + const v = iy / heightSegments; // special case for the poles - var uOffset = 0; + let uOffset = 0; if (iy == 0 && thetaStart == 0) { uOffset = 0.5 / widthSegments; @@ -23847,8 +22619,8 @@ uOffset = -0.5 / widthSegments; } - for (var ix = 0; ix <= widthSegments; ix++) { - var u = ix / widthSegments; // vertex + for (let ix = 0; ix <= widthSegments; ix++) { + const u = ix / widthSegments; // vertex vertex.x = -radius * Math.cos(phiStart + u * phiLength) * Math.sin(thetaStart + v * thetaLength); vertex.y = radius * Math.cos(thetaStart + v * thetaLength); @@ -23866,121 +22638,84 @@ } // indices - 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); + 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); } } // 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)); - - return _this; + 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 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; - } + } - 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 = { + 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 = { radius: radius, detail: detail }; - return _this; } - return TetrahedronGeometry; - }(PolyhedronGeometry); - - var TextGeometry = /*#__PURE__*/function (_ExtrudeGeometry) { - _inheritsLoose(TextGeometry, _ExtrudeGeometry); - - function TextGeometry(text, parameters) { - var _this; + } - if (parameters === void 0) { - parameters = {}; - } + /** + * 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 font = parameters.font; + class TextGeometry extends ExtrudeGeometry { + constructor(text, parameters = {}) { + const font = parameters.font; if (!(font && font.isFont)) { console.error('THREE.TextGeometry: font parameter is not an instance of THREE.Font.'); - return new BufferGeometry() || _assertThisInitialized(_this); + return new BufferGeometry(); } - var shapes = font.generateShapes(text, parameters.size); // translate parameters to ExtrudeGeometry API + const 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; - _this = _ExtrudeGeometry.call(this, shapes, parameters) || this; - _this.type = 'TextGeometry'; - return _this; + super(shapes, parameters); + this.type = 'TextGeometry'; } - 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; - } + } - _this = _BufferGeometry.call(this) || this; - _this.type = 'TorusGeometry'; - _this.parameters = { + class TorusGeometry extends BufferGeometry { + constructor(radius = 1, tube = 0.4, radialSegments = 8, tubularSegments = 6, arc = Math.PI * 2) { + super(); + this.type = 'TorusGeometry'; + this.parameters = { radius: radius, tube: tube, radialSegments: radialSegments, @@ -23990,19 +22725,19 @@ radialSegments = Math.floor(radialSegments); tubularSegments = Math.floor(tubularSegments); // buffers - var indices = []; - var vertices = []; - var normals = []; - var uvs = []; // helper variables + const indices = []; + const vertices = []; + const normals = []; + const uvs = []; // helper variables - var center = new Vector3(); - var vertex = new Vector3(); - var normal = new Vector3(); // generate vertices, normals and uvs + const center = new Vector3(); + const vertex = new Vector3(); + const normal = new Vector3(); // generate vertices, normals and uvs - 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 + 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 vertex.x = (radius + tube * Math.cos(v)) * Math.cos(u); vertex.y = (radius + tube * Math.cos(v)) * Math.sin(u); @@ -24020,13 +22755,13 @@ } // generate indices - for (var _j = 1; _j <= radialSegments; _j++) { - for (var _i = 1; _i <= tubularSegments; _i++) { + for (let j = 1; j <= radialSegments; j++) { + for (let i = 1; i <= tubularSegments; i++) { // indices - 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 + 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 indices.push(a, b, d); indices.push(b, c, d); @@ -24034,53 +22769,19 @@ } // 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)); - - return _this; + 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 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 = { + 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, @@ -24091,22 +22792,22 @@ tubularSegments = Math.floor(tubularSegments); radialSegments = Math.floor(radialSegments); // buffers - var indices = []; - var vertices = []; - var normals = []; - var uvs = []; // helper variables + const indices = []; + const vertices = []; + const normals = []; + const 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 + 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 - for (var i = 0; i <= tubularSegments; ++i) { + 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 - 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. + const u = i / tubularSegments * p * Math.PI * 2; // now we calculate two points. P1 is our current position on the curve, P2 is a little farther ahead. // these points are used to create a special "coordinate space", which is necessary to calculate the correct vertex positions calculatePositionOnCurve(u, p, q, radius, P1); @@ -24120,12 +22821,12 @@ B.normalize(); N.normalize(); - for (var j = 0; j <= radialSegments; ++j) { + for (let j = 0; j <= radialSegments; ++j) { // now calculate the vertices. they are nothing more than an extrusion of the torus curve. // because we extrude a shape in the xy-plane, there is no need to calculate a z-value. - 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. + 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. // 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); @@ -24142,13 +22843,13 @@ } // generate indices - for (var _j = 1; _j <= tubularSegments; _j++) { - for (var _i = 1; _i <= radialSegments; _i++) { + for (let j = 1; j <= tubularSegments; j++) { + for (let i = 1; i <= radialSegments; i++) { // indices - 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 + 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 indices.push(a, b, d); indices.push(b, c, d); @@ -24156,91 +22857,60 @@ } // 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) { - var cu = Math.cos(u); - var su = Math.sin(u); - var quOverP = q / p * u; - var cs = Math.cos(quOverP); + const cu = Math.cos(u); + const su = Math.sin(u); + const quOverP = q / p * u; + const 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; - } - - if (radialSegments === void 0) { - radialSegments = 8; - } - - if (closed === void 0) { - closed = false; - } + } - _this = _BufferGeometry.call(this) || this; - _this.type = 'TubeGeometry'; - _this.parameters = { + class TubeGeometry extends BufferGeometry { + constructor(path, tubularSegments = 64, radius = 1, radialSegments = 8, closed = false) { + super(); + this.type = 'TubeGeometry'; + this.parameters = { path: path, tubularSegments: tubularSegments, radius: radius, radialSegments: radialSegments, closed: closed }; - var frames = path.computeFrenetFrames(tubularSegments, closed); // expose internals + const frames = path.computeFrenetFrames(tubularSegments, closed); // expose internals - _this.tangents = frames.tangents; - _this.normals = frames.normals; - _this.binormals = frames.binormals; // helper variables + this.tangents = frames.tangents; + this.normals = frames.normals; + this.binormals = frames.binormals; // helper variables - var vertex = new Vector3(); - var normal = new Vector3(); - var uv = new Vector2(); - var P = new Vector3(); // buffer + const vertex = new Vector3(); + const normal = new Vector3(); + const uv = new Vector2(); + let P = new Vector3(); // buffer - var vertices = []; - var normals = []; - var uvs = []; - var indices = []; // create buffer data + const vertices = []; + const normals = []; + const uvs = []; + const 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 (var i = 0; i < tubularSegments; i++) { + for (let 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 @@ -24260,13 +22930,13 @@ // we use getPointAt to sample evenly distributed points from the given path P = path.getPointAt(i / tubularSegments, P); // retrieve corresponding normal and binormal - var N = frames.normals[i]; - var B = frames.binormals[i]; // generate normals and vertices for the current segment + const N = frames.normals[i]; + const B = frames.binormals[i]; // generate normals and vertices for the current segment - 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 + 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 normal.x = cos * N.x + sin * B.x; normal.y = cos * N.y + sin * B.y; @@ -24282,12 +22952,12 @@ } function generateIndices() { - 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 + 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 indices.push(a, b, d); indices.push(b, c, d); @@ -24296,55 +22966,46 @@ } function generateUVs() { - for (var i = 0; i <= tubularSegments; i++) { - for (var j = 0; j <= radialSegments; j++) { + for (let i = 0; i <= tubularSegments; i++) { + for (let j = 0; j <= radialSegments; j++) { uv.x = i / tubularSegments; uv.y = j / radialSegments; uvs.push(uv.x, uv.y); } } } - - return _this; } - var _proto = TubeGeometry.prototype; - - _proto.toJSON = function toJSON() { - var data = BufferGeometry.prototype.toJSON.call(this); + toJSON() { + const 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); + } - function WireframeGeometry(geometry) { - var _this; + } - _this = _BufferGeometry.call(this) || this; - _this.type = 'WireframeGeometry'; + class WireframeGeometry extends BufferGeometry { + constructor(geometry) { + super(); + this.type = 'WireframeGeometry'; if (geometry.isGeometry === true) { console.error('THREE.WireframeGeometry no longer supports THREE.Geometry. Use THREE.BufferGeometry instead.'); - return _assertThisInitialized(_this); + return; } // buffer - var vertices = []; // helper variables + const vertices = []; // helper variables - var edge = [0, 0], - edges = {}; - var vertex = new Vector3(); + const edge = [0, 0], + edges = {}; + const vertex = new Vector3(); if (geometry.index !== null) { // indexed BufferGeometry - var position = geometry.attributes.position; - var indices = geometry.index; - var groups = geometry.groups; + const position = geometry.attributes.position; + const indices = geometry.index; + let groups = geometry.groups; if (groups.length === 0) { groups = [{ @@ -24355,19 +23016,19 @@ } // create a data structure that contains all eges without duplicates - for (var o = 0, ol = groups.length; o < ol; ++o) { - var group = groups[o]; - var start = group.start; - var count = group.count; + for (let o = 0, ol = groups.length; o < ol; ++o) { + const group = groups[o]; + const start = group.start; + const count = group.count; - 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); + 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); edge[0] = Math.min(edge1, edge2); // sorting prevents duplicates edge[1] = Math.max(edge1, edge2); - var key = edge[0] + ',' + edge[1]; + const key = edge[0] + ',' + edge[1]; if (edges[key] === undefined) { edges[key] = { @@ -24380,8 +23041,8 @@ } // generate vertices - for (var _key in edges) { - var e = edges[_key]; + for (const key in edges) { + const e = edges[key]; vertex.fromBufferAttribute(position, e.index1); vertices.push(vertex.x, vertex.y, vertex.z); vertex.fromBufferAttribute(position, e.index2); @@ -24389,30 +23050,27 @@ } } else { // non-indexed BufferGeometry - var _position = geometry.attributes.position; + const position = geometry.attributes.position; - for (var _i = 0, _l = _position.count / 3; _i < _l; _i++) { - for (var _j = 0; _j < 3; _j++) { + for (let i = 0, l = position.count / 3; i < l; i++) { + for (let j = 0; j < 3; j++) { // three edges per triangle, an edge is represented as (index1, index2) // e.g. the first triangle has the following edges: (0,1),(1,2),(2,0) - var index1 = 3 * _i + _j; - vertex.fromBufferAttribute(_position, index1); + const index1 = 3 * i + j; + vertex.fromBufferAttribute(position, index1); vertices.push(vertex.x, vertex.y, vertex.z); - var index2 = 3 * _i + (_j + 1) % 3; - vertex.fromBufferAttribute(_position, index2); + const 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)); - - return _this; + this.setAttribute('position', new Float32BufferAttribute(vertices, 3)); } - return WireframeGeometry; - }(BufferGeometry); + } var Geometries = /*#__PURE__*/Object.freeze({ __proto__: null, @@ -24466,49 +23124,32 @@ * } */ - 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; + class ShadowMaterial extends Material { + constructor(parameters) { + super(); + this.type = 'ShadowMaterial'; + this.color = new Color(0x000000); + this.transparent = true; + this.setValues(parameters); } - var _proto = ShadowMaterial.prototype; - - _proto.copy = function copy(source) { - _Material.prototype.copy.call(this, source); - + copy(source) { + super.copy(source); this.color.copy(source.color); return this; - }; + } - return ShadowMaterial; - }(Material); + } ShadowMaterial.prototype.isShadowMaterial = true; - var RawShaderMaterial = /*#__PURE__*/function (_ShaderMaterial) { - _inheritsLoose(RawShaderMaterial, _ShaderMaterial); - - function RawShaderMaterial(parameters) { - var _this; - - _this = _ShaderMaterial.call(this, parameters) || this; - _this.type = 'RawShaderMaterial'; - return _this; + class RawShaderMaterial extends ShaderMaterial { + constructor(parameters) { + super(parameters); + this.type = 'RawShaderMaterial'; } - return RawShaderMaterial; - }(ShaderMaterial); + } RawShaderMaterial.prototype.isRawShaderMaterial = true; @@ -24689,10 +23330,10 @@ this.reflectivity = 0.5; // maps to F0 = 0.04 Object.defineProperty(this, 'ior', { - get: function get() { + get: function () { return (1 + 0.4 * this.reflectivity) / (1 - 0.4 * this.reflectivity); }, - set: function set(ior) { + set: function (ior) { this.reflectivity = MathUtils.clamp(2.5 * (ior - 1) / (ior + 1), 0, 1); } }); @@ -24782,59 +23423,49 @@ * } */ - 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); + 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); + } + copy(source) { + super.copy(source); this.color.copy(source.color); this.specular.copy(source.specular); this.shininess = source.shininess; @@ -24869,10 +23500,9 @@ this.morphNormals = source.morphNormals; this.flatShading = source.flatShading; return this; - }; + } - return MeshPhongMaterial; - }(Material); + } MeshPhongMaterial.prototype.isMeshPhongMaterial = true; @@ -24915,54 +23545,44 @@ * } */ - var MeshToonMaterial = /*#__PURE__*/function (_Material) { - _inheritsLoose(MeshToonMaterial, _Material); - - function MeshToonMaterial(parameters) { - var _this; - - _this = _Material.call(this) || this; - _this.defines = { + class MeshToonMaterial extends Material { + constructor(parameters) { + super(); + 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); - - return _this; - } - - var _proto = MeshToonMaterial.prototype; - - _proto.copy = function copy(source) { - _Material.prototype.copy.call(this, source); + 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); + } + copy(source) { + super.copy(source); this.color.copy(source.color); this.map = source.map; this.gradientMap = source.gradientMap; @@ -24990,10 +23610,9 @@ this.morphTargets = source.morphTargets; this.morphNormals = source.morphNormals; return this; - }; + } - return MeshToonMaterial; - }(Material); + } MeshToonMaterial.prototype.isMeshToonMaterial = true; @@ -25023,40 +23642,30 @@ * } */ - 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; + 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 _proto = MeshNormalMaterial.prototype; - - _proto.copy = function copy(source) { - _Material.prototype.copy.call(this, source); - + copy(source) { + super.copy(source); this.bumpMap = source.bumpMap; this.bumpScale = source.bumpScale; this.normalMap = source.normalMap; @@ -25072,10 +23681,9 @@ this.morphNormals = source.morphNormals; this.flatShading = source.flatShading; return this; - }; + } - return MeshNormalMaterial; - }(Material); + } MeshNormalMaterial.prototype.isMeshNormalMaterial = true; @@ -25114,48 +23722,38 @@ * } */ - var MeshLambertMaterial = /*#__PURE__*/function (_Material) { - _inheritsLoose(MeshLambertMaterial, _Material); - - function MeshLambertMaterial(parameters) { - var _this; + class MeshLambertMaterial extends Material { + constructor(parameters) { + super(); + this.type = 'MeshLambertMaterial'; + this.color = new Color(0xffffff); // diffuse - _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; + 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); } - var _proto = MeshLambertMaterial.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.lightMap = source.lightMap; @@ -25179,10 +23777,9 @@ this.morphTargets = source.morphTargets; this.morphNormals = source.morphNormals; return this; - }; + } - return MeshLambertMaterial; - }(Material); + } MeshLambertMaterial.prototype.isMeshLambertMaterial = true; @@ -25216,45 +23813,35 @@ * } */ - var MeshMatcapMaterial = /*#__PURE__*/function (_Material) { - _inheritsLoose(MeshMatcapMaterial, _Material); - - function MeshMatcapMaterial(parameters) { - var _this; - - _this = _Material.call(this) || this; - _this.defines = { + class MeshMatcapMaterial extends Material { + constructor(parameters) { + super(); + this.defines = { 'MATCAP': '' }; - _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.type = 'MeshMatcapMaterial'; + this.color = new Color(0xffffff); // diffuse - _this.setValues(parameters); - - return _this; + 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); } - var _proto = MeshMatcapMaterial.prototype; - - _proto.copy = function copy(source) { - _Material.prototype.copy.call(this, source); - + copy(source) { + super.copy(source); this.defines = { 'MATCAP': '' }; @@ -25275,10 +23862,9 @@ this.morphNormals = source.morphNormals; this.flatShading = source.flatShading; return this; - }; + } - return MeshMatcapMaterial; - }(Material); + } MeshMatcapMaterial.prototype.isMeshMatcapMaterial = true; @@ -25295,36 +23881,25 @@ * } */ - 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; + class LineDashedMaterial extends LineBasicMaterial { + constructor(parameters) { + super(); + this.type = 'LineDashedMaterial'; + this.scale = 1; + this.dashSize = 3; + this.gapSize = 1; + this.setValues(parameters); } - var _proto = LineDashedMaterial.prototype; - - _proto.copy = function copy(source) { - _LineBasicMaterial.prototype.copy.call(this, source); - + copy(source) { + super.copy(source); this.scale = source.scale; this.dashSize = source.dashSize; this.gapSize = source.gapSize; return this; - }; + } - return LineDashedMaterial; - }(LineBasicMaterial); + } LineDashedMaterial.prototype.isLineDashedMaterial = true; @@ -25350,9 +23925,9 @@ Material: Material }); - var AnimationUtils = { + const AnimationUtils = { // same as Array.prototype.slice, but also works on typed arrays - arraySlice: function arraySlice(array, from, to) { + arraySlice: function (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 @@ -25362,7 +23937,7 @@ return array.slice(from, to); }, // converts an array to a specific type - convertArray: function convertArray(array, type, forceClone) { + convertArray: function (array, type, forceClone) { if (!array || // let 'undefined' and 'null' pass !forceClone && array.constructor === type) return array; @@ -25372,34 +23947,32 @@ return Array.prototype.slice.call(array); // create Array }, - isTypedArray: function isTypedArray(object) { + isTypedArray: function (object) { return ArrayBuffer.isView(object) && !(object instanceof DataView); }, // returns an array by which times and values can be sorted - getKeyframeOrder: function getKeyframeOrder(times) { + getKeyframeOrder: function (times) { function compareTime(i, j) { return times[i] - times[j]; } - var n = times.length; - var result = new Array(n); + const n = times.length; + const result = new Array(n); - for (var i = 0; i !== n; ++i) { - result[i] = i; - } + for (let 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 sortedArray(values, stride, order) { - var nValues = values.length; - var result = new values.constructor(nValues); + sortedArray: function (values, stride, order) { + const nValues = values.length; + const result = new values.constructor(nValues); - for (var i = 0, dstOffset = 0; dstOffset !== nValues; ++i) { - var srcOffset = order[i] * stride; + for (let i = 0, dstOffset = 0; dstOffset !== nValues; ++i) { + const srcOffset = order[i] * stride; - for (var j = 0; j !== stride; ++j) { + for (let j = 0; j !== stride; ++j) { result[dstOffset++] = values[srcOffset + j]; } } @@ -25407,8 +23980,8 @@ return result; }, // function for parsing AOS keyframe formats - flattenJSON: function flattenJSON(jsonKeys, times, values, valuePropertyName) { - var i = 1, + flattenJSON: function (jsonKeys, times, values, valuePropertyName) { + let i = 1, key = jsonKeys[0]; while (key !== undefined && key[valuePropertyName] === undefined) { @@ -25417,7 +23990,7 @@ if (key === undefined) return; // no data - var value = key[valuePropertyName]; + let value = key[valuePropertyName]; if (value === undefined) return; // no data if (Array.isArray(value)) { @@ -25457,27 +24030,23 @@ } while (key !== undefined); } }, - subclip: function subclip(sourceClip, name, startFrame, endFrame, fps) { - if (fps === void 0) { - fps = 30; - } - - var clip = sourceClip.clone(); + subclip: function (sourceClip, name, startFrame, endFrame, fps = 30) { + const clip = sourceClip.clone(); clip.name = name; - var tracks = []; + const tracks = []; - for (var i = 0; i < clip.tracks.length; ++i) { - var track = clip.tracks[i]; - var valueSize = track.getValueSize(); - var times = []; - var values = []; + for (let i = 0; i < clip.tracks.length; ++i) { + const track = clip.tracks[i]; + const valueSize = track.getValueSize(); + const times = []; + const values = []; - for (var j = 0; j < track.times.length; ++j) { - var frame = track.times[j] * fps; + for (let j = 0; j < track.times.length; ++j) { + const frame = track.times[j] * fps; if (frame < startFrame || frame >= endFrame) continue; times.push(track.times[j]); - for (var k = 0; k < valueSize; ++k) { + for (let k = 0; k < valueSize; ++k) { values.push(track.values[j * valueSize + k]); } } @@ -25490,118 +24059,96 @@ clip.tracks = tracks; // find minimum .times value across all tracks in the trimmed clip - var minStartTime = Infinity; + let minStartTime = Infinity; - for (var _i = 0; _i < clip.tracks.length; ++_i) { - if (minStartTime > clip.tracks[_i].times[0]) { - minStartTime = clip.tracks[_i].times[0]; + for (let i = 0; i < clip.tracks.length; ++i) { + if (minStartTime > clip.tracks[i].times[0]) { + minStartTime = clip.tracks[i].times[0]; } } // shift all tracks such that clip begins at t=0 - for (var _i2 = 0; _i2 < clip.tracks.length; ++_i2) { - clip.tracks[_i2].shift(-1 * minStartTime); + for (let i = 0; i < clip.tracks.length; ++i) { + clip.tracks[i].shift(-1 * minStartTime); } clip.resetDuration(); return clip; }, - 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; - } - + makeClipAdditive: function (targetClip, referenceFrame = 0, referenceClip = targetClip, fps = 30) { if (fps <= 0) fps = 30; - var numTracks = referenceClip.tracks.length; - var referenceTime = referenceFrame / fps; // Make each track's values relative to the values at the reference frame + const numTracks = referenceClip.tracks.length; + const referenceTime = referenceFrame / fps; // Make each track's values relative to the values at the reference frame - var _loop = function _loop(i) { - var referenceTrack = referenceClip.tracks[i]; - var referenceTrackType = referenceTrack.ValueTypeName; // Skip this track if it's non-numeric + for (let i = 0; i < numTracks; ++i) { + const referenceTrack = referenceClip.tracks[i]; + const referenceTrackType = referenceTrack.ValueTypeName; // Skip this track if it's non-numeric - if (referenceTrackType === 'bool' || referenceTrackType === 'string') return "continue"; // Find the track in the target clip whose name and type matches the reference track + if (referenceTrackType === 'bool' || referenceTrackType === 'string') continue; // Find the track in the target clip whose name and type matches the reference track - var targetTrack = targetClip.tracks.find(function (track) { + const targetTrack = targetClip.tracks.find(function (track) { return track.name === referenceTrack.name && track.ValueTypeName === referenceTrackType; }); - if (targetTrack === undefined) return "continue"; - var referenceOffset = 0; - var referenceValueSize = referenceTrack.getValueSize(); + if (targetTrack === undefined) continue; + let referenceOffset = 0; + const referenceValueSize = referenceTrack.getValueSize(); if (referenceTrack.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline) { referenceOffset = referenceValueSize / 3; } - var targetOffset = 0; - var targetValueSize = targetTrack.getValueSize(); + let targetOffset = 0; + const targetValueSize = targetTrack.getValueSize(); if (targetTrack.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline) { targetOffset = targetValueSize / 3; } - var lastIndex = referenceTrack.times.length - 1; - var referenceValue = void 0; // Find the value to subtract out of the track + const lastIndex = referenceTrack.times.length - 1; + let referenceValue; // Find the value to subtract out of the track if (referenceTime <= referenceTrack.times[0]) { // Reference frame is earlier than the first keyframe, so just use the first keyframe - var startIndex = referenceOffset; - var endIndex = referenceValueSize - referenceOffset; + const startIndex = referenceOffset; + const 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 - var _startIndex = lastIndex * referenceValueSize + referenceOffset; - - var _endIndex = _startIndex + referenceValueSize - referenceOffset; - - referenceValue = AnimationUtils.arraySlice(referenceTrack.values, _startIndex, _endIndex); + const startIndex = lastIndex * referenceValueSize + referenceOffset; + const endIndex = startIndex + referenceValueSize - referenceOffset; + referenceValue = AnimationUtils.arraySlice(referenceTrack.values, startIndex, endIndex); } else { // Interpolate to the reference value - var interpolant = referenceTrack.createInterpolant(); - var _startIndex2 = referenceOffset; - - var _endIndex2 = referenceValueSize - referenceOffset; - + const interpolant = referenceTrack.createInterpolant(); + const startIndex = referenceOffset; + const endIndex = referenceValueSize - referenceOffset; interpolant.evaluate(referenceTime); - referenceValue = AnimationUtils.arraySlice(interpolant.resultBuffer, _startIndex2, _endIndex2); + referenceValue = AnimationUtils.arraySlice(interpolant.resultBuffer, startIndex, endIndex); } // Conjugate the quaternion if (referenceTrackType === 'quaternion') { - var referenceQuat = new Quaternion().fromArray(referenceValue).normalize().conjugate(); + const referenceQuat = new Quaternion().fromArray(referenceValue).normalize().conjugate(); referenceQuat.toArray(referenceValue); } // Subtract the reference value from all of the track values - var numTimes = targetTrack.times.length; + const numTimes = targetTrack.times.length; - for (var j = 0; j < numTimes; ++j) { - var valueStart = j * targetValueSize + targetOffset; + for (let j = 0; j < numTimes; ++j) { + const valueStart = j * targetValueSize + targetOffset; if (referenceTrackType === 'quaternion') { // Multiply the conjugate for quaternion track types Quaternion.multiplyQuaternionsFlat(targetTrack.values, valueStart, referenceValue, 0, targetTrack.values, valueStart); } else { - var valueEnd = targetValueSize - targetOffset * 2; // Subtract each value for all other numeric track types + const valueEnd = targetValueSize - targetOffset * 2; // Subtract each value for all other numeric track types - for (var k = 0; k < valueEnd; ++k) { + for (let 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; @@ -25638,15 +24185,15 @@ } Object.assign(Interpolant.prototype, { - evaluate: function evaluate(t) { - var pp = this.parameterPositions; - var i1 = this._cachedIndex, + evaluate: function (t) { + const pp = this.parameterPositions; + let i1 = this._cachedIndex, t1 = pp[i1], t0 = pp[i1 - 1]; validate_interval: { seek: { - var right; + let right; linear_scan: { //- See http://jsperf.com/comparison-to-undefined/3 @@ -25654,7 +24201,7 @@ //- //- if ( t >= t1 || t1 === undefined ) { forward_scan: if (!(t < t1)) { - for (var giveUpAt = i1 + 2;;) { + for (let giveUpAt = i1 + 2;;) { if (t1 === undefined) { if (t < t0) break forward_scan; // after end @@ -25683,7 +24230,7 @@ if (!(t >= t0)) { // looping? - var t1global = pp[1]; + const t1global = pp[1]; if (t < t1global) { i1 = 2; // + 1, using the scan for the details @@ -25692,14 +24239,14 @@ } // linear reverse scan - for (var _giveUpAt = i1 - 2;;) { + for (let giveUpAt = i1 - 2;;) { if (t0 === undefined) { // before start this._cachedIndex = 0; return this.beforeStart_(0, t, t1); } - if (i1 === _giveUpAt) break; // this loop + if (i1 === giveUpAt) break; // this loop t1 = t0; t0 = pp[--i1 - 1]; @@ -25723,7 +24270,7 @@ while (i1 < right) { - var mid = i1 + right >>> 1; + const mid = i1 + right >>> 1; if (t < pp[mid]) { right = mid; @@ -25760,29 +24307,29 @@ // Note: The indirection allows central control of many interpolants. // --- Protected interface DefaultSettings_: {}, - getSettings_: function getSettings_() { + getSettings_: function () { return this.settings || this.DefaultSettings_; }, - copySampleValue_: function copySampleValue_(index) { + copySampleValue_: function (index) { // copies a sample value to the result buffer - var result = this.resultBuffer, - values = this.sampleValues, - stride = this.valueSize, - offset = index * stride; + const result = this.resultBuffer, + values = this.sampleValues, + stride = this.valueSize, + offset = index * stride; - for (var i = 0; i !== stride; ++i) { + for (let i = 0; i !== stride; ++i) { result[i] = values[offset + i]; } return result; }, // Template methods for derived classes: - interpolate_: function interpolate_() + interpolate_: function () /* i1, t0, t, t1 */ { throw new Error('call to abstract method'); // implementations shall return this.resultBuffer }, - intervalChanged_: function intervalChanged_() + intervalChanged_: function () /* i1, t0, t1 */ {// empty } @@ -25817,9 +24364,9 @@ endingStart: ZeroCurvatureEnding, endingEnd: ZeroCurvatureEnding }, - intervalChanged_: function intervalChanged_(i1, t0, t1) { - var pp = this.parameterPositions; - var iPrev = i1 - 2, + intervalChanged_: function (i1, t0, t1) { + const pp = this.parameterPositions; + let iPrev = i1 - 2, iNext = i1 + 1, tPrev = pp[iPrev], tNext = pp[iNext]; @@ -25868,33 +24415,33 @@ } } - var halfDt = (t1 - t0) * 0.5, - stride = this.valueSize; + const 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 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) { + 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) { result[i] = sP * values[oP + i] + s0 * values[o0 + i] + s1 * values[o1 + i] + sN * values[oN + i]; } @@ -25908,16 +24455,16 @@ LinearInterpolant.prototype = Object.assign(Object.create(Interpolant.prototype), { constructor: LinearInterpolant, - 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) { + 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) { result[i] = values[offset0 + i] * weight0 + values[offset1 + i] * weight1; } @@ -25937,15 +24484,15 @@ DiscreteInterpolant.prototype = Object.assign(Object.create(Interpolant.prototype), { constructor: DiscreteInterpolant, - interpolate_: function interpolate_(i1 + interpolate_: function (i1 /*, t0, t, t1 */ ) { return this.copySampleValue_(i1 - 1); } }); - var KeyframeTrack = /*#__PURE__*/function () { - function KeyframeTrack(name, times, values, interpolation) { + class KeyframeTrack { + constructor(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; @@ -25956,9 +24503,9 @@ // and automatic invocation of .toJSON): - KeyframeTrack.toJSON = function toJSON(track) { - var trackType = track.constructor; - var json; // derived classes can define a static toJSON method + static toJSON(track) { + const trackType = track.constructor; + let json; // derived classes can define a static toJSON method if (trackType.toJSON !== this.toJSON) { json = trackType.toJSON(track); @@ -25969,7 +24516,7 @@ 'times': AnimationUtils.convertArray(track.times, Array), 'values': AnimationUtils.convertArray(track.values, Array) }; - var interpolation = track.getInterpolation(); + const interpolation = track.getInterpolation(); if (interpolation !== track.DefaultInterpolation) { json.interpolation = interpolation; @@ -25979,24 +24526,22 @@ json.type = track.ValueTypeName; // mandatory return json; - }; - - var _proto = KeyframeTrack.prototype; + } - _proto.InterpolantFactoryMethodDiscrete = function InterpolantFactoryMethodDiscrete(result) { + InterpolantFactoryMethodDiscrete(result) { return new DiscreteInterpolant(this.times, this.values, this.getValueSize(), result); - }; + } - _proto.InterpolantFactoryMethodLinear = function InterpolantFactoryMethodLinear(result) { + InterpolantFactoryMethodLinear(result) { return new LinearInterpolant(this.times, this.values, this.getValueSize(), result); - }; + } - _proto.InterpolantFactoryMethodSmooth = function InterpolantFactoryMethodSmooth(result) { + InterpolantFactoryMethodSmooth(result) { return new CubicInterpolant(this.times, this.values, this.getValueSize(), result); - }; + } - _proto.setInterpolation = function setInterpolation(interpolation) { - var factoryMethod; + setInterpolation(interpolation) { + let factoryMethod; switch (interpolation) { case InterpolateDiscrete: @@ -26013,7 +24558,7 @@ } if (factoryMethod === undefined) { - var message = 'unsupported interpolation for ' + this.ValueTypeName + ' keyframe track named ' + this.name; + const message = 'unsupported interpolation for ' + this.ValueTypeName + ' keyframe track named ' + this.name; if (this.createInterpolant === undefined) { // fall back to default, unless the default itself is messed up @@ -26030,9 +24575,9 @@ this.createInterpolant = factoryMethod; return this; - }; + } - _proto.getInterpolation = function getInterpolation() { + getInterpolation() { switch (this.createInterpolant) { case this.InterpolantFactoryMethodDiscrete: return InterpolateDiscrete; @@ -26043,31 +24588,31 @@ case this.InterpolantFactoryMethodSmooth: return InterpolateSmooth; } - }; + } - _proto.getValueSize = function getValueSize() { + getValueSize() { return this.values.length / this.times.length; } // move all keyframes either forwards or backwards in time - ; - _proto.shift = function shift(timeOffset) { + + shift(timeOffset) { if (timeOffset !== 0.0) { - var times = this.times; + const times = this.times; - for (var i = 0, n = times.length; i !== n; ++i) { + for (let i = 0, n = times.length; i !== n; ++i) { times[i] += timeOffset; } } return this; } // scale all keyframe times by a factor (useful for frame <-> seconds conversions) - ; - _proto.scale = function scale(timeScale) { + + scale(timeScale) { if (timeScale !== 1.0) { - var times = this.times; + const times = this.times; - for (var i = 0, n = times.length; i !== n; ++i) { + for (let i = 0, n = times.length; i !== n; ++i) { times[i] *= timeScale; } } @@ -26075,12 +24620,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 - ; - _proto.trim = function trim(startTime, endTime) { - var times = this.times, - nKeys = times.length; - var from = 0, + + trim(startTime, endTime) { + const times = this.times, + nKeys = times.length; + let from = 0, to = nKeys - 1; while (from !== nKeys && times[from] < startTime) { @@ -26100,37 +24645,37 @@ from = to - 1; } - var stride = this.getValueSize(); + const stride = this.getValueSize(); this.times = AnimationUtils.arraySlice(times, from, to); this.values = AnimationUtils.arraySlice(this.values, from * stride, to * stride); } return this; } // ensure we do not get a GarbageInGarbageOut situation, make sure tracks are at least minimally viable - ; - _proto.validate = function validate() { - var valid = true; - var valueSize = this.getValueSize(); + + validate() { + let valid = true; + const valueSize = this.getValueSize(); if (valueSize - Math.floor(valueSize) !== 0) { console.error('THREE.KeyframeTrack: Invalid value size in track.', this); valid = false; } - var times = this.times, - values = this.values, - nKeys = times.length; + const times = this.times, + values = this.values, + nKeys = times.length; if (nKeys === 0) { console.error('THREE.KeyframeTrack: Track is empty.', this); valid = false; } - var prevTime = null; + let prevTime = null; - for (var i = 0; i !== nKeys; i++) { - var currTime = times[i]; + for (let i = 0; i !== nKeys; i++) { + const currTime = times[i]; if (typeof currTime === 'number' && isNaN(currTime)) { console.error('THREE.KeyframeTrack: Time is not a valid number.', this, i, currTime); @@ -26149,11 +24694,11 @@ if (values !== undefined) { if (AnimationUtils.isTypedArray(values)) { - for (var _i = 0, n = values.length; _i !== n; ++_i) { - var value = values[_i]; + for (let i = 0, n = values.length; i !== n; ++i) { + const value = values[i]; if (isNaN(value)) { - console.error('THREE.KeyframeTrack: Value is not a valid number.', this, _i, value); + console.error('THREE.KeyframeTrack: Value is not a valid number.', this, i, value); valid = false; break; } @@ -26164,31 +24709,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) - ; - _proto.optimize = function optimize() { + + optimize() { // times or values may be shared with other tracks, so overwriting is unsafe - 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 + 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 if (time !== timeNext && (i !== 1 || time !== times[0])) { if (!smoothInterpolation) { // remove unnecessary keyframes same as their neighbors - var offset = i * stride, - offsetP = offset - stride, - offsetN = offset + stride; + const offset = i * stride, + offsetP = offset - stride, + offsetN = offset + stride; - for (var j = 0; j !== stride; ++j) { - var value = values[offset + j]; + for (let j = 0; j !== stride; ++j) { + const value = values[offset + j]; if (value !== values[offsetP + j] || value !== values[offsetN + j]) { keep = true; @@ -26204,11 +24749,11 @@ if (keep) { if (i !== writeIndex) { times[writeIndex] = times[i]; - var readOffset = i * stride, - writeOffset = writeIndex * stride; + const readOffset = i * stride, + writeOffset = writeIndex * stride; - for (var _j = 0; _j !== stride; ++_j) { - values[writeOffset + _j] = values[readOffset + _j]; + for (let j = 0; j !== stride; ++j) { + values[writeOffset + j] = values[readOffset + j]; } } @@ -26220,8 +24765,8 @@ if (lastIndex > 0) { times[writeIndex] = times[lastIndex]; - for (var _readOffset = lastIndex * stride, _writeOffset = writeIndex * stride, _j2 = 0; _j2 !== stride; ++_j2) { - values[_writeOffset + _j2] = values[_readOffset + _j2]; + for (let readOffset = lastIndex * stride, writeOffset = writeIndex * stride, j = 0; j !== stride; ++j) { + values[writeOffset + j] = values[readOffset + j]; } ++writeIndex; @@ -26236,20 +24781,19 @@ } return this; - }; + } - _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. + 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. track.createInterpolant = this.createInterpolant; return track; - }; + } - return KeyframeTrack; - }(); + } KeyframeTrack.prototype.TimeBufferType = Float32Array; KeyframeTrack.prototype.ValueBufferType = Float32Array; @@ -26259,15 +24803,7 @@ * A Track of Boolean keyframe values. */ - var BooleanKeyframeTrack = /*#__PURE__*/function (_KeyframeTrack) { - _inheritsLoose(BooleanKeyframeTrack, _KeyframeTrack); - - function BooleanKeyframeTrack() { - return _KeyframeTrack.apply(this, arguments) || this; - } - - return BooleanKeyframeTrack; - }(KeyframeTrack); + class BooleanKeyframeTrack extends KeyframeTrack {} BooleanKeyframeTrack.prototype.ValueTypeName = 'bool'; BooleanKeyframeTrack.prototype.ValueBufferType = Array; @@ -26279,15 +24815,7 @@ * A Track of keyframe values that represent color. */ - var ColorKeyframeTrack = /*#__PURE__*/function (_KeyframeTrack) { - _inheritsLoose(ColorKeyframeTrack, _KeyframeTrack); - - function ColorKeyframeTrack() { - return _KeyframeTrack.apply(this, arguments) || this; - } - - return ColorKeyframeTrack; - }(KeyframeTrack); + class ColorKeyframeTrack extends KeyframeTrack {} ColorKeyframeTrack.prototype.ValueTypeName = 'color'; // ValueBufferType is inherited @@ -26295,15 +24823,7 @@ * A Track of numeric keyframe values. */ - var NumberKeyframeTrack = /*#__PURE__*/function (_KeyframeTrack) { - _inheritsLoose(NumberKeyframeTrack, _KeyframeTrack); - - function NumberKeyframeTrack() { - return _KeyframeTrack.apply(this, arguments) || this; - } - - return NumberKeyframeTrack; - }(KeyframeTrack); + class NumberKeyframeTrack extends KeyframeTrack {} NumberKeyframeTrack.prototype.ValueTypeName = 'number'; // ValueBufferType is inherited @@ -26317,14 +24837,14 @@ QuaternionLinearInterpolant.prototype = Object.assign(Object.create(Interpolant.prototype), { constructor: QuaternionLinearInterpolant, - 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) { + 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) { Quaternion.slerpFlat(result, 0, values, offset - stride, values, offset, alpha); } @@ -26336,21 +24856,12 @@ * A Track of quaternion keyframe values. */ - 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) { + class QuaternionKeyframeTrack extends KeyframeTrack { + InterpolantFactoryMethodLinear(result) { return new QuaternionLinearInterpolant(this.times, this.values, this.getValueSize(), result); - }; + } - return QuaternionKeyframeTrack; - }(KeyframeTrack); + } QuaternionKeyframeTrack.prototype.ValueTypeName = 'quaternion'; // ValueBufferType is inherited @@ -26361,15 +24872,7 @@ * A Track that interpolates Strings */ - var StringKeyframeTrack = /*#__PURE__*/function (_KeyframeTrack) { - _inheritsLoose(StringKeyframeTrack, _KeyframeTrack); - - function StringKeyframeTrack() { - return _KeyframeTrack.apply(this, arguments) || this; - } - - return StringKeyframeTrack; - }(KeyframeTrack); + class StringKeyframeTrack extends KeyframeTrack {} StringKeyframeTrack.prototype.ValueTypeName = 'string'; StringKeyframeTrack.prototype.ValueBufferType = Array; @@ -26381,28 +24884,12 @@ * A Track of vectored keyframe values. */ - var VectorKeyframeTrack = /*#__PURE__*/function (_KeyframeTrack) { - _inheritsLoose(VectorKeyframeTrack, _KeyframeTrack); - - function VectorKeyframeTrack() { - return _KeyframeTrack.apply(this, arguments) || this; - } - - return VectorKeyframeTrack; - }(KeyframeTrack); + class VectorKeyframeTrack extends KeyframeTrack {} VectorKeyframeTrack.prototype.ValueTypeName = 'vector'; // ValueBufferType is inherited - var AnimationClip = /*#__PURE__*/function () { - function AnimationClip(name, duration, tracks, blendMode) { - if (duration === void 0) { - duration = -1; - } - - if (blendMode === void 0) { - blendMode = NormalAnimationBlendMode; - } - + class AnimationClip { + constructor(name, duration = -1, tracks, blendMode = NormalAnimationBlendMode) { this.name = name; this.tracks = tracks; this.duration = duration; @@ -26414,24 +24901,24 @@ } } - AnimationClip.parse = function parse(json) { - var tracks = [], - jsonTracks = json.tracks, - frameTime = 1.0 / (json.fps || 1.0); + static parse(json) { + const tracks = [], + jsonTracks = json.tracks, + frameTime = 1.0 / (json.fps || 1.0); - for (var i = 0, n = jsonTracks.length; i !== n; ++i) { + for (let i = 0, n = jsonTracks.length; i !== n; ++i) { tracks.push(parseKeyframeTrack(jsonTracks[i]).scale(frameTime)); } - var clip = new this(json.name, json.duration, tracks, json.blendMode); + const clip = new this(json.name, json.duration, tracks, json.blendMode); clip.uuid = json.uuid; return clip; - }; + } - AnimationClip.toJSON = function toJSON(clip) { - var tracks = [], - clipTracks = clip.tracks; - var json = { + static toJSON(clip) { + const tracks = [], + clipTracks = clip.tracks; + const json = { 'name': clip.name, 'duration': clip.duration, 'tracks': tracks, @@ -26439,23 +24926,23 @@ 'blendMode': clip.blendMode }; - for (var i = 0, n = clipTracks.length; i !== n; ++i) { + for (let i = 0, n = clipTracks.length; i !== n; ++i) { tracks.push(KeyframeTrack.toJSON(clipTracks[i])); } return json; - }; + } - AnimationClip.CreateFromMorphTargetSequence = function CreateFromMorphTargetSequence(name, morphTargetSequence, fps, noLoop) { - var numMorphTargets = morphTargetSequence.length; - var tracks = []; + static CreateFromMorphTargetSequence(name, morphTargetSequence, fps, noLoop) { + const numMorphTargets = morphTargetSequence.length; + const tracks = []; - for (var i = 0; i < numMorphTargets; i++) { - var times = []; - var values = []; + for (let i = 0; i < numMorphTargets; i++) { + let times = []; + let values = []; times.push((i + numMorphTargets - 1) % numMorphTargets, i, (i + 1) % numMorphTargets); values.push(0, 1, 0); - var order = AnimationUtils.getKeyframeOrder(times); + const order = AnimationUtils.getKeyframeOrder(times); times = AnimationUtils.sortedArray(times, 1, order); values = AnimationUtils.sortedArray(values, 1, order); // if there is a key at the first frame, duplicate it as the // last frame as well for perfect loop. @@ -26469,39 +24956,39 @@ } return new this(name, -1, tracks); - }; + } - AnimationClip.findByName = function findByName(objectOrClipArray, name) { - var clipArray = objectOrClipArray; + static findByName(objectOrClipArray, name) { + let clipArray = objectOrClipArray; if (!Array.isArray(objectOrClipArray)) { - var o = objectOrClipArray; + const o = objectOrClipArray; clipArray = o.geometry && o.geometry.animations || o.animations; } - for (var i = 0; i < clipArray.length; i++) { + for (let i = 0; i < clipArray.length; i++) { if (clipArray[i].name === name) { return clipArray[i]; } } return null; - }; + } - AnimationClip.CreateClipsFromMorphTargetSequences = function CreateClipsFromMorphTargetSequences(morphTargets, fps, noLoop) { - var animationToMorphTargets = {}; // tested with https://regex101.com/ on trick sequences + static CreateClipsFromMorphTargetSequences(morphTargets, fps, noLoop) { + const animationToMorphTargets = {}; // tested with https://regex101.com/ on trick sequences // such flamingo_flyA_003, flamingo_run1_003, crdeath0059 - var pattern = /^([\w-]*?)([\d]+)$/; // sort morph target names into animation groups based + const pattern = /^([\w-]*?)([\d]+)$/; // sort morph target names into animation groups based // patterns like Walk_001, Walk_002, Run_001, Run_002 - for (var i = 0, il = morphTargets.length; i < il; i++) { - var morphTarget = morphTargets[i]; - var parts = morphTarget.name.match(pattern); + for (let i = 0, il = morphTargets.length; i < il; i++) { + const morphTarget = morphTargets[i]; + const parts = morphTarget.name.match(pattern); if (parts && parts.length > 1) { - var name = parts[1]; - var animationMorphTargets = animationToMorphTargets[name]; + const name = parts[1]; + let animationMorphTargets = animationToMorphTargets[name]; if (!animationMorphTargets) { animationToMorphTargets[name] = animationMorphTargets = []; @@ -26511,27 +24998,27 @@ } } - var clips = []; + const clips = []; - for (var _name in animationToMorphTargets) { - clips.push(this.CreateFromMorphTargetSequence(_name, animationToMorphTargets[_name], fps, noLoop)); + for (const name in animationToMorphTargets) { + clips.push(this.CreateFromMorphTargetSequence(name, animationToMorphTargets[name], fps, noLoop)); } return clips; } // parse the animation.hierarchy format - ; - AnimationClip.parseAnimation = function parseAnimation(animation, bones) { + + static parseAnimation(animation, bones) { if (!animation) { console.error('THREE.AnimationClip: No animation in JSONLoader data.'); return null; } - var addNonemptyTrack = function addNonemptyTrack(trackType, trackName, animationKeys, propertyName, destTracks) { + const addNonemptyTrack = function (trackType, trackName, animationKeys, propertyName, destTracks) { // only return track if there are actually keys. if (animationKeys.length !== 0) { - var times = []; - var values = []; + const times = []; + const values = []; AnimationUtils.flattenJSON(animationKeys, times, values, propertyName); // empty keys are filtered out, so check again if (times.length !== 0) { @@ -26540,27 +25027,27 @@ } }; - var tracks = []; - var clipName = animation.name || 'default'; - var fps = animation.fps || 30; - var blendMode = animation.blendMode; // automatic length determination in AnimationClip. + const tracks = []; + const clipName = animation.name || 'default'; + const fps = animation.fps || 30; + const blendMode = animation.blendMode; // automatic length determination in AnimationClip. - var duration = animation.length || -1; - var hierarchyTracks = animation.hierarchy || []; + let duration = animation.length || -1; + const hierarchyTracks = animation.hierarchy || []; - for (var h = 0; h < hierarchyTracks.length; h++) { - var animationKeys = hierarchyTracks[h].keys; // skip empty tracks + for (let h = 0; h < hierarchyTracks.length; h++) { + const 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 - var morphTargetNames = {}; - var k = void 0; + const morphTargetNames = {}; + let k; for (k = 0; k < animationKeys.length; k++) { if (animationKeys[k].morphTargets) { - for (var m = 0; m < animationKeys[k].morphTargets.length; m++) { + for (let m = 0; m < animationKeys[k].morphTargets.length; m++) { morphTargetNames[animationKeys[k].morphTargets[m]] = -1; } } @@ -26569,12 +25056,12 @@ // the morphTarget is named. - for (var morphTargetName in morphTargetNames) { - var times = []; - var values = []; + for (const morphTargetName in morphTargetNames) { + const times = []; + const values = []; - for (var _m = 0; _m !== animationKeys[k].morphTargets.length; ++_m) { - var animationKey = animationKeys[k]; + for (let m = 0; m !== animationKeys[k].morphTargets.length; ++m) { + const animationKey = animationKeys[k]; times.push(animationKey.time); values.push(animationKey.morphTarget === morphTargetName ? 1 : 0); } @@ -26585,7 +25072,7 @@ duration = morphTargetNames.length * (fps || 1.0); } else { // ...assume skeletal animation - var boneName = '.bones[' + bones[h].name + ']'; + const boneName = '.bones[' + bones[h].name + ']'; addNonemptyTrack(VectorKeyframeTrack, boneName + '.position', animationKeys, 'pos', tracks); addNonemptyTrack(QuaternionKeyframeTrack, boneName + '.quaternion', animationKeys, 'rot', tracks); addNonemptyTrack(VectorKeyframeTrack, boneName + '.scale', animationKeys, 'scl', tracks); @@ -26596,67 +25083,64 @@ return null; } - var clip = new this(clipName, duration, tracks, blendMode); + const clip = new this(clipName, duration, tracks, blendMode); return clip; - }; - - var _proto = AnimationClip.prototype; + } - _proto.resetDuration = function resetDuration() { - var tracks = this.tracks; - var duration = 0; + resetDuration() { + const tracks = this.tracks; + let duration = 0; - for (var i = 0, n = tracks.length; i !== n; ++i) { - var track = this.tracks[i]; + for (let i = 0, n = tracks.length; i !== n; ++i) { + const track = this.tracks[i]; duration = Math.max(duration, track.times[track.times.length - 1]); } this.duration = duration; return this; - }; + } - _proto.trim = function trim() { - for (var i = 0; i < this.tracks.length; i++) { + trim() { + for (let i = 0; i < this.tracks.length; i++) { this.tracks[i].trim(0, this.duration); } return this; - }; + } - _proto.validate = function validate() { - var valid = true; + validate() { + let valid = true; - for (var i = 0; i < this.tracks.length; i++) { + for (let i = 0; i < this.tracks.length; i++) { valid = valid && this.tracks[i].validate(); } return valid; - }; + } - _proto.optimize = function optimize() { - for (var i = 0; i < this.tracks.length; i++) { + optimize() { + for (let i = 0; i < this.tracks.length; i++) { this.tracks[i].optimize(); } return this; - }; + } - _proto.clone = function clone() { - var tracks = []; + clone() { + const tracks = []; - for (var i = 0; i < this.tracks.length; i++) { + for (let i = 0; i < this.tracks.length; i++) { tracks.push(this.tracks[i].clone()); } return new this.constructor(this.name, this.duration, tracks, this.blendMode); - }; + } - _proto.toJSON = function toJSON() { + toJSON() { return this.constructor.toJSON(this); - }; + } - return AnimationClip; - }(); + } function getTrackTypeForValueTypeName(typeName) { switch (typeName.toLowerCase()) { @@ -26695,11 +25179,11 @@ throw new Error('THREE.KeyframeTrack: track type undefined, can not parse'); } - var trackType = getTrackTypeForValueTypeName(json.type); + const trackType = getTrackTypeForValueTypeName(json.type); if (json.times === undefined) { - var times = [], - values = []; + const times = [], + values = []; AnimationUtils.flattenJSON(json.keys, times, values, 'value'); json.times = times; json.values = values; @@ -26714,34 +25198,34 @@ } } - var Cache = { + const Cache = { enabled: false, files: {}, - add: function add(key, file) { + add: function (key, file) { if (this.enabled === false) return; // console.log( 'THREE.Cache', 'Adding key:', key ); this.files[key] = file; }, - get: function get(key) { + get: function (key) { if (this.enabled === false) return; // console.log( 'THREE.Cache', 'Checking key:', key ); return this.files[key]; }, - remove: function remove(key) { + remove: function (key) { delete this.files[key]; }, - clear: function clear() { + clear: function () { this.files = {}; } }; function LoadingManager(onLoad, onProgress, onError) { - 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 + 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 // in the constructor this.onStart = undefined; @@ -26802,7 +25286,7 @@ }; this.removeHandler = function (regex) { - var index = handlers.indexOf(regex); + const index = handlers.indexOf(regex); if (index !== -1) { handlers.splice(index, 2); @@ -26812,9 +25296,9 @@ }; this.getHandler = function (file) { - for (var i = 0, l = handlers.length; i < l; i += 2) { - var regex = handlers[i]; - var loader = handlers[i + 1]; + for (let i = 0, l = handlers.length; i < l; i += 2) { + const regex = handlers[i]; + const loader = handlers[i + 1]; if (regex.global) regex.lastIndex = 0; // see #17920 if (regex.test(file)) { @@ -26826,7 +25310,7 @@ }; } - var DefaultLoadingManager = new LoadingManager(); + const DefaultLoadingManager = new LoadingManager(); function Loader(manager) { this.manager = manager !== undefined ? manager : DefaultLoadingManager; @@ -26838,41 +25322,41 @@ } Object.assign(Loader.prototype, { - load: function load() + load: function () /* url, onLoad, onProgress, onError */ {}, - loadAsync: function loadAsync(url, onProgress) { - var scope = this; + loadAsync: function (url, onProgress) { + const scope = this; return new Promise(function (resolve, reject) { scope.load(url, resolve, onProgress, reject); }); }, - parse: function parse() + parse: function () /* data */ {}, - setCrossOrigin: function setCrossOrigin(crossOrigin) { + setCrossOrigin: function (crossOrigin) { this.crossOrigin = crossOrigin; return this; }, - setWithCredentials: function setWithCredentials(value) { + setWithCredentials: function (value) { this.withCredentials = value; return this; }, - setPath: function setPath(path) { + setPath: function (path) { this.path = path; return this; }, - setResourcePath: function setResourcePath(resourcePath) { + setResourcePath: function (resourcePath) { this.resourcePath = resourcePath; return this; }, - setRequestHeader: function setRequestHeader(requestHeader) { + setRequestHeader: function (requestHeader) { this.requestHeader = requestHeader; return this; } }); - var loading = {}; + const loading = {}; function FileLoader(manager) { Loader.call(this, manager); @@ -26880,12 +25364,12 @@ FileLoader.prototype = Object.assign(Object.create(Loader.prototype), { constructor: FileLoader, - load: function load(url, onLoad, onProgress, onError) { + load: function (url, onLoad, onProgress, onError) { if (url === undefined) url = ''; if (this.path !== undefined) url = this.path + url; url = this.manager.resolveURL(url); - var scope = this; - var cached = Cache.get(url); + const scope = this; + const cached = Cache.get(url); if (cached !== undefined) { scope.manager.itemStart(url); @@ -26907,27 +25391,27 @@ } // Check for data: URI - var dataUriRegex = /^data:(.*?)(;base64)?,(.*)$/; - var dataUriRegexResult = url.match(dataUriRegex); - var request; // Safari can not handle Data URIs through XMLHttpRequest so process manually + const dataUriRegex = /^data:(.*?)(;base64)?,(.*)$/; + const dataUriRegexResult = url.match(dataUriRegex); + let request; // Safari can not handle Data URIs through XMLHttpRequest so process manually if (dataUriRegexResult) { - var mimeType = dataUriRegexResult[1]; - var isBase64 = !!dataUriRegexResult[2]; - var data = dataUriRegexResult[3]; + const mimeType = dataUriRegexResult[1]; + const isBase64 = !!dataUriRegexResult[2]; + let data = dataUriRegexResult[3]; data = decodeURIComponent(data); if (isBase64) data = atob(data); try { - var response; - var responseType = (this.responseType || '').toLowerCase(); + let response; + const responseType = (this.responseType || '').toLowerCase(); switch (responseType) { case 'arraybuffer': case 'blob': - var view = new Uint8Array(data.length); + const view = new Uint8Array(data.length); - for (var i = 0; i < data.length; i++) { + for (let i = 0; i < data.length; i++) { view[i] = data.charCodeAt(i); } @@ -26942,7 +25426,7 @@ break; case 'document': - var parser = new DOMParser(); + const parser = new DOMParser(); response = parser.parseFromString(data, mimeType); break; @@ -26980,8 +25464,8 @@ request = new XMLHttpRequest(); request.open('GET', url, true); request.addEventListener('load', function (event) { - var response = this.response; - var callbacks = loading[url]; + const response = this.response; + const callbacks = loading[url]; delete loading[url]; if (this.status === 200 || this.status === 0) { @@ -26992,16 +25476,16 @@ Cache.add(url, response); - for (var _i = 0, il = callbacks.length; _i < il; _i++) { - var callback = callbacks[_i]; + for (let i = 0, il = callbacks.length; i < il; i++) { + const callback = callbacks[i]; if (callback.onLoad) callback.onLoad(response); } scope.manager.itemEnd(url); } else { - for (var _i2 = 0, _il = callbacks.length; _i2 < _il; _i2++) { - var _callback = callbacks[_i2]; - if (_callback.onError) _callback.onError(event); + for (let i = 0, il = callbacks.length; i < il; i++) { + const callback = callbacks[i]; + if (callback.onError) callback.onError(event); } scope.manager.itemError(url); @@ -27009,19 +25493,19 @@ } }, false); request.addEventListener('progress', function (event) { - var callbacks = loading[url]; + const callbacks = loading[url]; - for (var _i3 = 0, il = callbacks.length; _i3 < il; _i3++) { - var callback = callbacks[_i3]; + for (let i = 0, il = callbacks.length; i < il; i++) { + const callback = callbacks[i]; if (callback.onProgress) callback.onProgress(event); } }, false); request.addEventListener('error', function (event) { - var callbacks = loading[url]; + const callbacks = loading[url]; delete loading[url]; - for (var _i4 = 0, il = callbacks.length; _i4 < il; _i4++) { - var callback = callbacks[_i4]; + for (let i = 0, il = callbacks.length; i < il; i++) { + const callback = callbacks[i]; if (callback.onError) callback.onError(event); } @@ -27029,11 +25513,11 @@ scope.manager.itemEnd(url); }, false); request.addEventListener('abort', function (event) { - var callbacks = loading[url]; + const callbacks = loading[url]; delete loading[url]; - for (var _i5 = 0, il = callbacks.length; _i5 < il; _i5++) { - var callback = callbacks[_i5]; + for (let i = 0, il = callbacks.length; i < il; i++) { + const callback = callbacks[i]; if (callback.onError) callback.onError(event); } @@ -27044,7 +25528,7 @@ if (this.withCredentials !== undefined) request.withCredentials = this.withCredentials; if (request.overrideMimeType) request.overrideMimeType(this.mimeType !== undefined ? this.mimeType : 'text/plain'); - for (var header in this.requestHeader) { + for (const header in this.requestHeader) { request.setRequestHeader(header, this.requestHeader[header]); } @@ -27054,28 +25538,24 @@ scope.manager.itemStart(url); return request; }, - setResponseType: function setResponseType(value) { + setResponseType: function (value) { this.responseType = value; return this; }, - setMimeType: function setMimeType(value) { + setMimeType: function (value) { this.mimeType = value; return this; } }); - var AnimationLoader = /*#__PURE__*/function (_Loader) { - _inheritsLoose(AnimationLoader, _Loader); - - function AnimationLoader(manager) { - return _Loader.call(this, manager) || this; + class AnimationLoader extends Loader { + constructor(manager) { + super(manager); } - var _proto = AnimationLoader.prototype; - - _proto.load = function load(url, onLoad, onProgress, onError) { - var scope = this; - var loader = new FileLoader(this.manager); + load(url, onLoad, onProgress, onError) { + const scope = this; + const loader = new FileLoader(this.manager); loader.setPath(this.path); loader.setRequestHeader(this.requestHeader); loader.setWithCredentials(this.withCredentials); @@ -27092,21 +25572,20 @@ scope.manager.itemError(url); } }, onProgress, onError); - }; + } - _proto.parse = function parse(json) { - var animations = []; + parse(json) { + const animations = []; - for (var i = 0; i < json.length; i++) { - var clip = AnimationClip.parse(json[i]); + for (let i = 0; i < json.length; i++) { + const clip = AnimationClip.parse(json[i]); animations.push(clip); } return animations; - }; + } - return AnimationLoader; - }(Loader); + } /** * Abstract Base class to block based textures loader (dds, pvr, ...) @@ -27120,20 +25599,20 @@ CompressedTextureLoader.prototype = Object.assign(Object.create(Loader.prototype), { constructor: CompressedTextureLoader, - load: function load(url, onLoad, onProgress, onError) { - var scope = this; - var images = []; - var texture = new CompressedTexture(); - var loader = new FileLoader(this.manager); + load: function (url, onLoad, onProgress, onError) { + const scope = this; + const images = []; + const texture = new CompressedTexture(); + const loader = new FileLoader(this.manager); loader.setPath(this.path); loader.setResponseType('arraybuffer'); loader.setRequestHeader(this.requestHeader); loader.setWithCredentials(scope.withCredentials); - var loaded = 0; + let loaded = 0; function loadTexture(i) { loader.load(url[i], function (buffer) { - var texDatas = scope.parse(buffer, true); + const texDatas = scope.parse(buffer, true); images[i] = { width: texDatas.width, height: texDatas.height, @@ -27153,24 +25632,24 @@ } if (Array.isArray(url)) { - for (var i = 0, il = url.length; i < il; ++i) { + for (let i = 0, il = url.length; i < il; ++i) { loadTexture(i); } } else { // compressed cubemap texture stored in a single DDS file loader.load(url, function (buffer) { - var texDatas = scope.parse(buffer, true); + const texDatas = scope.parse(buffer, true); if (texDatas.isCubemap) { - var faces = texDatas.mipmaps.length / texDatas.mipmapCount; + const faces = texDatas.mipmaps.length / texDatas.mipmapCount; - for (var f = 0; f < faces; f++) { + for (let f = 0; f < faces; f++) { images[f] = { mipmaps: [] }; - for (var _i = 0; _i < texDatas.mipmapCount; _i++) { - images[f].mipmaps.push(texDatas.mipmaps[f * texDatas.mipmapCount + _i]); + for (let 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; @@ -27198,20 +25677,16 @@ } }); - var ImageLoader = /*#__PURE__*/function (_Loader) { - _inheritsLoose(ImageLoader, _Loader); - - function ImageLoader(manager) { - return _Loader.call(this, manager) || this; + class ImageLoader extends Loader { + constructor(manager) { + super(manager); } - var _proto = ImageLoader.prototype; - - _proto.load = function load(url, onLoad, onProgress, onError) { + load(url, onLoad, onProgress, onError) { if (this.path !== undefined) url = this.path + url; url = this.manager.resolveURL(url); - var scope = this; - var cached = Cache.get(url); + const scope = this; + const cached = Cache.get(url); if (cached !== undefined) { scope.manager.itemStart(url); @@ -27222,7 +25697,7 @@ return cached; } - var image = document.createElementNS('http://www.w3.org/1999/xhtml', 'img'); + const image = document.createElementNS('http://www.w3.org/1999/xhtml', 'img'); function onImageLoad() { image.removeEventListener('load', onImageLoad, false); @@ -27250,26 +25725,21 @@ scope.manager.itemStart(url); image.src = url; return image; - }; - - return ImageLoader; - }(Loader); + } - var CubeTextureLoader = /*#__PURE__*/function (_Loader) { - _inheritsLoose(CubeTextureLoader, _Loader); + } - function CubeTextureLoader(manager) { - return _Loader.call(this, manager) || this; + class CubeTextureLoader extends Loader { + constructor(manager) { + super(manager); } - var _proto = CubeTextureLoader.prototype; - - _proto.load = function load(urls, onLoad, onProgress, onError) { - var texture = new CubeTexture(); - var loader = new ImageLoader(this.manager); + load(urls, onLoad, onProgress, onError) { + const texture = new CubeTexture(); + const loader = new ImageLoader(this.manager); loader.setCrossOrigin(this.crossOrigin); loader.setPath(this.path); - var loaded = 0; + let loaded = 0; function loadTexture(i) { loader.load(urls[i], function (image) { @@ -27283,15 +25753,14 @@ }, undefined, onError); } - for (var i = 0; i < urls.length; ++i) { + for (let i = 0; i < urls.length; ++i) { loadTexture(i); } return texture; - }; + } - return CubeTextureLoader; - }(Loader); + } /** * Abstract Base class to load generic binary textures formats (rgbe, hdr, ...) @@ -27305,16 +25774,16 @@ DataTextureLoader.prototype = Object.assign(Object.create(Loader.prototype), { constructor: DataTextureLoader, - load: function load(url, onLoad, onProgress, onError) { - var scope = this; - var texture = new DataTexture(); - var loader = new FileLoader(this.manager); + load: function (url, onLoad, onProgress, onError) { + const scope = this; + const texture = new DataTexture(); + const 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) { - var texData = scope.parse(buffer); + const texData = scope.parse(buffer); if (!texData) return; if (texData.image !== undefined) { @@ -27373,15 +25842,15 @@ TextureLoader.prototype = Object.assign(Object.create(Loader.prototype), { constructor: TextureLoader, - load: function load(url, onLoad, onProgress, onError) { - var texture = new Texture(); - var loader = new ImageLoader(this.manager); + load: function (url, onLoad, onProgress, onError) { + const texture = new Texture(); + const 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. - var isJPEG = url.search(/\.jpe?g($|\?)/i) > 0 || url.search(/^data\:image\/jpeg/) === 0; + const isJPEG = url.search(/\.jpe?g($|\?)/i) > 0 || url.search(/^data\:image\/jpeg/) === 0; texture.format = isJPEG ? RGBFormat : RGBAFormat; texture.needsUpdate = true; @@ -27431,7 +25900,7 @@ Object.assign(Curve.prototype, { // Virtual base class method to overwrite and implement in subclasses // - t [0 .. 1] - getPoint: function getPoint() + getPoint: function () /* t, optionalTarget */ { console.warn('THREE.Curve: .getPoint() not implemented.'); @@ -27439,45 +25908,37 @@ }, // Get point at relative position in curve according to arc length // - u [0 .. 1] - getPointAt: function getPointAt(u, optionalTarget) { - var t = this.getUtoTmapping(u); + getPointAt: function (u, optionalTarget) { + const t = this.getUtoTmapping(u); return this.getPoint(t, optionalTarget); }, // Get sequence of points using getPoint( t ) - getPoints: function getPoints(divisions) { - if (divisions === void 0) { - divisions = 5; - } - - var points = []; + getPoints: function (divisions = 5) { + const points = []; - for (var d = 0; d <= divisions; d++) { + for (let d = 0; d <= divisions; d++) { points.push(this.getPoint(d / divisions)); } return points; }, // Get sequence of points using getPointAt( u ) - getSpacedPoints: function getSpacedPoints(divisions) { - if (divisions === void 0) { - divisions = 5; - } - - var points = []; + getSpacedPoints: function (divisions = 5) { + const points = []; - for (var d = 0; d <= divisions; d++) { + for (let d = 0; d <= divisions; d++) { points.push(this.getPointAt(d / divisions)); } return points; }, // Get total curve arc length - getLength: function getLength() { - var lengths = this.getLengths(); + getLength: function () { + const lengths = this.getLengths(); return lengths[lengths.length - 1]; }, // Get list of cumulative segment lengths - getLengths: function getLengths(divisions) { + getLengths: function (divisions) { if (divisions === undefined) divisions = this.arcLengthDivisions; if (this.cacheArcLengths && this.cacheArcLengths.length === divisions + 1 && !this.needsUpdate) { @@ -27485,13 +25946,13 @@ } this.needsUpdate = false; - var cache = []; - var current, + const cache = []; + let current, last = this.getPoint(0); - var sum = 0; + let sum = 0; cache.push(0); - for (var p = 1; p <= divisions; p++) { + for (let p = 1; p <= divisions; p++) { current = this.getPoint(p / divisions); sum += current.distanceTo(last); cache.push(sum); @@ -27501,16 +25962,16 @@ this.cacheArcLengths = cache; return cache; // { sums: cache, sum: sum }; Sum is in the last element. }, - updateArcLengths: function updateArcLengths() { + updateArcLengths: function () { this.needsUpdate = true; this.getLengths(); }, // Given u ( 0 .. 1 ), get a t to find p. This gives you points which are equidistant - 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 + getUtoTmapping: function (u, distance) { + const arcLengths = this.getLengths(); + let i = 0; + const il = arcLengths.length; + let targetArcLength; // The targeted u distance value to get if (distance) { targetArcLength = distance; @@ -27519,7 +25980,7 @@ } // binary search for the index with largest value smaller than target u distance - var low = 0, + let low = 0, high = il - 1, comparison; @@ -27545,47 +26006,47 @@ } // we could get finer grain at lengths, or use simple interpolation between two 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 lengthBefore = arcLengths[i]; + const lengthAfter = arcLengths[i + 1]; + const segmentLength = lengthAfter - lengthBefore; // determine where we are between the 'before' and 'after' points - var segmentFraction = (targetArcLength - lengthBefore) / segmentLength; // add that fractional amount to t + const segmentFraction = (targetArcLength - lengthBefore) / segmentLength; // add that fractional amount to t - var t = (i + segmentFraction) / (il - 1); + const 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 getTangent(t, optionalTarget) { - var delta = 0.0001; - var t1 = t - delta; - var t2 = t + delta; // Capping in case of danger + getTangent: function (t, optionalTarget) { + const delta = 0.0001; + let t1 = t - delta; + let t2 = t + delta; // Capping in case of danger if (t1 < 0) t1 = 0; if (t2 > 1) t2 = 1; - var pt1 = this.getPoint(t1); - var pt2 = this.getPoint(t2); - var tangent = optionalTarget || (pt1.isVector2 ? new Vector2() : new Vector3()); + const pt1 = this.getPoint(t1); + const pt2 = this.getPoint(t2); + const tangent = optionalTarget || (pt1.isVector2 ? new Vector2() : new Vector3()); tangent.copy(pt2).sub(pt1).normalize(); return tangent; }, - getTangentAt: function getTangentAt(u, optionalTarget) { - var t = this.getUtoTmapping(u); + getTangentAt: function (u, optionalTarget) { + const t = this.getUtoTmapping(u); return this.getTangent(t, optionalTarget); }, - computeFrenetFrames: function computeFrenetFrames(segments, closed) { + computeFrenetFrames: function (segments, closed) { // see http://www.cs.indiana.edu/pub/techreports/TR425.pdf - 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; + 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; tangents[i] = this.getTangentAt(u, new Vector3()); tangents[i].normalize(); } // select an initial normal vector perpendicular to the first tangent vector, @@ -27594,10 +26055,10 @@ normals[0] = new Vector3(); binormals[0] = new Vector3(); - 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); + 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); if (tx <= min) { min = tx; @@ -27617,36 +26078,34 @@ 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 (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]); + for (let i = 1; i <= segments; i++) { + normals[i] = normals[i - 1].clone(); + binormals[i] = binormals[i - 1].clone(); + vec.crossVectors(tangents[i - 1], tangents[i]); if (vec.length() > Number.EPSILON) { vec.normalize(); - var theta = Math.acos(MathUtils.clamp(tangents[_i - 1].dot(tangents[_i]), -1, 1)); // clamp for floating pt errors + const 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) { - var _theta = Math.acos(MathUtils.clamp(normals[0].dot(normals[segments]), -1, 1)); - - _theta /= segments; + let 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 (var _i2 = 1; _i2 <= segments; _i2++) { + for (let i = 1; i <= segments; i++) { // twist a little... - normals[_i2].applyMatrix4(mat.makeRotationAxis(tangents[_i2], _theta * _i2)); - - binormals[_i2].crossVectors(tangents[_i2], normals[_i2]); + normals[i].applyMatrix4(mat.makeRotationAxis(tangents[i], theta * i)); + binormals[i].crossVectors(tangents[i], normals[i]); } } @@ -27656,15 +26115,15 @@ binormals: binormals }; }, - clone: function clone() { + clone: function () { return new this.constructor().copy(this); }, - copy: function copy(source) { + copy: function (source) { this.arcLengthDivisions = source.arcLengthDivisions; return this; }, - toJSON: function toJSON() { - var data = { + toJSON: function () { + const data = { metadata: { version: 4.5, type: 'Curve', @@ -27675,78 +26134,35 @@ data.type = this.type; return data; }, - fromJSON: function fromJSON(json) { + fromJSON: function (json) { this.arcLengthDivisions = json.arcLengthDivisions; return this; } }); - var EllipseCurve = /*#__PURE__*/function (_Curve) { - _inheritsLoose(EllipseCurve, _Curve); - - function EllipseCurve(aX, aY, xRadius, yRadius, aStartAngle, aEndAngle, aClockwise, aRotation) { - var _this; - - if (aX === void 0) { - aX = 0; - } - - if (aY === void 0) { - aY = 0; - } - - if (xRadius === void 0) { - xRadius = 1; - } - - 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; + 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 _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 + 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 - while (deltaAngle < 0) { - deltaAngle += twoPi; - } + while (deltaAngle < 0) deltaAngle += twoPi; - while (deltaAngle > twoPi) { - deltaAngle -= twoPi; - } + while (deltaAngle > twoPi) deltaAngle -= twoPi; if (deltaAngle < Number.EPSILON) { if (samePoints) { @@ -27764,26 +26180,25 @@ } } - var angle = this.aStartAngle + t * deltaAngle; - var x = this.aX + this.xRadius * Math.cos(angle); - var y = this.aY + this.yRadius * Math.sin(angle); + const angle = this.aStartAngle + t * deltaAngle; + let x = this.aX + this.xRadius * Math.cos(angle); + let y = this.aY + this.yRadius * Math.sin(angle); if (this.aRotation !== 0) { - 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. + 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. 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; @@ -27793,11 +26208,10 @@ 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; @@ -27807,11 +26221,10 @@ 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; @@ -27821,26 +26234,19 @@ this.aClockwise = json.aClockwise; this.aRotation = json.aRotation; return this; - }; + } - return EllipseCurve; - }(Curve); + } EllipseCurve.prototype.isEllipseCurve = true; - 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; + class ArcCurve extends EllipseCurve { + constructor(aX, aY, aRadius, aStartAngle, aEndAngle, aClockwise) { + super(aX, aY, aRadius, aRadius, aStartAngle, aEndAngle, aClockwise); + this.type = 'ArcCurve'; } - return ArcCurve; - }(EllipseCurve); + } ArcCurve.prototype.isArcCurve = true; @@ -27864,7 +26270,7 @@ */ function CubicPoly() { - var c0 = 0, + let c0 = 0, c1 = 0, c2 = 0, c3 = 0; @@ -27885,76 +26291,49 @@ } return { - initCatmullRom: function initCatmullRom(x0, x1, x2, x3, tension) { + initCatmullRom: function (x0, x1, x2, x3, tension) { init(x1, x2, tension * (x2 - x0), tension * (x3 - x1)); }, - initNonuniformCatmullRom: function initNonuniformCatmullRom(x0, x1, x2, x3, dt0, dt1, dt2) { + initNonuniformCatmullRom: function (x0, x1, x2, x3, dt0, dt1, dt2) { // compute tangents when parameterized in [t1,t2] - 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] + 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] t1 *= dt1; t2 *= dt1; init(x1, x2, t1, t2); }, - calc: function calc(t) { - var t2 = t * t; - var t3 = t2 * t; + calc: function (t) { + const t2 = t * t; + const t3 = t2 * t; return c0 + c1 * t + c2 * t2 + c3 * t3; } }; } // - 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; - - if (points === void 0) { - points = []; - } - - if (closed === void 0) { - closed = false; - } - - if (curveType === void 0) { - curveType = 'centripetal'; - } - - if (tension === void 0) { - tension = 0.5; - } + const tmp = new Vector3(); + const px = new CubicPoly(), + py = new CubicPoly(), + pz = new CubicPoly(); - _this = _Curve.call(this) || this; - _this.type = 'CatmullRomCurve3'; - _this.points = points; - _this.closed = closed; - _this.curveType = curveType; - _this.tension = tension; - return _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; } - 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; + 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; if (this.closed) { intPoint += intPoint > 0 ? 0 : (Math.floor(Math.abs(intPoint) / l) + 1) * l; @@ -27963,7 +26342,7 @@ weight = 1; } - var p0, p3; // 4 points (p1 & p2 defined below) + let p0, p3; // 4 points (p1 & p2 defined below) if (this.closed || intPoint > 0) { p0 = points[(intPoint - 1) % l]; @@ -27973,8 +26352,8 @@ p0 = tmp; } - var p1 = points[intPoint % l]; - var p2 = points[(intPoint + 1) % l]; + const p1 = points[intPoint % l]; + const p2 = points[(intPoint + 1) % l]; if (this.closed || intPoint + 2 < l) { p3 = points[(intPoint + 2) % l]; @@ -27986,10 +26365,10 @@ if (this.curveType === 'centripetal' || this.curveType === 'chordal') { // init Centripetal / Chordal Catmull-Rom - 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 + 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 if (dt1 < 1e-4) dt1 = 1.0; if (dt0 < 1e-4) dt0 = dt1; @@ -28005,15 +26384,14 @@ 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 (var i = 0, l = source.points.length; i < l; i++) { - var point = source.points[i]; + for (let i = 0, l = source.points.length; i < l; i++) { + const point = source.points[i]; this.points.push(point.clone()); } @@ -28021,15 +26399,14 @@ 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 (var i = 0, l = this.points.length; i < l; i++) { - var point = this.points[i]; + for (let i = 0, l = this.points.length; i < l; i++) { + const point = this.points[i]; data.points.push(point.toArray()); } @@ -28037,15 +26414,14 @@ 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 (var i = 0, l = json.points.length; i < l; i++) { - var point = json.points[i]; + for (let i = 0, l = json.points.length; i < l; i++) { + const point = json.points[i]; this.points.push(new Vector3().fromArray(point)); } @@ -28053,10 +26429,9 @@ this.curveType = json.curveType; this.tension = json.tension; return this; - }; + } - return CatmullRomCurve3; - }(Curve); + } CatmullRomCurve3.prototype.isCatmullRomCurve3 = true; @@ -28065,16 +26440,16 @@ * http://en.wikipedia.org/wiki/Bézier_curve */ function CatmullRom(t, p0, p1, p2, p3) { - var v0 = (p2 - p0) * 0.5; - var v1 = (p3 - p1) * 0.5; - var t2 = t * t; - var t3 = t * t2; + const v0 = (p2 - p0) * 0.5; + const v1 = (p3 - p1) * 0.5; + const t2 = t * t; + const t3 = t * t2; return (2 * p1 - 2 * p2 + v0 + v1) * t3 + (-3 * p1 + 3 * p2 - 2 * v0 - v1) * t2 + v0 * t + p1; } // function QuadraticBezierP0(t, p) { - var k = 1 - t; + const k = 1 - t; return k * k * p; } @@ -28092,12 +26467,12 @@ function CubicBezierP0(t, p) { - var k = 1 - t; + const k = 1 - t; return k * k * k * p; } function CubicBezierP1(t, p) { - var k = 1 - t; + const k = 1 - t; return 3 * k * k * t * p; } @@ -28113,199 +26488,118 @@ return CubicBezierP0(t, p0) + CubicBezierP1(t, p1) + CubicBezierP2(t, p2) + CubicBezierP3(t, p3); } - 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; + 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; 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; - - 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(); - } + CubicBezierCurve.prototype.isCubicBezierCurve = true; - var point = optionalTarget; - var v0 = this.v0, - v1 = this.v1, - v2 = this.v2, - v3 = this.v3; + 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; 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; - 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; + class LineCurve extends Curve { + constructor(v1 = new Vector2(), v2 = new Vector2()) { + super(); + this.type = 'LineCurve'; + this.v1 = v1; + this.v2 = v2; } - var _proto = LineCurve.prototype; - - _proto.getPoint = function getPoint(t, optionalTarget) { - if (optionalTarget === void 0) { - optionalTarget = new Vector2(); - } - - var point = optionalTarget; + getPoint(t, optionalTarget = new Vector2()) { + const point = optionalTarget; if (t === 1) { point.copy(this.v2); @@ -28316,77 +26610,54 @@ return point; } // Line curve is linear, so we can overwrite default getPointAt - ; - _proto.getPointAt = function getPointAt(u, optionalTarget) { + + getPointAt(u, optionalTarget) { return this.getPoint(u, optionalTarget); - }; + } - _proto.getTangent = function getTangent(t, optionalTarget) { - var tangent = optionalTarget || new Vector2(); + getTangent(t, optionalTarget) { + const 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; - 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; + 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 _proto = LineCurve3.prototype; - - _proto.getPoint = function getPoint(t, optionalTarget) { - if (optionalTarget === void 0) { - optionalTarget = new Vector3(); - } - - var point = optionalTarget; + getPoint(t, optionalTarget = new Vector3()) { + const point = optionalTarget; if (t === 1) { point.copy(this.v2); @@ -28397,262 +26668,185 @@ return point; } // Line curve is linear, so we can overwrite default getPointAt - ; - _proto.getPointAt = function getPointAt(u, optionalTarget) { - return this.getPoint(u, optionalTarget); - }; - _proto.copy = function copy(source) { - _Curve.prototype.copy.call(this, source); + getPointAt(u, optionalTarget) { + return this.getPoint(u, optionalTarget); + } + copy(source) { + super.copy(source); this.v1.copy(source.v1); this.v2.copy(source.v2); return this; - }; - - _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(); - } - - _this = _Curve.call(this) || this; - _this.type = 'QuadraticBezierCurve'; - _this.v0 = v0; - _this.v1 = v1; - _this.v2 = v2; - return _this; } - var _proto = QuadraticBezierCurve.prototype; + } - _proto.getPoint = function getPoint(t, optionalTarget) { - if (optionalTarget === void 0) { - optionalTarget = 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; + } - var point = optionalTarget; - var v0 = this.v0, - v1 = this.v1, - v2 = this.v2; + getPoint(t, optionalTarget = new Vector2()) { + const point = optionalTarget; + const 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; - 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; + 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 _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; + getPoint(t, optionalTarget = new Vector3()) { + const point = optionalTarget; + const 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; - - 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(); - } + QuadraticBezierCurve3.prototype.isQuadraticBezierCurve3 = true; - 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]; + 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]; 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 (var i = 0, l = source.points.length; i < l; i++) { - var point = source.points[i]; + for (let i = 0, l = source.points.length; i < l; i++) { + const 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 (var i = 0, l = this.points.length; i < l; i++) { - var point = this.points[i]; + for (let i = 0, l = this.points.length; i < l; i++) { + const 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 (var i = 0, l = json.points.length; i < l; i++) { - var point = json.points[i]; + for (let i = 0, l = json.points.length; i < l; i++) { + const point = json.points[i]; this.points.push(new Vector2().fromArray(point)); } return this; - }; + } - return SplineCurve; - }(Curve); + } SplineCurve.prototype.isSplineCurve = true; @@ -28675,30 +26869,22 @@ * curves, but retains the api of a curve **************************************************************/ - 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; + class CurvePath extends Curve { + constructor() { + super(); + this.type = 'CurvePath'; + this.curves = []; + this.autoClose = false; // Automatically closes the path } - var _proto = CurvePath.prototype; - - _proto.add = function add(curve) { + add(curve) { this.curves.push(curve); - }; + } - _proto.closePath = function closePath() { + closePath() { // Add a line curve if start and end of lines are not connected - var startPoint = this.curves[0].getPoint(0); - var endPoint = this.curves[this.curves.length - 1].getPoint(1); + const startPoint = this.curves[0].getPoint(0); + const endPoint = this.curves[this.curves.length - 1].getPoint(1); if (!startPoint.equals(endPoint)) { this.curves.push(new LineCurve(endPoint, startPoint)); @@ -28710,19 +26896,19 @@ // 2. Locate and identify type of curve // 3. Get t for the curve // 4. Return curve.getPointAt(t') - ; - _proto.getPoint = function getPoint(t) { - var d = t * this.getLength(); - var curveLengths = this.getCurveLengths(); - var i = 0; // To think about boundaries points. + + getPoint(t) { + const d = t * this.getLength(); + const curveLengths = this.getCurveLengths(); + let i = 0; // To think about boundaries points. while (i < curveLengths.length) { if (curveLengths[i] >= d) { - var diff = curveLengths[i] - d; - var curve = this.curves[i]; - var segmentLength = curve.getLength(); - var u = segmentLength === 0 ? 0 : 1 - diff / segmentLength; + const diff = curveLengths[i] - d; + const curve = this.curves[i]; + const segmentLength = curve.getLength(); + const u = segmentLength === 0 ? 0 : 1 - diff / segmentLength; return curve.getPointAt(u); } @@ -28733,23 +26919,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 - ; - _proto.getLength = function getLength() { - var lens = this.getCurveLengths(); + + getLength() { + const lens = this.getCurveLengths(); return lens[lens.length - 1]; } // cacheLengths must be recalculated. - ; - _proto.updateArcLengths = function updateArcLengths() { + + updateArcLengths() { this.needsUpdate = true; this.cacheLengths = null; this.getCurveLengths(); } // Compute lengths and cache them // We cannot overwrite getLengths() because UtoT mapping uses it. - ; - _proto.getCurveLengths = function getCurveLengths() { + + 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; @@ -28757,26 +26943,22 @@ // Push sums into cached array - var lengths = []; - var sums = 0; + const lengths = []; + let sums = 0; - for (var i = 0, l = this.curves.length; i < l; i++) { + for (let 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; - } + } - var points = []; + getSpacedPoints(divisions = 40) { + const points = []; - for (var i = 0; i <= divisions; i++) { + for (let i = 0; i <= divisions; i++) { points.push(this.getPoint(i / divisions)); } @@ -28785,23 +26967,19 @@ } return points; - }; - - _proto.getPoints = function getPoints(divisions) { - if (divisions === void 0) { - divisions = 12; - } + } - var points = []; - var last; + getPoints(divisions = 12) { + const points = []; + let last; - 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 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 j = 0; j < pts.length; j++) { - var point = pts[j]; + for (let j = 0; j < pts.length; j++) { + const point = pts[j]; if (last && last.equals(point)) continue; // ensures no consecutive points are duplicates points.push(point); @@ -28814,144 +26992,132 @@ } return points; - }; - - _proto.copy = function copy(source) { - _Curve.prototype.copy.call(this, source); + } + copy(source) { + super.copy(source); this.curves = []; - for (var i = 0, l = source.curves.length; i < l; i++) { - var curve = source.curves[i]; + for (let i = 0, l = source.curves.length; i < l; i++) { + const curve = source.curves[i]; this.curves.push(curve.clone()); } this.autoClose = source.autoClose; return this; - }; - - _proto.toJSON = function toJSON() { - var data = _Curve.prototype.toJSON.call(this); + } + toJSON() { + const data = super.toJSON(); data.autoClose = this.autoClose; data.curves = []; - for (var i = 0, l = this.curves.length; i < l; i++) { - var curve = this.curves[i]; + for (let i = 0, l = this.curves.length; i < l; i++) { + const 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 (var i = 0, l = json.curves.length; i < l; i++) { - var curve = json.curves[i]; + for (let i = 0, l = json.curves.length; i < l; i++) { + const curve = json.curves[i]; this.curves.push(new Curves[curve.type]().fromJSON(curve)); } return this; - }; - - return CurvePath; - }(Curve); - - var Path = /*#__PURE__*/function (_CurvePath) { - _inheritsLoose(Path, _CurvePath); + } - function Path(points) { - var _this; + } - _this = _CurvePath.call(this) || this; - _this.type = 'Path'; - _this.currentPoint = new Vector2(); + class Path extends CurvePath { + constructor(points) { + super(); + this.type = 'Path'; + this.currentPoint = new Vector2(); if (points) { - _this.setFromPoints(points); + this.setFromPoints(points); } - - return _this; } - var _proto = Path.prototype; - - _proto.setFromPoints = function setFromPoints(points) { + setFromPoints(points) { this.moveTo(points[0].x, points[0].y); - for (var i = 1, l = points.length; i < l; i++) { + for (let i = 1, l = points.length; i < l; i++) { this.lineTo(points[i].x, points[i].y); } return this; - }; + } - _proto.moveTo = function moveTo(x, y) { + moveTo(x, y) { this.currentPoint.set(x, y); // TODO consider referencing vectors instead of copying? return this; - }; + } - _proto.lineTo = function lineTo(x, y) { - var curve = new LineCurve(this.currentPoint.clone(), new Vector2(x, y)); + lineTo(x, y) { + const curve = new LineCurve(this.currentPoint.clone(), new Vector2(x, y)); this.curves.push(curve); this.currentPoint.set(x, y); return this; - }; + } - _proto.quadraticCurveTo = function quadraticCurveTo(aCPx, aCPy, aX, aY) { - var curve = new QuadraticBezierCurve(this.currentPoint.clone(), new Vector2(aCPx, aCPy), new Vector2(aX, aY)); + quadraticCurveTo(aCPx, aCPy, aX, aY) { + const curve = new QuadraticBezierCurve(this.currentPoint.clone(), new Vector2(aCPx, aCPy), new Vector2(aX, aY)); this.curves.push(curve); this.currentPoint.set(aX, aY); return this; - }; + } - _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)); + bezierCurveTo(aCP1x, aCP1y, aCP2x, aCP2y, aX, aY) { + const curve = new CubicBezierCurve(this.currentPoint.clone(), new Vector2(aCP1x, aCP1y), new Vector2(aCP2x, aCP2y), new Vector2(aX, aY)); this.curves.push(curve); this.currentPoint.set(aX, aY); return this; - }; + } - _proto.splineThru = function splineThru(pts + splineThru(pts /*Array of Vector*/ ) { - var npts = [this.currentPoint.clone()].concat(pts); - var curve = new SplineCurve(npts); + const npts = [this.currentPoint.clone()].concat(pts); + const curve = new SplineCurve(npts); this.curves.push(curve); this.currentPoint.copy(pts[pts.length - 1]); return this; - }; + } - _proto.arc = function arc(aX, aY, aRadius, aStartAngle, aEndAngle, aClockwise) { - var x0 = this.currentPoint.x; - var y0 = this.currentPoint.y; + arc(aX, aY, aRadius, aStartAngle, aEndAngle, aClockwise) { + const x0 = this.currentPoint.x; + const y0 = this.currentPoint.y; this.absarc(aX + x0, aY + y0, aRadius, aStartAngle, aEndAngle, aClockwise); return this; - }; + } - _proto.absarc = function absarc(aX, aY, aRadius, aStartAngle, aEndAngle, aClockwise) { + absarc(aX, aY, aRadius, aStartAngle, aEndAngle, aClockwise) { this.absellipse(aX, aY, aRadius, aRadius, aStartAngle, aEndAngle, aClockwise); return this; - }; + } - _proto.ellipse = function ellipse(aX, aY, xRadius, yRadius, aStartAngle, aEndAngle, aClockwise, aRotation) { - var x0 = this.currentPoint.x; - var y0 = this.currentPoint.y; + ellipse(aX, aY, xRadius, yRadius, aStartAngle, aEndAngle, aClockwise, aRotation) { + const x0 = this.currentPoint.x; + const y0 = this.currentPoint.y; this.absellipse(aX + x0, aY + y0, xRadius, yRadius, aStartAngle, aEndAngle, aClockwise, aRotation); return this; - }; + } - _proto.absellipse = function absellipse(aX, aY, xRadius, yRadius, aStartAngle, aEndAngle, aClockwise, aRotation) { - var curve = new EllipseCurve(aX, aY, xRadius, yRadius, aStartAngle, aEndAngle, aClockwise, aRotation); + absellipse(aX, aY, xRadius, yRadius, aStartAngle, aEndAngle, aClockwise, aRotation) { + const curve = new EllipseCurve(aX, aY, xRadius, yRadius, aStartAngle, aEndAngle, aClockwise, aRotation); if (this.curves.length > 0) { // if a previous curve is present, attempt to join - var firstPoint = curve.getPoint(0); + const firstPoint = curve.getPoint(0); if (!firstPoint.equals(this.currentPoint)) { this.lineTo(firstPoint.x, firstPoint.y); @@ -28959,142 +27125,114 @@ } this.curves.push(curve); - var lastPoint = curve.getPoint(1); + const 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); - - 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; + class Shape extends Path { + constructor(points) { + super(points); + this.uuid = MathUtils.generateUUID(); + this.type = 'Shape'; + this.holes = []; } - var _proto = Shape.prototype; - - _proto.getPointsHoles = function getPointsHoles(divisions) { - var holesPts = []; + getPointsHoles(divisions) { + const holesPts = []; - for (var i = 0, l = this.holes.length; i < l; i++) { + for (let i = 0, l = this.holes.length; i < l; i++) { holesPts[i] = this.holes[i].getPoints(divisions); } return holesPts; } // get points of shape and holes (keypoints based on segments parameter) - ; - _proto.extractPoints = function extractPoints(divisions) { + + 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 (var i = 0, l = source.holes.length; i < l; i++) { - var hole = source.holes[i]; + for (let i = 0, l = source.holes.length; i < l; i++) { + const 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 (var i = 0, l = this.holes.length; i < l; i++) { - var hole = this.holes[i]; + for (let i = 0, l = this.holes.length; i < l; i++) { + const 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 (var i = 0, l = json.holes.length; i < l; i++) { - var hole = json.holes[i]; + for (let i = 0, l = json.holes.length; i < l; i++) { + const hole = json.holes[i]; this.holes.push(new Path().fromJSON(hole)); } return this; - }; - - return Shape; - }(Path); - - 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; } - var _proto = Light.prototype; + } - _proto.copy = function copy(source) { - _Object3D.prototype.copy.call(this, source); + class Light extends Object3D { + constructor(color, intensity = 1) { + super(); + this.type = 'Light'; + this.color = new Color(color); + this.intensity = intensity; + } + copy(source) { + super.copy(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(); @@ -29104,51 +27242,39 @@ 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; - 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; + 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 _proto = HemisphereLight.prototype; - - _proto.copy = function copy(source) { + copy(source) { Light.prototype.copy.call(this, source); this.groundColor.copy(source.groundColor); return this; - }; + } - return HemisphereLight; - }(Light); + } HemisphereLight.prototype.isHemisphereLight = true; - var _projScreenMatrix = /*@__PURE__*/new Matrix4(); + const _projScreenMatrix = /*@__PURE__*/new Matrix4(); - var _lightPositionWorld = /*@__PURE__*/new Vector3(); + const _lightPositionWorld = /*@__PURE__*/new Vector3(); - var _lookTarget = /*@__PURE__*/new Vector3(); + const _lookTarget = /*@__PURE__*/new Vector3(); - var LightShadow = /*#__PURE__*/function () { - function LightShadow(camera) { + class LightShadow { + constructor(camera) { this.camera = camera; this.bias = 0; this.normalBias = 0; @@ -29165,19 +27291,17 @@ this._viewports = [new Vector4(0, 0, 1, 1)]; } - var _proto = LightShadow.prototype; - - _proto.getViewportCount = function getViewportCount() { + getViewportCount() { return this._viewportCount; - }; + } - _proto.getFrustum = function getFrustum() { + getFrustum() { return this._frustum; - }; + } - _proto.updateMatrices = function updateMatrices(light) { - var shadowCamera = this.camera; - var shadowMatrix = this.matrix; + updateMatrices(light) { + const shadowCamera = this.camera; + const shadowMatrix = this.matrix; _lightPositionWorld.setFromMatrixPosition(light.matrixWorld); @@ -29195,30 +27319,30 @@ 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); - }; + } - _proto.getViewport = function getViewport(viewportIndex) { + getViewport(viewportIndex) { return this._viewports[viewportIndex]; - }; + } - _proto.getFrameExtents = function getFrameExtents() { + getFrameExtents() { return this._frameExtents; - }; + } - _proto.copy = function copy(source) { + copy(source) { this.camera = source.camera.clone(); this.bias = source.bias; this.radius = source.radius; this.mapSize.copy(source.mapSize); return this; - }; + } - _proto.clone = function clone() { + clone() { return new this.constructor().copy(this); - }; + } - _proto.toJSON = function toJSON() { - var object = {}; + toJSON() { + const 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; @@ -29226,29 +27350,21 @@ 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; + class SpotLightShadow extends LightShadow { + constructor() { + super(new PerspectiveCamera(50, 1, 0.5, 500)); + this.focus = 1; } - 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; + 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 (fov !== camera.fov || aspect !== camera.aspect || far !== camera.far) { camera.fov = fov; @@ -29257,58 +27373,42 @@ camera.updateProjectionMatrix(); } - _LightShadow.prototype.updateMatrices.call(this, light); - }; + super.updateMatrices(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; - } - - if (angle === void 0) { - angle = Math.PI / 3; - } - - if (penumbra === void 0) { - penumbra = 0; - } - - if (decay === void 0) { - decay = 1; - } - - _this = _Light.call(this, color, intensity) || this; - _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. + 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.shadow = new SpotLightShadow(); - return _this; + this.shadow = new SpotLightShadow(); } - var _proto = SpotLight.prototype; + 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; + } - _proto.copy = function copy(source) { - _Light.prototype.copy.call(this, source); + 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; + } + copy(source) { + super.copy(source); this.distance = source.distance; this.angle = source.angle; this.penumbra = source.penumbra; @@ -29316,43 +27416,24 @@ 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; - var _projScreenMatrix$1 = /*@__PURE__*/new Matrix4(); + const _projScreenMatrix$1 = /*@__PURE__*/new Matrix4(); - var _lightPositionWorld$1 = /*@__PURE__*/new Vector3(); + const _lightPositionWorld$1 = /*@__PURE__*/new Vector3(); - var _lookTarget$1 = /*@__PURE__*/new Vector3(); + const _lookTarget$1 = /*@__PURE__*/new Vector3(); - var PointLightShadow = /*#__PURE__*/function (_LightShadow) { - _inheritsLoose(PointLightShadow, _LightShadow); - - 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 + 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 // following orientation: // // xzXZ @@ -29371,20 +27452,13 @@ 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)]; - return _this; + 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)]; } - var _proto = PointLightShadow.prototype; - - _proto.updateMatrices = function updateMatrices(light, viewportIndex) { - if (viewportIndex === void 0) { - viewportIndex = 0; - } - - var camera = this.camera; - var shadowMatrix = this.matrix; + updateMatrices(light, viewportIndex = 0) { + const camera = this.camera; + const shadowMatrix = this.matrix; _lightPositionWorld$1.setFromMatrixPosition(light.matrixWorld); @@ -29402,117 +27476,63 @@ _projScreenMatrix$1.multiplyMatrices(camera.projectionMatrix, camera.matrixWorldInverse); this._frustum.setFromProjectionMatrix(_projScreenMatrix$1); - }; + } - return PointLightShadow; - }(LightShadow); + } PointLightShadow.prototype.isPointLightShadow = true; - var PointLight = /*#__PURE__*/function (_Light) { - _inheritsLoose(PointLight, _Light); + 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. - function PointLight(color, intensity, distance, decay) { - var _this; - - 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. - - _this.shadow = new PointLightShadow(); - return _this; + this.shadow = new PointLightShadow(); } - var _proto = PointLight.prototype; + 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; + } - _proto.copy = function copy(source) { - _Light.prototype.copy.call(this, source); + 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); + } + copy(source) { + super.copy(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; - 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; + 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 _proto = OrthographicCamera.prototype; - - _proto.copy = function copy(source, recursive) { - _Camera.prototype.copy.call(this, source, recursive); - + copy(source, recursive) { + super.copy(source, recursive); this.left = source.left; this.right = source.right; this.top = source.top; @@ -29522,9 +27542,9 @@ this.zoom = source.zoom; this.view = source.view === null ? null : Object.assign({}, source.view); return this; - }; + } - _proto.setViewOffset = function setViewOffset(fullWidth, fullHeight, x, y, width, height) { + setViewOffset(fullWidth, fullHeight, x, y, width, height) { if (this.view === null) { this.view = { enabled: true, @@ -29545,29 +27565,29 @@ this.view.width = width; this.view.height = height; this.updateProjectionMatrix(); - }; + } - _proto.clearViewOffset = function clearViewOffset() { + clearViewOffset() { if (this.view !== null) { this.view.enabled = false; } this.updateProjectionMatrix(); - }; + } - _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; + 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; if (this.view !== null && this.view.enabled) { - var scaleW = (this.right - this.left) / this.view.fullWidth / this.zoom; - var scaleH = (this.top - this.bottom) / this.view.fullHeight / this.zoom; + const scaleW = (this.right - this.left) / this.view.fullWidth / this.zoom; + const 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; @@ -29576,10 +27596,10 @@ this.projectionMatrix.makeOrthographic(left, right, top, bottom, this.near, this.far); this.projectionMatrixInverse.copy(this.projectionMatrix).invert(); - }; + } - _proto.toJSON = function toJSON(meta) { - var data = Object3D.prototype.toJSON.call(this, meta); + toJSON(meta) { + const data = Object3D.prototype.toJSON.call(this, meta); data.object.zoom = this.zoom; data.object.left = this.left; data.object.right = this.right; @@ -29589,115 +27609,75 @@ 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; - var DirectionalLightShadow = /*#__PURE__*/function (_LightShadow) { - _inheritsLoose(DirectionalLightShadow, _LightShadow); - - function DirectionalLightShadow() { - return _LightShadow.call(this, new OrthographicCamera(-5, 5, 5, -5, 0.5, 500)) || this; + class DirectionalLightShadow extends LightShadow { + constructor() { + super(new OrthographicCamera(-5, 5, 5, -5, 0.5, 500)); } - return DirectionalLightShadow; - }(LightShadow); + } DirectionalLightShadow.prototype.isDirectionalLightShadow = true; - 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; + 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 _proto = DirectionalLight.prototype; - - _proto.copy = function copy(source) { - _Light.prototype.copy.call(this, source); - + copy(source) { + super.copy(source); this.target = source.target.clone(); this.shadow = source.shadow.clone(); return this; - }; + } - return DirectionalLight; - }(Light); + } DirectionalLight.prototype.isDirectionalLight = true; - 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; + class AmbientLight extends Light { + constructor(color, intensity) { + super(color, intensity); + this.type = 'AmbientLight'; } - return AmbientLight; - }(Light); + } AmbientLight.prototype.isAmbientLight = true; - 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; + class RectAreaLight extends Light { + constructor(color, intensity, width = 10, height = 10) { + super(color, intensity); + this.type = 'RectAreaLight'; + this.width = width; + this.height = height; } - var _proto = RectAreaLight.prototype; - - _proto.copy = function copy(source) { - _Light.prototype.copy.call(this, source); - + copy(source) { + super.copy(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; @@ -29710,41 +27690,39 @@ */ // 3-band SH defined by 9 coefficients - var SphericalHarmonics3 = /*#__PURE__*/function () { - function SphericalHarmonics3() { + class SphericalHarmonics3 { + constructor() { this.coefficients = []; - for (var i = 0; i < 9; i++) { + for (let i = 0; i < 9; i++) { this.coefficients.push(new Vector3()); } } - var _proto = SphericalHarmonics3.prototype; - - _proto.set = function set(coefficients) { - for (var i = 0; i < 9; i++) { + set(coefficients) { + for (let i = 0; i < 9; i++) { this.coefficients[i].copy(coefficients[i]); } return this; - }; + } - _proto.zero = function zero() { - for (var i = 0; i < 9; i++) { + zero() { + for (let i = 0; i < 9; i++) { this.coefficients[i].set(0, 0, 0); } return this; } // get the radiance in the direction of the normal // target is a Vector3 - ; - _proto.getAt = function getAt(normal, target) { + + getAt(normal, target) { // normal is assumed to be unit length - var x = normal.x, - y = normal.y, - z = normal.z; - var coeff = this.coefficients; // band 0 + const x = normal.x, + y = normal.y, + z = normal.z; + const coeff = this.coefficients; // band 0 target.copy(coeff[0]).multiplyScalar(0.282095); // band 1 @@ -29761,14 +27739,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 - ; - _proto.getIrradianceAt = function getIrradianceAt(normal, target) { + + getIrradianceAt(normal, target) { // normal is assumed to be unit length - var x = normal.x, - y = normal.y, - z = normal.z; - var coeff = this.coefficients; // band 0 + const x = normal.x, + y = normal.y, + z = normal.z; + const coeff = this.coefficients; // band 0 target.copy(coeff[0]).multiplyScalar(0.886227); // π * 0.282095 // band 1 @@ -29787,97 +27765,85 @@ target.addScaledVector(coeff[8], 0.429043 * (x * x - y * y)); // ( π / 4 ) * 0.546274 return target; - }; + } - _proto.add = function add(sh) { - for (var i = 0; i < 9; i++) { + add(sh) { + for (let i = 0; i < 9; i++) { this.coefficients[i].add(sh.coefficients[i]); } return this; - }; + } - _proto.addScaledSH = function addScaledSH(sh, s) { - for (var i = 0; i < 9; i++) { + addScaledSH(sh, s) { + for (let i = 0; i < 9; i++) { this.coefficients[i].addScaledVector(sh.coefficients[i], s); } return this; - }; + } - _proto.scale = function scale(s) { - for (var i = 0; i < 9; i++) { + scale(s) { + for (let i = 0; i < 9; i++) { this.coefficients[i].multiplyScalar(s); } return this; - }; + } - _proto.lerp = function lerp(sh, alpha) { - for (var i = 0; i < 9; i++) { + lerp(sh, alpha) { + for (let i = 0; i < 9; i++) { this.coefficients[i].lerp(sh.coefficients[i], alpha); } return this; - }; + } - _proto.equals = function equals(sh) { - for (var i = 0; i < 9; i++) { + equals(sh) { + for (let i = 0; i < 9; i++) { if (!this.coefficients[i].equals(sh.coefficients[i])) { return false; } } return true; - }; + } - _proto.copy = function copy(sh) { + copy(sh) { return this.set(sh.coefficients); - }; + } - _proto.clone = function clone() { + clone() { return new this.constructor().copy(this); - }; - - _proto.fromArray = function fromArray(array, offset) { - if (offset === void 0) { - offset = 0; - } + } - var coefficients = this.coefficients; + fromArray(array, offset = 0) { + const coefficients = this.coefficients; - for (var i = 0; i < 9; i++) { + for (let 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; - } + } - var coefficients = this.coefficients; + toArray(array = [], offset = 0) { + const coefficients = this.coefficients; - for (var i = 0; i < 9; i++) { + for (let i = 0; i < 9; i++) { coefficients[i].toArray(array, offset + i * 3); } return array; } // evaluate the basis functions // shBasis is an Array[ 9 ] - ; - SphericalHarmonics3.getBasisAt = function getBasisAt(normal, shBasis) { + + static getBasisAt(normal, shBasis) { // normal is assumed to be unit length - var x = normal.x, - y = normal.y, - z = normal.z; // band 0 + const x = normal.x, + y = normal.y, + z = normal.z; // band 0 shBasis[0] = 0.282095; // band 1 @@ -29890,76 +27856,50 @@ 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; - 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; + class LightProbe extends Light { + constructor(sh = new SphericalHarmonics3(), intensity = 1) { + super(undefined, intensity); + this.sh = sh; } - var _proto = LightProbe.prototype; - - _proto.copy = function copy(source) { - _Light.prototype.copy.call(this, source); - + copy(source) { + super.copy(source); this.sh.copy(source.sh); return this; - }; + } - _proto.fromJSON = function fromJSON(json) { + 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; - var MaterialLoader = /*#__PURE__*/function (_Loader) { - _inheritsLoose(MaterialLoader, _Loader); - - function MaterialLoader(manager) { - var _this; - - _this = _Loader.call(this, manager) || this; - _this.textures = {}; - return _this; + class MaterialLoader extends Loader { + constructor(manager) { + super(manager); + this.textures = {}; } - var _proto = MaterialLoader.prototype; - - _proto.load = function load(url, onLoad, onProgress, onError) { - var scope = this; - var loader = new FileLoader(scope.manager); + load(url, onLoad, onProgress, onError) { + const scope = this; + const loader = new FileLoader(scope.manager); loader.setPath(scope.path); loader.setRequestHeader(scope.requestHeader); loader.setWithCredentials(scope.withCredentials); @@ -29976,10 +27916,10 @@ scope.manager.itemError(url); } }, onProgress, onError); - }; + } - _proto.parse = function parse(json) { - var textures = this.textures; + parse(json) { + const textures = this.textures; function getTexture(name) { if (textures[name] === undefined) { @@ -29989,7 +27929,7 @@ return textures[name]; } - var material = new Materials[json.type](); + const 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); @@ -30053,8 +27993,8 @@ if (json.uniforms !== undefined) { - for (var name in json.uniforms) { - var uniform = json.uniforms[name]; + for (const name in json.uniforms) { + const uniform = json.uniforms[name]; material.uniforms[name] = {}; switch (uniform.type) { @@ -30097,7 +28037,7 @@ if (json.fragmentShader !== undefined) material.fragmentShader = json.fragmentShader; if (json.extensions !== undefined) { - for (var key in json.extensions) { + for (const key in json.extensions) { material.extensions[key] = json.extensions[key]; } } // Deprecated @@ -30118,7 +28058,7 @@ if (json.normalMapType !== undefined) material.normalMapType = json.normalMapType; if (json.normalScale !== undefined) { - var normalScale = json.normalScale; + let normalScale = json.normalScale; if (Array.isArray(normalScale) === false) { // Blender exporter used to export a scalar. See #7459 @@ -30152,27 +28092,26 @@ if (json.transmission !== undefined) material.transmission = json.transmission; if (json.transmissionMap !== undefined) material.transmissionMap = getTexture(json.transmissionMap); return material; - }; + } - _proto.setTextures = function setTextures(value) { + setTextures(value) { this.textures = value; return this; - }; + } - return MaterialLoader; - }(Loader); + } - var LoaderUtils = { - decodeText: function decodeText(array) { + const LoaderUtils = { + decodeText: function (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. - var s = ''; + let s = ''; - for (var i = 0, il = array.length; i < il; i++) { + for (let i = 0, il = array.length; i < il; i++) { // Implicitly assumes little-endian. s += String.fromCharCode(array[i]); } @@ -30185,8 +28124,8 @@ return s; } }, - extractUrlBase: function extractUrlBase(url) { - var index = url.lastIndexOf('/'); + extractUrlBase: function (url) { + const index = url.lastIndexOf('/'); if (index === -1) return './'; return url.substr(0, index + 1); } @@ -30201,16 +28140,16 @@ InstancedBufferGeometry.prototype = Object.assign(Object.create(BufferGeometry.prototype), { constructor: InstancedBufferGeometry, isInstancedBufferGeometry: true, - copy: function copy(source) { + copy: function (source) { BufferGeometry.prototype.copy.call(this, source); this.instanceCount = source.instanceCount; return this; }, - clone: function clone() { + clone: function () { return new this.constructor().copy(this); }, - toJSON: function toJSON() { - var data = BufferGeometry.prototype.toJSON.call(this); + toJSON: function () { + const data = BufferGeometry.prototype.toJSON.call(this); data.instanceCount = this.instanceCount; data.isInstancedBufferGeometry = true; return data; @@ -30231,31 +28170,27 @@ InstancedBufferAttribute.prototype = Object.assign(Object.create(BufferAttribute.prototype), { constructor: InstancedBufferAttribute, isInstancedBufferAttribute: true, - copy: function copy(source) { + copy: function (source) { BufferAttribute.prototype.copy.call(this, source); this.meshPerAttribute = source.meshPerAttribute; return this; }, - toJSON: function toJSON() { - var data = BufferAttribute.prototype.toJSON.call(this); + toJSON: function () { + const data = BufferAttribute.prototype.toJSON.call(this); data.meshPerAttribute = this.meshPerAttribute; data.isInstancedBufferAttribute = true; return data; } }); - var BufferGeometryLoader = /*#__PURE__*/function (_Loader) { - _inheritsLoose(BufferGeometryLoader, _Loader); - - function BufferGeometryLoader(manager) { - return _Loader.call(this, manager) || this; + class BufferGeometryLoader extends Loader { + constructor(manager) { + super(manager); } - var _proto = BufferGeometryLoader.prototype; - - _proto.load = function load(url, onLoad, onProgress, onError) { - var scope = this; - var loader = new FileLoader(scope.manager); + load(url, onLoad, onProgress, onError) { + const scope = this; + const loader = new FileLoader(scope.manager); loader.setPath(scope.path); loader.setRequestHeader(scope.requestHeader); loader.setWithCredentials(scope.withCredentials); @@ -30272,19 +28207,19 @@ scope.manager.itemError(url); } }, onProgress, onError); - }; + } - _proto.parse = function parse(json) { - var interleavedBufferMap = {}; - var arrayBufferMap = {}; + parse(json) { + const interleavedBufferMap = {}; + const arrayBufferMap = {}; function getInterleavedBuffer(json, uuid) { if (interleavedBufferMap[uuid] !== undefined) return interleavedBufferMap[uuid]; - 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); + 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); ib.uuid = interleavedBuffer.uuid; interleavedBufferMap[uuid] = ib; return ib; @@ -30292,90 +28227,86 @@ function getArrayBuffer(json, uuid) { if (arrayBufferMap[uuid] !== undefined) return arrayBufferMap[uuid]; - var arrayBuffers = json.arrayBuffers; - var arrayBuffer = arrayBuffers[uuid]; - var ab = new Uint32Array(arrayBuffer).buffer; + const arrayBuffers = json.arrayBuffers; + const arrayBuffer = arrayBuffers[uuid]; + const ab = new Uint32Array(arrayBuffer).buffer; arrayBufferMap[uuid] = ab; return ab; } - var geometry = json.isInstancedBufferGeometry ? new InstancedBufferGeometry() : new BufferGeometry(); - var index = json.data.index; + const geometry = json.isInstancedBufferGeometry ? new InstancedBufferGeometry() : new BufferGeometry(); + const index = json.data.index; if (index !== undefined) { - var typedArray = getTypedArray(index.type, index.array); + const typedArray = getTypedArray(index.type, index.array); geometry.setIndex(new BufferAttribute(typedArray, 1)); } - var attributes = json.data.attributes; + const attributes = json.data.attributes; - for (var key in attributes) { - var attribute = attributes[key]; - var bufferAttribute = void 0; + for (const key in attributes) { + const attribute = attributes[key]; + let bufferAttribute; if (attribute.isInterleavedBufferAttribute) { - var interleavedBuffer = getInterleavedBuffer(json.data, attribute.data); + const interleavedBuffer = getInterleavedBuffer(json.data, attribute.data); bufferAttribute = new InterleavedBufferAttribute(interleavedBuffer, attribute.itemSize, attribute.offset, attribute.normalized); } else { - var _typedArray = getTypedArray(attribute.type, attribute.array); - - var bufferAttributeConstr = attribute.isInstancedBufferAttribute ? InstancedBufferAttribute : BufferAttribute; - bufferAttribute = new bufferAttributeConstr(_typedArray, attribute.itemSize, attribute.normalized); + const typedArray = getTypedArray(attribute.type, attribute.array); + const bufferAttributeConstr = attribute.isInstancedBufferAttribute ? InstancedBufferAttribute : BufferAttribute; + bufferAttribute = new bufferAttributeConstr(typedArray, attribute.itemSize, attribute.normalized); } if (attribute.name !== undefined) bufferAttribute.name = attribute.name; geometry.setAttribute(key, bufferAttribute); } - var morphAttributes = json.data.morphAttributes; + const morphAttributes = json.data.morphAttributes; if (morphAttributes) { - 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 (const key in morphAttributes) { + const attributeArray = morphAttributes[key]; + const array = []; - var _bufferAttribute = void 0; + for (let i = 0, il = attributeArray.length; i < il; i++) { + const attribute = attributeArray[i]; + let bufferAttribute; - if (_attribute.isInterleavedBufferAttribute) { - var _interleavedBuffer = getInterleavedBuffer(json.data, _attribute.data); - - _bufferAttribute = new InterleavedBufferAttribute(_interleavedBuffer, _attribute.itemSize, _attribute.offset, _attribute.normalized); + if (attribute.isInterleavedBufferAttribute) { + const interleavedBuffer = getInterleavedBuffer(json.data, attribute.data); + bufferAttribute = new InterleavedBufferAttribute(interleavedBuffer, attribute.itemSize, attribute.offset, attribute.normalized); } else { - var _typedArray2 = getTypedArray(_attribute.type, _attribute.array); - - _bufferAttribute = new BufferAttribute(_typedArray2, _attribute.itemSize, _attribute.normalized); + const typedArray = getTypedArray(attribute.type, attribute.array); + bufferAttribute = new BufferAttribute(typedArray, attribute.itemSize, attribute.normalized); } - if (_attribute.name !== undefined) _bufferAttribute.name = _attribute.name; - array.push(_bufferAttribute); + if (attribute.name !== undefined) bufferAttribute.name = attribute.name; + array.push(bufferAttribute); } - geometry.morphAttributes[_key] = array; + geometry.morphAttributes[key] = array; } } - var morphTargetsRelative = json.data.morphTargetsRelative; + const morphTargetsRelative = json.data.morphTargetsRelative; if (morphTargetsRelative) { geometry.morphTargetsRelative = true; } - var groups = json.data.groups || json.data.drawcalls || json.data.offsets; + const groups = json.data.groups || json.data.drawcalls || json.data.offsets; if (groups !== undefined) { - for (var _i = 0, n = groups.length; _i !== n; ++_i) { - var group = groups[_i]; + for (let i = 0, n = groups.length; i !== n; ++i) { + const group = groups[i]; geometry.addGroup(group.start, group.count, group.materialIndex); } } - var boundingSphere = json.data.boundingSphere; + const boundingSphere = json.data.boundingSphere; if (boundingSphere !== undefined) { - var center = new Vector3(); + const center = new Vector3(); if (boundingSphere.center !== undefined) { center.fromArray(boundingSphere.center); @@ -30387,30 +28318,25 @@ 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); + } - function ObjectLoader(manager) { - return _Loader.call(this, manager) || this; + class ObjectLoader extends Loader { + constructor(manager) { + super(manager); } - var _proto = ObjectLoader.prototype; - - _proto.load = function load(url, onLoad, onProgress, onError) { - var scope = this; - var path = this.path === '' ? LoaderUtils.extractUrlBase(url) : this.path; + load(url, onLoad, onProgress, onError) { + const scope = this; + const path = this.path === '' ? LoaderUtils.extractUrlBase(url) : this.path; this.resourcePath = this.resourcePath || path; - var loader = new FileLoader(this.manager); + const loader = new FileLoader(this.manager); loader.setPath(this.path); loader.setRequestHeader(this.requestHeader); loader.setWithCredentials(this.withCredentials); loader.load(url, function (text) { - var json = null; + let json = null; try { json = JSON.parse(text); @@ -30420,7 +28346,7 @@ return; } - var metadata = json.metadata; + const metadata = json.metadata; if (metadata === undefined || metadata.type === undefined || metadata.type.toLowerCase() === 'geometry') { console.error('THREE.ObjectLoader: Can\'t load ' + url); @@ -30429,25 +28355,25 @@ scope.parse(json, onLoad); }, onProgress, onError); - }; + } - _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 () { + 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 () { if (onLoad !== undefined) onLoad(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); + 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); this.bindSkeletons(object, skeletons); // if (onLoad !== undefined) { - var hasImages = false; + let hasImages = false; - for (var uuid in images) { + for (const uuid in images) { if (images[uuid] instanceof HTMLImageElement) { hasImages = true; break; @@ -30458,49 +28384,49 @@ } return object; - }; + } - _proto.parseShapes = function parseShapes(json) { - var shapes = {}; + parseShapes(json) { + const shapes = {}; if (json !== undefined) { - for (var i = 0, l = json.length; i < l; i++) { - var shape = new Shape().fromJSON(json[i]); + for (let i = 0, l = json.length; i < l; i++) { + const shape = new Shape().fromJSON(json[i]); shapes[shape.uuid] = shape; } } return shapes; - }; + } - _proto.parseSkeletons = function parseSkeletons(json, object) { - var skeletons = {}; - var bones = {}; // generate bone lookup table + parseSkeletons(json, object) { + const skeletons = {}; + const bones = {}; // generate bone lookup table object.traverse(function (child) { if (child.isBone) bones[child.uuid] = child; }); // create skeletons if (json !== undefined) { - for (var i = 0, l = json.length; i < l; i++) { - var skeleton = new Skeleton().fromJSON(json[i], bones); + for (let i = 0, l = json.length; i < l; i++) { + const skeleton = new Skeleton().fromJSON(json[i], bones); skeletons[skeleton.uuid] = skeleton; } } return skeletons; - }; + } - _proto.parseGeometries = function parseGeometries(json, shapes) { - var geometries = {}; - var geometryShapes; + parseGeometries(json, shapes) { + const geometries = {}; + let geometryShapes; if (json !== undefined) { - var bufferGeometryLoader = new BufferGeometryLoader(); + const bufferGeometryLoader = new BufferGeometryLoader(); - for (var i = 0, l = json.length; i < l; i++) { - var geometry = void 0; - var data = json[i]; + for (let i = 0, l = json.length; i < l; i++) { + let geometry; + const data = json[i]; switch (data.type) { case 'PlaneGeometry': @@ -30580,8 +28506,8 @@ case 'ShapeBufferGeometry': geometryShapes = []; - for (var j = 0, jl = data.shapes.length; j < jl; j++) { - var shape = shapes[data.shapes[j]]; + for (let j = 0, jl = data.shapes.length; j < jl; j++) { + const shape = shapes[data.shapes[j]]; geometryShapes.push(shape); } @@ -30592,12 +28518,12 @@ case 'ExtrudeBufferGeometry': geometryShapes = []; - for (var _j = 0, _jl = data.shapes.length; _j < _jl; _j++) { - var _shape = shapes[data.shapes[_j]]; - geometryShapes.push(_shape); + for (let j = 0, jl = data.shapes.length; j < jl; j++) { + const shape = shapes[data.shapes[j]]; + geometryShapes.push(shape); } - var extrudePath = data.options.extrudePath; + const extrudePath = data.options.extrudePath; if (extrudePath !== undefined) { data.options.extrudePath = new Curves[extrudePath.type]().fromJSON(extrudePath); @@ -30628,26 +28554,26 @@ } return geometries; - }; + } - _proto.parseMaterials = function parseMaterials(json, textures) { - var cache = {}; // MultiMaterial + parseMaterials(json, textures) { + const cache = {}; // MultiMaterial - var materials = {}; + const materials = {}; if (json !== undefined) { - var loader = new MaterialLoader(); + const loader = new MaterialLoader(); loader.setTextures(textures); - for (var i = 0, l = json.length; i < l; i++) { - var data = json[i]; + for (let i = 0, l = json.length; i < l; i++) { + const data = json[i]; if (data.type === 'MultiMaterial') { // Deprecated - var array = []; + const array = []; - for (var j = 0; j < data.materials.length; j++) { - var material = data.materials[j]; + for (let j = 0; j < data.materials.length; j++) { + const material = data.materials[j]; if (cache[material.uuid] === undefined) { cache[material.uuid] = loader.parse(material); @@ -30668,26 +28594,26 @@ } return materials; - }; + } - _proto.parseAnimations = function parseAnimations(json) { - var animations = {}; + parseAnimations(json) { + const animations = {}; if (json !== undefined) { - for (var i = 0; i < json.length; i++) { - var data = json[i]; - var clip = AnimationClip.parse(data); + for (let i = 0; i < json.length; i++) { + const data = json[i]; + const clip = AnimationClip.parse(data); animations[clip.uuid] = clip; } } return animations; - }; + } - _proto.parseImages = function parseImages(json, onLoad) { - var scope = this; - var images = {}; - var loader; + parseImages(json, onLoad) { + const scope = this; + const images = {}; + let loader; function loadImage(url) { scope.manager.itemStart(url); @@ -30701,8 +28627,8 @@ function deserializeImage(image) { if (typeof image === 'string') { - var url = image; - var path = /^(\/\/)|([a-z]+:(\/\/)?)/i.test(url) ? url : scope.resourcePath + url; + const url = image; + const path = /^(\/\/)|([a-z]+:(\/\/)?)/i.test(url) ? url : scope.resourcePath + url; return loadImage(path); } else { if (image.data) { @@ -30718,21 +28644,21 @@ } if (json !== undefined && json.length > 0) { - var manager = new LoadingManager(onLoad); + const manager = new LoadingManager(onLoad); loader = new ImageLoader(manager); loader.setCrossOrigin(this.crossOrigin); - for (var i = 0, il = json.length; i < il; i++) { - var image = json[i]; - var url = image.url; + for (let i = 0, il = json.length; i < il; i++) { + const image = json[i]; + const url = image.url; if (Array.isArray(url)) { // load array of images e.g CubeTexture images[image.uuid] = []; - for (var j = 0, jl = url.length; j < jl; j++) { - var currentUrl = url[j]; - var deserializedImage = deserializeImage(currentUrl); + for (let j = 0, jl = url.length; j < jl; j++) { + const currentUrl = url[j]; + const deserializedImage = deserializeImage(currentUrl); if (deserializedImage !== null) { if (deserializedImage instanceof HTMLImageElement) { @@ -30745,30 +28671,30 @@ } } else { // load single image - var _deserializedImage = deserializeImage(image.url); + const deserializedImage = deserializeImage(image.url); - if (_deserializedImage !== null) { - images[image.uuid] = _deserializedImage; + if (deserializedImage !== null) { + images[image.uuid] = deserializedImage; } } } } return images; - }; + } - _proto.parseTextures = function parseTextures(json, images) { + parseTextures(json, images) { function parseConstant(value, type) { if (typeof value === 'number') return value; console.warn('THREE.ObjectLoader.parseTexture: Constant should be in numeric form.', value); return type[value]; } - var textures = {}; + const textures = {}; if (json !== undefined) { - for (var i = 0, l = json.length; i < l; i++) { - var data = json[i]; + for (let i = 0, l = json.length; i < l; i++) { + const data = json[i]; if (data.image === undefined) { console.warn('THREE.ObjectLoader: No "image" specified for', data.uuid); @@ -30778,8 +28704,8 @@ console.warn('THREE.ObjectLoader: Undefined image', data.image); } - var texture = void 0; - var image = images[data.image]; + let texture; + const image = images[data.image]; if (Array.isArray(image)) { texture = new CubeTexture(image); @@ -30821,10 +28747,10 @@ } return textures; - }; + } - _proto.parseObject = function parseObject(data, geometries, materials, animations) { - var object; + parseObject(data, geometries, materials, animations) { + let object; function getGeometry(name) { if (geometries[name] === undefined) { @@ -30838,10 +28764,10 @@ if (name === undefined) return undefined; if (Array.isArray(name)) { - var array = []; + const array = []; - for (var i = 0, l = name.length; i < l; i++) { - var uuid = name[i]; + for (let i = 0, l = name.length; i < l; i++) { + const uuid = name[i]; if (materials[uuid] === undefined) { console.warn('THREE.ObjectLoader: Undefined material', uuid); @@ -30860,7 +28786,7 @@ return materials[name]; } - var geometry, material; + let geometry, material; switch (data.type) { case 'Scene': @@ -30943,8 +28869,8 @@ case 'InstancedMesh': geometry = getGeometry(data.geometry); material = getMaterial(data.material); - var count = data.count; - var instanceMatrix = data.instanceMatrix; + const count = data.count; + const instanceMatrix = data.instanceMatrix; object = new InstancedMesh(geometry, material, count); object.instanceMatrix = new BufferAttribute(new Float32Array(instanceMatrix.array), 16); break; @@ -31018,29 +28944,29 @@ if (data.layers !== undefined) object.layers.mask = data.layers; if (data.children !== undefined) { - var children = data.children; + const children = data.children; - for (var i = 0; i < children.length; i++) { + for (let i = 0; i < children.length; i++) { object.add(this.parseObject(children[i], geometries, materials, animations)); } } if (data.animations !== undefined) { - var objectAnimations = data.animations; + const objectAnimations = data.animations; - for (var _i = 0; _i < objectAnimations.length; _i++) { - var uuid = objectAnimations[_i]; + for (let i = 0; i < objectAnimations.length; i++) { + const uuid = objectAnimations[i]; object.animations.push(animations[uuid]); } } if (data.type === 'LOD') { if (data.autoUpdate !== undefined) object.autoUpdate = data.autoUpdate; - var levels = data.levels; + const levels = data.levels; - for (var l = 0; l < levels.length; l++) { - var level = levels[l]; - var child = object.getObjectByProperty('uuid', level.object); + for (let l = 0; l < levels.length; l++) { + const level = levels[l]; + const child = object.getObjectByProperty('uuid', level.object); if (child !== undefined) { object.addLevel(child, level.distance); @@ -31049,13 +28975,13 @@ } return object; - }; + } - _proto.bindSkeletons = function bindSkeletons(object, skeletons) { + bindSkeletons(object, skeletons) { if (Object.keys(skeletons).length === 0) return; object.traverse(function (child) { if (child.isSkinnedMesh === true && child.skeleton !== undefined) { - var skeleton = skeletons[child.skeleton]; + const skeleton = skeletons[child.skeleton]; if (skeleton === undefined) { console.warn('THREE.ObjectLoader: No skeleton found with UUID:', child.skeleton); @@ -31066,17 +28992,16 @@ }); } /* DEPRECATED */ - ; - _proto.setTexturePath = function setTexturePath(value) { + + setTexturePath(value) { console.warn('THREE.ObjectLoader: .setTexturePath() has been renamed to .setResourcePath().'); return this.setResourcePath(value); - }; + } - return ObjectLoader; - }(Loader); + } - var TEXTURE_MAPPING = { + const TEXTURE_MAPPING = { UVMapping: UVMapping, CubeReflectionMapping: CubeReflectionMapping, CubeRefractionMapping: CubeRefractionMapping, @@ -31085,12 +29010,12 @@ CubeUVReflectionMapping: CubeUVReflectionMapping, CubeUVRefractionMapping: CubeUVRefractionMapping }; - var TEXTURE_WRAPPING = { + const TEXTURE_WRAPPING = { RepeatWrapping: RepeatWrapping, ClampToEdgeWrapping: ClampToEdgeWrapping, MirroredRepeatWrapping: MirroredRepeatWrapping }; - var TEXTURE_FILTER = { + const TEXTURE_FILTER = { NearestFilter: NearestFilter, NearestMipmapNearestFilter: NearestMipmapNearestFilter, NearestMipmapLinearFilter: NearestMipmapLinearFilter, @@ -31121,12 +29046,12 @@ this.options = options; return this; }, - load: function load(url, onLoad, onProgress, onError) { + load: function (url, onLoad, onProgress, onError) { if (url === undefined) url = ''; if (this.path !== undefined) url = this.path + url; url = this.manager.resolveURL(url); - var scope = this; - var cached = Cache.get(url); + const scope = this; + const cached = Cache.get(url); if (cached !== undefined) { scope.manager.itemStart(url); @@ -31137,7 +29062,7 @@ return cached; } - var fetchOptions = {}; + const fetchOptions = {}; fetchOptions.credentials = this.crossOrigin === 'anonymous' ? 'same-origin' : 'include'; fetchOptions.headers = this.requestHeader; fetch(url, fetchOptions).then(function (res) { @@ -31159,72 +29084,68 @@ } }); - var ShapePath = /*#__PURE__*/function () { - function ShapePath() { + class ShapePath { + constructor() { this.type = 'ShapePath'; this.color = new Color(); this.subPaths = []; this.currentPath = null; } - var _proto = ShapePath.prototype; - - _proto.moveTo = function moveTo(x, y) { + moveTo(x, y) { this.currentPath = new Path(); this.subPaths.push(this.currentPath); this.currentPath.moveTo(x, y); return this; - }; + } - _proto.lineTo = function lineTo(x, y) { + lineTo(x, y) { this.currentPath.lineTo(x, y); return this; - }; + } - _proto.quadraticCurveTo = function quadraticCurveTo(aCPx, aCPy, aX, aY) { + quadraticCurveTo(aCPx, aCPy, aX, aY) { this.currentPath.quadraticCurveTo(aCPx, aCPy, aX, aY); return this; - }; + } - _proto.bezierCurveTo = function bezierCurveTo(aCP1x, aCP1y, aCP2x, aCP2y, aX, aY) { + bezierCurveTo(aCP1x, aCP1y, aCP2x, aCP2y, aX, aY) { this.currentPath.bezierCurveTo(aCP1x, aCP1y, aCP2x, aCP2y, aX, aY); return this; - }; + } - _proto.splineThru = function splineThru(pts) { + splineThru(pts) { this.currentPath.splineThru(pts); return this; - }; + } - _proto.toShapes = function toShapes(isCCW, noHoles) { + toShapes(isCCW, noHoles) { function toShapesNoHoles(inSubpaths) { - var shapes = []; - - for (var i = 0, l = inSubpaths.length; i < l; i++) { - var _tmpPath = inSubpaths[i]; + const shapes = []; - var _tmpShape = new Shape(); - - _tmpShape.curves = _tmpPath.curves; - shapes.push(_tmpShape); + for (let i = 0, l = inSubpaths.length; i < l; i++) { + const tmpPath = inSubpaths[i]; + const tmpShape = new Shape(); + tmpShape.curves = tmpPath.curves; + shapes.push(tmpShape); } return shapes; } function isPointInsidePolygon(inPt, inPolygon) { - var polyLen = inPolygon.length; // inPt on polygon contour => immediate success or + const polyLen = inPolygon.length; // inPt on polygon contour => immediate success or // toggling of inside/outside at every single! intersection point of an edge // with the horizontal line through inPt, left of inPt // not counting lowerY endpoints of edges and whole edges on that line - var inside = false; + let inside = false; - 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; + for (let p = polyLen - 1, q = 0; q < polyLen; p = q++) { + let edgeLowPt = inPolygon[p]; + let edgeHighPt = inPolygon[q]; + let edgeDx = edgeHighPt.x - edgeLowPt.x; + let edgeDy = edgeHighPt.y - edgeLowPt.y; if (Math.abs(edgeDy) > Number.EPSILON) { // not parallel @@ -31241,7 +29162,7 @@ if (inPt.x === edgeLowPt.x) return true; // inPt is on contour ? // continue; // no intersection or edgeLowPt => doesn't count !!! } else { - var perpEdge = edgeDy * (inPt.x - edgeLowPt.x) - edgeDx * (inPt.y - edgeLowPt.y); + const perpEdge = edgeDy * (inPt.x - edgeLowPt.x) - edgeDx * (inPt.y - edgeLowPt.y); if (perpEdge === 0) return true; // inPt is on contour ? if (perpEdge < 0) continue; @@ -31260,12 +29181,12 @@ return inside; } - var isClockWise = ShapeUtils.isClockWise; - var subPaths = this.subPaths; + const isClockWise = ShapeUtils.isClockWise; + const subPaths = this.subPaths; if (subPaths.length === 0) return []; if (noHoles === true) return toShapesNoHoles(subPaths); - var solid, tmpPath, tmpShape; - var shapes = []; + let solid, tmpPath, tmpShape; + const shapes = []; if (subPaths.length === 1) { tmpPath = subPaths[0]; @@ -31275,18 +29196,18 @@ return shapes; } - var holesFirst = !isClockWise(subPaths[0].getPoints()); + let holesFirst = !isClockWise(subPaths[0].getPoints()); holesFirst = isCCW ? !holesFirst : holesFirst; // console.log("Holes first", holesFirst); - var betterShapeHoles = []; - var newShapes = []; - var newShapeHoles = []; - var mainIdx = 0; - var tmpPoints; + const betterShapeHoles = []; + const newShapes = []; + let newShapeHoles = []; + let mainIdx = 0; + let tmpPoints; newShapes[mainIdx] = undefined; newShapeHoles[mainIdx] = []; - for (var i = 0, l = subPaths.length; i < l; i++) { + for (let i = 0, l = subPaths.length; i < l; i++) { tmpPath = subPaths[i]; tmpPoints = tmpPath.getPoints(); solid = isClockWise(tmpPoints); @@ -31313,24 +29234,24 @@ if (!newShapes[0]) return toShapesNoHoles(subPaths); if (newShapes.length > 1) { - var ambiguous = false; - var toChange = []; + let ambiguous = false; + const toChange = []; - for (var sIdx = 0, sLen = newShapes.length; sIdx < sLen; sIdx++) { + for (let sIdx = 0, sLen = newShapes.length; sIdx < sLen; sIdx++) { betterShapeHoles[sIdx] = []; } - for (var _sIdx = 0, _sLen = newShapes.length; _sIdx < _sLen; _sIdx++) { - var sho = newShapeHoles[_sIdx]; + for (let sIdx = 0, sLen = newShapes.length; sIdx < sLen; sIdx++) { + const sho = newShapeHoles[sIdx]; - for (var hIdx = 0; hIdx < sho.length; hIdx++) { - var ho = sho[hIdx]; - var hole_unassigned = true; + for (let hIdx = 0; hIdx < sho.length; hIdx++) { + const ho = sho[hIdx]; + let hole_unassigned = true; - for (var s2Idx = 0; s2Idx < newShapes.length; s2Idx++) { + for (let 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 }); @@ -31345,7 +29266,7 @@ } if (hole_unassigned) { - betterShapeHoles[_sIdx].push(ho); + betterShapeHoles[sIdx].push(ho); } } } // console.log("ambiguous: ", ambiguous); @@ -31357,67 +29278,59 @@ } } - var tmpHoles; + let tmpHoles; - for (var _i = 0, il = newShapes.length; _i < il; _i++) { - tmpShape = newShapes[_i].s; + for (let i = 0, il = newShapes.length; i < il; i++) { + tmpShape = newShapes[i].s; shapes.push(tmpShape); - tmpHoles = newShapeHoles[_i]; + tmpHoles = newShapeHoles[i]; - for (var j = 0, jl = tmpHoles.length; j < jl; j++) { + for (let j = 0, jl = tmpHoles.length; j < jl; j++) { tmpShape.holes.push(tmpHoles[j].h); } } //console.log("shape", shapes); return shapes; - }; + } - return ShapePath; - }(); + } - var Font = /*#__PURE__*/function () { - function Font(data) { + class Font { + constructor(data) { this.type = 'Font'; this.data = data; } - var _proto = Font.prototype; + generateShapes(text, size = 100) { + const shapes = []; + const paths = createPaths(text, size, this.data); - _proto.generateShapes = function generateShapes(text, size) { - if (size === void 0) { - size = 100; - } - - var shapes = []; - var paths = createPaths(text, size, this.data); - - for (var p = 0, pl = paths.length; p < pl; p++) { + for (let 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) { - 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, + 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, offsetY = 0; - for (var i = 0; i < chars.length; i++) { - var char = chars[i]; + for (let i = 0; i < chars.length; i++) { + const char = chars[i]; if (char === '\n') { offsetX = 0; offsetY -= line_height; } else { - var ret = createPath(char, scale, offsetX, offsetY, data); + const ret = createPath(char, scale, offsetX, offsetY, data); offsetX += ret.offsetX; paths.push(ret.path); } @@ -31427,21 +29340,21 @@ } function createPath(char, scale, offsetX, offsetY, data) { - var glyph = data.glyphs[char] || data.glyphs['?']; + const glyph = data.glyphs[char] || data.glyphs['?']; if (!glyph) { console.error('THREE.Font: character "' + char + '" does not exists in font family ' + data.familyName + '.'); return; } - var path = new ShapePath(); - var x, y, cpx, cpy, cpx1, cpy1, cpx2, cpy2; + const path = new ShapePath(); + let x, y, cpx, cpy, cpx1, cpy1, cpx2, cpy2; if (glyph.o) { - var outline = glyph._cachedOutline || (glyph._cachedOutline = glyph.o.split(' ')); + const outline = glyph._cachedOutline || (glyph._cachedOutline = glyph.o.split(' ')); - for (var i = 0, l = outline.length; i < l;) { - var action = outline[i++]; + for (let i = 0, l = outline.length; i < l;) { + const action = outline[i++]; switch (action) { case 'm': @@ -31489,23 +29402,19 @@ Font.prototype.isFont = true; - var FontLoader = /*#__PURE__*/function (_Loader) { - _inheritsLoose(FontLoader, _Loader); - - function FontLoader(manager) { - return _Loader.call(this, manager) || this; + class FontLoader extends Loader { + constructor(manager) { + super(manager); } - var _proto = FontLoader.prototype; - - _proto.load = function load(url, onLoad, onProgress, onError) { - var scope = this; - var loader = new FileLoader(this.manager); + load(url, onLoad, onProgress, onError) { + const scope = this; + const loader = new FileLoader(this.manager); loader.setPath(this.path); loader.setRequestHeader(this.requestHeader); loader.setWithCredentials(scope.withCredentials); loader.load(url, function (text) { - var json; + let json; try { json = JSON.parse(text); @@ -31514,45 +29423,40 @@ json = JSON.parse(text.substring(65, text.length - 2)); } - var font = scope.parse(json); + const font = scope.parse(json); if (onLoad) onLoad(font); }, onProgress, onError); - }; + } - _proto.parse = function parse(json) { + parse(json) { return new Font(json); - }; + } - return FontLoader; - }(Loader); + } - var _context; + let _context; - var AudioContext = { - getContext: function getContext() { + const AudioContext = { + getContext: function () { if (_context === undefined) { _context = new (window.AudioContext || window.webkitAudioContext)(); } return _context; }, - setContext: function setContext(value) { + setContext: function (value) { _context = value; } }; - var AudioLoader = /*#__PURE__*/function (_Loader) { - _inheritsLoose(AudioLoader, _Loader); - - function AudioLoader(manager) { - return _Loader.call(this, manager) || this; + class AudioLoader extends Loader { + constructor(manager) { + super(manager); } - var _proto = AudioLoader.prototype; - - _proto.load = function load(url, onLoad, onProgress, onError) { - var scope = this; - var loader = new FileLoader(this.manager); + load(url, onLoad, onProgress, onError) { + const scope = this; + const loader = new FileLoader(this.manager); loader.setResponseType('arraybuffer'); loader.setPath(this.path); loader.setRequestHeader(this.requestHeader); @@ -31561,8 +29465,8 @@ try { // Create a copy of the buffer. The `decodeAudioData` method // detaches the buffer when complete, preventing reuse. - var bufferCopy = buffer.slice(0); - var context = AudioContext.getContext(); + const bufferCopy = buffer.slice(0); + const context = AudioContext.getContext(); context.decodeAudioData(bufferCopy, function (audioBuffer) { onLoad(audioBuffer); }); @@ -31576,71 +29480,46 @@ scope.manager.itemError(url); } }, onProgress, onError); - }; - - return AudioLoader; - }(Loader); - - var HemisphereLightProbe = /*#__PURE__*/function (_LightProbe) { - _inheritsLoose(HemisphereLightProbe, _LightProbe); - - 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); + 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 ); - return _this; + 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); } - return HemisphereLightProbe; - }(LightProbe); + } HemisphereLightProbe.prototype.isHemisphereLightProbe = true; - var AmbientLightProbe = /*#__PURE__*/function (_LightProbe) { - _inheritsLoose(AmbientLightProbe, _LightProbe); - - 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 ); + 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 ); - _this.sh.coefficients[0].set(color1.r, color1.g, color1.b).multiplyScalar(2 * Math.sqrt(Math.PI)); - - return _this; + this.sh.coefficients[0].set(color1.r, color1.g, color1.b).multiplyScalar(2 * Math.sqrt(Math.PI)); } - return AmbientLightProbe; - }(LightProbe); + } AmbientLightProbe.prototype.isAmbientLightProbe = true; - var _eyeRight = new Matrix4(); + const _eyeRight = new Matrix4(); - var _eyeLeft = new Matrix4(); + const _eyeLeft = new Matrix4(); - var StereoCamera = /*#__PURE__*/function () { - function StereoCamera() { + class StereoCamera { + constructor() { this.type = 'StereoCamera'; this.aspect = 1; this.eyeSep = 0.064; @@ -31661,11 +29540,9 @@ }; } - 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; + update(camera) { + const cache = this._cache; + const needsUpdate = cache.focus !== camera.focus || cache.fov !== camera.fov || cache.aspect !== camera.aspect * this.aspect || cache.near !== camera.near || cache.far !== camera.far || cache.zoom !== camera.zoom || cache.eyeSep !== this.eyeSep; if (needsUpdate) { cache.focus = camera.focus; @@ -31677,11 +29554,11 @@ cache.eyeSep = this.eyeSep; // Off-axis stereoscopic effect based on // http://paulbourke.net/stereographics/stereorender/ - 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 + 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 _eyeLeft.elements[12] = -eyeSepHalf; _eyeRight.elements[12] = eyeSepHalf; // for left eye @@ -31701,13 +29578,12 @@ this.cameraL.matrixWorld.copy(camera.matrixWorld).multiply(_eyeLeft); this.cameraR.matrixWorld.copy(camera.matrixWorld).multiply(_eyeRight); - }; + } - return StereoCamera; - }(); + } - var Clock = /*#__PURE__*/function () { - function Clock(autoStart) { + class Clock { + constructor(autoStart) { this.autoStart = autoStart !== undefined ? autoStart : true; this.startTime = 0; this.oldTime = 0; @@ -31715,28 +29591,26 @@ this.running = false; } - var _proto = Clock.prototype; - - _proto.start = function start() { + start() { this.startTime = now(); this.oldTime = this.startTime; this.elapsedTime = 0; this.running = true; - }; + } - _proto.stop = function stop() { + stop() { this.getElapsedTime(); this.running = false; this.autoStart = false; - }; + } - _proto.getElapsedTime = function getElapsedTime() { + getElapsedTime() { this.getDelta(); return this.elapsedTime; - }; + } - _proto.getDelta = function getDelta() { - var diff = 0; + getDelta() { + let diff = 0; if (this.autoStart && !this.running) { this.start(); @@ -31744,57 +29618,47 @@ } if (this.running) { - var newTime = now(); + const 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 } - var _position$2 = /*@__PURE__*/new Vector3(); - - var _quaternion$3 = /*@__PURE__*/new Quaternion(); - - var _scale$1 = /*@__PURE__*/new Vector3(); + const _position$2 = /*@__PURE__*/new Vector3(); - var _orientation = /*@__PURE__*/new Vector3(); + const _quaternion$3 = /*@__PURE__*/new Quaternion(); - var AudioListener = /*#__PURE__*/function (_Object3D) { - _inheritsLoose(AudioListener, _Object3D); + const _scale$1 = /*@__PURE__*/new Vector3(); - function AudioListener() { - var _this; + const _orientation = /*@__PURE__*/new Vector3(); - _this = _Object3D.call(this) || this; - _this.type = 'AudioListener'; - _this.context = AudioContext.getContext(); - _this.gain = _this.context.createGain(); + 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.gain.connect(_this.context.destination); - - _this.filter = null; - _this.timeDelta = 0; // private - - _this._clock = new Clock(); - return _this; + this._clock = new Clock(); } - var _proto = AudioListener.prototype; - - _proto.getInput = function getInput() { + getInput() { return this.gain; - }; + } - _proto.removeFilter = function removeFilter() { + removeFilter() { if (this.filter !== null) { this.gain.disconnect(this.filter); this.filter.disconnect(this.context.destination); @@ -31803,13 +29667,13 @@ } return this; - }; + } - _proto.getFilter = function getFilter() { + getFilter() { return this.filter; - }; + } - _proto.setFilter = function setFilter(value) { + setFilter(value) { if (this.filter !== null) { this.gain.disconnect(this.filter); this.filter.disconnect(this.context.destination); @@ -31821,22 +29685,21 @@ this.gain.connect(this.filter); this.filter.connect(this.context.destination); return this; - }; + } - _proto.getMasterVolume = function getMasterVolume() { + getMasterVolume() { return this.gain.gain.value; - }; + } - _proto.setMasterVolume = function setMasterVolume(value) { + 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); + } - var listener = this.context.listener; - var up = this.up; + updateMatrixWorld(force) { + super.updateMatrixWorld(force); + const listener = this.context.listener; + const up = this.up; this.timeDelta = this._clock.getDelta(); this.matrixWorld.decompose(_position$2, _quaternion$3, _scale$1); @@ -31844,7 +29707,7 @@ if (listener.positionX) { // code path for Chrome (see #14393) - var endTime = this.context.currentTime + this.timeDelta; + const 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); @@ -31858,87 +29721,73 @@ 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); } - }; + } + + } - 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() { + 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 this.gain; - }; + } - _proto.setNodeSource = function setNodeSource(audioNode) { + setNodeSource(audioNode) { this.hasPlaybackControl = false; this.sourceType = 'audioNode'; this.source = audioNode; this.connect(); return this; - }; + } - _proto.setMediaElementSource = function setMediaElementSource(mediaElement) { + setMediaElementSource(mediaElement) { this.hasPlaybackControl = false; this.sourceType = 'mediaNode'; this.source = this.context.createMediaElementSource(mediaElement); this.connect(); return this; - }; + } - _proto.setMediaStreamSource = function setMediaStreamSource(mediaStream) { + setMediaStreamSource(mediaStream) { this.hasPlaybackControl = false; this.sourceType = 'mediaStreamNode'; this.source = this.context.createMediaStreamSource(mediaStream); this.connect(); return this; - }; + } - _proto.setBuffer = function setBuffer(audioBuffer) { + 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; @@ -31950,7 +29799,7 @@ } this._startedAt = this.context.currentTime + delay; - var source = this.context.createBufferSource(); + const source = this.context.createBufferSource(); source.buffer = this.buffer; source.loop = this.loop; source.loopStart = this.loopStart; @@ -31962,9 +29811,9 @@ this.setDetune(this.detune); this.setPlaybackRate(this.playbackRate); return this.connect(); - }; + } - _proto.pause = function pause() { + pause() { if (this.hasPlaybackControl === false) { console.warn('THREE.Audio: this Audio has no playback control.'); return; @@ -31985,9 +29834,9 @@ } return this; - }; + } - _proto.stop = function stop() { + stop() { if (this.hasPlaybackControl === false) { console.warn('THREE.Audio: this Audio has no playback control.'); return; @@ -31998,13 +29847,13 @@ this.source.onended = null; this.isPlaying = false; return this; - }; + } - _proto.connect = function connect() { + connect() { if (this.filters.length > 0) { this.source.connect(this.filters[0]); - for (var i = 1, l = this.filters.length; i < l; i++) { + for (let i = 1, l = this.filters.length; i < l; i++) { this.filters[i - 1].connect(this.filters[i]); } @@ -32015,13 +29864,13 @@ this._connected = true; return this; - }; + } - _proto.disconnect = function disconnect() { + disconnect() { if (this.filters.length > 0) { this.source.disconnect(this.filters[0]); - for (var i = 1, l = this.filters.length; i < l; i++) { + for (let i = 1, l = this.filters.length; i < l; i++) { this.filters[i - 1].disconnect(this.filters[i]); } @@ -32032,13 +29881,13 @@ this._connected = false; return this; - }; + } - _proto.getFilters = function getFilters() { + getFilters() { return this.filters; - }; + } - _proto.setFilters = function setFilters(value) { + setFilters(value) { if (!value) value = []; if (this._connected === true) { @@ -32050,9 +29899,9 @@ } return this; - }; + } - _proto.setDetune = function setDetune(value) { + setDetune(value) { this.detune = value; if (this.source.detune === undefined) return; // only set detune when available @@ -32061,21 +29910,21 @@ } return this; - }; + } - _proto.getDetune = function getDetune() { + getDetune() { return this.detune; - }; + } - _proto.getFilter = function getFilter() { + getFilter() { return this.getFilters()[0]; - }; + } - _proto.setFilter = function setFilter(filter) { + setFilter(filter) { return this.setFilters(filter ? [filter] : []); - }; + } - _proto.setPlaybackRate = function setPlaybackRate(value) { + setPlaybackRate(value) { if (this.hasPlaybackControl === false) { console.warn('THREE.Audio: this Audio has no playback control.'); return; @@ -32088,26 +29937,26 @@ } return this; - }; + } - _proto.getPlaybackRate = function getPlaybackRate() { + getPlaybackRate() { return this.playbackRate; - }; + } - _proto.onEnded = function onEnded() { + onEnded() { this.isPlaying = false; - }; + } - _proto.getLoop = function getLoop() { + getLoop() { if (this.hasPlaybackControl === false) { console.warn('THREE.Audio: this Audio has no playback control.'); return false; } return this.loop; - }; + } - _proto.setLoop = function setLoop(value) { + setLoop(value) { if (this.hasPlaybackControl === false) { console.warn('THREE.Audio: this Audio has no playback control.'); return; @@ -32120,115 +29969,104 @@ } return this; - }; + } - _proto.setLoopStart = function setLoopStart(value) { + setLoopStart(value) { this.loopStart = value; return this; - }; + } - _proto.setLoopEnd = function setLoopEnd(value) { + setLoopEnd(value) { this.loopEnd = value; return this; - }; + } - _proto.getVolume = function getVolume() { + getVolume() { return this.gain.gain.value; - }; + } - _proto.setVolume = function setVolume(value) { + 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(); + } - var PositionalAudio = /*#__PURE__*/function (_Audio) { - _inheritsLoose(PositionalAudio, _Audio); + const _position$3 = /*@__PURE__*/new Vector3(); - function PositionalAudio(listener) { - var _this; + const _quaternion$4 = /*@__PURE__*/new Quaternion(); - _this = _Audio.call(this, listener) || this; - _this.panner = _this.context.createPanner(); - _this.panner.panningModel = 'HRTF'; + const _scale$2 = /*@__PURE__*/new Vector3(); - _this.panner.connect(_this.gain); + const _orientation$1 = /*@__PURE__*/new Vector3(); - return _this; + class PositionalAudio extends Audio { + constructor(listener) { + super(listener); + this.panner = this.context.createPanner(); + this.panner.panningModel = 'HRTF'; + this.panner.connect(this.gain); } - var _proto = PositionalAudio.prototype; - - _proto.getOutput = function getOutput() { + getOutput() { return this.panner; - }; + } - _proto.getRefDistance = function getRefDistance() { + getRefDistance() { return this.panner.refDistance; - }; + } - _proto.setRefDistance = function setRefDistance(value) { + setRefDistance(value) { this.panner.refDistance = value; return this; - }; + } - _proto.getRolloffFactor = function getRolloffFactor() { + getRolloffFactor() { return this.panner.rolloffFactor; - }; + } - _proto.setRolloffFactor = function setRolloffFactor(value) { + setRolloffFactor(value) { this.panner.rolloffFactor = value; return this; - }; + } - _proto.getDistanceModel = function getDistanceModel() { + getDistanceModel() { return this.panner.distanceModel; - }; + } - _proto.setDistanceModel = function setDistanceModel(value) { + setDistanceModel(value) { this.panner.distanceModel = value; return this; - }; + } - _proto.getMaxDistance = function getMaxDistance() { + getMaxDistance() { return this.panner.maxDistance; - }; + } - _proto.setMaxDistance = function setMaxDistance(value) { + setMaxDistance(value) { this.panner.maxDistance = value; return this; - }; + } - _proto.setDirectionalCone = function setDirectionalCone(coneInnerAngle, coneOuterAngle, coneOuterGain) { + 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$3, _quaternion$4, _scale$2); _orientation$1.set(0, 0, 1).applyQuaternion(_quaternion$4); - var panner = this.panner; + const panner = this.panner; if (panner.positionX) { // code path for Chrome and Firefox (see #14393) - var endTime = this.context.currentTime + this.listener.timeDelta; + const 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); @@ -32239,49 +30077,41 @@ 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); } - var _proto = AudioAnalyser.prototype; - - _proto.getFrequencyData = function getFrequencyData() { + getFrequencyData() { this.analyser.getByteFrequencyData(this.data); return this.data; - }; + } - _proto.getAverageFrequency = function getAverageFrequency() { - var value = 0; - var data = this.getFrequencyData(); + getAverageFrequency() { + let value = 0; + const data = this.getFrequencyData(); - for (var i = 0; i < data.length; i++) { + for (let i = 0; i < data.length; i++) { value += data[i]; } return value / data.length; - }; + } - return AudioAnalyser; - }(); + } - var PropertyMixer = /*#__PURE__*/function () { - function PropertyMixer(binding, typeName, valueSize) { + class PropertyMixer { + constructor(binding, typeName, valueSize) { this.binding = binding; this.valueSize = valueSize; - var mixFunction, mixFunctionAdditive, setIdentity; // buffer layout: [ incoming | accu0 | accu1 | orig | addAccu | (optional work) ] + let mixFunction, mixFunctionAdditive, setIdentity; // buffer layout: [ incoming | accu0 | accu1 | orig | addAccu | (optional work) ] // // interpolators can use .buffer as their .result // the data then goes to 'incoming' @@ -32335,19 +30165,17 @@ } // accumulate data in the 'incoming' region into 'accu' - var _proto = PropertyMixer.prototype; - - _proto.accumulate = function accumulate(accuIndex, weight) { + 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 - var buffer = this.buffer, - stride = this.valueSize, - offset = accuIndex * stride + stride; - var currentWeight = this.cumulativeWeight; + const buffer = this.buffer, + stride = this.valueSize, + offset = accuIndex * stride + stride; + let currentWeight = this.cumulativeWeight; if (currentWeight === 0) { // accuN := incoming * weight - for (var i = 0; i !== stride; ++i) { + for (let i = 0; i !== stride; ++i) { buffer[offset + i] = buffer[i]; } @@ -32355,19 +30183,19 @@ } else { // accuN := accuN + incoming * weight currentWeight += weight; - var mix = weight / currentWeight; + const mix = weight / currentWeight; this._mixBufferRegion(buffer, offset, 0, mix, stride); } this.cumulativeWeight = currentWeight; } // accumulate data in the 'incoming' region into 'add' - ; - _proto.accumulateAdditive = function accumulateAdditive(weight) { - var buffer = this.buffer, - stride = this.valueSize, - offset = stride * this._addIndex; + + accumulateAdditive(weight) { + const buffer = this.buffer, + stride = this.valueSize, + offset = stride * this._addIndex; if (this.cumulativeWeightAdditive === 0) { // add = identity @@ -32379,21 +30207,21 @@ this.cumulativeWeightAdditive += weight; } // apply the state of 'accu' to the binding when accus differ - ; - - _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; + + + apply(accuIndex) { + const 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 ) - var originalValueOffset = stride * this._origIndex; + const originalValueOffset = stride * this._origIndex; this._mixBufferRegion(buffer, offset, originalValueOffset, 1 - weight, stride); } @@ -32403,7 +30231,7 @@ this._mixBufferRegionAdditive(buffer, offset, this._addIndex * stride, 1, stride); } - for (var i = stride, e = stride + stride; i !== e; ++i) { + for (let i = stride, e = stride + stride; i !== e; ++i) { if (buffer[i] !== buffer[i + stride]) { // value has changed -> update scene graph binding.setValue(buffer, offset); @@ -32411,16 +30239,16 @@ } } } // remember the state of the bound property and copy it to both accus - ; - _proto.saveOriginalState = function saveOriginalState() { - var binding = this.binding; - var buffer = this.buffer, - stride = this.valueSize, - originalValueOffset = stride * this._origIndex; + + saveOriginalState() { + const binding = this.binding; + const buffer = this.buffer, + stride = this.valueSize, + originalValueOffset = stride * this._origIndex; binding.getValue(buffer, originalValueOffset); // accu[0..1] := orig -- initially detect changes against the original - for (var i = stride, e = originalValueOffset; i !== e; ++i) { + for (let i = stride, e = originalValueOffset; i !== e; ++i) { buffer[i] = buffer[originalValueOffset + i % stride]; } // Add to identity for additive @@ -32430,141 +30258,140 @@ this.cumulativeWeight = 0; this.cumulativeWeightAdditive = 0; } // apply the state previously taken via 'saveOriginalState' to the binding - ; - _proto.restoreOriginalState = function restoreOriginalState() { - var originalValueOffset = this.valueSize * 3; + + restoreOriginalState() { + const originalValueOffset = this.valueSize * 3; this.binding.setValue(this.buffer, originalValueOffset); - }; + } - _proto._setAdditiveIdentityNumeric = function _setAdditiveIdentityNumeric() { - var startIndex = this._addIndex * this.valueSize; - var endIndex = startIndex + this.valueSize; + _setAdditiveIdentityNumeric() { + const startIndex = this._addIndex * this.valueSize; + const endIndex = startIndex + this.valueSize; - for (var i = startIndex; i < endIndex; i++) { + for (let i = startIndex; i < endIndex; i++) { this.buffer[i] = 0; } - }; + } - _proto._setAdditiveIdentityQuaternion = function _setAdditiveIdentityQuaternion() { + _setAdditiveIdentityQuaternion() { this._setAdditiveIdentityNumeric(); this.buffer[this._addIndex * this.valueSize + 3] = 1; - }; + } - _proto._setAdditiveIdentityOther = function _setAdditiveIdentityOther() { - var startIndex = this._origIndex * this.valueSize; - var targetIndex = this._addIndex * this.valueSize; + _setAdditiveIdentityOther() { + const startIndex = this._origIndex * this.valueSize; + const targetIndex = this._addIndex * this.valueSize; - for (var i = 0; i < this.valueSize; i++) { + for (let i = 0; i < this.valueSize; i++) { this.buffer[targetIndex + i] = this.buffer[startIndex + i]; } } // mix functions - ; - _proto._select = function _select(buffer, dstOffset, srcOffset, t, stride) { + + _select(buffer, dstOffset, srcOffset, t, stride) { if (t >= 0.5) { - for (var i = 0; i !== stride; ++i) { + for (let i = 0; i !== stride; ++i) { buffer[dstOffset + i] = buffer[srcOffset + i]; } } - }; + } - _proto._slerp = function _slerp(buffer, dstOffset, srcOffset, t) { + _slerp(buffer, dstOffset, srcOffset, t) { Quaternion.slerpFlat(buffer, dstOffset, buffer, dstOffset, buffer, srcOffset, t); - }; + } - _proto._slerpAdditive = function _slerpAdditive(buffer, dstOffset, srcOffset, t, stride) { - var workOffset = this._workIndex * stride; // Store result in intermediate buffer offset + _slerpAdditive(buffer, dstOffset, srcOffset, t, stride) { + const 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); - }; + } - _proto._lerp = function _lerp(buffer, dstOffset, srcOffset, t, stride) { - var s = 1 - t; + _lerp(buffer, dstOffset, srcOffset, t, stride) { + const s = 1 - t; - for (var i = 0; i !== stride; ++i) { - var j = dstOffset + i; + for (let i = 0; i !== stride; ++i) { + const j = dstOffset + i; buffer[j] = buffer[j] * s + buffer[srcOffset + i] * t; } - }; + } - _proto._lerpAdditive = function _lerpAdditive(buffer, dstOffset, srcOffset, t, stride) { - for (var i = 0; i !== stride; ++i) { - var j = dstOffset + i; + _lerpAdditive(buffer, dstOffset, srcOffset, t, stride) { + for (let i = 0; i !== stride; ++i) { + const j = dstOffset + i; buffer[j] = buffer[j] + buffer[srcOffset + i] * t; } - }; + } - return PropertyMixer; - }(); + } // Characters [].:/ are reserved for track binding syntax. - var _RESERVED_CHARS_RE = '\\[\\]\\.:\\/'; + const _RESERVED_CHARS_RE = '\\[\\]\\.:\\/'; - var _reservedRe = new RegExp('[' + _RESERVED_CHARS_RE + ']', 'g'); // Attempts to allow node names from any language. ES5's `\w` regexp matches + const _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. - var _wordChar = '[^' + _RESERVED_CHARS_RE + ']'; + const _wordChar = '[^' + _RESERVED_CHARS_RE + ']'; - var _wordCharOrDot = '[^' + _RESERVED_CHARS_RE.replace('\\.', '') + ']'; // Parent directories, delimited by '/' or ':'. Currently unused, but must + const _wordCharOrDot = '[^' + _RESERVED_CHARS_RE.replace('\\.', '') + ']'; // Parent directories, delimited by '/' or ':'. Currently unused, but must // be matched to parse the rest of the track name. - var _directoryRe = /((?:WC+[\/:])*)/.source.replace('WC', _wordChar); // Target node. May contain word characters (a-zA-Z0-9_) and '.' or '-'. + const _directoryRe = /((?:WC+[\/:])*)/.source.replace('WC', _wordChar); // Target node. May contain word characters (a-zA-Z0-9_) and '.' or '-'. - var _nodeRe = /(WCOD+)?/.source.replace('WCOD', _wordCharOrDot); // Object on target node, and accessor. May not contain reserved + const _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. - var _objectRe = /(?:\.(WC+)(?:\[(.+)\])?)?/.source.replace('WC', _wordChar); // Property and accessor. May not contain reserved characters. Accessor may + const _objectRe = /(?:\.(WC+)(?:\[(.+)\])?)?/.source.replace('WC', _wordChar); // Property and accessor. May not contain reserved characters. Accessor may // contain any non-bracket characters. - var _propertyRe = /\.(WC+)(?:\[(.+)\])?/.source.replace('WC', _wordChar); + const _propertyRe = /\.(WC+)(?:\[(.+)\])?/.source.replace('WC', _wordChar); - var _trackRe = new RegExp('' + '^' + _directoryRe + _nodeRe + _objectRe + _propertyRe + '$'); + const _trackRe = new RegExp('' + '^' + _directoryRe + _nodeRe + _objectRe + _propertyRe + '$'); - var _supportedObjectNames = ['material', 'materials', 'bones']; + const _supportedObjectNames = ['material', 'materials', 'bones']; function Composite(targetGroup, path, optionalParsedPath) { - var parsedPath = optionalParsedPath || PropertyBinding.parseTrackName(path); + const parsedPath = optionalParsedPath || PropertyBinding.parseTrackName(path); this._targetGroup = targetGroup; this._bindings = targetGroup.subscribe_(path, parsedPath); } Object.assign(Composite.prototype, { - getValue: function getValue(array, offset) { + getValue: function (array, offset) { this.bind(); // bind all binding - var firstValidIndex = this._targetGroup.nCachedObjects_, - binding = this._bindings[firstValidIndex]; // and only call .getValue on the first + const firstValidIndex = this._targetGroup.nCachedObjects_, + binding = this._bindings[firstValidIndex]; // and only call .getValue on the first if (binding !== undefined) binding.getValue(array, offset); }, - setValue: function setValue(array, offset) { - var bindings = this._bindings; + setValue: function (array, offset) { + const bindings = this._bindings; - for (var i = this._targetGroup.nCachedObjects_, n = bindings.length; i !== n; ++i) { + for (let i = this._targetGroup.nCachedObjects_, n = bindings.length; i !== n; ++i) { bindings[i].setValue(array, offset); } }, - bind: function bind() { - var bindings = this._bindings; + bind: function () { + const bindings = this._bindings; - for (var i = this._targetGroup.nCachedObjects_, n = bindings.length; i !== n; ++i) { + for (let i = this._targetGroup.nCachedObjects_, n = bindings.length; i !== n; ++i) { bindings[i].bind(); } }, - unbind: function unbind() { - var bindings = this._bindings; + unbind: function () { + const bindings = this._bindings; - for (var i = this._targetGroup.nCachedObjects_, n = bindings.length; i !== n; ++i) { + for (let i = this._targetGroup.nCachedObjects_, n = bindings.length; i !== n; ++i) { bindings[i].unbind(); } } @@ -32579,7 +30406,7 @@ Object.assign(PropertyBinding, { Composite: Composite, - create: function create(root, path, parsedPath) { + create: function (root, path, parsedPath) { if (!(root && root.isAnimationObjectGroup)) { return new PropertyBinding(root, path, parsedPath); } else { @@ -32594,17 +30421,17 @@ * @param {string} name Node name to be sanitized. * @return {string} */ - sanitizeNodeName: function sanitizeNodeName(name) { + sanitizeNodeName: function (name) { return name.replace(/\s/g, '_').replace(_reservedRe, ''); }, - parseTrackName: function parseTrackName(trackName) { - var matches = _trackRe.exec(trackName); + parseTrackName: function (trackName) { + const matches = _trackRe.exec(trackName); if (!matches) { throw new Error('PropertyBinding: Cannot parse trackName: ' + trackName); } - var results = { + const results = { // directoryName: matches[ 1 ], // (tschw) currently unused nodeName: matches[2], objectName: matches[3], @@ -32613,10 +30440,10 @@ // required propertyIndex: matches[6] }; - var lastDot = results.nodeName && results.nodeName.lastIndexOf('.'); + const lastDot = results.nodeName && results.nodeName.lastIndexOf('.'); if (lastDot !== undefined && lastDot !== -1) { - var objectName = results.nodeName.substring(lastDot + 1); // Object names must be checked against an allowlist. Otherwise, there + const objectName = results.nodeName.substring(lastDot + 1); // Object names must be checked against an allowlist. Otherwise, there // is no way to parse 'foo.bar.baz': 'baz' must be a property, but // 'bar' could be the objectName, or part of a nodeName (which can // include '.' characters). @@ -32633,14 +30460,14 @@ return results; }, - findNode: function findNode(root, nodeName) { + findNode: function (root, nodeName) { if (!nodeName || nodeName === '' || nodeName === '.' || nodeName === -1 || nodeName === root.name || nodeName === root.uuid) { return root; } // search into skeleton bones. if (root.skeleton) { - var bone = root.skeleton.getBoneByName(nodeName); + const bone = root.skeleton.getBoneByName(nodeName); if (bone !== undefined) { return bone; @@ -32649,22 +30476,22 @@ if (root.children) { - var searchNodeSubtree = function searchNodeSubtree(children) { - for (var i = 0; i < children.length; i++) { - var childNode = children[i]; + const searchNodeSubtree = function (children) { + for (let i = 0; i < children.length; i++) { + const childNode = children[i]; if (childNode.name === nodeName || childNode.uuid === nodeName) { return childNode; } - var result = searchNodeSubtree(childNode.children); + const result = searchNodeSubtree(childNode.children); if (result) return result; } return null; }; - var subTreeNode = searchNodeSubtree(root.children); + const subTreeNode = searchNodeSubtree(root.children); if (subTreeNode) { return subTreeNode; @@ -32677,8 +30504,8 @@ Object.assign(PropertyBinding.prototype, { // prototype, continued // these are used to "bind" a nonexistent property - _getValue_unavailable: function _getValue_unavailable() {}, - _setValue_unavailable: function _setValue_unavailable() {}, + _getValue_unavailable: function () {}, + _setValue_unavailable: function () {}, BindingType: { Direct: 0, EntireArray: 1, @@ -32693,9 +30520,9 @@ GetterByBindingType: [function getValue_direct(buffer, offset) { buffer[offset] = this.node[this.propertyName]; }, function getValue_array(buffer, offset) { - var source = this.resolvedProperty; + const source = this.resolvedProperty; - for (var i = 0, n = source.length; i !== n; ++i) { + for (let i = 0, n = source.length; i !== n; ++i) { buffer[offset++] = source[i]; } }, function getValue_arrayElement(buffer, offset) { @@ -32714,23 +30541,23 @@ this.targetObject.matrixWorldNeedsUpdate = true; }], [// EntireArray function setValue_array(buffer, offset) { - var dest = this.resolvedProperty; + const dest = this.resolvedProperty; - for (var i = 0, n = dest.length; i !== n; ++i) { + for (let i = 0, n = dest.length; i !== n; ++i) { dest[i] = buffer[offset++]; } }, function setValue_array_setNeedsUpdate(buffer, offset) { - var dest = this.resolvedProperty; + const dest = this.resolvedProperty; - for (var i = 0, n = dest.length; i !== n; ++i) { + for (let i = 0, n = dest.length; i !== n; ++i) { dest[i] = buffer[offset++]; } this.targetObject.needsUpdate = true; }, function setValue_array_setMatrixWorldNeedsUpdate(buffer, offset) { - var dest = this.resolvedProperty; + const dest = this.resolvedProperty; - for (var i = 0, n = dest.length; i !== n; ++i) { + for (let i = 0, n = dest.length; i !== n; ++i) { dest[i] = buffer[offset++]; } @@ -32767,12 +30594,12 @@ this.setValue(sourceArray, offset); }, // create getter / setter pair for a property in the scene graph - bind: function bind() { - var targetObject = this.node; - var parsedPath = this.parsedPath; - var objectName = parsedPath.objectName; - var propertyName = parsedPath.propertyName; - var propertyIndex = parsedPath.propertyIndex; + bind: function () { + let targetObject = this.node; + const parsedPath = this.parsedPath; + const objectName = parsedPath.objectName; + const propertyName = parsedPath.propertyName; + let propertyIndex = parsedPath.propertyIndex; if (!targetObject) { targetObject = PropertyBinding.findNode(this.rootNode, parsedPath.nodeName) || this.rootNode; @@ -32789,7 +30616,7 @@ } if (objectName) { - var objectIndex = parsedPath.objectIndex; // special cases were we need to reach deeper into the hierarchy to get the face materials.... + let objectIndex = parsedPath.objectIndex; // special cases were we need to reach deeper into the hierarchy to get the face materials.... switch (objectName) { case 'materials': @@ -32816,7 +30643,7 @@ targetObject = targetObject.skeleton.bones; // support resolving morphTarget names into indices. - for (var i = 0; i < targetObject.length; i++) { + for (let i = 0; i < targetObject.length; i++) { if (targetObject[i].name === objectIndex) { objectIndex = i; break; @@ -32845,16 +30672,16 @@ } // resolve property - var nodeProperty = targetObject[propertyName]; + const nodeProperty = targetObject[propertyName]; if (nodeProperty === undefined) { - var nodeName = parsedPath.nodeName; + const nodeName = parsedPath.nodeName; console.error('THREE.PropertyBinding: Trying to update property for track: ' + nodeName + '.' + propertyName + ' but it wasn\'t found.', targetObject); return; } // determine versioning scheme - var versioning = this.Versioning.None; + let versioning = this.Versioning.None; this.targetObject = targetObject; if (targetObject.needsUpdate !== undefined) { @@ -32866,7 +30693,7 @@ } // determine how the property gets bound - var bindingType = this.BindingType.Direct; + let bindingType = this.BindingType.Direct; if (propertyIndex !== undefined) { // access a sub element of the property array (only primitives are supported right now) @@ -32911,7 +30738,7 @@ this.getValue = this.GetterByBindingType[bindingType]; this.setValue = this.SetterByBindingTypeAndVersioning[bindingType][versioning]; }, - unbind: function unbind() { + unbind: function () { this.node = null; // back to the prototype version of getValue / setValue // note: avoiding to mutate the shape of 'this' via 'delete' @@ -32955,18 +30782,18 @@ * target group or directly, but not both. */ - var AnimationObjectGroup = /*#__PURE__*/function () { - function AnimationObjectGroup() { + class AnimationObjectGroup { + constructor() { 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 - var indices = {}; + const indices = {}; this._indicesByUUID = indices; // for bookkeeping - for (var i = 0, n = arguments.length; i !== n; ++i) { + for (let i = 0, n = arguments.length; i !== n; ++i) { indices[arguments[i].uuid] = i; } @@ -32978,7 +30805,7 @@ this._bindingsIndicesByPath = {}; // inside: indices in these arrays - var scope = this; + const scope = this; this.stats = { objects: { get total() { @@ -32998,23 +30825,21 @@ }; } - 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, + add() { + const objects = this._objects, + indicesByUUID = this._indicesByUUID, + paths = this._paths, + parsedPaths = this._parsedPaths, + bindings = this._bindings, + nBindings = bindings.length; + let knownObject = undefined, nObjects = objects.length, nCachedObjects = this.nCachedObjects_; - for (var i = 0, n = arguments.length; i !== n; ++i) { - var object = arguments[i], - uuid = object.uuid; - var index = indicesByUUID[uuid]; + for (let i = 0, n = arguments.length; i !== n; ++i) { + const object = arguments[i], + uuid = object.uuid; + let index = indicesByUUID[uuid]; if (index === undefined) { // unknown object -> add it to the ACTIVE region @@ -33022,30 +30847,30 @@ indicesByUUID[uuid] = index; objects.push(object); // accounting is done, now do the same for all bindings - for (var j = 0, m = nBindings; j !== m; ++j) { + for (let j = 0, m = nBindings; j !== m; ++j) { bindings[j].push(new PropertyBinding(object, paths[j], parsedPaths[j])); } } else if (index < nCachedObjects) { knownObject = objects[index]; // move existing object to the ACTIVE region - var firstActiveIndex = --nCachedObjects, - lastCachedObject = objects[firstActiveIndex]; + const 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 (var _j = 0, _m = nBindings; _j !== _m; ++_j) { - var bindingsForPath = bindings[_j], - lastCached = bindingsForPath[firstActiveIndex]; - var binding = bindingsForPath[index]; + for (let j = 0, m = nBindings; j !== m; ++j) { + const bindingsForPath = bindings[j], + lastCached = bindingsForPath[firstActiveIndex]; + let binding = bindingsForPath[index]; bindingsForPath[index] = lastCached; if (binding === undefined) { // since we do not bother to create new bindings // for objects that are cached, the binding may // or may not exist - binding = new PropertyBinding(object, paths[_j], parsedPaths[_j]); + binding = new PropertyBinding(object, paths[j], parsedPaths[j]); } bindingsForPath[firstActiveIndex] = binding; @@ -33058,33 +30883,33 @@ this.nCachedObjects_ = nCachedObjects; - }; + } - _proto.remove = function remove() { - var objects = this._objects, - indicesByUUID = this._indicesByUUID, - bindings = this._bindings, - nBindings = bindings.length; - var nCachedObjects = this.nCachedObjects_; + remove() { + const objects = this._objects, + indicesByUUID = this._indicesByUUID, + bindings = this._bindings, + nBindings = bindings.length; + let nCachedObjects = this.nCachedObjects_; - for (var i = 0, n = arguments.length; i !== n; ++i) { - var object = arguments[i], - uuid = object.uuid, - index = indicesByUUID[uuid]; + for (let i = 0, n = arguments.length; i !== n; ++i) { + const object = arguments[i], + uuid = object.uuid, + index = indicesByUUID[uuid]; if (index !== undefined && index >= nCachedObjects) { // move existing object into the CACHED region - var lastCachedIndex = nCachedObjects++, - firstActiveObject = objects[lastCachedIndex]; + const 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 (var j = 0, m = nBindings; j !== m; ++j) { - var bindingsForPath = bindings[j], - firstActive = bindingsForPath[lastCachedIndex], - binding = bindingsForPath[index]; + for (let j = 0, m = nBindings; j !== m; ++j) { + const bindingsForPath = bindings[j], + firstActive = bindingsForPath[lastCachedIndex], + binding = bindingsForPath[index]; bindingsForPath[index] = firstActive; bindingsForPath[lastCachedIndex] = binding; } @@ -33094,30 +30919,30 @@ this.nCachedObjects_ = nCachedObjects; } // remove & forget - ; - - _proto.uncache = function uncache() { - var objects = this._objects, - indicesByUUID = this._indicesByUUID, - bindings = this._bindings, - nBindings = bindings.length; - var nCachedObjects = this.nCachedObjects_, + + + uncache() { + const objects = this._objects, + indicesByUUID = this._indicesByUUID, + bindings = this._bindings, + nBindings = bindings.length; + let nCachedObjects = this.nCachedObjects_, nObjects = objects.length; - for (var i = 0, n = arguments.length; i !== n; ++i) { - var object = arguments[i], - uuid = object.uuid, - index = indicesByUUID[uuid]; + for (let i = 0, n = arguments.length; i !== n; ++i) { + const 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 - var firstActiveIndex = --nCachedObjects, - lastCachedObject = objects[firstActiveIndex], - lastIndex = --nObjects, - lastObject = objects[lastIndex]; // last cached object takes this object's place + const 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 @@ -33126,31 +30951,30 @@ objects[firstActiveIndex] = lastObject; objects.pop(); // accounting is done, now do the same for all bindings - for (var j = 0, m = nBindings; j !== m; ++j) { - var bindingsForPath = bindings[j], - lastCached = bindingsForPath[firstActiveIndex], - last = bindingsForPath[lastIndex]; + for (let j = 0, m = nBindings; j !== m; ++j) { + const 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 - var _lastIndex = --nObjects, - _lastObject = objects[_lastIndex]; + const 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 (var _j2 = 0, _m2 = nBindings; _j2 !== _m2; ++_j2) { - var _bindingsForPath = bindings[_j2]; - _bindingsForPath[index] = _bindingsForPath[_lastIndex]; - - _bindingsForPath.pop(); + for (let j = 0, m = nBindings; j !== m; ++j) { + const bindingsForPath = bindings[j]; + bindingsForPath[index] = bindingsForPath[lastIndex]; + bindingsForPath.pop(); } } // cached or active @@ -33161,48 +30985,48 @@ this.nCachedObjects_ = nCachedObjects; } // Internal interface used by befriended PropertyBinding.Composite: - ; - _proto.subscribe_ = function subscribe_(path, parsedPath) { + + subscribe_(path, parsedPath) { // returns an array of bindings for the given path that is changed // according to the contained objects in the group - var indicesByPath = this._bindingsIndicesByPath; - var index = indicesByPath[path]; - var bindings = this._bindings; + const indicesByPath = this._bindingsIndicesByPath; + let index = indicesByPath[path]; + const bindings = this._bindings; if (index !== undefined) return bindings[index]; - var paths = this._paths, - parsedPaths = this._parsedPaths, - objects = this._objects, - nObjects = objects.length, - nCachedObjects = this.nCachedObjects_, - bindingsForPath = new Array(nObjects); + const 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 (var i = nCachedObjects, n = objects.length; i !== n; ++i) { - var object = objects[i]; + for (let i = nCachedObjects, n = objects.length; i !== n; ++i) { + const object = objects[i]; bindingsForPath[i] = new PropertyBinding(object, path, parsedPath); } return bindingsForPath; - }; + } - _proto.unsubscribe_ = function unsubscribe_(path) { + unsubscribe_(path) { // tells the group to forget about a property path and no longer // update the array previously obtained with 'subscribe_' - var indicesByPath = this._bindingsIndicesByPath, - index = indicesByPath[path]; + const indicesByPath = this._bindingsIndicesByPath, + index = indicesByPath[path]; if (index !== undefined) { - var paths = this._paths, - parsedPaths = this._parsedPaths, - bindings = this._bindings, - lastBindingsIndex = bindings.length - 1, - lastBindings = bindings[lastBindingsIndex], - lastBindingsPath = path[lastBindingsIndex]; + const 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(); @@ -33211,37 +31035,28 @@ paths[index] = paths[lastBindingsIndex]; paths.pop(); } - }; + } - return AnimationObjectGroup; - }(); + } AnimationObjectGroup.prototype.isAnimationObjectGroup = true; - var AnimationAction = /*#__PURE__*/function () { - function AnimationAction(mixer, clip, localRoot, blendMode) { - if (localRoot === void 0) { - localRoot = null; - } - - if (blendMode === void 0) { - blendMode = clip.blendMode; - } - + class AnimationAction { + constructor(mixer, clip, localRoot = null, blendMode = clip.blendMode) { this._mixer = mixer; this._clip = clip; this._localRoot = localRoot; this.blendMode = blendMode; - var tracks = clip.tracks, - nTracks = tracks.length, - interpolants = new Array(nTracks); - var interpolantSettings = { + const tracks = clip.tracks, + nTracks = tracks.length, + interpolants = new Array(nTracks); + const interpolantSettings = { endingStart: ZeroCurvatureEnding, endingEnd: ZeroCurvatureEnding }; - for (var i = 0; i !== nTracks; ++i) { - var interpolant = tracks[i].createInterpolant(null); + for (let i = 0; i !== nTracks; ++i) { + const interpolant = tracks[i].createInterpolant(null); interpolants[i] = interpolant; interpolant.settings = interpolantSettings; } @@ -33283,21 +31098,19 @@ } // State & Scheduling - var _proto = AnimationAction.prototype; - - _proto.play = function play() { + play() { this._mixer._activateAction(this); return this; - }; + } - _proto.stop = function stop() { + stop() { this._mixer._deactivateAction(this); return this.reset(); - }; + } - _proto.reset = function reset() { + reset() { this.paused = false; this.enabled = true; this.time = 0; // restart clip @@ -33307,23 +31120,23 @@ this._startTime = null; // forget scheduling return this.stopFading().stopWarping(); - }; + } - _proto.isRunning = function isRunning() { + isRunning() { return this.enabled && !this.paused && this.timeScale !== 0 && this._startTime === null && this._mixer._isActiveAction(this); } // return true when play has been called - ; - _proto.isScheduled = function isScheduled() { + + isScheduled() { return this._mixer._isActiveAction(this); - }; + } - _proto.startAt = function startAt(time) { + startAt(time) { this._startTime = time; return this; - }; + } - _proto.setLoop = function setLoop(mode, repetitions) { + setLoop(mode, repetitions) { this.loop = mode; this.repetitions = repetitions; return this; @@ -33331,50 +31144,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 - ; - _proto.setEffectiveWeight = function setEffectiveWeight(weight) { + + 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 - ; - _proto.getEffectiveWeight = function getEffectiveWeight() { + + getEffectiveWeight() { return this._effectiveWeight; - }; + } - _proto.fadeIn = function fadeIn(duration) { + fadeIn(duration) { return this._scheduleFading(duration, 0, 1); - }; + } - _proto.fadeOut = function fadeOut(duration) { + fadeOut(duration) { return this._scheduleFading(duration, 1, 0); - }; + } - _proto.crossFadeFrom = function crossFadeFrom(fadeOutAction, duration, warp) { + crossFadeFrom(fadeOutAction, duration, warp) { fadeOutAction.fadeOut(duration); this.fadeIn(duration); if (warp) { - var fadeInDuration = this._clip.duration, - fadeOutDuration = fadeOutAction._clip.duration, - startEndRatio = fadeOutDuration / fadeInDuration, - endStartRatio = fadeInDuration / fadeOutDuration; + const 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; - }; + } - _proto.crossFadeTo = function crossFadeTo(fadeInAction, duration, warp) { + crossFadeTo(fadeInAction, duration, warp) { return fadeInAction.crossFadeFrom(this, duration, warp); - }; + } - _proto.stopFading = function stopFading() { - var weightInterpolant = this._weightInterpolant; + stopFading() { + const weightInterpolant = this._weightInterpolant; if (weightInterpolant !== null) { this._weightInterpolant = null; @@ -33387,56 +31200,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 - ; - _proto.setEffectiveTimeScale = function setEffectiveTimeScale(timeScale) { + + setEffectiveTimeScale(timeScale) { this.timeScale = timeScale; this._effectiveTimeScale = this.paused ? 0 : timeScale; return this.stopWarping(); } // return the time scale considering warping and .paused - ; - _proto.getEffectiveTimeScale = function getEffectiveTimeScale() { + + getEffectiveTimeScale() { return this._effectiveTimeScale; - }; + } - _proto.setDuration = function setDuration(duration) { + setDuration(duration) { this.timeScale = this._clip.duration / duration; return this.stopWarping(); - }; + } - _proto.syncWith = function syncWith(action) { + syncWith(action) { this.time = action.time; this.timeScale = action.timeScale; return this.stopWarping(); - }; + } - _proto.halt = function halt(duration) { + halt(duration) { return this.warp(this._effectiveTimeScale, 0, duration); - }; + } - _proto.warp = function warp(startTimeScale, endTimeScale, duration) { - var mixer = this._mixer, - now = mixer.time, - timeScale = this.timeScale; - var interpolant = this._timeScaleInterpolant; + warp(startTimeScale, endTimeScale, duration) { + const mixer = this._mixer, + now = mixer.time, + timeScale = this.timeScale; + let interpolant = this._timeScaleInterpolant; if (interpolant === null) { interpolant = mixer._lendControlInterpolant(); this._timeScaleInterpolant = interpolant; } - var times = interpolant.parameterPositions, - values = interpolant.sampleValues; + const times = interpolant.parameterPositions, + values = interpolant.sampleValues; times[0] = now; times[1] = now + duration; values[0] = startTimeScale / timeScale; values[1] = endTimeScale / timeScale; return this; - }; + } - _proto.stopWarping = function stopWarping() { - var timeScaleInterpolant = this._timeScaleInterpolant; + stopWarping() { + const timeScaleInterpolant = this._timeScaleInterpolant; if (timeScaleInterpolant !== null) { this._timeScaleInterpolant = null; @@ -33446,22 +31259,22 @@ return this; } // Object Accessors - ; - _proto.getMixer = function getMixer() { + + getMixer() { return this._mixer; - }; + } - _proto.getClip = function getClip() { + getClip() { return this._clip; - }; + } - _proto.getRoot = function getRoot() { + getRoot() { return this._localRoot || this._mixer._root; } // Interna - ; - _proto._update = function _update(time, deltaTime, timeDirection, accuIndex) { + + _update(time, deltaTime, timeDirection, accuIndex) { // called by the mixer if (!this.enabled) { // call ._updateWeight() to update ._effectiveWeight @@ -33470,11 +31283,11 @@ return; } - var startTime = this._startTime; + const startTime = this._startTime; if (startTime !== null) { // check for scheduled start of action - var timeRunning = (time - startTime) * timeDirection; + const timeRunning = (time - startTime) * timeDirection; if (timeRunning < 0 || timeDirection === 0) { return; // yet to come / don't decide when delta = 0 @@ -33489,21 +31302,20 @@ deltaTime *= this._updateTimeScale(time); - var clipTime = this._updateTime(deltaTime); // note: _updateTime may disable the action resulting in + const clipTime = this._updateTime(deltaTime); // note: _updateTime may disable the action resulting in // an effective weight of 0 - var weight = this._updateWeight(time); + const weight = this._updateWeight(time); if (weight > 0) { - var _interpolants = this._interpolants; - var propertyMixers = this._propertyBindings; + const interpolants = this._interpolants; + const propertyMixers = this._propertyBindings; switch (this.blendMode) { case AdditiveAnimationBlendMode: - for (var j = 0, m = _interpolants.length; j !== m; ++j) { - _interpolants[j].evaluate(clipTime); - + for (let j = 0, m = interpolants.length; j !== m; ++j) { + interpolants[j].evaluate(clipTime); propertyMixers[j].accumulateAdditive(weight); } @@ -33511,25 +31323,24 @@ case NormalAnimationBlendMode: default: - for (var _j = 0, _m = _interpolants.length; _j !== _m; ++_j) { - _interpolants[_j].evaluate(clipTime); - - propertyMixers[_j].accumulate(accuIndex, weight); + for (let j = 0, m = interpolants.length; j !== m; ++j) { + interpolants[j].evaluate(clipTime); + propertyMixers[j].accumulate(accuIndex, weight); } } } - }; + } - _proto._updateWeight = function _updateWeight(time) { - var weight = 0; + _updateWeight(time) { + let weight = 0; if (this.enabled) { weight = this.weight; - var interpolant = this._weightInterpolant; + const interpolant = this._weightInterpolant; if (interpolant !== null) { - var interpolantValue = interpolant.evaluate(time)[0]; + const interpolantValue = interpolant.evaluate(time)[0]; weight *= interpolantValue; if (time > interpolant.parameterPositions[1]) { @@ -33545,17 +31356,17 @@ this._effectiveWeight = weight; return weight; - }; + } - _proto._updateTimeScale = function _updateTimeScale(time) { - var timeScale = 0; + _updateTimeScale(time) { + let timeScale = 0; if (!this.paused) { timeScale = this.timeScale; - var interpolant = this._timeScaleInterpolant; + const interpolant = this._timeScaleInterpolant; if (interpolant !== null) { - var interpolantValue = interpolant.evaluate(time)[0]; + const interpolantValue = interpolant.evaluate(time)[0]; timeScale *= interpolantValue; if (time > interpolant.parameterPositions[1]) { @@ -33574,14 +31385,14 @@ this._effectiveTimeScale = timeScale; return timeScale; - }; + } - _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; + _updateTime(deltaTime) { + const duration = this._clip.duration; + const loop = this.loop; + let time = this.time + deltaTime; + let loopCount = this._loopCount; + const pingPong = loop === LoopPingPong; if (deltaTime === 0) { if (loopCount === -1) return time; @@ -33633,11 +31444,11 @@ if (time >= duration || time < 0) { // wrap around - var loopDelta = Math.floor(time / duration); // signed + const loopDelta = Math.floor(time / duration); // signed time -= duration * loopDelta; loopCount += Math.abs(loopDelta); - var pending = this.repetitions - loopCount; + const pending = this.repetitions - loopCount; if (pending <= 0) { // have to stop (switch state, clamp time, fire event) @@ -33654,7 +31465,7 @@ // keep running if (pending === 1) { // entering the last round - var atStart = deltaTime < 0; + const atStart = deltaTime < 0; this._setEndings(atStart, !atStart, pingPong); } else { @@ -33681,10 +31492,10 @@ } return time; - }; + } - _proto._setEndings = function _setEndings(atStart, atEnd, pingPong) { - var settings = this._interpolantSettings; + _setEndings(atStart, atEnd, pingPong) { + const settings = this._interpolantSettings; if (pingPong) { settings.endingStart = ZeroSlopeEnding; @@ -33703,68 +31514,60 @@ settings.endingEnd = WrapAroundEnding; } } - }; + } - _proto._scheduleFading = function _scheduleFading(duration, weightNow, weightThen) { - var mixer = this._mixer, - now = mixer.time; - var interpolant = this._weightInterpolant; + _scheduleFading(duration, weightNow, weightThen) { + const mixer = this._mixer, + now = mixer.time; + let interpolant = this._weightInterpolant; if (interpolant === null) { interpolant = mixer._lendControlInterpolant(); this._weightInterpolant = interpolant; } - var times = interpolant.parameterPositions, - values = interpolant.sampleValues; + const times = interpolant.parameterPositions, + values = interpolant.sampleValues; times[0] = now; values[0] = weightNow; times[1] = now + duration; values[1] = weightThen; return this; - }; - - return AnimationAction; - }(); - - var AnimationMixer = /*#__PURE__*/function (_EventDispatcher) { - _inheritsLoose(AnimationMixer, _EventDispatcher); + } - function AnimationMixer(root) { - var _this; + } - _this = _EventDispatcher.call(this) || this; - _this._root = root; + class AnimationMixer extends EventDispatcher { + constructor(root) { + super(); + this._root = root; - _this._initMemoryManager(); + this._initMemoryManager(); - _this._accuIndex = 0; - _this.time = 0; - _this.timeScale = 1.0; - return _this; + this._accuIndex = 0; + this.time = 0; + this.timeScale = 1.0; } - 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]; + _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]; if (bindingsByName === undefined) { bindingsByName = {}; bindingsByRoot[rootUuid] = bindingsByName; } - for (var i = 0; i !== nTracks; ++i) { - var track = tracks[i], - trackName = track.name; - var binding = bindingsByName[trackName]; + for (let i = 0; i !== nTracks; ++i) { + const track = tracks[i], + trackName = track.name; + let binding = bindingsByName[trackName]; if (binding !== undefined) { bindings[i] = binding; @@ -33782,7 +31585,7 @@ continue; } - var path = prototypeAction && prototypeAction._propertyBindings[i].binding.parsedPath; + const path = prototypeAction && prototypeAction._propertyBindings[i].binding.parsedPath; binding = new PropertyMixer(PropertyBinding.create(root, trackName, path), track.ValueTypeName, track.getValueSize()); ++binding.referenceCount; @@ -33793,26 +31596,26 @@ interpolants[i].resultBuffer = binding.buffer; } - }; + } - _proto._activateAction = function _activateAction(action) { + _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 - var rootUuid = (action._localRoot || this._root).uuid, - clipUuid = action._clip.uuid, - actionsForClip = this._actionsByClip[clipUuid]; + const rootUuid = (action._localRoot || this._root).uuid, + clipUuid = action._clip.uuid, + actionsForClip = this._actionsByClip[clipUuid]; this._bindAction(action, actionsForClip && actionsForClip.knownActions[0]); this._addInactiveAction(action, clipUuid, rootUuid); } - var bindings = action._propertyBindings; // increment reference counts / sort out state + const bindings = action._propertyBindings; // increment reference counts / sort out state - for (var i = 0, n = bindings.length; i !== n; ++i) { - var binding = bindings[i]; + for (let i = 0, n = bindings.length; i !== n; ++i) { + const binding = bindings[i]; if (binding.useCount++ === 0) { this._lendBinding(binding); @@ -33823,14 +31626,14 @@ this._lendAction(action); } - }; + } - _proto._deactivateAction = function _deactivateAction(action) { + _deactivateAction(action) { if (this._isActiveAction(action)) { - var bindings = action._propertyBindings; // decrement reference counts / sort out state + const bindings = action._propertyBindings; // decrement reference counts / sort out state - for (var i = 0, n = bindings.length; i !== n; ++i) { - var binding = bindings[i]; + for (let i = 0, n = bindings.length; i !== n; ++i) { + const binding = bindings[i]; if (--binding.useCount === 0) { binding.restoreOriginalState(); @@ -33842,9 +31645,9 @@ this._takeBackAction(action); } } // Memory manager - ; - _proto._initMemoryManager = function _initMemoryManager() { + + _initMemoryManager() { this._actions = []; // 'nActiveActions' followed by inactive ones this._nActiveActions = 0; @@ -33862,7 +31665,7 @@ this._controlInterpolants = []; // same game as above this._nActiveControlInterpolants = 0; - var scope = this; + const scope = this; this.stats = { actions: { get total() { @@ -33896,17 +31699,17 @@ } }; } // Memory management for AnimationAction objects - ; - _proto._isActiveAction = function _isActiveAction(action) { - var index = action._cacheIndex; + + _isActiveAction(action) { + const index = action._cacheIndex; return index !== null && index < this._nActiveActions; - }; + } - _proto._addInactiveAction = function _addInactiveAction(action, clipUuid, rootUuid) { - var actions = this._actions, - actionsByClip = this._actionsByClip; - var actionsForClip = actionsByClip[clipUuid]; + _addInactiveAction(action, clipUuid, rootUuid) { + const actions = this._actions, + actionsByClip = this._actionsByClip; + let actionsForClip = actionsByClip[clipUuid]; if (actionsForClip === undefined) { actionsForClip = { @@ -33916,7 +31719,7 @@ action._byClipCacheIndex = 0; actionsByClip[clipUuid] = actionsForClip; } else { - var knownActions = actionsForClip.knownActions; + const knownActions = actionsForClip.knownActions; action._byClipCacheIndex = knownActions.length; knownActions.push(action); } @@ -33924,28 +31727,28 @@ action._cacheIndex = actions.length; actions.push(action); actionsForClip.actionByRoot[rootUuid] = action; - }; + } - _proto._removeInactiveAction = function _removeInactiveAction(action) { - var actions = this._actions, - lastInactiveAction = actions[actions.length - 1], - cacheIndex = action._cacheIndex; + _removeInactiveAction(action) { + const actions = this._actions, + lastInactiveAction = actions[actions.length - 1], + cacheIndex = action._cacheIndex; lastInactiveAction._cacheIndex = cacheIndex; actions[cacheIndex] = lastInactiveAction; actions.pop(); action._cacheIndex = null; - var clipUuid = action._clip.uuid, - actionsByClip = this._actionsByClip, - actionsForClip = actionsByClip[clipUuid], - knownActionsForClip = actionsForClip.knownActions, - lastKnownAction = knownActionsForClip[knownActionsForClip.length - 1], - byClipCacheIndex = action._byClipCacheIndex; + const 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; - var actionByRoot = actionsForClip.actionByRoot, - rootUuid = (action._localRoot || this._root).uuid; + const actionByRoot = actionsForClip.actionByRoot, + rootUuid = (action._localRoot || this._root).uuid; delete actionByRoot[rootUuid]; if (knownActionsForClip.length === 0) { @@ -33953,57 +31756,57 @@ } this._removeInactiveBindingsForAction(action); - }; + } - _proto._removeInactiveBindingsForAction = function _removeInactiveBindingsForAction(action) { - var bindings = action._propertyBindings; + _removeInactiveBindingsForAction(action) { + const bindings = action._propertyBindings; - for (var i = 0, n = bindings.length; i !== n; ++i) { - var binding = bindings[i]; + for (let i = 0, n = bindings.length; i !== n; ++i) { + const binding = bindings[i]; if (--binding.referenceCount === 0) { this._removeInactiveBinding(binding); } } - }; + } - _proto._lendAction = function _lendAction(action) { + _lendAction(action) { // [ active actions | inactive actions ] // [ active actions >| inactive actions ] // s a // <-swap-> // a s - var actions = this._actions, - prevIndex = action._cacheIndex, - lastActiveIndex = this._nActiveActions++, - firstInactiveAction = actions[lastActiveIndex]; + const actions = this._actions, + prevIndex = action._cacheIndex, + lastActiveIndex = this._nActiveActions++, + firstInactiveAction = actions[lastActiveIndex]; action._cacheIndex = lastActiveIndex; actions[lastActiveIndex] = action; firstInactiveAction._cacheIndex = prevIndex; actions[prevIndex] = firstInactiveAction; - }; + } - _proto._takeBackAction = function _takeBackAction(action) { + _takeBackAction(action) { // [ active actions | inactive actions ] // [ active actions |< inactive actions ] // a s // <-swap-> // s a - var actions = this._actions, - prevIndex = action._cacheIndex, - firstInactiveIndex = --this._nActiveActions, - lastActiveAction = actions[firstInactiveIndex]; + const 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 - ; - _proto._addInactiveBinding = function _addInactiveBinding(binding, rootUuid, trackName) { - var bindingsByRoot = this._bindingsByRootAndName, - bindings = this._bindings; - var bindingByName = bindingsByRoot[rootUuid]; + + _addInactiveBinding(binding, rootUuid, trackName) { + const bindingsByRoot = this._bindingsByRootAndName, + bindings = this._bindings; + let bindingByName = bindingsByRoot[rootUuid]; if (bindingByName === undefined) { bindingByName = {}; @@ -34013,17 +31816,17 @@ bindingByName[trackName] = binding; binding._cacheIndex = bindings.length; bindings.push(binding); - }; + } - _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; + _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; lastInactiveBinding._cacheIndex = cacheIndex; bindings[cacheIndex] = lastInactiveBinding; bindings.pop(); @@ -34032,35 +31835,35 @@ if (Object.keys(bindingByName).length === 0) { delete bindingsByRoot[rootUuid]; } - }; + } - _proto._lendBinding = function _lendBinding(binding) { - var bindings = this._bindings, - prevIndex = binding._cacheIndex, - lastActiveIndex = this._nActiveBindings++, - firstInactiveBinding = bindings[lastActiveIndex]; + _lendBinding(binding) { + const bindings = this._bindings, + prevIndex = binding._cacheIndex, + lastActiveIndex = this._nActiveBindings++, + firstInactiveBinding = bindings[lastActiveIndex]; binding._cacheIndex = lastActiveIndex; bindings[lastActiveIndex] = binding; firstInactiveBinding._cacheIndex = prevIndex; bindings[prevIndex] = firstInactiveBinding; - }; + } - _proto._takeBackBinding = function _takeBackBinding(binding) { - var bindings = this._bindings, - prevIndex = binding._cacheIndex, - firstInactiveIndex = --this._nActiveBindings, - lastActiveBinding = bindings[firstInactiveIndex]; + _takeBackBinding(binding) { + const 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 - ; - _proto._lendControlInterpolant = function _lendControlInterpolant() { - var interpolants = this._controlInterpolants, - lastActiveIndex = this._nActiveControlInterpolants++; - var interpolant = interpolants[lastActiveIndex]; + + _lendControlInterpolant() { + const interpolants = this._controlInterpolants, + lastActiveIndex = this._nActiveControlInterpolants++; + let interpolant = interpolants[lastActiveIndex]; if (interpolant === undefined) { interpolant = new LinearInterpolant(new Float32Array(2), new Float32Array(2), 1, this._controlInterpolantsResultBuffer); @@ -34069,13 +31872,13 @@ } return interpolant; - }; + } - _proto._takeBackControlInterpolant = function _takeBackControlInterpolant(interpolant) { - var interpolants = this._controlInterpolants, - prevIndex = interpolant.__cacheIndex, - firstInactiveIndex = --this._nActiveControlInterpolants, - lastActiveInterpolant = interpolants[firstInactiveIndex]; + _takeBackControlInterpolant(interpolant) { + const interpolants = this._controlInterpolants, + prevIndex = interpolant.__cacheIndex, + firstInactiveIndex = --this._nActiveControlInterpolants, + lastActiveInterpolant = interpolants[firstInactiveIndex]; interpolant.__cacheIndex = firstInactiveIndex; interpolants[firstInactiveIndex] = interpolant; lastActiveInterpolant.__cacheIndex = prevIndex; @@ -34083,15 +31886,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) - ; - _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; + + 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; if (blendMode === undefined) { if (clipObject !== null) { @@ -34102,7 +31905,7 @@ } if (actionsForClip !== undefined) { - var existingAction = actionsForClip.actionByRoot[rootUuid]; + const existingAction = actionsForClip.actionByRoot[rootUuid]; if (existingAction !== undefined && existingAction.blendMode === blendMode) { return existingAction; @@ -34118,7 +31921,7 @@ if (clipObject === null) return null; // allocate all resources required to run it - var newAction = new AnimationAction(this, clipObject, optionalRoot, blendMode); + const newAction = new AnimationAction(this, clipObject, optionalRoot, blendMode); this._bindAction(newAction, prototypeAction); // and make the action known to the memory manager @@ -34127,14 +31930,14 @@ return newAction; } // get an existing action - ; - _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]; + + 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]; if (actionsForClip !== undefined) { return actionsForClip.actionByRoot[rootUuid] || null; @@ -34142,81 +31945,81 @@ return null; } // deactivates all previously scheduled actions - ; - _proto.stopAllAction = function stopAllAction() { - var actions = this._actions, - nActions = this._nActiveActions; - for (var i = nActions - 1; i >= 0; --i) { + stopAllAction() { + const actions = this._actions, + nActions = this._nActiveActions; + + for (let i = nActions - 1; i >= 0; --i) { actions[i].stop(); } return this; } // advance the time and update apply the animation - ; - _proto.update = function update(deltaTime) { + + update(deltaTime) { deltaTime *= this.timeScale; - var actions = this._actions, - nActions = this._nActiveActions, - time = this.time += deltaTime, - timeDirection = Math.sign(deltaTime), - accuIndex = this._accuIndex ^= 1; // run active actions + const actions = this._actions, + nActions = this._nActiveActions, + time = this.time += deltaTime, + timeDirection = Math.sign(deltaTime), + accuIndex = this._accuIndex ^= 1; // run active actions - for (var i = 0; i !== nActions; ++i) { - var action = actions[i]; + for (let i = 0; i !== nActions; ++i) { + const action = actions[i]; action._update(time, deltaTime, timeDirection, accuIndex); } // update scene graph - var bindings = this._bindings, - nBindings = this._nActiveBindings; + const bindings = this._bindings, + nBindings = this._nActiveBindings; - for (var _i = 0; _i !== nBindings; ++_i) { - bindings[_i].apply(accuIndex); + for (let i = 0; i !== nBindings; ++i) { + bindings[i].apply(accuIndex); } return this; } // Allows you to seek to a specific time in an animation. - ; - _proto.setTime = function setTime(timeInSeconds) { + + setTime(timeInSeconds) { this.time = 0; // Zero out time attribute for AnimationMixer object; - for (var i = 0; i < this._actions.length; i++) { + for (let i = 0; i < this._actions.length; i++) { this._actions[i].time = 0; // Zero out time attribute for all associated AnimationAction objects. } return this.update(timeInSeconds); // Update used to set exact time. Returns "this" AnimationMixer object. } // return this mixer's root target object - ; - _proto.getRoot = function getRoot() { + + getRoot() { return this._root; } // free all resources specific to a particular clip - ; - _proto.uncacheClip = function uncacheClip(clip) { - var actions = this._actions, - clipUuid = clip.uuid, - actionsByClip = this._actionsByClip, - actionsForClip = actionsByClip[clipUuid]; + + uncacheClip(clip) { + const 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 - var actionsToRemove = actionsForClip.knownActions; + const actionsToRemove = actionsForClip.knownActions; - for (var i = 0, n = actionsToRemove.length; i !== n; ++i) { - var action = actionsToRemove[i]; + for (let i = 0, n = actionsToRemove.length; i !== n; ++i) { + const action = actionsToRemove[i]; this._deactivateAction(action); - var cacheIndex = action._cacheIndex, - lastInactiveAction = actions[actions.length - 1]; + const cacheIndex = action._cacheIndex, + lastInactiveAction = actions[actions.length - 1]; action._cacheIndex = null; action._byClipCacheIndex = null; lastInactiveAction._cacheIndex = cacheIndex; @@ -34229,15 +32032,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; - for (var clipUuid in actionsByClip) { - var actionByRoot = actionsByClip[clipUuid].actionByRoot, - action = actionByRoot[rootUuid]; + uncacheRoot(root) { + const rootUuid = root.uuid, + actionsByClip = this._actionsByClip; + + for (const clipUuid in actionsByClip) { + const actionByRoot = actionsByClip[clipUuid].actionByRoot, + action = actionByRoot[rootUuid]; if (action !== undefined) { this._deactivateAction(action); @@ -34246,37 +32049,36 @@ } } - var bindingsByRoot = this._bindingsByRootAndName, - bindingByName = bindingsByRoot[rootUuid]; + const bindingsByRoot = this._bindingsByRootAndName, + bindingByName = bindingsByRoot[rootUuid]; if (bindingByName !== undefined) { - for (var trackName in bindingByName) { - var binding = bindingByName[trackName]; + for (const trackName in bindingByName) { + const binding = bindingByName[trackName]; binding.restoreOriginalState(); this._removeInactiveBinding(binding); } } } // remove a targeted clip from the cache - ; - _proto.uncacheAction = function uncacheAction(clip, optionalRoot) { - var action = this.existingAction(clip, optionalRoot); + + uncacheAction(clip, optionalRoot) { + const action = this.existingAction(clip, optionalRoot); if (action !== null) { this._deactivateAction(action); this._removeInactiveAction(action); } - }; + } - return AnimationMixer; - }(EventDispatcher); + } AnimationMixer.prototype._controlInterpolantsResultBuffer = new Float32Array(1); - var Uniform = /*#__PURE__*/function () { - function Uniform(value) { + class Uniform { + constructor(value) { if (typeof value === 'string') { console.warn('THREE.Uniform: Type parameter is no longer needed.'); value = arguments[1]; @@ -34285,14 +32087,11 @@ this.value = value; } - var _proto = Uniform.prototype; - - _proto.clone = function clone() { + 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); @@ -34302,18 +32101,18 @@ InstancedInterleavedBuffer.prototype = Object.assign(Object.create(InterleavedBuffer.prototype), { constructor: InstancedInterleavedBuffer, isInstancedInterleavedBuffer: true, - copy: function copy(source) { + copy: function (source) { InterleavedBuffer.prototype.copy.call(this, source); this.meshPerAttribute = source.meshPerAttribute; return this; }, - clone: function clone(data) { - var ib = InterleavedBuffer.prototype.clone.call(this, data); + clone: function (data) { + const ib = InterleavedBuffer.prototype.clone.call(this, data); ib.meshPerAttribute = this.meshPerAttribute; return ib; }, - toJSON: function toJSON(data) { - var json = InterleavedBuffer.prototype.toJSON.call(this, data); + toJSON: function (data) { + const json = InterleavedBuffer.prototype.toJSON.call(this, data); json.isInstancedInterleavedBuffer = true; json.meshPerAttribute = this.meshPerAttribute; return json; @@ -34330,40 +32129,32 @@ } Object.defineProperty(GLBufferAttribute.prototype, 'needsUpdate', { - set: function set(value) { + set: function (value) { if (value === true) this.version++; } }); Object.assign(GLBufferAttribute.prototype, { isGLBufferAttribute: true, - setBuffer: function setBuffer(buffer) { + setBuffer: function (buffer) { this.buffer = buffer; return this; }, - setType: function setType(type, elementSize) { + setType: function (type, elementSize) { this.type = type; this.elementSize = elementSize; return this; }, - setItemSize: function setItemSize(itemSize) { + setItemSize: function (itemSize) { this.itemSize = itemSize; return this; }, - setCount: function setCount(count) { + setCount: function (count) { this.count = count; return this; } }); - function Raycaster(origin, direction, near, far) { - if (near === void 0) { - near = 0; - } - - if (far === void 0) { - far = Infinity; - } - + function Raycaster(origin, direction, near = 0, far = Infinity) { this.ray = new Ray(origin, direction); // direction is assumed to be normalized (for accurate distance calculations) this.near = near; @@ -34383,7 +32174,7 @@ }; Object.defineProperties(this.params, { PointCloud: { - get: function get() { + get: function () { console.warn('THREE.Raycaster: params.PointCloud has been renamed to params.Points.'); return this.Points; } @@ -34395,26 +32186,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) { - var children = object.children; + const children = object.children; - for (var i = 0, l = children.length; i < l; i++) { - _intersectObject(children[i], raycaster, intersects, true); + for (let i = 0, l = children.length; i < l; i++) { + intersectObject(children[i], raycaster, intersects, true); } } } Object.assign(Raycaster.prototype, { - set: function set(origin, direction) { + set: function (origin, direction) { // direction is assumed to be normalized (for accurate distance calculations) this.ray.set(origin, direction); }, - setFromCamera: function setFromCamera(coords, camera) { + setFromCamera: function (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(); @@ -34428,31 +32219,14 @@ console.error('THREE.Raycaster: Unsupported camera type: ' + camera.type); } }, - intersectObject: function intersectObject(object, recursive, intersects) { - if (recursive === void 0) { - recursive = false; - } - - if (intersects === void 0) { - intersects = []; - } - - _intersectObject(object, this, intersects, recursive); - + intersectObject: function (object, recursive = false, intersects = []) { + intersectObject(object, this, intersects, recursive); intersects.sort(ascSort); return intersects; }, - 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); + intersectObjects: function (objects, recursive = false, intersects = []) { + for (let i = 0, l = objects.length; i < l; i++) { + intersectObject(objects[i], this, intersects, recursive); } intersects.sort(ascSort); @@ -34467,20 +32241,8 @@ * The azimuthal angle (theta) is measured from the positive z-axis. */ - 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; - } - + class Spherical { + constructor(radius = 1, phi = 0, theta = 0) { this.radius = radius; this.phi = phi; // polar angle @@ -34489,34 +32251,32 @@ return this; } - var _proto = Spherical.prototype; - - _proto.set = function set(radius, phi, theta) { + set(radius, phi, theta) { this.radius = radius; this.phi = phi; this.theta = theta; return this; - }; + } - _proto.copy = function copy(other) { + 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 - ; - _proto.makeSafe = function makeSafe() { - var EPS = 0.000001; + + makeSafe() { + const EPS = 0.000001; this.phi = Math.max(EPS, Math.min(Math.PI - EPS, this.phi)); return this; - }; + } - _proto.setFromVector3 = function setFromVector3(v) { + setFromVector3(v) { return this.setFromCartesianCoords(v.x, v.y, v.z); - }; + } - _proto.setFromCartesianCoords = function setFromCartesianCoords(x, y, z) { + setFromCartesianCoords(x, y, z) { this.radius = Math.sqrt(x * x + y * y + z * z); if (this.radius === 0) { @@ -34528,32 +32288,19 @@ } return this; - }; + } - _proto.clone = function clone() { + clone() { return new this.constructor().copy(this); - }; + } - return Spherical; - }(); + } /** * Ref: https://en.wikipedia.org/wiki/Cylindrical_coordinate_system */ - 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; - } - + class Cylindrical { + constructor(radius = 1, theta = 0, y = 0) { this.radius = radius; // distance from the origin to a point in the x-z plane this.theta = theta; // counterclockwise angle in the x-z plane measured in radians from the positive z-axis @@ -34563,148 +32310,135 @@ return this; } - var _proto = Cylindrical.prototype; - - _proto.set = function set(radius, theta, y) { + set(radius, theta, y) { this.radius = radius; this.theta = theta; this.y = y; return this; - }; + } - _proto.copy = function copy(other) { + copy(other) { this.radius = other.radius; this.theta = other.theta; this.y = other.y; return this; - }; + } - _proto.setFromVector3 = function setFromVector3(v) { + setFromVector3(v) { return this.setFromCartesianCoords(v.x, v.y, v.z); - }; + } - _proto.setFromCartesianCoords = function setFromCartesianCoords(x, y, z) { + setFromCartesianCoords(x, y, z) { this.radius = Math.sqrt(x * x + z * z); this.theta = Math.atan2(x, z); this.y = y; return this; - }; + } - _proto.clone = function clone() { + clone() { return new this.constructor().copy(this); - }; - - return Cylindrical; - }(); - - var _vector$8 = /*@__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); - } + const _vector$8 = /*@__PURE__*/new Vector2(); + class Box2 { + constructor(min = new Vector2(+Infinity, +Infinity), max = new Vector2(-Infinity, -Infinity)) { this.min = min; this.max = max; } - var _proto = Box2.prototype; - - _proto.set = function set(min, max) { + set(min, max) { this.min.copy(min); this.max.copy(max); return this; - }; + } - _proto.setFromPoints = function setFromPoints(points) { + setFromPoints(points) { this.makeEmpty(); - for (var i = 0, il = points.length; i < il; i++) { + for (let i = 0, il = points.length; i < il; i++) { this.expandByPoint(points[i]); } return this; - }; + } - _proto.setFromCenterAndSize = function setFromCenterAndSize(center, size) { - var halfSize = _vector$8.copy(size).multiplyScalar(0.5); + setFromCenterAndSize(center, size) { + const halfSize = _vector$8.copy(size).multiplyScalar(0.5); this.min.copy(center).sub(halfSize); this.max.copy(center).add(halfSize); return this; - }; + } - _proto.clone = function clone() { + clone() { return new this.constructor().copy(this); - }; + } - _proto.copy = function copy(box) { + copy(box) { this.min.copy(box.min); this.max.copy(box.max); return this; - }; + } - _proto.makeEmpty = function makeEmpty() { + makeEmpty() { this.min.x = this.min.y = +Infinity; this.max.x = this.max.y = -Infinity; return this; - }; + } - _proto.isEmpty = function isEmpty() { + 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; - }; + } - _proto.getCenter = function getCenter(target) { + 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); - }; + } - _proto.getSize = function getSize(target) { + 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); - }; + } - _proto.expandByPoint = function expandByPoint(point) { + expandByPoint(point) { this.min.min(point); this.max.max(point); return this; - }; + } - _proto.expandByVector = function expandByVector(vector) { + expandByVector(vector) { this.min.sub(vector); this.max.add(vector); return this; - }; + } - _proto.expandByScalar = function expandByScalar(scalar) { + expandByScalar(scalar) { this.min.addScalar(-scalar); this.max.addScalar(scalar); return this; - }; + } - _proto.containsPoint = function containsPoint(point) { + 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; - }; + } - _proto.containsBox = function containsBox(box) { + 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; - }; + } - _proto.getParameter = function getParameter(point, target) { + getParameter(point, target) { // This can potentially have a divide by zero if the box // has a size dimension of 0. if (target === undefined) { @@ -34713,142 +32447,131 @@ } 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)); - }; + } - _proto.intersectsBox = function intersectsBox(box) { + 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; - }; + } - _proto.clampPoint = function clampPoint(point, target) { + 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); - }; + } - _proto.distanceToPoint = function distanceToPoint(point) { - var clampedPoint = _vector$8.copy(point).clamp(this.min, this.max); + distanceToPoint(point) { + const clampedPoint = _vector$8.copy(point).clamp(this.min, this.max); return clampedPoint.sub(point).length(); - }; + } - _proto.intersect = function intersect(box) { + intersect(box) { this.min.max(box.min); this.max.min(box.max); return this; - }; + } - _proto.union = function union(box) { + union(box) { this.min.min(box.min); this.max.max(box.max); return this; - }; + } - _proto.translate = function translate(offset) { + translate(offset) { this.min.add(offset); this.max.add(offset); return this; - }; + } - _proto.equals = function equals(box) { + equals(box) { return box.min.equals(this.min) && box.max.equals(this.max); - }; + } - return Box2; - }(); + } Box2.prototype.isBox2 = true; - var _startP = /*@__PURE__*/new Vector3(); - - var _startEnd = /*@__PURE__*/new Vector3(); + const _startP = /*@__PURE__*/new Vector3(); - var Line3 = /*#__PURE__*/function () { - function Line3(start, end) { - if (start === void 0) { - start = new Vector3(); - } - - if (end === void 0) { - end = new Vector3(); - } + const _startEnd = /*@__PURE__*/new Vector3(); + class Line3 { + constructor(start = new Vector3(), end = new Vector3()) { this.start = start; this.end = end; } - var _proto = Line3.prototype; - - _proto.set = function set(start, end) { + set(start, end) { this.start.copy(start); this.end.copy(end); return this; - }; + } - _proto.copy = function copy(line) { + copy(line) { this.start.copy(line.start); this.end.copy(line.end); return this; - }; + } - _proto.getCenter = function getCenter(target) { + 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); - }; + } - _proto.delta = function delta(target) { + delta(target) { if (target === undefined) { console.warn('THREE.Line3: .delta() target is now required'); target = new Vector3(); } return target.subVectors(this.end, this.start); - }; + } - _proto.distanceSq = function distanceSq() { + distanceSq() { return this.start.distanceToSquared(this.end); - }; + } - _proto.distance = function distance() { + distance() { return this.start.distanceTo(this.end); - }; + } - _proto.at = function at(t, target) { + 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); - }; + } - _proto.closestPointToPointParameter = function closestPointToPointParameter(point, clampToLine) { + closestPointToPointParameter(point, clampToLine) { _startP.subVectors(point, this.start); _startEnd.subVectors(this.end, this.start); - var startEnd2 = _startEnd.dot(_startEnd); + const startEnd2 = _startEnd.dot(_startEnd); - var startEnd_startP = _startEnd.dot(_startP); + const startEnd_startP = _startEnd.dot(_startP); - var t = startEnd_startP / startEnd2; + let t = startEnd_startP / startEnd2; if (clampToLine) { t = MathUtils.clamp(t, 0, 1); } return t; - }; + } - _proto.closestPointToPoint = function closestPointToPoint(point, clampToLine, target) { - var t = this.closestPointToPointParameter(point, clampToLine); + closestPointToPoint(point, clampToLine, target) { + const t = this.closestPointToPointParameter(point, clampToLine); if (target === undefined) { console.warn('THREE.Line3: .closestPointToPoint() target is now required'); @@ -34856,24 +32579,23 @@ } return this.delta(target).multiplyScalar(t).add(this.start); - }; + } - _proto.applyMatrix4 = function applyMatrix4(matrix) { + applyMatrix4(matrix) { this.start.applyMatrix4(matrix); this.end.applyMatrix4(matrix); return this; - }; + } - _proto.equals = function equals(line) { + equals(line) { return line.start.equals(this.start) && line.end.equals(this.end); - }; + } - _proto.clone = function clone() { + clone() { return new this.constructor().copy(this); - }; + } - return Line3; - }(); + } function ImmediateRenderObject(material) { Object3D.call(this); @@ -34898,56 +32620,44 @@ ImmediateRenderObject.prototype.constructor = ImmediateRenderObject; ImmediateRenderObject.prototype.isImmediateRenderObject = true; - var _vector$9 = /*@__PURE__*/new Vector3(); - - var SpotLightHelper = /*#__PURE__*/function (_Object3D) { - _inheritsLoose(SpotLightHelper, _Object3D); - - function SpotLightHelper(light, color) { - var _this; - - _this = _Object3D.call(this) || this; - _this.light = light; + const _vector$9 = /*@__PURE__*/new Vector3(); - _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; + 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; positions.push(Math.cos(p1), Math.sin(p1), 1, Math.cos(p2), Math.sin(p2), 1); } geometry.setAttribute('position', new Float32BufferAttribute(positions, 3)); - var material = new LineBasicMaterial({ + const material = new LineBasicMaterial({ fog: false, toneMapped: false }); - _this.cone = new LineSegments(geometry, material); - - _this.add(_this.cone); - - _this.update(); - - return _this; + this.cone = new LineSegments(geometry, material); + this.add(this.cone); + this.update(); } - var _proto = SpotLightHelper.prototype; - - _proto.dispose = function dispose() { + dispose() { this.cone.geometry.dispose(); this.cone.material.dispose(); - }; + } - _proto.update = function update() { + update() { this.light.updateMatrixWorld(); - var coneLength = this.light.distance ? this.light.distance : 1000; - var coneWidth = coneLength * Math.tan(this.light.angle); + const coneLength = this.light.distance ? this.light.distance : 1000; + const coneWidth = coneLength * Math.tan(this.light.angle); this.cone.scale.set(coneWidth, coneWidth, coneLength); _vector$9.setFromMatrixPosition(this.light.target.matrixWorld); @@ -34959,32 +32669,27 @@ } else { this.cone.material.color.copy(this.light.color); } - }; - - return SpotLightHelper; - }(Object3D); - - var _vector$a = /*@__PURE__*/new Vector3(); + } - var _boneMatrix = /*@__PURE__*/new Matrix4(); + } - var _matrixWorldInv = /*@__PURE__*/new Matrix4(); + const _vector$a = /*@__PURE__*/new Vector3(); - var SkeletonHelper = /*#__PURE__*/function (_LineSegments) { - _inheritsLoose(SkeletonHelper, _LineSegments); + const _boneMatrix = /*@__PURE__*/new Matrix4(); - function SkeletonHelper(object) { - var _this; + const _matrixWorldInv = /*@__PURE__*/new Matrix4(); - 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); + 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); - for (var i = 0; i < bones.length; i++) { - var bone = bones[i]; + for (let i = 0; i < bones.length; i++) { + const bone = bones[i]; if (bone.parent && bone.parent.isBone) { vertices.push(0, 0, 0); @@ -34996,34 +32701,31 @@ geometry.setAttribute('position', new Float32BufferAttribute(vertices, 3)); geometry.setAttribute('color', new Float32BufferAttribute(colors, 3)); - var material = new LineBasicMaterial({ + const material = new LineBasicMaterial({ vertexColors: true, depthTest: false, depthWrite: false, toneMapped: false, transparent: true }); - _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; + super(geometry, material); + this.type = 'SkeletonHelper'; + this.isSkeletonHelper = true; + this.root = object; + this.bones = bones; + this.matrix = object.matrixWorld; + this.matrixAutoUpdate = false; } - var _proto = SkeletonHelper.prototype; - - _proto.updateMatrixWorld = function updateMatrixWorld(force) { - var bones = this.bones; - var geometry = this.geometry; - var position = geometry.getAttribute('position'); + updateMatrixWorld(force) { + const bones = this.bones; + const geometry = this.geometry; + const position = geometry.getAttribute('position'); _matrixWorldInv.copy(this.root.matrixWorld).invert(); - for (var i = 0, j = 0; i < bones.length; i++) { - var bone = bones[i]; + for (let i = 0, j = 0; i < bones.length; i++) { + const bone = bones[i]; if (bone.parent && bone.parent.isBone) { _boneMatrix.multiplyMatrices(_matrixWorldInv, bone.matrixWorld); @@ -35042,50 +32744,41 @@ } geometry.getAttribute('position').needsUpdate = true; + super.updateMatrixWorld(force); + } - _LineSegments.prototype.updateMatrixWorld.call(this, force); - }; - - return SkeletonHelper; - }(LineSegments); + } function getBoneList(object) { - var boneList = []; + const boneList = []; if (object && object.isBone) { boneList.push(object); } - for (var i = 0; i < object.children.length; i++) { + for (let i = 0; i < object.children.length; i++) { boneList.push.apply(boneList, getBoneList(object.children[i])); } return boneList; } - 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({ + class PointLightHelper extends Mesh { + constructor(light, sphereSize, color) { + const geometry = new SphereGeometry(sphereSize, 4, 2); + const material = new MeshBasicMaterial({ wireframe: true, fog: false, toneMapped: false }); - _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(); + 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(); /* // TODO: delete this comment? const distanceGeometry = new THREE.IcosahedronBufferGeometry( 1, 2 ); @@ -35100,19 +32793,14 @@ } this.add( this.lightDistance ); */ - - - return _this; } - var _proto = PointLightHelper.prototype; - - _proto.dispose = function dispose() { + dispose() { this.geometry.dispose(); this.material.dispose(); - }; + } - _proto.update = function update() { + update() { if (this.color !== undefined) { this.material.color.set(this.color); } else { @@ -35128,71 +32816,58 @@ } */ - }; - - return PointLightHelper; - }(Mesh); - - var _vector$b = /*@__PURE__*/new Vector3(); - - var _color1 = /*@__PURE__*/new Color(); - - var _color2 = /*@__PURE__*/new Color(); + } - var HemisphereLightHelper = /*#__PURE__*/function (_Object3D) { - _inheritsLoose(HemisphereLightHelper, _Object3D); + } - function HemisphereLightHelper(light, size, color) { - var _this; + const _vector$b = /*@__PURE__*/new Vector3(); - _this = _Object3D.call(this) || this; - _this.light = light; + const _color1 = /*@__PURE__*/new Color(); - _this.light.updateMatrixWorld(); + const _color2 = /*@__PURE__*/new Color(); - _this.matrix = light.matrixWorld; - _this.matrixAutoUpdate = false; - _this.color = color; - var geometry = new OctahedronGeometry(size); + 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); 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; - var position = geometry.getAttribute('position'); - var colors = new Float32Array(position.count * 3); + if (this.color === undefined) this.material.vertexColors = true; + const position = geometry.getAttribute('position'); + const colors = new Float32Array(position.count * 3); geometry.setAttribute('color', new BufferAttribute(colors, 3)); - - _this.add(new Mesh(geometry, _this.material)); - - _this.update(); - - return _this; + this.add(new Mesh(geometry, this.material)); + this.update(); } - var _proto = HemisphereLightHelper.prototype; - - _proto.dispose = function dispose() { + dispose() { this.children[0].geometry.dispose(); this.children[0].material.dispose(); - }; + } - _proto.update = function update() { - var mesh = this.children[0]; + update() { + const mesh = this.children[0]; if (this.color !== undefined) { this.material.color.set(this.color); } else { - var colors = mesh.geometry.getAttribute('color'); + const colors = mesh.geometry.getAttribute('color'); _color1.copy(this.light.color); _color2.copy(this.light.groundColor); - for (var i = 0, l = colors.count; i < l; i++) { - var color = i < l / 2 ? _color1 : _color2; + for (let i = 0, l = colors.count; i < l; i++) { + const color = i < l / 2 ? _color1 : _color2; colors.setXYZ(i, color.r, color.g, color.b); } @@ -35200,45 +32875,24 @@ } 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); - var center = divisions / 2; - var step = size / divisions; - var halfSize = size / 2; - var vertices = [], - colors = []; + const center = divisions / 2; + const step = size / divisions; + const halfSize = size / 2; + const vertices = [], + colors = []; - for (var i = 0, j = 0, k = -halfSize; i <= divisions; i++, k += step) { + for (let i = 0, j = 0, k = -halfSize; i <= divisions; i++, k += step) { vertices.push(-halfSize, 0, k, halfSize, 0, k); vertices.push(k, 0, -halfSize, k, 0, halfSize); - var color = i === center ? color1 : color2; + const color = i === center ? color1 : color2; color.toArray(colors, j); j += 3; color.toArray(colors, j); @@ -35249,159 +32903,109 @@ j += 3; } - var geometry = new BufferGeometry(); + const geometry = new BufferGeometry(); geometry.setAttribute('position', new Float32BufferAttribute(vertices, 3)); geometry.setAttribute('color', new Float32BufferAttribute(colors, 3)); - var material = new LineBasicMaterial({ + const material = new LineBasicMaterial({ vertexColors: true, toneMapped: false }); - _this = _LineSegments.call(this, geometry, material) || this; - _this.type = 'GridHelper'; - return _this; + super(geometry, material); + this.type = 'GridHelper'; } - 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); - var vertices = []; - var colors = []; // create the radials + const vertices = []; + const colors = []; // create the radials - 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; + 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; vertices.push(0, 0, 0); vertices.push(x, 0, z); - var color = i & 1 ? color1 : color2; + const color = i & 1 ? color1 : color2; colors.push(color.r, color.g, color.b); colors.push(color.r, color.g, color.b); } // create the circles - for (var _i = 0; _i <= circles; _i++) { - var _color = _i & 1 ? color1 : color2; - - var r = radius - radius / circles * _i; + for (let i = 0; i <= circles; i++) { + const color = i & 1 ? color1 : color2; + const r = radius - radius / circles * i; - for (var j = 0; j < divisions; j++) { + for (let j = 0; j < divisions; j++) { // first vertex - var _v = j / divisions * (Math.PI * 2); + 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 _x = Math.sin(_v) * r; - - var _z = Math.cos(_v) * r; - - 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); + 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); } } - var geometry = new BufferGeometry(); + const geometry = new BufferGeometry(); geometry.setAttribute('position', new Float32BufferAttribute(vertices, 3)); geometry.setAttribute('color', new Float32BufferAttribute(colors, 3)); - var material = new LineBasicMaterial({ + const material = new LineBasicMaterial({ vertexColors: true, toneMapped: false }); - _this = _LineSegments.call(this, geometry, material) || this; - _this.type = 'PolarGridHelper'; - return _this; + super(geometry, material); + this.type = 'PolarGridHelper'; } - return PolarGridHelper; - }(LineSegments); - - var _v1$6 = /*@__PURE__*/new Vector3(); - - var _v2$3 = /*@__PURE__*/new Vector3(); - - var _v3$1 = /*@__PURE__*/new Vector3(); - - var DirectionalLightHelper = /*#__PURE__*/function (_Object3D) { - _inheritsLoose(DirectionalLightHelper, _Object3D); + } - function DirectionalLightHelper(light, size, color) { - var _this; + const _v1$6 = /*@__PURE__*/new Vector3(); - _this = _Object3D.call(this) || this; - _this.light = light; + const _v2$3 = /*@__PURE__*/new Vector3(); - _this.light.updateMatrixWorld(); + const _v3$1 = /*@__PURE__*/new Vector3(); - _this.matrix = light.matrixWorld; - _this.matrixAutoUpdate = false; - _this.color = color; + 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; if (size === undefined) size = 1; - var geometry = new BufferGeometry(); + let geometry = new BufferGeometry(); geometry.setAttribute('position', new Float32BufferAttribute([-size, size, 0, size, size, 0, size, -size, 0, -size, -size, 0, -size, size, 0], 3)); - var material = new LineBasicMaterial({ + const 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(); - - return _this; + this.targetLine = new Line(geometry, material); + this.add(this.targetLine); + this.update(); } - var _proto = DirectionalLightHelper.prototype; - - _proto.dispose = function dispose() { + dispose() { this.lightPlane.geometry.dispose(); this.lightPlane.material.dispose(); this.targetLine.geometry.dispose(); this.targetLine.material.dispose(); - }; + } - _proto.update = function update() { + update() { _v1$6.setFromMatrixPosition(this.light.matrixWorld); _v2$3.setFromMatrixPosition(this.light.target.matrixWorld); @@ -35420,43 +33024,38 @@ this.targetLine.lookAt(_v2$3); this.targetLine.scale.z = _v3$1.length(); - }; + } - return DirectionalLightHelper; - }(Object3D); + } - var _vector$c = /*@__PURE__*/new Vector3(); + const _vector$c = /*@__PURE__*/new Vector3(); - var _camera = /*@__PURE__*/new Camera(); + const _camera = /*@__PURE__*/new Camera(); /** * - shows frustum, line of sight and up of the camera * - suitable for fast updates * - based on frustum visualization in lightgl.js shadowmap example * http://evanw.github.com/lightgl.js/tests/shadowmap.html - */ - - - var CameraHelper = /*#__PURE__*/function (_LineSegments) { - _inheritsLoose(CameraHelper, _LineSegments); + */ - function CameraHelper(camera) { - var _this; - var geometry = new BufferGeometry(); - var material = new LineBasicMaterial({ + class CameraHelper extends LineSegments { + constructor(camera) { + const geometry = new BufferGeometry(); + const material = new LineBasicMaterial({ color: 0xffffff, vertexColors: true, toneMapped: false }); - var vertices = []; - var colors = []; - var pointMap = {}; // colors + const vertices = []; + const colors = []; + const pointMap = {}; // colors - 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 + 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 addLine('n1', 'n2', colorFrustum); addLine('n2', 'n4', colorFrustum); @@ -35508,26 +33107,21 @@ geometry.setAttribute('position', new Float32BufferAttribute(vertices, 3)); geometry.setAttribute('color', new Float32BufferAttribute(colors, 3)); - _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; + 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(); } - 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 + update() { + const geometry = this.geometry; + const pointMap = this.pointMap; + const w = 1, + h = 1; // we need just camera projection matrix inverse // world matrix must be identity _camera.projectionMatrixInverse.copy(this.camera.projectionMatrixInverse); // center / target @@ -35559,58 +33153,44 @@ 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$c.set(x, y, z).unproject(camera); - var points = pointMap[point]; + const points = pointMap[point]; if (points !== undefined) { - var position = geometry.getAttribute('position'); + const position = geometry.getAttribute('position'); - for (var i = 0, l = points.length; i < l; i++) { + for (let i = 0, l = points.length; i < l; i++) { position.setXYZ(points[i], _vector$c.x, _vector$c.y, _vector$c.z); } } } - 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; - } + const _box$3 = /*@__PURE__*/new Box3(); - 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(); + 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(); geometry.setIndex(new BufferAttribute(indices, 1)); geometry.setAttribute('position', new BufferAttribute(positions, 3)); - _this = _LineSegments.call(this, geometry, new LineBasicMaterial({ + super(geometry, new LineBasicMaterial({ color: color, toneMapped: false - })) || this; - _this.object = object; - _this.type = 'BoxHelper'; - _this.matrixAutoUpdate = false; - - _this.update(); - - return _this; + })); + this.object = object; + this.type = 'BoxHelper'; + this.matrixAutoUpdate = false; + this.update(); } - var _proto = BoxHelper.prototype; - - _proto.update = function update(object) { + update(object) { if (object !== undefined) { console.warn('THREE.BoxHelper: .update() has no longer arguments.'); } @@ -35620,8 +33200,8 @@ } if (_box$3.isEmpty()) return; - var min = _box$3.min; - var max = _box$3.max; + const min = _box$3.min; + const max = _box$3.max; /* 5____4 1/___0/| @@ -35637,8 +33217,8 @@ 7: max.x, min.y, min.z */ - var position = this.geometry.attributes.position; - var array = position.array; + const position = this.geometry.attributes.position; + const array = position.array; array[0] = max.x; array[1] = max.y; array[2] = max.z; @@ -35665,161 +33245,98 @@ array[23] = min.z; position.needsUpdate = true; this.geometry.computeBoundingSphere(); - }; + } - _proto.setFromObject = function setFromObject(object) { + setFromObject(object) { this.object = object; this.update(); return this; - }; + } - _proto.copy = function copy(source) { + 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; + } - 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(); + 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(); geometry.setIndex(new BufferAttribute(indices, 1)); geometry.setAttribute('position', new Float32BufferAttribute(positions, 3)); - _this = _LineSegments.call(this, geometry, new LineBasicMaterial({ + super(geometry, new LineBasicMaterial({ color: color, toneMapped: false - })) || this; - _this.box = box; - _this.type = 'Box3Helper'; - - _this.geometry.computeBoundingSphere(); - - return _this; + })); + this.box = box; + this.type = 'Box3Helper'; + this.geometry.computeBoundingSphere(); } - var _proto = Box3Helper.prototype; - - _proto.updateMatrixWorld = function updateMatrixWorld(force) { - var box = this.box; + updateMatrixWorld(force) { + const 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); - - 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(); + 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(); geometry.setAttribute('position', new Float32BufferAttribute(positions, 3)); geometry.computeBoundingSphere(); - _this = _Line.call(this, geometry, new LineBasicMaterial({ + super(geometry, new LineBasicMaterial({ color: color, toneMapped: false - })) || 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(); + })); + 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(); 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; } - var _proto = PlaneHelper.prototype; - - _proto.updateMatrixWorld = function updateMatrixWorld(force) { - var scale = -this.plane.constant; + updateMatrixWorld(force) { + let 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); - }; - - return PlaneHelper; - }(Line); - - var _axis = /*@__PURE__*/new Vector3(); + } - var _lineGeometry, _coneGeometry; + const _axis = /*@__PURE__*/new Vector3(); - var ArrowHelper = /*#__PURE__*/function (_Object3D) { - _inheritsLoose(ArrowHelper, _Object3D); + let _lineGeometry, _coneGeometry; + class ArrowHelper extends Object3D { // dir is assumed to be normalized - 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'; + constructor(dir = new Vector3(0, 0, 1), origin = new Vector3(0, 0, 0), length = 1, color = 0xffff00, headLength = length * 0.2, headWidth = headLength * 0.2) { + super(); + this.type = 'ArrowHelper'; if (_lineGeometry === undefined) { _lineGeometry = new BufferGeometry(); @@ -35831,34 +33348,24 @@ _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); - - return _this; + this.cone.matrixAutoUpdate = false; + this.add(this.cone); + this.setDirection(dir); + this.setLength(length, headLength, headWidth); } - var _proto = ArrowHelper.prototype; - - _proto.setDirection = function setDirection(dir) { + setDirection(dir) { // dir is assumed to be normalized if (dir.y > 0.99999) { this.quaternion.set(0, 0, 0, 1); @@ -35867,92 +33374,72 @@ } else { _axis.set(dir.z, 0, -dir.x).normalize(); - var radians = Math.acos(dir.y); + const 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(); - }; + } - _proto.setColor = function setColor(color) { + 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; - } + } - 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(); + 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(); geometry.setAttribute('position', new Float32BufferAttribute(vertices, 3)); geometry.setAttribute('color', new Float32BufferAttribute(colors, 3)); - var material = new LineBasicMaterial({ + const material = new LineBasicMaterial({ vertexColors: true, toneMapped: false }); - _this = _LineSegments.call(this, geometry, material) || this; - _this.type = 'AxesHelper'; - return _this; + super(geometry, material); + this.type = 'AxesHelper'; } - return AxesHelper; - }(LineSegments); + } - var _floatView = new Float32Array(1); + const _floatView = new Float32Array(1); - var _int32View = new Int32Array(_floatView.buffer); + const _int32View = new Int32Array(_floatView.buffer); - var DataUtils = { + const DataUtils = { // Converts float32 to float16 (stored as uint16 value). - toHalfFloat: function toHalfFloat(val) { + toHalfFloat: function (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; - var x = _int32View[0]; - var bits = x >> 16 & 0x8000; + const x = _int32View[0]; + let bits = x >> 16 & 0x8000; /* Get the sign */ - var m = x >> 12 & 0x07ff; + let m = x >> 12 & 0x07ff; /* Keep one extra bit for rounding */ - var e = x >> 23 & 0xff; + const e = x >> 23 & 0xff; /* Using int is faster here */ /* If zero, or denormal, or exponent underflows too much for a denormal @@ -35990,43 +33477,51 @@ } }; - 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 + 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 // 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. - 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 + const EXTRA_LOD_SIGMA = [0.125, 0.215, 0.35, 0.446, 0.526, 0.582]; + const TOTAL_LODS = LOD_MAX - LOD_MIN + 1 + EXTRA_LOD_SIGMA.length; // The maximum length of the blur for loop. Smaller sigmas will use fewer // samples and exit early, but not recompile the shader. - 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({ + const MAX_SAMPLES = 20; + const ENCODINGS = { + [LinearEncoding]: 0, + [sRGBEncoding]: 1, + [RGBEEncoding]: 2, + [RGBM7Encoding]: 3, + [RGBM16Encoding]: 4, + [RGBDEncoding]: 5, + [GammaEncoding]: 6 + }; + const backgroundMaterial = new MeshBasicMaterial({ side: BackSide, depthWrite: false, depthTest: false }); - var backgroundBox = new Mesh(new BoxGeometry(), backgroundMaterial); + const backgroundBox = new Mesh(new BoxGeometry(), backgroundMaterial); - var _flatCamera = /*@__PURE__*/new OrthographicCamera(); + const _flatCamera = /*@__PURE__*/new OrthographicCamera(); - var _createPlanes2 = /*@__PURE__*/_createPlanes(), - _lodPlanes = _createPlanes2._lodPlanes, - _sizeLods = _createPlanes2._sizeLods, - _sigmas = _createPlanes2._sigmas; + const { + _lodPlanes, + _sizeLods, + _sigmas + } = /*@__PURE__*/_createPlanes(); - var _clearColor = /*@__PURE__*/new Color(); + const _clearColor = /*@__PURE__*/new Color(); - var _oldTarget = null; // Golden Ratio + let _oldTarget = null; // Golden Ratio - var PHI = (1 + Math.sqrt(5)) / 2; - var INV_PHI = 1 / PHI; // Vertices of a dodecahedron (except the opposites, which represent the + const PHI = (1 + Math.sqrt(5)) / 2; + const INV_PHI = 1 / PHI; // Vertices of a dodecahedron (except the opposites, which represent the // same axis), used as axis directions evenly spread on a sphere. - 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)]; + const _axisDirections = [/*@__PURE__*/new Vector3(1, 1, 1), /*@__PURE__*/new Vector3(-1, 1, 1), /*@__PURE__*/new Vector3(1, 1, -1), /*@__PURE__*/new Vector3(-1, 1, -1), /*@__PURE__*/new Vector3(0, PHI, INV_PHI), /*@__PURE__*/new Vector3(0, PHI, -INV_PHI), /*@__PURE__*/new Vector3(INV_PHI, 0, PHI), /*@__PURE__*/new Vector3(-INV_PHI, 0, PHI), /*@__PURE__*/new Vector3(PHI, INV_PHI, 0), /*@__PURE__*/new Vector3(-PHI, INV_PHI, 0)]; /** * This class generates a Prefiltered, Mipmapped Radiance Environment Map * (PMREM) from a cubeMap environment texture. This allows different levels of @@ -36040,15 +33535,15 @@ */ function convertLinearToRGBE(color) { - 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); + 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); color.multiplyScalar(Math.pow(2.0, -fExp)); - var alpha = (fExp + 128.0) / 255.0; + const alpha = (fExp + 128.0) / 255.0; return alpha; } - var PMREMGenerator = /*#__PURE__*/function () { - function PMREMGenerator(renderer) { + class PMREMGenerator { + constructor(renderer) { this._renderer = renderer; this._pingPongRenderTarget = null; this._blurMaterial = _getBlurShader(MAX_SAMPLES); @@ -36066,24 +33561,10 @@ */ - 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; - } - + fromScene(scene, sigma = 0, near = 0.1, far = 100) { _oldTarget = this._renderer.getRenderTarget(); - var cubeUVRenderTarget = this._allocateTargets(); + const cubeUVRenderTarget = this._allocateTargets(); this._sceneToCubeUV(scene, near, far, cubeUVRenderTarget); @@ -36102,9 +33583,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. */ - ; - _proto.fromEquirectangular = function fromEquirectangular(equirectangular) { + + fromEquirectangular(equirectangular) { return this._fromTexture(equirectangular); } /** @@ -36112,18 +33593,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. */ - ; - _proto.fromCubemap = function fromCubemap(cubemap) { + + 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. */ - ; - _proto.compileCubemapShader = function compileCubemapShader() { + + compileCubemapShader() { if (this._cubemapShader === null) { this._cubemapShader = _getCubemapShader(); @@ -36134,9 +33615,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. */ - ; - _proto.compileEquirectangularShader = function compileEquirectangularShader() { + + compileEquirectangularShader() { if (this._equirectShader === null) { this._equirectShader = _getEquirectShader(); @@ -36148,21 +33629,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. */ - ; - _proto.dispose = function dispose() { + + dispose() { this._blurMaterial.dispose(); if (this._cubemapShader !== null) this._cubemapShader.dispose(); if (this._equirectShader !== null) this._equirectShader.dispose(); - for (var i = 0; i < _lodPlanes.length; i++) { + for (let i = 0; i < _lodPlanes.length; i++) { _lodPlanes[i].dispose(); } } // private interface - ; - _proto._cleanup = function _cleanup(outputTarget) { + + _cleanup(outputTarget) { this._pingPongRenderTarget.dispose(); this._renderer.setRenderTarget(_oldTarget); @@ -36170,12 +33651,12 @@ outputTarget.scissorTest = false; _setViewport(outputTarget, 0, 0, outputTarget.width, outputTarget.height); - }; + } - _proto._fromTexture = function _fromTexture(texture) { + _fromTexture(texture) { _oldTarget = this._renderer.getRenderTarget(); - var cubeUVRenderTarget = this._allocateTargets(texture); + const cubeUVRenderTarget = this._allocateTargets(texture); this._textureToCubeUV(texture, cubeUVRenderTarget); @@ -36184,11 +33665,11 @@ this._cleanup(cubeUVRenderTarget); return cubeUVRenderTarget; - }; + } - _proto._allocateTargets = function _allocateTargets(texture) { + _allocateTargets(texture) { // warning: null texture is valid - var params = { + const params = { magFilter: NearestFilter, minFilter: NearestFilter, generateMipmaps: false, @@ -36198,55 +33679,53 @@ depthBuffer: false }; - var cubeUVRenderTarget = _createRenderTarget(params); + const cubeUVRenderTarget = _createRenderTarget(params); cubeUVRenderTarget.depthBuffer = texture ? false : true; this._pingPongRenderTarget = _createRenderTarget(params); return cubeUVRenderTarget; - }; + } - _proto._compileMaterial = function _compileMaterial(material) { - var tmpMesh = new Mesh(_lodPlanes[0], material); + _compileMaterial(material) { + const tmpMesh = new Mesh(_lodPlanes[0], material); this._renderer.compile(tmpMesh, _flatCamera); - }; + } - _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; + _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; renderer.getClearColor(_clearColor); renderer.toneMapping = NoToneMapping; renderer.outputEncoding = LinearEncoding; renderer.autoClear = false; - var useSolidColor = false; - var background = scene.background; + let useSolidColor = false; + const background = scene.background; if (background) { if (background.isColor) { backgroundMaterial.color.copy(background).convertSRGBToLinear(); scene.background = null; - var alpha = convertLinearToRGBE(backgroundMaterial.color); + const alpha = convertLinearToRGBE(backgroundMaterial.color); backgroundMaterial.opacity = alpha; useSolidColor = true; } } else { backgroundMaterial.color.copy(_clearColor).convertSRGBToLinear(); - - var _alpha = convertLinearToRGBE(backgroundMaterial.color); - - backgroundMaterial.opacity = _alpha; + const alpha = convertLinearToRGBE(backgroundMaterial.color); + backgroundMaterial.opacity = alpha; useSolidColor = true; } - for (var i = 0; i < 6; i++) { - var col = i % 3; + for (let i = 0; i < 6; i++) { + const col = i % 3; if (col == 0) { cubeCamera.up.set(0, upSign[i], 0); @@ -36273,10 +33752,10 @@ renderer.toneMapping = toneMapping; renderer.outputEncoding = outputEncoding; renderer.autoClear = originalAutoClear; - }; + } - _proto._textureToCubeUV = function _textureToCubeUV(texture, cubeUVRenderTarget) { - var renderer = this._renderer; + _textureToCubeUV(texture, cubeUVRenderTarget) { + const renderer = this._renderer; if (texture.isCubeTexture) { if (this._cubemapShader == null) { @@ -36288,9 +33767,9 @@ } } - var material = texture.isCubeTexture ? this._cubemapShader : this._equirectShader; - var mesh = new Mesh(_lodPlanes[0], material); - var uniforms = material.uniforms; + const material = texture.isCubeTexture ? this._cubemapShader : this._equirectShader; + const mesh = new Mesh(_lodPlanes[0], material); + const uniforms = material.uniforms; uniforms['envMap'].value = texture; if (!texture.isCubeTexture) { @@ -36304,16 +33783,16 @@ renderer.setRenderTarget(cubeUVRenderTarget); renderer.render(mesh, _flatCamera); - }; + } - _proto._applyPMREM = function _applyPMREM(cubeUVRenderTarget) { - var renderer = this._renderer; - var autoClear = renderer.autoClear; + _applyPMREM(cubeUVRenderTarget) { + const renderer = this._renderer; + const autoClear = renderer.autoClear; renderer.autoClear = false; - 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]; + for (let i = 1; i < TOTAL_LODS; i++) { + const sigma = Math.sqrt(_sigmas[i] * _sigmas[i] - _sigmas[i - 1] * _sigmas[i - 1]); + const poleAxis = _axisDirections[(i - 1) % _axisDirections.length]; this._blur(cubeUVRenderTarget, i - 1, i, sigma, poleAxis); } @@ -36327,44 +33806,43 @@ * the poles) to approximate the orthogonally-separable blur. It is least * accurate at the poles, but still does a decent job. */ - ; - _proto._blur = function _blur(cubeUVRenderTarget, lodIn, lodOut, sigma, poleAxis) { - var pingPongRenderTarget = this._pingPongRenderTarget; + + _blur(cubeUVRenderTarget, lodIn, lodOut, sigma, poleAxis) { + const pingPongRenderTarget = this._pingPongRenderTarget; this._halfBlur(cubeUVRenderTarget, pingPongRenderTarget, lodIn, lodOut, sigma, 'latitudinal', poleAxis); this._halfBlur(pingPongRenderTarget, cubeUVRenderTarget, lodOut, lodOut, sigma, 'longitudinal', poleAxis); - }; + } - _proto._halfBlur = function _halfBlur(targetIn, targetOut, lodIn, lodOut, sigmaRadians, direction, poleAxis) { - var renderer = this._renderer; - var blurMaterial = this._blurMaterial; + _halfBlur(targetIn, targetOut, lodIn, lodOut, sigmaRadians, direction, poleAxis) { + const renderer = this._renderer; + const blurMaterial = this._blurMaterial; if (direction !== 'latitudinal' && direction !== 'longitudinal') { console.error('blur direction must be either latitudinal or longitudinal!'); } // Number of standard deviations at which to cut off the discrete approximation. - 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; + 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; 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}`); } - var weights = []; - var sum = 0; + const weights = []; + let sum = 0; - for (var i = 0; i < MAX_SAMPLES; ++i) { - var _x = i / sigmaPixels; - - var weight = Math.exp(-_x * _x / 2); + for (let i = 0; i < MAX_SAMPLES; ++i) { + const x = i / sigmaPixels; + const weight = Math.exp(-x * x / 2); weights.push(weight); if (i == 0) { @@ -36374,8 +33852,8 @@ } } - for (var _i = 0; _i < weights.length; _i++) { - weights[_i] = weights[_i] / sum; + for (let i = 0; i < weights.length; i++) { + weights[i] = weights[i] / sum; } blurUniforms['envMap'].value = targetIn.texture; @@ -36391,18 +33869,17 @@ blurUniforms['mipInt'].value = LOD_MAX - lodIn; blurUniforms['inputEncoding'].value = ENCODINGS[targetIn.texture.encoding]; blurUniforms['outputEncoding'].value = ENCODINGS[targetIn.texture.encoding]; - 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); + const outputSize = _sizeLods[lodOut]; + const x = 3 * Math.max(0, SIZE_MAX - 2 * outputSize); + const y = (lodOut === 0 ? 0 : 2 * SIZE_MAX) + 2 * outputSize * (lodOut > LOD_MAX - LOD_MIN ? lodOut - LOD_MAX + LOD_MIN : 0); _setViewport(targetOut, x, y, 3 * outputSize, 2 * outputSize); renderer.setRenderTarget(targetOut); renderer.render(blurMesh, _flatCamera); - }; + } - return PMREMGenerator; - }(); + } function _isLDR(texture) { if (texture === undefined || texture.type !== UnsignedByteType) return false; @@ -36410,17 +33887,17 @@ } function _createPlanes() { - var _lodPlanes = []; - var _sizeLods = []; - var _sigmas = []; - var lod = LOD_MAX; + const _lodPlanes = []; + const _sizeLods = []; + const _sigmas = []; + let lod = LOD_MAX; - for (var i = 0; i < TOTAL_LODS; i++) { - var sizeLod = Math.pow(2, lod); + for (let i = 0; i < TOTAL_LODS; i++) { + const sizeLod = Math.pow(2, lod); _sizeLods.push(sizeLod); - var sigma = 1.0 / sizeLod; + let sigma = 1.0 / sizeLod; if (i > LOD_MAX - LOD_MIN) { sigma = EXTRA_LOD_SIGMA[i - LOD_MAX + LOD_MIN - 1]; @@ -36430,30 +33907,30 @@ _sigmas.push(sigma); - 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]; + 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]; position.set(coordinates, positionSize * vertices * face); uv.set(uv1, uvSize * vertices * face); - var fill = [face, face, face, face, face, face]; + const fill = [face, face, face, face, face, face]; faceIndex.set(fill, faceIndexSize * vertices * face); } - var planes = new BufferGeometry(); + const planes = new BufferGeometry(); planes.setAttribute('position', new BufferAttribute(position, positionSize)); planes.setAttribute('uv', new BufferAttribute(uv, uvSize)); planes.setAttribute('faceIndex', new BufferAttribute(faceIndex, faceIndexSize)); @@ -36466,14 +33943,14 @@ } return { - _lodPlanes: _lodPlanes, - _sizeLods: _sizeLods, - _sigmas: _sigmas + _lodPlanes, + _sizeLods, + _sigmas }; } function _createRenderTarget(params) { - var cubeUVRenderTarget = new WebGLRenderTarget(3 * SIZE_MAX, 3 * SIZE_MAX, params); + const cubeUVRenderTarget = new WebGLRenderTarget(3 * SIZE_MAX, 3 * SIZE_MAX, params); cubeUVRenderTarget.texture.mapping = CubeUVReflectionMapping; cubeUVRenderTarget.texture.name = 'PMREM.cubeUv'; cubeUVRenderTarget.scissorTest = true; @@ -36486,9 +33963,9 @@ } function _getBlurShader(maxSamples) { - var weights = new Float32Array(maxSamples); - var poleAxis = new Vector3(0, 1, 0); - var shaderMaterial = new RawShaderMaterial({ + const weights = new Float32Array(maxSamples); + const poleAxis = new Vector3(0, 1, 0); + const shaderMaterial = new RawShaderMaterial({ name: 'SphericalGaussianBlur', defines: { 'n': maxSamples @@ -36525,7 +34002,71 @@ vertexShader: _getCommonVertexShader(), fragmentShader: /* glsl */ - "\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", + ` + + 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 ); + + } + `, blending: NoBlending, depthTest: false, depthWrite: false @@ -36534,8 +34075,8 @@ } function _getEquirectShader() { - var texelSize = new Vector2(1, 1); - var shaderMaterial = new RawShaderMaterial({ + const texelSize = new Vector2(1, 1); + const shaderMaterial = new RawShaderMaterial({ name: 'EquirectangularToCubeUV', uniforms: { 'envMap': { @@ -36554,7 +34095,45 @@ vertexShader: _getCommonVertexShader(), fragmentShader: /* glsl */ - "\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", + ` + + 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 ); + + } + `, blending: NoBlending, depthTest: false, depthWrite: false @@ -36563,7 +34142,7 @@ } function _getCubemapShader() { - var shaderMaterial = new RawShaderMaterial({ + const shaderMaterial = new RawShaderMaterial({ name: 'CubemapToCubeUV', uniforms: { 'envMap': { @@ -36579,7 +34158,25 @@ vertexShader: _getCommonVertexShader(), fragmentShader: /* glsl */ - "\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", + ` + + 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 ); + + } + `, blending: NoBlending, depthTest: false, depthWrite: false @@ -36590,31 +34187,164 @@ function _getCommonVertexShader() { return ( /* glsl */ - "\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" + ` + + 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 ); + + } + ` ); } function _getEncodings() { return ( /* glsl */ - "\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" + ` + + 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 ); + + } + ` ); } - var LineStrip = 0; - var LinePieces = 1; - var NoColors = 0; - var FaceColors = 1; - var VertexColors = 2; + const LineStrip = 0; + const LinePieces = 1; + const NoColors = 0; + const FaceColors = 1; + const VertexColors = 2; function MeshFaceMaterial(materials) { console.warn('THREE.MeshFaceMaterial has been removed. Use an Array instead.'); return materials; } - function MultiMaterial(materials) { - if (materials === void 0) { - materials = []; - } - + function MultiMaterial(materials = []) { console.warn('THREE.MultiMaterial has been removed. Use an Array instead.'); materials.isMultiMaterial = true; materials.materials = materials; @@ -36746,12 +34476,12 @@ }; Loader.Handlers = { - add: function add() + add: function () /* regex, loader */ { console.error('THREE.Loader: Handlers.add() has been removed. Use LoadingManager.addHandler() instead.'); }, - get: function get() + get: function () /* file */ { console.error('THREE.Loader: Handlers.get() has been removed. Use LoadingManager.getHandler() instead.'); @@ -37153,20 +34883,20 @@ Object.defineProperties(Object3D.prototype, { eulerOrder: { - get: function get() { + get: function () { console.warn('THREE.Object3D: .eulerOrder is now .rotation.order.'); return this.rotation.order; }, - set: function set(value) { + set: function (value) { console.warn('THREE.Object3D: .eulerOrder is now .rotation.order.'); this.rotation.order = value; } }, useQuaternion: { - get: function get() { + get: function () { console.warn('THREE.Object3D: .useQuaternion has been removed. The library now uses quaternions by default.'); }, - set: function set() { + set: function () { console.warn('THREE.Object3D: .useQuaternion has been removed. The library now uses quaternions by default.'); } } @@ -37178,28 +34908,28 @@ Object.defineProperties(Mesh.prototype, { drawMode: { - get: function get() { + get: function () { console.error('THREE.Mesh: .drawMode has been removed. The renderer now always assumes THREE.TrianglesDrawMode.'); return TrianglesDrawMode; }, - set: function set() { + set: function () { console.error('THREE.Mesh: .drawMode has been removed. The renderer now always assumes THREE.TrianglesDrawMode. Transform your geometry via BufferGeometryUtils.toTrianglesDrawMode() if necessary.'); } } }); Object.defineProperties(LOD.prototype, { objects: { - get: function get() { + get: function () { console.warn('THREE.LOD: .objects has been renamed to .levels.'); return this.levels; } } }); Object.defineProperty(Skeleton.prototype, 'useVertexTexture', { - get: function get() { + get: function () { console.warn('THREE.Skeleton: useVertexTexture has been removed.'); }, - set: function set() { + set: function () { console.warn('THREE.Skeleton: useVertexTexture has been removed.'); } }); @@ -37209,11 +34939,11 @@ }; Object.defineProperty(Curve.prototype, '__arcLengthDivisions', { - get: function get() { + get: function () { console.warn('THREE.Curve: .__arcLengthDivisions is now .arcLengthDivisions.'); return this.arcLengthDivisions; }, - set: function set(value) { + set: function (value) { console.warn('THREE.Curve: .__arcLengthDivisions is now .arcLengthDivisions.'); this.arcLengthDivisions = value; } @@ -37228,76 +34958,76 @@ Object.defineProperties(Light.prototype, { onlyShadow: { - set: function set() { + set: function () { console.warn('THREE.Light: .onlyShadow has been removed.'); } }, shadowCameraFov: { - set: function set(value) { + set: function (value) { console.warn('THREE.Light: .shadowCameraFov is now .shadow.camera.fov.'); this.shadow.camera.fov = value; } }, shadowCameraLeft: { - set: function set(value) { + set: function (value) { console.warn('THREE.Light: .shadowCameraLeft is now .shadow.camera.left.'); this.shadow.camera.left = value; } }, shadowCameraRight: { - set: function set(value) { + set: function (value) { console.warn('THREE.Light: .shadowCameraRight is now .shadow.camera.right.'); this.shadow.camera.right = value; } }, shadowCameraTop: { - set: function set(value) { + set: function (value) { console.warn('THREE.Light: .shadowCameraTop is now .shadow.camera.top.'); this.shadow.camera.top = value; } }, shadowCameraBottom: { - set: function set(value) { + set: function (value) { console.warn('THREE.Light: .shadowCameraBottom is now .shadow.camera.bottom.'); this.shadow.camera.bottom = value; } }, shadowCameraNear: { - set: function set(value) { + set: function (value) { console.warn('THREE.Light: .shadowCameraNear is now .shadow.camera.near.'); this.shadow.camera.near = value; } }, shadowCameraFar: { - set: function set(value) { + set: function (value) { console.warn('THREE.Light: .shadowCameraFar is now .shadow.camera.far.'); this.shadow.camera.far = value; } }, shadowCameraVisible: { - set: function set() { + set: function () { console.warn('THREE.Light: .shadowCameraVisible has been removed. Use new THREE.CameraHelper( light.shadow.camera ) instead.'); } }, shadowBias: { - set: function set(value) { + set: function (value) { console.warn('THREE.Light: .shadowBias is now .shadow.bias.'); this.shadow.bias = value; } }, shadowDarkness: { - set: function set() { + set: function () { console.warn('THREE.Light: .shadowDarkness has been removed.'); } }, shadowMapWidth: { - set: function set(value) { + set: function (value) { console.warn('THREE.Light: .shadowMapWidth is now .shadow.mapSize.width.'); this.shadow.mapSize.width = value; } }, shadowMapHeight: { - set: function set(value) { + set: function (value) { console.warn('THREE.Light: .shadowMapHeight is now .shadow.mapSize.height.'); this.shadow.mapSize.height = value; } @@ -37306,17 +35036,17 @@ Object.defineProperties(BufferAttribute.prototype, { length: { - get: function get() { + get: function () { console.warn('THREE.BufferAttribute: .length has been deprecated. Use .count instead.'); return this.array.length; } }, dynamic: { - get: function get() { + get: function () { console.warn('THREE.BufferAttribute: .dynamic has been deprecated. Use .usage instead.'); return this.usage === DynamicDrawUsage; }, - set: function set() + set: function () /* value */ { console.warn('THREE.BufferAttribute: .dynamic has been deprecated. Use .usage instead.'); @@ -37393,13 +35123,13 @@ Object.defineProperties(BufferGeometry.prototype, { drawcalls: { - get: function get() { + get: function () { console.error('THREE.BufferGeometry: .drawcalls has been renamed to .groups.'); return this.groups; } }, offsets: { - get: function get() { + get: function () { console.warn('THREE.BufferGeometry: .offsets has been renamed to .groups.'); return this.groups; } @@ -37407,11 +35137,11 @@ }); Object.defineProperties(InstancedBufferGeometry.prototype, { maxInstancedCount: { - get: function get() { + get: function () { console.warn('THREE.InstancedBufferGeometry: .maxInstancedCount has been renamed to .instanceCount.'); return this.instanceCount; }, - set: function set(value) { + set: function (value) { console.warn('THREE.InstancedBufferGeometry: .maxInstancedCount has been renamed to .instanceCount.'); this.instanceCount = value; } @@ -37419,11 +35149,11 @@ }); Object.defineProperties(Raycaster.prototype, { linePrecision: { - get: function get() { + get: function () { console.warn('THREE.Raycaster: .linePrecision has been deprecated. Use .params.Line.threshold instead.'); return this.params.Line.threshold; }, - set: function set(value) { + set: function (value) { console.warn('THREE.Raycaster: .linePrecision has been deprecated. Use .params.Line.threshold instead.'); this.params.Line.threshold = value; } @@ -37431,11 +35161,11 @@ }); Object.defineProperties(InterleavedBuffer.prototype, { dynamic: { - get: function get() { + get: function () { console.warn('THREE.InterleavedBuffer: .length has been deprecated. Use .usage instead.'); return this.usage === DynamicDrawUsage; }, - set: function set(value) { + set: function (value) { console.warn('THREE.InterleavedBuffer: .length has been deprecated. Use .usage instead.'); this.setUsage(value); } @@ -37475,12 +35205,12 @@ Object.defineProperties(Uniform.prototype, { dynamic: { - set: function set() { + set: function () { console.warn('THREE.Uniform: .dynamic has been removed. Use object.onBeforeRender() instead.'); } }, onUpdate: { - value: function value() { + value: function () { console.warn('THREE.Uniform: .onUpdate() has been removed. Use object.onBeforeRender() instead.'); return this; } @@ -37489,42 +35219,42 @@ Object.defineProperties(Material.prototype, { wrapAround: { - get: function get() { + get: function () { console.warn('THREE.Material: .wrapAround has been removed.'); }, - set: function set() { + set: function () { console.warn('THREE.Material: .wrapAround has been removed.'); } }, overdraw: { - get: function get() { + get: function () { console.warn('THREE.Material: .overdraw has been removed.'); }, - set: function set() { + set: function () { console.warn('THREE.Material: .overdraw has been removed.'); } }, wrapRGB: { - get: function get() { + get: function () { console.warn('THREE.Material: .wrapRGB has been removed.'); return new Color(); } }, shading: { - get: function get() { + get: function () { console.error('THREE.' + this.type + ': .shading has been removed. Use the boolean .flatShading instead.'); }, - set: function set(value) { + set: function (value) { console.warn('THREE.' + this.type + ': .shading has been removed. Use the boolean .flatShading instead.'); this.flatShading = value === FlatShading; } }, stencilMask: { - get: function get() { + get: function () { console.warn('THREE.' + this.type + ': .stencilMask has been removed. Use .stencilFuncMask instead.'); return this.stencilFuncMask; }, - set: function set(value) { + set: function (value) { console.warn('THREE.' + this.type + ': .stencilMask has been removed. Use .stencilFuncMask instead.'); this.stencilFuncMask = value; } @@ -37532,22 +35262,22 @@ }); Object.defineProperties(MeshPhongMaterial.prototype, { metal: { - get: function get() { + get: function () { console.warn('THREE.MeshPhongMaterial: .metal has been removed. Use THREE.MeshStandardMaterial instead.'); return false; }, - set: function set() { + set: function () { console.warn('THREE.MeshPhongMaterial: .metal has been removed. Use THREE.MeshStandardMaterial instead'); } } }); Object.defineProperties(MeshPhysicalMaterial.prototype, { transparency: { - get: function get() { + get: function () { console.warn('THREE.MeshPhysicalMaterial: .transparency has been renamed to .transmission.'); return this.transmission; }, - set: function set(value) { + set: function (value) { console.warn('THREE.MeshPhysicalMaterial: .transparency has been renamed to .transmission.'); this.transmission = value; } @@ -37555,11 +35285,11 @@ }); Object.defineProperties(ShaderMaterial.prototype, { derivatives: { - get: function get() { + get: function () { console.warn('THREE.ShaderMaterial: .derivatives has been moved to .extensions.derivatives.'); return this.extensions.derivatives; }, - set: function set(value) { + set: function (value) { console.warn('THREE. ShaderMaterial: .derivatives has been moved to .extensions.derivatives.'); this.extensions.derivatives = value; } @@ -37685,102 +35415,102 @@ Object.defineProperties(WebGLRenderer.prototype, { shadowMapEnabled: { - get: function get() { + get: function () { return this.shadowMap.enabled; }, - set: function set(value) { + set: function (value) { console.warn('THREE.WebGLRenderer: .shadowMapEnabled is now .shadowMap.enabled.'); this.shadowMap.enabled = value; } }, shadowMapType: { - get: function get() { + get: function () { return this.shadowMap.type; }, - set: function set(value) { + set: function (value) { console.warn('THREE.WebGLRenderer: .shadowMapType is now .shadowMap.type.'); this.shadowMap.type = value; } }, shadowMapCullFace: { - get: function get() { + get: function () { console.warn('THREE.WebGLRenderer: .shadowMapCullFace has been removed. Set Material.shadowSide instead.'); return undefined; }, - set: function set() + set: function () /* value */ { console.warn('THREE.WebGLRenderer: .shadowMapCullFace has been removed. Set Material.shadowSide instead.'); } }, context: { - get: function get() { + get: function () { console.warn('THREE.WebGLRenderer: .context has been removed. Use .getContext() instead.'); return this.getContext(); } }, vr: { - get: function get() { + get: function () { console.warn('THREE.WebGLRenderer: .vr has been renamed to .xr'); return this.xr; } }, gammaInput: { - get: function get() { + get: function () { console.warn('THREE.WebGLRenderer: .gammaInput has been removed. Set the encoding for textures via Texture.encoding instead.'); return false; }, - set: function set() { + set: function () { console.warn('THREE.WebGLRenderer: .gammaInput has been removed. Set the encoding for textures via Texture.encoding instead.'); } }, gammaOutput: { - get: function get() { + get: function () { console.warn('THREE.WebGLRenderer: .gammaOutput has been removed. Set WebGLRenderer.outputEncoding instead.'); return false; }, - set: function set(value) { + set: function (value) { console.warn('THREE.WebGLRenderer: .gammaOutput has been removed. Set WebGLRenderer.outputEncoding instead.'); this.outputEncoding = value === true ? sRGBEncoding : LinearEncoding; } }, toneMappingWhitePoint: { - get: function get() { + get: function () { console.warn('THREE.WebGLRenderer: .toneMappingWhitePoint has been removed.'); return 1.0; }, - set: function set() { + set: function () { console.warn('THREE.WebGLRenderer: .toneMappingWhitePoint has been removed.'); } } }); Object.defineProperties(WebGLShadowMap.prototype, { cullFace: { - get: function get() { + get: function () { console.warn('THREE.WebGLRenderer: .shadowMap.cullFace has been removed. Set Material.shadowSide instead.'); return undefined; }, - set: function set() + set: function () /* cullFace */ { console.warn('THREE.WebGLRenderer: .shadowMap.cullFace has been removed. Set Material.shadowSide instead.'); } }, renderReverseSided: { - get: function get() { + get: function () { console.warn('THREE.WebGLRenderer: .shadowMap.renderReverseSided has been removed. Set Material.shadowSide instead.'); return undefined; }, - set: function set() { + set: function () { console.warn('THREE.WebGLRenderer: .shadowMap.renderReverseSided has been removed. Set Material.shadowSide instead.'); } }, renderSingleSided: { - get: function get() { + get: function () { console.warn('THREE.WebGLRenderer: .shadowMap.renderSingleSided has been removed. Set Material.shadowSide instead.'); return undefined; }, - set: function set() { + set: function () { console.warn('THREE.WebGLRenderer: .shadowMap.renderSingleSided has been removed. Set Material.shadowSide instead.'); } } @@ -37792,101 +35522,101 @@ Object.defineProperties(WebGLRenderTarget.prototype, { wrapS: { - get: function get() { + get: function () { console.warn('THREE.WebGLRenderTarget: .wrapS is now .texture.wrapS.'); return this.texture.wrapS; }, - set: function set(value) { + set: function (value) { console.warn('THREE.WebGLRenderTarget: .wrapS is now .texture.wrapS.'); this.texture.wrapS = value; } }, wrapT: { - get: function get() { + get: function () { console.warn('THREE.WebGLRenderTarget: .wrapT is now .texture.wrapT.'); return this.texture.wrapT; }, - set: function set(value) { + set: function (value) { console.warn('THREE.WebGLRenderTarget: .wrapT is now .texture.wrapT.'); this.texture.wrapT = value; } }, magFilter: { - get: function get() { + get: function () { console.warn('THREE.WebGLRenderTarget: .magFilter is now .texture.magFilter.'); return this.texture.magFilter; }, - set: function set(value) { + set: function (value) { console.warn('THREE.WebGLRenderTarget: .magFilter is now .texture.magFilter.'); this.texture.magFilter = value; } }, minFilter: { - get: function get() { + get: function () { console.warn('THREE.WebGLRenderTarget: .minFilter is now .texture.minFilter.'); return this.texture.minFilter; }, - set: function set(value) { + set: function (value) { console.warn('THREE.WebGLRenderTarget: .minFilter is now .texture.minFilter.'); this.texture.minFilter = value; } }, anisotropy: { - get: function get() { + get: function () { console.warn('THREE.WebGLRenderTarget: .anisotropy is now .texture.anisotropy.'); return this.texture.anisotropy; }, - set: function set(value) { + set: function (value) { console.warn('THREE.WebGLRenderTarget: .anisotropy is now .texture.anisotropy.'); this.texture.anisotropy = value; } }, offset: { - get: function get() { + get: function () { console.warn('THREE.WebGLRenderTarget: .offset is now .texture.offset.'); return this.texture.offset; }, - set: function set(value) { + set: function (value) { console.warn('THREE.WebGLRenderTarget: .offset is now .texture.offset.'); this.texture.offset = value; } }, repeat: { - get: function get() { + get: function () { console.warn('THREE.WebGLRenderTarget: .repeat is now .texture.repeat.'); return this.texture.repeat; }, - set: function set(value) { + set: function (value) { console.warn('THREE.WebGLRenderTarget: .repeat is now .texture.repeat.'); this.texture.repeat = value; } }, format: { - get: function get() { + get: function () { console.warn('THREE.WebGLRenderTarget: .format is now .texture.format.'); return this.texture.format; }, - set: function set(value) { + set: function (value) { console.warn('THREE.WebGLRenderTarget: .format is now .texture.format.'); this.texture.format = value; } }, type: { - get: function get() { + get: function () { console.warn('THREE.WebGLRenderTarget: .type is now .texture.type.'); return this.texture.type; }, - set: function set(value) { + set: function (value) { console.warn('THREE.WebGLRenderTarget: .type is now .texture.type.'); this.texture.type = value; } }, generateMipmaps: { - get: function get() { + get: function () { console.warn('THREE.WebGLRenderTarget: .generateMipmaps is now .texture.generateMipmaps.'); return this.texture.generateMipmaps; }, - set: function set(value) { + set: function (value) { console.warn('THREE.WebGLRenderTarget: .generateMipmaps is now .texture.generateMipmaps.'); this.texture.generateMipmaps = value; } @@ -37895,10 +35625,10 @@ Object.defineProperties(Audio.prototype, { load: { - value: function value(file) { + value: function (file) { console.warn('THREE.Audio: .load has been deprecated. Use THREE.AudioLoader instead.'); - var scope = this; - var audioLoader = new AudioLoader(); + const scope = this; + const audioLoader = new AudioLoader(); audioLoader.load(file, function (buffer) { scope.setBuffer(buffer); }); @@ -37906,7 +35636,7 @@ } }, startTime: { - set: function set() { + set: function () { console.warn('THREE.Audio: .startTime is now .play( delay ).'); } } @@ -37932,18 +35662,18 @@ ImageUtils.loadTexture = function (url, mapping, onLoad, onError) { console.warn('THREE.ImageUtils.loadTexture has been deprecated. Use THREE.TextureLoader() instead.'); - var loader = new TextureLoader(); + const loader = new TextureLoader(); loader.setCrossOrigin(this.crossOrigin); - var texture = loader.load(url, onLoad, undefined, onError); + const 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.'); - var loader = new CubeTextureLoader(); + const loader = new CubeTextureLoader(); loader.setCrossOrigin(this.crossOrigin); - var texture = loader.load(urls, onLoad, undefined, onError); + const texture = loader.load(urls, onLoad, undefined, onError); if (mapping) texture.mapping = mapping; return texture; }; @@ -37965,18 +35695,18 @@ console.error('THREE.JSONLoader has been removed.'); } // - var SceneUtils = { - createMultiMaterialObject: function createMultiMaterialObject() + const SceneUtils = { + createMultiMaterialObject: function () /* geometry, materials */ { console.error('THREE.SceneUtils has been moved to /examples/jsm/utils/SceneUtils.js'); }, - detach: function detach() + detach: function () /* child, parent, scene */ { console.error('THREE.SceneUtils has been moved to /examples/jsm/utils/SceneUtils.js'); }, - attach: function attach() + attach: function () /* 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 529ba325242cff5779d667e2a9f455b377979588..8c4a05ed60f1f3ca0f9625eb5bf188207936e6ac 100644 --- a/build/three.min.js +++ b/build/three.min.js @@ -1,2 +1,2 @@ // threejs.org/license -!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";var e=function(t){var e,n=Object.prototype,r=n.hasOwnProperty,i="function"==typeof Symbol?Symbol:{},a=i.iterator||"@@iterator",o=i.asyncIterator||"@@asyncIterator",s=i.toStringTag||"@@toStringTag";function l(t,e,n){return Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{l({},"")}catch(t){l=function(t,e,n){return t[e]=n}}function c(t,e,n,r){var i=e&&e.prototype instanceof v?e:v,a=Object.create(i.prototype),o=new L(r||[]);return a._invoke=function(t,e,n){var r=h;return function(i,a){if(r===p)throw new Error("Generator is already running");if(r===f){if("throw"===i)throw a;return C()}for(n.method=i,n.arg=a;;){var o=n.delegate;if(o){var s=T(o,n);if(s){if(s===m)continue;return s}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if(r===h)throw r=f,n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);r=p;var l=u(t,e,n);if("normal"===l.type){if(r=n.done?f:d,l.arg===m)continue;return{value:l.arg,done:n.done}}"throw"===l.type&&(r=f,n.method="throw",n.arg=l.arg)}}}(t,n,o),a}function u(t,e,n){try{return{type:"normal",arg:t.call(e,n)}}catch(t){return{type:"throw",arg:t}}}t.wrap=c;var h="suspendedStart",d="suspendedYield",p="executing",f="completed",m={};function v(){}function g(){}function y(){}var x={};x[a]=function(){return this};var _=Object.getPrototypeOf,b=_&&_(_(R([])));b&&b!==n&&r.call(b,a)&&(x=b);var w=y.prototype=v.prototype=Object.create(x);function M(t){["next","throw","return"].forEach((function(e){l(t,e,(function(t){return this._invoke(e,t)}))}))}function S(t,e){function n(i,a,o,s){var l=u(t[i],t,a);if("throw"!==l.type){var c=l.arg,h=c.value;return h&&"object"==typeof h&&r.call(h,"__await")?e.resolve(h.__await).then((function(t){n("next",t,o,s)}),(function(t){n("throw",t,o,s)})):e.resolve(h).then((function(t){c.value=t,o(c)}),(function(t){return n("throw",t,o,s)}))}s(l.arg)}var i;this._invoke=function(t,r){function a(){return new e((function(e,i){n(t,r,e,i)}))}return i=i?i.then(a,a):a()}}function T(t,n){var r=t.iterator[n.method];if(r===e){if(n.delegate=null,"throw"===n.method){if(t.iterator.return&&(n.method="return",n.arg=e,T(t,n),"throw"===n.method))return m;n.method="throw",n.arg=new TypeError("The iterator does not provide a 'throw' method")}return m}var i=u(r,t.iterator,n.arg);if("throw"===i.type)return n.method="throw",n.arg=i.arg,n.delegate=null,m;var a=i.arg;return a?a.done?(n[t.resultName]=a.value,n.next=t.nextLoc,"return"!==n.method&&(n.method="next",n.arg=e),n.delegate=null,m):a:(n.method="throw",n.arg=new TypeError("iterator result is not an object"),n.delegate=null,m)}function E(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function A(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function L(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(E,this),this.reset(!0)}function R(t){if(t){var n=t[a];if(n)return n.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var i=-1,o=function n(){for(;++i=0;--a){var o=this.tryEntries[a],s=o.completion;if("root"===o.tryLoc)return i("end");if(o.tryLoc<=this.prev){var l=r.call(o,"catchLoc"),c=r.call(o,"finallyLoc");if(l&&c){if(this.prev=0;--n){var i=this.tryEntries[n];if(i.tryLoc<=this.prev&&r.call(i,"finallyLoc")&&this.prev=0;--e){var n=this.tryEntries[e];if(n.finallyLoc===t)return this.complete(n.completion,n.afterLoc),A(n),m}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var n=this.tryEntries[e];if(n.tryLoc===t){var r=n.completion;if("throw"===r.type){var i=r.arg;A(n)}return i}}throw new Error("illegal catch attempt")},delegateYield:function(t,n,r){return this.delegate={iterator:R(t),resultName:n,nextLoc:r},"next"===this.method&&(this.arg=e),m}},t}("object"==typeof module?module.exports:{});try{regeneratorRuntime=e}catch(t){Function("r","regeneratorRuntime = r")(e)}var n="127dev",r=100,i=300,a=301,o=302,s=303,l=304,c=306,u=307,h=1e3,d=1001,p=1002,f=1003,m=1004,v=1005,g=1006,y=1007,x=1008,_=1009,b=1012,w=1014,M=1015,S=1016,T=1020,E=1022,A=1023,L=1026,R=1027,C=33776,P=33777,D=33778,I=33779,N=35840,B=35841,O=35842,z=35843,F=37492,H=37496,G=2300,U=2301,k=2302,V=2400,W=2401,j=2402,q=2500,X=2501,Y=3e3,Z=3001,J=3007,Q=3002,K=3004,$=3005,tt=3006,et=7680,nt=35044,rt=35048,it="300 es";function at(t,e,n,r,i,a,o){try{var s=t[a](o),l=s.value}catch(t){return void n(t)}s.done?e(l):Promise.resolve(l).then(r,i)}function ot(t,e){for(var n=0;nt.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 pt(){}Object.assign(pt.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]+ft[t>>16&255]+ft[t>>24&255]+"-"+ft[255&e]+ft[e>>8&255]+"-"+ft[e>>16&15|64]+ft[e>>24&255]+"-"+ft[63&n|128]+ft[n>>8&255]+"-"+ft[n>>16&255]+ft[n>>24&255]+ft[255&r]+ft[r>>8&255]+ft[r>>16&255]+ft[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 gt.lerp(t,e,1-Math.exp(-n*r))},pingpong:function(t,e){return void 0===e&&(e=1),e-Math.abs(gt.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&&(vt=t%2147483647),((vt=16807*vt%2147483647)-1)/2147483646},degToRad:function(t){return t*gt.DEG2RAD},radToDeg:function(t){return t*gt.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),c=a((e+r)/2),u=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*u,l*h,l*d,s*c);break;case"YZY":t.set(l*d,s*u,l*h,s*c);break;case"ZXZ":t.set(l*h,l*d,s*u,s*c);break;case"XZX":t.set(s*u,l*f,l*p,s*c);break;case"YXY":t.set(l*p,s*u,l*f,s*c);break;case"ZYZ":t.set(l*f,l*p,s*u,s*c);break;default:console.warn("THREE.MathUtils: .setQuaternionFromProperEuler() encountered an unknown order: "+i)}}},yt=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},st(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}();yt.prototype.isVector2=!0;var xt,_t=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 c=this.elements;return c[0]=t,c[1]=r,c[2]=o,c[3]=e,c[4]=i,c[5]=s,c[6]=n,c[7]=a,c[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],c=n[4],u=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+c*g+u*_,i[4]=l*m+c*y+u*b,i[7]=l*v+c*x+u*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],c=t[8];return e*a*c-e*o*l-n*i*c+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],c=t[8],u=c*a-o*l,h=o*s-c*i,d=l*i-a*s,p=e*u+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]=u*f,t[1]=(r*l-c*n)*f,t[2]=(o*n-r*a)*f,t[3]=h*f,t[4]=(c*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],c=r[7];return r[0]=e*i+n*s,r[3]=e*a+n*l,r[6]=e*o+n*c,r[1]=-n*i+e*s,r[4]=-n*a+e*l,r[7]=-n*o+e*c,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}();_t.prototype.isMatrix3=!0;var bt={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===xt&&(xt=document.createElementNS("http://www.w3.org/1999/xhtml","canvas")),xt.width=t.width,xt.height=t.height;var n=xt.getContext("2d");t instanceof ImageData?n.putImageData(t,0,0):n.drawImage(t,0,0,t.width,t.height),e=xt}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")}},wt=0,Mt=function(t){function e(n,r,i,a,o,s,l,c,u,h){var p;return void 0===n&&(n=e.DEFAULT_IMAGE),void 0===r&&(r=e.DEFAULT_MAPPING),void 0===i&&(i=d),void 0===a&&(a=d),void 0===o&&(o=g),void 0===s&&(s=x),void 0===l&&(l=A),void 0===c&&(c=_),void 0===u&&(u=1),void 0===h&&(h=Y),p=t.call(this)||this,Object.defineProperty(ut(p),"id",{value:wt++}),p.uuid=gt.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=u,p.format=l,p.internalFormat=null,p.type=c,p.offset=new yt(0,0),p.repeat=new yt(1,1),p.center=new yt(0,0),p.rotation=0,p.matrixAutoUpdate=!0,p.matrix=new _t,p.generateMipmaps=!0,p.premultiplyAlpha=!1,p.flipY=!0,p.unpackAlignment=4,p.encoding=h,p.version=0,p.onUpdate=null,p}lt(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=gt.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 h:t.x=t.x-Math.floor(t.x);break;case d:t.x=t.x<0?0:1;break;case p: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 d:t.y=t.y<0?0:1;break;case p: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},st(e,[{key:"needsUpdate",set:function(t){!0===t&&this.version++}}]),e}(pt);function St(t){return"undefined"!=typeof HTMLImageElement&&t instanceof HTMLImageElement||"undefined"!=typeof HTMLCanvasElement&&t instanceof HTMLCanvasElement||"undefined"!=typeof ImageBitmap&&t instanceof ImageBitmap?bt.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."),{})}Mt.DEFAULT_IMAGE=void 0,Mt.DEFAULT_MAPPING=i,Mt.prototype.isTexture=!0;var Tt=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],c=s[4],u=s[8],h=s[1],d=s[5],p=s[9],f=s[2],m=s[6],v=s[10];if(Math.abs(c-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,c=c*m+p*b,u=u*m+f*b,m===1-o){var w=1/Math.sqrt(s*s+l*l+c*c+u*u);s*=w,l*=w,c*=w,u*=w}}t[e]=s,t[e+1]=l,t[e+2]=c,t[e+3]=u},t.multiplyQuaternionsFlat=function(t,e,n,r,i,a){var o=n[r],s=n[r+1],l=n[r+2],c=n[r+3],u=i[a],h=i[a+1],d=i[a+2],p=i[a+3];return t[e]=o*p+c*u+s*d-l*h,t[e+1]=s*p+c*h+l*u-o*d,t[e+2]=l*p+c*d+o*h-s*u,t[e+3]=c*p-o*u-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),c=o(r/2),u=o(i/2),h=s(n/2),d=s(r/2),p=s(i/2);switch(a){case"XYZ":this._x=h*c*u+l*d*p,this._y=l*d*u-h*c*p,this._z=l*c*p+h*d*u,this._w=l*c*u-h*d*p;break;case"YXZ":this._x=h*c*u+l*d*p,this._y=l*d*u-h*c*p,this._z=l*c*p-h*d*u,this._w=l*c*u+h*d*p;break;case"ZXY":this._x=h*c*u-l*d*p,this._y=l*d*u+h*c*p,this._z=l*c*p+h*d*u,this._w=l*c*u-h*d*p;break;case"ZYX":this._x=h*c*u-l*d*p,this._y=l*d*u+h*c*p,this._z=l*c*p-h*d*u,this._w=l*c*u+h*d*p;break;case"YZX":this._x=h*c*u+l*d*p,this._y=l*d*u+h*c*p,this._z=l*c*p-h*d*u,this._w=l*c*u-h*d*p;break;case"XZY":this._x=h*c*u-l*d*p,this._y=l*d*u-h*c*p,this._z=l*c*p+h*d*u,this._w=l*c*u+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],c=e[6],u=e[10],h=n+o+u;if(h>0){var d=.5/Math.sqrt(h+1);this._w=.25/d,this._x=(c-s)*d,this._y=(i-l)*d,this._z=(a-r)*d}else if(n>o&&n>u){var p=2*Math.sqrt(1+n-o-u);this._w=(c-s)/p,this._x=.25*p,this._y=(r+a)/p,this._z=(i+l)/p}else if(o>u){var f=2*Math.sqrt(1+o-n-u);this._w=(i-l)/f,this._x=(r+a)/f,this._y=.25*f,this._z=(s+c)/f}else{var m=2*Math.sqrt(1+u-n-o);this._w=(a-r)/m,this._x=(i+l)/m,this._y=(s+c)/m,this._z=.25*m}return this._onChangeCallback(),this},e.setFromUnitVectors=function(t,e){var n=t.dot(e)+1;return n<1e-6?(n=0,Math.abs(t.x)>Math.abs(t.z)?(this._x=-t.y,this._y=t.x,this._z=0,this._w=n):(this._x=0,this._y=-t.z,this._z=t.y,this._w=n)):(this._x=t.y*e.z-t.z*e.y,this._y=t.z*e.x-t.x*e.z,this._z=t.x*e.y-t.y*e.x,this._w=n),this.normalize()},e.angleTo=function(t){return 2*Math.acos(Math.abs(gt.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,c=e._w;return this._x=n*c+a*o+r*l-i*s,this._y=r*c+a*s+i*o-n*l,this._z=i*c+a*l+n*s-r*o,this._w=a*c-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 c=Math.sqrt(s),u=Math.atan2(c,o),h=Math.sin((1-e)*u)/c,d=Math.sin(e*u)/c;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(){},st(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}();Lt.prototype.isQuaternion=!0;var Rt=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(Pt.setFromEuler(t))},e.applyAxisAngle=function(t,e){return this.applyQuaternion(Pt.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,c=s*n+o*e-i*r,u=s*r+i*n-a*e,h=-i*e-a*n-o*r;return this.x=l*s+h*-i+c*-o-u*-a,this.y=c*s+h*-a+u*-i-l*-o,this.z=u*s+h*-o+l*-a-c*-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 Ct.copy(this).projectOnVector(t),this.sub(Ct)},e.reflect=function(t){return this.sub(Ct.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(gt.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}();Rt.prototype.isVector3=!0;var Ct=new Rt,Pt=new Lt,Dt=function(){function t(t,e){void 0===t&&(t=new Rt(1/0,1/0,1/0)),void 0===e&&(e=new Rt(-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=c),u>a&&(a=u),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=c),u>a&&(a=u),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 Rt),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,Nt),Nt.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(kt),Vt.subVectors(this.max,kt),Ot.subVectors(t.a,kt),zt.subVectors(t.b,kt),Ft.subVectors(t.c,kt),Ht.subVectors(zt,Ot),Gt.subVectors(Ft,zt),Ut.subVectors(Ot,Ft);var e=[0,-Ht.z,Ht.y,0,-Gt.z,Gt.y,0,-Ut.z,Ut.y,Ht.z,0,-Ht.x,Gt.z,0,-Gt.x,Ut.z,0,-Ut.x,-Ht.y,Ht.x,0,-Gt.y,Gt.x,0,-Ut.y,Ut.x,0];return!!qt(e,Ot,zt,Ft,Vt)&&(!!qt(e=[1,0,0,0,1,0,0,0,1],Ot,zt,Ft,Vt)&&(Wt.crossVectors(Ht,Gt),qt(e=[Wt.x,Wt.y,Wt.z],Ot,zt,Ft,Vt)))},e.clampPoint=function(t,e){return void 0===e&&(console.warn("THREE.Box3: .clampPoint() target is now required"),e=new Rt),e.copy(t).clamp(this.min,this.max)},e.distanceToPoint=function(t){return Nt.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(Nt).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()||(It[0].set(this.min.x,this.min.y,this.min.z).applyMatrix4(t),It[1].set(this.min.x,this.min.y,this.max.z).applyMatrix4(t),It[2].set(this.min.x,this.max.y,this.min.z).applyMatrix4(t),It[3].set(this.min.x,this.max.y,this.max.z).applyMatrix4(t),It[4].set(this.max.x,this.min.y,this.min.z).applyMatrix4(t),It[5].set(this.max.x,this.min.y,this.max.z).applyMatrix4(t),It[6].set(this.max.x,this.max.y,this.min.z).applyMatrix4(t),It[7].set(this.max.x,this.max.y,this.max.z).applyMatrix4(t),this.setFromPoints(It)),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}();Dt.prototype.isBox3=!0;var It=[new Rt,new Rt,new Rt,new Rt,new Rt,new Rt,new Rt,new Rt],Nt=new Rt,Bt=new Dt,Ot=new Rt,zt=new Rt,Ft=new Rt,Ht=new Rt,Gt=new Rt,Ut=new Rt,kt=new Rt,Vt=new Rt,Wt=new Rt,jt=new Rt;function qt(t,e,n,r,i){for(var a=0,o=t.length-3;a<=o;a+=3){jt.fromArray(t,a);var s=i.x*Math.abs(jt.x)+i.y*Math.abs(jt.y)+i.z*Math.abs(jt.z),l=e.dot(jt),c=n.dot(jt),u=r.dot(jt);if(Math.max(-Math.max(l,c,u),Math.min(l,c,u))>s)return!1}return!0}var Xt=new Dt,Yt=function(){function t(t,e){void 0===t&&(t=new Rt),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):Xt.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 Dt),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.equals=function(t){return t.center.equals(this.center)&&t.radius===this.radius},e.clone=function(){return(new this.constructor).copy(this)},t}(),Zt=new Rt,Jt=new Rt,Qt=new Rt,Kt=new Rt,$t=new Rt,te=new Rt,ee=new Rt,ne=function(){function t(t,e){void 0===t&&(t=new Rt),void 0===e&&(e=new Rt(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 Rt),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,Zt)),this},e.closestPointToPoint=function(t,e){void 0===e&&(console.warn("THREE.Ray: .closestPointToPoint() target is now required"),e=new Rt),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=Zt.subVectors(t,this.origin).dot(this.direction);return e<0?this.origin.distanceToSquared(t):(Zt.copy(this.direction).multiplyScalar(e).add(this.origin),Zt.distanceToSquared(t))},e.distanceSqToSegment=function(t,e,n,r){Jt.copy(t).add(e).multiplyScalar(.5),Qt.copy(e).sub(t).normalize(),Kt.copy(this.origin).sub(Jt);var i,a,o,s,l=.5*t.distanceTo(e),c=-this.direction.dot(Qt),u=Kt.dot(this.direction),h=-Kt.dot(Qt),d=Kt.lengthSq(),p=Math.abs(1-c*c);if(p>0)if(a=c*u-h,s=l*p,(i=c*h-u)>=0)if(a>=-s)if(a<=s){var f=1/p;o=(i*=f)*(i+c*(a*=f)+2*u)+a*(c*i+a+2*h)+d}else a=l,o=-(i=Math.max(0,-(c*a+u)))*i+a*(a+2*h)+d;else a=-l,o=-(i=Math.max(0,-(c*a+u)))*i+a*(a+2*h)+d;else a<=-s?o=-(i=Math.max(0,-(-c*l+u)))*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,-(c*l+u)))*i+(a=i>0?l:Math.min(Math.max(-l,-h),l))*(a+2*h)+d;else a=c>0?-l:l,o=-(i=Math.max(0,-(c*a+u)))*i+a*(a+2*h)+d;return n&&n.copy(this.direction).multiplyScalar(i).add(this.origin),r&&r.copy(Qt).multiplyScalar(a).add(Jt),o},e.intersectSphere=function(t,e){Zt.subVectors(t.center,this.origin);var n=Zt.dot(this.direction),r=Zt.dot(Zt)-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,c=1/this.direction.y,u=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),c>=0?(i=(t.min.y-h.y)*c,a=(t.max.y-h.y)*c):(i=(t.max.y-h.y)*c,a=(t.min.y-h.y)*c),n>a||i>r?null:((i>n||n!=n)&&(n=i),(a=0?(o=(t.min.z-h.z)*u,s=(t.max.z-h.z)*u):(o=(t.max.z-h.z)*u,s=(t.min.z-h.z)*u),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,Zt)},e.intersectTriangle=function(t,e,n,r,i){$t.subVectors(e,t),te.subVectors(n,t),ee.crossVectors($t,te);var a,o=this.direction.dot(ee);if(o>0){if(r)return null;a=1}else{if(!(o<0))return null;a=-1,o=-o}Kt.subVectors(this.origin,t);var s=a*this.direction.dot(te.crossVectors(Kt,te));if(s<0)return null;var l=a*this.direction.dot($t.cross(Kt));if(l<0)return null;if(s+l>o)return null;var c=-a*Kt.dot(ee);return c<0?null:this.at(c/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}(),re=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,c,u,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]=c,v[10]=u,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/ie.setFromMatrixColumn(t,0).length(),i=1/ie.setFromMatrixColumn(t,1).length(),a=1/ie.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),c=Math.cos(i),u=Math.sin(i);if("XYZ"===t.order){var h=a*c,d=a*u,p=o*c,f=o*u;e[0]=s*c,e[4]=-s*u,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*c,v=s*u,g=l*c,y=l*u;e[0]=m+y*o,e[4]=g*o-v,e[8]=a*l,e[1]=a*u,e[5]=a*c,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*c,_=s*u,b=l*c,w=l*u;e[0]=x-w*o,e[4]=-a*u,e[8]=b+_*o,e[1]=_+b*o,e[5]=a*c,e[9]=w-x*o,e[2]=-a*l,e[6]=o,e[10]=a*s}else if("ZYX"===t.order){var M=a*c,S=a*u,T=o*c,E=o*u;e[0]=s*c,e[4]=T*l-S,e[8]=M*l+E,e[1]=s*u,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*c,e[4]=C-A*u,e[8]=R*u+L,e[1]=u,e[5]=a*c,e[9]=-o*c,e[2]=-l*c,e[6]=L*u+R,e[10]=A-C*u}else if("XZY"===t.order){var P=a*s,D=a*l,I=o*s,N=o*l;e[0]=s*c,e[4]=-u,e[8]=l*c,e[1]=P*u+N,e[5]=a*c,e[9]=D*u-I,e[2]=I*u-D,e[6]=o*c,e[10]=N*u+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(oe,t,se)},e.lookAt=function(t,e,n){var r=this.elements;return ue.subVectors(t,e),0===ue.lengthSq()&&(ue.z=1),ue.normalize(),le.crossVectors(n,ue),0===le.lengthSq()&&(1===Math.abs(n.z)?ue.x+=1e-4:ue.z+=1e-4,ue.normalize(),le.crossVectors(n,ue)),le.normalize(),ce.crossVectors(ue,le),r[0]=le.x,r[4]=ce.x,r[8]=ue.x,r[1]=le.y,r[5]=ce.y,r[9]=ue.y,r[2]=le.z,r[6]=ce.z,r[10]=ue.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],c=n[1],u=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]=c*b+u*T+h*R+d*I,i[5]=c*w+u*E+h*C+d*N,i[9]=c*M+u*A+h*P+d*B,i[13]=c*S+u*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],c=t[2],u=t[6],h=t[10],d=t[14];return t[3]*(+i*s*u-r*l*u-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*c-i*s*c)+t[11]*(+e*l*u-e*o*d-i*a*u+n*a*d+i*o*c-n*l*c)+t[15]*(-r*o*c-e*s*u+e*o*h+r*a*u-n*a*h+n*s*c)},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],c=t[8],u=t[9],h=t[10],d=t[11],p=t[12],f=t[13],m=t[14],v=t[15],g=u*m*l-f*h*l+f*s*d-o*m*d-u*s*v+o*h*v,y=p*h*l-c*m*l-p*s*d+a*m*d+c*s*v-a*h*v,x=c*f*l-p*u*l+p*o*d-a*f*d-c*o*v+a*u*v,_=p*u*s-c*f*s-p*o*h+a*f*h+c*o*m-a*u*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-u*m*i-f*r*d+n*m*d+u*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]=(u*s*i-o*h*i-u*r*l+n*h*l+o*r*d-n*s*d)*w,t[4]=y*w,t[5]=(c*m*i-p*h*i+p*r*d-e*m*d-c*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-c*s*i+c*r*l-e*h*l-a*r*d+e*s*d)*w,t[8]=x*w,t[9]=(p*u*i-c*f*i-p*n*d+e*f*d+c*n*v-e*u*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]=(c*o*i-a*u*i-c*n*l+e*u*l+a*n*d-e*o*d)*w,t[12]=_*w,t[13]=(c*f*r-p*u*r+p*n*h-e*f*h-c*n*m+e*u*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*u*r-c*o*r+c*n*s-e*u*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,c=i*o;return this.set(l*a+n,l*o-r*s,l*s+r*o,0,l*o+r*s,c*o+n,c*s-r*a,0,l*s-r*o,c*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,c=a+a,u=o+o,h=i*l,d=i*c,p=i*u,f=a*c,m=a*u,v=o*u,g=s*l,y=s*c,x=s*u,_=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=ie.set(r[0],r[1],r[2]).length(),a=ie.set(r[4],r[5],r[6]).length(),o=ie.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],ae.copy(this);var s=1/i,l=1/a,c=1/o;return ae.elements[0]*=s,ae.elements[1]*=s,ae.elements[2]*=s,ae.elements[4]*=l,ae.elements[5]*=l,ae.elements[6]*=l,ae.elements[8]*=c,ae.elements[9]*=c,ae.elements[10]*=c,e.setFromRotationMatrix(ae),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),c=(e+t)/(e-t),u=(n+r)/(n-r),h=-(a+i)/(a-i),d=-2*a*i/(a-i);return o[0]=s,o[4]=0,o[8]=c,o[12]=0,o[1]=0,o[5]=l,o[9]=u,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),c=1/(a-i),u=(e+t)*s,h=(n+r)*l,d=(a+i)*c;return o[0]=2*s,o[4]=0,o[8]=0,o[12]=-u,o[1]=0,o[5]=2*l,o[9]=0,o[13]=-h,o[2]=0,o[6]=0,o[10]=-2*c,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}();re.prototype.isMatrix4=!0;var ie=new Rt,ae=new re,oe=new Rt(0,0,0),se=new Rt(1,1,1),le=new Rt,ce=new Rt,ue=new Rt,he=new re,de=new Lt,pe=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=gt.clamp,i=t.elements,a=i[0],o=i[4],s=i[8],l=i[1],c=i[5],u=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(-u,p),this._z=Math.atan2(-o,a)):(this._x=Math.atan2(d,c),this._z=0);break;case"YXZ":this._x=Math.asin(-r(u,-1,1)),Math.abs(u)<.9999999?(this._y=Math.atan2(s,p),this._z=Math.atan2(l,c)):(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,c)):(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,c));break;case"YZX":this._z=Math.asin(r(l,-1,1)),Math.abs(l)<.9999999?(this._x=Math.atan2(-u,c),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,c),this._y=Math.atan2(s,a)):(this._x=Math.atan2(-u,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 he.makeRotationFromQuaternion(t),this.setFromRotationMatrix(he,e,n)},e.setFromVector3=function(t,e){return this.set(t.x,t.y,t.z,e||this._order)},e.reorder=function(t){return de.setFromEuler(this),this.setFromQuaternion(de,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 Rt(this._x,this._y,this._z)},e._onChange=function(t){return this._onChangeCallback=t,this},e._onChangeCallback=function(){},st(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}();pe.prototype.isEuler=!0,pe.DefaultOrder="XYZ",pe.RotationOrders=["XYZ","YZX","ZXY","XZY","YXZ","ZYX"];var fe=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?void 0: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 Rt),t.copy(this.normal).multiplyScalar(-this.constant)},e.applyMatrix4=function(t,e){var n=e||Pe.getNormalMatrix(t),r=this.coplanarPoint(Re).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}();De.prototype.isPlane=!0;var Ie=new Rt,Ne=new Rt,Be=new Rt,Oe=new Rt,ze=new Rt,Fe=new Rt,He=new Rt,Ge=new Rt,Ue=new Rt,ke=new Rt,Ve=function(){function t(t,e,n){void 0===t&&(t=new Rt),void 0===e&&(e=new Rt),void 0===n&&(n=new Rt),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 Rt),r.subVectors(n,e),Ie.subVectors(t,e),r.cross(Ie);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){Ie.subVectors(r,e),Ne.subVectors(n,e),Be.subVectors(t,e);var a=Ie.dot(Ie),o=Ie.dot(Ne),s=Ie.dot(Be),l=Ne.dot(Ne),c=Ne.dot(Be),u=a*l-o*o;if(void 0===i&&(console.warn("THREE.Triangle: .getBarycoord() target is now required"),i=new Rt),0===u)return i.set(-2,-1,-1);var h=1/u,d=(l*s-o*c)*h,p=(a*c-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,Oe),Oe.x>=0&&Oe.y>=0&&Oe.x+Oe.y<=1},t.getUV=function(t,e,n,r,i,a,o,s){return this.getBarycoord(t,e,n,r,Oe),s.set(0,0),s.addScaledVector(i,Oe.x),s.addScaledVector(a,Oe.y),s.addScaledVector(o,Oe.z),s},t.isFrontFacing=function(t,e,n,r){return Ie.subVectors(n,e),Ne.subVectors(t,e),Ie.cross(Ne).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 Ie.subVectors(this.c,this.b),Ne.subVectors(this.a,this.b),.5*Ie.cross(Ne).length()},e.getMidpoint=function(t){return void 0===t&&(console.warn("THREE.Triangle: .getMidpoint() target is now required"),t=new Rt),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 De),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 Rt);var n,r,i=this.a,a=this.b,o=this.c;ze.subVectors(a,i),Fe.subVectors(o,i),Ge.subVectors(t,i);var s=ze.dot(Ge),l=Fe.dot(Ge);if(s<=0&&l<=0)return e.copy(i);Ue.subVectors(t,a);var c=ze.dot(Ue),u=Fe.dot(Ue);if(c>=0&&u<=c)return e.copy(a);var h=s*u-c*l;if(h<=0&&s>=0&&c<=0)return n=s/(s-c),e.copy(i).addScaledVector(ze,n);ke.subVectors(t,o);var d=ze.dot(ke),p=Fe.dot(ke);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(Fe,r);var m=c*p-d*u;if(m<=0&&u-c>=0&&d-p>=0)return He.subVectors(o,a),r=(u-c)/(u-c+(d-p)),e.copy(a).addScaledVector(He,r);var v=1/(m+f+h);return n=f*v,r=h*v,e.copy(i).addScaledVector(ze,n).addScaledVector(Fe,r)},e.equals=function(t){return t.a.equals(this.a)&&t.b.equals(this.b)&&t.c.equals(this.c)},t}(),We=0;function je(){Object.defineProperty(this,"id",{value:We++}),this.uuid=gt.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=r,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=et,this.stencilZFail=et,this.stencilZPass=et,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}je.prototype=Object.assign(Object.create(pt.prototype),{constructor:je,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),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.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(je.prototype,"needsUpdate",{set:function(t){!0===t&&this.version++}});var qe={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},Xe={h:0,s:0,l:0},Ye={h:0,s:0,l:0};function Ze(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 Je(t){return t<.04045?.0773993808*t:Math.pow(.9478672986*t+.0521327014,2.4)}function Qe(t){return t<.0031308?12.92*t:1.055*Math.pow(t,.41666)-.055}var Ke=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=gt.euclideanModulo(t,1),e=gt.clamp(e,0,1),n=gt.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=Ze(i,r,t+1/3),this.g=Ze(i,r,t),this.b=Ze(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 c=n[1],u=c.length;if(3===u)return this.r=parseInt(c.charAt(0)+c.charAt(0),16)/255,this.g=parseInt(c.charAt(1)+c.charAt(1),16)/255,this.b=parseInt(c.charAt(2)+c.charAt(2),16)/255,this;if(6===u)return this.r=parseInt(c.charAt(0)+c.charAt(1),16)/255,this.g=parseInt(c.charAt(2)+c.charAt(3),16)/255,this.b=parseInt(c.charAt(4)+c.charAt(5),16)/255,this}return t&&t.length>0?this.setColorName(t):this},e.setColorName=function(t){var e=qe[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=Je(t.r),this.g=Je(t.g),this.b=Je(t.b),this},e.copyLinearToSRGB=function(t){return this.r=Qe(t.r),this.g=Qe(t.g),this.b=Qe(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 c=o-s;switch(n=l<=.5?c/(o+s):c/(2-o-s),o){case r:e=(i-a)/c+(ie&&(e=t[n]);return e}Object.defineProperty(nn.prototype,"needsUpdate",{set:function(t){!0===t&&this.version++}}),Object.assign(nn.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?un:ln)(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 _t).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 yn.makeRotationX(t),this.applyMatrix4(yn),this},rotateY:function(t){return yn.makeRotationY(t),this.applyMatrix4(yn),this},rotateZ:function(t){return yn.makeRotationZ(t),this.applyMatrix4(yn),this},translate:function(t,e,n){return yn.makeTranslation(t,e,n),this.applyMatrix4(yn),this},scale:function(t,e,n){return yn.makeScale(t,e,n),this.applyMatrix4(yn),this},lookAt:function(t){return xn.lookAt(t),xn.updateMatrix(),this.applyMatrix4(xn.matrix),this},center:function(){return this.computeBoundingBox(),this.boundingBox.getCenter(_n).negate(),this.translate(_n.x,_n.y,_n.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],s=o.toJSON(t.data);""!==o.name&&(s.name=o.name),t.data.attributes[a]=s}var l={},c=!1;for(var u in this.morphAttributes){for(var h=this.morphAttributes[u],d=[],p=0,f=h.length;p0&&(l[u]=d,c=!0)}c&&(t.data.morphAttributes=l,t.data.morphTargetsRelative=this.morphTargetsRelative);var g=this.groups;g.length>0&&(t.data.groups=JSON.parse(JSON.stringify(g)));var y=this.boundingSphere;return null!==y&&(t.data.boundingSphere={center:y.center.toArray(),radius:y.radius}),t},clone:function(){return(new Sn).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=[],c=o[s],u=0,h=c.length;un.far?null:{distance:l,point:Un.clone(),object:t}}(t,e,n,r,Ln,Rn,Cn,Gn);if(g){s&&(zn.fromBufferAttribute(s,c),Fn.fromBufferAttribute(s,u),Hn.fromBufferAttribute(s,h),g.uv=Ve.getUV(Gn,Ln,Rn,Cn,zn,Fn,Hn,new yt)),l&&(zn.fromBufferAttribute(l,c),Fn.fromBufferAttribute(l,u),Hn.fromBufferAttribute(l,h),g.uv2=Ve.getUV(Gn,Ln,Rn,Cn,zn,Fn,Hn,new yt));var y={a:c,b:u,c:h,normal:new Rt,materialIndex:0};Ve.getNormal(Ln,Rn,Cn,y.normal),g.face=y}return g}kn.prototype=Object.assign(Object.create(Le.prototype),{constructor:kn,isMesh:!0,copy:function(t){return Le.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(),An.copy(r.boundingSphere),An.applyMatrix4(a),!1!==t.ray.intersectsSphere(An)&&(Tn.copy(a).invert(),En.copy(t.ray).applyMatrix4(Tn),null===r.boundingBox||!1!==En.intersectsBox(r.boundingBox))))if(r.isBufferGeometry){var o=r.index,s=r.attributes.position,l=r.morphAttributes.position,c=r.morphTargetsRelative,u=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},Zn.prototype=Object.assign(Object.create(Le.prototype),{constructor:Zn,isCamera:!0,copy:function(t,e){return Le.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 Rt),this.updateWorldMatrix(!0,!1);var e=this.matrixWorld.elements;return t.set(-e[8],-e[9],-e[10]).normalize()},updateMatrixWorld:function(t){Le.prototype.updateMatrixWorld.call(this,t),this.matrixWorldInverse.copy(this.matrixWorld).invert()},updateWorldMatrix:function(t,e){Le.prototype.updateWorldMatrix.call(this,t,e),this.matrixWorldInverse.copy(this.matrixWorld).invert()},clone:function(){return(new this.constructor).copy(this)}}),Jn.prototype=Object.assign(Object.create(Zn.prototype),{constructor:Jn,isPerspectiveCamera:!0,copy:function(t,e){return Zn.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*gt.RAD2DEG*Math.atan(e),this.updateProjectionMatrix()},getFocalLength:function(){var t=Math.tan(.5*gt.DEG2RAD*this.fov);return.5*this.getFilmHeight()/t},getEffectiveFOV:function(){return 2*gt.RAD2DEG*Math.atan(Math.tan(.5*gt.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*gt.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=Le.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 Qn=90,Kn=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."),ut(i);i.renderTarget=r;var a=new Jn(Qn,1,e,n);a.layers=i.layers,a.up.set(0,-1,0),a.lookAt(new Rt(1,0,0)),i.add(a);var o=new Jn(Qn,1,e,n);o.layers=i.layers,o.up.set(0,-1,0),o.lookAt(new Rt(-1,0,0)),i.add(o);var s=new Jn(Qn,1,e,n);s.layers=i.layers,s.up.set(0,0,1),s.lookAt(new Rt(0,1,0)),i.add(s);var l=new Jn(Qn,1,e,n);l.layers=i.layers,l.up.set(0,0,-1),l.lookAt(new Rt(0,-1,0)),i.add(l);var c=new Jn(Qn,1,e,n);c.layers=i.layers,c.up.set(0,-1,0),c.lookAt(new Rt(0,0,1)),i.add(c);var u=new Jn(Qn,1,e,n);return u.layers=i.layers,u.up.set(0,-1,0),u.lookAt(new Rt(0,0,-1)),i.add(u),i}return lt(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],c=r[5],u=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,c),t.setRenderTarget(h),t.xr.enabled=u},e}(Le),$n=function(t){function e(e,n,r,i,o,s,l,c,u,h){var d;return e=void 0!==e?e:[],n=void 0!==n?n:a,l=void 0!==l?l:E,(d=t.call(this,e,n,r,i,o,s,l,c,u,h)||this)._needsFlipEnvMap=!0,d.flipY=!1,d}return lt(e,t),st(e,[{key:"images",get:function(){return this.image},set:function(t){this.image=t}}]),e}(Mt);$n.prototype.isCubeTexture=!0;var tr=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 $n(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:g,i.texture._needsFlipEnvMap=!1,i}lt(e,t);var n=e.prototype;return n.fromEquirectangularTexture=function(t,e){this.texture.type=e.type,this.texture.format=A,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 Wn(5,5,5),o=new Yn({name:"CubemapFromEquirect",uniforms:jn(n),vertexShader:r,fragmentShader:i,side:1,blending:0});o.uniforms.tEquirect.value=e;var s=new kn(a,o),l=e.minFilter;return e.minFilter===x&&(e.minFilter=g),new Kn(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}(Et);tr.prototype.isWebGLCubeRenderTarget=!0;var er=function(t){function e(e,n,r,i,a,o,s,l,c,u,h,d){var p;return(p=t.call(this,null,o,s,l,c,u,i,a,h,d)||this).image={data:e||null,width:n||1,height:r||1},p.magFilter=void 0!==c?c:f,p.minFilter=void 0!==u?u:f,p.generateMipmaps=!1,p.flipY=!1,p.unpackAlignment=1,p.needsUpdate=!0,p}return lt(e,t),e}(Mt);er.prototype.isDataTexture=!0;var nr=new Yt,rr=new Rt,ir=function(){function t(t,e,n,r,i,a){void 0===t&&(t=new De),void 0===e&&(e=new De),void 0===n&&(n=new De),void 0===r&&(r=new De),void 0===i&&(i=new De),void 0===a&&(a=new De),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],c=n[6],u=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,u-s,f-h,y-m).normalize(),e[1].setComponents(o+r,u+s,f+h,y+m).normalize(),e[2].setComponents(o+i,u+l,f+d,y+v).normalize(),e[3].setComponents(o-i,u-l,f-d,y-v).normalize(),e[4].setComponents(o-a,u-c,f-p,y-g).normalize(),e[5].setComponents(o+a,u+c,f+p,y+g).normalize(),this},e.intersectsObject=function(t){var e=t.geometry;return null===e.boundingSphere&&e.computeBoundingSphere(),nr.copy(e.boundingSphere).applyMatrix4(t.matrixWorld),this.intersectsSphere(nr)},e.intersectsSprite=function(t){return nr.center.set(0,0,0),nr.radius=.7071067811865476,nr.applyMatrix4(t.matrixWorld),this.intersectsSphere(nr)},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,rr.y=r.normal.y>0?t.max.y:t.min.y,rr.z=r.normal.z>0?t.max.z:t.min.z,r.distanceToPoint(rr)<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 ar(){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 or(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 Ke(15658734)},opacity:{value:1},map:{value:null},uvTransform:{value:new _t},uv2Transform:{value:new _t},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 yt(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 _t}},sprite:{diffuse:{value:new Ke(15658734)},opacity:{value:1},center:{value:new yt(.5,.5)},rotation:{value:0},map:{value:null},alphaMap:{value:null},uvTransform:{value:new _t}}},ur={basic:{uniforms:qn([cr.common,cr.specularmap,cr.envmap,cr.aomap,cr.lightmap,cr.fog]),vertexShader:lr.meshbasic_vert,fragmentShader:lr.meshbasic_frag},lambert:{uniforms:qn([cr.common,cr.specularmap,cr.envmap,cr.aomap,cr.lightmap,cr.emissivemap,cr.fog,cr.lights,{emissive:{value:new Ke(0)}}]),vertexShader:lr.meshlambert_vert,fragmentShader:lr.meshlambert_frag},phong:{uniforms:qn([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 Ke(0)},specular:{value:new Ke(1118481)},shininess:{value:30}}]),vertexShader:lr.meshphong_vert,fragmentShader:lr.meshphong_frag},standard:{uniforms:qn([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 Ke(0)},roughness:{value:1},metalness:{value:0},envMapIntensity:{value:1}}]),vertexShader:lr.meshphysical_vert,fragmentShader:lr.meshphysical_frag},toon:{uniforms:qn([cr.common,cr.aomap,cr.lightmap,cr.emissivemap,cr.bumpmap,cr.normalmap,cr.displacementmap,cr.gradientmap,cr.fog,cr.lights,{emissive:{value:new Ke(0)}}]),vertexShader:lr.meshtoon_vert,fragmentShader:lr.meshtoon_frag},matcap:{uniforms:qn([cr.common,cr.bumpmap,cr.normalmap,cr.displacementmap,cr.fog,{matcap:{value:null}}]),vertexShader:lr.meshmatcap_vert,fragmentShader:lr.meshmatcap_frag},points:{uniforms:qn([cr.points,cr.fog]),vertexShader:lr.points_vert,fragmentShader:lr.points_frag},dashed:{uniforms:qn([cr.common,cr.fog,{scale:{value:1},dashSize:{value:1},totalSize:{value:2}}]),vertexShader:lr.linedashed_vert,fragmentShader:lr.linedashed_frag},depth:{uniforms:qn([cr.common,cr.displacementmap]),vertexShader:lr.depth_vert,fragmentShader:lr.depth_frag},normal:{uniforms:qn([cr.common,cr.bumpmap,cr.normalmap,cr.displacementmap,{opacity:{value:1}}]),vertexShader:lr.normal_vert,fragmentShader:lr.normal_frag},sprite:{uniforms:qn([cr.sprite,cr.fog]),vertexShader:lr.sprite_vert,fragmentShader:lr.sprite_frag},background:{uniforms:{uvTransform:{value:new _t},t2D:{value:null}},vertexShader:lr.background_vert,fragmentShader:lr.background_frag},cube:{uniforms:qn([cr.envmap,{opacity:{value:1}}]),vertexShader:lr.cube_vert,fragmentShader:lr.cube_frag},equirect:{uniforms:{tEquirect:{value:null}},vertexShader:lr.equirect_vert,fragmentShader:lr.equirect_frag},distanceRGBA:{uniforms:qn([cr.common,cr.displacementmap,{referencePosition:{value:new Rt},nearDistance:{value:1},farDistance:{value:1e3}}]),vertexShader:lr.distanceRGBA_vert,fragmentShader:lr.distanceRGBA_frag},shadow:{uniforms:qn([cr.lights,cr.fog,{color:{value:new Ke(0)},opacity:{value:1}}]),vertexShader:lr.shadow_vert,fragmentShader:lr.shadow_frag}};function hr(t,e,n,r,i){var a,o,s=new Ke(0),l=0,u=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,l=e)},getClearAlpha:function(){return l},setClearAlpha:function(t){p(s,l=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,l):v&&v.isColor&&(p(v,1),m=!0),(t.autoClear||m)&&t.clear(t.autoClearColor,t.autoClearDepth,t.autoClearStencil),v&&(v.isCubeTexture||v.mapping===c)?(void 0===o&&((o=new kn(new Wn(1,1,1),new Yn({name:"BackgroundCubeMaterial",uniforms:jn(ur.cube.uniforms),vertexShader:ur.cube.vertexShader,fragmentShader:ur.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,u===v&&h===v.version&&d===t.toneMapping||(o.material.needsUpdate=!0,u=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 kn(new sr(2,2),new Yn({name:"BackgroundMaterial",uniforms:jn(ur.background.uniforms),vertexShader:ur.background.vertexShader,fragmentShader:ur.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),u===v&&h===v.version&&d===t.toneMapping||(a.material.needsUpdate=!0,u=v,h=v.version,d=t.toneMapping),n.unshift(a,a.geometry,a.material,0,0,null))}}}function dr(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),c=l;function u(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!==u){var N=u[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 pr(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,c;if(a)l=t,c="drawArraysInstanced";else if(c="drawArraysInstancedANGLE",null===(l=e.get("ANGLE_instanced_arrays")))return void console.error("THREE.WebGLBufferRenderer: using THREE.InstancedBufferGeometry but hardware does not support extension ANGLE_instanced_arrays.");l[c](i,r,o,s),n.update(o,i,s)}}}function fr(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,c=t.getParameter(34930),u=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=u>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:c,maxVertexTextures:u,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 mr(t){var e=this,n=null,r=0,i=!1,a=!1,o=new De,s=new _t,l={value:null,needsUpdate:!1};function c(){l.value!==n&&(l.value=n,l.needsUpdate=r>0),e.numPlanes=r,e.numIntersection=0}function u(t,n,r,i){var a=null!==t?t.length:0,c=null;if(0!==a){if(c=l.value,!0!==i||null===c){var u=r+4*a,h=n.matrixWorldInverse;s.getNormalMatrix(h),(null===c||c.length0){var c=t.getRenderTarget(),u=new tr(o.height/2);return u.fromEquirectangularTexture(t,i),e.set(i,u),t.setRenderTarget(c),i.addEventListener("dispose",r),n(u.texture,i.mapping)}return null}}return i},dispose:function(){e=new WeakMap}}}function gr(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 yr(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 c=a.get(s);c&&(e.remove(c),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,c=s.length;l65535?un:ln)(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=Pr[i];if(void 0===a&&(a=new Float32Array(i),Pr[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 zr(t,e){if(t.length!==e.length)return!1;for(var n=0,r=t.length;n/gm;function Di(t){return t.replace(Pi,Ii)}function Ii(t,e){var n=lr[e];if(void 0===n)throw new Error("Can not resolve #include <"+e+">");return Di(n)}var Ni=/#pragma unroll_loop[\s]+?for \( int i \= (\d+)\; i < (\d+)\; i \+\+ \) \{([\s\S]+?)(?=\})\}/g,Bi=/#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 Oi(t){return t.replace(Bi,Fi).replace(Ni,zi)}function zi(t,e,n,r){return console.warn("WebGLProgram: #pragma unroll_loop shader syntax is deprecated. Please use #pragma unroll_loop_start syntax instead."),Fi(t,e,n,r)}function Fi(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(Li).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?((i=[M].filter(Li).join("\n")).length>0&&(i+="\n"),(s=[w,M].filter(Li).join("\n")).length>0&&(s+="\n")):(i=[Hi(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(Li).join("\n"),s=[w,Hi(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?lr.tonemapping_pars_fragment:"",0!==n.toneMapping?Ai("toneMapping",n.toneMapping):"",n.dithering?"#define DITHERING":"",lr.encodings_pars_fragment,n.map?Ei("mapTexelToLinear",n.mapEncoding):"",n.matcap?Ei("matcapTexelToLinear",n.matcapEncoding):"",n.envMap?Ei("envMapTexelToLinear",n.envMapEncoding):"",n.emissiveMap?Ei("emissiveMapTexelToLinear",n.emissiveMapEncoding):"",n.lightMap?Ei("lightMapTexelToLinear",n.lightMapEncoding):"",(l="linearToOutputTexel",h=n.outputEncoding,d=Si(h),"vec4 "+l+"( vec4 value ) { return LinearTo"+d[0]+d[1]+"; }"),n.depthPacking?"#define DEPTH_PACKING "+n.depthPacking:"","\n"].filter(Li).join("\n")),m=Ci(m=Ri(m=Di(m),n),n),v=Ci(v=Ri(v=Di(v),n),n),m=Oi(m),v=Oi(v),n.isWebGL2&&!0!==n.isRawShaderMaterial&&(T="#version 300 es\n",i=["#define attribute in","#define varying out","#define texture2D texture"].join("\n")+"\n"+i,s=["#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"+s);var E,A,L=T+s+v,R=wi(p,35633,T+i+m),C=wi(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=Ti(p,R,"vertex"),z=Ti(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:i},fragmentShader:{log:I,prefix:s}})}return p.deleteShader(R),p.deleteShader(C),this.getUniforms=function(){return void 0===E&&(E=new bi(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||Vi),i.length>1&&i.sort(e||Wi)}}}function qi(t){var e=new WeakMap;return{get:function(n,r){var i;return!1===e.has(n)?(i=new ji(t),e.set(n,[i])):r>=e.get(n).length?(i=new ji(t),e.get(n).push(i)):i=e.get(n)[r],i},dispose:function(){e=new WeakMap}}}function Xi(){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 Rt,color:new Ke};break;case"SpotLight":n={position:new Rt,direction:new Rt,color:new Ke,distance:0,coneCos:0,penumbraCos:0,decay:0};break;case"PointLight":n={position:new Rt,color:new Ke,distance:0,decay:0};break;case"HemisphereLight":n={direction:new Rt,skyColor:new Ke,groundColor:new Ke};break;case"RectAreaLight":n={color:new Ke,position:new Rt,halfWidth:new Rt,halfHeight:new Rt}}return t[e.id]=n,n}}}var Yi=0;function Zi(t,e){return(e.castShadow?1:0)-(t.castShadow?1:0)}function Ji(t,e){for(var n,r=new Xi,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 yt};break;case"PointLight":e={shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new yt,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 Rt);var s=new Rt,l=new re,c=new re;return{setup:function(n){for(var o=0,s=0,l=0,c=0;c<9;c++)a.probe[c].set(0,0,0);var u=0,h=0,d=0,p=0,f=0,m=0,v=0,g=0;n.sort(Zi);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===u&&z.pointLength===h&&z.spotLength===d&&z.rectAreaLength===p&&z.hemiLength===f&&z.numDirectionalShadows===m&&z.numPointShadows===v&&z.numSpotShadows===g||(a.directional.length=u,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=u,z.pointLength=h,z.spotLength=d,z.rectAreaLength=p,z.hemiLength=f,z.numDirectionalShadows=m,z.numPointShadows=v,z.numSpotShadows=g,a.version=Yi++)},setupView:function(t,e){for(var n=0,r=0,i=0,o=0,u=0,h=e.matrixWorldInverse,d=0,p=t.length;d=n.get(r).length?(a=new Qi(t,e),n.get(r).push(a)):a=n.get(r)[i],a},dispose:function(){n=new WeakMap}}}var $i=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 lt(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}(je);$i.prototype.isMeshDepthMaterial=!0;var ta=function(t){function e(e){var n;return(n=t.call(this)||this).type="MeshDistanceMaterial",n.referencePosition=new Rt,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 lt(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}(je);ta.prototype.isMeshDistanceMaterial=!0;function ea(t,e,n){var r=new ir,i=new yt,a=new yt,o=new Tt,s=[],l=[],c={},u={0:1,1:0,2:2},h=new Yn({defines:{SAMPLE_RATE:2/8,HALF_SAMPLE_RATE:1/8},uniforms:{shadow_pass:{value:null},resolution:{value:new yt},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}"}),d=h.clone();d.defines.HORIZONTAL_PASS=1;var p=new Sn;p.setAttribute("position",new nn(new Float32Array([-1,-1,.5,3,-1,.5,-1,3,.5]),3));var m=new kn(p,h),v=this;function y(n,r){var i=e.update(m);h.uniforms.shadow_pass.value=n.map.texture,h.uniforms.resolution.value=n.mapSize,h.uniforms.radius.value=n.radius,t.setRenderTarget(n.mapPass),t.clear(),t.renderBufferDirect(r,null,i,h,m,null),d.uniforms.shadow_pass.value=n.mapPass.texture,d.uniforms.resolution.value=n.mapSize,d.uniforms.radius.value=n.radius,t.setRenderTarget(n.map),t.clear(),t.renderBufferDirect(r,null,i,d,m,null)}function x(t,e,n){var r=t<<0|e<<1|n<<2,i=s[r];return void 0===i&&(i=new $i({depthPacking:3201,morphTargets:t,skinning:e}),s[r]=i),i}function _(t,e,n){var r=t<<0|e<<1|n<<2,i=l[r];return void 0===i&&(i=new ta({morphTargets:t,skinning:e}),l[r]=i),i}function b(e,n,r,i,a,o,s){var l=null,h=x,d=e.customDepthMaterial;if(!0===i.isPointLight&&(h=_,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=h(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=c[m];void 0===g&&(g={},c[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:u[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 w(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),c=n.material;if(Array.isArray(c))for(var u=l.groups,h=0,d=u.length;hn||i.y>n)&&(i.x>n&&(a.x=Math.floor(n/b.x),i.x=a.x*b.x,_.mapSize.x=a.x),i.y>n&&(a.y=Math.floor(n/b.y),i.y=a.y*b.y,_.mapSize.y=a.y)),null===_.map&&!_.isPointLightShadow&&3===this.type){var M={minFilter:g,magFilter:g,format:A};_.map=new Et(i.x,i.y,M),_.map.texture.name=x.name+".shadowMap",_.mapPass=new Et(i.x,i.y,M),_.camera.updateProjectionMatrix()}if(null===_.map){var S={minFilter:f,magFilter:f,format:A};_.map=new Et(i.x,i.y,S),_.map.texture.name=x.name+".shadowMap",_.camera.updateProjectionMatrix()}t.setRenderTarget(_.map),t.clear();for(var T=_.getViewportCount(),E=0;E=1):-1!==R.indexOf("OpenGL ES")&&(L=parseFloat(/^OpenGL ES (\d)/.exec(R)[1]),A=L>=2);var C=null,P={},D=new Tt,I=new Tt;function N(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?gt.floorPowerOfTwo:Math.floor,o=a(i*t.width),s=a(i*t.height);void 0===c&&(c=P(o,s));var l=n?P(o,s):c;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 gt.isPowerOfTwo(t.width)&>.isPowerOfTwo(t.height)}function N(t,e){return t.generateMipmaps&&e&&t.minFilter!==f&&t.minFilter!==g}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===u)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===f||t===m||t===v?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&&_.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;_.get(t)!==e&&(_.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=[],c=0;c<6;c++)l[c]=o||s?s?r.image[c].image:r.image[c]:D(r.image[c],!1,!0,p);var h,d=l[0],f=I(d)||u,m=a.convert(r.format),v=a.convert(r.type),g=O(r.internalFormat,m,v);if(j(34067,r,f),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!u&&(t.wrapS!==d||t.wrapT!==d||t.minFilter!==f&&t.minFilter!==g)}(r)&&!1===I(r.image),c=D(r.image,l,!1,y),h=I(c)||u,p=a.convert(r.format),m=a.convert(r.type),v=O(r.internalFormat,p,m);j(o,r,h);var x=r.mipmaps;if(r.isDepthTexture)v=6402,u?v=r.type===M?36012:r.type===w?33190:r.type===T?35056:33189:r.type===M&&console.error("WebGLRenderer: Floating point depth texture requires WebGL2."),r.format===L&&6402===v&&r.type!==b&&r.type!==w&&(console.warn("THREE.WebGLRenderer: Use UnsignedShortType or UnsignedIntType for DepthFormat DepthTexture."),r.type=b,m=a.convert(r.type)),r.format===R&&6402===v&&(v=34041,r.type!==T&&(console.warn("THREE.WebGLRenderer: Use UnsignedInt248Type for DepthStencilFormat DepthTexture."),r.type=T,m=a.convert(r.type))),n.texImage2D(3553,0,v,c.width,c.height,0,p,m,null);else if(r.isDataTexture)if(x.length>0&&h){for(var _=0,S=x.length;_0&&h){for(var z=0,F=x.length;z=h&&console.warn("THREE.WebGLTextures: Trying to use "+t+" texture units while this GPU supports only "+h),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(),o.memory.textures++;var c=!0===e.isWebGLCubeRenderTarget,h=!0===e.isWebGLMultisampleRenderTarget,d=i.isDataTexture3D||i.isDataTexture2DArray,p=I(e)||u;if(!u||i.format!==E||i.type!==M&&i.type!==S||(i.format=A,console.warn("THREE.WebGLRenderer: Rendering to textures with RGB format is not supported. Using RGBA format instead.")),c){s.__webglFramebuffer=[];for(var f=0;f<6;f++)s.__webglFramebuffer[f]=t.createFramebuffer()}else if(s.__webglFramebuffer=t.createFramebuffer(),h)if(u){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),t.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)),t.bindFramebuffer(36160,null)}else console.warn("THREE.WebGLRenderer: WebGLMultisampleRenderTarget can only be used with WebGL2.");if(c){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(u)_=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)||u)){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(u){var n=r.get(e);t.bindFramebuffer(36008,n.__webglMultisampledFramebuffer),t.bindFramebuffer(36009,n.__webglFramebuffer);var i=e.width,a=e.height,o=16384;e.depthBuffer&&(o|=256),e.stencilBuffer&&(o|=1024),t.blitFramebuffer(0,0,i,a,0,0,i,a,o,9728),t.bindFramebuffer(36160,n.__webglMultisampledFramebuffer)}else console.warn("THREE.WebGLRenderer: WebGLMultisampleRenderTarget can only be used with WebGL2.")},this.safeSetTexture2D=function(t,e){t&&t.isWebGLRenderTarget&&(!1===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 ia(t,e,n){var r=n.isWebGL2;return{convert:function(t){var n;if(t===_)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===b)return 5123;if(1013===t)return 5124;if(t===w)return 5125;if(t===M)return 5126;if(t===S)return r?5131:null!==(n=e.get("OES_texture_half_float"))?n.HALF_FLOAT_OES:null;if(1021===t)return 6406;if(t===E)return 6407;if(t===A)return 6408;if(1024===t)return 6409;if(1025===t)return 6410;if(t===L)return 6402;if(t===R)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===C||t===P||t===D||t===I){if(null===(n=e.get("WEBGL_compressed_texture_s3tc")))return null;if(t===C)return n.COMPRESSED_RGB_S3TC_DXT1_EXT;if(t===P)return n.COMPRESSED_RGBA_S3TC_DXT1_EXT;if(t===D)return n.COMPRESSED_RGBA_S3TC_DXT3_EXT;if(t===I)return n.COMPRESSED_RGBA_S3TC_DXT5_EXT}if(t===N||t===B||t===O||t===z){if(null===(n=e.get("WEBGL_compressed_texture_pvrtc")))return null;if(t===N)return n.COMPRESSED_RGB_PVRTC_4BPPV1_IMG;if(t===B)return n.COMPRESSED_RGB_PVRTC_2BPPV1_IMG;if(t===O)return n.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG;if(t===z)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===F||t===H)&&null!==(n=e.get("WEBGL_compressed_texture_etc"))){if(t===F)return n.COMPRESSED_RGB8_ETC2;if(t===H)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===T?r?34042:null!==(n=e.get("WEBGL_depth_texture"))?n.UNSIGNED_INT_24_8_WEBGL:null:void 0}}}function aa(t){void 0===t&&(t=[]),Jn.call(this),this.cameras=t}aa.prototype=Object.assign(Object.create(Jn.prototype),{constructor:aa,isArrayCamera:!0});var oa=function(t){function e(){var e;return(e=t.call(this)||this).type="Group",e}return lt(e,t),e}(Le);function sa(){this._targetRay=null,this._grip=null,this._hand=null}function la(t,e){var n=this,r=null,i=1,a=null,o="local-floor",s=null,l=[],c=new Map,u=new Jn;u.layers.enable(1),u.viewport=new Tt;var h=new Jn;h.layers.enable(2),h.viewport=new Tt;var d=[u,h],p=new aa;p.layers.enable(1),p.layers.enable(2);var f=null,m=null;function v(t){var e=c.get(t.inputSource);e&&e.dispatchEvent({type:t.type,data:t.inputSource})}function g(){c.forEach((function(t,e){t.disconnect(e)})),c.clear(),f=null,m=null,t.setFramebuffer(null),t.setRenderTarget(t.getRenderTarget()),M.stop(),n.isPresenting=!1,n.dispatchEvent({type:"sessionend"})}function y(t){for(var e=r.inputSources,n=0;n0&&It(a,t,e),o.length>0&&It(o,t,e),null!==w&&($.updateRenderTargetMipmap(w),$.updateMultisampleRenderTarget(w)),!0===t.isScene&&t.onAfterRender(v,t,e),J.buffers.depth.setTest(!0),J.buffers.depth.setMask(!0),J.buffers.color.setMask(!0),J.setPolygonOffset(!1),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.setFramebuffer=function(t){y!==t&&null===w&&mt.bindFramebuffer(36160,t),y=t},this.getActiveCubeFace=function(){return x},this.getActiveMipmapLevel=function(){return b},this.getRenderTarget=function(){return w},this.setRenderTarget=function(t,e,n){void 0===e&&(e=0),void 0===n&&(n=0),w=t,x=e,b=n,t&&void 0===K.get(t).__webglFramebuffer&&$.setupRenderTarget(t);var r=y,i=!1,a=!1;if(t){var o=t.texture;(o.isDataTexture3D||o.isDataTexture2DArray)&&(a=!0);var s=K.get(t).__webglFramebuffer;t.isWebGLCubeRenderTarget?(r=s[e],i=!0):r=t.isWebGLMultisampleRenderTarget?K.get(t).__webglMultisampledFramebuffer:s,R.copy(t.viewport),C.copy(t.scissor),P=t.scissorTest}else R.copy(z).multiplyScalar(N).floor(),C.copy(F).multiplyScalar(N).floor(),P=H;if(T!==r&&(mt.bindFramebuffer(36160,r),T=r),J.viewport(R),J.scissor(C),J.setScissorTest(P),i){var l=K.get(t.texture);mt.framebufferTexture2D(36160,36064,34069+e,l.__webglTexture,n)}else if(a){var c=K.get(t.texture),u=e||0;mt.framebufferTextureLayer(36160,36064,c.__webglTexture,n||0,u)}},this.readRenderTargetPixels=function(t,e,n,r,i,a,o){if(t&&t.isWebGLRenderTarget){var s=K.get(t).__webglFramebuffer;if(t.isWebGLCubeRenderTarget&&void 0!==o&&(s=s[o]),s){var l=!1;s!==T&&(mt.bindFramebuffer(36160,s),l=!0);try{var c=t.texture,u=c.format,h=c.type;if(u!==A&&pt.convert(u)!==mt.getParameter(35739))return void console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in RGBA or implementation defined format.");var d=h===S&&(X.has("EXT_color_buffer_half_float")||Z.isWebGL2&&X.has("EXT_color_buffer_float"));if(!(h===_||pt.convert(h)===mt.getParameter(35738)||h===M&&(Z.isWebGL2||X.has("OES_texture_float")||X.has("WEBGL_color_buffer_float"))||d))return void console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in UnsignedByteType or implementation defined type.");36053===mt.checkFramebufferStatus(36160)?e>=0&&e<=t.width-r&&n>=0&&n<=t.height-i&&mt.readPixels(e,n,r,i,pt.convert(u),pt.convert(h),a):console.error("THREE.WebGLRenderer.readRenderTargetPixels: readPixels from renderTarget failed. Framebuffer not complete.")}finally{l&&mt.bindFramebuffer(36160,T)}}}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=pt.convert(e.format);$.setTexture2D(e,0),mt.copyTexImage2D(3553,n,o,t.x,t.y,i,a,0),J.unbindTexture()},this.copyTextureToTexture=function(t,e,n,r){void 0===r&&(r=0);var i=e.image.width,a=e.image.height,o=pt.convert(n.format),s=pt.convert(n.type);$.setTexture2D(n,0),mt.pixelStorei(37440,n.flipY),mt.pixelStorei(37441,n.premultiplyAlpha),mt.pixelStorei(3317,n.unpackAlignment),e.isDataTexture?mt.texSubImage2D(3553,r,t.x,t.y,i,a,o,s,e.image.data):e.isCompressedTexture?mt.compressedTexSubImage2D(3553,r,t.x,t.y,e.mipmaps[0].width,e.mipmaps[0].height,o,e.mipmaps[0].data):mt.texSubImage2D(3553,r,t.x,t.y,o,s,e.image),0===r&&n.generateMipmaps&&mt.generateMipmap(3553),J.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,c=o.data,u=pt.convert(r.format),h=pt.convert(r.type);if(r.isDataTexture3D)$.setTexture3D(r,0),a=32879;else{if(!r.isDataTexture2DArray)return void console.warn("THREE.WebGLRenderer.copyTextureToTexture3D: only supports THREE.DataTexture3D and THREE.DataTexture2DArray.");$.setTexture2DArray(r,0),a=35866}mt.pixelStorei(37440,r.flipY),mt.pixelStorei(37441,r.premultiplyAlpha),mt.pixelStorei(3317,r.unpackAlignment);var d=mt.getParameter(3314),p=mt.getParameter(32878),f=mt.getParameter(3316),m=mt.getParameter(3315),g=mt.getParameter(32877);mt.pixelStorei(3314,s),mt.pixelStorei(32878,l),mt.pixelStorei(3316,t.min.x),mt.pixelStorei(3315,t.min.y),mt.pixelStorei(32877,t.min.z),mt.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,u,h,c),mt.pixelStorei(3314,d),mt.pixelStorei(32878,p),mt.pixelStorei(3316,f),mt.pixelStorei(3315,m),mt.pixelStorei(32877,g),0===i&&r.generateMipmaps&&mt.generateMipmap(a),J.unbindTexture()}},this.initTexture=function(t){$.setTexture2D(t,0),J.unbindTexture()},this.resetState=function(){J.reset(),ft.reset()},"undefined"!=typeof __THREE_DEVTOOLS__&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}oa.prototype.isGroup=!0,Object.assign(sa.prototype,{constructor:sa,getHandSpace:function(){return null===this._hand&&(this._hand=new oa,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 oa,this._targetRay.matrixAutoUpdate=!1,this._targetRay.visible=!1),this._targetRay},getGripSpace:function(){return null===this._grip&&(this._grip=new oa,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 c,u=dt(t.hand.values());!(c=u()).done;){var h=c.value,d=e.getJointPose(h,n);if(void 0===l.joints[h.jointName]){var p=new oa;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(la.prototype,pt.prototype);var ha=function(t){function e(){return t.apply(this,arguments)||this}return lt(e,t),e}(ua);ha.prototype.isWebGL1Renderer=!0;var da=function(){function t(t,e){this.name="",this.color=new Ke(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}();da.prototype.isFogExp2=!0;var pa=function(){function t(t,e,n){this.name="",this.color=new Ke(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}();pa.prototype.isFog=!0;var fa=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:ut(e)})),e}lt(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}(Le);function ma(t,e){this.array=t,this.stride=e,this.count=void 0!==t?t.length/e:0,this.usage=nt,this.updateRange={offset:0,count:-1},this.version=0,this.uuid=gt.generateUUID()}fa.prototype.isScene=!0,Object.defineProperty(ma.prototype,"needsUpdate",{set:function(t){!0===t&&this.version++}}),Object.assign(ma.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:_a.clone(),uv:Ve.getUV(_a,Ea,Aa,La,Ra,Ca,Pa,new yt),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}(Le);function Ia(t,e,n,r,i,a){Ma.subVectors(t,n).addScalar(.5).multiply(r),void 0!==i?(Sa.x=a*Ma.x-i*Ma.y,Sa.y=i*Ma.x+a*Ma.y):Sa.copy(Ma),t.copy(e),t.x+=Sa.x,t.y+=Sa.y,t.applyMatrix4(Ta)}Da.prototype.isSprite=!0;var Na=new Rt,Ba=new Rt,Oa=function(t){function e(){var e;return(e=t.call(this)||this)._currentLevel=0,e.type="LOD",Object.defineProperties(ut(e),{levels:{enumerable:!0,value:[]},isLOD:{value:!0}}),e.autoUpdate=!0,e}lt(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){Na.setFromMatrixPosition(this.matrixWorld);var n=t.ray.origin.distanceTo(Na);this.getObjectForDistance(n).raycast(t,e)}},n.update=function(t){var e=this.levels;if(e.length>1){Na.setFromMatrixPosition(t.matrixWorld),Ba.setFromMatrixPosition(this.matrixWorld);var n,r,i=Na.distanceTo(Ba)/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;no)){u.applyMatrix4(this.matrixWorld);var x=t.ray.origin.distanceTo(u);xt.far||e.push({distance:x,point:c.clone().applyMatrix4(this.matrixWorld),index:m,face:null,faceIndex:null,object:this})}}else for(var _=0,b=p.count-1;_o)){u.applyMatrix4(this.matrixWorld);var w=t.ray.origin.distanceTo(u);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 ao=new Rt,oo=new Rt;function so(t,e){io.call(this,t,e),this.type="LineSegments"}so.prototype=Object.assign(Object.create(io.prototype),{constructor:so,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:c,distanceToRay:Math.sqrt(s),point:l,index:e,face:null,object:o})}}mo.prototype=Object.assign(Object.create(Le.prototype),{constructor:mo,isPoints:!0,copy:function(t){return Le.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;if(null===n.boundingSphere&&n.computeBoundingSphere(),po.copy(n.boundingSphere),po.applyMatrix4(r),po.radius+=i,!1!==t.ray.intersectsSphere(po)){uo.copy(r).invert(),ho.copy(t.ray).applyMatrix4(uo);var a=i/((this.scale.x+this.scale.y+this.scale.z)/3),o=a*a;if(n.isBufferGeometry){var s=n.index,l=n.attributes.position;if(null!==s)for(var c=s.array,u=0,h=c.length;u0){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 go=function(t){function e(e,n,r,i,a,o,s,l,c){var u;(u=t.call(this,e,n,r,i,a,o,s,l,c)||this).format=void 0!==s?s:E,u.minFilter=void 0!==o?o:g,u.magFilter=void 0!==a?a:g,u.generateMipmaps=!1;var h=ut(u);return"requestVideoFrameCallback"in e&&e.requestVideoFrameCallback((function t(){h.needsUpdate=!0,e.requestVideoFrameCallback(t)})),u}lt(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}(Mt);go.prototype.isVideoTexture=!0;var yo=function(t){function e(e,n,r,i,a,o,s,l,c,u,h,d){var p;return(p=t.call(this,null,o,s,l,c,u,i,a,h,d)||this).image={width:n,height:r},p.mipmaps=e,p.flipY=!1,p.generateMipmaps=!1,p}return lt(e,t),e}(Mt);yo.prototype.isCompressedTexture=!0;var xo=function(t){function e(e,n,r,i,a,o,s,l,c){var u;return(u=t.call(this,e,n,r,i,a,o,s,l,c)||this).needsUpdate=!0,u}return lt(e,t),e}(Mt);xo.prototype.isCanvasTexture=!0;var _o=function(t){function e(e,n,r,i,a,o,s,l,c,u){var h;if((u=void 0!==u?u:L)!==L&&u!==R)throw new Error("DepthTexture format must be either THREE.DepthFormat or THREE.DepthStencilFormat");return void 0===r&&u===L&&(r=b),void 0===r&&u===R&&(r=T),(h=t.call(this,null,i,a,o,s,l,u,r,c)||this).image={width:e,height:n},h.magFilter=void 0!==s?s:f,h.minFilter=void 0!==l?l:f,h.flipY=!1,h.generateMipmaps=!1,h}return lt(e,t),e}(Mt);_o.prototype.isDepthTexture=!0;var bo=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=[],c=[],u=new Rt,h=new yt;s.push(0,0,0),l.push(0,0,1),c.push(.5,.5);for(var d=0,p=3;d<=n;d++,p+=3){var f=r+d/n*i;u.x=e*Math.cos(f),u.y=e*Math.sin(f),s.push(u.x,u.y,u.z),l.push(0,0,1),h.x=(s[p]/e+1)/2,h.y=(s[p+1]/e+1)/2,c.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 dn(s,3)),a.setAttribute("normal",new dn(l,3)),a.setAttribute("uv",new dn(c,2)),a}return lt(e,t),e}(Sn),wo=function(t){function e(e,n,r,i,a,o,s,l){var c;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),(c=t.call(this)||this).type="CylinderGeometry",c.parameters={radiusTop:e,radiusBottom:n,height:r,radialSegments:i,heightSegments:a,openEnded:o,thetaStart:s,thetaLength:l};var u=ut(c);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 yt,o=new Rt,c=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)),c.setIndex(h),c.setAttribute("position",new dn(d,3)),c.setAttribute("normal",new dn(p,3)),c.setAttribute("uv",new dn(f,2)),c}return lt(e,t),e}(Sn),Mo=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 lt(e,t),e}(wo),So=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),u=i-o,h=0;h<=u;h++)a[o][h]=0===h&&o===i?s:s.clone().lerp(l,h/u)}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 dn(o,3)),a.setAttribute("normal",new dn(o.slice(),3)),a.setAttribute("uv",new dn(s,2)),0===i?a.computeVertexNormals():a.normalizeNormals(),a}return lt(e,t),e}(Sn),To=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 lt(e,t),e}(So),Eo=new Rt,Ao=new Rt,Lo=new Rt,Ro=new Ve,Co=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."),ut(r);for(var i=Math.pow(10,4),a=Math.cos(gt.DEG2RAD*n),o=e.getIndex(),s=e.getAttribute("position"),l=o?o.count:s.count,c=[0,0,0],u=["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);c=0!==(c=Math.max(a-r,o-i))?1/c:0}return No(d,p,n,r,i,c),p};function Do(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=$o(a,t[a],t[a+1],o);return o&&Xo(o,o.next)&&(ts(o),o=o.next),o}function Io(t,e){if(!t)return t;e||(e=t);var n,r=t;do{if(n=!1,r.steiner||!Xo(r,r.next)&&0!==qo(r.prev,r,r.next))r=r.next;else{if(ts(r),(r=e=r.prev)===r.next)break;n=!0}}while(n||r!==e);return e}function No(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=ko(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,c=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,c*=2}while(o>1)}(i)}(t,r,i,a);for(var s,l,c=t;t.prev!==t.next;)if(s=t.prev,l=t.next,a?Oo(t,r,i,a):Bo(t))e.push(s.i/n),e.push(t.i/n),e.push(l.i/n),ts(t),t=l.next,c=l.next;else if((t=l)===c){o?1===o?No(t=zo(Io(t),e,n),e,n,r,i,a,2):2===o&&Fo(t,e,n,r,i,a):No(Io(t),e,n,r,i,a,1);break}}}function Bo(t){var e=t.prev,n=t,r=t.next;if(qo(e,n,r)>=0)return!1;for(var i=t.next.next;i!==t.prev;){if(Wo(e.x,e.y,n.x,n.y,r.x,r.y,i.x,i.y)&&qo(i.prev,i,i.next)>=0)return!1;i=i.next}return!0}function Oo(t,e,n,r){var i=t.prev,a=t,o=t.next;if(qo(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,u=i.y>a.y?i.y>o.y?i.y:o.y:a.y>o.y?a.y:o.y,h=ko(s,l,e,n,r),d=ko(c,u,e,n,r),p=t.prevZ,f=t.nextZ;p&&p.z>=h&&f&&f.z<=d;){if(p!==t.prev&&p!==t.next&&Wo(i.x,i.y,a.x,a.y,o.x,o.y,p.x,p.y)&&qo(p.prev,p,p.next)>=0)return!1;if(p=p.prevZ,f!==t.prev&&f!==t.next&&Wo(i.x,i.y,a.x,a.y,o.x,o.y,f.x,f.y)&&qo(f.prev,f,f.next)>=0)return!1;f=f.nextZ}for(;p&&p.z>=h;){if(p!==t.prev&&p!==t.next&&Wo(i.x,i.y,a.x,a.y,o.x,o.y,p.x,p.y)&&qo(p.prev,p,p.next)>=0)return!1;p=p.prevZ}for(;f&&f.z<=d;){if(f!==t.prev&&f!==t.next&&Wo(i.x,i.y,a.x,a.y,o.x,o.y,f.x,f.y)&&qo(f.prev,f,f.next)>=0)return!1;f=f.nextZ}return!0}function zo(t,e,n){var r=t;do{var i=r.prev,a=r.next.next;!Xo(i,a)&&Yo(i,r,r.next,a)&&Qo(i,a)&&Qo(a,i)&&(e.push(i.i/n),e.push(r.i/n),e.push(a.i/n),ts(r),ts(r.next),r=t=a),r=r.next}while(r!==t);return Io(r)}function Fo(t,e,n,r,i,a){var o=t;do{for(var s=o.next.next;s!==o.prev;){if(o.i!==s.i&&jo(o,s)){var l=Ko(o,s);return o=Io(o,o.next),l=Io(l,l.next),No(o,e,n,r,i,a),void No(l,e,n,r,i,a)}s=s.next}o=o.next}while(o!==t)}function Ho(t,e){return t.x-e.x}function Go(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>=u&&i!==r.x&&Wo(an.x||r.x===n.x&&Uo(n,r)))&&(n=r,d=l)),r=r.next}while(r!==c);return n}(t,e)){var n=Ko(e,t);Io(e,e.next),Io(n,n.next)}}function Uo(t,e){return qo(t.prev,t,e.prev)<0&&qo(e.next,t,t.next)<0}function ko(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 Vo(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 jo(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&&Yo(n,n.next,t,e))return!0;n=n.next}while(n!==t);return!1}(t,e)&&(Qo(t,e)&&Qo(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)&&(qo(t.prev,t,e.prev)||qo(t,e.prev,e))||Xo(t,e)&&qo(t.prev,t,t.next)>0&&qo(e.prev,e,e.next)>0)}function qo(t,e,n){return(e.y-t.y)*(n.x-e.x)-(e.x-t.x)*(n.y-e.y)}function Xo(t,e){return t.x===e.x&&t.y===e.y}function Yo(t,e,n,r){var i=Jo(qo(t,e,n)),a=Jo(qo(t,e,r)),o=Jo(qo(n,r,t)),s=Jo(qo(n,r,e));return i!==a&&o!==s||(!(0!==i||!Zo(t,n,e))||(!(0!==a||!Zo(t,r,e))||(!(0!==o||!Zo(n,t,r))||!(0!==s||!Zo(n,e,r)))))}function Zo(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 Jo(t){return t>0?1:t<0?-1:0}function Qo(t,e){return qo(t.prev,t,t.next)<0?qo(t,e,t.next)>=0&&qo(t,t.prev,e)>=0:qo(t,e,t.prev)<0||qo(t,t.next,e)<0}function Ko(t,e){var n=new es(t.i,t.x,t.y),r=new es(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 $o(t,e,n,r){var i=new es(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 ts(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 es(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 ns={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 is(t,e){for(var n=0;nNumber.EPSILON){var d=Math.sqrt(u),p=Math.sqrt(l*l+c*c),f=e.x-s/d,m=e.y+o/d,v=((n.x-c/p-f)*c-(n.y+l/p-m)*l)/(o*c-s*l),g=(r=f+o*v-t.x)*r+(i=m+s*v-t.y)*i;if(g<=2)return new yt(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(c)&&(y=!0),y?(r=-s,i=o,a=Math.sqrt(u)):(r=o,i=s,a=Math.sqrt(u/2))}return new yt(r/a,i/a)}for(var z=[],F=0,H=R.length,G=H-1,U=F+1;F=0;gt--){for(var xt=gt/p,_t=u*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,u),h.subVectors(c,u)):(t(g+s,m,u),h.subVectors(u,c)),m-s>=0?(t(g,m-s,u),d.subVectors(c,u)):(t(g,m+s,u),d.subVectors(u,c)),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||c=r)){u.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=Ds.arraySlice(r.values,m,v)}else{var g=r.createInterpolant(),y=s,x=l-s;g.evaluate(a),d=Ds.arraySlice(g.resultBuffer,y,x)}"quaternion"===i&&(new Lt).fromArray(d).normalize().conjugate().toArray(d);for(var _=o.times.length,b=0;b<_;++b){var w=b*u+c;if("quaternion"===i)Lt.multiplyQuaternionsFlat(o.values,w,d,0,o.values,w);else for(var M=u-2*c,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=Ds.arraySlice(n,i,a),this.values=Ds.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&&Ds.isTypedArray(r))for(var l=0,c=r.length;l!==c;++l){var u=r[l];if(isNaN(u)){console.error("THREE.KeyframeTrack: Value is not a valid number.",this,l,u),t=!1;break}}return t},e.optimize=function(){for(var t=Ds.arraySlice(this.times),e=Ds.arraySlice(this.values),n=this.getValueSize(),r=this.getInterpolation()===k,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=Ds.arraySlice(t,0,a),this.values=Ds.arraySlice(e,0,a*n)):(this.times=t,this.values=e),this},e.clone=function(){var t=Ds.arraySlice(this.times,0),e=Ds.arraySlice(this.values,0),n=new(0,this.constructor)(this.name,t,e);return n.createInterpolant=this.createInterpolant,n},t}();zs.prototype.TimeBufferType=Float32Array,zs.prototype.ValueBufferType=Float32Array,zs.prototype.DefaultInterpolation=U;var Fs=function(t){function e(){return t.apply(this,arguments)||this}return lt(e,t),e}(zs);Fs.prototype.ValueTypeName="bool",Fs.prototype.ValueBufferType=Array,Fs.prototype.DefaultInterpolation=G,Fs.prototype.InterpolantFactoryMethodLinear=void 0,Fs.prototype.InterpolantFactoryMethodSmooth=void 0;var Hs=function(t){function e(){return t.apply(this,arguments)||this}return lt(e,t),e}(zs);Hs.prototype.ValueTypeName="color";var Gs=function(t){function e(){return t.apply(this,arguments)||this}return lt(e,t),e}(zs);function Us(t,e,n,r){Is.call(this,t,e,n,r)}Gs.prototype.ValueTypeName="number",Us.prototype=Object.assign(Object.create(Is.prototype),{constructor:Us,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,c=l+o;l!==c;l+=4)Lt.slerpFlat(i,0,a,l-o,a,l,s);return i}});var ks=function(t){function e(){return t.apply(this,arguments)||this}return lt(e,t),e.prototype.InterpolantFactoryMethodLinear=function(t){return new Us(this.times,this.values,this.getValueSize(),t)},e}(zs);ks.prototype.ValueTypeName="quaternion",ks.prototype.DefaultInterpolation=U,ks.prototype.InterpolantFactoryMethodSmooth=void 0;var Vs=function(t){function e(){return t.apply(this,arguments)||this}return lt(e,t),e}(zs);Vs.prototype.ValueTypeName="string",Vs.prototype.ValueBufferType=Array,Vs.prototype.DefaultInterpolation=G,Vs.prototype.InterpolantFactoryMethodLinear=void 0,Vs.prototype.InterpolantFactoryMethodSmooth=void 0;var Ws=function(t){function e(){return t.apply(this,arguments)||this}return lt(e,t),e}(zs);Ws.prototype.ValueTypeName="vector";var js=function(){function t(t,e,n,r){void 0===e&&(e=-1),void 0===r&&(r=q),this.name=t,this.tracks=n,this.duration=e,this.blendMode=r,this.uuid=gt.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(qs(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(zs.toJSON(n[i]));return r},t.CreateFromMorphTargetSequence=function(t,e,n,r){for(var i=e.length,a=[],o=0;o1){var c=l[1],u=r[c];u||(r[c]=u=[]),u.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=[];Ds.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||[],c=0;c0||0===t.search(/^data\:image\/jpeg/);i.format=r?E:A,i.needsUpdate=!0,void 0!==e&&e(i)}),n,r),i}}),Object.assign(al.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 c=r[i];return(i+(n-c)/(r[i+1]-c))/(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 yt:new Rt);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 Rt,r=[],i=[],a=[],o=new Rt,s=new re,l=0;l<=t;l++){var c=l/t;r[l]=this.getTangentAt(c,new Rt),r[l].normalize()}i[0]=new Rt,a[0]=new Rt;var u=Number.MAX_VALUE,h=Math.abs(r[0].x),d=Math.abs(r[0].y),p=Math.abs(r[0].z);h<=u&&(u=h,n.set(1,0,0)),d<=u&&(u=d,n.set(0,1,0)),p<=u&&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(gt.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(gt.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 ol=function(t){function e(e,n,r,i,a,o,s,l){var c;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),(c=t.call(this)||this).type="EllipseCurve",c.aX=e,c.aY=n,c.xRadius=r,c.yRadius=i,c.aStartAngle=a,c.aEndAngle=o,c.aClockwise=s,c.aRotation=l,c}lt(e,t);var n=e.prototype;return n.getPoint=function(t,e){for(var n=e||new yt,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===c&&l===o-1&&(l=o-2,c=1),this.closed||l>0?n=a[(l-1)%o]:(cl.subVectors(a[0],a[1]).add(a[0]),n=cl);var u=a[l%o],h=a[(l+1)%o];if(this.closed||l+2r.length-2?r.length-1:a+1],u=r[a>r.length-3?r.length-1:a+2];return n.set(fl(o,s.x,l.x,c.x,u.x),fl(o,s.y,l.y,c.y,u.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 c=l.getPoint(0);c.equals(this.currentPoint)||this.lineTo(c.x,c.y)}this.curves.push(l);var u=l.getPoint(1);return this.currentPoint.copy(u),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}(Tl),Al=function(t){function e(e){var n;return(n=t.call(this,e)||this).uuid=gt.generateUUID(),n.type="Shape",n.holes=[],n}lt(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 Ke).setHex(a.value);break;case"v2":r.uniforms[i].value=(new yt).fromArray(a.value);break;case"v3":r.uniforms[i].value=(new Rt).fromArray(a.value);break;case"v4":r.uniforms[i].value=(new Tt).fromArray(a.value);break;case"m3":r.uniforms[i].value=(new _t).fromArray(a.value);break;case"m4":r.uniforms[i].value=(new re).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 yt).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 yt).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}(Js),Zl={decodeText:function(t){if("undefined"!=typeof TextDecoder)return(new TextDecoder).decode(t);for(var e="",n=0,r=t.length;n0){var o=new Ys(e);(n=new el(o)).setCrossOrigin(this.crossOrigin);for(var s=0,l=t.length;sNumber.EPSILON){if(c<0&&(o=e[a],l=-l,s=e[i],c=-c),t.ys.y)continue;if(t.y===o.y){if(t.x===o.x)return!0}else{var u=c*(t.x-o.x)-l*(t.y-o.y);if(0===u)return!0;if(u<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=ns.isClockWise,l=this.subPaths;if(0===l.length)return[];if(!0===e)return n(l);var c=[];if(1===l.length)return a=l[0],(o=new Al).curves=a.curves,c.push(o),c;var u=!s(l[0].getPoints());u=t?!u:u;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,c=e+e;l!==c;++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){Lt.slerpFlat(t,e,t,e,t,n,r)},e._slerpAdditive=function(t,e,n,r,i){var a=this._workIndex*i;Lt.multiplyQuaternionsFlat(t,a,t,e,t,n),Lt.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}(),Pc="\\[\\]\\.:\\/",Dc=new RegExp("[\\[\\]\\.:\\/]","g"),Ic="[^\\[\\]\\.:\\/]",Nc="[^"+Pc.replace("\\.","")+"]",Bc=/((?:WC+[\/:])*)/.source.replace("WC",Ic),Oc=/(WCOD+)?/.source.replace("WCOD",Nc),zc=/(?:\.(WC+)(?:\[(.+)\])?)?/.source.replace("WC",Ic),Fc=/\.(WC+)(?:\[(.+)\])?/.source.replace("WC",Ic),Hc=new RegExp("^"+Bc+Oc+zc+Fc+"$"),Gc=["material","materials","bones"];function Uc(t,e,n){var r=n||kc.parseTrackName(e);this._targetGroup=t,this._bindings=t.subscribe_(e,r)}function kc(t,e,n){this.path=e,this.parsedPath=n||kc.parseTrackName(e),this.node=kc.findNode(t,this.parsedPath.nodeName)||t,this.rootNode=t}Object.assign(Uc.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(kc,{Composite:Uc,create:function(t,e,n){return t&&t.isAnimationObjectGroup?new kc.Composite(t,e,n):new kc(t,e,n)},sanitizeNodeName:function(t){return t.replace(/\s/g,"_").replace(Dc,"")},parseTrackName:function(t){var e=Hc.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!==Gc.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 u=i++,h=t[u];e[h.uuid]=c,t[c]=h,e[l]=u,t[u]=s;for(var d=0,p=r;d!==p;++d){var f=n[d],m=f[u],v=f[c];f[c]=m,f[u]=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],c=l.uuid,u=e[c];if(void 0!==u)if(delete e[c],u0&&(e[b.uuid]=u),t[u]=b,t.pop();for(var w=0,M=r;w!==M;++w){var S=n[w];S[u]=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,c=this.nCachedObjects_,u=new Array(l);r=i.length,n[t]=r,a.push(t),o.push(e),i.push(u);for(var h=c,d=s.length;h!==d;++h){var p=s[h];u[h]=new kc(p,t,e)}return u},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}();Vc.prototype.isAnimationObjectGroup=!0;var Wc=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:V,endingEnd:V},l=0;l!==a;++l){var c=i[l].createInterpolant(null);o[l]=c,c.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,c=this._propertyBindings;switch(this.blendMode){case X:for(var u=0,h=l.length;u!==h;++u)l[u].evaluate(o),c[u].accumulateAdditive(s);break;case q:default:for(var d=0,p=l.length;d!==p;++d)l[d].evaluate(o),c[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=W,r.endingEnd=W):(r.endingStart=t?this.zeroSlopeAtStart?W:V:j,r.endingEnd=e?this.zeroSlopeAtEnd?W:V:j)},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}(),jc=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}lt(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,c=l[s];void 0===c&&(c={},l[s]=c);for(var u=0;u!==i;++u){var h=r[u],d=h.name,p=c[d];if(void 0!==p)a[u]=p;else{if(void 0!==(p=a[u])){null===p._cacheIndex&&(++p.referenceCount,this._addInactiveBinding(p,s,d));continue}var f=e&&e._propertyBindings[u].binding.parsedPath;++(p=new Cc(kc.create(n,d,f),h.ValueTypeName,h.getValueSize())).referenceCount,this._addInactiveBinding(p,s,d),a[u]=p}o[u].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,c=0;c!==l;++c)s[c].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 yt),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 yt),e.copy(t).clamp(this.min,this.max)},e.distanceToPoint=function(t){return tu.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}();eu.prototype.isBox2=!0;var nu=new Rt,ru=new Rt,iu=function(){function t(t,e){void 0===t&&(t=new Rt),void 0===e&&(e=new Rt),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 Rt),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 Rt),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 Rt),this.delta(e).multiplyScalar(t).add(this.start)},e.closestPointToPointParameter=function(t,e){nu.subVectors(t,this.start),ru.subVectors(this.end,this.start);var n=ru.dot(ru),r=ru.dot(nu)/n;return e&&(r=gt.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 Rt),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 au(t){Le.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}au.prototype=Object.create(Le.prototype),au.prototype.constructor=au,au.prototype.isImmediateRenderObject=!0;var ou=new Rt,su=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 Sn,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,c=s/32*Math.PI*2;a.push(Math.cos(l),Math.sin(l),1,Math.cos(c),Math.sin(c),1)}i.setAttribute("position",new dn(a,3));var u=new Ka({fog:!1,toneMapped:!1});return r.cone=new so(i,u),r.add(r.cone),r.update(),r}lt(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),ou.setFromMatrixPosition(this.light.target.matrixWorld),this.cone.lookAt(ou),void 0!==this.color?this.cone.material.color.set(this.color):this.cone.material.color.copy(this.light.color)},e}(Le),lu=new Rt,cu=new re,uu=new re,hu=function(t){function e(e){for(var n,r=du(e),i=new Sn,a=[],o=[],s=new Ke(0,0,1),l=new Ke(0,1,0),c=0;c.99999)this.quaternion.set(0,0,0,1);else if(t.y<-.99999)this.quaternion.set(1,0,0,0);else{Bu.set(t.z,0,-t.x).normalize();var e=Math.acos(t.y);this.quaternion.setFromAxisAngle(Bu,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}(Le),zu=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 Sn;i.setAttribute("position",new dn(r,3)),i.setAttribute("color",new dn([1,0,0,1,.6,0,0,1,0,.6,1,0,0,0,1,0,.6,1],3));var a=new Ka({vertexColors:!0,toneMapped:!1});return(n=t.call(this,i,a)||this).type="AxesHelper",n}return lt(e,t),e}(so),Fu=new Float32Array(1),Hu=new Int32Array(Fu.buffer),Gu={toHalfFloat:function(t){Fu[0]=t;var e=Hu[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)}},Uu=Math.pow(2,8),ku=[.125,.215,.35,.446,.526,.582],Vu=5+ku.length,Wu=20,ju=((Cu={})[3e3]=0,Cu[3001]=1,Cu[3002]=2,Cu[3004]=3,Cu[3005]=4,Cu[3006]=5,Cu[3007]=6,Cu),qu=new $e({side:1,depthWrite:!1,depthTest:!1}),Xu=new kn(new Wn,qu),Yu=new Ul,Zu=sh(),Ju=Zu._lodPlanes,Qu=Zu._sizeLods,Ku=Zu._sigmas,$u=new Ke,th=null,eh=(1+Math.sqrt(5))/2,nh=1/eh,rh=[new Rt(1,1,1),new Rt(-1,1,1),new Rt(1,1,-1),new Rt(-1,1,-1),new Rt(0,eh,nh),new Rt(0,eh,-nh),new Rt(nh,0,eh),new Rt(-nh,0,eh),new Rt(eh,nh,0),new Rt(-eh,nh,0)];function ih(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 ah=function(){function t(t){var e,n,r;this._renderer=t,this._pingPongRenderTarget=null,this._blurMaterial=(e=Wu,n=new Float32Array(e),r=new Rt(0,1,0),new ws({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:ju[3e3]},outputEncoding:{value:ju[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),th=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=hh(),this._compileMaterial(this._cubemapShader))},e.compileEquirectangularShader=function(){null===this._equirectShader&&(this._equirectShader=uh(),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;t2?Uu:0,Uu,Uu),s.setRenderTarget(r),h&&s.render(Xu,i),s.render(t,i)}s.toneMapping=u,s.outputEncoding=c,s.autoClear=l},e._textureToCubeUV=function(t,e){var n=this._renderer;t.isCubeTexture?null==this._cubemapShader&&(this._cubemapShader=hh()):null==this._equirectShader&&(this._equirectShader=uh());var r=t.isCubeTexture?this._cubemapShader:this._equirectShader,i=new kn(Ju[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=ju[t.encoding],a.outputEncoding.value=ju[e.texture.encoding],ch(e,0,0,3*Uu,2*Uu),n.setRenderTarget(e),n.render(i,Yu)},e._applyPMREM=function(t){var e=this._renderer,n=e.autoClear;e.autoClear=!1;for(var r=1;rWu&&console.warn("sigmaRadians, "+i+", is too large and will clip, as it requested "+f+" samples when the maximum is set to "+Wu);for(var m=[],v=0,g=0;g4?r-8+4:0),3*b,2*b),s.setRenderTarget(e),s.render(c,Yu)},t}();function oh(t){return void 0!==t&&t.type===_&&(t.encoding===Y||t.encoding===Z||t.encoding===J)}function sh(){for(var t=[],e=[],n=[],r=8,i=0;i4?o=ku[i-8+4-1]:0==i&&(o=0),n.push(o);for(var s=1/(a-1),l=-s/2,c=1+s/2,u=[l,l,c,l,c,c,l,l,c,c,l,c],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(u,12*f);var y=[f,f,f,f,f,f];p.set(y,6*f)}var x=new Sn;x.setAttribute("position",new nn(h,3)),x.setAttribute("uv",new nn(d,2)),x.setAttribute("faceIndex",new nn(p,1)),t.push(x),r>4&&r--}return{_lodPlanes:t,_sizeLods:e,_sigmas:n}}function lh(t){var e=new Et(3*Uu,3*Uu,t);return e.texture.mapping=c,e.texture.name="PMREM.cubeUv",e.scissorTest=!0,e}function ch(t,e,n,r,i){t.viewport.set(e,n,r,i),t.scissor.set(e,n,r,i)}function uh(){var t=new yt(1,1);return new ws({name:"EquirectangularToCubeUV",uniforms:{envMap:{value:null},texelSize:{value:t},inputEncoding:{value:ju[3e3]},outputEncoding:{value:ju[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 hh(){return new ws({name:"CubemapToCubeUV",uniforms:{envMap:{value:null},inputEncoding:{value:ju[3e3]},outputEncoding:{value:ju[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})}al.create=function(t,e){return console.log("THREE.Curve.create() has been deprecated"),t.prototype=Object.create(al.prototype),t.prototype.constructor=t,t.prototype.getPoint=e,t},El.prototype.fromPoints=function(t){return console.warn("THREE.Path: .fromPoints() has been renamed to .setFromPoints()."),this.setFromPoints(t)},yu.prototype.setColors=function(){console.error("THREE.GridHelper: setColors() has been deprecated, pass them in the constructor instead.")},hu.prototype.update=function(){console.error("THREE.SkeletonHelper: update() no longer needs to be called.")},Js.prototype.extractUrlBase=function(t){return console.warn("THREE.Loader: .extractUrlBase() has been deprecated. Use THREE.LoaderUtils.extractUrlBase() instead."),Zl.extractUrlBase(t)},Js.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.")}},eu.prototype.center=function(t){return console.warn("THREE.Box2: .center() has been renamed to .getCenter()."),this.getCenter(t)},eu.prototype.empty=function(){return console.warn("THREE.Box2: .empty() has been renamed to .isEmpty()."),this.isEmpty()},eu.prototype.isIntersectionBox=function(t){return console.warn("THREE.Box2: .isIntersectionBox() has been renamed to .intersectsBox()."),this.intersectsBox(t)},eu.prototype.size=function(t){return console.warn("THREE.Box2: .size() has been renamed to .getSize()."),this.getSize(t)},Dt.prototype.center=function(t){return console.warn("THREE.Box3: .center() has been renamed to .getCenter()."),this.getCenter(t)},Dt.prototype.empty=function(){return console.warn("THREE.Box3: .empty() has been renamed to .isEmpty()."),this.isEmpty()},Dt.prototype.isIntersectionBox=function(t){return console.warn("THREE.Box3: .isIntersectionBox() has been renamed to .intersectsBox()."),this.intersectsBox(t)},Dt.prototype.isIntersectionSphere=function(t){return console.warn("THREE.Box3: .isIntersectionSphere() has been renamed to .intersectsSphere()."),this.intersectsSphere(t)},Dt.prototype.size=function(t){return console.warn("THREE.Box3: .size() has been renamed to .getSize()."),this.getSize(t)},Yt.prototype.empty=function(){return console.warn("THREE.Sphere: .empty() has been renamed to .isEmpty()."),this.isEmpty()},ir.prototype.setFromMatrix=function(t){return console.warn("THREE.Frustum: .setFromMatrix() has been renamed to .setFromProjectionMatrix()."),this.setFromProjectionMatrix(t)},iu.prototype.center=function(t){return console.warn("THREE.Line3: .center() has been renamed to .getCenter()."),this.getCenter(t)},gt.random16=function(){return console.warn("THREE.Math: .random16() has been deprecated. Use Math.random() instead."),Math.random()},gt.nearestPowerOfTwo=function(t){return console.warn("THREE.Math: .nearestPowerOfTwo() has been renamed to .floorPowerOfTwo()."),gt.floorPowerOfTwo(t)},gt.nextPowerOfTwo=function(t){return console.warn("THREE.Math: .nextPowerOfTwo() has been renamed to .ceilPowerOfTwo()."),gt.ceilPowerOfTwo(t)},_t.prototype.flattenToArrayOffset=function(t,e){return console.warn("THREE.Matrix3: .flattenToArrayOffset() has been deprecated. Use .toArray() instead."),this.toArray(t,e)},_t.prototype.multiplyVector3=function(t){return console.warn("THREE.Matrix3: .multiplyVector3() has been removed. Use vector.applyMatrix3( matrix ) instead."),t.applyMatrix3(this)},_t.prototype.multiplyVector3Array=function(){console.error("THREE.Matrix3: .multiplyVector3Array() has been removed.")},_t.prototype.applyToBufferAttribute=function(t){return console.warn("THREE.Matrix3: .applyToBufferAttribute() has been removed. Use attribute.applyMatrix3( matrix ) instead."),t.applyMatrix3(this)},_t.prototype.applyToVector3Array=function(){console.error("THREE.Matrix3: .applyToVector3Array() has been removed.")},_t.prototype.getInverse=function(t){return console.warn("THREE.Matrix3: .getInverse() has been removed. Use matrixInv.copy( matrix ).invert(); instead."),this.copy(t).invert()},re.prototype.extractPosition=function(t){return console.warn("THREE.Matrix4: .extractPosition() has been renamed to .copyPosition()."),this.copyPosition(t)},re.prototype.flattenToArrayOffset=function(t,e){return console.warn("THREE.Matrix4: .flattenToArrayOffset() has been deprecated. Use .toArray() instead."),this.toArray(t,e)},re.prototype.getPosition=function(){return console.warn("THREE.Matrix4: .getPosition() has been removed. Use Vector3.setFromMatrixPosition( matrix ) instead."),(new Rt).setFromMatrixColumn(this,3)},re.prototype.setRotationFromQuaternion=function(t){return console.warn("THREE.Matrix4: .setRotationFromQuaternion() has been renamed to .makeRotationFromQuaternion()."),this.makeRotationFromQuaternion(t)},re.prototype.multiplyToArray=function(){console.warn("THREE.Matrix4: .multiplyToArray() has been removed.")},re.prototype.multiplyVector3=function(t){return console.warn("THREE.Matrix4: .multiplyVector3() has been removed. Use vector.applyMatrix4( matrix ) instead."),t.applyMatrix4(this)},re.prototype.multiplyVector4=function(t){return console.warn("THREE.Matrix4: .multiplyVector4() has been removed. Use vector.applyMatrix4( matrix ) instead."),t.applyMatrix4(this)},re.prototype.multiplyVector3Array=function(){console.error("THREE.Matrix4: .multiplyVector3Array() has been removed.")},re.prototype.rotateAxis=function(t){console.warn("THREE.Matrix4: .rotateAxis() has been removed. Use Vector3.transformDirection( matrix ) instead."),t.transformDirection(this)},re.prototype.crossVector=function(t){return console.warn("THREE.Matrix4: .crossVector() has been removed. Use vector.applyMatrix4( matrix ) instead."),t.applyMatrix4(this)},re.prototype.translate=function(){console.error("THREE.Matrix4: .translate() has been removed.")},re.prototype.rotateX=function(){console.error("THREE.Matrix4: .rotateX() has been removed.")},re.prototype.rotateY=function(){console.error("THREE.Matrix4: .rotateY() has been removed.")},re.prototype.rotateZ=function(){console.error("THREE.Matrix4: .rotateZ() has been removed.")},re.prototype.rotateByAxis=function(){console.error("THREE.Matrix4: .rotateByAxis() has been removed.")},re.prototype.applyToBufferAttribute=function(t){return console.warn("THREE.Matrix4: .applyToBufferAttribute() has been removed. Use attribute.applyMatrix4( matrix ) instead."),t.applyMatrix4(this)},re.prototype.applyToVector3Array=function(){console.error("THREE.Matrix4: .applyToVector3Array() has been removed.")},re.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)},re.prototype.getInverse=function(t){return console.warn("THREE.Matrix4: .getInverse() has been removed. Use matrixInv.copy( matrix ).invert(); instead."),this.copy(t).invert()},De.prototype.isIntersectionLine=function(t){return console.warn("THREE.Plane: .isIntersectionLine() has been renamed to .intersectsLine()."),this.intersectsLine(t)},Lt.prototype.multiplyVector3=function(t){return console.warn("THREE.Quaternion: .multiplyVector3() has been removed. Use is now vector.applyQuaternion( quaternion ) instead."),t.applyQuaternion(this)},Lt.prototype.inverse=function(){return console.warn("THREE.Quaternion: .inverse() has been renamed to invert()."),this.invert()},ne.prototype.isIntersectionBox=function(t){return console.warn("THREE.Ray: .isIntersectionBox() has been renamed to .intersectsBox()."),this.intersectsBox(t)},ne.prototype.isIntersectionPlane=function(t){return console.warn("THREE.Ray: .isIntersectionPlane() has been renamed to .intersectsPlane()."),this.intersectsPlane(t)},ne.prototype.isIntersectionSphere=function(t){return console.warn("THREE.Ray: .isIntersectionSphere() has been renamed to .intersectsSphere()."),this.intersectsSphere(t)},Ve.prototype.area=function(){return console.warn("THREE.Triangle: .area() has been renamed to .getArea()."),this.getArea()},Ve.prototype.barycoordFromPoint=function(t,e){return console.warn("THREE.Triangle: .barycoordFromPoint() has been renamed to .getBarycoord()."),this.getBarycoord(t,e)},Ve.prototype.midpoint=function(t){return console.warn("THREE.Triangle: .midpoint() has been renamed to .getMidpoint()."),this.getMidpoint(t)},Ve.prototypenormal=function(t){return console.warn("THREE.Triangle: .normal() has been renamed to .getNormal()."),this.getNormal(t)},Ve.prototype.plane=function(t){return console.warn("THREE.Triangle: .plane() has been renamed to .getPlane()."),this.getPlane(t)},Ve.barycoordFromPoint=function(t,e,n,r,i){return console.warn("THREE.Triangle: .barycoordFromPoint() has been renamed to .getBarycoord()."),Ve.getBarycoord(t,e,n,r,i)},Ve.normal=function(t,e,n,r){return console.warn("THREE.Triangle: .normal() has been renamed to .getNormal()."),Ve.getNormal(t,e,n,r)},Al.prototype.extractAllPoints=function(t){return console.warn("THREE.Shape: .extractAllPoints() has been removed. Use .extractPoints() instead."),this.extractPoints(t)},Al.prototype.extrude=function(t){return console.warn("THREE.Shape: .extrude() has been removed. Use ExtrudeGeometry() instead."),new as(this,t)},Al.prototype.makeGeometry=function(t){return console.warn("THREE.Shape: .makeGeometry() has been removed. Use ShapeGeometry() instead."),new ds(this,t)},yt.prototype.fromAttribute=function(t,e,n){return console.warn("THREE.Vector2: .fromAttribute() has been renamed to .fromBufferAttribute()."),this.fromBufferAttribute(t,e,n)},yt.prototype.distanceToManhattan=function(t){return console.warn("THREE.Vector2: .distanceToManhattan() has been renamed to .manhattanDistanceTo()."),this.manhattanDistanceTo(t)},yt.prototype.lengthManhattan=function(){return console.warn("THREE.Vector2: .lengthManhattan() has been renamed to .manhattanLength()."),this.manhattanLength()},Rt.prototype.setEulerFromRotationMatrix=function(){console.error("THREE.Vector3: .setEulerFromRotationMatrix() has been removed. Use Euler.setFromRotationMatrix() instead.")},Rt.prototype.setEulerFromQuaternion=function(){console.error("THREE.Vector3: .setEulerFromQuaternion() has been removed. Use Euler.setFromQuaternion() instead.")},Rt.prototype.getPositionFromMatrix=function(t){return console.warn("THREE.Vector3: .getPositionFromMatrix() has been renamed to .setFromMatrixPosition()."),this.setFromMatrixPosition(t)},Rt.prototype.getScaleFromMatrix=function(t){return console.warn("THREE.Vector3: .getScaleFromMatrix() has been renamed to .setFromMatrixScale()."),this.setFromMatrixScale(t)},Rt.prototype.getColumnFromMatrix=function(t,e){return console.warn("THREE.Vector3: .getColumnFromMatrix() has been renamed to .setFromMatrixColumn()."),this.setFromMatrixColumn(e,t)},Rt.prototype.applyProjection=function(t){return console.warn("THREE.Vector3: .applyProjection() has been removed. Use .applyMatrix4( m ) instead."),this.applyMatrix4(t)},Rt.prototype.fromAttribute=function(t,e,n){return console.warn("THREE.Vector3: .fromAttribute() has been renamed to .fromBufferAttribute()."),this.fromBufferAttribute(t,e,n)},Rt.prototype.distanceToManhattan=function(t){return console.warn("THREE.Vector3: .distanceToManhattan() has been renamed to .manhattanDistanceTo()."),this.manhattanDistanceTo(t)},Rt.prototype.lengthManhattan=function(){return console.warn("THREE.Vector3: .lengthManhattan() has been renamed to .manhattanLength()."),this.manhattanLength()},Tt.prototype.fromAttribute=function(t,e,n){return console.warn("THREE.Vector4: .fromAttribute() has been renamed to .fromBufferAttribute()."),this.fromBufferAttribute(t,e,n)},Tt.prototype.lengthManhattan=function(){return console.warn("THREE.Vector4: .lengthManhattan() has been renamed to .manhattanLength()."),this.manhattanLength()},Le.prototype.getChildByName=function(t){return console.warn("THREE.Object3D: .getChildByName() has been renamed to .getObjectByName()."),this.getObjectByName(t)},Le.prototype.renderDepth=function(){console.warn("THREE.Object3D: .renderDepth has been removed. Use .renderOrder, instead.")},Le.prototype.translate=function(t,e){return console.warn("THREE.Object3D: .translate() has been removed. Use .translateOnAxis( axis, distance ) instead."),this.translateOnAxis(e,t)},Le.prototype.getWorldRotation=function(){console.error("THREE.Object3D: .getWorldRotation() has been removed. Use THREE.Object3D.getWorldQuaternion( target ) instead.")},Le.prototype.applyMatrix=function(t){return console.warn("THREE.Object3D: .applyMatrix() has been renamed to .applyMatrix4()."),this.applyMatrix4(t)},Object.defineProperties(Le.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.")}}}),kn.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(kn.prototype,{drawMode:{get:function(){return console.error("THREE.Mesh: .drawMode has been removed. The renderer now always assumes THREE.TrianglesDrawMode."),0},set:function(){console.error("THREE.Mesh: .drawMode has been removed. The renderer now always assumes THREE.TrianglesDrawMode. Transform your geometry via BufferGeometryUtils.toTrianglesDrawMode() if necessary.")}}}),Object.defineProperties(Oa.prototype,{objects:{get:function(){return console.warn("THREE.LOD: .objects has been renamed to .levels."),this.levels}}}),Object.defineProperty(qa.prototype,"useVertexTexture",{get:function(){console.warn("THREE.Skeleton: useVertexTexture has been removed.")},set:function(){console.warn("THREE.Skeleton: useVertexTexture has been removed.")}}),ka.prototype.initBones=function(){console.error("THREE.SkinnedMesh: initBones() has been removed.")},Object.defineProperty(al.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}}),Jn.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(Ll.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(nn.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===rt},set:function(){console.warn("THREE.BufferAttribute: .dynamic has been deprecated. Use .usage instead."),this.setUsage(rt)}}}),nn.prototype.setDynamic=function(t){return console.warn("THREE.BufferAttribute: .setDynamic() has been deprecated. Use .setUsage() instead."),this.setUsage(!0===t?rt:nt),this},nn.prototype.copyIndicesArray=function(){console.error("THREE.BufferAttribute: .copyIndicesArray() has been removed.")},nn.prototype.setArray=function(){console.error("THREE.BufferAttribute: .setArray has been removed. Use BufferGeometry .setAttribute to replace/resize attribute buffers")},Sn.prototype.addIndex=function(t){console.warn("THREE.BufferGeometry: .addIndex() has been renamed to .setIndex()."),this.setIndex(t)},Sn.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 nn(arguments[1],arguments[2])))},Sn.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)},Sn.prototype.clearDrawCalls=function(){console.warn("THREE.BufferGeometry: .clearDrawCalls() is now .clearGroups()."),this.clearGroups()},Sn.prototype.computeOffsets=function(){console.warn("THREE.BufferGeometry: .computeOffsets() has been removed.")},Sn.prototype.removeAttribute=function(t){return console.warn("THREE.BufferGeometry: .removeAttribute() has been renamed to .deleteAttribute()."),this.deleteAttribute(t)},Sn.prototype.applyMatrix=function(t){return console.warn("THREE.BufferGeometry: .applyMatrix() has been renamed to .applyMatrix4()."),this.applyMatrix4(t)},Object.defineProperties(Sn.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(Jl.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(Zc.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(ma.prototype,{dynamic:{get:function(){return console.warn("THREE.InterleavedBuffer: .length has been deprecated. Use .usage instead."),this.usage===rt},set:function(t){console.warn("THREE.InterleavedBuffer: .length has been deprecated. Use .usage instead."),this.setUsage(t)}}}),ma.prototype.setDynamic=function(t){return console.warn("THREE.InterleavedBuffer: .setDynamic() has been deprecated. Use .setUsage() instead."),this.setUsage(!0===t?rt:nt),this},ma.prototype.setArray=function(){console.error("THREE.InterleavedBuffer: .setArray has been removed. Use BufferGeometry .setAttribute to replace/resize attribute buffers")},as.prototype.getArrays=function(){console.error("THREE.ExtrudeGeometry: .getArrays() has been removed.")},as.prototype.addShapeList=function(){console.error("THREE.ExtrudeGeometry: .addShapeList() has been removed.")},as.prototype.addShape=function(){console.error("THREE.ExtrudeGeometry: .addShape() has been removed.")},fa.prototype.dispose=function(){console.error("THREE.Scene: .dispose() has been removed.")},Object.defineProperties(qc.prototype,{dynamic:{set:function(){console.warn("THREE.Uniform: .dynamic has been removed. Use object.onBeforeRender() instead.")}},onUpdate:{value:function(){return console.warn("THREE.Uniform: .onUpdate() has been removed. Use object.onBeforeRender() instead."),this}}}),Object.defineProperties(je.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(Ts.prototype,{metal:{get:function(){return console.warn("THREE.MeshPhongMaterial: .metal has been removed. Use THREE.MeshStandardMaterial instead."),!1},set:function(){console.warn("THREE.MeshPhongMaterial: .metal has been removed. Use THREE.MeshStandardMaterial instead")}}}),Object.defineProperties(Ss.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(Yn.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}}}),ua.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)},ua.prototype.animate=function(t){console.warn("THREE.WebGLRenderer: .animate() is now .setAnimationLoop()."),this.setAnimationLoop(t)},ua.prototype.getCurrentRenderTarget=function(){return console.warn("THREE.WebGLRenderer: .getCurrentRenderTarget() is now .getRenderTarget()."),this.getRenderTarget()},ua.prototype.getMaxAnisotropy=function(){return console.warn("THREE.WebGLRenderer: .getMaxAnisotropy() is now .capabilities.getMaxAnisotropy()."),this.capabilities.getMaxAnisotropy()},ua.prototype.getPrecision=function(){return console.warn("THREE.WebGLRenderer: .getPrecision() is now .capabilities.precision."),this.capabilities.precision},ua.prototype.resetGLState=function(){return console.warn("THREE.WebGLRenderer: .resetGLState() is now .state.reset()."),this.state.reset()},ua.prototype.supportsFloatTextures=function(){return console.warn("THREE.WebGLRenderer: .supportsFloatTextures() is now .extensions.get( 'OES_texture_float' )."),this.extensions.get("OES_texture_float")},ua.prototype.supportsHalfFloatTextures=function(){return console.warn("THREE.WebGLRenderer: .supportsHalfFloatTextures() is now .extensions.get( 'OES_texture_half_float' )."),this.extensions.get("OES_texture_half_float")},ua.prototype.supportsStandardDerivatives=function(){return console.warn("THREE.WebGLRenderer: .supportsStandardDerivatives() is now .extensions.get( 'OES_standard_derivatives' )."),this.extensions.get("OES_standard_derivatives")},ua.prototype.supportsCompressedTextureS3TC=function(){return console.warn("THREE.WebGLRenderer: .supportsCompressedTextureS3TC() is now .extensions.get( 'WEBGL_compressed_texture_s3tc' )."),this.extensions.get("WEBGL_compressed_texture_s3tc")},ua.prototype.supportsCompressedTexturePVRTC=function(){return console.warn("THREE.WebGLRenderer: .supportsCompressedTexturePVRTC() is now .extensions.get( 'WEBGL_compressed_texture_pvrtc' )."),this.extensions.get("WEBGL_compressed_texture_pvrtc")},ua.prototype.supportsBlendMinMax=function(){return console.warn("THREE.WebGLRenderer: .supportsBlendMinMax() is now .extensions.get( 'EXT_blend_minmax' )."),this.extensions.get("EXT_blend_minmax")},ua.prototype.supportsVertexTextures=function(){return console.warn("THREE.WebGLRenderer: .supportsVertexTextures() is now .capabilities.vertexTextures."),this.capabilities.vertexTextures},ua.prototype.supportsInstancedArrays=function(){return console.warn("THREE.WebGLRenderer: .supportsInstancedArrays() is now .extensions.get( 'ANGLE_instanced_arrays' )."),this.extensions.get("ANGLE_instanced_arrays")},ua.prototype.enableScissorTest=function(t){console.warn("THREE.WebGLRenderer: .enableScissorTest() is now .setScissorTest()."),this.setScissorTest(t)},ua.prototype.initMaterial=function(){console.warn("THREE.WebGLRenderer: .initMaterial() has been removed.")},ua.prototype.addPrePlugin=function(){console.warn("THREE.WebGLRenderer: .addPrePlugin() has been removed.")},ua.prototype.addPostPlugin=function(){console.warn("THREE.WebGLRenderer: .addPostPlugin() has been removed.")},ua.prototype.updateShadowMap=function(){console.warn("THREE.WebGLRenderer: .updateShadowMap() has been removed.")},ua.prototype.setFaceCulling=function(){console.warn("THREE.WebGLRenderer: .setFaceCulling() has been removed.")},ua.prototype.allocTextureUnit=function(){console.warn("THREE.WebGLRenderer: .allocTextureUnit() has been removed.")},ua.prototype.setTexture=function(){console.warn("THREE.WebGLRenderer: .setTexture() has been removed.")},ua.prototype.setTexture2D=function(){console.warn("THREE.WebGLRenderer: .setTexture2D() has been removed.")},ua.prototype.setTextureCube=function(){console.warn("THREE.WebGLRenderer: .setTextureCube() has been removed.")},ua.prototype.getActiveMipMapLevel=function(){return console.warn("THREE.WebGLRenderer: .getActiveMipMapLevel() is now .getActiveMipmapLevel()."),this.getActiveMipmapLevel()},Object.defineProperties(ua.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?Z:Y}},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(ea.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(Et.prototype,{wrapS:{get:function(){return console.warn("THREE.WebGLRenderTarget: .wrapS is now .texture.wrapS."),this.texture.wrapS},set:function(t){console.warn("THREE.WebGLRenderTarget: .wrapS is now .texture.wrapS."),this.texture.wrapS=t}},wrapT:{get:function(){return console.warn("THREE.WebGLRenderTarget: .wrapT is now .texture.wrapT."),this.texture.wrapT},set:function(t){console.warn("THREE.WebGLRenderTarget: .wrapT is now .texture.wrapT."),this.texture.wrapT=t}},magFilter:{get:function(){return console.warn("THREE.WebGLRenderTarget: .magFilter is now .texture.magFilter."),this.texture.magFilter},set:function(t){console.warn("THREE.WebGLRenderTarget: .magFilter is now .texture.magFilter."),this.texture.magFilter=t}},minFilter:{get:function(){return console.warn("THREE.WebGLRenderTarget: .minFilter is now .texture.minFilter."),this.texture.minFilter},set:function(t){console.warn("THREE.WebGLRenderTarget: .minFilter is now .texture.minFilter."),this.texture.minFilter=t}},anisotropy:{get:function(){return console.warn("THREE.WebGLRenderTarget: .anisotropy is now .texture.anisotropy."),this.texture.anisotropy},set:function(t){console.warn("THREE.WebGLRenderTarget: .anisotropy is now .texture.anisotropy."),this.texture.anisotropy=t}},offset:{get:function(){return console.warn("THREE.WebGLRenderTarget: .offset is now .texture.offset."),this.texture.offset},set:function(t){console.warn("THREE.WebGLRenderTarget: .offset is now .texture.offset."),this.texture.offset=t}},repeat:{get:function(){return console.warn("THREE.WebGLRenderTarget: .repeat is now .texture.repeat."),this.texture.repeat},set:function(t){console.warn("THREE.WebGLRenderTarget: .repeat is now .texture.repeat."),this.texture.repeat=t}},format:{get:function(){return console.warn("THREE.WebGLRenderTarget: .format is now .texture.format."),this.texture.format},set:function(t){console.warn("THREE.WebGLRenderTarget: .format is now .texture.format."),this.texture.format=t}},type:{get:function(){return console.warn("THREE.WebGLRenderTarget: .type is now .texture.type."),this.texture.type},set:function(t){console.warn("THREE.WebGLRenderTarget: .type is now .texture.type."),this.texture.type=t}},generateMipmaps:{get:function(){return console.warn("THREE.WebGLRenderTarget: .generateMipmaps is now .texture.generateMipmaps."),this.texture.generateMipmaps},set:function(t){console.warn("THREE.WebGLRenderTarget: .generateMipmaps is now .texture.generateMipmaps."),this.texture.generateMipmaps=t}}}),Object.defineProperties(Mc.prototype,{load:{value:function(t){console.warn("THREE.Audio: .load has been deprecated. Use THREE.AudioLoader instead.");var e=this;return(new uc).load(t,(function(t){e.setBuffer(t)})),this}},startTime:{set:function(){console.warn("THREE.Audio: .startTime is now .play( delay ).")}}}),Rc.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,r){return console.warn("THREE.CubeCamera: .clear() is now .renderTarget.clear()."),this.renderTarget.clear(t,e,n,r)},bt.crossOrigin=void 0,bt.loadTexture=function(t,e,n,r){console.warn("THREE.ImageUtils.loadTexture has been deprecated. Use THREE.TextureLoader() instead.");var i=new il;i.setCrossOrigin(this.crossOrigin);var a=i.load(t,n,void 0,r);return e&&(a.mapping=e),a},bt.loadTextureCube=function(t,e,n,r){console.warn("THREE.ImageUtils.loadTextureCube has been deprecated. Use THREE.CubeTextureLoader() instead.");var i=new nl;i.setCrossOrigin(this.crossOrigin);var a=i.load(t,n,void 0,r);return e&&(a.mapping=e),a},bt.loadCompressedTexture=function(){console.error("THREE.ImageUtils.loadCompressedTexture has been removed. Use THREE.DDSLoader instead.")},bt.loadCompressedTextureCube=function(){console.error("THREE.ImageUtils.loadCompressedTextureCube has been removed. Use THREE.DDSLoader instead.")};var dh={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:n}})),"undefined"!=typeof window&&(window.__THREE__?console.warn("WARNING: Multiple instances of Three.js being imported."):window.__THREE__=n),t.ACESFilmicToneMapping=4,t.AddEquation=r,t.AddOperation=2,t.AdditiveAnimationBlendMode=X,t.AdditiveBlending=2,t.AlphaFormat=1021,t.AlwaysDepth=1,t.AlwaysStencilFunc=519,t.AmbientLight=Wl,t.AmbientLightProbe=dc,t.AnimationClip=js,t.AnimationLoader=$s,t.AnimationMixer=jc,t.AnimationObjectGroup=Vc,t.AnimationUtils=Ds,t.ArcCurve=sl,t.ArrayCamera=aa,t.ArrowHelper=Ou,t.Audio=Mc,t.AudioAnalyser=Rc,t.AudioContext=cc,t.AudioListener=wc,t.AudioLoader=uc,t.AxesHelper=zu,t.AxisHelper=function(t){return console.warn("THREE.AxisHelper has been renamed to THREE.AxesHelper."),new zu(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 rl(t)},t.Bone=Va,t.BooleanKeyframeTrack=Fs,t.BoundingBoxHelper=function(t,e){return console.warn("THREE.BoundingBoxHelper has been deprecated. Creating a THREE.BoxHelper instead."),new Du(t,e)},t.Box2=eu,t.Box3=Dt,t.Box3Helper=Iu,t.BoxBufferGeometry=Wn,t.BoxGeometry=Wn,t.BoxHelper=Du,t.BufferAttribute=nn,t.BufferGeometry=Sn,t.BufferGeometryLoader=Kl,t.ByteType=1010,t.Cache=Xs,t.Camera=Zn,t.CameraHelper=Eu,t.CanvasRenderer=function(){console.error("THREE.CanvasRenderer has been removed")},t.CanvasTexture=xo,t.CatmullRomCurve3=pl,t.CineonToneMapping=3,t.CircleBufferGeometry=bo,t.CircleGeometry=bo,t.ClampToEdgeWrapping=d,t.Clock=vc,t.Color=Ke,t.ColorKeyframeTrack=Hs,t.CompressedTexture=yo,t.CompressedTextureLoader=tl,t.ConeBufferGeometry=Mo,t.ConeGeometry=Mo,t.CubeCamera=Kn,t.CubeReflectionMapping=a,t.CubeRefractionMapping=o,t.CubeTexture=$n,t.CubeTextureLoader=nl,t.CubeUVReflectionMapping=c,t.CubeUVRefractionMapping=u,t.CubicBezierCurve=gl,t.CubicBezierCurve3=yl,t.CubicInterpolant=Ns,t.CullFaceBack=1,t.CullFaceFront=2,t.CullFaceFrontBack=3,t.CullFaceNone=0,t.Curve=al,t.CurvePath=Tl,t.CustomBlending=5,t.CustomToneMapping=5,t.CylinderBufferGeometry=wo,t.CylinderGeometry=wo,t.Cylindrical=$c,t.DataTexture=er,t.DataTexture2DArray=Tr,t.DataTexture3D=Er,t.DataTextureLoader=rl,t.DataUtils=Gu,t.DecrementStencilOp=7683,t.DecrementWrapStencilOp=34056,t.DefaultLoadingManager=Zs,t.DepthFormat=L,t.DepthStencilFormat=R,t.DepthTexture=_o,t.DirectionalLight=Vl,t.DirectionalLightHelper=Mu,t.DiscreteInterpolant=Os,t.DodecahedronBufferGeometry=To,t.DodecahedronGeometry=To,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 nn(t,e).setUsage(rt)},t.DynamicCopyUsage=35050,t.DynamicDrawUsage=rt,t.DynamicReadUsage=35049,t.EdgesGeometry=Co,t.EdgesHelper=function(t,e){return console.warn("THREE.EdgesHelper has been removed. Use THREE.EdgesGeometry instead."),new so(new Co(t.geometry),new Ka({color:void 0!==e?e:16777215}))},t.EllipseCurve=ol,t.EqualDepth=4,t.EqualStencilFunc=514,t.EquirectangularReflectionMapping=s,t.EquirectangularRefractionMapping=l,t.Euler=pe,t.EventDispatcher=pt,t.ExtrudeBufferGeometry=as,t.ExtrudeGeometry=as,t.FaceColors=1,t.FileLoader=Ks,t.FlatShading=1,t.Float16BufferAttribute=hn,t.Float32Attribute=function(t,e){return console.warn("THREE.Float32Attribute has been removed. Use new THREE.Float32BufferAttribute() instead."),new dn(t,e)},t.Float32BufferAttribute=dn,t.Float64Attribute=function(t,e){return console.warn("THREE.Float64Attribute has been removed. Use new THREE.Float64BufferAttribute() instead."),new pn(t,e)},t.Float64BufferAttribute=pn,t.FloatType=M,t.Fog=pa,t.FogExp2=da,t.Font=ac,t.FontLoader=lc,t.FrontSide=0,t.Frustum=ir,t.GLBufferAttribute=Yc,t.GLSL1="100",t.GLSL3=it,t.GammaEncoding=J,t.GreaterDepth=6,t.GreaterEqualDepth=5,t.GreaterEqualStencilFunc=518,t.GreaterStencilFunc=516,t.GridHelper=yu,t.Group=oa,t.HalfFloatType=S,t.HemisphereLight=Rl,t.HemisphereLightHelper=gu,t.HemisphereLightProbe=hc,t.IcosahedronBufferGeometry=ss,t.IcosahedronGeometry=ss,t.ImageBitmapLoader=rc,t.ImageLoader=el,t.ImageUtils=bt,t.ImmediateRenderObject=au,t.IncrementStencilOp=7682,t.IncrementWrapStencilOp=34055,t.InstancedBufferAttribute=Ql,t.InstancedBufferGeometry=Jl,t.InstancedInterleavedBuffer=Xc,t.InstancedMesh=Qa,t.Int16Attribute=function(t,e){return console.warn("THREE.Int16Attribute has been removed. Use new THREE.Int16BufferAttribute() instead."),new sn(t,e)},t.Int16BufferAttribute=sn,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 rn(t,e)},t.Int8BufferAttribute=rn,t.IntType=1013,t.InterleavedBuffer=ma,t.InterleavedBufferAttribute=ga,t.Interpolant=Is,t.InterpolateDiscrete=G,t.InterpolateLinear=U,t.InterpolateSmooth=k,t.InvertStencilOp=5386,t.JSONLoader=function(){console.error("THREE.JSONLoader has been removed.")},t.KeepStencilOp=et,t.KeyframeTrack=zs,t.LOD=Oa,t.LatheBufferGeometry=ls,t.LatheGeometry=ls,t.Layers=fe,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=Ll,t.LightProbe=Xl,t.Line=io,t.Line3=iu,t.LineBasicMaterial=Ka,t.LineCurve=xl,t.LineCurve3=_l,t.LineDashedMaterial=Cs,t.LineLoop=lo,t.LinePieces=1,t.LineSegments=so,t.LineStrip=0,t.LinearEncoding=Y,t.LinearFilter=g,t.LinearInterpolant=Bs,t.LinearMipMapLinearFilter=1008,t.LinearMipMapNearestFilter=1007,t.LinearMipmapLinearFilter=x,t.LinearMipmapNearestFilter=y,t.LinearToneMapping=1,t.Loader=Js,t.LoaderUtils=Zl,t.LoadingManager=Ys,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=je,t.MaterialLoader=Yl,t.Math=gt,t.MathUtils=gt,t.Matrix3=_t,t.Matrix4=re,t.MaxEquation=104,t.Mesh=kn,t.MeshBasicMaterial=$e,t.MeshDepthMaterial=$i,t.MeshDistanceMaterial=ta,t.MeshFaceMaterial=function(t){return console.warn("THREE.MeshFaceMaterial has been removed. Use an Array instead."),t},t.MeshLambertMaterial=Ls,t.MeshMatcapMaterial=Rs,t.MeshNormalMaterial=As,t.MeshPhongMaterial=Ts,t.MeshPhysicalMaterial=Ss,t.MeshStandardMaterial=Ms,t.MeshToonMaterial=Es,t.MinEquation=103,t.MirroredRepeatWrapping=p,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=f,t.NearestMipMapLinearFilter=1005,t.NearestMipMapNearestFilter=1004,t.NearestMipmapLinearFilter=v,t.NearestMipmapNearestFilter=m,t.NeverDepth=0,t.NeverStencilFunc=512,t.NoBlending=0,t.NoColors=0,t.NoToneMapping=0,t.NormalAnimationBlendMode=q,t.NormalBlending=1,t.NotEqualDepth=7,t.NotEqualStencilFunc=517,t.NumberKeyframeTrack=Gs,t.Object3D=Le,t.ObjectLoader=$l,t.ObjectSpaceNormalMap=1,t.OctahedronBufferGeometry=cs,t.OctahedronGeometry=cs,t.OneFactor=201,t.OneMinusDstAlphaFactor=207,t.OneMinusDstColorFactor=209,t.OneMinusSrcAlphaFactor=205,t.OneMinusSrcColorFactor=203,t.OrthographicCamera=Ul,t.PCFShadowMap=1,t.PCFSoftShadowMap=2,t.PMREMGenerator=ah,t.ParametricBufferGeometry=us,t.ParametricGeometry=us,t.Particle=function(t){return console.warn("THREE.Particle has been renamed to THREE.Sprite."),new Da(t)},t.ParticleBasicMaterial=function(t){return console.warn("THREE.ParticleBasicMaterial has been renamed to THREE.PointsMaterial."),new co(t)},t.ParticleSystem=function(t,e){return console.warn("THREE.ParticleSystem has been renamed to THREE.Points."),new mo(t,e)},t.ParticleSystemMaterial=function(t){return console.warn("THREE.ParticleSystemMaterial has been renamed to THREE.PointsMaterial."),new co(t)},t.Path=El,t.PerspectiveCamera=Jn,t.Plane=De,t.PlaneBufferGeometry=sr,t.PlaneGeometry=sr,t.PlaneHelper=Nu,t.PointCloud=function(t,e){return console.warn("THREE.PointCloud has been renamed to THREE.Points."),new mo(t,e)},t.PointCloudMaterial=function(t){return console.warn("THREE.PointCloudMaterial has been renamed to THREE.PointsMaterial."),new co(t)},t.PointLight=Gl,t.PointLightHelper=pu,t.Points=mo,t.PointsMaterial=co,t.PolarGridHelper=xu,t.PolyhedronBufferGeometry=So,t.PolyhedronGeometry=So,t.PositionalAudio=Lc,t.PropertyBinding=kc,t.PropertyMixer=Cc,t.QuadraticBezierCurve=bl,t.QuadraticBezierCurve3=wl,t.Quaternion=Lt,t.QuaternionKeyframeTrack=ks,t.QuaternionLinearInterpolant=Us,t.REVISION=n,t.RGBADepthPacking=3201,t.RGBAFormat=A,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=H,t.RGBA_PVRTC_2BPPV1_Format=z,t.RGBA_PVRTC_4BPPV1_Format=O,t.RGBA_S3TC_DXT1_Format=P,t.RGBA_S3TC_DXT3_Format=D,t.RGBA_S3TC_DXT5_Format=I,t.RGBDEncoding=tt,t.RGBEEncoding=Q,t.RGBEFormat=1023,t.RGBFormat=E,t.RGBIntegerFormat=1032,t.RGBM16Encoding=$,t.RGBM7Encoding=K,t.RGB_ETC1_Format=36196,t.RGB_ETC2_Format=F,t.RGB_PVRTC_2BPPV1_Format=B,t.RGB_PVRTC_4BPPV1_Format=N,t.RGB_S3TC_DXT1_Format=C,t.RGFormat=1030,t.RGIntegerFormat=1031,t.RawShaderMaterial=ws,t.Ray=ne,t.Raycaster=Zc,t.RectAreaLight=jl,t.RedFormat=1028,t.RedIntegerFormat=1029,t.ReinhardToneMapping=2,t.RepeatWrapping=h,t.ReplaceStencilOp=7681,t.ReverseSubtractEquation=102,t.RingBufferGeometry=hs,t.RingGeometry=hs,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=fa,t.SceneUtils=dh,t.ShaderChunk=lr,t.ShaderLib=ur,t.ShaderMaterial=Yn,t.ShadowMaterial=bs,t.Shape=Al,t.ShapeBufferGeometry=ds,t.ShapeGeometry=ds,t.ShapePath=ic,t.ShapeUtils=ns,t.ShortType=1011,t.Skeleton=qa,t.SkeletonHelper=hu,t.SkinnedMesh=ka,t.SmoothShading=2,t.Sphere=Yt,t.SphereBufferGeometry=ps,t.SphereGeometry=ps,t.Spherical=Kc,t.SphericalHarmonics3=ql,t.SplineCurve=Ml,t.SpotLight=Bl,t.SpotLightHelper=su,t.Sprite=Da,t.SpriteMaterial=xa,t.SrcAlphaFactor=204,t.SrcAlphaSaturateFactor=210,t.SrcColorFactor=202,t.StaticCopyUsage=35046,t.StaticDrawUsage=nt,t.StaticReadUsage=35045,t.StereoCamera=mc,t.StreamCopyUsage=35042,t.StreamDrawUsage=35040,t.StreamReadUsage=35041,t.StringKeyframeTrack=Vs,t.SubtractEquation=101,t.SubtractiveBlending=3,t.TOUCH={ROTATE:0,PAN:1,DOLLY_PAN:2,DOLLY_ROTATE:3},t.TangentSpaceNormalMap=0,t.TetrahedronBufferGeometry=fs,t.TetrahedronGeometry=fs,t.TextBufferGeometry=ms,t.TextGeometry=ms,t.Texture=Mt,t.TextureLoader=il,t.TorusBufferGeometry=vs,t.TorusGeometry=vs,t.TorusKnotBufferGeometry=gs,t.TorusKnotGeometry=gs,t.Triangle=Ve,t.TriangleFanDrawMode=2,t.TriangleStripDrawMode=1,t.TrianglesDrawMode=0,t.TubeBufferGeometry=ys,t.TubeGeometry=ys,t.UVMapping=i,t.Uint16Attribute=function(t,e){return console.warn("THREE.Uint16Attribute has been removed. Use new THREE.Uint16BufferAttribute() instead."),new ln(t,e)},t.Uint16BufferAttribute=ln,t.Uint32Attribute=function(t,e){return console.warn("THREE.Uint32Attribute has been removed. Use new THREE.Uint32BufferAttribute() instead."),new un(t,e)},t.Uint32BufferAttribute=un,t.Uint8Attribute=function(t,e){return console.warn("THREE.Uint8Attribute has been removed. Use new THREE.Uint8BufferAttribute() instead."),new an(t,e)},t.Uint8BufferAttribute=an,t.Uint8ClampedAttribute=function(t,e){return console.warn("THREE.Uint8ClampedAttribute has been removed. Use new THREE.Uint8ClampedBufferAttribute() instead."),new on(t,e)},t.Uint8ClampedBufferAttribute=on,t.Uniform=qc,t.UniformsLib=cr,t.UniformsUtils=Xn,t.UnsignedByteType=_,t.UnsignedInt248Type=T,t.UnsignedIntType=w,t.UnsignedShort4444Type=1017,t.UnsignedShort5551Type=1018,t.UnsignedShort565Type=1019,t.UnsignedShortType=b,t.VSMShadowMap=3,t.Vector2=yt,t.Vector3=Rt,t.Vector4=Tt,t.VectorKeyframeTrack=Ws,t.Vertex=function(t,e,n){return console.warn("THREE.Vertex has been removed. Use THREE.Vector3 instead."),new Rt(t,e,n)},t.VertexColors=2,t.VideoTexture=go,t.WebGL1Renderer=ha,t.WebGLCubeRenderTarget=tr,t.WebGLMultisampleRenderTarget=At,t.WebGLRenderTarget=Et,t.WebGLRenderTargetCube=function(t,e,n){return console.warn("THREE.WebGLRenderTargetCube( width, height, options ) is now WebGLCubeRenderTarget( size, options )."),new tr(t,n)},t.WebGLRenderer=ua,t.WebGLUtils=ia,t.WireframeGeometry=xs,t.WireframeHelper=function(t,e){return console.warn("THREE.WireframeHelper has been removed. Use THREE.WireframeGeometry instead."),new so(new xs(t.geometry),new Ka({color:void 0!==e?e:16777215}))},t.WrapAroundEnding=j,t.XHRLoader=function(t){return console.warn("THREE.XHRLoader has been renamed to THREE.FileLoader."),new Ks(t)},t.ZeroCurvatureEnding=V,t.ZeroFactor=200,t.ZeroSlopeEnding=W,t.ZeroStencilOp=0,t.sRGBEncoding=Z,Object.defineProperty(t,"__esModule",{value:!0})})); +!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";var e=function(t){var e,n=Object.prototype,i=n.hasOwnProperty,r="function"==typeof Symbol?Symbol:{},s=r.iterator||"@@iterator",o=r.asyncIterator||"@@asyncIterator",a=r.toStringTag||"@@toStringTag";function l(t,e,n){return Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{l({},"")}catch(t){l=function(t,e,n){return t[e]=n}}function c(t,e,n,i){var r=e&&e.prototype instanceof g?e:g,s=Object.create(r.prototype),o=new L(i||[]);return s._invoke=function(t,e,n){var i=u;return function(r,s){if(i===p)throw new Error("Generator is already running");if(i===f){if("throw"===r)throw s;return C()}for(n.method=r,n.arg=s;;){var o=n.delegate;if(o){var a=T(o,n);if(a){if(a===m)continue;return a}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if(i===u)throw i=f,n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);i=p;var l=h(t,e,n);if("normal"===l.type){if(i=n.done?f:d,l.arg===m)continue;return{value:l.arg,done:n.done}}"throw"===l.type&&(i=f,n.method="throw",n.arg=l.arg)}}}(t,n,o),s}function h(t,e,n){try{return{type:"normal",arg:t.call(e,n)}}catch(t){return{type:"throw",arg:t}}}t.wrap=c;var u="suspendedStart",d="suspendedYield",p="executing",f="completed",m={};function g(){}function v(){}function y(){}var x={};x[s]=function(){return this};var _=Object.getPrototypeOf,b=_&&_(_(R([])));b&&b!==n&&i.call(b,s)&&(x=b);var w=y.prototype=g.prototype=Object.create(x);function M(t){["next","throw","return"].forEach((function(e){l(t,e,(function(t){return this._invoke(e,t)}))}))}function S(t,e){function n(r,s,o,a){var l=h(t[r],t,s);if("throw"!==l.type){var c=l.arg,u=c.value;return u&&"object"==typeof u&&i.call(u,"__await")?e.resolve(u.__await).then((function(t){n("next",t,o,a)}),(function(t){n("throw",t,o,a)})):e.resolve(u).then((function(t){c.value=t,o(c)}),(function(t){return n("throw",t,o,a)}))}a(l.arg)}var r;this._invoke=function(t,i){function s(){return new e((function(e,r){n(t,i,e,r)}))}return r=r?r.then(s,s):s()}}function T(t,n){var i=t.iterator[n.method];if(i===e){if(n.delegate=null,"throw"===n.method){if(t.iterator.return&&(n.method="return",n.arg=e,T(t,n),"throw"===n.method))return m;n.method="throw",n.arg=new TypeError("The iterator does not provide a 'throw' method")}return m}var r=h(i,t.iterator,n.arg);if("throw"===r.type)return n.method="throw",n.arg=r.arg,n.delegate=null,m;var s=r.arg;return s?s.done?(n[t.resultName]=s.value,n.next=t.nextLoc,"return"!==n.method&&(n.method="next",n.arg=e),n.delegate=null,m):s:(n.method="throw",n.arg=new TypeError("iterator result is not an object"),n.delegate=null,m)}function E(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function A(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function L(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(E,this),this.reset(!0)}function R(t){if(t){var n=t[s];if(n)return n.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var r=-1,o=function n(){for(;++r=0;--s){var o=this.tryEntries[s],a=o.completion;if("root"===o.tryLoc)return r("end");if(o.tryLoc<=this.prev){var l=i.call(o,"catchLoc"),c=i.call(o,"finallyLoc");if(l&&c){if(this.prev=0;--n){var r=this.tryEntries[n];if(r.tryLoc<=this.prev&&i.call(r,"finallyLoc")&&this.prev=0;--e){var n=this.tryEntries[e];if(n.finallyLoc===t)return this.complete(n.completion,n.afterLoc),A(n),m}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var n=this.tryEntries[e];if(n.tryLoc===t){var i=n.completion;if("throw"===i.type){var r=i.arg;A(n)}return r}}throw new Error("illegal catch attempt")},delegateYield:function(t,n,i){return this.delegate={iterator:R(t),resultName:n,nextLoc:i},"next"===this.method&&(this.arg=e),m}},t}("object"==typeof module?module.exports:{});try{regeneratorRuntime=e}catch(t){Function("r","regeneratorRuntime = r")(e)}const n="127dev",i=100,r=300,s=301,o=302,a=303,l=304,c=306,h=307,u=1e3,d=1001,p=1002,f=1003,m=1004,g=1005,v=1006,y=1007,x=1008,_=1009,b=1012,w=1014,M=1015,S=1016,T=1020,E=1022,A=1023,L=1026,R=1027,C=33776,P=33777,D=33778,I=33779,N=35840,O=35841,B=35842,z=35843,F=37492,H=37496,G=2300,U=2301,k=2302,V=2400,W=2401,j=2402,q=2500,X=2501,Y=3e3,Z=3001,J=3007,Q=3002,K=3004,$=3005,tt=3006,et=7680,nt=35044,it=35048,rt="300 es";function st(){}Object.assign(st.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]+ot[t>>16&255]+ot[t>>24&255]+"-"+ot[255&e]+ot[e>>8&255]+"-"+ot[e>>16&15|64]+ot[e>>24&255]+"-"+ot[63&n|128]+ot[n>>8&255]+"-"+ot[n>>16&255]+ot[n>>24&255]+ot[255&i]+ot[i>>8&255]+ot[i>>16&255]+ot[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 lt.lerp(t,e,1-Math.exp(-n*i))},pingpong:function(t,e=1){return e-Math.abs(lt.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*lt.DEG2RAD},radToDeg:function(t){return t*lt.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,o=Math.sin,a=s(n/2),l=o(n/2),c=s((e+i)/2),h=o((e+i)/2),u=s((e-i)/2),d=o((e-i)/2),p=s((i-e)/2),f=o((i-e)/2);switch(r){case"XYX":t.set(a*h,l*u,l*d,a*c);break;case"YZY":t.set(l*d,a*h,l*u,a*c);break;case"ZXZ":t.set(l*u,l*d,a*h,a*c);break;case"XZX":t.set(a*h,l*f,l*p,a*c);break;case"YXY":t.set(l*p,a*h,l*f,a*c);break;case"ZYZ":t.set(l*f,l*p,a*h,a*c);break;default:console.warn("THREE.MathUtils: .setQuaternionFromProperEuler() encountered an unknown order: "+r)}}};class ct{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}}ct.prototype.isVector2=!0;class ht{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,o,a,l){const c=this.elements;return c[0]=t,c[1]=i,c[2]=o,c[3]=e,c[4]=r,c[5]=a,c[6]=n,c[7]=s,c[8]=l,this}identity(){return this.set(1,0,0,0,1,0,0,0,1),this}copy(t){const e=this.elements,n=t.elements;return e[0]=n[0],e[1]=n[1],e[2]=n[2],e[3]=n[3],e[4]=n[4],e[5]=n[5],e[6]=n[6],e[7]=n[7],e[8]=n[8],this}extractBasis(t,e,n){return t.setFromMatrix3Column(this,0),e.setFromMatrix3Column(this,1),n.setFromMatrix3Column(this,2),this}setFromMatrix4(t){const e=t.elements;return this.set(e[0],e[4],e[8],e[1],e[5],e[9],e[2],e[6],e[10]),this}multiply(t){return this.multiplyMatrices(this,t)}premultiply(t){return this.multiplyMatrices(t,this)}multiplyMatrices(t,e){const n=t.elements,i=e.elements,r=this.elements,s=n[0],o=n[3],a=n[6],l=n[1],c=n[4],h=n[7],u=n[2],d=n[5],p=n[8],f=i[0],m=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*f+o*v+a*_,r[3]=s*m+o*y+a*b,r[6]=s*g+o*x+a*w,r[1]=l*f+c*v+h*_,r[4]=l*m+c*y+h*b,r[7]=l*g+c*x+h*w,r[2]=u*f+d*v+p*_,r[5]=u*m+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],o=t[5],a=t[6],l=t[7],c=t[8];return e*s*c-e*o*l-n*r*c+n*o*a+i*r*l-i*s*a}invert(){const t=this.elements,e=t[0],n=t[1],i=t[2],r=t[3],s=t[4],o=t[5],a=t[6],l=t[7],c=t[8],h=c*s-o*l,u=o*a-c*r,d=l*r-s*a,p=e*h+n*u+i*d;if(0===p)return this.set(0,0,0,0,0,0,0,0,0);const f=1/p;return t[0]=h*f,t[1]=(i*l-c*n)*f,t[2]=(o*n-i*s)*f,t[3]=u*f,t[4]=(c*e-i*a)*f,t[5]=(i*r-o*e)*f,t[6]=d*f,t[7]=(n*a-l*e)*f,t[8]=(s*e-n*r)*f,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,o){const a=Math.cos(r),l=Math.sin(r);return this.set(n*a,n*l,-n*(a*s+l*o)+s+t,-i*l,i*a,-i*(-l*s+a*o)+o+e,0,0,1),this}scale(t,e){const n=this.elements;return n[0]*=t,n[3]*=t,n[6]*=t,n[1]*=e,n[4]*=e,n[7]*=e,this}rotate(t){const e=Math.cos(t),n=Math.sin(t),i=this.elements,r=i[0],s=i[3],o=i[6],a=i[1],l=i[4],c=i[7];return i[0]=e*r+n*a,i[3]=e*s+n*l,i[6]=e*o+n*c,i[1]=-n*r+e*a,i[4]=-n*s+e*l,i[7]=-n*o+e*c,this}translate(t,e){const n=this.elements;return n[0]+=t*n[2],n[3]+=t*n[5],n[6]+=t*n[8],n[1]+=e*n[2],n[4]+=e*n[5],n[7]+=e*n[8],this}equals(t){const e=this.elements,n=t.elements;for(let 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 ut;ht.prototype.isMatrix3=!0;const dt={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===ut&&(ut=document.createElementNS("http://www.w3.org/1999/xhtml","canvas")),ut.width=t.width,ut.height=t.height;const n=ut.getContext("2d");t instanceof ImageData?n.putImageData(t,0,0):n.drawImage(t,0,0,t.width,t.height),e=ut}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 pt=0;class ft extends st{constructor(t=ft.DEFAULT_IMAGE,e=ft.DEFAULT_MAPPING,n=1001,i=1001,r=1006,s=1008,o=1023,a=1009,l=1,c=3e3){super(),Object.defineProperty(this,"id",{value:pt++}),this.uuid=lt.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=o,this.internalFormat=null,this.type=a,this.offset=new ct(0,0),this.repeat=new ct(1,1),this.center=new ct(0,0),this.rotation=0,this.matrixAutoUpdate=!0,this.matrix=new ht,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=lt.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 u:t.x=t.x-Math.floor(t.x);break;case d:t.x=t.x<0?0:1;break;case p: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 u:t.y=t.y-Math.floor(t.y);break;case d:t.y=t.y<0?0:1;break;case p: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?dt.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."),{})}ft.DEFAULT_IMAGE=void 0,ft.DEFAULT_MAPPING=r,ft.prototype.isTexture=!0;class gt{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,o=.1,a=t.elements,l=a[0],c=a[4],h=a[8],u=a[1],d=a[5],p=a[9],f=a[2],m=a[6],g=a[10];if(Math.abs(c-u)a&&t>v?tv?a=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,o=Math.sin(o*s)/r}const r=o*n;if(a=a*t+u*r,l=l*t+d*r,c=c*t+p*r,h=h*t+f*r,t===1-o){const t=1/Math.sqrt(a*a+l*l+c*c+h*h);a*=t,l*=t,c*=t,h*=t}}t[e]=a,t[e+1]=l,t[e+2]=c,t[e+3]=h}static multiplyQuaternionsFlat(t,e,n,i,r,s){const o=n[i],a=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]=o*p+c*h+a*d-l*u,t[e+1]=a*p+c*u+l*h-o*d,t[e+2]=l*p+c*d+o*u-a*h,t[e+3]=c*p-o*h-a*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,o=Math.cos,a=Math.sin,l=o(n/2),c=o(i/2),h=o(r/2),u=a(n/2),d=a(i/2),p=a(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],o=e[5],a=e[9],l=e[2],c=e[6],h=e[10],u=n+o+h;if(u>0){const t=.5/Math.sqrt(u+1);this._w=.25/t,this._x=(c-a)*t,this._y=(r-l)*t,this._z=(s-i)*t}else if(n>o&&n>h){const t=2*Math.sqrt(1+n-o-h);this._w=(c-a)/t,this._x=.25*t,this._y=(i+s)/t,this._z=(r+l)/t}else if(o>h){const t=2*Math.sqrt(1+o-n-h);this._w=(r-l)/t,this._x=(i+s)/t,this._y=.25*t,this._z=(a+c)/t}else{const t=2*Math.sqrt(1+h-n-o);this._w=(s-i)/t,this._x=(r+l)/t,this._y=(a+c)/t,this._z=.25*t}return this._onChangeCallback(),this}setFromUnitVectors(t,e){let n=t.dot(e)+1;return n<1e-6?(n=0,Math.abs(t.x)>Math.abs(t.z)?(this._x=-t.y,this._y=t.x,this._z=0,this._w=n):(this._x=0,this._y=-t.z,this._z=t.y,this._w=n)):(this._x=t.y*e.z-t.z*e.y,this._y=t.z*e.x-t.x*e.z,this._z=t.x*e.y-t.y*e.x,this._w=n),this.normalize()}angleTo(t){return 2*Math.acos(Math.abs(lt.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,o=e._x,a=e._y,l=e._z,c=e._w;return this._x=n*c+s*o+i*l-r*a,this._y=i*c+s*a+r*o-n*l,this._z=r*c+s*l+n*a-i*o,this._w=s*c-n*o-i*a-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 o=s*t._w+n*t._x+i*t._y+r*t._z;if(o<0?(this._w=-t._w,this._x=-t._x,this._y=-t._y,this._z=-t._z,o=-o):this.copy(t),o>=1)return this._w=s,this._x=n,this._y=i,this._z=r,this;const a=1-o*o;if(a<=Number.EPSILON){const t=1-e;return this._w=t*s+e*this._w,this._x=t*n+e*this._x,this._y=t*i+e*this._y,this._z=t*r+e*this._z,this.normalize(),this._onChangeCallback(),this}const l=Math.sqrt(a),c=Math.atan2(l,o),h=Math.sin((1-e)*c)/l,u=Math.sin(e*c)/l;return this._w=s*h+this._w*u,this._x=n*h+this._x*u,this._y=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(){}}xt.prototype.isQuaternion=!0;class _t{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(wt.setFromEuler(t))}applyAxisAngle(t,e){return this.applyQuaternion(wt.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,o=t.z,a=t.w,l=a*e+s*i-o*n,c=a*n+o*e-r*i,h=a*i+r*n-s*e,u=-r*e-s*n-o*i;return this.x=l*a+u*-r+c*-o-h*-s,this.y=c*a+u*-s+h*-r-l*-o,this.z=h*a+u*-o+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,o=e.y,a=e.z;return this.x=i*a-r*o,this.y=r*s-n*a,this.z=n*o-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 bt.copy(this).projectOnVector(t),this.sub(bt)}reflect(t){return this.sub(bt.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(lt.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}}_t.prototype.isVector3=!0;const bt=new _t,wt=new xt;class Mt{constructor(t=new _t(1/0,1/0,1/0),e=new _t(-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,o=-1/0;for(let a=0,l=t.length;ar&&(r=l),c>s&&(s=c),h>o&&(o=h)}return this.min.set(e,n,i),this.max.set(r,s,o),this}setFromBufferAttribute(t){let e=1/0,n=1/0,i=1/0,r=-1/0,s=-1/0,o=-1/0;for(let a=0,l=t.count;ar&&(r=l),c>s&&(s=c),h>o&&(o=h)}return this.min.set(e,n,i),this.max.set(r,s,o),this}setFromPoints(t){this.makeEmpty();for(let e=0,n=t.length;ethis.max.x||t.ythis.max.y||t.zthis.max.z)}containsBox(t){return this.min.x<=t.min.x&&t.max.x<=this.max.x&&this.min.y<=t.min.y&&t.max.y<=this.max.y&&this.min.z<=t.min.z&&t.max.z<=this.max.z}getParameter(t,e){return void 0===e&&(console.warn("THREE.Box3: .getParameter() target is now required"),e=new _t),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,Tt),Tt.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(It),Nt.subVectors(this.max,It),At.subVectors(t.a,It),Lt.subVectors(t.b,It),Rt.subVectors(t.c,It),Ct.subVectors(Lt,At),Pt.subVectors(Rt,Lt),Dt.subVectors(At,Rt);let e=[0,-Ct.z,Ct.y,0,-Pt.z,Pt.y,0,-Dt.z,Dt.y,Ct.z,0,-Ct.x,Pt.z,0,-Pt.x,Dt.z,0,-Dt.x,-Ct.y,Ct.x,0,-Pt.y,Pt.x,0,-Dt.y,Dt.x,0];return!!zt(e,At,Lt,Rt,Nt)&&(e=[1,0,0,0,1,0,0,0,1],!!zt(e,At,Lt,Rt,Nt)&&(Ot.crossVectors(Ct,Pt),e=[Ot.x,Ot.y,Ot.z],zt(e,At,Lt,Rt,Nt)))}clampPoint(t,e){return void 0===e&&(console.warn("THREE.Box3: .clampPoint() target is now required"),e=new _t),e.copy(t).clamp(this.min,this.max)}distanceToPoint(t){return Tt.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(Tt).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()||(St[0].set(this.min.x,this.min.y,this.min.z).applyMatrix4(t),St[1].set(this.min.x,this.min.y,this.max.z).applyMatrix4(t),St[2].set(this.min.x,this.max.y,this.min.z).applyMatrix4(t),St[3].set(this.min.x,this.max.y,this.max.z).applyMatrix4(t),St[4].set(this.max.x,this.min.y,this.min.z).applyMatrix4(t),St[5].set(this.max.x,this.min.y,this.max.z).applyMatrix4(t),St[6].set(this.max.x,this.max.y,this.min.z).applyMatrix4(t),St[7].set(this.max.x,this.max.y,this.max.z).applyMatrix4(t),this.setFromPoints(St)),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)}}Mt.prototype.isBox3=!0;const St=[new _t,new _t,new _t,new _t,new _t,new _t,new _t,new _t],Tt=new _t,Et=new Mt,At=new _t,Lt=new _t,Rt=new _t,Ct=new _t,Pt=new _t,Dt=new _t,It=new _t,Nt=new _t,Ot=new _t,Bt=new _t;function zt(t,e,n,i,r){for(let s=0,o=t.length-3;s<=o;s+=3){Bt.fromArray(t,s);const o=r.x*Math.abs(Bt.x)+r.y*Math.abs(Bt.y)+r.z*Math.abs(Bt.z),a=e.dot(Bt),l=n.dot(Bt),c=i.dot(Bt);if(Math.max(-Math.max(a,l,c),Math.min(a,l,c))>o)return!1}return!0}const Ft=new Mt;class Ht{constructor(t=new _t,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):Ft.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 Mt),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 Gt=new _t,Ut=new _t,kt=new _t,Vt=new _t,Wt=new _t,jt=new _t,qt=new _t;class Xt{constructor(t=new _t,e=new _t(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 _t),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,Gt)),this}closestPointToPoint(t,e){void 0===e&&(console.warn("THREE.Ray: .closestPointToPoint() target is now required"),e=new _t),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=Gt.subVectors(t,this.origin).dot(this.direction);return e<0?this.origin.distanceToSquared(t):(Gt.copy(this.direction).multiplyScalar(e).add(this.origin),Gt.distanceToSquared(t))}distanceSqToSegment(t,e,n,i){Ut.copy(t).add(e).multiplyScalar(.5),kt.copy(e).sub(t).normalize(),Vt.copy(this.origin).sub(Ut);const r=.5*t.distanceTo(e),s=-this.direction.dot(kt),o=Vt.dot(this.direction),a=-Vt.dot(kt),l=Vt.lengthSq(),c=Math.abs(1-s*s);let h,u,d,p;if(c>0)if(h=s*a-o,u=s*o-a,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*o)+u*(s*h+u+2*a)+l}else u=r,h=Math.max(0,-(s*u+o)),d=-h*h+u*(u+2*a)+l;else u=-r,h=Math.max(0,-(s*u+o)),d=-h*h+u*(u+2*a)+l;else u<=-p?(h=Math.max(0,-(-s*r+o)),u=h>0?-r:Math.min(Math.max(-r,-a),r),d=-h*h+u*(u+2*a)+l):u<=p?(h=0,u=Math.min(Math.max(-r,-a),r),d=u*(u+2*a)+l):(h=Math.max(0,-(s*r+o)),u=h>0?r:Math.min(Math.max(-r,-a),r),d=-h*h+u*(u+2*a)+l);else u=s>0?-r:r,h=Math.max(0,-(s*u+o)),d=-h*h+u*(u+2*a)+l;return n&&n.copy(this.direction).multiplyScalar(h).add(this.origin),i&&i.copy(kt).multiplyScalar(u).add(Ut),d}intersectSphere(t,e){Gt.subVectors(t.center,this.origin);const n=Gt.dot(this.direction),i=Gt.dot(Gt)-n*n,r=t.radius*t.radius;if(i>r)return null;const s=Math.sqrt(r-i),o=n-s,a=n+s;return o<0&&a<0?null:o<0?this.at(a,e):this.at(o,e)}intersectsSphere(t){return this.distanceSqToPoint(t.center)<=t.radius*t.radius}distanceToPlane(t){const e=t.normal.dot(this.direction);if(0===e)return 0===t.distanceToPoint(this.origin)?0:null;const n=-(this.origin.dot(t.normal)+t.constant)/e;return n>=0?n:null}intersectPlane(t,e){const n=this.distanceToPlane(t);return null===n?null:this.at(n,e)}intersectsPlane(t){const e=t.distanceToPoint(this.origin);if(0===e)return!0;return t.normal.dot(this.direction)*e<0}intersectBox(t,e){let n,i,r,s,o,a;const l=1/this.direction.x,c=1/this.direction.y,h=1/this.direction.z,u=this.origin;return l>=0?(n=(t.min.x-u.x)*l,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?(o=(t.min.z-u.z)*h,a=(t.max.z-u.z)*h):(o=(t.max.z-u.z)*h,a=(t.min.z-u.z)*h),n>a||o>i?null:((o>n||n!=n)&&(n=o),(a=0?n:i,e)))}intersectsBox(t){return null!==this.intersectBox(t,Gt)}intersectTriangle(t,e,n,i,r){Wt.subVectors(e,t),jt.subVectors(n,t),qt.crossVectors(Wt,jt);let s,o=this.direction.dot(qt);if(o>0){if(i)return null;s=1}else{if(!(o<0))return null;s=-1,o=-o}Vt.subVectors(this.origin,t);const a=s*this.direction.dot(jt.crossVectors(Vt,jt));if(a<0)return null;const l=s*this.direction.dot(Wt.cross(Vt));if(l<0)return null;if(a+l>o)return null;const c=-s*Vt.dot(qt);return c<0?null:this.at(c/o,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 Yt{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,o,a,l,c,h,u,d,p,f,m){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]=o,g[13]=a,g[2]=l,g[6]=c,g[10]=h,g[14]=u,g[3]=d,g[7]=p,g[11]=f,g[15]=m,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 Yt).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/Zt.setFromMatrixColumn(t,0).length(),r=1/Zt.setFromMatrixColumn(t,1).length(),s=1/Zt.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),o=Math.sin(n),a=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=o*c,r=o*h;e[0]=a*c,e[4]=-a*h,e[8]=l,e[1]=n+i*l,e[5]=t-r*l,e[9]=-o*a,e[2]=r-t*l,e[6]=i+n*l,e[10]=s*a}else if("YXZ"===t.order){const t=a*c,n=a*h,i=l*c,r=l*h;e[0]=t+r*o,e[4]=i*o-n,e[8]=s*l,e[1]=s*h,e[5]=s*c,e[9]=-o,e[2]=n*o-i,e[6]=r+t*o,e[10]=s*a}else if("ZXY"===t.order){const t=a*c,n=a*h,i=l*c,r=l*h;e[0]=t-r*o,e[4]=-s*h,e[8]=i+n*o,e[1]=n+i*o,e[5]=s*c,e[9]=r-t*o,e[2]=-s*l,e[6]=o,e[10]=s*a}else if("ZYX"===t.order){const t=s*c,n=s*h,i=o*c,r=o*h;e[0]=a*c,e[4]=i*l-n,e[8]=t*l+r,e[1]=a*h,e[5]=r*l+t,e[9]=n*l-i,e[2]=-l,e[6]=o*a,e[10]=s*a}else if("YZX"===t.order){const t=s*a,n=s*l,i=o*a,r=o*l;e[0]=a*c,e[4]=r-t*h,e[8]=i*h+n,e[1]=h,e[5]=s*c,e[9]=-o*c,e[2]=-l*c,e[6]=n*h+i,e[10]=t-r*h}else if("XZY"===t.order){const t=s*a,n=s*l,i=o*a,r=o*l;e[0]=a*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]=o*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(Qt,t,Kt)}lookAt(t,e,n){const i=this.elements;return ee.subVectors(t,e),0===ee.lengthSq()&&(ee.z=1),ee.normalize(),$t.crossVectors(n,ee),0===$t.lengthSq()&&(1===Math.abs(n.z)?ee.x+=1e-4:ee.z+=1e-4,ee.normalize(),$t.crossVectors(n,ee)),$t.normalize(),te.crossVectors(ee,$t),i[0]=$t.x,i[4]=te.x,i[8]=ee.x,i[1]=$t.y,i[5]=te.y,i[9]=ee.y,i[2]=$t.z,i[6]=te.z,i[10]=ee.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],o=n[4],a=n[8],l=n[12],c=n[1],h=n[5],u=n[9],d=n[13],p=n[2],f=n[6],m=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],O=i[11],B=i[15];return r[0]=s*b+o*T+a*R+l*I,r[4]=s*w+o*E+a*C+l*N,r[8]=s*M+o*A+a*P+l*O,r[12]=s*S+o*L+a*D+l*B,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*O,r[13]=c*S+h*L+u*D+d*B,r[2]=p*b+f*T+m*R+g*I,r[6]=p*w+f*E+m*C+g*N,r[10]=p*M+f*A+m*P+g*O,r[14]=p*S+f*L+m*D+g*B,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+_*O,r[15]=v*S+y*L+x*D+_*B,this}multiplyScalar(t){const e=this.elements;return e[0]*=t,e[4]*=t,e[8]*=t,e[12]*=t,e[1]*=t,e[5]*=t,e[9]*=t,e[13]*=t,e[2]*=t,e[6]*=t,e[10]*=t,e[14]*=t,e[3]*=t,e[7]*=t,e[11]*=t,e[15]*=t,this}determinant(){const t=this.elements,e=t[0],n=t[4],i=t[8],r=t[12],s=t[1],o=t[5],a=t[9],l=t[13],c=t[2],h=t[6],u=t[10],d=t[14];return t[3]*(+r*a*h-i*l*h-r*o*u+n*l*u+i*o*d-n*a*d)+t[7]*(+e*a*d-e*l*u+r*s*u-i*s*d+i*l*c-r*a*c)+t[11]*(+e*l*h-e*o*d-r*s*h+n*s*d+r*o*c-n*l*c)+t[15]*(-i*o*c-e*a*h+e*o*u+i*s*h-n*s*u+n*a*c)}transpose(){const t=this.elements;let e;return e=t[1],t[1]=t[4],t[4]=e,e=t[2],t[2]=t[8],t[8]=e,e=t[6],t[6]=t[9],t[9]=e,e=t[3],t[3]=t[12],t[12]=e,e=t[7],t[7]=t[13],t[13]=e,e=t[11],t[11]=t[14],t[14]=e,this}setPosition(t,e,n){const 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],o=t[5],a=t[6],l=t[7],c=t[8],h=t[9],u=t[10],d=t[11],p=t[12],f=t[13],m=t[14],g=t[15],v=h*m*l-f*u*l+f*a*d-o*m*d-h*a*g+o*u*g,y=p*u*l-c*m*l-p*a*d+s*m*d+c*a*g-s*u*g,x=c*f*l-p*h*l+p*o*d-s*f*d-c*o*g+s*h*g,_=p*h*a-c*f*a-p*o*u+s*f*u+c*o*m-s*h*m,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]=(f*u*r-h*m*r-f*i*d+n*m*d+h*i*g-n*u*g)*w,t[2]=(o*m*r-f*a*r+f*i*l-n*m*l-o*i*g+n*a*g)*w,t[3]=(h*a*r-o*u*r-h*i*l+n*u*l+o*i*d-n*a*d)*w,t[4]=y*w,t[5]=(c*m*r-p*u*r+p*i*d-e*m*d-c*i*g+e*u*g)*w,t[6]=(p*a*r-s*m*r-p*i*l+e*m*l+s*i*g-e*a*g)*w,t[7]=(s*u*r-c*a*r+c*i*l-e*u*l-s*i*d+e*a*d)*w,t[8]=x*w,t[9]=(p*h*r-c*f*r-p*n*d+e*f*d+c*n*g-e*h*g)*w,t[10]=(s*f*r-p*o*r+p*n*l-e*f*l-s*n*g+e*o*g)*w,t[11]=(c*o*r-s*h*r-c*n*l+e*h*l+s*n*d-e*o*d)*w,t[12]=_*w,t[13]=(c*f*i-p*h*i+p*n*u-e*f*u-c*n*m+e*h*m)*w,t[14]=(p*o*i-s*f*i-p*n*a+e*f*a+s*n*m-e*o*m)*w,t[15]=(s*h*i-c*o*i+c*n*a-e*h*a-s*n*u+e*o*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,o=t.y,a=t.z,l=r*s,c=r*o;return this.set(l*s+n,l*o-i*a,l*a+i*o,0,l*o+i*a,c*o+n,c*a-i*s,0,l*a-i*o,c*a+i*s,r*a*a+n,0,0,0,0,1),this}makeScale(t,e,n){return this.set(t,0,0,0,0,e,0,0,0,0,n,0,0,0,0,1),this}makeShear(t,e,n){return this.set(1,e,n,0,t,1,n,0,t,e,1,0,0,0,0,1),this}compose(t,e,n){const i=this.elements,r=e._x,s=e._y,o=e._z,a=e._w,l=r+r,c=s+s,h=o+o,u=r*l,d=r*c,p=r*h,f=s*c,m=s*h,g=o*h,v=a*l,y=a*c,x=a*h,_=n.x,b=n.y,w=n.z;return i[0]=(1-(f+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]=(m+v)*b,i[7]=0,i[8]=(p+y)*w,i[9]=(m-v)*w,i[10]=(1-(u+f))*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=Zt.set(i[0],i[1],i[2]).length();const s=Zt.set(i[4],i[5],i[6]).length(),o=Zt.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],Jt.copy(this);const a=1/r,l=1/s,c=1/o;return Jt.elements[0]*=a,Jt.elements[1]*=a,Jt.elements[2]*=a,Jt.elements[4]*=l,Jt.elements[5]*=l,Jt.elements[6]*=l,Jt.elements[8]*=c,Jt.elements[9]*=c,Jt.elements[10]*=c,e.setFromRotationMatrix(Jt),n.x=r,n.y=s,n.z=o,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 o=this.elements,a=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 o[0]=a,o[4]=0,o[8]=c,o[12]=0,o[1]=0,o[5]=l,o[9]=h,o[13]=0,o[2]=0,o[6]=0,o[10]=u,o[14]=d,o[3]=0,o[7]=0,o[11]=-1,o[15]=0,this}makeOrthographic(t,e,n,i,r,s){const o=this.elements,a=1/(e-t),l=1/(n-i),c=1/(s-r),h=(e+t)*a,u=(n+i)*l,d=(s+r)*c;return o[0]=2*a,o[4]=0,o[8]=0,o[12]=-h,o[1]=0,o[5]=2*l,o[9]=0,o[13]=-u,o[2]=0,o[6]=0,o[10]=-2*c,o[14]=-d,o[3]=0,o[7]=0,o[11]=0,o[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}}Yt.prototype.isMatrix4=!0;const Zt=new _t,Jt=new Yt,Qt=new _t(0,0,0),Kt=new _t(1,1,1),$t=new _t,te=new _t,ee=new _t,ne=new Yt,ie=new xt;class re{constructor(t=0,e=0,n=0,i=re.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=lt.clamp,r=t.elements,s=r[0],o=r[4],a=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(a,-1,1)),Math.abs(a)<.9999999?(this._x=Math.atan2(-h,p),this._z=Math.atan2(-o,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(a,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(-o,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(-o,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(a,p));break;case"XZY":this._z=Math.asin(-i(o,-1,1)),Math.abs(o)<.9999999?(this._x=Math.atan2(d,c),this._y=Math.atan2(a,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 ne.makeRotationFromQuaternion(t),this.setFromRotationMatrix(ne,e,n)}setFromVector3(t,e){return this.set(t.x,t.y,t.z,e||this._order)}reorder(t){return ie.setFromEuler(this),this.setFromQuaternion(ie,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 _t(this._x,this._y,this._z)}_onChange(t){return this._onChangeCallback=t,this}_onChangeCallback(){}}re.prototype.isEuler=!0,re.DefaultOrder="XYZ",re.RotationOrders=["XYZ","YZX","ZXY","XZY","YXZ","ZYX"];class se{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),o.length>0&&(n.images=o),a.length>0&&(n.shapes=a),l.length>0&&(n.skeletons=l),c.length>0&&(n.animations=c)}return n.object=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?void 0: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 _t),t.copy(this.normal).multiplyScalar(-this.constant)}applyMatrix4(t,e){const n=e||we.getNormalMatrix(t),i=this.coplanarPoint(_e).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)}}Me.prototype.isPlane=!0;const Se=new _t,Te=new _t,Ee=new _t,Ae=new _t,Le=new _t,Re=new _t,Ce=new _t,Pe=new _t,De=new _t,Ie=new _t;class Ne{constructor(t=new _t,e=new _t,n=new _t){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 _t),i.subVectors(n,e),Se.subVectors(t,e),i.cross(Se);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){Se.subVectors(i,e),Te.subVectors(n,e),Ee.subVectors(t,e);const s=Se.dot(Se),o=Se.dot(Te),a=Se.dot(Ee),l=Te.dot(Te),c=Te.dot(Ee),h=s*l-o*o;if(void 0===r&&(console.warn("THREE.Triangle: .getBarycoord() target is now required"),r=new _t),0===h)return r.set(-2,-1,-1);const u=1/h,d=(l*a-o*c)*u,p=(s*c-o*a)*u;return r.set(1-d-p,p,d)}static containsPoint(t,e,n,i){return this.getBarycoord(t,e,n,i,Ae),Ae.x>=0&&Ae.y>=0&&Ae.x+Ae.y<=1}static getUV(t,e,n,i,r,s,o,a){return this.getBarycoord(t,e,n,i,Ae),a.set(0,0),a.addScaledVector(r,Ae.x),a.addScaledVector(s,Ae.y),a.addScaledVector(o,Ae.z),a}static isFrontFacing(t,e,n,i){return Se.subVectors(n,e),Te.subVectors(t,e),Se.cross(Te).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 Se.subVectors(this.c,this.b),Te.subVectors(this.a,this.b),.5*Se.cross(Te).length()}getMidpoint(t){return void 0===t&&(console.warn("THREE.Triangle: .getMidpoint() target is now required"),t=new _t),t.addVectors(this.a,this.b).add(this.c).multiplyScalar(1/3)}getNormal(t){return Ne.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 Me),t.setFromCoplanarPoints(this.a,this.b,this.c)}getBarycoord(t,e){return Ne.getBarycoord(t,this.a,this.b,this.c,e)}getUV(t,e,n,i,r){return Ne.getUV(t,this.a,this.b,this.c,e,n,i,r)}containsPoint(t){return Ne.containsPoint(t,this.a,this.b,this.c)}isFrontFacing(t){return Ne.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 _t);const n=this.a,i=this.b,r=this.c;let s,o;Le.subVectors(i,n),Re.subVectors(r,n),Pe.subVectors(t,n);const a=Le.dot(Pe),l=Re.dot(Pe);if(a<=0&&l<=0)return e.copy(n);De.subVectors(t,i);const c=Le.dot(De),h=Re.dot(De);if(c>=0&&h<=c)return e.copy(i);const u=a*h-c*l;if(u<=0&&a>=0&&c<=0)return s=a/(a-c),e.copy(n).addScaledVector(Le,s);Ie.subVectors(t,r);const d=Le.dot(Ie),p=Re.dot(Ie);if(p>=0&&d<=p)return e.copy(r);const f=d*l-a*p;if(f<=0&&l>=0&&p<=0)return o=l/(l-p),e.copy(n).addScaledVector(Re,o);const m=c*p-d*h;if(m<=0&&h-c>=0&&d-p>=0)return Ce.subVectors(r,i),o=(h-c)/(h-c+(d-p)),e.copy(i).addScaledVector(Ce,o);const g=1/(m+f+u);return s=f*g,o=u*g,e.copy(n).addScaledVector(Le,s).addScaledVector(Re,o)}equals(t){return t.a.equals(this.a)&&t.b.equals(this.b)&&t.c.equals(this.c)}}let Oe=0;function Be(){Object.defineProperty(this,"id",{value:Oe++}),this.uuid=lt.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=i,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=et,this.stencilZFail=et,this.stencilZPass=et,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(st.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),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.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 ze={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},Fe={h:0,s:0,l:0},He={h:0,s:0,l:0};function Ge(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 Ue(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}class Ve{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=lt.euclideanModulo(t,1),e=lt.clamp(e,0,1),n=lt.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=Ge(r,i,t+1/3),this.g=Ge(r,i,t),this.b=Ge(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=ze[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=Ue(t.r),this.g=Ue(t.g),this.b=Ue(t.b),this}copyLinearToSRGB(t){return this.r=ke(t.r),this.g=ke(t.g),this.b=ke(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 o,a;const l=(s+r)/2;if(s===r)o=0,a=0;else{const t=r-s;switch(a=l<=.5?t/(r+s):t/(2-r-s),r){case e:o=(n-i)/t+(ne&&(e=t[n]);return e}Object.defineProperty(Xe.prototype,"needsUpdate",{set:function(t){!0===t&&this.version++}}),Object.assign(Xe.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?tn:Ke)(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 ht).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 cn.makeRotationX(t),this.applyMatrix4(cn),this},rotateY:function(t){return cn.makeRotationY(t),this.applyMatrix4(cn),this},rotateZ:function(t){return cn.makeRotationZ(t),this.applyMatrix4(cn),this},translate:function(t,e,n){return cn.makeTranslation(t,e,n),this.applyMatrix4(cn),this},scale:function(t,e,n){return cn.makeScale(t,e,n),this.applyMatrix4(cn),this},lookAt:function(t){return hn.lookAt(t),hn.updateMatrix(),this.applyMatrix4(hn.matrix),this},center:function(){return this.computeBoundingBox(),this.boundingBox.getCenter(un).negate(),this.translate(un.x,un.y,un.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],r=i.toJSON(t.data);""!==i.name&&(r.name=i.name),t.data.attributes[e]=r}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 o=this.boundingSphere;return null!==o&&(t.data.boundingSphere={center:o.center.toArray(),radius:o.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:Dn.clone(),object:t}}(t,e,n,i,xn,_n,bn,Pn);if(p){a&&(Ln.fromBufferAttribute(a,c),Rn.fromBufferAttribute(a,h),Cn.fromBufferAttribute(a,u),p.uv=Ne.getUV(Pn,xn,_n,bn,Ln,Rn,Cn,new ct)),l&&(Ln.fromBufferAttribute(l,c),Rn.fromBufferAttribute(l,h),Cn.fromBufferAttribute(l,u),p.uv2=Ne.getUV(Pn,xn,_n,bn,Ln,Rn,Cn,new ct));const t={a:c,b:h,c:u,normal:new _t,materialIndex:0};Ne.getNormal(xn,_n,bn,t.normal),p.face=t}return p}In.prototype=Object.assign(Object.create(xe.prototype),{constructor:In,isMesh:!0,copy:function(t){return xe.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(),yn.copy(n.boundingSphere),yn.applyMatrix4(r),!1===t.ray.intersectsSphere(yn))return;if(gn.copy(r).invert(),vn.copy(t.ray).applyMatrix4(gn),null!==n.boundingBox&&!1===vn.intersectsBox(n.boundingBox))return;let s;if(n.isBufferGeometry){const r=n.index,o=n.attributes.position,a=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(a/m),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},Gn.prototype=Object.assign(Object.create(xe.prototype),{constructor:Gn,isCamera:!0,copy:function(t,e){return xe.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 _t),this.updateWorldMatrix(!0,!1);const e=this.matrixWorld.elements;return t.set(-e[8],-e[9],-e[10]).normalize()},updateMatrixWorld:function(t){xe.prototype.updateMatrixWorld.call(this,t),this.matrixWorldInverse.copy(this.matrixWorld).invert()},updateWorldMatrix:function(t,e){xe.prototype.updateWorldMatrix.call(this,t,e),this.matrixWorldInverse.copy(this.matrixWorld).invert()},clone:function(){return(new this.constructor).copy(this)}}),Un.prototype=Object.assign(Object.create(Gn.prototype),{constructor:Un,isPerspectiveCamera:!0,copy:function(t,e){return Gn.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*lt.RAD2DEG*Math.atan(e),this.updateProjectionMatrix()},getFocalLength:function(){const t=Math.tan(.5*lt.DEG2RAD*this.fov);return.5*this.getFilmHeight()/t},getEffectiveFOV:function(){return 2*lt.RAD2DEG*Math.atan(Math.tan(.5*lt.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*lt.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,o=s.fullHeight;r+=s.offsetX*i/t,e-=s.offsetY*n/o,i*=s.width/t,n*=s.height/o}const o=this.filmOffset;0!==o&&(r+=t*o/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=xe.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 kn=90;class Vn extends xe{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 Un(kn,1,t,e);i.layers=this.layers,i.up.set(0,-1,0),i.lookAt(new _t(1,0,0)),this.add(i);const r=new Un(kn,1,t,e);r.layers=this.layers,r.up.set(0,-1,0),r.lookAt(new _t(-1,0,0)),this.add(r);const s=new Un(kn,1,t,e);s.layers=this.layers,s.up.set(0,0,1),s.lookAt(new _t(0,1,0)),this.add(s);const o=new Un(kn,1,t,e);o.layers=this.layers,o.up.set(0,0,-1),o.lookAt(new _t(0,-1,0)),this.add(o);const a=new Un(kn,1,t,e);a.layers=this.layers,a.up.set(0,-1,0),a.lookAt(new _t(0,0,1)),this.add(a);const l=new Un(kn,1,t,e);l.layers=this.layers,l.up.set(0,-1,0),l.lookAt(new _t(0,0,-1)),this.add(l)}update(t,e){null===this.parent&&this.updateMatrixWorld();const n=this.renderTarget,[i,r,s,o,a,l]=this.children,c=t.xr.enabled,h=t.getRenderTarget();t.xr.enabled=!1;const u=n.texture.generateMipmaps;n.texture.generateMipmaps=!1,t.setRenderTarget(n,0),t.render(e,i),t.setRenderTarget(n,1),t.render(e,r),t.setRenderTarget(n,2),t.render(e,s),t.setRenderTarget(n,3),t.render(e,o),t.setRenderTarget(n,4),t.render(e,a),n.texture.generateMipmaps=u,t.setRenderTarget(n,5),t.render(e,l),t.setRenderTarget(h),t.xr.enabled=c}}class Wn extends ft{constructor(t,e,n,i,r,o,a,l,c,h){super(t=void 0!==t?t:[],e=void 0!==e?e:s,n,i,r,o,a=void 0!==a?a:E,l,c,h),this._needsFlipEnvMap=!0,this.flipY=!1}get images(){return this.image}set images(t){this.image=t}}Wn.prototype.isCubeTexture=!0;class jn extends vt{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 Wn(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:v,this.texture._needsFlipEnvMap=!1}fromEquirectangularTexture(t,e){this.texture.type=e.type,this.texture.format=A,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 On(5,5,5),r=new Hn({name:"CubemapFromEquirect",uniforms:Bn(n.uniforms),vertexShader:n.vertexShader,fragmentShader:n.fragmentShader,side:1,blending:0});r.uniforms.tEquirect.value=e;const s=new In(i,r),o=e.minFilter;e.minFilter===x&&(e.minFilter=v);return new Vn(1,10,this).update(t,s),e.minFilter=o,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)}}jn.prototype.isWebGLCubeRenderTarget=!0;class qn extends ft{constructor(t,e,n,i,r,s,o,a,l,c,h,u){super(null,s,o,a,l,c,i,r,h,u),this.image={data:t||null,width:e||1,height:n||1},this.magFilter=void 0!==l?l:f,this.minFilter=void 0!==c?c:f,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1,this.needsUpdate=!0}}qn.prototype.isDataTexture=!0;const Xn=new Ht,Yn=new _t;class Zn{constructor(t=new Me,e=new Me,n=new Me,i=new Me,r=new Me,s=new Me){this.planes=[t,e,n,i,r,s]}set(t,e,n,i,r,s){const o=this.planes;return o[0].copy(t),o[1].copy(e),o[2].copy(n),o[3].copy(i),o[4].copy(r),o[5].copy(s),this}copy(t){const e=this.planes;for(let n=0;n<6;n++)e[n].copy(t.planes[n]);return this}setFromProjectionMatrix(t){const e=this.planes,n=t.elements,i=n[0],r=n[1],s=n[2],o=n[3],a=n[4],l=n[5],c=n[6],h=n[7],u=n[8],d=n[9],p=n[10],f=n[11],m=n[12],g=n[13],v=n[14],y=n[15];return e[0].setComponents(o-i,h-a,f-u,y-m).normalize(),e[1].setComponents(o+i,h+a,f+u,y+m).normalize(),e[2].setComponents(o+r,h+l,f+d,y+g).normalize(),e[3].setComponents(o-r,h-l,f-d,y-g).normalize(),e[4].setComponents(o-s,h-c,f-p,y-v).normalize(),e[5].setComponents(o+s,h+c,f+p,y+v).normalize(),this}intersectsObject(t){const e=t.geometry;return null===e.boundingSphere&&e.computeBoundingSphere(),Xn.copy(e.boundingSphere).applyMatrix4(t.matrixWorld),this.intersectsSphere(Xn)}intersectsSprite(t){return Xn.center.set(0,0,0),Xn.radius=.7071067811865476,Xn.applyMatrix4(t.matrixWorld),this.intersectsSphere(Xn)}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,Yn.y=i.normal.y>0?t.max.y:t.min.y,Yn.z=i.normal.z>0?t.max.z:t.min.z,i.distanceToPoint(Yn)<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 Jn(){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 Qn(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}"},ti={common:{diffuse:{value:new Ve(15658734)},opacity:{value:1},map:{value:null},uvTransform:{value:new ht},uv2Transform:{value:new ht},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 ct(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 Ve(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 Ve(15658734)},opacity:{value:1},size:{value:1},scale:{value:1},map:{value:null},alphaMap:{value:null},uvTransform:{value:new ht}},sprite:{diffuse:{value:new Ve(15658734)},opacity:{value:1},center:{value:new ct(.5,.5)},rotation:{value:0},map:{value:null},alphaMap:{value:null},uvTransform:{value:new ht}}},ei={basic:{uniforms:zn([ti.common,ti.specularmap,ti.envmap,ti.aomap,ti.lightmap,ti.fog]),vertexShader:$n.meshbasic_vert,fragmentShader:$n.meshbasic_frag},lambert:{uniforms:zn([ti.common,ti.specularmap,ti.envmap,ti.aomap,ti.lightmap,ti.emissivemap,ti.fog,ti.lights,{emissive:{value:new Ve(0)}}]),vertexShader:$n.meshlambert_vert,fragmentShader:$n.meshlambert_frag},phong:{uniforms:zn([ti.common,ti.specularmap,ti.envmap,ti.aomap,ti.lightmap,ti.emissivemap,ti.bumpmap,ti.normalmap,ti.displacementmap,ti.fog,ti.lights,{emissive:{value:new Ve(0)},specular:{value:new Ve(1118481)},shininess:{value:30}}]),vertexShader:$n.meshphong_vert,fragmentShader:$n.meshphong_frag},standard:{uniforms:zn([ti.common,ti.envmap,ti.aomap,ti.lightmap,ti.emissivemap,ti.bumpmap,ti.normalmap,ti.displacementmap,ti.roughnessmap,ti.metalnessmap,ti.fog,ti.lights,{emissive:{value:new Ve(0)},roughness:{value:1},metalness:{value:0},envMapIntensity:{value:1}}]),vertexShader:$n.meshphysical_vert,fragmentShader:$n.meshphysical_frag},toon:{uniforms:zn([ti.common,ti.aomap,ti.lightmap,ti.emissivemap,ti.bumpmap,ti.normalmap,ti.displacementmap,ti.gradientmap,ti.fog,ti.lights,{emissive:{value:new Ve(0)}}]),vertexShader:$n.meshtoon_vert,fragmentShader:$n.meshtoon_frag},matcap:{uniforms:zn([ti.common,ti.bumpmap,ti.normalmap,ti.displacementmap,ti.fog,{matcap:{value:null}}]),vertexShader:$n.meshmatcap_vert,fragmentShader:$n.meshmatcap_frag},points:{uniforms:zn([ti.points,ti.fog]),vertexShader:$n.points_vert,fragmentShader:$n.points_frag},dashed:{uniforms:zn([ti.common,ti.fog,{scale:{value:1},dashSize:{value:1},totalSize:{value:2}}]),vertexShader:$n.linedashed_vert,fragmentShader:$n.linedashed_frag},depth:{uniforms:zn([ti.common,ti.displacementmap]),vertexShader:$n.depth_vert,fragmentShader:$n.depth_frag},normal:{uniforms:zn([ti.common,ti.bumpmap,ti.normalmap,ti.displacementmap,{opacity:{value:1}}]),vertexShader:$n.normal_vert,fragmentShader:$n.normal_frag},sprite:{uniforms:zn([ti.sprite,ti.fog]),vertexShader:$n.sprite_vert,fragmentShader:$n.sprite_frag},background:{uniforms:{uvTransform:{value:new ht},t2D:{value:null}},vertexShader:$n.background_vert,fragmentShader:$n.background_frag},cube:{uniforms:zn([ti.envmap,{opacity:{value:1}}]),vertexShader:$n.cube_vert,fragmentShader:$n.cube_frag},equirect:{uniforms:{tEquirect:{value:null}},vertexShader:$n.equirect_vert,fragmentShader:$n.equirect_frag},distanceRGBA:{uniforms:zn([ti.common,ti.displacementmap,{referencePosition:{value:new _t},nearDistance:{value:1},farDistance:{value:1e3}}]),vertexShader:$n.distanceRGBA_vert,fragmentShader:$n.distanceRGBA_frag},shadow:{uniforms:zn([ti.lights,ti.fog,{color:{value:new Ve(0)},opacity:{value:1}}]),vertexShader:$n.shadow_vert,fragmentShader:$n.shadow_frag}};function ni(t,e,n,i,r){const s=new Ve(0);let o,a,l=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),l=e,p(s,l)},getClearAlpha:function(){return l},setClearAlpha:function(t){l=t,p(s,l)},render:function(n,r,f,m){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,l):g&&g.isColor&&(p(g,1),m=!0),(t.autoClear||m)&&t.clear(t.autoClearColor,t.autoClearDepth,t.autoClearStencil),g&&(g.isCubeTexture||g.mapping===c)?(void 0===a&&(a=new In(new On(1,1,1),new Hn({name:"BackgroundCubeMaterial",uniforms:Bn(ei.cube.uniforms),vertexShader:ei.cube.vertexShader,fragmentShader:ei.cube.fragmentShader,side:1,depthTest:!1,depthWrite:!1,fog:!1})),a.geometry.deleteAttribute("normal"),a.geometry.deleteAttribute("uv"),a.onBeforeRender=function(t,e,n){this.matrixWorld.copyPosition(n.matrixWorld)},Object.defineProperty(a.material,"envMap",{get:function(){return this.uniforms.envMap.value}}),i.update(a)),a.material.uniforms.envMap.value=g,a.material.uniforms.flipEnvMap.value=g.isCubeTexture&&g._needsFlipEnvMap?-1:1,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)):g&&g.isTexture&&(void 0===o&&(o=new In(new Kn(2,2),new Hn({name:"BackgroundMaterial",uniforms:Bn(ei.background.uniforms),vertexShader:ei.background.vertexShader,fragmentShader:ei.background.fragmentShader,side:0,depthTest:!1,depthWrite:!1,fog:!1})),o.geometry.deleteAttribute("normal"),Object.defineProperty(o.material,"map",{get:function(){return this.uniforms.t2D.value}}),i.update(o)),o.material.uniforms.t2D.value=g,!0===g.matrixAutoUpdate&&g.updateMatrix(),o.material.uniforms.uvTransform.value.copy(g.matrix),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))}}}function ii(t,e,n,i){const r=t.getParameter(34921),s=i.isWebGL2?null:e.get("OES_vertex_array_object"),o=i.isWebGL2||null!==s,a={},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,o=n.get(s);if(void 0===o)continue;const l=o.buffer,c=o.type,h=o.bytesPerElement;if(s.isInterleavedBufferAttribute){const n=s.data,o=n.stride,u=s.offset;n&&n.isInstancedInterleavedBuffer?(m(i,n.meshPerAttribute),void 0===a._maxInstanceCount&&(a._maxInstanceCount=n.meshPerAttribute*n.count)):f(i),t.bindBuffer(34962,l),v(i,r,c,e,o*h,u*h)}else s.isInstancedBufferAttribute?(m(i,s.meshPerAttribute),void 0===a._maxInstanceCount&&(a._maxInstanceCount=s.meshPerAttribute*s.count)):f(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,o=e.type;m(i+0,1),m(i+1,1),m(i+2,1),m(i+3,1),t.bindBuffer(34962,s),t.vertexAttribPointer(i+0,4,o,!1,64,0),t.vertexAttribPointer(i+1,4,o,!1,64,16),t.vertexAttribPointer(i+2,4,o,!1,64,32),t.vertexAttribPointer(i+3,4,o,!1,64,48)}else if("instanceColor"===e){const e=n.get(r.instanceColor);if(void 0===e)continue;const s=e.buffer,o=e.type;m(i,1),t.bindBuffer(34962,s),t.vertexAttribPointer(i,3,o,!1,12,0)}else if(void 0!==h){const n=h[e];if(void 0!==n)switch(n.length){case 2:t.vertexAttrib2fv(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 a){const e=a[t];for(const t in e){const n=e[t];for(const t in n)u(n[t].object),delete n[t];delete e[t]}delete a[t]}},releaseStatesOfGeometry:function(t){if(void 0===a[t.id])return;const e=a[t.id];for(const t in e){const n=e[t];for(const t in n)u(n[t].object),delete n[t];delete e[t]}delete a[t.id]},releaseStatesOfProgram:function(t){for(const e in a){const n=a[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:f,disableUnusedAttributes:g}}function ri(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,o,a){if(0===a)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,o,a),n.update(o,s,a)}}function si(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 o=void 0!==n.precision?n.precision:"highp";const a=r(o);a!==o&&(console.warn("THREE.WebGLRenderer:",o,"not supported, using",a,"instead."),o=a);const l=!0===n.logarithmicDepthBuffer,c=t.getParameter(34930),h=t.getParameter(35660),u=t.getParameter(3379),d=t.getParameter(34076),p=t.getParameter(34921),f=t.getParameter(36347),m=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:o,logarithmicDepthBuffer:l,maxTextures:c,maxVertexTextures:h,maxTextureSize:u,maxCubemapSize:d,maxAttributes:p,maxVertexUniforms:f,maxVaryings:m,maxFragmentUniforms:g,vertexTextures:v,floatFragmentTextures:y,floatVertexTextures:v&&y,maxSamples:s?t.getParameter(36183):0}}function oi(t){const e=this;let n=null,i=0,r=!1,s=!1;const o=new Me,a=new ht,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;a.getNormalMatrix(r),(null===c||c.length0){const o=t.getRenderTarget(),a=new jn(s.height/2);return a.fromEquirectangularTexture(t,r),e.set(r,a),t.setRenderTarget(o),r.addEventListener("dispose",i),n(a.texture,r.mapping)}return null}}}return r},dispose:function(){e=new WeakMap}}}function li(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 ci(t,e,n,i){const r={},s=new WeakMap;function o(t){const a=t.target;null!==a.index&&e.remove(a.index);for(const t in a.attributes)e.remove(a.attributes[t]);a.removeEventListener("dispose",o),delete r[a.id];const l=s.get(a);l&&(e.remove(l),s.delete(a)),i.releaseStatesOfGeometry(a),!0===a.isInstancedBufferGeometry&&delete a._maxInstanceCount,n.memory.geometries--}function a(t){const n=[],i=t.index,r=t.attributes.position;let o=0;if(null!==i){const t=i.array;o=i.version;for(let e=0,i=t.length;e65535?tn:Ke)(n,1);a.version=o;const l=s.get(t);l&&e.remove(l),s.set(t,a)}return{get:function(t,e){return!0===r[e.id]||(e.addEventListener("dispose",o),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=wi[r];if(void 0===s&&(s=new Float32Array(r),wi[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 Li(t,e){if(t.length!==e.length)return!1;for(let n=0,i=t.length;n/gm;function Sr(t){return t.replace(Mr,Tr)}function Tr(t,e){const n=$n[e];if(void 0===n)throw new Error("Can not resolve #include <"+e+">");return Sr(n)}const Er=/#pragma unroll_loop[\s]+?for \( int i \= (\d+)\; i < (\d+)\; i \+\+ \) \{([\s\S]+?)(?=\})\}/g,Ar=/#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 Lr(t){return t.replace(Ar,Cr).replace(Er,Rr)}function Rr(t,e,n,i){return console.warn("WebGLProgram: #pragma unroll_loop shader syntax is deprecated. Please use #pragma unroll_loop_start syntax instead."),Cr(t,e,n,i)}function Cr(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(_r).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")}(a),x=r.createProgram();let _,b,w=n.glslVersion?"#version "+n.glslVersion+"\n":"";n.isRawShaderMaterial?(_=[y].filter(_r).join("\n"),_.length>0&&(_+="\n"),b=[v,y].filter(_r).join("\n"),b.length>0&&(b+="\n")):(_=[Pr(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 "+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.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(_r).join("\n"),b=[v,Pr(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 "+f:"",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.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?$n.tonemapping_pars_fragment:"",0!==n.toneMapping?xr("toneMapping",n.toneMapping):"",n.dithering?"#define DITHERING":"",$n.encodings_pars_fragment,n.map?vr("mapTexelToLinear",n.mapEncoding):"",n.matcap?vr("matcapTexelToLinear",n.matcapEncoding):"",n.envMap?vr("envMapTexelToLinear",n.envMapEncoding):"",n.emissiveMap?vr("emissiveMapTexelToLinear",n.emissiveMapEncoding):"",n.lightMap?vr("lightMapTexelToLinear",n.lightMapEncoding):"",yr("linearToOutputTexel",n.outputEncoding),n.depthPacking?"#define DEPTH_PACKING "+n.depthPacking:"","\n"].filter(_r).join("\n")),l=Sr(l),l=br(l,n),l=wr(l,n),u=Sr(u),u=br(u,n),u=wr(u,n),l=Lr(l),u=Lr(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===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"+b);const M=w+b+u,S=pr(r,35633,w+_+l),T=pr(r,35632,M);if(r.attachShader(x,S),r.attachShader(x,T),void 0!==n.index0AttributeName?r.bindAttribLocation(x,0,n.index0AttributeName):!0===n.morphTargets&&r.bindAttribLocation(x,0,"position"),r.linkProgram(x),t.debug.checkShaderErrors){const t=r.getProgramInfoLog(x).trim(),e=r.getShaderInfoLog(S).trim(),n=r.getShaderInfoLog(T).trim();let i=!0,s=!0;if(!1===r.getProgramParameter(x,35714)){i=!1;const e=gr(r,S,"vertex"),n=gr(r,T,"fragment");console.error("THREE.WebGLProgram: shader error: ",r.getError(),"35715",r.getProgramParameter(x,35715),"gl.getProgramInfoLog",t,e,n)}else""!==t?console.warn("THREE.WebGLProgram: gl.getProgramInfoLog()",t):""!==e&&""!==n||(s=!1);s&&(this.diagnostics={runnable:i,programLog:t,vertexShader:{log:e,prefix:_},fragmentShader:{log:n,prefix:b}})}let E,A;return r.deleteShader(S),r.deleteShader(T),this.getUniforms=function(){return void 0===E&&(E=new dr(r,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:o.directional.length,numPointLights:o.point.length,numSpotLights:o.spot.length,numRectAreaLights:o.rectArea.length,numHemiLights:o.hemi.length,numDirLightShadows:o.directionalShadowMap.length,numPointLightShadows:o.pointShadowMap.length,numSpotLightShadows:o.spotShadowMap.length,numClippingPlanes:s.numPlanes,numClipIntersection:s.numIntersection,dithering: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:a||n.has("EXT_frag_depth"),rendererExtensionDrawBuffers:a||n.has("WEBGL_draw_buffers"),rendererExtensionShaderTextureLod:a||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||Or),r.length>1&&r.sort(e||Br)}}}function Fr(t){let e=new WeakMap;return{get:function(n,i){let r;return!1===e.has(n)?(r=new zr(t),e.set(n,[r])):i>=e.get(n).length?(r=new zr(t),e.get(n).push(r)):r=e.get(n)[i],r},dispose:function(){e=new WeakMap}}}function Hr(){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 _t,color:new Ve};break;case"SpotLight":n={position:new _t,direction:new _t,color:new Ve,distance:0,coneCos:0,penumbraCos:0,decay:0};break;case"PointLight":n={position:new _t,color:new Ve,distance:0,decay:0};break;case"HemisphereLight":n={direction:new _t,skyColor:new Ve,groundColor:new Ve};break;case"RectAreaLight":n={color:new Ve,position:new _t,halfWidth:new _t,halfHeight:new _t}}return t[e.id]=n,n}}}let Gr=0;function Ur(t,e){return(e.castShadow?1:0)-(t.castShadow?1:0)}function kr(t,e){const n=new Hr,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 ct};break;case"PointLight":n={shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new ct,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 _t);const s=new _t,o=new Yt,a=new Yt;return{setup:function(s){let o=0,a=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,f=0,m=0,g=0;s.sort(Ur);for(let t=0,e=s.length;t0&&(e.isWebGL2||!0===t.has("OES_texture_float_linear")?(r.rectAreaLTC1=ti.LTC_FLOAT_1,r.rectAreaLTC2=ti.LTC_FLOAT_2):!0===t.has("OES_texture_half_float_linear")?(r.rectAreaLTC1=ti.LTC_HALF_1,r.rectAreaLTC2=ti.LTC_HALF_2):console.error("THREE.WebGLRenderer: Unable to use RectAreaLight. Missing WebGL extensions.")),r.ambient[0]=o,r.ambient[1]=a,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===f&&v.numPointShadows===m&&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=f,r.directionalShadowMap.length=f,r.pointShadow.length=m,r.pointShadowMap.length=m,r.spotShadow.length=g,r.spotShadowMap.length=g,r.directionalShadowMatrix.length=f,r.pointShadowMatrix.length=m,r.spotShadowMatrix.length=g,v.directionalLength=c,v.pointLength=h,v.spotLength=u,v.rectAreaLength=d,v.hemiLength=p,v.numDirectionalShadows=f,v.numPointShadows=m,v.numSpotShadows=g,r.version=Gr++)},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 Vr(t,e),n.get(i).push(s)):s=n.get(i)[r],s},dispose:function(){n=new WeakMap}}}class jr 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}}jr.prototype.isMeshDepthMaterial=!0;class qr extends Be{constructor(t){super(),this.type="MeshDistanceMaterial",this.referencePosition=new _t,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}}qr.prototype.isMeshDistanceMaterial=!0;function Xr(t,e,n){let i=new Zn;const r=new ct,s=new ct,o=new gt,a=[],l=[],c={},h={0:1,1:0,2:2},u=new Hn({defines:{SAMPLE_RATE:2/8,HALF_SAMPLE_RATE:1/8},uniforms:{shadow_pass:{value:null},resolution:{value:new ct},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}"}),d=u.clone();d.defines.HORIZONTAL_PASS=1;const p=new mn;p.setAttribute("position",new Xe(new Float32Array([-1,-1,.5,3,-1,.5,-1,3,.5]),3));const m=new In(p,u),g=this;function y(n,i){const r=e.update(m);u.uniforms.shadow_pass.value=n.map.texture,u.uniforms.resolution.value=n.mapSize,u.uniforms.radius.value=n.radius,t.setRenderTarget(n.mapPass),t.clear(),t.renderBufferDirect(i,null,r,u,m,null),d.uniforms.shadow_pass.value=n.mapPass.texture,d.uniforms.resolution.value=n.mapSize,d.uniforms.radius.value=n.radius,t.setRenderTarget(n.map),t.clear(),t.renderBufferDirect(i,null,r,d,m,null)}function x(t,e,n){const i=t<<0|e<<1|n<<2;let r=a[i];return void 0===r&&(r=new jr({depthPacking:3201,morphTargets:t,skinning:e}),a[i]=r),r}function _(t,e,n){const i=t<<0|e<<1|n<<2;let r=l[i];return void 0===r&&(r=new qr({morphTargets:t,skinning:e}),l[i]=r),r}function b(e,n,i,r,s,o,a){let l=null,u=x,d=e.customDepthMaterial;if(!0===r.isPointLight&&(u=_,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=u(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===a?null!==i.shadowSide?i.shadowSide:i.side:null!==i.shadowSide?i.shadowSide:h[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=o),l}function w(n,r,s,o,a){if(!1===n.visible)return;if(n.layers.test(r.layers)&&(n.isMesh||n.isLine||n.isPoints)&&(n.castShadow||n.receiveShadow&&3===a)&&(!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;ln||r.y>n)&&(r.x>n&&(s.x=Math.floor(n/p.x),r.x=s.x*p.x,u.mapSize.x=s.x),r.y>n&&(s.y=Math.floor(n/p.y),r.y=s.y*p.y,u.mapSize.y=s.y)),null===u.map&&!u.isPointLightShadow&&3===this.type){const t={minFilter:v,magFilter:v,format:A};u.map=new vt(r.x,r.y,t),u.map.texture.name=h.name+".shadowMap",u.mapPass=new vt(r.x,r.y,t),u.camera.updateProjectionMatrix()}if(null===u.map){const t={minFilter:f,magFilter:f,format:A};u.map=new vt(r.x,r.y,t),u.map.texture.name=h.name+".shadowMap",u.camera.updateProjectionMatrix()}t.setRenderTarget(u.map),t.clear();const m=u.getViewportCount();for(let t=0;t=1):-1!==A.indexOf("OpenGL ES")&&(E=parseFloat(/^OpenGL ES (\d)/.exec(A)[1]),T=E>=2);let L=null,R={};const C=new gt,P=new gt;function D(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?lt.floorPowerOfTwo:Math.floor,s=i(r*t.width),o=i(r*t.height);void 0===P&&(P=I(s,o));const a=n?I(s,o):P;a.width=s,a.height=o;return a.getContext("2d").drawImage(t,0,0,s,o),console.warn("THREE.WebGLRenderer: Texture has been resized from ("+t.width+"x"+t.height+") to ("+s+"x"+o+")."),a}return"data"in t&&console.warn("THREE.WebGLRenderer: Image in DataTexture is too big ("+t.width+"x"+t.height+")."),t}return t}function O(t){return lt.isPowerOfTwo(t.width)&<.isPowerOfTwo(t.height)}function B(t,e){return t.generateMipmaps&&e&&t.minFilter!==f&&t.minFilter!==v}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===a)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===f||t===m||t===g?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),o.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),o.memory.textures--}let k=0;function V(t,e){const r=i.get(t);if(t.isVideoTexture&&function(t){const e=o.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 o=i.get(e);e.version>0&&o.__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 o=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]=o||l?l?i.image[t].image:i.image[t]:N(i.image[t],!1,!0,c);const u=h[0],d=O(u)||a,p=s.convert(i.format),f=s.convert(i.type),m=F(i.internalFormat,p,f);let g;if(X(34067,i,d),o){for(let t=0;t<6;t++){g=h[t].mipmaps;for(let e=0;e1||i.get(s).__currentAnisotropy)&&(t.texParameterf(n,o.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(),o.memory.textures++)}function Z(e,i,r){let o=3553;i.isDataTexture2DArray&&(o=35866),i.isDataTexture3D&&(o=32879),Y(e,i),n.activeTexture(33984+r),n.bindTexture(o,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!a&&(t.wrapS!==d||t.wrapT!==d||t.minFilter!==f&&t.minFilter!==v)}(i)&&!1===O(i.image),c=N(i.image,l,!1,h),u=O(c)||a,p=s.convert(i.format);let m,g=s.convert(i.type),y=F(i.internalFormat,p,g);X(o,i,u);const x=i.mipmaps;if(i.isDepthTexture)y=6402,a?y=i.type===M?36012:i.type===w?33190:i.type===T?35056:33189:i.type===M&&console.error("WebGLRenderer: Floating point depth texture requires WebGL2."),i.format===L&&6402===y&&i.type!==b&&i.type!==w&&(console.warn("THREE.WebGLRenderer: Use UnsignedShortType or UnsignedIntType for DepthFormat DepthTexture."),i.type=b,g=s.convert(i.type)),i.format===R&&6402===y&&(y=34041,i.type!==T&&(console.warn("THREE.WebGLRenderer: Use UnsignedInt248Type for DepthStencilFormat DepthTexture."),i.type=T,g=s.convert(i.type))),n.texImage2D(3553,0,y,c.width,c.height,0,p,g,null);else if(i.isDataTexture)if(x.length>0&&u){for(let t=0,e=x.length;t0&&u){for(let t=0,e=x.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(),o.memory.textures++;const h=!0===e.isWebGLCubeRenderTarget,u=!0===e.isWebGLMultisampleRenderTarget,d=r.isDataTexture3D||r.isDataTexture2DArray,p=O(e)||a;if(!a||r.format!==E||r.type!==M&&r.type!==S||(r.format=A,console.warn("THREE.WebGLRenderer: Rendering to textures with RGB format is not supported. Using RGBA format instead.")),h){l.__webglFramebuffer=[];for(let e=0;e<6;e++)l.__webglFramebuffer[e]=t.createFramebuffer()}else if(l.__webglFramebuffer=t.createFramebuffer(),u)if(a){l.__webglMultisampledFramebuffer=t.createFramebuffer(),l.__webglColorRenderbuffer=t.createRenderbuffer(),t.bindRenderbuffer(36161,l.__webglColorRenderbuffer);const n=s.convert(r.format),i=s.convert(r.type),o=F(r.internalFormat,n,i),a=$(e);t.renderbufferStorageMultisample(36161,a,o,e.width,e.height),t.bindFramebuffer(36160,l.__webglMultisampledFramebuffer),t.framebufferRenderbuffer(36160,36064,36161,l.__webglColorRenderbuffer),t.bindRenderbuffer(36161,null),e.depthBuffer&&(l.__webglDepthRenderbuffer=t.createRenderbuffer(),Q(l.__webglDepthRenderbuffer,e,!0)),t.bindFramebuffer(36160,null)}else console.warn("THREE.WebGLRenderer: WebGLMultisampleRenderTarget can only be used with WebGL2.");if(h){n.bindTexture(34067,c.__webglTexture),X(34067,r,p);for(let t=0;t<6;t++)J(l.__webglFramebuffer[t],e,36064,34069+t);B(r,p)&&z(34067,r,e.width,e.height),n.bindTexture(34067,null)}else{let t=3553;if(d)if(a){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),B(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(B(e,O(t)||a)){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(a){const n=i.get(e);t.bindFramebuffer(36008,n.__webglMultisampledFramebuffer),t.bindFramebuffer(36009,n.__webglFramebuffer);const r=e.width,s=e.height;let o=16384;e.depthBuffer&&(o|=256),e.stencilBuffer&&(o|=1024),t.blitFramebuffer(0,0,r,s,0,0,r,s,o,9728),t.bindFramebuffer(36160,n.__webglMultisampledFramebuffer)}else console.warn("THREE.WebGLRenderer: WebGLMultisampleRenderTarget can only be used with WebGL2.")},this.safeSetTexture2D=function(t,e){t&&t.isWebGLRenderTarget&&(!1===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 Jr(t,e,n){const i=n.isWebGL2;return{convert:function(t){let n;if(t===_)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===b)return 5123;if(1013===t)return 5124;if(t===w)return 5125;if(t===M)return 5126;if(t===S)return i?5131:(n=e.get("OES_texture_half_float"),null!==n?n.HALF_FLOAT_OES:null);if(1021===t)return 6406;if(t===E)return 6407;if(t===A)return 6408;if(1024===t)return 6409;if(1025===t)return 6410;if(t===L)return 6402;if(t===R)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===C||t===P||t===D||t===I){if(n=e.get("WEBGL_compressed_texture_s3tc"),null===n)return null;if(t===C)return n.COMPRESSED_RGB_S3TC_DXT1_EXT;if(t===P)return n.COMPRESSED_RGBA_S3TC_DXT1_EXT;if(t===D)return n.COMPRESSED_RGBA_S3TC_DXT3_EXT;if(t===I)return n.COMPRESSED_RGBA_S3TC_DXT5_EXT}if(t===N||t===O||t===B||t===z){if(n=e.get("WEBGL_compressed_texture_pvrtc"),null===n)return null;if(t===N)return n.COMPRESSED_RGB_PVRTC_4BPPV1_IMG;if(t===O)return n.COMPRESSED_RGB_PVRTC_2BPPV1_IMG;if(t===B)return n.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG;if(t===z)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===F||t===H)&&(n=e.get("WEBGL_compressed_texture_etc"),null!==n)){if(t===F)return n.COMPRESSED_RGB8_ETC2;if(t===H)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===T?i?34042:(n=e.get("WEBGL_depth_texture"),null!==n?n.UNSIGNED_INT_24_8_WEBGL:null):void 0}}}function Qr(t=[]){Un.call(this),this.cameras=t}Qr.prototype=Object.assign(Object.create(Un.prototype),{constructor:Qr,isArrayCamera:!0});class Kr extends xe{constructor(){super(),this.type="Group"}}function $r(){this._targetRay=null,this._grip=null,this._hand=null}function ts(t,e){const n=this;let i=null,r=1,s=null,o="local-floor",a=null;const l=[],c=new Map,h=new Un;h.layers.enable(1),h.viewport=new gt;const u=new Un;u.layers.enable(2),u.viewport=new gt;const d=[h,u],p=new Qr;p.layers.enable(1),p.layers.enable(2);let f=null,m=null;function g(t){const e=c.get(t.inputSource);e&&e.dispatchEvent({type:t.type,data:t.inputSource})}function v(){c.forEach((function(t,e){t.disconnect(e)})),c.clear(),f=null,m=null,t.setFramebuffer(null),t.setRenderTarget(t.getRenderTarget()),M.stop(),n.isPresenting=!1,n.dispatchEvent({type:"sessionend"})}function y(t){const e=i.inputSources;for(let t=0;t0&&Ct(s,t,e),o.length>0&&Ct(o,t,e),null!==b&&(K.updateRenderTargetMipmap(b),K.updateMultisampleRenderTarget(b)),!0===t.isScene&&t.onAfterRender(m,t,e),Z.buffers.depth.setTest(!0),Z.buffers.depth.setMask(!0),Z.buffers.color.setMask(!0),Z.setPolygonOffset(!1),f.pop(),d=f.length>0?f[f.length-1]:null,p.pop(),u=p.length>0?p[p.length-1]:null},this.setFramebuffer=function(t){v!==t&&null===b&&vt.bindFramebuffer(36160,t),v=t},this.getActiveCubeFace=function(){return y},this.getActiveMipmapLevel=function(){return x},this.getRenderTarget=function(){return b},this.setRenderTarget=function(t,e=0,n=0){b=t,y=e,x=n,t&&void 0===Q.get(t).__webglFramebuffer&&K.setupRenderTarget(t);let i=v,r=!1,s=!1;if(t){const n=t.texture;(n.isDataTexture3D||n.isDataTexture2DArray)&&(s=!0);const o=Q.get(t).__webglFramebuffer;t.isWebGLCubeRenderTarget?(i=o[e],r=!0):i=t.isWebGLMultisampleRenderTarget?Q.get(t).__webglMultisampledFramebuffer:o,L.copy(t.viewport),R.copy(t.scissor),C=t.scissorTest}else L.copy(B).multiplyScalar(I).floor(),R.copy(z).multiplyScalar(I).floor(),C=F;if(w!==i&&(vt.bindFramebuffer(36160,i),w=i),Z.viewport(L),Z.scissor(R),Z.setScissorTest(C),r){const i=Q.get(t.texture);vt.framebufferTexture2D(36160,36064,34069+e,i.__webglTexture,n)}else if(s){const i=Q.get(t.texture),r=e||0;vt.framebufferTextureLayer(36160,36064,i.__webglTexture,n||0,r)}},this.readRenderTargetPixels=function(t,e,n,i,r,s,o){if(!t||!t.isWebGLRenderTarget)return void console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");let a=Q.get(t).__webglFramebuffer;if(t.isWebGLCubeRenderTarget&&void 0!==o&&(a=a[o]),a){let o=!1;a!==w&&(vt.bindFramebuffer(36160,a),o=!0);try{const a=t.texture,l=a.format,c=a.type;if(l!==A&&ft.convert(l)!==vt.getParameter(35739))return void console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in RGBA or implementation defined format.");const h=c===S&&(q.has("EXT_color_buffer_half_float")||X.isWebGL2&&q.has("EXT_color_buffer_float"));if(!(c===_||ft.convert(c)===vt.getParameter(35738)||c===M&&(X.isWebGL2||q.has("OES_texture_float")||q.has("WEBGL_color_buffer_float"))||h))return void console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in UnsignedByteType or implementation defined type.");36053===vt.checkFramebufferStatus(36160)?e>=0&&e<=t.width-i&&n>=0&&n<=t.height-r&&vt.readPixels(e,n,i,r,ft.convert(l),ft.convert(c),s):console.error("THREE.WebGLRenderer.readRenderTargetPixels: readPixels from renderTarget failed. Framebuffer not complete.")}finally{o&&vt.bindFramebuffer(36160,w)}}},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),o=ft.convert(e.format);K.setTexture2D(e,0),vt.copyTexImage2D(3553,n,o,t.x,t.y,r,s,0),Z.unbindTexture()},this.copyTextureToTexture=function(t,e,n,i=0){const r=e.image.width,s=e.image.height,o=ft.convert(n.format),a=ft.convert(n.type);K.setTexture2D(n,0),vt.pixelStorei(37440,n.flipY),vt.pixelStorei(37441,n.premultiplyAlpha),vt.pixelStorei(3317,n.unpackAlignment),e.isDataTexture?vt.texSubImage2D(3553,i,t.x,t.y,r,s,o,a,e.image.data):e.isCompressedTexture?vt.compressedTexSubImage2D(3553,i,t.x,t.y,e.mipmaps[0].width,e.mipmaps[0].height,o,e.mipmaps[0].data):vt.texSubImage2D(3553,i,t.x,t.y,o,a,e.image),0===i&&n.generateMipmaps&&vt.generateMipmap(3553),Z.unbindTexture()},this.copyTextureToTexture3D=function(t,e,n,i,r=0){if(m.isWebGL1Renderer)return void console.warn("THREE.WebGLRenderer.copyTextureToTexture3D: can only be used with WebGL2.");const{width:s,height:o,data:a}=n.image,l=ft.convert(i.format),c=ft.convert(i.type);let h;if(i.isDataTexture3D)K.setTexture3D(i,0),h=32879;else{if(!i.isDataTexture2DArray)return void console.warn("THREE.WebGLRenderer.copyTextureToTexture3D: only supports THREE.DataTexture3D and THREE.DataTexture2DArray.");K.setTexture2DArray(i,0),h=35866}vt.pixelStorei(37440,i.flipY),vt.pixelStorei(37441,i.premultiplyAlpha),vt.pixelStorei(3317,i.unpackAlignment);const u=vt.getParameter(3314),d=vt.getParameter(32878),p=vt.getParameter(3316),f=vt.getParameter(3315),g=vt.getParameter(32877);vt.pixelStorei(3314,s),vt.pixelStorei(32878,o),vt.pixelStorei(3316,t.min.x),vt.pixelStorei(3315,t.min.y),vt.pixelStorei(32877,t.min.z),vt.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,a),vt.pixelStorei(3314,u),vt.pixelStorei(32878,d),vt.pixelStorei(3316,p),vt.pixelStorei(3315,f),vt.pixelStorei(32877,g),0===r&&i.generateMipmaps&&vt.generateMipmap(h),Z.unbindTexture()},this.initTexture=function(t){K.setTexture2D(t,0),Z.unbindTexture()},this.resetState=function(){Z.reset(),mt.reset()},"undefined"!=typeof __THREE_DEVTOOLS__&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}Kr.prototype.isGroup=!0,Object.assign($r.prototype,{constructor:$r,getHandSpace:function(){return null===this._hand&&(this._hand=new Kr,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 Kr,this._targetRay.matrixAutoUpdate=!1,this._targetRay.visible=!1),this._targetRay},getGripSpace:function(){return null===this._grip&&(this._grip=new Kr,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 o=this._targetRay,a=this._grip,l=this._hand;if(t&&"visible-blurred"!==e.session.visibilityState)if(null!==o&&(i=e.getPose(t.targetRaySpace,n),null!==i&&(o.matrix.fromArray(i.transform.matrix),o.matrix.decompose(o.position,o.rotation,o.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 Kr;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"],o=i.position.distanceTo(r.position),a=.02,c=.005;l.inputState.pinching&&o>a+c?(l.inputState.pinching=!1,this.dispatchEvent({type:"pinchend",handedness:t.handedness,target:this})):!l.inputState.pinching&&o<=a-c&&(l.inputState.pinching=!0,this.dispatchEvent({type:"pinchstart",handedness:t.handedness,target:this}))}else null!==a&&t.gripSpace&&(r=e.getPose(t.gripSpace,n),null!==r&&(a.matrix.fromArray(r.transform.matrix),a.matrix.decompose(a.position,a.rotation,a.scale)));return null!==o&&(o.visible=null!==i),null!==a&&(a.visible=null!==r),null!==l&&(l.visible=null!==s),this}}),Object.assign(ts.prototype,st.prototype);class is extends ns{}is.prototype.isWebGL1Renderer=!0;class rs{constructor(t,e){this.name="",this.color=new Ve(t),this.density=void 0!==e?e:25e-5}clone(){return new rs(this.color,this.density)}toJSON(){return{type:"FogExp2",color:this.color.getHex(),density:this.density}}}rs.prototype.isFogExp2=!0;class ss{constructor(t,e,n){this.name="",this.color=new Ve(t),this.near=void 0!==e?e:1,this.far=void 0!==n?n:1e3}clone(){return new ss(this.color,this.near,this.far)}toJSON(){return{type:"Fog",color:this.color.getHex(),near:this.near,far:this.far}}}ss.prototype.isFog=!0;class os extends xe{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=nt,this.updateRange={offset:0,count:-1},this.version=0,this.uuid=lt.generateUUID()}os.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:a,point:ds.clone(),uv:Ne.getUV(ds,ys,xs,_s,bs,ws,Ms,new ct),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 Ts(t,e,n,i,r,s){ms.subVectors(t,n).addScalar(.5).multiply(i),void 0!==r?(gs.x=s*ms.x-r*ms.y,gs.y=r*ms.x+s*ms.y):gs.copy(ms),t.copy(e),t.x+=gs.x,t.y+=gs.y,t.applyMatrix4(vs)}Ss.prototype.isSprite=!0;const Es=new _t,As=new _t;class Ls extends xe{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){Es.setFromMatrixPosition(this.matrixWorld);const n=t.ray.origin.distanceTo(Es);this.getObjectForDistance(n).raycast(t,e)}}update(t){const e=this.levels;if(e.length>1){Es.setFromMatrixPosition(t.matrixWorld),As.setFromMatrixPosition(this.matrixWorld);const n=Es.distanceTo(As)/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;h.applyMatrix4(this.matrixWorld);const d=t.ray.origin.distanceTo(h);dt.far||e.push({distance:d,point:c.clone().applyMatrix4(this.matrixWorld),index:i,face:null,faceIndex:null,object:this})}}else for(let n=0,i=r.count-1;no)continue;h.applyMatrix4(this.matrixWorld);const i=t.ray.origin.distanceTo(h);it.far||e.push({distance:i,point:c.clone().applyMatrix4(this.matrixWorld),index:n,face:null,faceIndex:null,object:this})}}else n.isGeometry&&console.error("THREE.Line.raycast() no longer supports THREE.Geometry. Use THREE.BufferGeometry instead.")},updateMorphTargets:function(){const t=this.geometry;if(t.isBufferGeometry){const e=t.morphAttributes,n=Object.keys(e);if(n.length>0){const t=e[n[0]];if(void 0!==t){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let e=0,n=t.length;e0&&console.error("THREE.Line.updateMorphTargets() does not support THREE.Geometry. Use THREE.BufferGeometry instead.")}}});const Qs=new _t,Ks=new _t;function $s(t,e){Js.call(this,t,e),this.type="LineSegments"}$s.prototype=Object.assign(Object.create(Js.prototype),{constructor:$s,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(a),point:n,index:e,face:null,object:o})}}oo.prototype=Object.assign(Object.create(xe.prototype),{constructor:oo,isPoints:!0,copy:function(t){return xe.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;if(null===n.boundingSphere&&n.computeBoundingSphere(),ro.copy(n.boundingSphere),ro.applyMatrix4(i),ro.radius+=r,!1===t.ray.intersectsSphere(ro))return;no.copy(i).invert(),io.copy(t.ray).applyMatrix4(no);const s=r/((this.scale.x+this.scale.y+this.scale.z)/3),o=s*s;if(n.isBufferGeometry){const r=n.index,s=n.attributes.position;if(null!==r){const n=r.array;for(let r=0,a=n.length;r0){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 lo extends ft{constructor(t,e,n,i,r,s,o,a,l){super(t,e,n,i,r,s,o,a,l),this.format=void 0!==o?o:E,this.minFilter=void 0!==s?s:v,this.magFilter=void 0!==r?r:v,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)}}lo.prototype.isVideoTexture=!0;class co extends ft{constructor(t,e,n,i,r,s,o,a,l,c,h,u){super(null,s,o,a,l,c,i,r,h,u),this.image={width:e,height:n},this.mipmaps=t,this.flipY=!1,this.generateMipmaps=!1}}co.prototype.isCompressedTexture=!0;class ho extends ft{constructor(t,e,n,i,r,s,o,a,l){super(t,e,n,i,r,s,o,a,l),this.needsUpdate=!0}}ho.prototype.isCanvasTexture=!0;class uo extends ft{constructor(t,e,n,i,r,s,o,a,l,c){if((c=void 0!==c?c:L)!==L&&c!==R)throw new Error("DepthTexture format must be either THREE.DepthFormat or THREE.DepthStencilFormat");void 0===n&&c===L&&(n=b),void 0===n&&c===R&&(n=T),super(null,i,r,s,o,a,c,n,l),this.image={width:t,height:e},this.magFilter=void 0!==o?o:f,this.minFilter=void 0!==a?a:f,this.flipY=!1,this.generateMipmaps=!1}}uo.prototype.isDepthTexture=!0;class po 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=[],o=[],a=[],l=new _t,c=new ct;s.push(0,0,0),o.push(0,0,1),a.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),o.push(0,0,1),c.x=(s[h]/t+1)/2,c.y=(s[h+1]/t+1)/2,a.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 nn(s,3)),this.setAttribute("normal",new nn(o,3)),this.setAttribute("uv",new nn(a,2))}}class fo extends mn{constructor(t=1,e=1,n=1,i=8,r=1,s=!1,o=0,a=2*Math.PI){super(),this.type="CylinderGeometry",this.parameters={radiusTop:t,radiusBottom:e,height:n,radialSegments:i,heightSegments:r,openEnded:s,thetaStart:o,thetaLength:a};const l=this;i=Math.floor(i),r=Math.floor(r);const c=[],h=[],u=[],d=[];let p=0;const f=[],m=n/2;let g=0;function v(n){const r=p,s=new ct,f=new _t;let v=0;const y=!0===n?t:e,x=!0===n?1:-1;for(let t=1;t<=i;t++)h.push(0,m*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*a+o,n=Math.cos(e),r=Math.sin(e);f.x=y*r,f.y=m*x,f.z=y*n,h.push(f.x,f.y,f.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 nn(h,3)),this.setAttribute("normal",new nn(u,3)),this.setAttribute("uv",new nn(d,2))}}class mo extends fo{constructor(t=1,e=1,n=8,i=1,r=!1,s=0,o=2*Math.PI){super(0,t,e,n,i,r,s,o),this.type="ConeGeometry",this.parameters={radius:t,height:e,radialSegments:n,heightSegments:i,openEnded:r,thetaStart:s,thetaLength:o}}}class go 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 o(t,e,n,i){const r=i+1,s=[];for(let i=0;i<=r;i++){s[i]=[];const o=t.clone().lerp(n,i/r),a=e.clone().lerp(n,i/r),l=r-i;for(let t=0;t<=l;t++)s[i][t]=0===t&&i===r?o:o.clone().lerp(a,t/l)}for(let t=0;t.9&&o<.1&&(e<.2&&(s[t+0]+=1),n<.2&&(s[t+2]+=1),i<.2&&(s[t+4]+=1))}}()}(),this.setAttribute("position",new nn(r,3)),this.setAttribute("normal",new nn(r.slice(),3)),this.setAttribute("uv",new nn(s,2)),0===i?this.computeVertexNormals():this.normalizeNormals()}}class vo extends go{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 yo=new _t,xo=new _t,_o=new _t,bo=new Ne;class wo 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(lt.DEG2RAD*e),r=t.getIndex(),s=t.getAttribute("position"),o=r?r.count:s.count,a=[0,0,0],l=["a","b","c"],c=new Array(3),h={},u=[];for(let t=0;t80*n){a=c=t[0],l=h=t[1];for(let e=n;ec&&(c=u),d>h&&(h=d);p=Math.max(c-a,h-l),p=0!==p?1/p:0}return Eo(s,o,n,a,l,p),o};function So(t,e,n,i,r){let s,o;if(r===function(t,e,n,i){let r=0;for(let s=e,o=n-i;s0)for(s=e;s=e;s-=i)o=jo(s,t[s],t[s+1],o);return o&&Ho(o,o.next)&&(qo(o),o=o.next),o}function To(t,e){if(!t)return t;e||(e=t);let n,i=t;do{if(n=!1,i.steiner||!Ho(i,i.next)&&0!==Fo(i.prev,i,i.next))i=i.next;else{if(qo(i),i=e=i.prev,i===i.next)break;n=!0}}while(n||i!==e);return e}function Eo(t,e,n,i,r,s,o){if(!t)return;!o&&s&&function(t,e,n,i){let r=t;do{null===r.z&&(r.z=No(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,o,a,l,c=1;do{for(n=t,t=null,s=null,o=0;n;){for(o++,i=n,a=0,e=0;e0||l>0&&i;)0!==a&&(0===l||!i||n.z<=i.z)?(r=n,n=n.nextZ,a--):(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(o>1)}(r)}(t,i,r,s);let a,l,c=t;for(;t.prev!==t.next;)if(a=t.prev,l=t.next,s?Lo(t,i,r,s):Ao(t))e.push(a.i/n),e.push(t.i/n),e.push(l.i/n),qo(t),t=l.next,c=l.next;else if((t=l)===c){o?1===o?Eo(t=Ro(To(t),e,n),e,n,i,r,s,2):2===o&&Co(t,e,n,i,r,s):Eo(To(t),e,n,i,r,s,1);break}}function Ao(t){const e=t.prev,n=t,i=t.next;if(Fo(e,n,i)>=0)return!1;let r=t.next.next;for(;r!==t.prev;){if(Bo(e.x,e.y,n.x,n.y,i.x,i.y,r.x,r.y)&&Fo(r.prev,r,r.next)>=0)return!1;r=r.next}return!0}function Lo(t,e,n,i){const r=t.prev,s=t,o=t.next;if(Fo(r,s,o)>=0)return!1;const a=r.xs.x?r.x>o.x?r.x:o.x:s.x>o.x?s.x:o.x,h=r.y>s.y?r.y>o.y?r.y:o.y:s.y>o.y?s.y:o.y,u=No(a,l,e,n,i),d=No(c,h,e,n,i);let p=t.prevZ,f=t.nextZ;for(;p&&p.z>=u&&f&&f.z<=d;){if(p!==t.prev&&p!==t.next&&Bo(r.x,r.y,s.x,s.y,o.x,o.y,p.x,p.y)&&Fo(p.prev,p,p.next)>=0)return!1;if(p=p.prevZ,f!==t.prev&&f!==t.next&&Bo(r.x,r.y,s.x,s.y,o.x,o.y,f.x,f.y)&&Fo(f.prev,f,f.next)>=0)return!1;f=f.nextZ}for(;p&&p.z>=u;){if(p!==t.prev&&p!==t.next&&Bo(r.x,r.y,s.x,s.y,o.x,o.y,p.x,p.y)&&Fo(p.prev,p,p.next)>=0)return!1;p=p.prevZ}for(;f&&f.z<=d;){if(f!==t.prev&&f!==t.next&&Bo(r.x,r.y,s.x,s.y,o.x,o.y,f.x,f.y)&&Fo(f.prev,f,f.next)>=0)return!1;f=f.nextZ}return!0}function Ro(t,e,n){let i=t;do{const r=i.prev,s=i.next.next;!Ho(r,s)&&Go(r,i,i.next,s)&&Vo(r,s)&&Vo(s,r)&&(e.push(r.i/n),e.push(i.i/n),e.push(s.i/n),qo(i),qo(i.next),i=t=s),i=i.next}while(i!==t);return To(i)}function Co(t,e,n,i,r,s){let o=t;do{let t=o.next.next;for(;t!==o.prev;){if(o.i!==t.i&&zo(o,t)){let a=Wo(o,t);return o=To(o,o.next),a=To(a,a.next),Eo(o,e,n,i,r,s),void Eo(a,e,n,i,r,s)}t=t.next}o=o.next}while(o!==t)}function Po(t,e){return t.x-e.x}function Do(t,e){if(e=function(t,e){let n=e;const i=t.x,r=t.y;let s,o=-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>o){if(o=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&&Bo(rs.x||n.x===s.x&&Io(s,n)))&&(s=n,u=h)),n=n.next}while(n!==a);return s}(t,e)){const n=Wo(e,t);To(e,e.next),To(n,n.next)}}function Io(t,e){return Fo(t.prev,t,e.prev)<0&&Fo(e.next,t,t.next)<0}function No(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 Oo(t){let e=t,n=t;do{(e.x=0&&(t-o)*(i-a)-(n-o)*(e-a)>=0&&(n-o)*(s-a)-(r-o)*(i-a)>=0}function zo(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&&Go(n,n.next,t,e))return!0;n=n.next}while(n!==t);return!1}(t,e)&&(Vo(t,e)&&Vo(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)&&(Fo(t.prev,t,e.prev)||Fo(t,e.prev,e))||Ho(t,e)&&Fo(t.prev,t,t.next)>0&&Fo(e.prev,e,e.next)>0)}function Fo(t,e,n){return(e.y-t.y)*(n.x-e.x)-(e.x-t.x)*(n.y-e.y)}function Ho(t,e){return t.x===e.x&&t.y===e.y}function Go(t,e,n,i){const r=ko(Fo(t,e,n)),s=ko(Fo(t,e,i)),o=ko(Fo(n,i,t)),a=ko(Fo(n,i,e));return r!==s&&o!==a||(!(0!==r||!Uo(t,n,e))||(!(0!==s||!Uo(t,i,e))||(!(0!==o||!Uo(n,t,i))||!(0!==a||!Uo(n,e,i)))))}function Uo(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 ko(t){return t>0?1:t<0?-1:0}function Vo(t,e){return Fo(t.prev,t,t.next)<0?Fo(t,e,t.next)>=0&&Fo(t,t.prev,e)>=0:Fo(t,e,t.prev)<0||Fo(t,t.next,e)<0}function Wo(t,e){const n=new Xo(t.i,t.x,t.y),i=new Xo(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 jo(t,e,n,i){const r=new Xo(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 qo(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 Xo(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 Yo={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 Jo(t,e){for(let n=0;nNumber.EPSILON){const u=Math.sqrt(h),d=Math.sqrt(l*l+c*c),p=e.x-a/u,f=e.y+o/u,m=((n.x-c/d-p)*c-(n.y+l/d-f)*l)/(o*c-a*l);i=p+o*m-t.x,r=f+a*m-t.y;const g=i*i+r*r;if(g<=2)return new ct(i,r);s=Math.sqrt(g/2)}else{let t=!1;o>Number.EPSILON?l>Number.EPSILON&&(t=!0):o<-Number.EPSILON?l<-Number.EPSILON&&(t=!0):Math.sign(a)===Math.sign(c)&&(t=!0),t?(i=-a,r=o,s=Math.sqrt(h)):(i=o,r=a,s=Math.sqrt(h/2))}return new ct(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=a+2*p;t=0?(t(i-a,p,h),u.subVectors(c,h)):(t(i+a,p,h),u.subVectors(h,c)),p-a>=0?(t(i,p-a,h),d.subVectors(c,h)):(t(i,p+a,h),d.subVectors(h,c)),l.crossVectors(u,d).normalize(),s.push(l.x,l.y,l.z),o.push(i,p)}}for(let t=0;t0)&&d.push(e,r,l),(t!==n-1||a=i)){l.push(e.times[t]);for(let n=0;ns.tracks[t].times[0]&&(a=s.tracks[t].times[0]);for(let t=0;t=i.times[u]){const t=u*l+a,e=t+l-a;d=Sa.arraySlice(i.values,t,e)}else{const t=i.createInterpolant(),e=a,n=l-a;t.evaluate(s),d=Sa.arraySlice(t.resultBuffer,e,n)}if("quaternion"===r){(new xt).fromArray(d).normalize().conjugate().toArray(d)}const p=o.times.length;for(let t=0;t=r)break t;{const o=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=Sa.arraySlice(n,r,s),this.values=Sa.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&&Sa.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=Sa.arraySlice(this.times),e=Sa.arraySlice(this.values),n=this.getValueSize(),i=this.getInterpolation()===k,r=t.length-1;let s=1;for(let o=1;o0){t[s]=t[r];for(let t=r*n,i=s*n,o=0;o!==n;++o)e[i+o]=e[t+o];++s}return s!==t.length?(this.times=Sa.arraySlice(t,0,s),this.values=Sa.arraySlice(e,0,s*n)):(this.times=t,this.values=e),this}clone(){const t=Sa.arraySlice(this.times,0),e=Sa.arraySlice(this.values,0),n=new(0,this.constructor)(this.name,t,e);return n.createInterpolant=this.createInterpolant,n}}Ra.prototype.TimeBufferType=Float32Array,Ra.prototype.ValueBufferType=Float32Array,Ra.prototype.DefaultInterpolation=U;class Ca extends Ra{}Ca.prototype.ValueTypeName="bool",Ca.prototype.ValueBufferType=Array,Ca.prototype.DefaultInterpolation=G,Ca.prototype.InterpolantFactoryMethodLinear=void 0,Ca.prototype.InterpolantFactoryMethodSmooth=void 0;class Pa extends Ra{}Pa.prototype.ValueTypeName="color";class Da extends Ra{}function Ia(t,e,n,i){Ta.call(this,t,e,n,i)}Da.prototype.ValueTypeName="number",Ia.prototype=Object.assign(Object.create(Ta.prototype),{constructor:Ia,interpolate_:function(t,e,n,i){const r=this.resultBuffer,s=this.sampleValues,o=this.valueSize,a=(n-e)/(i-e);let l=t*o;for(let t=l+o;l!==t;l+=4)xt.slerpFlat(r,0,s,l-o,s,l,a);return r}});class Na extends Ra{InterpolantFactoryMethodLinear(t){return new Ia(this.times,this.values,this.getValueSize(),t)}}Na.prototype.ValueTypeName="quaternion",Na.prototype.DefaultInterpolation=U,Na.prototype.InterpolantFactoryMethodSmooth=void 0;class Oa extends Ra{}Oa.prototype.ValueTypeName="string",Oa.prototype.ValueBufferType=Array,Oa.prototype.DefaultInterpolation=G,Oa.prototype.InterpolantFactoryMethodLinear=void 0,Oa.prototype.InterpolantFactoryMethodSmooth=void 0;class Ba extends Ra{}Ba.prototype.ValueTypeName="vector";class za{constructor(t,e=-1,n,i=2500){this.name=t,this.tracks=n,this.duration=e,this.blendMode=i,this.uuid=lt.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(Fa(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(Ra.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=[],o=[];Sa.flattenJSON(n,s,o,i),0!==s.length&&r.push(new t(e,s,o))}},i=[],r=t.name||"default",s=t.fps||30,o=t.blendMode;let a=t.length||-1;const l=t.hierarchy||[];for(let t=0;t0||0===t.search(/^data\:image\/jpeg/);r.format=i?E:A,r.needsUpdate=!0,void 0!==e&&e(r)}),n,i),r}}),Object.assign(Ja.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 o,a=0,l=r-1;for(;a<=l;)if(i=Math.floor(a+(l-a)/2),o=n[i]-s,o<0)a=i+1;else{if(!(o>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),o=this.getPoint(r),a=e||(s.isVector2?new ct:new _t);return a.copy(o).sub(s).normalize(),a},getTangentAt:function(t,e){const n=this.getUtoTmapping(t);return this.getTangent(n,e)},computeFrenetFrames:function(t,e){const n=new _t,i=[],r=[],s=[],o=new _t,a=new Yt;for(let e=0;e<=t;e++){const n=e/t;i[e]=this.getTangentAt(n,new _t),i[e].normalize()}r[0]=new _t,s[0]=new _t;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),o.crossVectors(i[0],n).normalize(),r[0].crossVectors(i[0],o),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(),o.crossVectors(i[e-1],i[e]),o.length()>Number.EPSILON){o.normalize();const t=Math.acos(lt.clamp(i[e-1].dot(i[e]),-1,1));r[e].applyMatrix4(a.makeRotationAxis(o,t))}s[e].crossVectors(i[e],r[e])}if(!0===e){let e=Math.acos(lt.clamp(r[0].dot(r[t]),-1,1));e/=t,i[0].dot(o.crossVectors(r[0],r[t]))>0&&(e=-e);for(let n=1;n<=t;n++)r[n].applyMatrix4(a.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 Qa extends Ja{constructor(t=0,e=0,n=1,i=1,r=0,s=2*Math.PI,o=!1,a=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=o,this.aRotation=a}getPoint(t,e){const n=e||new ct,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?o=i[(l-1)%r]:(tl.subVectors(i[0],i[1]).add(i[0]),o=tl);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(sl(o,a.x,l.x,c.x,h.x),sl(o,a.y,l.y,c.y,h.y)),n}copy(t){super.copy(t),this.points=[];for(let e=0,n=t.points.length;e=e){const t=n[i]-e,r=this.curves[i],s=r.getLength(),o=0===s?0:1-t/s;return r.getPointAt(o)}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 yl extends vl{constructor(t){super(t),this.uuid=lt.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 Ve).setHex(r.value);break;case"v2":i.uniforms[e].value=(new ct).fromArray(r.value);break;case"v3":i.uniforms[e].value=(new _t).fromArray(r.value);break;case"v4":i.uniforms[e].value=(new gt).fromArray(r.value);break;case"m3":i.uniforms[e].value=(new ht).fromArray(r.value);break;case"m4":i.uniforms[e].value=(new Yt).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 ct).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 ct).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 Gl={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],a=-a,o=e[r],l=-l),t.yo.y)continue;if(t.y===n.y){if(t.x===n.x)return!0}else{const e=l*(t.x-n.x)-a*(t.y-n.y);if(0===e)return!0;if(e<0)continue;i=!i}}else{if(t.y!==n.y)continue;if(o.x<=t.x&&t.x<=n.x||n.x<=t.x&&t.x<=o.x)return!0}}return i}const r=Yo.isClockWise,s=this.subPaths;if(0===s.length)return[];if(!0===e)return n(s);let o,a,l;const c=[];if(1===s.length)return a=s[0],l=new yl,l.curves=a.curves,c.push(l),c;let h=!r(s[0].getPoints());h=t?!h:h;const u=[],d=[];let p,f,m=[],g=0;d[g]=void 0,m[g]=[];for(let e=0,n=s.length;e1){let t=!1;const e=[];for(let t=0,e=d.length;t0&&(t||(m=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]){o.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){xt.slerpFlat(t,e,t,e,t,n,i)}_slerpAdditive(t,e,n,i,r){const s=this._workIndex*r;xt.multiplyQuaternionsFlat(t,s,t,e,t,n),xt.slerpFlat(t,e,t,e,t,s,i)}_lerp(t,e,n,i,r){const s=1-i;for(let o=0;o!==r;++o){const r=e+o;t[r]=t[r]*s+t[n+o]*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 vc="\\[\\]\\.:\\/",yc=new RegExp("[\\[\\]\\.:\\/]","g"),xc="[^\\[\\]\\.:\\/]",_c="[^"+vc.replace("\\.","")+"]",bc=/((?:WC+[\/:])*)/.source.replace("WC",xc),wc=/(WCOD+)?/.source.replace("WCOD",_c),Mc=/(?:\.(WC+)(?:\[(.+)\])?)?/.source.replace("WC",xc),Sc=/\.(WC+)(?:\[(.+)\])?/.source.replace("WC",xc),Tc=new RegExp("^"+bc+wc+Mc+Sc+"$"),Ec=["material","materials","bones"];function Ac(t,e,n){const i=n||Lc.parseTrackName(e);this._targetGroup=t,this._bindings=t.subscribe_(e,i)}function Lc(t,e,n){this.path=e,this.parsedPath=n||Lc.parseTrackName(e),this.node=Lc.findNode(t,this.parsedPath.nodeName)||t,this.rootNode=t}Object.assign(Ac.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(Lc,{Composite:Ac,create:function(t,e,n){return t&&t.isAnimationObjectGroup?new Lc.Composite(t,e,n):new Lc(t,e,n)},sanitizeNodeName:function(t){return t.replace(/\s/g,"_").replace(yc,"")},parseTrackName:function(t){const e=Tc.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!==Ec.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[a]=s,t[s]=o;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 o=0,a=arguments.length;o!==a;++o){const a=arguments[o].uuid,l=e[a];if(void 0!==l)if(delete e[a],l0&&(e[o.uuid]=l),t[l]=o,t.pop();for(let t=0,e=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,o=this._parsedPaths,a=this._objects,l=a.length,c=this.nCachedObjects_,h=new Array(l);i=r.length,n[t]=i,s.push(t),o.push(e),r.push(h);for(let n=c,i=a.length;n!==i;++n){const i=a[n];h[n]=new Lc(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,o=s.length-1,a=s[o];e[t[o]]=n,s[n]=a,s.pop(),r[n]=r[o],r.pop(),i[n]=i[o],i.pop()}}}Rc.prototype.isAnimationObjectGroup=!0;class Cc{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,o=new Array(s),a={endingStart:V,endingEnd:V};for(let t=0;t!==s;++t){const e=r[t].createInterpolant(null);o[t]=e,e.settings=a}this._interpolantSettings=a,this._interpolants=o,this._propertyBindings=new Array(s),this._cacheIndex=null,this._byClipCacheIndex=null,this._timeScaleInterpolant=null,this._weightInterpolant=null,this.loop=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 o=this._timeScaleInterpolant;null===o&&(o=i._lendControlInterpolant(),this._timeScaleInterpolant=o);const a=o.parameterPositions,l=o.sampleValues;return a[0]=r,a[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),o=this._updateWeight(t);if(o>0){const t=this._interpolants,e=this._propertyBindings;switch(this.blendMode){case X:for(let n=0,i=t.length;n!==i;++n)t[n].evaluate(s),e[n].accumulateAdditive(o);break;case q:default:for(let n=0,r=t.length;n!==r;++n)t[n].evaluate(s),e[n].accumulate(i,o)}}}_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 o=this.repetitions-r;if(o<=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===o){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=W,i.endingEnd=W):(i.endingStart=t?this.zeroSlopeAtStart?W:V:j,i.endingEnd=e?this.zeroSlopeAtEnd?W:V:j)}_scheduleFading(t,e,n){const i=this._mixer,r=i.time;let s=this._weightInterpolant;null===s&&(s=i._lendControlInterpolant(),this._weightInterpolant=s);const o=s.parameterPositions,a=s.sampleValues;return o[0]=r,a[0]=e,o[1]=r+t,a[1]=n,this}}class Pc extends st{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,o=t._interpolants,a=n.uuid,l=this._bindingsByRootAndName;let c=l[a];void 0===c&&(c={},l[a]=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,a,l));continue}const i=e&&e._propertyBindings[t].binding.parsedPath;h=new gc(Lc.create(n,l,i),r.ValueTypeName,r.getValueSize()),++h.referenceCount,this._addInactiveBinding(h,a,l),s[t]=h}o[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 o=0;o!==n;++o){e[o]._update(i,t,r,s)}const o=this._bindings,a=this._nActiveBindings;for(let t=0;t!==a;++t)o[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 ct),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 ct),e.copy(t).clamp(this.min,this.max)}distanceToPoint(t){return Fc.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)}}Hc.prototype.isBox2=!0;const Gc=new _t,Uc=new _t;class kc{constructor(t=new _t,e=new _t){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 _t),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 _t),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 _t),this.delta(e).multiplyScalar(t).add(this.start)}closestPointToPointParameter(t,e){Gc.subVectors(t,this.start),Uc.subVectors(this.end,this.start);const n=Uc.dot(Uc);let i=Uc.dot(Gc)/n;return e&&(i=lt.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 _t),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 Vc(t){xe.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}Vc.prototype=Object.create(xe.prototype),Vc.prototype.constructor=Vc,Vc.prototype.isImmediateRenderObject=!0;const Wc=new _t;const jc=new _t,qc=new Yt,Xc=new Yt;class Yc extends $s{constructor(t){const e=Zc(t),n=new mn,i=[],r=[],s=new Ve(0,0,1),o=new Ve(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),gh=[.125,.215,.35,.446,.526,.582],vh=5+gh.length,yh=20,xh={[Y]:0,[Z]:1,[Q]:2,[K]:3,[$]:4,[tt]:5,[J]:6},_h=new We({side:1,depthWrite:!1,depthTest:!1}),bh=new In(new On,_h),wh=new Dl,{_lodPlanes:Mh,_sizeLods:Sh,_sigmas:Th}=Ih(),Eh=new Ve;let Ah=null;const Lh=(1+Math.sqrt(5))/2,Rh=1/Lh,Ch=[new _t(1,1,1),new _t(-1,1,1),new _t(1,1,-1),new _t(-1,1,-1),new _t(0,Lh,Rh),new _t(0,Lh,-Rh),new _t(Rh,0,Lh),new _t(-Rh,0,Lh),new _t(Lh,Rh,0),new _t(-Lh,Rh,0)];function Ph(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 Dh(t){return void 0!==t&&t.type===_&&(t.encoding===Y||t.encoding===Z||t.encoding===J)}function Ih(){const t=[],e=[],n=[];let i=8;for(let r=0;r4?o=gh[r-8+4-1]:0==r&&(o=0),n.push(o);const a=1/(s-1),l=-a/2,c=1+a/2,h=[l,l,c,l,c,c,l,l,c,c,l,c],u=6,d=6,p=3,f=2,m=1,g=new Float32Array(p*d*u),v=new Float32Array(f*d*u),y=new Float32Array(m*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,f*d*t);const r=[t,t,t,t,t,t];y.set(r,m*d*t)}const x=new mn;x.setAttribute("position",new Xe(g,p)),x.setAttribute("uv",new Xe(v,f)),x.setAttribute("faceIndex",new Xe(y,m)),t.push(x),i>4&&i--}return{_lodPlanes:t,_sizeLods:e,_sigmas:n}}function Nh(t){const e=new vt(3*mh,3*mh,t);return e.texture.mapping=c,e.texture.name="PMREM.cubeUv",e.scissorTest=!0,e}function Oh(t,e,n,i,r){t.viewport.set(e,n,i,r),t.scissor.set(e,n,i,r)}function Bh(){const t=new ct(1,1);return new fa({name:"EquirectangularToCubeUV",uniforms:{envMap:{value:null},texelSize:{value:t},inputEncoding:{value:xh[3e3]},outputEncoding:{value:xh[3e3]}},vertexShader:Fh(),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${Hh()}\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 zh(){return new fa({name:"CubemapToCubeUV",uniforms:{envMap:{value:null},inputEncoding:{value:xh[3e3]},outputEncoding:{value:xh[3e3]}},vertexShader:Fh(),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${Hh()}\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 Fh(){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 Hh(){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"}Ja.create=function(t,e){return console.log("THREE.Curve.create() has been deprecated"),t.prototype=Object.create(Ja.prototype),t.prototype.constructor=t,t.prototype.getPoint=e,t},vl.prototype.fromPoints=function(t){return console.warn("THREE.Path: .fromPoints() has been renamed to .setFromPoints()."),this.setFromPoints(t)},$c.prototype.setColors=function(){console.error("THREE.GridHelper: setColors() has been deprecated, pass them in the constructor instead.")},Yc.prototype.update=function(){console.error("THREE.SkeletonHelper: update() no longer needs to be called.")},ka.prototype.extractUrlBase=function(t){return console.warn("THREE.Loader: .extractUrlBase() has been deprecated. Use THREE.LoaderUtils.extractUrlBase() instead."),Gl.extractUrlBase(t)},ka.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.")}},Hc.prototype.center=function(t){return console.warn("THREE.Box2: .center() has been renamed to .getCenter()."),this.getCenter(t)},Hc.prototype.empty=function(){return console.warn("THREE.Box2: .empty() has been renamed to .isEmpty()."),this.isEmpty()},Hc.prototype.isIntersectionBox=function(t){return console.warn("THREE.Box2: .isIntersectionBox() has been renamed to .intersectsBox()."),this.intersectsBox(t)},Hc.prototype.size=function(t){return console.warn("THREE.Box2: .size() has been renamed to .getSize()."),this.getSize(t)},Mt.prototype.center=function(t){return console.warn("THREE.Box3: .center() has been renamed to .getCenter()."),this.getCenter(t)},Mt.prototype.empty=function(){return console.warn("THREE.Box3: .empty() has been renamed to .isEmpty()."),this.isEmpty()},Mt.prototype.isIntersectionBox=function(t){return console.warn("THREE.Box3: .isIntersectionBox() has been renamed to .intersectsBox()."),this.intersectsBox(t)},Mt.prototype.isIntersectionSphere=function(t){return console.warn("THREE.Box3: .isIntersectionSphere() has been renamed to .intersectsSphere()."),this.intersectsSphere(t)},Mt.prototype.size=function(t){return console.warn("THREE.Box3: .size() has been renamed to .getSize()."),this.getSize(t)},Ht.prototype.empty=function(){return console.warn("THREE.Sphere: .empty() has been renamed to .isEmpty()."),this.isEmpty()},Zn.prototype.setFromMatrix=function(t){return console.warn("THREE.Frustum: .setFromMatrix() has been renamed to .setFromProjectionMatrix()."),this.setFromProjectionMatrix(t)},kc.prototype.center=function(t){return console.warn("THREE.Line3: .center() has been renamed to .getCenter()."),this.getCenter(t)},lt.random16=function(){return console.warn("THREE.Math: .random16() has been deprecated. Use Math.random() instead."),Math.random()},lt.nearestPowerOfTwo=function(t){return console.warn("THREE.Math: .nearestPowerOfTwo() has been renamed to .floorPowerOfTwo()."),lt.floorPowerOfTwo(t)},lt.nextPowerOfTwo=function(t){return console.warn("THREE.Math: .nextPowerOfTwo() has been renamed to .ceilPowerOfTwo()."),lt.ceilPowerOfTwo(t)},ht.prototype.flattenToArrayOffset=function(t,e){return console.warn("THREE.Matrix3: .flattenToArrayOffset() has been deprecated. Use .toArray() instead."),this.toArray(t,e)},ht.prototype.multiplyVector3=function(t){return console.warn("THREE.Matrix3: .multiplyVector3() has been removed. Use vector.applyMatrix3( matrix ) instead."),t.applyMatrix3(this)},ht.prototype.multiplyVector3Array=function(){console.error("THREE.Matrix3: .multiplyVector3Array() has been removed.")},ht.prototype.applyToBufferAttribute=function(t){return console.warn("THREE.Matrix3: .applyToBufferAttribute() has been removed. Use attribute.applyMatrix3( matrix ) instead."),t.applyMatrix3(this)},ht.prototype.applyToVector3Array=function(){console.error("THREE.Matrix3: .applyToVector3Array() has been removed.")},ht.prototype.getInverse=function(t){return console.warn("THREE.Matrix3: .getInverse() has been removed. Use matrixInv.copy( matrix ).invert(); instead."),this.copy(t).invert()},Yt.prototype.extractPosition=function(t){return console.warn("THREE.Matrix4: .extractPosition() has been renamed to .copyPosition()."),this.copyPosition(t)},Yt.prototype.flattenToArrayOffset=function(t,e){return console.warn("THREE.Matrix4: .flattenToArrayOffset() has been deprecated. Use .toArray() instead."),this.toArray(t,e)},Yt.prototype.getPosition=function(){return console.warn("THREE.Matrix4: .getPosition() has been removed. Use Vector3.setFromMatrixPosition( matrix ) instead."),(new _t).setFromMatrixColumn(this,3)},Yt.prototype.setRotationFromQuaternion=function(t){return console.warn("THREE.Matrix4: .setRotationFromQuaternion() has been renamed to .makeRotationFromQuaternion()."),this.makeRotationFromQuaternion(t)},Yt.prototype.multiplyToArray=function(){console.warn("THREE.Matrix4: .multiplyToArray() has been removed.")},Yt.prototype.multiplyVector3=function(t){return console.warn("THREE.Matrix4: .multiplyVector3() has been removed. Use vector.applyMatrix4( matrix ) instead."),t.applyMatrix4(this)},Yt.prototype.multiplyVector4=function(t){return console.warn("THREE.Matrix4: .multiplyVector4() has been removed. Use vector.applyMatrix4( matrix ) instead."),t.applyMatrix4(this)},Yt.prototype.multiplyVector3Array=function(){console.error("THREE.Matrix4: .multiplyVector3Array() has been removed.")},Yt.prototype.rotateAxis=function(t){console.warn("THREE.Matrix4: .rotateAxis() has been removed. Use Vector3.transformDirection( matrix ) instead."),t.transformDirection(this)},Yt.prototype.crossVector=function(t){return console.warn("THREE.Matrix4: .crossVector() has been removed. Use vector.applyMatrix4( matrix ) instead."),t.applyMatrix4(this)},Yt.prototype.translate=function(){console.error("THREE.Matrix4: .translate() has been removed.")},Yt.prototype.rotateX=function(){console.error("THREE.Matrix4: .rotateX() has been removed.")},Yt.prototype.rotateY=function(){console.error("THREE.Matrix4: .rotateY() has been removed.")},Yt.prototype.rotateZ=function(){console.error("THREE.Matrix4: .rotateZ() has been removed.")},Yt.prototype.rotateByAxis=function(){console.error("THREE.Matrix4: .rotateByAxis() has been removed.")},Yt.prototype.applyToBufferAttribute=function(t){return console.warn("THREE.Matrix4: .applyToBufferAttribute() has been removed. Use attribute.applyMatrix4( matrix ) instead."),t.applyMatrix4(this)},Yt.prototype.applyToVector3Array=function(){console.error("THREE.Matrix4: .applyToVector3Array() has been removed.")},Yt.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)},Yt.prototype.getInverse=function(t){return console.warn("THREE.Matrix4: .getInverse() has been removed. Use matrixInv.copy( matrix ).invert(); instead."),this.copy(t).invert()},Me.prototype.isIntersectionLine=function(t){return console.warn("THREE.Plane: .isIntersectionLine() has been renamed to .intersectsLine()."),this.intersectsLine(t)},xt.prototype.multiplyVector3=function(t){return console.warn("THREE.Quaternion: .multiplyVector3() has been removed. Use is now vector.applyQuaternion( quaternion ) instead."),t.applyQuaternion(this)},xt.prototype.inverse=function(){return console.warn("THREE.Quaternion: .inverse() has been renamed to invert()."),this.invert()},Xt.prototype.isIntersectionBox=function(t){return console.warn("THREE.Ray: .isIntersectionBox() has been renamed to .intersectsBox()."),this.intersectsBox(t)},Xt.prototype.isIntersectionPlane=function(t){return console.warn("THREE.Ray: .isIntersectionPlane() has been renamed to .intersectsPlane()."),this.intersectsPlane(t)},Xt.prototype.isIntersectionSphere=function(t){return console.warn("THREE.Ray: .isIntersectionSphere() has been renamed to .intersectsSphere()."),this.intersectsSphere(t)},Ne.prototype.area=function(){return console.warn("THREE.Triangle: .area() has been renamed to .getArea()."),this.getArea()},Ne.prototype.barycoordFromPoint=function(t,e){return console.warn("THREE.Triangle: .barycoordFromPoint() has been renamed to .getBarycoord()."),this.getBarycoord(t,e)},Ne.prototype.midpoint=function(t){return console.warn("THREE.Triangle: .midpoint() has been renamed to .getMidpoint()."),this.getMidpoint(t)},Ne.prototypenormal=function(t){return console.warn("THREE.Triangle: .normal() has been renamed to .getNormal()."),this.getNormal(t)},Ne.prototype.plane=function(t){return console.warn("THREE.Triangle: .plane() has been renamed to .getPlane()."),this.getPlane(t)},Ne.barycoordFromPoint=function(t,e,n,i,r){return console.warn("THREE.Triangle: .barycoordFromPoint() has been renamed to .getBarycoord()."),Ne.getBarycoord(t,e,n,i,r)},Ne.normal=function(t,e,n,i){return console.warn("THREE.Triangle: .normal() has been renamed to .getNormal()."),Ne.getNormal(t,e,n,i)},yl.prototype.extractAllPoints=function(t){return console.warn("THREE.Shape: .extractAllPoints() has been removed. Use .extractPoints() instead."),this.extractPoints(t)},yl.prototype.extrude=function(t){return console.warn("THREE.Shape: .extrude() has been removed. Use ExtrudeGeometry() instead."),new Qo(this,t)},yl.prototype.makeGeometry=function(t){return console.warn("THREE.Shape: .makeGeometry() has been removed. Use ShapeGeometry() instead."),new ra(this,t)},ct.prototype.fromAttribute=function(t,e,n){return console.warn("THREE.Vector2: .fromAttribute() has been renamed to .fromBufferAttribute()."),this.fromBufferAttribute(t,e,n)},ct.prototype.distanceToManhattan=function(t){return console.warn("THREE.Vector2: .distanceToManhattan() has been renamed to .manhattanDistanceTo()."),this.manhattanDistanceTo(t)},ct.prototype.lengthManhattan=function(){return console.warn("THREE.Vector2: .lengthManhattan() has been renamed to .manhattanLength()."),this.manhattanLength()},_t.prototype.setEulerFromRotationMatrix=function(){console.error("THREE.Vector3: .setEulerFromRotationMatrix() has been removed. Use Euler.setFromRotationMatrix() instead.")},_t.prototype.setEulerFromQuaternion=function(){console.error("THREE.Vector3: .setEulerFromQuaternion() has been removed. Use Euler.setFromQuaternion() instead.")},_t.prototype.getPositionFromMatrix=function(t){return console.warn("THREE.Vector3: .getPositionFromMatrix() has been renamed to .setFromMatrixPosition()."),this.setFromMatrixPosition(t)},_t.prototype.getScaleFromMatrix=function(t){return console.warn("THREE.Vector3: .getScaleFromMatrix() has been renamed to .setFromMatrixScale()."),this.setFromMatrixScale(t)},_t.prototype.getColumnFromMatrix=function(t,e){return console.warn("THREE.Vector3: .getColumnFromMatrix() has been renamed to .setFromMatrixColumn()."),this.setFromMatrixColumn(e,t)},_t.prototype.applyProjection=function(t){return console.warn("THREE.Vector3: .applyProjection() has been removed. Use .applyMatrix4( m ) instead."),this.applyMatrix4(t)},_t.prototype.fromAttribute=function(t,e,n){return console.warn("THREE.Vector3: .fromAttribute() has been renamed to .fromBufferAttribute()."),this.fromBufferAttribute(t,e,n)},_t.prototype.distanceToManhattan=function(t){return console.warn("THREE.Vector3: .distanceToManhattan() has been renamed to .manhattanDistanceTo()."),this.manhattanDistanceTo(t)},_t.prototype.lengthManhattan=function(){return console.warn("THREE.Vector3: .lengthManhattan() has been renamed to .manhattanLength()."),this.manhattanLength()},gt.prototype.fromAttribute=function(t,e,n){return console.warn("THREE.Vector4: .fromAttribute() has been renamed to .fromBufferAttribute()."),this.fromBufferAttribute(t,e,n)},gt.prototype.lengthManhattan=function(){return console.warn("THREE.Vector4: .lengthManhattan() has been renamed to .manhattanLength()."),this.manhattanLength()},xe.prototype.getChildByName=function(t){return console.warn("THREE.Object3D: .getChildByName() has been renamed to .getObjectByName()."),this.getObjectByName(t)},xe.prototype.renderDepth=function(){console.warn("THREE.Object3D: .renderDepth has been removed. Use .renderOrder, instead.")},xe.prototype.translate=function(t,e){return console.warn("THREE.Object3D: .translate() has been removed. Use .translateOnAxis( axis, distance ) instead."),this.translateOnAxis(e,t)},xe.prototype.getWorldRotation=function(){console.error("THREE.Object3D: .getWorldRotation() has been removed. Use THREE.Object3D.getWorldQuaternion( target ) instead.")},xe.prototype.applyMatrix=function(t){return console.warn("THREE.Object3D: .applyMatrix() has been renamed to .applyMatrix4()."),this.applyMatrix4(t)},Object.defineProperties(xe.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.")}}}),In.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(In.prototype,{drawMode:{get:function(){return console.error("THREE.Mesh: .drawMode has been removed. The renderer now always assumes THREE.TrianglesDrawMode."),0},set:function(){console.error("THREE.Mesh: .drawMode has been removed. The renderer now always assumes THREE.TrianglesDrawMode. Transform your geometry via BufferGeometryUtils.toTrianglesDrawMode() if necessary.")}}}),Object.defineProperties(Ls.prototype,{objects:{get:function(){return console.warn("THREE.LOD: .objects has been renamed to .levels."),this.levels}}}),Object.defineProperty(Fs.prototype,"useVertexTexture",{get:function(){console.warn("THREE.Skeleton: useVertexTexture has been removed.")},set:function(){console.warn("THREE.Skeleton: useVertexTexture has been removed.")}}),Ns.prototype.initBones=function(){console.error("THREE.SkinnedMesh: initBones() has been removed.")},Object.defineProperty(Ja.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}}),Un.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(xl.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(Xe.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===it},set:function(){console.warn("THREE.BufferAttribute: .dynamic has been deprecated. Use .usage instead."),this.setUsage(it)}}}),Xe.prototype.setDynamic=function(t){return console.warn("THREE.BufferAttribute: .setDynamic() has been deprecated. Use .setUsage() instead."),this.setUsage(!0===t?it:nt),this},Xe.prototype.copyIndicesArray=function(){console.error("THREE.BufferAttribute: .copyIndicesArray() has been removed.")},Xe.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 Xe(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(Ul.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(Oc.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===it},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?it:nt),this},as.prototype.setArray=function(){console.error("THREE.InterleavedBuffer: .setArray has been removed. Use BufferGeometry .setAttribute to replace/resize attribute buffers")},Qo.prototype.getArrays=function(){console.error("THREE.ExtrudeGeometry: .getArrays() has been removed.")},Qo.prototype.addShapeList=function(){console.error("THREE.ExtrudeGeometry: .addShapeList() has been removed.")},Qo.prototype.addShape=function(){console.error("THREE.ExtrudeGeometry: .addShape() has been removed.")},os.prototype.dispose=function(){console.error("THREE.Scene: .dispose() has been removed.")},Object.defineProperties(Dc.prototype,{dynamic:{set:function(){console.warn("THREE.Uniform: .dynamic has been removed. Use object.onBeforeRender() instead.")}},onUpdate:{value:function(){return console.warn("THREE.Uniform: .onUpdate() has been removed. Use object.onBeforeRender() instead."),this}}}),Object.defineProperties(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 Ve}},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(va.prototype,{metal:{get:function(){return console.warn("THREE.MeshPhongMaterial: .metal has been removed. Use THREE.MeshStandardMaterial instead."),!1},set:function(){console.warn("THREE.MeshPhongMaterial: .metal has been removed. Use THREE.MeshStandardMaterial instead")}}}),Object.defineProperties(ga.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(Hn.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}}}),ns.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)},ns.prototype.animate=function(t){console.warn("THREE.WebGLRenderer: .animate() is now .setAnimationLoop()."),this.setAnimationLoop(t)},ns.prototype.getCurrentRenderTarget=function(){return console.warn("THREE.WebGLRenderer: .getCurrentRenderTarget() is now .getRenderTarget()."),this.getRenderTarget()},ns.prototype.getMaxAnisotropy=function(){return console.warn("THREE.WebGLRenderer: .getMaxAnisotropy() is now .capabilities.getMaxAnisotropy()."),this.capabilities.getMaxAnisotropy()},ns.prototype.getPrecision=function(){return console.warn("THREE.WebGLRenderer: .getPrecision() is now .capabilities.precision."),this.capabilities.precision},ns.prototype.resetGLState=function(){return console.warn("THREE.WebGLRenderer: .resetGLState() is now .state.reset()."),this.state.reset()},ns.prototype.supportsFloatTextures=function(){return console.warn("THREE.WebGLRenderer: .supportsFloatTextures() is now .extensions.get( 'OES_texture_float' )."),this.extensions.get("OES_texture_float")},ns.prototype.supportsHalfFloatTextures=function(){return console.warn("THREE.WebGLRenderer: .supportsHalfFloatTextures() is now .extensions.get( 'OES_texture_half_float' )."),this.extensions.get("OES_texture_half_float")},ns.prototype.supportsStandardDerivatives=function(){return console.warn("THREE.WebGLRenderer: .supportsStandardDerivatives() is now .extensions.get( 'OES_standard_derivatives' )."),this.extensions.get("OES_standard_derivatives")},ns.prototype.supportsCompressedTextureS3TC=function(){return console.warn("THREE.WebGLRenderer: .supportsCompressedTextureS3TC() is now .extensions.get( 'WEBGL_compressed_texture_s3tc' )."),this.extensions.get("WEBGL_compressed_texture_s3tc")},ns.prototype.supportsCompressedTexturePVRTC=function(){return console.warn("THREE.WebGLRenderer: .supportsCompressedTexturePVRTC() is now .extensions.get( 'WEBGL_compressed_texture_pvrtc' )."),this.extensions.get("WEBGL_compressed_texture_pvrtc")},ns.prototype.supportsBlendMinMax=function(){return console.warn("THREE.WebGLRenderer: .supportsBlendMinMax() is now .extensions.get( 'EXT_blend_minmax' )."),this.extensions.get("EXT_blend_minmax")},ns.prototype.supportsVertexTextures=function(){return console.warn("THREE.WebGLRenderer: .supportsVertexTextures() is now .capabilities.vertexTextures."),this.capabilities.vertexTextures},ns.prototype.supportsInstancedArrays=function(){return console.warn("THREE.WebGLRenderer: .supportsInstancedArrays() is now .extensions.get( 'ANGLE_instanced_arrays' )."),this.extensions.get("ANGLE_instanced_arrays")},ns.prototype.enableScissorTest=function(t){console.warn("THREE.WebGLRenderer: .enableScissorTest() is now .setScissorTest()."),this.setScissorTest(t)},ns.prototype.initMaterial=function(){console.warn("THREE.WebGLRenderer: .initMaterial() has been removed.")},ns.prototype.addPrePlugin=function(){console.warn("THREE.WebGLRenderer: .addPrePlugin() has been removed.")},ns.prototype.addPostPlugin=function(){console.warn("THREE.WebGLRenderer: .addPostPlugin() has been removed.")},ns.prototype.updateShadowMap=function(){console.warn("THREE.WebGLRenderer: .updateShadowMap() has been removed.")},ns.prototype.setFaceCulling=function(){console.warn("THREE.WebGLRenderer: .setFaceCulling() has been removed.")},ns.prototype.allocTextureUnit=function(){console.warn("THREE.WebGLRenderer: .allocTextureUnit() has been removed.")},ns.prototype.setTexture=function(){console.warn("THREE.WebGLRenderer: .setTexture() has been removed.")},ns.prototype.setTexture2D=function(){console.warn("THREE.WebGLRenderer: .setTexture2D() has been removed.")},ns.prototype.setTextureCube=function(){console.warn("THREE.WebGLRenderer: .setTextureCube() has been removed.")},ns.prototype.getActiveMipMapLevel=function(){return console.warn("THREE.WebGLRenderer: .getActiveMipMapLevel() is now .getActiveMipmapLevel()."),this.getActiveMipmapLevel()},Object.defineProperties(ns.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?Z:Y}},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(Xr.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(vt.prototype,{wrapS:{get:function(){return console.warn("THREE.WebGLRenderTarget: .wrapS is now .texture.wrapS."),this.texture.wrapS},set:function(t){console.warn("THREE.WebGLRenderTarget: .wrapS is now .texture.wrapS."),this.texture.wrapS=t}},wrapT:{get:function(){return console.warn("THREE.WebGLRenderTarget: .wrapT is now .texture.wrapT."),this.texture.wrapT},set:function(t){console.warn("THREE.WebGLRenderTarget: .wrapT is now .texture.wrapT."),this.texture.wrapT=t}},magFilter:{get:function(){return console.warn("THREE.WebGLRenderTarget: .magFilter is now .texture.magFilter."),this.texture.magFilter},set:function(t){console.warn("THREE.WebGLRenderTarget: .magFilter is now .texture.magFilter."),this.texture.magFilter=t}},minFilter:{get:function(){return console.warn("THREE.WebGLRenderTarget: .minFilter is now .texture.minFilter."),this.texture.minFilter},set:function(t){console.warn("THREE.WebGLRenderTarget: .minFilter is now .texture.minFilter."),this.texture.minFilter=t}},anisotropy:{get:function(){return console.warn("THREE.WebGLRenderTarget: .anisotropy is now .texture.anisotropy."),this.texture.anisotropy},set:function(t){console.warn("THREE.WebGLRenderTarget: .anisotropy is now .texture.anisotropy."),this.texture.anisotropy=t}},offset:{get:function(){return console.warn("THREE.WebGLRenderTarget: .offset is now .texture.offset."),this.texture.offset},set:function(t){console.warn("THREE.WebGLRenderTarget: .offset is now .texture.offset."),this.texture.offset=t}},repeat:{get:function(){return console.warn("THREE.WebGLRenderTarget: .repeat is now .texture.repeat."),this.texture.repeat},set:function(t){console.warn("THREE.WebGLRenderTarget: .repeat is now .texture.repeat."),this.texture.repeat=t}},format:{get:function(){return console.warn("THREE.WebGLRenderTarget: .format is now .texture.format."),this.texture.format},set:function(t){console.warn("THREE.WebGLRenderTarget: .format is now .texture.format."),this.texture.format=t}},type:{get:function(){return console.warn("THREE.WebGLRenderTarget: .type is now .texture.type."),this.texture.type},set:function(t){console.warn("THREE.WebGLRenderTarget: .type is now .texture.type."),this.texture.type=t}},generateMipmaps:{get:function(){return console.warn("THREE.WebGLRenderTarget: .generateMipmaps is now .texture.generateMipmaps."),this.texture.generateMipmaps},set:function(t){console.warn("THREE.WebGLRenderTarget: .generateMipmaps is now .texture.generateMipmaps."),this.texture.generateMipmaps=t}}}),Object.defineProperties(hc.prototype,{load:{value:function(t){console.warn("THREE.Audio: .load has been deprecated. Use THREE.AudioLoader instead.");const e=this;return(new $l).load(t,(function(t){e.setBuffer(t)})),this}},startTime:{set:function(){console.warn("THREE.Audio: .startTime is now .play( delay ).")}}}),mc.prototype.getData=function(){return console.warn("THREE.AudioAnalyser: .getData() is now .getFrequencyData()."),this.getFrequencyData()},Vn.prototype.updateCubeMap=function(t,e){return console.warn("THREE.CubeCamera: .updateCubeMap() is now .update()."),this.update(t,e)},Vn.prototype.clear=function(t,e,n,i){return console.warn("THREE.CubeCamera: .clear() is now .renderTarget.clear()."),this.renderTarget.clear(t,e,n,i)},dt.crossOrigin=void 0,dt.loadTexture=function(t,e,n,i){console.warn("THREE.ImageUtils.loadTexture has been deprecated. Use THREE.TextureLoader() instead.");const r=new Za;r.setCrossOrigin(this.crossOrigin);const s=r.load(t,n,void 0,i);return e&&(s.mapping=e),s},dt.loadTextureCube=function(t,e,n,i){console.warn("THREE.ImageUtils.loadTextureCube has been deprecated. Use THREE.CubeTextureLoader() instead.");const r=new Xa;r.setCrossOrigin(this.crossOrigin);const s=r.load(t,n,void 0,i);return e&&(s.mapping=e),s},dt.loadCompressedTexture=function(){console.error("THREE.ImageUtils.loadCompressedTexture has been removed. Use THREE.DDSLoader instead.")},dt.loadCompressedTextureCube=function(){console.error("THREE.ImageUtils.loadCompressedTextureCube has been removed. Use THREE.DDSLoader instead.")};const Gh={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:n}})),"undefined"!=typeof window&&(window.__THREE__?console.warn("WARNING: Multiple instances of Three.js being imported."):window.__THREE__=n),t.ACESFilmicToneMapping=4,t.AddEquation=i,t.AddOperation=2,t.AdditiveAnimationBlendMode=X,t.AdditiveBlending=2,t.AlphaFormat=1021,t.AlwaysDepth=1,t.AlwaysStencilFunc=519,t.AmbientLight=Ol,t.AmbientLightProbe=ec,t.AnimationClip=za,t.AnimationLoader=class extends ka{constructor(t){super(t)}load(t,e,n,i){const r=this,s=new Wa(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{lh.set(t.z,0,-t.x).normalize();const e=Math.acos(t.y);this.quaternion.setFromAxisAngle(lh,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=hc,t.AudioAnalyser=mc,t.AudioContext=Kl,t.AudioListener=class extends xe{constructor(){super(),this.type="AudioListener",this.context=Kl.getContext(),this.gain=this.context.createGain(),this.gain.connect(this.context.destination),this.filter=null,this.timeDelta=0,this._clock=new rc}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(oc,ac,lc),cc.set(0,0,-1).applyQuaternion(ac),e.positionX){const t=this.context.currentTime+this.timeDelta;e.positionX.linearRampToValueAtTime(oc.x,t),e.positionY.linearRampToValueAtTime(oc.y,t),e.positionZ.linearRampToValueAtTime(oc.z,t),e.forwardX.linearRampToValueAtTime(cc.x,t),e.forwardY.linearRampToValueAtTime(cc.y,t),e.forwardZ.linearRampToValueAtTime(cc.z,t),e.upX.linearRampToValueAtTime(n.x,t),e.upY.linearRampToValueAtTime(n.y,t),e.upZ.linearRampToValueAtTime(n.z,t)}else e.setPosition(oc.x,oc.y,oc.z),e.setOrientation(cc.x,cc.y,cc.z,n.x,n.y,n.z)}},t.AudioLoader=$l,t.AxesHelper=uh,t.AxisHelper=function(t){return console.warn("THREE.AxisHelper has been renamed to THREE.AxesHelper."),new uh(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 Ya(t)},t.Bone=Os,t.BooleanKeyframeTrack=Ca,t.BoundingBoxHelper=function(t,e){return console.warn("THREE.BoundingBoxHelper has been deprecated. Creating a THREE.BoxHelper instead."),new ah(t,e)},t.Box2=Hc,t.Box3=Mt,t.Box3Helper=class extends $s{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 Xe(n,1)),i.setAttribute("position",new nn([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 Ws({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=On,t.BoxGeometry=On,t.BoxHelper=ah,t.BufferAttribute=Xe,t.BufferGeometry=mn,t.BufferGeometryLoader=Vl,t.ByteType=1010,t.Cache=Ha,t.Camera=Gn,t.CameraHelper=class extends $s{constructor(t){const e=new mn,n=new Ws({color:16777215,vertexColors:!0,toneMapped:!1}),i=[],r=[],s={},o=new Ve(16755200),a=new Ve(16711680),l=new Ve(43775),c=new Ve(16777215),h=new Ve(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",o),u("n2","n4",o),u("n4","n3",o),u("n3","n1",o),u("f1","f2",o),u("f2","f4",o),u("f4","f3",o),u("f3","f1",o),u("n1","f1",o),u("n2","f2",o),u("n3","f3",o),u("n4","f4",o),u("p","n1",a),u("p","n2",a),u("p","n3",a),u("p","n4",a),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 nn(i,3)),e.setAttribute("color",new nn(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;rh.projectionMatrixInverse.copy(this.camera.projectionMatrixInverse),sh("c",e,t,rh,0,0,-1),sh("t",e,t,rh,0,0,1),sh("n1",e,t,rh,-1,-1,-1),sh("n2",e,t,rh,1,-1,-1),sh("n3",e,t,rh,-1,1,-1),sh("n4",e,t,rh,1,1,-1),sh("f1",e,t,rh,-1,-1,1),sh("f2",e,t,rh,1,-1,1),sh("f3",e,t,rh,-1,1,1),sh("f4",e,t,rh,1,1,1),sh("u1",e,t,rh,.7,1.1,-1),sh("u2",e,t,rh,-.7,1.1,-1),sh("u3",e,t,rh,0,2,-1),sh("cf1",e,t,rh,-1,0,1),sh("cf2",e,t,rh,1,0,1),sh("cf3",e,t,rh,0,-1,1),sh("cf4",e,t,rh,0,1,1),sh("cn1",e,t,rh,-1,0,-1),sh("cn2",e,t,rh,1,0,-1),sh("cn3",e,t,rh,0,-1,-1),sh("cn4",e,t,rh,0,1,-1),t.getAttribute("position").needsUpdate=!0}},t.CanvasRenderer=function(){console.error("THREE.CanvasRenderer has been removed")},t.CanvasTexture=ho,t.CatmullRomCurve3=rl,t.CineonToneMapping=3,t.CircleBufferGeometry=po,t.CircleGeometry=po,t.ClampToEdgeWrapping=d,t.Clock=rc,t.Color=Ve,t.ColorKeyframeTrack=Pa,t.CompressedTexture=co,t.CompressedTextureLoader=ja,t.ConeBufferGeometry=mo,t.ConeGeometry=mo,t.CubeCamera=Vn,t.CubeReflectionMapping=s,t.CubeRefractionMapping=o,t.CubeTexture=Wn,t.CubeTextureLoader=Xa,t.CubeUVReflectionMapping=c,t.CubeUVRefractionMapping=h,t.CubicBezierCurve=ll,t.CubicBezierCurve3=cl,t.CubicInterpolant=Ea,t.CullFaceBack=1,t.CullFaceFront=2,t.CullFaceFrontBack=3,t.CullFaceNone=0,t.Curve=Ja,t.CurvePath=gl,t.CustomBlending=5,t.CustomToneMapping=5,t.CylinderBufferGeometry=fo,t.CylinderGeometry=fo,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=qn,t.DataTexture2DArray=gi,t.DataTexture3D=vi,t.DataTextureLoader=Ya,t.DataUtils=fh,t.DecrementStencilOp=7683,t.DecrementWrapStencilOp=34056,t.DefaultLoadingManager=Ua,t.DepthFormat=L,t.DepthStencilFormat=R,t.DepthTexture=uo,t.DirectionalLight=Nl,t.DirectionalLightHelper=class extends xe{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 nn([-e,e,0,e,e,0,e,-e,0,-e,-e,0,-e,e,0],3));const r=new Ws({fog:!1,toneMapped:!1});this.lightPlane=new Js(i,r),this.add(this.lightPlane),i=new mn,i.setAttribute("position",new nn([0,0,0,0,0,1],3)),this.targetLine=new Js(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(){th.setFromMatrixPosition(this.light.matrixWorld),eh.setFromMatrixPosition(this.light.target.matrixWorld),nh.subVectors(eh,th),this.lightPlane.lookAt(eh),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(eh),this.targetLine.scale.z=nh.length()}},t.DiscreteInterpolant=La,t.DodecahedronBufferGeometry=vo,t.DodecahedronGeometry=vo,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 Xe(t,e).setUsage(it)},t.DynamicCopyUsage=35050,t.DynamicDrawUsage=it,t.DynamicReadUsage=35049,t.EdgesGeometry=wo,t.EdgesHelper=function(t,e){return console.warn("THREE.EdgesHelper has been removed. Use THREE.EdgesGeometry instead."),new $s(new wo(t.geometry),new Ws({color:void 0!==e?e:16777215}))},t.EllipseCurve=Qa,t.EqualDepth=4,t.EqualStencilFunc=514,t.EquirectangularReflectionMapping=a,t.EquirectangularRefractionMapping=l,t.Euler=re,t.EventDispatcher=st,t.ExtrudeBufferGeometry=Qo,t.ExtrudeGeometry=Qo,t.FaceColors=1,t.FileLoader=Wa,t.FlatShading=1,t.Float16BufferAttribute=en,t.Float32Attribute=function(t,e){return console.warn("THREE.Float32Attribute has been removed. Use new THREE.Float32BufferAttribute() instead."),new nn(t,e)},t.Float32BufferAttribute=nn,t.Float64Attribute=function(t,e){return console.warn("THREE.Float64Attribute has been removed. Use new THREE.Float64BufferAttribute() instead."),new rn(t,e)},t.Float64BufferAttribute=rn,t.FloatType=M,t.Fog=ss,t.FogExp2=rs,t.Font=Zl,t.FontLoader=class extends ka{constructor(t){super(t)}load(t,e,n,i){const r=this,s=new Wa(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 Zl(t)}},t.FrontSide=0,t.Frustum=Zn,t.GLBufferAttribute=Nc,t.GLSL1="100",t.GLSL3=rt,t.GammaEncoding=J,t.GreaterDepth=6,t.GreaterEqualDepth=5,t.GreaterEqualStencilFunc=518,t.GreaterStencilFunc=516,t.GridHelper=$c,t.Group=Kr,t.HalfFloatType=S,t.HemisphereLight=_l,t.HemisphereLightHelper=class extends xe{constructor(t,e,n){super(),this.light=t,this.light.updateMatrixWorld(),this.matrix=t.matrixWorld,this.matrixAutoUpdate=!1,this.color=n;const i=new ea(e);i.rotateY(.5*Math.PI),this.material=new We({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 Xe(s,3)),this.add(new In(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");Qc.copy(this.light.color),Kc.copy(this.light.groundColor);for(let t=0,n=e.count;t0){const n=new Ga(e);r=new qa(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})}(yh),this._equirectShader=null,this._cubemapShader=null,this._compileMaterial(this._blurMaterial)}fromScene(t,e=0,n=.1,i=100){Ah=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=zh(),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),a.setRenderTarget(i),u&&a.render(bh,r),a.render(t,r)}a.toneMapping=h,a.outputEncoding=c,a.autoClear=l}_textureToCubeUV(t,e){const n=this._renderer;t.isCubeTexture?null==this._cubemapShader&&(this._cubemapShader=zh()):null==this._equirectShader&&(this._equirectShader=Bh());const i=t.isCubeTexture?this._cubemapShader:this._equirectShader,r=new In(Mh[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=xh[t.encoding],s.outputEncoding.value=xh[e.texture.encoding],Oh(e,0,0,3*mh,2*mh),n.setRenderTarget(e),n.render(r,wh)}_applyPMREM(t){const e=this._renderer,n=e.autoClear;e.autoClear=!1;for(let e=1;eyh&&console.warn(`sigmaRadians, ${r}, is too large and will clip, as it requested ${f} samples when the maximum is set to 20`);const m=[];let g=0;for(let t=0;t4?i-8+4:0),3*v,2*v),a.setRenderTarget(e),a.render(c,wh)}},t.ParametricBufferGeometry=na,t.ParametricGeometry=na,t.Particle=function(t){return console.warn("THREE.Particle has been renamed to THREE.Sprite."),new Ss(t)},t.ParticleBasicMaterial=function(t){return console.warn("THREE.ParticleBasicMaterial has been renamed to THREE.PointsMaterial."),new eo(t)},t.ParticleSystem=function(t,e){return console.warn("THREE.ParticleSystem has been renamed to THREE.Points."),new oo(t,e)},t.ParticleSystemMaterial=function(t){return console.warn("THREE.ParticleSystemMaterial has been renamed to THREE.PointsMaterial."),new eo(t)},t.Path=vl,t.PerspectiveCamera=Un,t.Plane=Me,t.PlaneBufferGeometry=Kn,t.PlaneGeometry=Kn,t.PlaneHelper=class extends Js{constructor(t,e=1,n=16776960){const i=n,r=new mn;r.setAttribute("position",new nn([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 Ws({color:i,toneMapped:!1})),this.type="PlaneHelper",this.plane=t,this.size=e;const s=new mn;s.setAttribute("position",new nn([1,1,1,-1,1,1,-1,-1,1,1,1,1,-1,-1,1,1,-1,1],3)),s.computeBoundingSphere(),this.add(new In(s,new We({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 oo(t,e)},t.PointCloudMaterial=function(t){return console.warn("THREE.PointCloudMaterial has been renamed to THREE.PointsMaterial."),new eo(t)},t.PointLight=Pl,t.PointLightHelper=class extends In{constructor(t,e,n){super(new sa(e,4,2),new We({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=oo,t.PointsMaterial=eo,t.PolarGridHelper=class extends $s{constructor(t=10,e=16,n=8,i=64,r=4473924,s=8947848){r=new Ve(r),s=new Ve(s);const o=[],a=[];for(let n=0;n<=e;n++){const i=n/e*(2*Math.PI),l=Math.sin(i)*t,c=Math.cos(i)*t;o.push(0,0,0),o.push(l,0,c);const h=1&n?r:s;a.push(h.r,h.g,h.b),a.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;t