From 7547be600c0ec0aa3f6e938af51108f9908db219 Mon Sep 17 00:00:00 2001 From: Matt Vollrath Date: Mon, 4 Mar 2019 11:27:06 -0500 Subject: [PATCH] 1.0.1 --- CHANGELOG.md | 6 + bower.json | 2 +- build/ros3d.cjs.js | 760 +++++++++++++++++---------------------------- build/ros3d.esm.js | 760 +++++++++++++++++---------------------------- build/ros3d.js | 13 + build/ros3d.min.js | 2 +- package.json | 2 +- src/Ros3D.js | 2 +- 8 files changed, 595 insertions(+), 952 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 5168f97b..1013a440 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,11 @@ ## Change Log +### 1.0.1 (2019/03/04 16:23 +00:00) +- [#254](https://github.com/RobotWebTools/ros3djs/pull/254) Use single item queue for unreliable topics (@mvollrath) +- [#256](https://github.com/RobotWebTools/ros3djs/pull/256) Use loose roslibjs version (@mvollrath) +- [#253](https://github.com/RobotWebTools/ros3djs/pull/253) Default LaserScan to CBOR (@mvollrath) + + ### 1.0.0 (2019/02/02 14:48 +00:00) - [#208](https://github.com/RobotWebTools/ros3djs/pull/208) Custom frame axes options: scale, dashed lines and no pan&zoom frame (@viktorku) - [#247](https://github.com/RobotWebTools/ros3djs/pull/247) Use CBOR by default for OccupancyGrid (@mvollrath) diff --git a/bower.json b/bower.json index b275f3ac..9a93ad09 100644 --- a/bower.json +++ b/bower.json @@ -2,7 +2,7 @@ "name": "ros3d", "homepage": "https://www.robotwebtools.org", "description": "(BOWER IS DEPRECATING! Please use npm version of ros3d). The standard ROS Javascript Visualization Library", - "version": "1.0.0", + "version": "1.0.1", "license": "BSD-3-Clause", "main": "./src/Ros3D.js", "repository": { diff --git a/build/ros3d.cjs.js b/build/ros3d.cjs.js index 1a4fd9ab..a89e3b42 100644 --- a/build/ros3d.cjs.js +++ b/build/ros3d.cjs.js @@ -163,8 +163,6 @@ Object.assign( EventDispatcher.prototype, { }, dispatchEvent: function ( event ) { - var this$1 = this; - if ( this._listeners === undefined ) { return; } @@ -179,7 +177,7 @@ Object.assign( EventDispatcher.prototype, { for ( var i = 0, l = array.length; i < l; i ++ ) { - array[ i ].call( this$1, event ); + array[ i ].call( this, event ); } @@ -1401,8 +1399,6 @@ Object.assign( Matrix4.prototype, { var v1 = new Vector3(); return function applyToBufferAttribute( attribute ) { - var this$1 = this; - for ( var i = 0, l = attribute.count; i < l; i ++ ) { @@ -1410,7 +1406,7 @@ Object.assign( Matrix4.prototype, { v1.y = attribute.getY( i ); v1.z = attribute.getZ( i ); - v1.applyMatrix4( this$1 ); + v1.applyMatrix4( this ); attribute.setXYZ( i, v1.x, v1.y, v1.z ); @@ -1832,14 +1828,12 @@ Object.assign( Matrix4.prototype, { }, fromArray: function ( array, offset ) { - var this$1 = this; - if ( offset === undefined ) { offset = 0; } for ( var i = 0; i < 16; i ++ ) { - this$1.elements[ i ] = array[ i + offset ]; + this.elements[ i ] = array[ i + offset ]; } @@ -3305,8 +3299,6 @@ Object.assign( Matrix3.prototype, { var v1 = new Vector3(); return function applyToBufferAttribute( attribute ) { - var this$1 = this; - for ( var i = 0, l = attribute.count; i < l; i ++ ) { @@ -3314,7 +3306,7 @@ Object.assign( Matrix3.prototype, { v1.y = attribute.getY( i ); v1.z = attribute.getZ( i ); - v1.applyMatrix3( this$1 ); + v1.applyMatrix3( this ); attribute.setXYZ( i, v1.x, v1.y, v1.z ); @@ -3558,14 +3550,12 @@ Object.assign( Matrix3.prototype, { }, fromArray: function ( array, offset ) { - var this$1 = this; - if ( offset === undefined ) { offset = 0; } for ( var i = 0; i < 9; i ++ ) { - this$1.elements[ i ] = array[ i + offset ]; + this.elements[ i ] = array[ i + offset ]; } @@ -5239,8 +5229,6 @@ function parseUniform( activeInfo, addr, container ) { // Root Container function WebGLUniforms( gl, program, renderer ) { - var this$1 = this; - UniformContainer.call( this ); @@ -5254,7 +5242,7 @@ function WebGLUniforms( gl, program, renderer ) { path = info.name, addr = gl.getUniformLocation( program, path ); - parseUniform( info, addr, this$1 ); + parseUniform( info, addr, this ); } @@ -6021,14 +6009,12 @@ var UniformsLib = { var UniformsUtils = { merge: function ( uniforms ) { - var this$1 = this; - var merged = {}; for ( var u = 0; u < uniforms.length; u ++ ) { - var tmp = this$1.clone( uniforms[ u ] ); + var tmp = this.clone( uniforms[ u ] ); for ( var p in tmp ) { @@ -6670,14 +6656,12 @@ Object.assign( Box2.prototype, { }, setFromPoints: function ( points ) { - var this$1 = this; - this.makeEmpty(); for ( var i = 0, il = points.length; i < il; i ++ ) { - this$1.expandByPoint( points[ i ] ); + this.expandByPoint( points[ i ] ); } @@ -7710,8 +7694,6 @@ Material.prototype = Object.assign( Object.create( EventDispatcher.prototype ), onBeforeCompile: function () {}, setValues: function ( values ) { - var this$1 = this; - if ( values === undefined ) { return; } @@ -7729,17 +7711,17 @@ Material.prototype = Object.assign( Object.create( EventDispatcher.prototype ), // for backward compatability if shading is set in the constructor if ( key === 'shading' ) { - console.warn( 'THREE.' + this$1.type + ': .shading has been removed. Use the boolean .flatShading instead.' ); - this$1.flatShading = ( newValue === FlatShading ) ? true : false; + console.warn( 'THREE.' + this.type + ': .shading has been removed. Use the boolean .flatShading instead.' ); + this.flatShading = ( newValue === FlatShading ) ? true : false; continue; } - var currentValue = this$1[ key ]; + var currentValue = this[ key ]; if ( currentValue === undefined ) { - console.warn( "THREE." + this$1.type + ": '" + key + "' is not a property of this material." ); + console.warn( "THREE." + this.type + ": '" + key + "' is not a property of this material." ); continue; } @@ -7755,11 +7737,11 @@ Material.prototype = Object.assign( Object.create( EventDispatcher.prototype ), } else if ( key === 'overdraw' ) { // ensure overdraw is backwards-compatible with legacy boolean type - this$1[ key ] = Number( newValue ); + this[ key ] = Number( newValue ); } else { - this$1[ key ] = newValue; + this[ key ] = newValue; } @@ -8251,14 +8233,12 @@ Object.assign( Box3.prototype, { }, setFromPoints: function ( points ) { - var this$1 = this; - this.makeEmpty(); for ( var i = 0, il = points.length; i < il; i ++ ) { - this$1.expandByPoint( points[ i ] ); + this.expandByPoint( points[ i ] ); } @@ -10535,14 +10515,13 @@ Object3D.prototype = Object.assign( Object.create( EventDispatcher.prototype ), add: function ( object ) { var arguments$1 = arguments; - var this$1 = this; if ( arguments.length > 1 ) { for ( var i = 0; i < arguments.length; i ++ ) { - this$1.add( arguments$1[ i ] ); + this.add( arguments$1[ i ] ); } @@ -10582,14 +10561,13 @@ Object3D.prototype = Object.assign( Object.create( EventDispatcher.prototype ), remove: function ( object ) { var arguments$1 = arguments; - var this$1 = this; if ( arguments.length > 1 ) { for ( var i = 0; i < arguments.length; i ++ ) { - this$1.remove( arguments$1[ i ] ); + this.remove( arguments$1[ i ] ); } @@ -10626,14 +10604,12 @@ Object3D.prototype = Object.assign( Object.create( EventDispatcher.prototype ), }, getObjectByProperty: function ( name, value ) { - var this$1 = this; - if ( this[ name ] === value ) { return this; } for ( var i = 0, l = this.children.length; i < l; i ++ ) { - var child = this$1.children[ i ]; + var child = this.children[ i ]; var object = child.getObjectByProperty( name, value ); if ( object !== undefined ) { @@ -10817,8 +10793,6 @@ Object3D.prototype = Object.assign( Object.create( EventDispatcher.prototype ), }, toJSON: function ( meta ) { - var this$1 = this; - // meta is a string when called from JSON.stringify var isRootObject = ( meta === undefined || typeof meta === 'string' ); @@ -10914,7 +10888,7 @@ Object3D.prototype = Object.assign( Object.create( EventDispatcher.prototype ), for ( var i = 0, l = this.material.length; i < l; i ++ ) { - uuids.push( serialize( meta.materials, this$1.material[ i ] ) ); + uuids.push( serialize( meta.materials, this.material[ i ] ) ); } @@ -10936,7 +10910,7 @@ Object3D.prototype = Object.assign( Object.create( EventDispatcher.prototype ), for ( var i = 0; i < this.children.length; i ++ ) { - object.children.push( this$1.children[ i ].toJSON( meta ).object ); + object.children.push( this.children[ i ].toJSON( meta ).object ); } @@ -10988,8 +10962,6 @@ Object3D.prototype = Object.assign( Object.create( EventDispatcher.prototype ), }, copy: function ( source, recursive ) { - var this$1 = this; - if ( recursive === undefined ) { recursive = true; } @@ -11023,7 +10995,7 @@ Object3D.prototype = Object.assign( Object.create( EventDispatcher.prototype ), for ( var i = 0; i < source.children.length; i ++ ) { var child = source.children[ i ]; - this$1.add( child.clone() ); + this.add( child.clone() ); } @@ -11271,8 +11243,6 @@ Object.assign( Face3.prototype, { }, copy: function ( source ) { - var this$1 = this; - this.a = source.a; this.b = source.b; @@ -11285,13 +11255,13 @@ Object.assign( Face3.prototype, { for ( var i = 0, il = source.vertexNormals.length; i < il; i ++ ) { - this$1.vertexNormals[ i ] = source.vertexNormals[ i ].clone(); + this.vertexNormals[ i ] = source.vertexNormals[ i ].clone(); } for ( var i = 0, il = source.vertexColors.length; i < il; i ++ ) { - this$1.vertexColors[ i ] = source.vertexColors[ i ].clone(); + this.vertexColors[ i ] = source.vertexColors[ i ].clone(); } @@ -11356,21 +11326,19 @@ Geometry.prototype = Object.assign( Object.create( EventDispatcher.prototype ), isGeometry: true, applyMatrix: function ( matrix ) { - var this$1 = this; - var normalMatrix = new Matrix3().getNormalMatrix( matrix ); for ( var i = 0, il = this.vertices.length; i < il; i ++ ) { - var vertex = this$1.vertices[ i ]; + var vertex = this.vertices[ i ]; vertex.applyMatrix4( matrix ); } for ( var i = 0, il = this.faces.length; i < il; i ++ ) { - var face = this$1.faces[ i ]; + var face = this.faces[ i ]; face.normal.applyMatrix3( normalMatrix ).normalize(); for ( var j = 0, jl = face.vertexNormals.length; j < jl; j ++ ) { @@ -11681,18 +11649,16 @@ Geometry.prototype = Object.assign( Object.create( EventDispatcher.prototype ), }, computeFaceNormals: function () { - var this$1 = this; - var cb = new Vector3(), ab = new Vector3(); for ( var f = 0, fl = this.faces.length; f < fl; f ++ ) { - var face = this$1.faces[ f ]; + var face = this.faces[ f ]; - var vA = this$1.vertices[ face.a ]; - var vB = this$1.vertices[ face.b ]; - var vC = this$1.vertices[ face.c ]; + var vA = this.vertices[ face.a ]; + var vB = this.vertices[ face.b ]; + var vC = this.vertices[ face.c ]; cb.subVectors( vC, vB ); ab.subVectors( vA, vB ); @@ -11707,8 +11673,6 @@ Geometry.prototype = Object.assign( Object.create( EventDispatcher.prototype ), }, computeVertexNormals: function ( areaWeighted ) { - var this$1 = this; - if ( areaWeighted === undefined ) { areaWeighted = true; } @@ -11732,11 +11696,11 @@ Geometry.prototype = Object.assign( Object.create( EventDispatcher.prototype ), for ( f = 0, fl = this.faces.length; f < fl; f ++ ) { - face = this$1.faces[ f ]; + face = this.faces[ f ]; - vA = this$1.vertices[ face.a ]; - vB = this$1.vertices[ face.b ]; - vC = this$1.vertices[ face.c ]; + vA = this.vertices[ face.a ]; + vB = this.vertices[ face.b ]; + vC = this.vertices[ face.c ]; cb.subVectors( vC, vB ); ab.subVectors( vA, vB ); @@ -11754,7 +11718,7 @@ Geometry.prototype = Object.assign( Object.create( EventDispatcher.prototype ), for ( f = 0, fl = this.faces.length; f < fl; f ++ ) { - face = this$1.faces[ f ]; + face = this.faces[ f ]; vertices[ face.a ].add( face.normal ); vertices[ face.b ].add( face.normal ); @@ -11772,7 +11736,7 @@ Geometry.prototype = Object.assign( Object.create( EventDispatcher.prototype ), for ( f = 0, fl = this.faces.length; f < fl; f ++ ) { - face = this$1.faces[ f ]; + face = this.faces[ f ]; var vertexNormals = face.vertexNormals; @@ -11801,8 +11765,6 @@ Geometry.prototype = Object.assign( Object.create( EventDispatcher.prototype ), }, computeFlatVertexNormals: function () { - var this$1 = this; - var f, fl, face; @@ -11810,7 +11772,7 @@ Geometry.prototype = Object.assign( Object.create( EventDispatcher.prototype ), for ( f = 0, fl = this.faces.length; f < fl; f ++ ) { - face = this$1.faces[ f ]; + face = this.faces[ f ]; var vertexNormals = face.vertexNormals; @@ -11839,8 +11801,6 @@ Geometry.prototype = Object.assign( Object.create( EventDispatcher.prototype ), }, computeMorphNormals: function () { - var this$1 = this; - var i, il, f, fl, face; @@ -11850,7 +11810,7 @@ Geometry.prototype = Object.assign( Object.create( EventDispatcher.prototype ), for ( f = 0, fl = this.faces.length; f < fl; f ++ ) { - face = this$1.faces[ f ]; + face = this.faces[ f ]; if ( ! face.__originalFaceNormal ) { @@ -11889,14 +11849,14 @@ Geometry.prototype = Object.assign( Object.create( EventDispatcher.prototype ), // create on first access - if ( ! this$1.morphNormals[ i ] ) { + if ( ! this.morphNormals[ i ] ) { - this$1.morphNormals[ i ] = {}; - this$1.morphNormals[ i ].faceNormals = []; - this$1.morphNormals[ i ].vertexNormals = []; + this.morphNormals[ i ] = {}; + this.morphNormals[ i ].faceNormals = []; + this.morphNormals[ i ].vertexNormals = []; - var dstNormalsFace = this$1.morphNormals[ i ].faceNormals; - var dstNormalsVertex = this$1.morphNormals[ i ].vertexNormals; + var dstNormalsFace = this.morphNormals[ i ].faceNormals; + var dstNormalsVertex = this.morphNormals[ i ].vertexNormals; var faceNormal, vertexNormals; @@ -11912,11 +11872,11 @@ Geometry.prototype = Object.assign( Object.create( EventDispatcher.prototype ), } - var morphNormals = this$1.morphNormals[ i ]; + var morphNormals = this.morphNormals[ i ]; // set vertices to morph target - tmpGeo.vertices = this$1.morphTargets[ i ].vertices; + tmpGeo.vertices = this.morphTargets[ i ].vertices; // compute morph normals @@ -11929,7 +11889,7 @@ Geometry.prototype = Object.assign( Object.create( EventDispatcher.prototype ), for ( f = 0, fl = this.faces.length; f < fl; f ++ ) { - face = this$1.faces[ f ]; + face = this.faces[ f ]; faceNormal = morphNormals.faceNormals[ f ]; vertexNormals = morphNormals.vertexNormals[ f ]; @@ -11948,7 +11908,7 @@ Geometry.prototype = Object.assign( Object.create( EventDispatcher.prototype ), for ( f = 0, fl = this.faces.length; f < fl; f ++ ) { - face = this$1.faces[ f ]; + face = this.faces[ f ]; face.normal = face.__originalFaceNormal; face.vertexNormals = face.__originalVertexNormals; @@ -11958,8 +11918,6 @@ Geometry.prototype = Object.assign( Object.create( EventDispatcher.prototype ), }, computeLineDistances: function () { - var this$1 = this; - var d = 0; var vertices = this.vertices; @@ -11972,7 +11930,7 @@ Geometry.prototype = Object.assign( Object.create( EventDispatcher.prototype ), } - this$1.lineDistances[ i ] = d; + this.lineDistances[ i ] = d; } @@ -12144,8 +12102,6 @@ Geometry.prototype = Object.assign( Object.create( EventDispatcher.prototype ), */ mergeVertices: function () { - var this$1 = this; - var verticesMap = {}; // Hashmap for looking up vertices by position coordinates (and making sure they are unique) var unique = [], changes = []; @@ -12158,13 +12114,13 @@ Geometry.prototype = Object.assign( Object.create( EventDispatcher.prototype ), for ( i = 0, il = this.vertices.length; i < il; i ++ ) { - v = this$1.vertices[ i ]; + v = this.vertices[ i ]; key = Math.round( v.x * precision ) + '_' + Math.round( v.y * precision ) + '_' + Math.round( v.z * precision ); if ( verticesMap[ key ] === undefined ) { verticesMap[ key ] = i; - unique.push( this$1.vertices[ i ] ); + unique.push( this.vertices[ i ] ); changes[ i ] = unique.length - 1; } else { @@ -12183,7 +12139,7 @@ Geometry.prototype = Object.assign( Object.create( EventDispatcher.prototype ), for ( i = 0, il = this.faces.length; i < il; i ++ ) { - face = this$1.faces[ i ]; + face = this.faces[ i ]; face.a = changes[ face.a ]; face.b = changes[ face.b ]; @@ -12210,11 +12166,11 @@ Geometry.prototype = Object.assign( Object.create( EventDispatcher.prototype ), var idx = faceIndicesToRemove[ i ]; - this$1.faces.splice( idx, 1 ); + this.faces.splice( idx, 1 ); for ( j = 0, jl = this.faceVertexUvs.length; j < jl; j ++ ) { - this$1.faceVertexUvs[ j ].splice( idx, 1 ); + this.faceVertexUvs[ j ].splice( idx, 1 ); } @@ -12229,15 +12185,13 @@ Geometry.prototype = Object.assign( Object.create( EventDispatcher.prototype ), }, setFromPoints: function ( points ) { - var this$1 = this; - this.vertices = []; for ( var i = 0, l = points.length; i < l; i ++ ) { var point = points[ i ]; - this$1.vertices.push( new Vector3( point.x, point.y, point.z || 0 ) ); + this.vertices.push( new Vector3( point.x, point.y, point.z || 0 ) ); } @@ -12293,8 +12247,6 @@ Geometry.prototype = Object.assign( Object.create( EventDispatcher.prototype ), }, toJSON: function () { - var this$1 = this; - var data = { metadata: { @@ -12328,7 +12280,7 @@ Geometry.prototype = Object.assign( Object.create( EventDispatcher.prototype ), for ( var i = 0; i < this.vertices.length; i ++ ) { - var vertex = this$1.vertices[ i ]; + var vertex = this.vertices[ i ]; vertices.push( vertex.x, vertex.y, vertex.z ); } @@ -12343,11 +12295,11 @@ Geometry.prototype = Object.assign( Object.create( EventDispatcher.prototype ), for ( var i = 0; i < this.faces.length; i ++ ) { - var face = this$1.faces[ i ]; + var face = this.faces[ i ]; var hasMaterial = true; var hasFaceUv = false; // deprecated - var hasFaceVertexUv = this$1.faceVertexUvs[ 0 ][ i ] !== undefined; + var hasFaceVertexUv = this.faceVertexUvs[ 0 ][ i ] !== undefined; var hasFaceNormal = face.normal.length() > 0; var hasFaceVertexNormal = face.vertexNormals.length > 0; var hasFaceColor = face.color.r !== 1 || face.color.g !== 1 || face.color.b !== 1; @@ -12370,7 +12322,7 @@ Geometry.prototype = Object.assign( Object.create( EventDispatcher.prototype ), if ( hasFaceVertexUv ) { - var faceVertexUvs = this$1.faceVertexUvs[ 0 ][ i ]; + var faceVertexUvs = this.faceVertexUvs[ 0 ][ i ]; faces.push( getUvIndex( faceVertexUvs[ 0 ] ), @@ -12518,8 +12470,6 @@ Geometry.prototype = Object.assign( Object.create( EventDispatcher.prototype ), }, copy: function ( source ) { - var this$1 = this; - var i, il, j, jl, k, kl; @@ -12547,7 +12497,7 @@ Geometry.prototype = Object.assign( Object.create( EventDispatcher.prototype ), for ( i = 0, il = vertices.length; i < il; i ++ ) { - this$1.vertices.push( vertices[ i ].clone() ); + this.vertices.push( vertices[ i ].clone() ); } @@ -12557,7 +12507,7 @@ Geometry.prototype = Object.assign( Object.create( EventDispatcher.prototype ), for ( i = 0, il = colors.length; i < il; i ++ ) { - this$1.colors.push( colors[ i ].clone() ); + this.colors.push( colors[ i ].clone() ); } @@ -12567,7 +12517,7 @@ Geometry.prototype = Object.assign( Object.create( EventDispatcher.prototype ), for ( i = 0, il = faces.length; i < il; i ++ ) { - this$1.faces.push( faces[ i ].clone() ); + this.faces.push( faces[ i ].clone() ); } @@ -12577,9 +12527,9 @@ Geometry.prototype = Object.assign( Object.create( EventDispatcher.prototype ), var faceVertexUvs = source.faceVertexUvs[ i ]; - if ( this$1.faceVertexUvs[ i ] === undefined ) { + if ( this.faceVertexUvs[ i ] === undefined ) { - this$1.faceVertexUvs[ i ] = []; + this.faceVertexUvs[ i ] = []; } @@ -12595,7 +12545,7 @@ Geometry.prototype = Object.assign( Object.create( EventDispatcher.prototype ), } - this$1.faceVertexUvs[ i ].push( uvsCopy ); + this.faceVertexUvs[ i ].push( uvsCopy ); } @@ -12638,7 +12588,7 @@ Geometry.prototype = Object.assign( Object.create( EventDispatcher.prototype ), } - this$1.morphTargets.push( morphTarget ); + this.morphTargets.push( morphTarget ); } @@ -12685,7 +12635,7 @@ Geometry.prototype = Object.assign( Object.create( EventDispatcher.prototype ), } - this$1.morphNormals.push( morphNormal ); + this.morphNormals.push( morphNormal ); } @@ -12695,7 +12645,7 @@ Geometry.prototype = Object.assign( Object.create( EventDispatcher.prototype ), for ( i = 0, il = skinWeights.length; i < il; i ++ ) { - this$1.skinWeights.push( skinWeights[ i ].clone() ); + this.skinWeights.push( skinWeights[ i ].clone() ); } @@ -12705,7 +12655,7 @@ Geometry.prototype = Object.assign( Object.create( EventDispatcher.prototype ), for ( i = 0, il = skinIndices.length; i < il; i ++ ) { - this$1.skinIndices.push( skinIndices[ i ].clone() ); + this.skinIndices.push( skinIndices[ i ].clone() ); } @@ -12715,7 +12665,7 @@ Geometry.prototype = Object.assign( Object.create( EventDispatcher.prototype ), for ( i = 0, il = lineDistances.length; i < il; i ++ ) { - this$1.lineDistances.push( lineDistances[ i ] ); + this.lineDistances.push( lineDistances[ i ] ); } @@ -12839,15 +12789,13 @@ Object.assign( BufferAttribute.prototype, { }, copyAt: function ( index1, attribute, index2 ) { - var this$1 = this; - index1 *= this.itemSize; index2 *= attribute.itemSize; for ( var i = 0, l = this.itemSize; i < l; i ++ ) { - this$1.array[ index1 + i ] = attribute.array[ index2 + i ]; + this.array[ index1 + i ] = attribute.array[ index2 + i ]; } @@ -13273,8 +13221,6 @@ Object.assign( DirectGeometry.prototype, { }, fromGeometry: function ( geometry ) { - var this$1 = this; - var faces = geometry.faces; var vertices = geometry.vertices; @@ -13337,19 +13283,19 @@ Object.assign( DirectGeometry.prototype, { var face = faces[ i ]; - this$1.vertices.push( vertices[ face.a ], vertices[ face.b ], vertices[ face.c ] ); + this.vertices.push( vertices[ face.a ], vertices[ face.b ], vertices[ face.c ] ); var vertexNormals = face.vertexNormals; if ( vertexNormals.length === 3 ) { - this$1.normals.push( vertexNormals[ 0 ], vertexNormals[ 1 ], vertexNormals[ 2 ] ); + this.normals.push( vertexNormals[ 0 ], vertexNormals[ 1 ], vertexNormals[ 2 ] ); } else { var normal = face.normal; - this$1.normals.push( normal, normal, normal ); + this.normals.push( normal, normal, normal ); } @@ -13357,13 +13303,13 @@ Object.assign( DirectGeometry.prototype, { if ( vertexColors.length === 3 ) { - this$1.colors.push( vertexColors[ 0 ], vertexColors[ 1 ], vertexColors[ 2 ] ); + this.colors.push( vertexColors[ 0 ], vertexColors[ 1 ], vertexColors[ 2 ] ); } else { var color = face.color; - this$1.colors.push( color, color, color ); + this.colors.push( color, color, color ); } @@ -13373,13 +13319,13 @@ Object.assign( DirectGeometry.prototype, { if ( vertexUvs !== undefined ) { - this$1.uvs.push( vertexUvs[ 0 ], vertexUvs[ 1 ], vertexUvs[ 2 ] ); + this.uvs.push( vertexUvs[ 0 ], vertexUvs[ 1 ], vertexUvs[ 2 ] ); } else { console.warn( 'THREE.DirectGeometry.fromGeometry(): Undefined vertexUv ', i ); - this$1.uvs.push( new Vector2(), new Vector2(), new Vector2() ); + this.uvs.push( new Vector2(), new Vector2(), new Vector2() ); } @@ -13391,13 +13337,13 @@ Object.assign( DirectGeometry.prototype, { if ( vertexUvs !== undefined ) { - this$1.uvs2.push( vertexUvs[ 0 ], vertexUvs[ 1 ], vertexUvs[ 2 ] ); + this.uvs2.push( vertexUvs[ 0 ], vertexUvs[ 1 ], vertexUvs[ 2 ] ); } else { console.warn( 'THREE.DirectGeometry.fromGeometry(): Undefined vertexUv2 ', i ); - this$1.uvs2.push( new Vector2(), new Vector2(), new Vector2() ); + this.uvs2.push( new Vector2(), new Vector2(), new Vector2() ); } @@ -13425,13 +13371,13 @@ Object.assign( DirectGeometry.prototype, { if ( hasSkinIndices ) { - this$1.skinIndices.push( skinIndices[ face.a ], skinIndices[ face.b ], skinIndices[ face.c ] ); + this.skinIndices.push( skinIndices[ face.a ], skinIndices[ face.b ], skinIndices[ face.c ] ); } if ( hasSkinWeights ) { - this$1.skinWeights.push( skinWeights[ face.a ], skinWeights[ face.b ], skinWeights[ face.c ] ); + this.skinWeights.push( skinWeights[ face.a ], skinWeights[ face.b ], skinWeights[ face.c ] ); } @@ -13950,8 +13896,6 @@ BufferGeometry.prototype = Object.assign( Object.create( EventDispatcher.prototy }, fromDirectGeometry: function ( geometry ) { - var this$1 = this; - var positions = new Float32Array( geometry.vertices.length * 3 ); this.addAttribute( 'position', new BufferAttribute( positions, 3 ).copyVector3sArray( geometry.vertices ) ); @@ -14013,7 +13957,7 @@ BufferGeometry.prototype = Object.assign( Object.create( EventDispatcher.prototy } - this$1.morphAttributes[ name ] = array; + this.morphAttributes[ name ] = array; } @@ -14478,8 +14422,6 @@ BufferGeometry.prototype = Object.assign( Object.create( EventDispatcher.prototy }, copy: function ( source ) { - var this$1 = this; - var name, i, l; @@ -14513,7 +14455,7 @@ BufferGeometry.prototype = Object.assign( Object.create( EventDispatcher.prototy for ( name in attributes ) { var attribute = attributes[ name ]; - this$1.addAttribute( name, attribute.clone() ); + this.addAttribute( name, attribute.clone() ); } @@ -14532,7 +14474,7 @@ BufferGeometry.prototype = Object.assign( Object.create( EventDispatcher.prototy } - this$1.morphAttributes[ name ] = array; + this.morphAttributes[ name ] = array; } @@ -14543,7 +14485,7 @@ BufferGeometry.prototype = Object.assign( Object.create( EventDispatcher.prototy for ( i = 0, l = groups.length; i < l; i ++ ) { var group = groups[ i ]; - this$1.addGroup( group.start, group.count, group.materialIndex ); + this.addGroup( group.start, group.count, group.materialIndex ); } @@ -16100,8 +16042,6 @@ Mesh.prototype = Object.assign( Object.create( Object3D.prototype ), { }, updateMorphTargets: function () { - var this$1 = this; - var geometry = this.geometry; var m, ml, name; @@ -16124,8 +16064,8 @@ Mesh.prototype = Object.assign( Object.create( Object3D.prototype ), { name = morphAttribute[ m ].name || String( m ); - this$1.morphTargetInfluences.push( 0 ); - this$1.morphTargetDictionary[ name ] = m; + this.morphTargetInfluences.push( 0 ); + this.morphTargetDictionary[ name ] = m; } @@ -16146,8 +16086,8 @@ Mesh.prototype = Object.assign( Object.create( Object3D.prototype ), { name = morphTargets[ m ].name || String( m ); - this$1.morphTargetInfluences.push( 0 ); - this$1.morphTargetDictionary[ name ] = m; + this.morphTargetInfluences.push( 0 ); + this.morphTargetDictionary[ name ] = m; } @@ -16255,8 +16195,6 @@ Mesh.prototype = Object.assign( Object.create( Object3D.prototype ), { } return function raycast( raycaster, intersects ) { - var this$1 = this; - var geometry = this.geometry; var material = this.material; @@ -16306,7 +16244,7 @@ Mesh.prototype = Object.assign( Object.create( Object3D.prototype ), { b = index.getX( i + 1 ); c = index.getX( i + 2 ); - intersection = checkBufferGeometryIntersection( this$1, raycaster, ray, position, uv, a, b, c ); + intersection = checkBufferGeometryIntersection( this, raycaster, ray, position, uv, a, b, c ); if ( intersection ) { @@ -16327,7 +16265,7 @@ Mesh.prototype = Object.assign( Object.create( Object3D.prototype ), { b = i + 1; c = i + 2; - intersection = checkBufferGeometryIntersection( this$1, raycaster, ray, position, uv, a, b, c ); + intersection = checkBufferGeometryIntersection( this, raycaster, ray, position, uv, a, b, c ); if ( intersection ) { @@ -16366,7 +16304,7 @@ Mesh.prototype = Object.assign( Object.create( Object3D.prototype ), { if ( faceMaterial.morphTargets === true ) { var morphTargets = geometry.morphTargets; - var morphInfluences = this$1.morphTargetInfluences; + var morphInfluences = this.morphTargetInfluences; vA.set( 0, 0, 0 ); vB.set( 0, 0, 0 ); @@ -16396,7 +16334,7 @@ Mesh.prototype = Object.assign( Object.create( Object3D.prototype ), { } - intersection = checkIntersection( this$1, faceMaterial, raycaster, ray, fvA, fvB, fvC, intersectionPoint ); + intersection = checkIntersection( this, faceMaterial, raycaster, ray, fvA, fvB, fvC, intersectionPoint ); if ( intersection ) { @@ -23951,8 +23889,6 @@ LensFlare.prototype = Object.assign( Object.create( Object3D.prototype ), { isLensFlare: true, copy: function ( source ) { - var this$1 = this; - Object3D.prototype.copy.call( this, source ); @@ -23961,7 +23897,7 @@ LensFlare.prototype = Object.assign( Object.create( Object3D.prototype ), { for ( var i = 0, l = source.lensFlares.length; i < l; i ++ ) { - this$1.lensFlares.push( source.lensFlares[ i ] ); + this.lensFlares.push( source.lensFlares[ i ] ); } @@ -23999,8 +23935,6 @@ LensFlare.prototype = Object.assign( Object.create( Object3D.prototype ), { */ updateLensFlares: function () { - var this$1 = this; - var f, fl = this.lensFlares.length; var flare; @@ -24009,10 +23943,10 @@ LensFlare.prototype = Object.assign( Object.create( Object3D.prototype ), { for ( f = 0; f < fl; f ++ ) { - flare = this$1.lensFlares[ f ]; + flare = this.lensFlares[ f ]; - flare.x = this$1.positionScreen.x + vecX * flare.distance; - flare.y = this$1.positionScreen.y + vecY * flare.distance; + flare.x = this.positionScreen.x + vecX * flare.distance; + flare.y = this.positionScreen.y + vecY * flare.distance; flare.wantedRotation = flare.x * Math.PI * 0.25; flare.rotation += ( flare.wantedRotation - flare.rotation ) * 0.25; @@ -24159,8 +24093,6 @@ LOD.prototype = Object.assign( Object.create( Object3D.prototype ), { constructor: LOD, copy: function ( source ) { - var this$1 = this; - Object3D.prototype.copy.call( this, source, false ); @@ -24170,7 +24102,7 @@ LOD.prototype = Object.assign( Object.create( Object3D.prototype ), { var level = levels[ i ]; - this$1.addLevel( level.object.clone(), level.distance ); + this.addLevel( level.object.clone(), level.distance ); } @@ -24314,8 +24246,6 @@ LOD.prototype = Object.assign( Object.create( Object3D.prototype ), { */ function Skeleton( bones, boneInverses ) { - var this$1 = this; - // copy the bone array @@ -24344,7 +24274,7 @@ function Skeleton( bones, boneInverses ) { for ( var i = 0, il = this.bones.length; i < il; i ++ ) { - this$1.boneInverses.push( new Matrix4() ); + this.boneInverses.push( new Matrix4() ); } @@ -24357,8 +24287,6 @@ function Skeleton( bones, boneInverses ) { Object.assign( Skeleton.prototype, { calculateInverses: function () { - var this$1 = this; - this.boneInverses = []; @@ -24366,21 +24294,19 @@ Object.assign( Skeleton.prototype, { var inverse = new Matrix4(); - if ( this$1.bones[ i ] ) { + if ( this.bones[ i ] ) { - inverse.getInverse( this$1.bones[ i ].matrixWorld ); + inverse.getInverse( this.bones[ i ].matrixWorld ); } - this$1.boneInverses.push( inverse ); + this.boneInverses.push( inverse ); } }, pose: function () { - var this$1 = this; - var bone, i, il; @@ -24388,11 +24314,11 @@ Object.assign( Skeleton.prototype, { for ( i = 0, il = this.bones.length; i < il; i ++ ) { - bone = this$1.bones[ i ]; + bone = this.bones[ i ]; if ( bone ) { - bone.matrixWorld.getInverse( this$1.boneInverses[ i ] ); + bone.matrixWorld.getInverse( this.boneInverses[ i ] ); } @@ -24402,7 +24328,7 @@ Object.assign( Skeleton.prototype, { for ( i = 0, il = this.bones.length; i < il; i ++ ) { - bone = this$1.bones[ i ]; + bone = this.bones[ i ]; if ( bone ) { @@ -24522,8 +24448,6 @@ SkinnedMesh.prototype = Object.assign( Object.create( Mesh.prototype ), { isSkinnedMesh: true, initBones: function () { - var this$1 = this; - var bones = [], bone, gbone; var i, il; @@ -24534,7 +24458,7 @@ SkinnedMesh.prototype = Object.assign( Object.create( Mesh.prototype ), { for ( i = 0, il = this.geometry.bones.length; i < il; i ++ ) { - gbone = this$1.geometry.bones[ i ]; + gbone = this.geometry.bones[ i ]; // create new 'Bone' object @@ -24554,7 +24478,7 @@ SkinnedMesh.prototype = Object.assign( Object.create( Mesh.prototype ), { for ( i = 0, il = this.geometry.bones.length; i < il; i ++ ) { - gbone = this$1.geometry.bones[ i ]; + gbone = this.geometry.bones[ i ]; if ( ( gbone.parent !== - 1 ) && ( gbone.parent !== null ) && ( bones[ gbone.parent ] !== undefined ) ) { @@ -24566,7 +24490,7 @@ SkinnedMesh.prototype = Object.assign( Object.create( Mesh.prototype ), { // topmost bone, immediate child of the skinned mesh - this$1.add( bones[ i ] ); + this.add( bones[ i ] ); } @@ -24609,8 +24533,6 @@ SkinnedMesh.prototype = Object.assign( Object.create( Mesh.prototype ), { }, normalizeSkinWeights: function () { - var this$1 = this; - var scale, i; @@ -24618,7 +24540,7 @@ SkinnedMesh.prototype = Object.assign( Object.create( Mesh.prototype ), { for ( i = 0; i < this.geometry.skinWeights.length; i ++ ) { - var sw = this$1.geometry.skinWeights[ i ]; + var sw = this.geometry.skinWeights[ i ]; scale = 1.0 / sw.manhattanLength(); @@ -24781,8 +24703,6 @@ Line.prototype = Object.assign( Object.create( Object3D.prototype ), { var sphere = new Sphere(); return function raycast( raycaster, intersects ) { - var this$1 = this; - var precision = raycaster.linePrecision; var precisionSq = precision * precision; @@ -24832,7 +24752,7 @@ Line.prototype = Object.assign( Object.create( Object3D.prototype ), { if ( distSq > precisionSq ) { continue; } - interRay.applyMatrix4( this$1.matrixWorld ); //Move back to world space for distance calculation + interRay.applyMatrix4( this.matrixWorld ); //Move back to world space for distance calculation var distance = raycaster.ray.origin.distanceTo( interRay ); @@ -24843,11 +24763,11 @@ Line.prototype = Object.assign( Object.create( Object3D.prototype ), { 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$1.matrixWorld ), + point: interSegment.clone().applyMatrix4( this.matrixWorld ), index: i, face: null, faceIndex: null, - object: this$1 + object: this } ); @@ -24864,7 +24784,7 @@ Line.prototype = Object.assign( Object.create( Object3D.prototype ), { if ( distSq > precisionSq ) { continue; } - interRay.applyMatrix4( this$1.matrixWorld ); //Move back to world space for distance calculation + interRay.applyMatrix4( this.matrixWorld ); //Move back to world space for distance calculation var distance = raycaster.ray.origin.distanceTo( interRay ); @@ -24875,11 +24795,11 @@ Line.prototype = Object.assign( Object.create( Object3D.prototype ), { 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$1.matrixWorld ), + point: interSegment.clone().applyMatrix4( this.matrixWorld ), index: i, face: null, faceIndex: null, - object: this$1 + object: this } ); @@ -24898,7 +24818,7 @@ Line.prototype = Object.assign( Object.create( Object3D.prototype ), { if ( distSq > precisionSq ) { continue; } - interRay.applyMatrix4( this$1.matrixWorld ); //Move back to world space for distance calculation + interRay.applyMatrix4( this.matrixWorld ); //Move back to world space for distance calculation var distance = raycaster.ray.origin.distanceTo( interRay ); @@ -24909,11 +24829,11 @@ Line.prototype = Object.assign( Object.create( Object3D.prototype ), { 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$1.matrixWorld ), + point: interSegment.clone().applyMatrix4( this.matrixWorld ), index: i, face: null, faceIndex: null, - object: this$1 + object: this } ); @@ -27731,8 +27651,6 @@ ExtrudeBufferGeometry.prototype.getArrays = function () { }; ExtrudeBufferGeometry.prototype.addShapeList = function ( shapes, options ) { - var this$1 = this; - var sl = shapes.length; options.arrays = this.getArrays(); @@ -27740,7 +27658,7 @@ ExtrudeBufferGeometry.prototype.addShapeList = function ( shapes, options ) { for ( var s = 0; s < sl; s ++ ) { var shape = shapes[ s ]; - this$1.addShape( shape, options ); + this.addShape( shape, options ); } @@ -29030,8 +28948,6 @@ ShapeGeometry.prototype.toJSON = function () { // ShapeBufferGeometry function ShapeBufferGeometry( shapes, curveSegments ) { - var this$1 = this; - BufferGeometry.call( this ); @@ -29068,7 +28984,7 @@ function ShapeBufferGeometry( shapes, curveSegments ) { addShape( shapes[ i ] ); - this$1.addGroup( groupStart, groupCount, i ); // enables MultiMaterial support + this.addGroup( groupStart, groupCount, i ); // enables MultiMaterial support groupStart += groupCount; groupCount = 0; @@ -30715,8 +30631,6 @@ function FileLoader( manager ) { Object.assign( FileLoader.prototype, { load: function ( url, onLoad, onProgress, onError ) { - var this$1 = this; - if ( url === undefined ) { url = ''; } @@ -30956,9 +30870,9 @@ Object.assign( FileLoader.prototype, { if ( request.overrideMimeType ) { request.overrideMimeType( this.mimeType !== undefined ? this.mimeType : 'text/plain' ); } - for ( var header in this$1.requestHeader ) { + for ( var header in this.requestHeader ) { - request.setRequestHeader( header, this$1.requestHeader[ header ] ); + request.setRequestHeader( header, this.requestHeader[ header ] ); } @@ -31530,8 +31444,6 @@ Object.assign( Curve.prototype, { // Get sequence of points using getPoint( t ) getPoints: function ( divisions ) { - var this$1 = this; - if ( divisions === undefined ) { divisions = 5; } @@ -31539,7 +31451,7 @@ Object.assign( Curve.prototype, { for ( var d = 0; d <= divisions; d ++ ) { - points.push( this$1.getPoint( d / divisions ) ); + points.push( this.getPoint( d / divisions ) ); } @@ -31550,8 +31462,6 @@ Object.assign( Curve.prototype, { // Get sequence of points using getPointAt( u ) getSpacedPoints: function ( divisions ) { - var this$1 = this; - if ( divisions === undefined ) { divisions = 5; } @@ -31559,7 +31469,7 @@ Object.assign( Curve.prototype, { for ( var d = 0; d <= divisions; d ++ ) { - points.push( this$1.getPointAt( d / divisions ) ); + points.push( this.getPointAt( d / divisions ) ); } @@ -31579,8 +31489,6 @@ Object.assign( Curve.prototype, { // Get list of cumulative segment lengths getLengths: function ( divisions ) { - var this$1 = this; - if ( divisions === undefined ) { divisions = this.arcLengthDivisions; } @@ -31602,7 +31510,7 @@ Object.assign( Curve.prototype, { for ( p = 1; p <= divisions; p ++ ) { - current = this$1.getPoint( p / divisions ); + current = this.getPoint( p / divisions ); sum += current.distanceTo( last ); cache.push( sum ); last = current; @@ -31730,8 +31638,6 @@ Object.assign( Curve.prototype, { }, computeFrenetFrames: function ( segments, closed ) { - var this$1 = this; - // see http://www.cs.indiana.edu/pub/techreports/TR425.pdf @@ -31752,7 +31658,7 @@ Object.assign( Curve.prototype, { u = i / segments; - tangents[ i ] = this$1.getTangentAt( u ); + tangents[ i ] = this.getTangentAt( u ); tangents[ i ].normalize(); } @@ -32243,8 +32149,6 @@ CatmullRomCurve3.prototype.getPoint = function ( t, optionalTarget ) { }; CatmullRomCurve3.prototype.copy = function ( source ) { - var this$1 = this; - Curve.prototype.copy.call( this, source ); @@ -32254,7 +32158,7 @@ CatmullRomCurve3.prototype.copy = function ( source ) { var point = source.points[ i ]; - this$1.points.push( point.clone() ); + this.points.push( point.clone() ); } @@ -32267,8 +32171,6 @@ CatmullRomCurve3.prototype.copy = function ( source ) { }; CatmullRomCurve3.prototype.toJSON = function () { - var this$1 = this; - var data = Curve.prototype.toJSON.call( this ); @@ -32276,7 +32178,7 @@ CatmullRomCurve3.prototype.toJSON = function () { for ( var i = 0, l = this.points.length; i < l; i ++ ) { - var point = this$1.points[ i ]; + var point = this.points[ i ]; data.points.push( point.toArray() ); } @@ -32290,8 +32192,6 @@ CatmullRomCurve3.prototype.toJSON = function () { }; CatmullRomCurve3.prototype.fromJSON = function ( json ) { - var this$1 = this; - Curve.prototype.fromJSON.call( this, json ); @@ -32300,7 +32200,7 @@ CatmullRomCurve3.prototype.fromJSON = function ( json ) { for ( var i = 0, l = json.points.length; i < l; i ++ ) { var point = json.points[ i ]; - this$1.points.push( new Vector3().fromArray( point ) ); + this.points.push( new Vector3().fromArray( point ) ); } @@ -32874,8 +32774,6 @@ SplineCurve.prototype.getPoint = function ( t, optionalTarget ) { }; SplineCurve.prototype.copy = function ( source ) { - var this$1 = this; - Curve.prototype.copy.call( this, source ); @@ -32885,7 +32783,7 @@ SplineCurve.prototype.copy = function ( source ) { var point = source.points[ i ]; - this$1.points.push( point.clone() ); + this.points.push( point.clone() ); } @@ -32894,8 +32792,6 @@ SplineCurve.prototype.copy = function ( source ) { }; SplineCurve.prototype.toJSON = function () { - var this$1 = this; - var data = Curve.prototype.toJSON.call( this ); @@ -32903,7 +32799,7 @@ SplineCurve.prototype.toJSON = function () { for ( var i = 0, l = this.points.length; i < l; i ++ ) { - var point = this$1.points[ i ]; + var point = this.points[ i ]; data.points.push( point.toArray() ); } @@ -32913,8 +32809,6 @@ SplineCurve.prototype.toJSON = function () { }; SplineCurve.prototype.fromJSON = function ( json ) { - var this$1 = this; - Curve.prototype.fromJSON.call( this, json ); @@ -32923,7 +32817,7 @@ SplineCurve.prototype.fromJSON = function ( json ) { for ( var i = 0, l = json.points.length; i < l; i ++ ) { var point = json.points[ i ]; - this$1.points.push( new Vector2().fromArray( point ) ); + this.points.push( new Vector2().fromArray( point ) ); } @@ -33001,8 +32895,6 @@ CurvePath.prototype = Object.assign( Object.create( Curve.prototype ), { // 4. Return curve.getPointAt(t') getPoint: function ( t ) { - var this$1 = this; - var d = t * this.getLength(); var curveLengths = this.getCurveLengths(); @@ -33015,7 +32907,7 @@ CurvePath.prototype = Object.assign( Object.create( Curve.prototype ), { if ( curveLengths[ i ] >= d ) { var diff = curveLengths[ i ] - d; - var curve = this$1.curves[ i ]; + var curve = this.curves[ i ]; var segmentLength = curve.getLength(); var u = segmentLength === 0 ? 0 : 1 - diff / segmentLength; @@ -33058,8 +32950,6 @@ CurvePath.prototype = Object.assign( Object.create( Curve.prototype ), { // We cannot overwrite getLengths() because UtoT mapping uses it. getCurveLengths: function () { - var this$1 = this; - // We use cache values if curves and cache array are same length @@ -33076,7 +32966,7 @@ CurvePath.prototype = Object.assign( Object.create( Curve.prototype ), { for ( var i = 0, l = this.curves.length; i < l; i ++ ) { - sums += this$1.curves[ i ].getLength(); + sums += this.curves[ i ].getLength(); lengths.push( sums ); } @@ -33088,8 +32978,6 @@ CurvePath.prototype = Object.assign( Object.create( Curve.prototype ), { }, getSpacedPoints: function ( divisions ) { - var this$1 = this; - if ( divisions === undefined ) { divisions = 40; } @@ -33097,7 +32985,7 @@ CurvePath.prototype = Object.assign( Object.create( Curve.prototype ), { for ( var i = 0; i <= divisions; i ++ ) { - points.push( this$1.getPoint( i / divisions ) ); + points.push( this.getPoint( i / divisions ) ); } @@ -33151,8 +33039,6 @@ CurvePath.prototype = Object.assign( Object.create( Curve.prototype ), { }, copy: function ( source ) { - var this$1 = this; - Curve.prototype.copy.call( this, source ); @@ -33162,7 +33048,7 @@ CurvePath.prototype = Object.assign( Object.create( Curve.prototype ), { var curve = source.curves[ i ]; - this$1.curves.push( curve.clone() ); + this.curves.push( curve.clone() ); } @@ -33173,8 +33059,6 @@ CurvePath.prototype = Object.assign( Object.create( Curve.prototype ), { }, toJSON: function () { - var this$1 = this; - var data = Curve.prototype.toJSON.call( this ); @@ -33183,7 +33067,7 @@ CurvePath.prototype = Object.assign( Object.create( Curve.prototype ), { for ( var i = 0, l = this.curves.length; i < l; i ++ ) { - var curve = this$1.curves[ i ]; + var curve = this.curves[ i ]; data.curves.push( curve.toJSON() ); } @@ -33193,8 +33077,6 @@ CurvePath.prototype = Object.assign( Object.create( Curve.prototype ), { }, fromJSON: function ( json ) { - var this$1 = this; - Curve.prototype.fromJSON.call( this, json ); @@ -33204,7 +33086,7 @@ CurvePath.prototype = Object.assign( Object.create( Curve.prototype ), { for ( var i = 0, l = json.curves.length; i < l; i ++ ) { var curve = json.curves[ i ]; - this$1.curves.push( new Curves[ curve.type ]().fromJSON( curve ) ); + this.curves.push( new Curves[ curve.type ]().fromJSON( curve ) ); } @@ -33240,14 +33122,12 @@ Path.prototype = Object.assign( Object.create( CurvePath.prototype ), { constructor: Path, setFromPoints: function ( points ) { - var this$1 = this; - this.moveTo( points[ 0 ].x, points[ 0 ].y ); for ( var i = 1, l = points.length; i < l; i ++ ) { - this$1.lineTo( points[ i ].x, points[ i ].y ); + this.lineTo( points[ i ].x, points[ i ].y ); } @@ -33417,14 +33297,12 @@ Shape.prototype = Object.assign( Object.create( Path.prototype ), { constructor: Shape, getPointsHoles: function ( divisions ) { - var this$1 = this; - var holesPts = []; for ( var i = 0, l = this.holes.length; i < l; i ++ ) { - holesPts[ i ] = this$1.holes[ i ].getPoints( divisions ); + holesPts[ i ] = this.holes[ i ].getPoints( divisions ); } @@ -33446,8 +33324,6 @@ Shape.prototype = Object.assign( Object.create( Path.prototype ), { }, copy: function ( source ) { - var this$1 = this; - Path.prototype.copy.call( this, source ); @@ -33457,7 +33333,7 @@ Shape.prototype = Object.assign( Object.create( Path.prototype ), { var hole = source.holes[ i ]; - this$1.holes.push( hole.clone() ); + this.holes.push( hole.clone() ); } @@ -33466,8 +33342,6 @@ Shape.prototype = Object.assign( Object.create( Path.prototype ), { }, toJSON: function () { - var this$1 = this; - var data = Path.prototype.toJSON.call( this ); @@ -33476,7 +33350,7 @@ Shape.prototype = Object.assign( Object.create( Path.prototype ), { for ( var i = 0, l = this.holes.length; i < l; i ++ ) { - var hole = this$1.holes[ i ]; + var hole = this.holes[ i ]; data.holes.push( hole.toJSON() ); } @@ -33486,8 +33360,6 @@ Shape.prototype = Object.assign( Object.create( Path.prototype ), { }, fromJSON: function ( json ) { - var this$1 = this; - Path.prototype.fromJSON.call( this, json ); @@ -33497,7 +33369,7 @@ Shape.prototype = Object.assign( Object.create( Path.prototype ), { for ( var i = 0, l = json.holes.length; i < l; i ++ ) { var hole = json.holes[ i ]; - this$1.holes.push( new Path().fromJSON( hole ) ); + this.holes.push( new Path().fromJSON( hole ) ); } @@ -34051,8 +33923,6 @@ function Interpolant( parameterPositions, sampleValues, sampleSize, resultBuffer Object.assign( Interpolant.prototype, { evaluate: function ( t ) { - var this$1 = this; - var pp = this.parameterPositions, i1 = this._cachedIndex, @@ -34083,8 +33953,8 @@ Object.assign( Interpolant.prototype, { // after end i1 = pp.length; - this$1._cachedIndex = i1; - return this$1.afterEnd_( i1 - 1, t, t0 ); + this._cachedIndex = i1; + return this.afterEnd_( i1 - 1, t, t0 ); } @@ -34131,8 +34001,8 @@ Object.assign( Interpolant.prototype, { // before start - this$1._cachedIndex = 0; - return this$1.beforeStart_( 0, t, t1 ); + this._cachedIndex = 0; + return this.beforeStart_( 0, t, t1 ); } @@ -35122,8 +34992,6 @@ Object.assign( KeyframeTrack.prototype, { // ensure we do not get a GarbageInGarbageOut situation, make sure tracks are at least minimally viable validate: function () { - var this$1 = this; - var valid = true; @@ -35155,7 +35023,7 @@ Object.assign( KeyframeTrack.prototype, { if ( typeof currTime === 'number' && isNaN( currTime ) ) { - console.error( 'THREE.KeyframeTrack: Time is not a valid number.', this$1, i, currTime ); + console.error( 'THREE.KeyframeTrack: Time is not a valid number.', this, i, currTime ); valid = false; break; @@ -35163,7 +35031,7 @@ Object.assign( KeyframeTrack.prototype, { if ( prevTime !== null && prevTime > currTime ) { - console.error( 'THREE.KeyframeTrack: Out of order keys.', this$1, i, currTime, prevTime ); + console.error( 'THREE.KeyframeTrack: Out of order keys.', this, i, currTime, prevTime ); valid = false; break; @@ -35183,7 +35051,7 @@ Object.assign( KeyframeTrack.prototype, { if ( isNaN( value ) ) { - console.error( 'THREE.KeyframeTrack: Value is not a valid number.', this$1, i, value ); + console.error( 'THREE.KeyframeTrack: Value is not a valid number.', this, i, value ); valid = false; break; @@ -35643,14 +35511,12 @@ Object.assign( AnimationClip, { Object.assign( AnimationClip.prototype, { resetDuration: function () { - var this$1 = this; - var tracks = this.tracks, duration = 0; for ( var i = 0, n = tracks.length; i !== n; ++ i ) { - var track = this$1.tracks[ i ]; + var track = this.tracks[ i ]; duration = Math.max( duration, track.times[ track.times.length - 1 ] ); @@ -35661,12 +35527,10 @@ Object.assign( AnimationClip.prototype, { }, trim: function () { - var this$1 = this; - for ( var i = 0; i < this.tracks.length; i ++ ) { - this$1.tracks[ i ].trim( 0, this$1.duration ); + this.tracks[ i ].trim( 0, this.duration ); } @@ -35675,12 +35539,10 @@ Object.assign( AnimationClip.prototype, { }, optimize: function () { - var this$1 = this; - for ( var i = 0; i < this.tracks.length; i ++ ) { - this$1.tracks[ i ].optimize(); + this.tracks[ i ].optimize(); } @@ -36001,14 +35863,12 @@ Object.assign( Loader.prototype, { crossOrigin: undefined, initMaterials: function ( materials, texturePath, crossOrigin ) { - var this$1 = this; - var array = []; for ( var i = 0; i < materials.length; ++ i ) { - array[ i ] = this$1.createMaterial( materials[ i ], texturePath, crossOrigin ); + array[ i ] = this.createMaterial( materials[ i ], texturePath, crossOrigin ); } @@ -37000,8 +36860,6 @@ Object.assign( ObjectLoader.prototype, { }, parseGeometries: function ( json, shapes ) { - var this$1 = this; - var geometries = {}; @@ -37211,7 +37069,7 @@ Object.assign( ObjectLoader.prototype, { case 'Geometry': - geometry = geometryLoader.parse( data, this$1.texturePath ).geometry; + geometry = geometryLoader.parse( data, this.texturePath ).geometry; break; @@ -37412,8 +37270,6 @@ Object.assign( ObjectLoader.prototype, { var matrix = new Matrix4(); return function parseObject( data, geometries, materials ) { - var this$1 = this; - var object; @@ -37659,7 +37515,7 @@ Object.assign( ObjectLoader.prototype, { for ( var i = 0; i < children.length; i ++ ) { - object.add( this$1.parseObject( children[ i ], geometries, materials ) ); + object.add( this.parseObject( children[ i ], geometries, materials ) ); } @@ -38838,8 +38694,6 @@ Audio.prototype = Object.assign( Object.create( Object3D.prototype ), { }, connect: function () { - var this$1 = this; - if ( this.filters.length > 0 ) { @@ -38847,7 +38701,7 @@ Audio.prototype = Object.assign( Object.create( Object3D.prototype ), { for ( var i = 1, l = this.filters.length; i < l; i ++ ) { - this$1.filters[ i - 1 ].connect( this$1.filters[ i ] ); + this.filters[ i - 1 ].connect( this.filters[ i ] ); } @@ -38864,8 +38718,6 @@ Audio.prototype = Object.assign( Object.create( Object3D.prototype ), { }, disconnect: function () { - var this$1 = this; - if ( this.filters.length > 0 ) { @@ -38873,7 +38725,7 @@ Audio.prototype = Object.assign( Object.create( Object3D.prototype ), { for ( var i = 1, l = this.filters.length; i < l; i ++ ) { - this$1.filters[ i - 1 ].disconnect( this$1.filters[ i ] ); + this.filters[ i - 1 ].disconnect( this.filters[ i ] ); } @@ -41149,8 +41001,6 @@ AnimationMixer.prototype = Object.assign( Object.create( EventDispatcher.prototy constructor: AnimationMixer, _bindAction: function ( action, prototypeAction ) { - var this$1 = this; - var root = action._localRoot || this._root, tracks = action._clip.tracks, @@ -41189,7 +41039,7 @@ AnimationMixer.prototype = Object.assign( Object.create( EventDispatcher.prototy if ( binding._cacheIndex === null ) { ++ binding.referenceCount; - this$1._addInactiveBinding( binding, rootUuid, trackName ); + this._addInactiveBinding( binding, rootUuid, trackName ); } @@ -41205,7 +41055,7 @@ AnimationMixer.prototype = Object.assign( Object.create( EventDispatcher.prototy track.ValueTypeName, track.getValueSize() ); ++ binding.referenceCount; - this$1._addInactiveBinding( binding, rootUuid, trackName ); + this._addInactiveBinding( binding, rootUuid, trackName ); bindings[ i ] = binding; @@ -41218,8 +41068,6 @@ AnimationMixer.prototype = Object.assign( Object.create( EventDispatcher.prototy }, _activateAction: function ( action ) { - var this$1 = this; - if ( ! this._isActiveAction( action ) ) { @@ -41248,7 +41096,7 @@ AnimationMixer.prototype = Object.assign( Object.create( EventDispatcher.prototy if ( binding.useCount ++ === 0 ) { - this$1._lendBinding( binding ); + this._lendBinding( binding ); binding.saveOriginalState(); } @@ -41262,8 +41110,6 @@ AnimationMixer.prototype = Object.assign( Object.create( EventDispatcher.prototy }, _deactivateAction: function ( action ) { - var this$1 = this; - if ( this._isActiveAction( action ) ) { @@ -41277,7 +41123,7 @@ AnimationMixer.prototype = Object.assign( Object.create( EventDispatcher.prototy if ( -- binding.useCount === 0 ) { binding.restoreOriginalState(); - this$1._takeBackBinding( binding ); + this._takeBackBinding( binding ); } @@ -41448,8 +41294,6 @@ AnimationMixer.prototype = Object.assign( Object.create( EventDispatcher.prototy }, _removeInactiveBindingsForAction: function ( action ) { - var this$1 = this; - var bindings = action._propertyBindings; for ( var i = 0, n = bindings.length; i !== n; ++ i ) { @@ -41458,7 +41302,7 @@ AnimationMixer.prototype = Object.assign( Object.create( EventDispatcher.prototy if ( -- binding.referenceCount === 0 ) { - this$1._removeInactiveBinding( binding ); + this._removeInactiveBinding( binding ); } @@ -41789,8 +41633,6 @@ AnimationMixer.prototype = Object.assign( Object.create( EventDispatcher.prototy // free all resources specific to a particular clip uncacheClip: function ( clip ) { - var this$1 = this; - var actions = this._actions, clipUuid = clip.uuid, @@ -41809,7 +41651,7 @@ AnimationMixer.prototype = Object.assign( Object.create( EventDispatcher.prototy var action = actionsToRemove[ i ]; - this$1._deactivateAction( action ); + this._deactivateAction( action ); var cacheIndex = action._cacheIndex, lastInactiveAction = actions[ actions.length - 1 ]; @@ -41821,7 +41663,7 @@ AnimationMixer.prototype = Object.assign( Object.create( EventDispatcher.prototy actions[ cacheIndex ] = lastInactiveAction; actions.pop(); - this$1._removeInactiveBindingsForAction( action ); + this._removeInactiveBindingsForAction( action ); } @@ -41833,8 +41675,6 @@ AnimationMixer.prototype = Object.assign( Object.create( EventDispatcher.prototy // free all resources specific to a particular root target object uncacheRoot: function ( root ) { - var this$1 = this; - var rootUuid = root.uuid, actionsByClip = this._actionsByClip; @@ -41846,8 +41686,8 @@ AnimationMixer.prototype = Object.assign( Object.create( EventDispatcher.prototy if ( action !== undefined ) { - this$1._deactivateAction( action ); - this$1._removeInactiveAction( action ); + this._deactivateAction( action ); + this._removeInactiveAction( action ); } @@ -41862,7 +41702,7 @@ AnimationMixer.prototype = Object.assign( Object.create( EventDispatcher.prototy var binding = bindingByName[ trackName ]; binding.restoreOriginalState(); - this$1._removeInactiveBinding( binding ); + this._removeInactiveBinding( binding ); } @@ -42152,15 +41992,13 @@ Object.assign( InterleavedBuffer.prototype, { }, copyAt: function ( index1, attribute, index2 ) { - var this$1 = this; - index1 *= this.stride; index2 *= attribute.stride; for ( var i = 0, l = this.stride; i < l; i ++ ) { - this$1.array[ index1 + i ] = attribute.array[ index2 + i ]; + this.array[ index1 + i ] = attribute.array[ index2 + i ]; } @@ -42360,8 +42198,6 @@ Object.assign( Raycaster.prototype, { }, intersectObjects: function ( objects, recursive ) { - var this$1 = this; - var intersects = []; @@ -42374,7 +42210,7 @@ Object.assign( Raycaster.prototype, { for ( var i = 0, l = objects.length; i < l; i ++ ) { - intersectObject( objects[ i ], this$1, intersects, recursive ); + intersectObject( objects[ i ], this, intersects, recursive ); } @@ -42671,8 +42507,6 @@ VertexNormalsHelper.prototype.update = ( function () { var normalMatrix = new Matrix3(); return function update() { - var this$1 = this; - var keys = [ 'a', 'b', 'c' ]; @@ -42708,7 +42542,7 @@ VertexNormalsHelper.prototype.update = ( function () { v1.copy( vertex ).applyMatrix4( matrixWorld ); - v2.copy( normal ).applyMatrix3( normalMatrix ).normalize().multiplyScalar( this$1.size ).add( v1 ); + v2.copy( normal ).applyMatrix3( normalMatrix ).normalize().multiplyScalar( this.size ).add( v1 ); position.setXYZ( idx, v1.x, v1.y, v1.z ); @@ -42738,7 +42572,7 @@ VertexNormalsHelper.prototype.update = ( function () { v2.set( objNorm.getX( j ), objNorm.getY( j ), objNorm.getZ( j ) ); - v2.applyMatrix3( normalMatrix ).normalize().multiplyScalar( this$1.size ).add( v1 ); + v2.applyMatrix3( normalMatrix ).normalize().multiplyScalar( this.size ).add( v1 ); position.setXYZ( idx, v1.x, v1.y, v1.z ); @@ -43405,8 +43239,6 @@ FaceNormalsHelper.prototype.update = ( function () { var normalMatrix = new Matrix3(); return function update() { - var this$1 = this; - this.object.updateMatrixWorld( true ); @@ -43438,7 +43270,7 @@ FaceNormalsHelper.prototype.update = ( function () { .divideScalar( 3 ) .applyMatrix4( matrixWorld ); - v2.copy( normal ).applyMatrix3( normalMatrix ).normalize().multiplyScalar( this$1.size ).add( v1 ); + v2.copy( normal ).applyMatrix3( normalMatrix ).normalize().multiplyScalar( this.size ).add( v1 ); position.setXYZ( idx, v1.x, v1.y, v1.z ); @@ -46330,7 +46162,7 @@ var closestAxisPoint = function(axisRay, camera, mousePos) { * @author Julius Kammerl - jkammerl@willowgarage.com */ -var DepthCloud = (function (superclass) { +var DepthCloud = /*@__PURE__*/(function (superclass) { function DepthCloud(options) { superclass.call(this); options = options || {}; @@ -46547,8 +46379,6 @@ var DepthCloud = (function (superclass) { * Callback called when video metadata is ready */ DepthCloud.prototype.initStreamer = function initStreamer () { - var this$1 = this; - if (this.metaLoaded) { this.texture = new THREE$1.Texture(this.video); @@ -46557,10 +46387,10 @@ var DepthCloud = (function (superclass) { for (var i = 0, l = this.width * this.height; i < l; i++) { var vertex = new THREE$1.Vector3(); - vertex.x = (i % this$1.width); - vertex.y = Math.floor(i / this$1.width); + vertex.x = (i % this.width); + vertex.y = Math.floor(i / this.width); - this$1.geometry.vertices.push(vertex); + this.geometry.vertices.push(vertex); } this.material = new THREE$1.ShaderMaterial({ @@ -46648,7 +46478,7 @@ var DepthCloud = (function (superclass) { * @author David Gossow - dgossow@willowgarage.com */ -var Arrow = (function (superclass) { +var Arrow = /*@__PURE__*/(function (superclass) { function Arrow(options) { options = options || {}; var origin = options.origin || new THREE$1.Vector3(0, 0, 0); @@ -50519,7 +50349,7 @@ THREE$1.ColladaLoader.prototype = { * @author Russell Toris - rctoris@wpi.edu */ -var MeshResource = (function (superclass) { +var MeshResource = /*@__PURE__*/(function (superclass) { function MeshResource(options) { superclass.call(this); var that = this; @@ -50602,7 +50432,7 @@ var MeshResource = (function (superclass) { * @author David Gossow - dgossow@willowgarage.com */ -var TriangleList = (function (superclass) { +var TriangleList = /*@__PURE__*/(function (superclass) { function TriangleList(options) { options = options || {}; var material = options.material || new THREE$1.MeshBasicMaterial(); @@ -50677,7 +50507,7 @@ var TriangleList = (function (superclass) { * @author Russell Toris - rctoris@wpi.edu */ -var Marker = (function (superclass) { +var Marker = /*@__PURE__*/(function (superclass) { function Marker(options) { superclass.call(this); @@ -51161,7 +50991,7 @@ var Marker = (function (superclass) { * @author David Gossow - dgossow@willowgarage.com */ -var InteractiveMarkerControl = (function (superclass) { +var InteractiveMarkerControl = /*@__PURE__*/(function (superclass) { function InteractiveMarkerControl(options) { superclass.call(this); var that = this; @@ -51423,7 +51253,7 @@ var InteractiveMarkerControl = (function (superclass) { * @author David Gossow - dgossow@willowgarage.com */ -var InteractiveMarkerMenu = (function (superclass) { +var InteractiveMarkerMenu = /*@__PURE__*/(function (superclass) { function InteractiveMarkerMenu(options) { superclass.call(this); var that = this; @@ -51597,7 +51427,7 @@ var InteractiveMarkerMenu = (function (superclass) { * @author David Gossow - dgossow@willowgarage.com */ -var InteractiveMarker = (function (superclass) { +var InteractiveMarker = /*@__PURE__*/(function (superclass) { function InteractiveMarker(options) { superclass.call(this); @@ -52120,9 +51950,7 @@ var eventemitter2 = createCommonjsModule(function (module, exports) { return listeners; } - function growListenerTree(type, listener) { - var this$1 = this; - + function growListenerTree(type, listener) { type = typeof type === 'string' ? type.split(this.delimiter) : type.slice(); @@ -52160,11 +51988,11 @@ var eventemitter2 = createCommonjsModule(function (module, exports) { if ( !tree._listeners.warned && - this$1._maxListeners > 0 && - tree._listeners.length > this$1._maxListeners + this._maxListeners > 0 && + tree._listeners.length > this._maxListeners ) { tree._listeners.warned = true; - logPossibleMemoryLeak.call(this$1, tree._listeners.length, name); + logPossibleMemoryLeak.call(this, tree._listeners.length, name); } } return true; @@ -52238,7 +52066,6 @@ var eventemitter2 = createCommonjsModule(function (module, exports) { EventEmitter.prototype.emit = function() { var arguments$1 = arguments; - var this$1 = this; this._events || init.call(this); @@ -52263,19 +52090,19 @@ var eventemitter2 = createCommonjsModule(function (module, exports) { } for (i = 0, l = handler.length; i < l; i++) { - this$1.event = type; + this.event = type; switch (al) { case 1: - handler[i].call(this$1, type); + handler[i].call(this, type); break; case 2: - handler[i].call(this$1, type, arguments$1[1]); + handler[i].call(this, type, arguments$1[1]); break; case 3: - handler[i].call(this$1, type, arguments$1[1], arguments$1[2]); + handler[i].call(this, type, arguments$1[1], arguments$1[2]); break; default: - handler[i].apply(this$1, args); + handler[i].apply(this, args); } } } @@ -52317,19 +52144,19 @@ var eventemitter2 = createCommonjsModule(function (module, exports) { for (j = 1; j < al; j++) { args[j - 1] = arguments$1[j]; } } for (i = 0, l = handler.length; i < l; i++) { - this$1.event = type; + this.event = type; switch (al) { case 1: - handler[i].call(this$1); + handler[i].call(this); break; case 2: - handler[i].call(this$1, arguments$1[1]); + handler[i].call(this, arguments$1[1]); break; case 3: - handler[i].call(this$1, arguments$1[1], arguments$1[2]); + handler[i].call(this, arguments$1[1], arguments$1[2]); break; default: - handler[i].apply(this$1, args); + handler[i].apply(this, args); } } return true; @@ -52347,7 +52174,6 @@ var eventemitter2 = createCommonjsModule(function (module, exports) { EventEmitter.prototype.emitAsync = function() { var arguments$1 = arguments; - var this$1 = this; this._events || init.call(this); @@ -52370,19 +52196,19 @@ var eventemitter2 = createCommonjsModule(function (module, exports) { for (j = 1; j < al; j++) { args[j] = arguments$1[j]; } } for (i = 0, l = this._all.length; i < l; i++) { - this$1.event = type; + this.event = type; switch (al) { case 1: - promises.push(this$1._all[i].call(this$1, type)); + promises.push(this._all[i].call(this, type)); break; case 2: - promises.push(this$1._all[i].call(this$1, type, arguments$1[1])); + promises.push(this._all[i].call(this, type, arguments$1[1])); break; case 3: - promises.push(this$1._all[i].call(this$1, type, arguments$1[1], arguments$1[2])); + promises.push(this._all[i].call(this, type, arguments$1[1], arguments$1[2])); break; default: - promises.push(this$1._all[i].apply(this$1, args)); + promises.push(this._all[i].apply(this, args)); } } } @@ -52419,19 +52245,19 @@ var eventemitter2 = createCommonjsModule(function (module, exports) { for (j = 1; j < al; j++) { args[j - 1] = arguments$1[j]; } } for (i = 0, l = handler.length; i < l; i++) { - this$1.event = type; + this.event = type; switch (al) { case 1: - promises.push(handler[i].call(this$1)); + promises.push(handler[i].call(this)); break; case 2: - promises.push(handler[i].call(this$1, arguments$1[1])); + promises.push(handler[i].call(this, arguments$1[1])); break; case 3: - promises.push(handler[i].call(this$1, arguments$1[1], arguments$1[2])); + promises.push(handler[i].call(this, arguments$1[1], arguments$1[2])); break; default: - promises.push(handler[i].apply(this$1, args)); + promises.push(handler[i].apply(this, args)); } } } else if (!this._all && type === 'error') { @@ -52533,9 +52359,7 @@ var eventemitter2 = createCommonjsModule(function (module, exports) { return this; }; - EventEmitter.prototype.off = function(type, listener) { - var this$1 = this; - + EventEmitter.prototype.off = function(type, listener) { if (typeof listener !== 'function') { throw new Error('removeListener only takes instances of Function'); } @@ -52573,37 +52397,37 @@ var eventemitter2 = createCommonjsModule(function (module, exports) { continue; } - if(this$1.wildcard) { + if(this.wildcard) { leaf._listeners.splice(position, 1); } else { - this$1._events[type].splice(position, 1); + this._events[type].splice(position, 1); } if (handlers.length === 0) { - if(this$1.wildcard) { + if(this.wildcard) { delete leaf._listeners; } else { - delete this$1._events[type]; + delete this._events[type]; } } - this$1.emit("removeListener", type, listener); + this.emit("removeListener", type, listener); - return this$1; + return this; } else if (handlers === listener || (handlers.listener && handlers.listener === listener) || (handlers._origin && handlers._origin === listener)) { - if(this$1.wildcard) { + if(this.wildcard) { delete leaf._listeners; } else { - delete this$1._events[type]; + delete this._events[type]; } - this$1.emit("removeListener", type, listener); + this.emit("removeListener", type, listener); } } @@ -52630,23 +52454,21 @@ var eventemitter2 = createCommonjsModule(function (module, exports) { return this; }; - EventEmitter.prototype.offAny = function(fn) { - var this$1 = this; - + EventEmitter.prototype.offAny = function(fn) { var i = 0, l = 0, fns; if (fn && this._all && this._all.length > 0) { fns = this._all; for(i = 0, l = fns.length; i < l; i++) { if(fn === fns[i]) { fns.splice(i, 1); - this$1.emit("removeListenerAny", fn); - return this$1; + this.emit("removeListenerAny", fn); + return this; } } } else { fns = this._all; for(i = 0, l = fns.length; i < l; i++) - { this$1.emit("removeListenerAny", fns[i]); } + { this.emit("removeListenerAny", fns[i]); } this._all = []; } return this; @@ -52727,7 +52549,7 @@ var eventemitter2 = createCommonjsModule(function (module, exports) { * @author David Gossow - dgossow@willowgarage.com */ -var InteractiveMarkerHandle = (function (EventEmitter2) { +var InteractiveMarkerHandle = /*@__PURE__*/(function (EventEmitter2) { function InteractiveMarkerHandle(options) { EventEmitter2.call(this); options = options || {}; @@ -52958,8 +52780,6 @@ InteractiveMarkerClient.prototype.subscribe = function subscribe (topic) { * Unsubscribe from the current interactive marker topic. */ InteractiveMarkerClient.prototype.unsubscribe = function unsubscribe () { - var this$1 = this; - if (this.updateTopic) { this.updateTopic.unsubscribe(); } @@ -52967,8 +52787,8 @@ InteractiveMarkerClient.prototype.unsubscribe = function unsubscribe () { this.feedbackTopic.unadvertise(); } // erase all markers - for (var intMarkerName in this$1.interactiveMarkers) { - this$1.eraseIntMarker(intMarkerName); + for (var intMarkerName in this.interactiveMarkers) { + this.eraseIntMarker(intMarkerName); } this.interactiveMarkers = {}; }; @@ -52978,13 +52798,11 @@ InteractiveMarkerClient.prototype.unsubscribe = function unsubscribe () { * @param initMessage - the interactive marker initialization message to process */ InteractiveMarkerClient.prototype.processInit = function processInit (initMessage) { - var this$1 = this; - var message = initMessage.msg; // erase any old markers message.erases = []; - for (var intMarkerName in this$1.interactiveMarkers) { + for (var intMarkerName in this.interactiveMarkers) { message.erases.push(intMarkerName); } message.poses = []; @@ -53092,7 +52910,7 @@ InteractiveMarkerClient.prototype.eraseIntMarker = function eraseIntMarker (intM * @author Russell Toris - rctoris@wpi.edu */ -var SceneNode = (function (superclass) { +var SceneNode = /*@__PURE__*/(function (superclass) { function SceneNode(options) { superclass.call(this); options = options || {}; @@ -53154,7 +52972,7 @@ var SceneNode = (function (superclass) { * @author Nils Berg - berg.nils@gmail.com */ -var MarkerArrayClient = (function (EventEmitter2) { +var MarkerArrayClient = /*@__PURE__*/(function (EventEmitter2) { function MarkerArrayClient(options) { EventEmitter2.call(this); options = options || {}; @@ -53188,8 +53006,6 @@ var MarkerArrayClient = (function (EventEmitter2) { }; MarkerArrayClient.prototype.processMessage = function processMessage (arrayMessage){ arrayMessage.markers.forEach(function(message) { - var this$1 = this; - if(message.action === 0) { var updated = false; if(message.ns + message.id in this.markers) { // "MODIFY" @@ -53221,9 +53037,9 @@ var MarkerArrayClient = (function (EventEmitter2) { delete this.markers[message.ns + message.id]; } else if(message.action === 3) { // "DELETE ALL" - for (var m in this$1.markers){ - this$1.markers[m].unsubscribeTf(); - this$1.rootObject.remove(this$1.markers[m]); + for (var m in this.markers){ + this.markers[m].unsubscribeTf(); + this.rootObject.remove(this.markers[m]); } this.markers = {}; } @@ -53247,7 +53063,7 @@ var MarkerArrayClient = (function (EventEmitter2) { * @author Russell Toris - rctoris@wpi.edu */ -var MarkerClient = (function (EventEmitter2) { +var MarkerClient = /*@__PURE__*/(function (EventEmitter2) { function MarkerClient(options) { EventEmitter2.call(this); options = options || {}; @@ -53332,7 +53148,7 @@ var MarkerClient = (function (EventEmitter2) { * @author Jihoon Lee - lee@magazino.eu */ -var Arrow2 = (function (superclass) { +var Arrow2 = /*@__PURE__*/(function (superclass) { function Arrow2(options) { options = options || {}; var origin = options.origin || new THREE$1.Vector3(0, 0, 0); @@ -53372,7 +53188,7 @@ var Arrow2 = (function (superclass) { * @author David Gossow - dgossow@willowgarage.com */ -var Axes = (function (superclass) { +var Axes = /*@__PURE__*/(function (superclass) { function Axes(options) { superclass.call(this); var that = this; @@ -53461,10 +53277,8 @@ var Axes = (function (superclass) { * @author Russell Toris - rctoris@wpi.edu */ -var Grid = (function (superclass) { +var Grid = /*@__PURE__*/(function (superclass) { function Grid(options) { - var this$1 = this; - options = options || {}; var num_cells = options.num_cells || 10; var color = options.color || '#cccccc'; @@ -53491,8 +53305,8 @@ var Grid = (function (superclass) { new THREE$1.Vector3( position, -edge, 0 ), new THREE$1.Vector3( position, edge, 0 ) ); - this$1.add(new THREE$1.Line(geometryH, material)); - this$1.add(new THREE$1.Line(geometryV, material)); + this.add(new THREE$1.Line(geometryH, material)); + this.add(new THREE$1.Line(geometryV, material)); } } @@ -53507,7 +53321,7 @@ var Grid = (function (superclass) { * @author Russell Toris - rctoris@wpi.edu */ -var OccupancyGrid = (function (superclass) { +var OccupancyGrid = /*@__PURE__*/(function (superclass) { function OccupancyGrid(options) { options = options || {}; var message = options.message; @@ -53587,7 +53401,7 @@ var OccupancyGrid = (function (superclass) { * @author Russell Toris - rctoris@wpi.edu */ -var OccupancyGridClient = (function (EventEmitter2) { +var OccupancyGridClient = /*@__PURE__*/(function (EventEmitter2) { function OccupancyGridClient(options) { EventEmitter2.call(this); options = options || {}; @@ -53625,6 +53439,7 @@ var OccupancyGridClient = (function (EventEmitter2) { ros : this.ros, name : this.topicName, messageType : 'nav_msgs/OccupancyGrid', + queue_length : 1, compression : this.compression }); this.rosTopic.subscribe(this.processMessage.bind(this)); @@ -53676,7 +53491,7 @@ var OccupancyGridClient = (function (EventEmitter2) { * @author David V. Lu!! - davidvlu@gmail.com */ -var Odometry = (function (superclass) { +var Odometry = /*@__PURE__*/(function (superclass) { function Odometry(options) { superclass.call(this); this.options = options || {}; @@ -53710,6 +53525,7 @@ var Odometry = (function (superclass) { this.rosTopic = new ROSLIB.Topic({ ros : this.ros, name : this.topicName, + queue_length : 1, messageType : 'nav_msgs/Odometry' }); this.rosTopic.subscribe(this.processMessage.bind(this)); @@ -53747,7 +53563,7 @@ var Odometry = (function (superclass) { * @author David V. Lu!! - davidvlu@gmail.com */ -var Path$1 = (function (superclass) { +var Path$1 = /*@__PURE__*/(function (superclass) { function Path(options) { superclass.call(this); options = options || {}; @@ -53780,6 +53596,7 @@ var Path$1 = (function (superclass) { this.rosTopic = new ROSLIB.Topic({ ros : this.ros, name : this.topicName, + queue_length : 1, messageType : 'nav_msgs/Path' }); this.rosTopic.subscribe(this.processMessage.bind(this)); @@ -53817,7 +53634,7 @@ var Path$1 = (function (superclass) { * @author David V. Lu!! - davidvlu@gmail.com */ -var Point = (function (superclass) { +var Point = /*@__PURE__*/(function (superclass) { function Point(options) { superclass.call(this); this.options = options || {}; @@ -53850,6 +53667,7 @@ var Point = (function (superclass) { this.rosTopic = new ROSLIB.Topic({ ros : this.ros, name : this.topicName, + queue_length : 1, messageType : 'geometry_msgs/PointStamped' }); this.rosTopic.subscribe(this.processMessage.bind(this)); @@ -53881,7 +53699,7 @@ var Point = (function (superclass) { * @author David V. Lu!! - davidvlu@gmail.com */ -var Polygon = (function (superclass) { +var Polygon = /*@__PURE__*/(function (superclass) { function Polygon(options) { superclass.call(this); options = options || {}; @@ -53914,6 +53732,7 @@ var Polygon = (function (superclass) { this.rosTopic = new ROSLIB.Topic({ ros : this.ros, name : this.topicName, + queue_length : 1, messageType : 'geometry_msgs/PolygonStamped' }); this.rosTopic.subscribe(this.processMessage.bind(this)); @@ -53954,7 +53773,7 @@ var Polygon = (function (superclass) { * @author David V. Lu!! - davidvlu@gmail.com */ -var Pose = (function (superclass) { +var Pose = /*@__PURE__*/(function (superclass) { function Pose(options) { superclass.call(this); this.options = options || {}; @@ -53986,6 +53805,7 @@ var Pose = (function (superclass) { this.rosTopic = new ROSLIB.Topic({ ros : this.ros, name : this.topicName, + queue_length : 1, messageType : 'geometry_msgs/PoseStamped' }); this.rosTopic.subscribe(this.processMessage.bind(this)); @@ -54022,7 +53842,7 @@ var Pose = (function (superclass) { * @author David V. Lu!! - davidvlu@gmail.com */ -var PoseArray = (function (superclass) { +var PoseArray = /*@__PURE__*/(function (superclass) { function PoseArray(options) { superclass.call(this); this.options = options || {}; @@ -54055,13 +53875,12 @@ var PoseArray = (function (superclass) { this.rosTopic = new ROSLIB.Topic({ ros : this.ros, name : this.topicName, + queue_length : 1, messageType : 'geometry_msgs/PoseArray' }); this.rosTopic.subscribe(this.processMessage.bind(this)); }; PoseArray.prototype.processMessage = function processMessage (message){ - var this$1 = this; - if(this.sn!==null){ this.sn.unsubscribeTf(); this.rootObject.remove(this.sn); @@ -54080,9 +53899,9 @@ var PoseArray = (function (superclass) { var rot = new THREE$1.Quaternion(message.poses[i].orientation.x, message.poses[i].orientation.y, message.poses[i].orientation.z, message.poses[i].orientation.w); - var tip = new THREE$1.Vector3(this$1.length,0,0); - var side1 = new THREE$1.Vector3(this$1.length*0.8, this$1.length*0.2, 0); - var side2 = new THREE$1.Vector3(this$1.length*0.8, -this$1.length*0.2, 0); + var tip = new THREE$1.Vector3(this.length,0,0); + var side1 = new THREE$1.Vector3(this.length*0.8, this.length*0.2, 0); + var side2 = new THREE$1.Vector3(this.length*0.8, -this.length*0.2, 0); tip.applyQuaternion(rot); side1.applyQuaternion(rot); side2.applyQuaternion(rot); @@ -54093,7 +53912,7 @@ var PoseArray = (function (superclass) { lineGeometry.vertices.push(tip); lineGeometry.computeLineDistances(); - var lineMaterial = new THREE$1.LineBasicMaterial( { color: this$1.color } ); + var lineMaterial = new THREE$1.LineBasicMaterial( { color: this.color } ); line = new THREE$1.Line( lineGeometry, lineMaterial ); group.add(line); @@ -54115,7 +53934,7 @@ var PoseArray = (function (superclass) { * @author David V. Lu!! - davidvlu@gmail.com */ -var PoseWithCovariance = (function (superclass) { +var PoseWithCovariance = /*@__PURE__*/(function (superclass) { function PoseWithCovariance(options) { superclass.call(this); this.options = options || {}; @@ -54147,6 +53966,7 @@ var PoseWithCovariance = (function (superclass) { this.rosTopic = new ROSLIB.Topic({ ros : this.ros, name : this.topicName, + queue_length : 1, messageType : 'geometry_msgs/PoseWithCovarianceStamped' }); this.rosTopic.subscribe(this.processMessage.bind(this)); @@ -54184,7 +54004,7 @@ var PoseWithCovariance = (function (superclass) { * @author Mathieu Bredif - mathieu.bredif@ign.fr */ -var Points$1 = (function (superclass) { +var Points$1 = /*@__PURE__*/(function (superclass) { function Points(options) { superclass.call(this); options = options || {}; @@ -54215,14 +54035,12 @@ var Points$1 = (function (superclass) { Points.prototype.setup = function setup (frame, point_step, fields) { - var this$1 = this; - if(this.sn===null){ // turn fields to a map fields = fields || []; this.fields = {}; for(var i=0; i= message.range_min && range <= message.range_max){ var angle = message.angle_min + i * message.angle_increment; - this$1.points.positions.array[j++] = range * Math.cos(angle); - this$1.points.positions.array[j++] = range * Math.sin(angle); - this$1.points.positions.array[j++] = 0.0; + this.points.positions.array[j++] = range * Math.cos(angle); + this.points.positions.array[j++] = range * Math.sin(angle); + this.points.positions.array[j++] = 0.0; } } this.points.update(j/3); @@ -54389,7 +54208,7 @@ decode64.e={}; for(var i=0;i<64;i++){decode64.e[decode64.S.charAt(i)]=i;} -var PointCloud2 = (function (superclass) { +var PointCloud2 = /*@__PURE__*/(function (superclass) { function PointCloud2(options) { superclass.call(this); options = options || {}; @@ -54420,13 +54239,12 @@ var PointCloud2 = (function (superclass) { ros : this.ros, name : this.topicName, messageType : 'sensor_msgs/PointCloud2', + queue_length : 1, compression: this.compression }); this.rosTopic.subscribe(this.processMessage.bind(this)); }; PointCloud2.prototype.processMessage = function processMessage (msg){ - var this$1 = this; - if(!this.points.setup(msg.header.frame_id, msg.point_step, msg.fields)) { return; } @@ -54453,15 +54271,15 @@ var PointCloud2 = (function (superclass) { var base, color; for(var i = 0; i < n; i++){ base = i * pointRatio * msg.point_step; - this$1.points.positions.array[3*i ] = dv.getFloat32(base+x, littleEndian); - this$1.points.positions.array[3*i + 1] = dv.getFloat32(base+y, littleEndian); - this$1.points.positions.array[3*i + 2] = dv.getFloat32(base+z, littleEndian); - - if(this$1.points.colors){ - color = this$1.points.colormap(this$1.points.getColor(dv,base,littleEndian)); - this$1.points.colors.array[3*i ] = color.r; - this$1.points.colors.array[3*i + 1] = color.g; - this$1.points.colors.array[3*i + 2] = color.b; + this.points.positions.array[3*i ] = dv.getFloat32(base+x, littleEndian); + this.points.positions.array[3*i + 1] = dv.getFloat32(base+y, littleEndian); + this.points.positions.array[3*i + 2] = dv.getFloat32(base+z, littleEndian); + + if(this.points.colors){ + color = this.points.colormap(this.points.getColor(dv,base,littleEndian)); + this.points.colors.array[3*i ] = color.r; + this.points.colors.array[3*i + 1] = color.g; + this.points.colors.array[3*i + 2] = color.b; } } this.points.update(n); @@ -54475,10 +54293,8 @@ var PointCloud2 = (function (superclass) { * @author Russell Toris - rctoris@wpi.edu */ -var Urdf = (function (superclass) { +var Urdf = /*@__PURE__*/(function (superclass) { function Urdf(options) { - var this$1 = this; - options = options || {}; var urdfModel = options.urdfModel; var path = options.path || '/'; @@ -54534,7 +54350,7 @@ var Urdf = (function (superclass) { tfClient : tfClient, object : mesh }); - this$1.add(sceneNode); + this.add(sceneNode); } else { console.warn('Could not load geometry mesh: '+uri); } @@ -54569,7 +54385,7 @@ var Urdf = (function (superclass) { tfClient: tfClient, object: shapeMesh }); - this$1.add(scene); + this.add(scene); } } } @@ -54724,8 +54540,6 @@ Highlighter.prototype.makeEverythingInvisible = function makeEverythingInvisible * @param scene - the object to traverse */ Highlighter.prototype.makeHighlightedVisible = function makeHighlightedVisible (scene) { - var this$1 = this; - var makeVisible = function(currentObject) { if ( currentObject instanceof THREE$1.Mesh || currentObject instanceof THREE$1.Line || currentObject instanceof THREE$1.Sprite ) { @@ -54733,8 +54547,8 @@ Highlighter.prototype.makeHighlightedVisible = function makeHighlightedVisible ( } }; - for (var uuid in this$1.hoverObjs) { - var selectedObject = this$1.hoverObjs[uuid]; + for (var uuid in this.hoverObjs) { + var selectedObject = this.hoverObjs[uuid]; // Make each selected object and all of its children visible selectedObject.visible = true; selectedObject.traverse(makeVisible); @@ -54758,7 +54572,7 @@ Highlighter.prototype.restoreVisibility = function restoreVisibility (scene) { * @author David Gossow - dgossow@willowgarage.com */ -var MouseHandler = (function (superclass) { +var MouseHandler = /*@__PURE__*/(function (superclass) { function MouseHandler(options) { superclass.call(this); this.renderer = options.renderer; @@ -54929,8 +54743,6 @@ var MouseHandler = (function (superclass) { * @returns if an event was canceled */ MouseHandler.prototype.notify = function notify (target, type, event3D) { - var this$1 = this; - // ensure the type is set // event3D.type = type; @@ -54956,7 +54768,7 @@ var MouseHandler = (function (superclass) { && event3D.currentTarget.dispatchEvent instanceof Function) { event3D.currentTarget.dispatchEvent(event3D); if (event3D.cancelBubble) { - this$1.dispatchEvent(event3D); + this.dispatchEvent(event3D); return 0; // Event Accepted } else if(event3D.continueBubble) { @@ -54980,7 +54792,7 @@ var MouseHandler = (function (superclass) { * @author AlteredQualia - http://alteredqualia.com */ -var OrbitControls = (function (superclass) { +var OrbitControls = /*@__PURE__*/(function (superclass) { function OrbitControls(options) { superclass.call(this); var that = this; diff --git a/build/ros3d.esm.js b/build/ros3d.esm.js index 2e083728..fbcf8697 100644 --- a/build/ros3d.esm.js +++ b/build/ros3d.esm.js @@ -159,8 +159,6 @@ Object.assign( EventDispatcher.prototype, { }, dispatchEvent: function ( event ) { - var this$1 = this; - if ( this._listeners === undefined ) { return; } @@ -175,7 +173,7 @@ Object.assign( EventDispatcher.prototype, { for ( var i = 0, l = array.length; i < l; i ++ ) { - array[ i ].call( this$1, event ); + array[ i ].call( this, event ); } @@ -1397,8 +1395,6 @@ Object.assign( Matrix4.prototype, { var v1 = new Vector3(); return function applyToBufferAttribute( attribute ) { - var this$1 = this; - for ( var i = 0, l = attribute.count; i < l; i ++ ) { @@ -1406,7 +1402,7 @@ Object.assign( Matrix4.prototype, { v1.y = attribute.getY( i ); v1.z = attribute.getZ( i ); - v1.applyMatrix4( this$1 ); + v1.applyMatrix4( this ); attribute.setXYZ( i, v1.x, v1.y, v1.z ); @@ -1828,14 +1824,12 @@ Object.assign( Matrix4.prototype, { }, fromArray: function ( array, offset ) { - var this$1 = this; - if ( offset === undefined ) { offset = 0; } for ( var i = 0; i < 16; i ++ ) { - this$1.elements[ i ] = array[ i + offset ]; + this.elements[ i ] = array[ i + offset ]; } @@ -3301,8 +3295,6 @@ Object.assign( Matrix3.prototype, { var v1 = new Vector3(); return function applyToBufferAttribute( attribute ) { - var this$1 = this; - for ( var i = 0, l = attribute.count; i < l; i ++ ) { @@ -3310,7 +3302,7 @@ Object.assign( Matrix3.prototype, { v1.y = attribute.getY( i ); v1.z = attribute.getZ( i ); - v1.applyMatrix3( this$1 ); + v1.applyMatrix3( this ); attribute.setXYZ( i, v1.x, v1.y, v1.z ); @@ -3554,14 +3546,12 @@ Object.assign( Matrix3.prototype, { }, fromArray: function ( array, offset ) { - var this$1 = this; - if ( offset === undefined ) { offset = 0; } for ( var i = 0; i < 9; i ++ ) { - this$1.elements[ i ] = array[ i + offset ]; + this.elements[ i ] = array[ i + offset ]; } @@ -5235,8 +5225,6 @@ function parseUniform( activeInfo, addr, container ) { // Root Container function WebGLUniforms( gl, program, renderer ) { - var this$1 = this; - UniformContainer.call( this ); @@ -5250,7 +5238,7 @@ function WebGLUniforms( gl, program, renderer ) { path = info.name, addr = gl.getUniformLocation( program, path ); - parseUniform( info, addr, this$1 ); + parseUniform( info, addr, this ); } @@ -6017,14 +6005,12 @@ var UniformsLib = { var UniformsUtils = { merge: function ( uniforms ) { - var this$1 = this; - var merged = {}; for ( var u = 0; u < uniforms.length; u ++ ) { - var tmp = this$1.clone( uniforms[ u ] ); + var tmp = this.clone( uniforms[ u ] ); for ( var p in tmp ) { @@ -6666,14 +6652,12 @@ Object.assign( Box2.prototype, { }, setFromPoints: function ( points ) { - var this$1 = this; - this.makeEmpty(); for ( var i = 0, il = points.length; i < il; i ++ ) { - this$1.expandByPoint( points[ i ] ); + this.expandByPoint( points[ i ] ); } @@ -7706,8 +7690,6 @@ Material.prototype = Object.assign( Object.create( EventDispatcher.prototype ), onBeforeCompile: function () {}, setValues: function ( values ) { - var this$1 = this; - if ( values === undefined ) { return; } @@ -7725,17 +7707,17 @@ Material.prototype = Object.assign( Object.create( EventDispatcher.prototype ), // for backward compatability if shading is set in the constructor if ( key === 'shading' ) { - console.warn( 'THREE.' + this$1.type + ': .shading has been removed. Use the boolean .flatShading instead.' ); - this$1.flatShading = ( newValue === FlatShading ) ? true : false; + console.warn( 'THREE.' + this.type + ': .shading has been removed. Use the boolean .flatShading instead.' ); + this.flatShading = ( newValue === FlatShading ) ? true : false; continue; } - var currentValue = this$1[ key ]; + var currentValue = this[ key ]; if ( currentValue === undefined ) { - console.warn( "THREE." + this$1.type + ": '" + key + "' is not a property of this material." ); + console.warn( "THREE." + this.type + ": '" + key + "' is not a property of this material." ); continue; } @@ -7751,11 +7733,11 @@ Material.prototype = Object.assign( Object.create( EventDispatcher.prototype ), } else if ( key === 'overdraw' ) { // ensure overdraw is backwards-compatible with legacy boolean type - this$1[ key ] = Number( newValue ); + this[ key ] = Number( newValue ); } else { - this$1[ key ] = newValue; + this[ key ] = newValue; } @@ -8247,14 +8229,12 @@ Object.assign( Box3.prototype, { }, setFromPoints: function ( points ) { - var this$1 = this; - this.makeEmpty(); for ( var i = 0, il = points.length; i < il; i ++ ) { - this$1.expandByPoint( points[ i ] ); + this.expandByPoint( points[ i ] ); } @@ -10531,14 +10511,13 @@ Object3D.prototype = Object.assign( Object.create( EventDispatcher.prototype ), add: function ( object ) { var arguments$1 = arguments; - var this$1 = this; if ( arguments.length > 1 ) { for ( var i = 0; i < arguments.length; i ++ ) { - this$1.add( arguments$1[ i ] ); + this.add( arguments$1[ i ] ); } @@ -10578,14 +10557,13 @@ Object3D.prototype = Object.assign( Object.create( EventDispatcher.prototype ), remove: function ( object ) { var arguments$1 = arguments; - var this$1 = this; if ( arguments.length > 1 ) { for ( var i = 0; i < arguments.length; i ++ ) { - this$1.remove( arguments$1[ i ] ); + this.remove( arguments$1[ i ] ); } @@ -10622,14 +10600,12 @@ Object3D.prototype = Object.assign( Object.create( EventDispatcher.prototype ), }, getObjectByProperty: function ( name, value ) { - var this$1 = this; - if ( this[ name ] === value ) { return this; } for ( var i = 0, l = this.children.length; i < l; i ++ ) { - var child = this$1.children[ i ]; + var child = this.children[ i ]; var object = child.getObjectByProperty( name, value ); if ( object !== undefined ) { @@ -10813,8 +10789,6 @@ Object3D.prototype = Object.assign( Object.create( EventDispatcher.prototype ), }, toJSON: function ( meta ) { - var this$1 = this; - // meta is a string when called from JSON.stringify var isRootObject = ( meta === undefined || typeof meta === 'string' ); @@ -10910,7 +10884,7 @@ Object3D.prototype = Object.assign( Object.create( EventDispatcher.prototype ), for ( var i = 0, l = this.material.length; i < l; i ++ ) { - uuids.push( serialize( meta.materials, this$1.material[ i ] ) ); + uuids.push( serialize( meta.materials, this.material[ i ] ) ); } @@ -10932,7 +10906,7 @@ Object3D.prototype = Object.assign( Object.create( EventDispatcher.prototype ), for ( var i = 0; i < this.children.length; i ++ ) { - object.children.push( this$1.children[ i ].toJSON( meta ).object ); + object.children.push( this.children[ i ].toJSON( meta ).object ); } @@ -10984,8 +10958,6 @@ Object3D.prototype = Object.assign( Object.create( EventDispatcher.prototype ), }, copy: function ( source, recursive ) { - var this$1 = this; - if ( recursive === undefined ) { recursive = true; } @@ -11019,7 +10991,7 @@ Object3D.prototype = Object.assign( Object.create( EventDispatcher.prototype ), for ( var i = 0; i < source.children.length; i ++ ) { var child = source.children[ i ]; - this$1.add( child.clone() ); + this.add( child.clone() ); } @@ -11267,8 +11239,6 @@ Object.assign( Face3.prototype, { }, copy: function ( source ) { - var this$1 = this; - this.a = source.a; this.b = source.b; @@ -11281,13 +11251,13 @@ Object.assign( Face3.prototype, { for ( var i = 0, il = source.vertexNormals.length; i < il; i ++ ) { - this$1.vertexNormals[ i ] = source.vertexNormals[ i ].clone(); + this.vertexNormals[ i ] = source.vertexNormals[ i ].clone(); } for ( var i = 0, il = source.vertexColors.length; i < il; i ++ ) { - this$1.vertexColors[ i ] = source.vertexColors[ i ].clone(); + this.vertexColors[ i ] = source.vertexColors[ i ].clone(); } @@ -11352,21 +11322,19 @@ Geometry.prototype = Object.assign( Object.create( EventDispatcher.prototype ), isGeometry: true, applyMatrix: function ( matrix ) { - var this$1 = this; - var normalMatrix = new Matrix3().getNormalMatrix( matrix ); for ( var i = 0, il = this.vertices.length; i < il; i ++ ) { - var vertex = this$1.vertices[ i ]; + var vertex = this.vertices[ i ]; vertex.applyMatrix4( matrix ); } for ( var i = 0, il = this.faces.length; i < il; i ++ ) { - var face = this$1.faces[ i ]; + var face = this.faces[ i ]; face.normal.applyMatrix3( normalMatrix ).normalize(); for ( var j = 0, jl = face.vertexNormals.length; j < jl; j ++ ) { @@ -11677,18 +11645,16 @@ Geometry.prototype = Object.assign( Object.create( EventDispatcher.prototype ), }, computeFaceNormals: function () { - var this$1 = this; - var cb = new Vector3(), ab = new Vector3(); for ( var f = 0, fl = this.faces.length; f < fl; f ++ ) { - var face = this$1.faces[ f ]; + var face = this.faces[ f ]; - var vA = this$1.vertices[ face.a ]; - var vB = this$1.vertices[ face.b ]; - var vC = this$1.vertices[ face.c ]; + var vA = this.vertices[ face.a ]; + var vB = this.vertices[ face.b ]; + var vC = this.vertices[ face.c ]; cb.subVectors( vC, vB ); ab.subVectors( vA, vB ); @@ -11703,8 +11669,6 @@ Geometry.prototype = Object.assign( Object.create( EventDispatcher.prototype ), }, computeVertexNormals: function ( areaWeighted ) { - var this$1 = this; - if ( areaWeighted === undefined ) { areaWeighted = true; } @@ -11728,11 +11692,11 @@ Geometry.prototype = Object.assign( Object.create( EventDispatcher.prototype ), for ( f = 0, fl = this.faces.length; f < fl; f ++ ) { - face = this$1.faces[ f ]; + face = this.faces[ f ]; - vA = this$1.vertices[ face.a ]; - vB = this$1.vertices[ face.b ]; - vC = this$1.vertices[ face.c ]; + vA = this.vertices[ face.a ]; + vB = this.vertices[ face.b ]; + vC = this.vertices[ face.c ]; cb.subVectors( vC, vB ); ab.subVectors( vA, vB ); @@ -11750,7 +11714,7 @@ Geometry.prototype = Object.assign( Object.create( EventDispatcher.prototype ), for ( f = 0, fl = this.faces.length; f < fl; f ++ ) { - face = this$1.faces[ f ]; + face = this.faces[ f ]; vertices[ face.a ].add( face.normal ); vertices[ face.b ].add( face.normal ); @@ -11768,7 +11732,7 @@ Geometry.prototype = Object.assign( Object.create( EventDispatcher.prototype ), for ( f = 0, fl = this.faces.length; f < fl; f ++ ) { - face = this$1.faces[ f ]; + face = this.faces[ f ]; var vertexNormals = face.vertexNormals; @@ -11797,8 +11761,6 @@ Geometry.prototype = Object.assign( Object.create( EventDispatcher.prototype ), }, computeFlatVertexNormals: function () { - var this$1 = this; - var f, fl, face; @@ -11806,7 +11768,7 @@ Geometry.prototype = Object.assign( Object.create( EventDispatcher.prototype ), for ( f = 0, fl = this.faces.length; f < fl; f ++ ) { - face = this$1.faces[ f ]; + face = this.faces[ f ]; var vertexNormals = face.vertexNormals; @@ -11835,8 +11797,6 @@ Geometry.prototype = Object.assign( Object.create( EventDispatcher.prototype ), }, computeMorphNormals: function () { - var this$1 = this; - var i, il, f, fl, face; @@ -11846,7 +11806,7 @@ Geometry.prototype = Object.assign( Object.create( EventDispatcher.prototype ), for ( f = 0, fl = this.faces.length; f < fl; f ++ ) { - face = this$1.faces[ f ]; + face = this.faces[ f ]; if ( ! face.__originalFaceNormal ) { @@ -11885,14 +11845,14 @@ Geometry.prototype = Object.assign( Object.create( EventDispatcher.prototype ), // create on first access - if ( ! this$1.morphNormals[ i ] ) { + if ( ! this.morphNormals[ i ] ) { - this$1.morphNormals[ i ] = {}; - this$1.morphNormals[ i ].faceNormals = []; - this$1.morphNormals[ i ].vertexNormals = []; + this.morphNormals[ i ] = {}; + this.morphNormals[ i ].faceNormals = []; + this.morphNormals[ i ].vertexNormals = []; - var dstNormalsFace = this$1.morphNormals[ i ].faceNormals; - var dstNormalsVertex = this$1.morphNormals[ i ].vertexNormals; + var dstNormalsFace = this.morphNormals[ i ].faceNormals; + var dstNormalsVertex = this.morphNormals[ i ].vertexNormals; var faceNormal, vertexNormals; @@ -11908,11 +11868,11 @@ Geometry.prototype = Object.assign( Object.create( EventDispatcher.prototype ), } - var morphNormals = this$1.morphNormals[ i ]; + var morphNormals = this.morphNormals[ i ]; // set vertices to morph target - tmpGeo.vertices = this$1.morphTargets[ i ].vertices; + tmpGeo.vertices = this.morphTargets[ i ].vertices; // compute morph normals @@ -11925,7 +11885,7 @@ Geometry.prototype = Object.assign( Object.create( EventDispatcher.prototype ), for ( f = 0, fl = this.faces.length; f < fl; f ++ ) { - face = this$1.faces[ f ]; + face = this.faces[ f ]; faceNormal = morphNormals.faceNormals[ f ]; vertexNormals = morphNormals.vertexNormals[ f ]; @@ -11944,7 +11904,7 @@ Geometry.prototype = Object.assign( Object.create( EventDispatcher.prototype ), for ( f = 0, fl = this.faces.length; f < fl; f ++ ) { - face = this$1.faces[ f ]; + face = this.faces[ f ]; face.normal = face.__originalFaceNormal; face.vertexNormals = face.__originalVertexNormals; @@ -11954,8 +11914,6 @@ Geometry.prototype = Object.assign( Object.create( EventDispatcher.prototype ), }, computeLineDistances: function () { - var this$1 = this; - var d = 0; var vertices = this.vertices; @@ -11968,7 +11926,7 @@ Geometry.prototype = Object.assign( Object.create( EventDispatcher.prototype ), } - this$1.lineDistances[ i ] = d; + this.lineDistances[ i ] = d; } @@ -12140,8 +12098,6 @@ Geometry.prototype = Object.assign( Object.create( EventDispatcher.prototype ), */ mergeVertices: function () { - var this$1 = this; - var verticesMap = {}; // Hashmap for looking up vertices by position coordinates (and making sure they are unique) var unique = [], changes = []; @@ -12154,13 +12110,13 @@ Geometry.prototype = Object.assign( Object.create( EventDispatcher.prototype ), for ( i = 0, il = this.vertices.length; i < il; i ++ ) { - v = this$1.vertices[ i ]; + v = this.vertices[ i ]; key = Math.round( v.x * precision ) + '_' + Math.round( v.y * precision ) + '_' + Math.round( v.z * precision ); if ( verticesMap[ key ] === undefined ) { verticesMap[ key ] = i; - unique.push( this$1.vertices[ i ] ); + unique.push( this.vertices[ i ] ); changes[ i ] = unique.length - 1; } else { @@ -12179,7 +12135,7 @@ Geometry.prototype = Object.assign( Object.create( EventDispatcher.prototype ), for ( i = 0, il = this.faces.length; i < il; i ++ ) { - face = this$1.faces[ i ]; + face = this.faces[ i ]; face.a = changes[ face.a ]; face.b = changes[ face.b ]; @@ -12206,11 +12162,11 @@ Geometry.prototype = Object.assign( Object.create( EventDispatcher.prototype ), var idx = faceIndicesToRemove[ i ]; - this$1.faces.splice( idx, 1 ); + this.faces.splice( idx, 1 ); for ( j = 0, jl = this.faceVertexUvs.length; j < jl; j ++ ) { - this$1.faceVertexUvs[ j ].splice( idx, 1 ); + this.faceVertexUvs[ j ].splice( idx, 1 ); } @@ -12225,15 +12181,13 @@ Geometry.prototype = Object.assign( Object.create( EventDispatcher.prototype ), }, setFromPoints: function ( points ) { - var this$1 = this; - this.vertices = []; for ( var i = 0, l = points.length; i < l; i ++ ) { var point = points[ i ]; - this$1.vertices.push( new Vector3( point.x, point.y, point.z || 0 ) ); + this.vertices.push( new Vector3( point.x, point.y, point.z || 0 ) ); } @@ -12289,8 +12243,6 @@ Geometry.prototype = Object.assign( Object.create( EventDispatcher.prototype ), }, toJSON: function () { - var this$1 = this; - var data = { metadata: { @@ -12324,7 +12276,7 @@ Geometry.prototype = Object.assign( Object.create( EventDispatcher.prototype ), for ( var i = 0; i < this.vertices.length; i ++ ) { - var vertex = this$1.vertices[ i ]; + var vertex = this.vertices[ i ]; vertices.push( vertex.x, vertex.y, vertex.z ); } @@ -12339,11 +12291,11 @@ Geometry.prototype = Object.assign( Object.create( EventDispatcher.prototype ), for ( var i = 0; i < this.faces.length; i ++ ) { - var face = this$1.faces[ i ]; + var face = this.faces[ i ]; var hasMaterial = true; var hasFaceUv = false; // deprecated - var hasFaceVertexUv = this$1.faceVertexUvs[ 0 ][ i ] !== undefined; + var hasFaceVertexUv = this.faceVertexUvs[ 0 ][ i ] !== undefined; var hasFaceNormal = face.normal.length() > 0; var hasFaceVertexNormal = face.vertexNormals.length > 0; var hasFaceColor = face.color.r !== 1 || face.color.g !== 1 || face.color.b !== 1; @@ -12366,7 +12318,7 @@ Geometry.prototype = Object.assign( Object.create( EventDispatcher.prototype ), if ( hasFaceVertexUv ) { - var faceVertexUvs = this$1.faceVertexUvs[ 0 ][ i ]; + var faceVertexUvs = this.faceVertexUvs[ 0 ][ i ]; faces.push( getUvIndex( faceVertexUvs[ 0 ] ), @@ -12514,8 +12466,6 @@ Geometry.prototype = Object.assign( Object.create( EventDispatcher.prototype ), }, copy: function ( source ) { - var this$1 = this; - var i, il, j, jl, k, kl; @@ -12543,7 +12493,7 @@ Geometry.prototype = Object.assign( Object.create( EventDispatcher.prototype ), for ( i = 0, il = vertices.length; i < il; i ++ ) { - this$1.vertices.push( vertices[ i ].clone() ); + this.vertices.push( vertices[ i ].clone() ); } @@ -12553,7 +12503,7 @@ Geometry.prototype = Object.assign( Object.create( EventDispatcher.prototype ), for ( i = 0, il = colors.length; i < il; i ++ ) { - this$1.colors.push( colors[ i ].clone() ); + this.colors.push( colors[ i ].clone() ); } @@ -12563,7 +12513,7 @@ Geometry.prototype = Object.assign( Object.create( EventDispatcher.prototype ), for ( i = 0, il = faces.length; i < il; i ++ ) { - this$1.faces.push( faces[ i ].clone() ); + this.faces.push( faces[ i ].clone() ); } @@ -12573,9 +12523,9 @@ Geometry.prototype = Object.assign( Object.create( EventDispatcher.prototype ), var faceVertexUvs = source.faceVertexUvs[ i ]; - if ( this$1.faceVertexUvs[ i ] === undefined ) { + if ( this.faceVertexUvs[ i ] === undefined ) { - this$1.faceVertexUvs[ i ] = []; + this.faceVertexUvs[ i ] = []; } @@ -12591,7 +12541,7 @@ Geometry.prototype = Object.assign( Object.create( EventDispatcher.prototype ), } - this$1.faceVertexUvs[ i ].push( uvsCopy ); + this.faceVertexUvs[ i ].push( uvsCopy ); } @@ -12634,7 +12584,7 @@ Geometry.prototype = Object.assign( Object.create( EventDispatcher.prototype ), } - this$1.morphTargets.push( morphTarget ); + this.morphTargets.push( morphTarget ); } @@ -12681,7 +12631,7 @@ Geometry.prototype = Object.assign( Object.create( EventDispatcher.prototype ), } - this$1.morphNormals.push( morphNormal ); + this.morphNormals.push( morphNormal ); } @@ -12691,7 +12641,7 @@ Geometry.prototype = Object.assign( Object.create( EventDispatcher.prototype ), for ( i = 0, il = skinWeights.length; i < il; i ++ ) { - this$1.skinWeights.push( skinWeights[ i ].clone() ); + this.skinWeights.push( skinWeights[ i ].clone() ); } @@ -12701,7 +12651,7 @@ Geometry.prototype = Object.assign( Object.create( EventDispatcher.prototype ), for ( i = 0, il = skinIndices.length; i < il; i ++ ) { - this$1.skinIndices.push( skinIndices[ i ].clone() ); + this.skinIndices.push( skinIndices[ i ].clone() ); } @@ -12711,7 +12661,7 @@ Geometry.prototype = Object.assign( Object.create( EventDispatcher.prototype ), for ( i = 0, il = lineDistances.length; i < il; i ++ ) { - this$1.lineDistances.push( lineDistances[ i ] ); + this.lineDistances.push( lineDistances[ i ] ); } @@ -12835,15 +12785,13 @@ Object.assign( BufferAttribute.prototype, { }, copyAt: function ( index1, attribute, index2 ) { - var this$1 = this; - index1 *= this.itemSize; index2 *= attribute.itemSize; for ( var i = 0, l = this.itemSize; i < l; i ++ ) { - this$1.array[ index1 + i ] = attribute.array[ index2 + i ]; + this.array[ index1 + i ] = attribute.array[ index2 + i ]; } @@ -13269,8 +13217,6 @@ Object.assign( DirectGeometry.prototype, { }, fromGeometry: function ( geometry ) { - var this$1 = this; - var faces = geometry.faces; var vertices = geometry.vertices; @@ -13333,19 +13279,19 @@ Object.assign( DirectGeometry.prototype, { var face = faces[ i ]; - this$1.vertices.push( vertices[ face.a ], vertices[ face.b ], vertices[ face.c ] ); + this.vertices.push( vertices[ face.a ], vertices[ face.b ], vertices[ face.c ] ); var vertexNormals = face.vertexNormals; if ( vertexNormals.length === 3 ) { - this$1.normals.push( vertexNormals[ 0 ], vertexNormals[ 1 ], vertexNormals[ 2 ] ); + this.normals.push( vertexNormals[ 0 ], vertexNormals[ 1 ], vertexNormals[ 2 ] ); } else { var normal = face.normal; - this$1.normals.push( normal, normal, normal ); + this.normals.push( normal, normal, normal ); } @@ -13353,13 +13299,13 @@ Object.assign( DirectGeometry.prototype, { if ( vertexColors.length === 3 ) { - this$1.colors.push( vertexColors[ 0 ], vertexColors[ 1 ], vertexColors[ 2 ] ); + this.colors.push( vertexColors[ 0 ], vertexColors[ 1 ], vertexColors[ 2 ] ); } else { var color = face.color; - this$1.colors.push( color, color, color ); + this.colors.push( color, color, color ); } @@ -13369,13 +13315,13 @@ Object.assign( DirectGeometry.prototype, { if ( vertexUvs !== undefined ) { - this$1.uvs.push( vertexUvs[ 0 ], vertexUvs[ 1 ], vertexUvs[ 2 ] ); + this.uvs.push( vertexUvs[ 0 ], vertexUvs[ 1 ], vertexUvs[ 2 ] ); } else { console.warn( 'THREE.DirectGeometry.fromGeometry(): Undefined vertexUv ', i ); - this$1.uvs.push( new Vector2(), new Vector2(), new Vector2() ); + this.uvs.push( new Vector2(), new Vector2(), new Vector2() ); } @@ -13387,13 +13333,13 @@ Object.assign( DirectGeometry.prototype, { if ( vertexUvs !== undefined ) { - this$1.uvs2.push( vertexUvs[ 0 ], vertexUvs[ 1 ], vertexUvs[ 2 ] ); + this.uvs2.push( vertexUvs[ 0 ], vertexUvs[ 1 ], vertexUvs[ 2 ] ); } else { console.warn( 'THREE.DirectGeometry.fromGeometry(): Undefined vertexUv2 ', i ); - this$1.uvs2.push( new Vector2(), new Vector2(), new Vector2() ); + this.uvs2.push( new Vector2(), new Vector2(), new Vector2() ); } @@ -13421,13 +13367,13 @@ Object.assign( DirectGeometry.prototype, { if ( hasSkinIndices ) { - this$1.skinIndices.push( skinIndices[ face.a ], skinIndices[ face.b ], skinIndices[ face.c ] ); + this.skinIndices.push( skinIndices[ face.a ], skinIndices[ face.b ], skinIndices[ face.c ] ); } if ( hasSkinWeights ) { - this$1.skinWeights.push( skinWeights[ face.a ], skinWeights[ face.b ], skinWeights[ face.c ] ); + this.skinWeights.push( skinWeights[ face.a ], skinWeights[ face.b ], skinWeights[ face.c ] ); } @@ -13946,8 +13892,6 @@ BufferGeometry.prototype = Object.assign( Object.create( EventDispatcher.prototy }, fromDirectGeometry: function ( geometry ) { - var this$1 = this; - var positions = new Float32Array( geometry.vertices.length * 3 ); this.addAttribute( 'position', new BufferAttribute( positions, 3 ).copyVector3sArray( geometry.vertices ) ); @@ -14009,7 +13953,7 @@ BufferGeometry.prototype = Object.assign( Object.create( EventDispatcher.prototy } - this$1.morphAttributes[ name ] = array; + this.morphAttributes[ name ] = array; } @@ -14474,8 +14418,6 @@ BufferGeometry.prototype = Object.assign( Object.create( EventDispatcher.prototy }, copy: function ( source ) { - var this$1 = this; - var name, i, l; @@ -14509,7 +14451,7 @@ BufferGeometry.prototype = Object.assign( Object.create( EventDispatcher.prototy for ( name in attributes ) { var attribute = attributes[ name ]; - this$1.addAttribute( name, attribute.clone() ); + this.addAttribute( name, attribute.clone() ); } @@ -14528,7 +14470,7 @@ BufferGeometry.prototype = Object.assign( Object.create( EventDispatcher.prototy } - this$1.morphAttributes[ name ] = array; + this.morphAttributes[ name ] = array; } @@ -14539,7 +14481,7 @@ BufferGeometry.prototype = Object.assign( Object.create( EventDispatcher.prototy for ( i = 0, l = groups.length; i < l; i ++ ) { var group = groups[ i ]; - this$1.addGroup( group.start, group.count, group.materialIndex ); + this.addGroup( group.start, group.count, group.materialIndex ); } @@ -16096,8 +16038,6 @@ Mesh.prototype = Object.assign( Object.create( Object3D.prototype ), { }, updateMorphTargets: function () { - var this$1 = this; - var geometry = this.geometry; var m, ml, name; @@ -16120,8 +16060,8 @@ Mesh.prototype = Object.assign( Object.create( Object3D.prototype ), { name = morphAttribute[ m ].name || String( m ); - this$1.morphTargetInfluences.push( 0 ); - this$1.morphTargetDictionary[ name ] = m; + this.morphTargetInfluences.push( 0 ); + this.morphTargetDictionary[ name ] = m; } @@ -16142,8 +16082,8 @@ Mesh.prototype = Object.assign( Object.create( Object3D.prototype ), { name = morphTargets[ m ].name || String( m ); - this$1.morphTargetInfluences.push( 0 ); - this$1.morphTargetDictionary[ name ] = m; + this.morphTargetInfluences.push( 0 ); + this.morphTargetDictionary[ name ] = m; } @@ -16251,8 +16191,6 @@ Mesh.prototype = Object.assign( Object.create( Object3D.prototype ), { } return function raycast( raycaster, intersects ) { - var this$1 = this; - var geometry = this.geometry; var material = this.material; @@ -16302,7 +16240,7 @@ Mesh.prototype = Object.assign( Object.create( Object3D.prototype ), { b = index.getX( i + 1 ); c = index.getX( i + 2 ); - intersection = checkBufferGeometryIntersection( this$1, raycaster, ray, position, uv, a, b, c ); + intersection = checkBufferGeometryIntersection( this, raycaster, ray, position, uv, a, b, c ); if ( intersection ) { @@ -16323,7 +16261,7 @@ Mesh.prototype = Object.assign( Object.create( Object3D.prototype ), { b = i + 1; c = i + 2; - intersection = checkBufferGeometryIntersection( this$1, raycaster, ray, position, uv, a, b, c ); + intersection = checkBufferGeometryIntersection( this, raycaster, ray, position, uv, a, b, c ); if ( intersection ) { @@ -16362,7 +16300,7 @@ Mesh.prototype = Object.assign( Object.create( Object3D.prototype ), { if ( faceMaterial.morphTargets === true ) { var morphTargets = geometry.morphTargets; - var morphInfluences = this$1.morphTargetInfluences; + var morphInfluences = this.morphTargetInfluences; vA.set( 0, 0, 0 ); vB.set( 0, 0, 0 ); @@ -16392,7 +16330,7 @@ Mesh.prototype = Object.assign( Object.create( Object3D.prototype ), { } - intersection = checkIntersection( this$1, faceMaterial, raycaster, ray, fvA, fvB, fvC, intersectionPoint ); + intersection = checkIntersection( this, faceMaterial, raycaster, ray, fvA, fvB, fvC, intersectionPoint ); if ( intersection ) { @@ -23947,8 +23885,6 @@ LensFlare.prototype = Object.assign( Object.create( Object3D.prototype ), { isLensFlare: true, copy: function ( source ) { - var this$1 = this; - Object3D.prototype.copy.call( this, source ); @@ -23957,7 +23893,7 @@ LensFlare.prototype = Object.assign( Object.create( Object3D.prototype ), { for ( var i = 0, l = source.lensFlares.length; i < l; i ++ ) { - this$1.lensFlares.push( source.lensFlares[ i ] ); + this.lensFlares.push( source.lensFlares[ i ] ); } @@ -23995,8 +23931,6 @@ LensFlare.prototype = Object.assign( Object.create( Object3D.prototype ), { */ updateLensFlares: function () { - var this$1 = this; - var f, fl = this.lensFlares.length; var flare; @@ -24005,10 +23939,10 @@ LensFlare.prototype = Object.assign( Object.create( Object3D.prototype ), { for ( f = 0; f < fl; f ++ ) { - flare = this$1.lensFlares[ f ]; + flare = this.lensFlares[ f ]; - flare.x = this$1.positionScreen.x + vecX * flare.distance; - flare.y = this$1.positionScreen.y + vecY * flare.distance; + flare.x = this.positionScreen.x + vecX * flare.distance; + flare.y = this.positionScreen.y + vecY * flare.distance; flare.wantedRotation = flare.x * Math.PI * 0.25; flare.rotation += ( flare.wantedRotation - flare.rotation ) * 0.25; @@ -24155,8 +24089,6 @@ LOD.prototype = Object.assign( Object.create( Object3D.prototype ), { constructor: LOD, copy: function ( source ) { - var this$1 = this; - Object3D.prototype.copy.call( this, source, false ); @@ -24166,7 +24098,7 @@ LOD.prototype = Object.assign( Object.create( Object3D.prototype ), { var level = levels[ i ]; - this$1.addLevel( level.object.clone(), level.distance ); + this.addLevel( level.object.clone(), level.distance ); } @@ -24310,8 +24242,6 @@ LOD.prototype = Object.assign( Object.create( Object3D.prototype ), { */ function Skeleton( bones, boneInverses ) { - var this$1 = this; - // copy the bone array @@ -24340,7 +24270,7 @@ function Skeleton( bones, boneInverses ) { for ( var i = 0, il = this.bones.length; i < il; i ++ ) { - this$1.boneInverses.push( new Matrix4() ); + this.boneInverses.push( new Matrix4() ); } @@ -24353,8 +24283,6 @@ function Skeleton( bones, boneInverses ) { Object.assign( Skeleton.prototype, { calculateInverses: function () { - var this$1 = this; - this.boneInverses = []; @@ -24362,21 +24290,19 @@ Object.assign( Skeleton.prototype, { var inverse = new Matrix4(); - if ( this$1.bones[ i ] ) { + if ( this.bones[ i ] ) { - inverse.getInverse( this$1.bones[ i ].matrixWorld ); + inverse.getInverse( this.bones[ i ].matrixWorld ); } - this$1.boneInverses.push( inverse ); + this.boneInverses.push( inverse ); } }, pose: function () { - var this$1 = this; - var bone, i, il; @@ -24384,11 +24310,11 @@ Object.assign( Skeleton.prototype, { for ( i = 0, il = this.bones.length; i < il; i ++ ) { - bone = this$1.bones[ i ]; + bone = this.bones[ i ]; if ( bone ) { - bone.matrixWorld.getInverse( this$1.boneInverses[ i ] ); + bone.matrixWorld.getInverse( this.boneInverses[ i ] ); } @@ -24398,7 +24324,7 @@ Object.assign( Skeleton.prototype, { for ( i = 0, il = this.bones.length; i < il; i ++ ) { - bone = this$1.bones[ i ]; + bone = this.bones[ i ]; if ( bone ) { @@ -24518,8 +24444,6 @@ SkinnedMesh.prototype = Object.assign( Object.create( Mesh.prototype ), { isSkinnedMesh: true, initBones: function () { - var this$1 = this; - var bones = [], bone, gbone; var i, il; @@ -24530,7 +24454,7 @@ SkinnedMesh.prototype = Object.assign( Object.create( Mesh.prototype ), { for ( i = 0, il = this.geometry.bones.length; i < il; i ++ ) { - gbone = this$1.geometry.bones[ i ]; + gbone = this.geometry.bones[ i ]; // create new 'Bone' object @@ -24550,7 +24474,7 @@ SkinnedMesh.prototype = Object.assign( Object.create( Mesh.prototype ), { for ( i = 0, il = this.geometry.bones.length; i < il; i ++ ) { - gbone = this$1.geometry.bones[ i ]; + gbone = this.geometry.bones[ i ]; if ( ( gbone.parent !== - 1 ) && ( gbone.parent !== null ) && ( bones[ gbone.parent ] !== undefined ) ) { @@ -24562,7 +24486,7 @@ SkinnedMesh.prototype = Object.assign( Object.create( Mesh.prototype ), { // topmost bone, immediate child of the skinned mesh - this$1.add( bones[ i ] ); + this.add( bones[ i ] ); } @@ -24605,8 +24529,6 @@ SkinnedMesh.prototype = Object.assign( Object.create( Mesh.prototype ), { }, normalizeSkinWeights: function () { - var this$1 = this; - var scale, i; @@ -24614,7 +24536,7 @@ SkinnedMesh.prototype = Object.assign( Object.create( Mesh.prototype ), { for ( i = 0; i < this.geometry.skinWeights.length; i ++ ) { - var sw = this$1.geometry.skinWeights[ i ]; + var sw = this.geometry.skinWeights[ i ]; scale = 1.0 / sw.manhattanLength(); @@ -24777,8 +24699,6 @@ Line.prototype = Object.assign( Object.create( Object3D.prototype ), { var sphere = new Sphere(); return function raycast( raycaster, intersects ) { - var this$1 = this; - var precision = raycaster.linePrecision; var precisionSq = precision * precision; @@ -24828,7 +24748,7 @@ Line.prototype = Object.assign( Object.create( Object3D.prototype ), { if ( distSq > precisionSq ) { continue; } - interRay.applyMatrix4( this$1.matrixWorld ); //Move back to world space for distance calculation + interRay.applyMatrix4( this.matrixWorld ); //Move back to world space for distance calculation var distance = raycaster.ray.origin.distanceTo( interRay ); @@ -24839,11 +24759,11 @@ Line.prototype = Object.assign( Object.create( Object3D.prototype ), { 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$1.matrixWorld ), + point: interSegment.clone().applyMatrix4( this.matrixWorld ), index: i, face: null, faceIndex: null, - object: this$1 + object: this } ); @@ -24860,7 +24780,7 @@ Line.prototype = Object.assign( Object.create( Object3D.prototype ), { if ( distSq > precisionSq ) { continue; } - interRay.applyMatrix4( this$1.matrixWorld ); //Move back to world space for distance calculation + interRay.applyMatrix4( this.matrixWorld ); //Move back to world space for distance calculation var distance = raycaster.ray.origin.distanceTo( interRay ); @@ -24871,11 +24791,11 @@ Line.prototype = Object.assign( Object.create( Object3D.prototype ), { 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$1.matrixWorld ), + point: interSegment.clone().applyMatrix4( this.matrixWorld ), index: i, face: null, faceIndex: null, - object: this$1 + object: this } ); @@ -24894,7 +24814,7 @@ Line.prototype = Object.assign( Object.create( Object3D.prototype ), { if ( distSq > precisionSq ) { continue; } - interRay.applyMatrix4( this$1.matrixWorld ); //Move back to world space for distance calculation + interRay.applyMatrix4( this.matrixWorld ); //Move back to world space for distance calculation var distance = raycaster.ray.origin.distanceTo( interRay ); @@ -24905,11 +24825,11 @@ Line.prototype = Object.assign( Object.create( Object3D.prototype ), { 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$1.matrixWorld ), + point: interSegment.clone().applyMatrix4( this.matrixWorld ), index: i, face: null, faceIndex: null, - object: this$1 + object: this } ); @@ -27727,8 +27647,6 @@ ExtrudeBufferGeometry.prototype.getArrays = function () { }; ExtrudeBufferGeometry.prototype.addShapeList = function ( shapes, options ) { - var this$1 = this; - var sl = shapes.length; options.arrays = this.getArrays(); @@ -27736,7 +27654,7 @@ ExtrudeBufferGeometry.prototype.addShapeList = function ( shapes, options ) { for ( var s = 0; s < sl; s ++ ) { var shape = shapes[ s ]; - this$1.addShape( shape, options ); + this.addShape( shape, options ); } @@ -29026,8 +28944,6 @@ ShapeGeometry.prototype.toJSON = function () { // ShapeBufferGeometry function ShapeBufferGeometry( shapes, curveSegments ) { - var this$1 = this; - BufferGeometry.call( this ); @@ -29064,7 +28980,7 @@ function ShapeBufferGeometry( shapes, curveSegments ) { addShape( shapes[ i ] ); - this$1.addGroup( groupStart, groupCount, i ); // enables MultiMaterial support + this.addGroup( groupStart, groupCount, i ); // enables MultiMaterial support groupStart += groupCount; groupCount = 0; @@ -30711,8 +30627,6 @@ function FileLoader( manager ) { Object.assign( FileLoader.prototype, { load: function ( url, onLoad, onProgress, onError ) { - var this$1 = this; - if ( url === undefined ) { url = ''; } @@ -30952,9 +30866,9 @@ Object.assign( FileLoader.prototype, { if ( request.overrideMimeType ) { request.overrideMimeType( this.mimeType !== undefined ? this.mimeType : 'text/plain' ); } - for ( var header in this$1.requestHeader ) { + for ( var header in this.requestHeader ) { - request.setRequestHeader( header, this$1.requestHeader[ header ] ); + request.setRequestHeader( header, this.requestHeader[ header ] ); } @@ -31526,8 +31440,6 @@ Object.assign( Curve.prototype, { // Get sequence of points using getPoint( t ) getPoints: function ( divisions ) { - var this$1 = this; - if ( divisions === undefined ) { divisions = 5; } @@ -31535,7 +31447,7 @@ Object.assign( Curve.prototype, { for ( var d = 0; d <= divisions; d ++ ) { - points.push( this$1.getPoint( d / divisions ) ); + points.push( this.getPoint( d / divisions ) ); } @@ -31546,8 +31458,6 @@ Object.assign( Curve.prototype, { // Get sequence of points using getPointAt( u ) getSpacedPoints: function ( divisions ) { - var this$1 = this; - if ( divisions === undefined ) { divisions = 5; } @@ -31555,7 +31465,7 @@ Object.assign( Curve.prototype, { for ( var d = 0; d <= divisions; d ++ ) { - points.push( this$1.getPointAt( d / divisions ) ); + points.push( this.getPointAt( d / divisions ) ); } @@ -31575,8 +31485,6 @@ Object.assign( Curve.prototype, { // Get list of cumulative segment lengths getLengths: function ( divisions ) { - var this$1 = this; - if ( divisions === undefined ) { divisions = this.arcLengthDivisions; } @@ -31598,7 +31506,7 @@ Object.assign( Curve.prototype, { for ( p = 1; p <= divisions; p ++ ) { - current = this$1.getPoint( p / divisions ); + current = this.getPoint( p / divisions ); sum += current.distanceTo( last ); cache.push( sum ); last = current; @@ -31726,8 +31634,6 @@ Object.assign( Curve.prototype, { }, computeFrenetFrames: function ( segments, closed ) { - var this$1 = this; - // see http://www.cs.indiana.edu/pub/techreports/TR425.pdf @@ -31748,7 +31654,7 @@ Object.assign( Curve.prototype, { u = i / segments; - tangents[ i ] = this$1.getTangentAt( u ); + tangents[ i ] = this.getTangentAt( u ); tangents[ i ].normalize(); } @@ -32239,8 +32145,6 @@ CatmullRomCurve3.prototype.getPoint = function ( t, optionalTarget ) { }; CatmullRomCurve3.prototype.copy = function ( source ) { - var this$1 = this; - Curve.prototype.copy.call( this, source ); @@ -32250,7 +32154,7 @@ CatmullRomCurve3.prototype.copy = function ( source ) { var point = source.points[ i ]; - this$1.points.push( point.clone() ); + this.points.push( point.clone() ); } @@ -32263,8 +32167,6 @@ CatmullRomCurve3.prototype.copy = function ( source ) { }; CatmullRomCurve3.prototype.toJSON = function () { - var this$1 = this; - var data = Curve.prototype.toJSON.call( this ); @@ -32272,7 +32174,7 @@ CatmullRomCurve3.prototype.toJSON = function () { for ( var i = 0, l = this.points.length; i < l; i ++ ) { - var point = this$1.points[ i ]; + var point = this.points[ i ]; data.points.push( point.toArray() ); } @@ -32286,8 +32188,6 @@ CatmullRomCurve3.prototype.toJSON = function () { }; CatmullRomCurve3.prototype.fromJSON = function ( json ) { - var this$1 = this; - Curve.prototype.fromJSON.call( this, json ); @@ -32296,7 +32196,7 @@ CatmullRomCurve3.prototype.fromJSON = function ( json ) { for ( var i = 0, l = json.points.length; i < l; i ++ ) { var point = json.points[ i ]; - this$1.points.push( new Vector3().fromArray( point ) ); + this.points.push( new Vector3().fromArray( point ) ); } @@ -32870,8 +32770,6 @@ SplineCurve.prototype.getPoint = function ( t, optionalTarget ) { }; SplineCurve.prototype.copy = function ( source ) { - var this$1 = this; - Curve.prototype.copy.call( this, source ); @@ -32881,7 +32779,7 @@ SplineCurve.prototype.copy = function ( source ) { var point = source.points[ i ]; - this$1.points.push( point.clone() ); + this.points.push( point.clone() ); } @@ -32890,8 +32788,6 @@ SplineCurve.prototype.copy = function ( source ) { }; SplineCurve.prototype.toJSON = function () { - var this$1 = this; - var data = Curve.prototype.toJSON.call( this ); @@ -32899,7 +32795,7 @@ SplineCurve.prototype.toJSON = function () { for ( var i = 0, l = this.points.length; i < l; i ++ ) { - var point = this$1.points[ i ]; + var point = this.points[ i ]; data.points.push( point.toArray() ); } @@ -32909,8 +32805,6 @@ SplineCurve.prototype.toJSON = function () { }; SplineCurve.prototype.fromJSON = function ( json ) { - var this$1 = this; - Curve.prototype.fromJSON.call( this, json ); @@ -32919,7 +32813,7 @@ SplineCurve.prototype.fromJSON = function ( json ) { for ( var i = 0, l = json.points.length; i < l; i ++ ) { var point = json.points[ i ]; - this$1.points.push( new Vector2().fromArray( point ) ); + this.points.push( new Vector2().fromArray( point ) ); } @@ -32997,8 +32891,6 @@ CurvePath.prototype = Object.assign( Object.create( Curve.prototype ), { // 4. Return curve.getPointAt(t') getPoint: function ( t ) { - var this$1 = this; - var d = t * this.getLength(); var curveLengths = this.getCurveLengths(); @@ -33011,7 +32903,7 @@ CurvePath.prototype = Object.assign( Object.create( Curve.prototype ), { if ( curveLengths[ i ] >= d ) { var diff = curveLengths[ i ] - d; - var curve = this$1.curves[ i ]; + var curve = this.curves[ i ]; var segmentLength = curve.getLength(); var u = segmentLength === 0 ? 0 : 1 - diff / segmentLength; @@ -33054,8 +32946,6 @@ CurvePath.prototype = Object.assign( Object.create( Curve.prototype ), { // We cannot overwrite getLengths() because UtoT mapping uses it. getCurveLengths: function () { - var this$1 = this; - // We use cache values if curves and cache array are same length @@ -33072,7 +32962,7 @@ CurvePath.prototype = Object.assign( Object.create( Curve.prototype ), { for ( var i = 0, l = this.curves.length; i < l; i ++ ) { - sums += this$1.curves[ i ].getLength(); + sums += this.curves[ i ].getLength(); lengths.push( sums ); } @@ -33084,8 +32974,6 @@ CurvePath.prototype = Object.assign( Object.create( Curve.prototype ), { }, getSpacedPoints: function ( divisions ) { - var this$1 = this; - if ( divisions === undefined ) { divisions = 40; } @@ -33093,7 +32981,7 @@ CurvePath.prototype = Object.assign( Object.create( Curve.prototype ), { for ( var i = 0; i <= divisions; i ++ ) { - points.push( this$1.getPoint( i / divisions ) ); + points.push( this.getPoint( i / divisions ) ); } @@ -33147,8 +33035,6 @@ CurvePath.prototype = Object.assign( Object.create( Curve.prototype ), { }, copy: function ( source ) { - var this$1 = this; - Curve.prototype.copy.call( this, source ); @@ -33158,7 +33044,7 @@ CurvePath.prototype = Object.assign( Object.create( Curve.prototype ), { var curve = source.curves[ i ]; - this$1.curves.push( curve.clone() ); + this.curves.push( curve.clone() ); } @@ -33169,8 +33055,6 @@ CurvePath.prototype = Object.assign( Object.create( Curve.prototype ), { }, toJSON: function () { - var this$1 = this; - var data = Curve.prototype.toJSON.call( this ); @@ -33179,7 +33063,7 @@ CurvePath.prototype = Object.assign( Object.create( Curve.prototype ), { for ( var i = 0, l = this.curves.length; i < l; i ++ ) { - var curve = this$1.curves[ i ]; + var curve = this.curves[ i ]; data.curves.push( curve.toJSON() ); } @@ -33189,8 +33073,6 @@ CurvePath.prototype = Object.assign( Object.create( Curve.prototype ), { }, fromJSON: function ( json ) { - var this$1 = this; - Curve.prototype.fromJSON.call( this, json ); @@ -33200,7 +33082,7 @@ CurvePath.prototype = Object.assign( Object.create( Curve.prototype ), { for ( var i = 0, l = json.curves.length; i < l; i ++ ) { var curve = json.curves[ i ]; - this$1.curves.push( new Curves[ curve.type ]().fromJSON( curve ) ); + this.curves.push( new Curves[ curve.type ]().fromJSON( curve ) ); } @@ -33236,14 +33118,12 @@ Path.prototype = Object.assign( Object.create( CurvePath.prototype ), { constructor: Path, setFromPoints: function ( points ) { - var this$1 = this; - this.moveTo( points[ 0 ].x, points[ 0 ].y ); for ( var i = 1, l = points.length; i < l; i ++ ) { - this$1.lineTo( points[ i ].x, points[ i ].y ); + this.lineTo( points[ i ].x, points[ i ].y ); } @@ -33413,14 +33293,12 @@ Shape.prototype = Object.assign( Object.create( Path.prototype ), { constructor: Shape, getPointsHoles: function ( divisions ) { - var this$1 = this; - var holesPts = []; for ( var i = 0, l = this.holes.length; i < l; i ++ ) { - holesPts[ i ] = this$1.holes[ i ].getPoints( divisions ); + holesPts[ i ] = this.holes[ i ].getPoints( divisions ); } @@ -33442,8 +33320,6 @@ Shape.prototype = Object.assign( Object.create( Path.prototype ), { }, copy: function ( source ) { - var this$1 = this; - Path.prototype.copy.call( this, source ); @@ -33453,7 +33329,7 @@ Shape.prototype = Object.assign( Object.create( Path.prototype ), { var hole = source.holes[ i ]; - this$1.holes.push( hole.clone() ); + this.holes.push( hole.clone() ); } @@ -33462,8 +33338,6 @@ Shape.prototype = Object.assign( Object.create( Path.prototype ), { }, toJSON: function () { - var this$1 = this; - var data = Path.prototype.toJSON.call( this ); @@ -33472,7 +33346,7 @@ Shape.prototype = Object.assign( Object.create( Path.prototype ), { for ( var i = 0, l = this.holes.length; i < l; i ++ ) { - var hole = this$1.holes[ i ]; + var hole = this.holes[ i ]; data.holes.push( hole.toJSON() ); } @@ -33482,8 +33356,6 @@ Shape.prototype = Object.assign( Object.create( Path.prototype ), { }, fromJSON: function ( json ) { - var this$1 = this; - Path.prototype.fromJSON.call( this, json ); @@ -33493,7 +33365,7 @@ Shape.prototype = Object.assign( Object.create( Path.prototype ), { for ( var i = 0, l = json.holes.length; i < l; i ++ ) { var hole = json.holes[ i ]; - this$1.holes.push( new Path().fromJSON( hole ) ); + this.holes.push( new Path().fromJSON( hole ) ); } @@ -34047,8 +33919,6 @@ function Interpolant( parameterPositions, sampleValues, sampleSize, resultBuffer Object.assign( Interpolant.prototype, { evaluate: function ( t ) { - var this$1 = this; - var pp = this.parameterPositions, i1 = this._cachedIndex, @@ -34079,8 +33949,8 @@ Object.assign( Interpolant.prototype, { // after end i1 = pp.length; - this$1._cachedIndex = i1; - return this$1.afterEnd_( i1 - 1, t, t0 ); + this._cachedIndex = i1; + return this.afterEnd_( i1 - 1, t, t0 ); } @@ -34127,8 +33997,8 @@ Object.assign( Interpolant.prototype, { // before start - this$1._cachedIndex = 0; - return this$1.beforeStart_( 0, t, t1 ); + this._cachedIndex = 0; + return this.beforeStart_( 0, t, t1 ); } @@ -35118,8 +34988,6 @@ Object.assign( KeyframeTrack.prototype, { // ensure we do not get a GarbageInGarbageOut situation, make sure tracks are at least minimally viable validate: function () { - var this$1 = this; - var valid = true; @@ -35151,7 +35019,7 @@ Object.assign( KeyframeTrack.prototype, { if ( typeof currTime === 'number' && isNaN( currTime ) ) { - console.error( 'THREE.KeyframeTrack: Time is not a valid number.', this$1, i, currTime ); + console.error( 'THREE.KeyframeTrack: Time is not a valid number.', this, i, currTime ); valid = false; break; @@ -35159,7 +35027,7 @@ Object.assign( KeyframeTrack.prototype, { if ( prevTime !== null && prevTime > currTime ) { - console.error( 'THREE.KeyframeTrack: Out of order keys.', this$1, i, currTime, prevTime ); + console.error( 'THREE.KeyframeTrack: Out of order keys.', this, i, currTime, prevTime ); valid = false; break; @@ -35179,7 +35047,7 @@ Object.assign( KeyframeTrack.prototype, { if ( isNaN( value ) ) { - console.error( 'THREE.KeyframeTrack: Value is not a valid number.', this$1, i, value ); + console.error( 'THREE.KeyframeTrack: Value is not a valid number.', this, i, value ); valid = false; break; @@ -35639,14 +35507,12 @@ Object.assign( AnimationClip, { Object.assign( AnimationClip.prototype, { resetDuration: function () { - var this$1 = this; - var tracks = this.tracks, duration = 0; for ( var i = 0, n = tracks.length; i !== n; ++ i ) { - var track = this$1.tracks[ i ]; + var track = this.tracks[ i ]; duration = Math.max( duration, track.times[ track.times.length - 1 ] ); @@ -35657,12 +35523,10 @@ Object.assign( AnimationClip.prototype, { }, trim: function () { - var this$1 = this; - for ( var i = 0; i < this.tracks.length; i ++ ) { - this$1.tracks[ i ].trim( 0, this$1.duration ); + this.tracks[ i ].trim( 0, this.duration ); } @@ -35671,12 +35535,10 @@ Object.assign( AnimationClip.prototype, { }, optimize: function () { - var this$1 = this; - for ( var i = 0; i < this.tracks.length; i ++ ) { - this$1.tracks[ i ].optimize(); + this.tracks[ i ].optimize(); } @@ -35997,14 +35859,12 @@ Object.assign( Loader.prototype, { crossOrigin: undefined, initMaterials: function ( materials, texturePath, crossOrigin ) { - var this$1 = this; - var array = []; for ( var i = 0; i < materials.length; ++ i ) { - array[ i ] = this$1.createMaterial( materials[ i ], texturePath, crossOrigin ); + array[ i ] = this.createMaterial( materials[ i ], texturePath, crossOrigin ); } @@ -36996,8 +36856,6 @@ Object.assign( ObjectLoader.prototype, { }, parseGeometries: function ( json, shapes ) { - var this$1 = this; - var geometries = {}; @@ -37207,7 +37065,7 @@ Object.assign( ObjectLoader.prototype, { case 'Geometry': - geometry = geometryLoader.parse( data, this$1.texturePath ).geometry; + geometry = geometryLoader.parse( data, this.texturePath ).geometry; break; @@ -37408,8 +37266,6 @@ Object.assign( ObjectLoader.prototype, { var matrix = new Matrix4(); return function parseObject( data, geometries, materials ) { - var this$1 = this; - var object; @@ -37655,7 +37511,7 @@ Object.assign( ObjectLoader.prototype, { for ( var i = 0; i < children.length; i ++ ) { - object.add( this$1.parseObject( children[ i ], geometries, materials ) ); + object.add( this.parseObject( children[ i ], geometries, materials ) ); } @@ -38834,8 +38690,6 @@ Audio.prototype = Object.assign( Object.create( Object3D.prototype ), { }, connect: function () { - var this$1 = this; - if ( this.filters.length > 0 ) { @@ -38843,7 +38697,7 @@ Audio.prototype = Object.assign( Object.create( Object3D.prototype ), { for ( var i = 1, l = this.filters.length; i < l; i ++ ) { - this$1.filters[ i - 1 ].connect( this$1.filters[ i ] ); + this.filters[ i - 1 ].connect( this.filters[ i ] ); } @@ -38860,8 +38714,6 @@ Audio.prototype = Object.assign( Object.create( Object3D.prototype ), { }, disconnect: function () { - var this$1 = this; - if ( this.filters.length > 0 ) { @@ -38869,7 +38721,7 @@ Audio.prototype = Object.assign( Object.create( Object3D.prototype ), { for ( var i = 1, l = this.filters.length; i < l; i ++ ) { - this$1.filters[ i - 1 ].disconnect( this$1.filters[ i ] ); + this.filters[ i - 1 ].disconnect( this.filters[ i ] ); } @@ -41145,8 +40997,6 @@ AnimationMixer.prototype = Object.assign( Object.create( EventDispatcher.prototy constructor: AnimationMixer, _bindAction: function ( action, prototypeAction ) { - var this$1 = this; - var root = action._localRoot || this._root, tracks = action._clip.tracks, @@ -41185,7 +41035,7 @@ AnimationMixer.prototype = Object.assign( Object.create( EventDispatcher.prototy if ( binding._cacheIndex === null ) { ++ binding.referenceCount; - this$1._addInactiveBinding( binding, rootUuid, trackName ); + this._addInactiveBinding( binding, rootUuid, trackName ); } @@ -41201,7 +41051,7 @@ AnimationMixer.prototype = Object.assign( Object.create( EventDispatcher.prototy track.ValueTypeName, track.getValueSize() ); ++ binding.referenceCount; - this$1._addInactiveBinding( binding, rootUuid, trackName ); + this._addInactiveBinding( binding, rootUuid, trackName ); bindings[ i ] = binding; @@ -41214,8 +41064,6 @@ AnimationMixer.prototype = Object.assign( Object.create( EventDispatcher.prototy }, _activateAction: function ( action ) { - var this$1 = this; - if ( ! this._isActiveAction( action ) ) { @@ -41244,7 +41092,7 @@ AnimationMixer.prototype = Object.assign( Object.create( EventDispatcher.prototy if ( binding.useCount ++ === 0 ) { - this$1._lendBinding( binding ); + this._lendBinding( binding ); binding.saveOriginalState(); } @@ -41258,8 +41106,6 @@ AnimationMixer.prototype = Object.assign( Object.create( EventDispatcher.prototy }, _deactivateAction: function ( action ) { - var this$1 = this; - if ( this._isActiveAction( action ) ) { @@ -41273,7 +41119,7 @@ AnimationMixer.prototype = Object.assign( Object.create( EventDispatcher.prototy if ( -- binding.useCount === 0 ) { binding.restoreOriginalState(); - this$1._takeBackBinding( binding ); + this._takeBackBinding( binding ); } @@ -41444,8 +41290,6 @@ AnimationMixer.prototype = Object.assign( Object.create( EventDispatcher.prototy }, _removeInactiveBindingsForAction: function ( action ) { - var this$1 = this; - var bindings = action._propertyBindings; for ( var i = 0, n = bindings.length; i !== n; ++ i ) { @@ -41454,7 +41298,7 @@ AnimationMixer.prototype = Object.assign( Object.create( EventDispatcher.prototy if ( -- binding.referenceCount === 0 ) { - this$1._removeInactiveBinding( binding ); + this._removeInactiveBinding( binding ); } @@ -41785,8 +41629,6 @@ AnimationMixer.prototype = Object.assign( Object.create( EventDispatcher.prototy // free all resources specific to a particular clip uncacheClip: function ( clip ) { - var this$1 = this; - var actions = this._actions, clipUuid = clip.uuid, @@ -41805,7 +41647,7 @@ AnimationMixer.prototype = Object.assign( Object.create( EventDispatcher.prototy var action = actionsToRemove[ i ]; - this$1._deactivateAction( action ); + this._deactivateAction( action ); var cacheIndex = action._cacheIndex, lastInactiveAction = actions[ actions.length - 1 ]; @@ -41817,7 +41659,7 @@ AnimationMixer.prototype = Object.assign( Object.create( EventDispatcher.prototy actions[ cacheIndex ] = lastInactiveAction; actions.pop(); - this$1._removeInactiveBindingsForAction( action ); + this._removeInactiveBindingsForAction( action ); } @@ -41829,8 +41671,6 @@ AnimationMixer.prototype = Object.assign( Object.create( EventDispatcher.prototy // free all resources specific to a particular root target object uncacheRoot: function ( root ) { - var this$1 = this; - var rootUuid = root.uuid, actionsByClip = this._actionsByClip; @@ -41842,8 +41682,8 @@ AnimationMixer.prototype = Object.assign( Object.create( EventDispatcher.prototy if ( action !== undefined ) { - this$1._deactivateAction( action ); - this$1._removeInactiveAction( action ); + this._deactivateAction( action ); + this._removeInactiveAction( action ); } @@ -41858,7 +41698,7 @@ AnimationMixer.prototype = Object.assign( Object.create( EventDispatcher.prototy var binding = bindingByName[ trackName ]; binding.restoreOriginalState(); - this$1._removeInactiveBinding( binding ); + this._removeInactiveBinding( binding ); } @@ -42148,15 +41988,13 @@ Object.assign( InterleavedBuffer.prototype, { }, copyAt: function ( index1, attribute, index2 ) { - var this$1 = this; - index1 *= this.stride; index2 *= attribute.stride; for ( var i = 0, l = this.stride; i < l; i ++ ) { - this$1.array[ index1 + i ] = attribute.array[ index2 + i ]; + this.array[ index1 + i ] = attribute.array[ index2 + i ]; } @@ -42356,8 +42194,6 @@ Object.assign( Raycaster.prototype, { }, intersectObjects: function ( objects, recursive ) { - var this$1 = this; - var intersects = []; @@ -42370,7 +42206,7 @@ Object.assign( Raycaster.prototype, { for ( var i = 0, l = objects.length; i < l; i ++ ) { - intersectObject( objects[ i ], this$1, intersects, recursive ); + intersectObject( objects[ i ], this, intersects, recursive ); } @@ -42667,8 +42503,6 @@ VertexNormalsHelper.prototype.update = ( function () { var normalMatrix = new Matrix3(); return function update() { - var this$1 = this; - var keys = [ 'a', 'b', 'c' ]; @@ -42704,7 +42538,7 @@ VertexNormalsHelper.prototype.update = ( function () { v1.copy( vertex ).applyMatrix4( matrixWorld ); - v2.copy( normal ).applyMatrix3( normalMatrix ).normalize().multiplyScalar( this$1.size ).add( v1 ); + v2.copy( normal ).applyMatrix3( normalMatrix ).normalize().multiplyScalar( this.size ).add( v1 ); position.setXYZ( idx, v1.x, v1.y, v1.z ); @@ -42734,7 +42568,7 @@ VertexNormalsHelper.prototype.update = ( function () { v2.set( objNorm.getX( j ), objNorm.getY( j ), objNorm.getZ( j ) ); - v2.applyMatrix3( normalMatrix ).normalize().multiplyScalar( this$1.size ).add( v1 ); + v2.applyMatrix3( normalMatrix ).normalize().multiplyScalar( this.size ).add( v1 ); position.setXYZ( idx, v1.x, v1.y, v1.z ); @@ -43401,8 +43235,6 @@ FaceNormalsHelper.prototype.update = ( function () { var normalMatrix = new Matrix3(); return function update() { - var this$1 = this; - this.object.updateMatrixWorld( true ); @@ -43434,7 +43266,7 @@ FaceNormalsHelper.prototype.update = ( function () { .divideScalar( 3 ) .applyMatrix4( matrixWorld ); - v2.copy( normal ).applyMatrix3( normalMatrix ).normalize().multiplyScalar( this$1.size ).add( v1 ); + v2.copy( normal ).applyMatrix3( normalMatrix ).normalize().multiplyScalar( this.size ).add( v1 ); position.setXYZ( idx, v1.x, v1.y, v1.z ); @@ -46326,7 +46158,7 @@ var closestAxisPoint = function(axisRay, camera, mousePos) { * @author Julius Kammerl - jkammerl@willowgarage.com */ -var DepthCloud = (function (superclass) { +var DepthCloud = /*@__PURE__*/(function (superclass) { function DepthCloud(options) { superclass.call(this); options = options || {}; @@ -46543,8 +46375,6 @@ var DepthCloud = (function (superclass) { * Callback called when video metadata is ready */ DepthCloud.prototype.initStreamer = function initStreamer () { - var this$1 = this; - if (this.metaLoaded) { this.texture = new THREE$1.Texture(this.video); @@ -46553,10 +46383,10 @@ var DepthCloud = (function (superclass) { for (var i = 0, l = this.width * this.height; i < l; i++) { var vertex = new THREE$1.Vector3(); - vertex.x = (i % this$1.width); - vertex.y = Math.floor(i / this$1.width); + vertex.x = (i % this.width); + vertex.y = Math.floor(i / this.width); - this$1.geometry.vertices.push(vertex); + this.geometry.vertices.push(vertex); } this.material = new THREE$1.ShaderMaterial({ @@ -46644,7 +46474,7 @@ var DepthCloud = (function (superclass) { * @author David Gossow - dgossow@willowgarage.com */ -var Arrow = (function (superclass) { +var Arrow = /*@__PURE__*/(function (superclass) { function Arrow(options) { options = options || {}; var origin = options.origin || new THREE$1.Vector3(0, 0, 0); @@ -50515,7 +50345,7 @@ THREE$1.ColladaLoader.prototype = { * @author Russell Toris - rctoris@wpi.edu */ -var MeshResource = (function (superclass) { +var MeshResource = /*@__PURE__*/(function (superclass) { function MeshResource(options) { superclass.call(this); var that = this; @@ -50598,7 +50428,7 @@ var MeshResource = (function (superclass) { * @author David Gossow - dgossow@willowgarage.com */ -var TriangleList = (function (superclass) { +var TriangleList = /*@__PURE__*/(function (superclass) { function TriangleList(options) { options = options || {}; var material = options.material || new THREE$1.MeshBasicMaterial(); @@ -50673,7 +50503,7 @@ var TriangleList = (function (superclass) { * @author Russell Toris - rctoris@wpi.edu */ -var Marker = (function (superclass) { +var Marker = /*@__PURE__*/(function (superclass) { function Marker(options) { superclass.call(this); @@ -51157,7 +50987,7 @@ var Marker = (function (superclass) { * @author David Gossow - dgossow@willowgarage.com */ -var InteractiveMarkerControl = (function (superclass) { +var InteractiveMarkerControl = /*@__PURE__*/(function (superclass) { function InteractiveMarkerControl(options) { superclass.call(this); var that = this; @@ -51419,7 +51249,7 @@ var InteractiveMarkerControl = (function (superclass) { * @author David Gossow - dgossow@willowgarage.com */ -var InteractiveMarkerMenu = (function (superclass) { +var InteractiveMarkerMenu = /*@__PURE__*/(function (superclass) { function InteractiveMarkerMenu(options) { superclass.call(this); var that = this; @@ -51593,7 +51423,7 @@ var InteractiveMarkerMenu = (function (superclass) { * @author David Gossow - dgossow@willowgarage.com */ -var InteractiveMarker = (function (superclass) { +var InteractiveMarker = /*@__PURE__*/(function (superclass) { function InteractiveMarker(options) { superclass.call(this); @@ -52116,9 +51946,7 @@ var eventemitter2 = createCommonjsModule(function (module, exports) { return listeners; } - function growListenerTree(type, listener) { - var this$1 = this; - + function growListenerTree(type, listener) { type = typeof type === 'string' ? type.split(this.delimiter) : type.slice(); @@ -52156,11 +51984,11 @@ var eventemitter2 = createCommonjsModule(function (module, exports) { if ( !tree._listeners.warned && - this$1._maxListeners > 0 && - tree._listeners.length > this$1._maxListeners + this._maxListeners > 0 && + tree._listeners.length > this._maxListeners ) { tree._listeners.warned = true; - logPossibleMemoryLeak.call(this$1, tree._listeners.length, name); + logPossibleMemoryLeak.call(this, tree._listeners.length, name); } } return true; @@ -52234,7 +52062,6 @@ var eventemitter2 = createCommonjsModule(function (module, exports) { EventEmitter.prototype.emit = function() { var arguments$1 = arguments; - var this$1 = this; this._events || init.call(this); @@ -52259,19 +52086,19 @@ var eventemitter2 = createCommonjsModule(function (module, exports) { } for (i = 0, l = handler.length; i < l; i++) { - this$1.event = type; + this.event = type; switch (al) { case 1: - handler[i].call(this$1, type); + handler[i].call(this, type); break; case 2: - handler[i].call(this$1, type, arguments$1[1]); + handler[i].call(this, type, arguments$1[1]); break; case 3: - handler[i].call(this$1, type, arguments$1[1], arguments$1[2]); + handler[i].call(this, type, arguments$1[1], arguments$1[2]); break; default: - handler[i].apply(this$1, args); + handler[i].apply(this, args); } } } @@ -52313,19 +52140,19 @@ var eventemitter2 = createCommonjsModule(function (module, exports) { for (j = 1; j < al; j++) { args[j - 1] = arguments$1[j]; } } for (i = 0, l = handler.length; i < l; i++) { - this$1.event = type; + this.event = type; switch (al) { case 1: - handler[i].call(this$1); + handler[i].call(this); break; case 2: - handler[i].call(this$1, arguments$1[1]); + handler[i].call(this, arguments$1[1]); break; case 3: - handler[i].call(this$1, arguments$1[1], arguments$1[2]); + handler[i].call(this, arguments$1[1], arguments$1[2]); break; default: - handler[i].apply(this$1, args); + handler[i].apply(this, args); } } return true; @@ -52343,7 +52170,6 @@ var eventemitter2 = createCommonjsModule(function (module, exports) { EventEmitter.prototype.emitAsync = function() { var arguments$1 = arguments; - var this$1 = this; this._events || init.call(this); @@ -52366,19 +52192,19 @@ var eventemitter2 = createCommonjsModule(function (module, exports) { for (j = 1; j < al; j++) { args[j] = arguments$1[j]; } } for (i = 0, l = this._all.length; i < l; i++) { - this$1.event = type; + this.event = type; switch (al) { case 1: - promises.push(this$1._all[i].call(this$1, type)); + promises.push(this._all[i].call(this, type)); break; case 2: - promises.push(this$1._all[i].call(this$1, type, arguments$1[1])); + promises.push(this._all[i].call(this, type, arguments$1[1])); break; case 3: - promises.push(this$1._all[i].call(this$1, type, arguments$1[1], arguments$1[2])); + promises.push(this._all[i].call(this, type, arguments$1[1], arguments$1[2])); break; default: - promises.push(this$1._all[i].apply(this$1, args)); + promises.push(this._all[i].apply(this, args)); } } } @@ -52415,19 +52241,19 @@ var eventemitter2 = createCommonjsModule(function (module, exports) { for (j = 1; j < al; j++) { args[j - 1] = arguments$1[j]; } } for (i = 0, l = handler.length; i < l; i++) { - this$1.event = type; + this.event = type; switch (al) { case 1: - promises.push(handler[i].call(this$1)); + promises.push(handler[i].call(this)); break; case 2: - promises.push(handler[i].call(this$1, arguments$1[1])); + promises.push(handler[i].call(this, arguments$1[1])); break; case 3: - promises.push(handler[i].call(this$1, arguments$1[1], arguments$1[2])); + promises.push(handler[i].call(this, arguments$1[1], arguments$1[2])); break; default: - promises.push(handler[i].apply(this$1, args)); + promises.push(handler[i].apply(this, args)); } } } else if (!this._all && type === 'error') { @@ -52529,9 +52355,7 @@ var eventemitter2 = createCommonjsModule(function (module, exports) { return this; }; - EventEmitter.prototype.off = function(type, listener) { - var this$1 = this; - + EventEmitter.prototype.off = function(type, listener) { if (typeof listener !== 'function') { throw new Error('removeListener only takes instances of Function'); } @@ -52569,37 +52393,37 @@ var eventemitter2 = createCommonjsModule(function (module, exports) { continue; } - if(this$1.wildcard) { + if(this.wildcard) { leaf._listeners.splice(position, 1); } else { - this$1._events[type].splice(position, 1); + this._events[type].splice(position, 1); } if (handlers.length === 0) { - if(this$1.wildcard) { + if(this.wildcard) { delete leaf._listeners; } else { - delete this$1._events[type]; + delete this._events[type]; } } - this$1.emit("removeListener", type, listener); + this.emit("removeListener", type, listener); - return this$1; + return this; } else if (handlers === listener || (handlers.listener && handlers.listener === listener) || (handlers._origin && handlers._origin === listener)) { - if(this$1.wildcard) { + if(this.wildcard) { delete leaf._listeners; } else { - delete this$1._events[type]; + delete this._events[type]; } - this$1.emit("removeListener", type, listener); + this.emit("removeListener", type, listener); } } @@ -52626,23 +52450,21 @@ var eventemitter2 = createCommonjsModule(function (module, exports) { return this; }; - EventEmitter.prototype.offAny = function(fn) { - var this$1 = this; - + EventEmitter.prototype.offAny = function(fn) { var i = 0, l = 0, fns; if (fn && this._all && this._all.length > 0) { fns = this._all; for(i = 0, l = fns.length; i < l; i++) { if(fn === fns[i]) { fns.splice(i, 1); - this$1.emit("removeListenerAny", fn); - return this$1; + this.emit("removeListenerAny", fn); + return this; } } } else { fns = this._all; for(i = 0, l = fns.length; i < l; i++) - { this$1.emit("removeListenerAny", fns[i]); } + { this.emit("removeListenerAny", fns[i]); } this._all = []; } return this; @@ -52723,7 +52545,7 @@ var eventemitter2 = createCommonjsModule(function (module, exports) { * @author David Gossow - dgossow@willowgarage.com */ -var InteractiveMarkerHandle = (function (EventEmitter2) { +var InteractiveMarkerHandle = /*@__PURE__*/(function (EventEmitter2) { function InteractiveMarkerHandle(options) { EventEmitter2.call(this); options = options || {}; @@ -52954,8 +52776,6 @@ InteractiveMarkerClient.prototype.subscribe = function subscribe (topic) { * Unsubscribe from the current interactive marker topic. */ InteractiveMarkerClient.prototype.unsubscribe = function unsubscribe () { - var this$1 = this; - if (this.updateTopic) { this.updateTopic.unsubscribe(); } @@ -52963,8 +52783,8 @@ InteractiveMarkerClient.prototype.unsubscribe = function unsubscribe () { this.feedbackTopic.unadvertise(); } // erase all markers - for (var intMarkerName in this$1.interactiveMarkers) { - this$1.eraseIntMarker(intMarkerName); + for (var intMarkerName in this.interactiveMarkers) { + this.eraseIntMarker(intMarkerName); } this.interactiveMarkers = {}; }; @@ -52974,13 +52794,11 @@ InteractiveMarkerClient.prototype.unsubscribe = function unsubscribe () { * @param initMessage - the interactive marker initialization message to process */ InteractiveMarkerClient.prototype.processInit = function processInit (initMessage) { - var this$1 = this; - var message = initMessage.msg; // erase any old markers message.erases = []; - for (var intMarkerName in this$1.interactiveMarkers) { + for (var intMarkerName in this.interactiveMarkers) { message.erases.push(intMarkerName); } message.poses = []; @@ -53088,7 +52906,7 @@ InteractiveMarkerClient.prototype.eraseIntMarker = function eraseIntMarker (intM * @author Russell Toris - rctoris@wpi.edu */ -var SceneNode = (function (superclass) { +var SceneNode = /*@__PURE__*/(function (superclass) { function SceneNode(options) { superclass.call(this); options = options || {}; @@ -53150,7 +52968,7 @@ var SceneNode = (function (superclass) { * @author Nils Berg - berg.nils@gmail.com */ -var MarkerArrayClient = (function (EventEmitter2) { +var MarkerArrayClient = /*@__PURE__*/(function (EventEmitter2) { function MarkerArrayClient(options) { EventEmitter2.call(this); options = options || {}; @@ -53184,8 +53002,6 @@ var MarkerArrayClient = (function (EventEmitter2) { }; MarkerArrayClient.prototype.processMessage = function processMessage (arrayMessage){ arrayMessage.markers.forEach(function(message) { - var this$1 = this; - if(message.action === 0) { var updated = false; if(message.ns + message.id in this.markers) { // "MODIFY" @@ -53217,9 +53033,9 @@ var MarkerArrayClient = (function (EventEmitter2) { delete this.markers[message.ns + message.id]; } else if(message.action === 3) { // "DELETE ALL" - for (var m in this$1.markers){ - this$1.markers[m].unsubscribeTf(); - this$1.rootObject.remove(this$1.markers[m]); + for (var m in this.markers){ + this.markers[m].unsubscribeTf(); + this.rootObject.remove(this.markers[m]); } this.markers = {}; } @@ -53243,7 +53059,7 @@ var MarkerArrayClient = (function (EventEmitter2) { * @author Russell Toris - rctoris@wpi.edu */ -var MarkerClient = (function (EventEmitter2) { +var MarkerClient = /*@__PURE__*/(function (EventEmitter2) { function MarkerClient(options) { EventEmitter2.call(this); options = options || {}; @@ -53328,7 +53144,7 @@ var MarkerClient = (function (EventEmitter2) { * @author Jihoon Lee - lee@magazino.eu */ -var Arrow2 = (function (superclass) { +var Arrow2 = /*@__PURE__*/(function (superclass) { function Arrow2(options) { options = options || {}; var origin = options.origin || new THREE$1.Vector3(0, 0, 0); @@ -53368,7 +53184,7 @@ var Arrow2 = (function (superclass) { * @author David Gossow - dgossow@willowgarage.com */ -var Axes = (function (superclass) { +var Axes = /*@__PURE__*/(function (superclass) { function Axes(options) { superclass.call(this); var that = this; @@ -53457,10 +53273,8 @@ var Axes = (function (superclass) { * @author Russell Toris - rctoris@wpi.edu */ -var Grid = (function (superclass) { +var Grid = /*@__PURE__*/(function (superclass) { function Grid(options) { - var this$1 = this; - options = options || {}; var num_cells = options.num_cells || 10; var color = options.color || '#cccccc'; @@ -53487,8 +53301,8 @@ var Grid = (function (superclass) { new THREE$1.Vector3( position, -edge, 0 ), new THREE$1.Vector3( position, edge, 0 ) ); - this$1.add(new THREE$1.Line(geometryH, material)); - this$1.add(new THREE$1.Line(geometryV, material)); + this.add(new THREE$1.Line(geometryH, material)); + this.add(new THREE$1.Line(geometryV, material)); } } @@ -53503,7 +53317,7 @@ var Grid = (function (superclass) { * @author Russell Toris - rctoris@wpi.edu */ -var OccupancyGrid = (function (superclass) { +var OccupancyGrid = /*@__PURE__*/(function (superclass) { function OccupancyGrid(options) { options = options || {}; var message = options.message; @@ -53583,7 +53397,7 @@ var OccupancyGrid = (function (superclass) { * @author Russell Toris - rctoris@wpi.edu */ -var OccupancyGridClient = (function (EventEmitter2) { +var OccupancyGridClient = /*@__PURE__*/(function (EventEmitter2) { function OccupancyGridClient(options) { EventEmitter2.call(this); options = options || {}; @@ -53621,6 +53435,7 @@ var OccupancyGridClient = (function (EventEmitter2) { ros : this.ros, name : this.topicName, messageType : 'nav_msgs/OccupancyGrid', + queue_length : 1, compression : this.compression }); this.rosTopic.subscribe(this.processMessage.bind(this)); @@ -53672,7 +53487,7 @@ var OccupancyGridClient = (function (EventEmitter2) { * @author David V. Lu!! - davidvlu@gmail.com */ -var Odometry = (function (superclass) { +var Odometry = /*@__PURE__*/(function (superclass) { function Odometry(options) { superclass.call(this); this.options = options || {}; @@ -53706,6 +53521,7 @@ var Odometry = (function (superclass) { this.rosTopic = new Topic({ ros : this.ros, name : this.topicName, + queue_length : 1, messageType : 'nav_msgs/Odometry' }); this.rosTopic.subscribe(this.processMessage.bind(this)); @@ -53743,7 +53559,7 @@ var Odometry = (function (superclass) { * @author David V. Lu!! - davidvlu@gmail.com */ -var Path$1 = (function (superclass) { +var Path$1 = /*@__PURE__*/(function (superclass) { function Path(options) { superclass.call(this); options = options || {}; @@ -53776,6 +53592,7 @@ var Path$1 = (function (superclass) { this.rosTopic = new Topic({ ros : this.ros, name : this.topicName, + queue_length : 1, messageType : 'nav_msgs/Path' }); this.rosTopic.subscribe(this.processMessage.bind(this)); @@ -53813,7 +53630,7 @@ var Path$1 = (function (superclass) { * @author David V. Lu!! - davidvlu@gmail.com */ -var Point = (function (superclass) { +var Point = /*@__PURE__*/(function (superclass) { function Point(options) { superclass.call(this); this.options = options || {}; @@ -53846,6 +53663,7 @@ var Point = (function (superclass) { this.rosTopic = new Topic({ ros : this.ros, name : this.topicName, + queue_length : 1, messageType : 'geometry_msgs/PointStamped' }); this.rosTopic.subscribe(this.processMessage.bind(this)); @@ -53877,7 +53695,7 @@ var Point = (function (superclass) { * @author David V. Lu!! - davidvlu@gmail.com */ -var Polygon = (function (superclass) { +var Polygon = /*@__PURE__*/(function (superclass) { function Polygon(options) { superclass.call(this); options = options || {}; @@ -53910,6 +53728,7 @@ var Polygon = (function (superclass) { this.rosTopic = new Topic({ ros : this.ros, name : this.topicName, + queue_length : 1, messageType : 'geometry_msgs/PolygonStamped' }); this.rosTopic.subscribe(this.processMessage.bind(this)); @@ -53950,7 +53769,7 @@ var Polygon = (function (superclass) { * @author David V. Lu!! - davidvlu@gmail.com */ -var Pose$1 = (function (superclass) { +var Pose$1 = /*@__PURE__*/(function (superclass) { function Pose$$1(options) { superclass.call(this); this.options = options || {}; @@ -53982,6 +53801,7 @@ var Pose$1 = (function (superclass) { this.rosTopic = new Topic({ ros : this.ros, name : this.topicName, + queue_length : 1, messageType : 'geometry_msgs/PoseStamped' }); this.rosTopic.subscribe(this.processMessage.bind(this)); @@ -54018,7 +53838,7 @@ var Pose$1 = (function (superclass) { * @author David V. Lu!! - davidvlu@gmail.com */ -var PoseArray = (function (superclass) { +var PoseArray = /*@__PURE__*/(function (superclass) { function PoseArray(options) { superclass.call(this); this.options = options || {}; @@ -54051,13 +53871,12 @@ var PoseArray = (function (superclass) { this.rosTopic = new Topic({ ros : this.ros, name : this.topicName, + queue_length : 1, messageType : 'geometry_msgs/PoseArray' }); this.rosTopic.subscribe(this.processMessage.bind(this)); }; PoseArray.prototype.processMessage = function processMessage (message){ - var this$1 = this; - if(this.sn!==null){ this.sn.unsubscribeTf(); this.rootObject.remove(this.sn); @@ -54076,9 +53895,9 @@ var PoseArray = (function (superclass) { var rot = new THREE$1.Quaternion(message.poses[i].orientation.x, message.poses[i].orientation.y, message.poses[i].orientation.z, message.poses[i].orientation.w); - var tip = new THREE$1.Vector3(this$1.length,0,0); - var side1 = new THREE$1.Vector3(this$1.length*0.8, this$1.length*0.2, 0); - var side2 = new THREE$1.Vector3(this$1.length*0.8, -this$1.length*0.2, 0); + var tip = new THREE$1.Vector3(this.length,0,0); + var side1 = new THREE$1.Vector3(this.length*0.8, this.length*0.2, 0); + var side2 = new THREE$1.Vector3(this.length*0.8, -this.length*0.2, 0); tip.applyQuaternion(rot); side1.applyQuaternion(rot); side2.applyQuaternion(rot); @@ -54089,7 +53908,7 @@ var PoseArray = (function (superclass) { lineGeometry.vertices.push(tip); lineGeometry.computeLineDistances(); - var lineMaterial = new THREE$1.LineBasicMaterial( { color: this$1.color } ); + var lineMaterial = new THREE$1.LineBasicMaterial( { color: this.color } ); line = new THREE$1.Line( lineGeometry, lineMaterial ); group.add(line); @@ -54111,7 +53930,7 @@ var PoseArray = (function (superclass) { * @author David V. Lu!! - davidvlu@gmail.com */ -var PoseWithCovariance = (function (superclass) { +var PoseWithCovariance = /*@__PURE__*/(function (superclass) { function PoseWithCovariance(options) { superclass.call(this); this.options = options || {}; @@ -54143,6 +53962,7 @@ var PoseWithCovariance = (function (superclass) { this.rosTopic = new Topic({ ros : this.ros, name : this.topicName, + queue_length : 1, messageType : 'geometry_msgs/PoseWithCovarianceStamped' }); this.rosTopic.subscribe(this.processMessage.bind(this)); @@ -54180,7 +54000,7 @@ var PoseWithCovariance = (function (superclass) { * @author Mathieu Bredif - mathieu.bredif@ign.fr */ -var Points$1 = (function (superclass) { +var Points$1 = /*@__PURE__*/(function (superclass) { function Points(options) { superclass.call(this); options = options || {}; @@ -54211,14 +54031,12 @@ var Points$1 = (function (superclass) { Points.prototype.setup = function setup (frame, point_step, fields) { - var this$1 = this; - if(this.sn===null){ // turn fields to a map fields = fields || []; this.fields = {}; for(var i=0; i= message.range_min && range <= message.range_max){ var angle = message.angle_min + i * message.angle_increment; - this$1.points.positions.array[j++] = range * Math.cos(angle); - this$1.points.positions.array[j++] = range * Math.sin(angle); - this$1.points.positions.array[j++] = 0.0; + this.points.positions.array[j++] = range * Math.cos(angle); + this.points.positions.array[j++] = range * Math.sin(angle); + this.points.positions.array[j++] = 0.0; } } this.points.update(j/3); @@ -54385,7 +54204,7 @@ decode64.e={}; for(var i=0;i<64;i++){decode64.e[decode64.S.charAt(i)]=i;} -var PointCloud2 = (function (superclass) { +var PointCloud2 = /*@__PURE__*/(function (superclass) { function PointCloud2(options) { superclass.call(this); options = options || {}; @@ -54416,13 +54235,12 @@ var PointCloud2 = (function (superclass) { ros : this.ros, name : this.topicName, messageType : 'sensor_msgs/PointCloud2', + queue_length : 1, compression: this.compression }); this.rosTopic.subscribe(this.processMessage.bind(this)); }; PointCloud2.prototype.processMessage = function processMessage (msg){ - var this$1 = this; - if(!this.points.setup(msg.header.frame_id, msg.point_step, msg.fields)) { return; } @@ -54449,15 +54267,15 @@ var PointCloud2 = (function (superclass) { var base, color; for(var i = 0; i < n; i++){ base = i * pointRatio * msg.point_step; - this$1.points.positions.array[3*i ] = dv.getFloat32(base+x, littleEndian); - this$1.points.positions.array[3*i + 1] = dv.getFloat32(base+y, littleEndian); - this$1.points.positions.array[3*i + 2] = dv.getFloat32(base+z, littleEndian); - - if(this$1.points.colors){ - color = this$1.points.colormap(this$1.points.getColor(dv,base,littleEndian)); - this$1.points.colors.array[3*i ] = color.r; - this$1.points.colors.array[3*i + 1] = color.g; - this$1.points.colors.array[3*i + 2] = color.b; + this.points.positions.array[3*i ] = dv.getFloat32(base+x, littleEndian); + this.points.positions.array[3*i + 1] = dv.getFloat32(base+y, littleEndian); + this.points.positions.array[3*i + 2] = dv.getFloat32(base+z, littleEndian); + + if(this.points.colors){ + color = this.points.colormap(this.points.getColor(dv,base,littleEndian)); + this.points.colors.array[3*i ] = color.r; + this.points.colors.array[3*i + 1] = color.g; + this.points.colors.array[3*i + 2] = color.b; } } this.points.update(n); @@ -54471,10 +54289,8 @@ var PointCloud2 = (function (superclass) { * @author Russell Toris - rctoris@wpi.edu */ -var Urdf = (function (superclass) { +var Urdf = /*@__PURE__*/(function (superclass) { function Urdf(options) { - var this$1 = this; - options = options || {}; var urdfModel = options.urdfModel; var path = options.path || '/'; @@ -54530,7 +54346,7 @@ var Urdf = (function (superclass) { tfClient : tfClient, object : mesh }); - this$1.add(sceneNode); + this.add(sceneNode); } else { console.warn('Could not load geometry mesh: '+uri); } @@ -54565,7 +54381,7 @@ var Urdf = (function (superclass) { tfClient: tfClient, object: shapeMesh }); - this$1.add(scene); + this.add(scene); } } } @@ -54720,8 +54536,6 @@ Highlighter.prototype.makeEverythingInvisible = function makeEverythingInvisible * @param scene - the object to traverse */ Highlighter.prototype.makeHighlightedVisible = function makeHighlightedVisible (scene) { - var this$1 = this; - var makeVisible = function(currentObject) { if ( currentObject instanceof THREE$1.Mesh || currentObject instanceof THREE$1.Line || currentObject instanceof THREE$1.Sprite ) { @@ -54729,8 +54543,8 @@ Highlighter.prototype.makeHighlightedVisible = function makeHighlightedVisible ( } }; - for (var uuid in this$1.hoverObjs) { - var selectedObject = this$1.hoverObjs[uuid]; + for (var uuid in this.hoverObjs) { + var selectedObject = this.hoverObjs[uuid]; // Make each selected object and all of its children visible selectedObject.visible = true; selectedObject.traverse(makeVisible); @@ -54754,7 +54568,7 @@ Highlighter.prototype.restoreVisibility = function restoreVisibility (scene) { * @author David Gossow - dgossow@willowgarage.com */ -var MouseHandler = (function (superclass) { +var MouseHandler = /*@__PURE__*/(function (superclass) { function MouseHandler(options) { superclass.call(this); this.renderer = options.renderer; @@ -54925,8 +54739,6 @@ var MouseHandler = (function (superclass) { * @returns if an event was canceled */ MouseHandler.prototype.notify = function notify (target, type, event3D) { - var this$1 = this; - // ensure the type is set // event3D.type = type; @@ -54952,7 +54764,7 @@ var MouseHandler = (function (superclass) { && event3D.currentTarget.dispatchEvent instanceof Function) { event3D.currentTarget.dispatchEvent(event3D); if (event3D.cancelBubble) { - this$1.dispatchEvent(event3D); + this.dispatchEvent(event3D); return 0; // Event Accepted } else if(event3D.continueBubble) { @@ -54976,7 +54788,7 @@ var MouseHandler = (function (superclass) { * @author AlteredQualia - http://alteredqualia.com */ -var OrbitControls = (function (superclass) { +var OrbitControls = /*@__PURE__*/(function (superclass) { function OrbitControls(options) { superclass.call(this); var that = this; diff --git a/build/ros3d.js b/build/ros3d.js index ed82246b..c627eedc 100644 --- a/build/ros3d.js +++ b/build/ros3d.js @@ -53656,6 +53656,7 @@ class OccupancyGridClient extends eventemitter2 { ros : this.ros, name : this.topicName, messageType : 'nav_msgs/OccupancyGrid', + queue_length : 1, compression : this.compression }); this.rosTopic.subscribe(this.processMessage.bind(this)); @@ -53756,6 +53757,7 @@ class Odometry extends THREE$1.Object3D { this.rosTopic = new ROSLIB.Topic({ ros : this.ros, name : this.topicName, + queue_length : 1, messageType : 'nav_msgs/Odometry' }); this.rosTopic.subscribe(this.processMessage.bind(this)); @@ -53836,6 +53838,7 @@ let Path$1 = class Path extends THREE$1.Object3D { this.rosTopic = new ROSLIB.Topic({ ros : this.ros, name : this.topicName, + queue_length : 1, messageType : 'nav_msgs/Path' }); this.rosTopic.subscribe(this.processMessage.bind(this)); @@ -53917,6 +53920,7 @@ class Point extends THREE$1.Object3D { this.rosTopic = new ROSLIB.Topic({ ros : this.ros, name : this.topicName, + queue_length : 1, messageType : 'geometry_msgs/PointStamped' }); this.rosTopic.subscribe(this.processMessage.bind(this)); @@ -53991,6 +53995,7 @@ class Polygon extends THREE$1.Object3D { this.rosTopic = new ROSLIB.Topic({ ros : this.ros, name : this.topicName, + queue_length : 1, messageType : 'geometry_msgs/PolygonStamped' }); this.rosTopic.subscribe(this.processMessage.bind(this)); @@ -54077,6 +54082,7 @@ class Pose extends THREE$1.Object3D { this.rosTopic = new ROSLIB.Topic({ ros : this.ros, name : this.topicName, + queue_length : 1, messageType : 'geometry_msgs/PoseStamped' }); this.rosTopic.subscribe(this.processMessage.bind(this)); @@ -54157,6 +54163,7 @@ class PoseArray extends THREE$1.Object3D { this.rosTopic = new ROSLIB.Topic({ ros : this.ros, name : this.topicName, + queue_length : 1, messageType : 'geometry_msgs/PoseArray' }); this.rosTopic.subscribe(this.processMessage.bind(this)); @@ -54257,6 +54264,7 @@ class PoseWithCovariance extends THREE$1.Object3D { this.rosTopic = new ROSLIB.Topic({ ros : this.ros, name : this.topicName, + queue_length : 1, messageType : 'geometry_msgs/PoseWithCovarianceStamped' }); this.rosTopic.subscribe(this.processMessage.bind(this)); @@ -54423,6 +54431,7 @@ class LaserScan extends THREE$1.Object3D { * * ros - the ROSLIB.Ros connection handle * * topic - the marker topic to listen to (default '/scan') * * tfClient - the TF client handle to use + * * compression (optional) - message compression (default: 'cbor') * * rootObject (optional) - the root object to add this marker to use for the points. * * max_pts (optional) - number of points to draw (default: 10000) * * pointRatio (optional) - point subsampling ratio (default: 1, no subsampling) @@ -54434,6 +54443,7 @@ class LaserScan extends THREE$1.Object3D { options = options || {}; this.ros = options.ros; this.topicName = options.topic || '/scan'; + this.compression = options.compression || 'cbor'; this.points = new Points$1(options); this.rosTopic = undefined; this.subscribe(); @@ -54454,6 +54464,8 @@ class LaserScan extends THREE$1.Object3D { this.rosTopic = new ROSLIB.Topic({ ros : this.ros, name : this.topicName, + compression : this.compression, + queue_length : 1, messageType : 'sensor_msgs/LaserScan' }); this.rosTopic.subscribe(this.processMessage.bind(this)); @@ -54567,6 +54579,7 @@ class PointCloud2 extends THREE$1.Object3D { ros : this.ros, name : this.topicName, messageType : 'sensor_msgs/PointCloud2', + queue_length : 1, compression: this.compression }); this.rosTopic.subscribe(this.processMessage.bind(this)); diff --git a/build/ros3d.min.js b/build/ros3d.min.js index b04b36e4..bf3bba5f 100644 --- a/build/ros3d.min.js +++ b/build/ros3d.min.js @@ -1 +1 @@ -var ROS3D=function(e,t){"use strict";function i(){}void 0===Number.EPSILON&&(Number.EPSILON=Math.pow(2,-52)),void 0===Number.isInteger&&(Number.isInteger=function(e){return"number"==typeof e&&isFinite(e)&&Math.floor(e)===e}),void 0===Math.sign&&(Math.sign=function(e){return e<0?-1:e>0?1:+e}),"name"in Function.prototype==!1&&Object.defineProperty(Function.prototype,"name",{get:function(){return this.toString().match(/^\s*function\s*([^\(\s]*)/)[1]}}),void 0===Object.assign&&(Object.assign=function(e){if(void 0===e||null===e)throw new TypeError("Cannot convert undefined or null to object");for(var t=Object(e),i=1;i>8&255]+e[t>>16&255]+e[t>>24&255]+"-"+e[255&i]+e[i>>8&255]+"-"+e[i>>16&15|64]+e[i>>24&255]+"-"+e[63&r|128]+e[r>>8&255]+"-"+e[r>>16&255]+e[r>>24&255]+e[255&n]+e[n>>8&255]+e[n>>16&255]+e[n>>24&255]}}(),clamp:function(e,t,i){return Math.max(t,Math.min(i,e))},euclideanModulo:function(e,t){return(e%t+t)%t},mapLinear:function(e,t,i,r,n){return r+(e-t)*(n-r)/(i-t)},lerp:function(e,t,i){return(1-i)*e+i*t},smoothstep:function(e,t,i){return e<=t?0:e>=i?1:(e=(e-t)/(i-t))*e*(3-2*e)},smootherstep:function(e,t,i){return e<=t?0:e>=i?1:(e=(e-t)/(i-t))*e*e*(e*(6*e-15)+10)},randInt:function(e,t){return e+Math.floor(Math.random()*(t-e+1))},randFloat:function(e,t){return e+Math.random()*(t-e)},randFloatSpread:function(e){return e*(.5-Math.random())},degToRad:function(e){return e*ft.DEG2RAD},radToDeg:function(e){return e*ft.RAD2DEG},isPowerOfTwo:function(e){return 0==(e&e-1)&&0!==e},ceilPowerOfTwo:function(e){return Math.pow(2,Math.ceil(Math.log(e)/Math.LN2))},floorPowerOfTwo:function(e){return Math.pow(2,Math.floor(Math.log(e)/Math.LN2))}};function mt(e,t){this.x=e||0,this.y=t||0}function vt(){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.")}function gt(e,t,i,r){this._x=e||0,this._y=t||0,this._z=i||0,this._w=void 0!==r?r:1}function yt(e,t,i){this.x=e||0,this.y=t||0,this.z=i||0}function xt(){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.")}Object.defineProperties(mt.prototype,{width:{get:function(){return this.x},set:function(e){this.x=e}},height:{get:function(){return this.y},set:function(e){this.y=e}}}),Object.assign(mt.prototype,{isVector2:!0,set:function(e,t){return this.x=e,this.y=t,this},setScalar:function(e){return this.x=e,this.y=e,this},setX:function(e){return this.x=e,this},setY:function(e){return this.y=e,this},setComponent:function(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;default:throw new Error("index is out of range: "+e)}return this},getComponent:function(e){switch(e){case 0:return this.x;case 1:return this.y;default:throw new Error("index is out of range: "+e)}},clone:function(){return new this.constructor(this.x,this.y)},copy:function(e){return this.x=e.x,this.y=e.y,this},add:function(e,t){return void 0!==t?(console.warn("THREE.Vector2: .add() now only accepts one argument. Use .addVectors( a, b ) instead."),this.addVectors(e,t)):(this.x+=e.x,this.y+=e.y,this)},addScalar:function(e){return this.x+=e,this.y+=e,this},addVectors:function(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this},addScaledVector:function(e,t){return this.x+=e.x*t,this.y+=e.y*t,this},sub:function(e,t){return void 0!==t?(console.warn("THREE.Vector2: .sub() now only accepts one argument. Use .subVectors( a, b ) instead."),this.subVectors(e,t)):(this.x-=e.x,this.y-=e.y,this)},subScalar:function(e){return this.x-=e,this.y-=e,this},subVectors:function(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this},multiply:function(e){return this.x*=e.x,this.y*=e.y,this},multiplyScalar:function(e){return this.x*=e,this.y*=e,this},divide:function(e){return this.x/=e.x,this.y/=e.y,this},divideScalar:function(e){return this.multiplyScalar(1/e)},applyMatrix3:function(e){var t=this.x,i=this.y,r=e.elements;return this.x=r[0]*t+r[3]*i+r[6],this.y=r[1]*t+r[4]*i+r[7],this},min:function(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this},max:function(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this},clamp:function(e,t){return this.x=Math.max(e.x,Math.min(t.x,this.x)),this.y=Math.max(e.y,Math.min(t.y,this.y)),this},clampScalar:(r=new mt,n=new mt,function(e,t){return r.set(e,e),n.set(t,t),this.clamp(r,n)}),clampLength:function(e,t){var i=this.length();return this.divideScalar(i||1).multiplyScalar(Math.max(e,Math.min(t,i)))},floor:function(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this},ceil:function(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this},round:function(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this},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},negate:function(){return this.x=-this.x,this.y=-this.y,this},dot:function(e){return this.x*e.x+this.y*e.y},lengthSq:function(){return this.x*this.x+this.y*this.y},length:function(){return Math.sqrt(this.x*this.x+this.y*this.y)},manhattanLength:function(){return Math.abs(this.x)+Math.abs(this.y)},normalize:function(){return this.divideScalar(this.length()||1)},angle:function(){var e=Math.atan2(this.y,this.x);return e<0&&(e+=2*Math.PI),e},distanceTo:function(e){return Math.sqrt(this.distanceToSquared(e))},distanceToSquared:function(e){var t=this.x-e.x,i=this.y-e.y;return t*t+i*i},manhattanDistanceTo:function(e){return Math.abs(this.x-e.x)+Math.abs(this.y-e.y)},setLength:function(e){return this.normalize().multiplyScalar(e)},lerp:function(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this},lerpVectors:function(e,t,i){return this.subVectors(t,e).multiplyScalar(i).add(e)},equals:function(e){return e.x===this.x&&e.y===this.y},fromArray:function(e,t){return void 0===t&&(t=0),this.x=e[t],this.y=e[t+1],this},toArray:function(e,t){return void 0===e&&(e=[]),void 0===t&&(t=0),e[t]=this.x,e[t+1]=this.y,e},fromBufferAttribute:function(e,t,i){return void 0!==i&&console.warn("THREE.Vector2: offset has been removed from .fromBufferAttribute()."),this.x=e.getX(t),this.y=e.getY(t),this},rotateAround:function(e,t){var i=Math.cos(t),r=Math.sin(t),n=this.x-e.x,o=this.y-e.y;return this.x=n*i-o*r+e.x,this.y=n*r+o*i+e.y,this}}),Object.assign(vt.prototype,{isMatrix4:!0,set:function(e,t,i,r,n,o,a,s,c,h,l,u,p,d,f,m){var v=this.elements;return v[0]=e,v[4]=t,v[8]=i,v[12]=r,v[1]=n,v[5]=o,v[9]=a,v[13]=s,v[2]=c,v[6]=h,v[10]=l,v[14]=u,v[3]=p,v[7]=d,v[11]=f,v[15]=m,this},identity:function(){return this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1),this},clone:function(){return(new vt).fromArray(this.elements)},copy:function(e){var t=this.elements,i=e.elements;return t[0]=i[0],t[1]=i[1],t[2]=i[2],t[3]=i[3],t[4]=i[4],t[5]=i[5],t[6]=i[6],t[7]=i[7],t[8]=i[8],t[9]=i[9],t[10]=i[10],t[11]=i[11],t[12]=i[12],t[13]=i[13],t[14]=i[14],t[15]=i[15],this},copyPosition:function(e){var t=this.elements,i=e.elements;return t[12]=i[12],t[13]=i[13],t[14]=i[14],this},extractBasis:function(e,t,i){return e.setFromMatrixColumn(this,0),t.setFromMatrixColumn(this,1),i.setFromMatrixColumn(this,2),this},makeBasis:function(e,t,i){return this.set(e.x,t.x,i.x,0,e.y,t.y,i.y,0,e.z,t.z,i.z,0,0,0,0,1),this},extractRotation:(l=new yt,function(e){var t=this.elements,i=e.elements,r=1/l.setFromMatrixColumn(e,0).length(),n=1/l.setFromMatrixColumn(e,1).length(),o=1/l.setFromMatrixColumn(e,2).length();return t[0]=i[0]*r,t[1]=i[1]*r,t[2]=i[2]*r,t[4]=i[4]*n,t[5]=i[5]*n,t[6]=i[6]*n,t[8]=i[8]*o,t[9]=i[9]*o,t[10]=i[10]*o,this}),makeRotationFromEuler:function(e){e&&e.isEuler||console.error("THREE.Matrix4: .makeRotationFromEuler() now expects a Euler rotation rather than a Vector3 and order.");var t=this.elements,i=e.x,r=e.y,n=e.z,o=Math.cos(i),a=Math.sin(i),s=Math.cos(r),c=Math.sin(r),h=Math.cos(n),l=Math.sin(n);if("XYZ"===e.order){var u=o*h,p=o*l,d=a*h,f=a*l;t[0]=s*h,t[4]=-s*l,t[8]=c,t[1]=p+d*c,t[5]=u-f*c,t[9]=-a*s,t[2]=f-u*c,t[6]=d+p*c,t[10]=o*s}else if("YXZ"===e.order){var m=s*h,v=s*l,g=c*h,y=c*l;t[0]=m+y*a,t[4]=g*a-v,t[8]=o*c,t[1]=o*l,t[5]=o*h,t[9]=-a,t[2]=v*a-g,t[6]=y+m*a,t[10]=o*s}else if("ZXY"===e.order){m=s*h,v=s*l,g=c*h,y=c*l;t[0]=m-y*a,t[4]=-o*l,t[8]=g+v*a,t[1]=v+g*a,t[5]=o*h,t[9]=y-m*a,t[2]=-o*c,t[6]=a,t[10]=o*s}else if("ZYX"===e.order){u=o*h,p=o*l,d=a*h,f=a*l;t[0]=s*h,t[4]=d*c-p,t[8]=u*c+f,t[1]=s*l,t[5]=f*c+u,t[9]=p*c-d,t[2]=-c,t[6]=a*s,t[10]=o*s}else if("YZX"===e.order){var x=o*s,b=o*c,w=a*s,_=a*c;t[0]=s*h,t[4]=_-x*l,t[8]=w*l+b,t[1]=l,t[5]=o*h,t[9]=-a*h,t[2]=-c*h,t[6]=b*l+w,t[10]=x-_*l}else if("XZY"===e.order){x=o*s,b=o*c,w=a*s,_=a*c;t[0]=s*h,t[4]=-l,t[8]=c*h,t[1]=x*l+_,t[5]=o*h,t[9]=b*l-w,t[2]=w*l-b,t[6]=a*h,t[10]=_*l+x}return t[3]=0,t[7]=0,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,this},makeRotationFromQuaternion:function(e){var t=this.elements,i=e._x,r=e._y,n=e._z,o=e._w,a=i+i,s=r+r,c=n+n,h=i*a,l=i*s,u=i*c,p=r*s,d=r*c,f=n*c,m=o*a,v=o*s,g=o*c;return t[0]=1-(p+f),t[4]=l-g,t[8]=u+v,t[1]=l+g,t[5]=1-(h+f),t[9]=d-m,t[2]=u-v,t[6]=d+m,t[10]=1-(h+p),t[3]=0,t[7]=0,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,this},lookAt:(s=new yt,c=new yt,h=new yt,function(e,t,i){var r=this.elements;return h.subVectors(e,t),0===h.lengthSq()&&(h.z=1),h.normalize(),s.crossVectors(i,h),0===s.lengthSq()&&(1===Math.abs(i.z)?h.x+=1e-4:h.z+=1e-4,h.normalize(),s.crossVectors(i,h)),s.normalize(),c.crossVectors(h,s),r[0]=s.x,r[4]=c.x,r[8]=h.x,r[1]=s.y,r[5]=c.y,r[9]=h.y,r[2]=s.z,r[6]=c.z,r[10]=h.z,this}),multiply:function(e,t){return void 0!==t?(console.warn("THREE.Matrix4: .multiply() now only accepts one argument. Use .multiplyMatrices( a, b ) instead."),this.multiplyMatrices(e,t)):this.multiplyMatrices(this,e)},premultiply:function(e){return this.multiplyMatrices(e,this)},multiplyMatrices:function(e,t){var i=e.elements,r=t.elements,n=this.elements,o=i[0],a=i[4],s=i[8],c=i[12],h=i[1],l=i[5],u=i[9],p=i[13],d=i[2],f=i[6],m=i[10],v=i[14],g=i[3],y=i[7],x=i[11],b=i[15],w=r[0],_=r[4],M=r[8],E=r[12],T=r[1],S=r[5],A=r[9],R=r[13],L=r[2],C=r[6],P=r[10],N=r[14],O=r[3],I=r[7],D=r[11],U=r[15];return n[0]=o*w+a*T+s*L+c*O,n[4]=o*_+a*S+s*C+c*I,n[8]=o*M+a*A+s*P+c*D,n[12]=o*E+a*R+s*N+c*U,n[1]=h*w+l*T+u*L+p*O,n[5]=h*_+l*S+u*C+p*I,n[9]=h*M+l*A+u*P+p*D,n[13]=h*E+l*R+u*N+p*U,n[2]=d*w+f*T+m*L+v*O,n[6]=d*_+f*S+m*C+v*I,n[10]=d*M+f*A+m*P+v*D,n[14]=d*E+f*R+m*N+v*U,n[3]=g*w+y*T+x*L+b*O,n[7]=g*_+y*S+x*C+b*I,n[11]=g*M+y*A+x*P+b*D,n[15]=g*E+y*R+x*N+b*U,this},multiplyScalar:function(e){var t=this.elements;return t[0]*=e,t[4]*=e,t[8]*=e,t[12]*=e,t[1]*=e,t[5]*=e,t[9]*=e,t[13]*=e,t[2]*=e,t[6]*=e,t[10]*=e,t[14]*=e,t[3]*=e,t[7]*=e,t[11]*=e,t[15]*=e,this},applyToBufferAttribute:function(){var e=new yt;return function(t){for(var i=0,r=t.count;i=0?1:-1,y=1-v*v;if(y>Number.EPSILON){var x=Math.sqrt(y),b=Math.atan2(x,v*g);m=Math.sin(m*b)/x,a=Math.sin(a*b)/x}var w=a*g;if(s=s*m+u*w,c=c*m+p*w,h=h*m+d*w,l=l*m+f*w,m===1-a){var _=1/Math.sqrt(s*s+c*c+h*h+l*l);s*=_,c*=_,h*=_,l*=_}}e[t]=s,e[t+1]=c,e[t+2]=h,e[t+3]=l}}),Object.defineProperties(gt.prototype,{x:{get:function(){return this._x},set:function(e){this._x=e,this.onChangeCallback()}},y:{get:function(){return this._y},set:function(e){this._y=e,this.onChangeCallback()}},z:{get:function(){return this._z},set:function(e){this._z=e,this.onChangeCallback()}},w:{get:function(){return this._w},set:function(e){this._w=e,this.onChangeCallback()}}}),Object.assign(gt.prototype,{set:function(e,t,i,r){return this._x=e,this._y=t,this._z=i,this._w=r,this.onChangeCallback(),this},clone:function(){return new this.constructor(this._x,this._y,this._z,this._w)},copy:function(e){return this._x=e.x,this._y=e.y,this._z=e.z,this._w=e.w,this.onChangeCallback(),this},setFromEuler:function(e,t){if(!e||!e.isEuler)throw new Error("THREE.Quaternion: .setFromEuler() now expects an Euler rotation rather than a Vector3 and order.");var i=e._x,r=e._y,n=e._z,o=e.order,a=Math.cos,s=Math.sin,c=a(i/2),h=a(r/2),l=a(n/2),u=s(i/2),p=s(r/2),d=s(n/2);return"XYZ"===o?(this._x=u*h*l+c*p*d,this._y=c*p*l-u*h*d,this._z=c*h*d+u*p*l,this._w=c*h*l-u*p*d):"YXZ"===o?(this._x=u*h*l+c*p*d,this._y=c*p*l-u*h*d,this._z=c*h*d-u*p*l,this._w=c*h*l+u*p*d):"ZXY"===o?(this._x=u*h*l-c*p*d,this._y=c*p*l+u*h*d,this._z=c*h*d+u*p*l,this._w=c*h*l-u*p*d):"ZYX"===o?(this._x=u*h*l-c*p*d,this._y=c*p*l+u*h*d,this._z=c*h*d-u*p*l,this._w=c*h*l+u*p*d):"YZX"===o?(this._x=u*h*l+c*p*d,this._y=c*p*l+u*h*d,this._z=c*h*d-u*p*l,this._w=c*h*l-u*p*d):"XZY"===o&&(this._x=u*h*l-c*p*d,this._y=c*p*l-u*h*d,this._z=c*h*d+u*p*l,this._w=c*h*l+u*p*d),!1!==t&&this.onChangeCallback(),this},setFromAxisAngle:function(e,t){var i=t/2,r=Math.sin(i);return this._x=e.x*r,this._y=e.y*r,this._z=e.z*r,this._w=Math.cos(i),this.onChangeCallback(),this},setFromRotationMatrix:function(e){var t,i=e.elements,r=i[0],n=i[4],o=i[8],a=i[1],s=i[5],c=i[9],h=i[2],l=i[6],u=i[10],p=r+s+u;return p>0?(t=.5/Math.sqrt(p+1),this._w=.25/t,this._x=(l-c)*t,this._y=(o-h)*t,this._z=(a-n)*t):r>s&&r>u?(t=2*Math.sqrt(1+r-s-u),this._w=(l-c)/t,this._x=.25*t,this._y=(n+a)/t,this._z=(o+h)/t):s>u?(t=2*Math.sqrt(1+s-r-u),this._w=(o-h)/t,this._x=(n+a)/t,this._y=.25*t,this._z=(c+l)/t):(t=2*Math.sqrt(1+u-r-s),this._w=(a-n)/t,this._x=(o+h)/t,this._y=(c+l)/t,this._z=.25*t),this.onChangeCallback(),this},setFromUnitVectors:function(){var e,t=new yt;return function(i,r){return void 0===t&&(t=new yt),(e=i.dot(r)+1)<1e-6?(e=0,Math.abs(i.x)>Math.abs(i.z)?t.set(-i.y,i.x,0):t.set(0,-i.z,i.y)):t.crossVectors(i,r),this._x=t.x,this._y=t.y,this._z=t.z,this._w=e,this.normalize()}}(),inverse:function(){return this.conjugate().normalize()},conjugate:function(){return this._x*=-1,this._y*=-1,this._z*=-1,this.onChangeCallback(),this},dot:function(e){return this._x*e._x+this._y*e._y+this._z*e._z+this._w*e._w},lengthSq:function(){return this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w},length:function(){return Math.sqrt(this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w)},normalize:function(){var e=this.length();return 0===e?(this._x=0,this._y=0,this._z=0,this._w=1):(e=1/e,this._x=this._x*e,this._y=this._y*e,this._z=this._z*e,this._w=this._w*e),this.onChangeCallback(),this},multiply:function(e,t){return void 0!==t?(console.warn("THREE.Quaternion: .multiply() now only accepts one argument. Use .multiplyQuaternions( a, b ) instead."),this.multiplyQuaternions(e,t)):this.multiplyQuaternions(this,e)},premultiply:function(e){return this.multiplyQuaternions(e,this)},multiplyQuaternions:function(e,t){var i=e._x,r=e._y,n=e._z,o=e._w,a=t._x,s=t._y,c=t._z,h=t._w;return this._x=i*h+o*a+r*c-n*s,this._y=r*h+o*s+n*a-i*c,this._z=n*h+o*c+i*s-r*a,this._w=o*h-i*a-r*s-n*c,this.onChangeCallback(),this},slerp:function(e,t){if(0===t)return this;if(1===t)return this.copy(e);var i=this._x,r=this._y,n=this._z,o=this._w,a=o*e._w+i*e._x+r*e._y+n*e._z;if(a<0?(this._w=-e._w,this._x=-e._x,this._y=-e._y,this._z=-e._z,a=-a):this.copy(e),a>=1)return this._w=o,this._x=i,this._y=r,this._z=n,this;var s=Math.sqrt(1-a*a);if(Math.abs(s)<.001)return this._w=.5*(o+this._w),this._x=.5*(i+this._x),this._y=.5*(r+this._y),this._z=.5*(n+this._z),this;var c=Math.atan2(s,a),h=Math.sin((1-t)*c)/s,l=Math.sin(t*c)/s;return this._w=o*h+this._w*l,this._x=i*h+this._x*l,this._y=r*h+this._y*l,this._z=n*h+this._z*l,this.onChangeCallback(),this},equals:function(e){return e._x===this._x&&e._y===this._y&&e._z===this._z&&e._w===this._w},fromArray:function(e,t){return void 0===t&&(t=0),this._x=e[t],this._y=e[t+1],this._z=e[t+2],this._w=e[t+3],this.onChangeCallback(),this},toArray:function(e,t){return void 0===e&&(e=[]),void 0===t&&(t=0),e[t]=this._x,e[t+1]=this._y,e[t+2]=this._z,e[t+3]=this._w,e},onChange:function(e){return this.onChangeCallback=e,this},onChangeCallback:function(){}}),Object.assign(yt.prototype,{isVector3:!0,set:function(e,t,i){return this.x=e,this.y=t,this.z=i,this},setScalar:function(e){return this.x=e,this.y=e,this.z=e,this},setX:function(e){return this.x=e,this},setY:function(e){return this.y=e,this},setZ:function(e){return this.z=e,this},setComponent:function(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;case 2:this.z=t;break;default:throw new Error("index is out of range: "+e)}return this},getComponent:function(e){switch(e){case 0:return this.x;case 1:return this.y;case 2:return this.z;default:throw new Error("index is out of range: "+e)}},clone:function(){return new this.constructor(this.x,this.y,this.z)},copy:function(e){return this.x=e.x,this.y=e.y,this.z=e.z,this},add:function(e,t){return void 0!==t?(console.warn("THREE.Vector3: .add() now only accepts one argument. Use .addVectors( a, b ) instead."),this.addVectors(e,t)):(this.x+=e.x,this.y+=e.y,this.z+=e.z,this)},addScalar:function(e){return this.x+=e,this.y+=e,this.z+=e,this},addVectors:function(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this.z=e.z+t.z,this},addScaledVector:function(e,t){return this.x+=e.x*t,this.y+=e.y*t,this.z+=e.z*t,this},sub:function(e,t){return void 0!==t?(console.warn("THREE.Vector3: .sub() now only accepts one argument. Use .subVectors( a, b ) instead."),this.subVectors(e,t)):(this.x-=e.x,this.y-=e.y,this.z-=e.z,this)},subScalar:function(e){return this.x-=e,this.y-=e,this.z-=e,this},subVectors:function(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this.z=e.z-t.z,this},multiply:function(e,t){return void 0!==t?(console.warn("THREE.Vector3: .multiply() now only accepts one argument. Use .multiplyVectors( a, b ) instead."),this.multiplyVectors(e,t)):(this.x*=e.x,this.y*=e.y,this.z*=e.z,this)},multiplyScalar:function(e){return this.x*=e,this.y*=e,this.z*=e,this},multiplyVectors:function(e,t){return this.x=e.x*t.x,this.y=e.y*t.y,this.z=e.z*t.z,this},applyEuler:(u=new gt,function(e){return e&&e.isEuler||console.error("THREE.Vector3: .applyEuler() now expects an Euler rotation rather than a Vector3 and order."),this.applyQuaternion(u.setFromEuler(e))}),applyAxisAngle:function(){var e=new gt;return function(t,i){return this.applyQuaternion(e.setFromAxisAngle(t,i))}}(),applyMatrix3:function(e){var t=this.x,i=this.y,r=this.z,n=e.elements;return this.x=n[0]*t+n[3]*i+n[6]*r,this.y=n[1]*t+n[4]*i+n[7]*r,this.z=n[2]*t+n[5]*i+n[8]*r,this},applyMatrix4:function(e){var t=this.x,i=this.y,r=this.z,n=e.elements,o=1/(n[3]*t+n[7]*i+n[11]*r+n[15]);return this.x=(n[0]*t+n[4]*i+n[8]*r+n[12])*o,this.y=(n[1]*t+n[5]*i+n[9]*r+n[13])*o,this.z=(n[2]*t+n[6]*i+n[10]*r+n[14])*o,this},applyQuaternion:function(e){var t=this.x,i=this.y,r=this.z,n=e.x,o=e.y,a=e.z,s=e.w,c=s*t+o*r-a*i,h=s*i+a*t-n*r,l=s*r+n*i-o*t,u=-n*t-o*i-a*r;return this.x=c*s+u*-n+h*-a-l*-o,this.y=h*s+u*-o+l*-n-c*-a,this.z=l*s+u*-a+c*-o-h*-n,this},project:function(){var e=new vt;return function(t){return e.multiplyMatrices(t.projectionMatrix,e.getInverse(t.matrixWorld)),this.applyMatrix4(e)}}(),unproject:function(){var e=new vt;return function(t){return e.multiplyMatrices(t.matrixWorld,e.getInverse(t.projectionMatrix)),this.applyMatrix4(e)}}(),transformDirection:function(e){var t=this.x,i=this.y,r=this.z,n=e.elements;return this.x=n[0]*t+n[4]*i+n[8]*r,this.y=n[1]*t+n[5]*i+n[9]*r,this.z=n[2]*t+n[6]*i+n[10]*r,this.normalize()},divide:function(e){return this.x/=e.x,this.y/=e.y,this.z/=e.z,this},divideScalar:function(e){return this.multiplyScalar(1/e)},min:function(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this.z=Math.min(this.z,e.z),this},max:function(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this.z=Math.max(this.z,e.z),this},clamp:function(e,t){return this.x=Math.max(e.x,Math.min(t.x,this.x)),this.y=Math.max(e.y,Math.min(t.y,this.y)),this.z=Math.max(e.z,Math.min(t.z,this.z)),this},clampScalar:function(){var e=new yt,t=new yt;return function(i,r){return e.set(i,i,i),t.set(r,r,r),this.clamp(e,t)}}(),clampLength:function(e,t){var i=this.length();return this.divideScalar(i||1).multiplyScalar(Math.max(e,Math.min(t,i)))},floor:function(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this},ceil:function(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this},round:function(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this},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},negate:function(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this},dot:function(e){return this.x*e.x+this.y*e.y+this.z*e.z},lengthSq:function(){return this.x*this.x+this.y*this.y+this.z*this.z},length:function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z)},manhattanLength:function(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)},normalize:function(){return this.divideScalar(this.length()||1)},setLength:function(e){return this.normalize().multiplyScalar(e)},lerp:function(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this.z+=(e.z-this.z)*t,this},lerpVectors:function(e,t,i){return this.subVectors(t,e).multiplyScalar(i).add(e)},cross:function(e,t){return void 0!==t?(console.warn("THREE.Vector3: .cross() now only accepts one argument. Use .crossVectors( a, b ) instead."),this.crossVectors(e,t)):this.crossVectors(this,e)},crossVectors:function(e,t){var i=e.x,r=e.y,n=e.z,o=t.x,a=t.y,s=t.z;return this.x=r*s-n*a,this.y=n*o-i*s,this.z=i*a-r*o,this},projectOnVector:function(e){var t=e.dot(this)/e.lengthSq();return this.copy(e).multiplyScalar(t)},projectOnPlane:function(){var e=new yt;return function(t){return e.copy(this).projectOnVector(t),this.sub(e)}}(),reflect:function(){var e=new yt;return function(t){return this.sub(e.copy(t).multiplyScalar(2*this.dot(t)))}}(),angleTo:function(e){var t=this.dot(e)/Math.sqrt(this.lengthSq()*e.lengthSq());return Math.acos(ft.clamp(t,-1,1))},distanceTo:function(e){return Math.sqrt(this.distanceToSquared(e))},distanceToSquared:function(e){var t=this.x-e.x,i=this.y-e.y,r=this.z-e.z;return t*t+i*i+r*r},manhattanDistanceTo:function(e){return Math.abs(this.x-e.x)+Math.abs(this.y-e.y)+Math.abs(this.z-e.z)},setFromSpherical:function(e){var t=Math.sin(e.phi)*e.radius;return this.x=t*Math.sin(e.theta),this.y=Math.cos(e.phi)*e.radius,this.z=t*Math.cos(e.theta),this},setFromCylindrical:function(e){return this.x=e.radius*Math.sin(e.theta),this.y=e.y,this.z=e.radius*Math.cos(e.theta),this},setFromMatrixPosition:function(e){var t=e.elements;return this.x=t[12],this.y=t[13],this.z=t[14],this},setFromMatrixScale:function(e){var t=this.setFromMatrixColumn(e,0).length(),i=this.setFromMatrixColumn(e,1).length(),r=this.setFromMatrixColumn(e,2).length();return this.x=t,this.y=i,this.z=r,this},setFromMatrixColumn:function(e,t){return this.fromArray(e.elements,4*t)},equals:function(e){return e.x===this.x&&e.y===this.y&&e.z===this.z},fromArray:function(e,t){return void 0===t&&(t=0),this.x=e[t],this.y=e[t+1],this.z=e[t+2],this},toArray:function(e,t){return void 0===e&&(e=[]),void 0===t&&(t=0),e[t]=this.x,e[t+1]=this.y,e[t+2]=this.z,e},fromBufferAttribute:function(e,t,i){return void 0!==i&&console.warn("THREE.Vector3: offset has been removed from .fromBufferAttribute()."),this.x=e.getX(t),this.y=e.getY(t),this.z=e.getZ(t),this}}),Object.assign(xt.prototype,{isMatrix3:!0,set:function(e,t,i,r,n,o,a,s,c){var h=this.elements;return h[0]=e,h[1]=r,h[2]=a,h[3]=t,h[4]=n,h[5]=s,h[6]=i,h[7]=o,h[8]=c,this},identity:function(){return this.set(1,0,0,0,1,0,0,0,1),this},clone:function(){return(new this.constructor).fromArray(this.elements)},copy:function(e){var t=this.elements,i=e.elements;return t[0]=i[0],t[1]=i[1],t[2]=i[2],t[3]=i[3],t[4]=i[4],t[5]=i[5],t[6]=i[6],t[7]=i[7],t[8]=i[8],this},setFromMatrix4:function(e){var t=e.elements;return this.set(t[0],t[4],t[8],t[1],t[5],t[9],t[2],t[6],t[10]),this},applyToBufferAttribute:function(){var e=new yt;return function(t){for(var i=0,r=t.count;i2048||t.height>2048?t.toDataURL("image/jpeg",.6):t.toDataURL("image/png")}(r)}),i.image=r.uuid}return t||(e.textures[this.uuid]=i),i},dispose:function(){this.dispatchEvent({type:"dispose"})},transformUv:function(e){if(300===this.mapping){if(e.applyMatrix3(this.matrix),e.x<0||e.x>1)switch(this.wrapS){case ve:e.x=e.x-Math.floor(e.x);break;case ge:e.x=e.x<0?0:1;break;case ye:1===Math.abs(Math.floor(e.x)%2)?e.x=Math.ceil(e.x)-e.x:e.x=e.x-Math.floor(e.x)}if(e.y<0||e.y>1)switch(this.wrapT){case ve:e.y=e.y-Math.floor(e.y);break;case ge:e.y=e.y<0?0:1;break;case ye:1===Math.abs(Math.floor(e.y)%2)?e.y=Math.ceil(e.y)-e.y:e.y=e.y-Math.floor(e.y)}this.flipY&&(e.y=1-e.y)}}}),Object.defineProperty(wt.prototype,"needsUpdate",{set:function(e){!0===e&&this.version++}}),Object.assign(_t.prototype,{isVector4:!0,set:function(e,t,i,r){return this.x=e,this.y=t,this.z=i,this.w=r,this},setScalar:function(e){return this.x=e,this.y=e,this.z=e,this.w=e,this},setX:function(e){return this.x=e,this},setY:function(e){return this.y=e,this},setZ:function(e){return this.z=e,this},setW:function(e){return this.w=e,this},setComponent:function(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;case 2:this.z=t;break;case 3:this.w=t;break;default:throw new Error("index is out of range: "+e)}return this},getComponent:function(e){switch(e){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: "+e)}},clone:function(){return new this.constructor(this.x,this.y,this.z,this.w)},copy:function(e){return this.x=e.x,this.y=e.y,this.z=e.z,this.w=void 0!==e.w?e.w:1,this},add:function(e,t){return void 0!==t?(console.warn("THREE.Vector4: .add() now only accepts one argument. Use .addVectors( a, b ) instead."),this.addVectors(e,t)):(this.x+=e.x,this.y+=e.y,this.z+=e.z,this.w+=e.w,this)},addScalar:function(e){return this.x+=e,this.y+=e,this.z+=e,this.w+=e,this},addVectors:function(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this.z=e.z+t.z,this.w=e.w+t.w,this},addScaledVector:function(e,t){return this.x+=e.x*t,this.y+=e.y*t,this.z+=e.z*t,this.w+=e.w*t,this},sub:function(e,t){return void 0!==t?(console.warn("THREE.Vector4: .sub() now only accepts one argument. Use .subVectors( a, b ) instead."),this.subVectors(e,t)):(this.x-=e.x,this.y-=e.y,this.z-=e.z,this.w-=e.w,this)},subScalar:function(e){return this.x-=e,this.y-=e,this.z-=e,this.w-=e,this},subVectors:function(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this.z=e.z-t.z,this.w=e.w-t.w,this},multiplyScalar:function(e){return this.x*=e,this.y*=e,this.z*=e,this.w*=e,this},applyMatrix4:function(e){var t=this.x,i=this.y,r=this.z,n=this.w,o=e.elements;return this.x=o[0]*t+o[4]*i+o[8]*r+o[12]*n,this.y=o[1]*t+o[5]*i+o[9]*r+o[13]*n,this.z=o[2]*t+o[6]*i+o[10]*r+o[14]*n,this.w=o[3]*t+o[7]*i+o[11]*r+o[15]*n,this},divideScalar:function(e){return this.multiplyScalar(1/e)},setAxisAngleFromQuaternion:function(e){this.w=2*Math.acos(e.w);var t=Math.sqrt(1-e.w*e.w);return t<1e-4?(this.x=1,this.y=0,this.z=0):(this.x=e.x/t,this.y=e.y/t,this.z=e.z/t),this},setAxisAngleFromRotationMatrix:function(e){var t,i,r,n,o=e.elements,a=o[0],s=o[4],c=o[8],h=o[1],l=o[5],u=o[9],p=o[2],d=o[6],f=o[10];if(Math.abs(s-h)<.01&&Math.abs(c-p)<.01&&Math.abs(u-d)<.01){if(Math.abs(s+h)<.1&&Math.abs(c+p)<.1&&Math.abs(u+d)<.1&&Math.abs(a+l+f-3)<.1)return this.set(1,0,0,0),this;t=Math.PI;var m=(a+1)/2,v=(l+1)/2,g=(f+1)/2,y=(s+h)/4,x=(c+p)/4,b=(u+d)/4;return m>v&&m>g?m<.01?(i=0,r=.707106781,n=.707106781):(r=y/(i=Math.sqrt(m)),n=x/i):v>g?v<.01?(i=.707106781,r=0,n=.707106781):(i=y/(r=Math.sqrt(v)),n=b/r):g<.01?(i=.707106781,r=.707106781,n=0):(i=x/(n=Math.sqrt(g)),r=b/n),this.set(i,r,n,t),this}var w=Math.sqrt((d-u)*(d-u)+(c-p)*(c-p)+(h-s)*(h-s));return Math.abs(w)<.001&&(w=1),this.x=(d-u)/w,this.y=(c-p)/w,this.z=(h-s)/w,this.w=Math.acos((a+l+f-1)/2),this},min:function(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this.z=Math.min(this.z,e.z),this.w=Math.min(this.w,e.w),this},max:function(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this.z=Math.max(this.z,e.z),this.w=Math.max(this.w,e.w),this},clamp:function(e,t){return this.x=Math.max(e.x,Math.min(t.x,this.x)),this.y=Math.max(e.y,Math.min(t.y,this.y)),this.z=Math.max(e.z,Math.min(t.z,this.z)),this.w=Math.max(e.w,Math.min(t.w,this.w)),this},clampScalar:function(){var e,t;return function(i,r){return void 0===e&&(e=new _t,t=new _t),e.set(i,i,i,i),t.set(r,r,r,r),this.clamp(e,t)}}(),clampLength:function(e,t){var i=this.length();return this.divideScalar(i||1).multiplyScalar(Math.max(e,Math.min(t,i)))},floor:function(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this.w=Math.floor(this.w),this},ceil:function(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this.w=Math.ceil(this.w),this},round:function(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this.w=Math.round(this.w),this},roundToZero: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.w=this.w<0?Math.ceil(this.w):Math.floor(this.w),this},negate:function(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this.w=-this.w,this},dot:function(e){return this.x*e.x+this.y*e.y+this.z*e.z+this.w*e.w},lengthSq:function(){return this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w},length:function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)},manhattanLength:function(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)+Math.abs(this.w)},normalize:function(){return this.divideScalar(this.length()||1)},setLength:function(e){return this.normalize().multiplyScalar(e)},lerp:function(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this.z+=(e.z-this.z)*t,this.w+=(e.w-this.w)*t,this},lerpVectors:function(e,t,i){return this.subVectors(t,e).multiplyScalar(i).add(e)},equals:function(e){return e.x===this.x&&e.y===this.y&&e.z===this.z&&e.w===this.w},fromArray:function(e,t){return void 0===t&&(t=0),this.x=e[t],this.y=e[t+1],this.z=e[t+2],this.w=e[t+3],this},toArray:function(e,t){return void 0===e&&(e=[]),void 0===t&&(t=0),e[t]=this.x,e[t+1]=this.y,e[t+2]=this.z,e[t+3]=this.w,e},fromBufferAttribute:function(e,t,i){return void 0!==i&&console.warn("THREE.Vector4: offset has been removed from .fromBufferAttribute()."),this.x=e.getX(t),this.y=e.getY(t),this.z=e.getZ(t),this.w=e.getW(t),this}}),Mt.prototype=Object.assign(Object.create(i.prototype),{constructor:Mt,isWebGLRenderTarget:!0,setSize:function(e,t){this.width===e&&this.height===t||(this.width=e,this.height=t,this.dispose()),this.viewport.set(0,0,e,t),this.scissor.set(0,0,e,t)},clone:function(){return(new this.constructor).copy(this)},copy:function(e){return this.width=e.width,this.height=e.height,this.viewport.copy(e.viewport),this.texture=e.texture.clone(),this.depthBuffer=e.depthBuffer,this.stencilBuffer=e.stencilBuffer,this.depthTexture=e.depthTexture,this},dispose:function(){this.dispatchEvent({type:"dispose"})}}),Et.prototype=Object.create(Mt.prototype),Et.prototype.constructor=Et,Et.prototype.isWebGLRenderTargetCube=!0,Tt.prototype=Object.create(wt.prototype),Tt.prototype.constructor=Tt,Tt.prototype.isDataTexture=!0,St.prototype=Object.create(wt.prototype),St.prototype.constructor=St,St.prototype.isCubeTexture=!0,Object.defineProperty(St.prototype,"images",{get:function(){return this.image},set:function(e){this.image=e}});var At=new wt,Rt=new St;function Lt(){this.seq=[],this.map={}}var Ct=[],Pt=[],Nt=new Float32Array(16),Ot=new Float32Array(9);function It(e,t,i){var r=e[0];if(r<=0||r>0)return e;var n=t*i,o=Ct[n];if(void 0===o&&(o=new Float32Array(n),Ct[n]=o),0!==t){r.toArray(o,0);for(var a=1,s=0;a!==t;++a)s+=i,e[a].toArray(o,s)}return o}function Dt(e,t){var i=Pt[t];void 0===i&&(i=new Int32Array(t),Pt[t]=i);for(var r=0;r!==t;++r)i[r]=e.allocTextureUnit();return i}function Ut(e,t){e.uniform1f(this.addr,t)}function Ft(e,t){e.uniform1i(this.addr,t)}function Bt(e,t){void 0===t.x?e.uniform2fv(this.addr,t):e.uniform2f(this.addr,t.x,t.y)}function zt(e,t){void 0!==t.x?e.uniform3f(this.addr,t.x,t.y,t.z):void 0!==t.r?e.uniform3f(this.addr,t.r,t.g,t.b):e.uniform3fv(this.addr,t)}function kt(e,t){void 0===t.x?e.uniform4fv(this.addr,t):e.uniform4f(this.addr,t.x,t.y,t.z,t.w)}function Gt(e,t){e.uniformMatrix2fv(this.addr,!1,t.elements||t)}function Vt(e,t){void 0===t.elements?e.uniformMatrix3fv(this.addr,!1,t):(Ot.set(t.elements),e.uniformMatrix3fv(this.addr,!1,Ot))}function Ht(e,t){void 0===t.elements?e.uniformMatrix4fv(this.addr,!1,t):(Nt.set(t.elements),e.uniformMatrix4fv(this.addr,!1,Nt))}function jt(e,t,i){var r=i.allocTextureUnit();e.uniform1i(this.addr,r),i.setTexture2D(t||At,r)}function Wt(e,t,i){var r=i.allocTextureUnit();e.uniform1i(this.addr,r),i.setTextureCube(t||Rt,r)}function Xt(e,t){e.uniform2iv(this.addr,t)}function qt(e,t){e.uniform3iv(this.addr,t)}function Yt(e,t){e.uniform4iv(this.addr,t)}function Zt(e,t){e.uniform1fv(this.addr,t)}function Jt(e,t){e.uniform1iv(this.addr,t)}function Qt(e,t){e.uniform2fv(this.addr,It(t,this.size,2))}function Kt(e,t){e.uniform3fv(this.addr,It(t,this.size,3))}function $t(e,t){e.uniform4fv(this.addr,It(t,this.size,4))}function ei(e,t){e.uniformMatrix2fv(this.addr,!1,It(t,this.size,4))}function ti(e,t){e.uniformMatrix3fv(this.addr,!1,It(t,this.size,9))}function ii(e,t){e.uniformMatrix4fv(this.addr,!1,It(t,this.size,16))}function ri(e,t,i){var r=t.length,n=Dt(i,r);e.uniform1iv(this.addr,n);for(var o=0;o!==r;++o)i.setTexture2D(t[o]||At,n[o])}function ni(e,t,i){var r=t.length,n=Dt(i,r);e.uniform1iv(this.addr,n);for(var o=0;o!==r;++o)i.setTextureCube(t[o]||Rt,n[o])}function oi(e,t,i){this.id=e,this.addr=i,this.setValue=function(e){switch(e){case 5126:return Ut;case 35664:return Bt;case 35665:return zt;case 35666:return kt;case 35674:return Gt;case 35675:return Vt;case 35676:return Ht;case 35678:case 36198:return jt;case 35680:return Wt;case 5124:case 35670:return Ft;case 35667:case 35671:return Xt;case 35668:case 35672:return qt;case 35669:case 35673:return Yt}}(t.type)}function ai(e,t,i){this.id=e,this.addr=i,this.size=t.size,this.setValue=function(e){switch(e){case 5126:return Zt;case 35664:return Qt;case 35665:return Kt;case 35666:return $t;case 35674:return ei;case 35675:return ti;case 35676:return ii;case 35678:return ri;case 35680:return ni;case 5124:case 35670:return Jt;case 35667:case 35671:return Xt;case 35668:case 35672:return qt;case 35669:case 35673:return Yt}}(t.type)}function si(e){this.id=e,Lt.call(this)}si.prototype.setValue=function(e,t){for(var i=this.seq,r=0,n=i.length;r!==n;++r){var o=i[r];o.setValue(e,t[o.id])}};var ci=/([\w\d_]+)(\])?(\[|\.)?/g;function hi(e,t){e.seq.push(t),e.map[t.id]=t}function li(e,t,i){var r=e.name,n=r.length;for(ci.lastIndex=0;;){var o=ci.exec(r),a=ci.lastIndex,s=o[1],c="]"===o[2],h=o[3];if(c&&(s|=0),void 0===h||"["===h&&a+2===n){hi(i,void 0===h?new oi(s,e,t):new ai(s,e,t));break}var l=i.map[s];void 0===l&&hi(i,l=new si(s)),i=l}}function ui(e,t,i){Lt.call(this),this.renderer=i;for(var r=e.getProgramParameter(t,e.ACTIVE_UNIFORMS),n=0;n>16&255)/255,this.g=(e>>8&255)/255,this.b=(255&e)/255,this},setRGB:function(e,t,i){return this.r=e,this.g=t,this.b=i,this},setHSL:function(){function e(e,t,i){return i<0&&(i+=1),i>1&&(i-=1),i<1/6?e+6*(t-e)*i:i<.5?t:i<2/3?e+6*(t-e)*(2/3-i):e}return function(t,i,r){if(t=ft.euclideanModulo(t,1),i=ft.clamp(i,0,1),r=ft.clamp(r,0,1),0===i)this.r=this.g=this.b=r;else{var n=r<=.5?r*(1+i):r+i-r*i,o=2*r-n;this.r=e(o,n,t+1/3),this.g=e(o,n,t),this.b=e(o,n,t-1/3)}return this}}(),setStyle:function(e){function t(t){void 0!==t&&parseFloat(t)<1&&console.warn("THREE.Color: Alpha component of "+e+" will be ignored.")}var i;if(i=/^((?:rgb|hsl)a?)\(\s*([^\)]*)\)/.exec(e)){var r,n=i[1],o=i[2];switch(n){case"rgb":case"rgba":if(r=/^(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(,\s*([0-9]*\.?[0-9]+)\s*)?$/.exec(o))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,t(r[5]),this;if(r=/^(\d+)\%\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(,\s*([0-9]*\.?[0-9]+)\s*)?$/.exec(o))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,t(r[5]),this;break;case"hsl":case"hsla":if(r=/^([0-9]*\.?[0-9]+)\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(,\s*([0-9]*\.?[0-9]+)\s*)?$/.exec(o)){var a=parseFloat(r[1])/360,s=parseInt(r[2],10)/100,c=parseInt(r[3],10)/100;return t(r[5]),this.setHSL(a,s,c)}}}else if(i=/^\#([A-Fa-f0-9]+)$/.exec(e)){var h,l=(h=i[1]).length;if(3===l)return this.r=parseInt(h.charAt(0)+h.charAt(0),16)/255,this.g=parseInt(h.charAt(1)+h.charAt(1),16)/255,this.b=parseInt(h.charAt(2)+h.charAt(2),16)/255,this;if(6===l)return this.r=parseInt(h.charAt(0)+h.charAt(1),16)/255,this.g=parseInt(h.charAt(2)+h.charAt(3),16)/255,this.b=parseInt(h.charAt(4)+h.charAt(5),16)/255,this}e&&e.length>0&&(void 0!==(h=pi[e])?this.setHex(h):console.warn("THREE.Color: Unknown color "+e));return this},clone:function(){return new this.constructor(this.r,this.g,this.b)},copy:function(e){return this.r=e.r,this.g=e.g,this.b=e.b,this},copyGammaToLinear:function(e,t){return void 0===t&&(t=2),this.r=Math.pow(e.r,t),this.g=Math.pow(e.g,t),this.b=Math.pow(e.b,t),this},copyLinearToGamma:function(e,t){void 0===t&&(t=2);var i=t>0?1/t:1;return this.r=Math.pow(e.r,i),this.g=Math.pow(e.g,i),this.b=Math.pow(e.b,i),this},convertGammaToLinear:function(){var e=this.r,t=this.g,i=this.b;return this.r=e*e,this.g=t*t,this.b=i*i,this},convertLinearToGamma:function(){return this.r=Math.sqrt(this.r),this.g=Math.sqrt(this.g),this.b=Math.sqrt(this.b),this},getHex:function(){return 255*this.r<<16^255*this.g<<8^255*this.b<<0},getHexString:function(){return("000000"+this.getHex().toString(16)).slice(-6)},getHSL:function(e){var t,i,r=e||{h:0,s:0,l:0},n=this.r,o=this.g,a=this.b,s=Math.max(n,o,a),c=Math.min(n,o,a),h=(c+s)/2;if(c===s)t=0,i=0;else{var l=s-c;switch(i=h<=.5?l/(s+c):l/(2-s-c),s){case n:t=(o-a)/l+(o 0.0 ) {\n#if defined ( PHYSICALLY_CORRECT_LIGHTS )\n\t\tfloat distanceFalloff = 1.0 / max( pow( lightDistance, decayExponent ), 0.01 );\n\t\tfloat maxDistanceCutoffFactor = pow2( saturate( 1.0 - pow4( lightDistance / cutoffDistance ) ) );\n\t\treturn distanceFalloff * maxDistanceCutoffFactor;\n#else\n\t\treturn pow( saturate( -lightDistance / cutoffDistance + 1.0 ), decayExponent );\n#endif\n\t}\n\treturn 1.0;\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}\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 GeometricContext geometry, const in vec3 specularColor, const in float roughness ) {\n\tfloat alpha = pow2( roughness );\n\tvec3 halfDir = normalize( incidentLight.direction + geometry.viewDir );\n\tfloat dotNL = saturate( dot( geometry.normal, incidentLight.direction ) );\n\tfloat dotNV = saturate( dot( geometry.normal, 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_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 theta = acos( dot( N, V ) );\n\tvec2 uv = vec2(\n\t\tsqrt( saturate( roughness ) ),\n\t\tsaturate( theta / ( 0.5 * PI ) ) );\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.86267 + (0.49788 + 0.01436 * y ) * y;\n\tfloat b = 3.45068 + (4.18814 + y) * y;\n\tfloat v = a / b;\n\tfloat theta_sintheta = (x > 0.0) ? v : 0.5 * inversesqrt( 1.0 - x * x ) - 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\tvec3 result = vec3( LTC_ClippedSphereFormFactor( vectorFormFactor ) );\n\treturn result;\n}\nvec3 BRDF_Specular_GGX_Environment( const in GeometricContext geometry, const in vec3 specularColor, const in float roughness ) {\n\tfloat dotNV = saturate( dot( geometry.normal, geometry.viewDir ) );\n\tconst vec4 c0 = vec4( - 1, - 0.0275, - 0.572, 0.022 );\n\tconst vec4 c1 = vec4( 1, 0.0425, 1.04, - 0.04 );\n\tvec4 r = roughness * c0 + c1;\n\tfloat a004 = min( r.x * r.x, exp2( - 9.28 * dotNV ) ) * r.x + r.y;\n\tvec2 AB = vec2( -1.04, 1.04 ) * a004 + r.zw;\n\treturn specularColor * AB.x + AB.y;\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",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 ) {\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 );\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\n",clipping_planes_fragment:"#if NUM_CLIPPING_PLANES > 0\n\tfor ( int i = 0; i < UNION_CLIPPING_PLANES; ++ i ) {\n\t\tvec4 plane = clippingPlanes[ i ];\n\t\tif ( dot( vViewPosition, plane.xyz ) > plane.w ) discard;\n\t}\n\t\t\n\t#if UNION_CLIPPING_PLANES < NUM_CLIPPING_PLANES\n\t\tbool clipped = true;\n\t\tfor ( int i = UNION_CLIPPING_PLANES; i < NUM_CLIPPING_PLANES; ++ i ) {\n\t\t\tvec4 plane = clippingPlanes[ i ];\n\t\t\tclipped = ( dot( vViewPosition, plane.xyz ) > plane.w ) && clipped;\n\t\t}\n\t\tif ( clipped ) discard;\n\t\n\t#endif\n#endif\n",clipping_planes_pars_fragment:"#if NUM_CLIPPING_PLANES > 0\n\t#if ! defined( PHYSICAL ) && ! defined( PHONG )\n\t\tvarying vec3 vViewPosition;\n\t#endif\n\tuniform vec4 clippingPlanes[ NUM_CLIPPING_PLANES ];\n#endif\n",clipping_planes_pars_vertex:"#if NUM_CLIPPING_PLANES > 0 && ! defined( PHYSICAL ) && ! defined( PHONG )\n\tvarying vec3 vViewPosition;\n#endif\n",clipping_planes_vertex:"#if NUM_CLIPPING_PLANES > 0 && ! defined( PHYSICAL ) && ! defined( PHONG )\n\tvViewPosition = - mvPosition.xyz;\n#endif\n",color_fragment:"#ifdef USE_COLOR\n\tdiffuseColor.rgb *= vColor;\n#endif",color_pars_fragment:"#ifdef USE_COLOR\n\tvarying vec3 vColor;\n#endif\n",color_pars_vertex:"#ifdef USE_COLOR\n\tvarying vec3 vColor;\n#endif",color_vertex:"#ifdef USE_COLOR\n\tvColor.xyz = color.xyz;\n#endif",common:"#define PI 3.14159265359\n#define PI2 6.28318530718\n#define PI_HALF 1.5707963267949\n#define RECIPROCAL_PI 0.31830988618\n#define RECIPROCAL_PI2 0.15915494\n#define LOG2 1.442695\n#define EPSILON 1e-6\n#define saturate(a) clamp( a, 0.0, 1.0 )\n#define whiteCompliment(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}\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};\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}\n",cube_uv_reflection_fragment:"#ifdef ENVMAP_TYPE_CUBE_UV\n#define cubeUV_textureSize (1024.0)\nint getFaceFromDirection(vec3 direction) {\n\tvec3 absDirection = abs(direction);\n\tint face = -1;\n\tif( absDirection.x > absDirection.z ) {\n\t\tif(absDirection.x > absDirection.y )\n\t\t\tface = direction.x > 0.0 ? 0 : 3;\n\t\telse\n\t\t\tface = direction.y > 0.0 ? 1 : 4;\n\t}\n\telse {\n\t\tif(absDirection.z > absDirection.y )\n\t\t\tface = direction.z > 0.0 ? 2 : 5;\n\t\telse\n\t\t\tface = direction.y > 0.0 ? 1 : 4;\n\t}\n\treturn face;\n}\n#define cubeUV_maxLods1 (log2(cubeUV_textureSize*0.25) - 1.0)\n#define cubeUV_rangeClamp (exp2((6.0 - 1.0) * 2.0))\nvec2 MipLevelInfo( vec3 vec, float roughnessLevel, float roughness ) {\n\tfloat scale = exp2(cubeUV_maxLods1 - roughnessLevel);\n\tfloat dxRoughness = dFdx(roughness);\n\tfloat dyRoughness = dFdy(roughness);\n\tvec3 dx = dFdx( vec * scale * dxRoughness );\n\tvec3 dy = dFdy( vec * scale * dyRoughness );\n\tfloat d = max( dot( dx, dx ), dot( dy, dy ) );\n\td = clamp(d, 1.0, cubeUV_rangeClamp);\n\tfloat mipLevel = 0.5 * log2(d);\n\treturn vec2(floor(mipLevel), fract(mipLevel));\n}\n#define cubeUV_maxLods2 (log2(cubeUV_textureSize*0.25) - 2.0)\n#define cubeUV_rcpTextureSize (1.0 / cubeUV_textureSize)\nvec2 getCubeUV(vec3 direction, float roughnessLevel, float mipLevel) {\n\tmipLevel = roughnessLevel > cubeUV_maxLods2 - 3.0 ? 0.0 : mipLevel;\n\tfloat a = 16.0 * cubeUV_rcpTextureSize;\n\tvec2 exp2_packed = exp2( vec2( roughnessLevel, mipLevel ) );\n\tvec2 rcp_exp2_packed = vec2( 1.0 ) / exp2_packed;\n\tfloat powScale = exp2_packed.x * exp2_packed.y;\n\tfloat scale = rcp_exp2_packed.x * rcp_exp2_packed.y * 0.25;\n\tfloat mipOffset = 0.75*(1.0 - rcp_exp2_packed.y) * rcp_exp2_packed.x;\n\tbool bRes = mipLevel == 0.0;\n\tscale = bRes && (scale < a) ? a : scale;\n\tvec3 r;\n\tvec2 offset;\n\tint face = getFaceFromDirection(direction);\n\tfloat rcpPowScale = 1.0 / powScale;\n\tif( face == 0) {\n\t\tr = vec3(direction.x, -direction.z, direction.y);\n\t\toffset = vec2(0.0+mipOffset,0.75 * rcpPowScale);\n\t\toffset.y = bRes && (offset.y < 2.0*a) ? a : offset.y;\n\t}\n\telse if( face == 1) {\n\t\tr = vec3(direction.y, direction.x, direction.z);\n\t\toffset = vec2(scale+mipOffset, 0.75 * rcpPowScale);\n\t\toffset.y = bRes && (offset.y < 2.0*a) ? a : offset.y;\n\t}\n\telse if( face == 2) {\n\t\tr = vec3(direction.z, direction.x, direction.y);\n\t\toffset = vec2(2.0*scale+mipOffset, 0.75 * rcpPowScale);\n\t\toffset.y = bRes && (offset.y < 2.0*a) ? a : offset.y;\n\t}\n\telse if( face == 3) {\n\t\tr = vec3(direction.x, direction.z, direction.y);\n\t\toffset = vec2(0.0+mipOffset,0.5 * rcpPowScale);\n\t\toffset.y = bRes && (offset.y < 2.0*a) ? 0.0 : offset.y;\n\t}\n\telse if( face == 4) {\n\t\tr = vec3(direction.y, direction.x, -direction.z);\n\t\toffset = vec2(scale+mipOffset, 0.5 * rcpPowScale);\n\t\toffset.y = bRes && (offset.y < 2.0*a) ? 0.0 : offset.y;\n\t}\n\telse {\n\t\tr = vec3(direction.z, -direction.x, direction.y);\n\t\toffset = vec2(2.0*scale+mipOffset, 0.5 * rcpPowScale);\n\t\toffset.y = bRes && (offset.y < 2.0*a) ? 0.0 : offset.y;\n\t}\n\tr = normalize(r);\n\tfloat texelOffset = 0.5 * cubeUV_rcpTextureSize;\n\tvec2 s = ( r.yz / abs( r.x ) + vec2( 1.0 ) ) * 0.5;\n\tvec2 base = offset + vec2( texelOffset );\n\treturn base + s * ( scale - 2.0 * texelOffset );\n}\n#define cubeUV_maxLods3 (log2(cubeUV_textureSize*0.25) - 3.0)\nvec4 textureCubeUV(vec3 reflectedDirection, float roughness ) {\n\tfloat roughnessVal = roughness* cubeUV_maxLods3;\n\tfloat r1 = floor(roughnessVal);\n\tfloat r2 = r1 + 1.0;\n\tfloat t = fract(roughnessVal);\n\tvec2 mipInfo = MipLevelInfo(reflectedDirection, r1, roughness);\n\tfloat s = mipInfo.y;\n\tfloat level0 = mipInfo.x;\n\tfloat level1 = level0 + 1.0;\n\tlevel1 = level1 > 5.0 ? 5.0 : level1;\n\tlevel0 += min( floor( s + 0.5 ), 5.0 );\n\tvec2 uv_10 = getCubeUV(reflectedDirection, r1, level0);\n\tvec4 color10 = envMapTexelToLinear(texture2D(envMap, uv_10));\n\tvec2 uv_20 = getCubeUV(reflectedDirection, r2, level0);\n\tvec4 color20 = envMapTexelToLinear(texture2D(envMap, uv_20));\n\tvec4 result = mix(color10, color20, t);\n\treturn vec4(result.rgb, 1.0);\n}\n#endif\n",defaultnormal_vertex:"vec3 transformedNormal = normalMatrix * objectNormal;\n#ifdef FLIP_SIDED\n\ttransformedNormal = - transformedNormal;\n#endif\n",displacementmap_pars_vertex:"#ifdef USE_DISPLACEMENTMAP\n\tuniform sampler2D displacementMap;\n\tuniform float displacementScale;\n\tuniform float displacementBias;\n#endif\n",displacementmap_vertex:"#ifdef USE_DISPLACEMENTMAP\n\ttransformed += normalize( objectNormal ) * ( texture2D( displacementMap, uv ).x * displacementScale + displacementBias );\n#endif\n",emissivemap_fragment:"#ifdef USE_EMISSIVEMAP\n\tvec4 emissiveColor = texture2D( emissiveMap, vUv );\n\temissiveColor.rgb = emissiveMapTexelToLinear( emissiveColor ).rgb;\n\ttotalEmissiveRadiance *= emissiveColor.rgb;\n#endif\n",emissivemap_pars_fragment:"#ifdef USE_EMISSIVEMAP\n\tuniform sampler2D emissiveMap;\n#endif\n",encodings_fragment:" gl_FragColor = linearToOutputTexel( gl_FragColor );\n",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.xyz, vec3( gammaFactor ) ), value.w );\n}\nvec4 LinearToGamma( in vec4 value, in float gammaFactor ) {\n\treturn vec4( pow( value.xyz, vec3( 1.0 / gammaFactor ) ), value.w );\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.w );\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.w );\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.xyz * value.w * maxRange, 1.0 );\n}\nvec4 LinearToRGBM( in vec4 value, in float maxRange ) {\n\tfloat maxRGB = max( value.x, 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.x, max( value.g, value.b ) );\n\tfloat D = max( maxRange / maxRGB, 1.0 );\n\tD = min( floor( D ) / 255.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 = value.rgb * cLogLuvM;\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 = Xp_Y_XYZp.rgb * cLogLuvInverseM;\n\treturn vec4( max(vRGB, 0.0), 1.0 );\n}\n",envmap_fragment:"#ifdef USE_ENVMAP\n\t#if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG )\n\t\tvec3 cameraToVertex = normalize( vWorldPosition - cameraPosition );\n\t\tvec3 worldNormal = inverseTransformDirection( normal, viewMatrix );\n\t\t#ifdef ENVMAP_MODE_REFLECTION\n\t\t\tvec3 reflectVec = reflect( cameraToVertex, worldNormal );\n\t\t#else\n\t\t\tvec3 reflectVec = refract( cameraToVertex, 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_EQUIREC )\n\t\tvec2 sampleUV;\n\t\treflectVec = normalize( reflectVec );\n\t\tsampleUV.y = asin( clamp( reflectVec.y, - 1.0, 1.0 ) ) * RECIPROCAL_PI + 0.5;\n\t\tsampleUV.x = atan( reflectVec.z, reflectVec.x ) * RECIPROCAL_PI2 + 0.5;\n\t\tvec4 envColor = texture2D( envMap, sampleUV );\n\t#elif defined( ENVMAP_TYPE_SPHERE )\n\t\treflectVec = normalize( reflectVec );\n\t\tvec3 reflectView = normalize( ( viewMatrix * vec4( reflectVec, 0.0 ) ).xyz + vec3( 0.0, 0.0, 1.0 ) );\n\t\tvec4 envColor = texture2D( envMap, reflectView.xy * 0.5 + 0.5 );\n\t#else\n\t\tvec4 envColor = vec4( 0.0 );\n\t#endif\n\tenvColor = envMapTexelToLinear( envColor );\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\n",envmap_pars_fragment:"#if defined( USE_ENVMAP ) || defined( PHYSICAL )\n\tuniform float reflectivity;\n\tuniform float envMapIntensity;\n#endif\n#ifdef USE_ENVMAP\n\t#if ! defined( PHYSICAL ) && ( defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG ) )\n\t\tvarying vec3 vWorldPosition;\n\t#endif\n\t#ifdef ENVMAP_TYPE_CUBE\n\t\tuniform samplerCube envMap;\n\t#else\n\t\tuniform sampler2D envMap;\n\t#endif\n\tuniform float flipEnvMap;\n\t#if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG ) || defined( PHYSICAL )\n\t\tuniform float refractionRatio;\n\t#else\n\t\tvarying vec3 vReflect;\n\t#endif\n#endif\n",envmap_pars_vertex:"#ifdef USE_ENVMAP\n\t#if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG )\n\t\tvarying vec3 vWorldPosition;\n\t#else\n\t\tvarying vec3 vReflect;\n\t\tuniform float refractionRatio;\n\t#endif\n#endif\n",envmap_vertex:"#ifdef USE_ENVMAP\n\t#if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG )\n\t\tvWorldPosition = worldPosition.xyz;\n\t#else\n\t\tvec3 cameraToVertex = normalize( worldPosition.xyz - cameraPosition );\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\n",fog_vertex:"\n#ifdef USE_FOG\nfogDepth = -mvPosition.z;\n#endif",fog_pars_vertex:"#ifdef USE_FOG\n varying float fogDepth;\n#endif\n",fog_fragment:"#ifdef USE_FOG\n\t#ifdef FOG_EXP2\n\t\tfloat fogFactor = whiteCompliment( exp2( - fogDensity * fogDensity * fogDepth * fogDepth * LOG2 ) );\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\n",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\n",gradientmap_pars_fragment:"#ifdef TOON\n\tuniform sampler2D gradientMap;\n\tvec3 getGradientIrradiance( vec3 normal, vec3 lightDirection ) {\n\t\tfloat dotNL = dot( normal, lightDirection );\n\t\tvec2 coord = vec2( dotNL * 0.5 + 0.5, 0.0 );\n\t\t#ifdef USE_GRADIENTMAP\n\t\t\treturn texture2D( gradientMap, coord ).rgb;\n\t\t#else\n\t\t\treturn ( coord.x < 0.7 ) ? vec3( 0.7 ) : vec3( 1.0 );\n\t\t#endif\n\t}\n#endif\n",lightmap_fragment:"#ifdef USE_LIGHTMAP\n\treflectedLight.indirectDiffuse += PI * texture2D( lightMap, vUv2 ).xyz * lightMapIntensity;\n#endif\n",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 = normalize( -mvPosition.xyz );\nGeometricContext backGeometry;\nbackGeometry.position = geometry.position;\nbackGeometry.normal = -geometry.normal;\nbackGeometry.viewDir = geometry.viewDir;\nvLightFront = vec3( 0.0 );\n#ifdef DOUBLE_SIDED\n\tvLightBack = vec3( 0.0 );\n#endif\nIncidentLight directLight;\nfloat dotNL;\nvec3 directLightColor_Diffuse;\n#if NUM_POINT_LIGHTS > 0\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#endif\n#if NUM_SPOT_LIGHTS > 0\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#endif\n#if NUM_DIR_LIGHTS > 0\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#endif\n#if NUM_HEMI_LIGHTS > 0\n\tfor ( int i = 0; i < NUM_HEMI_LIGHTS; i ++ ) {\n\t\tvLightFront += getHemisphereLightIrradiance( hemisphereLights[ i ], geometry );\n\t\t#ifdef DOUBLE_SIDED\n\t\t\tvLightBack += getHemisphereLightIrradiance( hemisphereLights[ i ], backGeometry );\n\t\t#endif\n\t}\n#endif\n",lights_pars:"uniform vec3 ambientLightColor;\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\tint shadow;\n\t\tfloat shadowBias;\n\t\tfloat shadowRadius;\n\t\tvec2 shadowMapSize;\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\tint shadow;\n\t\tfloat shadowBias;\n\t\tfloat shadowRadius;\n\t\tvec2 shadowMapSize;\n\t\tfloat shadowCameraNear;\n\t\tfloat shadowCameraFar;\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\tint shadow;\n\t\tfloat shadowBias;\n\t\tfloat shadowRadius;\n\t\tvec2 shadowMapSize;\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 ltcMat;\tuniform sampler2D ltcMag;\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\n#if defined( USE_ENVMAP ) && defined( PHYSICAL )\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\tvec3 queryVec = vec3( flipEnvMap * worldNormal.x, worldNormal.yz );\n\t\t\tvec4 envMapColor = textureCubeUV( queryVec, 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 blinnShininessExponent, const in int maxMIPLevel ) {\n\t\tfloat maxMIPLevelScalar = float( maxMIPLevel );\n\t\tfloat desiredMIPLevel = maxMIPLevelScalar + 0.79248 - 0.5 * log2( pow2( blinnShininessExponent ) + 1.0 );\n\t\treturn clamp( desiredMIPLevel, 0.0, maxMIPLevelScalar );\n\t}\n\tvec3 getLightProbeIndirectRadiance( const in GeometricContext geometry, const in float blinnShininessExponent, const in int maxMIPLevel ) {\n\t\t#ifdef ENVMAP_MODE_REFLECTION\n\t\t\tvec3 reflectVec = reflect( -geometry.viewDir, geometry.normal );\n\t\t#else\n\t\t\tvec3 reflectVec = refract( -geometry.viewDir, geometry.normal, refractionRatio );\n\t\t#endif\n\t\treflectVec = inverseTransformDirection( reflectVec, viewMatrix );\n\t\tfloat specularMIPLevel = getSpecularMIPLevel( blinnShininessExponent, 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\tvec3 queryReflectVec = vec3( flipEnvMap * reflectVec.x, reflectVec.yz );\n\t\t\tvec4 envMapColor = textureCubeUV(queryReflectVec, BlinnExponentToGGXRoughness(blinnShininessExponent));\n\t\t#elif defined( ENVMAP_TYPE_EQUIREC )\n\t\t\tvec2 sampleUV;\n\t\t\tsampleUV.y = asin( clamp( reflectVec.y, - 1.0, 1.0 ) ) * RECIPROCAL_PI + 0.5;\n\t\t\tsampleUV.x = atan( reflectVec.z, reflectVec.x ) * RECIPROCAL_PI2 + 0.5;\n\t\t\t#ifdef TEXTURE_LOD_EXT\n\t\t\t\tvec4 envMapColor = texture2DLodEXT( envMap, sampleUV, specularMIPLevel );\n\t\t\t#else\n\t\t\t\tvec4 envMapColor = texture2D( envMap, sampleUV, specularMIPLevel );\n\t\t\t#endif\n\t\t\tenvMapColor.rgb = envMapTexelToLinear( envMapColor ).rgb;\n\t\t#elif defined( ENVMAP_TYPE_SPHERE )\n\t\t\tvec3 reflectView = normalize( ( viewMatrix * vec4( reflectVec, 0.0 ) ).xyz + vec3( 0.0,0.0,1.0 ) );\n\t\t\t#ifdef TEXTURE_LOD_EXT\n\t\t\t\tvec4 envMapColor = texture2DLodEXT( envMap, reflectView.xy * 0.5 + 0.5, specularMIPLevel );\n\t\t\t#else\n\t\t\t\tvec4 envMapColor = texture2D( envMap, reflectView.xy * 0.5 + 0.5, specularMIPLevel );\n\t\t\t#endif\n\t\t\tenvMapColor.rgb = envMapTexelToLinear( envMapColor ).rgb;\n\t\t#endif\n\t\treturn envMapColor.rgb * envMapIntensity;\n\t}\n#endif\n",lights_phong_fragment:"BlinnPhongMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb;\nmaterial.specularColor = specular;\nmaterial.specularShininess = shininess;\nmaterial.specularStrength = specularStrength;\n",lights_phong_pars_fragment:"varying vec3 vViewPosition;\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n#endif\nstruct BlinnPhongMaterial {\n\tvec3\tdiffuseColor;\n\tvec3\tspecularColor;\n\tfloat\tspecularShininess;\n\tfloat\tspecularStrength;\n};\nvoid RE_Direct_BlinnPhong( const in IncidentLight directLight, const in GeometricContext geometry, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight ) {\n\t#ifdef TOON\n\t\tvec3 irradiance = getGradientIrradiance( geometry.normal, directLight.direction ) * directLight.color;\n\t#else\n\t\tfloat dotNL = saturate( dot( geometry.normal, directLight.direction ) );\n\t\tvec3 irradiance = dotNL * directLight.color;\n\t#endif\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)\n",lights_physical_fragment:"PhysicalMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb * ( 1.0 - metalnessFactor );\nmaterial.specularRoughness = clamp( roughnessFactor, 0.04, 1.0 );\n#ifdef STANDARD\n\tmaterial.specularColor = mix( vec3( DEFAULT_SPECULAR_COEFFICIENT ), diffuseColor.rgb, metalnessFactor );\n#else\n\tmaterial.specularColor = mix( vec3( MAXIMUM_SPECULAR_COEFFICIENT * pow2( reflectivity ) ), diffuseColor.rgb, metalnessFactor );\n\tmaterial.clearCoat = saturate( clearCoat );\tmaterial.clearCoatRoughness = clamp( clearCoatRoughness, 0.04, 1.0 );\n#endif\n",lights_physical_pars_fragment:"struct PhysicalMaterial {\n\tvec3\tdiffuseColor;\n\tfloat\tspecularRoughness;\n\tvec3\tspecularColor;\n\t#ifndef STANDARD\n\t\tfloat clearCoat;\n\t\tfloat clearCoatRoughness;\n\t#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\tfloat norm = texture2D( ltcMag, uv ).a;\n\t\tvec4 t = texture2D( ltcMat, uv );\n\t\tmat3 mInv = mat3(\n\t\t\tvec3( 1, 0, t.y ),\n\t\t\tvec3( 0, t.z, 0 ),\n\t\t\tvec3( t.w, 0, t.x )\n\t\t);\n\t\treflectedLight.directSpecular += lightColor * material.specularColor * norm * LTC_Evaluate( normal, viewDir, position, mInv, rectCoords );\n\t\treflectedLight.directDiffuse += lightColor * material.diffuseColor * LTC_Evaluate( normal, viewDir, position, mat3( 1 ), 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#ifndef STANDARD\n\t\tfloat clearCoatDHR = material.clearCoat * clearCoatDHRApprox( material.clearCoatRoughness, dotNL );\n\t#else\n\t\tfloat clearCoatDHR = 0.0;\n\t#endif\n\treflectedLight.directSpecular += ( 1.0 - clearCoatDHR ) * irradiance * BRDF_Specular_GGX( directLight, geometry, material.specularColor, material.specularRoughness );\n\treflectedLight.directDiffuse += ( 1.0 - clearCoatDHR ) * irradiance * BRDF_Diffuse_Lambert( material.diffuseColor );\n\t#ifndef STANDARD\n\t\treflectedLight.directSpecular += irradiance * material.clearCoat * BRDF_Specular_GGX( directLight, geometry, vec3( DEFAULT_SPECULAR_COEFFICIENT ), material.clearCoatRoughness );\n\t#endif\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 clearCoatRadiance, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {\n\t#ifndef STANDARD\n\t\tfloat dotNV = saturate( dot( geometry.normal, geometry.viewDir ) );\n\t\tfloat dotNL = dotNV;\n\t\tfloat clearCoatDHR = material.clearCoat * clearCoatDHRApprox( material.clearCoatRoughness, dotNL );\n\t#else\n\t\tfloat clearCoatDHR = 0.0;\n\t#endif\n\treflectedLight.indirectSpecular += ( 1.0 - clearCoatDHR ) * radiance * BRDF_Specular_GGX_Environment( geometry, material.specularColor, material.specularRoughness );\n\t#ifndef STANDARD\n\t\treflectedLight.indirectSpecular += clearCoatRadiance * material.clearCoat * BRDF_Specular_GGX_Environment( geometry, vec3( DEFAULT_SPECULAR_COEFFICIENT ), material.clearCoatRoughness );\n\t#endif\n}\n#define RE_Direct\t\t\t\tRE_Direct_Physical\n#define RE_Direct_RectArea\t\tRE_Direct_RectArea_Physical\n#define RE_IndirectDiffuse\t\tRE_IndirectDiffuse_Physical\n#define RE_IndirectSpecular\t\tRE_IndirectSpecular_Physical\n#define Material_BlinnShininessExponent( material ) GGXRoughnessToBlinnExponent( material.specularRoughness )\n#define Material_ClearCoat_BlinnShininessExponent( material ) GGXRoughnessToBlinnExponent( material.clearCoatRoughness )\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}\n",lights_template:"\nGeometricContext geometry;\ngeometry.position = - vViewPosition;\ngeometry.normal = normal;\ngeometry.viewDir = normalize( vViewPosition );\nIncidentLight directLight;\n#if ( NUM_POINT_LIGHTS > 0 ) && defined( RE_Direct )\n\tPointLight pointLight;\n\tfor ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) {\n\t\tpointLight = pointLights[ i ];\n\t\tgetPointDirectLightIrradiance( pointLight, geometry, directLight );\n\t\t#ifdef USE_SHADOWMAP\n\t\tdirectLight.color *= all( bvec2( pointLight.shadow, directLight.visible ) ) ? getPointShadow( pointShadowMap[ i ], pointLight.shadowMapSize, pointLight.shadowBias, pointLight.shadowRadius, vPointShadowCoord[ i ], pointLight.shadowCameraNear, pointLight.shadowCameraFar ) : 1.0;\n\t\t#endif\n\t\tRE_Direct( directLight, geometry, material, reflectedLight );\n\t}\n#endif\n#if ( NUM_SPOT_LIGHTS > 0 ) && defined( RE_Direct )\n\tSpotLight spotLight;\n\tfor ( int i = 0; i < NUM_SPOT_LIGHTS; i ++ ) {\n\t\tspotLight = spotLights[ i ];\n\t\tgetSpotDirectLightIrradiance( spotLight, geometry, directLight );\n\t\t#ifdef USE_SHADOWMAP\n\t\tdirectLight.color *= all( bvec2( spotLight.shadow, directLight.visible ) ) ? getShadow( spotShadowMap[ i ], spotLight.shadowMapSize, spotLight.shadowBias, spotLight.shadowRadius, vSpotShadowCoord[ i ] ) : 1.0;\n\t\t#endif\n\t\tRE_Direct( directLight, geometry, material, reflectedLight );\n\t}\n#endif\n#if ( NUM_DIR_LIGHTS > 0 ) && defined( RE_Direct )\n\tDirectionalLight directionalLight;\n\tfor ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) {\n\t\tdirectionalLight = directionalLights[ i ];\n\t\tgetDirectionalDirectLightIrradiance( directionalLight, geometry, directLight );\n\t\t#ifdef USE_SHADOWMAP\n\t\tdirectLight.color *= all( bvec2( directionalLight.shadow, directLight.visible ) ) ? getShadow( directionalShadowMap[ i ], directionalLight.shadowMapSize, directionalLight.shadowBias, directionalLight.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0;\n\t\t#endif\n\t\tRE_Direct( directLight, geometry, material, reflectedLight );\n\t}\n#endif\n#if ( NUM_RECT_AREA_LIGHTS > 0 ) && defined( RE_Direct_RectArea )\n\tRectAreaLight rectAreaLight;\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#endif\n#if defined( RE_IndirectDiffuse )\n\tvec3 irradiance = getAmbientLightIrradiance( ambientLightColor );\n\t#ifdef USE_LIGHTMAP\n\t\tvec3 lightMapIrradiance = texture2D( lightMap, vUv2 ).xyz * 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 ( NUM_HEMI_LIGHTS > 0 )\n\t\tfor ( int i = 0; i < NUM_HEMI_LIGHTS; i ++ ) {\n\t\t\tirradiance += getHemisphereLightIrradiance( hemisphereLights[ i ], geometry );\n\t\t}\n\t#endif\n\t#if defined( USE_ENVMAP ) && defined( PHYSICAL ) && defined( ENVMAP_TYPE_CUBE_UV )\n\t\tirradiance += getLightProbeIndirectIrradiance( geometry, 8 );\n\t#endif\n\tRE_IndirectDiffuse( irradiance, geometry, material, reflectedLight );\n#endif\n#if defined( USE_ENVMAP ) && defined( RE_IndirectSpecular )\n\tvec3 radiance = getLightProbeIndirectRadiance( geometry, Material_BlinnShininessExponent( material ), 8 );\n\t#ifndef STANDARD\n\t\tvec3 clearCoatRadiance = getLightProbeIndirectRadiance( geometry, Material_ClearCoat_BlinnShininessExponent( material ), 8 );\n\t#else\n\t\tvec3 clearCoatRadiance = vec3( 0.0 );\n\t#endif\n\tRE_IndirectSpecular( radiance, clearCoatRadiance, geometry, material, reflectedLight );\n#endif\n",logdepthbuf_fragment:"#if defined( USE_LOGDEPTHBUF ) && defined( USE_LOGDEPTHBUF_EXT )\n\tgl_FragDepthEXT = log2( vFragDepth ) * logDepthBufFC * 0.5;\n#endif",logdepthbuf_pars_fragment:"#ifdef USE_LOGDEPTHBUF\n\tuniform float logDepthBufFC;\n\t#ifdef USE_LOGDEPTHBUF_EXT\n\t\tvarying float vFragDepth;\n\t#endif\n#endif\n",logdepthbuf_pars_vertex:"#ifdef USE_LOGDEPTHBUF\n\t#ifdef USE_LOGDEPTHBUF_EXT\n\t\tvarying float vFragDepth;\n\t#endif\n\tuniform float logDepthBufFC;\n#endif",logdepthbuf_vertex:"#ifdef USE_LOGDEPTHBUF\n\t#ifdef USE_LOGDEPTHBUF_EXT\n\t\tvFragDepth = 1.0 + gl_Position.w;\n\t#else\n\t\tgl_Position.z = log2( max( EPSILON, gl_Position.w + 1.0 ) ) * logDepthBufFC - 1.0;\n\t\tgl_Position.z *= gl_Position.w;\n\t#endif\n#endif\n",map_fragment:"#ifdef USE_MAP\n\tvec4 texelColor = texture2D( map, vUv );\n\ttexelColor = mapTexelToLinear( texelColor );\n\tdiffuseColor *= texelColor;\n#endif\n",map_pars_fragment:"#ifdef USE_MAP\n\tuniform sampler2D map;\n#endif\n",map_particle_fragment:"#ifdef USE_MAP\n\tvec2 uv = ( uvTransform * vec3( gl_PointCoord.x, 1.0 - gl_PointCoord.y, 1 ) ).xy;\n\tvec4 mapTexel = texture2D( map, uv );\n\tdiffuseColor *= mapTexelToLinear( mapTexel );\n#endif\n",map_particle_pars_fragment:"#ifdef USE_MAP\n\tuniform mat3 uvTransform;\n\tuniform sampler2D map;\n#endif\n",metalnessmap_fragment:"float metalnessFactor = metalness;\n#ifdef USE_METALNESSMAP\n\tvec4 texelMetalness = texture2D( metalnessMap, vUv );\n\tmetalnessFactor *= texelMetalness.b;\n#endif\n",metalnessmap_pars_fragment:"#ifdef USE_METALNESSMAP\n\tuniform sampler2D metalnessMap;\n#endif",morphnormal_vertex:"#ifdef USE_MORPHNORMALS\n\tobjectNormal += ( morphNormal0 - normal ) * morphTargetInfluences[ 0 ];\n\tobjectNormal += ( morphNormal1 - normal ) * morphTargetInfluences[ 1 ];\n\tobjectNormal += ( morphNormal2 - normal ) * morphTargetInfluences[ 2 ];\n\tobjectNormal += ( morphNormal3 - normal ) * morphTargetInfluences[ 3 ];\n#endif\n",morphtarget_pars_vertex:"#ifdef USE_MORPHTARGETS\n\t#ifndef USE_MORPHNORMALS\n\tuniform float morphTargetInfluences[ 8 ];\n\t#else\n\tuniform float morphTargetInfluences[ 4 ];\n\t#endif\n#endif",morphtarget_vertex:"#ifdef USE_MORPHTARGETS\n\ttransformed += ( morphTarget0 - position ) * morphTargetInfluences[ 0 ];\n\ttransformed += ( morphTarget1 - position ) * morphTargetInfluences[ 1 ];\n\ttransformed += ( morphTarget2 - position ) * morphTargetInfluences[ 2 ];\n\ttransformed += ( morphTarget3 - position ) * morphTargetInfluences[ 3 ];\n\t#ifndef USE_MORPHNORMALS\n\ttransformed += ( morphTarget4 - position ) * morphTargetInfluences[ 4 ];\n\ttransformed += ( morphTarget5 - position ) * morphTargetInfluences[ 5 ];\n\ttransformed += ( morphTarget6 - position ) * morphTargetInfluences[ 6 ];\n\ttransformed += ( morphTarget7 - position ) * morphTargetInfluences[ 7 ];\n\t#endif\n#endif\n",normal_fragment:"#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 * ( float( gl_FrontFacing ) * 2.0 - 1.0 );\n\t#endif\n#endif\n#ifdef USE_NORMALMAP\n\tnormal = perturbNormal2Arb( -vViewPosition, normal );\n#elif defined( USE_BUMPMAP )\n\tnormal = perturbNormalArb( -vViewPosition, normal, dHdxy_fwd() );\n#endif\n",normalmap_pars_fragment:"#ifdef USE_NORMALMAP\n\tuniform sampler2D normalMap;\n\tuniform vec2 normalScale;\n\tvec3 perturbNormal2Arb( vec3 eye_pos, vec3 surf_norm ) {\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 S = normalize( q0 * st1.t - q1 * st0.t );\n\t\tvec3 T = normalize( -q0 * st1.s + q1 * st0.s );\n\t\tvec3 N = normalize( surf_norm );\n\t\tvec3 mapN = texture2D( normalMap, vUv ).xyz * 2.0 - 1.0;\n\t\tmapN.xy = normalScale * mapN.xy;\n\t\tmat3 tsn = mat3( S, T, N );\n\t\treturn normalize( tsn * mapN );\n\t}\n#endif\n",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}\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}\n",premultiplied_alpha_fragment:"#ifdef PREMULTIPLIED_ALPHA\n\tgl_FragColor.rgb *= gl_FragColor.a;\n#endif\n",project_vertex:"vec4 mvPosition = modelViewMatrix * vec4( transformed, 1.0 );\ngl_Position = projectionMatrix * mvPosition;\n",dithering_fragment:"#if defined( DITHERING )\n gl_FragColor.rgb = dithering( gl_FragColor.rgb );\n#endif\n",dithering_pars_fragment:"#if defined( 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\n",roughnessmap_fragment:"float roughnessFactor = roughness;\n#ifdef USE_ROUGHNESSMAP\n\tvec4 texelRoughness = texture2D( roughnessMap, vUv );\n\troughnessFactor *= texelRoughness.g;\n#endif\n",roughnessmap_pars_fragment:"#ifdef USE_ROUGHNESSMAP\n\tuniform sampler2D roughnessMap;\n#endif",shadowmap_pars_fragment:"#ifdef USE_SHADOWMAP\n\t#if NUM_DIR_LIGHTS > 0\n\t\tuniform sampler2D directionalShadowMap[ NUM_DIR_LIGHTS ];\n\t\tvarying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHTS ];\n\t#endif\n\t#if NUM_SPOT_LIGHTS > 0\n\t\tuniform sampler2D spotShadowMap[ NUM_SPOT_LIGHTS ];\n\t\tvarying vec4 vSpotShadowCoord[ NUM_SPOT_LIGHTS ];\n\t#endif\n\t#if NUM_POINT_LIGHTS > 0\n\t\tuniform sampler2D pointShadowMap[ NUM_POINT_LIGHTS ];\n\t\tvarying vec4 vPointShadowCoord[ NUM_POINT_LIGHTS ];\n\t#endif\n\tfloat texture2DCompare( sampler2D depths, vec2 uv, float compare ) {\n\t\treturn step( compare, unpackRGBAToDepth( texture2D( depths, uv ) ) );\n\t}\n\tfloat texture2DShadowLerp( sampler2D depths, vec2 size, vec2 uv, float compare ) {\n\t\tconst vec2 offset = vec2( 0.0, 1.0 );\n\t\tvec2 texelSize = vec2( 1.0 ) / size;\n\t\tvec2 centroidUV = floor( uv * size + 0.5 ) / size;\n\t\tfloat lb = texture2DCompare( depths, centroidUV + texelSize * offset.xx, compare );\n\t\tfloat lt = texture2DCompare( depths, centroidUV + texelSize * offset.xy, compare );\n\t\tfloat rb = texture2DCompare( depths, centroidUV + texelSize * offset.yx, compare );\n\t\tfloat rt = texture2DCompare( depths, centroidUV + texelSize * offset.yy, compare );\n\t\tvec2 f = fract( uv * size + 0.5 );\n\t\tfloat a = mix( lb, lt, f.y );\n\t\tfloat b = mix( rb, rt, f.y );\n\t\tfloat c = mix( a, b, f.x );\n\t\treturn c;\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\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( dx0, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy, 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( 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 / 9.0 );\n\t\t#elif defined( SHADOWMAP_TYPE_PCF_SOFT )\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\tshadow = (\n\t\t\t\ttexture2DShadowLerp( shadowMap, shadowMapSize, shadowCoord.xy + vec2( dx0, dy0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DShadowLerp( shadowMap, shadowMapSize, shadowCoord.xy + vec2( 0.0, dy0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DShadowLerp( shadowMap, shadowMapSize, shadowCoord.xy + vec2( dx1, dy0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DShadowLerp( shadowMap, shadowMapSize, shadowCoord.xy + vec2( dx0, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DShadowLerp( shadowMap, shadowMapSize, shadowCoord.xy, shadowCoord.z ) +\n\t\t\t\ttexture2DShadowLerp( shadowMap, shadowMapSize, shadowCoord.xy + vec2( dx1, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DShadowLerp( shadowMap, shadowMapSize, shadowCoord.xy + vec2( dx0, dy1 ), shadowCoord.z ) +\n\t\t\t\ttexture2DShadowLerp( shadowMap, shadowMapSize, shadowCoord.xy + vec2( 0.0, dy1 ), shadowCoord.z ) +\n\t\t\t\ttexture2DShadowLerp( shadowMap, shadowMapSize, shadowCoord.xy + vec2( dx1, dy1 ), shadowCoord.z )\n\t\t\t) * ( 1.0 / 9.0 );\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 )\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\n",shadowmap_pars_vertex:"#ifdef USE_SHADOWMAP\n\t#if NUM_DIR_LIGHTS > 0\n\t\tuniform mat4 directionalShadowMatrix[ NUM_DIR_LIGHTS ];\n\t\tvarying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHTS ];\n\t#endif\n\t#if NUM_SPOT_LIGHTS > 0\n\t\tuniform mat4 spotShadowMatrix[ NUM_SPOT_LIGHTS ];\n\t\tvarying vec4 vSpotShadowCoord[ NUM_SPOT_LIGHTS ];\n\t#endif\n\t#if NUM_POINT_LIGHTS > 0\n\t\tuniform mat4 pointShadowMatrix[ NUM_POINT_LIGHTS ];\n\t\tvarying vec4 vPointShadowCoord[ NUM_POINT_LIGHTS ];\n\t#endif\n#endif\n",shadowmap_vertex:"#ifdef USE_SHADOWMAP\n\t#if NUM_DIR_LIGHTS > 0\n\tfor ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) {\n\t\tvDirectionalShadowCoord[ i ] = directionalShadowMatrix[ i ] * worldPosition;\n\t}\n\t#endif\n\t#if NUM_SPOT_LIGHTS > 0\n\tfor ( int i = 0; i < NUM_SPOT_LIGHTS; i ++ ) {\n\t\tvSpotShadowCoord[ i ] = spotShadowMatrix[ i ] * worldPosition;\n\t}\n\t#endif\n\t#if NUM_POINT_LIGHTS > 0\n\tfor ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) {\n\t\tvPointShadowCoord[ i ] = pointShadowMatrix[ i ] * worldPosition;\n\t}\n\t#endif\n#endif\n",shadowmask_pars_fragment:"float getShadowMask() {\n\tfloat shadow = 1.0;\n\t#ifdef USE_SHADOWMAP\n\t#if NUM_DIR_LIGHTS > 0\n\tDirectionalLight directionalLight;\n\tfor ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) {\n\t\tdirectionalLight = directionalLights[ i ];\n\t\tshadow *= bool( directionalLight.shadow ) ? getShadow( directionalShadowMap[ i ], directionalLight.shadowMapSize, directionalLight.shadowBias, directionalLight.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0;\n\t}\n\t#endif\n\t#if NUM_SPOT_LIGHTS > 0\n\tSpotLight spotLight;\n\tfor ( int i = 0; i < NUM_SPOT_LIGHTS; i ++ ) {\n\t\tspotLight = spotLights[ i ];\n\t\tshadow *= bool( spotLight.shadow ) ? getShadow( spotShadowMap[ i ], spotLight.shadowMapSize, spotLight.shadowBias, spotLight.shadowRadius, vSpotShadowCoord[ i ] ) : 1.0;\n\t}\n\t#endif\n\t#if NUM_POINT_LIGHTS > 0\n\tPointLight pointLight;\n\tfor ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) {\n\t\tpointLight = pointLights[ i ];\n\t\tshadow *= bool( pointLight.shadow ) ? getPointShadow( pointShadowMap[ i ], pointLight.shadowMapSize, pointLight.shadowBias, pointLight.shadowRadius, vPointShadowCoord[ i ], pointLight.shadowCameraNear, pointLight.shadowCameraFar ) : 1.0;\n\t}\n\t#endif\n\t#endif\n\treturn shadow;\n}\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 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\n",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\n",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#endif\n",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 gl_FragColor.rgb = toneMapping( gl_FragColor.rgb );\n#endif\n",tonemapping_pars_fragment:"#ifndef saturate\n\t#define saturate(a) clamp( a, 0.0, 1.0 )\n#endif\nuniform float toneMappingExposure;\nuniform float toneMappingWhitePoint;\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}\n#define Uncharted2Helper( x ) max( ( ( x * ( 0.15 * x + 0.10 * 0.50 ) + 0.20 * 0.02 ) / ( x * ( 0.15 * x + 0.50 ) + 0.20 * 0.30 ) ) - 0.02 / 0.30, vec3( 0.0 ) )\nvec3 Uncharted2ToneMapping( vec3 color ) {\n\tcolor *= toneMappingExposure;\n\treturn saturate( Uncharted2Helper( color ) / Uncharted2Helper( vec3( toneMappingWhitePoint ) ) );\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}\n",uv_pars_fragment:"#if defined( USE_MAP ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( USE_SPECULARMAP ) || defined( USE_ALPHAMAP ) || defined( USE_EMISSIVEMAP ) || defined( USE_ROUGHNESSMAP ) || defined( USE_METALNESSMAP )\n\tvarying vec2 vUv;\n#endif",uv_pars_vertex:"#if defined( USE_MAP ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( USE_SPECULARMAP ) || defined( USE_ALPHAMAP ) || defined( USE_EMISSIVEMAP ) || defined( USE_ROUGHNESSMAP ) || defined( USE_METALNESSMAP )\n\tvarying vec2 vUv;\n\tuniform mat3 uvTransform;\n#endif\n",uv_vertex:"#if defined( USE_MAP ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( USE_SPECULARMAP ) || defined( USE_ALPHAMAP ) || defined( USE_EMISSIVEMAP ) || defined( USE_ROUGHNESSMAP ) || defined( USE_METALNESSMAP )\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#endif",uv2_vertex:"#if defined( USE_LIGHTMAP ) || defined( USE_AOMAP )\n\tvUv2 = uv2;\n#endif",worldpos_vertex:"#if defined( USE_ENVMAP ) || defined( DISTANCE ) || defined ( USE_SHADOWMAP )\n\tvec4 worldPosition = modelMatrix * vec4( transformed, 1.0 );\n#endif\n",cube_frag:"uniform samplerCube tCube;\nuniform float tFlip;\nuniform float opacity;\nvarying vec3 vWorldPosition;\nvoid main() {\n\tgl_FragColor = textureCube( tCube, vec3( tFlip * vWorldPosition.x, vWorldPosition.yz ) );\n\tgl_FragColor.a *= opacity;\n}\n",cube_vert:"varying vec3 vWorldPosition;\n#include \nvoid main() {\n\tvWorldPosition = transformDirection( position, modelMatrix );\n\t#include \n\t#include \n\tgl_Position.z = gl_Position.w;\n}\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 \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\t#if DEPTH_PACKING == 3200\n\t\tgl_FragColor = vec4( vec3( gl_FragCoord.z ), opacity );\n\t#elif DEPTH_PACKING == 3201\n\t\tgl_FragColor = packDepthToRGBA( gl_FragCoord.z );\n\t#endif\n}\n",depth_vert:"#include \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}\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}\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}\n",equirect_frag:"uniform sampler2D tEquirect;\nvarying vec3 vWorldPosition;\n#include \nvoid main() {\n\tvec3 direction = normalize( vWorldPosition );\n\tvec2 sampleUV;\n\tsampleUV.y = asin( clamp( direction.y, - 1.0, 1.0 ) ) * RECIPROCAL_PI + 0.5;\n\tsampleUV.x = atan( direction.z, direction.x ) * RECIPROCAL_PI2 + 0.5;\n\tgl_FragColor = texture2D( tEquirect, sampleUV );\n}\n",equirect_vert:"varying vec3 vWorldPosition;\n#include \nvoid main() {\n\tvWorldPosition = transformDirection( position, modelMatrix );\n\t#include \n\t#include \n}\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}\n",linedashed_vert:"uniform float scale;\nattribute float lineDistance;\nvarying float vLineDistance;\n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\tvLineDistance = scale * lineDistance;\n\tvec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );\n\tgl_Position = projectionMatrix * mvPosition;\n\t#include \n\t#include \n\t#include \n}\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 \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\treflectedLight.indirectDiffuse += texture2D( lightMap, vUv2 ).xyz * 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}\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}\n",meshlambert_frag:"uniform vec3 diffuse;\nuniform vec3 emissive;\nuniform float opacity;\nvarying vec3 vLightFront;\n#ifdef DOUBLE_SIDED\n\tvarying vec3 vLightBack;\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 \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\treflectedLight.indirectDiffuse = getAmbientLightIrradiance( ambientLightColor );\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}\n",meshlambert_vert:"#define LAMBERT\nvarying vec3 vLightFront;\n#ifdef DOUBLE_SIDED\n\tvarying vec3 vLightBack;\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}\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 \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\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}\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}\n",meshphysical_frag:"#define PHYSICAL\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform float roughness;\nuniform float metalness;\nuniform float opacity;\n#ifndef STANDARD\n\tuniform float clearCoat;\n\tuniform float clearCoatRoughness;\n#endif\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 \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\tvec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + reflectedLight.directSpecular + reflectedLight.indirectSpecular + totalEmissiveRadiance;\n\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n}\n",meshphysical_vert:"#define PHYSICAL\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}\n",normal_frag:"#define NORMAL\nuniform float opacity;\n#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP )\n\tvarying vec3 vViewPosition;\n#endif\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n#endif\n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\t#include \n\tgl_FragColor = vec4( packNormalToRGB( normal ), opacity );\n}\n",normal_vert:"#define NORMAL\n#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP )\n\tvarying vec3 vViewPosition;\n#endif\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n#endif\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#endif\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( USE_NORMALMAP )\n\tvViewPosition = - mvPosition.xyz;\n#endif\n}\n",points_frag:"uniform vec3 diffuse;\nuniform float opacity;\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\tvec3 outgoingLight = vec3( 0.0 );\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include \n\t#include \n\t#include \n\t#include \n\toutgoingLight = diffuseColor.rgb;\n\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\n\t#include \n\t#include \n\t#include \n\t#include \n}\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#ifdef USE_SIZEATTENUATION\n\t\tgl_PointSize = size * ( scale / - mvPosition.z );\n\t#else\n\t\tgl_PointSize = size;\n\t#endif\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n}\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}\n",shadow_vert:"#include \n#include \nvoid main() {\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n}\n"},gi={basic:{uniforms:mi.merge([fi.common,fi.specularmap,fi.envmap,fi.aomap,fi.lightmap,fi.fog]),vertexShader:vi.meshbasic_vert,fragmentShader:vi.meshbasic_frag},lambert:{uniforms:mi.merge([fi.common,fi.specularmap,fi.envmap,fi.aomap,fi.lightmap,fi.emissivemap,fi.fog,fi.lights,{emissive:{value:new di(0)}}]),vertexShader:vi.meshlambert_vert,fragmentShader:vi.meshlambert_frag},phong:{uniforms:mi.merge([fi.common,fi.specularmap,fi.envmap,fi.aomap,fi.lightmap,fi.emissivemap,fi.bumpmap,fi.normalmap,fi.displacementmap,fi.gradientmap,fi.fog,fi.lights,{emissive:{value:new di(0)},specular:{value:new di(1118481)},shininess:{value:30}}]),vertexShader:vi.meshphong_vert,fragmentShader:vi.meshphong_frag},standard:{uniforms:mi.merge([fi.common,fi.envmap,fi.aomap,fi.lightmap,fi.emissivemap,fi.bumpmap,fi.normalmap,fi.displacementmap,fi.roughnessmap,fi.metalnessmap,fi.fog,fi.lights,{emissive:{value:new di(0)},roughness:{value:.5},metalness:{value:.5},envMapIntensity:{value:1}}]),vertexShader:vi.meshphysical_vert,fragmentShader:vi.meshphysical_frag},points:{uniforms:mi.merge([fi.points,fi.fog]),vertexShader:vi.points_vert,fragmentShader:vi.points_frag},dashed:{uniforms:mi.merge([fi.common,fi.fog,{scale:{value:1},dashSize:{value:1},totalSize:{value:2}}]),vertexShader:vi.linedashed_vert,fragmentShader:vi.linedashed_frag},depth:{uniforms:mi.merge([fi.common,fi.displacementmap]),vertexShader:vi.depth_vert,fragmentShader:vi.depth_frag},normal:{uniforms:mi.merge([fi.common,fi.bumpmap,fi.normalmap,fi.displacementmap,{opacity:{value:1}}]),vertexShader:vi.normal_vert,fragmentShader:vi.normal_frag},cube:{uniforms:{tCube:{value:null},tFlip:{value:-1},opacity:{value:1}},vertexShader:vi.cube_vert,fragmentShader:vi.cube_frag},equirect:{uniforms:{tEquirect:{value:null}},vertexShader:vi.equirect_vert,fragmentShader:vi.equirect_frag},distanceRGBA:{uniforms:mi.merge([fi.common,fi.displacementmap,{referencePosition:{value:new yt},nearDistance:{value:1},farDistance:{value:1e3}}]),vertexShader:vi.distanceRGBA_vert,fragmentShader:vi.distanceRGBA_frag},shadow:{uniforms:mi.merge([fi.lights,fi.fog,{color:{value:new di(0)},opacity:{value:1}}]),vertexShader:vi.shadow_vert,fragmentShader:vi.shadow_frag}};function yi(e,t){this.min=void 0!==e?e:new mt(1/0,1/0),this.max=void 0!==t?t:new mt(-1/0,-1/0)}function xi(e,t,i,r,n){var o,a,s,c,h,l,u,p;function d(){var e=new Float32Array([-1,-1,0,0,1,-1,1,0,1,1,1,1,-1,1,0,1]),r=new Uint16Array([0,1,2,0,2,3]);o=t.createBuffer(),a=t.createBuffer(),t.bindBuffer(t.ARRAY_BUFFER,o),t.bufferData(t.ARRAY_BUFFER,e,t.STATIC_DRAW),t.bindBuffer(t.ELEMENT_ARRAY_BUFFER,a),t.bufferData(t.ELEMENT_ARRAY_BUFFER,r,t.STATIC_DRAW),u=t.createTexture(),p=t.createTexture(),i.bindTexture(t.TEXTURE_2D,u),t.texImage2D(t.TEXTURE_2D,0,t.RGB,16,16,0,t.RGB,t.UNSIGNED_BYTE,null),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_S,t.CLAMP_TO_EDGE),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_T,t.CLAMP_TO_EDGE),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MAG_FILTER,t.NEAREST),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MIN_FILTER,t.NEAREST),i.bindTexture(t.TEXTURE_2D,p),t.texImage2D(t.TEXTURE_2D,0,t.RGBA,16,16,0,t.RGBA,t.UNSIGNED_BYTE,null),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_S,t.CLAMP_TO_EDGE),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_T,t.CLAMP_TO_EDGE),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MAG_FILTER,t.NEAREST),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MIN_FILTER,t.NEAREST),s={vertexShader:["uniform lowp int renderType;","uniform vec3 screenPosition;","uniform vec2 scale;","uniform float rotation;","uniform sampler2D occlusionMap;","attribute vec2 position;","attribute vec2 uv;","varying vec2 vUV;","varying float vVisibility;","void main() {","\tvUV = uv;","\tvec2 pos = position;","\tif ( renderType == 2 ) {","\t\tvec4 visibility = texture2D( occlusionMap, vec2( 0.1, 0.1 ) );","\t\tvisibility += texture2D( occlusionMap, vec2( 0.5, 0.1 ) );","\t\tvisibility += texture2D( occlusionMap, vec2( 0.9, 0.1 ) );","\t\tvisibility += texture2D( occlusionMap, vec2( 0.9, 0.5 ) );","\t\tvisibility += texture2D( occlusionMap, vec2( 0.9, 0.9 ) );","\t\tvisibility += texture2D( occlusionMap, vec2( 0.5, 0.9 ) );","\t\tvisibility += texture2D( occlusionMap, vec2( 0.1, 0.9 ) );","\t\tvisibility += texture2D( occlusionMap, vec2( 0.1, 0.5 ) );","\t\tvisibility += texture2D( occlusionMap, vec2( 0.5, 0.5 ) );","\t\tvVisibility = visibility.r / 9.0;","\t\tvVisibility *= 1.0 - visibility.g / 9.0;","\t\tvVisibility *= visibility.b / 9.0;","\t\tvVisibility *= 1.0 - visibility.a / 9.0;","\t\tpos.x = cos( rotation ) * position.x - sin( rotation ) * position.y;","\t\tpos.y = sin( rotation ) * position.x + cos( rotation ) * position.y;","\t}","\tgl_Position = vec4( ( pos * scale + screenPosition.xy ).xy, screenPosition.z, 1.0 );","}"].join("\n"),fragmentShader:["uniform lowp int renderType;","uniform sampler2D map;","uniform float opacity;","uniform vec3 color;","varying vec2 vUV;","varying float vVisibility;","void main() {","\tif ( renderType == 0 ) {","\t\tgl_FragColor = vec4( 1.0, 0.0, 1.0, 0.0 );","\t} else if ( renderType == 1 ) {","\t\tgl_FragColor = texture2D( map, vUV );","\t} else {","\t\tvec4 texture = texture2D( map, vUV );","\t\ttexture.a *= opacity * vVisibility;","\t\tgl_FragColor = texture;","\t\tgl_FragColor.rgb *= color;","\t}","}"].join("\n")},c=function(e){var i=t.createProgram(),r=t.createShader(t.FRAGMENT_SHADER),o=t.createShader(t.VERTEX_SHADER),a="precision "+n.precision+" float;\n";return t.shaderSource(r,a+e.fragmentShader),t.shaderSource(o,a+e.vertexShader),t.compileShader(r),t.compileShader(o),t.attachShader(i,r),t.attachShader(i,o),t.linkProgram(i),i}(s),h={vertex:t.getAttribLocation(c,"position"),uv:t.getAttribLocation(c,"uv")},l={renderType:t.getUniformLocation(c,"renderType"),map:t.getUniformLocation(c,"map"),occlusionMap:t.getUniformLocation(c,"occlusionMap"),opacity:t.getUniformLocation(c,"opacity"),color:t.getUniformLocation(c,"color"),scale:t.getUniformLocation(c,"scale"),rotation:t.getUniformLocation(c,"rotation"),screenPosition:t.getUniformLocation(c,"screenPosition")}}this.render=function(e,n,s,f){if(0!==e.length){var m=new yt,v=f.w/f.z,g=.5*f.z,y=.5*f.w,x=16/f.w,b=new mt(x*v,x),w=new yt(1,1,0),_=new mt(1,1),M=new yi;M.min.set(f.x,f.y),M.max.set(f.x+(f.z-16),f.y+(f.w-16)),void 0===c&&d(),i.useProgram(c),i.initAttributes(),i.enableAttribute(h.vertex),i.enableAttribute(h.uv),i.disableUnusedAttributes(),t.uniform1i(l.occlusionMap,0),t.uniform1i(l.map,1),t.bindBuffer(t.ARRAY_BUFFER,o),t.vertexAttribPointer(h.vertex,2,t.FLOAT,!1,16,0),t.vertexAttribPointer(h.uv,2,t.FLOAT,!1,16,8),t.bindBuffer(t.ELEMENT_ARRAY_BUFFER,a),i.disable(t.CULL_FACE),i.buffers.depth.setMask(!1);for(var E=0,T=e.length;E.001&&L.scale>.001&&(w.x=L.x,w.y=L.y,w.z=L.z,x=L.size*L.scale/f.w,b.x=x*v,b.y=x,t.uniform3f(l.screenPosition,w.x,w.y,w.z),t.uniform2f(l.scale,b.x,b.y),t.uniform1f(l.rotation,L.rotation),t.uniform1f(l.opacity,L.opacity),t.uniform3f(l.color,L.color.r,L.color.g,L.color.b),i.setBlending(L.blending,L.blendEquation,L.blendSrc,L.blendDst),r.setTexture2D(L.texture,1),t.drawElements(t.TRIANGLES,6,t.UNSIGNED_SHORT,0))}}}i.enable(t.CULL_FACE),i.enable(t.DEPTH_TEST),i.buffers.depth.setMask(!0),i.reset()}}}function bi(e,t,i,r,n,o,a,s,c){wt.call(this,e,t,i,r,n,o,a,s,c),this.needsUpdate=!0}function wi(e,t,i,r,n){var o,a,s,c,h,l,u=new yt,p=new gt,d=new yt;function f(){var e=new Float32Array([-.5,-.5,0,0,.5,-.5,1,0,.5,.5,1,1,-.5,.5,0,1]),i=new Uint16Array([0,1,2,0,2,3]);o=t.createBuffer(),a=t.createBuffer(),t.bindBuffer(t.ARRAY_BUFFER,o),t.bufferData(t.ARRAY_BUFFER,e,t.STATIC_DRAW),t.bindBuffer(t.ELEMENT_ARRAY_BUFFER,a),t.bufferData(t.ELEMENT_ARRAY_BUFFER,i,t.STATIC_DRAW),s=function(){var e=t.createProgram(),i=t.createShader(t.VERTEX_SHADER),r=t.createShader(t.FRAGMENT_SHADER);return t.shaderSource(i,["precision "+n.precision+" float;","#define SHADER_NAME SpriteMaterial","uniform mat4 modelViewMatrix;","uniform mat4 projectionMatrix;","uniform float rotation;","uniform vec2 scale;","uniform vec2 uvOffset;","uniform vec2 uvScale;","attribute vec2 position;","attribute vec2 uv;","varying vec2 vUV;","varying float fogDepth;","void main() {","\tvUV = uvOffset + uv * uvScale;","\tvec2 alignedPosition = position * scale;","\tvec2 rotatedPosition;","\trotatedPosition.x = cos( rotation ) * alignedPosition.x - sin( rotation ) * alignedPosition.y;","\trotatedPosition.y = sin( rotation ) * alignedPosition.x + cos( rotation ) * alignedPosition.y;","\tvec4 mvPosition;","\tmvPosition = modelViewMatrix * vec4( 0.0, 0.0, 0.0, 1.0 );","\tmvPosition.xy += rotatedPosition;","\tgl_Position = projectionMatrix * mvPosition;","\tfogDepth = - mvPosition.z;","}"].join("\n")),t.shaderSource(r,["precision "+n.precision+" float;","#define SHADER_NAME SpriteMaterial","uniform vec3 color;","uniform sampler2D map;","uniform float opacity;","uniform int fogType;","uniform vec3 fogColor;","uniform float fogDensity;","uniform float fogNear;","uniform float fogFar;","uniform float alphaTest;","varying vec2 vUV;","varying float fogDepth;","void main() {","\tvec4 texture = texture2D( map, vUV );","\tgl_FragColor = vec4( color * texture.xyz, texture.a * opacity );","\tif ( gl_FragColor.a < alphaTest ) discard;","\tif ( fogType > 0 ) {","\t\tfloat fogFactor = 0.0;","\t\tif ( fogType == 1 ) {","\t\t\tfogFactor = smoothstep( fogNear, fogFar, fogDepth );","\t\t} else {","\t\t\tconst float LOG2 = 1.442695;","\t\t\tfogFactor = exp2( - fogDensity * fogDensity * fogDepth * fogDepth * LOG2 );","\t\t\tfogFactor = 1.0 - clamp( fogFactor, 0.0, 1.0 );","\t\t}","\t\tgl_FragColor.rgb = mix( gl_FragColor.rgb, fogColor, fogFactor );","\t}","}"].join("\n")),t.compileShader(i),t.compileShader(r),t.attachShader(e,i),t.attachShader(e,r),t.linkProgram(e),e}(),c={position:t.getAttribLocation(s,"position"),uv:t.getAttribLocation(s,"uv")},h={uvOffset:t.getUniformLocation(s,"uvOffset"),uvScale:t.getUniformLocation(s,"uvScale"),rotation:t.getUniformLocation(s,"rotation"),scale:t.getUniformLocation(s,"scale"),color:t.getUniformLocation(s,"color"),map:t.getUniformLocation(s,"map"),opacity:t.getUniformLocation(s,"opacity"),modelViewMatrix:t.getUniformLocation(s,"modelViewMatrix"),projectionMatrix:t.getUniformLocation(s,"projectionMatrix"),fogType:t.getUniformLocation(s,"fogType"),fogDensity:t.getUniformLocation(s,"fogDensity"),fogNear:t.getUniformLocation(s,"fogNear"),fogFar:t.getUniformLocation(s,"fogFar"),fogColor:t.getUniformLocation(s,"fogColor"),fogDepth:t.getUniformLocation(s,"fogDepth"),alphaTest:t.getUniformLocation(s,"alphaTest")};var r=document.createElementNS("http://www.w3.org/1999/xhtml","canvas");r.width=8,r.height=8;var u=r.getContext("2d");u.fillStyle="white",u.fillRect(0,0,8,8),l=new bi(r)}function m(e,t){return e.renderOrder!==t.renderOrder?e.renderOrder-t.renderOrder:e.z!==t.z?t.z-e.z:t.id-e.id}this.render=function(n,v,g){if(0!==n.length){void 0===s&&f(),i.useProgram(s),i.initAttributes(),i.enableAttribute(c.position),i.enableAttribute(c.uv),i.disableUnusedAttributes(),i.disable(t.CULL_FACE),i.enable(t.BLEND),t.bindBuffer(t.ARRAY_BUFFER,o),t.vertexAttribPointer(c.position,2,t.FLOAT,!1,16,0),t.vertexAttribPointer(c.uv,2,t.FLOAT,!1,16,8),t.bindBuffer(t.ELEMENT_ARRAY_BUFFER,a),t.uniformMatrix4fv(h.projectionMatrix,!1,g.projectionMatrix.elements),i.activeTexture(t.TEXTURE0),t.uniform1i(h.map,0);var y=0,x=0,b=v.fog;b?(t.uniform3f(h.fogColor,b.color.r,b.color.g,b.color.b),b.isFog?(t.uniform1f(h.fogNear,b.near),t.uniform1f(h.fogFar,b.far),t.uniform1i(h.fogType,1),y=1,x=1):b.isFogExp2&&(t.uniform1f(h.fogDensity,b.density),t.uniform1i(h.fogType,2),y=2,x=2)):(t.uniform1i(h.fogType,0),y=0,x=0);for(var w=0,_=n.length;w<_;w++){(E=n[w]).modelViewMatrix.multiplyMatrices(g.matrixWorldInverse,E.matrixWorld),E.z=-E.modelViewMatrix.elements[14]}n.sort(m);var M=[];for(w=0,_=n.length;w<_;w++){var E,T=(E=n[w]).material;if(!1!==T.visible){E.onBeforeRender(e,v,g,void 0,T,void 0),t.uniform1f(h.alphaTest,T.alphaTest),t.uniformMatrix4fv(h.modelViewMatrix,!1,E.modelViewMatrix.elements),E.matrixWorld.decompose(u,p,d),M[0]=d.x,M[1]=d.y;var S=0;v.fog&&T.fog&&(S=x),y!==S&&(t.uniform1i(h.fogType,S),y=S),null!==T.map?(t.uniform2f(h.uvOffset,T.map.offset.x,T.map.offset.y),t.uniform2f(h.uvScale,T.map.repeat.x,T.map.repeat.y)):(t.uniform2f(h.uvOffset,0,0),t.uniform2f(h.uvScale,1,1)),t.uniform1f(h.opacity,T.opacity),t.uniform3f(h.color,T.color.r,T.color.g,T.color.b),t.uniform1f(h.rotation,T.rotation),t.uniform2fv(h.scale,M),i.setBlending(T.blending,T.blendEquation,T.blendSrc,T.blendDst,T.blendEquationAlpha,T.blendSrcAlpha,T.blendDstAlpha,T.premultipliedAlpha),i.buffers.depth.setTest(T.depthTest),i.buffers.depth.setMask(T.depthWrite),i.buffers.color.setMask(T.colorWrite),r.setTexture2D(T.map||l,0),t.drawElements(t.TRIANGLES,6,t.UNSIGNED_SHORT,0),E.onAfterRender(e,v,g,void 0,T,void 0)}}i.enable(t.CULL_FACE),i.reset()}}}gi.physical={uniforms:mi.merge([gi.standard.uniforms,{clearCoat:{value:0},clearCoatRoughness:{value:0}}]),vertexShader:vi.meshphysical_vert,fragmentShader:vi.meshphysical_frag},Object.assign(yi.prototype,{set:function(e,t){return this.min.copy(e),this.max.copy(t),this},setFromPoints:function(e){this.makeEmpty();for(var t=0,i=e.length;tthis.max.x||e.ythis.max.y)},containsBox:function(e){return this.min.x<=e.min.x&&e.max.x<=this.max.x&&this.min.y<=e.min.y&&e.max.y<=this.max.y},getParameter:function(e,t){return(t||new mt).set((e.x-this.min.x)/(this.max.x-this.min.x),(e.y-this.min.y)/(this.max.y-this.min.y))},intersectsBox:function(e){return!(e.max.xthis.max.x||e.max.ythis.max.y)},clampPoint:function(e,t){return(t||new mt).copy(e).clamp(this.min,this.max)},distanceToPoint:function(){var e=new mt;return function(t){return e.copy(t).clamp(this.min,this.max).sub(t).length()}}(),intersect:function(e){return this.min.max(e.min),this.max.min(e.max),this},union:function(e){return this.min.min(e.min),this.max.max(e.max),this},translate:function(e){return this.min.add(e),this.max.add(e),this},equals:function(e){return e.min.equals(this.min)&&e.max.equals(this.max)}}),bi.prototype=Object.create(wt.prototype),bi.prototype.constructor=bi;var _i,Mi,Ei,Ti,Si,Ai,Ri,Li=0;function Ci(){Object.defineProperty(this,"id",{value:Li++}),this.uuid=ft.generateUUID(),this.name="",this.type="Material",this.fog=!0,this.lights=!0,this.blending=S,this.side=x,this.flatShading=!1,this.vertexColors=_,this.opacity=1,this.transparent=!1,this.blendSrc=k,this.blendDst=G,this.blendEquation=P,this.blendSrcAlpha=null,this.blendDstAlpha=null,this.blendEquationAlpha=null,this.depthFunc=J,this.depthTest=!0,this.depthWrite=!0,this.clippingPlanes=null,this.clipIntersection=!1,this.clipShadows=!1,this.colorWrite=!0,this.precision=null,this.polygonOffset=!1,this.polygonOffsetFactor=0,this.polygonOffsetUnits=0,this.dithering=!1,this.alphaTest=0,this.premultipliedAlpha=!1,this.overdraw=0,this.visible=!0,this.userData={},this.needsUpdate=!0}function Pi(e){Ci.call(this),this.type="MeshDepthMaterial",this.depthPacking=pt,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.lights=!1,this.setValues(e)}function Ni(e){Ci.call(this),this.type="MeshDistanceMaterial",this.referencePosition=new yt,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.lights=!1,this.setValues(e)}function Oi(e,t){this.min=void 0!==e?e:new yt(1/0,1/0,1/0),this.max=void 0!==t?t:new yt(-1/0,-1/0,-1/0)}function Ii(e,t){this.center=void 0!==e?e:new yt,this.radius=void 0!==t?t:0}function Di(e,t){this.normal=void 0!==e?e:new yt(1,0,0),this.constant=void 0!==t?t:0}function Ui(e,t,i,r,n,o){this.planes=[void 0!==e?e:new Di,void 0!==t?t:new Di,void 0!==i?i:new Di,void 0!==r?r:new Di,void 0!==n?n:new Di,void 0!==o?o:new Di]}function Fi(e,t,i){for(var r=new Ui,n=new vt,o=new mt,a=new mt(i,i),s=new yt,c=new yt,h=1,l=2,u=1+(h|l),p=new Array(u),d=new Array(u),f={},m=[new yt(1,0,0),new yt(-1,0,0),new yt(0,0,1),new yt(0,0,-1),new yt(0,1,0),new yt(0,-1,0)],v=[new yt(0,1,0),new yt(0,1,0),new yt(0,1,0),new yt(0,1,0),new yt(0,0,1),new yt(0,0,-1)],y=[new _t,new _t,new _t,new _t,new _t,new _t],_=0;_!==u;++_){var M=0!=(_&h),E=0!=(_&l),T=new Pi({depthPacking:dt,morphTargets:M,skinning:E});p[_]=T;var S=new Ni({morphTargets:M,skinning:E});d[_]=S}var A=this;function R(t,i,r,n,o,a){var s=t.geometry,c=null,u=p,m=t.customDepthMaterial;if(r&&(u=d,m=t.customDistanceMaterial),m)c=m;else{var v=!1;i.morphTargets&&(s&&s.isBufferGeometry?v=s.morphAttributes&&s.morphAttributes.position&&s.morphAttributes.position.length>0:s&&s.isGeometry&&(v=s.morphTargets&&s.morphTargets.length>0)),t.isSkinnedMesh&&!1===i.skinning&&console.warn("THREE.WebGLShadowMap: THREE.SkinnedMesh with material.skinning set to false:",t);var g=t.isSkinnedMesh&&i.skinning,y=0;v&&(y|=h),g&&(y|=l),c=u[y]}if(e.localClippingEnabled&&!0===i.clipShadows&&0!==i.clippingPlanes.length){var _=c.uuid,M=i.uuid,E=f[_];void 0===E&&(E={},f[_]=E);var T=E[M];void 0===T&&(T=c.clone(),E[M]=T),c=T}c.visible=i.visible,c.wireframe=i.wireframe;var S=i.side;return A.renderSingleSided&&S==w&&(S=x),A.renderReverseSided&&(S===x?S=b:S===b&&(S=x)),c.side=S,c.clipShadows=i.clipShadows,c.clippingPlanes=i.clippingPlanes,c.clipIntersection=i.clipIntersection,c.wireframeLinewidth=i.wireframeLinewidth,c.linewidth=i.linewidth,r&&c.isMeshDistanceMaterial&&(c.referencePosition.copy(n),c.nearDistance=o,c.farDistance=a),c}function L(i,n,o,a){if(!1!==i.visible){if(i.layers.test(n.layers)&&(i.isMesh||i.isLine||i.isPoints)&&i.castShadow&&(!i.frustumCulled||r.intersectsObject(i))){i.modelViewMatrix.multiplyMatrices(o.matrixWorldInverse,i.matrixWorld);var s=t.update(i),h=i.material;if(Array.isArray(h))for(var l=s.groups,u=0,p=l.length;u0&&(i.alphaTest=this.alphaTest),!0===this.premultipliedAlpha&&(i.premultipliedAlpha=this.premultipliedAlpha),!0===this.wireframe&&(i.wireframe=this.wireframe),this.wireframeLinewidth>1&&(i.wireframeLinewidth=this.wireframeLinewidth),"round"!==this.wireframeLinecap&&(i.wireframeLinecap=this.wireframeLinecap),"round"!==this.wireframeLinejoin&&(i.wireframeLinejoin=this.wireframeLinejoin),!0===this.morphTargets&&(i.morphTargets=!0),!0===this.skinning&&(i.skinning=!0),!1===this.visible&&(i.visible=!1),"{}"!==JSON.stringify(this.userData)&&(i.userData=this.userData),t){var n=r(e.textures),o=r(e.images);n.length>0&&(i.textures=n),o.length>0&&(i.images=o)}return i},clone:function(){return(new this.constructor).copy(this)},copy:function(e){this.name=e.name,this.fog=e.fog,this.lights=e.lights,this.blending=e.blending,this.side=e.side,this.flatShading=e.flatShading,this.vertexColors=e.vertexColors,this.opacity=e.opacity,this.transparent=e.transparent,this.blendSrc=e.blendSrc,this.blendDst=e.blendDst,this.blendEquation=e.blendEquation,this.blendSrcAlpha=e.blendSrcAlpha,this.blendDstAlpha=e.blendDstAlpha,this.blendEquationAlpha=e.blendEquationAlpha,this.depthFunc=e.depthFunc,this.depthTest=e.depthTest,this.depthWrite=e.depthWrite,this.colorWrite=e.colorWrite,this.precision=e.precision,this.polygonOffset=e.polygonOffset,this.polygonOffsetFactor=e.polygonOffsetFactor,this.polygonOffsetUnits=e.polygonOffsetUnits,this.dithering=e.dithering,this.alphaTest=e.alphaTest,this.premultipliedAlpha=e.premultipliedAlpha,this.overdraw=e.overdraw,this.visible=e.visible,this.userData=JSON.parse(JSON.stringify(e.userData)),this.clipShadows=e.clipShadows,this.clipIntersection=e.clipIntersection;var t=e.clippingPlanes,i=null;if(null!==t){var r=t.length;i=new Array(r);for(var n=0;n!==r;++n)i[n]=t[n].clone()}return this.clippingPlanes=i,this},dispose:function(){this.dispatchEvent({type:"dispose"})}}),Pi.prototype=Object.create(Ci.prototype),Pi.prototype.constructor=Pi,Pi.prototype.isMeshDepthMaterial=!0,Pi.prototype.copy=function(e){return Ci.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},Ni.prototype=Object.create(Ci.prototype),Ni.prototype.constructor=Ni,Ni.prototype.isMeshDistanceMaterial=!0,Ni.prototype.copy=function(e){return Ci.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},Object.assign(Oi.prototype,{isBox3:!0,set:function(e,t){return this.min.copy(e),this.max.copy(t),this},setFromArray:function(e){for(var t=1/0,i=1/0,r=1/0,n=-1/0,o=-1/0,a=-1/0,s=0,c=e.length;sn&&(n=h),l>o&&(o=l),u>a&&(a=u)}return this.min.set(t,i,r),this.max.set(n,o,a),this},setFromBufferAttribute:function(e){for(var t=1/0,i=1/0,r=1/0,n=-1/0,o=-1/0,a=-1/0,s=0,c=e.count;sn&&(n=h),l>o&&(o=l),u>a&&(a=u)}return this.min.set(t,i,r),this.max.set(n,o,a),this},setFromPoints:function(e){this.makeEmpty();for(var t=0,i=e.length;tthis.max.x||e.ythis.max.y||e.zthis.max.z)},containsBox:function(e){return this.min.x<=e.min.x&&e.max.x<=this.max.x&&this.min.y<=e.min.y&&e.max.y<=this.max.y&&this.min.z<=e.min.z&&e.max.z<=this.max.z},getParameter:function(e,t){return(t||new yt).set((e.x-this.min.x)/(this.max.x-this.min.x),(e.y-this.min.y)/(this.max.y-this.min.y),(e.z-this.min.z)/(this.max.z-this.min.z))},intersectsBox:function(e){return!(e.max.xthis.max.x||e.max.ythis.max.y||e.max.zthis.max.z)},intersectsSphere:(Mi=new yt,function(e){return this.clampPoint(e.center,Mi),Mi.distanceToSquared(e.center)<=e.radius*e.radius}),intersectsPlane:function(e){var t,i;return e.normal.x>0?(t=e.normal.x*this.min.x,i=e.normal.x*this.max.x):(t=e.normal.x*this.max.x,i=e.normal.x*this.min.x),e.normal.y>0?(t+=e.normal.y*this.min.y,i+=e.normal.y*this.max.y):(t+=e.normal.y*this.max.y,i+=e.normal.y*this.min.y),e.normal.z>0?(t+=e.normal.z*this.min.z,i+=e.normal.z*this.max.z):(t+=e.normal.z*this.max.z,i+=e.normal.z*this.min.z),t<=e.constant&&i>=e.constant},clampPoint:function(e,t){return(t||new yt).copy(e).clamp(this.min,this.max)},distanceToPoint:function(){var e=new yt;return function(t){return e.copy(t).clamp(this.min,this.max).sub(t).length()}}(),getBoundingSphere:function(){var e=new yt;return function(t){var i=t||new Ii;return this.getCenter(i.center),i.radius=.5*this.getSize(e).length(),i}}(),intersect:function(e){return this.min.max(e.min),this.max.min(e.max),this.isEmpty()&&this.makeEmpty(),this},union:function(e){return this.min.min(e.min),this.max.max(e.max),this},applyMatrix4:(_i=[new yt,new yt,new yt,new yt,new yt,new yt,new yt,new yt],function(e){return this.isEmpty()?this:(_i[0].set(this.min.x,this.min.y,this.min.z).applyMatrix4(e),_i[1].set(this.min.x,this.min.y,this.max.z).applyMatrix4(e),_i[2].set(this.min.x,this.max.y,this.min.z).applyMatrix4(e),_i[3].set(this.min.x,this.max.y,this.max.z).applyMatrix4(e),_i[4].set(this.max.x,this.min.y,this.min.z).applyMatrix4(e),_i[5].set(this.max.x,this.min.y,this.max.z).applyMatrix4(e),_i[6].set(this.max.x,this.max.y,this.min.z).applyMatrix4(e),_i[7].set(this.max.x,this.max.y,this.max.z).applyMatrix4(e),this.setFromPoints(_i),this)}),translate:function(e){return this.min.add(e),this.max.add(e),this},equals:function(e){return e.min.equals(this.min)&&e.max.equals(this.max)}}),Object.assign(Ii.prototype,{set:function(e,t){return this.center.copy(e),this.radius=t,this},setFromPoints:(Ei=new Oi,function(e,t){var i=this.center;void 0!==t?i.copy(t):Ei.setFromPoints(e).getCenter(i);for(var r=0,n=0,o=e.length;nthis.radius*this.radius&&(r.sub(this.center).normalize(),r.multiplyScalar(this.radius).add(this.center)),r},getBoundingBox:function(e){var t=e||new Oi;return t.set(this.center,this.center),t.expandByScalar(this.radius),t},applyMatrix4:function(e){return this.center.applyMatrix4(e),this.radius=this.radius*e.getMaxScaleOnAxis(),this},translate:function(e){return this.center.add(e),this},equals:function(e){return e.center.equals(this.center)&&e.radius===this.radius}}),Object.assign(Di.prototype,{set:function(e,t){return this.normal.copy(e),this.constant=t,this},setComponents:function(e,t,i,r){return this.normal.set(e,t,i),this.constant=r,this},setFromNormalAndCoplanarPoint:function(e,t){return this.normal.copy(e),this.constant=-t.dot(this.normal),this},setFromCoplanarPoints:function(){var e=new yt,t=new yt;return function(i,r,n){var o=e.subVectors(n,r).cross(t.subVectors(i,r)).normalize();return this.setFromNormalAndCoplanarPoint(o,i),this}}(),clone:function(){return(new this.constructor).copy(this)},copy:function(e){return this.normal.copy(e.normal),this.constant=e.constant,this},normalize:function(){var e=1/this.normal.length();return this.normal.multiplyScalar(e),this.constant*=e,this},negate:function(){return this.constant*=-1,this.normal.negate(),this},distanceToPoint:function(e){return this.normal.dot(e)+this.constant},distanceToSphere:function(e){return this.distanceToPoint(e.center)-e.radius},projectPoint:function(e,t){return(t||new yt).copy(this.normal).multiplyScalar(-this.distanceToPoint(e)).add(e)},intersectLine:function(){var e=new yt;return function(t,i){var r=i||new yt,n=t.delta(e),o=this.normal.dot(n);if(0===o)return 0===this.distanceToPoint(t.start)?r.copy(t.start):void 0;var a=-(t.start.dot(this.normal)+this.constant)/o;return a<0||a>1?void 0:r.copy(n).multiplyScalar(a).add(t.start)}}(),intersectsLine:function(e){var t=this.distanceToPoint(e.start),i=this.distanceToPoint(e.end);return t<0&&i>0||i<0&&t>0},intersectsBox:function(e){return e.intersectsPlane(this)},intersectsSphere:function(e){return e.intersectsPlane(this)},coplanarPoint:function(e){return(e||new yt).copy(this.normal).multiplyScalar(-this.constant)},applyMatrix4:function(){var e=new yt,t=new xt;return function(i,r){var n=r||t.getNormalMatrix(i),o=this.coplanarPoint(e).applyMatrix4(i),a=this.normal.applyMatrix3(n).normalize();return this.constant=-o.dot(a),this}}(),translate:function(e){return this.constant-=e.dot(this.normal),this},equals:function(e){return e.normal.equals(this.normal)&&e.constant===this.constant}}),Object.assign(Ui.prototype,{set:function(e,t,i,r,n,o){var a=this.planes;return a[0].copy(e),a[1].copy(t),a[2].copy(i),a[3].copy(r),a[4].copy(n),a[5].copy(o),this},clone:function(){return(new this.constructor).copy(this)},copy:function(e){for(var t=this.planes,i=0;i<6;i++)t[i].copy(e.planes[i]);return this},setFromMatrix:function(e){var t=this.planes,i=e.elements,r=i[0],n=i[1],o=i[2],a=i[3],s=i[4],c=i[5],h=i[6],l=i[7],u=i[8],p=i[9],d=i[10],f=i[11],m=i[12],v=i[13],g=i[14],y=i[15];return t[0].setComponents(a-r,l-s,f-u,y-m).normalize(),t[1].setComponents(a+r,l+s,f+u,y+m).normalize(),t[2].setComponents(a+n,l+c,f+p,y+v).normalize(),t[3].setComponents(a-n,l-c,f-p,y-v).normalize(),t[4].setComponents(a-o,l-h,f-d,y-g).normalize(),t[5].setComponents(a+o,l+h,f+d,y+g).normalize(),this},intersectsObject:(Ai=new Ii,function(e){var t=e.geometry;return null===t.boundingSphere&&t.computeBoundingSphere(),Ai.copy(t.boundingSphere).applyMatrix4(e.matrixWorld),this.intersectsSphere(Ai)}),intersectsSprite:function(){var e=new Ii;return function(t){return e.center.set(0,0,0),e.radius=.7071067811865476,e.applyMatrix4(t.matrixWorld),this.intersectsSphere(e)}}(),intersectsSphere:function(e){for(var t=this.planes,i=e.center,r=-e.radius,n=0;n<6;n++){if(t[n].distanceToPoint(i)0?e.min.x:e.max.x,Si.x=r.normal.x>0?e.max.x:e.min.x,Ti.y=r.normal.y>0?e.min.y:e.max.y,Si.y=r.normal.y>0?e.max.y:e.min.y,Ti.z=r.normal.z>0?e.min.z:e.max.z,Si.z=r.normal.z>0?e.max.z:e.min.z;var n=r.distanceToPoint(Ti),o=r.distanceToPoint(Si);if(n<0&&o<0)return!1}return!0}),containsPoint:function(e){for(var t=this.planes,i=0;i<6;i++)if(t[i].distanceToPoint(e)<0)return!1;return!0}}),zi.RotationOrders=["XYZ","YZX","ZXY","XZY","YXZ","ZYX"],zi.DefaultOrder="XYZ",Object.defineProperties(zi.prototype,{x:{get:function(){return this._x},set:function(e){this._x=e,this.onChangeCallback()}},y:{get:function(){return this._y},set:function(e){this._y=e,this.onChangeCallback()}},z:{get:function(){return this._z},set:function(e){this._z=e,this.onChangeCallback()}},order:{get:function(){return this._order},set:function(e){this._order=e,this.onChangeCallback()}}}),Object.assign(zi.prototype,{isEuler:!0,set:function(e,t,i,r){return this._x=e,this._y=t,this._z=i,this._order=r||this._order,this.onChangeCallback(),this},clone:function(){return new this.constructor(this._x,this._y,this._z,this._order)},copy:function(e){return this._x=e._x,this._y=e._y,this._z=e._z,this._order=e._order,this.onChangeCallback(),this},setFromRotationMatrix:function(e,t,i){var r=ft.clamp,n=e.elements,o=n[0],a=n[4],s=n[8],c=n[1],h=n[5],l=n[9],u=n[2],p=n[6],d=n[10];return"XYZ"===(t=t||this._order)?(this._y=Math.asin(r(s,-1,1)),Math.abs(s)<.99999?(this._x=Math.atan2(-l,d),this._z=Math.atan2(-a,o)):(this._x=Math.atan2(p,h),this._z=0)):"YXZ"===t?(this._x=Math.asin(-r(l,-1,1)),Math.abs(l)<.99999?(this._y=Math.atan2(s,d),this._z=Math.atan2(c,h)):(this._y=Math.atan2(-u,o),this._z=0)):"ZXY"===t?(this._x=Math.asin(r(p,-1,1)),Math.abs(p)<.99999?(this._y=Math.atan2(-u,d),this._z=Math.atan2(-a,h)):(this._y=0,this._z=Math.atan2(c,o))):"ZYX"===t?(this._y=Math.asin(-r(u,-1,1)),Math.abs(u)<.99999?(this._x=Math.atan2(p,d),this._z=Math.atan2(c,o)):(this._x=0,this._z=Math.atan2(-a,h))):"YZX"===t?(this._z=Math.asin(r(c,-1,1)),Math.abs(c)<.99999?(this._x=Math.atan2(-l,h),this._y=Math.atan2(-u,o)):(this._x=0,this._y=Math.atan2(s,d))):"XZY"===t?(this._z=Math.asin(-r(a,-1,1)),Math.abs(a)<.99999?(this._x=Math.atan2(p,h),this._y=Math.atan2(s,o)):(this._x=Math.atan2(-l,d),this._y=0)):console.warn("THREE.Euler: .setFromRotationMatrix() given unsupported order: "+t),this._order=t,!1!==i&&this.onChangeCallback(),this},setFromQuaternion:function(){var e=new vt;return function(t,i,r){return e.makeRotationFromQuaternion(t),this.setFromRotationMatrix(e,i,r)}}(),setFromVector3:function(e,t){return this.set(e.x,e.y,e.z,t||this._order)},reorder:(Ri=new gt,function(e){return Ri.setFromEuler(this),this.setFromQuaternion(Ri,e)}),equals:function(e){return e._x===this._x&&e._y===this._y&&e._z===this._z&&e._order===this._order},fromArray:function(e){return this._x=e[0],this._y=e[1],this._z=e[2],void 0!==e[3]&&(this._order=e[3]),this.onChangeCallback(),this},toArray:function(e,t){return void 0===e&&(e=[]),void 0===t&&(t=0),e[t]=this._x,e[t+1]=this._y,e[t+2]=this._z,e[t+3]=this._order,e},toVector3:function(e){return e?e.set(this._x,this._y,this._z):new yt(this._x,this._y,this._z)},onChange:function(e){return this.onChangeCallback=e,this},onChangeCallback:function(){}}),Object.assign(ki.prototype,{set:function(e){this.mask=1<1){for(var t=0;t1){for(var t=0;t0){r.children=[];for(s=0;s0&&(i.geometries=u),p.length>0&&(i.materials=p),d.length>0&&(i.textures=d),f.length>0&&(i.images=f),a.length>0&&(i.shapes=a)}return i.object=r,i;function m(e){var t=[];for(var i in e){var r=e[i];delete r.metadata,t.push(r)}return t}},clone:function(e){return(new this.constructor).copy(this,e)},copy:function(e,t){if(void 0===t&&(t=!0),this.name=e.name,this.up.copy(e.up),this.position.copy(e.position),this.quaternion.copy(e.quaternion),this.scale.copy(e.scale),this.matrix.copy(e.matrix),this.matrixWorld.copy(e.matrixWorld),this.matrixAutoUpdate=e.matrixAutoUpdate,this.matrixWorldNeedsUpdate=e.matrixWorldNeedsUpdate,this.layers.mask=e.layers.mask,this.visible=e.visible,this.castShadow=e.castShadow,this.receiveShadow=e.receiveShadow,this.frustumCulled=e.frustumCulled,this.renderOrder=e.renderOrder,this.userData=JSON.parse(JSON.stringify(e.userData)),!0===t)for(var i=0;it&&(t=e[i]);return t}Ki.prototype=Object.assign(Object.create(i.prototype),{constructor:Ki,isGeometry:!0,applyMatrix:function(e){for(var t=(new xt).getNormalMatrix(e),i=0,r=this.vertices.length;i0)for(p=0;p0&&(this.normalsNeedUpdate=!0)},computeFlatVertexNormals:function(){var e,t,i;for(this.computeFaceNormals(),e=0,t=this.faces.length;e0&&(this.normalsNeedUpdate=!0)},computeMorphNormals:function(){var e,t,i,r,n;for(i=0,r=this.faces.length;i0&&(e+=t[i].distanceTo(t[i-1])),this.lineDistances[i]=e},computeBoundingBox:function(){null===this.boundingBox&&(this.boundingBox=new Oi),this.boundingBox.setFromPoints(this.vertices)},computeBoundingSphere:function(){null===this.boundingSphere&&(this.boundingSphere=new Ii),this.boundingSphere.setFromPoints(this.vertices)},merge:function(e,t,i){if(e&&e.isGeometry){var r,n=this.vertices.length,o=this.vertices,a=e.vertices,s=this.faces,c=e.faces,h=this.faceVertexUvs[0],l=e.faceVertexUvs[0],u=this.colors,p=e.colors;void 0===i&&(i=0),void 0!==t&&(r=(new xt).getNormalMatrix(t));for(var d=0,f=a.length;d=0;i--){var f=p[i];for(this.faces.splice(f,1),a=0,s=this.faceVertexUvs.length;a0,v=d.vertexNormals.length>0,g=1!==d.color.r||1!==d.color.g||1!==d.color.b,y=d.vertexColors.length>0,x=0;if(x=M(x=M(x=M(x=M(x=M(x=M(x=M(x=M(x,0,0),1,!0),2,!1),3,f),4,m),5,v),6,g),7,y),a.push(x),a.push(d.a,d.b,d.c),a.push(d.materialIndex),f){var b=this.faceVertexUvs[0][n];a.push(S(b[0]),S(b[1]),S(b[2]))}if(m&&a.push(E(d.normal)),v){var w=d.vertexNormals;a.push(E(w[0]),E(w[1]),E(w[2]))}if(g&&a.push(T(d.color)),y){var _=d.vertexColors;a.push(T(_[0]),T(_[1]),T(_[2]))}}function M(e,t,i){return i?e|1<0&&(e.data.colors=h),u.length>0&&(e.data.uvs=[u]),e.data.faces=a,e},clone:function(){return(new Ki).copy(this)},copy:function(e){var t,i,r,n,o,a;this.vertices=[],this.colors=[],this.faces=[],this.faceVertexUvs=[[]],this.morphTargets=[],this.morphNormals=[],this.skinWeights=[],this.skinIndices=[],this.lineDistances=[],this.boundingBox=null,this.boundingSphere=null,this.name=e.name;var s=e.vertices;for(t=0,i=s.length;t0,a=n[1]&&n[1].length>0,s=e.morphTargets,c=s.length;if(c>0){t=[];for(var h=0;h0){l=[];for(h=0;h0?1:-1,h.push(L.x,L.y,L.z),l.push(y/m),l.push(1-x/v),A+=1}}for(x=0;x1&&i.sort(Cr),r.length>1&&r.sort(Pr)}}},e[r]=n),n},dispose:function(){e={}}}}function Or(e,t){return Math.abs(t[1])-Math.abs(e[1])}function Ir(){var e=new function(){var e={};return{get:function(t){if(void 0!==e[t.id])return e[t.id];var i;switch(t.type){case"DirectionalLight":i={direction:new yt,color:new di,shadow:!1,shadowBias:0,shadowRadius:1,shadowMapSize:new mt};break;case"SpotLight":i={position:new yt,direction:new yt,color:new di,distance:0,coneCos:0,penumbraCos:0,decay:0,shadow:!1,shadowBias:0,shadowRadius:1,shadowMapSize:new mt};break;case"PointLight":i={position:new yt,color:new di,distance:0,decay:0,shadow:!1,shadowBias:0,shadowRadius:1,shadowMapSize:new mt,shadowCameraNear:1,shadowCameraFar:1e3};break;case"HemisphereLight":i={direction:new yt,skyColor:new di,groundColor:new di};break;case"RectAreaLight":i={color:new di,position:new yt,halfWidth:new yt,halfHeight:new yt}}return e[t.id]=i,i}}},t={hash:"",ambient:[0,0,0],directional:[],directionalShadowMap:[],directionalShadowMatrix:[],spot:[],spotShadowMap:[],spotShadowMatrix:[],rectArea:[],point:[],pointShadowMap:[],pointShadowMatrix:[],hemi:[]},i=new yt,r=new vt,n=new vt;return{setup:function(o,a,s){for(var c=0,h=0,l=0,u=0,p=0,d=0,f=0,m=0,v=s.matrixWorldInverse,g=0,y=o.length;g65535?ar:nr)(e,1):this.index=e},addAttribute:function(e,t){return t&&t.isBufferAttribute||t&&t.isInterleavedBufferAttribute?"index"===e?(console.warn("THREE.BufferGeometry.addAttribute: Use .setIndex() for index attribute."),void this.setIndex(t)):(this.attributes[e]=t,this):(console.warn("THREE.BufferGeometry: .addAttribute() now expects ( name, attribute )."),void this.addAttribute(e,new $i(arguments[1],arguments[2])))},getAttribute:function(e){return this.attributes[e]},removeAttribute:function(e){return delete this.attributes[e],this},addGroup:function(e,t,i){this.groups.push({start:e,count:t,materialIndex:void 0!==i?i:0})},clearGroups:function(){this.groups=[]},setDrawRange:function(e,t){this.drawRange.start=e,this.drawRange.count=t},applyMatrix:function(e){var t=this.attributes.position;void 0!==t&&(e.applyToBufferAttribute(t),t.needsUpdate=!0);var i=this.attributes.normal;void 0!==i&&((new xt).getNormalMatrix(e).applyToBufferAttribute(i),i.needsUpdate=!0);return null!==this.boundingBox&&this.computeBoundingBox(),null!==this.boundingSphere&&this.computeBoundingSphere(),this},rotateX:function(){var e=new vt;return function(t){return e.makeRotationX(t),this.applyMatrix(e),this}}(),rotateY:function(){var e=new vt;return function(t){return e.makeRotationY(t),this.applyMatrix(e),this}}(),rotateZ:function(){var e=new vt;return function(t){return e.makeRotationZ(t),this.applyMatrix(e),this}}(),translate:function(){var e=new vt;return function(t,i,r){return e.makeTranslation(t,i,r),this.applyMatrix(e),this}}(),scale:function(){var e=new vt;return function(t,i,r){return e.makeScale(t,i,r),this.applyMatrix(e),this}}(),lookAt:function(){var e=new Xi;return function(t){e.lookAt(t),e.updateMatrix(),this.applyMatrix(e.matrix)}}(),center:function(){this.computeBoundingBox();var e=this.boundingBox.getCenter().negate();return this.translate(e.x,e.y,e.z),e},setFromObject:function(e){var t=e.geometry;if(e.isPoints||e.isLine){var i=new sr(3*t.vertices.length,3),r=new sr(3*t.colors.length,3);if(this.addAttribute("position",i.copyVector3sArray(t.vertices)),this.addAttribute("color",r.copyColorsArray(t.colors)),t.lineDistances&&t.lineDistances.length===t.vertices.length){var n=new sr(t.lineDistances.length,1);this.addAttribute("lineDistance",n.copyArray(t.lineDistances))}null!==t.boundingSphere&&(this.boundingSphere=t.boundingSphere.clone()),null!==t.boundingBox&&(this.boundingBox=t.boundingBox.clone())}else e.isMesh&&t&&t.isGeometry&&this.fromGeometry(t);return this},setFromPoints:function(e){for(var t=[],i=0,r=e.length;i0){var i=new Float32Array(3*e.normals.length);this.addAttribute("normal",new $i(i,3).copyVector3sArray(e.normals))}if(e.colors.length>0){var r=new Float32Array(3*e.colors.length);this.addAttribute("color",new $i(r,3).copyColorsArray(e.colors))}if(e.uvs.length>0){var n=new Float32Array(2*e.uvs.length);this.addAttribute("uv",new $i(n,2).copyVector2sArray(e.uvs))}if(e.uvs2.length>0){var o=new Float32Array(2*e.uvs2.length);this.addAttribute("uv2",new $i(o,2).copyVector2sArray(e.uvs2))}if(e.indices.length>0){var a=new(lr(e.indices)>65535?Uint32Array:Uint16Array)(3*e.indices.length);this.setIndex(new $i(a,1).copyIndicesArray(e.indices))}for(var s in this.groups=e.groups,e.morphTargets){for(var c=[],h=e.morphTargets[s],l=0,u=h.length;l0){var f=new sr(4*e.skinIndices.length,4);this.addAttribute("skinIndex",f.copyVector4sArray(e.skinIndices))}if(e.skinWeights.length>0){var m=new sr(4*e.skinWeights.length,4);this.addAttribute("skinWeight",m.copyVector4sArray(e.skinWeights))}return null!==e.boundingSphere&&(this.boundingSphere=e.boundingSphere.clone()),null!==e.boundingBox&&(this.boundingBox=e.boundingBox.clone()),this},computeBoundingBox:function(){null===this.boundingBox&&(this.boundingBox=new Oi);var e=this.attributes.position;void 0!==e?this.boundingBox.setFromBufferAttribute(e):this.boundingBox.makeEmpty(),(isNaN(this.boundingBox.min.x)||isNaN(this.boundingBox.min.y)||isNaN(this.boundingBox.min.z))&&console.error('THREE.BufferGeometry.computeBoundingBox: Computed min/max have NaN values. The "position" attribute is likely to have NaN values.',this)},computeBoundingSphere:function(){var e=new Oi,t=new yt;return function(){null===this.boundingSphere&&(this.boundingSphere=new Ii);var i=this.attributes.position;if(i){var r=this.boundingSphere.center;e.setFromBufferAttribute(i),e.getCenter(r);for(var n=0,o=0,a=i.count;o0&&(e.data.groups=JSON.parse(JSON.stringify(s)));var c=this.boundingSphere;return null!==c&&(e.data.boundingSphere={center:c.center.toArray(),radius:c.radius}),e},clone:function(){return(new xr).copy(this)},copy:function(e){var t,i,r;this.index=null,this.attributes={},this.morphAttributes={},this.groups=[],this.boundingBox=null,this.boundingSphere=null,this.name=e.name;var n=e.index;null!==n&&this.setIndex(n.clone());var o=e.attributes;for(t in o){var a=o[t];this.addAttribute(t,a.clone())}var s=e.morphAttributes;for(t in s){var c=[],h=s[t];for(i=0,r=h.length;i0)if(o=h*l-u,s=c*d,(n=h*u-l)>=0)if(o>=-s)if(o<=s){var f=1/d;a=(n*=f)*(n+h*(o*=f)+2*l)+o*(h*n+o+2*u)+p}else o=c,a=-(n=Math.max(0,-(h*o+l)))*n+o*(o+2*u)+p;else o=-c,a=-(n=Math.max(0,-(h*o+l)))*n+o*(o+2*u)+p;else o<=-s?a=-(n=Math.max(0,-(-h*c+l)))*n+(o=n>0?-c:Math.min(Math.max(-c,-u),c))*(o+2*u)+p:o<=s?(n=0,a=(o=Math.min(Math.max(-c,-u),c))*(o+2*u)+p):a=-(n=Math.max(0,-(h*c+l)))*n+(o=n>0?c:Math.min(Math.max(-c,-u),c))*(o+2*u)+p;else o=h>0?-c:c,a=-(n=Math.max(0,-(h*o+l)))*n+o*(o+2*u)+p;return i&&i.copy(this.direction).multiplyScalar(n).add(this.origin),r&&r.copy(dr).multiplyScalar(o).add(pr),a}),intersectSphere:function(){var e=new yt;return function(t,i){e.subVectors(t.center,this.origin);var r=e.dot(this.direction),n=e.dot(e)-r*r,o=t.radius*t.radius;if(n>o)return null;var a=Math.sqrt(o-n),s=r-a,c=r+a;return s<0&&c<0?null:s<0?this.at(c,i):this.at(s,i)}}(),intersectsSphere:function(e){return this.distanceToPoint(e.center)<=e.radius},distanceToPlane:function(e){var t=e.normal.dot(this.direction);if(0===t)return 0===e.distanceToPoint(this.origin)?0:null;var i=-(this.origin.dot(e.normal)+e.constant)/t;return i>=0?i:null},intersectPlane:function(e,t){var i=this.distanceToPlane(e);return null===i?null:this.at(i,t)},intersectsPlane:function(e){var t=e.distanceToPoint(this.origin);return 0===t||e.normal.dot(this.direction)*t<0},intersectBox:function(e,t){var i,r,n,o,a,s,c=1/this.direction.x,h=1/this.direction.y,l=1/this.direction.z,u=this.origin;return c>=0?(i=(e.min.x-u.x)*c,r=(e.max.x-u.x)*c):(i=(e.max.x-u.x)*c,r=(e.min.x-u.x)*c),h>=0?(n=(e.min.y-u.y)*h,o=(e.max.y-u.y)*h):(n=(e.max.y-u.y)*h,o=(e.min.y-u.y)*h),i>o||n>r?null:((n>i||i!=i)&&(i=n),(o=0?(a=(e.min.z-u.z)*l,s=(e.max.z-u.z)*l):(a=(e.max.z-u.z)*l,s=(e.min.z-u.z)*l),i>s||a>r?null:((a>i||i!=i)&&(i=a),(s=0?i:r,t)))},intersectsBox:(ur=new yt,function(e){return null!==this.intersectBox(e,ur)}),intersectTriangle:function(){var e=new yt,t=new yt,i=new yt,r=new yt;return function(n,o,a,s,c){t.subVectors(o,n),i.subVectors(a,n),r.crossVectors(t,i);var h,l=this.direction.dot(r);if(l>0){if(s)return null;h=1}else{if(!(l<0))return null;h=-1,l=-l}e.subVectors(this.origin,n);var u=h*this.direction.dot(i.crossVectors(e,i));if(u<0)return null;var p=h*this.direction.dot(t.cross(e));if(p<0)return null;if(u+p>l)return null;var d=-h*e.dot(r);return d<0?null:this.at(d/l,c)}}(),applyMatrix4:function(e){return this.origin.applyMatrix4(e),this.direction.transformDirection(e),this},equals:function(e){return e.origin.equals(this.origin)&&e.direction.equals(this.direction)}}),Object.assign(Ar.prototype,{set:function(e,t){return this.start.copy(e),this.end.copy(t),this},clone:function(){return(new this.constructor).copy(this)},copy:function(e){return this.start.copy(e.start),this.end.copy(e.end),this},getCenter:function(e){return(e||new yt).addVectors(this.start,this.end).multiplyScalar(.5)},delta:function(e){return(e||new yt).subVectors(this.end,this.start)},distanceSq:function(){return this.start.distanceToSquared(this.end)},distance:function(){return this.start.distanceTo(this.end)},at:function(e,t){var i=t||new yt;return this.delta(i).multiplyScalar(e).add(this.start)},closestPointToPointParameter:(mr=new yt,vr=new yt,function(e,t){mr.subVectors(e,this.start),vr.subVectors(this.end,this.start);var i=vr.dot(vr),r=vr.dot(mr)/i;return t&&(r=ft.clamp(r,0,1)),r}),closestPointToPoint:function(e,t,i){var r=this.closestPointToPointParameter(e,t),n=i||new yt;return this.delta(n).multiplyScalar(r).add(this.start)},applyMatrix4:function(e){return this.start.applyMatrix4(e),this.end.applyMatrix4(e),this},equals:function(e){return e.start.equals(this.start)&&e.end.equals(this.end)}}),Object.assign(Rr,{normal:(gr=new yt,function(e,t,i,r){var n=r||new yt;n.subVectors(i,t),gr.subVectors(e,t),n.cross(gr);var o=n.lengthSq();return o>0?n.multiplyScalar(1/Math.sqrt(o)):n.set(0,0,0)}),barycoordFromPoint:function(){var e=new yt,t=new yt,i=new yt;return function(r,n,o,a,s){e.subVectors(a,n),t.subVectors(o,n),i.subVectors(r,n);var c=e.dot(e),h=e.dot(t),l=e.dot(i),u=t.dot(t),p=t.dot(i),d=c*u-h*h,f=s||new yt;if(0===d)return f.set(-2,-1,-1);var m=1/d,v=(u*l-h*p)*m,g=(c*p-h*l)*m;return f.set(1-v-g,g,v)}}(),containsPoint:function(){var e=new yt;return function(t,i,r,n){var o=Rr.barycoordFromPoint(t,i,r,n,e);return o.x>=0&&o.y>=0&&o.x+o.y<=1}}()}),Object.assign(Rr.prototype,{set:function(e,t,i){return this.a.copy(e),this.b.copy(t),this.c.copy(i),this},setFromPointsAndIndices:function(e,t,i,r){return this.a.copy(e[t]),this.b.copy(e[i]),this.c.copy(e[r]),this},clone:function(){return(new this.constructor).copy(this)},copy:function(e){return this.a.copy(e.a),this.b.copy(e.b),this.c.copy(e.c),this},area:function(){var e=new yt,t=new yt;return function(){return e.subVectors(this.c,this.b),t.subVectors(this.a,this.b),.5*e.cross(t).length()}}(),midpoint:function(e){return(e||new yt).addVectors(this.a,this.b).add(this.c).multiplyScalar(1/3)},normal:function(e){return Rr.normal(this.a,this.b,this.c,e)},plane:function(e){return(e||new Di).setFromCoplanarPoints(this.a,this.b,this.c)},barycoordFromPoint:function(e,t){return Rr.barycoordFromPoint(e,this.a,this.b,this.c,t)},containsPoint:function(e){return Rr.containsPoint(e,this.a,this.b,this.c)},closestPointToPoint:function(){var e=new Di,t=[new Ar,new Ar,new Ar],i=new yt,r=new yt;return function(n,o){var a=o||new yt,s=1/0;if(e.setFromCoplanarPoints(this.a,this.b,this.c),e.projectPoint(n,i),!0===this.containsPoint(i))a.copy(i);else{t[0].set(this.a,this.b),t[1].set(this.b,this.c),t[2].set(this.c,this.a);for(var c=0;c0){var a=n[o[0]];if(void 0!==a)for(this.morphTargetInfluences=[],this.morphTargetDictionary={},e=0,t=a.length;e0)for(this.morphTargetInfluences=[],this.morphTargetDictionary={},e=0,t=s.length;ei.far?null:{distance:c,point:f.clone(),object:e}}function g(e,t,i,a,s,c,p,f){r.fromBufferAttribute(a,c),n.fromBufferAttribute(a,p),o.fromBufferAttribute(a,f);var g=v(e,e.material,t,i,r,n,o,d);return g&&(s&&(h.fromBufferAttribute(s,c),l.fromBufferAttribute(s,p),u.fromBufferAttribute(s,f),g.uv=m(d,r,n,o,h,l,u)),g.face=new Zi(c,p,f,Rr.normal(r,n,o)),g.faceIndex=c),g}return function(p,f){var y,x=this.geometry,b=this.material,w=this.matrixWorld;if(void 0!==b&&(null===x.boundingSphere&&x.computeBoundingSphere(),i.copy(x.boundingSphere),i.applyMatrix4(w),!1!==p.ray.intersectsSphere(i)&&(e.getInverse(w),t.copy(p.ray).applyMatrix4(e),null===x.boundingBox||!1!==t.intersectsBox(x.boundingBox))))if(x.isBufferGeometry){var _,M,E,T,S,A=x.index,R=x.attributes.position,L=x.attributes.uv;if(null!==A)for(T=0,S=A.count;T0&&(O=F);for(var B=0,z=U.length;B/gm,function(e,t){var i=vi[t];if(void 0===i)throw new Error("Can not resolve #include <"+t+">");return qr(i)})}function Yr(e){return e.replace(/for \( int i \= (\d+)\; i < (\d+)\; i \+\+ \) \{([\s\S]+?)(?=\})\}/g,function(e,t,i,r){for(var n="",o=parseInt(t);o0?e.gammaFactor:1,_=function(e,t,i){return[(e=e||{}).derivatives||t.envMapCubeUV||t.bumpMap||t.normalMap||t.flatShading?"#extension GL_OES_standard_derivatives : enable":"",(e.fragDepth||t.logarithmicDepthBuffer)&&i.get("EXT_frag_depth")?"#extension GL_EXT_frag_depth : enable":"",e.drawBuffers&&i.get("WEBGL_draw_buffers")?"#extension GL_EXT_draw_buffers : require":"",(e.shaderTextureLOD||t.envMap)&&i.get("EXT_shader_texture_lod")?"#extension GL_EXT_shader_texture_lod : enable":""].filter(Wr).join("\n")}(r.extensions,o,t),M=function(e){var t=[];for(var i in e){var r=e[i];!1!==r&&t.push("#define "+i+" "+r)}return t.join("\n")}(s),E=a.createProgram();r.isRawShaderMaterial?((f=[M].filter(Wr).join("\n")).length>0&&(f+="\n"),(m=[_,M].filter(Wr).join("\n")).length>0&&(m+="\n")):(f=["precision "+o.precision+" float;","precision "+o.precision+" int;","#define SHADER_NAME "+n.name,M,o.supportsVertexTextures?"#define VERTEX_TEXTURES":"","#define GAMMA_FACTOR "+w,"#define MAX_BONES "+o.maxBones,o.useFog&&o.fog?"#define USE_FOG":"",o.useFog&&o.fogExp?"#define FOG_EXP2":"",o.map?"#define USE_MAP":"",o.envMap?"#define USE_ENVMAP":"",o.envMap?"#define "+p:"",o.lightMap?"#define USE_LIGHTMAP":"",o.aoMap?"#define USE_AOMAP":"",o.emissiveMap?"#define USE_EMISSIVEMAP":"",o.bumpMap?"#define USE_BUMPMAP":"",o.normalMap?"#define USE_NORMALMAP":"",o.displacementMap&&o.supportsVertexTextures?"#define USE_DISPLACEMENTMAP":"",o.specularMap?"#define USE_SPECULARMAP":"",o.roughnessMap?"#define USE_ROUGHNESSMAP":"",o.metalnessMap?"#define USE_METALNESSMAP":"",o.alphaMap?"#define USE_ALPHAMAP":"",o.vertexColors?"#define USE_COLOR":"",o.flatShading?"#define FLAT_SHADED":"",o.skinning?"#define USE_SKINNING":"",o.useVertexTexture?"#define BONE_TEXTURE":"",o.morphTargets?"#define USE_MORPHTARGETS":"",o.morphNormals&&!1===o.flatShading?"#define USE_MORPHNORMALS":"",o.doubleSided?"#define DOUBLE_SIDED":"",o.flipSided?"#define FLIP_SIDED":"","#define NUM_CLIPPING_PLANES "+o.numClippingPlanes,o.shadowMapEnabled?"#define USE_SHADOWMAP":"",o.shadowMapEnabled?"#define "+l:"",o.sizeAttenuation?"#define USE_SIZEATTENUATION":"",o.logarithmicDepthBuffer?"#define USE_LOGDEPTHBUF":"",o.logarithmicDepthBuffer&&t.get("EXT_frag_depth")?"#define USE_LOGDEPTHBUF_EXT":"","uniform mat4 modelMatrix;","uniform mat4 modelViewMatrix;","uniform mat4 projectionMatrix;","uniform mat4 viewMatrix;","uniform mat3 normalMatrix;","uniform vec3 cameraPosition;","attribute vec3 position;","attribute vec3 normal;","attribute vec2 uv;","#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(Wr).join("\n"),m=[_,"precision "+o.precision+" float;","precision "+o.precision+" int;","#define SHADER_NAME "+n.name,M,o.alphaTest?"#define ALPHATEST "+o.alphaTest:"","#define GAMMA_FACTOR "+w,o.useFog&&o.fog?"#define USE_FOG":"",o.useFog&&o.fogExp?"#define FOG_EXP2":"",o.map?"#define USE_MAP":"",o.envMap?"#define USE_ENVMAP":"",o.envMap?"#define "+u:"",o.envMap?"#define "+p:"",o.envMap?"#define "+d:"",o.lightMap?"#define USE_LIGHTMAP":"",o.aoMap?"#define USE_AOMAP":"",o.emissiveMap?"#define USE_EMISSIVEMAP":"",o.bumpMap?"#define USE_BUMPMAP":"",o.normalMap?"#define USE_NORMALMAP":"",o.specularMap?"#define USE_SPECULARMAP":"",o.roughnessMap?"#define USE_ROUGHNESSMAP":"",o.metalnessMap?"#define USE_METALNESSMAP":"",o.alphaMap?"#define USE_ALPHAMAP":"",o.vertexColors?"#define USE_COLOR":"",o.gradientMap?"#define USE_GRADIENTMAP":"",o.flatShading?"#define FLAT_SHADED":"",o.doubleSided?"#define DOUBLE_SIDED":"",o.flipSided?"#define FLIP_SIDED":"","#define NUM_CLIPPING_PLANES "+o.numClippingPlanes,"#define UNION_CLIPPING_PLANES "+(o.numClippingPlanes-o.numClipIntersection),o.shadowMapEnabled?"#define USE_SHADOWMAP":"",o.shadowMapEnabled?"#define "+l:"",o.premultipliedAlpha?"#define PREMULTIPLIED_ALPHA":"",o.physicallyCorrectLights?"#define PHYSICALLY_CORRECT_LIGHTS":"",o.logarithmicDepthBuffer?"#define USE_LOGDEPTHBUF":"",o.logarithmicDepthBuffer&&t.get("EXT_frag_depth")?"#define USE_LOGDEPTHBUF_EXT":"",o.envMap&&t.get("EXT_shader_texture_lod")?"#define TEXTURE_LOD_EXT":"","uniform mat4 viewMatrix;","uniform vec3 cameraPosition;",o.toneMapping!==ne?"#define TONE_MAPPING":"",o.toneMapping!==ne?vi.tonemapping_pars_fragment:"",o.toneMapping!==ne?function(e,t){var i;switch(t){case oe:i="Linear";break;case ae:i="Reinhard";break;case se:i="Uncharted2";break;case ce:i="OptimizedCineon";break;default:throw new Error("unsupported toneMapping: "+t)}return"vec3 "+e+"( vec3 color ) { return "+i+"ToneMapping( color ); }"}("toneMapping",o.toneMapping):"",o.dithering?"#define DITHERING":"",o.outputEncoding||o.mapEncoding||o.envMapEncoding||o.emissiveMapEncoding?vi.encodings_pars_fragment:"",o.mapEncoding?jr("mapTexelToLinear",o.mapEncoding):"",o.envMapEncoding?jr("envMapTexelToLinear",o.envMapEncoding):"",o.emissiveMapEncoding?jr("emissiveMapTexelToLinear",o.emissiveMapEncoding):"",o.outputEncoding?(v="linearToOutputTexel",x=o.outputEncoding,b=Hr(x),"vec4 "+v+"( vec4 value ) { return LinearTo"+b[0]+b[1]+"; }"):"",o.depthPacking?"#define DEPTH_PACKING "+r.depthPacking:"","\n"].filter(Wr).join("\n")),c=Xr(c=qr(c),o),h=Xr(h=qr(h),o),r.isShaderMaterial||(c=Yr(c),h=Yr(h));var T=f+c,S=m+h,A=Dr(a,a.VERTEX_SHADER,T),R=Dr(a,a.FRAGMENT_SHADER,S);a.attachShader(E,A),a.attachShader(E,R),void 0!==r.index0AttributeName?a.bindAttribLocation(E,0,r.index0AttributeName):!0===o.morphTargets&&a.bindAttribLocation(E,0,"position"),a.linkProgram(E);var L,C,P=a.getProgramInfoLog(E),N=a.getShaderInfoLog(A),O=a.getShaderInfoLog(R),I=!0,D=!0;return!1===a.getProgramParameter(E,a.LINK_STATUS)?(I=!1,console.error("THREE.WebGLProgram: shader error: ",a.getError(),"gl.VALIDATE_STATUS",a.getProgramParameter(E,a.VALIDATE_STATUS),"gl.getProgramInfoLog",P,N,O)):""!==P?console.warn("THREE.WebGLProgram: gl.getProgramInfoLog()",P):""!==N&&""!==O||(D=!1),D&&(this.diagnostics={runnable:I,material:r,programLog:P,vertexShader:{log:N,prefix:f},fragmentShader:{log:O,prefix:m}}),a.deleteShader(A),a.deleteShader(R),this.getUniforms=function(){return void 0===L&&(L=new ui(a,E,e)),L},this.getAttributes=function(){return void 0===C&&(C=function(e,t){for(var i={},r=e.getProgramParameter(t,e.ACTIVE_ATTRIBUTES),n=0;n0,maxBones:p,useVertexTexture:i.floatVertexTextures,morphTargets:t.morphTargets,morphNormals:t.morphNormals,maxMorphTargets:e.maxMorphTargets,maxMorphNormals:e.maxMorphNormals,numDirLights:r.directional.length,numPointLights:r.point.length,numSpotLights:r.spot.length,numRectAreaLights:r.rectArea.length,numHemiLights:r.hemi.length,numClippingPlanes:c,numClipIntersection:h,dithering:t.dithering,shadowMapEnabled:e.shadowMap.enabled&&l.receiveShadow&&o.length>0,shadowMapType:e.shadowMap.type,toneMapping:e.toneMapping,physicallyCorrectLights:e.physicallyCorrectLights,premultipliedAlpha:t.premultipliedAlpha,alphaTest:t.alphaTest,doubleSided:t.side===w,flipSided:t.side===b,depthPacking:void 0!==t.depthPacking&&t.depthPacking}},this.getProgramCode=function(t,i){var r=[];if(i.shaderID?r.push(i.shaderID):(r.push(t.fragmentShader),r.push(t.vertexShader)),void 0!==t.defines)for(var n in t.defines)r.push(n),r.push(t.defines[n]);for(var a=0;at||e.height>t){var i=t/Math.max(e.width,e.height),r=document.createElementNS("http://www.w3.org/1999/xhtml","canvas");return r.width=Math.floor(e.width*i),r.height=Math.floor(e.height*i),r.getContext("2d").drawImage(e,0,0,e.width,e.height,0,0,r.width,r.height),console.warn("THREE.WebGLRenderer: image is too big ("+e.width+"x"+e.height+"). Resized to "+r.width+"x"+r.height,e),r}return e}function l(e){return ft.isPowerOfTwo(e.width)&&ft.isPowerOfTwo(e.height)}function u(e,t){return e.generateMipmaps&&t&&e.minFilter!==xe&&e.minFilter!==_e}function p(t){return t===xe||t===be||t===we?e.NEAREST:e.LINEAR}function d(t){var i=t.target;i.removeEventListener("dispose",d),function(t){var i=r.get(t);if(t.image&&i.__image__webglTextureCube)e.deleteTexture(i.__image__webglTextureCube);else{if(void 0===i.__webglInit)return;e.deleteTexture(i.__webglTexture)}r.remove(t)}(i),i.isVideoTexture&&delete c[i.id],a.textures--}function f(t){var i=t.target;i.removeEventListener("dispose",f),function(t){var i=r.get(t),n=r.get(t.texture);if(!t)return;void 0!==n.__webglTexture&&e.deleteTexture(n.__webglTexture);t.depthTexture&&t.depthTexture.dispose();if(t.isWebGLRenderTargetCube)for(var o=0;o<6;o++)e.deleteFramebuffer(i.__webglFramebuffer[o]),i.__webglDepthbuffer&&e.deleteRenderbuffer(i.__webglDepthbuffer[o]);else e.deleteFramebuffer(i.__webglFramebuffer),i.__webglDepthbuffer&&e.deleteRenderbuffer(i.__webglDepthbuffer);r.remove(t.texture),r.remove(t)}(i),a.textures--}function m(t,p){var f=r.get(t);if(t.version>0&&f.__version!==t.version){var m=t.image;if(void 0===m)console.warn("THREE.WebGLRenderer: Texture marked for update but image is undefined",t);else{if(!1!==m.complete)return void function(t,r,p){void 0===t.__webglInit&&(t.__webglInit=!0,r.addEventListener("dispose",d),t.__webglTexture=e.createTexture(),r.isVideoTexture&&(c[r.id]=r),a.textures++);i.activeTexture(e.TEXTURE0+p),i.bindTexture(e.TEXTURE_2D,t.__webglTexture),e.pixelStorei(e.UNPACK_FLIP_Y_WEBGL,r.flipY),e.pixelStorei(e.UNPACK_PREMULTIPLY_ALPHA_WEBGL,r.premultiplyAlpha),e.pixelStorei(e.UNPACK_ALIGNMENT,r.unpackAlignment);var f=h(r.image,n.maxTextureSize);(function(e){return e.wrapS!==ge||e.wrapT!==ge||e.minFilter!==xe&&e.minFilter!==_e})(r)&&!1===l(f)&&(f=function(e){if(e instanceof HTMLImageElement||e instanceof HTMLCanvasElement||e instanceof ImageBitmap){var t=document.createElementNS("http://www.w3.org/1999/xhtml","canvas");return t.width=ft.floorPowerOfTwo(e.width),t.height=ft.floorPowerOfTwo(e.height),t.getContext("2d").drawImage(e,0,0,t.width,t.height),console.warn("THREE.WebGLRenderer: image is not power of two ("+e.width+"x"+e.height+"). Resized to "+t.width+"x"+t.height,e),t}return e}(f));var m=l(f),g=o.convert(r.format),y=o.convert(r.type);v(e.TEXTURE_2D,r,m);var x,b=r.mipmaps;if(r.isDepthTexture){var w=e.DEPTH_COMPONENT;if(r.type===Pe){if(!s)throw new Error("Float Depth Texture only supported in WebGL2.0");w=e.DEPTH_COMPONENT32F}else s&&(w=e.DEPTH_COMPONENT16);r.format===He&&w===e.DEPTH_COMPONENT&&r.type!==Re&&r.type!==Ce&&(console.warn("THREE.WebGLRenderer: Use UnsignedShortType or UnsignedIntType for DepthFormat DepthTexture."),r.type=Re,y=o.convert(r.type)),r.format===je&&(w=e.DEPTH_STENCIL,r.type!==Ue&&(console.warn("THREE.WebGLRenderer: Use UnsignedInt248Type for DepthStencilFormat DepthTexture."),r.type=Ue,y=o.convert(r.type))),i.texImage2D(e.TEXTURE_2D,0,w,f.width,f.height,0,g,y,null)}else if(r.isDataTexture)if(b.length>0&&m){for(var _=0,M=b.length;_-1?i.compressedTexImage2D(e.TEXTURE_2D,_,g,x.width,x.height,0,x.data):console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()"):i.texImage2D(e.TEXTURE_2D,_,g,x.width,x.height,0,g,y,x.data);else if(b.length>0&&m){for(var _=0,M=b.length;_1||r.get(a).__currentAnisotropy)&&(e.texParameterf(i,c.TEXTURE_MAX_ANISOTROPY_EXT,Math.min(a.anisotropy,n.getMaxAnisotropy())),r.get(a).__currentAnisotropy=a.anisotropy)}}function g(t,n,a,s){var c=o.convert(n.texture.format),h=o.convert(n.texture.type);i.texImage2D(s,0,c,n.width,n.height,0,c,h,null),e.bindFramebuffer(e.FRAMEBUFFER,t),e.framebufferTexture2D(e.FRAMEBUFFER,a,s,r.get(n.texture).__webglTexture,0),e.bindFramebuffer(e.FRAMEBUFFER,null)}function y(t,i){e.bindRenderbuffer(e.RENDERBUFFER,t),i.depthBuffer&&!i.stencilBuffer?(e.renderbufferStorage(e.RENDERBUFFER,e.DEPTH_COMPONENT16,i.width,i.height),e.framebufferRenderbuffer(e.FRAMEBUFFER,e.DEPTH_ATTACHMENT,e.RENDERBUFFER,t)):i.depthBuffer&&i.stencilBuffer?(e.renderbufferStorage(e.RENDERBUFFER,e.DEPTH_STENCIL,i.width,i.height),e.framebufferRenderbuffer(e.FRAMEBUFFER,e.DEPTH_STENCIL_ATTACHMENT,e.RENDERBUFFER,t)):e.renderbufferStorage(e.RENDERBUFFER,e.RGBA4,i.width,i.height),e.bindRenderbuffer(e.RENDERBUFFER,null)}function x(t){var i=r.get(t),n=!0===t.isWebGLRenderTargetCube;if(t.depthTexture){if(n)throw new Error("target.depthTexture not supported in Cube render targets");!function(t,i){if(i&&i.isWebGLRenderTargetCube)throw new Error("Depth Texture with cube render targets is not supported");if(e.bindFramebuffer(e.FRAMEBUFFER,t),!i.depthTexture||!i.depthTexture.isDepthTexture)throw new Error("renderTarget.depthTexture must be an instance of THREE.DepthTexture");r.get(i.depthTexture).__webglTexture&&i.depthTexture.image.width===i.width&&i.depthTexture.image.height===i.height||(i.depthTexture.image.width=i.width,i.depthTexture.image.height=i.height,i.depthTexture.needsUpdate=!0),m(i.depthTexture,0);var n=r.get(i.depthTexture).__webglTexture;if(i.depthTexture.format===He)e.framebufferTexture2D(e.FRAMEBUFFER,e.DEPTH_ATTACHMENT,e.TEXTURE_2D,n,0);else{if(i.depthTexture.format!==je)throw new Error("Unknown depthTexture format");e.framebufferTexture2D(e.FRAMEBUFFER,e.DEPTH_STENCIL_ATTACHMENT,e.TEXTURE_2D,n,0)}}(i.__webglFramebuffer,t)}else if(n){i.__webglDepthbuffer=[];for(var o=0;o<6;o++)e.bindFramebuffer(e.FRAMEBUFFER,i.__webglFramebuffer[o]),i.__webglDepthbuffer[o]=e.createRenderbuffer(),y(i.__webglDepthbuffer[o],t)}else e.bindFramebuffer(e.FRAMEBUFFER,i.__webglFramebuffer),i.__webglDepthbuffer=e.createRenderbuffer(),y(i.__webglDepthbuffer,t);e.bindFramebuffer(e.FRAMEBUFFER,null)}this.setTexture2D=m,this.setTextureCube=function(t,s){var c=r.get(t);if(6===t.image.length)if(t.version>0&&c.__version!==t.version){c.__image__webglTextureCube||(t.addEventListener("dispose",d),c.__image__webglTextureCube=e.createTexture(),a.textures++),i.activeTexture(e.TEXTURE0+s),i.bindTexture(e.TEXTURE_CUBE_MAP,c.__image__webglTextureCube),e.pixelStorei(e.UNPACK_FLIP_Y_WEBGL,t.flipY);for(var p=t&&t.isCompressedTexture,f=t.image[0]&&t.image[0].isDataTexture,m=[],g=0;g<6;g++)m[g]=p||f?f?t.image[g].image:t.image[g]:h(t.image[g],n.maxCubemapSize);var y=l(m[0]),x=o.convert(t.format),b=o.convert(t.type);for(v(e.TEXTURE_CUBE_MAP,t,y),g=0;g<6;g++)if(p)for(var w,_=m[g].mipmaps,M=0,E=_.length;M-1?i.compressedTexImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+g,M,x,w.width,w.height,0,w.data):console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .setTextureCube()"):i.texImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+g,M,x,w.width,w.height,0,x,b,w.data);else f?i.texImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+g,0,x,m[g].width,m[g].height,0,x,b,m[g].data):i.texImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+g,0,x,x,b,m[g]);u(t,y)&&e.generateMipmap(e.TEXTURE_CUBE_MAP),c.__version=t.version,t.onUpdate&&t.onUpdate(t)}else i.activeTexture(e.TEXTURE0+s),i.bindTexture(e.TEXTURE_CUBE_MAP,c.__image__webglTextureCube)},this.setTextureCubeDynamic=function(t,n){i.activeTexture(e.TEXTURE0+n),i.bindTexture(e.TEXTURE_CUBE_MAP,r.get(t).__webglTexture)},this.setupRenderTarget=function(t){var n=r.get(t),o=r.get(t.texture);t.addEventListener("dispose",f),o.__webglTexture=e.createTexture(),a.textures++;var s=!0===t.isWebGLRenderTargetCube,c=l(t);if(s){n.__webglFramebuffer=[];for(var h=0;h<6;h++)n.__webglFramebuffer[h]=e.createFramebuffer()}else n.__webglFramebuffer=e.createFramebuffer();if(s){for(i.bindTexture(e.TEXTURE_CUBE_MAP,o.__webglTexture),v(e.TEXTURE_CUBE_MAP,t.texture,c),h=0;h<6;h++)g(n.__webglFramebuffer[h],t,e.COLOR_ATTACHMENT0,e.TEXTURE_CUBE_MAP_POSITIVE_X+h);u(t.texture,c)&&e.generateMipmap(e.TEXTURE_CUBE_MAP),i.bindTexture(e.TEXTURE_CUBE_MAP,null)}else i.bindTexture(e.TEXTURE_2D,o.__webglTexture),v(e.TEXTURE_2D,t.texture,c),g(n.__webglFramebuffer,t,e.COLOR_ATTACHMENT0,e.TEXTURE_2D),u(t.texture,c)&&e.generateMipmap(e.TEXTURE_2D),i.bindTexture(e.TEXTURE_2D,null);t.depthBuffer&&x(t)},this.updateRenderTargetMipmap=function(t){var n=t.texture;if(u(n,l(t))){var o=t.isWebGLRenderTargetCube?e.TEXTURE_CUBE_MAP:e.TEXTURE_2D,a=r.get(n).__webglTexture;i.bindTexture(o,a),e.generateMipmap(o),i.bindTexture(o,null)}},this.updateVideoTextures=function(){for(var e in c)c[e].update()}}function Kr(e,t,i,r){qi.call(this),this.type="PerspectiveCamera",this.fov=void 0!==e?e:50,this.zoom=1,this.near=void 0!==i?i:.1,this.far=void 0!==r?r:2e3,this.focus=10,this.aspect=void 0!==t?t:1,this.view=null,this.filmGauge=35,this.filmOffset=0,this.updateProjectionMatrix()}function $r(e){Kr.call(this),this.cameras=e||[]}function en(e){var t=this,i=null,r=null,n=null;"undefined"!=typeof window&&"VRFrameData"in window&&(r=new window.VRFrameData);var o=new vt,a=new Kr;a.bounds=new _t(0,0,.5,1),a.layers.enable(1);var s=new Kr;s.bounds=new _t(.5,0,.5,1),s.layers.enable(2);var c,h,l=new $r([a,s]);function u(){if(null!==i&&i.isPresenting){var r=i.getEyeParameters("left"),n=r.renderWidth,o=r.renderHeight;h=e.getPixelRatio(),c=e.getSize(),e.setDrawingBufferSize(2*n,o,1)}else t.enabled&&e.setDrawingBufferSize(c.width,c.height,h)}l.layers.enable(1),l.layers.enable(2),"undefined"!=typeof window&&window.addEventListener("vrdisplaypresentchange",u,!1),this.enabled=!1,this.getDevice=function(){return i},this.setDevice=function(e){void 0!==e&&(i=e)},this.setPoseTarget=function(e){void 0!==e&&(n=e)},this.getCamera=function(e){if(null===i)return e;i.depthNear=e.near,i.depthFar=e.far,i.getFrameData(r);var t=r.pose,c=null!==n?n:e;if(null!==t.position?c.position.fromArray(t.position):c.position.set(0,0,0),null!==t.orientation&&c.quaternion.fromArray(t.orientation),c.updateMatrixWorld(),!1===i.isPresenting)return e;a.near=e.near,s.near=e.near,a.far=e.far,s.far=e.far,l.matrixWorld.copy(e.matrixWorld),l.matrixWorldInverse.copy(e.matrixWorldInverse),a.matrixWorldInverse.fromArray(r.leftViewMatrix),s.matrixWorldInverse.fromArray(r.rightViewMatrix);var h=c.parent;null!==h&&(o.getInverse(h.matrixWorld),a.matrixWorldInverse.multiply(o),s.matrixWorldInverse.multiply(o)),a.matrixWorld.getInverse(a.matrixWorldInverse),s.matrixWorld.getInverse(s.matrixWorldInverse),a.projectionMatrix.fromArray(r.leftProjectionMatrix),s.projectionMatrix.fromArray(r.rightProjectionMatrix),l.projectionMatrix.copy(a.projectionMatrix);var u=i.getLayers();if(u.length){var p=u[0];null!==p.leftBounds&&4===p.leftBounds.length&&a.bounds.fromArray(p.leftBounds),null!==p.rightBounds&&4===p.rightBounds.length&&s.bounds.fromArray(p.rightBounds)}return l},this.submitFrame=function(){i&&i.isPresenting&&i.submitFrame()},this.dispose=function(){"undefined"!=typeof window&&window.removeEventListener("vrdisplaypresentchange",u)}}function tn(e,t){return{convert:function(i){var r;if(i===ve)return e.REPEAT;if(i===ge)return e.CLAMP_TO_EDGE;if(i===ye)return e.MIRRORED_REPEAT;if(i===xe)return e.NEAREST;if(i===be)return e.NEAREST_MIPMAP_NEAREST;if(i===we)return e.NEAREST_MIPMAP_LINEAR;if(i===_e)return e.LINEAR;if(i===Me)return e.LINEAR_MIPMAP_NEAREST;if(i===Ee)return e.LINEAR_MIPMAP_LINEAR;if(i===Te)return e.UNSIGNED_BYTE;if(i===Oe)return e.UNSIGNED_SHORT_4_4_4_4;if(i===Ie)return e.UNSIGNED_SHORT_5_5_5_1;if(i===De)return e.UNSIGNED_SHORT_5_6_5;if(i===Se)return e.BYTE;if(i===Ae)return e.SHORT;if(i===Re)return e.UNSIGNED_SHORT;if(i===Le)return e.INT;if(i===Ce)return e.UNSIGNED_INT;if(i===Pe)return e.FLOAT;if(i===Ne&&null!==(r=t.get("OES_texture_half_float")))return r.HALF_FLOAT_OES;if(i===Fe)return e.ALPHA;if(i===Be)return e.RGB;if(i===ze)return e.RGBA;if(i===ke)return e.LUMINANCE;if(i===Ge)return e.LUMINANCE_ALPHA;if(i===He)return e.DEPTH_COMPONENT;if(i===je)return e.DEPTH_STENCIL;if(i===P)return e.FUNC_ADD;if(i===N)return e.FUNC_SUBTRACT;if(i===O)return e.FUNC_REVERSE_SUBTRACT;if(i===U)return e.ZERO;if(i===F)return e.ONE;if(i===B)return e.SRC_COLOR;if(i===z)return e.ONE_MINUS_SRC_COLOR;if(i===k)return e.SRC_ALPHA;if(i===G)return e.ONE_MINUS_SRC_ALPHA;if(i===V)return e.DST_ALPHA;if(i===H)return e.ONE_MINUS_DST_ALPHA;if(i===j)return e.DST_COLOR;if(i===W)return e.ONE_MINUS_DST_COLOR;if(i===X)return e.SRC_ALPHA_SATURATE;if((i===We||i===Xe||i===qe||i===Ye)&&null!==(r=t.get("WEBGL_compressed_texture_s3tc"))){if(i===We)return r.COMPRESSED_RGB_S3TC_DXT1_EXT;if(i===Xe)return r.COMPRESSED_RGBA_S3TC_DXT1_EXT;if(i===qe)return r.COMPRESSED_RGBA_S3TC_DXT3_EXT;if(i===Ye)return r.COMPRESSED_RGBA_S3TC_DXT5_EXT}if((i===Ze||i===Je||i===Qe||i===Ke)&&null!==(r=t.get("WEBGL_compressed_texture_pvrtc"))){if(i===Ze)return r.COMPRESSED_RGB_PVRTC_4BPPV1_IMG;if(i===Je)return r.COMPRESSED_RGB_PVRTC_2BPPV1_IMG;if(i===Qe)return r.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG;if(i===Ke)return r.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG}if(i===$e&&null!==(r=t.get("WEBGL_compressed_texture_etc1")))return r.COMPRESSED_RGB_ETC1_WEBGL;if((i===I||i===D)&&null!==(r=t.get("EXT_blend_minmax"))){if(i===I)return r.MIN_EXT;if(i===D)return r.MAX_EXT}return i===Ue&&null!==(r=t.get("WEBGL_depth_texture"))?r.UNSIGNED_INT_24_8_WEBGL:0}}}function rn(e){console.log("THREE.WebGLRenderer",p);var t=void 0!==(e=e||{}).canvas?e.canvas:document.createElementNS("http://www.w3.org/1999/xhtml","canvas"),i=void 0!==e.context?e.context:null,r=void 0!==e.alpha&&e.alpha,n=void 0===e.depth||e.depth,o=void 0===e.stencil||e.stencil,a=void 0!==e.antialias&&e.antialias,s=void 0===e.premultipliedAlpha||e.premultipliedAlpha,c=void 0!==e.preserveDrawingBuffer&&e.preserveDrawingBuffer,h=void 0!==e.powerPreference?e.powerPreference:"default",l=[],u=[],g=null,y=[],x=[];this.domElement=t,this.context=null,this.autoClear=!0,this.autoClearColor=!0,this.autoClearDepth=!0,this.autoClearStencil=!0,this.sortObjects=!0,this.clippingPlanes=[],this.localClippingEnabled=!1,this.gammaFactor=2,this.gammaInput=!1,this.gammaOutput=!1,this.physicallyCorrectLights=!1,this.toneMapping=oe,this.toneMappingExposure=1,this.toneMappingWhitePoint=1,this.maxMorphTargets=8,this.maxMorphNormals=4;var M,E,P,N,O,I,D,U,F,B,z,k,G,V,H,j,W,X,te,ie=this,re=!1,ne=null,ae=null,se=-1,ce="",he=null,le=null,ue=new _t,pe=new _t,de=null,fe=0,me=t.width,ve=t.height,ge=1,ye=new _t(0,0,me,ve),xe=new _t(0,0,me,ve),be=!1,we=new Ui,_e=new function(){var e=this,t=null,i=0,r=!1,n=!1,o=new Di,a=new xt,s={value:null,needsUpdate:!1};function c(){s.value!==t&&(s.value=t,s.needsUpdate=i>0),e.numPlanes=i,e.numIntersection=0}function h(t,i,r,n){var c=null!==t?t.length:0,h=null;if(0!==c){if(h=s.value,!0!==n||null===h){var l=r+4*c,u=i.matrixWorldInverse;a.getNormalMatrix(u),(null===h||h.length0&&e.getShaderPrecisionFormat(e.FRAGMENT_SHADER,e.HIGH_FLOAT).precision>0)return"highp";t="mediump"}return"mediump"===t&&e.getShaderPrecisionFormat(e.VERTEX_SHADER,e.MEDIUM_FLOAT).precision>0&&e.getShaderPrecisionFormat(e.FRAGMENT_SHADER,e.MEDIUM_FLOAT).precision>0?"mediump":"lowp"}var o=void 0!==i.precision?i.precision:"highp",a=n(o);a!==o&&(console.warn("THREE.WebGLRenderer:",o,"not supported, using",a,"instead."),o=a);var s=!0===i.logarithmicDepthBuffer,c=e.getParameter(e.MAX_TEXTURE_IMAGE_UNITS),h=e.getParameter(e.MAX_VERTEX_TEXTURE_IMAGE_UNITS),l=e.getParameter(e.MAX_TEXTURE_SIZE),u=e.getParameter(e.MAX_CUBE_MAP_TEXTURE_SIZE),p=e.getParameter(e.MAX_VERTEX_ATTRIBS),d=e.getParameter(e.MAX_VERTEX_UNIFORM_VECTORS),f=e.getParameter(e.MAX_VARYING_VECTORS),m=e.getParameter(e.MAX_FRAGMENT_UNIFORM_VECTORS),v=h>0,g=!!t.get("OES_texture_float");return{getMaxAnisotropy:function(){if(void 0!==r)return r;var i=t.get("EXT_texture_filter_anisotropic");return r=null!==i?e.getParameter(i.MAX_TEXTURE_MAX_ANISOTROPY_EXT):0},getMaxPrecision:n,precision:o,logarithmicDepthBuffer:s,maxTextures:c,maxVertexTextures:h,maxTextureSize:l,maxCubemapSize:u,maxAttributes:p,maxVertexUniforms:d,maxVaryings:f,maxFragmentUniforms:m,vertexTextures:v,floatFragmentTextures:g,floatVertexTextures:v&&g}}(M,E,e),(N=new function(e,t,i){var r=new function(){var t=!1,i=new _t,r=null,n=new _t(0,0,0,0);return{setMask:function(i){r===i||t||(e.colorMask(i,i,i,i),r=i)},setLocked:function(e){t=e},setClear:function(t,r,o,a,s){!0===s&&(t*=a,r*=a,o*=a),i.set(t,r,o,a),!1===n.equals(i)&&(e.clearColor(t,r,o,a),n.copy(i))},reset:function(){t=!1,r=null,n.set(-1,0,0,0)}}},n=new function(){var t=!1,i=null,r=null,n=null;return{setTest:function(t){t?X(e.DEPTH_TEST):te(e.DEPTH_TEST)},setMask:function(r){i===r||t||(e.depthMask(r),i=r)},setFunc:function(t){if(r!==t){if(t)switch(t){case q:e.depthFunc(e.NEVER);break;case Y:e.depthFunc(e.ALWAYS);break;case Z:e.depthFunc(e.LESS);break;case J:e.depthFunc(e.LEQUAL);break;case Q:e.depthFunc(e.EQUAL);break;case K:e.depthFunc(e.GEQUAL);break;case $:e.depthFunc(e.GREATER);break;case ee:e.depthFunc(e.NOTEQUAL);break;default:e.depthFunc(e.LEQUAL)}else e.depthFunc(e.LEQUAL);r=t}},setLocked:function(e){t=e},setClear:function(t){n!==t&&(e.clearDepth(t),n=t)},reset:function(){t=!1,i=null,r=null,n=null}}},o=new function(){var t=!1,i=null,r=null,n=null,o=null,a=null,s=null,c=null,h=null;return{setTest:function(t){t?X(e.STENCIL_TEST):te(e.STENCIL_TEST)},setMask:function(r){i===r||t||(e.stencilMask(r),i=r)},setFunc:function(t,i,a){r===t&&n===i&&o===a||(e.stencilFunc(t,i,a),r=t,n=i,o=a)},setOp:function(t,i,r){a===t&&s===i&&c===r||(e.stencilOp(t,i,r),a=t,s=i,c=r)},setLocked:function(e){t=e},setClear:function(t){h!==t&&(e.clearStencil(t),h=t)},reset:function(){t=!1,i=null,r=null,n=null,o=null,a=null,s=null,c=null,h=null}}},a=e.getParameter(e.MAX_VERTEX_ATTRIBS),s=new Uint8Array(a),c=new Uint8Array(a),h=new Uint8Array(a),l={},u=null,p=null,v=null,g=null,y=null,x=null,_=null,M=null,E=null,P=!1,N=null,O=null,I=null,D=null,U=null,F=e.getParameter(e.MAX_COMBINED_TEXTURE_IMAGE_UNITS),B=parseFloat(/^WebGL\ ([0-9])/.exec(e.getParameter(e.VERSION))[1]),z=parseFloat(B)>=1,k=null,G={},V=new _t,H=new _t;function j(t,i,r){var n=new Uint8Array(4),o=e.createTexture();e.bindTexture(t,o),e.texParameteri(t,e.TEXTURE_MIN_FILTER,e.NEAREST),e.texParameteri(t,e.TEXTURE_MAG_FILTER,e.NEAREST);for(var a=0;a65535?ar:nr)(a,1),t.update(r,e.ELEMENT_ARRAY_BUFFER),n[i.id]=r,r}}}(M,D,Re),F=new function(e,t){var i={};return{update:function(r){var n=t.frame,o=r.geometry,a=e.get(r,o);return i[a.id]!==n&&(o.isGeometry&&a.updateFromObject(r),e.update(a),i[a.id]=n),a},clear:function(){i={}}}}(U,Le),V=new function(e){var t={},i=new Float32Array(8);return{update:function(r,n,o,a){var s=r.morphTargetInfluences,c=s.length,h=t[n.id];if(void 0===h){h=[];for(var l=0;l=0){var h=n[s];if(void 0!==h){var l=h.normalized,u=h.itemSize,p=D.get(h);if(void 0===p)continue;var d=p.buffer,f=p.type,m=p.bytesPerElement;if(h.isInterleavedBufferAttribute){var v=h.data,g=v.stride,y=h.offset;v&&v.isInstancedInterleavedBuffer?(N.enableAttributeAndDivisor(c,v.meshPerAttribute),void 0===i.maxInstancedCount&&(i.maxInstancedCount=v.meshPerAttribute*v.count)):N.enableAttribute(c),M.bindBuffer(M.ARRAY_BUFFER,d),M.vertexAttribPointer(c,u,f,l,g*m,(r*g+y)*m)}else h.isInstancedBufferAttribute?(N.enableAttributeAndDivisor(c,h.meshPerAttribute),void 0===i.maxInstancedCount&&(i.maxInstancedCount=h.meshPerAttribute*h.count)):N.enableAttribute(c),M.bindBuffer(M.ARRAY_BUFFER,d),M.vertexAttribPointer(c,u,f,l,0,r*u*m)}else if(void 0!==a){var x=a[s];if(void 0!==x)switch(x.length){case 2:M.vertexAttrib2fv(c,x);break;case 3:M.vertexAttrib3fv(c,x);break;case 4:M.vertexAttrib4fv(c,x);break;default:M.vertexAttrib1fv(c,x)}}}}N.disableUnusedAttributes()}(r,s,i),null!==u&&M.bindBuffer(M.ELEMENT_ARRAY_BUFFER,l.buffer));var m=0;null!==u?m=u.count:void 0!==p&&(m=p.count);var v=i.drawRange.start*d,g=i.drawRange.count*d,y=null!==o?o.start*d:0,x=null!==o?o.count*d:1/0,b=Math.max(v,y),w=Math.min(m,v+g,y+x)-1,_=Math.max(0,w-b+1);if(0!==_){if(n.isMesh)if(!0===r.wireframe)N.setLineWidth(r.wireframeLinewidth*Ce()),f.setMode(M.LINES);else switch(n.drawMode){case it:f.setMode(M.TRIANGLES);break;case rt:f.setMode(M.TRIANGLE_STRIP);break;case nt:f.setMode(M.TRIANGLE_FAN)}else if(n.isLine){var T=r.linewidth;void 0===T&&(T=1),N.setLineWidth(T*Ce()),n.isLineSegments?f.setMode(M.LINES):n.isLineLoop?f.setMode(M.LINE_LOOP):f.setMode(M.LINE_STRIP)}else n.isPoints&&f.setMode(M.POINTS);i&&i.isInstancedBufferGeometry?i.maxInstancedCount>0&&f.renderInstances(i,b,_):f.render(b,_)}},this.compile=function(e,t){l.length=0,u.length=0,e.traverse(function(e){e.isLight&&(l.push(e),e.castShadow&&u.push(e))}),B.setup(l,u,t),e.traverse(function(t){if(t.material)if(Array.isArray(t.material))for(var i=0;i=0&&e.numSupportedMorphTargets++}if(e.morphNormals){e.numSupportedMorphNormals=0;for(l=0;l=0&&e.numSupportedMorphNormals++}var p=r.shader.uniforms;(e.isShaderMaterial||e.isRawShaderMaterial)&&!0!==e.clipping||(r.numClippingPlanes=_e.numPlanes,r.numIntersection=_e.numIntersection,p.clippingPlanes=_e.uniform),r.fog=t,r.lightsHash=B.state.hash,e.lights&&(p.ambientLightColor.value=B.state.ambient,p.directionalLights.value=B.state.directional,p.spotLights.value=B.state.spot,p.rectAreaLights.value=B.state.rectArea,p.pointLights.value=B.state.point,p.hemisphereLights.value=B.state.hemi,p.directionalShadowMap.value=B.state.directionalShadowMap,p.directionalShadowMatrix.value=B.state.directionalShadowMatrix,p.spotShadowMap.value=B.state.spotShadowMap,p.spotShadowMatrix.value=B.state.spotShadowMatrix,p.pointShadowMap.value=B.state.pointShadowMap,p.pointShadowMatrix.value=B.state.pointShadowMatrix);var d=r.program.getUniforms(),f=ui.seqWithValue(d.seq,p);r.uniformsList=f}function Ze(e,t,i,r){fe=0;var n=O.get(i);if(Me&&(Ee||e!==he)){var o=e===he&&i.id===se;_e.setState(i.clippingPlanes,i.clipIntersection,i.clipShadows,e,n,o)}!1===i.needsUpdate&&(void 0===n.program?i.needsUpdate=!0:i.fog&&n.fog!==t?i.needsUpdate=!0:i.lights&&n.lightsHash!==B.state.hash?i.needsUpdate=!0:void 0===n.numClippingPlanes||n.numClippingPlanes===_e.numPlanes&&n.numIntersection===_e.numIntersection||(i.needsUpdate=!0)),i.needsUpdate&&(Ye(i,t,r),i.needsUpdate=!1);var a,s,c=!1,h=!1,l=!1,u=n.program,p=u.getUniforms(),d=n.shader.uniforms;if(N.useProgram(u.program)&&(c=!0,h=!0,l=!0),i.id!==se&&(se=i.id,h=!0),c||e!==he){if(p.setValue(M,"projectionMatrix",e.projectionMatrix),P.logarithmicDepthBuffer&&p.setValue(M,"logDepthBufFC",2/(Math.log(e.far+1)/Math.LN2)),he!==(le||e)&&(he=le||e,h=!0,l=!0),i.isShaderMaterial||i.isMeshPhongMaterial||i.isMeshStandardMaterial||i.envMap){var f=p.map.cameraPosition;void 0!==f&&f.setValue(M,Ae.setFromMatrixPosition(e.matrixWorld))}(i.isMeshPhongMaterial||i.isMeshLambertMaterial||i.isMeshBasicMaterial||i.isMeshStandardMaterial||i.isShaderMaterial||i.skinning)&&p.setValue(M,"viewMatrix",e.matrixWorldInverse)}if(i.skinning){p.setOptional(M,r,"bindMatrix"),p.setOptional(M,r,"bindMatrixInverse");var m=r.skeleton;if(m){var v=m.bones;if(P.floatVertexTextures){if(void 0===m.boneTexture){var g=Math.sqrt(4*v.length);g=ft.ceilPowerOfTwo(g),g=Math.max(g,4);var y=new Float32Array(g*g*4);y.set(m.boneMatrices);var x=new Tt(y,g,g,ze,Pe);m.boneMatrices=y,m.boneTexture=x,m.boneTextureSize=g}p.setValue(M,"boneTexture",m.boneTexture),p.setValue(M,"boneTextureSize",m.boneTextureSize)}else p.setOptional(M,m,"boneMatrices")}}return h&&(p.setValue(M,"toneMappingExposure",ie.toneMappingExposure),p.setValue(M,"toneMappingWhitePoint",ie.toneMappingWhitePoint),i.lights&&(s=l,(a=d).ambientLightColor.needsUpdate=s,a.directionalLights.needsUpdate=s,a.pointLights.needsUpdate=s,a.spotLights.needsUpdate=s,a.rectAreaLights.needsUpdate=s,a.hemisphereLights.needsUpdate=s),t&&i.fog&&function(e,t){e.fogColor.value=t.color,t.isFog?(e.fogNear.value=t.near,e.fogFar.value=t.far):t.isFogExp2&&(e.fogDensity.value=t.density)}(d,t),i.isMeshBasicMaterial?Je(d,i):i.isMeshLambertMaterial?(Je(d,i),function(e,t){t.emissiveMap&&(e.emissiveMap.value=t.emissiveMap)}(d,i)):i.isMeshPhongMaterial?(Je(d,i),i.isMeshToonMaterial?function(e,t){Qe(e,t),t.gradientMap&&(e.gradientMap.value=t.gradientMap)}(d,i):Qe(d,i)):i.isMeshStandardMaterial?(Je(d,i),i.isMeshPhysicalMaterial?function(e,t){e.clearCoat.value=t.clearCoat,e.clearCoatRoughness.value=t.clearCoatRoughness,Ke(e,t)}(d,i):Ke(d,i)):i.isMeshDepthMaterial?(Je(d,i),function(e,t){t.displacementMap&&(e.displacementMap.value=t.displacementMap,e.displacementScale.value=t.displacementScale,e.displacementBias.value=t.displacementBias)}(d,i)):i.isMeshDistanceMaterial?(Je(d,i),function(e,t){t.displacementMap&&(e.displacementMap.value=t.displacementMap,e.displacementScale.value=t.displacementScale,e.displacementBias.value=t.displacementBias);e.referencePosition.value.copy(t.referencePosition),e.nearDistance.value=t.nearDistance,e.farDistance.value=t.farDistance}(d,i)):i.isMeshNormalMaterial?(Je(d,i),function(e,t){t.bumpMap&&(e.bumpMap.value=t.bumpMap,e.bumpScale.value=t.bumpScale);t.normalMap&&(e.normalMap.value=t.normalMap,e.normalScale.value.copy(t.normalScale));t.displacementMap&&(e.displacementMap.value=t.displacementMap,e.displacementScale.value=t.displacementScale,e.displacementBias.value=t.displacementBias)}(d,i)):i.isLineBasicMaterial?(function(e,t){e.diffuse.value=t.color,e.opacity.value=t.opacity}(d,i),i.isLineDashedMaterial&&function(e,t){e.dashSize.value=t.dashSize,e.totalSize.value=t.dashSize+t.gapSize,e.scale.value=t.scale}(d,i)):i.isPointsMaterial?function(e,t){if(e.diffuse.value=t.color,e.opacity.value=t.opacity,e.size.value=t.size*ge,e.scale.value=.5*ve,e.map.value=t.map,null!==t.map){if(!0===t.map.matrixAutoUpdate){var i=t.map.offset,r=t.map.repeat,n=t.map.rotation,o=t.map.center;t.map.matrix.setUvTransform(i.x,i.y,r.x,r.y,n,o.x,o.y)}e.uvTransform.value.copy(t.map.matrix)}}(d,i):i.isShadowMaterial&&(d.color.value=i.color,d.opacity.value=i.opacity),void 0!==d.ltcMat&&(d.ltcMat.value=fi.LTC_MAT_TEXTURE),void 0!==d.ltcMag&&(d.ltcMag.value=fi.LTC_MAG_TEXTURE),ui.upload(M,n.uniformsList,d,ie)),p.setValue(M,"modelViewMatrix",r.modelViewMatrix),p.setValue(M,"normalMatrix",r.normalMatrix),p.setValue(M,"modelMatrix",r.matrixWorld),u}function Je(e,t){var i;if(e.opacity.value=t.opacity,t.color&&(e.diffuse.value=t.color),t.emissive&&e.emissive.value.copy(t.emissive).multiplyScalar(t.emissiveIntensity),t.map&&(e.map.value=t.map),t.alphaMap&&(e.alphaMap.value=t.alphaMap),t.specularMap&&(e.specularMap.value=t.specularMap),t.envMap&&(e.envMap.value=t.envMap,e.flipEnvMap.value=t.envMap&&t.envMap.isCubeTexture?-1:1,e.reflectivity.value=t.reflectivity,e.refractionRatio.value=t.refractionRatio),t.lightMap&&(e.lightMap.value=t.lightMap,e.lightMapIntensity.value=t.lightMapIntensity),t.aoMap&&(e.aoMap.value=t.aoMap,e.aoMapIntensity.value=t.aoMapIntensity),t.map?i=t.map:t.specularMap?i=t.specularMap:t.displacementMap?i=t.displacementMap:t.normalMap?i=t.normalMap:t.bumpMap?i=t.bumpMap:t.roughnessMap?i=t.roughnessMap:t.metalnessMap?i=t.metalnessMap:t.alphaMap?i=t.alphaMap:t.emissiveMap&&(i=t.emissiveMap),void 0!==i){if(i.isWebGLRenderTarget&&(i=i.texture),!0===i.matrixAutoUpdate){var r=i.offset,n=i.repeat,o=i.rotation,a=i.center;i.matrix.setUvTransform(r.x,r.y,n.x,n.y,o,a.x,a.y)}e.uvTransform.value.copy(i.matrix)}}function Qe(e,t){e.specular.value=t.specular,e.shininess.value=Math.max(t.shininess,1e-4),t.emissiveMap&&(e.emissiveMap.value=t.emissiveMap),t.bumpMap&&(e.bumpMap.value=t.bumpMap,e.bumpScale.value=t.bumpScale),t.normalMap&&(e.normalMap.value=t.normalMap,e.normalScale.value.copy(t.normalScale)),t.displacementMap&&(e.displacementMap.value=t.displacementMap,e.displacementScale.value=t.displacementScale,e.displacementBias.value=t.displacementBias)}function Ke(e,t){e.roughness.value=t.roughness,e.metalness.value=t.metalness,t.roughnessMap&&(e.roughnessMap.value=t.roughnessMap),t.metalnessMap&&(e.metalnessMap.value=t.metalnessMap),t.emissiveMap&&(e.emissiveMap.value=t.emissiveMap),t.bumpMap&&(e.bumpMap.value=t.bumpMap,e.bumpScale.value=t.bumpScale),t.normalMap&&(e.normalMap.value=t.normalMap,e.normalScale.value.copy(t.normalScale)),t.displacementMap&&(e.displacementMap.value=t.displacementMap,e.displacementScale.value=t.displacementScale,e.displacementBias.value=t.displacementBias),t.envMap&&(e.envMapIntensity.value=t.envMapIntensity)}this.animate=function(e){je=e,function(){if(!He){var e=De.getDevice();e&&e.isPresenting?e.requestAnimationFrame(We):window.requestAnimationFrame(We),He=!0}}()},this.render=function(e,t,i,r){if(t&&t.isCamera){if(!re){ce="",se=-1,he=null,!0===e.autoUpdate&&e.updateMatrixWorld(),null===t.parent&&t.updateMatrixWorld(),De.enabled&&(t=De.getCamera(t)),Se.multiplyMatrices(t.projectionMatrix,t.matrixWorldInverse),we.setFromMatrix(Se),l.length=0,u.length=0,y.length=0,x.length=0,Ee=this.localClippingEnabled,Me=_e.init(this.clippingPlanes,Ee,t),(g=k.get(e,t)).init(),function e(t,i,r){if(!1===t.visible)return;var n=t.layers.test(i.layers);if(n)if(t.isLight)l.push(t),t.castShadow&&u.push(t);else if(t.isSprite)t.frustumCulled&&!we.intersectsSprite(t)||y.push(t);else if(t.isLensFlare)x.push(t);else if(t.isImmediateRenderObject)r&&Ae.setFromMatrixPosition(t.matrixWorld).applyMatrix4(Se),g.push(t,null,t.material,Ae.z,null);else if((t.isMesh||t.isLine||t.isPoints)&&(t.isSkinnedMesh&&t.skeleton.update(),!t.frustumCulled||we.intersectsObject(t))){r&&Ae.setFromMatrixPosition(t.matrixWorld).applyMatrix4(Se);var o=F.update(t),a=t.material;if(Array.isArray(a))for(var s=o.groups,c=0,h=s.length;c=P.maxTextures&&console.warn("THREE.WebGLRenderer: Trying to use "+e+" texture units while this GPU supports only "+P.maxTextures),fe+=1,e},this.setTexture2D=(Ve=!1,function(e,t){e&&e.isWebGLRenderTarget&&(Ve||(console.warn("THREE.WebGLRenderer.setTexture2D: don't use render targets as textures. Use their .texture property instead."),Ve=!0),e=e.texture),I.setTexture2D(e,t)}),this.setTexture=function(){var e=!1;return function(t,i){e||(console.warn("THREE.WebGLRenderer: .setTexture is deprecated, use setTexture2D instead."),e=!0),I.setTexture2D(t,i)}}(),this.setTextureCube=function(){var e=!1;return function(t,i){t&&t.isWebGLRenderTargetCube&&(e||(console.warn("THREE.WebGLRenderer.setTextureCube: don't use cube render targets as textures. Use their .texture property instead."),e=!0),t=t.texture),t&&t.isCubeTexture||Array.isArray(t.image)&&6===t.image.length?I.setTextureCube(t,i):I.setTextureCubeDynamic(t,i)}}(),this.getRenderTarget=function(){return ne},this.setRenderTarget=function(e){ne=e,e&&void 0===O.get(e).__webglFramebuffer&&I.setupRenderTarget(e);var t=null,i=!1;if(e){var r=O.get(e).__webglFramebuffer;e.isWebGLRenderTargetCube?(t=r[e.activeCubeFace],i=!0):t=r,ue.copy(e.viewport),pe.copy(e.scissor),de=e.scissorTest}else ue.copy(ye).multiplyScalar(ge),pe.copy(xe).multiplyScalar(ge),de=be;if(ae!==t&&(M.bindFramebuffer(M.FRAMEBUFFER,t),ae=t),N.viewport(ue),N.scissor(pe),N.setScissorTest(de),i){var n=O.get(e.texture);M.framebufferTexture2D(M.FRAMEBUFFER,M.COLOR_ATTACHMENT0,M.TEXTURE_CUBE_MAP_POSITIVE_X+e.activeCubeFace,n.__webglTexture,e.activeMipMapLevel)}},this.readRenderTargetPixels=function(e,t,i,r,n,o){if(e&&e.isWebGLRenderTarget){var a=O.get(e).__webglFramebuffer;if(a){var s=!1;a!==ae&&(M.bindFramebuffer(M.FRAMEBUFFER,a),s=!0);try{var c=e.texture,h=c.format,l=c.type;if(h!==ze&&te.convert(h)!==M.getParameter(M.IMPLEMENTATION_COLOR_READ_FORMAT))return void console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in RGBA or implementation defined format.");if(!(l===Te||te.convert(l)===M.getParameter(M.IMPLEMENTATION_COLOR_READ_TYPE)||l===Pe&&(E.get("OES_texture_float")||E.get("WEBGL_color_buffer_float"))||l===Ne&&E.get("EXT_color_buffer_half_float")))return void console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in UnsignedByteType or implementation defined type.");M.checkFramebufferStatus(M.FRAMEBUFFER)===M.FRAMEBUFFER_COMPLETE?t>=0&&t<=e.width-r&&i>=0&&i<=e.height-n&&M.readPixels(t,i,r,n,te.convert(h),te.convert(l),o):console.error("THREE.WebGLRenderer.readRenderTargetPixels: readPixels from renderTarget failed. Framebuffer not complete.")}finally{s&&M.bindFramebuffer(M.FRAMEBUFFER,ae)}}}else console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.")}}function nn(e,t){this.name="",this.color=new di(e),this.density=void 0!==t?t:25e-5}function on(e,t,i){this.name="",this.color=new di(e),this.near=void 0!==t?t:1,this.far=void 0!==i?i:1e3}function an(){Xi.call(this),this.type="Scene",this.background=null,this.fog=null,this.overrideMaterial=null,this.autoUpdate=!0}function sn(e,t,i,r,n){Xi.call(this),this.lensFlares=[],this.positionScreen=new yt,this.customUpdateCallback=void 0,void 0!==e&&this.add(e,t,i,r,n)}function cn(e){Ci.call(this),this.type="SpriteMaterial",this.color=new di(16777215),this.map=null,this.rotation=0,this.fog=!1,this.lights=!1,this.setValues(e)}function hn(e){Xi.call(this),this.type="Sprite",this.material=void 0!==e?e:new cn}function ln(){Xi.call(this),this.type="LOD",Object.defineProperties(this,{levels:{enumerable:!0,value:[]}})}function un(e,t){if(e=e||[],this.bones=e.slice(0),this.boneMatrices=new Float32Array(16*this.bones.length),void 0===t)this.calculateInverses();else if(this.bones.length===t.length)this.boneInverses=t.slice(0);else{console.warn("THREE.Skeleton boneInverses is the wrong length."),this.boneInverses=[];for(var i=0,r=this.bones.length;i=0?(u=e(v-1e-5,m,u),p.subVectors(l,u)):(u=e(v+1e-5,m,u),p.subVectors(u,l)),m-1e-5>=0?(u=e(v,m-1e-5,u),d.subVectors(l,u)):(u=e(v,m+1e-5,u),d.subVectors(u,l)),h.crossVectors(p,d).normalize(),s.push(h.x,h.y,h.z),c.push(v,m)}}for(r=0;r.9&&a<.1&&(t<.2&&(o[e+0]+=1),i<.2&&(o[e+2]+=1),r<.2&&(o[e+4]+=1))}}()}(),this.addAttribute("position",new sr(n,3)),this.addAttribute("normal",new sr(n.slice(),3)),this.addAttribute("uv",new sr(o,2)),0===r?this.computeVertexNormals():this.normalizeNormals()}function Ln(e,t){Ki.call(this),this.type="TetrahedronGeometry",this.parameters={radius:e,detail:t},this.fromBufferGeometry(new Cn(e,t)),this.mergeVertices()}function Cn(e,t){Rn.call(this,[1,1,1,-1,-1,1,-1,1,-1,1,-1,-1],[2,1,0,0,3,2,1,3,0,2,3,1],e,t),this.type="TetrahedronBufferGeometry",this.parameters={radius:e,detail:t}}function Pn(e,t){Ki.call(this),this.type="OctahedronGeometry",this.parameters={radius:e,detail:t},this.fromBufferGeometry(new Nn(e,t)),this.mergeVertices()}function Nn(e,t){Rn.call(this,[1,0,0,-1,0,0,0,1,0,0,-1,0,0,0,1,0,0,-1],[0,2,4,0,4,3,0,3,5,0,5,2,1,2,5,1,5,3,1,3,4,1,4,2],e,t),this.type="OctahedronBufferGeometry",this.parameters={radius:e,detail:t}}function On(e,t){Ki.call(this),this.type="IcosahedronGeometry",this.parameters={radius:e,detail:t},this.fromBufferGeometry(new In(e,t)),this.mergeVertices()}function In(e,t){var i=(1+Math.sqrt(5))/2,r=[-1,i,0,1,i,0,-1,-i,0,1,-i,0,0,-1,i,0,1,i,0,-1,-i,0,1,-i,i,0,-1,i,0,1,-i,0,-1,-i,0,1];Rn.call(this,r,[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],e,t),this.type="IcosahedronBufferGeometry",this.parameters={radius:e,detail:t}}function Dn(e,t){Ki.call(this),this.type="DodecahedronGeometry",this.parameters={radius:e,detail:t},this.fromBufferGeometry(new Un(e,t)),this.mergeVertices()}function Un(e,t){var i=(1+Math.sqrt(5))/2,r=1/i,n=[-1,-1,-1,-1,-1,1,-1,1,-1,-1,1,1,1,-1,-1,1,-1,1,1,1,-1,1,1,1,0,-r,-i,0,-r,i,0,r,-i,0,r,i,-r,-i,0,-r,i,0,r,-i,0,r,i,0,-i,0,-r,i,0,-r,-i,0,r,i,0,r];Rn.call(this,n,[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,t),this.type="DodecahedronBufferGeometry",this.parameters={radius:e,detail:t}}function Fn(e,t,i,r,n,o){Ki.call(this),this.type="TubeGeometry",this.parameters={path:e,tubularSegments:t,radius:i,radialSegments:r,closed:n},void 0!==o&&console.warn("THREE.TubeGeometry: taper has been removed.");var a=new Bn(e,t,i,r,n);this.tangents=a.tangents,this.normals=a.normals,this.binormals=a.binormals,this.fromBufferGeometry(a),this.mergeVertices()}function Bn(e,t,i,r,n){xr.call(this),this.type="TubeBufferGeometry",this.parameters={path:e,tubularSegments:t,radius:i,radialSegments:r,closed:n},t=t||64,i=i||1,r=r||8,n=n||!1;var o=e.computeFrenetFrames(t,n);this.tangents=o.tangents,this.normals=o.normals,this.binormals=o.binormals;var a,s,c=new yt,h=new yt,l=new mt,u=new yt,p=[],d=[],f=[],m=[];function v(n){u=e.getPointAt(n/t,u);var a=o.normals[n],l=o.binormals[n];for(s=0;s<=r;s++){var f=s/r*Math.PI*2,m=Math.sin(f),v=-Math.cos(f);h.x=v*a.x+m*l.x,h.y=v*a.y+m*l.y,h.z=v*a.z+m*l.z,h.normalize(),d.push(h.x,h.y,h.z),c.x=u.x+i*h.x,c.y=u.y+i*h.y,c.z=u.z+i*h.z,p.push(c.x,c.y,c.z)}}!function(){for(a=0;ai)){var r=e.ray.origin.distanceTo(Ur);re.far||t.push({distance:r,point:Ur.clone(),face:null,object:this})}}),clone:function(){return new this.constructor(this.material).copy(this)}}),ln.prototype=Object.assign(Object.create(Xi.prototype),{constructor:ln,copy:function(e){Xi.prototype.copy.call(this,e,!1);for(var t=e.levels,i=0,r=t.length;i1){e.setFromMatrixPosition(i.matrixWorld),t.setFromMatrixPosition(this.matrixWorld);var n=e.distanceTo(t);r[0].object.visible=!0;for(var o=1,a=r.length;o=r[o].distance;o++)r[o-1].object.visible=!1,r[o].object.visible=!0;for(;oa))p.applyMatrix4(this.matrixWorld),(M=r.ray.origin.distanceTo(p))r.far||n.push({distance:M,point:u.clone().applyMatrix4(this.matrixWorld),index:g,face:null,faceIndex:null,object:this})}else for(g=0,y=m.length/3-1;ga))p.applyMatrix4(this.matrixWorld),(M=r.ray.origin.distanceTo(p))r.far||n.push({distance:M,point:u.clone().applyMatrix4(this.matrixWorld),index:g,face:null,faceIndex:null,object:this})}}else if(s.isGeometry){var w=s.vertices,_=w.length;for(g=0;g<_-1;g+=d){var M;if(!(t.distanceSqToSegment(w[g],w[g+1],p,u)>a))p.applyMatrix4(this.matrixWorld),(M=r.ray.origin.distanceTo(p))r.far||n.push({distance:M,point:u.clone().applyMatrix4(this.matrixWorld),index:g,face:null,faceIndex:null,object:this})}}}}}(),clone:function(){return new this.constructor(this.geometry,this.material).copy(this)}}),vn.prototype=Object.assign(Object.create(mn.prototype),{constructor:vn,isLineSegments:!0}),gn.prototype=Object.assign(Object.create(mn.prototype),{constructor:gn,isLineLoop:!0}),yn.prototype=Object.create(Ci.prototype),yn.prototype.constructor=yn,yn.prototype.isPointsMaterial=!0,yn.prototype.copy=function(e){return Ci.prototype.copy.call(this,e),this.color.copy(e.color),this.map=e.map,this.size=e.size,this.sizeAttenuation=e.sizeAttenuation,this},xn.prototype=Object.assign(Object.create(Xi.prototype),{constructor:xn,isPoints:!0,raycast:function(){var e=new vt,t=new Sr,i=new Ii;return function(r,n){var o=this,a=this.geometry,s=this.matrixWorld,c=r.params.Points.threshold;if(null===a.boundingSphere&&a.computeBoundingSphere(),i.copy(a.boundingSphere),i.applyMatrix4(s),i.radius+=c,!1!==r.ray.intersectsSphere(i)){e.getInverse(s),t.copy(r.ray).applyMatrix4(e);var h=c/((this.scale.x+this.scale.y+this.scale.z)/3),l=h*h,u=new yt;if(a.isBufferGeometry){var p=a.index,d=a.attributes.position.array;if(null!==p)for(var f=p.array,m=0,v=f.length;mr.far)return;n.push({distance:h,distanceToRay:Math.sqrt(a),point:c.clone(),index:i,face:null,object:o})}}}}(),clone:function(){return new this.constructor(this.geometry,this.material).copy(this)}}),bn.prototype=Object.assign(Object.create(Xi.prototype),{constructor:bn,isGroup:!0}),wn.prototype=Object.assign(Object.create(wt.prototype),{constructor:wn,isVideoTexture:!0,update:function(){var e=this.image;e.readyState>=e.HAVE_CURRENT_DATA&&(this.needsUpdate=!0)}}),_n.prototype=Object.create(wt.prototype),_n.prototype.constructor=_n,_n.prototype.isCompressedTexture=!0,Mn.prototype=Object.create(wt.prototype),Mn.prototype.constructor=Mn,Mn.prototype.isDepthTexture=!0,En.prototype=Object.create(xr.prototype),En.prototype.constructor=En,Tn.prototype=Object.create(Ki.prototype),Tn.prototype.constructor=Tn,Sn.prototype=Object.create(xr.prototype),Sn.prototype.constructor=Sn,An.prototype=Object.create(Ki.prototype),An.prototype.constructor=An,Rn.prototype=Object.create(xr.prototype),Rn.prototype.constructor=Rn,Ln.prototype=Object.create(Ki.prototype),Ln.prototype.constructor=Ln,Cn.prototype=Object.create(Rn.prototype),Cn.prototype.constructor=Cn,Pn.prototype=Object.create(Ki.prototype),Pn.prototype.constructor=Pn,Nn.prototype=Object.create(Rn.prototype),Nn.prototype.constructor=Nn,On.prototype=Object.create(Ki.prototype),On.prototype.constructor=On,In.prototype=Object.create(Rn.prototype),In.prototype.constructor=In,Dn.prototype=Object.create(Ki.prototype),Dn.prototype.constructor=Dn,Un.prototype=Object.create(Rn.prototype),Un.prototype.constructor=Un,Fn.prototype=Object.create(Ki.prototype),Fn.prototype.constructor=Fn,Bn.prototype=Object.create(xr.prototype),Bn.prototype.constructor=Bn,zn.prototype=Object.create(Ki.prototype),zn.prototype.constructor=zn,kn.prototype=Object.create(xr.prototype),kn.prototype.constructor=kn,Gn.prototype=Object.create(Ki.prototype),Gn.prototype.constructor=Gn,Vn.prototype=Object.create(xr.prototype),Vn.prototype.constructor=Vn;var Hn=function(e,t,i){i=i||2;var r,n,o,a,s,c,h,l=t&&t.length,u=l?t[0]*i:e.length,p=jn(e,0,u,i,!0),d=[];if(!p)return d;if(l&&(p=function(e,t,i,r){var n,o,a,s,c,h=[];for(n=0,o=t.length;n80*i){r=o=e[0],n=a=e[1];for(var f=i;fo&&(o=s),c>a&&(a=c);h=0!==(h=Math.max(o-r,a-n))?1/h:0}return Xn(p,d,i,r,n,h),d};function jn(e,t,i,r,n){var o,a;if(n===function(e,t,i,r){for(var n=0,o=t,a=i-r;o0)for(o=t;o=t;o-=r)a=co(o,e[o],e[o+1],a);return a&&no(a,a.next)&&(ho(a),a=a.next),a}function Wn(e,t){if(!e)return e;t||(t=e);var i,r=e;do{if(i=!1,r.steiner||!no(r,r.next)&&0!==ro(r.prev,r,r.next))r=r.next;else{if(ho(r),(r=t=r.prev)===r.next)break;i=!0}}while(i||r!==t);return t}function Xn(e,t,i,r,n,o,a){if(e){!a&&o&&function(e,t,i,r){var n=e;do{null===n.z&&(n.z=$n(n.x,n.y,t,i,r)),n.prevZ=n.prev,n.nextZ=n.next,n=n.next}while(n!==e);n.prevZ.nextZ=null,n.prevZ=null,function(e){var t,i,r,n,o,a,s,c,h=1;do{for(i=e,e=null,o=null,a=0;i;){for(a++,r=i,s=0,t=0;t0||c>0&&r;)0!==s&&(0===c||!r||i.z<=r.z)?(n=i,i=i.nextZ,s--):(n=r,r=r.nextZ,c--),o?o.nextZ=n:e=n,n.prevZ=o,o=n;i=r}o.nextZ=null,h*=2}while(a>1)}(n)}(e,r,n,o);for(var s,c,h=e;e.prev!==e.next;)if(s=e.prev,c=e.next,o?Yn(e,r,n,o):qn(e))t.push(s.i/i),t.push(e.i/i),t.push(c.i/i),ho(e),e=c.next,h=c.next;else if((e=c)===h){a?1===a?Xn(e=Zn(e,t,i),t,i,r,n,o,2):2===a&&Jn(e,t,i,r,n,o):Xn(Wn(e),t,i,r,n,o,1);break}}}function qn(e){var t=e.prev,i=e,r=e.next;if(ro(t,i,r)>=0)return!1;for(var n=e.next.next;n!==e.prev;){if(to(t.x,t.y,i.x,i.y,r.x,r.y,n.x,n.y)&&ro(n.prev,n,n.next)>=0)return!1;n=n.next}return!0}function Yn(e,t,i,r){var n=e.prev,o=e,a=e.next;if(ro(n,o,a)>=0)return!1;for(var s=n.xo.x?n.x>a.x?n.x:a.x:o.x>a.x?o.x:a.x,l=n.y>o.y?n.y>a.y?n.y:a.y:o.y>a.y?o.y:a.y,u=$n(s,c,t,i,r),p=$n(h,l,t,i,r),d=e.nextZ;d&&d.z<=p;){if(d!==e.prev&&d!==e.next&&to(n.x,n.y,o.x,o.y,a.x,a.y,d.x,d.y)&&ro(d.prev,d,d.next)>=0)return!1;d=d.nextZ}for(d=e.prevZ;d&&d.z>=u;){if(d!==e.prev&&d!==e.next&&to(n.x,n.y,o.x,o.y,a.x,a.y,d.x,d.y)&&ro(d.prev,d,d.next)>=0)return!1;d=d.prevZ}return!0}function Zn(e,t,i){var r=e;do{var n=r.prev,o=r.next.next;!no(n,o)&&oo(n,r,r.next,o)&&ao(n,o)&&ao(o,n)&&(t.push(n.i/i),t.push(r.i/i),t.push(o.i/i),ho(r),ho(r.next),r=e=o),r=r.next}while(r!==e);return r}function Jn(e,t,i,r,n,o){var a=e;do{for(var s=a.next.next;s!==a.prev;){if(a.i!==s.i&&io(a,s)){var c=so(a,s);return a=Wn(a,a.next),c=Wn(c,c.next),Xn(a,t,i,r,n,o),void Xn(c,t,i,r,n,o)}s=s.next}a=a.next}while(a!==e)}function Qn(e,t){return e.x-t.x}function Kn(e,t){if(t=function(e,t){var i,r=t,n=e.x,o=e.y,a=-1/0;do{if(o<=r.y&&o>=r.next.y&&r.next.y!==r.y){var s=r.x+(o-r.y)*(r.next.x-r.x)/(r.next.y-r.y);if(s<=n&&s>a){if(a=s,s===n){if(o===r.y)return r;if(o===r.next.y)return r.next}i=r.x=r.x&&r.x>=l&&n!==r.x&&to(oi.x)&&ao(r,e)&&(i=r,p=c),r=r.next;return i}(e,t)){var i=so(t,e);Wn(i,i.next)}}function $n(e,t,i,r,n){return(e=1431655765&((e=858993459&((e=252645135&((e=16711935&((e=32767*(e-i)*n)|e<<8))|e<<4))|e<<2))|e<<1))|(t=1431655765&((t=858993459&((t=252645135&((t=16711935&((t=32767*(t-r)*n)|t<<8))|t<<4))|t<<2))|t<<1))<<1}function eo(e){var t=e,i=e;do{t.x=0&&(e-a)*(r-s)-(i-a)*(t-s)>=0&&(i-a)*(o-s)-(n-a)*(r-s)>=0}function io(e,t){return e.next.i!==t.i&&e.prev.i!==t.i&&!function(e,t){var i=e;do{if(i.i!==e.i&&i.next.i!==e.i&&i.i!==t.i&&i.next.i!==t.i&&oo(i,i.next,e,t))return!0;i=i.next}while(i!==e);return!1}(e,t)&&ao(e,t)&&ao(t,e)&&function(e,t){var i=e,r=!1,n=(e.x+t.x)/2,o=(e.y+t.y)/2;do{i.y>o!=i.next.y>o&&i.next.y!==i.y&&n<(i.next.x-i.x)*(o-i.y)/(i.next.y-i.y)+i.x&&(r=!r),i=i.next}while(i!==e);return r}(e,t)}function ro(e,t,i){return(t.y-e.y)*(i.x-t.x)-(t.x-e.x)*(i.y-t.y)}function no(e,t){return e.x===t.x&&e.y===t.y}function oo(e,t,i,r){return!!(no(e,t)&&no(i,r)||no(e,r)&&no(i,t))||ro(e,t,i)>0!=ro(e,t,r)>0&&ro(i,r,e)>0!=ro(i,r,t)>0}function ao(e,t){return ro(e.prev,e,e.next)<0?ro(e,t,e.next)>=0&&ro(e,e.prev,t)>=0:ro(e,t,e.prev)<0||ro(e,e.next,t)<0}function so(e,t){var i=new lo(e.i,e.x,e.y),r=new lo(t.i,t.x,t.y),n=e.next,o=t.prev;return e.next=t,t.prev=e,i.next=n,n.prev=i,r.next=i,i.prev=r,o.next=r,r.prev=o,r}function co(e,t,i,r){var n=new lo(e,t,i);return r?(n.next=r.next,n.prev=r,r.next.prev=n,r.next=n):(n.prev=n,n.next=n),n}function ho(e){e.next.prev=e.prev,e.prev.next=e.next,e.prevZ&&(e.prevZ.nextZ=e.nextZ),e.nextZ&&(e.nextZ.prevZ=e.prevZ)}function lo(e,t,i){this.i=e,this.x=t,this.y=i,this.prev=null,this.next=null,this.z=null,this.prevZ=null,this.nextZ=null,this.steiner=!1}var uo={area:function(e){for(var t=e.length,i=0,r=t-1,n=0;n2&&e[t-1].equals(e[0])&&e.pop()}function r(e,t){for(var i=0;i0)&&f.push(w,_,E),(c!==i-1||h0&&g(!0),t>0&&g(!1)),this.setIndex(h),this.addAttribute("position",new sr(l,3)),this.addAttribute("normal",new sr(u,3)),this.addAttribute("uv",new sr(p,2))}function Lo(e,t,i,r,n,o,a){Ao.call(this,0,e,t,i,r,n,o,a),this.type="ConeGeometry",this.parameters={radius:e,height:t,radialSegments:i,heightSegments:r,openEnded:n,thetaStart:o,thetaLength:a}}function Co(e,t,i,r,n,o,a){Ro.call(this,0,e,t,i,r,n,o,a),this.type="ConeBufferGeometry",this.parameters={radius:e,height:t,radialSegments:i,heightSegments:r,openEnded:n,thetaStart:o,thetaLength:a}}function Po(e,t,i,r){Ki.call(this),this.type="CircleGeometry",this.parameters={radius:e,segments:t,thetaStart:i,thetaLength:r},this.fromBufferGeometry(new No(e,t,i,r)),this.mergeVertices()}function No(e,t,i,r){xr.call(this),this.type="CircleBufferGeometry",this.parameters={radius:e,segments:t,thetaStart:i,thetaLength:r},e=e||1,t=void 0!==t?Math.max(3,t):8,i=void 0!==i?i:0,r=void 0!==r?r:2*Math.PI;var n,o,a=[],s=[],c=[],h=[],l=new yt,u=new mt;for(s.push(0,0,0),c.push(0,0,1),h.push(.5,.5),o=0,n=3;o<=t;o++,n+=3){var p=i+o/t*r;l.x=e*Math.cos(p),l.y=e*Math.sin(p),s.push(l.x,l.y,l.z),c.push(0,0,1),u.x=(s[n]/e+1)/2,u.y=(s[n+1]/e+1)/2,h.push(u.x,u.y)}for(n=1;n<=t;n++)a.push(n,n+1,0);this.setIndex(a),this.addAttribute("position",new sr(s,3)),this.addAttribute("normal",new sr(c,3)),this.addAttribute("uv",new sr(h,2))}po.prototype=Object.create(Ki.prototype),po.prototype.constructor=po,fo.prototype=Object.create(xr.prototype),fo.prototype.constructor=fo,fo.prototype.getArrays=function(){var e=this.getAttribute("position"),t=e?Array.prototype.slice.call(e.array):[],i=this.getAttribute("uv"),r=i?Array.prototype.slice.call(i.array):[],n=this.index;return{position:t,uv:r,index:n?Array.prototype.slice.call(n.array):[]}},fo.prototype.addShapeList=function(e,t){var i=e.length;t.arrays=this.getArrays();for(var r=0;rNumber.EPSILON){var p=Math.sqrt(l),d=Math.sqrt(c*c+h*h),f=t.x-s/p,m=t.y+a/p,v=((i.x-h/d-f)*h-(i.y+c/d-m)*c)/(a*h-s*c),g=(r=f+a*v-e.x)*r+(n=m+s*v-e.y)*n;if(g<=2)return new mt(r,n);o=Math.sqrt(g/2)}else{var y=!1;a>Number.EPSILON?c>Number.EPSILON&&(y=!0):a<-Number.EPSILON?c<-Number.EPSILON&&(y=!0):Math.sign(s)===Math.sign(h)&&(y=!0),y?(r=-s,n=a,o=Math.sqrt(l)):(r=a,n=s,o=Math.sqrt(l/2))}return new mt(r/o,n/o)}for(var G=[],V=0,H=C.length,j=H-1,W=V+1;V=0;N--){for(I=N/y,D=v*Math.cos(I*Math.PI/2),O=g*Math.sin(I*Math.PI/2),V=0,H=C.length;V=0;){i=V,(r=V-1)<0&&(r=e.length-1);var n=0,o=w+2*y;for(n=0;n0||0===e.search(/^data\:image\/jpeg/);n.format=r?Be:ze,n.needsUpdate=!0,void 0!==t&&t(n)},i,r),n},setCrossOrigin:function(e){return this.crossOrigin=e,this},setPath:function(e){return this.path=e,this}}),Object.assign(ea.prototype,{getPoint:function(){return console.warn("THREE.Curve: .getPoint() not implemented."),null},getPointAt:function(e,t){var i=this.getUtoTmapping(e);return this.getPoint(i,t)},getPoints:function(e){void 0===e&&(e=5);for(var t=[],i=0;i<=e;i++)t.push(this.getPoint(i/e));return t},getSpacedPoints:function(e){void 0===e&&(e=5);for(var t=[],i=0;i<=e;i++)t.push(this.getPointAt(i/e));return t},getLength:function(){var e=this.getLengths();return e[e.length-1]},getLengths:function(e){if(void 0===e&&(e=this.arcLengthDivisions),this.cacheArcLengths&&this.cacheArcLengths.length===e+1&&!this.needsUpdate)return this.cacheArcLengths;this.needsUpdate=!1;var t,i,r=[],n=this.getPoint(0),o=0;for(r.push(0),i=1;i<=e;i++)o+=(t=this.getPoint(i/e)).distanceTo(n),r.push(o),n=t;return this.cacheArcLengths=r,r},updateArcLengths:function(){this.needsUpdate=!0,this.getLengths()},getUtoTmapping:function(e,t){var i,r=this.getLengths(),n=0,o=r.length;i=t||e*r[o-1];for(var a,s=0,c=o-1;s<=c;)if((a=r[n=Math.floor(s+(c-s)/2)]-i)<0)s=n+1;else{if(!(a>0)){c=n;break}c=n-1}if(r[n=c]===i)return n/(o-1);var h=r[n];return(n+(i-h)/(r[n+1]-h))/(o-1)},getTangent:function(e){var t=e-1e-4,i=e+1e-4;t<0&&(t=0),i>1&&(i=1);var r=this.getPoint(t);return this.getPoint(i).clone().sub(r).normalize()},getTangentAt:function(e){var t=this.getUtoTmapping(e);return this.getTangent(t)},computeFrenetFrames:function(e,t){var i,r,n,o=new yt,a=[],s=[],c=[],h=new yt,l=new vt;for(i=0;i<=e;i++)r=i/e,a[i]=this.getTangentAt(r),a[i].normalize();s[0]=new yt,c[0]=new yt;var u=Number.MAX_VALUE,p=Math.abs(a[0].x),d=Math.abs(a[0].y),f=Math.abs(a[0].z);for(p<=u&&(u=p,o.set(1,0,0)),d<=u&&(u=d,o.set(0,1,0)),f<=u&&o.set(0,0,1),h.crossVectors(a[0],o).normalize(),s[0].crossVectors(a[0],h),c[0].crossVectors(a[0],s[0]),i=1;i<=e;i++)s[i]=s[i-1].clone(),c[i]=c[i-1].clone(),h.crossVectors(a[i-1],a[i]),h.length()>Number.EPSILON&&(h.normalize(),n=Math.acos(ft.clamp(a[i-1].dot(a[i]),-1,1)),s[i].applyMatrix4(l.makeRotationAxis(h,n))),c[i].crossVectors(a[i],s[i]);if(!0===t)for(n=Math.acos(ft.clamp(s[0].dot(s[e]),-1,1)),n/=e,a[0].dot(h.crossVectors(s[0],s[e]))>0&&(n=-n),i=1;i<=e;i++)s[i].applyMatrix4(l.makeRotationAxis(a[i],n*i)),c[i].crossVectors(a[i],s[i]);return{tangents:a,normals:s,binormals:c}},clone:function(){return(new this.constructor).copy(this)},copy:function(e){return this.arcLengthDivisions=e.arcLengthDivisions,this},toJSON:function(){var e={metadata:{version:4.5,type:"Curve",generator:"Curve.toJSON"}};return e.arcLengthDivisions=this.arcLengthDivisions,e.type=this.type,e},fromJSON:function(e){return this.arcLengthDivisions=e.arcLengthDivisions,this}}),ta.prototype=Object.create(ea.prototype),ta.prototype.constructor=ta,ta.prototype.isEllipseCurve=!0,ta.prototype.getPoint=function(e,t){for(var i=t||new mt,r=2*Math.PI,n=this.aEndAngle-this.aStartAngle,o=Math.abs(n)r;)n-=r;n0?0:(Math.floor(Math.abs(l)/s.length)+1)*s.length:0===u&&l===c-1&&(l=c-2,u=1),this.closed||l>0?i=s[(l-1)%c]:(na.subVectors(s[0],s[1]).add(s[0]),i=na),r=s[l%c],n=s[(l+1)%c],this.closed||l+2r.length-2?r.length-1:o+1],l=r[o>r.length-3?r.length-1:o+2];return i.set(ha(a,s.x,c.x,h.x,l.x),ha(a,s.y,c.y,h.y,l.y)),i},ya.prototype.copy=function(e){ea.prototype.copy.call(this,e),this.points=[];for(var t=0,i=e.points.length;t=t){var n=i[r]-t,o=this.curves[r],a=o.getLength(),s=0===a?0:1-n/a;return o.getPointAt(s)}r++}return null},getLength:function(){var e=this.getCurveLengths();return e[e.length-1]},updateArcLengths:function(){this.needsUpdate=!0,this.cacheLengths=null,this.getCurveLengths()},getCurveLengths:function(){if(this.cacheLengths&&this.cacheLengths.length===this.curves.length)return this.cacheLengths;for(var e=[],t=0,i=0,r=this.curves.length;i1&&!i[i.length-1].equals(i[0])&&i.push(i[0]),i},copy:function(e){ea.prototype.copy.call(this,e),this.curves=[];for(var t=0,i=e.curves.length;t0){var h=c.getPoint(0);h.equals(this.currentPoint)||this.lineTo(h.x,h.y)}this.curves.push(c);var l=c.getPoint(1);this.currentPoint.copy(l)},copy:function(e){return ba.prototype.copy.call(this,e),this.currentPoint.copy(e.currentPoint),this},toJSON:function(){var e=ba.prototype.toJSON.call(this);return e.currentPoint=this.currentPoint.toArray(),e},fromJSON:function(e){return ba.prototype.fromJSON.call(this,e),this.currentPoint.fromArray(e.currentPoint),this}}),_a.prototype=Object.assign(Object.create(wa.prototype),{constructor:_a,getPointsHoles:function(e){for(var t=[],i=0,r=this.holes.length;i=n)break e;var s=t[1];e=(n=t[--i-1]))break t}o=i,i=0}for(;i>>1;et;)--o;if(++o,0!==n||o!==r){n>=o&&(n=(o=Math.max(o,1))-1);var a=this.getValueSize();this.times=Ha.arraySlice(i,n,o),this.values=Ha.arraySlice(this.values,n*a,o*a)}return this},validate:function(){var e=!0,t=this.getValueSize();t-Math.floor(t)!=0&&(console.error("THREE.KeyframeTrack: Invalid value size in track.",this),e=!1);var i=this.times,r=this.values,n=i.length;0===n&&(console.error("THREE.KeyframeTrack: Track is empty.",this),e=!1);for(var o=null,a=0;a!==n;a++){var s=i[a];if("number"==typeof s&&isNaN(s)){console.error("THREE.KeyframeTrack: Time is not a valid number.",this,a,s),e=!1;break}if(null!==o&&o>s){console.error("THREE.KeyframeTrack: Out of order keys.",this,a,s,o),e=!1;break}o=s}if(void 0!==r&&Ha.isTypedArray(r)){a=0;for(var c=r.length;a!==c;++a){var h=r[a];if(isNaN(h)){console.error("THREE.KeyframeTrack: Value is not a valid number.",this,a,h),e=!1;break}}}return e},optimize:function(){for(var e=this.times,t=this.values,i=this.getValueSize(),r=2302===this.getInterpolation(),n=1,o=e.length-1,a=1;a0){e[n]=e[o];for(f=o*i,m=n*i,p=0;p!==i;++p)t[m+p]=t[f+p];++n}return n!==e.length&&(this.times=Ha.arraySlice(e,0,n),this.values=Ha.arraySlice(t,0,n*i)),this}}),Wa.prototype=Object.assign(Object.create(ja.prototype),{constructor:Wa,ValueTypeName:"vector"}),Object.assign(Xa,{parse:function(e){for(var t=[],i=e.tracks,r=1/(e.fps||1),n=0,o=i.length;n!==o;++n)t.push(ja.parse(i[n]).scale(r));return new Xa(e.name,e.duration,t)},toJSON:function(e){for(var t=[],i=e.tracks,r={name:e.name,duration:e.duration,tracks:t},n=0,o=i.length;n!==o;++n)t.push(ja.toJSON(i[n]));return r},CreateFromMorphTargetSequence:function(e,t,i,r){for(var n=t.length,o=[],a=0;a1){var h=r[u=c[1]];h||(r[u]=h=[]),h.push(s)}}var l=[];for(var u in r)l.push(Xa.CreateFromMorphTargetSequence(u,r[u],t,i));return l},parseAnimation:function(e,t){if(!e)return console.error("THREE.AnimationClip: No animation in JSONLoader data."),null;for(var i=function(e,t,i,r,n){if(0!==i.length){var o=[],a=[];Ha.flattenJSON(i,o,a,r),0!==o.length&&n.push(new e(t,o,a))}},r=[],n=e.name||"default",o=e.length||-1,a=e.fps||30,s=e.hierarchy||[],c=0;c1?e.skinWeights[r+1]:0,s=i>2?e.skinWeights[r+2]:0,c=i>3?e.skinWeights[r+3]:0;t.skinWeights.push(new _t(o,a,s,c))}if(e.skinIndices)for(r=0,n=e.skinIndices.length;r1?e.skinIndices[r+1]:0,u=i>2?e.skinIndices[r+2]:0,p=i>3?e.skinIndices[r+3]:0;t.skinIndices.push(new _t(h,l,u,p))}t.bones=e.bones,t.bones&&t.bones.length>0&&(t.skinWeights.length!==t.skinIndices.length||t.skinIndices.length!==t.vertices.length)&&console.warn("When skinning, number of vertices ("+t.vertices.length+"), skinIndices ("+t.skinIndices.length+"), and skinWeights ("+t.skinWeights.length+") should match.")}(e,i),function(e,t){var i=e.scale;if(void 0!==e.morphTargets)for(var r=0,n=e.morphTargets.length;r0){console.warn('THREE.JSONLoader: "morphColors" no longer supported. Using them as face colors.');var l=t.faces,u=e.morphColors[0].colors;for(r=0,n=l.length;r0&&(t.animations=i)}(e,i),i.computeFaceNormals(),i.computeBoundingSphere(),void 0===e.materials||0===e.materials.length?{geometry:i}:{geometry:i,materials:es.prototype.initMaterials(e.materials,t,this.crossOrigin)}}}()}),Object.assign(rs.prototype,{load:function(e,t,i,r){""===this.texturePath&&(this.texturePath=e.substring(0,e.lastIndexOf("/")+1));var n=this;new Yo(n.manager).load(e,function(i){var o=null;try{o=JSON.parse(i)}catch(t){return void 0!==r&&r(t),void console.error("THREE:ObjectLoader: Can't parse "+e+".",t.message)}var a=o.metadata;void 0!==a&&void 0!==a.type&&"geometry"!==a.type.toLowerCase()?n.parse(o,t):console.error("THREE.ObjectLoader: Can't load "+e+". Use THREE.JSONLoader instead.")},i,r)},setTexturePath:function(e){this.texturePath=e},setCrossOrigin:function(e){this.crossOrigin=e},parse:function(e,t){var i=this.parseShape(e.shapes),r=this.parseGeometries(e.geometries,i),n=this.parseImages(e.images,function(){void 0!==t&&t(s)}),o=this.parseTextures(e.textures,n),a=this.parseMaterials(e.materials,o),s=this.parseObject(e.object,r,a);return e.animations&&(s.animations=this.parseAnimations(e.animations)),void 0!==e.images&&0!==e.images.length||void 0!==t&&t(s),s},parseShape:function(e){var t={};if(void 0!==e)for(var i=0,r=e.length;i0){var o=new Qo(new Wo(t));o.setCrossOrigin(this.crossOrigin);for(var a=0,s=e.length;a0?new dn(s,c):new Lr(s,c);break;case"LOD":n=new ln;break;case"Line":n=new mn(o(t.geometry),a(t.material),t.mode);break;case"LineLoop":n=new gn(o(t.geometry),a(t.material));break;case"LineSegments":n=new vn(o(t.geometry),a(t.material));break;case"PointCloud":case"Points":n=new xn(o(t.geometry),a(t.material));break;case"Sprite":n=new hn(a(t.material));break;case"Group":n=new bn;break;default:n=new Xi}if(n.uuid=t.uuid,void 0!==t.name&&(n.name=t.name),void 0!==t.matrix?(e.fromArray(t.matrix),e.decompose(n.position,n.quaternion,n.scale)):(void 0!==t.position&&n.position.fromArray(t.position),void 0!==t.rotation&&n.rotation.fromArray(t.rotation),void 0!==t.quaternion&&n.quaternion.fromArray(t.quaternion),void 0!==t.scale&&n.scale.fromArray(t.scale)),void 0!==t.castShadow&&(n.castShadow=t.castShadow),void 0!==t.receiveShadow&&(n.receiveShadow=t.receiveShadow),t.shadow&&(void 0!==t.shadow.bias&&(n.shadow.bias=t.shadow.bias),void 0!==t.shadow.radius&&(n.shadow.radius=t.shadow.radius),void 0!==t.shadow.mapSize&&n.shadow.mapSize.fromArray(t.shadow.mapSize),void 0!==t.shadow.camera&&(n.shadow.camera=this.parseObject(t.shadow.camera))),void 0!==t.visible&&(n.visible=t.visible),void 0!==t.userData&&(n.userData=t.userData),void 0!==t.children)for(var h=t.children,l=0;lNumber.EPSILON){if(h<0&&(a=t[o],c=-c,s=t[n],h=-h),e.ys.y)continue;if(e.y===a.y){if(e.x===a.x)return!0}else{var l=h*(e.x-a.x)-c*(e.y-a.y);if(0===l)return!0;if(l<0)continue;r=!r}}else{if(e.y!==a.y)continue;if(s.x<=e.x&&e.x<=a.x||a.x<=e.x&&e.x<=s.x)return!0}}return r}var n=uo.isClockWise,o=this.subPaths;if(0===o.length)return[];if(!0===t)return i(o);var a,s,c,h=[];if(1===o.length)return s=o[0],(c=new _a).curves=s.curves,h.push(c),h;var l=!n(o[0].getPoints());l=e?!l:l;var u,p,d=[],f=[],m=[],v=0;f[v]=void 0,m[v]=[];for(var g=0,y=o.length;g1){for(var x=!1,b=[],w=0,_=f.length;w<_;w++)d[w]=[];for(w=0,_=f.length;w<_;w++)for(var M=m[w],E=0;E0&&(x||(m=d))}g=0;for(var R=f.length;g0){this.source.connect(this.filters[0]);for(var e=1,t=this.filters.length;e0){this.source.disconnect(this.filters[0]);for(var e=1,t=this.filters.length;e=.5)for(var o=0;o!==n;++o)e[t+o]=e[i+o]},_slerp:function(e,t,i,r){gt.slerpFlat(e,t,e,t,e,i,r)},_lerp:function(e,t,i,r,n){for(var o=1-r,a=0;a!==n;++a){var s=t+a;e[s]=e[s]*o+e[i+a]*r}}}),Object.assign(Fs.prototype,{getValue:function(e,t){this.bind();var i=this._targetGroup.nCachedObjects_,r=this._bindings[i];void 0!==r&&r.getValue(e,t)},setValue:function(e,t){for(var i=this._bindings,r=this._targetGroup.nCachedObjects_,n=i.length;r!==n;++r)i[r].setValue(e,t)},bind:function(){for(var e=this._bindings,t=this._targetGroup.nCachedObjects_,i=e.length;t!==i;++t)e[t].bind()},unbind:function(){for(var e=this._bindings,t=this._targetGroup.nCachedObjects_,i=e.length;t!==i;++t)e[t].unbind()}}),Object.assign(Bs,{Composite:Fs,create:function(e,t,i){return e&&e.isAnimationObjectGroup?new Bs.Composite(e,t,i):new Bs(e,t,i)},sanitizeNodeName:function(e){return e.replace(/\s/g,"_").replace(/[^\w-]/g,"")},parseTrackName:(_s=new RegExp("^"+/((?:[\w-]+[\/:])*)/.source+/([\w-\.]+)?/.source+/(?:\.([\w-]+)(?:\[(.+)\])?)?/.source+/\.([\w-]+)(?:\[(.+)\])?/.source+"$"),Ms=["material","materials","bones"],function(e){var t=_s.exec(e);if(!t)throw new Error("PropertyBinding: Cannot parse trackName: "+e);var i={nodeName:t[2],objectName:t[3],objectIndex:t[4],propertyName:t[5],propertyIndex:t[6]},r=i.nodeName&&i.nodeName.lastIndexOf(".");if(void 0!==r&&-1!==r){var n=i.nodeName.substring(r+1);-1!==Ms.indexOf(n)&&(i.nodeName=i.nodeName.substring(0,r),i.objectName=n)}if(null===i.propertyName||0===i.propertyName.length)throw new Error("PropertyBinding: can not parse propertyName from trackName: "+e);return i}),findNode:function(e,t){if(!t||""===t||"root"===t||"."===t||-1===t||t===e.name||t===e.uuid)return e;if(e.skeleton){var i=function(e){for(var i=0;i=t){var l=t++,u=e[l];i[u.uuid]=h,e[h]=u,i[c]=l,e[l]=s;for(var p=0,d=n;p!==d;++p){var f=r[p],m=f[l],v=f[h];f[h]=m,f[l]=v}}}this.nCachedObjects_=t},uncache:function(){for(var e=this._objects,t=e.length,i=this.nCachedObjects_,r=this._indicesByUUID,n=this._bindings,o=n.length,a=0,s=arguments.length;a!==s;++a){var c=arguments[a].uuid,h=r[c];if(void 0!==h)if(delete r[c],h0)for(var c=this._interpolants,h=this._propertyBindings,l=0,u=c.length;l!==u;++l)c[l].evaluate(a),h[l].accumulate(r,s)}else this._updateWeight(e)},_updateWeight:function(e){var t=0;if(this.enabled){t=this.weight;var i=this._weightInterpolant;if(null!==i){var r=i.evaluate(e)[0];t*=r,e>i.parameterPositions[1]&&(this.stopFading(),0===r&&(this.enabled=!1))}}return this._effectiveWeight=t,t},_updateTimeScale:function(e){var t=0;if(!this.paused){t=this.timeScale;var i=this._timeScaleInterpolant;if(null!==i)t*=i.evaluate(e)[0],e>i.parameterPositions[1]&&(this.stopWarping(),0===t?this.paused=!0:this.timeScale=t)}return this._effectiveTimeScale=t,t},_updateTime:function(e){var t=this.time+e;if(0===e)return t;var i=this._clip.duration,r=this.loop,n=this._loopCount;if(2200===r){-1===n&&(this._loopCount=0,this._setEndings(!0,!0,!1));e:{if(t>=i)t=i;else{if(!(t<0))break e;t=0}this.clampWhenFinished?this.paused=!0:this.enabled=!1,this._mixer.dispatchEvent({type:"finished",action:this,direction:e<0?-1:1})}}else{var o=2202===r;if(-1===n&&(e>=0?(n=0,this._setEndings(!0,0===this.repetitions,o)):this._setEndings(0===this.repetitions,!0,o)),t>=i||t<0){var a=Math.floor(t/i);t-=i*a,n+=Math.abs(a);var s=this.repetitions-n;if(s<0)this.clampWhenFinished?this.paused=!0:this.enabled=!1,t=e>0?i:0,this._mixer.dispatchEvent({type:"finished",action:this,direction:e>0?1:-1});else{if(0===s){var c=e<0;this._setEndings(c,!c,o)}else this._setEndings(!1,!1,o);this._loopCount=n,this._mixer.dispatchEvent({type:"loop",action:this,loopDelta:a})}}if(o&&1==(1&n))return this.time=t,i-t}return this.time=t,t},_setEndings:function(e,t,i){var r=this._interpolantSettings;i?(r.endingStart=2401,r.endingEnd=2401):(r.endingStart=e?this.zeroSlopeAtStart?2401:tt:2402,r.endingEnd=t?this.zeroSlopeAtEnd?2401:tt:2402)},_scheduleFading:function(e,t,i){var r=this._mixer,n=r.time,o=this._weightInterpolant;null===o&&(o=r._lendControlInterpolant(),this._weightInterpolant=o);var a=o.parameterPositions,s=o.sampleValues;return a[0]=n,s[0]=t,a[1]=n+e,s[1]=i,this}}),Gs.prototype=Object.assign(Object.create(i.prototype),{constructor:Gs,_bindAction:function(e,t){var i=e._localRoot||this._root,r=e._clip.tracks,n=r.length,o=e._propertyBindings,a=e._interpolants,s=i.uuid,c=this._bindingsByRootAndName,h=c[s];void 0===h&&(h={},c[s]=h);for(var l=0;l!==n;++l){var u=r[l],p=u.name,d=h[p];if(void 0!==d)o[l]=d;else{if(void 0!==(d=o[l])){null===d._cacheIndex&&(++d.referenceCount,this._addInactiveBinding(d,s,p));continue}var f=t&&t._propertyBindings[l].binding.parsedPath;++(d=new Us(Bs.create(i,p,f),u.ValueTypeName,u.getValueSize())).referenceCount,this._addInactiveBinding(d,s,p),o[l]=d}a[l].resultBuffer=d.buffer}},_activateAction:function(e){if(!this._isActiveAction(e)){if(null===e._cacheIndex){var t=(e._localRoot||this._root).uuid,i=e._clip.uuid,r=this._actionsByClip[i];this._bindAction(e,r&&r.knownActions[0]),this._addInactiveAction(e,i,t)}for(var n=e._propertyBindings,o=0,a=n.length;o!==a;++o){var s=n[o];0==s.useCount++&&(this._lendBinding(s),s.saveOriginalState())}this._lendAction(e)}},_deactivateAction:function(e){if(this._isActiveAction(e)){for(var t=e._propertyBindings,i=0,r=t.length;i!==r;++i){var n=t[i];0==--n.useCount&&(n.restoreOriginalState(),this._takeBackBinding(n))}this._takeBackAction(e)}},_initMemoryManager:function(){this._actions=[],this._nActiveActions=0,this._actionsByClip={},this._bindings=[],this._nActiveBindings=0,this._bindingsByRootAndName={},this._controlInterpolants=[],this._nActiveControlInterpolants=0;var e=this;this.stats={actions:{get total(){return e._actions.length},get inUse(){return e._nActiveActions}},bindings:{get total(){return e._bindings.length},get inUse(){return e._nActiveBindings}},controlInterpolants:{get total(){return e._controlInterpolants.length},get inUse(){return e._nActiveControlInterpolants}}}},_isActiveAction:function(e){var t=e._cacheIndex;return null!==t&&t.99999?this.quaternion.set(0,0,0,1):e.y<-.99999?this.quaternion.set(1,0,0,0):(As.set(e.z,0,-e.x).normalize(),Ss=Math.acos(e.y),this.quaternion.setFromAxisAngle(As,Ss))}),mc.prototype.setLength=function(e,t,i){void 0===t&&(t=.2*e),void 0===i&&(i=.2*t),this.line.scale.set(1,Math.max(0,e-t),1),this.line.updateMatrix(),this.cone.scale.set(i,t,i),this.cone.position.y=e,this.cone.updateMatrix()},mc.prototype.setColor=function(e){this.line.material.color.copy(e),this.cone.material.color.copy(e)},vc.prototype=Object.create(vn.prototype),vc.prototype.constructor=vc;var gc={createMultiMaterialObject:function(e,t){for(var i=new bn,r=0,n=t.length;r>5&31)/31,r=(w>>10&31)/31):(t=o,i=a,r=s)}for(var _=1;_<=3;_++){var M=g+12*_;f.push(h.getFloat32(M,!0)),f.push(h.getFloat32(M+4,!0)),f.push(h.getFloat32(M+8,!0)),m.push(y,x,b),u&&n.push(t,i,r)}}return d.addAttribute("position",new Ec.BufferAttribute(new Float32Array(f),3)),d.addAttribute("normal",new Ec.BufferAttribute(new Float32Array(m),3)),u&&(d.addAttribute("color",new Ec.BufferAttribute(new Float32Array(n),3)),d.hasColors=!0,d.alpha=c),d}(t):function(e){for(var t,i=new Ec.BufferGeometry,r=/facet([\s\S]*?)endfacet/g,n=0,o=/[\s]+([+-]?(?:\d+.\d+|\d+.|\d+|.\d+)(?:[eE][+-]?\d+)?)/.source,a=new RegExp("vertex"+o+o+o,"g"),s=new RegExp("normal"+o+o+o,"g"),c=[],h=[],l=new Ec.Vector3;null!==(t=r.exec(e));){for(var u=0,p=0,d=t[0];null!==(t=s.exec(d));)l.x=parseFloat(t[1]),l.y=parseFloat(t[2]),l.z=parseFloat(t[3]),p++;for(;null!==(t=a.exec(d));)c.push(parseFloat(t[1]),parseFloat(t[2]),parseFloat(t[3])),h.push(l.x,l.y,l.z),u++;1!==p&&console.error("THREE.STLLoader: Something isn't right with the normal of face number "+n),3!==u&&console.error("THREE.STLLoader: Something isn't right with the vertices of face number "+n),n++}return i.addAttribute("position",new Ec.Float32BufferAttribute(c,3)),i.addAttribute("normal",new Ec.Float32BufferAttribute(h,3)),i}(function(e){if("string"!=typeof e){var t=new Uint8Array(e);if(void 0!==window.TextDecoder)return(new TextDecoder).decode(t);for(var i="",r=0,n=e.byteLength;r0&&t.push(new Ec.VectorKeyframeTrack(r+".position",n,o)),a.length>0&&t.push(new Ec.QuaternionKeyframeTrack(r+".quaternion",n,a)),s.length>0&&t.push(new Ec.VectorKeyframeTrack(r+".scale",n,s)),t}function b(e,t,i){var r,n,o,a=!0;for(n=0,o=e.length;n=0;){var r=e[t];if(null!==r.value[i])return r;t--}return null}function _(e,t,i){for(;t0&&p.addAttribute("position",new Ec.Float32BufferAttribute(n.array,n.stride)),o.array.length>0&&p.addAttribute("normal",new Ec.Float32BufferAttribute(o.array,o.stride)),s.array.length>0&&p.addAttribute("color",new Ec.Float32BufferAttribute(s.array,s.stride)),a.array.length>0&&p.addAttribute("uv",new Ec.Float32BufferAttribute(a.array,a.stride)),c.length>0&&p.addAttribute("skinIndex",new Ec.Float32BufferAttribute(c,h)),l.length>0&&p.addAttribute("skinWeight",new Ec.Float32BufferAttribute(l,u)),r.data=p,r.type=e[0].type,r.materialKeys=d,r}function ie(e,t,i,r){var n=e.p,o=e.stride,a=e.vcount;function s(e){for(var t=n[e+i]*l,o=t+l;t0&&console.log("THREE.ColladaLoader: Geometry has faces with more than 4 vertices.")}else for(p=0,d=n.length;p=t.limits.max&&(t.static=!0),t.middlePosition=(t.limits.min+t.limits.max)/2,t}function ce(e){for(var t={sid:e.getAttribute("sid"),name:e.getAttribute("name")||"",attachments:[],transforms:[]},i=0;ir.limits.max||t0){var q=this.msgColor,Y=document.createElement("canvas"),Z=Y.getContext("2d");Z.font="normal 100px sans-serif";var J=Z.measureText(i.text).width;Y.width=J,Y.height=150,Z.font="normal 100px sans-serif",Z.fillStyle="rgba("+Math.round(255*q.r)+", "+Math.round(255*q.g)+", "+Math.round(255*q.b)+", "+q.a+")",Z.textAlign="left",Z.textBaseline="middle",Z.fillText(i.text,0,Y.height/2);var Q=new Ec.Texture(Y);Q.needsUpdate=!0;var K=new Ec.SpriteMaterial({map:Q,useScreenCoordinates:!1}),$=new Ec.Sprite(K),ee=i.scale.x;$.scale.set(J/Y.height*ee,ee,1),this.add($)}break;case Dc:var te=null;0===i.color.r&&0===i.color.g&&0===i.color.b&&0===i.color.a||(te=r),this.msgMesh=i.mesh_resource.substr(10);var ie=new rh({path:t,resource:this.msgMesh,material:te});this.add(ie);break;case Uc:var re=new nh({material:r,vertices:i.points,colors:i.colors});re.scale.set(i.scale.x,i.scale.y,i.scale.z),this.add(re);break;default:console.error("Currently unsupported marker type: "+i.type)}}setPose(e){this.position.x=e.position.x,this.position.y=e.position.y,this.position.z=e.position.z,this.quaternion.set(e.orientation.x,e.orientation.y,e.orientation.z,e.orientation.w),this.quaternion.normalize(),this.updateMatrixWorld()}update(e){if(this.setPose(e.pose),e.color.r!==this.msgColor.r||e.color.g!==this.msgColor.g||e.color.b!==this.msgColor.b||e.color.a!==this.msgColor.a){var t=Kc(e.color.r,e.color.g,e.color.b,e.color.a);switch(e.type){case Lc:case Cc:case Oc:break;case Tc:case Sc:case Ac:case Rc:case Uc:case Ic:this.traverse(function(e){e instanceof Ec.Mesh&&(e.material=t)});break;case Dc:var i=null;0===e.color.r&&0===e.color.g&&0===e.color.b&&0===e.color.a||(i=this.colorMaterial),this.traverse(function(e){e instanceof Ec.Mesh&&(e.material=i)});break;case Pc:case Nc:default:return!1}this.msgColor=e.color}var r=Math.abs(this.msgScale[0]-e.scale.x)>1e-6||Math.abs(this.msgScale[1]-e.scale.y)>1e-6||Math.abs(this.msgScale[2]-e.scale.z)>1e-6;switch(this.msgScale=[e.scale.x,e.scale.y,e.scale.z],e.type){case Sc:case Ac:case Rc:if(r)return!1;break;case Ic:if(r||this.text!==e.text)return!1;break;case Dc:if(e.mesh_resource.substr(10)!==this.msgMesh)return!1;if(r)return!1;break;case Tc:case Lc:case Cc:case Pc:case Nc:case Oc:case Uc:return!1}return!0}dispose(){this.children.forEach(function(e){e instanceof rh?e.children.forEach(function(t){void 0!==t.material&&t.material.dispose(),t.children.forEach(function(e){void 0!==e.geometry&&e.geometry.dispose(),void 0!==e.material&&e.material.dispose(),t.remove(e)}),e.remove(t)}):(void 0!==e.geometry&&e.geometry.dispose(),void 0!==e.material&&e.material.dispose()),e.parent.remove(e)})}}class ah extends Ec.Object3D{constructor(e){super();var i=this;e=e||{},this.parent=e.parent;var r=e.handle,n=e.message;this.message=n,this.name=n.name,this.camera=e.camera,this.path=e.path||"/",this.loader=e.loader,this.dragging=!1,this.startMousePos=new Ec.Vector2,this.isShift=!1;var o=new Ec.Quaternion(n.orientation.x,n.orientation.y,n.orientation.z,n.orientation.w);o.normalize();var a=new Ec.Vector3(1,0,0);switch(a.applyQuaternion(o),this.currentControlOri=new Ec.Quaternion,n.interaction_mode){case Yc:case qc:this.addEventListener("mousemove",this.parent.move3d.bind(this.parent,this,a));case jc:this.addEventListener("mousemove",this.parent.moveAxis.bind(this.parent,this,a)),this.addEventListener("touchmove",this.parent.moveAxis.bind(this.parent,this,a));break;case Xc:this.addEventListener("mousemove",this.parent.rotateAxis.bind(this.parent,this,o));break;case Wc:this.addEventListener("mousemove",this.parent.movePlane.bind(this.parent,this,a));break;case Hc:this.addEventListener("click",this.parent.buttonClick.bind(this.parent,this))}function s(e){e.stopPropagation()}n.interaction_mode!==Vc&&(this.addEventListener("mousedown",this.parent.startDrag.bind(this.parent,this)),this.addEventListener("mouseup",this.parent.stopDrag.bind(this.parent,this)),this.addEventListener("contextmenu",this.parent.showMenu.bind(this.parent,this)),this.addEventListener("mouseup",function(e){0===i.startMousePos.distanceToSquared(e.mousePos)&&(e.type="contextmenu",i.dispatchEvent(e))}),this.addEventListener("mouseover",s),this.addEventListener("mouseout",s),this.addEventListener("click",s),this.addEventListener("mousedown",function(e){i.startMousePos=e.mousePos}),this.addEventListener("touchstart",function(e){1===e.domEvent.touches.length&&(e.type="mousedown",e.domEvent.button=0,i.dispatchEvent(e))}),this.addEventListener("touchmove",function(e){1===e.domEvent.touches.length&&(e.type="mousemove",e.domEvent.button=0,i.dispatchEvent(e))}),this.addEventListener("touchend",function(e){0===e.domEvent.touches.length&&(e.domEvent.button=0,e.type="mouseup",i.dispatchEvent(e),e.type="click",i.dispatchEvent(e))}),window.addEventListener("keydown",function(e){16===e.keyCode&&(i.isShift=!0)}),window.addEventListener("keyup",function(e){16===e.keyCode&&(i.isShift=!1)}));var c=new Ec.Quaternion,h=this.parent.position.clone().multiplyScalar(-1);switch(n.orientation_mode){case Zc:c=this.parent.quaternion.clone().inverse();break;case Jc:case Qc:break;default:console.error("Unkown orientation mode: "+n.orientation_mode)}var l=new t.TFClient({ros:r.tfClient.ros,fixedFrame:r.message.header.frame_id,serverName:r.tfClient.serverName});n.markers.forEach(function(e){var r=function(r){var n=new oh({message:e,path:i.path,loader:i.loader});if(null!==r){var o=new t.Pose({position:n.position,orientation:n.quaternion});o.applyTransform(new t.Transform(r));var a=new oh({message:e,path:i.path,loader:i.loader});a.position.add(h),a.position.applyQuaternion(c),a.quaternion.multiplyQuaternions(c,a.quaternion);var s=new Ec.Vector3(a.position.x,a.position.y,a.position.z),u=new t.Transform({translation:s,orientation:a.quaternion});o.applyTransform(u),n.setPose(o),n.updateMatrixWorld(),l.unsubscribe(e.header.frame_id)}i.add(n)};""!==e.header.frame_id?l.subscribe(e.header.frame_id,r):r(null)})}updateMatrixWorld(e){var t=this.message;switch(t.orientation_mode){case Zc:super.updateMatrixWorld(e),this.currentControlOri.copy(this.quaternion),this.currentControlOri.normalize();break;case Jc:this.quaternion.copy(this.parent.quaternion.clone().inverse()),this.updateMatrix(),this.matrixWorldNeedsUpdate=!0,super.updateMatrixWorld(e),this.currentControlOri.copy(this.quaternion);break;case Qc:this.camera.updateMatrixWorld();var i=(new Ec.Matrix4).extractRotation(this.camera.matrixWorld),r=new Ec.Matrix4,n=.5*Math.PI,o=new Ec.Euler(-n,0,n);r.makeRotationFromEuler(o);var a=new Ec.Matrix4;a.getInverse(this.parent.matrixWorld),i.multiplyMatrices(i,r),i.multiplyMatrices(a,i),this.currentControlOri.setFromRotationMatrix(i),t.independent_marker_orientation||(this.quaternion.copy(this.currentControlOri),this.updateMatrix(),this.matrixWorldNeedsUpdate=!0),super.updateMatrixWorld(e);break;default:console.error("Unkown orientation mode: "+t.orientation_mode)}}}class sh extends Ec.EventDispatcher{constructor(e){super();var t,i,r,n=this,o=(e=e||{}).menuEntries,a=e.className||"default-interactive-marker-menu",s=(e.entryClassName,e.overlayClassName||"default-interactive-marker-overlay"),c=e.menuFontSize||"0.8em",h=[];if(h[0]={children:[]},null===document.getElementById("default-interactive-marker-menu-css")){var l=document.createElement("style");l.id="default-interactive-marker-menu-css",l.type="text/css",l.innerHTML=".default-interactive-marker-menu {background-color: #444444;border: 1px solid #888888;border: 1px solid #888888;padding: 0px 0px 0px 0px;color: #FFFFFF;font-family: sans-serif;font-size: "+c+";z-index: 1002;}.default-interactive-marker-menu ul {padding: 0px 0px 5px 0px;margin: 0px;list-style-type: none;}.default-interactive-marker-menu ul li div {-webkit-touch-callout: none;-webkit-user-select: none;-khtml-user-select: none;-moz-user-select: none;-ms-user-select: none;user-select: none;cursor: default;padding: 3px 10px 3px 10px;}.default-interactive-marker-menu-entry:hover { background-color: #666666; cursor: pointer;}.default-interactive-marker-menu ul ul { font-style: italic; padding-left: 10px;}.default-interactive-marker-overlay { position: absolute; top: 0%; left: 0%; width: 100%; height: 100%; background-color: black; z-index: 1001; -moz-opacity: 0.0; opacity: .0; filter: alpha(opacity = 0);}",document.getElementsByTagName("head")[0].appendChild(l)}for(this.menuDomElem=document.createElement("div"),this.menuDomElem.style.position="absolute",this.menuDomElem.className=a,this.menuDomElem.addEventListener("contextmenu",function(e){e.preventDefault()}),this.overlayDomElem=document.createElement("div"),this.overlayDomElem.className=s,this.hideListener=this.hide.bind(this),this.overlayDomElem.addEventListener("contextmenu",this.hideListener),this.overlayDomElem.addEventListener("click",this.hideListener),this.overlayDomElem.addEventListener("touchstart",this.hideListener),t=0;t0?(e(s,o[a]),c.addEventListener("click",n.hide.bind(n)),c.addEventListener("touchstart",n.hide.bind(n))):(c.addEventListener("click",p.bind(n,o[a])),c.addEventListener("touchstart",p.bind(n,o[a])),c.className="default-interactive-marker-menu-entry")}}(this.menuDomElem,h[0])}show(e,t){t&&t.preventDefault&&t.preventDefault(),this.controlName=e.name,void 0!==t.domEvent.changedTouches?(this.menuDomElem.style.left=t.domEvent.changedTouches[0].pageX+"px",this.menuDomElem.style.top=t.domEvent.changedTouches[0].pageY+"px"):(this.menuDomElem.style.left=t.domEvent.clientX+"px",this.menuDomElem.style.top=t.domEvent.clientY+"px"),document.body.appendChild(this.overlayDomElem),document.body.appendChild(this.menuDomElem)}hide(e){e&&e.preventDefault&&e.preventDefault(),document.body.removeChild(this.overlayDomElem),document.body.removeChild(this.menuDomElem)}}class ch extends Ec.Object3D{constructor(e){super();var t=this,i=(e=e||{}).handle;this.name=i.name;var r=e.camera,n=e.path||"/",o=e.loader;this.dragging=!1,this.onServerSetPose({pose:i.pose}),this.dragStart={position:new Ec.Vector3,orientation:new Ec.Quaternion,positionWorld:new Ec.Vector3,orientationWorld:new Ec.Quaternion,event3d:{}},i.controls.forEach(function(e){t.add(new ah({parent:t,handle:i,message:e,camera:r,path:n,loader:o}))}),i.menuEntries.length>0&&(this.menu=new sh({menuEntries:i.menuEntries,menuFontSize:i.menuFontSize}),this.menu.addEventListener("menu-select",function(e){t.dispatchEvent(e)}))}showMenu(e,t){this.menu&&this.menu.show(e,t)}moveAxis(e,t,i){if(this.dragging){var r=e.currentControlOri,n=t.clone().applyQuaternion(r),o=this.dragStart.event3d.intersection.point,a=n.clone().applyQuaternion(this.dragStart.orientationWorld.clone()),s=new Ec.Ray(o,a),c=th(s,i.camera,i.mousePos),h=new Ec.Vector3;h.addVectors(this.dragStart.position,n.clone().applyQuaternion(this.dragStart.orientation).multiplyScalar(c)),this.setPosition(e,h),i.stopPropagation()}}move3d(e,t,i){if(this.dragging)if(e.isShift);else{var r=e.camera.getWorldDirection(),n=Math.abs(r.x),o=Math.abs(r.y),a=Math.abs(r.z),s=new Ec.Quaternion(1,0,0,1);o>n&&o>a?s=new Ec.Quaternion(0,0,1,1):a>n&&a>o&&(s=new Ec.Quaternion(0,1,0,1)),s.normalize(),(t=new Ec.Vector3(1,0,0)).applyQuaternion(s),this.movePlane(e,t,i)}}movePlane(e,t,i){if(this.dragging){var r=e.currentControlOri,n=t.clone().applyQuaternion(r),o=this.dragStart.event3d.intersection.point,a=n.clone().applyQuaternion(this.dragStart.orientationWorld),s=$c(i.mouseRay,o,a),c=new Ec.Vector3;c.subVectors(s,o),c.add(this.dragStart.positionWorld),this.setPosition(e,c),i.stopPropagation()}}rotateAxis(e,t,i){if(this.dragging){e.updateMatrixWorld();var r=e.currentControlOri.clone().multiply(t.clone()),n=new Ec.Vector3(1,0,0).applyQuaternion(r),o=this.dragStart.event3d.intersection.point,a=n.applyQuaternion(this.dragStart.orientationWorld),s=$c(i.mouseRay,o,a),c=new Ec.Ray(this.dragStart.positionWorld,a),h=$c(c,o,a),l=this.dragStart.orientationWorld.clone().multiply(r).clone().inverse();s.sub(h),s.applyQuaternion(l);var u=this.dragStart.event3d.intersection.point.clone();u.sub(h),u.applyQuaternion(l);var p=Math.atan2(s.y,s.z),d=Math.atan2(u.y,u.z)-p,f=new Ec.Quaternion;f.setFromAxisAngle(n,d),this.setOrientation(e,f.multiply(this.dragStart.orientationWorld)),i.stopPropagation()}}feedbackEvent(e,t){this.dispatchEvent({type:e,position:this.position.clone(),orientation:this.quaternion.clone(),controlName:t.name})}startDrag(e,t){if(0===t.domEvent.button){t.stopPropagation(),this.dragging=!0,this.updateMatrixWorld(!0);var i=new Ec.Vector3;this.matrixWorld.decompose(this.dragStart.positionWorld,this.dragStart.orientationWorld,i),this.dragStart.position=this.position.clone(),this.dragStart.orientation=this.quaternion.clone(),this.dragStart.event3d=t,this.feedbackEvent("user-mousedown",e)}}stopDrag(e,t){0===t.domEvent.button&&(t.stopPropagation(),this.dragging=!1,this.dragStart.event3d={},this.onServerSetPose(this.bufferedPoseEvent),this.bufferedPoseEvent=void 0,this.feedbackEvent("user-mouseup",e))}buttonClick(e,t){t.stopPropagation(),this.feedbackEvent("user-button-click",e)}setPosition(e,t){this.position.copy(t),this.feedbackEvent("user-pose-change",e)}setOrientation(e,t){t.normalize(),this.quaternion.copy(t),this.feedbackEvent("user-pose-change",e)}onServerSetPose(e){if(void 0!==e)if(this.dragging)this.bufferedPoseEvent=e;else{var t=e.pose;this.position.copy(t.position),this.quaternion.copy(t.orientation),this.updateMatrixWorld(!0)}}dispose(){var e=this;this.children.forEach(function(t){t.children.forEach(function(e){e.dispose(),t.remove(e)}),e.remove(t)})}}var hh,lh=(function(e,t){!function(t){var i=Array.isArray?Array.isArray:function(e){return"[object Array]"===Object.prototype.toString.call(e)},r=10;function n(){this._events={},this._conf&&o.call(this,this._conf)}function o(e){e?(this._conf=e,e.delimiter&&(this.delimiter=e.delimiter),this._maxListeners=e.maxListeners!==t?e.maxListeners:r,e.wildcard&&(this.wildcard=e.wildcard),e.newListener&&(this.newListener=e.newListener),e.verboseMemoryLeak&&(this.verboseMemoryLeak=e.verboseMemoryLeak),this.wildcard&&(this.listenerTree={})):this._maxListeners=r}function a(e,t){var i="(node) warning: possible EventEmitter memory leak detected. "+e+" listeners added. Use emitter.setMaxListeners() to increase limit.";if(this.verboseMemoryLeak&&(i+=" Event name: "+t+"."),"undefined"!=typeof process&&process.emitWarning){var r=new Error(i);r.name="MaxListenersExceededWarning",r.emitter=this,r.count=e,process.emitWarning(r)}else console.error(i),console.trace&&console.trace()}function s(e){this._events={},this.newListener=!1,this.verboseMemoryLeak=!1,o.call(this,e)}function c(e,t,i,r){if(!i)return[];var n,o,a,s,h,l,u,p=[],d=t.length,f=t[r],m=t[r+1];if(r===d&&i._listeners){if("function"==typeof i._listeners)return e&&e.push(i._listeners),[i];for(n=0,o=i._listeners.length;n3)for(t=new Array(s),o=0;o3)for(t=new Array(s-1),o=1;o3)for(t=new Array(h),o=1;o3)for(t=new Array(h-1),o=1;o0&&o._listeners.length>this._maxListeners&&(o._listeners.warned=!0,a.call(this,o._listeners.length,s))):o._listeners=i,!0;s=e.shift()}return!0}.call(this,e,i),this):(this._events[e]?("function"==typeof this._events[e]&&(this._events[e]=[this._events[e]]),r?this._events[e].unshift(i):this._events[e].push(i),!this._events[e].warned&&this._maxListeners>0&&this._events[e].length>this._maxListeners&&(this._events[e].warned=!0,a.call(this,this._events[e].length,e))):this._events[e]=i,this)},s.prototype.off=function(e,r){if("function"!=typeof r)throw new Error("removeListener only takes instances of Function");var n,o=[];if(this.wildcard){var a="string"==typeof e?e.split(this.delimiter):e.slice();o=c.call(this,null,a,this.listenerTree,0)}else{if(!this._events[e])return this;n=this._events[e],o.push({_listeners:n})}for(var s=0;s0&&e(i[o]),0===Object.keys(a).length&&delete i[o])}}}(this.listenerTree),this},s.prototype.offAny=function(e){var t,i=0,r=0;if(e&&this._all&&this._all.length>0){for(i=0,r=(t=this._all).length;i=8&&(a-=8,t[s++]=o>>>a&255,s%i==0&&(n+=Math.ceil((l-a)/6),(a%=8)>0&&(o=vh.e[e.charAt(n)])));return Math.floor(s/i)}vh.S="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",vh.e={};for(var gh=0;gh<64;gh++)vh.e[vh.S.charAt(gh)]=gh;class yh extends Ec.Object3D{constructor(e){var i=(e=e||{}).urdfModel,r=e.path||"/",n=e.tfClient,o=e.tfPrefix||"",a=e.loader;super();var s=i.links;for(var c in s)for(var h=s[c],l=0;l0?(r=f[0].object,d.intersection=this.lastIntersection=f[0]):r=this.fallbackTarget,r!==this.lastTarget&&e.type.match(/mouse/)){var m=this.notify(r,"mouseover",d);0===m?this.notify(this.lastTarget,"mouseout",d):1===m&&(r=this.fallbackTarget)!==this.lastTarget&&(this.notify(r,"mouseover",d),this.notify(this.lastTarget,"mouseout",d))}r!==this.lastTarget&&e.type.match(/touch/)&&(this.notify(r,e.type,d)?(this.notify(this.lastTarget,"touchleave",d),this.notify(this.lastTarget,"touchend",d)):(r=this.fallbackTarget)!==this.lastTarget&&(this.notify(this.lastTarget,"touchmove",d),this.notify(this.lastTarget,"touchend",d)));this.notify(r,e.type,d),"mousedown"!==e.type&&"touchstart"!==e.type&&"touchmove"!==e.type||(this.dragging=!0),this.lastTarget=r}notify(e,t,i){for(i.type=t,i.cancelBubble=!1,i.continueBubble=!1,i.stopPropagation=function(){i.cancelBubble=!0},i.continuePropagation=function(){i.continueBubble=!0},i.currentTarget=e;i.currentTarget;){if(i.currentTarget.dispatchEvent&&i.currentTarget.dispatchEvent instanceof Function){if(i.currentTarget.dispatchEvent(i),i.cancelBubble)return this.dispatchEvent(i),0;if(i.continueBubble)return 2}i.currentTarget=i.currentTarget.parent}return 1}}class wh extends Ec.EventDispatcher{constructor(e){super();var t=this,i=(e=e||{}).scene;this.camera=e.camera,this.center=new Ec.Vector3,this.userZoom=!0,this.userZoomSpeed=e.userZoomSpeed||1,this.userRotate=!0,this.userRotateSpeed=e.userRotateSpeed||1,this.autoRotate=e.autoRotate,this.autoRotateSpeed=e.autoRotateSpeed||2,this.displayPanAndZoomFrame=void 0===e.displayPanAndZoomFrame||!!e.displayPanAndZoomFrame,this.lineTypePanAndZoomFrame=e.dashedPanAndZoomFrame||"full",this.camera.up=new Ec.Vector3(0,0,1);var r=1800,n=10,o=new Ec.Vector2,a=new Ec.Vector2,s=new Ec.Vector2,c=new Ec.Vector2,h=new Ec.Vector2,l=new Ec.Vector2,u=new Ec.Vector3,p=new Ec.Vector3,d=new Ec.Vector3,f=new Ec.Vector3,m=new Array(2),v=new Array(2);this.phiDelta=0,this.thetaDelta=0,this.scale=1,this.lastPosition=new Ec.Vector3;var g={NONE:-1,ROTATE:0,ZOOM:1,MOVE:2},y=g.NONE;function x(e,t,i){var r=new Ec.Vector3;new Ec.Vector3;r.subVectors(t,e.origin);var n=e.direction.dot(i);if(Math.abs(n)0?t.zoomIn():t.zoomOut(),this.showAxes()}}this.axes=new dh({shaftRadius:.025,headRadius:.07,headLength:.2,lineType:this.lineTypePanAndZoomFrame}),this.displayPanAndZoomFrame&&(i.add(this.axes),this.axes.traverse(function(e){e.visible=!1})),this.addEventListener("mousedown",function(e){var i=e.domEvent;switch(i.preventDefault(),i.button){case 0:y=g.ROTATE,o.set(i.clientX,i.clientY);break;case 1:y=g.MOVE,p=new Ec.Vector3(0,0,1);var r=(new Ec.Matrix4).extractRotation(this.camera.matrix);p.applyMatrix4(r),u=t.center.clone(),d=t.camera.position.clone(),f=x(e.mouseRay,u,p);break;case 2:y=g.ZOOM,c.set(i.clientX,i.clientY)}this.showAxes()}),this.addEventListener("mouseup",function(e){t.userRotate&&(y=g.NONE)}),this.addEventListener("mousemove",function(e){var i=e.domEvent;if(y===g.ROTATE)a.set(i.clientX,i.clientY),s.subVectors(a,o),t.rotateLeft(2*Math.PI*s.x/r*t.userRotateSpeed),t.rotateUp(2*Math.PI*s.y/r*t.userRotateSpeed),o.copy(a),this.showAxes();else if(y===g.ZOOM)h.set(i.clientX,i.clientY),l.subVectors(h,c),l.y>0?t.zoomIn():t.zoomOut(),c.copy(h),this.showAxes();else if(y===g.MOVE){var n=x(e.mouseRay,t.center,p);if(!n)return;var m=(new Ec.Vector3).subVectors(f.clone(),n.clone());t.center.addVectors(u.clone(),m.clone()),t.camera.position.addVectors(d.clone(),m.clone()),t.update(),t.camera.updateMatrixWorld(),this.showAxes()}}),this.addEventListener("touchstart",function(e){var i=e.domEvent;switch(i.touches.length){case 1:y=g.ROTATE,o.set(i.touches[0].pageX-window.scrollX,i.touches[0].pageY-window.scrollY);break;case 2:y=g.NONE,p=new Ec.Vector3(0,0,1);var r=(new Ec.Matrix4).extractRotation(this.camera.matrix);p.applyMatrix4(r),u=t.center.clone(),d=t.camera.position.clone(),f=x(e.mouseRay,u,p),m[0]=new Ec.Vector2(i.touches[0].pageX,i.touches[0].pageY),m[1]=new Ec.Vector2(i.touches[1].pageX,i.touches[1].pageY),v[0]=new Ec.Vector2(0,0),v[1]=new Ec.Vector2(0,0)}this.showAxes(),i.preventDefault()}),this.addEventListener("touchmove",function(e){var i=e.domEvent;if(y===g.ROTATE)a.set(i.touches[0].pageX-window.scrollX,i.touches[0].pageY-window.scrollY),s.subVectors(a,o),t.rotateLeft(2*Math.PI*s.x/r*t.userRotateSpeed),t.rotateUp(2*Math.PI*s.y/r*t.userRotateSpeed),o.copy(a),this.showAxes();else{if(v[0].set(m[0].x-i.touches[0].pageX,m[0].y-i.touches[0].pageY),v[1].set(m[1].x-i.touches[1].pageX,m[1].y-i.touches[1].pageY),v[0].lengthSq()>n&&v[1].lengthSq()>n&&(m[0].set(i.touches[0].pageX,i.touches[0].pageY),m[1].set(i.touches[1].pageX,i.touches[1].pageY),v[0].dot(v[1])>0&&y!==g.ZOOM?y=g.MOVE:v[0].dot(v[1])<0&&y!==g.MOVE&&(y=g.ZOOM),y===g.ZOOM)){var c=new Ec.Vector2;c.subVectors(m[0],m[1]),v[0].dot(c)<0&&v[1].dot(c)>0?t.zoomOut():v[0].dot(c)>0&&v[1].dot(c)<0&&t.zoomIn()}if(y===g.MOVE){var h=x(e.mouseRay,t.center,p);if(!h)return;var l=(new Ec.Vector3).subVectors(f.clone(),h.clone());t.center.addVectors(u.clone(),l.clone()),t.camera.position.addVectors(d.clone(),l.clone()),t.update(),t.camera.updateMatrixWorld()}this.showAxes(),i.preventDefault()}}),this.addEventListener("touchend",function(e){var t=e.domEvent;1===t.touches.length&&y!==g.ROTATE?(y=g.ROTATE,o.set(t.touches[0].pageX-window.scrollX,t.touches[0].pageY-window.scrollY)):y=g.NONE}),this.addEventListener("mousewheel",b),this.addEventListener("DOMMouseScroll",b)}showAxes(){var e=this;this.axes.traverse(function(e){e.visible=!0}),this.hideTimeout&&clearTimeout(this.hideTimeout),this.hideTimeout=setTimeout(function(){e.axes.traverse(function(e){e.visible=!1}),e.hideTimeout=!1},1e3)}rotateLeft(e){void 0===e&&(e=2*Math.PI/60/60*this.autoRotateSpeed),this.thetaDelta-=e}rotateRight(e){void 0===e&&(e=2*Math.PI/60/60*this.autoRotateSpeed),this.thetaDelta+=e}rotateUp(e){void 0===e&&(e=2*Math.PI/60/60*this.autoRotateSpeed),this.phiDelta-=e}rotateDown(e){void 0===e&&(e=2*Math.PI/60/60*this.autoRotateSpeed),this.phiDelta+=e}zoomIn(e){void 0===e&&(e=Math.pow(.95,this.userZoomSpeed)),this.scale/=e}zoomOut(e){void 0===e&&(e=Math.pow(.95,this.userZoomSpeed)),this.scale*=e}update(){var e=this.camera.position,t=e.clone().sub(this.center),i=Math.atan2(t.y,t.x),r=Math.atan2(Math.sqrt(t.y*t.y+t.x*t.x),t.z);this.autoRotate&&this.rotateLeft(2*Math.PI/60/60*this.autoRotateSpeed),i+=this.thetaDelta,r+=this.phiDelta;r=Math.max(1e-6,Math.min(Math.PI-1e-6,r));var n=t.length();t.set(n*Math.sin(r)*Math.cos(i),n*Math.sin(r)*Math.sin(i),n*Math.cos(r)),t.multiplyScalar(this.scale),e.copy(this.center).add(t),this.camera.lookAt(this.center),n=t.length(),this.axes.position.copy(this.center),this.axes.scale.set(.05*n,.05*n,.05*n),this.axes.updateMatrixWorld(!0),this.thetaDelta=0,this.phiDelta=0,this.scale=1,this.lastPosition.distanceTo(this.camera.position)>0&&(this.dispatchEvent({type:"change"}),this.lastPosition.copy(this.camera.position))}}return e.MARKER_ARROW=Tc,e.MARKER_CUBE=Sc,e.MARKER_SPHERE=Ac,e.MARKER_CYLINDER=Rc,e.MARKER_LINE_STRIP=Lc,e.MARKER_LINE_LIST=Cc,e.MARKER_CUBE_LIST=Pc,e.MARKER_SPHERE_LIST=Nc,e.MARKER_POINTS=Oc,e.MARKER_TEXT_VIEW_FACING=Ic,e.MARKER_MESH_RESOURCE=Dc,e.MARKER_TRIANGLE_LIST=Uc,e.INTERACTIVE_MARKER_KEEP_ALIVE=0,e.INTERACTIVE_MARKER_POSE_UPDATE=Fc,e.INTERACTIVE_MARKER_MENU_SELECT=Bc,e.INTERACTIVE_MARKER_BUTTON_CLICK=zc,e.INTERACTIVE_MARKER_MOUSE_DOWN=kc,e.INTERACTIVE_MARKER_MOUSE_UP=Gc,e.INTERACTIVE_MARKER_NONE=Vc,e.INTERACTIVE_MARKER_MENU=1,e.INTERACTIVE_MARKER_BUTTON=Hc,e.INTERACTIVE_MARKER_MOVE_AXIS=jc,e.INTERACTIVE_MARKER_MOVE_PLANE=Wc,e.INTERACTIVE_MARKER_ROTATE_AXIS=Xc,e.INTERACTIVE_MARKER_MOVE_ROTATE=6,e.INTERACTIVE_MARKER_MOVE_3D=qc,e.INTERACTIVE_MARKER_ROTATE_3D=8,e.INTERACTIVE_MARKER_MOVE_ROTATE_3D=Yc,e.INTERACTIVE_MARKER_INHERIT=Zc,e.INTERACTIVE_MARKER_FIXED=Jc,e.INTERACTIVE_MARKER_VIEW_FACING=Qc,e.makeColorMaterial=Kc,e.intersectPlane=$c,e.findClosestPoint=eh,e.closestAxisPoint=th,e.DepthCloud=class extends Ec.Object3D{constructor(e){super(),e=e||{},this.url=e.url,this.streamType=e.streamType||"vp8",this.f=e.f||526,this.maxDepthPerTile=e.maxDepthPerTile||1,this.pointSize=e.pointSize||3,this.width=e.width||1024,this.height=e.height||1024,this.resolutionFactor=Math.max(this.width,this.height)/1024,this.whiteness=e.whiteness||0,this.varianceThreshold=e.varianceThreshold||16667e-9,this.isMjpeg="mjpeg"===this.streamType.toLowerCase(),this.video=document.createElement(this.isMjpeg?"img":"video"),this.video.addEventListener(this.isMjpeg?"load":"loadedmetadata",this.metaLoaded.bind(this),!1),this.isMjpeg||(this.video.loop=!0),this.video.src=this.url,this.video.crossOrigin="Anonymous",this.video.setAttribute("crossorigin","Anonymous"),this.vertex_shader=["uniform sampler2D map;","","uniform float width;","uniform float height;","uniform float nearClipping, farClipping;","","uniform float pointSize;","uniform float zOffset;","","uniform float focallength;","uniform float maxDepthPerTile;","uniform float resolutionFactor;","","varying vec2 vUvP;","varying vec2 colorP;","","varying float depthVariance;","varying float maskVal;","","float sampleDepth(vec2 pos)"," {"," float depth;"," "," vec2 vUv = vec2( pos.x / (width*2.0), pos.y / (height*2.0)+0.5 );"," vec2 vUv2 = vec2( pos.x / (width*2.0)+0.5, pos.y / (height*2.0)+0.5 );"," "," vec4 depthColor = texture2D( map, vUv );"," "," depth = ( depthColor.r + depthColor.g + depthColor.b ) / 3.0 ;"," "," if (depth>0.99)"," {"," vec4 depthColor2 = texture2D( map, vUv2 );"," float depth2 = ( depthColor2.r + depthColor2.g + depthColor2.b ) / 3.0 ;"," depth = 0.99+depth2;"," }"," "," return depth;"," }","","float median(float a, float b, float c)"," {"," float r=a;"," "," if ( (a0.5) || (vUvP.y<0.5) || (vUvP.y>0.0))"," {"," vec2 smp = decodeDepth(vec2(position.x, position.y));"," float depth = smp.x;"," depthVariance = smp.y;"," "," float z = -depth;"," "," pos = vec4("," ( position.x / width - 0.5 ) * z * 0.5 * maxDepthPerTile * resolutionFactor * (1000.0/focallength) * -1.0,"," ( position.y / height - 0.5 ) * z * 0.5 * maxDepthPerTile * resolutionFactor * (1000.0/focallength),"," (- z + zOffset / 1000.0) * maxDepthPerTile,"," 1.0);"," "," vec2 maskP = vec2( position.x / (width*2.0), position.y / (height*2.0) );"," vec4 maskColor = texture2D( map, maskP );"," maskVal = ( maskColor.r + maskColor.g + maskColor.b ) / 3.0 ;"," }"," "," gl_PointSize = pointSize;"," gl_Position = projectionMatrix * modelViewMatrix * pos;"," ","}"].join("\n"),this.fragment_shader=["uniform sampler2D map;","uniform float varianceThreshold;","uniform float whiteness;","","varying vec2 vUvP;","varying vec2 colorP;","","varying float depthVariance;","varying float maskVal;","","","void main() {"," "," vec4 color;"," "," if ( (depthVariance>varianceThreshold) || (maskVal>0.5) ||(vUvP.x<0.0)|| (vUvP.x>0.5) || (vUvP.y<0.5) || (vUvP.y>1.0))"," { "," discard;"," }"," else "," {"," color = texture2D( map, colorP );"," "," float fader = whiteness /100.0;"," "," color.r = color.r * (1.0-fader)+ fader;"," "," color.g = color.g * (1.0-fader)+ fader;"," "," color.b = color.b * (1.0-fader)+ fader;"," "," color.a = 1.0;//smoothstep( 20000.0, -20000.0, gl_FragCoord.z / gl_FragCoord.w );"," }"," "," gl_FragColor = vec4( color.r, color.g, color.b, color.a );"," ","}"].join("\n")}metaLoaded(){this.metaLoaded=!0,this.initStreamer()}initStreamer(){if(this.metaLoaded){this.texture=new Ec.Texture(this.video),this.geometry=new Ec.Geometry;for(var e=0,t=this.width*this.height;ethis.lifetime){var t=this.markers[e];t.unsubscribeTf(),this.rootObject.remove(t),this.emit("change")}else{var i=this;setTimeout(function(){i.checkTime(e)},100)}}subscribe(){this.unsubscribe(),this.rosTopic=new t.Topic({ros:this.ros,name:this.topicName,messageType:"visualization_msgs/Marker",compression:"png"}),this.rosTopic.subscribe(this.processMessage.bind(this))}processMessage(e){var t=new oh({message:e,path:this.path}),i=this.markers[e.ns+e.id];this.updatedTime[e.ns+e.id]=(new Date).getTime(),i?(i.unsubscribeTf(),this.rootObject.remove(i)):this.lifetime&&this.checkTime(e.ns+e.id),this.markers[e.ns+e.id]=new ph({frameID:e.header.frame_id,tfClient:this.tfClient,object:t}),this.rootObject.add(this.markers[e.ns+e.id]),this.emit("change")}},e.Arrow=ih,e.Arrow2=class extends Ec.ArrowHelper{constructor(e){var t=(e=e||{}).origin||new Ec.Vector3(0,0,0),i=e.direction||new Ec.Vector3(1,0,0),r=e.length||1;e.headLength,e.shaftDiameter,e.headDiameter,e.material||new Ec.MeshBasicMaterial,super(i,t,r,16711680)}dispose(){void 0!==this.line&&(this.line.material.dispose(),this.line.geometry.dispose()),void 0!==this.cone&&(this.cone.material.dispose(),this.cone.geometry.dispose())}},e.Axes=dh,e.Grid=class extends Ec.Object3D{constructor(e){var t=(e=e||{}).num_cells||10,i=e.color||"#cccccc",r=e.lineWidth||1,n=e.cellSize||1;super();for(var o=new Ec.LineBasicMaterial({color:i,linewidth:r}),a=0;a<=t;++a){var s=n*t/2,c=s-a*n,h=new Ec.Geometry;h.vertices.push(new Ec.Vector3(-s,c,0),new Ec.Vector3(s,c,0));var l=new Ec.Geometry;l.vertices.push(new Ec.Vector3(c,-s,0),new Ec.Vector3(c,s,0)),this.add(new Ec.Line(h,o)),this.add(new Ec.Line(l,o))}}},e.MeshResource=rh,e.TriangleList=nh,e.OccupancyGrid=fh,e.OccupancyGridClient=class extends lh{constructor(e){super(),e=e||{},this.ros=e.ros,this.topicName=e.topic||"/map",this.compression=e.compression||"cbor",this.continuous=e.continuous,this.tfClient=e.tfClient,this.rootObject=e.rootObject||new Ec.Object3D,this.offsetPose=e.offsetPose||new t.Pose,this.color=e.color||{r:255,g:255,b:255},this.opacity=e.opacity||1,this.currentGrid=null,this.rosTopic=void 0,this.subscribe()}unsubscribe(){this.rosTopic&&this.rosTopic.unsubscribe()}subscribe(){this.unsubscribe(),this.rosTopic=new t.Topic({ros:this.ros,name:this.topicName,messageType:"nav_msgs/OccupancyGrid",compression:this.compression}),this.rosTopic.subscribe(this.processMessage.bind(this))}processMessage(e){this.currentGrid&&(this.currentGrid.tfClient&&this.currentGrid.unsubscribeTf(),this.rootObject.remove(this.currentGrid));var t=new fh({message:e,color:this.color,opacity:this.opacity});this.tfClient?(this.currentGrid=t,this.sceneNode=new ph({frameID:e.header.frame_id,tfClient:this.tfClient,object:t,pose:this.offsetPose})):this.sceneNode=this.currentGrid=t,this.rootObject.add(this.sceneNode),this.emit("change"),this.continuous||this.rosTopic.unsubscribe()}},e.Odometry=class extends Ec.Object3D{constructor(e){super(),this.options=e||{},this.ros=e.ros,this.topicName=e.topic||"/particlecloud",this.tfClient=e.tfClient,this.color=e.color||13369599,this.length=e.length||1,this.rootObject=e.rootObject||new Ec.Object3D,this.keep=e.keep||1,this.sns=[],this.rosTopic=void 0,this.subscribe()}unsubscribe(){this.rosTopic&&this.rosTopic.unsubscribe()}subscribe(){this.unsubscribe(),this.rosTopic=new t.Topic({ros:this.ros,name:this.topicName,messageType:"nav_msgs/Odometry"}),this.rosTopic.subscribe(this.processMessage.bind(this))}processMessage(e){this.sns.length>=this.keep&&(this.sns[0].unsubscribeTf(),this.rootObject.remove(this.sns[0]),this.sns.shift()),this.options.origin=new Ec.Vector3(e.pose.pose.position.x,e.pose.pose.position.y,e.pose.pose.position.z);var t=new Ec.Quaternion(e.pose.pose.orientation.x,e.pose.pose.orientation.y,e.pose.pose.orientation.z,e.pose.pose.orientation.w);this.options.direction=new Ec.Vector3(1,0,0),this.options.direction.applyQuaternion(t),this.options.material=new Ec.MeshBasicMaterial({color:this.color});var i=new ih(this.options);this.sns.push(new ph({frameID:e.header.frame_id,tfClient:this.tfClient,object:i})),this.rootObject.add(this.sns[this.sns.length-1])}},e.Path=class extends Ec.Object3D{constructor(e){super(),e=e||{},this.ros=e.ros,this.topicName=e.topic||"/path",this.tfClient=e.tfClient,this.color=e.color||13369599,this.rootObject=e.rootObject||new Ec.Object3D,this.sn=null,this.line=null,this.rosTopic=void 0,this.subscribe()}unsubscribe(){this.rosTopic&&this.rosTopic.unsubscribe()}subscribe(){this.unsubscribe(),this.rosTopic=new t.Topic({ros:this.ros,name:this.topicName,messageType:"nav_msgs/Path"}),this.rosTopic.subscribe(this.processMessage.bind(this))}processMessage(e){null!==this.sn&&(this.sn.unsubscribeTf(),this.rootObject.remove(this.sn));for(var t=new Ec.Geometry,i=0;i=e.range_min&&n<=e.range_max){var o=e.angle_min+r*e.angle_increment;this.points.positions.array[i++]=n*Math.cos(o),this.points.positions.array[i++]=n*Math.sin(o),this.points.positions.array[i++]=0}}this.points.update(i/3)}}},e.Points=mh,e.PointCloud2=class extends Ec.Object3D{constructor(e){super(),e=e||{},this.ros=e.ros,this.topicName=e.topic||"/points",this.compression=e.compression||"cbor",this.max_pts=e.max_pts||1e4,this.points=new mh(e),this.rosTopic=void 0,this.buffer=null,this.subscribe()}unsubscribe(){this.rosTopic&&this.rosTopic.unsubscribe()}subscribe(){this.unsubscribe(),this.rosTopic=new t.Topic({ros:this.ros,name:this.topicName,messageType:"sensor_msgs/PointCloud2",compression:this.compression}),this.rosTopic.subscribe(this.processMessage.bind(this))}processMessage(e){if(this.points.setup(e.header.frame_id,e.point_step,e.fields)){var t,i=this.points.pointRatio,r=this.max_pts*e.point_step;e.data.buffer?(this.buffer=e.data.slice(0,Math.min(e.data.byteLength,r)),t=Math.min(e.height*e.width/i,this.points.positions.array.length/3)):((!this.buffer||this.buffer.byteLength0?1:+e}),"name"in Function.prototype==!1&&Object.defineProperty(Function.prototype,"name",{get:function(){return this.toString().match(/^\s*function\s*([^\(\s]*)/)[1]}}),void 0===Object.assign&&(Object.assign=function(e){if(void 0===e||null===e)throw new TypeError("Cannot convert undefined or null to object");for(var t=Object(e),i=1;i>8&255]+e[t>>16&255]+e[t>>24&255]+"-"+e[255&i]+e[i>>8&255]+"-"+e[i>>16&15|64]+e[i>>24&255]+"-"+e[63&r|128]+e[r>>8&255]+"-"+e[r>>16&255]+e[r>>24&255]+e[255&n]+e[n>>8&255]+e[n>>16&255]+e[n>>24&255]}}(),clamp:function(e,t,i){return Math.max(t,Math.min(i,e))},euclideanModulo:function(e,t){return(e%t+t)%t},mapLinear:function(e,t,i,r,n){return r+(e-t)*(n-r)/(i-t)},lerp:function(e,t,i){return(1-i)*e+i*t},smoothstep:function(e,t,i){return e<=t?0:e>=i?1:(e=(e-t)/(i-t))*e*(3-2*e)},smootherstep:function(e,t,i){return e<=t?0:e>=i?1:(e=(e-t)/(i-t))*e*e*(e*(6*e-15)+10)},randInt:function(e,t){return e+Math.floor(Math.random()*(t-e+1))},randFloat:function(e,t){return e+Math.random()*(t-e)},randFloatSpread:function(e){return e*(.5-Math.random())},degToRad:function(e){return e*ft.DEG2RAD},radToDeg:function(e){return e*ft.RAD2DEG},isPowerOfTwo:function(e){return 0==(e&e-1)&&0!==e},ceilPowerOfTwo:function(e){return Math.pow(2,Math.ceil(Math.log(e)/Math.LN2))},floorPowerOfTwo:function(e){return Math.pow(2,Math.floor(Math.log(e)/Math.LN2))}};function mt(e,t){this.x=e||0,this.y=t||0}function vt(){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.")}function gt(e,t,i,r){this._x=e||0,this._y=t||0,this._z=i||0,this._w=void 0!==r?r:1}function yt(e,t,i){this.x=e||0,this.y=t||0,this.z=i||0}function xt(){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.")}Object.defineProperties(mt.prototype,{width:{get:function(){return this.x},set:function(e){this.x=e}},height:{get:function(){return this.y},set:function(e){this.y=e}}}),Object.assign(mt.prototype,{isVector2:!0,set:function(e,t){return this.x=e,this.y=t,this},setScalar:function(e){return this.x=e,this.y=e,this},setX:function(e){return this.x=e,this},setY:function(e){return this.y=e,this},setComponent:function(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;default:throw new Error("index is out of range: "+e)}return this},getComponent:function(e){switch(e){case 0:return this.x;case 1:return this.y;default:throw new Error("index is out of range: "+e)}},clone:function(){return new this.constructor(this.x,this.y)},copy:function(e){return this.x=e.x,this.y=e.y,this},add:function(e,t){return void 0!==t?(console.warn("THREE.Vector2: .add() now only accepts one argument. Use .addVectors( a, b ) instead."),this.addVectors(e,t)):(this.x+=e.x,this.y+=e.y,this)},addScalar:function(e){return this.x+=e,this.y+=e,this},addVectors:function(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this},addScaledVector:function(e,t){return this.x+=e.x*t,this.y+=e.y*t,this},sub:function(e,t){return void 0!==t?(console.warn("THREE.Vector2: .sub() now only accepts one argument. Use .subVectors( a, b ) instead."),this.subVectors(e,t)):(this.x-=e.x,this.y-=e.y,this)},subScalar:function(e){return this.x-=e,this.y-=e,this},subVectors:function(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this},multiply:function(e){return this.x*=e.x,this.y*=e.y,this},multiplyScalar:function(e){return this.x*=e,this.y*=e,this},divide:function(e){return this.x/=e.x,this.y/=e.y,this},divideScalar:function(e){return this.multiplyScalar(1/e)},applyMatrix3:function(e){var t=this.x,i=this.y,r=e.elements;return this.x=r[0]*t+r[3]*i+r[6],this.y=r[1]*t+r[4]*i+r[7],this},min:function(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this},max:function(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this},clamp:function(e,t){return this.x=Math.max(e.x,Math.min(t.x,this.x)),this.y=Math.max(e.y,Math.min(t.y,this.y)),this},clampScalar:(r=new mt,n=new mt,function(e,t){return r.set(e,e),n.set(t,t),this.clamp(r,n)}),clampLength:function(e,t){var i=this.length();return this.divideScalar(i||1).multiplyScalar(Math.max(e,Math.min(t,i)))},floor:function(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this},ceil:function(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this},round:function(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this},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},negate:function(){return this.x=-this.x,this.y=-this.y,this},dot:function(e){return this.x*e.x+this.y*e.y},lengthSq:function(){return this.x*this.x+this.y*this.y},length:function(){return Math.sqrt(this.x*this.x+this.y*this.y)},manhattanLength:function(){return Math.abs(this.x)+Math.abs(this.y)},normalize:function(){return this.divideScalar(this.length()||1)},angle:function(){var e=Math.atan2(this.y,this.x);return e<0&&(e+=2*Math.PI),e},distanceTo:function(e){return Math.sqrt(this.distanceToSquared(e))},distanceToSquared:function(e){var t=this.x-e.x,i=this.y-e.y;return t*t+i*i},manhattanDistanceTo:function(e){return Math.abs(this.x-e.x)+Math.abs(this.y-e.y)},setLength:function(e){return this.normalize().multiplyScalar(e)},lerp:function(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this},lerpVectors:function(e,t,i){return this.subVectors(t,e).multiplyScalar(i).add(e)},equals:function(e){return e.x===this.x&&e.y===this.y},fromArray:function(e,t){return void 0===t&&(t=0),this.x=e[t],this.y=e[t+1],this},toArray:function(e,t){return void 0===e&&(e=[]),void 0===t&&(t=0),e[t]=this.x,e[t+1]=this.y,e},fromBufferAttribute:function(e,t,i){return void 0!==i&&console.warn("THREE.Vector2: offset has been removed from .fromBufferAttribute()."),this.x=e.getX(t),this.y=e.getY(t),this},rotateAround:function(e,t){var i=Math.cos(t),r=Math.sin(t),n=this.x-e.x,o=this.y-e.y;return this.x=n*i-o*r+e.x,this.y=n*r+o*i+e.y,this}}),Object.assign(vt.prototype,{isMatrix4:!0,set:function(e,t,i,r,n,o,a,s,c,h,l,u,p,d,f,m){var v=this.elements;return v[0]=e,v[4]=t,v[8]=i,v[12]=r,v[1]=n,v[5]=o,v[9]=a,v[13]=s,v[2]=c,v[6]=h,v[10]=l,v[14]=u,v[3]=p,v[7]=d,v[11]=f,v[15]=m,this},identity:function(){return this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1),this},clone:function(){return(new vt).fromArray(this.elements)},copy:function(e){var t=this.elements,i=e.elements;return t[0]=i[0],t[1]=i[1],t[2]=i[2],t[3]=i[3],t[4]=i[4],t[5]=i[5],t[6]=i[6],t[7]=i[7],t[8]=i[8],t[9]=i[9],t[10]=i[10],t[11]=i[11],t[12]=i[12],t[13]=i[13],t[14]=i[14],t[15]=i[15],this},copyPosition:function(e){var t=this.elements,i=e.elements;return t[12]=i[12],t[13]=i[13],t[14]=i[14],this},extractBasis:function(e,t,i){return e.setFromMatrixColumn(this,0),t.setFromMatrixColumn(this,1),i.setFromMatrixColumn(this,2),this},makeBasis:function(e,t,i){return this.set(e.x,t.x,i.x,0,e.y,t.y,i.y,0,e.z,t.z,i.z,0,0,0,0,1),this},extractRotation:(l=new yt,function(e){var t=this.elements,i=e.elements,r=1/l.setFromMatrixColumn(e,0).length(),n=1/l.setFromMatrixColumn(e,1).length(),o=1/l.setFromMatrixColumn(e,2).length();return t[0]=i[0]*r,t[1]=i[1]*r,t[2]=i[2]*r,t[4]=i[4]*n,t[5]=i[5]*n,t[6]=i[6]*n,t[8]=i[8]*o,t[9]=i[9]*o,t[10]=i[10]*o,this}),makeRotationFromEuler:function(e){e&&e.isEuler||console.error("THREE.Matrix4: .makeRotationFromEuler() now expects a Euler rotation rather than a Vector3 and order.");var t=this.elements,i=e.x,r=e.y,n=e.z,o=Math.cos(i),a=Math.sin(i),s=Math.cos(r),c=Math.sin(r),h=Math.cos(n),l=Math.sin(n);if("XYZ"===e.order){var u=o*h,p=o*l,d=a*h,f=a*l;t[0]=s*h,t[4]=-s*l,t[8]=c,t[1]=p+d*c,t[5]=u-f*c,t[9]=-a*s,t[2]=f-u*c,t[6]=d+p*c,t[10]=o*s}else if("YXZ"===e.order){var m=s*h,v=s*l,g=c*h,y=c*l;t[0]=m+y*a,t[4]=g*a-v,t[8]=o*c,t[1]=o*l,t[5]=o*h,t[9]=-a,t[2]=v*a-g,t[6]=y+m*a,t[10]=o*s}else if("ZXY"===e.order){m=s*h,v=s*l,g=c*h,y=c*l;t[0]=m-y*a,t[4]=-o*l,t[8]=g+v*a,t[1]=v+g*a,t[5]=o*h,t[9]=y-m*a,t[2]=-o*c,t[6]=a,t[10]=o*s}else if("ZYX"===e.order){u=o*h,p=o*l,d=a*h,f=a*l;t[0]=s*h,t[4]=d*c-p,t[8]=u*c+f,t[1]=s*l,t[5]=f*c+u,t[9]=p*c-d,t[2]=-c,t[6]=a*s,t[10]=o*s}else if("YZX"===e.order){var x=o*s,b=o*c,w=a*s,_=a*c;t[0]=s*h,t[4]=_-x*l,t[8]=w*l+b,t[1]=l,t[5]=o*h,t[9]=-a*h,t[2]=-c*h,t[6]=b*l+w,t[10]=x-_*l}else if("XZY"===e.order){x=o*s,b=o*c,w=a*s,_=a*c;t[0]=s*h,t[4]=-l,t[8]=c*h,t[1]=x*l+_,t[5]=o*h,t[9]=b*l-w,t[2]=w*l-b,t[6]=a*h,t[10]=_*l+x}return t[3]=0,t[7]=0,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,this},makeRotationFromQuaternion:function(e){var t=this.elements,i=e._x,r=e._y,n=e._z,o=e._w,a=i+i,s=r+r,c=n+n,h=i*a,l=i*s,u=i*c,p=r*s,d=r*c,f=n*c,m=o*a,v=o*s,g=o*c;return t[0]=1-(p+f),t[4]=l-g,t[8]=u+v,t[1]=l+g,t[5]=1-(h+f),t[9]=d-m,t[2]=u-v,t[6]=d+m,t[10]=1-(h+p),t[3]=0,t[7]=0,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,this},lookAt:(s=new yt,c=new yt,h=new yt,function(e,t,i){var r=this.elements;return h.subVectors(e,t),0===h.lengthSq()&&(h.z=1),h.normalize(),s.crossVectors(i,h),0===s.lengthSq()&&(1===Math.abs(i.z)?h.x+=1e-4:h.z+=1e-4,h.normalize(),s.crossVectors(i,h)),s.normalize(),c.crossVectors(h,s),r[0]=s.x,r[4]=c.x,r[8]=h.x,r[1]=s.y,r[5]=c.y,r[9]=h.y,r[2]=s.z,r[6]=c.z,r[10]=h.z,this}),multiply:function(e,t){return void 0!==t?(console.warn("THREE.Matrix4: .multiply() now only accepts one argument. Use .multiplyMatrices( a, b ) instead."),this.multiplyMatrices(e,t)):this.multiplyMatrices(this,e)},premultiply:function(e){return this.multiplyMatrices(e,this)},multiplyMatrices:function(e,t){var i=e.elements,r=t.elements,n=this.elements,o=i[0],a=i[4],s=i[8],c=i[12],h=i[1],l=i[5],u=i[9],p=i[13],d=i[2],f=i[6],m=i[10],v=i[14],g=i[3],y=i[7],x=i[11],b=i[15],w=r[0],_=r[4],M=r[8],E=r[12],T=r[1],S=r[5],A=r[9],R=r[13],L=r[2],C=r[6],P=r[10],N=r[14],O=r[3],I=r[7],D=r[11],U=r[15];return n[0]=o*w+a*T+s*L+c*O,n[4]=o*_+a*S+s*C+c*I,n[8]=o*M+a*A+s*P+c*D,n[12]=o*E+a*R+s*N+c*U,n[1]=h*w+l*T+u*L+p*O,n[5]=h*_+l*S+u*C+p*I,n[9]=h*M+l*A+u*P+p*D,n[13]=h*E+l*R+u*N+p*U,n[2]=d*w+f*T+m*L+v*O,n[6]=d*_+f*S+m*C+v*I,n[10]=d*M+f*A+m*P+v*D,n[14]=d*E+f*R+m*N+v*U,n[3]=g*w+y*T+x*L+b*O,n[7]=g*_+y*S+x*C+b*I,n[11]=g*M+y*A+x*P+b*D,n[15]=g*E+y*R+x*N+b*U,this},multiplyScalar:function(e){var t=this.elements;return t[0]*=e,t[4]*=e,t[8]*=e,t[12]*=e,t[1]*=e,t[5]*=e,t[9]*=e,t[13]*=e,t[2]*=e,t[6]*=e,t[10]*=e,t[14]*=e,t[3]*=e,t[7]*=e,t[11]*=e,t[15]*=e,this},applyToBufferAttribute:function(){var e=new yt;return function(t){for(var i=0,r=t.count;i=0?1:-1,y=1-v*v;if(y>Number.EPSILON){var x=Math.sqrt(y),b=Math.atan2(x,v*g);m=Math.sin(m*b)/x,a=Math.sin(a*b)/x}var w=a*g;if(s=s*m+u*w,c=c*m+p*w,h=h*m+d*w,l=l*m+f*w,m===1-a){var _=1/Math.sqrt(s*s+c*c+h*h+l*l);s*=_,c*=_,h*=_,l*=_}}e[t]=s,e[t+1]=c,e[t+2]=h,e[t+3]=l}}),Object.defineProperties(gt.prototype,{x:{get:function(){return this._x},set:function(e){this._x=e,this.onChangeCallback()}},y:{get:function(){return this._y},set:function(e){this._y=e,this.onChangeCallback()}},z:{get:function(){return this._z},set:function(e){this._z=e,this.onChangeCallback()}},w:{get:function(){return this._w},set:function(e){this._w=e,this.onChangeCallback()}}}),Object.assign(gt.prototype,{set:function(e,t,i,r){return this._x=e,this._y=t,this._z=i,this._w=r,this.onChangeCallback(),this},clone:function(){return new this.constructor(this._x,this._y,this._z,this._w)},copy:function(e){return this._x=e.x,this._y=e.y,this._z=e.z,this._w=e.w,this.onChangeCallback(),this},setFromEuler:function(e,t){if(!e||!e.isEuler)throw new Error("THREE.Quaternion: .setFromEuler() now expects an Euler rotation rather than a Vector3 and order.");var i=e._x,r=e._y,n=e._z,o=e.order,a=Math.cos,s=Math.sin,c=a(i/2),h=a(r/2),l=a(n/2),u=s(i/2),p=s(r/2),d=s(n/2);return"XYZ"===o?(this._x=u*h*l+c*p*d,this._y=c*p*l-u*h*d,this._z=c*h*d+u*p*l,this._w=c*h*l-u*p*d):"YXZ"===o?(this._x=u*h*l+c*p*d,this._y=c*p*l-u*h*d,this._z=c*h*d-u*p*l,this._w=c*h*l+u*p*d):"ZXY"===o?(this._x=u*h*l-c*p*d,this._y=c*p*l+u*h*d,this._z=c*h*d+u*p*l,this._w=c*h*l-u*p*d):"ZYX"===o?(this._x=u*h*l-c*p*d,this._y=c*p*l+u*h*d,this._z=c*h*d-u*p*l,this._w=c*h*l+u*p*d):"YZX"===o?(this._x=u*h*l+c*p*d,this._y=c*p*l+u*h*d,this._z=c*h*d-u*p*l,this._w=c*h*l-u*p*d):"XZY"===o&&(this._x=u*h*l-c*p*d,this._y=c*p*l-u*h*d,this._z=c*h*d+u*p*l,this._w=c*h*l+u*p*d),!1!==t&&this.onChangeCallback(),this},setFromAxisAngle:function(e,t){var i=t/2,r=Math.sin(i);return this._x=e.x*r,this._y=e.y*r,this._z=e.z*r,this._w=Math.cos(i),this.onChangeCallback(),this},setFromRotationMatrix:function(e){var t,i=e.elements,r=i[0],n=i[4],o=i[8],a=i[1],s=i[5],c=i[9],h=i[2],l=i[6],u=i[10],p=r+s+u;return p>0?(t=.5/Math.sqrt(p+1),this._w=.25/t,this._x=(l-c)*t,this._y=(o-h)*t,this._z=(a-n)*t):r>s&&r>u?(t=2*Math.sqrt(1+r-s-u),this._w=(l-c)/t,this._x=.25*t,this._y=(n+a)/t,this._z=(o+h)/t):s>u?(t=2*Math.sqrt(1+s-r-u),this._w=(o-h)/t,this._x=(n+a)/t,this._y=.25*t,this._z=(c+l)/t):(t=2*Math.sqrt(1+u-r-s),this._w=(a-n)/t,this._x=(o+h)/t,this._y=(c+l)/t,this._z=.25*t),this.onChangeCallback(),this},setFromUnitVectors:function(){var e,t=new yt;return function(i,r){return void 0===t&&(t=new yt),(e=i.dot(r)+1)<1e-6?(e=0,Math.abs(i.x)>Math.abs(i.z)?t.set(-i.y,i.x,0):t.set(0,-i.z,i.y)):t.crossVectors(i,r),this._x=t.x,this._y=t.y,this._z=t.z,this._w=e,this.normalize()}}(),inverse:function(){return this.conjugate().normalize()},conjugate:function(){return this._x*=-1,this._y*=-1,this._z*=-1,this.onChangeCallback(),this},dot:function(e){return this._x*e._x+this._y*e._y+this._z*e._z+this._w*e._w},lengthSq:function(){return this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w},length:function(){return Math.sqrt(this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w)},normalize:function(){var e=this.length();return 0===e?(this._x=0,this._y=0,this._z=0,this._w=1):(e=1/e,this._x=this._x*e,this._y=this._y*e,this._z=this._z*e,this._w=this._w*e),this.onChangeCallback(),this},multiply:function(e,t){return void 0!==t?(console.warn("THREE.Quaternion: .multiply() now only accepts one argument. Use .multiplyQuaternions( a, b ) instead."),this.multiplyQuaternions(e,t)):this.multiplyQuaternions(this,e)},premultiply:function(e){return this.multiplyQuaternions(e,this)},multiplyQuaternions:function(e,t){var i=e._x,r=e._y,n=e._z,o=e._w,a=t._x,s=t._y,c=t._z,h=t._w;return this._x=i*h+o*a+r*c-n*s,this._y=r*h+o*s+n*a-i*c,this._z=n*h+o*c+i*s-r*a,this._w=o*h-i*a-r*s-n*c,this.onChangeCallback(),this},slerp:function(e,t){if(0===t)return this;if(1===t)return this.copy(e);var i=this._x,r=this._y,n=this._z,o=this._w,a=o*e._w+i*e._x+r*e._y+n*e._z;if(a<0?(this._w=-e._w,this._x=-e._x,this._y=-e._y,this._z=-e._z,a=-a):this.copy(e),a>=1)return this._w=o,this._x=i,this._y=r,this._z=n,this;var s=Math.sqrt(1-a*a);if(Math.abs(s)<.001)return this._w=.5*(o+this._w),this._x=.5*(i+this._x),this._y=.5*(r+this._y),this._z=.5*(n+this._z),this;var c=Math.atan2(s,a),h=Math.sin((1-t)*c)/s,l=Math.sin(t*c)/s;return this._w=o*h+this._w*l,this._x=i*h+this._x*l,this._y=r*h+this._y*l,this._z=n*h+this._z*l,this.onChangeCallback(),this},equals:function(e){return e._x===this._x&&e._y===this._y&&e._z===this._z&&e._w===this._w},fromArray:function(e,t){return void 0===t&&(t=0),this._x=e[t],this._y=e[t+1],this._z=e[t+2],this._w=e[t+3],this.onChangeCallback(),this},toArray:function(e,t){return void 0===e&&(e=[]),void 0===t&&(t=0),e[t]=this._x,e[t+1]=this._y,e[t+2]=this._z,e[t+3]=this._w,e},onChange:function(e){return this.onChangeCallback=e,this},onChangeCallback:function(){}}),Object.assign(yt.prototype,{isVector3:!0,set:function(e,t,i){return this.x=e,this.y=t,this.z=i,this},setScalar:function(e){return this.x=e,this.y=e,this.z=e,this},setX:function(e){return this.x=e,this},setY:function(e){return this.y=e,this},setZ:function(e){return this.z=e,this},setComponent:function(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;case 2:this.z=t;break;default:throw new Error("index is out of range: "+e)}return this},getComponent:function(e){switch(e){case 0:return this.x;case 1:return this.y;case 2:return this.z;default:throw new Error("index is out of range: "+e)}},clone:function(){return new this.constructor(this.x,this.y,this.z)},copy:function(e){return this.x=e.x,this.y=e.y,this.z=e.z,this},add:function(e,t){return void 0!==t?(console.warn("THREE.Vector3: .add() now only accepts one argument. Use .addVectors( a, b ) instead."),this.addVectors(e,t)):(this.x+=e.x,this.y+=e.y,this.z+=e.z,this)},addScalar:function(e){return this.x+=e,this.y+=e,this.z+=e,this},addVectors:function(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this.z=e.z+t.z,this},addScaledVector:function(e,t){return this.x+=e.x*t,this.y+=e.y*t,this.z+=e.z*t,this},sub:function(e,t){return void 0!==t?(console.warn("THREE.Vector3: .sub() now only accepts one argument. Use .subVectors( a, b ) instead."),this.subVectors(e,t)):(this.x-=e.x,this.y-=e.y,this.z-=e.z,this)},subScalar:function(e){return this.x-=e,this.y-=e,this.z-=e,this},subVectors:function(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this.z=e.z-t.z,this},multiply:function(e,t){return void 0!==t?(console.warn("THREE.Vector3: .multiply() now only accepts one argument. Use .multiplyVectors( a, b ) instead."),this.multiplyVectors(e,t)):(this.x*=e.x,this.y*=e.y,this.z*=e.z,this)},multiplyScalar:function(e){return this.x*=e,this.y*=e,this.z*=e,this},multiplyVectors:function(e,t){return this.x=e.x*t.x,this.y=e.y*t.y,this.z=e.z*t.z,this},applyEuler:(u=new gt,function(e){return e&&e.isEuler||console.error("THREE.Vector3: .applyEuler() now expects an Euler rotation rather than a Vector3 and order."),this.applyQuaternion(u.setFromEuler(e))}),applyAxisAngle:function(){var e=new gt;return function(t,i){return this.applyQuaternion(e.setFromAxisAngle(t,i))}}(),applyMatrix3:function(e){var t=this.x,i=this.y,r=this.z,n=e.elements;return this.x=n[0]*t+n[3]*i+n[6]*r,this.y=n[1]*t+n[4]*i+n[7]*r,this.z=n[2]*t+n[5]*i+n[8]*r,this},applyMatrix4:function(e){var t=this.x,i=this.y,r=this.z,n=e.elements,o=1/(n[3]*t+n[7]*i+n[11]*r+n[15]);return this.x=(n[0]*t+n[4]*i+n[8]*r+n[12])*o,this.y=(n[1]*t+n[5]*i+n[9]*r+n[13])*o,this.z=(n[2]*t+n[6]*i+n[10]*r+n[14])*o,this},applyQuaternion:function(e){var t=this.x,i=this.y,r=this.z,n=e.x,o=e.y,a=e.z,s=e.w,c=s*t+o*r-a*i,h=s*i+a*t-n*r,l=s*r+n*i-o*t,u=-n*t-o*i-a*r;return this.x=c*s+u*-n+h*-a-l*-o,this.y=h*s+u*-o+l*-n-c*-a,this.z=l*s+u*-a+c*-o-h*-n,this},project:function(){var e=new vt;return function(t){return e.multiplyMatrices(t.projectionMatrix,e.getInverse(t.matrixWorld)),this.applyMatrix4(e)}}(),unproject:function(){var e=new vt;return function(t){return e.multiplyMatrices(t.matrixWorld,e.getInverse(t.projectionMatrix)),this.applyMatrix4(e)}}(),transformDirection:function(e){var t=this.x,i=this.y,r=this.z,n=e.elements;return this.x=n[0]*t+n[4]*i+n[8]*r,this.y=n[1]*t+n[5]*i+n[9]*r,this.z=n[2]*t+n[6]*i+n[10]*r,this.normalize()},divide:function(e){return this.x/=e.x,this.y/=e.y,this.z/=e.z,this},divideScalar:function(e){return this.multiplyScalar(1/e)},min:function(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this.z=Math.min(this.z,e.z),this},max:function(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this.z=Math.max(this.z,e.z),this},clamp:function(e,t){return this.x=Math.max(e.x,Math.min(t.x,this.x)),this.y=Math.max(e.y,Math.min(t.y,this.y)),this.z=Math.max(e.z,Math.min(t.z,this.z)),this},clampScalar:function(){var e=new yt,t=new yt;return function(i,r){return e.set(i,i,i),t.set(r,r,r),this.clamp(e,t)}}(),clampLength:function(e,t){var i=this.length();return this.divideScalar(i||1).multiplyScalar(Math.max(e,Math.min(t,i)))},floor:function(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this},ceil:function(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this},round:function(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this},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},negate:function(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this},dot:function(e){return this.x*e.x+this.y*e.y+this.z*e.z},lengthSq:function(){return this.x*this.x+this.y*this.y+this.z*this.z},length:function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z)},manhattanLength:function(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)},normalize:function(){return this.divideScalar(this.length()||1)},setLength:function(e){return this.normalize().multiplyScalar(e)},lerp:function(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this.z+=(e.z-this.z)*t,this},lerpVectors:function(e,t,i){return this.subVectors(t,e).multiplyScalar(i).add(e)},cross:function(e,t){return void 0!==t?(console.warn("THREE.Vector3: .cross() now only accepts one argument. Use .crossVectors( a, b ) instead."),this.crossVectors(e,t)):this.crossVectors(this,e)},crossVectors:function(e,t){var i=e.x,r=e.y,n=e.z,o=t.x,a=t.y,s=t.z;return this.x=r*s-n*a,this.y=n*o-i*s,this.z=i*a-r*o,this},projectOnVector:function(e){var t=e.dot(this)/e.lengthSq();return this.copy(e).multiplyScalar(t)},projectOnPlane:function(){var e=new yt;return function(t){return e.copy(this).projectOnVector(t),this.sub(e)}}(),reflect:function(){var e=new yt;return function(t){return this.sub(e.copy(t).multiplyScalar(2*this.dot(t)))}}(),angleTo:function(e){var t=this.dot(e)/Math.sqrt(this.lengthSq()*e.lengthSq());return Math.acos(ft.clamp(t,-1,1))},distanceTo:function(e){return Math.sqrt(this.distanceToSquared(e))},distanceToSquared:function(e){var t=this.x-e.x,i=this.y-e.y,r=this.z-e.z;return t*t+i*i+r*r},manhattanDistanceTo:function(e){return Math.abs(this.x-e.x)+Math.abs(this.y-e.y)+Math.abs(this.z-e.z)},setFromSpherical:function(e){var t=Math.sin(e.phi)*e.radius;return this.x=t*Math.sin(e.theta),this.y=Math.cos(e.phi)*e.radius,this.z=t*Math.cos(e.theta),this},setFromCylindrical:function(e){return this.x=e.radius*Math.sin(e.theta),this.y=e.y,this.z=e.radius*Math.cos(e.theta),this},setFromMatrixPosition:function(e){var t=e.elements;return this.x=t[12],this.y=t[13],this.z=t[14],this},setFromMatrixScale:function(e){var t=this.setFromMatrixColumn(e,0).length(),i=this.setFromMatrixColumn(e,1).length(),r=this.setFromMatrixColumn(e,2).length();return this.x=t,this.y=i,this.z=r,this},setFromMatrixColumn:function(e,t){return this.fromArray(e.elements,4*t)},equals:function(e){return e.x===this.x&&e.y===this.y&&e.z===this.z},fromArray:function(e,t){return void 0===t&&(t=0),this.x=e[t],this.y=e[t+1],this.z=e[t+2],this},toArray:function(e,t){return void 0===e&&(e=[]),void 0===t&&(t=0),e[t]=this.x,e[t+1]=this.y,e[t+2]=this.z,e},fromBufferAttribute:function(e,t,i){return void 0!==i&&console.warn("THREE.Vector3: offset has been removed from .fromBufferAttribute()."),this.x=e.getX(t),this.y=e.getY(t),this.z=e.getZ(t),this}}),Object.assign(xt.prototype,{isMatrix3:!0,set:function(e,t,i,r,n,o,a,s,c){var h=this.elements;return h[0]=e,h[1]=r,h[2]=a,h[3]=t,h[4]=n,h[5]=s,h[6]=i,h[7]=o,h[8]=c,this},identity:function(){return this.set(1,0,0,0,1,0,0,0,1),this},clone:function(){return(new this.constructor).fromArray(this.elements)},copy:function(e){var t=this.elements,i=e.elements;return t[0]=i[0],t[1]=i[1],t[2]=i[2],t[3]=i[3],t[4]=i[4],t[5]=i[5],t[6]=i[6],t[7]=i[7],t[8]=i[8],this},setFromMatrix4:function(e){var t=e.elements;return this.set(t[0],t[4],t[8],t[1],t[5],t[9],t[2],t[6],t[10]),this},applyToBufferAttribute:function(){var e=new yt;return function(t){for(var i=0,r=t.count;i2048||t.height>2048?t.toDataURL("image/jpeg",.6):t.toDataURL("image/png")}(r)}),i.image=r.uuid}return t||(e.textures[this.uuid]=i),i},dispose:function(){this.dispatchEvent({type:"dispose"})},transformUv:function(e){if(300===this.mapping){if(e.applyMatrix3(this.matrix),e.x<0||e.x>1)switch(this.wrapS){case ve:e.x=e.x-Math.floor(e.x);break;case ge:e.x=e.x<0?0:1;break;case ye:1===Math.abs(Math.floor(e.x)%2)?e.x=Math.ceil(e.x)-e.x:e.x=e.x-Math.floor(e.x)}if(e.y<0||e.y>1)switch(this.wrapT){case ve:e.y=e.y-Math.floor(e.y);break;case ge:e.y=e.y<0?0:1;break;case ye:1===Math.abs(Math.floor(e.y)%2)?e.y=Math.ceil(e.y)-e.y:e.y=e.y-Math.floor(e.y)}this.flipY&&(e.y=1-e.y)}}}),Object.defineProperty(wt.prototype,"needsUpdate",{set:function(e){!0===e&&this.version++}}),Object.assign(_t.prototype,{isVector4:!0,set:function(e,t,i,r){return this.x=e,this.y=t,this.z=i,this.w=r,this},setScalar:function(e){return this.x=e,this.y=e,this.z=e,this.w=e,this},setX:function(e){return this.x=e,this},setY:function(e){return this.y=e,this},setZ:function(e){return this.z=e,this},setW:function(e){return this.w=e,this},setComponent:function(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;case 2:this.z=t;break;case 3:this.w=t;break;default:throw new Error("index is out of range: "+e)}return this},getComponent:function(e){switch(e){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: "+e)}},clone:function(){return new this.constructor(this.x,this.y,this.z,this.w)},copy:function(e){return this.x=e.x,this.y=e.y,this.z=e.z,this.w=void 0!==e.w?e.w:1,this},add:function(e,t){return void 0!==t?(console.warn("THREE.Vector4: .add() now only accepts one argument. Use .addVectors( a, b ) instead."),this.addVectors(e,t)):(this.x+=e.x,this.y+=e.y,this.z+=e.z,this.w+=e.w,this)},addScalar:function(e){return this.x+=e,this.y+=e,this.z+=e,this.w+=e,this},addVectors:function(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this.z=e.z+t.z,this.w=e.w+t.w,this},addScaledVector:function(e,t){return this.x+=e.x*t,this.y+=e.y*t,this.z+=e.z*t,this.w+=e.w*t,this},sub:function(e,t){return void 0!==t?(console.warn("THREE.Vector4: .sub() now only accepts one argument. Use .subVectors( a, b ) instead."),this.subVectors(e,t)):(this.x-=e.x,this.y-=e.y,this.z-=e.z,this.w-=e.w,this)},subScalar:function(e){return this.x-=e,this.y-=e,this.z-=e,this.w-=e,this},subVectors:function(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this.z=e.z-t.z,this.w=e.w-t.w,this},multiplyScalar:function(e){return this.x*=e,this.y*=e,this.z*=e,this.w*=e,this},applyMatrix4:function(e){var t=this.x,i=this.y,r=this.z,n=this.w,o=e.elements;return this.x=o[0]*t+o[4]*i+o[8]*r+o[12]*n,this.y=o[1]*t+o[5]*i+o[9]*r+o[13]*n,this.z=o[2]*t+o[6]*i+o[10]*r+o[14]*n,this.w=o[3]*t+o[7]*i+o[11]*r+o[15]*n,this},divideScalar:function(e){return this.multiplyScalar(1/e)},setAxisAngleFromQuaternion:function(e){this.w=2*Math.acos(e.w);var t=Math.sqrt(1-e.w*e.w);return t<1e-4?(this.x=1,this.y=0,this.z=0):(this.x=e.x/t,this.y=e.y/t,this.z=e.z/t),this},setAxisAngleFromRotationMatrix:function(e){var t,i,r,n,o=e.elements,a=o[0],s=o[4],c=o[8],h=o[1],l=o[5],u=o[9],p=o[2],d=o[6],f=o[10];if(Math.abs(s-h)<.01&&Math.abs(c-p)<.01&&Math.abs(u-d)<.01){if(Math.abs(s+h)<.1&&Math.abs(c+p)<.1&&Math.abs(u+d)<.1&&Math.abs(a+l+f-3)<.1)return this.set(1,0,0,0),this;t=Math.PI;var m=(a+1)/2,v=(l+1)/2,g=(f+1)/2,y=(s+h)/4,x=(c+p)/4,b=(u+d)/4;return m>v&&m>g?m<.01?(i=0,r=.707106781,n=.707106781):(r=y/(i=Math.sqrt(m)),n=x/i):v>g?v<.01?(i=.707106781,r=0,n=.707106781):(i=y/(r=Math.sqrt(v)),n=b/r):g<.01?(i=.707106781,r=.707106781,n=0):(i=x/(n=Math.sqrt(g)),r=b/n),this.set(i,r,n,t),this}var w=Math.sqrt((d-u)*(d-u)+(c-p)*(c-p)+(h-s)*(h-s));return Math.abs(w)<.001&&(w=1),this.x=(d-u)/w,this.y=(c-p)/w,this.z=(h-s)/w,this.w=Math.acos((a+l+f-1)/2),this},min:function(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this.z=Math.min(this.z,e.z),this.w=Math.min(this.w,e.w),this},max:function(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this.z=Math.max(this.z,e.z),this.w=Math.max(this.w,e.w),this},clamp:function(e,t){return this.x=Math.max(e.x,Math.min(t.x,this.x)),this.y=Math.max(e.y,Math.min(t.y,this.y)),this.z=Math.max(e.z,Math.min(t.z,this.z)),this.w=Math.max(e.w,Math.min(t.w,this.w)),this},clampScalar:function(){var e,t;return function(i,r){return void 0===e&&(e=new _t,t=new _t),e.set(i,i,i,i),t.set(r,r,r,r),this.clamp(e,t)}}(),clampLength:function(e,t){var i=this.length();return this.divideScalar(i||1).multiplyScalar(Math.max(e,Math.min(t,i)))},floor:function(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this.w=Math.floor(this.w),this},ceil:function(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this.w=Math.ceil(this.w),this},round:function(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this.w=Math.round(this.w),this},roundToZero: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.w=this.w<0?Math.ceil(this.w):Math.floor(this.w),this},negate:function(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this.w=-this.w,this},dot:function(e){return this.x*e.x+this.y*e.y+this.z*e.z+this.w*e.w},lengthSq:function(){return this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w},length:function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)},manhattanLength:function(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)+Math.abs(this.w)},normalize:function(){return this.divideScalar(this.length()||1)},setLength:function(e){return this.normalize().multiplyScalar(e)},lerp:function(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this.z+=(e.z-this.z)*t,this.w+=(e.w-this.w)*t,this},lerpVectors:function(e,t,i){return this.subVectors(t,e).multiplyScalar(i).add(e)},equals:function(e){return e.x===this.x&&e.y===this.y&&e.z===this.z&&e.w===this.w},fromArray:function(e,t){return void 0===t&&(t=0),this.x=e[t],this.y=e[t+1],this.z=e[t+2],this.w=e[t+3],this},toArray:function(e,t){return void 0===e&&(e=[]),void 0===t&&(t=0),e[t]=this.x,e[t+1]=this.y,e[t+2]=this.z,e[t+3]=this.w,e},fromBufferAttribute:function(e,t,i){return void 0!==i&&console.warn("THREE.Vector4: offset has been removed from .fromBufferAttribute()."),this.x=e.getX(t),this.y=e.getY(t),this.z=e.getZ(t),this.w=e.getW(t),this}}),Mt.prototype=Object.assign(Object.create(i.prototype),{constructor:Mt,isWebGLRenderTarget:!0,setSize:function(e,t){this.width===e&&this.height===t||(this.width=e,this.height=t,this.dispose()),this.viewport.set(0,0,e,t),this.scissor.set(0,0,e,t)},clone:function(){return(new this.constructor).copy(this)},copy:function(e){return this.width=e.width,this.height=e.height,this.viewport.copy(e.viewport),this.texture=e.texture.clone(),this.depthBuffer=e.depthBuffer,this.stencilBuffer=e.stencilBuffer,this.depthTexture=e.depthTexture,this},dispose:function(){this.dispatchEvent({type:"dispose"})}}),Et.prototype=Object.create(Mt.prototype),Et.prototype.constructor=Et,Et.prototype.isWebGLRenderTargetCube=!0,Tt.prototype=Object.create(wt.prototype),Tt.prototype.constructor=Tt,Tt.prototype.isDataTexture=!0,St.prototype=Object.create(wt.prototype),St.prototype.constructor=St,St.prototype.isCubeTexture=!0,Object.defineProperty(St.prototype,"images",{get:function(){return this.image},set:function(e){this.image=e}});var At=new wt,Rt=new St;function Lt(){this.seq=[],this.map={}}var Ct=[],Pt=[],Nt=new Float32Array(16),Ot=new Float32Array(9);function It(e,t,i){var r=e[0];if(r<=0||r>0)return e;var n=t*i,o=Ct[n];if(void 0===o&&(o=new Float32Array(n),Ct[n]=o),0!==t){r.toArray(o,0);for(var a=1,s=0;a!==t;++a)s+=i,e[a].toArray(o,s)}return o}function Dt(e,t){var i=Pt[t];void 0===i&&(i=new Int32Array(t),Pt[t]=i);for(var r=0;r!==t;++r)i[r]=e.allocTextureUnit();return i}function Ut(e,t){e.uniform1f(this.addr,t)}function Ft(e,t){e.uniform1i(this.addr,t)}function Bt(e,t){void 0===t.x?e.uniform2fv(this.addr,t):e.uniform2f(this.addr,t.x,t.y)}function zt(e,t){void 0!==t.x?e.uniform3f(this.addr,t.x,t.y,t.z):void 0!==t.r?e.uniform3f(this.addr,t.r,t.g,t.b):e.uniform3fv(this.addr,t)}function kt(e,t){void 0===t.x?e.uniform4fv(this.addr,t):e.uniform4f(this.addr,t.x,t.y,t.z,t.w)}function Gt(e,t){e.uniformMatrix2fv(this.addr,!1,t.elements||t)}function Vt(e,t){void 0===t.elements?e.uniformMatrix3fv(this.addr,!1,t):(Ot.set(t.elements),e.uniformMatrix3fv(this.addr,!1,Ot))}function Ht(e,t){void 0===t.elements?e.uniformMatrix4fv(this.addr,!1,t):(Nt.set(t.elements),e.uniformMatrix4fv(this.addr,!1,Nt))}function jt(e,t,i){var r=i.allocTextureUnit();e.uniform1i(this.addr,r),i.setTexture2D(t||At,r)}function Wt(e,t,i){var r=i.allocTextureUnit();e.uniform1i(this.addr,r),i.setTextureCube(t||Rt,r)}function Xt(e,t){e.uniform2iv(this.addr,t)}function qt(e,t){e.uniform3iv(this.addr,t)}function Yt(e,t){e.uniform4iv(this.addr,t)}function Zt(e,t){e.uniform1fv(this.addr,t)}function Jt(e,t){e.uniform1iv(this.addr,t)}function Qt(e,t){e.uniform2fv(this.addr,It(t,this.size,2))}function Kt(e,t){e.uniform3fv(this.addr,It(t,this.size,3))}function $t(e,t){e.uniform4fv(this.addr,It(t,this.size,4))}function ei(e,t){e.uniformMatrix2fv(this.addr,!1,It(t,this.size,4))}function ti(e,t){e.uniformMatrix3fv(this.addr,!1,It(t,this.size,9))}function ii(e,t){e.uniformMatrix4fv(this.addr,!1,It(t,this.size,16))}function ri(e,t,i){var r=t.length,n=Dt(i,r);e.uniform1iv(this.addr,n);for(var o=0;o!==r;++o)i.setTexture2D(t[o]||At,n[o])}function ni(e,t,i){var r=t.length,n=Dt(i,r);e.uniform1iv(this.addr,n);for(var o=0;o!==r;++o)i.setTextureCube(t[o]||Rt,n[o])}function oi(e,t,i){this.id=e,this.addr=i,this.setValue=function(e){switch(e){case 5126:return Ut;case 35664:return Bt;case 35665:return zt;case 35666:return kt;case 35674:return Gt;case 35675:return Vt;case 35676:return Ht;case 35678:case 36198:return jt;case 35680:return Wt;case 5124:case 35670:return Ft;case 35667:case 35671:return Xt;case 35668:case 35672:return qt;case 35669:case 35673:return Yt}}(t.type)}function ai(e,t,i){this.id=e,this.addr=i,this.size=t.size,this.setValue=function(e){switch(e){case 5126:return Zt;case 35664:return Qt;case 35665:return Kt;case 35666:return $t;case 35674:return ei;case 35675:return ti;case 35676:return ii;case 35678:return ri;case 35680:return ni;case 5124:case 35670:return Jt;case 35667:case 35671:return Xt;case 35668:case 35672:return qt;case 35669:case 35673:return Yt}}(t.type)}function si(e){this.id=e,Lt.call(this)}si.prototype.setValue=function(e,t){for(var i=this.seq,r=0,n=i.length;r!==n;++r){var o=i[r];o.setValue(e,t[o.id])}};var ci=/([\w\d_]+)(\])?(\[|\.)?/g;function hi(e,t){e.seq.push(t),e.map[t.id]=t}function li(e,t,i){var r=e.name,n=r.length;for(ci.lastIndex=0;;){var o=ci.exec(r),a=ci.lastIndex,s=o[1],c="]"===o[2],h=o[3];if(c&&(s|=0),void 0===h||"["===h&&a+2===n){hi(i,void 0===h?new oi(s,e,t):new ai(s,e,t));break}var l=i.map[s];void 0===l&&hi(i,l=new si(s)),i=l}}function ui(e,t,i){Lt.call(this),this.renderer=i;for(var r=e.getProgramParameter(t,e.ACTIVE_UNIFORMS),n=0;n>16&255)/255,this.g=(e>>8&255)/255,this.b=(255&e)/255,this},setRGB:function(e,t,i){return this.r=e,this.g=t,this.b=i,this},setHSL:function(){function e(e,t,i){return i<0&&(i+=1),i>1&&(i-=1),i<1/6?e+6*(t-e)*i:i<.5?t:i<2/3?e+6*(t-e)*(2/3-i):e}return function(t,i,r){if(t=ft.euclideanModulo(t,1),i=ft.clamp(i,0,1),r=ft.clamp(r,0,1),0===i)this.r=this.g=this.b=r;else{var n=r<=.5?r*(1+i):r+i-r*i,o=2*r-n;this.r=e(o,n,t+1/3),this.g=e(o,n,t),this.b=e(o,n,t-1/3)}return this}}(),setStyle:function(e){function t(t){void 0!==t&&parseFloat(t)<1&&console.warn("THREE.Color: Alpha component of "+e+" will be ignored.")}var i;if(i=/^((?:rgb|hsl)a?)\(\s*([^\)]*)\)/.exec(e)){var r,n=i[1],o=i[2];switch(n){case"rgb":case"rgba":if(r=/^(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(,\s*([0-9]*\.?[0-9]+)\s*)?$/.exec(o))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,t(r[5]),this;if(r=/^(\d+)\%\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(,\s*([0-9]*\.?[0-9]+)\s*)?$/.exec(o))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,t(r[5]),this;break;case"hsl":case"hsla":if(r=/^([0-9]*\.?[0-9]+)\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(,\s*([0-9]*\.?[0-9]+)\s*)?$/.exec(o)){var a=parseFloat(r[1])/360,s=parseInt(r[2],10)/100,c=parseInt(r[3],10)/100;return t(r[5]),this.setHSL(a,s,c)}}}else if(i=/^\#([A-Fa-f0-9]+)$/.exec(e)){var h,l=(h=i[1]).length;if(3===l)return this.r=parseInt(h.charAt(0)+h.charAt(0),16)/255,this.g=parseInt(h.charAt(1)+h.charAt(1),16)/255,this.b=parseInt(h.charAt(2)+h.charAt(2),16)/255,this;if(6===l)return this.r=parseInt(h.charAt(0)+h.charAt(1),16)/255,this.g=parseInt(h.charAt(2)+h.charAt(3),16)/255,this.b=parseInt(h.charAt(4)+h.charAt(5),16)/255,this}e&&e.length>0&&(void 0!==(h=pi[e])?this.setHex(h):console.warn("THREE.Color: Unknown color "+e));return this},clone:function(){return new this.constructor(this.r,this.g,this.b)},copy:function(e){return this.r=e.r,this.g=e.g,this.b=e.b,this},copyGammaToLinear:function(e,t){return void 0===t&&(t=2),this.r=Math.pow(e.r,t),this.g=Math.pow(e.g,t),this.b=Math.pow(e.b,t),this},copyLinearToGamma:function(e,t){void 0===t&&(t=2);var i=t>0?1/t:1;return this.r=Math.pow(e.r,i),this.g=Math.pow(e.g,i),this.b=Math.pow(e.b,i),this},convertGammaToLinear:function(){var e=this.r,t=this.g,i=this.b;return this.r=e*e,this.g=t*t,this.b=i*i,this},convertLinearToGamma:function(){return this.r=Math.sqrt(this.r),this.g=Math.sqrt(this.g),this.b=Math.sqrt(this.b),this},getHex:function(){return 255*this.r<<16^255*this.g<<8^255*this.b<<0},getHexString:function(){return("000000"+this.getHex().toString(16)).slice(-6)},getHSL:function(e){var t,i,r=e||{h:0,s:0,l:0},n=this.r,o=this.g,a=this.b,s=Math.max(n,o,a),c=Math.min(n,o,a),h=(c+s)/2;if(c===s)t=0,i=0;else{var l=s-c;switch(i=h<=.5?l/(s+c):l/(2-s-c),s){case n:t=(o-a)/l+(o 0.0 ) {\n#if defined ( PHYSICALLY_CORRECT_LIGHTS )\n\t\tfloat distanceFalloff = 1.0 / max( pow( lightDistance, decayExponent ), 0.01 );\n\t\tfloat maxDistanceCutoffFactor = pow2( saturate( 1.0 - pow4( lightDistance / cutoffDistance ) ) );\n\t\treturn distanceFalloff * maxDistanceCutoffFactor;\n#else\n\t\treturn pow( saturate( -lightDistance / cutoffDistance + 1.0 ), decayExponent );\n#endif\n\t}\n\treturn 1.0;\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}\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 GeometricContext geometry, const in vec3 specularColor, const in float roughness ) {\n\tfloat alpha = pow2( roughness );\n\tvec3 halfDir = normalize( incidentLight.direction + geometry.viewDir );\n\tfloat dotNL = saturate( dot( geometry.normal, incidentLight.direction ) );\n\tfloat dotNV = saturate( dot( geometry.normal, 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_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 theta = acos( dot( N, V ) );\n\tvec2 uv = vec2(\n\t\tsqrt( saturate( roughness ) ),\n\t\tsaturate( theta / ( 0.5 * PI ) ) );\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.86267 + (0.49788 + 0.01436 * y ) * y;\n\tfloat b = 3.45068 + (4.18814 + y) * y;\n\tfloat v = a / b;\n\tfloat theta_sintheta = (x > 0.0) ? v : 0.5 * inversesqrt( 1.0 - x * x ) - 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\tvec3 result = vec3( LTC_ClippedSphereFormFactor( vectorFormFactor ) );\n\treturn result;\n}\nvec3 BRDF_Specular_GGX_Environment( const in GeometricContext geometry, const in vec3 specularColor, const in float roughness ) {\n\tfloat dotNV = saturate( dot( geometry.normal, geometry.viewDir ) );\n\tconst vec4 c0 = vec4( - 1, - 0.0275, - 0.572, 0.022 );\n\tconst vec4 c1 = vec4( 1, 0.0425, 1.04, - 0.04 );\n\tvec4 r = roughness * c0 + c1;\n\tfloat a004 = min( r.x * r.x, exp2( - 9.28 * dotNV ) ) * r.x + r.y;\n\tvec2 AB = vec2( -1.04, 1.04 ) * a004 + r.zw;\n\treturn specularColor * AB.x + AB.y;\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",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 ) {\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 );\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\n",clipping_planes_fragment:"#if NUM_CLIPPING_PLANES > 0\n\tfor ( int i = 0; i < UNION_CLIPPING_PLANES; ++ i ) {\n\t\tvec4 plane = clippingPlanes[ i ];\n\t\tif ( dot( vViewPosition, plane.xyz ) > plane.w ) discard;\n\t}\n\t\t\n\t#if UNION_CLIPPING_PLANES < NUM_CLIPPING_PLANES\n\t\tbool clipped = true;\n\t\tfor ( int i = UNION_CLIPPING_PLANES; i < NUM_CLIPPING_PLANES; ++ i ) {\n\t\t\tvec4 plane = clippingPlanes[ i ];\n\t\t\tclipped = ( dot( vViewPosition, plane.xyz ) > plane.w ) && clipped;\n\t\t}\n\t\tif ( clipped ) discard;\n\t\n\t#endif\n#endif\n",clipping_planes_pars_fragment:"#if NUM_CLIPPING_PLANES > 0\n\t#if ! defined( PHYSICAL ) && ! defined( PHONG )\n\t\tvarying vec3 vViewPosition;\n\t#endif\n\tuniform vec4 clippingPlanes[ NUM_CLIPPING_PLANES ];\n#endif\n",clipping_planes_pars_vertex:"#if NUM_CLIPPING_PLANES > 0 && ! defined( PHYSICAL ) && ! defined( PHONG )\n\tvarying vec3 vViewPosition;\n#endif\n",clipping_planes_vertex:"#if NUM_CLIPPING_PLANES > 0 && ! defined( PHYSICAL ) && ! defined( PHONG )\n\tvViewPosition = - mvPosition.xyz;\n#endif\n",color_fragment:"#ifdef USE_COLOR\n\tdiffuseColor.rgb *= vColor;\n#endif",color_pars_fragment:"#ifdef USE_COLOR\n\tvarying vec3 vColor;\n#endif\n",color_pars_vertex:"#ifdef USE_COLOR\n\tvarying vec3 vColor;\n#endif",color_vertex:"#ifdef USE_COLOR\n\tvColor.xyz = color.xyz;\n#endif",common:"#define PI 3.14159265359\n#define PI2 6.28318530718\n#define PI_HALF 1.5707963267949\n#define RECIPROCAL_PI 0.31830988618\n#define RECIPROCAL_PI2 0.15915494\n#define LOG2 1.442695\n#define EPSILON 1e-6\n#define saturate(a) clamp( a, 0.0, 1.0 )\n#define whiteCompliment(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}\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};\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}\n",cube_uv_reflection_fragment:"#ifdef ENVMAP_TYPE_CUBE_UV\n#define cubeUV_textureSize (1024.0)\nint getFaceFromDirection(vec3 direction) {\n\tvec3 absDirection = abs(direction);\n\tint face = -1;\n\tif( absDirection.x > absDirection.z ) {\n\t\tif(absDirection.x > absDirection.y )\n\t\t\tface = direction.x > 0.0 ? 0 : 3;\n\t\telse\n\t\t\tface = direction.y > 0.0 ? 1 : 4;\n\t}\n\telse {\n\t\tif(absDirection.z > absDirection.y )\n\t\t\tface = direction.z > 0.0 ? 2 : 5;\n\t\telse\n\t\t\tface = direction.y > 0.0 ? 1 : 4;\n\t}\n\treturn face;\n}\n#define cubeUV_maxLods1 (log2(cubeUV_textureSize*0.25) - 1.0)\n#define cubeUV_rangeClamp (exp2((6.0 - 1.0) * 2.0))\nvec2 MipLevelInfo( vec3 vec, float roughnessLevel, float roughness ) {\n\tfloat scale = exp2(cubeUV_maxLods1 - roughnessLevel);\n\tfloat dxRoughness = dFdx(roughness);\n\tfloat dyRoughness = dFdy(roughness);\n\tvec3 dx = dFdx( vec * scale * dxRoughness );\n\tvec3 dy = dFdy( vec * scale * dyRoughness );\n\tfloat d = max( dot( dx, dx ), dot( dy, dy ) );\n\td = clamp(d, 1.0, cubeUV_rangeClamp);\n\tfloat mipLevel = 0.5 * log2(d);\n\treturn vec2(floor(mipLevel), fract(mipLevel));\n}\n#define cubeUV_maxLods2 (log2(cubeUV_textureSize*0.25) - 2.0)\n#define cubeUV_rcpTextureSize (1.0 / cubeUV_textureSize)\nvec2 getCubeUV(vec3 direction, float roughnessLevel, float mipLevel) {\n\tmipLevel = roughnessLevel > cubeUV_maxLods2 - 3.0 ? 0.0 : mipLevel;\n\tfloat a = 16.0 * cubeUV_rcpTextureSize;\n\tvec2 exp2_packed = exp2( vec2( roughnessLevel, mipLevel ) );\n\tvec2 rcp_exp2_packed = vec2( 1.0 ) / exp2_packed;\n\tfloat powScale = exp2_packed.x * exp2_packed.y;\n\tfloat scale = rcp_exp2_packed.x * rcp_exp2_packed.y * 0.25;\n\tfloat mipOffset = 0.75*(1.0 - rcp_exp2_packed.y) * rcp_exp2_packed.x;\n\tbool bRes = mipLevel == 0.0;\n\tscale = bRes && (scale < a) ? a : scale;\n\tvec3 r;\n\tvec2 offset;\n\tint face = getFaceFromDirection(direction);\n\tfloat rcpPowScale = 1.0 / powScale;\n\tif( face == 0) {\n\t\tr = vec3(direction.x, -direction.z, direction.y);\n\t\toffset = vec2(0.0+mipOffset,0.75 * rcpPowScale);\n\t\toffset.y = bRes && (offset.y < 2.0*a) ? a : offset.y;\n\t}\n\telse if( face == 1) {\n\t\tr = vec3(direction.y, direction.x, direction.z);\n\t\toffset = vec2(scale+mipOffset, 0.75 * rcpPowScale);\n\t\toffset.y = bRes && (offset.y < 2.0*a) ? a : offset.y;\n\t}\n\telse if( face == 2) {\n\t\tr = vec3(direction.z, direction.x, direction.y);\n\t\toffset = vec2(2.0*scale+mipOffset, 0.75 * rcpPowScale);\n\t\toffset.y = bRes && (offset.y < 2.0*a) ? a : offset.y;\n\t}\n\telse if( face == 3) {\n\t\tr = vec3(direction.x, direction.z, direction.y);\n\t\toffset = vec2(0.0+mipOffset,0.5 * rcpPowScale);\n\t\toffset.y = bRes && (offset.y < 2.0*a) ? 0.0 : offset.y;\n\t}\n\telse if( face == 4) {\n\t\tr = vec3(direction.y, direction.x, -direction.z);\n\t\toffset = vec2(scale+mipOffset, 0.5 * rcpPowScale);\n\t\toffset.y = bRes && (offset.y < 2.0*a) ? 0.0 : offset.y;\n\t}\n\telse {\n\t\tr = vec3(direction.z, -direction.x, direction.y);\n\t\toffset = vec2(2.0*scale+mipOffset, 0.5 * rcpPowScale);\n\t\toffset.y = bRes && (offset.y < 2.0*a) ? 0.0 : offset.y;\n\t}\n\tr = normalize(r);\n\tfloat texelOffset = 0.5 * cubeUV_rcpTextureSize;\n\tvec2 s = ( r.yz / abs( r.x ) + vec2( 1.0 ) ) * 0.5;\n\tvec2 base = offset + vec2( texelOffset );\n\treturn base + s * ( scale - 2.0 * texelOffset );\n}\n#define cubeUV_maxLods3 (log2(cubeUV_textureSize*0.25) - 3.0)\nvec4 textureCubeUV(vec3 reflectedDirection, float roughness ) {\n\tfloat roughnessVal = roughness* cubeUV_maxLods3;\n\tfloat r1 = floor(roughnessVal);\n\tfloat r2 = r1 + 1.0;\n\tfloat t = fract(roughnessVal);\n\tvec2 mipInfo = MipLevelInfo(reflectedDirection, r1, roughness);\n\tfloat s = mipInfo.y;\n\tfloat level0 = mipInfo.x;\n\tfloat level1 = level0 + 1.0;\n\tlevel1 = level1 > 5.0 ? 5.0 : level1;\n\tlevel0 += min( floor( s + 0.5 ), 5.0 );\n\tvec2 uv_10 = getCubeUV(reflectedDirection, r1, level0);\n\tvec4 color10 = envMapTexelToLinear(texture2D(envMap, uv_10));\n\tvec2 uv_20 = getCubeUV(reflectedDirection, r2, level0);\n\tvec4 color20 = envMapTexelToLinear(texture2D(envMap, uv_20));\n\tvec4 result = mix(color10, color20, t);\n\treturn vec4(result.rgb, 1.0);\n}\n#endif\n",defaultnormal_vertex:"vec3 transformedNormal = normalMatrix * objectNormal;\n#ifdef FLIP_SIDED\n\ttransformedNormal = - transformedNormal;\n#endif\n",displacementmap_pars_vertex:"#ifdef USE_DISPLACEMENTMAP\n\tuniform sampler2D displacementMap;\n\tuniform float displacementScale;\n\tuniform float displacementBias;\n#endif\n",displacementmap_vertex:"#ifdef USE_DISPLACEMENTMAP\n\ttransformed += normalize( objectNormal ) * ( texture2D( displacementMap, uv ).x * displacementScale + displacementBias );\n#endif\n",emissivemap_fragment:"#ifdef USE_EMISSIVEMAP\n\tvec4 emissiveColor = texture2D( emissiveMap, vUv );\n\temissiveColor.rgb = emissiveMapTexelToLinear( emissiveColor ).rgb;\n\ttotalEmissiveRadiance *= emissiveColor.rgb;\n#endif\n",emissivemap_pars_fragment:"#ifdef USE_EMISSIVEMAP\n\tuniform sampler2D emissiveMap;\n#endif\n",encodings_fragment:" gl_FragColor = linearToOutputTexel( gl_FragColor );\n",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.xyz, vec3( gammaFactor ) ), value.w );\n}\nvec4 LinearToGamma( in vec4 value, in float gammaFactor ) {\n\treturn vec4( pow( value.xyz, vec3( 1.0 / gammaFactor ) ), value.w );\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.w );\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.w );\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.xyz * value.w * maxRange, 1.0 );\n}\nvec4 LinearToRGBM( in vec4 value, in float maxRange ) {\n\tfloat maxRGB = max( value.x, 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.x, max( value.g, value.b ) );\n\tfloat D = max( maxRange / maxRGB, 1.0 );\n\tD = min( floor( D ) / 255.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 = value.rgb * cLogLuvM;\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 = Xp_Y_XYZp.rgb * cLogLuvInverseM;\n\treturn vec4( max(vRGB, 0.0), 1.0 );\n}\n",envmap_fragment:"#ifdef USE_ENVMAP\n\t#if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG )\n\t\tvec3 cameraToVertex = normalize( vWorldPosition - cameraPosition );\n\t\tvec3 worldNormal = inverseTransformDirection( normal, viewMatrix );\n\t\t#ifdef ENVMAP_MODE_REFLECTION\n\t\t\tvec3 reflectVec = reflect( cameraToVertex, worldNormal );\n\t\t#else\n\t\t\tvec3 reflectVec = refract( cameraToVertex, 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_EQUIREC )\n\t\tvec2 sampleUV;\n\t\treflectVec = normalize( reflectVec );\n\t\tsampleUV.y = asin( clamp( reflectVec.y, - 1.0, 1.0 ) ) * RECIPROCAL_PI + 0.5;\n\t\tsampleUV.x = atan( reflectVec.z, reflectVec.x ) * RECIPROCAL_PI2 + 0.5;\n\t\tvec4 envColor = texture2D( envMap, sampleUV );\n\t#elif defined( ENVMAP_TYPE_SPHERE )\n\t\treflectVec = normalize( reflectVec );\n\t\tvec3 reflectView = normalize( ( viewMatrix * vec4( reflectVec, 0.0 ) ).xyz + vec3( 0.0, 0.0, 1.0 ) );\n\t\tvec4 envColor = texture2D( envMap, reflectView.xy * 0.5 + 0.5 );\n\t#else\n\t\tvec4 envColor = vec4( 0.0 );\n\t#endif\n\tenvColor = envMapTexelToLinear( envColor );\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\n",envmap_pars_fragment:"#if defined( USE_ENVMAP ) || defined( PHYSICAL )\n\tuniform float reflectivity;\n\tuniform float envMapIntensity;\n#endif\n#ifdef USE_ENVMAP\n\t#if ! defined( PHYSICAL ) && ( defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG ) )\n\t\tvarying vec3 vWorldPosition;\n\t#endif\n\t#ifdef ENVMAP_TYPE_CUBE\n\t\tuniform samplerCube envMap;\n\t#else\n\t\tuniform sampler2D envMap;\n\t#endif\n\tuniform float flipEnvMap;\n\t#if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG ) || defined( PHYSICAL )\n\t\tuniform float refractionRatio;\n\t#else\n\t\tvarying vec3 vReflect;\n\t#endif\n#endif\n",envmap_pars_vertex:"#ifdef USE_ENVMAP\n\t#if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG )\n\t\tvarying vec3 vWorldPosition;\n\t#else\n\t\tvarying vec3 vReflect;\n\t\tuniform float refractionRatio;\n\t#endif\n#endif\n",envmap_vertex:"#ifdef USE_ENVMAP\n\t#if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG )\n\t\tvWorldPosition = worldPosition.xyz;\n\t#else\n\t\tvec3 cameraToVertex = normalize( worldPosition.xyz - cameraPosition );\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\n",fog_vertex:"\n#ifdef USE_FOG\nfogDepth = -mvPosition.z;\n#endif",fog_pars_vertex:"#ifdef USE_FOG\n varying float fogDepth;\n#endif\n",fog_fragment:"#ifdef USE_FOG\n\t#ifdef FOG_EXP2\n\t\tfloat fogFactor = whiteCompliment( exp2( - fogDensity * fogDensity * fogDepth * fogDepth * LOG2 ) );\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\n",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\n",gradientmap_pars_fragment:"#ifdef TOON\n\tuniform sampler2D gradientMap;\n\tvec3 getGradientIrradiance( vec3 normal, vec3 lightDirection ) {\n\t\tfloat dotNL = dot( normal, lightDirection );\n\t\tvec2 coord = vec2( dotNL * 0.5 + 0.5, 0.0 );\n\t\t#ifdef USE_GRADIENTMAP\n\t\t\treturn texture2D( gradientMap, coord ).rgb;\n\t\t#else\n\t\t\treturn ( coord.x < 0.7 ) ? vec3( 0.7 ) : vec3( 1.0 );\n\t\t#endif\n\t}\n#endif\n",lightmap_fragment:"#ifdef USE_LIGHTMAP\n\treflectedLight.indirectDiffuse += PI * texture2D( lightMap, vUv2 ).xyz * lightMapIntensity;\n#endif\n",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 = normalize( -mvPosition.xyz );\nGeometricContext backGeometry;\nbackGeometry.position = geometry.position;\nbackGeometry.normal = -geometry.normal;\nbackGeometry.viewDir = geometry.viewDir;\nvLightFront = vec3( 0.0 );\n#ifdef DOUBLE_SIDED\n\tvLightBack = vec3( 0.0 );\n#endif\nIncidentLight directLight;\nfloat dotNL;\nvec3 directLightColor_Diffuse;\n#if NUM_POINT_LIGHTS > 0\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#endif\n#if NUM_SPOT_LIGHTS > 0\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#endif\n#if NUM_DIR_LIGHTS > 0\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#endif\n#if NUM_HEMI_LIGHTS > 0\n\tfor ( int i = 0; i < NUM_HEMI_LIGHTS; i ++ ) {\n\t\tvLightFront += getHemisphereLightIrradiance( hemisphereLights[ i ], geometry );\n\t\t#ifdef DOUBLE_SIDED\n\t\t\tvLightBack += getHemisphereLightIrradiance( hemisphereLights[ i ], backGeometry );\n\t\t#endif\n\t}\n#endif\n",lights_pars:"uniform vec3 ambientLightColor;\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\tint shadow;\n\t\tfloat shadowBias;\n\t\tfloat shadowRadius;\n\t\tvec2 shadowMapSize;\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\tint shadow;\n\t\tfloat shadowBias;\n\t\tfloat shadowRadius;\n\t\tvec2 shadowMapSize;\n\t\tfloat shadowCameraNear;\n\t\tfloat shadowCameraFar;\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\tint shadow;\n\t\tfloat shadowBias;\n\t\tfloat shadowRadius;\n\t\tvec2 shadowMapSize;\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 ltcMat;\tuniform sampler2D ltcMag;\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\n#if defined( USE_ENVMAP ) && defined( PHYSICAL )\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\tvec3 queryVec = vec3( flipEnvMap * worldNormal.x, worldNormal.yz );\n\t\t\tvec4 envMapColor = textureCubeUV( queryVec, 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 blinnShininessExponent, const in int maxMIPLevel ) {\n\t\tfloat maxMIPLevelScalar = float( maxMIPLevel );\n\t\tfloat desiredMIPLevel = maxMIPLevelScalar + 0.79248 - 0.5 * log2( pow2( blinnShininessExponent ) + 1.0 );\n\t\treturn clamp( desiredMIPLevel, 0.0, maxMIPLevelScalar );\n\t}\n\tvec3 getLightProbeIndirectRadiance( const in GeometricContext geometry, const in float blinnShininessExponent, const in int maxMIPLevel ) {\n\t\t#ifdef ENVMAP_MODE_REFLECTION\n\t\t\tvec3 reflectVec = reflect( -geometry.viewDir, geometry.normal );\n\t\t#else\n\t\t\tvec3 reflectVec = refract( -geometry.viewDir, geometry.normal, refractionRatio );\n\t\t#endif\n\t\treflectVec = inverseTransformDirection( reflectVec, viewMatrix );\n\t\tfloat specularMIPLevel = getSpecularMIPLevel( blinnShininessExponent, 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\tvec3 queryReflectVec = vec3( flipEnvMap * reflectVec.x, reflectVec.yz );\n\t\t\tvec4 envMapColor = textureCubeUV(queryReflectVec, BlinnExponentToGGXRoughness(blinnShininessExponent));\n\t\t#elif defined( ENVMAP_TYPE_EQUIREC )\n\t\t\tvec2 sampleUV;\n\t\t\tsampleUV.y = asin( clamp( reflectVec.y, - 1.0, 1.0 ) ) * RECIPROCAL_PI + 0.5;\n\t\t\tsampleUV.x = atan( reflectVec.z, reflectVec.x ) * RECIPROCAL_PI2 + 0.5;\n\t\t\t#ifdef TEXTURE_LOD_EXT\n\t\t\t\tvec4 envMapColor = texture2DLodEXT( envMap, sampleUV, specularMIPLevel );\n\t\t\t#else\n\t\t\t\tvec4 envMapColor = texture2D( envMap, sampleUV, specularMIPLevel );\n\t\t\t#endif\n\t\t\tenvMapColor.rgb = envMapTexelToLinear( envMapColor ).rgb;\n\t\t#elif defined( ENVMAP_TYPE_SPHERE )\n\t\t\tvec3 reflectView = normalize( ( viewMatrix * vec4( reflectVec, 0.0 ) ).xyz + vec3( 0.0,0.0,1.0 ) );\n\t\t\t#ifdef TEXTURE_LOD_EXT\n\t\t\t\tvec4 envMapColor = texture2DLodEXT( envMap, reflectView.xy * 0.5 + 0.5, specularMIPLevel );\n\t\t\t#else\n\t\t\t\tvec4 envMapColor = texture2D( envMap, reflectView.xy * 0.5 + 0.5, specularMIPLevel );\n\t\t\t#endif\n\t\t\tenvMapColor.rgb = envMapTexelToLinear( envMapColor ).rgb;\n\t\t#endif\n\t\treturn envMapColor.rgb * envMapIntensity;\n\t}\n#endif\n",lights_phong_fragment:"BlinnPhongMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb;\nmaterial.specularColor = specular;\nmaterial.specularShininess = shininess;\nmaterial.specularStrength = specularStrength;\n",lights_phong_pars_fragment:"varying vec3 vViewPosition;\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n#endif\nstruct BlinnPhongMaterial {\n\tvec3\tdiffuseColor;\n\tvec3\tspecularColor;\n\tfloat\tspecularShininess;\n\tfloat\tspecularStrength;\n};\nvoid RE_Direct_BlinnPhong( const in IncidentLight directLight, const in GeometricContext geometry, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight ) {\n\t#ifdef TOON\n\t\tvec3 irradiance = getGradientIrradiance( geometry.normal, directLight.direction ) * directLight.color;\n\t#else\n\t\tfloat dotNL = saturate( dot( geometry.normal, directLight.direction ) );\n\t\tvec3 irradiance = dotNL * directLight.color;\n\t#endif\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)\n",lights_physical_fragment:"PhysicalMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb * ( 1.0 - metalnessFactor );\nmaterial.specularRoughness = clamp( roughnessFactor, 0.04, 1.0 );\n#ifdef STANDARD\n\tmaterial.specularColor = mix( vec3( DEFAULT_SPECULAR_COEFFICIENT ), diffuseColor.rgb, metalnessFactor );\n#else\n\tmaterial.specularColor = mix( vec3( MAXIMUM_SPECULAR_COEFFICIENT * pow2( reflectivity ) ), diffuseColor.rgb, metalnessFactor );\n\tmaterial.clearCoat = saturate( clearCoat );\tmaterial.clearCoatRoughness = clamp( clearCoatRoughness, 0.04, 1.0 );\n#endif\n",lights_physical_pars_fragment:"struct PhysicalMaterial {\n\tvec3\tdiffuseColor;\n\tfloat\tspecularRoughness;\n\tvec3\tspecularColor;\n\t#ifndef STANDARD\n\t\tfloat clearCoat;\n\t\tfloat clearCoatRoughness;\n\t#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\tfloat norm = texture2D( ltcMag, uv ).a;\n\t\tvec4 t = texture2D( ltcMat, uv );\n\t\tmat3 mInv = mat3(\n\t\t\tvec3( 1, 0, t.y ),\n\t\t\tvec3( 0, t.z, 0 ),\n\t\t\tvec3( t.w, 0, t.x )\n\t\t);\n\t\treflectedLight.directSpecular += lightColor * material.specularColor * norm * LTC_Evaluate( normal, viewDir, position, mInv, rectCoords );\n\t\treflectedLight.directDiffuse += lightColor * material.diffuseColor * LTC_Evaluate( normal, viewDir, position, mat3( 1 ), 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#ifndef STANDARD\n\t\tfloat clearCoatDHR = material.clearCoat * clearCoatDHRApprox( material.clearCoatRoughness, dotNL );\n\t#else\n\t\tfloat clearCoatDHR = 0.0;\n\t#endif\n\treflectedLight.directSpecular += ( 1.0 - clearCoatDHR ) * irradiance * BRDF_Specular_GGX( directLight, geometry, material.specularColor, material.specularRoughness );\n\treflectedLight.directDiffuse += ( 1.0 - clearCoatDHR ) * irradiance * BRDF_Diffuse_Lambert( material.diffuseColor );\n\t#ifndef STANDARD\n\t\treflectedLight.directSpecular += irradiance * material.clearCoat * BRDF_Specular_GGX( directLight, geometry, vec3( DEFAULT_SPECULAR_COEFFICIENT ), material.clearCoatRoughness );\n\t#endif\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 clearCoatRadiance, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {\n\t#ifndef STANDARD\n\t\tfloat dotNV = saturate( dot( geometry.normal, geometry.viewDir ) );\n\t\tfloat dotNL = dotNV;\n\t\tfloat clearCoatDHR = material.clearCoat * clearCoatDHRApprox( material.clearCoatRoughness, dotNL );\n\t#else\n\t\tfloat clearCoatDHR = 0.0;\n\t#endif\n\treflectedLight.indirectSpecular += ( 1.0 - clearCoatDHR ) * radiance * BRDF_Specular_GGX_Environment( geometry, material.specularColor, material.specularRoughness );\n\t#ifndef STANDARD\n\t\treflectedLight.indirectSpecular += clearCoatRadiance * material.clearCoat * BRDF_Specular_GGX_Environment( geometry, vec3( DEFAULT_SPECULAR_COEFFICIENT ), material.clearCoatRoughness );\n\t#endif\n}\n#define RE_Direct\t\t\t\tRE_Direct_Physical\n#define RE_Direct_RectArea\t\tRE_Direct_RectArea_Physical\n#define RE_IndirectDiffuse\t\tRE_IndirectDiffuse_Physical\n#define RE_IndirectSpecular\t\tRE_IndirectSpecular_Physical\n#define Material_BlinnShininessExponent( material ) GGXRoughnessToBlinnExponent( material.specularRoughness )\n#define Material_ClearCoat_BlinnShininessExponent( material ) GGXRoughnessToBlinnExponent( material.clearCoatRoughness )\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}\n",lights_template:"\nGeometricContext geometry;\ngeometry.position = - vViewPosition;\ngeometry.normal = normal;\ngeometry.viewDir = normalize( vViewPosition );\nIncidentLight directLight;\n#if ( NUM_POINT_LIGHTS > 0 ) && defined( RE_Direct )\n\tPointLight pointLight;\n\tfor ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) {\n\t\tpointLight = pointLights[ i ];\n\t\tgetPointDirectLightIrradiance( pointLight, geometry, directLight );\n\t\t#ifdef USE_SHADOWMAP\n\t\tdirectLight.color *= all( bvec2( pointLight.shadow, directLight.visible ) ) ? getPointShadow( pointShadowMap[ i ], pointLight.shadowMapSize, pointLight.shadowBias, pointLight.shadowRadius, vPointShadowCoord[ i ], pointLight.shadowCameraNear, pointLight.shadowCameraFar ) : 1.0;\n\t\t#endif\n\t\tRE_Direct( directLight, geometry, material, reflectedLight );\n\t}\n#endif\n#if ( NUM_SPOT_LIGHTS > 0 ) && defined( RE_Direct )\n\tSpotLight spotLight;\n\tfor ( int i = 0; i < NUM_SPOT_LIGHTS; i ++ ) {\n\t\tspotLight = spotLights[ i ];\n\t\tgetSpotDirectLightIrradiance( spotLight, geometry, directLight );\n\t\t#ifdef USE_SHADOWMAP\n\t\tdirectLight.color *= all( bvec2( spotLight.shadow, directLight.visible ) ) ? getShadow( spotShadowMap[ i ], spotLight.shadowMapSize, spotLight.shadowBias, spotLight.shadowRadius, vSpotShadowCoord[ i ] ) : 1.0;\n\t\t#endif\n\t\tRE_Direct( directLight, geometry, material, reflectedLight );\n\t}\n#endif\n#if ( NUM_DIR_LIGHTS > 0 ) && defined( RE_Direct )\n\tDirectionalLight directionalLight;\n\tfor ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) {\n\t\tdirectionalLight = directionalLights[ i ];\n\t\tgetDirectionalDirectLightIrradiance( directionalLight, geometry, directLight );\n\t\t#ifdef USE_SHADOWMAP\n\t\tdirectLight.color *= all( bvec2( directionalLight.shadow, directLight.visible ) ) ? getShadow( directionalShadowMap[ i ], directionalLight.shadowMapSize, directionalLight.shadowBias, directionalLight.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0;\n\t\t#endif\n\t\tRE_Direct( directLight, geometry, material, reflectedLight );\n\t}\n#endif\n#if ( NUM_RECT_AREA_LIGHTS > 0 ) && defined( RE_Direct_RectArea )\n\tRectAreaLight rectAreaLight;\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#endif\n#if defined( RE_IndirectDiffuse )\n\tvec3 irradiance = getAmbientLightIrradiance( ambientLightColor );\n\t#ifdef USE_LIGHTMAP\n\t\tvec3 lightMapIrradiance = texture2D( lightMap, vUv2 ).xyz * 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 ( NUM_HEMI_LIGHTS > 0 )\n\t\tfor ( int i = 0; i < NUM_HEMI_LIGHTS; i ++ ) {\n\t\t\tirradiance += getHemisphereLightIrradiance( hemisphereLights[ i ], geometry );\n\t\t}\n\t#endif\n\t#if defined( USE_ENVMAP ) && defined( PHYSICAL ) && defined( ENVMAP_TYPE_CUBE_UV )\n\t\tirradiance += getLightProbeIndirectIrradiance( geometry, 8 );\n\t#endif\n\tRE_IndirectDiffuse( irradiance, geometry, material, reflectedLight );\n#endif\n#if defined( USE_ENVMAP ) && defined( RE_IndirectSpecular )\n\tvec3 radiance = getLightProbeIndirectRadiance( geometry, Material_BlinnShininessExponent( material ), 8 );\n\t#ifndef STANDARD\n\t\tvec3 clearCoatRadiance = getLightProbeIndirectRadiance( geometry, Material_ClearCoat_BlinnShininessExponent( material ), 8 );\n\t#else\n\t\tvec3 clearCoatRadiance = vec3( 0.0 );\n\t#endif\n\tRE_IndirectSpecular( radiance, clearCoatRadiance, geometry, material, reflectedLight );\n#endif\n",logdepthbuf_fragment:"#if defined( USE_LOGDEPTHBUF ) && defined( USE_LOGDEPTHBUF_EXT )\n\tgl_FragDepthEXT = log2( vFragDepth ) * logDepthBufFC * 0.5;\n#endif",logdepthbuf_pars_fragment:"#ifdef USE_LOGDEPTHBUF\n\tuniform float logDepthBufFC;\n\t#ifdef USE_LOGDEPTHBUF_EXT\n\t\tvarying float vFragDepth;\n\t#endif\n#endif\n",logdepthbuf_pars_vertex:"#ifdef USE_LOGDEPTHBUF\n\t#ifdef USE_LOGDEPTHBUF_EXT\n\t\tvarying float vFragDepth;\n\t#endif\n\tuniform float logDepthBufFC;\n#endif",logdepthbuf_vertex:"#ifdef USE_LOGDEPTHBUF\n\t#ifdef USE_LOGDEPTHBUF_EXT\n\t\tvFragDepth = 1.0 + gl_Position.w;\n\t#else\n\t\tgl_Position.z = log2( max( EPSILON, gl_Position.w + 1.0 ) ) * logDepthBufFC - 1.0;\n\t\tgl_Position.z *= gl_Position.w;\n\t#endif\n#endif\n",map_fragment:"#ifdef USE_MAP\n\tvec4 texelColor = texture2D( map, vUv );\n\ttexelColor = mapTexelToLinear( texelColor );\n\tdiffuseColor *= texelColor;\n#endif\n",map_pars_fragment:"#ifdef USE_MAP\n\tuniform sampler2D map;\n#endif\n",map_particle_fragment:"#ifdef USE_MAP\n\tvec2 uv = ( uvTransform * vec3( gl_PointCoord.x, 1.0 - gl_PointCoord.y, 1 ) ).xy;\n\tvec4 mapTexel = texture2D( map, uv );\n\tdiffuseColor *= mapTexelToLinear( mapTexel );\n#endif\n",map_particle_pars_fragment:"#ifdef USE_MAP\n\tuniform mat3 uvTransform;\n\tuniform sampler2D map;\n#endif\n",metalnessmap_fragment:"float metalnessFactor = metalness;\n#ifdef USE_METALNESSMAP\n\tvec4 texelMetalness = texture2D( metalnessMap, vUv );\n\tmetalnessFactor *= texelMetalness.b;\n#endif\n",metalnessmap_pars_fragment:"#ifdef USE_METALNESSMAP\n\tuniform sampler2D metalnessMap;\n#endif",morphnormal_vertex:"#ifdef USE_MORPHNORMALS\n\tobjectNormal += ( morphNormal0 - normal ) * morphTargetInfluences[ 0 ];\n\tobjectNormal += ( morphNormal1 - normal ) * morphTargetInfluences[ 1 ];\n\tobjectNormal += ( morphNormal2 - normal ) * morphTargetInfluences[ 2 ];\n\tobjectNormal += ( morphNormal3 - normal ) * morphTargetInfluences[ 3 ];\n#endif\n",morphtarget_pars_vertex:"#ifdef USE_MORPHTARGETS\n\t#ifndef USE_MORPHNORMALS\n\tuniform float morphTargetInfluences[ 8 ];\n\t#else\n\tuniform float morphTargetInfluences[ 4 ];\n\t#endif\n#endif",morphtarget_vertex:"#ifdef USE_MORPHTARGETS\n\ttransformed += ( morphTarget0 - position ) * morphTargetInfluences[ 0 ];\n\ttransformed += ( morphTarget1 - position ) * morphTargetInfluences[ 1 ];\n\ttransformed += ( morphTarget2 - position ) * morphTargetInfluences[ 2 ];\n\ttransformed += ( morphTarget3 - position ) * morphTargetInfluences[ 3 ];\n\t#ifndef USE_MORPHNORMALS\n\ttransformed += ( morphTarget4 - position ) * morphTargetInfluences[ 4 ];\n\ttransformed += ( morphTarget5 - position ) * morphTargetInfluences[ 5 ];\n\ttransformed += ( morphTarget6 - position ) * morphTargetInfluences[ 6 ];\n\ttransformed += ( morphTarget7 - position ) * morphTargetInfluences[ 7 ];\n\t#endif\n#endif\n",normal_fragment:"#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 * ( float( gl_FrontFacing ) * 2.0 - 1.0 );\n\t#endif\n#endif\n#ifdef USE_NORMALMAP\n\tnormal = perturbNormal2Arb( -vViewPosition, normal );\n#elif defined( USE_BUMPMAP )\n\tnormal = perturbNormalArb( -vViewPosition, normal, dHdxy_fwd() );\n#endif\n",normalmap_pars_fragment:"#ifdef USE_NORMALMAP\n\tuniform sampler2D normalMap;\n\tuniform vec2 normalScale;\n\tvec3 perturbNormal2Arb( vec3 eye_pos, vec3 surf_norm ) {\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 S = normalize( q0 * st1.t - q1 * st0.t );\n\t\tvec3 T = normalize( -q0 * st1.s + q1 * st0.s );\n\t\tvec3 N = normalize( surf_norm );\n\t\tvec3 mapN = texture2D( normalMap, vUv ).xyz * 2.0 - 1.0;\n\t\tmapN.xy = normalScale * mapN.xy;\n\t\tmat3 tsn = mat3( S, T, N );\n\t\treturn normalize( tsn * mapN );\n\t}\n#endif\n",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}\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}\n",premultiplied_alpha_fragment:"#ifdef PREMULTIPLIED_ALPHA\n\tgl_FragColor.rgb *= gl_FragColor.a;\n#endif\n",project_vertex:"vec4 mvPosition = modelViewMatrix * vec4( transformed, 1.0 );\ngl_Position = projectionMatrix * mvPosition;\n",dithering_fragment:"#if defined( DITHERING )\n gl_FragColor.rgb = dithering( gl_FragColor.rgb );\n#endif\n",dithering_pars_fragment:"#if defined( 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\n",roughnessmap_fragment:"float roughnessFactor = roughness;\n#ifdef USE_ROUGHNESSMAP\n\tvec4 texelRoughness = texture2D( roughnessMap, vUv );\n\troughnessFactor *= texelRoughness.g;\n#endif\n",roughnessmap_pars_fragment:"#ifdef USE_ROUGHNESSMAP\n\tuniform sampler2D roughnessMap;\n#endif",shadowmap_pars_fragment:"#ifdef USE_SHADOWMAP\n\t#if NUM_DIR_LIGHTS > 0\n\t\tuniform sampler2D directionalShadowMap[ NUM_DIR_LIGHTS ];\n\t\tvarying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHTS ];\n\t#endif\n\t#if NUM_SPOT_LIGHTS > 0\n\t\tuniform sampler2D spotShadowMap[ NUM_SPOT_LIGHTS ];\n\t\tvarying vec4 vSpotShadowCoord[ NUM_SPOT_LIGHTS ];\n\t#endif\n\t#if NUM_POINT_LIGHTS > 0\n\t\tuniform sampler2D pointShadowMap[ NUM_POINT_LIGHTS ];\n\t\tvarying vec4 vPointShadowCoord[ NUM_POINT_LIGHTS ];\n\t#endif\n\tfloat texture2DCompare( sampler2D depths, vec2 uv, float compare ) {\n\t\treturn step( compare, unpackRGBAToDepth( texture2D( depths, uv ) ) );\n\t}\n\tfloat texture2DShadowLerp( sampler2D depths, vec2 size, vec2 uv, float compare ) {\n\t\tconst vec2 offset = vec2( 0.0, 1.0 );\n\t\tvec2 texelSize = vec2( 1.0 ) / size;\n\t\tvec2 centroidUV = floor( uv * size + 0.5 ) / size;\n\t\tfloat lb = texture2DCompare( depths, centroidUV + texelSize * offset.xx, compare );\n\t\tfloat lt = texture2DCompare( depths, centroidUV + texelSize * offset.xy, compare );\n\t\tfloat rb = texture2DCompare( depths, centroidUV + texelSize * offset.yx, compare );\n\t\tfloat rt = texture2DCompare( depths, centroidUV + texelSize * offset.yy, compare );\n\t\tvec2 f = fract( uv * size + 0.5 );\n\t\tfloat a = mix( lb, lt, f.y );\n\t\tfloat b = mix( rb, rt, f.y );\n\t\tfloat c = mix( a, b, f.x );\n\t\treturn c;\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\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( dx0, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy, 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( 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 / 9.0 );\n\t\t#elif defined( SHADOWMAP_TYPE_PCF_SOFT )\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\tshadow = (\n\t\t\t\ttexture2DShadowLerp( shadowMap, shadowMapSize, shadowCoord.xy + vec2( dx0, dy0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DShadowLerp( shadowMap, shadowMapSize, shadowCoord.xy + vec2( 0.0, dy0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DShadowLerp( shadowMap, shadowMapSize, shadowCoord.xy + vec2( dx1, dy0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DShadowLerp( shadowMap, shadowMapSize, shadowCoord.xy + vec2( dx0, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DShadowLerp( shadowMap, shadowMapSize, shadowCoord.xy, shadowCoord.z ) +\n\t\t\t\ttexture2DShadowLerp( shadowMap, shadowMapSize, shadowCoord.xy + vec2( dx1, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DShadowLerp( shadowMap, shadowMapSize, shadowCoord.xy + vec2( dx0, dy1 ), shadowCoord.z ) +\n\t\t\t\ttexture2DShadowLerp( shadowMap, shadowMapSize, shadowCoord.xy + vec2( 0.0, dy1 ), shadowCoord.z ) +\n\t\t\t\ttexture2DShadowLerp( shadowMap, shadowMapSize, shadowCoord.xy + vec2( dx1, dy1 ), shadowCoord.z )\n\t\t\t) * ( 1.0 / 9.0 );\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 )\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\n",shadowmap_pars_vertex:"#ifdef USE_SHADOWMAP\n\t#if NUM_DIR_LIGHTS > 0\n\t\tuniform mat4 directionalShadowMatrix[ NUM_DIR_LIGHTS ];\n\t\tvarying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHTS ];\n\t#endif\n\t#if NUM_SPOT_LIGHTS > 0\n\t\tuniform mat4 spotShadowMatrix[ NUM_SPOT_LIGHTS ];\n\t\tvarying vec4 vSpotShadowCoord[ NUM_SPOT_LIGHTS ];\n\t#endif\n\t#if NUM_POINT_LIGHTS > 0\n\t\tuniform mat4 pointShadowMatrix[ NUM_POINT_LIGHTS ];\n\t\tvarying vec4 vPointShadowCoord[ NUM_POINT_LIGHTS ];\n\t#endif\n#endif\n",shadowmap_vertex:"#ifdef USE_SHADOWMAP\n\t#if NUM_DIR_LIGHTS > 0\n\tfor ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) {\n\t\tvDirectionalShadowCoord[ i ] = directionalShadowMatrix[ i ] * worldPosition;\n\t}\n\t#endif\n\t#if NUM_SPOT_LIGHTS > 0\n\tfor ( int i = 0; i < NUM_SPOT_LIGHTS; i ++ ) {\n\t\tvSpotShadowCoord[ i ] = spotShadowMatrix[ i ] * worldPosition;\n\t}\n\t#endif\n\t#if NUM_POINT_LIGHTS > 0\n\tfor ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) {\n\t\tvPointShadowCoord[ i ] = pointShadowMatrix[ i ] * worldPosition;\n\t}\n\t#endif\n#endif\n",shadowmask_pars_fragment:"float getShadowMask() {\n\tfloat shadow = 1.0;\n\t#ifdef USE_SHADOWMAP\n\t#if NUM_DIR_LIGHTS > 0\n\tDirectionalLight directionalLight;\n\tfor ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) {\n\t\tdirectionalLight = directionalLights[ i ];\n\t\tshadow *= bool( directionalLight.shadow ) ? getShadow( directionalShadowMap[ i ], directionalLight.shadowMapSize, directionalLight.shadowBias, directionalLight.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0;\n\t}\n\t#endif\n\t#if NUM_SPOT_LIGHTS > 0\n\tSpotLight spotLight;\n\tfor ( int i = 0; i < NUM_SPOT_LIGHTS; i ++ ) {\n\t\tspotLight = spotLights[ i ];\n\t\tshadow *= bool( spotLight.shadow ) ? getShadow( spotShadowMap[ i ], spotLight.shadowMapSize, spotLight.shadowBias, spotLight.shadowRadius, vSpotShadowCoord[ i ] ) : 1.0;\n\t}\n\t#endif\n\t#if NUM_POINT_LIGHTS > 0\n\tPointLight pointLight;\n\tfor ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) {\n\t\tpointLight = pointLights[ i ];\n\t\tshadow *= bool( pointLight.shadow ) ? getPointShadow( pointShadowMap[ i ], pointLight.shadowMapSize, pointLight.shadowBias, pointLight.shadowRadius, vPointShadowCoord[ i ], pointLight.shadowCameraNear, pointLight.shadowCameraFar ) : 1.0;\n\t}\n\t#endif\n\t#endif\n\treturn shadow;\n}\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 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\n",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\n",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#endif\n",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 gl_FragColor.rgb = toneMapping( gl_FragColor.rgb );\n#endif\n",tonemapping_pars_fragment:"#ifndef saturate\n\t#define saturate(a) clamp( a, 0.0, 1.0 )\n#endif\nuniform float toneMappingExposure;\nuniform float toneMappingWhitePoint;\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}\n#define Uncharted2Helper( x ) max( ( ( x * ( 0.15 * x + 0.10 * 0.50 ) + 0.20 * 0.02 ) / ( x * ( 0.15 * x + 0.50 ) + 0.20 * 0.30 ) ) - 0.02 / 0.30, vec3( 0.0 ) )\nvec3 Uncharted2ToneMapping( vec3 color ) {\n\tcolor *= toneMappingExposure;\n\treturn saturate( Uncharted2Helper( color ) / Uncharted2Helper( vec3( toneMappingWhitePoint ) ) );\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}\n",uv_pars_fragment:"#if defined( USE_MAP ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( USE_SPECULARMAP ) || defined( USE_ALPHAMAP ) || defined( USE_EMISSIVEMAP ) || defined( USE_ROUGHNESSMAP ) || defined( USE_METALNESSMAP )\n\tvarying vec2 vUv;\n#endif",uv_pars_vertex:"#if defined( USE_MAP ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( USE_SPECULARMAP ) || defined( USE_ALPHAMAP ) || defined( USE_EMISSIVEMAP ) || defined( USE_ROUGHNESSMAP ) || defined( USE_METALNESSMAP )\n\tvarying vec2 vUv;\n\tuniform mat3 uvTransform;\n#endif\n",uv_vertex:"#if defined( USE_MAP ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( USE_SPECULARMAP ) || defined( USE_ALPHAMAP ) || defined( USE_EMISSIVEMAP ) || defined( USE_ROUGHNESSMAP ) || defined( USE_METALNESSMAP )\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#endif",uv2_vertex:"#if defined( USE_LIGHTMAP ) || defined( USE_AOMAP )\n\tvUv2 = uv2;\n#endif",worldpos_vertex:"#if defined( USE_ENVMAP ) || defined( DISTANCE ) || defined ( USE_SHADOWMAP )\n\tvec4 worldPosition = modelMatrix * vec4( transformed, 1.0 );\n#endif\n",cube_frag:"uniform samplerCube tCube;\nuniform float tFlip;\nuniform float opacity;\nvarying vec3 vWorldPosition;\nvoid main() {\n\tgl_FragColor = textureCube( tCube, vec3( tFlip * vWorldPosition.x, vWorldPosition.yz ) );\n\tgl_FragColor.a *= opacity;\n}\n",cube_vert:"varying vec3 vWorldPosition;\n#include \nvoid main() {\n\tvWorldPosition = transformDirection( position, modelMatrix );\n\t#include \n\t#include \n\tgl_Position.z = gl_Position.w;\n}\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 \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\t#if DEPTH_PACKING == 3200\n\t\tgl_FragColor = vec4( vec3( gl_FragCoord.z ), opacity );\n\t#elif DEPTH_PACKING == 3201\n\t\tgl_FragColor = packDepthToRGBA( gl_FragCoord.z );\n\t#endif\n}\n",depth_vert:"#include \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}\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}\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}\n",equirect_frag:"uniform sampler2D tEquirect;\nvarying vec3 vWorldPosition;\n#include \nvoid main() {\n\tvec3 direction = normalize( vWorldPosition );\n\tvec2 sampleUV;\n\tsampleUV.y = asin( clamp( direction.y, - 1.0, 1.0 ) ) * RECIPROCAL_PI + 0.5;\n\tsampleUV.x = atan( direction.z, direction.x ) * RECIPROCAL_PI2 + 0.5;\n\tgl_FragColor = texture2D( tEquirect, sampleUV );\n}\n",equirect_vert:"varying vec3 vWorldPosition;\n#include \nvoid main() {\n\tvWorldPosition = transformDirection( position, modelMatrix );\n\t#include \n\t#include \n}\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}\n",linedashed_vert:"uniform float scale;\nattribute float lineDistance;\nvarying float vLineDistance;\n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\tvLineDistance = scale * lineDistance;\n\tvec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );\n\tgl_Position = projectionMatrix * mvPosition;\n\t#include \n\t#include \n\t#include \n}\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 \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\treflectedLight.indirectDiffuse += texture2D( lightMap, vUv2 ).xyz * 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}\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}\n",meshlambert_frag:"uniform vec3 diffuse;\nuniform vec3 emissive;\nuniform float opacity;\nvarying vec3 vLightFront;\n#ifdef DOUBLE_SIDED\n\tvarying vec3 vLightBack;\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 \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\treflectedLight.indirectDiffuse = getAmbientLightIrradiance( ambientLightColor );\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}\n",meshlambert_vert:"#define LAMBERT\nvarying vec3 vLightFront;\n#ifdef DOUBLE_SIDED\n\tvarying vec3 vLightBack;\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}\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 \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\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}\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}\n",meshphysical_frag:"#define PHYSICAL\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform float roughness;\nuniform float metalness;\nuniform float opacity;\n#ifndef STANDARD\n\tuniform float clearCoat;\n\tuniform float clearCoatRoughness;\n#endif\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 \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\tvec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + reflectedLight.directSpecular + reflectedLight.indirectSpecular + totalEmissiveRadiance;\n\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n}\n",meshphysical_vert:"#define PHYSICAL\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}\n",normal_frag:"#define NORMAL\nuniform float opacity;\n#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP )\n\tvarying vec3 vViewPosition;\n#endif\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n#endif\n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\t#include \n\tgl_FragColor = vec4( packNormalToRGB( normal ), opacity );\n}\n",normal_vert:"#define NORMAL\n#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP )\n\tvarying vec3 vViewPosition;\n#endif\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n#endif\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#endif\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( USE_NORMALMAP )\n\tvViewPosition = - mvPosition.xyz;\n#endif\n}\n",points_frag:"uniform vec3 diffuse;\nuniform float opacity;\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\tvec3 outgoingLight = vec3( 0.0 );\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include \n\t#include \n\t#include \n\t#include \n\toutgoingLight = diffuseColor.rgb;\n\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\n\t#include \n\t#include \n\t#include \n\t#include \n}\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#ifdef USE_SIZEATTENUATION\n\t\tgl_PointSize = size * ( scale / - mvPosition.z );\n\t#else\n\t\tgl_PointSize = size;\n\t#endif\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n}\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}\n",shadow_vert:"#include \n#include \nvoid main() {\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n}\n"},gi={basic:{uniforms:mi.merge([fi.common,fi.specularmap,fi.envmap,fi.aomap,fi.lightmap,fi.fog]),vertexShader:vi.meshbasic_vert,fragmentShader:vi.meshbasic_frag},lambert:{uniforms:mi.merge([fi.common,fi.specularmap,fi.envmap,fi.aomap,fi.lightmap,fi.emissivemap,fi.fog,fi.lights,{emissive:{value:new di(0)}}]),vertexShader:vi.meshlambert_vert,fragmentShader:vi.meshlambert_frag},phong:{uniforms:mi.merge([fi.common,fi.specularmap,fi.envmap,fi.aomap,fi.lightmap,fi.emissivemap,fi.bumpmap,fi.normalmap,fi.displacementmap,fi.gradientmap,fi.fog,fi.lights,{emissive:{value:new di(0)},specular:{value:new di(1118481)},shininess:{value:30}}]),vertexShader:vi.meshphong_vert,fragmentShader:vi.meshphong_frag},standard:{uniforms:mi.merge([fi.common,fi.envmap,fi.aomap,fi.lightmap,fi.emissivemap,fi.bumpmap,fi.normalmap,fi.displacementmap,fi.roughnessmap,fi.metalnessmap,fi.fog,fi.lights,{emissive:{value:new di(0)},roughness:{value:.5},metalness:{value:.5},envMapIntensity:{value:1}}]),vertexShader:vi.meshphysical_vert,fragmentShader:vi.meshphysical_frag},points:{uniforms:mi.merge([fi.points,fi.fog]),vertexShader:vi.points_vert,fragmentShader:vi.points_frag},dashed:{uniforms:mi.merge([fi.common,fi.fog,{scale:{value:1},dashSize:{value:1},totalSize:{value:2}}]),vertexShader:vi.linedashed_vert,fragmentShader:vi.linedashed_frag},depth:{uniforms:mi.merge([fi.common,fi.displacementmap]),vertexShader:vi.depth_vert,fragmentShader:vi.depth_frag},normal:{uniforms:mi.merge([fi.common,fi.bumpmap,fi.normalmap,fi.displacementmap,{opacity:{value:1}}]),vertexShader:vi.normal_vert,fragmentShader:vi.normal_frag},cube:{uniforms:{tCube:{value:null},tFlip:{value:-1},opacity:{value:1}},vertexShader:vi.cube_vert,fragmentShader:vi.cube_frag},equirect:{uniforms:{tEquirect:{value:null}},vertexShader:vi.equirect_vert,fragmentShader:vi.equirect_frag},distanceRGBA:{uniforms:mi.merge([fi.common,fi.displacementmap,{referencePosition:{value:new yt},nearDistance:{value:1},farDistance:{value:1e3}}]),vertexShader:vi.distanceRGBA_vert,fragmentShader:vi.distanceRGBA_frag},shadow:{uniforms:mi.merge([fi.lights,fi.fog,{color:{value:new di(0)},opacity:{value:1}}]),vertexShader:vi.shadow_vert,fragmentShader:vi.shadow_frag}};function yi(e,t){this.min=void 0!==e?e:new mt(1/0,1/0),this.max=void 0!==t?t:new mt(-1/0,-1/0)}function xi(e,t,i,r,n){var o,a,s,c,h,l,u,p;function d(){var e=new Float32Array([-1,-1,0,0,1,-1,1,0,1,1,1,1,-1,1,0,1]),r=new Uint16Array([0,1,2,0,2,3]);o=t.createBuffer(),a=t.createBuffer(),t.bindBuffer(t.ARRAY_BUFFER,o),t.bufferData(t.ARRAY_BUFFER,e,t.STATIC_DRAW),t.bindBuffer(t.ELEMENT_ARRAY_BUFFER,a),t.bufferData(t.ELEMENT_ARRAY_BUFFER,r,t.STATIC_DRAW),u=t.createTexture(),p=t.createTexture(),i.bindTexture(t.TEXTURE_2D,u),t.texImage2D(t.TEXTURE_2D,0,t.RGB,16,16,0,t.RGB,t.UNSIGNED_BYTE,null),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_S,t.CLAMP_TO_EDGE),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_T,t.CLAMP_TO_EDGE),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MAG_FILTER,t.NEAREST),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MIN_FILTER,t.NEAREST),i.bindTexture(t.TEXTURE_2D,p),t.texImage2D(t.TEXTURE_2D,0,t.RGBA,16,16,0,t.RGBA,t.UNSIGNED_BYTE,null),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_S,t.CLAMP_TO_EDGE),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_T,t.CLAMP_TO_EDGE),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MAG_FILTER,t.NEAREST),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MIN_FILTER,t.NEAREST),s={vertexShader:["uniform lowp int renderType;","uniform vec3 screenPosition;","uniform vec2 scale;","uniform float rotation;","uniform sampler2D occlusionMap;","attribute vec2 position;","attribute vec2 uv;","varying vec2 vUV;","varying float vVisibility;","void main() {","\tvUV = uv;","\tvec2 pos = position;","\tif ( renderType == 2 ) {","\t\tvec4 visibility = texture2D( occlusionMap, vec2( 0.1, 0.1 ) );","\t\tvisibility += texture2D( occlusionMap, vec2( 0.5, 0.1 ) );","\t\tvisibility += texture2D( occlusionMap, vec2( 0.9, 0.1 ) );","\t\tvisibility += texture2D( occlusionMap, vec2( 0.9, 0.5 ) );","\t\tvisibility += texture2D( occlusionMap, vec2( 0.9, 0.9 ) );","\t\tvisibility += texture2D( occlusionMap, vec2( 0.5, 0.9 ) );","\t\tvisibility += texture2D( occlusionMap, vec2( 0.1, 0.9 ) );","\t\tvisibility += texture2D( occlusionMap, vec2( 0.1, 0.5 ) );","\t\tvisibility += texture2D( occlusionMap, vec2( 0.5, 0.5 ) );","\t\tvVisibility = visibility.r / 9.0;","\t\tvVisibility *= 1.0 - visibility.g / 9.0;","\t\tvVisibility *= visibility.b / 9.0;","\t\tvVisibility *= 1.0 - visibility.a / 9.0;","\t\tpos.x = cos( rotation ) * position.x - sin( rotation ) * position.y;","\t\tpos.y = sin( rotation ) * position.x + cos( rotation ) * position.y;","\t}","\tgl_Position = vec4( ( pos * scale + screenPosition.xy ).xy, screenPosition.z, 1.0 );","}"].join("\n"),fragmentShader:["uniform lowp int renderType;","uniform sampler2D map;","uniform float opacity;","uniform vec3 color;","varying vec2 vUV;","varying float vVisibility;","void main() {","\tif ( renderType == 0 ) {","\t\tgl_FragColor = vec4( 1.0, 0.0, 1.0, 0.0 );","\t} else if ( renderType == 1 ) {","\t\tgl_FragColor = texture2D( map, vUV );","\t} else {","\t\tvec4 texture = texture2D( map, vUV );","\t\ttexture.a *= opacity * vVisibility;","\t\tgl_FragColor = texture;","\t\tgl_FragColor.rgb *= color;","\t}","}"].join("\n")},c=function(e){var i=t.createProgram(),r=t.createShader(t.FRAGMENT_SHADER),o=t.createShader(t.VERTEX_SHADER),a="precision "+n.precision+" float;\n";return t.shaderSource(r,a+e.fragmentShader),t.shaderSource(o,a+e.vertexShader),t.compileShader(r),t.compileShader(o),t.attachShader(i,r),t.attachShader(i,o),t.linkProgram(i),i}(s),h={vertex:t.getAttribLocation(c,"position"),uv:t.getAttribLocation(c,"uv")},l={renderType:t.getUniformLocation(c,"renderType"),map:t.getUniformLocation(c,"map"),occlusionMap:t.getUniformLocation(c,"occlusionMap"),opacity:t.getUniformLocation(c,"opacity"),color:t.getUniformLocation(c,"color"),scale:t.getUniformLocation(c,"scale"),rotation:t.getUniformLocation(c,"rotation"),screenPosition:t.getUniformLocation(c,"screenPosition")}}this.render=function(e,n,s,f){if(0!==e.length){var m=new yt,v=f.w/f.z,g=.5*f.z,y=.5*f.w,x=16/f.w,b=new mt(x*v,x),w=new yt(1,1,0),_=new mt(1,1),M=new yi;M.min.set(f.x,f.y),M.max.set(f.x+(f.z-16),f.y+(f.w-16)),void 0===c&&d(),i.useProgram(c),i.initAttributes(),i.enableAttribute(h.vertex),i.enableAttribute(h.uv),i.disableUnusedAttributes(),t.uniform1i(l.occlusionMap,0),t.uniform1i(l.map,1),t.bindBuffer(t.ARRAY_BUFFER,o),t.vertexAttribPointer(h.vertex,2,t.FLOAT,!1,16,0),t.vertexAttribPointer(h.uv,2,t.FLOAT,!1,16,8),t.bindBuffer(t.ELEMENT_ARRAY_BUFFER,a),i.disable(t.CULL_FACE),i.buffers.depth.setMask(!1);for(var E=0,T=e.length;E.001&&L.scale>.001&&(w.x=L.x,w.y=L.y,w.z=L.z,x=L.size*L.scale/f.w,b.x=x*v,b.y=x,t.uniform3f(l.screenPosition,w.x,w.y,w.z),t.uniform2f(l.scale,b.x,b.y),t.uniform1f(l.rotation,L.rotation),t.uniform1f(l.opacity,L.opacity),t.uniform3f(l.color,L.color.r,L.color.g,L.color.b),i.setBlending(L.blending,L.blendEquation,L.blendSrc,L.blendDst),r.setTexture2D(L.texture,1),t.drawElements(t.TRIANGLES,6,t.UNSIGNED_SHORT,0))}}}i.enable(t.CULL_FACE),i.enable(t.DEPTH_TEST),i.buffers.depth.setMask(!0),i.reset()}}}function bi(e,t,i,r,n,o,a,s,c){wt.call(this,e,t,i,r,n,o,a,s,c),this.needsUpdate=!0}function wi(e,t,i,r,n){var o,a,s,c,h,l,u=new yt,p=new gt,d=new yt;function f(){var e=new Float32Array([-.5,-.5,0,0,.5,-.5,1,0,.5,.5,1,1,-.5,.5,0,1]),i=new Uint16Array([0,1,2,0,2,3]);o=t.createBuffer(),a=t.createBuffer(),t.bindBuffer(t.ARRAY_BUFFER,o),t.bufferData(t.ARRAY_BUFFER,e,t.STATIC_DRAW),t.bindBuffer(t.ELEMENT_ARRAY_BUFFER,a),t.bufferData(t.ELEMENT_ARRAY_BUFFER,i,t.STATIC_DRAW),s=function(){var e=t.createProgram(),i=t.createShader(t.VERTEX_SHADER),r=t.createShader(t.FRAGMENT_SHADER);return t.shaderSource(i,["precision "+n.precision+" float;","#define SHADER_NAME SpriteMaterial","uniform mat4 modelViewMatrix;","uniform mat4 projectionMatrix;","uniform float rotation;","uniform vec2 scale;","uniform vec2 uvOffset;","uniform vec2 uvScale;","attribute vec2 position;","attribute vec2 uv;","varying vec2 vUV;","varying float fogDepth;","void main() {","\tvUV = uvOffset + uv * uvScale;","\tvec2 alignedPosition = position * scale;","\tvec2 rotatedPosition;","\trotatedPosition.x = cos( rotation ) * alignedPosition.x - sin( rotation ) * alignedPosition.y;","\trotatedPosition.y = sin( rotation ) * alignedPosition.x + cos( rotation ) * alignedPosition.y;","\tvec4 mvPosition;","\tmvPosition = modelViewMatrix * vec4( 0.0, 0.0, 0.0, 1.0 );","\tmvPosition.xy += rotatedPosition;","\tgl_Position = projectionMatrix * mvPosition;","\tfogDepth = - mvPosition.z;","}"].join("\n")),t.shaderSource(r,["precision "+n.precision+" float;","#define SHADER_NAME SpriteMaterial","uniform vec3 color;","uniform sampler2D map;","uniform float opacity;","uniform int fogType;","uniform vec3 fogColor;","uniform float fogDensity;","uniform float fogNear;","uniform float fogFar;","uniform float alphaTest;","varying vec2 vUV;","varying float fogDepth;","void main() {","\tvec4 texture = texture2D( map, vUV );","\tgl_FragColor = vec4( color * texture.xyz, texture.a * opacity );","\tif ( gl_FragColor.a < alphaTest ) discard;","\tif ( fogType > 0 ) {","\t\tfloat fogFactor = 0.0;","\t\tif ( fogType == 1 ) {","\t\t\tfogFactor = smoothstep( fogNear, fogFar, fogDepth );","\t\t} else {","\t\t\tconst float LOG2 = 1.442695;","\t\t\tfogFactor = exp2( - fogDensity * fogDensity * fogDepth * fogDepth * LOG2 );","\t\t\tfogFactor = 1.0 - clamp( fogFactor, 0.0, 1.0 );","\t\t}","\t\tgl_FragColor.rgb = mix( gl_FragColor.rgb, fogColor, fogFactor );","\t}","}"].join("\n")),t.compileShader(i),t.compileShader(r),t.attachShader(e,i),t.attachShader(e,r),t.linkProgram(e),e}(),c={position:t.getAttribLocation(s,"position"),uv:t.getAttribLocation(s,"uv")},h={uvOffset:t.getUniformLocation(s,"uvOffset"),uvScale:t.getUniformLocation(s,"uvScale"),rotation:t.getUniformLocation(s,"rotation"),scale:t.getUniformLocation(s,"scale"),color:t.getUniformLocation(s,"color"),map:t.getUniformLocation(s,"map"),opacity:t.getUniformLocation(s,"opacity"),modelViewMatrix:t.getUniformLocation(s,"modelViewMatrix"),projectionMatrix:t.getUniformLocation(s,"projectionMatrix"),fogType:t.getUniformLocation(s,"fogType"),fogDensity:t.getUniformLocation(s,"fogDensity"),fogNear:t.getUniformLocation(s,"fogNear"),fogFar:t.getUniformLocation(s,"fogFar"),fogColor:t.getUniformLocation(s,"fogColor"),fogDepth:t.getUniformLocation(s,"fogDepth"),alphaTest:t.getUniformLocation(s,"alphaTest")};var r=document.createElementNS("http://www.w3.org/1999/xhtml","canvas");r.width=8,r.height=8;var u=r.getContext("2d");u.fillStyle="white",u.fillRect(0,0,8,8),l=new bi(r)}function m(e,t){return e.renderOrder!==t.renderOrder?e.renderOrder-t.renderOrder:e.z!==t.z?t.z-e.z:t.id-e.id}this.render=function(n,v,g){if(0!==n.length){void 0===s&&f(),i.useProgram(s),i.initAttributes(),i.enableAttribute(c.position),i.enableAttribute(c.uv),i.disableUnusedAttributes(),i.disable(t.CULL_FACE),i.enable(t.BLEND),t.bindBuffer(t.ARRAY_BUFFER,o),t.vertexAttribPointer(c.position,2,t.FLOAT,!1,16,0),t.vertexAttribPointer(c.uv,2,t.FLOAT,!1,16,8),t.bindBuffer(t.ELEMENT_ARRAY_BUFFER,a),t.uniformMatrix4fv(h.projectionMatrix,!1,g.projectionMatrix.elements),i.activeTexture(t.TEXTURE0),t.uniform1i(h.map,0);var y=0,x=0,b=v.fog;b?(t.uniform3f(h.fogColor,b.color.r,b.color.g,b.color.b),b.isFog?(t.uniform1f(h.fogNear,b.near),t.uniform1f(h.fogFar,b.far),t.uniform1i(h.fogType,1),y=1,x=1):b.isFogExp2&&(t.uniform1f(h.fogDensity,b.density),t.uniform1i(h.fogType,2),y=2,x=2)):(t.uniform1i(h.fogType,0),y=0,x=0);for(var w=0,_=n.length;w<_;w++){(E=n[w]).modelViewMatrix.multiplyMatrices(g.matrixWorldInverse,E.matrixWorld),E.z=-E.modelViewMatrix.elements[14]}n.sort(m);var M=[];for(w=0,_=n.length;w<_;w++){var E,T=(E=n[w]).material;if(!1!==T.visible){E.onBeforeRender(e,v,g,void 0,T,void 0),t.uniform1f(h.alphaTest,T.alphaTest),t.uniformMatrix4fv(h.modelViewMatrix,!1,E.modelViewMatrix.elements),E.matrixWorld.decompose(u,p,d),M[0]=d.x,M[1]=d.y;var S=0;v.fog&&T.fog&&(S=x),y!==S&&(t.uniform1i(h.fogType,S),y=S),null!==T.map?(t.uniform2f(h.uvOffset,T.map.offset.x,T.map.offset.y),t.uniform2f(h.uvScale,T.map.repeat.x,T.map.repeat.y)):(t.uniform2f(h.uvOffset,0,0),t.uniform2f(h.uvScale,1,1)),t.uniform1f(h.opacity,T.opacity),t.uniform3f(h.color,T.color.r,T.color.g,T.color.b),t.uniform1f(h.rotation,T.rotation),t.uniform2fv(h.scale,M),i.setBlending(T.blending,T.blendEquation,T.blendSrc,T.blendDst,T.blendEquationAlpha,T.blendSrcAlpha,T.blendDstAlpha,T.premultipliedAlpha),i.buffers.depth.setTest(T.depthTest),i.buffers.depth.setMask(T.depthWrite),i.buffers.color.setMask(T.colorWrite),r.setTexture2D(T.map||l,0),t.drawElements(t.TRIANGLES,6,t.UNSIGNED_SHORT,0),E.onAfterRender(e,v,g,void 0,T,void 0)}}i.enable(t.CULL_FACE),i.reset()}}}gi.physical={uniforms:mi.merge([gi.standard.uniforms,{clearCoat:{value:0},clearCoatRoughness:{value:0}}]),vertexShader:vi.meshphysical_vert,fragmentShader:vi.meshphysical_frag},Object.assign(yi.prototype,{set:function(e,t){return this.min.copy(e),this.max.copy(t),this},setFromPoints:function(e){this.makeEmpty();for(var t=0,i=e.length;tthis.max.x||e.ythis.max.y)},containsBox:function(e){return this.min.x<=e.min.x&&e.max.x<=this.max.x&&this.min.y<=e.min.y&&e.max.y<=this.max.y},getParameter:function(e,t){return(t||new mt).set((e.x-this.min.x)/(this.max.x-this.min.x),(e.y-this.min.y)/(this.max.y-this.min.y))},intersectsBox:function(e){return!(e.max.xthis.max.x||e.max.ythis.max.y)},clampPoint:function(e,t){return(t||new mt).copy(e).clamp(this.min,this.max)},distanceToPoint:function(){var e=new mt;return function(t){return e.copy(t).clamp(this.min,this.max).sub(t).length()}}(),intersect:function(e){return this.min.max(e.min),this.max.min(e.max),this},union:function(e){return this.min.min(e.min),this.max.max(e.max),this},translate:function(e){return this.min.add(e),this.max.add(e),this},equals:function(e){return e.min.equals(this.min)&&e.max.equals(this.max)}}),bi.prototype=Object.create(wt.prototype),bi.prototype.constructor=bi;var _i,Mi,Ei,Ti,Si,Ai,Ri,Li=0;function Ci(){Object.defineProperty(this,"id",{value:Li++}),this.uuid=ft.generateUUID(),this.name="",this.type="Material",this.fog=!0,this.lights=!0,this.blending=S,this.side=x,this.flatShading=!1,this.vertexColors=_,this.opacity=1,this.transparent=!1,this.blendSrc=k,this.blendDst=G,this.blendEquation=P,this.blendSrcAlpha=null,this.blendDstAlpha=null,this.blendEquationAlpha=null,this.depthFunc=J,this.depthTest=!0,this.depthWrite=!0,this.clippingPlanes=null,this.clipIntersection=!1,this.clipShadows=!1,this.colorWrite=!0,this.precision=null,this.polygonOffset=!1,this.polygonOffsetFactor=0,this.polygonOffsetUnits=0,this.dithering=!1,this.alphaTest=0,this.premultipliedAlpha=!1,this.overdraw=0,this.visible=!0,this.userData={},this.needsUpdate=!0}function Pi(e){Ci.call(this),this.type="MeshDepthMaterial",this.depthPacking=pt,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.lights=!1,this.setValues(e)}function Ni(e){Ci.call(this),this.type="MeshDistanceMaterial",this.referencePosition=new yt,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.lights=!1,this.setValues(e)}function Oi(e,t){this.min=void 0!==e?e:new yt(1/0,1/0,1/0),this.max=void 0!==t?t:new yt(-1/0,-1/0,-1/0)}function Ii(e,t){this.center=void 0!==e?e:new yt,this.radius=void 0!==t?t:0}function Di(e,t){this.normal=void 0!==e?e:new yt(1,0,0),this.constant=void 0!==t?t:0}function Ui(e,t,i,r,n,o){this.planes=[void 0!==e?e:new Di,void 0!==t?t:new Di,void 0!==i?i:new Di,void 0!==r?r:new Di,void 0!==n?n:new Di,void 0!==o?o:new Di]}function Fi(e,t,i){for(var r=new Ui,n=new vt,o=new mt,a=new mt(i,i),s=new yt,c=new yt,h=1,l=2,u=1+(h|l),p=new Array(u),d=new Array(u),f={},m=[new yt(1,0,0),new yt(-1,0,0),new yt(0,0,1),new yt(0,0,-1),new yt(0,1,0),new yt(0,-1,0)],v=[new yt(0,1,0),new yt(0,1,0),new yt(0,1,0),new yt(0,1,0),new yt(0,0,1),new yt(0,0,-1)],y=[new _t,new _t,new _t,new _t,new _t,new _t],_=0;_!==u;++_){var M=0!=(_&h),E=0!=(_&l),T=new Pi({depthPacking:dt,morphTargets:M,skinning:E});p[_]=T;var S=new Ni({morphTargets:M,skinning:E});d[_]=S}var A=this;function R(t,i,r,n,o,a){var s=t.geometry,c=null,u=p,m=t.customDepthMaterial;if(r&&(u=d,m=t.customDistanceMaterial),m)c=m;else{var v=!1;i.morphTargets&&(s&&s.isBufferGeometry?v=s.morphAttributes&&s.morphAttributes.position&&s.morphAttributes.position.length>0:s&&s.isGeometry&&(v=s.morphTargets&&s.morphTargets.length>0)),t.isSkinnedMesh&&!1===i.skinning&&console.warn("THREE.WebGLShadowMap: THREE.SkinnedMesh with material.skinning set to false:",t);var g=t.isSkinnedMesh&&i.skinning,y=0;v&&(y|=h),g&&(y|=l),c=u[y]}if(e.localClippingEnabled&&!0===i.clipShadows&&0!==i.clippingPlanes.length){var _=c.uuid,M=i.uuid,E=f[_];void 0===E&&(E={},f[_]=E);var T=E[M];void 0===T&&(T=c.clone(),E[M]=T),c=T}c.visible=i.visible,c.wireframe=i.wireframe;var S=i.side;return A.renderSingleSided&&S==w&&(S=x),A.renderReverseSided&&(S===x?S=b:S===b&&(S=x)),c.side=S,c.clipShadows=i.clipShadows,c.clippingPlanes=i.clippingPlanes,c.clipIntersection=i.clipIntersection,c.wireframeLinewidth=i.wireframeLinewidth,c.linewidth=i.linewidth,r&&c.isMeshDistanceMaterial&&(c.referencePosition.copy(n),c.nearDistance=o,c.farDistance=a),c}function L(i,n,o,a){if(!1!==i.visible){if(i.layers.test(n.layers)&&(i.isMesh||i.isLine||i.isPoints)&&i.castShadow&&(!i.frustumCulled||r.intersectsObject(i))){i.modelViewMatrix.multiplyMatrices(o.matrixWorldInverse,i.matrixWorld);var s=t.update(i),h=i.material;if(Array.isArray(h))for(var l=s.groups,u=0,p=l.length;u0&&(i.alphaTest=this.alphaTest),!0===this.premultipliedAlpha&&(i.premultipliedAlpha=this.premultipliedAlpha),!0===this.wireframe&&(i.wireframe=this.wireframe),this.wireframeLinewidth>1&&(i.wireframeLinewidth=this.wireframeLinewidth),"round"!==this.wireframeLinecap&&(i.wireframeLinecap=this.wireframeLinecap),"round"!==this.wireframeLinejoin&&(i.wireframeLinejoin=this.wireframeLinejoin),!0===this.morphTargets&&(i.morphTargets=!0),!0===this.skinning&&(i.skinning=!0),!1===this.visible&&(i.visible=!1),"{}"!==JSON.stringify(this.userData)&&(i.userData=this.userData),t){var n=r(e.textures),o=r(e.images);n.length>0&&(i.textures=n),o.length>0&&(i.images=o)}return i},clone:function(){return(new this.constructor).copy(this)},copy:function(e){this.name=e.name,this.fog=e.fog,this.lights=e.lights,this.blending=e.blending,this.side=e.side,this.flatShading=e.flatShading,this.vertexColors=e.vertexColors,this.opacity=e.opacity,this.transparent=e.transparent,this.blendSrc=e.blendSrc,this.blendDst=e.blendDst,this.blendEquation=e.blendEquation,this.blendSrcAlpha=e.blendSrcAlpha,this.blendDstAlpha=e.blendDstAlpha,this.blendEquationAlpha=e.blendEquationAlpha,this.depthFunc=e.depthFunc,this.depthTest=e.depthTest,this.depthWrite=e.depthWrite,this.colorWrite=e.colorWrite,this.precision=e.precision,this.polygonOffset=e.polygonOffset,this.polygonOffsetFactor=e.polygonOffsetFactor,this.polygonOffsetUnits=e.polygonOffsetUnits,this.dithering=e.dithering,this.alphaTest=e.alphaTest,this.premultipliedAlpha=e.premultipliedAlpha,this.overdraw=e.overdraw,this.visible=e.visible,this.userData=JSON.parse(JSON.stringify(e.userData)),this.clipShadows=e.clipShadows,this.clipIntersection=e.clipIntersection;var t=e.clippingPlanes,i=null;if(null!==t){var r=t.length;i=new Array(r);for(var n=0;n!==r;++n)i[n]=t[n].clone()}return this.clippingPlanes=i,this},dispose:function(){this.dispatchEvent({type:"dispose"})}}),Pi.prototype=Object.create(Ci.prototype),Pi.prototype.constructor=Pi,Pi.prototype.isMeshDepthMaterial=!0,Pi.prototype.copy=function(e){return Ci.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},Ni.prototype=Object.create(Ci.prototype),Ni.prototype.constructor=Ni,Ni.prototype.isMeshDistanceMaterial=!0,Ni.prototype.copy=function(e){return Ci.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},Object.assign(Oi.prototype,{isBox3:!0,set:function(e,t){return this.min.copy(e),this.max.copy(t),this},setFromArray:function(e){for(var t=1/0,i=1/0,r=1/0,n=-1/0,o=-1/0,a=-1/0,s=0,c=e.length;sn&&(n=h),l>o&&(o=l),u>a&&(a=u)}return this.min.set(t,i,r),this.max.set(n,o,a),this},setFromBufferAttribute:function(e){for(var t=1/0,i=1/0,r=1/0,n=-1/0,o=-1/0,a=-1/0,s=0,c=e.count;sn&&(n=h),l>o&&(o=l),u>a&&(a=u)}return this.min.set(t,i,r),this.max.set(n,o,a),this},setFromPoints:function(e){this.makeEmpty();for(var t=0,i=e.length;tthis.max.x||e.ythis.max.y||e.zthis.max.z)},containsBox:function(e){return this.min.x<=e.min.x&&e.max.x<=this.max.x&&this.min.y<=e.min.y&&e.max.y<=this.max.y&&this.min.z<=e.min.z&&e.max.z<=this.max.z},getParameter:function(e,t){return(t||new yt).set((e.x-this.min.x)/(this.max.x-this.min.x),(e.y-this.min.y)/(this.max.y-this.min.y),(e.z-this.min.z)/(this.max.z-this.min.z))},intersectsBox:function(e){return!(e.max.xthis.max.x||e.max.ythis.max.y||e.max.zthis.max.z)},intersectsSphere:(Mi=new yt,function(e){return this.clampPoint(e.center,Mi),Mi.distanceToSquared(e.center)<=e.radius*e.radius}),intersectsPlane:function(e){var t,i;return e.normal.x>0?(t=e.normal.x*this.min.x,i=e.normal.x*this.max.x):(t=e.normal.x*this.max.x,i=e.normal.x*this.min.x),e.normal.y>0?(t+=e.normal.y*this.min.y,i+=e.normal.y*this.max.y):(t+=e.normal.y*this.max.y,i+=e.normal.y*this.min.y),e.normal.z>0?(t+=e.normal.z*this.min.z,i+=e.normal.z*this.max.z):(t+=e.normal.z*this.max.z,i+=e.normal.z*this.min.z),t<=e.constant&&i>=e.constant},clampPoint:function(e,t){return(t||new yt).copy(e).clamp(this.min,this.max)},distanceToPoint:function(){var e=new yt;return function(t){return e.copy(t).clamp(this.min,this.max).sub(t).length()}}(),getBoundingSphere:function(){var e=new yt;return function(t){var i=t||new Ii;return this.getCenter(i.center),i.radius=.5*this.getSize(e).length(),i}}(),intersect:function(e){return this.min.max(e.min),this.max.min(e.max),this.isEmpty()&&this.makeEmpty(),this},union:function(e){return this.min.min(e.min),this.max.max(e.max),this},applyMatrix4:(_i=[new yt,new yt,new yt,new yt,new yt,new yt,new yt,new yt],function(e){return this.isEmpty()?this:(_i[0].set(this.min.x,this.min.y,this.min.z).applyMatrix4(e),_i[1].set(this.min.x,this.min.y,this.max.z).applyMatrix4(e),_i[2].set(this.min.x,this.max.y,this.min.z).applyMatrix4(e),_i[3].set(this.min.x,this.max.y,this.max.z).applyMatrix4(e),_i[4].set(this.max.x,this.min.y,this.min.z).applyMatrix4(e),_i[5].set(this.max.x,this.min.y,this.max.z).applyMatrix4(e),_i[6].set(this.max.x,this.max.y,this.min.z).applyMatrix4(e),_i[7].set(this.max.x,this.max.y,this.max.z).applyMatrix4(e),this.setFromPoints(_i),this)}),translate:function(e){return this.min.add(e),this.max.add(e),this},equals:function(e){return e.min.equals(this.min)&&e.max.equals(this.max)}}),Object.assign(Ii.prototype,{set:function(e,t){return this.center.copy(e),this.radius=t,this},setFromPoints:(Ei=new Oi,function(e,t){var i=this.center;void 0!==t?i.copy(t):Ei.setFromPoints(e).getCenter(i);for(var r=0,n=0,o=e.length;nthis.radius*this.radius&&(r.sub(this.center).normalize(),r.multiplyScalar(this.radius).add(this.center)),r},getBoundingBox:function(e){var t=e||new Oi;return t.set(this.center,this.center),t.expandByScalar(this.radius),t},applyMatrix4:function(e){return this.center.applyMatrix4(e),this.radius=this.radius*e.getMaxScaleOnAxis(),this},translate:function(e){return this.center.add(e),this},equals:function(e){return e.center.equals(this.center)&&e.radius===this.radius}}),Object.assign(Di.prototype,{set:function(e,t){return this.normal.copy(e),this.constant=t,this},setComponents:function(e,t,i,r){return this.normal.set(e,t,i),this.constant=r,this},setFromNormalAndCoplanarPoint:function(e,t){return this.normal.copy(e),this.constant=-t.dot(this.normal),this},setFromCoplanarPoints:function(){var e=new yt,t=new yt;return function(i,r,n){var o=e.subVectors(n,r).cross(t.subVectors(i,r)).normalize();return this.setFromNormalAndCoplanarPoint(o,i),this}}(),clone:function(){return(new this.constructor).copy(this)},copy:function(e){return this.normal.copy(e.normal),this.constant=e.constant,this},normalize:function(){var e=1/this.normal.length();return this.normal.multiplyScalar(e),this.constant*=e,this},negate:function(){return this.constant*=-1,this.normal.negate(),this},distanceToPoint:function(e){return this.normal.dot(e)+this.constant},distanceToSphere:function(e){return this.distanceToPoint(e.center)-e.radius},projectPoint:function(e,t){return(t||new yt).copy(this.normal).multiplyScalar(-this.distanceToPoint(e)).add(e)},intersectLine:function(){var e=new yt;return function(t,i){var r=i||new yt,n=t.delta(e),o=this.normal.dot(n);if(0===o)return 0===this.distanceToPoint(t.start)?r.copy(t.start):void 0;var a=-(t.start.dot(this.normal)+this.constant)/o;return a<0||a>1?void 0:r.copy(n).multiplyScalar(a).add(t.start)}}(),intersectsLine:function(e){var t=this.distanceToPoint(e.start),i=this.distanceToPoint(e.end);return t<0&&i>0||i<0&&t>0},intersectsBox:function(e){return e.intersectsPlane(this)},intersectsSphere:function(e){return e.intersectsPlane(this)},coplanarPoint:function(e){return(e||new yt).copy(this.normal).multiplyScalar(-this.constant)},applyMatrix4:function(){var e=new yt,t=new xt;return function(i,r){var n=r||t.getNormalMatrix(i),o=this.coplanarPoint(e).applyMatrix4(i),a=this.normal.applyMatrix3(n).normalize();return this.constant=-o.dot(a),this}}(),translate:function(e){return this.constant-=e.dot(this.normal),this},equals:function(e){return e.normal.equals(this.normal)&&e.constant===this.constant}}),Object.assign(Ui.prototype,{set:function(e,t,i,r,n,o){var a=this.planes;return a[0].copy(e),a[1].copy(t),a[2].copy(i),a[3].copy(r),a[4].copy(n),a[5].copy(o),this},clone:function(){return(new this.constructor).copy(this)},copy:function(e){for(var t=this.planes,i=0;i<6;i++)t[i].copy(e.planes[i]);return this},setFromMatrix:function(e){var t=this.planes,i=e.elements,r=i[0],n=i[1],o=i[2],a=i[3],s=i[4],c=i[5],h=i[6],l=i[7],u=i[8],p=i[9],d=i[10],f=i[11],m=i[12],v=i[13],g=i[14],y=i[15];return t[0].setComponents(a-r,l-s,f-u,y-m).normalize(),t[1].setComponents(a+r,l+s,f+u,y+m).normalize(),t[2].setComponents(a+n,l+c,f+p,y+v).normalize(),t[3].setComponents(a-n,l-c,f-p,y-v).normalize(),t[4].setComponents(a-o,l-h,f-d,y-g).normalize(),t[5].setComponents(a+o,l+h,f+d,y+g).normalize(),this},intersectsObject:(Ai=new Ii,function(e){var t=e.geometry;return null===t.boundingSphere&&t.computeBoundingSphere(),Ai.copy(t.boundingSphere).applyMatrix4(e.matrixWorld),this.intersectsSphere(Ai)}),intersectsSprite:function(){var e=new Ii;return function(t){return e.center.set(0,0,0),e.radius=.7071067811865476,e.applyMatrix4(t.matrixWorld),this.intersectsSphere(e)}}(),intersectsSphere:function(e){for(var t=this.planes,i=e.center,r=-e.radius,n=0;n<6;n++){if(t[n].distanceToPoint(i)0?e.min.x:e.max.x,Si.x=r.normal.x>0?e.max.x:e.min.x,Ti.y=r.normal.y>0?e.min.y:e.max.y,Si.y=r.normal.y>0?e.max.y:e.min.y,Ti.z=r.normal.z>0?e.min.z:e.max.z,Si.z=r.normal.z>0?e.max.z:e.min.z;var n=r.distanceToPoint(Ti),o=r.distanceToPoint(Si);if(n<0&&o<0)return!1}return!0}),containsPoint:function(e){for(var t=this.planes,i=0;i<6;i++)if(t[i].distanceToPoint(e)<0)return!1;return!0}}),zi.RotationOrders=["XYZ","YZX","ZXY","XZY","YXZ","ZYX"],zi.DefaultOrder="XYZ",Object.defineProperties(zi.prototype,{x:{get:function(){return this._x},set:function(e){this._x=e,this.onChangeCallback()}},y:{get:function(){return this._y},set:function(e){this._y=e,this.onChangeCallback()}},z:{get:function(){return this._z},set:function(e){this._z=e,this.onChangeCallback()}},order:{get:function(){return this._order},set:function(e){this._order=e,this.onChangeCallback()}}}),Object.assign(zi.prototype,{isEuler:!0,set:function(e,t,i,r){return this._x=e,this._y=t,this._z=i,this._order=r||this._order,this.onChangeCallback(),this},clone:function(){return new this.constructor(this._x,this._y,this._z,this._order)},copy:function(e){return this._x=e._x,this._y=e._y,this._z=e._z,this._order=e._order,this.onChangeCallback(),this},setFromRotationMatrix:function(e,t,i){var r=ft.clamp,n=e.elements,o=n[0],a=n[4],s=n[8],c=n[1],h=n[5],l=n[9],u=n[2],p=n[6],d=n[10];return"XYZ"===(t=t||this._order)?(this._y=Math.asin(r(s,-1,1)),Math.abs(s)<.99999?(this._x=Math.atan2(-l,d),this._z=Math.atan2(-a,o)):(this._x=Math.atan2(p,h),this._z=0)):"YXZ"===t?(this._x=Math.asin(-r(l,-1,1)),Math.abs(l)<.99999?(this._y=Math.atan2(s,d),this._z=Math.atan2(c,h)):(this._y=Math.atan2(-u,o),this._z=0)):"ZXY"===t?(this._x=Math.asin(r(p,-1,1)),Math.abs(p)<.99999?(this._y=Math.atan2(-u,d),this._z=Math.atan2(-a,h)):(this._y=0,this._z=Math.atan2(c,o))):"ZYX"===t?(this._y=Math.asin(-r(u,-1,1)),Math.abs(u)<.99999?(this._x=Math.atan2(p,d),this._z=Math.atan2(c,o)):(this._x=0,this._z=Math.atan2(-a,h))):"YZX"===t?(this._z=Math.asin(r(c,-1,1)),Math.abs(c)<.99999?(this._x=Math.atan2(-l,h),this._y=Math.atan2(-u,o)):(this._x=0,this._y=Math.atan2(s,d))):"XZY"===t?(this._z=Math.asin(-r(a,-1,1)),Math.abs(a)<.99999?(this._x=Math.atan2(p,h),this._y=Math.atan2(s,o)):(this._x=Math.atan2(-l,d),this._y=0)):console.warn("THREE.Euler: .setFromRotationMatrix() given unsupported order: "+t),this._order=t,!1!==i&&this.onChangeCallback(),this},setFromQuaternion:function(){var e=new vt;return function(t,i,r){return e.makeRotationFromQuaternion(t),this.setFromRotationMatrix(e,i,r)}}(),setFromVector3:function(e,t){return this.set(e.x,e.y,e.z,t||this._order)},reorder:(Ri=new gt,function(e){return Ri.setFromEuler(this),this.setFromQuaternion(Ri,e)}),equals:function(e){return e._x===this._x&&e._y===this._y&&e._z===this._z&&e._order===this._order},fromArray:function(e){return this._x=e[0],this._y=e[1],this._z=e[2],void 0!==e[3]&&(this._order=e[3]),this.onChangeCallback(),this},toArray:function(e,t){return void 0===e&&(e=[]),void 0===t&&(t=0),e[t]=this._x,e[t+1]=this._y,e[t+2]=this._z,e[t+3]=this._order,e},toVector3:function(e){return e?e.set(this._x,this._y,this._z):new yt(this._x,this._y,this._z)},onChange:function(e){return this.onChangeCallback=e,this},onChangeCallback:function(){}}),Object.assign(ki.prototype,{set:function(e){this.mask=1<1){for(var t=0;t1){for(var t=0;t0){r.children=[];for(s=0;s0&&(i.geometries=u),p.length>0&&(i.materials=p),d.length>0&&(i.textures=d),f.length>0&&(i.images=f),a.length>0&&(i.shapes=a)}return i.object=r,i;function m(e){var t=[];for(var i in e){var r=e[i];delete r.metadata,t.push(r)}return t}},clone:function(e){return(new this.constructor).copy(this,e)},copy:function(e,t){if(void 0===t&&(t=!0),this.name=e.name,this.up.copy(e.up),this.position.copy(e.position),this.quaternion.copy(e.quaternion),this.scale.copy(e.scale),this.matrix.copy(e.matrix),this.matrixWorld.copy(e.matrixWorld),this.matrixAutoUpdate=e.matrixAutoUpdate,this.matrixWorldNeedsUpdate=e.matrixWorldNeedsUpdate,this.layers.mask=e.layers.mask,this.visible=e.visible,this.castShadow=e.castShadow,this.receiveShadow=e.receiveShadow,this.frustumCulled=e.frustumCulled,this.renderOrder=e.renderOrder,this.userData=JSON.parse(JSON.stringify(e.userData)),!0===t)for(var i=0;it&&(t=e[i]);return t}Ki.prototype=Object.assign(Object.create(i.prototype),{constructor:Ki,isGeometry:!0,applyMatrix:function(e){for(var t=(new xt).getNormalMatrix(e),i=0,r=this.vertices.length;i0)for(p=0;p0&&(this.normalsNeedUpdate=!0)},computeFlatVertexNormals:function(){var e,t,i;for(this.computeFaceNormals(),e=0,t=this.faces.length;e0&&(this.normalsNeedUpdate=!0)},computeMorphNormals:function(){var e,t,i,r,n;for(i=0,r=this.faces.length;i0&&(e+=t[i].distanceTo(t[i-1])),this.lineDistances[i]=e},computeBoundingBox:function(){null===this.boundingBox&&(this.boundingBox=new Oi),this.boundingBox.setFromPoints(this.vertices)},computeBoundingSphere:function(){null===this.boundingSphere&&(this.boundingSphere=new Ii),this.boundingSphere.setFromPoints(this.vertices)},merge:function(e,t,i){if(e&&e.isGeometry){var r,n=this.vertices.length,o=this.vertices,a=e.vertices,s=this.faces,c=e.faces,h=this.faceVertexUvs[0],l=e.faceVertexUvs[0],u=this.colors,p=e.colors;void 0===i&&(i=0),void 0!==t&&(r=(new xt).getNormalMatrix(t));for(var d=0,f=a.length;d=0;i--){var f=p[i];for(this.faces.splice(f,1),a=0,s=this.faceVertexUvs.length;a0,v=d.vertexNormals.length>0,g=1!==d.color.r||1!==d.color.g||1!==d.color.b,y=d.vertexColors.length>0,x=0;if(x=M(x=M(x=M(x=M(x=M(x=M(x=M(x=M(x,0,0),1,!0),2,!1),3,f),4,m),5,v),6,g),7,y),a.push(x),a.push(d.a,d.b,d.c),a.push(d.materialIndex),f){var b=this.faceVertexUvs[0][n];a.push(S(b[0]),S(b[1]),S(b[2]))}if(m&&a.push(E(d.normal)),v){var w=d.vertexNormals;a.push(E(w[0]),E(w[1]),E(w[2]))}if(g&&a.push(T(d.color)),y){var _=d.vertexColors;a.push(T(_[0]),T(_[1]),T(_[2]))}}function M(e,t,i){return i?e|1<0&&(e.data.colors=h),u.length>0&&(e.data.uvs=[u]),e.data.faces=a,e},clone:function(){return(new Ki).copy(this)},copy:function(e){var t,i,r,n,o,a;this.vertices=[],this.colors=[],this.faces=[],this.faceVertexUvs=[[]],this.morphTargets=[],this.morphNormals=[],this.skinWeights=[],this.skinIndices=[],this.lineDistances=[],this.boundingBox=null,this.boundingSphere=null,this.name=e.name;var s=e.vertices;for(t=0,i=s.length;t0,a=n[1]&&n[1].length>0,s=e.morphTargets,c=s.length;if(c>0){t=[];for(var h=0;h0){l=[];for(h=0;h0?1:-1,h.push(L.x,L.y,L.z),l.push(y/m),l.push(1-x/v),A+=1}}for(x=0;x1&&i.sort(Cr),r.length>1&&r.sort(Pr)}}},e[r]=n),n},dispose:function(){e={}}}}function Or(e,t){return Math.abs(t[1])-Math.abs(e[1])}function Ir(){var e=new function(){var e={};return{get:function(t){if(void 0!==e[t.id])return e[t.id];var i;switch(t.type){case"DirectionalLight":i={direction:new yt,color:new di,shadow:!1,shadowBias:0,shadowRadius:1,shadowMapSize:new mt};break;case"SpotLight":i={position:new yt,direction:new yt,color:new di,distance:0,coneCos:0,penumbraCos:0,decay:0,shadow:!1,shadowBias:0,shadowRadius:1,shadowMapSize:new mt};break;case"PointLight":i={position:new yt,color:new di,distance:0,decay:0,shadow:!1,shadowBias:0,shadowRadius:1,shadowMapSize:new mt,shadowCameraNear:1,shadowCameraFar:1e3};break;case"HemisphereLight":i={direction:new yt,skyColor:new di,groundColor:new di};break;case"RectAreaLight":i={color:new di,position:new yt,halfWidth:new yt,halfHeight:new yt}}return e[t.id]=i,i}}},t={hash:"",ambient:[0,0,0],directional:[],directionalShadowMap:[],directionalShadowMatrix:[],spot:[],spotShadowMap:[],spotShadowMatrix:[],rectArea:[],point:[],pointShadowMap:[],pointShadowMatrix:[],hemi:[]},i=new yt,r=new vt,n=new vt;return{setup:function(o,a,s){for(var c=0,h=0,l=0,u=0,p=0,d=0,f=0,m=0,v=s.matrixWorldInverse,g=0,y=o.length;g65535?ar:nr)(e,1):this.index=e},addAttribute:function(e,t){return t&&t.isBufferAttribute||t&&t.isInterleavedBufferAttribute?"index"===e?(console.warn("THREE.BufferGeometry.addAttribute: Use .setIndex() for index attribute."),void this.setIndex(t)):(this.attributes[e]=t,this):(console.warn("THREE.BufferGeometry: .addAttribute() now expects ( name, attribute )."),void this.addAttribute(e,new $i(arguments[1],arguments[2])))},getAttribute:function(e){return this.attributes[e]},removeAttribute:function(e){return delete this.attributes[e],this},addGroup:function(e,t,i){this.groups.push({start:e,count:t,materialIndex:void 0!==i?i:0})},clearGroups:function(){this.groups=[]},setDrawRange:function(e,t){this.drawRange.start=e,this.drawRange.count=t},applyMatrix:function(e){var t=this.attributes.position;void 0!==t&&(e.applyToBufferAttribute(t),t.needsUpdate=!0);var i=this.attributes.normal;void 0!==i&&((new xt).getNormalMatrix(e).applyToBufferAttribute(i),i.needsUpdate=!0);return null!==this.boundingBox&&this.computeBoundingBox(),null!==this.boundingSphere&&this.computeBoundingSphere(),this},rotateX:function(){var e=new vt;return function(t){return e.makeRotationX(t),this.applyMatrix(e),this}}(),rotateY:function(){var e=new vt;return function(t){return e.makeRotationY(t),this.applyMatrix(e),this}}(),rotateZ:function(){var e=new vt;return function(t){return e.makeRotationZ(t),this.applyMatrix(e),this}}(),translate:function(){var e=new vt;return function(t,i,r){return e.makeTranslation(t,i,r),this.applyMatrix(e),this}}(),scale:function(){var e=new vt;return function(t,i,r){return e.makeScale(t,i,r),this.applyMatrix(e),this}}(),lookAt:function(){var e=new Xi;return function(t){e.lookAt(t),e.updateMatrix(),this.applyMatrix(e.matrix)}}(),center:function(){this.computeBoundingBox();var e=this.boundingBox.getCenter().negate();return this.translate(e.x,e.y,e.z),e},setFromObject:function(e){var t=e.geometry;if(e.isPoints||e.isLine){var i=new sr(3*t.vertices.length,3),r=new sr(3*t.colors.length,3);if(this.addAttribute("position",i.copyVector3sArray(t.vertices)),this.addAttribute("color",r.copyColorsArray(t.colors)),t.lineDistances&&t.lineDistances.length===t.vertices.length){var n=new sr(t.lineDistances.length,1);this.addAttribute("lineDistance",n.copyArray(t.lineDistances))}null!==t.boundingSphere&&(this.boundingSphere=t.boundingSphere.clone()),null!==t.boundingBox&&(this.boundingBox=t.boundingBox.clone())}else e.isMesh&&t&&t.isGeometry&&this.fromGeometry(t);return this},setFromPoints:function(e){for(var t=[],i=0,r=e.length;i0){var i=new Float32Array(3*e.normals.length);this.addAttribute("normal",new $i(i,3).copyVector3sArray(e.normals))}if(e.colors.length>0){var r=new Float32Array(3*e.colors.length);this.addAttribute("color",new $i(r,3).copyColorsArray(e.colors))}if(e.uvs.length>0){var n=new Float32Array(2*e.uvs.length);this.addAttribute("uv",new $i(n,2).copyVector2sArray(e.uvs))}if(e.uvs2.length>0){var o=new Float32Array(2*e.uvs2.length);this.addAttribute("uv2",new $i(o,2).copyVector2sArray(e.uvs2))}if(e.indices.length>0){var a=new(lr(e.indices)>65535?Uint32Array:Uint16Array)(3*e.indices.length);this.setIndex(new $i(a,1).copyIndicesArray(e.indices))}for(var s in this.groups=e.groups,e.morphTargets){for(var c=[],h=e.morphTargets[s],l=0,u=h.length;l0){var f=new sr(4*e.skinIndices.length,4);this.addAttribute("skinIndex",f.copyVector4sArray(e.skinIndices))}if(e.skinWeights.length>0){var m=new sr(4*e.skinWeights.length,4);this.addAttribute("skinWeight",m.copyVector4sArray(e.skinWeights))}return null!==e.boundingSphere&&(this.boundingSphere=e.boundingSphere.clone()),null!==e.boundingBox&&(this.boundingBox=e.boundingBox.clone()),this},computeBoundingBox:function(){null===this.boundingBox&&(this.boundingBox=new Oi);var e=this.attributes.position;void 0!==e?this.boundingBox.setFromBufferAttribute(e):this.boundingBox.makeEmpty(),(isNaN(this.boundingBox.min.x)||isNaN(this.boundingBox.min.y)||isNaN(this.boundingBox.min.z))&&console.error('THREE.BufferGeometry.computeBoundingBox: Computed min/max have NaN values. The "position" attribute is likely to have NaN values.',this)},computeBoundingSphere:function(){var e=new Oi,t=new yt;return function(){null===this.boundingSphere&&(this.boundingSphere=new Ii);var i=this.attributes.position;if(i){var r=this.boundingSphere.center;e.setFromBufferAttribute(i),e.getCenter(r);for(var n=0,o=0,a=i.count;o0&&(e.data.groups=JSON.parse(JSON.stringify(s)));var c=this.boundingSphere;return null!==c&&(e.data.boundingSphere={center:c.center.toArray(),radius:c.radius}),e},clone:function(){return(new xr).copy(this)},copy:function(e){var t,i,r;this.index=null,this.attributes={},this.morphAttributes={},this.groups=[],this.boundingBox=null,this.boundingSphere=null,this.name=e.name;var n=e.index;null!==n&&this.setIndex(n.clone());var o=e.attributes;for(t in o){var a=o[t];this.addAttribute(t,a.clone())}var s=e.morphAttributes;for(t in s){var c=[],h=s[t];for(i=0,r=h.length;i0)if(o=h*l-u,s=c*d,(n=h*u-l)>=0)if(o>=-s)if(o<=s){var f=1/d;a=(n*=f)*(n+h*(o*=f)+2*l)+o*(h*n+o+2*u)+p}else o=c,a=-(n=Math.max(0,-(h*o+l)))*n+o*(o+2*u)+p;else o=-c,a=-(n=Math.max(0,-(h*o+l)))*n+o*(o+2*u)+p;else o<=-s?a=-(n=Math.max(0,-(-h*c+l)))*n+(o=n>0?-c:Math.min(Math.max(-c,-u),c))*(o+2*u)+p:o<=s?(n=0,a=(o=Math.min(Math.max(-c,-u),c))*(o+2*u)+p):a=-(n=Math.max(0,-(h*c+l)))*n+(o=n>0?c:Math.min(Math.max(-c,-u),c))*(o+2*u)+p;else o=h>0?-c:c,a=-(n=Math.max(0,-(h*o+l)))*n+o*(o+2*u)+p;return i&&i.copy(this.direction).multiplyScalar(n).add(this.origin),r&&r.copy(dr).multiplyScalar(o).add(pr),a}),intersectSphere:function(){var e=new yt;return function(t,i){e.subVectors(t.center,this.origin);var r=e.dot(this.direction),n=e.dot(e)-r*r,o=t.radius*t.radius;if(n>o)return null;var a=Math.sqrt(o-n),s=r-a,c=r+a;return s<0&&c<0?null:s<0?this.at(c,i):this.at(s,i)}}(),intersectsSphere:function(e){return this.distanceToPoint(e.center)<=e.radius},distanceToPlane:function(e){var t=e.normal.dot(this.direction);if(0===t)return 0===e.distanceToPoint(this.origin)?0:null;var i=-(this.origin.dot(e.normal)+e.constant)/t;return i>=0?i:null},intersectPlane:function(e,t){var i=this.distanceToPlane(e);return null===i?null:this.at(i,t)},intersectsPlane:function(e){var t=e.distanceToPoint(this.origin);return 0===t||e.normal.dot(this.direction)*t<0},intersectBox:function(e,t){var i,r,n,o,a,s,c=1/this.direction.x,h=1/this.direction.y,l=1/this.direction.z,u=this.origin;return c>=0?(i=(e.min.x-u.x)*c,r=(e.max.x-u.x)*c):(i=(e.max.x-u.x)*c,r=(e.min.x-u.x)*c),h>=0?(n=(e.min.y-u.y)*h,o=(e.max.y-u.y)*h):(n=(e.max.y-u.y)*h,o=(e.min.y-u.y)*h),i>o||n>r?null:((n>i||i!=i)&&(i=n),(o=0?(a=(e.min.z-u.z)*l,s=(e.max.z-u.z)*l):(a=(e.max.z-u.z)*l,s=(e.min.z-u.z)*l),i>s||a>r?null:((a>i||i!=i)&&(i=a),(s=0?i:r,t)))},intersectsBox:(ur=new yt,function(e){return null!==this.intersectBox(e,ur)}),intersectTriangle:function(){var e=new yt,t=new yt,i=new yt,r=new yt;return function(n,o,a,s,c){t.subVectors(o,n),i.subVectors(a,n),r.crossVectors(t,i);var h,l=this.direction.dot(r);if(l>0){if(s)return null;h=1}else{if(!(l<0))return null;h=-1,l=-l}e.subVectors(this.origin,n);var u=h*this.direction.dot(i.crossVectors(e,i));if(u<0)return null;var p=h*this.direction.dot(t.cross(e));if(p<0)return null;if(u+p>l)return null;var d=-h*e.dot(r);return d<0?null:this.at(d/l,c)}}(),applyMatrix4:function(e){return this.origin.applyMatrix4(e),this.direction.transformDirection(e),this},equals:function(e){return e.origin.equals(this.origin)&&e.direction.equals(this.direction)}}),Object.assign(Ar.prototype,{set:function(e,t){return this.start.copy(e),this.end.copy(t),this},clone:function(){return(new this.constructor).copy(this)},copy:function(e){return this.start.copy(e.start),this.end.copy(e.end),this},getCenter:function(e){return(e||new yt).addVectors(this.start,this.end).multiplyScalar(.5)},delta:function(e){return(e||new yt).subVectors(this.end,this.start)},distanceSq:function(){return this.start.distanceToSquared(this.end)},distance:function(){return this.start.distanceTo(this.end)},at:function(e,t){var i=t||new yt;return this.delta(i).multiplyScalar(e).add(this.start)},closestPointToPointParameter:(mr=new yt,vr=new yt,function(e,t){mr.subVectors(e,this.start),vr.subVectors(this.end,this.start);var i=vr.dot(vr),r=vr.dot(mr)/i;return t&&(r=ft.clamp(r,0,1)),r}),closestPointToPoint:function(e,t,i){var r=this.closestPointToPointParameter(e,t),n=i||new yt;return this.delta(n).multiplyScalar(r).add(this.start)},applyMatrix4:function(e){return this.start.applyMatrix4(e),this.end.applyMatrix4(e),this},equals:function(e){return e.start.equals(this.start)&&e.end.equals(this.end)}}),Object.assign(Rr,{normal:(gr=new yt,function(e,t,i,r){var n=r||new yt;n.subVectors(i,t),gr.subVectors(e,t),n.cross(gr);var o=n.lengthSq();return o>0?n.multiplyScalar(1/Math.sqrt(o)):n.set(0,0,0)}),barycoordFromPoint:function(){var e=new yt,t=new yt,i=new yt;return function(r,n,o,a,s){e.subVectors(a,n),t.subVectors(o,n),i.subVectors(r,n);var c=e.dot(e),h=e.dot(t),l=e.dot(i),u=t.dot(t),p=t.dot(i),d=c*u-h*h,f=s||new yt;if(0===d)return f.set(-2,-1,-1);var m=1/d,v=(u*l-h*p)*m,g=(c*p-h*l)*m;return f.set(1-v-g,g,v)}}(),containsPoint:function(){var e=new yt;return function(t,i,r,n){var o=Rr.barycoordFromPoint(t,i,r,n,e);return o.x>=0&&o.y>=0&&o.x+o.y<=1}}()}),Object.assign(Rr.prototype,{set:function(e,t,i){return this.a.copy(e),this.b.copy(t),this.c.copy(i),this},setFromPointsAndIndices:function(e,t,i,r){return this.a.copy(e[t]),this.b.copy(e[i]),this.c.copy(e[r]),this},clone:function(){return(new this.constructor).copy(this)},copy:function(e){return this.a.copy(e.a),this.b.copy(e.b),this.c.copy(e.c),this},area:function(){var e=new yt,t=new yt;return function(){return e.subVectors(this.c,this.b),t.subVectors(this.a,this.b),.5*e.cross(t).length()}}(),midpoint:function(e){return(e||new yt).addVectors(this.a,this.b).add(this.c).multiplyScalar(1/3)},normal:function(e){return Rr.normal(this.a,this.b,this.c,e)},plane:function(e){return(e||new Di).setFromCoplanarPoints(this.a,this.b,this.c)},barycoordFromPoint:function(e,t){return Rr.barycoordFromPoint(e,this.a,this.b,this.c,t)},containsPoint:function(e){return Rr.containsPoint(e,this.a,this.b,this.c)},closestPointToPoint:function(){var e=new Di,t=[new Ar,new Ar,new Ar],i=new yt,r=new yt;return function(n,o){var a=o||new yt,s=1/0;if(e.setFromCoplanarPoints(this.a,this.b,this.c),e.projectPoint(n,i),!0===this.containsPoint(i))a.copy(i);else{t[0].set(this.a,this.b),t[1].set(this.b,this.c),t[2].set(this.c,this.a);for(var c=0;c0){var a=n[o[0]];if(void 0!==a)for(this.morphTargetInfluences=[],this.morphTargetDictionary={},e=0,t=a.length;e0)for(this.morphTargetInfluences=[],this.morphTargetDictionary={},e=0,t=s.length;ei.far?null:{distance:c,point:f.clone(),object:e}}function g(e,t,i,a,s,c,p,f){r.fromBufferAttribute(a,c),n.fromBufferAttribute(a,p),o.fromBufferAttribute(a,f);var g=v(e,e.material,t,i,r,n,o,d);return g&&(s&&(h.fromBufferAttribute(s,c),l.fromBufferAttribute(s,p),u.fromBufferAttribute(s,f),g.uv=m(d,r,n,o,h,l,u)),g.face=new Zi(c,p,f,Rr.normal(r,n,o)),g.faceIndex=c),g}return function(p,f){var y,x=this.geometry,b=this.material,w=this.matrixWorld;if(void 0!==b&&(null===x.boundingSphere&&x.computeBoundingSphere(),i.copy(x.boundingSphere),i.applyMatrix4(w),!1!==p.ray.intersectsSphere(i)&&(e.getInverse(w),t.copy(p.ray).applyMatrix4(e),null===x.boundingBox||!1!==t.intersectsBox(x.boundingBox))))if(x.isBufferGeometry){var _,M,E,T,S,A=x.index,R=x.attributes.position,L=x.attributes.uv;if(null!==A)for(T=0,S=A.count;T0&&(O=F);for(var B=0,z=U.length;B/gm,function(e,t){var i=vi[t];if(void 0===i)throw new Error("Can not resolve #include <"+t+">");return qr(i)})}function Yr(e){return e.replace(/for \( int i \= (\d+)\; i < (\d+)\; i \+\+ \) \{([\s\S]+?)(?=\})\}/g,function(e,t,i,r){for(var n="",o=parseInt(t);o0?e.gammaFactor:1,_=function(e,t,i){return[(e=e||{}).derivatives||t.envMapCubeUV||t.bumpMap||t.normalMap||t.flatShading?"#extension GL_OES_standard_derivatives : enable":"",(e.fragDepth||t.logarithmicDepthBuffer)&&i.get("EXT_frag_depth")?"#extension GL_EXT_frag_depth : enable":"",e.drawBuffers&&i.get("WEBGL_draw_buffers")?"#extension GL_EXT_draw_buffers : require":"",(e.shaderTextureLOD||t.envMap)&&i.get("EXT_shader_texture_lod")?"#extension GL_EXT_shader_texture_lod : enable":""].filter(Wr).join("\n")}(r.extensions,o,t),M=function(e){var t=[];for(var i in e){var r=e[i];!1!==r&&t.push("#define "+i+" "+r)}return t.join("\n")}(s),E=a.createProgram();r.isRawShaderMaterial?((f=[M].filter(Wr).join("\n")).length>0&&(f+="\n"),(m=[_,M].filter(Wr).join("\n")).length>0&&(m+="\n")):(f=["precision "+o.precision+" float;","precision "+o.precision+" int;","#define SHADER_NAME "+n.name,M,o.supportsVertexTextures?"#define VERTEX_TEXTURES":"","#define GAMMA_FACTOR "+w,"#define MAX_BONES "+o.maxBones,o.useFog&&o.fog?"#define USE_FOG":"",o.useFog&&o.fogExp?"#define FOG_EXP2":"",o.map?"#define USE_MAP":"",o.envMap?"#define USE_ENVMAP":"",o.envMap?"#define "+p:"",o.lightMap?"#define USE_LIGHTMAP":"",o.aoMap?"#define USE_AOMAP":"",o.emissiveMap?"#define USE_EMISSIVEMAP":"",o.bumpMap?"#define USE_BUMPMAP":"",o.normalMap?"#define USE_NORMALMAP":"",o.displacementMap&&o.supportsVertexTextures?"#define USE_DISPLACEMENTMAP":"",o.specularMap?"#define USE_SPECULARMAP":"",o.roughnessMap?"#define USE_ROUGHNESSMAP":"",o.metalnessMap?"#define USE_METALNESSMAP":"",o.alphaMap?"#define USE_ALPHAMAP":"",o.vertexColors?"#define USE_COLOR":"",o.flatShading?"#define FLAT_SHADED":"",o.skinning?"#define USE_SKINNING":"",o.useVertexTexture?"#define BONE_TEXTURE":"",o.morphTargets?"#define USE_MORPHTARGETS":"",o.morphNormals&&!1===o.flatShading?"#define USE_MORPHNORMALS":"",o.doubleSided?"#define DOUBLE_SIDED":"",o.flipSided?"#define FLIP_SIDED":"","#define NUM_CLIPPING_PLANES "+o.numClippingPlanes,o.shadowMapEnabled?"#define USE_SHADOWMAP":"",o.shadowMapEnabled?"#define "+l:"",o.sizeAttenuation?"#define USE_SIZEATTENUATION":"",o.logarithmicDepthBuffer?"#define USE_LOGDEPTHBUF":"",o.logarithmicDepthBuffer&&t.get("EXT_frag_depth")?"#define USE_LOGDEPTHBUF_EXT":"","uniform mat4 modelMatrix;","uniform mat4 modelViewMatrix;","uniform mat4 projectionMatrix;","uniform mat4 viewMatrix;","uniform mat3 normalMatrix;","uniform vec3 cameraPosition;","attribute vec3 position;","attribute vec3 normal;","attribute vec2 uv;","#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(Wr).join("\n"),m=[_,"precision "+o.precision+" float;","precision "+o.precision+" int;","#define SHADER_NAME "+n.name,M,o.alphaTest?"#define ALPHATEST "+o.alphaTest:"","#define GAMMA_FACTOR "+w,o.useFog&&o.fog?"#define USE_FOG":"",o.useFog&&o.fogExp?"#define FOG_EXP2":"",o.map?"#define USE_MAP":"",o.envMap?"#define USE_ENVMAP":"",o.envMap?"#define "+u:"",o.envMap?"#define "+p:"",o.envMap?"#define "+d:"",o.lightMap?"#define USE_LIGHTMAP":"",o.aoMap?"#define USE_AOMAP":"",o.emissiveMap?"#define USE_EMISSIVEMAP":"",o.bumpMap?"#define USE_BUMPMAP":"",o.normalMap?"#define USE_NORMALMAP":"",o.specularMap?"#define USE_SPECULARMAP":"",o.roughnessMap?"#define USE_ROUGHNESSMAP":"",o.metalnessMap?"#define USE_METALNESSMAP":"",o.alphaMap?"#define USE_ALPHAMAP":"",o.vertexColors?"#define USE_COLOR":"",o.gradientMap?"#define USE_GRADIENTMAP":"",o.flatShading?"#define FLAT_SHADED":"",o.doubleSided?"#define DOUBLE_SIDED":"",o.flipSided?"#define FLIP_SIDED":"","#define NUM_CLIPPING_PLANES "+o.numClippingPlanes,"#define UNION_CLIPPING_PLANES "+(o.numClippingPlanes-o.numClipIntersection),o.shadowMapEnabled?"#define USE_SHADOWMAP":"",o.shadowMapEnabled?"#define "+l:"",o.premultipliedAlpha?"#define PREMULTIPLIED_ALPHA":"",o.physicallyCorrectLights?"#define PHYSICALLY_CORRECT_LIGHTS":"",o.logarithmicDepthBuffer?"#define USE_LOGDEPTHBUF":"",o.logarithmicDepthBuffer&&t.get("EXT_frag_depth")?"#define USE_LOGDEPTHBUF_EXT":"",o.envMap&&t.get("EXT_shader_texture_lod")?"#define TEXTURE_LOD_EXT":"","uniform mat4 viewMatrix;","uniform vec3 cameraPosition;",o.toneMapping!==ne?"#define TONE_MAPPING":"",o.toneMapping!==ne?vi.tonemapping_pars_fragment:"",o.toneMapping!==ne?function(e,t){var i;switch(t){case oe:i="Linear";break;case ae:i="Reinhard";break;case se:i="Uncharted2";break;case ce:i="OptimizedCineon";break;default:throw new Error("unsupported toneMapping: "+t)}return"vec3 "+e+"( vec3 color ) { return "+i+"ToneMapping( color ); }"}("toneMapping",o.toneMapping):"",o.dithering?"#define DITHERING":"",o.outputEncoding||o.mapEncoding||o.envMapEncoding||o.emissiveMapEncoding?vi.encodings_pars_fragment:"",o.mapEncoding?jr("mapTexelToLinear",o.mapEncoding):"",o.envMapEncoding?jr("envMapTexelToLinear",o.envMapEncoding):"",o.emissiveMapEncoding?jr("emissiveMapTexelToLinear",o.emissiveMapEncoding):"",o.outputEncoding?(v="linearToOutputTexel",x=o.outputEncoding,b=Hr(x),"vec4 "+v+"( vec4 value ) { return LinearTo"+b[0]+b[1]+"; }"):"",o.depthPacking?"#define DEPTH_PACKING "+r.depthPacking:"","\n"].filter(Wr).join("\n")),c=Xr(c=qr(c),o),h=Xr(h=qr(h),o),r.isShaderMaterial||(c=Yr(c),h=Yr(h));var T=f+c,S=m+h,A=Dr(a,a.VERTEX_SHADER,T),R=Dr(a,a.FRAGMENT_SHADER,S);a.attachShader(E,A),a.attachShader(E,R),void 0!==r.index0AttributeName?a.bindAttribLocation(E,0,r.index0AttributeName):!0===o.morphTargets&&a.bindAttribLocation(E,0,"position"),a.linkProgram(E);var L,C,P=a.getProgramInfoLog(E),N=a.getShaderInfoLog(A),O=a.getShaderInfoLog(R),I=!0,D=!0;return!1===a.getProgramParameter(E,a.LINK_STATUS)?(I=!1,console.error("THREE.WebGLProgram: shader error: ",a.getError(),"gl.VALIDATE_STATUS",a.getProgramParameter(E,a.VALIDATE_STATUS),"gl.getProgramInfoLog",P,N,O)):""!==P?console.warn("THREE.WebGLProgram: gl.getProgramInfoLog()",P):""!==N&&""!==O||(D=!1),D&&(this.diagnostics={runnable:I,material:r,programLog:P,vertexShader:{log:N,prefix:f},fragmentShader:{log:O,prefix:m}}),a.deleteShader(A),a.deleteShader(R),this.getUniforms=function(){return void 0===L&&(L=new ui(a,E,e)),L},this.getAttributes=function(){return void 0===C&&(C=function(e,t){for(var i={},r=e.getProgramParameter(t,e.ACTIVE_ATTRIBUTES),n=0;n0,maxBones:p,useVertexTexture:i.floatVertexTextures,morphTargets:t.morphTargets,morphNormals:t.morphNormals,maxMorphTargets:e.maxMorphTargets,maxMorphNormals:e.maxMorphNormals,numDirLights:r.directional.length,numPointLights:r.point.length,numSpotLights:r.spot.length,numRectAreaLights:r.rectArea.length,numHemiLights:r.hemi.length,numClippingPlanes:c,numClipIntersection:h,dithering:t.dithering,shadowMapEnabled:e.shadowMap.enabled&&l.receiveShadow&&o.length>0,shadowMapType:e.shadowMap.type,toneMapping:e.toneMapping,physicallyCorrectLights:e.physicallyCorrectLights,premultipliedAlpha:t.premultipliedAlpha,alphaTest:t.alphaTest,doubleSided:t.side===w,flipSided:t.side===b,depthPacking:void 0!==t.depthPacking&&t.depthPacking}},this.getProgramCode=function(t,i){var r=[];if(i.shaderID?r.push(i.shaderID):(r.push(t.fragmentShader),r.push(t.vertexShader)),void 0!==t.defines)for(var n in t.defines)r.push(n),r.push(t.defines[n]);for(var a=0;at||e.height>t){var i=t/Math.max(e.width,e.height),r=document.createElementNS("http://www.w3.org/1999/xhtml","canvas");return r.width=Math.floor(e.width*i),r.height=Math.floor(e.height*i),r.getContext("2d").drawImage(e,0,0,e.width,e.height,0,0,r.width,r.height),console.warn("THREE.WebGLRenderer: image is too big ("+e.width+"x"+e.height+"). Resized to "+r.width+"x"+r.height,e),r}return e}function l(e){return ft.isPowerOfTwo(e.width)&&ft.isPowerOfTwo(e.height)}function u(e,t){return e.generateMipmaps&&t&&e.minFilter!==xe&&e.minFilter!==_e}function p(t){return t===xe||t===be||t===we?e.NEAREST:e.LINEAR}function d(t){var i=t.target;i.removeEventListener("dispose",d),function(t){var i=r.get(t);if(t.image&&i.__image__webglTextureCube)e.deleteTexture(i.__image__webglTextureCube);else{if(void 0===i.__webglInit)return;e.deleteTexture(i.__webglTexture)}r.remove(t)}(i),i.isVideoTexture&&delete c[i.id],a.textures--}function f(t){var i=t.target;i.removeEventListener("dispose",f),function(t){var i=r.get(t),n=r.get(t.texture);if(!t)return;void 0!==n.__webglTexture&&e.deleteTexture(n.__webglTexture);t.depthTexture&&t.depthTexture.dispose();if(t.isWebGLRenderTargetCube)for(var o=0;o<6;o++)e.deleteFramebuffer(i.__webglFramebuffer[o]),i.__webglDepthbuffer&&e.deleteRenderbuffer(i.__webglDepthbuffer[o]);else e.deleteFramebuffer(i.__webglFramebuffer),i.__webglDepthbuffer&&e.deleteRenderbuffer(i.__webglDepthbuffer);r.remove(t.texture),r.remove(t)}(i),a.textures--}function m(t,p){var f=r.get(t);if(t.version>0&&f.__version!==t.version){var m=t.image;if(void 0===m)console.warn("THREE.WebGLRenderer: Texture marked for update but image is undefined",t);else{if(!1!==m.complete)return void function(t,r,p){void 0===t.__webglInit&&(t.__webglInit=!0,r.addEventListener("dispose",d),t.__webglTexture=e.createTexture(),r.isVideoTexture&&(c[r.id]=r),a.textures++);i.activeTexture(e.TEXTURE0+p),i.bindTexture(e.TEXTURE_2D,t.__webglTexture),e.pixelStorei(e.UNPACK_FLIP_Y_WEBGL,r.flipY),e.pixelStorei(e.UNPACK_PREMULTIPLY_ALPHA_WEBGL,r.premultiplyAlpha),e.pixelStorei(e.UNPACK_ALIGNMENT,r.unpackAlignment);var f=h(r.image,n.maxTextureSize);(function(e){return e.wrapS!==ge||e.wrapT!==ge||e.minFilter!==xe&&e.minFilter!==_e})(r)&&!1===l(f)&&(f=function(e){if(e instanceof HTMLImageElement||e instanceof HTMLCanvasElement||e instanceof ImageBitmap){var t=document.createElementNS("http://www.w3.org/1999/xhtml","canvas");return t.width=ft.floorPowerOfTwo(e.width),t.height=ft.floorPowerOfTwo(e.height),t.getContext("2d").drawImage(e,0,0,t.width,t.height),console.warn("THREE.WebGLRenderer: image is not power of two ("+e.width+"x"+e.height+"). Resized to "+t.width+"x"+t.height,e),t}return e}(f));var m=l(f),g=o.convert(r.format),y=o.convert(r.type);v(e.TEXTURE_2D,r,m);var x,b=r.mipmaps;if(r.isDepthTexture){var w=e.DEPTH_COMPONENT;if(r.type===Pe){if(!s)throw new Error("Float Depth Texture only supported in WebGL2.0");w=e.DEPTH_COMPONENT32F}else s&&(w=e.DEPTH_COMPONENT16);r.format===He&&w===e.DEPTH_COMPONENT&&r.type!==Re&&r.type!==Ce&&(console.warn("THREE.WebGLRenderer: Use UnsignedShortType or UnsignedIntType for DepthFormat DepthTexture."),r.type=Re,y=o.convert(r.type)),r.format===je&&(w=e.DEPTH_STENCIL,r.type!==Ue&&(console.warn("THREE.WebGLRenderer: Use UnsignedInt248Type for DepthStencilFormat DepthTexture."),r.type=Ue,y=o.convert(r.type))),i.texImage2D(e.TEXTURE_2D,0,w,f.width,f.height,0,g,y,null)}else if(r.isDataTexture)if(b.length>0&&m){for(var _=0,M=b.length;_-1?i.compressedTexImage2D(e.TEXTURE_2D,_,g,x.width,x.height,0,x.data):console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()"):i.texImage2D(e.TEXTURE_2D,_,g,x.width,x.height,0,g,y,x.data);else if(b.length>0&&m){for(var _=0,M=b.length;_1||r.get(a).__currentAnisotropy)&&(e.texParameterf(i,c.TEXTURE_MAX_ANISOTROPY_EXT,Math.min(a.anisotropy,n.getMaxAnisotropy())),r.get(a).__currentAnisotropy=a.anisotropy)}}function g(t,n,a,s){var c=o.convert(n.texture.format),h=o.convert(n.texture.type);i.texImage2D(s,0,c,n.width,n.height,0,c,h,null),e.bindFramebuffer(e.FRAMEBUFFER,t),e.framebufferTexture2D(e.FRAMEBUFFER,a,s,r.get(n.texture).__webglTexture,0),e.bindFramebuffer(e.FRAMEBUFFER,null)}function y(t,i){e.bindRenderbuffer(e.RENDERBUFFER,t),i.depthBuffer&&!i.stencilBuffer?(e.renderbufferStorage(e.RENDERBUFFER,e.DEPTH_COMPONENT16,i.width,i.height),e.framebufferRenderbuffer(e.FRAMEBUFFER,e.DEPTH_ATTACHMENT,e.RENDERBUFFER,t)):i.depthBuffer&&i.stencilBuffer?(e.renderbufferStorage(e.RENDERBUFFER,e.DEPTH_STENCIL,i.width,i.height),e.framebufferRenderbuffer(e.FRAMEBUFFER,e.DEPTH_STENCIL_ATTACHMENT,e.RENDERBUFFER,t)):e.renderbufferStorage(e.RENDERBUFFER,e.RGBA4,i.width,i.height),e.bindRenderbuffer(e.RENDERBUFFER,null)}function x(t){var i=r.get(t),n=!0===t.isWebGLRenderTargetCube;if(t.depthTexture){if(n)throw new Error("target.depthTexture not supported in Cube render targets");!function(t,i){if(i&&i.isWebGLRenderTargetCube)throw new Error("Depth Texture with cube render targets is not supported");if(e.bindFramebuffer(e.FRAMEBUFFER,t),!i.depthTexture||!i.depthTexture.isDepthTexture)throw new Error("renderTarget.depthTexture must be an instance of THREE.DepthTexture");r.get(i.depthTexture).__webglTexture&&i.depthTexture.image.width===i.width&&i.depthTexture.image.height===i.height||(i.depthTexture.image.width=i.width,i.depthTexture.image.height=i.height,i.depthTexture.needsUpdate=!0),m(i.depthTexture,0);var n=r.get(i.depthTexture).__webglTexture;if(i.depthTexture.format===He)e.framebufferTexture2D(e.FRAMEBUFFER,e.DEPTH_ATTACHMENT,e.TEXTURE_2D,n,0);else{if(i.depthTexture.format!==je)throw new Error("Unknown depthTexture format");e.framebufferTexture2D(e.FRAMEBUFFER,e.DEPTH_STENCIL_ATTACHMENT,e.TEXTURE_2D,n,0)}}(i.__webglFramebuffer,t)}else if(n){i.__webglDepthbuffer=[];for(var o=0;o<6;o++)e.bindFramebuffer(e.FRAMEBUFFER,i.__webglFramebuffer[o]),i.__webglDepthbuffer[o]=e.createRenderbuffer(),y(i.__webglDepthbuffer[o],t)}else e.bindFramebuffer(e.FRAMEBUFFER,i.__webglFramebuffer),i.__webglDepthbuffer=e.createRenderbuffer(),y(i.__webglDepthbuffer,t);e.bindFramebuffer(e.FRAMEBUFFER,null)}this.setTexture2D=m,this.setTextureCube=function(t,s){var c=r.get(t);if(6===t.image.length)if(t.version>0&&c.__version!==t.version){c.__image__webglTextureCube||(t.addEventListener("dispose",d),c.__image__webglTextureCube=e.createTexture(),a.textures++),i.activeTexture(e.TEXTURE0+s),i.bindTexture(e.TEXTURE_CUBE_MAP,c.__image__webglTextureCube),e.pixelStorei(e.UNPACK_FLIP_Y_WEBGL,t.flipY);for(var p=t&&t.isCompressedTexture,f=t.image[0]&&t.image[0].isDataTexture,m=[],g=0;g<6;g++)m[g]=p||f?f?t.image[g].image:t.image[g]:h(t.image[g],n.maxCubemapSize);var y=l(m[0]),x=o.convert(t.format),b=o.convert(t.type);for(v(e.TEXTURE_CUBE_MAP,t,y),g=0;g<6;g++)if(p)for(var w,_=m[g].mipmaps,M=0,E=_.length;M-1?i.compressedTexImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+g,M,x,w.width,w.height,0,w.data):console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .setTextureCube()"):i.texImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+g,M,x,w.width,w.height,0,x,b,w.data);else f?i.texImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+g,0,x,m[g].width,m[g].height,0,x,b,m[g].data):i.texImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+g,0,x,x,b,m[g]);u(t,y)&&e.generateMipmap(e.TEXTURE_CUBE_MAP),c.__version=t.version,t.onUpdate&&t.onUpdate(t)}else i.activeTexture(e.TEXTURE0+s),i.bindTexture(e.TEXTURE_CUBE_MAP,c.__image__webglTextureCube)},this.setTextureCubeDynamic=function(t,n){i.activeTexture(e.TEXTURE0+n),i.bindTexture(e.TEXTURE_CUBE_MAP,r.get(t).__webglTexture)},this.setupRenderTarget=function(t){var n=r.get(t),o=r.get(t.texture);t.addEventListener("dispose",f),o.__webglTexture=e.createTexture(),a.textures++;var s=!0===t.isWebGLRenderTargetCube,c=l(t);if(s){n.__webglFramebuffer=[];for(var h=0;h<6;h++)n.__webglFramebuffer[h]=e.createFramebuffer()}else n.__webglFramebuffer=e.createFramebuffer();if(s){for(i.bindTexture(e.TEXTURE_CUBE_MAP,o.__webglTexture),v(e.TEXTURE_CUBE_MAP,t.texture,c),h=0;h<6;h++)g(n.__webglFramebuffer[h],t,e.COLOR_ATTACHMENT0,e.TEXTURE_CUBE_MAP_POSITIVE_X+h);u(t.texture,c)&&e.generateMipmap(e.TEXTURE_CUBE_MAP),i.bindTexture(e.TEXTURE_CUBE_MAP,null)}else i.bindTexture(e.TEXTURE_2D,o.__webglTexture),v(e.TEXTURE_2D,t.texture,c),g(n.__webglFramebuffer,t,e.COLOR_ATTACHMENT0,e.TEXTURE_2D),u(t.texture,c)&&e.generateMipmap(e.TEXTURE_2D),i.bindTexture(e.TEXTURE_2D,null);t.depthBuffer&&x(t)},this.updateRenderTargetMipmap=function(t){var n=t.texture;if(u(n,l(t))){var o=t.isWebGLRenderTargetCube?e.TEXTURE_CUBE_MAP:e.TEXTURE_2D,a=r.get(n).__webglTexture;i.bindTexture(o,a),e.generateMipmap(o),i.bindTexture(o,null)}},this.updateVideoTextures=function(){for(var e in c)c[e].update()}}function Kr(e,t,i,r){qi.call(this),this.type="PerspectiveCamera",this.fov=void 0!==e?e:50,this.zoom=1,this.near=void 0!==i?i:.1,this.far=void 0!==r?r:2e3,this.focus=10,this.aspect=void 0!==t?t:1,this.view=null,this.filmGauge=35,this.filmOffset=0,this.updateProjectionMatrix()}function $r(e){Kr.call(this),this.cameras=e||[]}function en(e){var t=this,i=null,r=null,n=null;"undefined"!=typeof window&&"VRFrameData"in window&&(r=new window.VRFrameData);var o=new vt,a=new Kr;a.bounds=new _t(0,0,.5,1),a.layers.enable(1);var s=new Kr;s.bounds=new _t(.5,0,.5,1),s.layers.enable(2);var c,h,l=new $r([a,s]);function u(){if(null!==i&&i.isPresenting){var r=i.getEyeParameters("left"),n=r.renderWidth,o=r.renderHeight;h=e.getPixelRatio(),c=e.getSize(),e.setDrawingBufferSize(2*n,o,1)}else t.enabled&&e.setDrawingBufferSize(c.width,c.height,h)}l.layers.enable(1),l.layers.enable(2),"undefined"!=typeof window&&window.addEventListener("vrdisplaypresentchange",u,!1),this.enabled=!1,this.getDevice=function(){return i},this.setDevice=function(e){void 0!==e&&(i=e)},this.setPoseTarget=function(e){void 0!==e&&(n=e)},this.getCamera=function(e){if(null===i)return e;i.depthNear=e.near,i.depthFar=e.far,i.getFrameData(r);var t=r.pose,c=null!==n?n:e;if(null!==t.position?c.position.fromArray(t.position):c.position.set(0,0,0),null!==t.orientation&&c.quaternion.fromArray(t.orientation),c.updateMatrixWorld(),!1===i.isPresenting)return e;a.near=e.near,s.near=e.near,a.far=e.far,s.far=e.far,l.matrixWorld.copy(e.matrixWorld),l.matrixWorldInverse.copy(e.matrixWorldInverse),a.matrixWorldInverse.fromArray(r.leftViewMatrix),s.matrixWorldInverse.fromArray(r.rightViewMatrix);var h=c.parent;null!==h&&(o.getInverse(h.matrixWorld),a.matrixWorldInverse.multiply(o),s.matrixWorldInverse.multiply(o)),a.matrixWorld.getInverse(a.matrixWorldInverse),s.matrixWorld.getInverse(s.matrixWorldInverse),a.projectionMatrix.fromArray(r.leftProjectionMatrix),s.projectionMatrix.fromArray(r.rightProjectionMatrix),l.projectionMatrix.copy(a.projectionMatrix);var u=i.getLayers();if(u.length){var p=u[0];null!==p.leftBounds&&4===p.leftBounds.length&&a.bounds.fromArray(p.leftBounds),null!==p.rightBounds&&4===p.rightBounds.length&&s.bounds.fromArray(p.rightBounds)}return l},this.submitFrame=function(){i&&i.isPresenting&&i.submitFrame()},this.dispose=function(){"undefined"!=typeof window&&window.removeEventListener("vrdisplaypresentchange",u)}}function tn(e,t){return{convert:function(i){var r;if(i===ve)return e.REPEAT;if(i===ge)return e.CLAMP_TO_EDGE;if(i===ye)return e.MIRRORED_REPEAT;if(i===xe)return e.NEAREST;if(i===be)return e.NEAREST_MIPMAP_NEAREST;if(i===we)return e.NEAREST_MIPMAP_LINEAR;if(i===_e)return e.LINEAR;if(i===Me)return e.LINEAR_MIPMAP_NEAREST;if(i===Ee)return e.LINEAR_MIPMAP_LINEAR;if(i===Te)return e.UNSIGNED_BYTE;if(i===Oe)return e.UNSIGNED_SHORT_4_4_4_4;if(i===Ie)return e.UNSIGNED_SHORT_5_5_5_1;if(i===De)return e.UNSIGNED_SHORT_5_6_5;if(i===Se)return e.BYTE;if(i===Ae)return e.SHORT;if(i===Re)return e.UNSIGNED_SHORT;if(i===Le)return e.INT;if(i===Ce)return e.UNSIGNED_INT;if(i===Pe)return e.FLOAT;if(i===Ne&&null!==(r=t.get("OES_texture_half_float")))return r.HALF_FLOAT_OES;if(i===Fe)return e.ALPHA;if(i===Be)return e.RGB;if(i===ze)return e.RGBA;if(i===ke)return e.LUMINANCE;if(i===Ge)return e.LUMINANCE_ALPHA;if(i===He)return e.DEPTH_COMPONENT;if(i===je)return e.DEPTH_STENCIL;if(i===P)return e.FUNC_ADD;if(i===N)return e.FUNC_SUBTRACT;if(i===O)return e.FUNC_REVERSE_SUBTRACT;if(i===U)return e.ZERO;if(i===F)return e.ONE;if(i===B)return e.SRC_COLOR;if(i===z)return e.ONE_MINUS_SRC_COLOR;if(i===k)return e.SRC_ALPHA;if(i===G)return e.ONE_MINUS_SRC_ALPHA;if(i===V)return e.DST_ALPHA;if(i===H)return e.ONE_MINUS_DST_ALPHA;if(i===j)return e.DST_COLOR;if(i===W)return e.ONE_MINUS_DST_COLOR;if(i===X)return e.SRC_ALPHA_SATURATE;if((i===We||i===Xe||i===qe||i===Ye)&&null!==(r=t.get("WEBGL_compressed_texture_s3tc"))){if(i===We)return r.COMPRESSED_RGB_S3TC_DXT1_EXT;if(i===Xe)return r.COMPRESSED_RGBA_S3TC_DXT1_EXT;if(i===qe)return r.COMPRESSED_RGBA_S3TC_DXT3_EXT;if(i===Ye)return r.COMPRESSED_RGBA_S3TC_DXT5_EXT}if((i===Ze||i===Je||i===Qe||i===Ke)&&null!==(r=t.get("WEBGL_compressed_texture_pvrtc"))){if(i===Ze)return r.COMPRESSED_RGB_PVRTC_4BPPV1_IMG;if(i===Je)return r.COMPRESSED_RGB_PVRTC_2BPPV1_IMG;if(i===Qe)return r.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG;if(i===Ke)return r.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG}if(i===$e&&null!==(r=t.get("WEBGL_compressed_texture_etc1")))return r.COMPRESSED_RGB_ETC1_WEBGL;if((i===I||i===D)&&null!==(r=t.get("EXT_blend_minmax"))){if(i===I)return r.MIN_EXT;if(i===D)return r.MAX_EXT}return i===Ue&&null!==(r=t.get("WEBGL_depth_texture"))?r.UNSIGNED_INT_24_8_WEBGL:0}}}function rn(e){console.log("THREE.WebGLRenderer",p);var t=void 0!==(e=e||{}).canvas?e.canvas:document.createElementNS("http://www.w3.org/1999/xhtml","canvas"),i=void 0!==e.context?e.context:null,r=void 0!==e.alpha&&e.alpha,n=void 0===e.depth||e.depth,o=void 0===e.stencil||e.stencil,a=void 0!==e.antialias&&e.antialias,s=void 0===e.premultipliedAlpha||e.premultipliedAlpha,c=void 0!==e.preserveDrawingBuffer&&e.preserveDrawingBuffer,h=void 0!==e.powerPreference?e.powerPreference:"default",l=[],u=[],g=null,y=[],x=[];this.domElement=t,this.context=null,this.autoClear=!0,this.autoClearColor=!0,this.autoClearDepth=!0,this.autoClearStencil=!0,this.sortObjects=!0,this.clippingPlanes=[],this.localClippingEnabled=!1,this.gammaFactor=2,this.gammaInput=!1,this.gammaOutput=!1,this.physicallyCorrectLights=!1,this.toneMapping=oe,this.toneMappingExposure=1,this.toneMappingWhitePoint=1,this.maxMorphTargets=8,this.maxMorphNormals=4;var M,E,P,N,O,I,D,U,F,B,z,k,G,V,H,j,W,X,te,ie=this,re=!1,ne=null,ae=null,se=-1,ce="",he=null,le=null,ue=new _t,pe=new _t,de=null,fe=0,me=t.width,ve=t.height,ge=1,ye=new _t(0,0,me,ve),xe=new _t(0,0,me,ve),be=!1,we=new Ui,_e=new function(){var e=this,t=null,i=0,r=!1,n=!1,o=new Di,a=new xt,s={value:null,needsUpdate:!1};function c(){s.value!==t&&(s.value=t,s.needsUpdate=i>0),e.numPlanes=i,e.numIntersection=0}function h(t,i,r,n){var c=null!==t?t.length:0,h=null;if(0!==c){if(h=s.value,!0!==n||null===h){var l=r+4*c,u=i.matrixWorldInverse;a.getNormalMatrix(u),(null===h||h.length0&&e.getShaderPrecisionFormat(e.FRAGMENT_SHADER,e.HIGH_FLOAT).precision>0)return"highp";t="mediump"}return"mediump"===t&&e.getShaderPrecisionFormat(e.VERTEX_SHADER,e.MEDIUM_FLOAT).precision>0&&e.getShaderPrecisionFormat(e.FRAGMENT_SHADER,e.MEDIUM_FLOAT).precision>0?"mediump":"lowp"}var o=void 0!==i.precision?i.precision:"highp",a=n(o);a!==o&&(console.warn("THREE.WebGLRenderer:",o,"not supported, using",a,"instead."),o=a);var s=!0===i.logarithmicDepthBuffer,c=e.getParameter(e.MAX_TEXTURE_IMAGE_UNITS),h=e.getParameter(e.MAX_VERTEX_TEXTURE_IMAGE_UNITS),l=e.getParameter(e.MAX_TEXTURE_SIZE),u=e.getParameter(e.MAX_CUBE_MAP_TEXTURE_SIZE),p=e.getParameter(e.MAX_VERTEX_ATTRIBS),d=e.getParameter(e.MAX_VERTEX_UNIFORM_VECTORS),f=e.getParameter(e.MAX_VARYING_VECTORS),m=e.getParameter(e.MAX_FRAGMENT_UNIFORM_VECTORS),v=h>0,g=!!t.get("OES_texture_float");return{getMaxAnisotropy:function(){if(void 0!==r)return r;var i=t.get("EXT_texture_filter_anisotropic");return r=null!==i?e.getParameter(i.MAX_TEXTURE_MAX_ANISOTROPY_EXT):0},getMaxPrecision:n,precision:o,logarithmicDepthBuffer:s,maxTextures:c,maxVertexTextures:h,maxTextureSize:l,maxCubemapSize:u,maxAttributes:p,maxVertexUniforms:d,maxVaryings:f,maxFragmentUniforms:m,vertexTextures:v,floatFragmentTextures:g,floatVertexTextures:v&&g}}(M,E,e),(N=new function(e,t,i){var r=new function(){var t=!1,i=new _t,r=null,n=new _t(0,0,0,0);return{setMask:function(i){r===i||t||(e.colorMask(i,i,i,i),r=i)},setLocked:function(e){t=e},setClear:function(t,r,o,a,s){!0===s&&(t*=a,r*=a,o*=a),i.set(t,r,o,a),!1===n.equals(i)&&(e.clearColor(t,r,o,a),n.copy(i))},reset:function(){t=!1,r=null,n.set(-1,0,0,0)}}},n=new function(){var t=!1,i=null,r=null,n=null;return{setTest:function(t){t?X(e.DEPTH_TEST):te(e.DEPTH_TEST)},setMask:function(r){i===r||t||(e.depthMask(r),i=r)},setFunc:function(t){if(r!==t){if(t)switch(t){case q:e.depthFunc(e.NEVER);break;case Y:e.depthFunc(e.ALWAYS);break;case Z:e.depthFunc(e.LESS);break;case J:e.depthFunc(e.LEQUAL);break;case Q:e.depthFunc(e.EQUAL);break;case K:e.depthFunc(e.GEQUAL);break;case $:e.depthFunc(e.GREATER);break;case ee:e.depthFunc(e.NOTEQUAL);break;default:e.depthFunc(e.LEQUAL)}else e.depthFunc(e.LEQUAL);r=t}},setLocked:function(e){t=e},setClear:function(t){n!==t&&(e.clearDepth(t),n=t)},reset:function(){t=!1,i=null,r=null,n=null}}},o=new function(){var t=!1,i=null,r=null,n=null,o=null,a=null,s=null,c=null,h=null;return{setTest:function(t){t?X(e.STENCIL_TEST):te(e.STENCIL_TEST)},setMask:function(r){i===r||t||(e.stencilMask(r),i=r)},setFunc:function(t,i,a){r===t&&n===i&&o===a||(e.stencilFunc(t,i,a),r=t,n=i,o=a)},setOp:function(t,i,r){a===t&&s===i&&c===r||(e.stencilOp(t,i,r),a=t,s=i,c=r)},setLocked:function(e){t=e},setClear:function(t){h!==t&&(e.clearStencil(t),h=t)},reset:function(){t=!1,i=null,r=null,n=null,o=null,a=null,s=null,c=null,h=null}}},a=e.getParameter(e.MAX_VERTEX_ATTRIBS),s=new Uint8Array(a),c=new Uint8Array(a),h=new Uint8Array(a),l={},u=null,p=null,v=null,g=null,y=null,x=null,_=null,M=null,E=null,P=!1,N=null,O=null,I=null,D=null,U=null,F=e.getParameter(e.MAX_COMBINED_TEXTURE_IMAGE_UNITS),B=parseFloat(/^WebGL\ ([0-9])/.exec(e.getParameter(e.VERSION))[1]),z=parseFloat(B)>=1,k=null,G={},V=new _t,H=new _t;function j(t,i,r){var n=new Uint8Array(4),o=e.createTexture();e.bindTexture(t,o),e.texParameteri(t,e.TEXTURE_MIN_FILTER,e.NEAREST),e.texParameteri(t,e.TEXTURE_MAG_FILTER,e.NEAREST);for(var a=0;a65535?ar:nr)(a,1),t.update(r,e.ELEMENT_ARRAY_BUFFER),n[i.id]=r,r}}}(M,D,Re),F=new function(e,t){var i={};return{update:function(r){var n=t.frame,o=r.geometry,a=e.get(r,o);return i[a.id]!==n&&(o.isGeometry&&a.updateFromObject(r),e.update(a),i[a.id]=n),a},clear:function(){i={}}}}(U,Le),V=new function(e){var t={},i=new Float32Array(8);return{update:function(r,n,o,a){var s=r.morphTargetInfluences,c=s.length,h=t[n.id];if(void 0===h){h=[];for(var l=0;l=0){var h=n[s];if(void 0!==h){var l=h.normalized,u=h.itemSize,p=D.get(h);if(void 0===p)continue;var d=p.buffer,f=p.type,m=p.bytesPerElement;if(h.isInterleavedBufferAttribute){var v=h.data,g=v.stride,y=h.offset;v&&v.isInstancedInterleavedBuffer?(N.enableAttributeAndDivisor(c,v.meshPerAttribute),void 0===i.maxInstancedCount&&(i.maxInstancedCount=v.meshPerAttribute*v.count)):N.enableAttribute(c),M.bindBuffer(M.ARRAY_BUFFER,d),M.vertexAttribPointer(c,u,f,l,g*m,(r*g+y)*m)}else h.isInstancedBufferAttribute?(N.enableAttributeAndDivisor(c,h.meshPerAttribute),void 0===i.maxInstancedCount&&(i.maxInstancedCount=h.meshPerAttribute*h.count)):N.enableAttribute(c),M.bindBuffer(M.ARRAY_BUFFER,d),M.vertexAttribPointer(c,u,f,l,0,r*u*m)}else if(void 0!==a){var x=a[s];if(void 0!==x)switch(x.length){case 2:M.vertexAttrib2fv(c,x);break;case 3:M.vertexAttrib3fv(c,x);break;case 4:M.vertexAttrib4fv(c,x);break;default:M.vertexAttrib1fv(c,x)}}}}N.disableUnusedAttributes()}(r,s,i),null!==u&&M.bindBuffer(M.ELEMENT_ARRAY_BUFFER,l.buffer));var m=0;null!==u?m=u.count:void 0!==p&&(m=p.count);var v=i.drawRange.start*d,g=i.drawRange.count*d,y=null!==o?o.start*d:0,x=null!==o?o.count*d:1/0,b=Math.max(v,y),w=Math.min(m,v+g,y+x)-1,_=Math.max(0,w-b+1);if(0!==_){if(n.isMesh)if(!0===r.wireframe)N.setLineWidth(r.wireframeLinewidth*Ce()),f.setMode(M.LINES);else switch(n.drawMode){case it:f.setMode(M.TRIANGLES);break;case rt:f.setMode(M.TRIANGLE_STRIP);break;case nt:f.setMode(M.TRIANGLE_FAN)}else if(n.isLine){var T=r.linewidth;void 0===T&&(T=1),N.setLineWidth(T*Ce()),n.isLineSegments?f.setMode(M.LINES):n.isLineLoop?f.setMode(M.LINE_LOOP):f.setMode(M.LINE_STRIP)}else n.isPoints&&f.setMode(M.POINTS);i&&i.isInstancedBufferGeometry?i.maxInstancedCount>0&&f.renderInstances(i,b,_):f.render(b,_)}},this.compile=function(e,t){l.length=0,u.length=0,e.traverse(function(e){e.isLight&&(l.push(e),e.castShadow&&u.push(e))}),B.setup(l,u,t),e.traverse(function(t){if(t.material)if(Array.isArray(t.material))for(var i=0;i=0&&e.numSupportedMorphTargets++}if(e.morphNormals){e.numSupportedMorphNormals=0;for(l=0;l=0&&e.numSupportedMorphNormals++}var p=r.shader.uniforms;(e.isShaderMaterial||e.isRawShaderMaterial)&&!0!==e.clipping||(r.numClippingPlanes=_e.numPlanes,r.numIntersection=_e.numIntersection,p.clippingPlanes=_e.uniform),r.fog=t,r.lightsHash=B.state.hash,e.lights&&(p.ambientLightColor.value=B.state.ambient,p.directionalLights.value=B.state.directional,p.spotLights.value=B.state.spot,p.rectAreaLights.value=B.state.rectArea,p.pointLights.value=B.state.point,p.hemisphereLights.value=B.state.hemi,p.directionalShadowMap.value=B.state.directionalShadowMap,p.directionalShadowMatrix.value=B.state.directionalShadowMatrix,p.spotShadowMap.value=B.state.spotShadowMap,p.spotShadowMatrix.value=B.state.spotShadowMatrix,p.pointShadowMap.value=B.state.pointShadowMap,p.pointShadowMatrix.value=B.state.pointShadowMatrix);var d=r.program.getUniforms(),f=ui.seqWithValue(d.seq,p);r.uniformsList=f}function Ze(e,t,i,r){fe=0;var n=O.get(i);if(Me&&(Ee||e!==he)){var o=e===he&&i.id===se;_e.setState(i.clippingPlanes,i.clipIntersection,i.clipShadows,e,n,o)}!1===i.needsUpdate&&(void 0===n.program?i.needsUpdate=!0:i.fog&&n.fog!==t?i.needsUpdate=!0:i.lights&&n.lightsHash!==B.state.hash?i.needsUpdate=!0:void 0===n.numClippingPlanes||n.numClippingPlanes===_e.numPlanes&&n.numIntersection===_e.numIntersection||(i.needsUpdate=!0)),i.needsUpdate&&(Ye(i,t,r),i.needsUpdate=!1);var a,s,c=!1,h=!1,l=!1,u=n.program,p=u.getUniforms(),d=n.shader.uniforms;if(N.useProgram(u.program)&&(c=!0,h=!0,l=!0),i.id!==se&&(se=i.id,h=!0),c||e!==he){if(p.setValue(M,"projectionMatrix",e.projectionMatrix),P.logarithmicDepthBuffer&&p.setValue(M,"logDepthBufFC",2/(Math.log(e.far+1)/Math.LN2)),he!==(le||e)&&(he=le||e,h=!0,l=!0),i.isShaderMaterial||i.isMeshPhongMaterial||i.isMeshStandardMaterial||i.envMap){var f=p.map.cameraPosition;void 0!==f&&f.setValue(M,Ae.setFromMatrixPosition(e.matrixWorld))}(i.isMeshPhongMaterial||i.isMeshLambertMaterial||i.isMeshBasicMaterial||i.isMeshStandardMaterial||i.isShaderMaterial||i.skinning)&&p.setValue(M,"viewMatrix",e.matrixWorldInverse)}if(i.skinning){p.setOptional(M,r,"bindMatrix"),p.setOptional(M,r,"bindMatrixInverse");var m=r.skeleton;if(m){var v=m.bones;if(P.floatVertexTextures){if(void 0===m.boneTexture){var g=Math.sqrt(4*v.length);g=ft.ceilPowerOfTwo(g),g=Math.max(g,4);var y=new Float32Array(g*g*4);y.set(m.boneMatrices);var x=new Tt(y,g,g,ze,Pe);m.boneMatrices=y,m.boneTexture=x,m.boneTextureSize=g}p.setValue(M,"boneTexture",m.boneTexture),p.setValue(M,"boneTextureSize",m.boneTextureSize)}else p.setOptional(M,m,"boneMatrices")}}return h&&(p.setValue(M,"toneMappingExposure",ie.toneMappingExposure),p.setValue(M,"toneMappingWhitePoint",ie.toneMappingWhitePoint),i.lights&&(s=l,(a=d).ambientLightColor.needsUpdate=s,a.directionalLights.needsUpdate=s,a.pointLights.needsUpdate=s,a.spotLights.needsUpdate=s,a.rectAreaLights.needsUpdate=s,a.hemisphereLights.needsUpdate=s),t&&i.fog&&function(e,t){e.fogColor.value=t.color,t.isFog?(e.fogNear.value=t.near,e.fogFar.value=t.far):t.isFogExp2&&(e.fogDensity.value=t.density)}(d,t),i.isMeshBasicMaterial?Je(d,i):i.isMeshLambertMaterial?(Je(d,i),function(e,t){t.emissiveMap&&(e.emissiveMap.value=t.emissiveMap)}(d,i)):i.isMeshPhongMaterial?(Je(d,i),i.isMeshToonMaterial?function(e,t){Qe(e,t),t.gradientMap&&(e.gradientMap.value=t.gradientMap)}(d,i):Qe(d,i)):i.isMeshStandardMaterial?(Je(d,i),i.isMeshPhysicalMaterial?function(e,t){e.clearCoat.value=t.clearCoat,e.clearCoatRoughness.value=t.clearCoatRoughness,Ke(e,t)}(d,i):Ke(d,i)):i.isMeshDepthMaterial?(Je(d,i),function(e,t){t.displacementMap&&(e.displacementMap.value=t.displacementMap,e.displacementScale.value=t.displacementScale,e.displacementBias.value=t.displacementBias)}(d,i)):i.isMeshDistanceMaterial?(Je(d,i),function(e,t){t.displacementMap&&(e.displacementMap.value=t.displacementMap,e.displacementScale.value=t.displacementScale,e.displacementBias.value=t.displacementBias);e.referencePosition.value.copy(t.referencePosition),e.nearDistance.value=t.nearDistance,e.farDistance.value=t.farDistance}(d,i)):i.isMeshNormalMaterial?(Je(d,i),function(e,t){t.bumpMap&&(e.bumpMap.value=t.bumpMap,e.bumpScale.value=t.bumpScale);t.normalMap&&(e.normalMap.value=t.normalMap,e.normalScale.value.copy(t.normalScale));t.displacementMap&&(e.displacementMap.value=t.displacementMap,e.displacementScale.value=t.displacementScale,e.displacementBias.value=t.displacementBias)}(d,i)):i.isLineBasicMaterial?(function(e,t){e.diffuse.value=t.color,e.opacity.value=t.opacity}(d,i),i.isLineDashedMaterial&&function(e,t){e.dashSize.value=t.dashSize,e.totalSize.value=t.dashSize+t.gapSize,e.scale.value=t.scale}(d,i)):i.isPointsMaterial?function(e,t){if(e.diffuse.value=t.color,e.opacity.value=t.opacity,e.size.value=t.size*ge,e.scale.value=.5*ve,e.map.value=t.map,null!==t.map){if(!0===t.map.matrixAutoUpdate){var i=t.map.offset,r=t.map.repeat,n=t.map.rotation,o=t.map.center;t.map.matrix.setUvTransform(i.x,i.y,r.x,r.y,n,o.x,o.y)}e.uvTransform.value.copy(t.map.matrix)}}(d,i):i.isShadowMaterial&&(d.color.value=i.color,d.opacity.value=i.opacity),void 0!==d.ltcMat&&(d.ltcMat.value=fi.LTC_MAT_TEXTURE),void 0!==d.ltcMag&&(d.ltcMag.value=fi.LTC_MAG_TEXTURE),ui.upload(M,n.uniformsList,d,ie)),p.setValue(M,"modelViewMatrix",r.modelViewMatrix),p.setValue(M,"normalMatrix",r.normalMatrix),p.setValue(M,"modelMatrix",r.matrixWorld),u}function Je(e,t){var i;if(e.opacity.value=t.opacity,t.color&&(e.diffuse.value=t.color),t.emissive&&e.emissive.value.copy(t.emissive).multiplyScalar(t.emissiveIntensity),t.map&&(e.map.value=t.map),t.alphaMap&&(e.alphaMap.value=t.alphaMap),t.specularMap&&(e.specularMap.value=t.specularMap),t.envMap&&(e.envMap.value=t.envMap,e.flipEnvMap.value=t.envMap&&t.envMap.isCubeTexture?-1:1,e.reflectivity.value=t.reflectivity,e.refractionRatio.value=t.refractionRatio),t.lightMap&&(e.lightMap.value=t.lightMap,e.lightMapIntensity.value=t.lightMapIntensity),t.aoMap&&(e.aoMap.value=t.aoMap,e.aoMapIntensity.value=t.aoMapIntensity),t.map?i=t.map:t.specularMap?i=t.specularMap:t.displacementMap?i=t.displacementMap:t.normalMap?i=t.normalMap:t.bumpMap?i=t.bumpMap:t.roughnessMap?i=t.roughnessMap:t.metalnessMap?i=t.metalnessMap:t.alphaMap?i=t.alphaMap:t.emissiveMap&&(i=t.emissiveMap),void 0!==i){if(i.isWebGLRenderTarget&&(i=i.texture),!0===i.matrixAutoUpdate){var r=i.offset,n=i.repeat,o=i.rotation,a=i.center;i.matrix.setUvTransform(r.x,r.y,n.x,n.y,o,a.x,a.y)}e.uvTransform.value.copy(i.matrix)}}function Qe(e,t){e.specular.value=t.specular,e.shininess.value=Math.max(t.shininess,1e-4),t.emissiveMap&&(e.emissiveMap.value=t.emissiveMap),t.bumpMap&&(e.bumpMap.value=t.bumpMap,e.bumpScale.value=t.bumpScale),t.normalMap&&(e.normalMap.value=t.normalMap,e.normalScale.value.copy(t.normalScale)),t.displacementMap&&(e.displacementMap.value=t.displacementMap,e.displacementScale.value=t.displacementScale,e.displacementBias.value=t.displacementBias)}function Ke(e,t){e.roughness.value=t.roughness,e.metalness.value=t.metalness,t.roughnessMap&&(e.roughnessMap.value=t.roughnessMap),t.metalnessMap&&(e.metalnessMap.value=t.metalnessMap),t.emissiveMap&&(e.emissiveMap.value=t.emissiveMap),t.bumpMap&&(e.bumpMap.value=t.bumpMap,e.bumpScale.value=t.bumpScale),t.normalMap&&(e.normalMap.value=t.normalMap,e.normalScale.value.copy(t.normalScale)),t.displacementMap&&(e.displacementMap.value=t.displacementMap,e.displacementScale.value=t.displacementScale,e.displacementBias.value=t.displacementBias),t.envMap&&(e.envMapIntensity.value=t.envMapIntensity)}this.animate=function(e){je=e,function(){if(!He){var e=De.getDevice();e&&e.isPresenting?e.requestAnimationFrame(We):window.requestAnimationFrame(We),He=!0}}()},this.render=function(e,t,i,r){if(t&&t.isCamera){if(!re){ce="",se=-1,he=null,!0===e.autoUpdate&&e.updateMatrixWorld(),null===t.parent&&t.updateMatrixWorld(),De.enabled&&(t=De.getCamera(t)),Se.multiplyMatrices(t.projectionMatrix,t.matrixWorldInverse),we.setFromMatrix(Se),l.length=0,u.length=0,y.length=0,x.length=0,Ee=this.localClippingEnabled,Me=_e.init(this.clippingPlanes,Ee,t),(g=k.get(e,t)).init(),function e(t,i,r){if(!1===t.visible)return;var n=t.layers.test(i.layers);if(n)if(t.isLight)l.push(t),t.castShadow&&u.push(t);else if(t.isSprite)t.frustumCulled&&!we.intersectsSprite(t)||y.push(t);else if(t.isLensFlare)x.push(t);else if(t.isImmediateRenderObject)r&&Ae.setFromMatrixPosition(t.matrixWorld).applyMatrix4(Se),g.push(t,null,t.material,Ae.z,null);else if((t.isMesh||t.isLine||t.isPoints)&&(t.isSkinnedMesh&&t.skeleton.update(),!t.frustumCulled||we.intersectsObject(t))){r&&Ae.setFromMatrixPosition(t.matrixWorld).applyMatrix4(Se);var o=F.update(t),a=t.material;if(Array.isArray(a))for(var s=o.groups,c=0,h=s.length;c=P.maxTextures&&console.warn("THREE.WebGLRenderer: Trying to use "+e+" texture units while this GPU supports only "+P.maxTextures),fe+=1,e},this.setTexture2D=(Ve=!1,function(e,t){e&&e.isWebGLRenderTarget&&(Ve||(console.warn("THREE.WebGLRenderer.setTexture2D: don't use render targets as textures. Use their .texture property instead."),Ve=!0),e=e.texture),I.setTexture2D(e,t)}),this.setTexture=function(){var e=!1;return function(t,i){e||(console.warn("THREE.WebGLRenderer: .setTexture is deprecated, use setTexture2D instead."),e=!0),I.setTexture2D(t,i)}}(),this.setTextureCube=function(){var e=!1;return function(t,i){t&&t.isWebGLRenderTargetCube&&(e||(console.warn("THREE.WebGLRenderer.setTextureCube: don't use cube render targets as textures. Use their .texture property instead."),e=!0),t=t.texture),t&&t.isCubeTexture||Array.isArray(t.image)&&6===t.image.length?I.setTextureCube(t,i):I.setTextureCubeDynamic(t,i)}}(),this.getRenderTarget=function(){return ne},this.setRenderTarget=function(e){ne=e,e&&void 0===O.get(e).__webglFramebuffer&&I.setupRenderTarget(e);var t=null,i=!1;if(e){var r=O.get(e).__webglFramebuffer;e.isWebGLRenderTargetCube?(t=r[e.activeCubeFace],i=!0):t=r,ue.copy(e.viewport),pe.copy(e.scissor),de=e.scissorTest}else ue.copy(ye).multiplyScalar(ge),pe.copy(xe).multiplyScalar(ge),de=be;if(ae!==t&&(M.bindFramebuffer(M.FRAMEBUFFER,t),ae=t),N.viewport(ue),N.scissor(pe),N.setScissorTest(de),i){var n=O.get(e.texture);M.framebufferTexture2D(M.FRAMEBUFFER,M.COLOR_ATTACHMENT0,M.TEXTURE_CUBE_MAP_POSITIVE_X+e.activeCubeFace,n.__webglTexture,e.activeMipMapLevel)}},this.readRenderTargetPixels=function(e,t,i,r,n,o){if(e&&e.isWebGLRenderTarget){var a=O.get(e).__webglFramebuffer;if(a){var s=!1;a!==ae&&(M.bindFramebuffer(M.FRAMEBUFFER,a),s=!0);try{var c=e.texture,h=c.format,l=c.type;if(h!==ze&&te.convert(h)!==M.getParameter(M.IMPLEMENTATION_COLOR_READ_FORMAT))return void console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in RGBA or implementation defined format.");if(!(l===Te||te.convert(l)===M.getParameter(M.IMPLEMENTATION_COLOR_READ_TYPE)||l===Pe&&(E.get("OES_texture_float")||E.get("WEBGL_color_buffer_float"))||l===Ne&&E.get("EXT_color_buffer_half_float")))return void console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in UnsignedByteType or implementation defined type.");M.checkFramebufferStatus(M.FRAMEBUFFER)===M.FRAMEBUFFER_COMPLETE?t>=0&&t<=e.width-r&&i>=0&&i<=e.height-n&&M.readPixels(t,i,r,n,te.convert(h),te.convert(l),o):console.error("THREE.WebGLRenderer.readRenderTargetPixels: readPixels from renderTarget failed. Framebuffer not complete.")}finally{s&&M.bindFramebuffer(M.FRAMEBUFFER,ae)}}}else console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.")}}function nn(e,t){this.name="",this.color=new di(e),this.density=void 0!==t?t:25e-5}function on(e,t,i){this.name="",this.color=new di(e),this.near=void 0!==t?t:1,this.far=void 0!==i?i:1e3}function an(){Xi.call(this),this.type="Scene",this.background=null,this.fog=null,this.overrideMaterial=null,this.autoUpdate=!0}function sn(e,t,i,r,n){Xi.call(this),this.lensFlares=[],this.positionScreen=new yt,this.customUpdateCallback=void 0,void 0!==e&&this.add(e,t,i,r,n)}function cn(e){Ci.call(this),this.type="SpriteMaterial",this.color=new di(16777215),this.map=null,this.rotation=0,this.fog=!1,this.lights=!1,this.setValues(e)}function hn(e){Xi.call(this),this.type="Sprite",this.material=void 0!==e?e:new cn}function ln(){Xi.call(this),this.type="LOD",Object.defineProperties(this,{levels:{enumerable:!0,value:[]}})}function un(e,t){if(e=e||[],this.bones=e.slice(0),this.boneMatrices=new Float32Array(16*this.bones.length),void 0===t)this.calculateInverses();else if(this.bones.length===t.length)this.boneInverses=t.slice(0);else{console.warn("THREE.Skeleton boneInverses is the wrong length."),this.boneInverses=[];for(var i=0,r=this.bones.length;i=0?(u=e(v-1e-5,m,u),p.subVectors(l,u)):(u=e(v+1e-5,m,u),p.subVectors(u,l)),m-1e-5>=0?(u=e(v,m-1e-5,u),d.subVectors(l,u)):(u=e(v,m+1e-5,u),d.subVectors(u,l)),h.crossVectors(p,d).normalize(),s.push(h.x,h.y,h.z),c.push(v,m)}}for(r=0;r.9&&a<.1&&(t<.2&&(o[e+0]+=1),i<.2&&(o[e+2]+=1),r<.2&&(o[e+4]+=1))}}()}(),this.addAttribute("position",new sr(n,3)),this.addAttribute("normal",new sr(n.slice(),3)),this.addAttribute("uv",new sr(o,2)),0===r?this.computeVertexNormals():this.normalizeNormals()}function Ln(e,t){Ki.call(this),this.type="TetrahedronGeometry",this.parameters={radius:e,detail:t},this.fromBufferGeometry(new Cn(e,t)),this.mergeVertices()}function Cn(e,t){Rn.call(this,[1,1,1,-1,-1,1,-1,1,-1,1,-1,-1],[2,1,0,0,3,2,1,3,0,2,3,1],e,t),this.type="TetrahedronBufferGeometry",this.parameters={radius:e,detail:t}}function Pn(e,t){Ki.call(this),this.type="OctahedronGeometry",this.parameters={radius:e,detail:t},this.fromBufferGeometry(new Nn(e,t)),this.mergeVertices()}function Nn(e,t){Rn.call(this,[1,0,0,-1,0,0,0,1,0,0,-1,0,0,0,1,0,0,-1],[0,2,4,0,4,3,0,3,5,0,5,2,1,2,5,1,5,3,1,3,4,1,4,2],e,t),this.type="OctahedronBufferGeometry",this.parameters={radius:e,detail:t}}function On(e,t){Ki.call(this),this.type="IcosahedronGeometry",this.parameters={radius:e,detail:t},this.fromBufferGeometry(new In(e,t)),this.mergeVertices()}function In(e,t){var i=(1+Math.sqrt(5))/2,r=[-1,i,0,1,i,0,-1,-i,0,1,-i,0,0,-1,i,0,1,i,0,-1,-i,0,1,-i,i,0,-1,i,0,1,-i,0,-1,-i,0,1];Rn.call(this,r,[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],e,t),this.type="IcosahedronBufferGeometry",this.parameters={radius:e,detail:t}}function Dn(e,t){Ki.call(this),this.type="DodecahedronGeometry",this.parameters={radius:e,detail:t},this.fromBufferGeometry(new Un(e,t)),this.mergeVertices()}function Un(e,t){var i=(1+Math.sqrt(5))/2,r=1/i,n=[-1,-1,-1,-1,-1,1,-1,1,-1,-1,1,1,1,-1,-1,1,-1,1,1,1,-1,1,1,1,0,-r,-i,0,-r,i,0,r,-i,0,r,i,-r,-i,0,-r,i,0,r,-i,0,r,i,0,-i,0,-r,i,0,-r,-i,0,r,i,0,r];Rn.call(this,n,[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,t),this.type="DodecahedronBufferGeometry",this.parameters={radius:e,detail:t}}function Fn(e,t,i,r,n,o){Ki.call(this),this.type="TubeGeometry",this.parameters={path:e,tubularSegments:t,radius:i,radialSegments:r,closed:n},void 0!==o&&console.warn("THREE.TubeGeometry: taper has been removed.");var a=new Bn(e,t,i,r,n);this.tangents=a.tangents,this.normals=a.normals,this.binormals=a.binormals,this.fromBufferGeometry(a),this.mergeVertices()}function Bn(e,t,i,r,n){xr.call(this),this.type="TubeBufferGeometry",this.parameters={path:e,tubularSegments:t,radius:i,radialSegments:r,closed:n},t=t||64,i=i||1,r=r||8,n=n||!1;var o=e.computeFrenetFrames(t,n);this.tangents=o.tangents,this.normals=o.normals,this.binormals=o.binormals;var a,s,c=new yt,h=new yt,l=new mt,u=new yt,p=[],d=[],f=[],m=[];function v(n){u=e.getPointAt(n/t,u);var a=o.normals[n],l=o.binormals[n];for(s=0;s<=r;s++){var f=s/r*Math.PI*2,m=Math.sin(f),v=-Math.cos(f);h.x=v*a.x+m*l.x,h.y=v*a.y+m*l.y,h.z=v*a.z+m*l.z,h.normalize(),d.push(h.x,h.y,h.z),c.x=u.x+i*h.x,c.y=u.y+i*h.y,c.z=u.z+i*h.z,p.push(c.x,c.y,c.z)}}!function(){for(a=0;ai)){var r=e.ray.origin.distanceTo(Ur);re.far||t.push({distance:r,point:Ur.clone(),face:null,object:this})}}),clone:function(){return new this.constructor(this.material).copy(this)}}),ln.prototype=Object.assign(Object.create(Xi.prototype),{constructor:ln,copy:function(e){Xi.prototype.copy.call(this,e,!1);for(var t=e.levels,i=0,r=t.length;i1){e.setFromMatrixPosition(i.matrixWorld),t.setFromMatrixPosition(this.matrixWorld);var n=e.distanceTo(t);r[0].object.visible=!0;for(var o=1,a=r.length;o=r[o].distance;o++)r[o-1].object.visible=!1,r[o].object.visible=!0;for(;oa))p.applyMatrix4(this.matrixWorld),(M=r.ray.origin.distanceTo(p))r.far||n.push({distance:M,point:u.clone().applyMatrix4(this.matrixWorld),index:g,face:null,faceIndex:null,object:this})}else for(g=0,y=m.length/3-1;ga))p.applyMatrix4(this.matrixWorld),(M=r.ray.origin.distanceTo(p))r.far||n.push({distance:M,point:u.clone().applyMatrix4(this.matrixWorld),index:g,face:null,faceIndex:null,object:this})}}else if(s.isGeometry){var w=s.vertices,_=w.length;for(g=0;g<_-1;g+=d){var M;if(!(t.distanceSqToSegment(w[g],w[g+1],p,u)>a))p.applyMatrix4(this.matrixWorld),(M=r.ray.origin.distanceTo(p))r.far||n.push({distance:M,point:u.clone().applyMatrix4(this.matrixWorld),index:g,face:null,faceIndex:null,object:this})}}}}}(),clone:function(){return new this.constructor(this.geometry,this.material).copy(this)}}),vn.prototype=Object.assign(Object.create(mn.prototype),{constructor:vn,isLineSegments:!0}),gn.prototype=Object.assign(Object.create(mn.prototype),{constructor:gn,isLineLoop:!0}),yn.prototype=Object.create(Ci.prototype),yn.prototype.constructor=yn,yn.prototype.isPointsMaterial=!0,yn.prototype.copy=function(e){return Ci.prototype.copy.call(this,e),this.color.copy(e.color),this.map=e.map,this.size=e.size,this.sizeAttenuation=e.sizeAttenuation,this},xn.prototype=Object.assign(Object.create(Xi.prototype),{constructor:xn,isPoints:!0,raycast:function(){var e=new vt,t=new Sr,i=new Ii;return function(r,n){var o=this,a=this.geometry,s=this.matrixWorld,c=r.params.Points.threshold;if(null===a.boundingSphere&&a.computeBoundingSphere(),i.copy(a.boundingSphere),i.applyMatrix4(s),i.radius+=c,!1!==r.ray.intersectsSphere(i)){e.getInverse(s),t.copy(r.ray).applyMatrix4(e);var h=c/((this.scale.x+this.scale.y+this.scale.z)/3),l=h*h,u=new yt;if(a.isBufferGeometry){var p=a.index,d=a.attributes.position.array;if(null!==p)for(var f=p.array,m=0,v=f.length;mr.far)return;n.push({distance:h,distanceToRay:Math.sqrt(a),point:c.clone(),index:i,face:null,object:o})}}}}(),clone:function(){return new this.constructor(this.geometry,this.material).copy(this)}}),bn.prototype=Object.assign(Object.create(Xi.prototype),{constructor:bn,isGroup:!0}),wn.prototype=Object.assign(Object.create(wt.prototype),{constructor:wn,isVideoTexture:!0,update:function(){var e=this.image;e.readyState>=e.HAVE_CURRENT_DATA&&(this.needsUpdate=!0)}}),_n.prototype=Object.create(wt.prototype),_n.prototype.constructor=_n,_n.prototype.isCompressedTexture=!0,Mn.prototype=Object.create(wt.prototype),Mn.prototype.constructor=Mn,Mn.prototype.isDepthTexture=!0,En.prototype=Object.create(xr.prototype),En.prototype.constructor=En,Tn.prototype=Object.create(Ki.prototype),Tn.prototype.constructor=Tn,Sn.prototype=Object.create(xr.prototype),Sn.prototype.constructor=Sn,An.prototype=Object.create(Ki.prototype),An.prototype.constructor=An,Rn.prototype=Object.create(xr.prototype),Rn.prototype.constructor=Rn,Ln.prototype=Object.create(Ki.prototype),Ln.prototype.constructor=Ln,Cn.prototype=Object.create(Rn.prototype),Cn.prototype.constructor=Cn,Pn.prototype=Object.create(Ki.prototype),Pn.prototype.constructor=Pn,Nn.prototype=Object.create(Rn.prototype),Nn.prototype.constructor=Nn,On.prototype=Object.create(Ki.prototype),On.prototype.constructor=On,In.prototype=Object.create(Rn.prototype),In.prototype.constructor=In,Dn.prototype=Object.create(Ki.prototype),Dn.prototype.constructor=Dn,Un.prototype=Object.create(Rn.prototype),Un.prototype.constructor=Un,Fn.prototype=Object.create(Ki.prototype),Fn.prototype.constructor=Fn,Bn.prototype=Object.create(xr.prototype),Bn.prototype.constructor=Bn,zn.prototype=Object.create(Ki.prototype),zn.prototype.constructor=zn,kn.prototype=Object.create(xr.prototype),kn.prototype.constructor=kn,Gn.prototype=Object.create(Ki.prototype),Gn.prototype.constructor=Gn,Vn.prototype=Object.create(xr.prototype),Vn.prototype.constructor=Vn;var Hn=function(e,t,i){i=i||2;var r,n,o,a,s,c,h,l=t&&t.length,u=l?t[0]*i:e.length,p=jn(e,0,u,i,!0),d=[];if(!p)return d;if(l&&(p=function(e,t,i,r){var n,o,a,s,c,h=[];for(n=0,o=t.length;n80*i){r=o=e[0],n=a=e[1];for(var f=i;fo&&(o=s),c>a&&(a=c);h=0!==(h=Math.max(o-r,a-n))?1/h:0}return Xn(p,d,i,r,n,h),d};function jn(e,t,i,r,n){var o,a;if(n===function(e,t,i,r){for(var n=0,o=t,a=i-r;o0)for(o=t;o=t;o-=r)a=co(o,e[o],e[o+1],a);return a&&no(a,a.next)&&(ho(a),a=a.next),a}function Wn(e,t){if(!e)return e;t||(t=e);var i,r=e;do{if(i=!1,r.steiner||!no(r,r.next)&&0!==ro(r.prev,r,r.next))r=r.next;else{if(ho(r),(r=t=r.prev)===r.next)break;i=!0}}while(i||r!==t);return t}function Xn(e,t,i,r,n,o,a){if(e){!a&&o&&function(e,t,i,r){var n=e;do{null===n.z&&(n.z=$n(n.x,n.y,t,i,r)),n.prevZ=n.prev,n.nextZ=n.next,n=n.next}while(n!==e);n.prevZ.nextZ=null,n.prevZ=null,function(e){var t,i,r,n,o,a,s,c,h=1;do{for(i=e,e=null,o=null,a=0;i;){for(a++,r=i,s=0,t=0;t0||c>0&&r;)0!==s&&(0===c||!r||i.z<=r.z)?(n=i,i=i.nextZ,s--):(n=r,r=r.nextZ,c--),o?o.nextZ=n:e=n,n.prevZ=o,o=n;i=r}o.nextZ=null,h*=2}while(a>1)}(n)}(e,r,n,o);for(var s,c,h=e;e.prev!==e.next;)if(s=e.prev,c=e.next,o?Yn(e,r,n,o):qn(e))t.push(s.i/i),t.push(e.i/i),t.push(c.i/i),ho(e),e=c.next,h=c.next;else if((e=c)===h){a?1===a?Xn(e=Zn(e,t,i),t,i,r,n,o,2):2===a&&Jn(e,t,i,r,n,o):Xn(Wn(e),t,i,r,n,o,1);break}}}function qn(e){var t=e.prev,i=e,r=e.next;if(ro(t,i,r)>=0)return!1;for(var n=e.next.next;n!==e.prev;){if(to(t.x,t.y,i.x,i.y,r.x,r.y,n.x,n.y)&&ro(n.prev,n,n.next)>=0)return!1;n=n.next}return!0}function Yn(e,t,i,r){var n=e.prev,o=e,a=e.next;if(ro(n,o,a)>=0)return!1;for(var s=n.xo.x?n.x>a.x?n.x:a.x:o.x>a.x?o.x:a.x,l=n.y>o.y?n.y>a.y?n.y:a.y:o.y>a.y?o.y:a.y,u=$n(s,c,t,i,r),p=$n(h,l,t,i,r),d=e.nextZ;d&&d.z<=p;){if(d!==e.prev&&d!==e.next&&to(n.x,n.y,o.x,o.y,a.x,a.y,d.x,d.y)&&ro(d.prev,d,d.next)>=0)return!1;d=d.nextZ}for(d=e.prevZ;d&&d.z>=u;){if(d!==e.prev&&d!==e.next&&to(n.x,n.y,o.x,o.y,a.x,a.y,d.x,d.y)&&ro(d.prev,d,d.next)>=0)return!1;d=d.prevZ}return!0}function Zn(e,t,i){var r=e;do{var n=r.prev,o=r.next.next;!no(n,o)&&oo(n,r,r.next,o)&&ao(n,o)&&ao(o,n)&&(t.push(n.i/i),t.push(r.i/i),t.push(o.i/i),ho(r),ho(r.next),r=e=o),r=r.next}while(r!==e);return r}function Jn(e,t,i,r,n,o){var a=e;do{for(var s=a.next.next;s!==a.prev;){if(a.i!==s.i&&io(a,s)){var c=so(a,s);return a=Wn(a,a.next),c=Wn(c,c.next),Xn(a,t,i,r,n,o),void Xn(c,t,i,r,n,o)}s=s.next}a=a.next}while(a!==e)}function Qn(e,t){return e.x-t.x}function Kn(e,t){if(t=function(e,t){var i,r=t,n=e.x,o=e.y,a=-1/0;do{if(o<=r.y&&o>=r.next.y&&r.next.y!==r.y){var s=r.x+(o-r.y)*(r.next.x-r.x)/(r.next.y-r.y);if(s<=n&&s>a){if(a=s,s===n){if(o===r.y)return r;if(o===r.next.y)return r.next}i=r.x=r.x&&r.x>=l&&n!==r.x&&to(oi.x)&&ao(r,e)&&(i=r,p=c),r=r.next;return i}(e,t)){var i=so(t,e);Wn(i,i.next)}}function $n(e,t,i,r,n){return(e=1431655765&((e=858993459&((e=252645135&((e=16711935&((e=32767*(e-i)*n)|e<<8))|e<<4))|e<<2))|e<<1))|(t=1431655765&((t=858993459&((t=252645135&((t=16711935&((t=32767*(t-r)*n)|t<<8))|t<<4))|t<<2))|t<<1))<<1}function eo(e){var t=e,i=e;do{t.x=0&&(e-a)*(r-s)-(i-a)*(t-s)>=0&&(i-a)*(o-s)-(n-a)*(r-s)>=0}function io(e,t){return e.next.i!==t.i&&e.prev.i!==t.i&&!function(e,t){var i=e;do{if(i.i!==e.i&&i.next.i!==e.i&&i.i!==t.i&&i.next.i!==t.i&&oo(i,i.next,e,t))return!0;i=i.next}while(i!==e);return!1}(e,t)&&ao(e,t)&&ao(t,e)&&function(e,t){var i=e,r=!1,n=(e.x+t.x)/2,o=(e.y+t.y)/2;do{i.y>o!=i.next.y>o&&i.next.y!==i.y&&n<(i.next.x-i.x)*(o-i.y)/(i.next.y-i.y)+i.x&&(r=!r),i=i.next}while(i!==e);return r}(e,t)}function ro(e,t,i){return(t.y-e.y)*(i.x-t.x)-(t.x-e.x)*(i.y-t.y)}function no(e,t){return e.x===t.x&&e.y===t.y}function oo(e,t,i,r){return!!(no(e,t)&&no(i,r)||no(e,r)&&no(i,t))||ro(e,t,i)>0!=ro(e,t,r)>0&&ro(i,r,e)>0!=ro(i,r,t)>0}function ao(e,t){return ro(e.prev,e,e.next)<0?ro(e,t,e.next)>=0&&ro(e,e.prev,t)>=0:ro(e,t,e.prev)<0||ro(e,e.next,t)<0}function so(e,t){var i=new lo(e.i,e.x,e.y),r=new lo(t.i,t.x,t.y),n=e.next,o=t.prev;return e.next=t,t.prev=e,i.next=n,n.prev=i,r.next=i,i.prev=r,o.next=r,r.prev=o,r}function co(e,t,i,r){var n=new lo(e,t,i);return r?(n.next=r.next,n.prev=r,r.next.prev=n,r.next=n):(n.prev=n,n.next=n),n}function ho(e){e.next.prev=e.prev,e.prev.next=e.next,e.prevZ&&(e.prevZ.nextZ=e.nextZ),e.nextZ&&(e.nextZ.prevZ=e.prevZ)}function lo(e,t,i){this.i=e,this.x=t,this.y=i,this.prev=null,this.next=null,this.z=null,this.prevZ=null,this.nextZ=null,this.steiner=!1}var uo={area:function(e){for(var t=e.length,i=0,r=t-1,n=0;n2&&e[t-1].equals(e[0])&&e.pop()}function r(e,t){for(var i=0;i0)&&f.push(w,_,E),(c!==i-1||h0&&g(!0),t>0&&g(!1)),this.setIndex(h),this.addAttribute("position",new sr(l,3)),this.addAttribute("normal",new sr(u,3)),this.addAttribute("uv",new sr(p,2))}function Lo(e,t,i,r,n,o,a){Ao.call(this,0,e,t,i,r,n,o,a),this.type="ConeGeometry",this.parameters={radius:e,height:t,radialSegments:i,heightSegments:r,openEnded:n,thetaStart:o,thetaLength:a}}function Co(e,t,i,r,n,o,a){Ro.call(this,0,e,t,i,r,n,o,a),this.type="ConeBufferGeometry",this.parameters={radius:e,height:t,radialSegments:i,heightSegments:r,openEnded:n,thetaStart:o,thetaLength:a}}function Po(e,t,i,r){Ki.call(this),this.type="CircleGeometry",this.parameters={radius:e,segments:t,thetaStart:i,thetaLength:r},this.fromBufferGeometry(new No(e,t,i,r)),this.mergeVertices()}function No(e,t,i,r){xr.call(this),this.type="CircleBufferGeometry",this.parameters={radius:e,segments:t,thetaStart:i,thetaLength:r},e=e||1,t=void 0!==t?Math.max(3,t):8,i=void 0!==i?i:0,r=void 0!==r?r:2*Math.PI;var n,o,a=[],s=[],c=[],h=[],l=new yt,u=new mt;for(s.push(0,0,0),c.push(0,0,1),h.push(.5,.5),o=0,n=3;o<=t;o++,n+=3){var p=i+o/t*r;l.x=e*Math.cos(p),l.y=e*Math.sin(p),s.push(l.x,l.y,l.z),c.push(0,0,1),u.x=(s[n]/e+1)/2,u.y=(s[n+1]/e+1)/2,h.push(u.x,u.y)}for(n=1;n<=t;n++)a.push(n,n+1,0);this.setIndex(a),this.addAttribute("position",new sr(s,3)),this.addAttribute("normal",new sr(c,3)),this.addAttribute("uv",new sr(h,2))}po.prototype=Object.create(Ki.prototype),po.prototype.constructor=po,fo.prototype=Object.create(xr.prototype),fo.prototype.constructor=fo,fo.prototype.getArrays=function(){var e=this.getAttribute("position"),t=e?Array.prototype.slice.call(e.array):[],i=this.getAttribute("uv"),r=i?Array.prototype.slice.call(i.array):[],n=this.index;return{position:t,uv:r,index:n?Array.prototype.slice.call(n.array):[]}},fo.prototype.addShapeList=function(e,t){var i=e.length;t.arrays=this.getArrays();for(var r=0;rNumber.EPSILON){var p=Math.sqrt(l),d=Math.sqrt(c*c+h*h),f=t.x-s/p,m=t.y+a/p,v=((i.x-h/d-f)*h-(i.y+c/d-m)*c)/(a*h-s*c),g=(r=f+a*v-e.x)*r+(n=m+s*v-e.y)*n;if(g<=2)return new mt(r,n);o=Math.sqrt(g/2)}else{var y=!1;a>Number.EPSILON?c>Number.EPSILON&&(y=!0):a<-Number.EPSILON?c<-Number.EPSILON&&(y=!0):Math.sign(s)===Math.sign(h)&&(y=!0),y?(r=-s,n=a,o=Math.sqrt(l)):(r=a,n=s,o=Math.sqrt(l/2))}return new mt(r/o,n/o)}for(var G=[],V=0,H=C.length,j=H-1,W=V+1;V=0;N--){for(I=N/y,D=v*Math.cos(I*Math.PI/2),O=g*Math.sin(I*Math.PI/2),V=0,H=C.length;V=0;){i=V,(r=V-1)<0&&(r=e.length-1);var n=0,o=w+2*y;for(n=0;n0||0===e.search(/^data\:image\/jpeg/);n.format=r?Be:ze,n.needsUpdate=!0,void 0!==t&&t(n)},i,r),n},setCrossOrigin:function(e){return this.crossOrigin=e,this},setPath:function(e){return this.path=e,this}}),Object.assign(ea.prototype,{getPoint:function(){return console.warn("THREE.Curve: .getPoint() not implemented."),null},getPointAt:function(e,t){var i=this.getUtoTmapping(e);return this.getPoint(i,t)},getPoints:function(e){void 0===e&&(e=5);for(var t=[],i=0;i<=e;i++)t.push(this.getPoint(i/e));return t},getSpacedPoints:function(e){void 0===e&&(e=5);for(var t=[],i=0;i<=e;i++)t.push(this.getPointAt(i/e));return t},getLength:function(){var e=this.getLengths();return e[e.length-1]},getLengths:function(e){if(void 0===e&&(e=this.arcLengthDivisions),this.cacheArcLengths&&this.cacheArcLengths.length===e+1&&!this.needsUpdate)return this.cacheArcLengths;this.needsUpdate=!1;var t,i,r=[],n=this.getPoint(0),o=0;for(r.push(0),i=1;i<=e;i++)o+=(t=this.getPoint(i/e)).distanceTo(n),r.push(o),n=t;return this.cacheArcLengths=r,r},updateArcLengths:function(){this.needsUpdate=!0,this.getLengths()},getUtoTmapping:function(e,t){var i,r=this.getLengths(),n=0,o=r.length;i=t||e*r[o-1];for(var a,s=0,c=o-1;s<=c;)if((a=r[n=Math.floor(s+(c-s)/2)]-i)<0)s=n+1;else{if(!(a>0)){c=n;break}c=n-1}if(r[n=c]===i)return n/(o-1);var h=r[n];return(n+(i-h)/(r[n+1]-h))/(o-1)},getTangent:function(e){var t=e-1e-4,i=e+1e-4;t<0&&(t=0),i>1&&(i=1);var r=this.getPoint(t);return this.getPoint(i).clone().sub(r).normalize()},getTangentAt:function(e){var t=this.getUtoTmapping(e);return this.getTangent(t)},computeFrenetFrames:function(e,t){var i,r,n,o=new yt,a=[],s=[],c=[],h=new yt,l=new vt;for(i=0;i<=e;i++)r=i/e,a[i]=this.getTangentAt(r),a[i].normalize();s[0]=new yt,c[0]=new yt;var u=Number.MAX_VALUE,p=Math.abs(a[0].x),d=Math.abs(a[0].y),f=Math.abs(a[0].z);for(p<=u&&(u=p,o.set(1,0,0)),d<=u&&(u=d,o.set(0,1,0)),f<=u&&o.set(0,0,1),h.crossVectors(a[0],o).normalize(),s[0].crossVectors(a[0],h),c[0].crossVectors(a[0],s[0]),i=1;i<=e;i++)s[i]=s[i-1].clone(),c[i]=c[i-1].clone(),h.crossVectors(a[i-1],a[i]),h.length()>Number.EPSILON&&(h.normalize(),n=Math.acos(ft.clamp(a[i-1].dot(a[i]),-1,1)),s[i].applyMatrix4(l.makeRotationAxis(h,n))),c[i].crossVectors(a[i],s[i]);if(!0===t)for(n=Math.acos(ft.clamp(s[0].dot(s[e]),-1,1)),n/=e,a[0].dot(h.crossVectors(s[0],s[e]))>0&&(n=-n),i=1;i<=e;i++)s[i].applyMatrix4(l.makeRotationAxis(a[i],n*i)),c[i].crossVectors(a[i],s[i]);return{tangents:a,normals:s,binormals:c}},clone:function(){return(new this.constructor).copy(this)},copy:function(e){return this.arcLengthDivisions=e.arcLengthDivisions,this},toJSON:function(){var e={metadata:{version:4.5,type:"Curve",generator:"Curve.toJSON"}};return e.arcLengthDivisions=this.arcLengthDivisions,e.type=this.type,e},fromJSON:function(e){return this.arcLengthDivisions=e.arcLengthDivisions,this}}),ta.prototype=Object.create(ea.prototype),ta.prototype.constructor=ta,ta.prototype.isEllipseCurve=!0,ta.prototype.getPoint=function(e,t){for(var i=t||new mt,r=2*Math.PI,n=this.aEndAngle-this.aStartAngle,o=Math.abs(n)r;)n-=r;n0?0:(Math.floor(Math.abs(l)/s.length)+1)*s.length:0===u&&l===c-1&&(l=c-2,u=1),this.closed||l>0?i=s[(l-1)%c]:(na.subVectors(s[0],s[1]).add(s[0]),i=na),r=s[l%c],n=s[(l+1)%c],this.closed||l+2r.length-2?r.length-1:o+1],l=r[o>r.length-3?r.length-1:o+2];return i.set(ha(a,s.x,c.x,h.x,l.x),ha(a,s.y,c.y,h.y,l.y)),i},ya.prototype.copy=function(e){ea.prototype.copy.call(this,e),this.points=[];for(var t=0,i=e.points.length;t=t){var n=i[r]-t,o=this.curves[r],a=o.getLength(),s=0===a?0:1-n/a;return o.getPointAt(s)}r++}return null},getLength:function(){var e=this.getCurveLengths();return e[e.length-1]},updateArcLengths:function(){this.needsUpdate=!0,this.cacheLengths=null,this.getCurveLengths()},getCurveLengths:function(){if(this.cacheLengths&&this.cacheLengths.length===this.curves.length)return this.cacheLengths;for(var e=[],t=0,i=0,r=this.curves.length;i1&&!i[i.length-1].equals(i[0])&&i.push(i[0]),i},copy:function(e){ea.prototype.copy.call(this,e),this.curves=[];for(var t=0,i=e.curves.length;t0){var h=c.getPoint(0);h.equals(this.currentPoint)||this.lineTo(h.x,h.y)}this.curves.push(c);var l=c.getPoint(1);this.currentPoint.copy(l)},copy:function(e){return ba.prototype.copy.call(this,e),this.currentPoint.copy(e.currentPoint),this},toJSON:function(){var e=ba.prototype.toJSON.call(this);return e.currentPoint=this.currentPoint.toArray(),e},fromJSON:function(e){return ba.prototype.fromJSON.call(this,e),this.currentPoint.fromArray(e.currentPoint),this}}),_a.prototype=Object.assign(Object.create(wa.prototype),{constructor:_a,getPointsHoles:function(e){for(var t=[],i=0,r=this.holes.length;i=n)break e;var s=t[1];e=(n=t[--i-1]))break t}o=i,i=0}for(;i>>1;et;)--o;if(++o,0!==n||o!==r){n>=o&&(n=(o=Math.max(o,1))-1);var a=this.getValueSize();this.times=Ha.arraySlice(i,n,o),this.values=Ha.arraySlice(this.values,n*a,o*a)}return this},validate:function(){var e=!0,t=this.getValueSize();t-Math.floor(t)!=0&&(console.error("THREE.KeyframeTrack: Invalid value size in track.",this),e=!1);var i=this.times,r=this.values,n=i.length;0===n&&(console.error("THREE.KeyframeTrack: Track is empty.",this),e=!1);for(var o=null,a=0;a!==n;a++){var s=i[a];if("number"==typeof s&&isNaN(s)){console.error("THREE.KeyframeTrack: Time is not a valid number.",this,a,s),e=!1;break}if(null!==o&&o>s){console.error("THREE.KeyframeTrack: Out of order keys.",this,a,s,o),e=!1;break}o=s}if(void 0!==r&&Ha.isTypedArray(r)){a=0;for(var c=r.length;a!==c;++a){var h=r[a];if(isNaN(h)){console.error("THREE.KeyframeTrack: Value is not a valid number.",this,a,h),e=!1;break}}}return e},optimize:function(){for(var e=this.times,t=this.values,i=this.getValueSize(),r=2302===this.getInterpolation(),n=1,o=e.length-1,a=1;a0){e[n]=e[o];for(f=o*i,m=n*i,p=0;p!==i;++p)t[m+p]=t[f+p];++n}return n!==e.length&&(this.times=Ha.arraySlice(e,0,n),this.values=Ha.arraySlice(t,0,n*i)),this}}),Wa.prototype=Object.assign(Object.create(ja.prototype),{constructor:Wa,ValueTypeName:"vector"}),Object.assign(Xa,{parse:function(e){for(var t=[],i=e.tracks,r=1/(e.fps||1),n=0,o=i.length;n!==o;++n)t.push(ja.parse(i[n]).scale(r));return new Xa(e.name,e.duration,t)},toJSON:function(e){for(var t=[],i=e.tracks,r={name:e.name,duration:e.duration,tracks:t},n=0,o=i.length;n!==o;++n)t.push(ja.toJSON(i[n]));return r},CreateFromMorphTargetSequence:function(e,t,i,r){for(var n=t.length,o=[],a=0;a1){var h=r[u=c[1]];h||(r[u]=h=[]),h.push(s)}}var l=[];for(var u in r)l.push(Xa.CreateFromMorphTargetSequence(u,r[u],t,i));return l},parseAnimation:function(e,t){if(!e)return console.error("THREE.AnimationClip: No animation in JSONLoader data."),null;for(var i=function(e,t,i,r,n){if(0!==i.length){var o=[],a=[];Ha.flattenJSON(i,o,a,r),0!==o.length&&n.push(new e(t,o,a))}},r=[],n=e.name||"default",o=e.length||-1,a=e.fps||30,s=e.hierarchy||[],c=0;c1?e.skinWeights[r+1]:0,s=i>2?e.skinWeights[r+2]:0,c=i>3?e.skinWeights[r+3]:0;t.skinWeights.push(new _t(o,a,s,c))}if(e.skinIndices)for(r=0,n=e.skinIndices.length;r1?e.skinIndices[r+1]:0,u=i>2?e.skinIndices[r+2]:0,p=i>3?e.skinIndices[r+3]:0;t.skinIndices.push(new _t(h,l,u,p))}t.bones=e.bones,t.bones&&t.bones.length>0&&(t.skinWeights.length!==t.skinIndices.length||t.skinIndices.length!==t.vertices.length)&&console.warn("When skinning, number of vertices ("+t.vertices.length+"), skinIndices ("+t.skinIndices.length+"), and skinWeights ("+t.skinWeights.length+") should match.")}(e,i),function(e,t){var i=e.scale;if(void 0!==e.morphTargets)for(var r=0,n=e.morphTargets.length;r0){console.warn('THREE.JSONLoader: "morphColors" no longer supported. Using them as face colors.');var l=t.faces,u=e.morphColors[0].colors;for(r=0,n=l.length;r0&&(t.animations=i)}(e,i),i.computeFaceNormals(),i.computeBoundingSphere(),void 0===e.materials||0===e.materials.length?{geometry:i}:{geometry:i,materials:es.prototype.initMaterials(e.materials,t,this.crossOrigin)}}}()}),Object.assign(rs.prototype,{load:function(e,t,i,r){""===this.texturePath&&(this.texturePath=e.substring(0,e.lastIndexOf("/")+1));var n=this;new Yo(n.manager).load(e,function(i){var o=null;try{o=JSON.parse(i)}catch(t){return void 0!==r&&r(t),void console.error("THREE:ObjectLoader: Can't parse "+e+".",t.message)}var a=o.metadata;void 0!==a&&void 0!==a.type&&"geometry"!==a.type.toLowerCase()?n.parse(o,t):console.error("THREE.ObjectLoader: Can't load "+e+". Use THREE.JSONLoader instead.")},i,r)},setTexturePath:function(e){this.texturePath=e},setCrossOrigin:function(e){this.crossOrigin=e},parse:function(e,t){var i=this.parseShape(e.shapes),r=this.parseGeometries(e.geometries,i),n=this.parseImages(e.images,function(){void 0!==t&&t(s)}),o=this.parseTextures(e.textures,n),a=this.parseMaterials(e.materials,o),s=this.parseObject(e.object,r,a);return e.animations&&(s.animations=this.parseAnimations(e.animations)),void 0!==e.images&&0!==e.images.length||void 0!==t&&t(s),s},parseShape:function(e){var t={};if(void 0!==e)for(var i=0,r=e.length;i0){var o=new Qo(new Wo(t));o.setCrossOrigin(this.crossOrigin);for(var a=0,s=e.length;a0?new dn(s,c):new Lr(s,c);break;case"LOD":n=new ln;break;case"Line":n=new mn(o(t.geometry),a(t.material),t.mode);break;case"LineLoop":n=new gn(o(t.geometry),a(t.material));break;case"LineSegments":n=new vn(o(t.geometry),a(t.material));break;case"PointCloud":case"Points":n=new xn(o(t.geometry),a(t.material));break;case"Sprite":n=new hn(a(t.material));break;case"Group":n=new bn;break;default:n=new Xi}if(n.uuid=t.uuid,void 0!==t.name&&(n.name=t.name),void 0!==t.matrix?(e.fromArray(t.matrix),e.decompose(n.position,n.quaternion,n.scale)):(void 0!==t.position&&n.position.fromArray(t.position),void 0!==t.rotation&&n.rotation.fromArray(t.rotation),void 0!==t.quaternion&&n.quaternion.fromArray(t.quaternion),void 0!==t.scale&&n.scale.fromArray(t.scale)),void 0!==t.castShadow&&(n.castShadow=t.castShadow),void 0!==t.receiveShadow&&(n.receiveShadow=t.receiveShadow),t.shadow&&(void 0!==t.shadow.bias&&(n.shadow.bias=t.shadow.bias),void 0!==t.shadow.radius&&(n.shadow.radius=t.shadow.radius),void 0!==t.shadow.mapSize&&n.shadow.mapSize.fromArray(t.shadow.mapSize),void 0!==t.shadow.camera&&(n.shadow.camera=this.parseObject(t.shadow.camera))),void 0!==t.visible&&(n.visible=t.visible),void 0!==t.userData&&(n.userData=t.userData),void 0!==t.children)for(var h=t.children,l=0;lNumber.EPSILON){if(h<0&&(a=t[o],c=-c,s=t[n],h=-h),e.ys.y)continue;if(e.y===a.y){if(e.x===a.x)return!0}else{var l=h*(e.x-a.x)-c*(e.y-a.y);if(0===l)return!0;if(l<0)continue;r=!r}}else{if(e.y!==a.y)continue;if(s.x<=e.x&&e.x<=a.x||a.x<=e.x&&e.x<=s.x)return!0}}return r}var n=uo.isClockWise,o=this.subPaths;if(0===o.length)return[];if(!0===t)return i(o);var a,s,c,h=[];if(1===o.length)return s=o[0],(c=new _a).curves=s.curves,h.push(c),h;var l=!n(o[0].getPoints());l=e?!l:l;var u,p,d=[],f=[],m=[],v=0;f[v]=void 0,m[v]=[];for(var g=0,y=o.length;g1){for(var x=!1,b=[],w=0,_=f.length;w<_;w++)d[w]=[];for(w=0,_=f.length;w<_;w++)for(var M=m[w],E=0;E0&&(x||(m=d))}g=0;for(var R=f.length;g0){this.source.connect(this.filters[0]);for(var e=1,t=this.filters.length;e0){this.source.disconnect(this.filters[0]);for(var e=1,t=this.filters.length;e=.5)for(var o=0;o!==n;++o)e[t+o]=e[i+o]},_slerp:function(e,t,i,r){gt.slerpFlat(e,t,e,t,e,i,r)},_lerp:function(e,t,i,r,n){for(var o=1-r,a=0;a!==n;++a){var s=t+a;e[s]=e[s]*o+e[i+a]*r}}}),Object.assign(Fs.prototype,{getValue:function(e,t){this.bind();var i=this._targetGroup.nCachedObjects_,r=this._bindings[i];void 0!==r&&r.getValue(e,t)},setValue:function(e,t){for(var i=this._bindings,r=this._targetGroup.nCachedObjects_,n=i.length;r!==n;++r)i[r].setValue(e,t)},bind:function(){for(var e=this._bindings,t=this._targetGroup.nCachedObjects_,i=e.length;t!==i;++t)e[t].bind()},unbind:function(){for(var e=this._bindings,t=this._targetGroup.nCachedObjects_,i=e.length;t!==i;++t)e[t].unbind()}}),Object.assign(Bs,{Composite:Fs,create:function(e,t,i){return e&&e.isAnimationObjectGroup?new Bs.Composite(e,t,i):new Bs(e,t,i)},sanitizeNodeName:function(e){return e.replace(/\s/g,"_").replace(/[^\w-]/g,"")},parseTrackName:(_s=new RegExp("^"+/((?:[\w-]+[\/:])*)/.source+/([\w-\.]+)?/.source+/(?:\.([\w-]+)(?:\[(.+)\])?)?/.source+/\.([\w-]+)(?:\[(.+)\])?/.source+"$"),Ms=["material","materials","bones"],function(e){var t=_s.exec(e);if(!t)throw new Error("PropertyBinding: Cannot parse trackName: "+e);var i={nodeName:t[2],objectName:t[3],objectIndex:t[4],propertyName:t[5],propertyIndex:t[6]},r=i.nodeName&&i.nodeName.lastIndexOf(".");if(void 0!==r&&-1!==r){var n=i.nodeName.substring(r+1);-1!==Ms.indexOf(n)&&(i.nodeName=i.nodeName.substring(0,r),i.objectName=n)}if(null===i.propertyName||0===i.propertyName.length)throw new Error("PropertyBinding: can not parse propertyName from trackName: "+e);return i}),findNode:function(e,t){if(!t||""===t||"root"===t||"."===t||-1===t||t===e.name||t===e.uuid)return e;if(e.skeleton){var i=function(e){for(var i=0;i=t){var l=t++,u=e[l];i[u.uuid]=h,e[h]=u,i[c]=l,e[l]=s;for(var p=0,d=n;p!==d;++p){var f=r[p],m=f[l],v=f[h];f[h]=m,f[l]=v}}}this.nCachedObjects_=t},uncache:function(){for(var e=this._objects,t=e.length,i=this.nCachedObjects_,r=this._indicesByUUID,n=this._bindings,o=n.length,a=0,s=arguments.length;a!==s;++a){var c=arguments[a].uuid,h=r[c];if(void 0!==h)if(delete r[c],h0)for(var c=this._interpolants,h=this._propertyBindings,l=0,u=c.length;l!==u;++l)c[l].evaluate(a),h[l].accumulate(r,s)}else this._updateWeight(e)},_updateWeight:function(e){var t=0;if(this.enabled){t=this.weight;var i=this._weightInterpolant;if(null!==i){var r=i.evaluate(e)[0];t*=r,e>i.parameterPositions[1]&&(this.stopFading(),0===r&&(this.enabled=!1))}}return this._effectiveWeight=t,t},_updateTimeScale:function(e){var t=0;if(!this.paused){t=this.timeScale;var i=this._timeScaleInterpolant;if(null!==i)t*=i.evaluate(e)[0],e>i.parameterPositions[1]&&(this.stopWarping(),0===t?this.paused=!0:this.timeScale=t)}return this._effectiveTimeScale=t,t},_updateTime:function(e){var t=this.time+e;if(0===e)return t;var i=this._clip.duration,r=this.loop,n=this._loopCount;if(2200===r){-1===n&&(this._loopCount=0,this._setEndings(!0,!0,!1));e:{if(t>=i)t=i;else{if(!(t<0))break e;t=0}this.clampWhenFinished?this.paused=!0:this.enabled=!1,this._mixer.dispatchEvent({type:"finished",action:this,direction:e<0?-1:1})}}else{var o=2202===r;if(-1===n&&(e>=0?(n=0,this._setEndings(!0,0===this.repetitions,o)):this._setEndings(0===this.repetitions,!0,o)),t>=i||t<0){var a=Math.floor(t/i);t-=i*a,n+=Math.abs(a);var s=this.repetitions-n;if(s<0)this.clampWhenFinished?this.paused=!0:this.enabled=!1,t=e>0?i:0,this._mixer.dispatchEvent({type:"finished",action:this,direction:e>0?1:-1});else{if(0===s){var c=e<0;this._setEndings(c,!c,o)}else this._setEndings(!1,!1,o);this._loopCount=n,this._mixer.dispatchEvent({type:"loop",action:this,loopDelta:a})}}if(o&&1==(1&n))return this.time=t,i-t}return this.time=t,t},_setEndings:function(e,t,i){var r=this._interpolantSettings;i?(r.endingStart=2401,r.endingEnd=2401):(r.endingStart=e?this.zeroSlopeAtStart?2401:tt:2402,r.endingEnd=t?this.zeroSlopeAtEnd?2401:tt:2402)},_scheduleFading:function(e,t,i){var r=this._mixer,n=r.time,o=this._weightInterpolant;null===o&&(o=r._lendControlInterpolant(),this._weightInterpolant=o);var a=o.parameterPositions,s=o.sampleValues;return a[0]=n,s[0]=t,a[1]=n+e,s[1]=i,this}}),Gs.prototype=Object.assign(Object.create(i.prototype),{constructor:Gs,_bindAction:function(e,t){var i=e._localRoot||this._root,r=e._clip.tracks,n=r.length,o=e._propertyBindings,a=e._interpolants,s=i.uuid,c=this._bindingsByRootAndName,h=c[s];void 0===h&&(h={},c[s]=h);for(var l=0;l!==n;++l){var u=r[l],p=u.name,d=h[p];if(void 0!==d)o[l]=d;else{if(void 0!==(d=o[l])){null===d._cacheIndex&&(++d.referenceCount,this._addInactiveBinding(d,s,p));continue}var f=t&&t._propertyBindings[l].binding.parsedPath;++(d=new Us(Bs.create(i,p,f),u.ValueTypeName,u.getValueSize())).referenceCount,this._addInactiveBinding(d,s,p),o[l]=d}a[l].resultBuffer=d.buffer}},_activateAction:function(e){if(!this._isActiveAction(e)){if(null===e._cacheIndex){var t=(e._localRoot||this._root).uuid,i=e._clip.uuid,r=this._actionsByClip[i];this._bindAction(e,r&&r.knownActions[0]),this._addInactiveAction(e,i,t)}for(var n=e._propertyBindings,o=0,a=n.length;o!==a;++o){var s=n[o];0==s.useCount++&&(this._lendBinding(s),s.saveOriginalState())}this._lendAction(e)}},_deactivateAction:function(e){if(this._isActiveAction(e)){for(var t=e._propertyBindings,i=0,r=t.length;i!==r;++i){var n=t[i];0==--n.useCount&&(n.restoreOriginalState(),this._takeBackBinding(n))}this._takeBackAction(e)}},_initMemoryManager:function(){this._actions=[],this._nActiveActions=0,this._actionsByClip={},this._bindings=[],this._nActiveBindings=0,this._bindingsByRootAndName={},this._controlInterpolants=[],this._nActiveControlInterpolants=0;var e=this;this.stats={actions:{get total(){return e._actions.length},get inUse(){return e._nActiveActions}},bindings:{get total(){return e._bindings.length},get inUse(){return e._nActiveBindings}},controlInterpolants:{get total(){return e._controlInterpolants.length},get inUse(){return e._nActiveControlInterpolants}}}},_isActiveAction:function(e){var t=e._cacheIndex;return null!==t&&t.99999?this.quaternion.set(0,0,0,1):e.y<-.99999?this.quaternion.set(1,0,0,0):(As.set(e.z,0,-e.x).normalize(),Ss=Math.acos(e.y),this.quaternion.setFromAxisAngle(As,Ss))}),mc.prototype.setLength=function(e,t,i){void 0===t&&(t=.2*e),void 0===i&&(i=.2*t),this.line.scale.set(1,Math.max(0,e-t),1),this.line.updateMatrix(),this.cone.scale.set(i,t,i),this.cone.position.y=e,this.cone.updateMatrix()},mc.prototype.setColor=function(e){this.line.material.color.copy(e),this.cone.material.color.copy(e)},vc.prototype=Object.create(vn.prototype),vc.prototype.constructor=vc;var gc={createMultiMaterialObject:function(e,t){for(var i=new bn,r=0,n=t.length;r>5&31)/31,r=(w>>10&31)/31):(t=o,i=a,r=s)}for(var _=1;_<=3;_++){var M=g+12*_;f.push(h.getFloat32(M,!0)),f.push(h.getFloat32(M+4,!0)),f.push(h.getFloat32(M+8,!0)),m.push(y,x,b),u&&n.push(t,i,r)}}return d.addAttribute("position",new Ec.BufferAttribute(new Float32Array(f),3)),d.addAttribute("normal",new Ec.BufferAttribute(new Float32Array(m),3)),u&&(d.addAttribute("color",new Ec.BufferAttribute(new Float32Array(n),3)),d.hasColors=!0,d.alpha=c),d}(t):function(e){for(var t,i=new Ec.BufferGeometry,r=/facet([\s\S]*?)endfacet/g,n=0,o=/[\s]+([+-]?(?:\d+.\d+|\d+.|\d+|.\d+)(?:[eE][+-]?\d+)?)/.source,a=new RegExp("vertex"+o+o+o,"g"),s=new RegExp("normal"+o+o+o,"g"),c=[],h=[],l=new Ec.Vector3;null!==(t=r.exec(e));){for(var u=0,p=0,d=t[0];null!==(t=s.exec(d));)l.x=parseFloat(t[1]),l.y=parseFloat(t[2]),l.z=parseFloat(t[3]),p++;for(;null!==(t=a.exec(d));)c.push(parseFloat(t[1]),parseFloat(t[2]),parseFloat(t[3])),h.push(l.x,l.y,l.z),u++;1!==p&&console.error("THREE.STLLoader: Something isn't right with the normal of face number "+n),3!==u&&console.error("THREE.STLLoader: Something isn't right with the vertices of face number "+n),n++}return i.addAttribute("position",new Ec.Float32BufferAttribute(c,3)),i.addAttribute("normal",new Ec.Float32BufferAttribute(h,3)),i}(function(e){if("string"!=typeof e){var t=new Uint8Array(e);if(void 0!==window.TextDecoder)return(new TextDecoder).decode(t);for(var i="",r=0,n=e.byteLength;r0&&t.push(new Ec.VectorKeyframeTrack(r+".position",n,o)),a.length>0&&t.push(new Ec.QuaternionKeyframeTrack(r+".quaternion",n,a)),s.length>0&&t.push(new Ec.VectorKeyframeTrack(r+".scale",n,s)),t}function b(e,t,i){var r,n,o,a=!0;for(n=0,o=e.length;n=0;){var r=e[t];if(null!==r.value[i])return r;t--}return null}function _(e,t,i){for(;t0&&p.addAttribute("position",new Ec.Float32BufferAttribute(n.array,n.stride)),o.array.length>0&&p.addAttribute("normal",new Ec.Float32BufferAttribute(o.array,o.stride)),s.array.length>0&&p.addAttribute("color",new Ec.Float32BufferAttribute(s.array,s.stride)),a.array.length>0&&p.addAttribute("uv",new Ec.Float32BufferAttribute(a.array,a.stride)),c.length>0&&p.addAttribute("skinIndex",new Ec.Float32BufferAttribute(c,h)),l.length>0&&p.addAttribute("skinWeight",new Ec.Float32BufferAttribute(l,u)),r.data=p,r.type=e[0].type,r.materialKeys=d,r}function ie(e,t,i,r){var n=e.p,o=e.stride,a=e.vcount;function s(e){for(var t=n[e+i]*l,o=t+l;t0&&console.log("THREE.ColladaLoader: Geometry has faces with more than 4 vertices.")}else for(p=0,d=n.length;p=t.limits.max&&(t.static=!0),t.middlePosition=(t.limits.min+t.limits.max)/2,t}function ce(e){for(var t={sid:e.getAttribute("sid"),name:e.getAttribute("name")||"",attachments:[],transforms:[]},i=0;ir.limits.max||t0){var q=this.msgColor,Y=document.createElement("canvas"),Z=Y.getContext("2d");Z.font="normal 100px sans-serif";var J=Z.measureText(i.text).width;Y.width=J,Y.height=150,Z.font="normal 100px sans-serif",Z.fillStyle="rgba("+Math.round(255*q.r)+", "+Math.round(255*q.g)+", "+Math.round(255*q.b)+", "+q.a+")",Z.textAlign="left",Z.textBaseline="middle",Z.fillText(i.text,0,Y.height/2);var Q=new Ec.Texture(Y);Q.needsUpdate=!0;var K=new Ec.SpriteMaterial({map:Q,useScreenCoordinates:!1}),$=new Ec.Sprite(K),ee=i.scale.x;$.scale.set(J/Y.height*ee,ee,1),this.add($)}break;case Dc:var te=null;0===i.color.r&&0===i.color.g&&0===i.color.b&&0===i.color.a||(te=r),this.msgMesh=i.mesh_resource.substr(10);var ie=new rh({path:t,resource:this.msgMesh,material:te});this.add(ie);break;case Uc:var re=new nh({material:r,vertices:i.points,colors:i.colors});re.scale.set(i.scale.x,i.scale.y,i.scale.z),this.add(re);break;default:console.error("Currently unsupported marker type: "+i.type)}}setPose(e){this.position.x=e.position.x,this.position.y=e.position.y,this.position.z=e.position.z,this.quaternion.set(e.orientation.x,e.orientation.y,e.orientation.z,e.orientation.w),this.quaternion.normalize(),this.updateMatrixWorld()}update(e){if(this.setPose(e.pose),e.color.r!==this.msgColor.r||e.color.g!==this.msgColor.g||e.color.b!==this.msgColor.b||e.color.a!==this.msgColor.a){var t=Kc(e.color.r,e.color.g,e.color.b,e.color.a);switch(e.type){case Lc:case Cc:case Oc:break;case Tc:case Sc:case Ac:case Rc:case Uc:case Ic:this.traverse(function(e){e instanceof Ec.Mesh&&(e.material=t)});break;case Dc:var i=null;0===e.color.r&&0===e.color.g&&0===e.color.b&&0===e.color.a||(i=this.colorMaterial),this.traverse(function(e){e instanceof Ec.Mesh&&(e.material=i)});break;case Pc:case Nc:default:return!1}this.msgColor=e.color}var r=Math.abs(this.msgScale[0]-e.scale.x)>1e-6||Math.abs(this.msgScale[1]-e.scale.y)>1e-6||Math.abs(this.msgScale[2]-e.scale.z)>1e-6;switch(this.msgScale=[e.scale.x,e.scale.y,e.scale.z],e.type){case Sc:case Ac:case Rc:if(r)return!1;break;case Ic:if(r||this.text!==e.text)return!1;break;case Dc:if(e.mesh_resource.substr(10)!==this.msgMesh)return!1;if(r)return!1;break;case Tc:case Lc:case Cc:case Pc:case Nc:case Oc:case Uc:return!1}return!0}dispose(){this.children.forEach(function(e){e instanceof rh?e.children.forEach(function(t){void 0!==t.material&&t.material.dispose(),t.children.forEach(function(e){void 0!==e.geometry&&e.geometry.dispose(),void 0!==e.material&&e.material.dispose(),t.remove(e)}),e.remove(t)}):(void 0!==e.geometry&&e.geometry.dispose(),void 0!==e.material&&e.material.dispose()),e.parent.remove(e)})}}class ah extends Ec.Object3D{constructor(e){super();var i=this;e=e||{},this.parent=e.parent;var r=e.handle,n=e.message;this.message=n,this.name=n.name,this.camera=e.camera,this.path=e.path||"/",this.loader=e.loader,this.dragging=!1,this.startMousePos=new Ec.Vector2,this.isShift=!1;var o=new Ec.Quaternion(n.orientation.x,n.orientation.y,n.orientation.z,n.orientation.w);o.normalize();var a=new Ec.Vector3(1,0,0);switch(a.applyQuaternion(o),this.currentControlOri=new Ec.Quaternion,n.interaction_mode){case Yc:case qc:this.addEventListener("mousemove",this.parent.move3d.bind(this.parent,this,a));case jc:this.addEventListener("mousemove",this.parent.moveAxis.bind(this.parent,this,a)),this.addEventListener("touchmove",this.parent.moveAxis.bind(this.parent,this,a));break;case Xc:this.addEventListener("mousemove",this.parent.rotateAxis.bind(this.parent,this,o));break;case Wc:this.addEventListener("mousemove",this.parent.movePlane.bind(this.parent,this,a));break;case Hc:this.addEventListener("click",this.parent.buttonClick.bind(this.parent,this))}function s(e){e.stopPropagation()}n.interaction_mode!==Vc&&(this.addEventListener("mousedown",this.parent.startDrag.bind(this.parent,this)),this.addEventListener("mouseup",this.parent.stopDrag.bind(this.parent,this)),this.addEventListener("contextmenu",this.parent.showMenu.bind(this.parent,this)),this.addEventListener("mouseup",function(e){0===i.startMousePos.distanceToSquared(e.mousePos)&&(e.type="contextmenu",i.dispatchEvent(e))}),this.addEventListener("mouseover",s),this.addEventListener("mouseout",s),this.addEventListener("click",s),this.addEventListener("mousedown",function(e){i.startMousePos=e.mousePos}),this.addEventListener("touchstart",function(e){1===e.domEvent.touches.length&&(e.type="mousedown",e.domEvent.button=0,i.dispatchEvent(e))}),this.addEventListener("touchmove",function(e){1===e.domEvent.touches.length&&(e.type="mousemove",e.domEvent.button=0,i.dispatchEvent(e))}),this.addEventListener("touchend",function(e){0===e.domEvent.touches.length&&(e.domEvent.button=0,e.type="mouseup",i.dispatchEvent(e),e.type="click",i.dispatchEvent(e))}),window.addEventListener("keydown",function(e){16===e.keyCode&&(i.isShift=!0)}),window.addEventListener("keyup",function(e){16===e.keyCode&&(i.isShift=!1)}));var c=new Ec.Quaternion,h=this.parent.position.clone().multiplyScalar(-1);switch(n.orientation_mode){case Zc:c=this.parent.quaternion.clone().inverse();break;case Jc:case Qc:break;default:console.error("Unkown orientation mode: "+n.orientation_mode)}var l=new t.TFClient({ros:r.tfClient.ros,fixedFrame:r.message.header.frame_id,serverName:r.tfClient.serverName});n.markers.forEach(function(e){var r=function(r){var n=new oh({message:e,path:i.path,loader:i.loader});if(null!==r){var o=new t.Pose({position:n.position,orientation:n.quaternion});o.applyTransform(new t.Transform(r));var a=new oh({message:e,path:i.path,loader:i.loader});a.position.add(h),a.position.applyQuaternion(c),a.quaternion.multiplyQuaternions(c,a.quaternion);var s=new Ec.Vector3(a.position.x,a.position.y,a.position.z),u=new t.Transform({translation:s,orientation:a.quaternion});o.applyTransform(u),n.setPose(o),n.updateMatrixWorld(),l.unsubscribe(e.header.frame_id)}i.add(n)};""!==e.header.frame_id?l.subscribe(e.header.frame_id,r):r(null)})}updateMatrixWorld(e){var t=this.message;switch(t.orientation_mode){case Zc:super.updateMatrixWorld(e),this.currentControlOri.copy(this.quaternion),this.currentControlOri.normalize();break;case Jc:this.quaternion.copy(this.parent.quaternion.clone().inverse()),this.updateMatrix(),this.matrixWorldNeedsUpdate=!0,super.updateMatrixWorld(e),this.currentControlOri.copy(this.quaternion);break;case Qc:this.camera.updateMatrixWorld();var i=(new Ec.Matrix4).extractRotation(this.camera.matrixWorld),r=new Ec.Matrix4,n=.5*Math.PI,o=new Ec.Euler(-n,0,n);r.makeRotationFromEuler(o);var a=new Ec.Matrix4;a.getInverse(this.parent.matrixWorld),i.multiplyMatrices(i,r),i.multiplyMatrices(a,i),this.currentControlOri.setFromRotationMatrix(i),t.independent_marker_orientation||(this.quaternion.copy(this.currentControlOri),this.updateMatrix(),this.matrixWorldNeedsUpdate=!0),super.updateMatrixWorld(e);break;default:console.error("Unkown orientation mode: "+t.orientation_mode)}}}class sh extends Ec.EventDispatcher{constructor(e){super();var t,i,r,n=this,o=(e=e||{}).menuEntries,a=e.className||"default-interactive-marker-menu",s=(e.entryClassName,e.overlayClassName||"default-interactive-marker-overlay"),c=e.menuFontSize||"0.8em",h=[];if(h[0]={children:[]},null===document.getElementById("default-interactive-marker-menu-css")){var l=document.createElement("style");l.id="default-interactive-marker-menu-css",l.type="text/css",l.innerHTML=".default-interactive-marker-menu {background-color: #444444;border: 1px solid #888888;border: 1px solid #888888;padding: 0px 0px 0px 0px;color: #FFFFFF;font-family: sans-serif;font-size: "+c+";z-index: 1002;}.default-interactive-marker-menu ul {padding: 0px 0px 5px 0px;margin: 0px;list-style-type: none;}.default-interactive-marker-menu ul li div {-webkit-touch-callout: none;-webkit-user-select: none;-khtml-user-select: none;-moz-user-select: none;-ms-user-select: none;user-select: none;cursor: default;padding: 3px 10px 3px 10px;}.default-interactive-marker-menu-entry:hover { background-color: #666666; cursor: pointer;}.default-interactive-marker-menu ul ul { font-style: italic; padding-left: 10px;}.default-interactive-marker-overlay { position: absolute; top: 0%; left: 0%; width: 100%; height: 100%; background-color: black; z-index: 1001; -moz-opacity: 0.0; opacity: .0; filter: alpha(opacity = 0);}",document.getElementsByTagName("head")[0].appendChild(l)}for(this.menuDomElem=document.createElement("div"),this.menuDomElem.style.position="absolute",this.menuDomElem.className=a,this.menuDomElem.addEventListener("contextmenu",function(e){e.preventDefault()}),this.overlayDomElem=document.createElement("div"),this.overlayDomElem.className=s,this.hideListener=this.hide.bind(this),this.overlayDomElem.addEventListener("contextmenu",this.hideListener),this.overlayDomElem.addEventListener("click",this.hideListener),this.overlayDomElem.addEventListener("touchstart",this.hideListener),t=0;t0?(e(s,o[a]),c.addEventListener("click",n.hide.bind(n)),c.addEventListener("touchstart",n.hide.bind(n))):(c.addEventListener("click",p.bind(n,o[a])),c.addEventListener("touchstart",p.bind(n,o[a])),c.className="default-interactive-marker-menu-entry")}}(this.menuDomElem,h[0])}show(e,t){t&&t.preventDefault&&t.preventDefault(),this.controlName=e.name,void 0!==t.domEvent.changedTouches?(this.menuDomElem.style.left=t.domEvent.changedTouches[0].pageX+"px",this.menuDomElem.style.top=t.domEvent.changedTouches[0].pageY+"px"):(this.menuDomElem.style.left=t.domEvent.clientX+"px",this.menuDomElem.style.top=t.domEvent.clientY+"px"),document.body.appendChild(this.overlayDomElem),document.body.appendChild(this.menuDomElem)}hide(e){e&&e.preventDefault&&e.preventDefault(),document.body.removeChild(this.overlayDomElem),document.body.removeChild(this.menuDomElem)}}class ch extends Ec.Object3D{constructor(e){super();var t=this,i=(e=e||{}).handle;this.name=i.name;var r=e.camera,n=e.path||"/",o=e.loader;this.dragging=!1,this.onServerSetPose({pose:i.pose}),this.dragStart={position:new Ec.Vector3,orientation:new Ec.Quaternion,positionWorld:new Ec.Vector3,orientationWorld:new Ec.Quaternion,event3d:{}},i.controls.forEach(function(e){t.add(new ah({parent:t,handle:i,message:e,camera:r,path:n,loader:o}))}),i.menuEntries.length>0&&(this.menu=new sh({menuEntries:i.menuEntries,menuFontSize:i.menuFontSize}),this.menu.addEventListener("menu-select",function(e){t.dispatchEvent(e)}))}showMenu(e,t){this.menu&&this.menu.show(e,t)}moveAxis(e,t,i){if(this.dragging){var r=e.currentControlOri,n=t.clone().applyQuaternion(r),o=this.dragStart.event3d.intersection.point,a=n.clone().applyQuaternion(this.dragStart.orientationWorld.clone()),s=new Ec.Ray(o,a),c=th(s,i.camera,i.mousePos),h=new Ec.Vector3;h.addVectors(this.dragStart.position,n.clone().applyQuaternion(this.dragStart.orientation).multiplyScalar(c)),this.setPosition(e,h),i.stopPropagation()}}move3d(e,t,i){if(this.dragging)if(e.isShift);else{var r=e.camera.getWorldDirection(),n=Math.abs(r.x),o=Math.abs(r.y),a=Math.abs(r.z),s=new Ec.Quaternion(1,0,0,1);o>n&&o>a?s=new Ec.Quaternion(0,0,1,1):a>n&&a>o&&(s=new Ec.Quaternion(0,1,0,1)),s.normalize(),(t=new Ec.Vector3(1,0,0)).applyQuaternion(s),this.movePlane(e,t,i)}}movePlane(e,t,i){if(this.dragging){var r=e.currentControlOri,n=t.clone().applyQuaternion(r),o=this.dragStart.event3d.intersection.point,a=n.clone().applyQuaternion(this.dragStart.orientationWorld),s=$c(i.mouseRay,o,a),c=new Ec.Vector3;c.subVectors(s,o),c.add(this.dragStart.positionWorld),this.setPosition(e,c),i.stopPropagation()}}rotateAxis(e,t,i){if(this.dragging){e.updateMatrixWorld();var r=e.currentControlOri.clone().multiply(t.clone()),n=new Ec.Vector3(1,0,0).applyQuaternion(r),o=this.dragStart.event3d.intersection.point,a=n.applyQuaternion(this.dragStart.orientationWorld),s=$c(i.mouseRay,o,a),c=new Ec.Ray(this.dragStart.positionWorld,a),h=$c(c,o,a),l=this.dragStart.orientationWorld.clone().multiply(r).clone().inverse();s.sub(h),s.applyQuaternion(l);var u=this.dragStart.event3d.intersection.point.clone();u.sub(h),u.applyQuaternion(l);var p=Math.atan2(s.y,s.z),d=Math.atan2(u.y,u.z)-p,f=new Ec.Quaternion;f.setFromAxisAngle(n,d),this.setOrientation(e,f.multiply(this.dragStart.orientationWorld)),i.stopPropagation()}}feedbackEvent(e,t){this.dispatchEvent({type:e,position:this.position.clone(),orientation:this.quaternion.clone(),controlName:t.name})}startDrag(e,t){if(0===t.domEvent.button){t.stopPropagation(),this.dragging=!0,this.updateMatrixWorld(!0);var i=new Ec.Vector3;this.matrixWorld.decompose(this.dragStart.positionWorld,this.dragStart.orientationWorld,i),this.dragStart.position=this.position.clone(),this.dragStart.orientation=this.quaternion.clone(),this.dragStart.event3d=t,this.feedbackEvent("user-mousedown",e)}}stopDrag(e,t){0===t.domEvent.button&&(t.stopPropagation(),this.dragging=!1,this.dragStart.event3d={},this.onServerSetPose(this.bufferedPoseEvent),this.bufferedPoseEvent=void 0,this.feedbackEvent("user-mouseup",e))}buttonClick(e,t){t.stopPropagation(),this.feedbackEvent("user-button-click",e)}setPosition(e,t){this.position.copy(t),this.feedbackEvent("user-pose-change",e)}setOrientation(e,t){t.normalize(),this.quaternion.copy(t),this.feedbackEvent("user-pose-change",e)}onServerSetPose(e){if(void 0!==e)if(this.dragging)this.bufferedPoseEvent=e;else{var t=e.pose;this.position.copy(t.position),this.quaternion.copy(t.orientation),this.updateMatrixWorld(!0)}}dispose(){var e=this;this.children.forEach(function(t){t.children.forEach(function(e){e.dispose(),t.remove(e)}),e.remove(t)})}}var hh,lh=(function(e,t){!function(t){var i=Array.isArray?Array.isArray:function(e){return"[object Array]"===Object.prototype.toString.call(e)},r=10;function n(){this._events={},this._conf&&o.call(this,this._conf)}function o(e){e?(this._conf=e,e.delimiter&&(this.delimiter=e.delimiter),this._maxListeners=e.maxListeners!==t?e.maxListeners:r,e.wildcard&&(this.wildcard=e.wildcard),e.newListener&&(this.newListener=e.newListener),e.verboseMemoryLeak&&(this.verboseMemoryLeak=e.verboseMemoryLeak),this.wildcard&&(this.listenerTree={})):this._maxListeners=r}function a(e,t){var i="(node) warning: possible EventEmitter memory leak detected. "+e+" listeners added. Use emitter.setMaxListeners() to increase limit.";if(this.verboseMemoryLeak&&(i+=" Event name: "+t+"."),"undefined"!=typeof process&&process.emitWarning){var r=new Error(i);r.name="MaxListenersExceededWarning",r.emitter=this,r.count=e,process.emitWarning(r)}else console.error(i),console.trace&&console.trace()}function s(e){this._events={},this.newListener=!1,this.verboseMemoryLeak=!1,o.call(this,e)}function c(e,t,i,r){if(!i)return[];var n,o,a,s,h,l,u,p=[],d=t.length,f=t[r],m=t[r+1];if(r===d&&i._listeners){if("function"==typeof i._listeners)return e&&e.push(i._listeners),[i];for(n=0,o=i._listeners.length;n3)for(t=new Array(s),o=0;o3)for(t=new Array(s-1),o=1;o3)for(t=new Array(h),o=1;o3)for(t=new Array(h-1),o=1;o0&&o._listeners.length>this._maxListeners&&(o._listeners.warned=!0,a.call(this,o._listeners.length,s))):o._listeners=i,!0;s=e.shift()}return!0}.call(this,e,i),this):(this._events[e]?("function"==typeof this._events[e]&&(this._events[e]=[this._events[e]]),r?this._events[e].unshift(i):this._events[e].push(i),!this._events[e].warned&&this._maxListeners>0&&this._events[e].length>this._maxListeners&&(this._events[e].warned=!0,a.call(this,this._events[e].length,e))):this._events[e]=i,this)},s.prototype.off=function(e,r){if("function"!=typeof r)throw new Error("removeListener only takes instances of Function");var n,o=[];if(this.wildcard){var a="string"==typeof e?e.split(this.delimiter):e.slice();o=c.call(this,null,a,this.listenerTree,0)}else{if(!this._events[e])return this;n=this._events[e],o.push({_listeners:n})}for(var s=0;s0&&e(i[o]),0===Object.keys(a).length&&delete i[o])}}}(this.listenerTree),this},s.prototype.offAny=function(e){var t,i=0,r=0;if(e&&this._all&&this._all.length>0){for(i=0,r=(t=this._all).length;i=8&&(a-=8,t[s++]=o>>>a&255,s%i==0&&(n+=Math.ceil((l-a)/6),(a%=8)>0&&(o=vh.e[e.charAt(n)])));return Math.floor(s/i)}vh.S="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",vh.e={};for(var gh=0;gh<64;gh++)vh.e[vh.S.charAt(gh)]=gh;class yh extends Ec.Object3D{constructor(e){var i=(e=e||{}).urdfModel,r=e.path||"/",n=e.tfClient,o=e.tfPrefix||"",a=e.loader;super();var s=i.links;for(var c in s)for(var h=s[c],l=0;l0?(r=f[0].object,d.intersection=this.lastIntersection=f[0]):r=this.fallbackTarget,r!==this.lastTarget&&e.type.match(/mouse/)){var m=this.notify(r,"mouseover",d);0===m?this.notify(this.lastTarget,"mouseout",d):1===m&&(r=this.fallbackTarget)!==this.lastTarget&&(this.notify(r,"mouseover",d),this.notify(this.lastTarget,"mouseout",d))}r!==this.lastTarget&&e.type.match(/touch/)&&(this.notify(r,e.type,d)?(this.notify(this.lastTarget,"touchleave",d),this.notify(this.lastTarget,"touchend",d)):(r=this.fallbackTarget)!==this.lastTarget&&(this.notify(this.lastTarget,"touchmove",d),this.notify(this.lastTarget,"touchend",d)));this.notify(r,e.type,d),"mousedown"!==e.type&&"touchstart"!==e.type&&"touchmove"!==e.type||(this.dragging=!0),this.lastTarget=r}notify(e,t,i){for(i.type=t,i.cancelBubble=!1,i.continueBubble=!1,i.stopPropagation=function(){i.cancelBubble=!0},i.continuePropagation=function(){i.continueBubble=!0},i.currentTarget=e;i.currentTarget;){if(i.currentTarget.dispatchEvent&&i.currentTarget.dispatchEvent instanceof Function){if(i.currentTarget.dispatchEvent(i),i.cancelBubble)return this.dispatchEvent(i),0;if(i.continueBubble)return 2}i.currentTarget=i.currentTarget.parent}return 1}}class wh extends Ec.EventDispatcher{constructor(e){super();var t=this,i=(e=e||{}).scene;this.camera=e.camera,this.center=new Ec.Vector3,this.userZoom=!0,this.userZoomSpeed=e.userZoomSpeed||1,this.userRotate=!0,this.userRotateSpeed=e.userRotateSpeed||1,this.autoRotate=e.autoRotate,this.autoRotateSpeed=e.autoRotateSpeed||2,this.displayPanAndZoomFrame=void 0===e.displayPanAndZoomFrame||!!e.displayPanAndZoomFrame,this.lineTypePanAndZoomFrame=e.dashedPanAndZoomFrame||"full",this.camera.up=new Ec.Vector3(0,0,1);var r=1800,n=10,o=new Ec.Vector2,a=new Ec.Vector2,s=new Ec.Vector2,c=new Ec.Vector2,h=new Ec.Vector2,l=new Ec.Vector2,u=new Ec.Vector3,p=new Ec.Vector3,d=new Ec.Vector3,f=new Ec.Vector3,m=new Array(2),v=new Array(2);this.phiDelta=0,this.thetaDelta=0,this.scale=1,this.lastPosition=new Ec.Vector3;var g={NONE:-1,ROTATE:0,ZOOM:1,MOVE:2},y=g.NONE;function x(e,t,i){var r=new Ec.Vector3;new Ec.Vector3;r.subVectors(t,e.origin);var n=e.direction.dot(i);if(Math.abs(n)0?t.zoomIn():t.zoomOut(),this.showAxes()}}this.axes=new dh({shaftRadius:.025,headRadius:.07,headLength:.2,lineType:this.lineTypePanAndZoomFrame}),this.displayPanAndZoomFrame&&(i.add(this.axes),this.axes.traverse(function(e){e.visible=!1})),this.addEventListener("mousedown",function(e){var i=e.domEvent;switch(i.preventDefault(),i.button){case 0:y=g.ROTATE,o.set(i.clientX,i.clientY);break;case 1:y=g.MOVE,p=new Ec.Vector3(0,0,1);var r=(new Ec.Matrix4).extractRotation(this.camera.matrix);p.applyMatrix4(r),u=t.center.clone(),d=t.camera.position.clone(),f=x(e.mouseRay,u,p);break;case 2:y=g.ZOOM,c.set(i.clientX,i.clientY)}this.showAxes()}),this.addEventListener("mouseup",function(e){t.userRotate&&(y=g.NONE)}),this.addEventListener("mousemove",function(e){var i=e.domEvent;if(y===g.ROTATE)a.set(i.clientX,i.clientY),s.subVectors(a,o),t.rotateLeft(2*Math.PI*s.x/r*t.userRotateSpeed),t.rotateUp(2*Math.PI*s.y/r*t.userRotateSpeed),o.copy(a),this.showAxes();else if(y===g.ZOOM)h.set(i.clientX,i.clientY),l.subVectors(h,c),l.y>0?t.zoomIn():t.zoomOut(),c.copy(h),this.showAxes();else if(y===g.MOVE){var n=x(e.mouseRay,t.center,p);if(!n)return;var m=(new Ec.Vector3).subVectors(f.clone(),n.clone());t.center.addVectors(u.clone(),m.clone()),t.camera.position.addVectors(d.clone(),m.clone()),t.update(),t.camera.updateMatrixWorld(),this.showAxes()}}),this.addEventListener("touchstart",function(e){var i=e.domEvent;switch(i.touches.length){case 1:y=g.ROTATE,o.set(i.touches[0].pageX-window.scrollX,i.touches[0].pageY-window.scrollY);break;case 2:y=g.NONE,p=new Ec.Vector3(0,0,1);var r=(new Ec.Matrix4).extractRotation(this.camera.matrix);p.applyMatrix4(r),u=t.center.clone(),d=t.camera.position.clone(),f=x(e.mouseRay,u,p),m[0]=new Ec.Vector2(i.touches[0].pageX,i.touches[0].pageY),m[1]=new Ec.Vector2(i.touches[1].pageX,i.touches[1].pageY),v[0]=new Ec.Vector2(0,0),v[1]=new Ec.Vector2(0,0)}this.showAxes(),i.preventDefault()}),this.addEventListener("touchmove",function(e){var i=e.domEvent;if(y===g.ROTATE)a.set(i.touches[0].pageX-window.scrollX,i.touches[0].pageY-window.scrollY),s.subVectors(a,o),t.rotateLeft(2*Math.PI*s.x/r*t.userRotateSpeed),t.rotateUp(2*Math.PI*s.y/r*t.userRotateSpeed),o.copy(a),this.showAxes();else{if(v[0].set(m[0].x-i.touches[0].pageX,m[0].y-i.touches[0].pageY),v[1].set(m[1].x-i.touches[1].pageX,m[1].y-i.touches[1].pageY),v[0].lengthSq()>n&&v[1].lengthSq()>n&&(m[0].set(i.touches[0].pageX,i.touches[0].pageY),m[1].set(i.touches[1].pageX,i.touches[1].pageY),v[0].dot(v[1])>0&&y!==g.ZOOM?y=g.MOVE:v[0].dot(v[1])<0&&y!==g.MOVE&&(y=g.ZOOM),y===g.ZOOM)){var c=new Ec.Vector2;c.subVectors(m[0],m[1]),v[0].dot(c)<0&&v[1].dot(c)>0?t.zoomOut():v[0].dot(c)>0&&v[1].dot(c)<0&&t.zoomIn()}if(y===g.MOVE){var h=x(e.mouseRay,t.center,p);if(!h)return;var l=(new Ec.Vector3).subVectors(f.clone(),h.clone());t.center.addVectors(u.clone(),l.clone()),t.camera.position.addVectors(d.clone(),l.clone()),t.update(),t.camera.updateMatrixWorld()}this.showAxes(),i.preventDefault()}}),this.addEventListener("touchend",function(e){var t=e.domEvent;1===t.touches.length&&y!==g.ROTATE?(y=g.ROTATE,o.set(t.touches[0].pageX-window.scrollX,t.touches[0].pageY-window.scrollY)):y=g.NONE}),this.addEventListener("mousewheel",b),this.addEventListener("DOMMouseScroll",b)}showAxes(){var e=this;this.axes.traverse(function(e){e.visible=!0}),this.hideTimeout&&clearTimeout(this.hideTimeout),this.hideTimeout=setTimeout(function(){e.axes.traverse(function(e){e.visible=!1}),e.hideTimeout=!1},1e3)}rotateLeft(e){void 0===e&&(e=2*Math.PI/60/60*this.autoRotateSpeed),this.thetaDelta-=e}rotateRight(e){void 0===e&&(e=2*Math.PI/60/60*this.autoRotateSpeed),this.thetaDelta+=e}rotateUp(e){void 0===e&&(e=2*Math.PI/60/60*this.autoRotateSpeed),this.phiDelta-=e}rotateDown(e){void 0===e&&(e=2*Math.PI/60/60*this.autoRotateSpeed),this.phiDelta+=e}zoomIn(e){void 0===e&&(e=Math.pow(.95,this.userZoomSpeed)),this.scale/=e}zoomOut(e){void 0===e&&(e=Math.pow(.95,this.userZoomSpeed)),this.scale*=e}update(){var e=this.camera.position,t=e.clone().sub(this.center),i=Math.atan2(t.y,t.x),r=Math.atan2(Math.sqrt(t.y*t.y+t.x*t.x),t.z);this.autoRotate&&this.rotateLeft(2*Math.PI/60/60*this.autoRotateSpeed),i+=this.thetaDelta,r+=this.phiDelta;r=Math.max(1e-6,Math.min(Math.PI-1e-6,r));var n=t.length();t.set(n*Math.sin(r)*Math.cos(i),n*Math.sin(r)*Math.sin(i),n*Math.cos(r)),t.multiplyScalar(this.scale),e.copy(this.center).add(t),this.camera.lookAt(this.center),n=t.length(),this.axes.position.copy(this.center),this.axes.scale.set(.05*n,.05*n,.05*n),this.axes.updateMatrixWorld(!0),this.thetaDelta=0,this.phiDelta=0,this.scale=1,this.lastPosition.distanceTo(this.camera.position)>0&&(this.dispatchEvent({type:"change"}),this.lastPosition.copy(this.camera.position))}}return e.MARKER_ARROW=Tc,e.MARKER_CUBE=Sc,e.MARKER_SPHERE=Ac,e.MARKER_CYLINDER=Rc,e.MARKER_LINE_STRIP=Lc,e.MARKER_LINE_LIST=Cc,e.MARKER_CUBE_LIST=Pc,e.MARKER_SPHERE_LIST=Nc,e.MARKER_POINTS=Oc,e.MARKER_TEXT_VIEW_FACING=Ic,e.MARKER_MESH_RESOURCE=Dc,e.MARKER_TRIANGLE_LIST=Uc,e.INTERACTIVE_MARKER_KEEP_ALIVE=0,e.INTERACTIVE_MARKER_POSE_UPDATE=Fc,e.INTERACTIVE_MARKER_MENU_SELECT=Bc,e.INTERACTIVE_MARKER_BUTTON_CLICK=zc,e.INTERACTIVE_MARKER_MOUSE_DOWN=kc,e.INTERACTIVE_MARKER_MOUSE_UP=Gc,e.INTERACTIVE_MARKER_NONE=Vc,e.INTERACTIVE_MARKER_MENU=1,e.INTERACTIVE_MARKER_BUTTON=Hc,e.INTERACTIVE_MARKER_MOVE_AXIS=jc,e.INTERACTIVE_MARKER_MOVE_PLANE=Wc,e.INTERACTIVE_MARKER_ROTATE_AXIS=Xc,e.INTERACTIVE_MARKER_MOVE_ROTATE=6,e.INTERACTIVE_MARKER_MOVE_3D=qc,e.INTERACTIVE_MARKER_ROTATE_3D=8,e.INTERACTIVE_MARKER_MOVE_ROTATE_3D=Yc,e.INTERACTIVE_MARKER_INHERIT=Zc,e.INTERACTIVE_MARKER_FIXED=Jc,e.INTERACTIVE_MARKER_VIEW_FACING=Qc,e.makeColorMaterial=Kc,e.intersectPlane=$c,e.findClosestPoint=eh,e.closestAxisPoint=th,e.DepthCloud=class extends Ec.Object3D{constructor(e){super(),e=e||{},this.url=e.url,this.streamType=e.streamType||"vp8",this.f=e.f||526,this.maxDepthPerTile=e.maxDepthPerTile||1,this.pointSize=e.pointSize||3,this.width=e.width||1024,this.height=e.height||1024,this.resolutionFactor=Math.max(this.width,this.height)/1024,this.whiteness=e.whiteness||0,this.varianceThreshold=e.varianceThreshold||16667e-9,this.isMjpeg="mjpeg"===this.streamType.toLowerCase(),this.video=document.createElement(this.isMjpeg?"img":"video"),this.video.addEventListener(this.isMjpeg?"load":"loadedmetadata",this.metaLoaded.bind(this),!1),this.isMjpeg||(this.video.loop=!0),this.video.src=this.url,this.video.crossOrigin="Anonymous",this.video.setAttribute("crossorigin","Anonymous"),this.vertex_shader=["uniform sampler2D map;","","uniform float width;","uniform float height;","uniform float nearClipping, farClipping;","","uniform float pointSize;","uniform float zOffset;","","uniform float focallength;","uniform float maxDepthPerTile;","uniform float resolutionFactor;","","varying vec2 vUvP;","varying vec2 colorP;","","varying float depthVariance;","varying float maskVal;","","float sampleDepth(vec2 pos)"," {"," float depth;"," "," vec2 vUv = vec2( pos.x / (width*2.0), pos.y / (height*2.0)+0.5 );"," vec2 vUv2 = vec2( pos.x / (width*2.0)+0.5, pos.y / (height*2.0)+0.5 );"," "," vec4 depthColor = texture2D( map, vUv );"," "," depth = ( depthColor.r + depthColor.g + depthColor.b ) / 3.0 ;"," "," if (depth>0.99)"," {"," vec4 depthColor2 = texture2D( map, vUv2 );"," float depth2 = ( depthColor2.r + depthColor2.g + depthColor2.b ) / 3.0 ;"," depth = 0.99+depth2;"," }"," "," return depth;"," }","","float median(float a, float b, float c)"," {"," float r=a;"," "," if ( (a0.5) || (vUvP.y<0.5) || (vUvP.y>0.0))"," {"," vec2 smp = decodeDepth(vec2(position.x, position.y));"," float depth = smp.x;"," depthVariance = smp.y;"," "," float z = -depth;"," "," pos = vec4("," ( position.x / width - 0.5 ) * z * 0.5 * maxDepthPerTile * resolutionFactor * (1000.0/focallength) * -1.0,"," ( position.y / height - 0.5 ) * z * 0.5 * maxDepthPerTile * resolutionFactor * (1000.0/focallength),"," (- z + zOffset / 1000.0) * maxDepthPerTile,"," 1.0);"," "," vec2 maskP = vec2( position.x / (width*2.0), position.y / (height*2.0) );"," vec4 maskColor = texture2D( map, maskP );"," maskVal = ( maskColor.r + maskColor.g + maskColor.b ) / 3.0 ;"," }"," "," gl_PointSize = pointSize;"," gl_Position = projectionMatrix * modelViewMatrix * pos;"," ","}"].join("\n"),this.fragment_shader=["uniform sampler2D map;","uniform float varianceThreshold;","uniform float whiteness;","","varying vec2 vUvP;","varying vec2 colorP;","","varying float depthVariance;","varying float maskVal;","","","void main() {"," "," vec4 color;"," "," if ( (depthVariance>varianceThreshold) || (maskVal>0.5) ||(vUvP.x<0.0)|| (vUvP.x>0.5) || (vUvP.y<0.5) || (vUvP.y>1.0))"," { "," discard;"," }"," else "," {"," color = texture2D( map, colorP );"," "," float fader = whiteness /100.0;"," "," color.r = color.r * (1.0-fader)+ fader;"," "," color.g = color.g * (1.0-fader)+ fader;"," "," color.b = color.b * (1.0-fader)+ fader;"," "," color.a = 1.0;//smoothstep( 20000.0, -20000.0, gl_FragCoord.z / gl_FragCoord.w );"," }"," "," gl_FragColor = vec4( color.r, color.g, color.b, color.a );"," ","}"].join("\n")}metaLoaded(){this.metaLoaded=!0,this.initStreamer()}initStreamer(){if(this.metaLoaded){this.texture=new Ec.Texture(this.video),this.geometry=new Ec.Geometry;for(var e=0,t=this.width*this.height;ethis.lifetime){var t=this.markers[e];t.unsubscribeTf(),this.rootObject.remove(t),this.emit("change")}else{var i=this;setTimeout(function(){i.checkTime(e)},100)}}subscribe(){this.unsubscribe(),this.rosTopic=new t.Topic({ros:this.ros,name:this.topicName,messageType:"visualization_msgs/Marker",compression:"png"}),this.rosTopic.subscribe(this.processMessage.bind(this))}processMessage(e){var t=new oh({message:e,path:this.path}),i=this.markers[e.ns+e.id];this.updatedTime[e.ns+e.id]=(new Date).getTime(),i?(i.unsubscribeTf(),this.rootObject.remove(i)):this.lifetime&&this.checkTime(e.ns+e.id),this.markers[e.ns+e.id]=new ph({frameID:e.header.frame_id,tfClient:this.tfClient,object:t}),this.rootObject.add(this.markers[e.ns+e.id]),this.emit("change")}},e.Arrow=ih,e.Arrow2=class extends Ec.ArrowHelper{constructor(e){var t=(e=e||{}).origin||new Ec.Vector3(0,0,0),i=e.direction||new Ec.Vector3(1,0,0),r=e.length||1;e.headLength,e.shaftDiameter,e.headDiameter,e.material||new Ec.MeshBasicMaterial,super(i,t,r,16711680)}dispose(){void 0!==this.line&&(this.line.material.dispose(),this.line.geometry.dispose()),void 0!==this.cone&&(this.cone.material.dispose(),this.cone.geometry.dispose())}},e.Axes=dh,e.Grid=class extends Ec.Object3D{constructor(e){var t=(e=e||{}).num_cells||10,i=e.color||"#cccccc",r=e.lineWidth||1,n=e.cellSize||1;super();for(var o=new Ec.LineBasicMaterial({color:i,linewidth:r}),a=0;a<=t;++a){var s=n*t/2,c=s-a*n,h=new Ec.Geometry;h.vertices.push(new Ec.Vector3(-s,c,0),new Ec.Vector3(s,c,0));var l=new Ec.Geometry;l.vertices.push(new Ec.Vector3(c,-s,0),new Ec.Vector3(c,s,0)),this.add(new Ec.Line(h,o)),this.add(new Ec.Line(l,o))}}},e.MeshResource=rh,e.TriangleList=nh,e.OccupancyGrid=fh,e.OccupancyGridClient=class extends lh{constructor(e){super(),e=e||{},this.ros=e.ros,this.topicName=e.topic||"/map",this.compression=e.compression||"cbor",this.continuous=e.continuous,this.tfClient=e.tfClient,this.rootObject=e.rootObject||new Ec.Object3D,this.offsetPose=e.offsetPose||new t.Pose,this.color=e.color||{r:255,g:255,b:255},this.opacity=e.opacity||1,this.currentGrid=null,this.rosTopic=void 0,this.subscribe()}unsubscribe(){this.rosTopic&&this.rosTopic.unsubscribe()}subscribe(){this.unsubscribe(),this.rosTopic=new t.Topic({ros:this.ros,name:this.topicName,messageType:"nav_msgs/OccupancyGrid",queue_length:1,compression:this.compression}),this.rosTopic.subscribe(this.processMessage.bind(this))}processMessage(e){this.currentGrid&&(this.currentGrid.tfClient&&this.currentGrid.unsubscribeTf(),this.rootObject.remove(this.currentGrid));var t=new fh({message:e,color:this.color,opacity:this.opacity});this.tfClient?(this.currentGrid=t,this.sceneNode=new ph({frameID:e.header.frame_id,tfClient:this.tfClient,object:t,pose:this.offsetPose})):this.sceneNode=this.currentGrid=t,this.rootObject.add(this.sceneNode),this.emit("change"),this.continuous||this.rosTopic.unsubscribe()}},e.Odometry=class extends Ec.Object3D{constructor(e){super(),this.options=e||{},this.ros=e.ros,this.topicName=e.topic||"/particlecloud",this.tfClient=e.tfClient,this.color=e.color||13369599,this.length=e.length||1,this.rootObject=e.rootObject||new Ec.Object3D,this.keep=e.keep||1,this.sns=[],this.rosTopic=void 0,this.subscribe()}unsubscribe(){this.rosTopic&&this.rosTopic.unsubscribe()}subscribe(){this.unsubscribe(),this.rosTopic=new t.Topic({ros:this.ros,name:this.topicName,queue_length:1,messageType:"nav_msgs/Odometry"}),this.rosTopic.subscribe(this.processMessage.bind(this))}processMessage(e){this.sns.length>=this.keep&&(this.sns[0].unsubscribeTf(),this.rootObject.remove(this.sns[0]),this.sns.shift()),this.options.origin=new Ec.Vector3(e.pose.pose.position.x,e.pose.pose.position.y,e.pose.pose.position.z);var t=new Ec.Quaternion(e.pose.pose.orientation.x,e.pose.pose.orientation.y,e.pose.pose.orientation.z,e.pose.pose.orientation.w);this.options.direction=new Ec.Vector3(1,0,0),this.options.direction.applyQuaternion(t),this.options.material=new Ec.MeshBasicMaterial({color:this.color});var i=new ih(this.options);this.sns.push(new ph({frameID:e.header.frame_id,tfClient:this.tfClient,object:i})),this.rootObject.add(this.sns[this.sns.length-1])}},e.Path=class extends Ec.Object3D{constructor(e){super(),e=e||{},this.ros=e.ros,this.topicName=e.topic||"/path",this.tfClient=e.tfClient,this.color=e.color||13369599,this.rootObject=e.rootObject||new Ec.Object3D,this.sn=null,this.line=null,this.rosTopic=void 0,this.subscribe()}unsubscribe(){this.rosTopic&&this.rosTopic.unsubscribe()}subscribe(){this.unsubscribe(),this.rosTopic=new t.Topic({ros:this.ros,name:this.topicName,queue_length:1,messageType:"nav_msgs/Path"}),this.rosTopic.subscribe(this.processMessage.bind(this))}processMessage(e){null!==this.sn&&(this.sn.unsubscribeTf(),this.rootObject.remove(this.sn));for(var t=new Ec.Geometry,i=0;i=e.range_min&&n<=e.range_max){var o=e.angle_min+r*e.angle_increment;this.points.positions.array[i++]=n*Math.cos(o),this.points.positions.array[i++]=n*Math.sin(o),this.points.positions.array[i++]=0}}this.points.update(i/3)}}},e.Points=mh,e.PointCloud2=class extends Ec.Object3D{constructor(e){super(),e=e||{},this.ros=e.ros,this.topicName=e.topic||"/points",this.compression=e.compression||"cbor",this.max_pts=e.max_pts||1e4,this.points=new mh(e),this.rosTopic=void 0,this.buffer=null,this.subscribe()}unsubscribe(){this.rosTopic&&this.rosTopic.unsubscribe()}subscribe(){this.unsubscribe(),this.rosTopic=new t.Topic({ros:this.ros,name:this.topicName,messageType:"sensor_msgs/PointCloud2",queue_length:1,compression:this.compression}),this.rosTopic.subscribe(this.processMessage.bind(this))}processMessage(e){if(this.points.setup(e.header.frame_id,e.point_step,e.fields)){var t,i=this.points.pointRatio,r=this.max_pts*e.point_step;e.data.buffer?(this.buffer=e.data.slice(0,Math.min(e.data.byteLength,r)),t=Math.min(e.height*e.width/i,this.points.positions.array.length/3)):((!this.buffer||this.buffer.byteLength