Scribe.js/public/scripts/three.min.js

13 lines
407 KiB
JavaScript
Raw Normal View History

2016-04-11 22:18:51 -05:00
/*! Grunt Uglify 2016-04-11 */ "use strict";var THREE={REVISION:"71"};"object"==typeof module&&(module.exports=THREE),void 0===Math.sign&&(Math.sign=function(a){return 0>a?-1:a>0?1:+a}),THREE.log=function(){},THREE.warn=function(){},THREE.error=function(){},THREE.MOUSE={LEFT:0,MIDDLE:1,RIGHT:2},THREE.CullFaceNone=0,THREE.CullFaceBack=1,THREE.CullFaceFront=2,THREE.CullFaceFrontBack=3,THREE.FrontFaceDirectionCW=0,THREE.FrontFaceDirectionCCW=1,THREE.BasicShadowMap=0,THREE.PCFShadowMap=1,THREE.PCFSoftShadowMap=2,THREE.FrontSide=0,THREE.BackSide=1,THREE.DoubleSide=2,THREE.NoShading=0,THREE.FlatShading=1,THREE.SmoothShading=2,THREE.NoColors=0,THREE.FaceColors=1,THREE.VertexColors=2,THREE.NoBlending=0,THREE.NormalBlending=1,THREE.AdditiveBlending=2,THREE.SubtractiveBlending=3,THREE.MultiplyBlending=4,THREE.CustomBlending=5,THREE.AddEquation=100,THREE.SubtractEquation=101,THREE.ReverseSubtractEquation=102,THREE.MinEquation=103,THREE.MaxEquation=104,THREE.ZeroFactor=200,THREE.OneFactor=201,THREE.SrcColorFactor=202,THREE.OneMinusSrcColorFactor=203,THREE.SrcAlphaFactor=204,THREE.OneMinusSrcAlphaFactor=205,THREE.DstAlphaFactor=206,THREE.OneMinusDstAlphaFactor=207,THREE.DstColorFactor=208,THREE.OneMinusDstColorFactor=209,THREE.SrcAlphaSaturateFactor=210,THREE.MultiplyOperation=0,THREE.MixOperation=1,THREE.AddOperation=2,THREE.UVMapping=300,THREE.CubeReflectionMapping=301,THREE.CubeRefractionMapping=302,THREE.EquirectangularReflectionMapping=303,THREE.EquirectangularRefractionMapping=304,THREE.SphericalReflectionMapping=305,THREE.RepeatWrapping=1e3,THREE.ClampToEdgeWrapping=1001,THREE.MirroredRepeatWrapping=1002,THREE.NearestFilter=1003,THREE.NearestMipMapNearestFilter=1004,THREE.NearestMipMapLinearFilter=1005,THREE.LinearFilter=1006,THREE.LinearMipMapNearestFilter=1007,THREE.LinearMipMapLinearFilter=1008,THREE.UnsignedByteType=1009,THREE.ByteType=1010,THREE.ShortType=1011,THREE.UnsignedShortType=1012,THREE.IntType=1013,THREE.UnsignedIntType=1014,THREE.FloatType=1015,THREE.HalfFloatType=1025,THREE.UnsignedShort4444Type=1016,THREE.UnsignedShort5551Type=1017,THREE.UnsignedShort565Type=1018,THREE.AlphaFormat=1019,THREE.RGBFormat=1020,THREE.RGBAFormat=1021,THREE.LuminanceFormat=1022,THREE.LuminanceAlphaFormat=1023,THREE.RGBEFormat=THREE.RGBAFormat,THREE.RGB_S3TC_DXT1_Format=2001,THREE.RGBA_S3TC_DXT1_Format=2002,THREE.RGBA_S3TC_DXT3_Format=2003,THREE.RGBA_S3TC_DXT5_Format=2004,THREE.RGB_PVRTC_4BPPV1_Format=2100,THREE.RGB_PVRTC_2BPPV1_Format=2101,THREE.RGBA_PVRTC_4BPPV1_Format=2102,THREE.RGBA_PVRTC_2BPPV1_Format=2103,THREE.Projector=function(){THREE.error("THREE.Projector has been moved to /examples/js/renderers/Projector.js."),this.projectVector=function(a,b){THREE.warn("THREE.Projector: .projectVector() is now vector.project()."),a.project(b)},this.unprojectVector=function(a,b){THREE.warn("THREE.Projector: .unprojectVector() is now vector.unproject()."),a.unproject(b)},this.pickingRay=function(a,b){THREE.error("THREE.Projector: .pickingRay() is now raycaster.setFromCamera().")}},THREE.CanvasRenderer=function(){THREE.error("THREE.CanvasRenderer has been moved to /examples/js/renderers/CanvasRenderer.js"),this.domElement=document.createElement("canvas"),this.clear=function(){},this.render=function(){},this.setClearColor=function(){},this.setSize=function(){}},THREE.Color=function(a){return 3===arguments.length?this.setRGB(arguments[0],arguments[1],arguments[2]):this.set(a)},THREE.Color.prototype={constructor:THREE.Color,r:1,g:1,b:1,set:function(a){return a instanceof THREE.Color?this.copy(a):"number"==typeof a?this.setHex(a):"string"==typeof a&&this.setStyle(a),this},setHex:function(a){return a=Math.floor(a),this.r=(a>>16&255)/255,this.g=(a>>8&255)/255,this.b=(255&a)/255,this},setRGB:function(a,b,c){return this.r=a,this.g=b,this.b=c,this},setHSL:function(a,b,c){if(0===b)this.r=this.g=this.b=c;else{var d=function(a,b,c){return 0>c&&(c+=1),c>1&&(c-=1),1/6>c?a+6*(b-a)*c:.5>c?b:2/3>c?a+6*(b-a)*(2/3-c):a};b=.5>=c?c*(1+b):c+b-c*b,c=2*c-b,this.r=d(c,b,a+1/3),this.g=d(c,b,a),this.b=d(c,b,a-1/3)}return this},setStyle:function(a){return/^rgb\((\d+),
constructor:THREE.Euler,_x:0,_y:0,_z:0,_order:THREE.Euler.DefaultOrder,get x(){return this._x},set x(a){this._x=a,this.onChangeCallback()},get y(){return this._y},set y(a){this._y=a,this.onChangeCallback()},get z(){return this._z},set z(a){this._z=a,this.onChangeCallback()},get order(){return this._order},set order(a){this._order=a,this.onChangeCallback()},set:function(a,b,c,d){return this._x=a,this._y=b,this._z=c,this._order=d||this._order,this.onChangeCallback(),this},copy:function(a){return this._x=a._x,this._y=a._y,this._z=a._z,this._order=a._order,this.onChangeCallback(),this},setFromRotationMatrix:function(a,b,c){var d=THREE.Math.clamp,e=a.elements;a=e[0];var f=e[4],g=e[8],h=e[1],i=e[5],j=e[9],k=e[2],l=e[6],e=e[10];return b=b||this._order,"XYZ"===b?(this._y=Math.asin(d(g,-1,1)),.99999>Math.abs(g)?(this._x=Math.atan2(-j,e),this._z=Math.atan2(-f,a)):(this._x=Math.atan2(l,i),this._z=0)):"YXZ"===b?(this._x=Math.asin(-d(j,-1,1)),.99999>Math.abs(j)?(this._y=Math.atan2(g,e),this._z=Math.atan2(h,i)):(this._y=Math.atan2(-k,a),this._z=0)):"ZXY"===b?(this._x=Math.asin(d(l,-1,1)),.99999>Math.abs(l)?(this._y=Math.atan2(-k,e),this._z=Math.atan2(-f,i)):(this._y=0,this._z=Math.atan2(h,a))):"ZYX"===b?(this._y=Math.asin(-d(k,-1,1)),.99999>Math.abs(k)?(this._x=Math.atan2(l,e),this._z=Math.atan2(h,a)):(this._x=0,this._z=Math.atan2(-f,i))):"YZX"===b?(this._z=Math.asin(d(h,-1,1)),.99999>Math.abs(h)?(this._x=Math.atan2(-j,i),this._y=Math.atan2(-k,a)):(this._x=0,this._y=Math.atan2(g,e))):"XZY"===b?(this._z=Math.asin(-d(f,-1,1)),.99999>Math.abs(f)?(this._x=Math.atan2(l,i),this._y=Math.atan2(g,a)):(this._x=Math.atan2(-j,e),this._y=0)):THREE.warn("THREE.Euler: .setFromRotationMatrix() given unsupported order: "+b),this._order=b,!1!==c&&this.onChangeCallback(),this},setFromQuaternion:function(){var a;return function(b,c,d){return void 0===a&&(a=new THREE.Matrix4),a.makeRotationFromQuaternion(b),this.setFromRotationMatrix(a,c,d),this}}(),setFromVector3:function(a,b){return this.set(a.x,a.y,a.z,b||this._order)},reorder:function(){var a=new THREE.Quaternion;return function(b){a.setFromEuler(this),this.setFromQuaternion(a,b)}}(),equals:function(a){return a._x===this._x&&a._y===this._y&&a._z===this._z&&a._order===this._order},fromArray:function(a){return this._x=a[0],this._y=a[1],this._z=a[2],void 0!==a[3]&&(this._order=a[3]),this.onChangeCallback(),this},toArray:function(a,b){return void 0===a&&(a=[]),void 0===b&&(b=0),a[b]=this._x,a[b+1]=this._y,a[b+2]=this._z,a[b+3]=this._order,a},toVector3:function(a){return a?a.set(this._x,this._y,this._z):new THREE.Vector3(this._x,this._y,this._z)},onChange:function(a){return this.onChangeCallback=a,this},onChangeCallback:function(){},clone:function(){return new THREE.Euler(this._x,this._y,this._z,this._order)}},THREE.Line3=function(a,b){this.start=void 0!==a?a:new THREE.Vector3,this.end=void 0!==b?b:new THREE.Vector3},THREE.Line3.prototype={constructor:THREE.Line3,set:function(a,b){return this.start.copy(a),this.end.copy(b),this},copy:function(a){return this.start.copy(a.start),this.end.copy(a.end),this},center:function(a){return(a||new THREE.Vector3).addVectors(this.start,this.end).multiplyScalar(.5)},delta:function(a){return(a||new THREE.Vector3).subVectors(this.end,this.start)},distanceSq:function(){return this.start.distanceToSquared(this.end)},distance:function(){return this.start.distanceTo(this.end)},at:function(a,b){var c=b||new THREE.Vector3;return this.delta(c).multiplyScalar(a).add(this.start)},closestPointToPointParameter:function(){var a=new THREE.Vector3,b=new THREE.Vector3;return function(c,d){a.subVectors(c,this.start),b.subVectors(this.end,this.start);var e=b.dot(b),e=b.dot(a)/e;return d&&(e=THREE.Math.clamp(e,0,1)),e}}(),closestPointToPoint:function(a,b,c){return a=this.closestPointToPointParameter(a,b),c=c||new THREE.Vector3,this.delta(c).multiplyScalar(a).add(this.start)},applyMatrix4:function(a){return this.start.applyMatrix4(a),this.end.applyMatrix4(a),this},equals:function(a){return a.start.equals(this.start)&&a.end.equals(this.end)},clone:function(){return(new THREE.Line3).copy(this
this}}(),copy:function(a){return this.normal.copy(a.normal),this.constant=a.constant,this},normalize:function(){var a=1/this.normal.length();return this.normal.multiplyScalar(a),this.constant*=a,this},negate:function(){return this.constant*=-1,this.normal.negate(),this},distanceToPoint:function(a){return this.normal.dot(a)+this.constant},distanceToSphere:function(a){return this.distanceToPoint(a.center)-a.radius},projectPoint:function(a,b){return this.orthoPoint(a,b).sub(a).negate()},orthoPoint:function(a,b){var c=this.distanceToPoint(a);return(b||new THREE.Vector3).copy(this.normal).multiplyScalar(c)},isIntersectionLine:function(a){var b=this.distanceToPoint(a.start);return a=this.distanceToPoint(a.end),0>b&&a>0||0>a&&b>0},intersectLine:function(){var a=new THREE.Vector3;return function(b,c){var d=c||new THREE.Vector3,e=b.delta(a),f=this.normal.dot(e);return 0!=f?(f=-(b.start.dot(this.normal)+this.constant)/f,0>f||f>1?void 0:d.copy(e).multiplyScalar(f).add(b.start)):0==this.distanceToPoint(b.start)?d.copy(b.start):void 0}}(),coplanarPoint:function(a){return(a||new THREE.Vector3).copy(this.normal).multiplyScalar(-this.constant)},applyMatrix4:function(){var a=new THREE.Vector3,b=new THREE.Vector3,c=new THREE.Matrix3;return function(d,e){var f=e||c.getNormalMatrix(d),f=a.copy(this.normal).applyMatrix3(f),g=this.coplanarPoint(b);return g.applyMatrix4(d),this.setFromNormalAndCoplanarPoint(f,g),this}}(),translate:function(a){return this.constant-=a.dot(this.normal),this},equals:function(a){return a.normal.equals(this.normal)&&a.constant==this.constant},clone:function(){return(new THREE.Plane).copy(this)}},THREE.Math={generateUUID:function(){var a,b="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz".split(""),c=Array(36),d=0;return function(){for(var e=0;36>e;e++)8==e||13==e||18==e||23==e?c[e]="-":14==e?c[e]="4":(2>=d&&(d=33554432+16777216*Math.random()|0),a=15&d,d>>=4,c[e]=b[19==e?3&a|8:a]);return c.join("")}}(),clamp:function(a,b,c){return b>a?b:a>c?c:a},clampBottom:function(a,b){return b>a?b:a},mapLinear:function(a,b,c,d,e){return d+(a-b)*(e-d)/(c-b)},smoothstep:function(a,b,c){return b>=a?0:a>=c?1:(a=(a-b)/(c-b),a*a*(3-2*a))},smootherstep:function(a,b,c){return b>=a?0:a>=c?1:(a=(a-b)/(c-b),a*a*a*(a*(6*a-15)+10))},random16:function(){return(65280*Math.random()+255*Math.random())/65535},randInt:function(a,b){return Math.floor(this.randFloat(a,b))},randFloat:function(a,b){return a+Math.random()*(b-a)},randFloatSpread:function(a){return a*(.5-Math.random())},degToRad:function(){var a=Math.PI/180;return function(b){return b*a}}(),radToDeg:function(){var a=180/Math.PI;return function(b){return b*a}}(),isPowerOfTwo:function(a){return 0===(a&a-1)&&0!==a},nextPowerOfTwo:function(a){return a--,a|=a>>1,a|=a>>2,a|=a>>4,a|=a>>8,a|=a>>16,a++,a}},THREE.Spline=function(a){function b(a,b,c,d,e,f,g){return a=.5*(c-a),d=.5*(d-b),(2*(b-c)+a+d)*g+(-3*(b-c)-2*a-d)*f+a*e+b}this.points=a;var c,d,e,f,g,h,i,j,k,l=[],m={x:0,y:0,z:0};this.initFromArray=function(a){this.points=[];for(var b=0;b<a.length;b++)this.points[b]={x:a[b][0],y:a[b][1],z:a[b][2]}},this.getPoint=function(a){return c=(this.points.length-1)*a,d=Math.floor(c),e=c-d,l[0]=0===d?d:d-1,l[1]=d,l[2]=d>this.points.length-2?this.points.length-1:d+1,l[3]=d>this.points.length-3?this.points.length-1:d+2,h=this.points[l[0]],i=this.points[l[1]],j=this.points[l[2]],k=this.points[l[3]],f=e*e,g=e*f,m.x=b(h.x,i.x,j.x,k.x,e,f,g),m.y=b(h.y,i.y,j.y,k.y,e,f,g),m.z=b(h.z,i.z,j.z,k.z,e,f,g),m},this.getControlPointsArray=function(){var a,b,c=this.points.length,d=[];for(a=0;c>a;a++)b=this.points[a],d[a]=[b.x,b.y,b.z];return d},this.getLength=function(a){var b,c,d,e=b=b=0,f=new THREE.Vector3,g=new THREE.Vector3,h=[],i=0;for(h[0]=0,a||(a=100),c=this.points.length*a,f.copy(this.points[0]),a=1;c>a;a++)b=a/c,d=this.getPoint(b),g.copy(d),i+=g.distanceTo(f),f.copy(d),b*=this.points.length-1,b=Math.floor(b),b!=e&&(h[b]=i,e=b);return h[h.length]=i,{chunks:h,total:i}},this.reparametrizeByArcLength=function(a){var b,c,d,e,f,g,h=[],i=new THREE.Vector3,j=this.getLength();for(h.push(i.copy(this.points[0]).
this.boundingSphere=this.boundingBox=null,this.hasTangents=!1,this.dynamic=!0,this.groupsNeedUpdate=this.lineDistancesNeedUpdate=this.colorsNeedUpdate=this.tangentsNeedUpdate=this.normalsNeedUpdate=this.uvsNeedUpdate=this.elementsNeedUpdate=this.verticesNeedUpdate=!1},THREE.Geometry.prototype={constructor:THREE.Geometry,applyMatrix:function(a){for(var b=(new THREE.Matrix3).getNormalMatrix(a),c=0,d=this.vertices.length;d>c;c++)this.vertices[c].applyMatrix4(a);for(c=0,d=this.faces.length;d>c;c++){a=this.faces[c],a.normal.applyMatrix3(b).normalize();for(var e=0,f=a.vertexNormals.length;f>e;e++)a.vertexNormals[e].applyMatrix3(b).normalize()}null!==this.boundingBox&&this.computeBoundingBox(),null!==this.boundingSphere&&this.computeBoundingSphere(),this.normalsNeedUpdate=this.verticesNeedUpdate=!0},fromBufferGeometry:function(a){for(var b=this,c=a.attributes,d=c.position.array,e=void 0!==c.index?c.index.array:void 0,f=void 0!==c.normal?c.normal.array:void 0,g=void 0!==c.color?c.color.array:void 0,h=void 0!==c.uv?c.uv.array:void 0,i=[],j=[],k=c=0;c<d.length;c+=3,k+=2)b.vertices.push(new THREE.Vector3(d[c],d[c+1],d[c+2])),void 0!==f&&i.push(new THREE.Vector3(f[c],f[c+1],f[c+2])),void 0!==g&&b.colors.push(new THREE.Color(g[c],g[c+1],g[c+2])),void 0!==h&&j.push(new THREE.Vector2(h[k],h[k+1]));var l=function(a,c,d){var e=void 0!==f?[i[a].clone(),i[c].clone(),i[d].clone()]:[],k=void 0!==g?[b.colors[a].clone(),b.colors[c].clone(),b.colors[d].clone()]:[];b.faces.push(new THREE.Face3(a,c,d,e,k)),void 0!==h&&b.faceVertexUvs[0].push([j[a].clone(),j[c].clone(),j[d].clone()])};if(void 0!==e)if(d=a.drawcalls,0<d.length)for(c=0;c<d.length;c++)for(var k=d[c],m=k.start,n=k.count,o=k.index,k=m,m=m+n;m>k;k+=3)l(o+e[k],o+e[k+1],o+e[k+2]);else for(c=0;c<e.length;c+=3)l(e[c],e[c+1],e[c+2]);else for(c=0;c<d.length/3;c+=3)l(c,c+1,c+2);return this.computeFaceNormals(),null!==a.boundingBox&&(this.boundingBox=a.boundingBox.clone()),null!==a.boundingSphere&&(this.boundingSphere=a.boundingSphere.clone()),this},center:function(){this.computeBoundingBox();var a=this.boundingBox.center().negate();return this.applyMatrix((new THREE.Matrix4).setPosition(a)),a},computeFaceNormals:function(){for(var a=new THREE.Vector3,b=new THREE.Vector3,c=0,d=this.faces.length;d>c;c++){var e=this.faces[c],f=this.vertices[e.a],g=this.vertices[e.b];a.subVectors(this.vertices[e.c],g),b.subVectors(f,g),a.cross(b),a.normalize(),e.normal.copy(a)}},computeVertexNormals:function(a){var b,c,d;for(d=Array(this.vertices.length),b=0,c=this.vertices.length;c>b;b++)d[b]=new THREE.Vector3;if(a){var e,f,g,h=new THREE.Vector3,i=new THREE.Vector3;for(a=0,b=this.faces.length;b>a;a++)c=this.faces[a],e=this.vertices[c.a],f=this.vertices[c.b],g=this.vertices[c.c],h.subVectors(g,f),i.subVectors(e,f),h.cross(i),d[c.a].add(h),d[c.b].add(h),d[c.c].add(h)}else for(a=0,b=this.faces.length;b>a;a++)c=this.faces[a],d[c.a].add(c.normal),d[c.b].add(c.normal),d[c.c].add(c.normal);for(b=0,c=this.vertices.length;c>b;b++)d[b].normalize();for(a=0,b=this.faces.length;b>a;a++)c=this.faces[a],c.vertexNormals[0]=d[c.a].clone(),c.vertexNormals[1]=d[c.b].clone(),c.vertexNormals[2]=d[c.c].clone()},computeMorphNormals:function(){var a,b,c,d,e;for(c=0,d=this.faces.length;d>c;c++)for(e=this.faces[c],e.__originalFaceNormal?e.__originalFaceNormal.copy(e.normal):e.__originalFaceNormal=e.normal.clone(),e.__originalVertexNormals||(e.__originalVertexNormals=[]),a=0,b=e.vertexNormals.length;b>a;a++)e.__originalVertexNormals[a]?e.__originalVertexNormals[a].copy(e.vertexNormals[a]):e.__originalVertexNormals[a]=e.vertexNormals[a].clone();var f=new THREE.Geometry;for(f.faces=this.faces,a=0,b=this.morphTargets.length;b>a;a++){if(!this.morphNormals[a]){this.morphNormals[a]={},this.morphNormals[a].faceNormals=[],this.morphNormals[a].vertexNormals=[],e=this.morphNormals[a].faceNormals;var g,h,i=this.morphNormals[a].vertexNormals;for(c=0,d=this.faces.length;d>c;c++)g=new THREE.Vector3,h={a:new THREE.Vector3,b:new THREE.Vector3,c:new THREE.Vector3},e.push(g),i.push(h)}for(i=this.morphNormals[a],f.vertices=this.morphTargets[a].vertices,f.co
this.manager=void 0!==a?a:THREE.DefaultLoadingManager},THREE.MaterialLoader.prototype={constructor:THREE.MaterialLoader,load:function(a,b,c,d){var e=this,f=new THREE.XHRLoader(e.manager);f.setCrossOrigin(this.crossOrigin),f.load(a,function(a){b(e.parse(JSON.parse(a)))},c,d)},setCrossOrigin:function(a){this.crossOrigin=a},parse:function(a){var b=new THREE[a.type];if(void 0!==a.color&&b.color.setHex(a.color),void 0!==a.emissive&&b.emissive.setHex(a.emissive),void 0!==a.specular&&b.specular.setHex(a.specular),void 0!==a.shininess&&(b.shininess=a.shininess),void 0!==a.uniforms&&(b.uniforms=a.uniforms),void 0!==a.vertexShader&&(b.vertexShader=a.vertexShader),void 0!==a.fragmentShader&&(b.fragmentShader=a.fragmentShader),void 0!==a.vertexColors&&(b.vertexColors=a.vertexColors),void 0!==a.shading&&(b.shading=a.shading),void 0!==a.blending&&(b.blending=a.blending),void 0!==a.side&&(b.side=a.side),void 0!==a.opacity&&(b.opacity=a.opacity),void 0!==a.transparent&&(b.transparent=a.transparent),void 0!==a.wireframe&&(b.wireframe=a.wireframe),void 0!==a.size&&(b.size=a.size),void 0!==a.sizeAttenuation&&(b.sizeAttenuation=a.sizeAttenuation),void 0!==a.materials)for(var c=0,d=a.materials.length;d>c;c++)b.materials.push(this.parse(a.materials[c]));return b}},THREE.ObjectLoader=function(a){this.manager=void 0!==a?a:THREE.DefaultLoadingManager,this.texturePath=""},THREE.ObjectLoader.prototype={constructor:THREE.ObjectLoader,load:function(a,b,c,d){""===this.texturePath&&(this.texturePath=a.substring(0,a.lastIndexOf("/")+1));var e=this,f=new THREE.XHRLoader(e.manager);f.setCrossOrigin(this.crossOrigin),f.load(a,function(a){e.parse(JSON.parse(a),b)},c,d)},setTexturePath:function(a){this.texturePath=a},setCrossOrigin:function(a){this.crossOrigin=a},parse:function(a,b){var c=this.parseGeometries(a.geometries),d=this.parseImages(a.images,function(){void 0!==b&&b(e)}),d=this.parseTextures(a.textures,d),d=this.parseMaterials(a.materials,d),e=this.parseObject(a.object,c,d);return void 0!==a.images&&0!==a.images.length||void 0===b||b(e),e},parseGeometries:function(a){var b={};if(void 0!==a)for(var c=new THREE.JSONLoader,d=new THREE.BufferGeometryLoader,e=0,f=a.length;f>e;e++){var g,h=a[e];switch(h.type){case"PlaneGeometry":case"PlaneBufferGeometry":g=new THREE[h.type](h.width,h.height,h.widthSegments,h.heightSegments);break;case"BoxGeometry":case"CubeGeometry":g=new THREE.BoxGeometry(h.width,h.height,h.depth,h.widthSegments,h.heightSegments,h.depthSegments);break;case"CircleGeometry":g=new THREE.CircleGeometry(h.radius,h.segments);break;case"CylinderGeometry":g=new THREE.CylinderGeometry(h.radiusTop,h.radiusBottom,h.height,h.radialSegments,h.heightSegments,h.openEnded);break;case"SphereGeometry":g=new THREE.SphereGeometry(h.radius,h.widthSegments,h.heightSegments,h.phiStart,h.phiLength,h.thetaStart,h.thetaLength);break;case"IcosahedronGeometry":g=new THREE.IcosahedronGeometry(h.radius,h.detail);break;case"TorusGeometry":g=new THREE.TorusGeometry(h.radius,h.tube,h.radialSegments,h.tubularSegments,h.arc);break;case"TorusKnotGeometry":g=new THREE.TorusKnotGeometry(h.radius,h.tube,h.radialSegments,h.tubularSegments,h.p,h.q,h.heightScale);break;case"BufferGeometry":g=d.parse(h);break;case"Geometry":g=c.parse(h.data).geometry}g.uuid=h.uuid,void 0!==h.name&&(g.name=h.name),b[h.uuid]=g}return b},parseMaterials:function(a,b){var c={};if(void 0!==a)for(var d=function(a){return void 0===b[a]&&THREE.warn("THREE.ObjectLoader: Undefined texture",a),b[a]},e=new THREE.MaterialLoader,f=0,g=a.length;g>f;f++){var h=a[f],i=e.parse(h);i.uuid=h.uuid,void 0!==h.name&&(i.name=h.name),void 0!==h.map&&(i.map=d(h.map)),void 0!==h.bumpMap&&(i.bumpMap=d(h.bumpMap),h.bumpScale&&(i.bumpScale=new THREE.Vector2(h.bumpScale,h.bumpScale))),void 0!==h.alphaMap&&(i.alphaMap=d(h.alphaMap)),void 0!==h.envMap&&(i.envMap=d(h.envMap)),void 0!==h.normalMap&&(i.normalMap=d(h.normalMap),h.normalScale&&(i.normalScale=new THREE.Vector2(h.normalScale,h.normalScale))),void 0!==h.lightMap&&(i.lightMap=d(h.lightMap)),void 0!==h.specularMap&&(i.specularMap=d(h.specularMap)),c[h.uuid]=i}return c},pa
},THREE.Mesh.prototype=Object.create(THREE.Object3D.prototype),THREE.Mesh.prototype.constructor=THREE.Mesh,THREE.Mesh.prototype.updateMorphTargets=function(){if(void 0!==this.geometry.morphTargets&&0<this.geometry.morphTargets.length){this.morphTargetBase=-1,this.morphTargetForcedOrder=[],this.morphTargetInfluences=[],this.morphTargetDictionary={};for(var a=0,b=this.geometry.morphTargets.length;b>a;a++)this.morphTargetInfluences.push(0),this.morphTargetDictionary[this.geometry.morphTargets[a].name]=a}},THREE.Mesh.prototype.getMorphTargetIndexByName=function(a){return void 0!==this.morphTargetDictionary[a]?this.morphTargetDictionary[a]:(THREE.warn("THREE.Mesh.getMorphTargetIndexByName: morph target "+a+" does not exist. Returning 0."),0)},THREE.Mesh.prototype.raycast=function(){var a=new THREE.Matrix4,b=new THREE.Ray,c=new THREE.Sphere,d=new THREE.Vector3,e=new THREE.Vector3,f=new THREE.Vector3;return function(g,h){var i=this.geometry;if(null===i.boundingSphere&&i.computeBoundingSphere(),c.copy(i.boundingSphere),c.applyMatrix4(this.matrixWorld),!1!==g.ray.isIntersectionSphere(c)&&(a.getInverse(this.matrixWorld),b.copy(g.ray).applyMatrix4(a),null===i.boundingBox||!1!==b.isIntersectionBox(i.boundingBox)))if(i instanceof THREE.BufferGeometry){var j=this.material;if(void 0!==j){var k,l,m=i.attributes,n=g.precision;if(void 0!==m.index){var o=m.index.array,p=m.position.array,q=i.offsets;0===q.length&&(q=[{start:0,count:o.length,index:0}]);for(var r=0,s=q.length;s>r;++r)for(var m=q[r].start,t=q[r].index,i=m,u=m+q[r].count;u>i;i+=3){m=t+o[i],k=t+o[i+1],l=t+o[i+2],d.fromArray(p,3*m),e.fromArray(p,3*k),f.fromArray(p,3*l);var v=j.side===THREE.BackSide?b.intersectTriangle(f,e,d,!0):b.intersectTriangle(d,e,f,j.side!==THREE.DoubleSide);if(null!==v){v.applyMatrix4(this.matrixWorld);var w=g.ray.origin.distanceTo(v);n>w||w<g.near||w>g.far||h.push({distance:w,point:v,face:new THREE.Face3(m,k,l,THREE.Triangle.normal(d,e,f)),faceIndex:null,object:this})}}}else for(p=m.position.array,o=i=0,u=p.length;u>i;i+=3,o+=9)m=i,k=i+1,l=i+2,d.fromArray(p,o),e.fromArray(p,o+3),f.fromArray(p,o+6),v=j.side===THREE.BackSide?b.intersectTriangle(f,e,d,!0):b.intersectTriangle(d,e,f,j.side!==THREE.DoubleSide),null!==v&&(v.applyMatrix4(this.matrixWorld),w=g.ray.origin.distanceTo(v),n>w||w<g.near||w>g.far||h.push({distance:w,point:v,face:new THREE.Face3(m,k,l,THREE.Triangle.normal(d,e,f)),faceIndex:null,object:this}))}}else if(i instanceof THREE.Geometry)for(o=this.material instanceof THREE.MeshFaceMaterial,p=!0===o?this.material.materials:null,n=g.precision,q=i.vertices,r=0,s=i.faces.length;s>r;r++)if(t=i.faces[r],j=!0===o?p[t.materialIndex]:this.material,void 0!==j){if(m=q[t.a],k=q[t.b],l=q[t.c],!0===j.morphTargets){v=i.morphTargets,w=this.morphTargetInfluences,d.set(0,0,0),e.set(0,0,0),f.set(0,0,0);for(var u=0,x=v.length;x>u;u++){var y=w[u];if(0!==y){var z=v[u].vertices;d.x+=(z[t.a].x-m.x)*y,d.y+=(z[t.a].y-m.y)*y,d.z+=(z[t.a].z-m.z)*y,e.x+=(z[t.b].x-k.x)*y,e.y+=(z[t.b].y-k.y)*y,e.z+=(z[t.b].z-k.z)*y,f.x+=(z[t.c].x-l.x)*y,f.y+=(z[t.c].y-l.y)*y,f.z+=(z[t.c].z-l.z)*y}}d.add(m),e.add(k),f.add(l),m=d,k=e,l=f}v=j.side===THREE.BackSide?b.intersectTriangle(l,k,m,!0):b.intersectTriangle(m,k,l,j.side!==THREE.DoubleSide),null!==v&&(v.applyMatrix4(this.matrixWorld),w=g.ray.origin.distanceTo(v),n>w||w<g.near||w>g.far||h.push({distance:w,point:v,face:t,faceIndex:r,object:this}))}}}(),THREE.Mesh.prototype.clone=function(a,b){return void 0===a&&(a=new THREE.Mesh(this.geometry,this.material)),THREE.Object3D.prototype.clone.call(this,a,b),a},THREE.Bone=function(a){THREE.Object3D.call(this),this.type="Bone",this.skin=a},THREE.Bone.prototype=Object.create(THREE.Object3D.prototype),THREE.Bone.prototype.constructor=THREE.Bone,THREE.Skeleton=function(a,b,c){if(this.useVertexTexture=void 0!==c?c:!0,this.identityMatrix=new THREE.Matrix4,a=a||[],this.bones=a.slice(0),this.useVertexTexture?(this.boneTextureHeight=this.boneTextureWidth=a=256<this.bones.length?64:64<this.bones.length?32:16<this.bones.length?16:8,this.boneMatrices=new Float32Array(this.boneTextureWidth*this.boneTextureHei
THREE.ShaderChunk.envmap_pars_fragment="#ifdef USE_ENVMAP\n\n uniform float reflectivity;\n #ifdef ENVMAP_TYPE_CUBE\n uniform samplerCube envMap;\n #else\n uniform sampler2D envMap;\n #endif\n uniform float flipEnvMap;\n\n #if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG )\n\n uniform float refractionRatio;\n\n #else\n\n varying vec3 vReflect;\n\n #endif\n\n#endif\n",THREE.ShaderChunk.logdepthbuf_fragment="#if defined(USE_LOGDEPTHBUF) && defined(USE_LOGDEPTHBUF_EXT)\n\n gl_FragDepthEXT = log2(vFragDepth) * logDepthBufFC * 0.5;\n\n#endif",THREE.ShaderChunk.normalmap_pars_fragment="#ifdef USE_NORMALMAP\n\n uniform sampler2D normalMap;\n uniform vec2 normalScale;\n\n // Per-Pixel Tangent Space Normal Mapping\n // http://hacksoflife.blogspot.ch/2009/11/per-pixel-tangent-space-normal-mapping.html\n\n vec3 perturbNormal2Arb( vec3 eye_pos, vec3 surf_norm ) {\n\n vec3 q0 = dFdx( eye_pos.xyz );\n vec3 q1 = dFdy( eye_pos.xyz );\n vec2 st0 = dFdx( vUv.st );\n vec2 st1 = dFdy( vUv.st );\n\n vec3 S = normalize( q0 * st1.t - q1 * st0.t );\n vec3 T = normalize( -q0 * st1.s + q1 * st0.s );\n vec3 N = normalize( surf_norm );\n\n vec3 mapN = texture2D( normalMap, vUv ).xyz * 2.0 - 1.0;\n mapN.xy = normalScale * mapN.xy;\n mat3 tsn = mat3( S, T, N );\n return normalize( tsn * mapN );\n\n }\n\n#endif\n",THREE.ShaderChunk.lights_phong_pars_vertex="#if MAX_SPOT_LIGHTS > 0 || defined( USE_BUMPMAP ) || defined( USE_ENVMAP )\n\n varying vec3 vWorldPosition;\n\n#endif\n",THREE.ShaderChunk.lightmap_pars_fragment="#ifdef USE_LIGHTMAP\n\n varying vec2 vUv2;\n uniform sampler2D lightMap;\n\n#endif",THREE.ShaderChunk.shadowmap_vertex="#ifdef USE_SHADOWMAP\n\n for( int i = 0; i < MAX_SHADOWS; i ++ ) {\n\n vShadowCoord[ i ] = shadowMatrix[ i ] * worldPosition;\n\n }\n\n#endif",THREE.ShaderChunk.lights_phong_vertex="#if MAX_SPOT_LIGHTS > 0 || defined( USE_BUMPMAP ) || defined( USE_ENVMAP )\n\n vWorldPosition = worldPosition.xyz;\n\n#endif",THREE.ShaderChunk.map_fragment="#ifdef USE_MAP\n\n vec4 texelColor = texture2D( map, vUv );\n\n texelColor.xyz = inputToLinear( texelColor.xyz );\n\n diffuseColor *= texelColor;\n\n#endif",THREE.ShaderChunk.lightmap_vertex="#ifdef USE_LIGHTMAP\n\n vUv2 = uv2;\n\n#endif",THREE.ShaderChunk.map_particle_fragment="#ifdef USE_MAP\n\n diffuseColor *= texture2D( map, vec2( gl_PointCoord.x, 1.0 - gl_PointCoord.y ) * offsetRepeat.zw + offsetRepeat.xy );\n\n#endif\n",THREE.ShaderChunk.color_pars_fragment="#ifdef USE_COLOR\n\n varying vec3 vColor;\n\n#endif\n",THREE.ShaderChunk.color_vertex="#ifdef USE_COLOR\n\n vColor.xyz = inputToLinear( color.xyz );\n\n#endif",THREE.ShaderChunk.skinning_vertex="#ifdef USE_SKINNING\n\n #ifdef USE_MORPHTARGETS\n\n vec4 skinVertex = bindMatrix * vec4( morphed, 1.0 );\n\n #else\n\n vec4 skinVertex = bindMatrix * vec4( position, 1.0 );\n\n #endif\n\n vec4 skinned = vec4( 0.0 );\n skinned += boneMatX * skinVertex * skinWeight.x;\n skinned += boneMatY * skinVertex * skinWeight.y;\n skinned += boneMatZ * skinVertex * skinWeight.z;\n skinned += boneMatW * skinVertex * skinWeight.w;\n skinned = bindMatrixInverse * skinned;\n\n#endif\n",THREE.ShaderChunk.envmap_pars_vertex="#if defined( USE_ENVMAP ) && ! defined( USE_BUMPMAP ) && ! defined( USE_NORMALMAP ) && ! defined( PHONG )\n\n varying vec3 vReflect;\n\n uniform float refractionRatio;\n\n#endif\n",THREE.ShaderChunk.linear_to_gamma_fragment="\n outgoingLight = linearToOutput( outgoingLight );\n",THREE.ShaderChunk.color_pars_vertex="#ifdef USE_COLOR\n\n varying vec3 vColor;\n\n#endif",THREE.ShaderChunk.lights_lambert_pars_vertex="uniform vec3 ambientLightColor;\n\n#if MAX_DIR_LIGHTS > 0\n\n uniform vec3 directionalLightColor[ MAX_DIR_LIGHTS ];\n uniform vec3 directionalLightDirection[ MAX_DIR_LIGHTS ];\n\n#endif\n\n#if MAX_HEMI_LIGHTS > 0\n\n uniform vec3 hemisphereLightSkyColor[ MAX_HEMI_LIGHTS ];\n uniform vec3 hemisphereLightGroundColor[ MAX_HEMI_LIGHTS ];\n uniform vec3 hemisphereLightDirection[ MAX_HEMI_LIGHTS ];\n\n#endif\n\n#if MAX_POINT_LIGHTS > 0\n\n uniform vec3 pointLightColor[ MAX_POINT_LIGHTS ];\n
},particle_basic:{uniforms:THREE.UniformsUtils.merge([THREE.UniformsLib.particle,THREE.UniformsLib.shadowmap]),vertexShader:["uniform float size;\nuniform float scale;",THREE.ShaderChunk.common,THREE.ShaderChunk.color_pars_vertex,THREE.ShaderChunk.shadowmap_pars_vertex,THREE.ShaderChunk.logdepthbuf_pars_vertex,"void main() {",THREE.ShaderChunk.color_vertex," vec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );\n #ifdef USE_SIZEATTENUATION\n gl_PointSize = size * ( scale / length( mvPosition.xyz ) );\n #else\n gl_PointSize = size;\n #endif\n gl_Position = projectionMatrix * mvPosition;",THREE.ShaderChunk.logdepthbuf_vertex,THREE.ShaderChunk.worldpos_vertex,THREE.ShaderChunk.shadowmap_vertex,"}"].join("\n"),fragmentShader:["uniform vec3 psColor;\nuniform float opacity;",THREE.ShaderChunk.common,THREE.ShaderChunk.color_pars_fragment,THREE.ShaderChunk.map_particle_pars_fragment,THREE.ShaderChunk.fog_pars_fragment,THREE.ShaderChunk.shadowmap_pars_fragment,THREE.ShaderChunk.logdepthbuf_pars_fragment,"void main() {\n vec3 outgoingLight = vec3( 0.0 );\n vec4 diffuseColor = vec4( psColor, opacity );",THREE.ShaderChunk.logdepthbuf_fragment,THREE.ShaderChunk.map_particle_fragment,THREE.ShaderChunk.color_fragment,THREE.ShaderChunk.alphatest_fragment," outgoingLight = diffuseColor.rgb;",THREE.ShaderChunk.shadowmap_fragment,THREE.ShaderChunk.fog_fragment," gl_FragColor = vec4( outgoingLight, diffuseColor.a );\n}"].join("\n")},dashed:{uniforms:THREE.UniformsUtils.merge([THREE.UniformsLib.common,THREE.UniformsLib.fog,{scale:{type:"f",value:1},dashSize:{type:"f",value:1},totalSize:{type:"f",value:2}}]),vertexShader:["uniform float scale;\nattribute float lineDistance;\nvarying float vLineDistance;",THREE.ShaderChunk.common,THREE.ShaderChunk.color_pars_vertex,THREE.ShaderChunk.logdepthbuf_pars_vertex,"void main() {",THREE.ShaderChunk.color_vertex," vLineDistance = scale * lineDistance;\n vec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );\n gl_Position = projectionMatrix * mvPosition;",THREE.ShaderChunk.logdepthbuf_vertex,"}"].join("\n"),fragmentShader:["uniform vec3 diffuse;\nuniform float opacity;\nuniform float dashSize;\nuniform float totalSize;\nvarying float vLineDistance;",THREE.ShaderChunk.common,THREE.ShaderChunk.color_pars_fragment,THREE.ShaderChunk.fog_pars_fragment,THREE.ShaderChunk.logdepthbuf_pars_fragment,"void main() {\n if ( mod( vLineDistance, totalSize ) > dashSize ) {\n discard;\n }\n vec3 outgoingLight = vec3( 0.0 );\n vec4 diffuseColor = vec4( diffuse, opacity );",THREE.ShaderChunk.logdepthbuf_fragment,THREE.ShaderChunk.color_fragment," outgoingLight = diffuseColor.rgb;",THREE.ShaderChunk.fog_fragment," gl_FragColor = vec4( outgoingLight, diffuseColor.a );\n}"].join("\n")},depth:{uniforms:{mNear:{type:"f",value:1},mFar:{type:"f",value:2e3},opacity:{type:"f",value:1}},vertexShader:[THREE.ShaderChunk.common,THREE.ShaderChunk.morphtarget_pars_vertex,THREE.ShaderChunk.logdepthbuf_pars_vertex,"void main() {",THREE.ShaderChunk.morphtarget_vertex,THREE.ShaderChunk.default_vertex,THREE.ShaderChunk.logdepthbuf_vertex,"}"].join("\n"),fragmentShader:["uniform float mNear;\nuniform float mFar;\nuniform float opacity;",THREE.ShaderChunk.common,THREE.ShaderChunk.logdepthbuf_pars_fragment,"void main() {",THREE.ShaderChunk.logdepthbuf_fragment," #ifdef USE_LOGDEPTHBUF_EXT\n float depth = gl_FragDepthEXT / gl_FragCoord.w;\n #else\n float depth = gl_FragCoord.z / gl_FragCoord.w;\n #endif\n float color = 1.0 - smoothstep( mNear, mFar, depth );\n gl_FragColor = vec4( vec3( color ), opacity );\n}"].join("\n")},normal:{uniforms:{opacity:{type:"f",value:1}},vertexShader:["varying vec3 vNormal;",THREE.ShaderChunk.common,THREE.ShaderChunk.morphtarget_pars_vertex,THREE.ShaderChunk.logdepthbuf_pars_vertex,"void main() {\n vNormal = normalize( normalMatrix * normal );",THREE.ShaderChunk.morphtarget_vertex,THREE.ShaderChunk.default_vertex,THREE.ShaderChunk.logdepthbuf_vertex,"}"].join("\n"),fragmentShader:["uniform float opacity;\nvarying vec3 vNormal;",THREE.ShaderChunk.common,THREE.ShaderChunk.logdepthbuf_pars_fragment,"void
null!==ga.boneTextureHeight&&W.uniform1i(ga.boneTextureHeight,e.skeleton.boneTextureHeight)}else e.skeleton&&e.skeleton.boneMatrices&&null!==ga.boneGlobalMatrices&&W.uniformMatrix4fv(ga.boneGlobalMatrices,!1,e.skeleton.boneMatrices);if(da){if(c&&d.fog&&(ha.fogColor.value=c.color,c instanceof THREE.Fog?(ha.fogNear.value=c.near,ha.fogFar.value=c.far):c instanceof THREE.FogExp2&&(ha.fogDensity.value=c.density)),d instanceof THREE.MeshPhongMaterial||d instanceof THREE.MeshLambertMaterial||d.lights){if(na){var ja,ka,pa,qa,ra,sa,ta,ua,ea=!0,va=0,wa=0,xa=0,ya=oa,Ca=ya.directional.colors,Da=ya.directional.positions,Ea=ya.point.colors,Fa=ya.point.positions,Ha=ya.point.distances,Ia=ya.point.decays,Ja=ya.spot.colors,Ka=ya.spot.positions,La=ya.spot.distances,Ma=ya.spot.directions,Na=ya.spot.anglesCos,Pa=ya.spot.exponents,Ra=ya.spot.decays,Ta=ya.hemi.skyColors,Ua=ya.hemi.groundColors,Wa=ya.hemi.positions,Xa=0,Ya=0,Za=0,$a=0,_a=0,ab=0,bb=0,cb=0,db=0,eb=0,fb=0,gb=0;for(ja=0,ka=b.length;ka>ja;ja++)pa=b[ja],pa.onlyShadow||(qa=pa.color,ta=pa.intensity,ua=pa.distance,pa instanceof THREE.AmbientLight?pa.visible&&(va+=qa.r,wa+=qa.g,xa+=qa.b):pa instanceof THREE.DirectionalLight?(_a+=1,pa.visible&&(ma.setFromMatrixPosition(pa.matrixWorld),la.setFromMatrixPosition(pa.target.matrixWorld),ma.sub(la),ma.normalize(),db=3*Xa,Da[db]=ma.x,Da[db+1]=ma.y,Da[db+2]=ma.z,v(Ca,db,qa,ta),Xa+=1)):pa instanceof THREE.PointLight?(ab+=1,pa.visible&&(eb=3*Ya,v(Ea,eb,qa,ta),la.setFromMatrixPosition(pa.matrixWorld),Fa[eb]=la.x,Fa[eb+1]=la.y,Fa[eb+2]=la.z,Ha[Ya]=ua,Ia[Ya]=0===pa.distance?0:pa.decay,Ya+=1)):pa instanceof THREE.SpotLight?(bb+=1,pa.visible&&(fb=3*Za,v(Ja,fb,qa,ta),ma.setFromMatrixPosition(pa.matrixWorld),Ka[fb]=ma.x,Ka[fb+1]=ma.y,Ka[fb+2]=ma.z,La[Za]=ua,la.setFromMatrixPosition(pa.target.matrixWorld),ma.sub(la),ma.normalize(),Ma[fb]=ma.x,Ma[fb+1]=ma.y,Ma[fb+2]=ma.z,Na[Za]=Math.cos(pa.angle),Pa[Za]=pa.exponent,Ra[Za]=0===pa.distance?0:pa.decay,Za+=1)):pa instanceof THREE.HemisphereLight&&(cb+=1,pa.visible&&(ma.setFromMatrixPosition(pa.matrixWorld),ma.normalize(),gb=3*$a,Wa[gb]=ma.x,Wa[gb+1]=ma.y,Wa[gb+2]=ma.z,ra=pa.color,sa=pa.groundColor,v(Ta,gb,ra,ta),v(Ua,gb,sa,ta),$a+=1)));for(ja=3*Xa,ka=Math.max(Ca.length,3*_a);ka>ja;ja++)Ca[ja]=0;for(ja=3*Ya,ka=Math.max(Ea.length,3*ab);ka>ja;ja++)Ea[ja]=0;for(ja=3*Za,ka=Math.max(Ja.length,3*bb);ka>ja;ja++)Ja[ja]=0;for(ja=3*$a,ka=Math.max(Ta.length,3*cb);ka>ja;ja++)Ta[ja]=0;for(ja=3*$a,ka=Math.max(Ua.length,3*cb);ka>ja;ja++)Ua[ja]=0;ya.directional.length=Xa,ya.point.length=Ya,ya.spot.length=Za,ya.hemi.length=$a,ya.ambient[0]=va,ya.ambient[1]=wa,ya.ambient[2]=xa,na=!1}if(ea){var hb=oa;ha.ambientLightColor.value=hb.ambient,ha.directionalLightColor.value=hb.directional.colors,ha.directionalLightDirection.value=hb.directional.positions,ha.pointLightColor.value=hb.point.colors,ha.pointLightPosition.value=hb.point.positions,ha.pointLightDistance.value=hb.point.distances,ha.pointLightDecay.value=hb.point.decays,ha.spotLightColor.value=hb.spot.colors,ha.spotLightPosition.value=hb.spot.positions,ha.spotLightDistance.value=hb.spot.distances,ha.spotLightDirection.value=hb.spot.directions,ha.spotLightAngleCos.value=hb.spot.anglesCos,ha.spotLightExponent.value=hb.spot.exponents,ha.spotLightDecay.value=hb.spot.decays,ha.hemisphereLightSkyColor.value=hb.hemi.skyColors,ha.hemisphereLightGroundColor.value=hb.hemi.groundColors,ha.hemisphereLightDirection.value=hb.hemi.positions,s(ha,!0)}else s(ha,!1)}if(d instanceof THREE.MeshBasicMaterial||d instanceof THREE.MeshLambertMaterial||d instanceof THREE.MeshPhongMaterial){ha.opacity.value=d.opacity,ha.diffuse.value=d.color,ha.map.value=d.map,ha.lightMap.value=d.lightMap,ha.specularMap.value=d.specularMap,ha.alphaMap.value=d.alphaMap,d.bumpMap&&(ha.bumpMap.value=d.bumpMap,ha.bumpScale.value=d.bumpScale),d.normalMap&&(ha.normalMap.value=d.normalMap,ha.normalScale.value.copy(d.normalScale));var ib;if(d.map?ib=d.map:d.specularMap?ib=d.specularMap:d.normalMap?ib=d.normalMap:d.bumpMap?ib=d.bumpMap:d.alphaMap&&(ib=d.alphaMap),void 0!==ib){var jb=ib.offset,kb=ib.repeat;ha.offsetRepeat.value.se
W.vertexAttribPointer(h,3,W.FLOAT,!1,0,0)),h=c["morphNormal"+i],h>=0&&d.morphNormals&&(W.bindBuffer(W.ARRAY_BUFFER,e.__webglMorphNormalsBuffers[m]),ra.enableAttribute(h),W.vertexAttribPointer(h,3,W.FLOAT,!1,0,0)),f.__webglMorphTargetInfluences[i]=k[m]}else f.__webglMorphTargetInfluences[i]=0}null!==d.program.uniforms.morphTargetInfluences&&W.uniform1fv(d.program.uniforms.morphTargetInfluences,f.__webglMorphTargetInfluences)}if(a){if(e.__webglCustomAttributesList)for(c=0,k=e.__webglCustomAttributesList.length;k>c;c++)j=e.__webglCustomAttributesList[c],0<=b[j.buffer.belongsToAttribute]&&(W.bindBuffer(W.ARRAY_BUFFER,j.buffer),ra.enableAttribute(b[j.buffer.belongsToAttribute]),W.vertexAttribPointer(b[j.buffer.belongsToAttribute],j.size,W.FLOAT,!1,0,0));0<=b.color&&(0<f.geometry.colors.length||0<f.geometry.faces.length?(W.bindBuffer(W.ARRAY_BUFFER,e.__webglColorBuffer),ra.enableAttribute(b.color),W.vertexAttribPointer(b.color,3,W.FLOAT,!1,0,0)):void 0!==d.defaultAttributeValues&&W.vertexAttrib3fv(b.color,d.defaultAttributeValues.color)),0<=b.normal&&(W.bindBuffer(W.ARRAY_BUFFER,e.__webglNormalBuffer),ra.enableAttribute(b.normal),W.vertexAttribPointer(b.normal,3,W.FLOAT,!1,0,0)),0<=b.tangent&&(W.bindBuffer(W.ARRAY_BUFFER,e.__webglTangentBuffer),ra.enableAttribute(b.tangent),W.vertexAttribPointer(b.tangent,4,W.FLOAT,!1,0,0)),0<=b.uv&&(f.geometry.faceVertexUvs[0]?(W.bindBuffer(W.ARRAY_BUFFER,e.__webglUVBuffer),ra.enableAttribute(b.uv),W.vertexAttribPointer(b.uv,2,W.FLOAT,!1,0,0)):void 0!==d.defaultAttributeValues&&W.vertexAttrib2fv(b.uv,d.defaultAttributeValues.uv)),0<=b.uv2&&(f.geometry.faceVertexUvs[1]?(W.bindBuffer(W.ARRAY_BUFFER,e.__webglUV2Buffer),ra.enableAttribute(b.uv2),W.vertexAttribPointer(b.uv2,2,W.FLOAT,!1,0,0)):void 0!==d.defaultAttributeValues&&W.vertexAttrib2fv(b.uv2,d.defaultAttributeValues.uv2)),d.skinning&&0<=b.skinIndex&&0<=b.skinWeight&&(W.bindBuffer(W.ARRAY_BUFFER,e.__webglSkinIndicesBuffer),ra.enableAttribute(b.skinIndex),W.vertexAttribPointer(b.skinIndex,4,W.FLOAT,!1,0,0),W.bindBuffer(W.ARRAY_BUFFER,e.__webglSkinWeightsBuffer),ra.enableAttribute(b.skinWeight),W.vertexAttribPointer(b.skinWeight,4,W.FLOAT,!1,0,0)),0<=b.lineDistance&&(W.bindBuffer(W.ARRAY_BUFFER,e.__webglLineDistanceBuffer),ra.enableAttribute(b.lineDistance),W.vertexAttribPointer(b.lineDistance,1,W.FLOAT,!1,0,0))}ra.disableUnusedAttributes(),f instanceof THREE.Mesh?(f=e.__typeArray===Uint32Array?W.UNSIGNED_INT:W.UNSIGNED_SHORT,d.wireframe?(ra.setLineWidth(d.wireframeLinewidth*E),a&&W.bindBuffer(W.ELEMENT_ARRAY_BUFFER,e.__webglLineBuffer),W.drawElements(W.LINES,e.__webglLineCount,f,0)):(a&&W.bindBuffer(W.ELEMENT_ARRAY_BUFFER,e.__webglFaceBuffer),W.drawElements(W.TRIANGLES,e.__webglFaceCount,f,0)),X.info.render.calls++,X.info.render.vertices+=e.__webglFaceCount,X.info.render.faces+=e.__webglFaceCount/3):f instanceof THREE.Line?(f=f.mode===THREE.LineStrip?W.LINE_STRIP:W.LINES,ra.setLineWidth(d.linewidth*E),W.drawArrays(f,0,e.__webglLineCount),X.info.render.calls++):f instanceof THREE.PointCloud&&(W.drawArrays(W.POINTS,0,e.__webglParticleCount),X.info.render.calls++,X.info.render.points+=e.__webglParticleCount)}},this.render=function(a,b,c,d){if(!1==b instanceof THREE.Camera)THREE.error("THREE.WebGLRenderer.render: camera is not an instance of THREE.Camera.");else{var g=a.fog;aa="",_=-1,ba=null,na=!0,!0===a.autoUpdate&&a.updateMatrixWorld(),void 0===b.parent&&b.updateMatrixWorld(),a.traverse(function(a){a instanceof THREE.SkinnedMesh&&a.skeleton.update()}),b.matrixWorldInverse.getInverse(b.matrixWorld),ka.multiplyMatrices(b.projectionMatrix,b.matrixWorldInverse),ja.setFromMatrix(ka),P.length=0,S.length=0,T.length=0,U.length=0,V.length=0,h(a),!0===X.sortObjects&&(S.sort(e),T.sort(f)),Ja.render(a,b),X.info.render.calls=0,X.info.render.vertices=0,X.info.render.faces=0,X.info.render.points=0,this.setRenderTarget(c),(this.autoClear||d)&&this.clear(this.autoClearColor,this.autoClearDepth,this.autoClearStencil),d=0;for(var l=R.length;l>d;d++){var m=R[d],n=m.object;n.visible&&(u(n,b),k(m))}a.overrideMaterial?(d=a.overrideMaterial,q(d),i(S,b,P,g,d),i(T,b
c.add(t.cameraHelper)),t.isVirtual&&A.originalCamera==q){for(v=q,u=t.shadowCamera,w=t.pointsFrustum,x=t.pointsWorld,m.set(1/0,1/0,1/0),n.set(-(1/0),-(1/0),-(1/0)),B=0;8>B;B++)y=x[B],y.copy(w[B]),y.unproject(v),y.applyMatrix4(u.matrixWorldInverse),y.x<m.x&&(m.x=y.x),y.x>n.x&&(n.x=y.x),y.y<m.y&&(m.y=y.y),y.y>n.y&&(n.y=y.y),y.z<m.z&&(m.z=y.z),y.z>n.z&&(n.z=y.z);u.left=m.x,u.right=n.x,u.top=n.y,u.bottom=m.y,u.updateProjectionMatrix()}for(u=t.shadowMap,w=t.shadowMatrix,v=t.shadowCamera,v.position.setFromMatrixPosition(t.matrixWorld),o.setFromMatrixPosition(t.target.matrixWorld),v.lookAt(o),v.updateMatrixWorld(),v.matrixWorldInverse.getInverse(v.matrixWorld),t.cameraHelper&&(t.cameraHelper.visible=t.shadowCameraVisible),t.shadowCameraVisible&&t.cameraHelper.update(),w.set(.5,0,0,.5,0,.5,0,.5,0,0,.5,.5,0,0,0,1),w.multiply(v.projectionMatrix),w.multiply(v.matrixWorldInverse),l.multiplyMatrices(v.projectionMatrix,v.matrixWorldInverse),k.setFromMatrix(l),a.setRenderTarget(u),a.clear(),p.length=0,e(c,c,v),t=0,u=p.length;u>t;t++)x=p[t],w=x.object,x=x.buffer,B=w.material instanceof THREE.MeshFaceMaterial?w.material.materials[0]:w.material,y=void 0!==w.geometry.morphTargets&&0<w.geometry.morphTargets.length&&B.morphTargets,C=w instanceof THREE.SkinnedMesh&&B.skinning,y=w.customDepthMaterial?w.customDepthMaterial:C?y?i:h:y?g:f,a.setMaterialFaces(B),x instanceof THREE.BufferGeometry?a.renderBufferDirect(v,b,null,y,x,w):a.renderBuffer(v,b,null,y,x,w);for(t=0,u=d.length;u>t;t++)x=d[t],w=x.object,w.visible&&w.castShadow&&(w._modelViewMatrix.multiplyMatrices(v.matrixWorldInverse,w.matrixWorld),a.renderImmediateObject(v,b,null,f,w))}r=a.getClearColor(),s=a.getClearAlpha(),j.clearColor(r.r,r.g,r.b,s),j.enable(j.BLEND),a.shadowMapCullFace===THREE.CullFaceFront&&j.cullFace(j.BACK),a.resetGLState()}}},THREE.SpritePlugin=function(a,b){function c(a,b){return a.z!==b.z?b.z-a.z:b.id-a.id}var d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y=a.context,z=new THREE.Vector3,A=new THREE.Quaternion,B=new THREE.Vector3;this.render=function(C,D){if(0!==b.length){if(void 0===w){var E=new Float32Array([-.5,-.5,0,0,.5,-.5,1,0,.5,.5,1,1,-.5,.5,0,1]),F=new Uint16Array([0,1,2,0,2,3]);u=y.createBuffer(),v=y.createBuffer(),y.bindBuffer(y.ARRAY_BUFFER,u),y.bufferData(y.ARRAY_BUFFER,E,y.STATIC_DRAW),y.bindBuffer(y.ELEMENT_ARRAY_BUFFER,v),y.bufferData(y.ELEMENT_ARRAY_BUFFER,F,y.STATIC_DRAW);var E=y.createProgram(),F=y.createShader(y.VERTEX_SHADER),G=y.createShader(y.FRAGMENT_SHADER);y.shaderSource(F,["precision "+a.getPrecision()+" float;","uniform mat4 modelViewMatrix;\nuniform mat4 projectionMatrix;\nuniform float rotation;\nuniform vec2 scale;\nuniform vec2 uvOffset;\nuniform vec2 uvScale;\nattribute vec2 position;\nattribute vec2 uv;\nvarying vec2 vUV;\nvoid main() {\nvUV = uvOffset + uv * uvScale;\nvec2 alignedPosition = position * scale;\nvec2 rotatedPosition;\nrotatedPosition.x = cos( rotation ) * alignedPosition.x - sin( rotation ) * alignedPosition.y;\nrotatedPosition.y = sin( rotation ) * alignedPosition.x + cos( rotation ) * alignedPosition.y;\nvec4 finalPosition;\nfinalPosition = modelViewMatrix * vec4( 0.0, 0.0, 0.0, 1.0 );\nfinalPosition.xy += rotatedPosition;\nfinalPosition = projectionMatrix * finalPosition;\ngl_Position = finalPosition;\n}"].join("\n")),y.shaderSource(G,["precision "+a.getPrecision()+" float;","uniform vec3 color;\nuniform sampler2D map;\nuniform float opacity;\nuniform int fogType;\nuniform vec3 fogColor;\nuniform float fogDensity;\nuniform float fogNear;\nuniform float fogFar;\nuniform float alphaTest;\nvarying vec2 vUV;\nvoid main() {\nvec4 texture = texture2D( map, vUV );\nif ( texture.a < alphaTest ) discard;\ngl_FragColor = vec4( color * texture.xyz, texture.a * opacity );\nif ( fogType > 0 ) {\nfloat depth = gl_FragCoord.z / gl_FragCoord.w;\nfloat fogFactor = 0.0;\nif ( fogType == 1 ) {\nfogFactor = smoothstep( fogNear, fogFar, depth );\n} else {\nconst float LOG2 = 1.442695;\nfloat fogFactor = exp2( - fogDensity * fogDensity * depth * depth * LOG2 );\nfogFactor = 1.0 - clamp( fogFactor, 0.0, 1.0 );\n}\ngl_FragColor = mix( gl_FragCo
this.v2=c},THREE.QuadraticBezierCurve.prototype=Object.create(THREE.Curve.prototype),THREE.QuadraticBezierCurve.prototype.constructor=THREE.QuadraticBezierCurve,THREE.QuadraticBezierCurve.prototype.getPoint=function(a){var b=new THREE.Vector2;return b.x=THREE.Shape.Utils.b2(a,this.v0.x,this.v1.x,this.v2.x),b.y=THREE.Shape.Utils.b2(a,this.v0.y,this.v1.y,this.v2.y),b},THREE.QuadraticBezierCurve.prototype.getTangent=function(a){var b=new THREE.Vector2;return b.x=THREE.Curve.Utils.tangentQuadraticBezier(a,this.v0.x,this.v1.x,this.v2.x),b.y=THREE.Curve.Utils.tangentQuadraticBezier(a,this.v0.y,this.v1.y,this.v2.y),b.normalize()},THREE.CubicBezierCurve=function(a,b,c,d){this.v0=a,this.v1=b,this.v2=c,this.v3=d},THREE.CubicBezierCurve.prototype=Object.create(THREE.Curve.prototype),THREE.CubicBezierCurve.prototype.constructor=THREE.CubicBezierCurve,THREE.CubicBezierCurve.prototype.getPoint=function(a){var b;return b=THREE.Shape.Utils.b3(a,this.v0.x,this.v1.x,this.v2.x,this.v3.x),a=THREE.Shape.Utils.b3(a,this.v0.y,this.v1.y,this.v2.y,this.v3.y),new THREE.Vector2(b,a)},THREE.CubicBezierCurve.prototype.getTangent=function(a){var b;return b=THREE.Curve.Utils.tangentCubicBezier(a,this.v0.x,this.v1.x,this.v2.x,this.v3.x),a=THREE.Curve.Utils.tangentCubicBezier(a,this.v0.y,this.v1.y,this.v2.y,this.v3.y),b=new THREE.Vector2(b,a),b.normalize(),b},THREE.SplineCurve=function(a){this.points=void 0==a?[]:a},THREE.SplineCurve.prototype=Object.create(THREE.Curve.prototype),THREE.SplineCurve.prototype.constructor=THREE.SplineCurve,THREE.SplineCurve.prototype.getPoint=function(a){var b=this.points;a*=b.length-1;var c=Math.floor(a);a-=c;var d=b[0==c?c:c-1],e=b[c],f=b[c>b.length-2?b.length-1:c+1],b=b[c>b.length-3?b.length-1:c+2],c=new THREE.Vector2;return c.x=THREE.Curve.Utils.interpolate(d.x,e.x,f.x,b.x,a),c.y=THREE.Curve.Utils.interpolate(d.y,e.y,f.y,b.y,a),c},THREE.EllipseCurve=function(a,b,c,d,e,f,g){this.aX=a,this.aY=b,this.xRadius=c,this.yRadius=d,this.aStartAngle=e,this.aEndAngle=f,this.aClockwise=g},THREE.EllipseCurve.prototype=Object.create(THREE.Curve.prototype),THREE.EllipseCurve.prototype.constructor=THREE.EllipseCurve,THREE.EllipseCurve.prototype.getPoint=function(a){var b=this.aEndAngle-this.aStartAngle;return 0>b&&(b+=2*Math.PI),b>2*Math.PI&&(b-=2*Math.PI),a=!0===this.aClockwise?this.aEndAngle+(1-a)*(2*Math.PI-b):this.aStartAngle+a*b,b=new THREE.Vector2,b.x=this.aX+this.xRadius*Math.cos(a),b.y=this.aY+this.yRadius*Math.sin(a),b},THREE.ArcCurve=function(a,b,c,d,e,f){THREE.EllipseCurve.call(this,a,b,c,c,d,e,f)},THREE.ArcCurve.prototype=Object.create(THREE.EllipseCurve.prototype),THREE.ArcCurve.prototype.constructor=THREE.ArcCurve,THREE.LineCurve3=THREE.Curve.create(function(a,b){this.v1=a,this.v2=b},function(a){var b=new THREE.Vector3;return b.subVectors(this.v2,this.v1),b.multiplyScalar(a),b.add(this.v1),b}),THREE.QuadraticBezierCurve3=THREE.Curve.create(function(a,b,c){this.v0=a,this.v1=b,this.v2=c},function(a){var b=new THREE.Vector3;return b.x=THREE.Shape.Utils.b2(a,this.v0.x,this.v1.x,this.v2.x),b.y=THREE.Shape.Utils.b2(a,this.v0.y,this.v1.y,this.v2.y),b.z=THREE.Shape.Utils.b2(a,this.v0.z,this.v1.z,this.v2.z),b}),THREE.CubicBezierCurve3=THREE.Curve.create(function(a,b,c,d){this.v0=a,this.v1=b,this.v2=c,this.v3=d},function(a){var b=new THREE.Vector3;return b.x=THREE.Shape.Utils.b3(a,this.v0.x,this.v1.x,this.v2.x,this.v3.x),b.y=THREE.Shape.Utils.b3(a,this.v0.y,this.v1.y,this.v2.y,this.v3.y),b.z=THREE.Shape.Utils.b3(a,this.v0.z,this.v1.z,this.v2.z,this.v3.z),b}),THREE.SplineCurve3=THREE.Curve.create(function(a){this.points=void 0==a?[]:a},function(a){var b=this.points;a*=b.length-1;var c=Math.floor(a);a-=c;var d=b[0==c?c:c-1],e=b[c],f=b[c>b.length-2?b.length-1:c+1],b=b[c>b.length-3?b.length-1:c+2],c=new THREE.Vector3;return c.x=THREE.Curve.Utils.interpolate(d.x,e.x,f.x,b.x,a),c.y=THREE.Curve.Utils.interpolate(d.y,e.y,f.y,b.y,a),c.z=THREE.Curve.Utils.interpolate(d.z,e.z,f.z,b.z,a),c}),THREE.ClosedSplineCurve3=THREE.Curve.create(function(a){this.points=void 0==a?[]:a},function(a){var b=this.points;a*=b.length-0;var c=Math.floor(a);a-=c;
d=e*d*Math.sin(a)*.5,new THREE.Vector3(f,g,d)}THREE.Geometry.call(this),this.type="TorusKnotGeometry",this.parameters={radius:a,tube:b,radialSegments:c,tubularSegments:d,p:e,q:f,heightScale:g},a=a||100,b=b||40,c=c||64,d=d||8,e=e||2,f=f||3,g=g||1;for(var i=Array(c),j=new THREE.Vector3,k=new THREE.Vector3,l=new THREE.Vector3,m=0;c>m;++m){i[m]=Array(d);var n=m/c*2*e*Math.PI,o=h(n,f,e,a,g),n=h(n+.01,f,e,a,g);for(j.subVectors(n,o),k.addVectors(n,o),l.crossVectors(j,k),k.crossVectors(l,j),l.normalize(),k.normalize(),n=0;d>n;++n){var p=n/d*2*Math.PI,q=-b*Math.cos(p),p=b*Math.sin(p),r=new THREE.Vector3;r.x=o.x+q*k.x+p*l.x,r.y=o.y+q*k.y+p*l.y,r.z=o.z+q*k.z+p*l.z,i[m][n]=this.vertices.push(r)-1}}for(m=0;c>m;++m)for(n=0;d>n;++n)e=(m+1)%c,f=(n+1)%d,a=i[m][n],b=i[e][n],e=i[e][f],f=i[m][f],g=new THREE.Vector2(m/c,n/d),j=new THREE.Vector2((m+1)/c,n/d),k=new THREE.Vector2((m+1)/c,(n+1)/d),l=new THREE.Vector2(m/c,(n+1)/d),this.faces.push(new THREE.Face3(a,b,f)),this.faceVertexUvs[0].push([g,j,l]),this.faces.push(new THREE.Face3(b,e,f)),this.faceVertexUvs[0].push([j.clone(),k,l.clone()]);this.computeFaceNormals(),this.computeVertexNormals()},THREE.TorusKnotGeometry.prototype=Object.create(THREE.Geometry.prototype),THREE.TorusKnotGeometry.prototype.constructor=THREE.TorusKnotGeometry,THREE.TubeGeometry=function(a,b,c,d,e,f){THREE.Geometry.call(this),this.type="TubeGeometry",this.parameters={path:a,segments:b,radius:c,radialSegments:d,closed:e},b=b||64,c=c||1,d=d||8,e=e||!1,f=f||THREE.TubeGeometry.NoTaper;var g,h,i,j,k,l,m,n,o,p,q=[],r=b+1,s=new THREE.Vector3;for(n=new THREE.TubeGeometry.FrenetFrames(a,b,e),o=n.normals,p=n.binormals,this.tangents=n.tangents,this.normals=o,this.binormals=p,n=0;r>n;n++)for(q[n]=[],i=n/(r-1),m=a.getPointAt(i),g=o[n],h=p[n],k=c*f(i),i=0;d>i;i++)j=i/d*2*Math.PI,l=-k*Math.cos(j),j=k*Math.sin(j),s.copy(m),s.x+=l*g.x+j*h.x,s.y+=l*g.y+j*h.y,s.z+=l*g.z+j*h.z,q[n][i]=this.vertices.push(new THREE.Vector3(s.x,s.y,s.z))-1;for(n=0;b>n;n++)for(i=0;d>i;i++)f=e?(n+1)%b:n+1,r=(i+1)%d,a=q[n][i],c=q[f][i],f=q[f][r],r=q[n][r],s=new THREE.Vector2(n/b,i/d),o=new THREE.Vector2((n+1)/b,i/d),p=new THREE.Vector2((n+1)/b,(i+1)/d),g=new THREE.Vector2(n/b,(i+1)/d),this.faces.push(new THREE.Face3(a,c,r)),this.faceVertexUvs[0].push([s,o,g]),this.faces.push(new THREE.Face3(c,f,r)),this.faceVertexUvs[0].push([o.clone(),p,g.clone()]);this.computeFaceNormals(),this.computeVertexNormals()},THREE.TubeGeometry.prototype=Object.create(THREE.Geometry.prototype),THREE.TubeGeometry.prototype.constructor=THREE.TubeGeometry,THREE.TubeGeometry.NoTaper=function(a){return 1},THREE.TubeGeometry.SinusoidalTaper=function(a){return Math.sin(Math.PI*a)},THREE.TubeGeometry.FrenetFrames=function(a,b,c){var d=new THREE.Vector3,e=[],f=[],g=[],h=new THREE.Vector3,i=new THREE.Matrix4;b+=1;var j,k,l;for(this.tangents=e,this.normals=f,this.binormals=g,j=0;b>j;j++)k=j/(b-1),e[j]=a.getTangentAt(k),e[j].normalize();for(f[0]=new THREE.Vector3,g[0]=new THREE.Vector3,a=Number.MAX_VALUE,j=Math.abs(e[0].x),k=Math.abs(e[0].y),l=Math.abs(e[0].z),a>=j&&(a=j,d.set(1,0,0)),a>=k&&(a=k,d.set(0,1,0)),a>=l&&d.set(0,0,1),h.crossVectors(e[0],d).normalize(),f[0].crossVectors(e[0],h),g[0].crossVectors(e[0],f[0]),j=1;b>j;j++)f[j]=f[j-1].clone(),g[j]=g[j-1].clone(),h.crossVectors(e[j-1],e[j]),1e-4<h.length()&&(h.normalize(),d=Math.acos(THREE.Math.clamp(e[j-1].dot(e[j]),-1,1)),f[j].applyMatrix4(i.makeRotationAxis(h,d))),g[j].crossVectors(e[j],f[j]);if(c)for(d=Math.acos(THREE.Math.clamp(f[0].dot(f[b-1]),-1,1)),d/=b-1,0<e[0].dot(h.crossVectors(f[0],f[b-1]))&&(d=-d),j=1;b>j;j++)f[j].applyMatrix4(i.makeRotationAxis(e[j],d*j)),g[j].crossVectors(e[j],f[j])},THREE.PolyhedronGeometry=function(a,b,c,d){function e(a){var b=a.normalize().clone();b.index=i.vertices.push(b)-1;var c=Math.atan2(a.z,-a.x)/2/Math.PI+.5;return a=Math.atan2(-a.y,Math.sqrt(a.x*a.x+a.z*a.z))/Math.PI+.5,b.uv=new THREE.Vector2(c,1-a),b}function f(a,b,c){var d=new THREE.Face3(a.index,b.index,c.index,[a.clone(),b.clone(),c.clone()]);i.faces.push(d),q.copy(a).add(b).add(c).divideScalar(3),d=Math.atan2(q.z,-q.x),i.faceVertexUvs[0].pu