compo.filler音乐可视化屏保三维频谱动画效果代码

代码语言:html

所属分类:动画

代码描述:compo.filler音乐可视化屏保三维频谱动画效果代码

代码标签: compo filler 动画 屏保 可视化 频谱

下面为部分代码预览,完整代码请点击下载或在bfwstudio webide中打开

<!DOCTYPE HTML>
<html>

<head>

    <meta name="viewport" content="width=device-width, user-scalable=no, minimum-scale=1.0, maximum-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="chrome=1">
    <style type="text/css">
        body { color: white; background-color: black; font-family: Helvetica; font-size: 20px; margin: 0px; overflow: hidden; }
        			.title { color: #444; font-size: 64px; font-style: italic; letter-spacing: .125em; }
        			.by-line { color: #222; font-size: 16px; margin-top: -1em; margin-left:20em; font-style: italic; letter-spacing: .5em; }
        			.start { background-color: #111; color: #ccc; cursor: pointer; font-style: bold; margin-top: .75em; padding: .25em; font-style: italic; letter-spacing: .5em; }
        			.start:hover { background-color: #222; }
        			.credits1 { display: block; color: #444; font-size: 16px; font-style: italic; margin-top: 1em; letter-spacing: .25em; opacity: .75; }
        			.credits2 { display: block; color: #444; font-size: 16px; font-style: italic; margin-top: .25em; letter-spacing: .25em; opacity: .75; }
        			a { text-decoration: none; }
        			a:hover { color:#888; text-decoration: none; }
    </style>
</head>

<body>
    <div id="splash" style="padding-top: 225px; text-align: center">
        <div class='title'>compo/filler</div>
        <div class='by-line'>by vrtx</div>
        <div class='start' onClick="start(0);">start demo</div>

    </div>
    <audio id="audio" autobuffer>
	
			<source src="//repo.bfw.wiki/bfwrepo/sound/5c89fd22dea6948307.mp3" type="audio/mpeg">
		</audio>
    <script type="text/javascript">
        var THREE=THREE||{REVISION:"48"};if(!self.Int32Array)self.Int32Array=Array,self.Float32Array=Array;
(function(){for(var a=0,b=["ms","moz","webkit","o"],c=0;c<b.length&&!window.requestAnimationFrame;++c)window.requestAnimationFrame=window[b[c]+"RequestAnimationFrame"],window.cancelAnimationFrame=window[b[c]+"CancelAnimationFrame"]||window[b[c]+"CancelRequestAnimationFrame"];if(!window.requestAnimationFrame)window.requestAnimationFrame=function(b){var c=(new Date).getTime(),g=Math.max(0,16-(c-a)),e=window.setTimeout(function(){b(c+g)},g);a=c+g;return e};if(!window.cancelAnimationFrame)window.cancelAnimationFrame=
function(a){clearTimeout(a)}})();THREE.Clock=function(a){this.autoStart=a!==void 0?a:!0;this.elapsedTime=this.oldTime=this.startTime=0;this.running=!1};THREE.Clock.prototype.start=function(){this.oldTime=this.startTime=Date.now();this.running=!0};THREE.Clock.prototype.stop=function(){this.getElapsedTime();this.running=!1};THREE.Clock.prototype.getElapsedTime=function(){this.elapsedTime+=this.getDelta();return this.elapsedTime};
THREE.Clock.prototype.getDelta=function(){var a=0;this.autoStart&&!this.running&&this.start();if(this.running){var b=Date.now(),a=0.001*(b-this.oldTime);this.oldTime=b;this.elapsedTime+=a}return a};THREE.Color=function(a){a!==void 0&&this.setHex(a);return this};
THREE.Color.prototype={constructor:THREE.Color,r:1,g:1,b:1,copy:function(a){this.r=a.r;this.g=a.g;this.b=a.b;return this},copyGammaToLinear:function(a){this.r=a.r*a.r;this.g=a.g*a.g;this.b=a.b*a.b;return this},copyLinearToGamma:function(a){this.r=Math.sqrt(a.r);this.g=Math.sqrt(a.g);this.b=Math.sqrt(a.b);return this},convertGammaToLinear:function(){var a=this.r,b=this.g,c=this.b;this.r=a*a;this.g=b*b;this.b=c*c;return this},convertLinearToGamma:function(){this.r=Math.sqrt(this.r);this.g=Math.sqrt(this.g);
this.b=Math.sqrt(this.b);return this},setRGB:function(a,b,c){this.r=a;this.g=b;this.b=c;return this},setHSV:function(a,b,c){var d,f,g;if(c===0)this.r=this.g=this.b=0;else switch(d=Math.floor(a*6),f=a*6-d,a=c*(1-b),g=c*(1-b*f),b=c*(1-b*(1-f)),d){case 1:this.r=g;this.g=c;this.b=a;break;case 2:this.r=a;this.g=c;this.b=b;break;case 3:this.r=a;this.g=g;this.b=c;break;case 4:this.r=b;this.g=a;this.b=c;break;case 5:this.r=c;this.g=a;this.b=g;break;case 6:case 0:this.r=c,this.g=b,this.b=a}return this},setHex:function(a){a=
Math.floor(a);this.r=(a>>16&255)/255;this.g=(a>>8&255)/255;this.b=(a&255)/255;return this},getHex:function(){return Math.floor(this.r*255)<<16^Math.floor(this.g*255)<<8^Math.floor(this.b*255)},getContextStyle:function(){return"rgb("+Math.floor(this.r*255)+","+Math.floor(this.g*255)+","+Math.floor(this.b*255)+")"},clone:function(){return(new THREE.Color).setRGB(this.r,this.g,this.b)}};THREE.Vector2=function(a,b){this.x=a||0;this.y=b||0};
THREE.Vector2.prototype={constructor:THREE.Vector2,set:function(a,b){this.x=a;this.y=b;return this},copy:function(a){this.x=a.x;this.y=a.y;return this},clone:function(){return new THREE.Vector2(this.x,this.y)},add:function(a,b){this.x=a.x+b.x;this.y=a.y+b.y;return this},addSelf:function(a){this.x+=a.x;this.y+=a.y;return this},sub:function(a,b){this.x=a.x-b.x;this.y=a.y-b.y;return this},subSelf:function(a){this.x-=a.x;this.y-=a.y;return this},multiplyScalar:function(a){this.x*=a;this.y*=a;return this},
divideScalar:function(a){a?(this.x/=a,this.y/=a):this.set(0,0);return this},negate:function(){return this.multiplyScalar(-1)},dot:function(a){return this.x*a.x+this.y*a.y},lengthSq:function(){return this.x*this.x+this.y*this.y},length:function(){return Math.sqrt(this.lengthSq())},normalize:function(){return this.divideScalar(this.length())},distanceTo:function(a){return Math.sqrt(this.distanceToSquared(a))},distanceToSquared:function(a){var b=this.x-a.x,a=this.y-a.y;return b*b+a*a},setLength:function(a){return this.normalize().multiplyScalar(a)},
lerpSelf:function(a,b){this.x+=(a.x-this.x)*b;this.y+=(a.y-this.y)*b;return this},equals:function(a){return a.x===this.x&&a.y===this.y},isZero:function(){return this.lengthSq()<1.0E-4}};THREE.Vector3=function(a,b,c){this.x=a||0;this.y=b||0;this.z=c||0};
THREE.Vector3.prototype={constructor:THREE.Vector3,set:function(a,b,c){this.x=a;this.y=b;this.z=c;return this},setX:function(a){this.x=a;return this},setY:function(a){this.y=a;return this},setZ:function(a){this.z=a;return this},copy:function(a){this.x=a.x;this.y=a.y;this.z=a.z;return this},clone:function(){return new THREE.Vector3(this.x,this.y,this.z)},add:function(a,b){this.x=a.x+b.x;this.y=a.y+b.y;this.z=a.z+b.z;return this},addSelf:function(a){this.x+=a.x;this.y+=a.y;this.z+=a.z;return this},
addScalar:function(a){this.x+=a;this.y+=a;this.z+=a;return this},sub:function(a,b){this.x=a.x-b.x;this.y=a.y-b.y;this.z=a.z-b.z;return this},subSelf:function(a){this.x-=a.x;this.y-=a.y;this.z-=a.z;return this},multiply:function(a,b){this.x=a.x*b.x;this.y=a.y*b.y;this.z=a.z*b.z;return this},multiplySelf:function(a){this.x*=a.x;this.y*=a.y;this.z*=a.z;return this},multiplyScalar:function(a){this.x*=a;this.y*=a;this.z*=a;return this},divideSelf:function(a){this.x/=a.x;this.y/=a.y;this.z/=a.z;return this},
divideScalar:function(a){a?(this.x/=a,this.y/=a,this.z/=a):this.z=this.y=this.x=0;return this},negate:function(){return this.multiplyScalar(-1)},dot:function(a){return this.x*a.x+this.y*a.y+this.z*a.z},lengthSq:function(){return this.x*this.x+this.y*this.y+this.z*this.z},length:function(){return Math.sqrt(this.lengthSq())},lengthManhattan:function(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)},normalize:function(){return this.divideScalar(this.length())},setLength:function(a){return this.normalize().multiplyScalar(a)},
lerpSelf:function(a,b){this.x+=(a.x-this.x)*b;this.y+=(a.y-this.y)*b;this.z+=(a.z-this.z)*b;return this},cross:function(a,b){this.x=a.y*b.z-a.z*b.y;this.y=a.z*b.x-a.x*b.z;this.z=a.x*b.y-a.y*b.x;return this},crossSelf:function(a){var b=this.x,c=this.y,d=this.z;this.x=c*a.z-d*a.y;this.y=d*a.x-b*a.z;this.z=b*a.y-c*a.x;return this},distanceTo:function(a){return Math.sqrt(this.distanceToSquared(a))},distanceToSquared:function(a){return(new THREE.Vector3).sub(this,a).lengthSq()},getPositionFromMatrix:function(a){this.x=
a.n14;this.y=a.n24;this.z=a.n34;return this},getRotationFromMatrix:function(a,b){var c=b?b.x:1,d=b?b.y:1,f=b?b.z:1,g=a.n11/c,e=a.n12/d,c=a.n21/c,d=a.n22/d,h=a.n23/f,i=a.n33/f;this.y=Math.asin(a.n13/f);f=Math.cos(this.y);Math.abs(f)>1.0E-5?(this.x=Math.atan2(-h/f,i/f),this.z=Math.atan2(-e/f,g/f)):(this.x=0,this.z=Math.atan2(c,d));return this},getScaleFromMatrix:function(a){var b=this.set(a.n11,a.n21,a.n31).length(),c=this.set(a.n12,a.n22,a.n32).length(),a=this.set(a.n13,a.n23,a.n33).length();this.x=
b;this.y=c;this.z=a},equals:function(a){return a.x===this.x&&a.y===this.y&&a.z===this.z},isZero:function(){return this.lengthSq()<1.0E-4}};THREE.Vector4=function(a,b,c,d){this.x=a||0;this.y=b||0;this.z=c||0;this.w=d!==void 0?d:1};
THREE.Vector4.prototype={constructor:THREE.Vector4,set:function(a,b,c,d){this.x=a;this.y=b;this.z=c;this.w=d;return this},copy:function(a){this.x=a.x;this.y=a.y;this.z=a.z;this.w=a.w!==void 0?a.w:1;return this},clone:function(){return new THREE.Vector4(this.x,this.y,this.z,this.w)},add:function(a,b){this.x=a.x+b.x;this.y=a.y+b.y;this.z=a.z+b.z;this.w=a.w+b.w;return this},addSelf:function(a){this.x+=a.x;this.y+=a.y;this.z+=a.z;this.w+=a.w;return this},sub:function(a,b){this.x=a.x-b.x;this.y=a.y-b.y;
this.z=a.z-b.z;this.w=a.w-b.w;return this},subSelf:function(a){this.x-=a.x;this.y-=a.y;this.z-=a.z;this.w-=a.w;return this},multiplyScalar:function(a){this.x*=a;this.y*=a;this.z*=a;this.w*=a;return this},divideScalar:function(a){a?(this.x/=a,this.y/=a,this.z/=a,this.w/=a):(this.z=this.y=this.x=0,this.w=1);return this},negate:function(){return this.multiplyScalar(-1)},dot:function(a){return this.x*a.x+this.y*a.y+this.z*a.z+this.w*a.w},lengthSq:function(){return this.dot(this)},length:function(){return Math.sqrt(this.lengthSq())},
normalize:function(){return this.divideScalar(this.length())},setLength:function(a){return this.normalize().multiplyScalar(a)},lerpSelf:function(a,b){this.x+=(a.x-this.x)*b;this.y+=(a.y-this.y)*b;this.z+=(a.z-this.z)*b;this.w+=(a.w-this.w)*b;return this}};THREE.Frustum=function(){this.planes=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4]};
THREE.Frustum.prototype.setFromMatrix=function(a){var b,c=this.planes;c[0].set(a.n41-a.n11,a.n42-a.n12,a.n43-a.n13,a.n44-a.n14);c[1].set(a.n41+a.n11,a.n42+a.n12,a.n43+a.n13,a.n44+a.n14);c[2].set(a.n41+a.n21,a.n42+a.n22,a.n43+a.n23,a.n44+a.n24);c[3].set(a.n41-a.n21,a.n42-a.n22,a.n43-a.n23,a.n44-a.n24);c[4].set(a.n41-a.n31,a.n42-a.n32,a.n43-a.n33,a.n44-a.n34);c[5].set(a.n41+a.n31,a.n42+a.n32,a.n43+a.n33,a.n44+a.n34);for(a=0;a<6;a++)b=c[a],b.divideScalar(Math.sqrt(b.x*b.x+b.y*b.y+b.z*b.z))};
THREE.Frustum.prototype.contains=function(a){for(var b=this.planes,c=a.matrixWorld,d=THREE.Frustum.__v1.set(c.getColumnX().length(),c.getColumnY().length(),c.getColumnZ().length()),d=-a.geometry.boundingSphere.radius*Math.max(d.x,Math.max(d.y,d.z)),f=0;f<6;f++)if(a=b[f].x*c.n14+b[f].y*c.n24+b[f].z*c.n34+b[f].w,a<=d)return!1;return!0};THREE.Frustum.__v1=new THREE.Vector3;
THREE.Ray=function(a,b){function c(a,b,c){s.sub(c,a);r=s.dot(b);t=m.add(a,p.copy(b).multiplyScalar(r));return v=c.distanceTo(t)}function d(a,b,c,d){s.sub(d,b);m.sub(c,b);p.sub(a,b);u=s.dot(s);w=s.dot(m);y=s.dot(p);F=m.dot(m);D=m.dot(p);G=1/(u*F-w*w);I=(F*y-w*D)*G;K=(u*D-w*y)*G;return I>=0&&K>=0&&I+K<1}this.origin=a||new THREE.Vector3;this.direction=b||new THREE.Vector3;this.intersectObjects=function(a){var b,c,d=[];for(b=0,c=a.length;b<c;b++)Array.prototype.push.apply(d,this.intersectObject(a[b]));
d.sort(function(a,b){return a.distance-b.distance});return d};var f=1.0E-4;this.setPrecision=function(a){f=a};var g=new THREE.Vector3,e=new THREE.Vector3,h=new THREE.Vector3,i=new THREE.Vector3,j=new THREE.Vector3,k=new THREE.Vector3,q=new THREE.Vector3,n=new THREE.Vector3,o=new THREE.Vector3;this.intersectObject=function(a){var b,m=[];if(a instanceof THREE.Particle){var s=c(this.origin,this.direction,a.matrixWorld.getPosition());if(s>a.scale.x)return[];b={distance:s,point:a.position,face:null,object:a};
m.push(b)}else if(a instanceof THREE.Mesh){var s=c(this.origin,this.direction,a.matrixWorld.getPosition()),p=THREE.Frustum.__v1.set(a.matrixWorld.getColumnX().length(),a.matrixWorld.getColumnY().length(),a.matrixWorld.getColumnZ().length());if(s>a.geometry.boundingSphere.radius*Math.max(p.x,Math.max(p.y,p.z)))return m;var r,l,t=a.geometry,u=t.vertices,z;a.matrixRotationWorld.extractRotation(a.matrixWorld);for(s=0,p=t.faces.length;s<p;s++)if(b=t.faces[s],j.copy(this.origin),k.copy(this.direction),
z=a.matrixWorld,q=z.multiplyVector3(q.copy(b.centroid)).subSelf(j),n=a.matrixRotationWorld.multiplyVector3(n.copy(b.normal)),r=k.dot(n),!(Math.abs(r)<f)&&(l=n.dot(q)/r,!(l<0)&&(a.doubleSided||(a.flipSided?r>0:r<0))))if(o.add(j,k.multiplyScalar(l)),b instanceof THREE.Face3)g=z.multiplyVector3(g.copy(u[b.a].position)),e=z.multiplyVector3(e.copy(u[b.b].position)),h=z.multiplyVector3(h.copy(u[b.c].position)),d(o,g,e,h)&&(b={distance:j.distanceTo(o),point:o.clone(),face:b,object:a},m.push(b));else if(b instanceof
THREE.Face4&&(g=z.multiplyVector3(g.copy(u[b.a].position)),e=z.multiplyVector3(e.copy(u[b.b].position)),h=z.multiplyVector3(h.copy(u[b.c].position)),i=z.multiplyVector3(i.copy(u[b.d].position)),d(o,g,e,i)||d(o,e,h,i)))b={distance:j.distanceTo(o),point:o.clone(),face:b,object:a},m.push(b)}return m};var s=new THREE.Vector3,m=new THREE.Vector3,p=new THREE.Vector3,r,t,v,u,w,y,F,D,G,I,K};
THREE.Rectangle=function(){function a(){g=d-b;e=f-c}var b,c,d,f,g,e,h=!0;this.getX=function(){return b};this.getY=function(){return c};this.getWidth=function(){return g};this.getHeight=function(){return e};this.getLeft=function(){return b};this.getTop=function(){return c};this.getRight=function(){return d};this.getBottom=function(){return f};this.set=function(g,e,k,q){h=!1;b=g;c=e;d=k;f=q;a()};this.addPoint=function(g,e){h?(h=!1,b=g,c=e,d=g,f=e):(b=b<g?b:g,c=c<e?c:e,d=d>g?d:g,f=f>e?f:e);a()};this.add3Points=
function(g,e,k,q,n,o){h?(h=!1,b=g<k?g<n?g:n:k<n?k:n,c=e<q?e<o?e:o:q<o?q:o,d=g>k?g>n?g:n:k>n?k:n,f=e>q?e>o?e:o:q>o?q:o):(b=g<k?g<n?g<b?g:b:n<b?n:b:k<n?k<b?k:b:n<b?n:b,c=e<q?e<o?e<c?e:c:o<c?o:c:q<o?q<c?q:c:o<c?o:c,d=g>k?g>n?g>d?g:d:n>d?n:d:k>n?k>d?k:d:n>d?n:d,f=e>q?e>o?e>f?e:f:o>f?o:f:q>o?q>f?q:f:o>f?o:f);a()};this.addRectangle=function(g){h?(h=!1,b=g.getLeft(),c=g.getTop(),d=g.getRight(),f=g.getBottom()):(b=b<g.getLeft()?b:g.getLeft(),c=c<g.getTop()?c:g.getTop(),d=d>g.getRight()?d:g.getRight(),f=f>
g.getBottom()?f:g.getBottom());a()};this.inflate=function(g){b-=g;c-=g;d+=g;f+=g;a()};this.minSelf=function(g){b=b>g.getLeft()?b:g.getLeft();c=c>g.getTop()?c:g.getTop();d=d<g.getRight()?d:g.getRight();f=f<g.getBottom()?f:g.getBottom();a()};this.intersects=function(a){return d<a.getLeft()?!1:b>a.getRight()?!1:f<a.getTop()?!1:c>a.getBottom()?!1:!0};this.empty=function(){h=!0;f=d=c=b=0;a()};this.isEmpty=function(){return h}};
THREE.Math={clamp:function(a,b,c){return a<b?b:a>c?c:a},clampBottom:function(a,b){return a<b?b:a},mapLinear:function(a,b,c,d,f){return d+(a-b)*(f-d)/(c-b)},random16:function(){return(65280*Math.random()+255*Math.random())/65535},randInt:function(a,b){return a+Math.floor(Math.random()*(b-a+1))},randFloat:function(a,b){return a+Math.random()*(b-a)},randFloatSpread:function(a){return a*(0.5-Math.random())},sign:function(a){return a<0?-1:a>0?1:0}};THREE.Matrix3=function(){this.m=[]};
THREE.Matrix3.prototype={constructor:THREE.Matrix3,transposeIntoArray:function(a){var b=this.m;a[0]=b[0];a[1]=b[3];a[2]=b[6];a[3]=b[1];a[4]=b[4];a[5]=b[7];a[6]=b[2];a[7]=b[5];a[8]=b[8];return this}};THREE.Matrix4=function(a,b,c,d,f,g,e,h,i,j,k,q,n,o,s,m){this.set(a!==void 0?a:1,b||0,c||0,d||0,f||0,g!==void 0?g:1,e||0,h||0,i||0,j||0,k!==void 0?k:1,q||0,n||0,o||0,s||0,m!==void 0?m:1);this.m33=new THREE.Matrix3};
THREE.Matrix4.prototype={constructor:THREE.Matrix4,set:function(a,b,c,d,f,g,e,h,i,j,k,q,n,o,s,m){this.n11=a;this.n12=b;this.n13=c;this.n14=d;this.n21=f;this.n22=g;this.n23=e;this.n24=h;this.n31=i;this.n32=j;this.n33=k;this.n34=q;this.n41=n;this.n42=o;this.n43=s;this.n44=m;return this},identity:function(){this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1);return this},copy:function(a){this.set(a.n11,a.n12,a.n13,a.n14,a.n21,a.n22,a.n23,a.n24,a.n31,a.n32,a.n33,a.n34,a.n41,a.n42,a.n43,a.n44);return this},lookAt:function(a,
b,c){var d=THREE.Matrix4.__v1,f=THREE.Matrix4.__v2,g=THREE.Matrix4.__v3;g.sub(a,b).normalize();if(g.length()===0)g.z=1;d.cross(c,g).normalize();d.length()===0&&(g.x+=1.0E-4,d.cross(c,g).normalize());f.cross(g,d);this.n11=d.x;this.n12=f.x;this.n13=g.x;this.n21=d.y;this.n22=f.y;this.n23=g.y;this.n31=d.z;this.n32=f.z;this.n33=g.z;return this},multiply:function(a,b){var c=a.n11,d=a.n12,f=a.n13,g=a.n14,e=a.n21,h=a.n22,i=a.n23,j=a.n24,k=a.n31,q=a.n32,n=a.n33,o=a.n34,s=a.n41,m=a.n42,p=a.n43,r=a.n44,t=b.n11,
v=b.n12,u=b.n13,w=b.n14,y=b.n21,F=b.n22,D=b.n23,G=b.n24,I=b.n31,K=b.n32,Q=b.n33,N=b.n34,B=b.n41,O=b.n42,S=b.n43,A=b.n44;this.n11=c*t+d*y+f*I+g*B;this.n12=c*v+d*F+f*K+g*O;this.n13=c*u+d*D+f*Q+g*S;this.n14=c*w+d*G+f*N+g*A;this.n21=e*t+h*y+i*I+j*B;this.n22=e*v+h*F+i*K+j*O;this.n23=e*u+h*D+i*Q+j*S;this.n24=e*w+h*G+i*N+j*A;this.n31=k*t+q*y+n*I+o*B;this.n32=k*v+q*F+n*K+o*O;this.n33=k*u+q*D+n*Q+o*S;this.n34=k*w+q*G+n*N+o*A;this.n41=s*t+m*y+p*I+r*B;this.n42=s*v+m*F+p*K+r*O;this.n43=s*u+m*D+p*Q+r*S;this.n44=
s*w+m*G+p*N+r*A;return this},multiplySelf:function(a){return this.multiply(this,a)},multiplyToArray:function(a,b,c){this.multiply(a,b);c[0]=this.n11;c[1]=this.n21;c[2]=this.n31;c[3]=this.n41;c[4]=this.n12;c[5]=this.n22;c[6]=this.n32;c[7]=this.n42;c[8]=this.n13;c[9]=this.n23;c[10]=this.n33;c[11]=this.n43;c[12]=this.n14;c[13]=this.n24;c[14]=this.n34;c[15]=this.n44;return this},multiplyScalar:function(a){this.n11*=a;this.n12*=a;this.n13*=a;this.n14*=a;this.n21*=a;this.n22*=a;this.n23*=a;this.n24*=a;
this.n31*=a;this.n32*=a;this.n33*=a;this.n34*=a;this.n41*=a;this.n42*=a;this.n43*=a;this.n44*=a;return this},multiplyVector3:function(a){var b=a.x,c=a.y,d=a.z,f=1/(this.n41*b+this.n42*c+this.n43*d+this.n44);a.x=(this.n11*b+this.n12*c+this.n13*d+this.n14)*f;a.y=(this.n21*b+this.n22*c+this.n23*d+this.n24)*f;a.z=(this.n31*b+this.n32*c+this.n33*d+this.n34)*f;return a},multiplyVector4:function(a){var b=a.x,c=a.y,d=a.z,f=a.w;a.x=this.n11*b+this.n12*c+this.n13*d+this.n14*f;a.y=this.n21*b+this.n22*c+this.n23*
d+this.n24*f;a.z=this.n31*b+this.n32*c+this.n33*d+this.n34*f;a.w=this.n41*b+this.n42*c+this.n43*d+this.n44*f;return a},rotateAxis:function(a){var b=a.x,c=a.y,d=a.z;a.x=b*this.n11+c*this.n12+d*this.n13;a.y=b*this.n21+c*this.n22+d*this.n23;a.z=b*this.n31+c*this.n32+d*this.n33;a.normalize();return a},crossVector:function(a){var b=new THREE.Vector4;b.x=this.n11*a.x+this.n12*a.y+this.n13*a.z+this.n14*a.w;b.y=this.n21*a.x+this.n22*a.y+this.n23*a.z+this.n24*a.w;b.z=this.n31*a.x+this.n32*a.y+this.n33*a.z+
this.n34*a.w;b.w=a.w?this.n41*a.x+this.n42*a.y+this.n43*a.z+this.n44*a.w:1;return b},determinant:function(){var a=this.n11,b=this.n12,c=this.n13,d=this.n14,f=this.n21,g=this.n22,e=this.n23,h=this.n24,i=this.n31,j=this.n32,k=this.n33,q=this.n34,n=this.n41,o=this.n42,s=this.n43,m=this.n44;return d*e*j*n-c*h*j*n-d*g*k*n+b*h*k*n+c*g*q*n-b*e*q*n-d*e*i*o+c*h*i*o+d*f*k*o-a*h*k*o-c*f*q*o+a*e*q*o+d*g*i*s-b*h*i*s-d*f*j*s+a*h*j*s+b*f*q*s-a*g*q*s-c*g*i*m+b*e*i*m+c*f*j*m-a*e*j*m-b*f*k*m+a*g*k*m},transpose:function(){var a;
a=this.n21;this.n21=this.n12;this.n12=a;a=this.n31;this.n31=this.n13;this.n13=a;a=this.n32;this.n32=this.n23;this.n23=a;a=this.n41;this.n41=this.n14;this.n14=a;a=this.n42;this.n42=this.n24;this.n24=a;a=this.n43;this.n43=this.n34;this.n34=a;return this},clone:function(){var a=new THREE.Matrix4;a.n11=this.n11;a.n12=this.n12;a.n13=this.n13;a.n14=this.n14;a.n21=this.n21;a.n22=this.n22;a.n23=this.n23;a.n24=this.n24;a.n31=this.n31;a.n32=this.n32;a.n33=this.n33;a.n34=this.n34;a.n41=this.n41;a.n42=this.n42;
a.n43=this.n43;a.n44=this.n44;return a},flattenToArray:function(a){a[0]=this.n11;a[1]=this.n21;a[2]=this.n31;a[3]=this.n41;a[4]=this.n12;a[5]=this.n22;a[6]=this.n32;a[7]=this.n42;a[8]=this.n13;a[9]=this.n23;a[10]=this.n33;a[11]=this.n43;a[12]=this.n14;a[13]=this.n24;a[14]=this.n34;a[15]=this.n44;return a},flattenToArrayOffset:function(a,b){a[b]=this.n11;a[b+1]=this.n21;a[b+2]=this.n31;a[b+3]=this.n41;a[b+4]=this.n12;a[b+5]=this.n22;a[b+6]=this.n32;a[b+7]=this.n42;a[b+8]=this.n13;a[b+9]=this.n23;a[b+
10]=this.n33;a[b+11]=this.n43;a[b+12]=this.n14;a[b+13]=this.n24;a[b+14]=this.n34;a[b+15]=this.n44;return a},setTranslation:function(a,b,c){this.set(1,0,0,a,0,1,0,b,0,0,1,c,0,0,0,1);return this},setScale:function(a,b,c){this.set(a,0,0,0,0,b,0,0,0,0,c,0,0,0,0,1);return this},setRotationX:function(a){var b=Math.cos(a),a=Math.sin(a);this.set(1,0,0,0,0,b,-a,0,0,a,b,0,0,0,0,1);return this},setRotationY:function(a){var b=Math.cos(a),a=Math.sin(a);this.set(b,0,a,0,0,1,0,0,-a,0,b,0,0,0,0,1);return this},setRotationZ:function(a){var b=
Math.cos(a),a=Math.sin(a);this.set(b,-a,0,0,a,b,0,0,0,0,1,0,0,0,0,1);return this},setRotationAxis:function(a,b){var c=Math.cos(b),d=Math.sin(b),f=1-c,g=a.x,e=a.y,h=a.z,i=f*g,j=f*e;this.set(i*g+c,i*e-d*h,i*h+d*e,0,i*e+d*h,j*e+c,j*h-d*g,0,i*h-d*e,j*h+d*g,f*h*h+c,0,0,0,0,1);return this},setPosition:function(a){this.n14=a.x;this.n24=a.y;this.n34=a.z;return this},getPosition:function(){return THREE.Matrix4.__v1.set(this.n14,this.n24,this.n34)},getColumnX:function(){return THREE.Matrix4.__v1.set(this.n11,
this.n21,this.n31)},getColumnY:function(){return THREE.Matrix4.__v1.set(this.n12,this.n22,this.n32)},getColumnZ:function(){return THREE.Matrix4.__v1.set(this.n13,this.n23,this.n33)},getInverse:function(a){var b=a.n11,c=a.n12,d=a.n13,f=a.n14,g=a.n21,e=a.n22,h=a.n23,i=a.n24,j=a.n31,k=a.n32,q=a.n33,n=a.n34,o=a.n41,s=a.n42,m=a.n43,p=a.n44;this.n11=h*n*s-i*q*s+i*k*m-e*n*m-h*k*p+e*q*p;this.n12=f*q*s-d*n*s-f*k*m+c*n*m+d*k*p-c*q*p;this.n13=d*i*s-f*h*s+f*e*m-c*i*m-d*e*p+c*h*p;this.n14=f*h*k-d*i*k-f*e*q+c*
i*q+d*e*n-c*h*n;this.n21=i*q*o-h*n*o-i*j*m+g*n*m+h*j*p-g*q*p;this.n22=d*n*o-f*q*o+f*j*m-b*n*m-d*j*p+b*q*p;this.n23=f*h*o-d*i*o-f*g*m+b*i*m+d*g*p-b*h*p;this.n24=d*i*j-f*h*j+f*g*q-b*i*q-d*g*n+b*h*n;this.n31=e*n*o-i*k*o+i*j*s-g*n*s-e*j*p+g*k*p;this.n32=f*k*o-c*n*o-f*j*s+b*n*s+c*j*p-b*k*p;this.n33=c*i*o-f*e*o+f*g*s-b*i*s-c*g*p+b*e*p;this.n34=f*e*j-c*i*j-f*g*k+b*i*k+c*g*n-b*e*n;this.n41=h*k*o-e*q*o-h*j*s+g*q*s+e*j*m-g*k*m;this.n42=c*q*o-d*k*o+d*j*s-b*q*s-c*j*m+b*k*m;this.n43=d*e*o-c*h*o-d*g*s+b*h*s+c*
g*m-b*e*m;this.n44=c*h*j-d*e*j+d*g*k-b*h*k-c*g*q+b*e*q;this.multiplyScalar(1/a.determinant());return this},setRotationFromEuler:function(a,b){var c=a.x,d=a.y,f=a.z,g=Math.cos(c),c=Math.sin(c),e=Math.cos(d),d=Math.sin(d),h=Math.cos(f),f=Math.sin(f);switch(b){case "YXZ":var i=e*h,j=e*f,k=d*h,q=d*f;this.n11=i+q*c;this.n12=k*c-j;this.n13=g*d;this.n21=g*f;this.n22=g*h;this.n23=-c;this.n31=j*c-k;this.n32=q+i*c;this.n33=g*e;break;case "ZXY":i=e*h;j=e*f;k=d*h;q=d*f;this.n11=i-q*c;this.n12=-g*f;this.n13=k+
j*c;this.n21=j+k*c;this.n22=g*h;this.n23=q-i*c;this.n31=-g*d;this.n32=c;this.n33=g*e;break;case "ZYX":i=g*h;j=g*f;k=c*h;q=c*f;this.n11=e*h;this.n12=k*d-j;this.n13=i*d+q;this.n21=e*f;this.n22=q*d+i;this.n23=j*d-k;this.n31=-d;this.n32=c*e;this.n33=g*e;break;case "YZX":i=g*e;j=g*d;k=c*e;q=c*d;this.n11=e*h;this.n12=q-i*f;this.n13=k*f+j;this.n21=f;this.n22=g*h;this.n23=-c*h;this.n31=-d*h;this.n32=j*f+k;this.n33=i-q*f;break;case "XZY":i=g*e;j=g*d;k=c*e;q=c*d;this.n11=e*h;this.n12=-f;this.n13=d*h;this.n21=
i*f+q;this.n22=g*h;this.n23=j*f-k;this.n31=k*f-j;this.n32=c*h;this.n33=q*f+i;break;default:i=g*h,j=g*f,k=c*h,q=c*f,this.n11=e*h,this.n12=-e*f,this.n13=d,this.n21=j+k*d,this.n22=i-q*d,this.n23=-c*e,this.n31=q-i*d,this.n32=k+j*d,this.n33=g*e}return this},setRotationFromQuaternion:function(a){var b=a.x,c=a.y,d=a.z,f=a.w,g=b+b,e=c+c,h=d+d,a=b*g,i=b*e;b*=h;var j=c*e;c*=h;d*=h;g*=f;e*=f;f*=h;this.n11=1-(j+d);this.n12=i-f;this.n13=b+e;this.n21=i+f;this.n22=1-(a+d);this.n23=c-g;this.n31=b-e;this.n32=c+g;
this.n33=1-(a+j);return this},scale:function(a){var b=a.x,c=a.y,a=a.z;this.n11*=b;this.n12*=c;this.n13*=a;this.n21*=b;this.n22*=c;this.n23*=a;this.n31*=b;this.n32*=c;this.n33*=a;this.n41*=b;this.n42*=c;this.n43*=a;return this},compose:function(a,b,c){var d=THREE.Matrix4.__m1,f=THREE.Matrix4.__m2;d.identity();d.setRotationFromQuaternion(b);f.setScale(c.x,c.y,c.z);this.multiply(d,f);this.n14=a.x;this.n24=a.y;this.n34=a.z;return this},decompose:function(a,b,c){var d=THREE.Matrix4.__v1,f=THREE.Matrix4.__v2,
g=THREE.Matrix4.__v3;d.set(this.n11,this.n21,this.n31);f.set(this.n12,this.n22,this.n32);g.set(this.n13,this.n23,this.n33);a=a instanceof THREE.Vector3?a:new THREE.Vector3;b=b instanceof THREE.Quaternion?b:new THREE.Quaternion;c=c instanceof THREE.Vector3?c:new THREE.Vector3;c.x=d.length();c.y=f.length();c.z=g.length();a.x=this.n14;a.y=this.n24;a.z=this.n34;d=THREE.Matrix4.__m1;d.copy(this);d.n11/=c.x;d.n21/=c.x;d.n31/=c.x;d.n12/=c.y;d.n22/=c.y;d.n32/=c.y;d.n13/=c.z;d.n23/=c.z;d.n33/=c.z;b.setFromRotationMatrix(d);
return[a,b,c]},extractPosition:function(a){this.n14=a.n14;this.n24=a.n24;this.n34=a.n34;return this},extractRotation:function(a){var b=THREE.Matrix4.__v1,c=1/b.set(a.n11,a.n21,a.n31).length(),d=1/b.set(a.n12,a.n22,a.n32).length(),b=1/b.set(a.n13,a.n23,a.n33).length();this.n11=a.n11*c;this.n21=a.n21*c;this.n31=a.n31*c;this.n12=a.n12*d;this.n22=a.n22*d;this.n32=a.n32*d;this.n13=a.n13*b;this.n23=a.n23*b;this.n33=a.n33*b;return this},rotateByAxis:function(a,b){if(a.x===1&&a.y===0&&a.z===0)return this.rotateX(b);
else if(a.x===0&&a.y===1&&a.z===0)return this.rotateY(b);else if(a.x===0&&a.y===0&&a.z===1)return this.rotateZ(b);var c=a.x,d=a.y,f=a.z,g=Math.sqrt(c*c+d*d+f*f);c/=g;d/=g;f/=g;var g=c*c,e=d*d,h=f*f,i=Math.cos(b),j=Math.sin(b),k=1-i,q=c*d*k,n=c*f*k;k*=d*f;c*=j;var o=d*j;j*=f;f=g+(1-g)*i;g=q+j;d=n-o;q-=j;e+=(1-e)*i;j=k+c;n+=o;k-=c;h+=(1-h)*i;var i=this.n11,c=this.n21,o=this.n31,s=this.n41,m=this.n12,p=this.n22,r=this.n32,t=this.n42,v=this.n13,u=this.n23,w=this.n33,y=this.n43;this.n11=f*i+g*m+d*v;this.n21=
f*c+g*p+d*u;this.n31=f*o+g*r+d*w;this.n41=f*s+g*t+d*y;this.n12=q*i+e*m+j*v;this.n22=q*c+e*p+j*u;this.n32=q*o+e*r+j*w;this.n42=q*s+e*t+j*y;this.n13=n*i+k*m+h*v;this.n23=n*c+k*p+h*u;this.n33=n*o+k*r+h*w;this.n43=n*s+k*t+h*y;return this},rotateX:function(a){var b=this.n12,c=this.n22,d=this.n32,f=this.n42,g=this.n13,e=this.n23,h=this.n33,i=this.n43,j=Math.cos(a),a=Math.sin(a);this.n12=j*b+a*g;this.n22=j*c+a*e;this.n32=j*d+a*h;this.n42=j*f+a*i;this.n13=j*g-a*b;this.n23=j*e-a*c;this.n33=j*h-a*d;this.n43=
j*i-a*f;return this},rotateY:function(a){var b=this.n11,c=this.n21,d=this.n31,f=this.n41,g=this.n13,e=this.n23,h=this.n33,i=this.n43,j=Math.cos(a),a=Math.sin(a);this.n11=j*b-a*g;this.n21=j*c-a*e;this.n31=j*d-a*h;this.n41=j*f-a*i;this.n13=j*g+a*b;this.n23=j*e+a*c;this.n33=j*h+a*d;this.n43=j*i+a*f;return this},rotateZ:function(a){var b=this.n11,c=this.n21,d=this.n31,f=this.n41,g=this.n12,e=this.n22,h=this.n32,i=this.n42,j=Math.cos(a),a=Math.sin(a);this.n11=j*b+a*g;this.n21=j*c+a*e;this.n31=j*d+a*h;
this.n41=j*f+a*i;this.n12=j*g-a*b;this.n22=j*e-a*c;this.n32=j*h-a*d;this.n42=j*i-a*f;return this},translate:function(a){var b=a.x,c=a.y,a=a.z;this.n14=this.n11*b+this.n12*c+this.n13*a+this.n14;this.n24=this.n21*b+this.n22*c+this.n23*a+this.n24;this.n34=this.n31*b+this.n32*c+this.n33*a+this.n34;this.n44=this.n41*b+this.n42*c+this.n43*a+this.n44;return this}};
THREE.Matrix4.makeInvert3x3=function(a){var b=a.m33,c=b.m,d=a.n33*a.n22-a.n32*a.n23,f=-a.n33*a.n21+a.n31*a.n23,g=a.n32*a.n21-a.n31*a.n22,e=-a.n33*a.n12+a.n32*a.n13,h=a.n33*a.n11-a.n31*a.n13,i=-a.n32*a.n11+a.n31*a.n12,j=a.n23*a.n12-a.n22*a.n13,k=-a.n23*a.n11+a.n21*a.n13,q=a.n22*a.n11-a.n21*a.n12,a=a.n11*d+a.n21*e+a.n31*j;if(a===0)return null;a=1/a;c[0]=a*d;c[1]=a*f;c[2]=a*g;c[3]=a*e;c[4]=a*h;c[5]=a*i;c[6]=a*j;c[7]=a*k;c[8]=a*q;return b};
THREE.Matrix4.makeFrustum=function(a,b,c,d,f,g){var e;e=new THREE.Matrix4;e.n11=2*f/(b-a);e.n12=0;e.n13=(b+a)/(b-a);e.n14=0;e.n21=0;e.n22=2*f/(d-c);e.n23=(d+c)/(d-c);e.n24=0;e.n31=0;e.n32=0;e.n33=-(g+f)/(g-f);e.n34=-2*g*f/(g-f);e.n41=0;e.n42=0;e.n43=-1;e.n44=0;return e};THREE.Matrix4.makePerspective=function(a,b,c,d){var f,a=c*Math.tan(a*Math.PI/360);f=-a;return THREE.Matrix4.makeFrustum(f*b,a*b,f,a,c,d)};
THREE.Matrix4.makeOrtho=function(a,b,c,d,f,g){var e,h,i,j;e=new THREE.Matrix4;h=b-a;i=c-d;j=g-f;e.n11=2/h;e.n12=0;e.n13=0;e.n14=-((b+a)/h);e.n21=0;e.n22=2/i;e.n23=0;e.n24=-((c+d)/i);e.n31=0;e.n32=0;e.n33=-2/j;e.n34=-((g+f)/j);e.n41=0;e.n42=0;e.n43=0;e.n44=1;return e};THREE.Matrix4.__v1=new THREE.Vector3;THREE.Matrix4.__v2=new THREE.Vector3;THREE.Matrix4.__v3=new THREE.Vector3;THREE.Matrix4.__m1=new THREE.Matrix4;THREE.Matrix4.__m2=new THREE.Matrix4;
THREE.Object3D=function(){this.id=THREE.Object3DCount++;this.name="";this.parent=void 0;this.children=[];this.up=new THREE.Vector3(0,1,0);this.position=new THREE.Vector3;this.rotation=new THREE.Vector3;this.eulerOrder="XYZ";this.scale=new THREE.Vector3(1,1,1);this.flipSided=this.doubleSided=!1;this.renderDepth=null;this.rotationAutoUpdate=!0;this.matrix=new THREE.Matrix4;this.matrixWorld=new THREE.Matrix4;this.matrixRotationWorld=new THREE.Matrix4;this.matrixWorldNeedsUpdate=this.matrixAutoUpdate=
!0;this.quaternion=new THREE.Quaternion;this.useQuaternion=!1;this.boundRadius=0;this.boundRadiusScale=1;this.visible=!0;this.receiveShadow=this.castShadow=!1;this.frustumCulled=!0;this._vector=new THREE.Vector3};
THREE.Object3D.prototype={constructor:THREE.Object3D,applyMatrix:function(a){this.matrix.multiply(a,this.matrix);this.scale.getScaleFromMatrix(this.matrix);this.rotation.getRotationFromMatrix(this.matrix,this.scale);this.position.getPositionFromMatrix(this.matrix)},translate:function(a,b){this.matrix.rotateAxis(b);this.position.addSelf(b.multiplyScalar(a))},translateX:function(a){this.translate(a,this._vector.set(1,0,0))},translateY:function(a){this.translate(a,this._vector.set(0,1,0))},translateZ:function(a){this.translate(a,
this._vector.set(0,0,1))},lookAt:function(a){this.matrix.lookAt(a,this.position,this.up);this.rotationAutoUpdate&&this.rotation.getRotationFromMatrix(this.matrix)},add:function(a){if(a===this)console.warn("THREE.Object3D.add: An object can't be added as a child of itself.");else if(this.children.indexOf(a)===-1){a.parent!==void 0&&a.parent.remove(a);a.parent=this;this.children.push(a);for(var b=this;b.parent!==void 0;)b=b.parent;b!==void 0&&b instanceof THREE.Scene&&b.__addObject(a)}},remove:function(a){var b=
this.children.indexOf(a);if(b!==-1){a.parent=void 0;this.children.splice(b,1);for(b=this;b.parent!==void 0;)b=b.parent;b!==void 0&&b instanceof THREE.Scene&&b.__removeObject(a)}},getChildByName:function(a,b){var c,d,f;for(c=0,d=this.children.length;c<d;c++){f=this.children[c];if(f.name===a)return f;if(b&&(f=f.getChildByName(a,b),f!==void 0))return f}},updateMatrix:function(){this.matrix.setPosition(this.position);this.useQuaternion?this.matrix.setRotationFromQuaternion(this.quaternion):this.matrix.setRotationFromEuler(this.rotation,
this.eulerOrder);if(this.scale.x!==1||this.scale.y!==1||this.scale.z!==1)this.matrix.scale(this.scale),this.boundRadiusScale=Math.max(this.scale.x,Math.max(this.scale.y,this.scale.z));this.matrixWorldNeedsUpdate=!0},updateMatrixWorld:function(a){this.matrixAutoUpdate&&this.updateMatrix();if(this.matrixWorldNeedsUpdate||a)this.parent?this.matrixWorld.multiply(this.parent.matrixWorld,this.matrix):this.matrixWorld.copy(this.matrix),this.matrixWorldNeedsUpdate=!1,a=!0;for(var b=0,c=this.children.length;b<
c;b++)this.children[b].updateMatrixWorld(a)}};THREE.Object3DCount=0;
THREE.Projector=function(){function a(){var a=e[g]=e[g]||new THREE.RenderableObject;g++;return a}function b(){var a=j[i]=j[i]||new THREE.RenderableVertex;i++;return a}function c(a,b){return b.z-a.z}function d(a,b){var c=0,d=1,f=a.z+a.w,g=b.z+b.w,e=-a.z+a.w,h=-b.z+b.w;return f>=0&&g>=0&&e>=0&&h>=0?!0:f<0&&g<0||e<0&&h<0?!1:(f<0?c=Math.max(c,f/(f-g)):g<0&&(d=Math.min(d,f/(f-g))),e<0?c=Math.max(c,e/(e-h)):h<0&&(d=Math.min(d,e/(e-h))),d<c?!1:(a.lerpSelf(b,c),b.lerpSelf(a,1-d),!0))}var f,g,e=[],h,i,j=[],
k,q,n=[],o,s=[],m,p,r=[],t,v,u=[],w={objects:[],sprites:[],lights:[],elements:[]},y=new THREE.Vector3,F=new THREE.Vector4,D=new THREE.Matrix4,G=new THREE.Matrix4,I=new THREE.Frustum,K=new THREE.Vector4,Q=new THREE.Vector4;this.projectVector=function(a,b){b.matrixWorldInverse.getInverse(b.matrixWorld);D.multiply(b.projectionMatrix,b.matrixWorldInverse);D.multiplyVector3(a);return a};this.unprojectVector=function(a,b){b.projectionMatrixInverse.getInverse(b.projectionMatrix);D.multiply(b.matrixWorld,
b.projectionMatrixInverse);D.multiplyVector3(a);return a};this.pickingRay=function(a,b){var c;a.z=-1;c=new THREE.Vector3(a.x,a.y,1);this.unprojectVector(a,b);this.unprojectVector(c,b);c.subSelf(a).normalize();return new THREE.Ray(a,c)};this.projectGraph=function(b,d){g=0;w.objects.length=0;w.sprites.length=0;w.lights.length=0;var e=function(b){if(b.visible!==!1){(b instanceof THREE.Mesh||b instanceof THREE.Line)&&(b.frustumCulled===!1||I.contains(b))?(D.multiplyVector3(y.copy(b.position)),f=a(),f.object=
b,f.z=y.z,w.objects.push(f)):b instanceof THREE.Sprite||b instanceof THREE.Particle?(D.multiplyVector3(y.copy(b.position)),f=a(),f.object=b,f.z=y.z,w.sprites.push(f)):b instanceof THREE.Light&&w.lights.push(b);for(var c=0,d=b.children.length;c<d;c++)e(b.children[c])}};e(b);d&&w.objects.sort(c);return w};this.projectScene=function(a,f,g){var e=f.near,A=f.far,l=!1,y,E,z,T,W,M,ma,aa,Z,X,U,Y,$,oa,ga;v=p=o=q=0;w.elements.length=0;f.parent===void 0&&(console.warn("DEPRECATED: Camera hasn't been added to a Scene. Adding it..."),
a.add(f));a.updateMatrixWorld();f.matrixWorldInverse.getInverse(f.matrixWorld);D.multiply(f.projectionMatrix,f.matrixWorldInverse);I.setFromMatrix(D);w=this.projectGraph(a,!1);for(a=0,y=w.objects.length;a<y;a++)if(Z=w.objects[a].object,X=Z.matrixWorld,i=0,Z instanceof THREE.Mesh){U=Z.geometry;Y=Z.geometry.materials;T=U.vertices;$=U.faces;oa=U.faceVertexUvs;U=Z.matrixRotationWorld.extractRotation(X);for(E=0,z=T.length;E<z;E++)h=b(),h.positionWorld.copy(T[E].position),X.multiplyVector3(h.positionWorld),
h.positionScreen.copy(h.positionWorld),D.multiplyVector4(h.positionScreen),h.positionScreen.x/=h.positionScreen.w,h.positionScreen.y/=h.positionScreen.w,h.visible=h.positionScreen.z>e&&h.positionScreen.z<A;for(T=0,E=$.length;T<E;T++){z=$[T];if(z instanceof THREE.Face3)if(W=j[z.a],M=j[z.b],ma=j[z.c],W.visible&&M.visible&&ma.visible)if(l=(ma.positionScreen.x-W.positionScreen.x)*(M.positionScreen.y-W.positionScreen.y)-(ma.positionScreen.y-W.positionScreen.y)*(M.positionScreen.x-W.positionScreen.x)<0,
Z.doubleSided||l!=Z.flipSided)aa=n[q]=n[q]||new THREE.RenderableFace3,q++,k=aa,k.v1.copy(W),k.v2.copy(M),k.v3.copy(ma);else continue;else continue;else if(z instanceof THREE.Face4)if(W=j[z.a],M=j[z.b],ma=j[z.c],aa=j[z.d],W.visible&&M.visible&&ma.visible&&aa.visible)if(l=(aa.positionScreen.x-W.positionScreen.x)*(M.positionScreen.y-W.positionScreen.y)-(aa.positionScreen.y-W.positionScreen.y)*(M.positionScreen.x-W.positionScreen.x)<0||(M.positionScreen.x-ma.positionScreen.x)*(aa.positionScreen.y-ma.positionScreen.y)-
(M.positionScreen.y-ma.positionScreen.y)*(aa.positionScreen.x-ma.positionScreen.x)<0,Z.doubleSided||l!=Z.flipSided)ga=s[o]=s[o]||new THREE.RenderableFace4,o++,k=ga,k.v1.copy(W),k.v2.copy(M),k.v3.copy(ma),k.v4.copy(aa);else continue;else continue;k.normalWorld.copy(z.normal);!l&&(Z.flipSided||Z.doubleSided)&&k.normalWorld.negate();U.multiplyVector3(k.normalWorld);k.centroidWorld.copy(z.centroid);X.multiplyVector3(k.centroidWorld);k.centroidScreen.copy(k.centroidWorld);D.multiplyVector3(k.centroidScreen);
ma=z.vertexNormals;for(W=0,M=ma.length;W<M;W++)aa=k.vertexNormalsWorld[W],aa.copy(ma[W]),!l&&(Z.flipSided||Z.doubleSided)&&aa.negate(),U.multiplyVector3(aa);for(W=0,M=oa.length;W<M;W++)if(ga=oa[W][T])for(ma=0,aa=ga.length;ma<aa;ma++)k.uvs[W][ma]=ga[ma];k.material=Z.material;k.faceMaterial=z.materialIndex!==null?Y[z.materialIndex]:null;k.z=k.centroidScreen.z;w.elements.push(k)}}else if(Z instanceof THREE.Line){G.multiply(D,X);T=Z.geometry.vertices;W=b();W.positionScreen.copy(T[0].position);G.multiplyVector4(W.positionScreen);
for(E=1,z=T.length;E<z;E++)if(W=b(),W.positionScreen.copy(T[E].position),G.multiplyVector4(W.positionScreen),M=j[i-2],K.copy(W.positionScreen),Q.copy(M.positionScreen),d(K,Q))K.multiplyScalar(1/K.w),Q.multiplyScalar(1/Q.w),X=r[p]=r[p]||new THREE.RenderableLine,p++,m=X,m.v1.positionScreen.copy(K),m.v2.positionScreen.copy(Q),m.z=Math.max(K.z,Q.z),m.material=Z.material,w.elements.push(m)}for(a=0,y=w.sprites.length;a<y;a++)if(Z=w.sprites[a].object,X=Z.matrixWorld,Z instanceof THREE.Particle&&(F.set(X.n14,
X.n24,X.n34,1),D.multiplyVector4(F),F.z/=F.w,F.z>0&&F.z<1))e=u[v]=u[v]||new THREE.RenderableParticle,v++,t=e,t.x=F.x/F.w,t.y=F.y/F.w,t.z=F.z,t.rotation=Z.rotation.z,t.scale.x=Z.scale.x*Math.abs(t.x-(F.x+f.projectionMatrix.n11)/(F.w+f.projectionMatrix.n14)),t.scale.y=Z.scale.y*Math.abs(t.y-(F.y+f.projectionMatrix.n22)/(F.w+f.projectionMatrix.n24)),t.material=Z.material,w.elements.push(t);g&&w.elements.sort(c);return w}};
THREE.Quaternion=function(a,b,c,d){this.x=a||0;this.y=b||0;this.z=c||0;this.w=d!==void 0?d:1};
THREE.Quaternion.prototype={constructor:THREE.Quaternion,set:function(a,b,c,d){this.x=a;this.y=b;this.z=c;this.w=d;return this},copy:function(a){this.x=a.x;this.y=a.y;this.z=a.z;this.w=a.w;return this},clone:function(){return new THREE.Quaternion(this.x,this.y,this.z,this.w)},setFromEuler:function(a){var b=Math.PI/360,c=a.x*b,d=a.y*b,f=a.z*b,a=Math.cos(d),d=Math.sin(d),b=Math.cos(-f),f=Math.sin(-f),g=Math.cos(c),c=Math.sin(c),e=a*b,h=d*f;this.w=e*g-h*c;this.x=e*c+h*g;this.y=d*b*g+a*f*c;this.z=a*f*
g-d*b*c;return this},setFromAxisAngle:function(a,b){var c=b/2,d=Math.sin(c);this.x=a.x*d;this.y=a.y*d;this.z=a.z*d;this.w=Math.cos(c);return this},setFromRotationMatrix:function(a){var b=Math.pow(a.determinant(),1/3);this.w=Math.sqrt(Math.max(0,b+a.n11+a.n22+a.n33))/2;this.x=Math.sqrt(Math.max(0,b+a.n11-a.n22-a.n33))/2;this.y=Math.sqrt(Math.max(0,b-a.n11+a.n22-a.n33))/2;this.z=Math.sqrt(Math.max(0,b-a.n11-a.n22+a.n33))/2;this.x=a.n32-a.n23<0?-Math.abs(this.x):Math.abs(this.x);this.y=a.n13-a.n31<0?
-Math.abs(this.y):Math.abs(this.y);this.z=a.n21-a.n12<0?-Math.abs(this.z):Math.abs(this.z);this.normalize();return this},calculateW:function(){this.w=-Math.sqrt(Math.abs(1-this.x*this.x-this.y*this.y-this.z*this.z));return this},inverse:function(){this.x*=-1;this.y*=-1;this.z*=-1;return this},length:function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)},normalize:function(){var a=Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w);a===0?this.w=this.z=
this.y=this.x=0:(a=1/a,this.x*=a,this.y*=a,this.z*=a,this.w*=a);return this},multiplySelf:function(a){var b=this.x,c=this.y,d=this.z,f=this.w,g=a.x,e=a.y,h=a.z,a=a.w;this.x=b*a+f*g+c*h-d*e;this.y=c*a+f*e+d*g-b*h;this.z=d*a+f*h+b*e-c*g;this.w=f*a-b*g-c*e-d*h;return this},multiply:function(a,b){this.x=a.x*b.w+a.y*b.z-a.z*b.y+a.w*b.x;this.y=-a.x*b.z+a.y*b.w+a.z*b.x+a.w*b.y;this.z=a.x*b.y-a.y*b.x+a.z*b.w+a.w*b.z;this.w=-a.x*b.x-a.y*b.y-a.z*b.z+a.w*b.w;return this},multiplyVector3:function(a,b){b||(b=
a);var c=a.x,d=a.y,f=a.z,g=this.x,e=this.y,h=this.z,i=this.w,j=i*c+e*f-h*d,k=i*d+h*c-g*f,q=i*f+g*d-e*c,c=-g*c-e*d-h*f;b.x=j*i+c*-g+k*-h-q*-e;b.y=k*i+c*-e+q*-g-j*-h;b.z=q*i+c*-h+j*-e-k*-g;return b}};
THREE.Quaternion.slerp=function(a,b,c,d){var f=a.w*b.w+a.x*b.x+a.y*b.y+a.z*b.z;f<0?(c.w=-b.w,c.x=-b.x,c.y=-b.y,c.z=-b.z,f=-f):c.copy(b);if(Math.abs(f)>=1)return c.w=a.w,c.x=a.x,c.y=a.y,c.z=a.z,c;var g=Math.acos(f),f=Math.sqrt(1-f*f);if(Math.abs(f)<0.001)return c.w=0.5*(a.w+b.w),c.x=0.5*(a.x+b.x),c.y=0.5*(a.y+b.y),c.z=0.5*(a.z+b.z),c;b=Math.sin((1-d)*g)/f;d=Math.sin(d*g)/f;c.w=a.w*b+c.w*d;c.x=a.x*b+c.x*d;c.y=a.y*b+c.y*d;c.z=a.z*b+c.z*d;return c};THREE.Vertex=function(a){this.position=a||new THREE.Vector3};
THREE.Vertex.prototype={constructor:THREE.Vertex,clone:function(){return new THREE.Vertex(this.position.clone())}};THREE.Face3=function(a,b,c,d,f,g){this.a=a;this.b=b;this.c=c;this.normal=d instanceof THREE.Vector3?d:new THREE.Vector3;this.vertexNormals=d instanceof Array?d:[];this.color=f instanceof THREE.Color?f:new THREE.Color;this.vertexColors=f instanceof Array?f:[];this.vertexTangents=[];this.materialIndex=g;this.centroid=new THREE.Vector3};
THREE.Face3.prototype={constructor:THREE.Face3,clone:function(){var a=new THREE.Face3(this.a,this.b,this.c);a.normal.copy(this.normal);a.color.copy(this.color);a.centroid.copy(this.centroid);a.materialIndex=this.materialIndex;var b,c;for(b=0,c=this.vertexNormals.length;b<c;b++)a.vertexNormals[b]=this.vertexNormals[b].clone();for(b=0,c=this.vertexColors.length;b<c;b++)a.vertexColors[b]=this.vertexColors[b].clone();for(b=0,c=this.vertexTangents.length;b<c;b++)a.vertexTangents[b]=this.vertexTangents[b].clone();
return a}};THREE.Face4=function(a,b,c,d,f,g,e){this.a=a;this.b=b;this.c=c;this.d=d;this.normal=f instanceof THREE.Vector3?f:new THREE.Vector3;this.vertexNormals=f instanceof Array?f:[];this.color=g instanceof THREE.Color?g:new THREE.Color;this.vertexColors=g instanceof Array?g:[];this.vertexTangents=[];this.materialIndex=e;this.centroid=new THREE.Vector3};
THREE.Face4.prototype={constructor:THREE.Face4,clone:function(){var a=new THREE.Face4(this.a,this.b,this.c,this.d);a.normal.copy(this.normal);a.color.copy(this.color);a.centroid.copy(this.centroid);a.materialIndex=this.materialIndex;var b,c;for(b=0,c=this.vertexNormals.length;b<c;b++)a.vertexNormals[b]=this.vertexNormals[b].clone();for(b=0,c=this.vertexColors.length;b<c;b++)a.vertexColors[b]=this.vertexColors[b].clone();for(b=0,c=this.vertexTangents.length;b<c;b++)a.vertexTangents[b]=this.vertexTangents[b].clone();
return a}};THREE.UV=function(a,b){this.u=a||0;this.v=b||0};THREE.UV.prototype={constructor:THREE.UV,set:function(a,b){this.u=a;this.v=b;return this},copy:function(a){this.u=a.u;this.v=a.v;return this},lerpSelf:function(a,b){this.u+=(a.u-this.u)*b;this.v+=(a.v-this.v)*b;return this},clone:function(){return new THREE.UV(this.u,this.v)}};
THREE.Geometry=function(){this.id=THREE.GeometryCount++;this.vertices=[];this.colors=[];this.materials=[];this.faces=[];this.faceUvs=[[]];this.faceVertexUvs=[[]];this.morphTargets=[];this.morphColors=[];this.morphNormals=[];this.skinWeights=[];this.skinIndices=[];this.boundingSphere=this.boundingBox=null;this.dynamic=this.hasTangents=!1};
THREE.Geometry.prototype={constructor:THREE.Geometry,applyMatrix:function(a){var b=new THREE.Matrix4;b.extractRotation(a);for(var c=0,d=this.vertices.length;c<d;c++)a.multiplyVector3(this.vertices[c].position);c=0;for(d=this.faces.length;c<d;c++){var f=this.faces[c];b.multiplyVector3(f.normal);for(var g=0,e=f.vertexNormals.length;g<e;g++)b.multiplyVector3(f.vertexNormals[g]);a.multiplyVector3(f.centroid)}},computeCentroids:function(){var a,b,c;for(a=0,b=this.faces.length;a<b;a++)c=this.faces[a],c.centroid.set(0,
0,0),c instanceof THREE.Face3?(c.centroid.addSelf(this.vertices[c.a].position),c.centroid.addSelf(this.vertices[c.b].position),c.centroid.addSelf(this.vertices[c.c].position),c.centroid.divideScalar(3)):c instanceof THREE.Face4&&(c.centroid.addSelf(this.vertices[c.a].position),c.centroid.addSelf(this.vertices[c.b].position),c.centroid.addSelf(this.vertices[c.c].position),c.centroid.addSelf(this.vertices[c.d].position),c.centroid.divideScalar(4))},computeFaceNormals:function(){var a,b,c,d,f,g,e=new THREE.Vector3,
h=new THREE.Vector3;for(a=0,b=this.faces.length;a<b;a++)c=this.faces[a],d=this.vertices[c.a],f=this.vertices[c.b],g=this.vertices[c.c],e.sub(g.position,f.position),h.sub(d.position,f.position),e.crossSelf(h),e.isZero()||e.normalize(),c.normal.copy(e)},computeVertexNormals:function(){var a,b,c,d;if(this.__tmpVertices===void 0){d=this.__tmpVertices=Array(this.vertices.length);for(a=0,b=this.vertices.length;a<b;a++)d[a]=new THREE.Vector3;for(a=0,b=this.faces.length;a<b;a++)if(c=this.faces[a],c instanceof
THREE.Face3)c.vertexNormals=[new THREE.Vector3,new THREE.Vector3,new THREE.Vector3];else if(c instanceof THREE.Face4)c.vertexNormals=[new THREE.Vector3,new THREE.Vector3,new THREE.Vector3,new THREE.Vector3]}else{d=this.__tmpVertices;for(a=0,b=this.vertices.length;a<b;a++)d[a].set(0,0,0)}for(a=0,b=this.faces.length;a<b;a++)c=this.faces[a],c instanceof THREE.Face3?(d[c.a].addSelf(c.normal),d[c.b].addSelf(c.normal),d[c.c].addSelf(c.normal)):c instanceof THREE.Face4&&(d[c.a].addSelf(c.normal),d[c.b].addSelf(c.normal),
d[c.c].addSelf(c.normal),d[c.d].addSelf(c.normal));for(a=0,b=this.vertices.length;a<b;a++)d[a].normalize();for(a=0,b=this.faces.length;a<b;a++)c=this.faces[a],c instanceof THREE.Face3?(c.vertexNormals[0].copy(d[c.a]),c.vertexNormals[1].copy(d[c.b]),c.vertexNormals[2].copy(d[c.c])):c instanceof THREE.Face4&&(c.vertexNormals[0].copy(d[c.a]),c.vertexNormals[1].copy(d[c.b]),c.vertexNormals[2].copy(d[c.c]),c.vertexNormals[3].copy(d[c.d]))},computeMorphNormals:function(){var a,b,c,d,f;for(c=0,d=this.faces.length;c<
d;c++){f=this.faces[c];f.__originalFaceNormal?f.__originalFaceNormal.copy(f.normal):f.__originalFaceNormal=f.normal.clone();if(!f.__originalVertexNormals)f.__originalVertexNormals=[];for(a=0,b=f.vertexNormals.length;a<b;a++)f.__originalVertexNormals[a]?f.__originalVertexNormals[a].copy(f.vertexNormals[a]):f.__originalVertexNormals[a]=f.vertexNormals[a].clone()}var g=new THREE.Geometry;g.faces=this.faces;for(a=0,b=this.morphTargets.length;a<b;a++){if(!this.morphNormals[a]){this.morphNormals[a]={};
this.morphNormals[a].faceNormals=[];this.morphNormals[a].vertexNormals=[];var e=this.morphNormals[a].faceNormals,h=this.morphNormals[a].vertexNormals,i,j;for(c=0,d=this.faces.length;c<d;c++)f=this.faces[c],i=new THREE.Vector3,j=f instanceof THREE.Face3?{a:new THREE.Vector3,b:new THREE.Vector3,c:new THREE.Vector3}:{a:new THREE.Vector3,b:new THREE.Vector3,c:new THREE.Vector3,d:new THREE.Vector3},e.push(i),h.push(j)}e=this.morphNormals[a];g.vertices=this.morphTargets[a].vertices;g.computeFaceNormals();
g.computeVertexNormals();for(c=0,d=this.faces.length;c<d;c++)f=this.faces[c],i=e.faceNormals[c],j=e.vertexNormals[c],i.copy(f.normal),f instanceof THREE.Face3?(j.a.copy(f.vertexNormals[0]),j.b.copy(f.vertexNormals[1]),j.c.copy(f.vertexNormals[2])):(j.a.copy(f.vertexNormals[0]),j.b.copy(f.vertexNormals[1]),j.c.copy(f.vertexNormals[2]),j.d.copy(f.vertexNormals[3]))}for(c=0,d=this.faces.length;c<d;c++)f=this.faces[c],f.normal=f.__originalFaceNormal,f.vertexNormals=f.__originalVertexNormals},computeTangents:function(){function a(a,
b,c,d,f,g,D){h=a.vertices[b].position;i=a.vertices[c].position;j=a.vertices[d].position;k=e[f];q=e[g];n=e[D];o=i.x-h.x;s=j.x-h.x;m=i.y-h.y;p=j.y-h.y;r=i.z-h.z;t=j.z-h.z;v=q.u-k.u;u=n.u-k.u;w=q.v-k.v;y=n.v-k.v;F=1/(v*y-u*w);K.set((y*o-w*s)*F,(y*m-w*p)*F,(y*r-w*t)*F);Q.set((v*s-u*o)*F,(v*p-u*m)*F,(v*t-u*r)*F);G[b].addSelf(K);G[c].addSelf(K);G[d].addSelf(K);I[b].addSelf(Q);I[c].addSelf(Q);I[d].addSelf(Q)}var b,c,d,f,g,e,h,i,j,k,q,n,o,s,m,p,r,t,v,u,w,y,F,D,G=[],I=[],K=new THREE.Vector3,Q=new THREE.Vector3,
N=new THREE.Vector3,B=new THREE.Vector3,O=new THREE.Vector3;for(b=0,c=this.vertices.length;b<c;b++)G[b]=new THREE.Vector3,I[b]=new THREE.Vector3;for(b=0,c=this.faces.length;b<c;b++)g=this.faces[b],e=this.faceVertexUvs[0][b],g instanceof THREE.Face3?a(this,g.a,g.b,g.c,0,1,2):g instanceof THREE.Face4&&(a(this,g.a,g.b,g.c,0,1,2),a(this,g.a,g.b,g.d,0,1,3));var S=["a","b","c","d"];for(b=0,c=this.faces.length;b<c;b++){g=this.faces[b];for(d=0;d<g.vertexNormals.length;d++)O.copy(g.vertexNormals[d]),f=g[S[d]],
D=G[f],N.copy(D),N.subSelf(O.multiplyScalar(O.dot(D))).normalize(),B.cross(g.vertexNormals[d],D),f=B.dot(I[f]),f=f<0?-1:1,g.vertexTangents[d]=new THREE.Vector4(N.x,N.y,N.z,f)}this.hasTangents=!0},computeBoundingBox:function(){if(!this.boundingBox)this.boundingBox={min:new THREE.Vector3,max:new THREE.Vector3};if(this.vertices.length>0){var a;a=this.vertices[0].position;this.boundingBox.min.copy(a);this.boundingBox.max.copy(a);for(var b=this.boundingBox.min,c=this.boundingBox.max,d=1,f=this.vertices.length;d<
f;d++){a=this.vertices[d].position;if(a.x<b.x)b.x=a.x;else if(a.x>c.x)c.x=a.x;if(a.y<b.y)b.y=a.y;else if(a.y>c.y)c.y=a.y;if(a.z<b.z)b.z=a.z;else if(a.z>c.z)c.z=a.z}}else this.boundingBox.min.set(0,0,0),this.boundingBox.max.set(0,0,0)},computeBoundingSphere:function(){if(!this.boundingSphere)this.boundingSphere={radius:0};for(var a,b=0,c=0,d=this.vertices.length;c<d;c++)a=this.vertices[c].position.length(),a>b&&(b=a);this.boundingSphere.radius=b},mergeVertices:function(){var a={},b=[],c=[],d,f=Math.pow(10,
4),g,e;for(g=0,e=this.vertices.length;g<e;g++)d=this.vertices[g].position,d=[Math.round(d.x*f),Math.round(d.y*f),Math.round(d.z*f)].join("_"),a[d]===void 0?(a[d]=g,b.push(this.vertices[g]),c[g]=b.length-1):c[g]=c[a[d]];for(g=0,e=this.faces.length;g<e;g++)if(a=this.faces[g],a instanceof THREE.Face3)a.a=c[a.a],a.b=c[a.b],a.c=c[a.c];else if(a instanceof THREE.Face4)a.a=c[a.a],a.b=c[a.b],a.c=c[a.c],a.d=c[a.d];this.vertices=b}};THREE.GeometryCount=0;
THREE.Spline=function(a){function b(a,b,c,d,f,g,e){a=(c-a)*0.5;d=(d-b)*0.5;return(2*(b-c)+a+d)*e+(-3*(b-c)-2*a-d)*g+a*f+b}this.points=a;var c=[],d={x:0,y:0,z:0},f,g,e,h,i,j,k,q,n;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){f=(this.points.length-1)*a;g=Math.floor(f);e=f-g;c[0]=g===0?g:g-1;c[1]=g;c[2]=g>this.points.length-2?g:g+1;c[3]=g>this.points.length-3?g:g+2;j=this.points[c[0]];k=this.points[c[1]];
q=this.points[c[2]];n=this.points[c[3]];h=e*e;i=e*h;d.x=b(j.x,k.x,q.x,n.x,e,h,i);d.y=b(j.y,k.y,q.y,n.y,e,h,i);d.z=b(j.z,k.z,q.z,n.z,e,h,i);return d};this.getControlPointsArray=function(){var a,b,c=this.points.length,d=[];for(a=0;a<c;a++)b=this.points[a],d[a]=[b.x,b.y,b.z];return d};this.getLength=function(a){var b,c,d,f=b=b=0,g=new THREE.Vector3,e=new THREE.Vector3,h=[],i=0;h[0]=0;a||(a=100);c=this.points.length*a;g.copy(this.points[0]);for(a=1;a<c;a++)b=a/c,d=this.getPoint(b),e.copy(d),i+=e.distanceTo(g),
g.copy(d),b*=this.points.length-1,b=Math.floor(b),b!=f&&(h[b]=i,f=b);h[h.length]=i;return{chunks:h,total:i}};this.reparametrizeByArcLength=function(a){var b,c,d,f,g,e,h=[],i=new THREE.Vector3,j=this.getLength();h.push(i.copy(this.points[0]).clone());for(b=1;b<this.points.length;b++){c=j.chunks[b]-j.chunks[b-1];e=Math.ceil(a*c/j.total);f=(b-1)/(this.points.length-1);g=b/(this.points.length-1);for(c=1;c<e-1;c++)d=f+c*(1/e)*(g-f),d=this.getPoint(d),h.push(i.copy(d).clone());h.push(i.copy(this.points[b]).clone())}this.points=
h}};THREE.Camera=function(){THREE.Object3D.call(this);this.matrixWorldInverse=new THREE.Matrix4;this.projectionMatrix=new THREE.Matrix4;this.projectionMatrixInverse=new THREE.Matrix4};THREE.Camera.prototype=new THREE.Object3D;THREE.Camera.prototype.constructor=THREE.Camera;THREE.Camera.prototype.lookAt=function(a){this.matrix.lookAt(this.position,a,this.up);this.rotationAutoUpdate&&this.rotation.getRotationFromMatrix(this.matrix)};
THREE.OrthographicCamera=function(a,b,c,d,f,g){THREE.Camera.call(this);this.left=a;this.right=b;this.top=c;this.bottom=d;this.near=f!==void 0?f:0.1;this.far=g!==void 0?g:2E3;this.updateProjectionMatrix()};THREE.OrthographicCamera.prototype=new THREE.Camera;THREE.OrthographicCamera.prototype.constructor=THREE.OrthographicCamera;THREE.OrthographicCamera.prototype.updateProjectionMatrix=function(){this.projectionMatrix=THREE.Matrix4.makeOrtho(this.left,this.right,this.top,this.bottom,this.near,this.far)};
THREE.PerspectiveCamera=function(a,b,c,d){THREE.Camera.call(this);this.fov=a!==void 0?a:50;this.aspect=b!==void 0?b:1;this.near=c!==void 0?c:0.1;this.far=d!==void 0?d:2E3;this.updateProjectionMatrix()};THREE.PerspectiveCamera.prototype=new THREE.Camera;THREE.PerspectiveCamera.prototype.constructor=THREE.PerspectiveCamera;THREE.PerspectiveCamera.prototype.setLens=function(a,b){this.fov=2*Math.atan((b!==void 0?b:24)/(a*2))*(180/Math.PI);this.updateProjectionMatrix()};
THREE.PerspectiveCamera.prototype.setViewOffset=function(a,b,c,d,f,g){this.fullWidth=a;this.fullHeight=b;this.x=c;this.y=d;this.width=f;this.height=g;this.updateProjectionMatrix()};
THREE.PerspectiveCamera.prototype.updateProjectionMatrix=function(){if(this.fullWidth){var a=this.fullWidth/this.fullHeight,b=Math.tan(this.fov*Math.PI/360)*this.near,c=-b,d=a*c,a=Math.abs(a*b-d),c=Math.abs(b-c);this.projectionMatrix=THREE.Matrix4.makeFrustum(d+this.x*a/this.fullWidth,d+(this.x+this.width)*a/this.fullWidth,b-(this.y+this.height)*c/this.fullHeight,b-this.y*c/this.fullHeight,this.near,this.far)}else this.projectionMatrix=THREE.Matrix4.makePerspective(this.fov,this.aspect,this.near,
this.far)};THREE.Light=function(a){THREE.Object3D.call(this);this.color=new THREE.Color(a)};THREE.Light.prototype=new THREE.Object3D;THREE.Light.prototype.constructor=THREE.Light;THREE.Light.prototype.supr=THREE.Object3D.prototype;THREE.AmbientLight=function(a){THREE.Light.call(this,a)};THREE.AmbientLight.prototype=new THREE.Light;THREE.AmbientLight.prototype.constructor=THREE.AmbientLight;
THREE.DirectionalLight=function(a,b,c){THREE.Light.call(this,a);this.position=new THREE.Vector3(0,1,0);this.target=new THREE.Object3D;this.intensity=b!==void 0?b:1;this.distance=c!==void 0?c:0;this.onlyShadow=this.castShadow=!1;this.shadowCameraNear=50;this.shadowCameraFar=5E3;this.shadowCameraLeft=-500;this.shadowCameraTop=this.shadowCameraRight=500;this.shadowCameraBottom=-500;this.shadowCameraVisible=!1;this.shadowBias=0;this.shadowDarkness=0.5;this.shadowMapHeight=this.shadowMapWidth=512;this.shadowCascade=
!1;this.shadowCascadeOffset=new THREE.Vector3(0,0,-1E3);this.shadowCascadeCount=2;this.shadowCascadeBias=[0,0,0];this.shadowCascadeWidth=[512,512,512];this.shadowCascadeHeight=[512,512,512];this.shadowCascadeNearZ=[-1,0.99,0.998];this.shadowCascadeFarZ=[0.99,0.998,1];this.shadowCascadeArray=[];this.shadowMatrix=this.shadowCamera=this.shadowMapSize=this.shadowMap=null};THREE.DirectionalLight.prototype=new THREE.Light;THREE.DirectionalLight.prototype.constructor=THREE.DirectionalLight;
THREE.PointLight=function(a,b,c){THREE.Light.call(this,a);this.position=new THREE.Vector3(0,0,0);this.intensity=b!==void 0?b:1;this.distance=c!==void 0?c:0};THREE.PointLight.prototype=new THREE.Light;THREE.PointLight.prototype.constructor=THREE.PointLight;
THREE.SpotLight=function(a,b,c,d){THREE.Light.call(this,a);this.position=new THREE.Vector3(0,1,0);this.target=new THREE.Object3D;this.intensity=b!==void 0?b:1;this.distance=c!==void 0?c:0;this.castShadow=d!==void 0?d:!1;this.onlyShadow=!1;this.shadowCameraNear=50;this.shadowCameraFar=5E3;this.shadowCameraFov=50;this.shadowCameraVisible=!1;this.shadowBias=0;this.shadowDarkness=0.5;this.shadowMapHeight=this.shadowMapWidth=512;this.shadowMatrix=this.shadowCamera=this.shadowMapSize=this.shadowMap=null};
THREE.SpotLight.prototype=new THREE.Light;THREE.SpotLight.prototype.constructor=THREE.SpotLight;
THREE.Material=function(a){a=a||{};this.id=THREE.MaterialCount++;this.name="";this.opacity=a.opacity!==void 0?a.opacity:1;this.transparent=a.transparent!==void 0?a.transparent:!1;this.blending=a.blending!==void 0?a.blending:THREE.NormalBlending;this.depthTest=a.depthTest!==void 0?a.depthTest:!0;this.depthWrite=a.depthWrite!==void 0?a.depthWrite:!0;this.polygonOffset=a.polygonOffset!==void 0?a.polygonOffset:!1;this.polygonOffsetFactor=a.polygonOffsetFactor!==void 0?a.polygonOffsetFactor:0;this.polygonOffsetUnits=
a.polygonOffsetUnits!==void 0?a.polygonOffsetUnits:0;this.alphaTest=a.alphaTest!==void 0?a.alphaTest:0;this.overdraw=a.overdraw!==void 0?a.overdraw:!1};THREE.MaterialCount=0;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.AdditiveAlphaBlending=5;
THREE.LineBasicMaterial=function(a){THREE.Material.call(this,a);a=a||{};this.color=a.color!==void 0?new THREE.Color(a.color):new THREE.Color(16777215);this.linewidth=a.linewidth!==void 0?a.linewidth:1;this.linecap=a.linecap!==void 0?a.linecap:"round";this.linejoin=a.linejoin!==void 0?a.linejoin:"round";this.vertexColors=a.vertexColors?a.vertexColors:!1;this.fog=a.fog!==void 0?a.fog:!0};THREE.LineBasicMaterial.prototype=new THREE.Material;THREE.LineBasicMaterial.prototype.constructor=THREE.LineBasicMaterial;
THREE.MeshBasicMaterial=function(a){THREE.Material.call(this,a);a=a||{};this.color=a.color!==void 0?new THREE.Color(a.color):new THREE.Color(16777215);this.map=a.map!==void 0?a.map:null;this.lightMap=a.lightMap!==void 0?a.lightMap:null;this.envMap=a.envMap!==void 0?a.envMap:null;this.combine=a.combine!==void 0?a.combine:THREE.MultiplyOperation;this.reflectivity=a.reflectivity!==void 0?a.reflectivity:1;this.refractionRatio=a.refractionRatio!==void 0?a.refractionRatio:0.98;this.fog=a.fog!==void 0?a.fog:
!0;this.shading=a.shading!==void 0?a.shading:THREE.SmoothShading;this.wireframe=a.wireframe!==void 0?a.wireframe:!1;this.wireframeLinewidth=a.wireframeLinewidth!==void 0?a.wireframeLinewidth:1;this.wireframeLinecap=a.wireframeLinecap!==void 0?a.wireframeLinecap:"round";this.wireframeLinejoin=a.wireframeLinejoin!==void 0?a.wireframeLinejoin:"round";this.vertexColors=a.vertexColors!==void 0?a.vertexColors:!1;this.skinning=a.skinning!==void 0?a.skinning:!1;this.morphTargets=a.morphTargets!==void 0?a.morphTargets:
!1};THREE.MeshBasicMaterial.prototype=new THREE.Material;THREE.MeshBasicMaterial.prototype.constructor=THREE.MeshBasicMaterial;
THREE.MeshLambertMaterial=function(a){THREE.Material.call(this,a);a=a||{};this.color=a.color!==void 0?new THREE.Color(a.color):new THREE.Color(16777215);this.ambient=a.ambient!==void 0?new THREE.Color(a.ambient):new THREE.Color(16777215);this.wrapAround=a.wrapAround!==void 0?a.wrapAround:!1;this.wrapRGB=new THREE.Vector3(1,1,1);this.map=a.map!==void 0?a.map:null;this.lightMap=a.lightMap!==void 0?a.lightMap:null;this.envMap=a.envMap!==void 0?a.envMap:null;this.combine=a.combine!==void 0?a.combine:
THREE.MultiplyOperation;this.reflectivity=a.reflectivity!==void 0?a.reflectivity:1;this.refractionRatio=a.refractionRatio!==void 0?a.refractionRatio:0.98;this.fog=a.fog!==void 0?a.fog:!0;this.shading=a.shading!==void 0?a.shading:THREE.SmoothShading;this.wireframe=a.wireframe!==void 0?a.wireframe:!1;this.wireframeLinewidth=a.wireframeLinewidth!==void 0?a.wireframeLinewidth:1;this.wireframeLinecap=a.wireframeLinecap!==void 0?a.wireframeLinecap:"round";this.wireframeLinejoin=a.wireframeLinejoin!==void 0?
a.wireframeLinejoin:"round";this.vertexColors=a.vertexColors!==void 0?a.vertexColors:!1;this.skinning=a.skinning!==void 0?a.skinning:!1;this.morphTargets=a.morphTargets!==void 0?a.morphTargets:!1;this.morphNormals=a.morphNormals!==void 0?a.morphNormals:!1};THREE.MeshLambertMaterial.prototype=new THREE.Material;THREE.MeshLambertMaterial.prototype.constructor=THREE.MeshLambertMaterial;
THREE.MeshPhongMaterial=function(a){THREE.Material.call(this,a);a=a||{};this.color=a.color!==void 0?new THREE.Color(a.color):new THREE.Color(16777215);this.ambient=a.ambient!==void 0?new THREE.Color(a.ambient):new THREE.Color(16777215);this.specular=a.specular!==void 0?new THREE.Color(a.specular):new THREE.Color(1118481);this.shininess=a.shininess!==void 0?a.shininess:30;this.metal=a.metal!==void 0?a.metal:!1;this.perPixel=a.perPixel!==void 0?a.perPixel:!1;this.wrapAround=a.wrapAround!==void 0?a.wrapAround:
!1;this.wrapRGB=new THREE.Vector3(1,1,1);this.map=a.map!==void 0?a.map:null;this.lightMap=a.lightMap!==void 0?a.lightMap:null;this.envMap=a.envMap!==void 0?a.envMap:null;this.combine=a.combine!==void 0?a.combine:THREE.MultiplyOperation;this.reflectivity=a.reflectivity!==void 0?a.reflectivity:1;this.refractionRatio=a.refractionRatio!==void 0?a.refractionRatio:0.98;this.fog=a.fog!==void 0?a.fog:!0;this.shading=a.shading!==void 0?a.shading:THREE.SmoothShading;this.wireframe=a.wireframe!==void 0?a.wireframe:
!1;this.wireframeLinewidth=a.wireframeLinewidth!==void 0?a.wireframeLinewidth:1;this.wireframeLinecap=a.wireframeLinecap!==void 0?a.wireframeLinecap:"round";this.wireframeLinejoin=a.wireframeLinejoin!==void 0?a.wireframeLinejoin:"round";this.vertexColors=a.vertexColors!==void 0?a.vertexColors:!1;this.skinning=a.skinning!==void 0?a.skinning:!1;this.morphTargets=a.morphTargets!==void 0?a.morphTargets:!1;this.morphNormals=a.morphNormals!==void 0?a.morphNormals:!1};THREE.MeshPhongMaterial.prototype=new THREE.Material;
THREE.MeshPhongMaterial.prototype.constructor=THREE.MeshPhongMaterial;THREE.MeshDepthMaterial=function(a){THREE.Material.call(this,a);a=a||{};this.shading=a.shading!==void 0?a.shading:THREE.SmoothShading;this.wireframe=a.wireframe!==void 0?a.wireframe:!1;this.wireframeLinewidth=a.wireframeLinewidth!==void 0?a.wireframeLinewidth:1};THREE.MeshDepthMaterial.prototype=new THREE.Material;THREE.MeshDepthMaterial.prototype.constructor=THREE.MeshDepthMaterial;
THREE.MeshNormalMaterial=function(a){THREE.Material.call(this,a);a=a||{};this.shading=a.shading?a.shading:THREE.FlatShading;this.wireframe=a.wireframe?a.wireframe:!1;this.wireframeLinewidth=a.wireframeLinewidth?a.wireframeLinewidth:1};THREE.MeshNormalMaterial.prototype=new THREE.Material;THREE.MeshNormalMaterial.prototype.constructor=THREE.MeshNormalMaterial;THREE.MeshFaceMaterial=function(){};
THREE.ParticleBasicMaterial=function(a){THREE.Material.call(this,a);a=a||{};this.color=a.color!==void 0?new THREE.Color(a.color):new THREE.Color(16777215);this.map=a.map!==void 0?a.map:null;this.size=a.size!==void 0?a.size:1;this.sizeAttenuation=a.sizeAttenuation!==void 0?a.sizeAttenuation:!0;this.vertexColors=a.vertexColors!==void 0?a.vertexColors:!1;this.fog=a.fog!==void 0?a.fog:!0};THREE.ParticleBasicMaterial.prototype=new THREE.Material;THREE.ParticleBasicMaterial.prototype.constructor=THREE.ParticleBasicMaterial;
THREE.ParticleCanvasMaterial=function(a){THREE.Material.call(this,a);a=a||{};this.color=a.color!==void 0?new THREE.Color(a.color):new THREE.Color(16777215);this.program=a.program!==void 0?a.program:function(){}};THREE.ParticleCanvasMaterial.prototype=new THREE.Material;THREE.ParticleCanvasMaterial.prototype.constructor=THREE.ParticleCanvasMaterial;THREE.ParticleDOMMaterial=function(a){THREE.Material.call(this);this.domElement=a};
THREE.ShaderMaterial=function(a){THREE.Material.call(this,a);a=a||{};this.fragmentShader=a.fragmentShader!==void 0?a.fragmentShader:"void main() {}";this.vertexShader=a.vertexShader!==void 0?a.vertexShader:"void main() {}";this.uniforms=a.uniforms!==void 0?a.uniforms:{};this.attributes=a.attributes;this.shading=a.shading!==void 0?a.shading:THREE.SmoothShading;this.wireframe=a.wireframe!==void 0?a.wireframe:!1;this.wireframeLinewidth=a.wireframeLinewidth!==void 0?a.wireframeLinewidth:1;this.fog=a.fog!==
void 0?a.fog:!1;this.lights=a.lights!==void 0?a.lights:!1;this.vertexColors=a.vertexColors!==void 0?a.vertexColors:!1;this.skinning=a.skinning!==void 0?a.skinning:!1;this.morphTargets=a.morphTargets!==void 0?a.morphTargets:!1};THREE.ShaderMaterial.prototype=new THREE.Material;THREE.ShaderMaterial.prototype.constructor=THREE.ShaderMaterial;
THREE.Texture=function(a,b,c,d,f,g,e,h){this.id=THREE.TextureCount++;this.image=a;this.mapping=b!==void 0?b:new THREE.UVMapping;this.wrapS=c!==void 0?c:THREE.ClampToEdgeWrapping;this.wrapT=d!==void 0?d:THREE.ClampToEdgeWrapping;this.magFilter=f!==void 0?f:THREE.LinearFilter;this.minFilter=g!==void 0?g:THREE.LinearMipMapLinearFilter;this.format=e!==void 0?e:THREE.RGBAFormat;this.type=h!==void 0?h:THREE.UnsignedByteType;this.offset=new THREE.Vector2(0,0);this.repeat=new THREE.Vector2(1,1);this.generateMipmaps=
!0;this.needsUpdate=!1;this.onUpdate=null};THREE.Texture.prototype={constructor:THREE.Texture,clone:function(){var a=new THREE.Texture(this.image,this.mapping,this.wrapS,this.wrapT,this.magFilter,this.minFilter,this.format,this.type);a.offset.copy(this.offset);a.repeat.copy(this.repeat);return a}};THREE.TextureCount=0;THREE.MultiplyOperation=0;THREE.MixOperation=1;THREE.CubeReflectionMapping=function(){};THREE.CubeRefractionMapping=function(){};THREE.LatitudeReflectionMapping=function(){};
THREE.LatitudeRefractionMapping=function(){};THREE.SphericalReflectionMapping=function(){};THREE.SphericalRefractionMapping=function(){};THREE.UVMapping=function(){};THREE.RepeatWrapping=0;THREE.ClampToEdgeWrapping=1;THREE.MirroredRepeatWrapping=2;THREE.NearestFilter=3;THREE.NearestMipMapNearestFilter=4;THREE.NearestMipMapLinearFilter=5;THREE.LinearFilter=6;THREE.LinearMipMapNearestFilter=7;THREE.LinearMipMapLinearFilter=8;THREE.ByteType=9;THREE.UnsignedByteType=10;THREE.ShortType=11;
THREE.UnsignedShortType=12;THREE.IntType=13;THREE.UnsignedIntType=14;THREE.FloatType=15;THREE.AlphaFormat=16;THREE.RGBFormat=17;THREE.RGBAFormat=18;THREE.LuminanceFormat=19;THREE.LuminanceAlphaFormat=20;THREE.DataTexture=function(a,b,c,d,f,g,e,h,i,j){THREE.Texture.call(this,null,g,e,h,i,j,d,f);this.image={data:a,width:b,height:c}};THREE.DataTexture.prototype=new THREE.Texture;THREE.DataTexture.prototype.constructor=THREE.DataTexture;
THREE.DataTexture.prototype.clone=function(){var a=new THREE.DataTexture(this.image.data,this.image.width,this.image.height,this.format,this.type,this.mapping,this.wrapS,this.wrapT,this.magFilter,this.minFilter);a.offset.copy(this.offset);a.repeat.copy(this.repeat);return a};THREE.Particle=function(a){THREE.Object3D.call(this);this.material=a};THREE.Particle.prototype=new THREE.Object3D;THREE.Particle.prototype.constructor=THREE.Particle;
THREE.ParticleSystem=function(a,b){THREE.Object3D.call(this);this.geometry=a;this.material=b!==void 0?b:new THREE.ParticleBasicMaterial({color:Math.random()*16777215});this.sortParticles=!1;if(this.geometry)this.geometry.boundingSphere||this.geometry.computeBoundingSphere(),this.boundRadius=a.boundingSphere.radius;this.frustumCulled=!1};THREE.ParticleSystem.prototype=new THREE.Object3D;THREE.ParticleSystem.prototype.constructor=THREE.ParticleSystem;
THREE.Line=function(a,b,c){THREE.Object3D.call(this);this.geometry=a;this.material=b!==void 0?b:new THREE.LineBasicMaterial({color:Math.random()*16777215});this.type=c!==void 0?c:THREE.LineStrip;this.geometry&&(this.geometry.boundingSphere||this.geometry.computeBoundingSphere())};THREE.LineStrip=0;THREE.LinePieces=1;THREE.Line.prototype=new THREE.Object3D;THREE.Line.prototype.constructor=THREE.Line;
THREE.Mesh=function(a,b){THREE.Object3D.call(this);this.geometry=a;this.material=b!==void 0?b:new THREE.MeshBasicMaterial({color:Math.random()*16777215,wireframe:!0});if(this.geometry&&(this.geometry.boundingSphere||this.geometry.computeBoundingSphere(),this.boundRadius=a.boundingSphere.radius,this.geometry.morphTargets.length)){this.morphTargetBase=-1;this.morphTargetForcedOrder=[];this.morphTargetInfluences=[];this.morphTargetDictionary={};for(var c=0;c<this.geometry.morphTargets.length;c++)this.morphTargetInfluences.push(0),
this.morphTargetDictionary[this.geometry.morphTargets[c].name]=c}};THREE.Mesh.prototype=new THREE.Object3D;THREE.Mesh.prototype.constructor=THREE.Mesh;THREE.Mesh.prototype.supr=THREE.Object3D.prototype;THREE.Mesh.prototype.getMorphTargetIndexByName=function(a){if(this.morphTargetDictionary[a]!==void 0)return this.morphTargetDictionary[a];console.log("THREE.Mesh.getMorphTargetIndexByName: morph target "+a+" does not exist. Returning 0.");return 0};
THREE.Bone=function(a){THREE.Object3D.call(this);this.skin=a;this.skinMatrix=new THREE.Matrix4};THREE.Bone.prototype=new THREE.Object3D;THREE.Bone.prototype.constructor=THREE.Bone;THREE.Bone.prototype.supr=THREE.Object3D.prototype;
THREE.Bone.prototype.update=function(a,b){this.matrixAutoUpdate&&(b|=this.updateMatrix());if(b||this.matrixWorldNeedsUpdate)a?this.skinMatrix.multiply(a,this.matrix):this.skinMatrix.copy(this.matrix),this.matrixWorldNeedsUpdate=!1,b=!0;var c,d=this.children.length;for(c=0;c<d;c++)this.children[c].update(this.skinMatrix,b)};
THREE.SkinnedMesh=function(a,b){THREE.Mesh.call(this,a,b);this.identityMatrix=new THREE.Matrix4;this.bones=[];this.boneMatrices=[];var c,d,f,g,e,h;if(this.geometry.bones!==void 0){for(c=0;c<this.geometry.bones.length;c++)f=this.geometry.bones[c],g=f.pos,e=f.rotq,h=f.scl,d=this.addBone(),d.name=f.name,d.position.set(g[0],g[1],g[2]),d.quaternion.set(e[0],e[1],e[2],e[3]),d.useQuaternion=!0,h!==void 0?d.scale.set(h[0],h[1],h[2]):d.scale.set(1,1,1);for(c=0;c<this.bones.length;c++)f=this.geometry.bones[c],
d=this.bones[c],f.parent===-1?this.add(d):this.bones[f.parent].add(d);this.boneMatrices=new Float32Array(16*this.bones.length);this.pose()}};THREE.SkinnedMesh.prototype=new THREE.Mesh;THREE.SkinnedMesh.prototype.constructor=THREE.SkinnedMesh;THREE.SkinnedMesh.prototype.addBone=function(a){a===void 0&&(a=new THREE.Bone(this));this.bones.push(a);return a};
THREE.SkinnedMesh.prototype.updateMatrixWorld=function(a){this.matrixAutoUpdate&&this.updateMatrix();if(this.matrixWorldNeedsUpdate||a)this.parent?this.matrixWorld.multiply(this.parent.matrixWorld,this.matrix):this.matrixWorld.copy(this.matrix),this.matrixWorldNeedsUpdate=!1;for(var a=0,b=this.children.length;a<b;a++){var c=this.children[a];c instanceof THREE.Bone?c.update(this.identityMatrix,!1):c.updateMatrixWorld(!0)}for(var b=this.bones.length,c=this.bones,d=this.boneMatrices,a=0;a<b;a++)c[a].skinMatrix.flattenToArrayOffset(d,
a*16)};
THREE.SkinnedMesh.prototype.pose=function(){this.updateMatrixWorld(!0);for(var a,b=[],c=0;c<this.bones.length;c++){a=this.bones[c];var d=new THREE.Matrix4;d.getInverse(a.skinMatrix);b.push(d);a.skinMatrix.flattenToArrayOffset(this.boneMatrices,c*16)}if(this.geometry.skinVerticesA===void 0){this.geometry.skinVerticesA=[];this.geometry.skinVerticesB=[];for(a=0;a<this.geometry.skinIndices.length;a++){var c=this.geometry.vertices[a].position,f=this.geometry.skinIndices[a].x,g=this.geometry.skinIndices[a].y,d=
new THREE.Vector3(c.x,c.y,c.z);this.geometry.skinVerticesA.push(b[f].multiplyVector3(d));d=new THREE.Vector3(c.x,c.y,c.z);this.geometry.skinVerticesB.push(b[g].multiplyVector3(d));this.geometry.skinWeights[a].x+this.geometry.skinWeights[a].y!==1&&(c=(1-(this.geometry.skinWeights[a].x+this.geometry.skinWeights[a].y))*0.5,this.geometry.skinWeights[a].x+=c,this.geometry.skinWeights[a].y+=c)}}};
THREE.MorphAnimMesh=function(a,b){THREE.Mesh.call(this,a,b);this.duration=1E3;this.mirroredLoop=!1;this.currentKeyframe=this.lastKeyframe=this.time=0;this.direction=1;this.directionBackwards=!1;this.setFrameRange(0,this.geometry.morphTargets.length-1)};THREE.MorphAnimMesh.prototype=new THREE.Mesh;THREE.MorphAnimMesh.prototype.constructor=THREE.MorphAnimMesh;
THREE.MorphAnimMesh.prototype.setFrameRange=function(a,b){this.startKeyframe=a;this.endKeyframe=b;this.length=this.endKeyframe-this.startKeyframe+1};THREE.MorphAnimMesh.prototype.setDirectionForward=function(){this.direction=1;this.directionBackwards=!1};THREE.MorphAnimMesh.prototype.setDirectionBackward=function(){this.direction=-1;this.directionBackwards=!0};
THREE.MorphAnimMesh.prototype.parseAnimations=function(){var a=this.geometry;if(!a.animations)a.animations={};for(var b,c=a.animations,d=/([a-z]+)(\d+)/,f=0,g=a.morphTargets.length;f<g;f++){var e=a.morphTargets[f].name.match(d);if(e&&e.length>1){e=e[1];c[e]||(c[e]={start:Infinity,end:-Infinity});var h=c[e];if(f<h.start)h.start=f;if(f>h.end)h.end=f;b||(b=e)}}a.firstAnimation=b};
THREE.MorphAnimMesh.prototype.setAnimationLabel=function(a,b,c){if(!this.geometry.animations)this.geometry.animations={};this.geometry.animations[a]={start:b,end:c}};THREE.MorphAnimMesh.prototype.playAnimation=function(a,b){var c=this.geometry.animations[a];c?(this.setFrameRange(c.start,c.end),this.duration=1E3*((c.end-c.start)/b),this.time=0):console.warn("animation["+a+"] undefined")};
THREE.MorphAnimMesh.prototype.updateAnimation=function(a){var b=this.duration/this.length;this.time+=this.direction*a;if(this.mirroredLoop){if(this.time>this.duration||this.time<0){this.direction*=-1;if(this.time>this.duration)this.time=this.duration,this.directionBackwards=!0;if(this.time<0)this.time=0,this.directionBackwards=!1}}else this.time%=this.duration,this.time<0&&(this.time+=this.duration);a=this.startKeyframe+THREE.Math.clamp(Math.floor(this.time/b),0,this.length-1);if(a!==this.currentKeyframe)this.morphTargetInfluences[this.lastKeyframe]=
0,this.morphTargetInfluences[this.currentKeyframe]=1,this.morphTargetInfluences[a]=0,this.lastKeyframe=this.currentKeyframe,this.currentKeyframe=a;b=this.time%b/b;this.directionBackwards&&(b=1-b);this.morphTargetInfluences[this.currentKeyframe]=b;this.morphTargetInfluences[this.lastKeyframe]=1-b};THREE.Ribbon=function(a,b){THREE.Object3D.call(this);this.geometry=a;this.material=b};THREE.Ribbon.prototype=new THREE.Object3D;THREE.Ribbon.prototype.constructor=THREE.Ribbon;
THREE.LOD=function(){THREE.Object3D.call(this);this.LODs=[]};THREE.LOD.prototype=new THREE.Object3D;THREE.LOD.prototype.constructor=THREE.LOD;THREE.LOD.prototype.supr=THREE.Object3D.prototype;THREE.LOD.prototype.addLevel=function(a,b){b===void 0&&(b=0);for(var b=Math.abs(b),c=0;c<this.LODs.length;c++)if(b<this.LODs[c].visibleAtDistance)break;this.LODs.splice(c,0,{visibleAtDistance:b,object3D:a});this.add(a)};
THREE.LOD.prototype.update=function(a){if(this.LODs.length>1){a.matrixWorldInverse.getInverse(a.matrixWorld);a=a.matrixWorldInverse;a=-(a.n31*this.matrixWorld.n14+a.n32*this.matrixWorld.n24+a.n33*this.matrixWorld.n34+a.n34);this.LODs[0].object3D.visible=!0;for(var b=1;b<this.LODs.length;b++)if(a>=this.LODs[b].visibleAtDistance)this.LODs[b-1].object3D.visible=!1,this.LODs[b].object3D.visible=!0;else break;for(;b<this.LODs.length;b++)this.LODs[b].object3D.visible=!1}};
THREE.Sprite=function(a){THREE.Object3D.call(this);this.color=a.color!==void 0?new THREE.Color(a.color):new THREE.Color(16777215);this.map=a.map!==void 0?a.map:new THREE.Texture;this.blending=a.blending!==void 0?a.blending:THREE.NormalBlending;this.useScreenCoordinates=a.useScreenCoordinates!==void 0?a.useScreenCoordinates:!0;this.mergeWith3D=a.mergeWith3D!==void 0?a.mergeWith3D:!this.useScreenCoordinates;this.affectedByDistance=a.affectedByDistance!==void 0?a.affectedByDistance:!this.useScreenCoordinates;
this.scaleByViewport=a.scaleByViewport!==void 0?a.scaleByViewport:!this.affectedByDistance;this.alignment=a.alignment instanceof THREE.Vector2?a.alignment:THREE.SpriteAlignment.center;this.rotation3d=this.rotation;this.rotation=0;this.opacity=1;this.uvOffset=new THREE.Vector2(0,0);this.uvScale=new THREE.Vector2(1,1)};THREE.Sprite.prototype=new THREE.Object3D;THREE.Sprite.prototype.constructor=THREE.Sprite;
THREE.Sprite.prototype.updateMatrix=function(){this.matrix.setPosition(this.position);this.rotation3d.set(0,0,this.rotation);this.matrix.setRotationFromEuler(this.rotation3d);if(this.scale.x!==1||this.scale.y!==1)this.matrix.scale(this.scale),this.boundRadiusScale=Math.max(this.scale.x,this.scale.y);this.matrixWorldNeedsUpdate=!0};THREE.SpriteAlignment={};THREE.SpriteAlignment.topLeft=new THREE.Vector2(1,-1);THREE.SpriteAlignment.topCenter=new THREE.Vector2(0,-1);
THREE.SpriteAlignment.topRight=new THREE.Vector2(-1,-1);THREE.SpriteAlignment.centerLeft=new THREE.Vector2(1,0);THREE.SpriteAlignment.center=new THREE.Vector2(0,0);THREE.SpriteAlignment.centerRight=new THREE.Vector2(-1,0);THREE.SpriteAlignment.bottomLeft=new THREE.Vector2(1,1);THREE.SpriteAlignment.bottomCenter=new THREE.Vector2(0,1);THREE.SpriteAlignment.bottomRight=new THREE.Vector2(-1,1);
THREE.Scene=function(){THREE.Object3D.call(this);this.overrideMaterial=this.fog=null;this.matrixAutoUpdate=!1;this.__objects=[];this.__lights=[];this.__objectsAdded=[];this.__objectsRemoved=[]};THREE.Scene.prototype=new THREE.Object3D;THREE.Scene.prototype.constructor=THREE.Scene;
THREE.Scene.prototype.__addObject=function(a){if(a instanceof THREE.Light)this.__lights.indexOf(a)===-1&&this.__lights.push(a);else if(!(a instanceof THREE.Camera||a instanceof THREE.Bone)&&this.__objects.indexOf(a)===-1){this.__objects.push(a);this.__objectsAdded.push(a);var b=this.__objectsRemoved.indexOf(a);b!==-1&&this.__objectsRemoved.splice(b,1)}for(b=0;b<a.children.length;b++)this.__addObject(a.children[b])};
THREE.Scene.prototype.__removeObject=function(a){if(a instanceof THREE.Light){var b=this.__lights.indexOf(a);b!==-1&&this.__lights.splice(b,1)}else a instanceof THREE.Camera||(b=this.__objects.indexOf(a),b!==-1&&(this.__objects.splice(b,1),this.__objectsRemoved.push(a),b=this.__objectsAdded.indexOf(a),b!==-1&&this.__objectsAdded.splice(b,1)));for(b=0;b<a.children.length;b++)this.__removeObject(a.children[b])};
THREE.Fog=function(a,b,c){this.color=new THREE.Color(a);this.near=b!==void 0?b:1;this.far=c!==void 0?c:1E3};THREE.FogExp2=function(a,b){this.color=new THREE.Color(a);this.density=b!==void 0?b:2.5E-4};
THREE.DOMRenderer=function(){var a,b,c=new THREE.Projector,d,f,g,e;this.domElement=document.createElement("div");this.setSize=function(a,b){d=a;f=b;g=d/2;e=f/2};this.render=function(d,f){var j,k,q,n,o;a=c.projectScene(d,f);b=a.elements;for(j=0,k=b.length;j<k;j++)if(q=b[j],q instanceof THREE.RenderableParticle&&(n=q.x*g+g,o=q.y*e+e,q=q.material,q instanceof THREE.ParticleDOMMaterial))q=q.domElement,q.style.left=n+"px",q.style.top=o+"px"}};
THREE.CanvasRenderer=function(a){function b(a){if(t!=a)m.globalAlpha=t=a}function c(a){if(v!=a){switch(a){case THREE.NormalBlending:m.globalCompositeOperation="source-over";break;case THREE.AdditiveBlending:m.globalCompositeOperation="lighter";break;case THREE.SubtractiveBlending:m.globalCompositeOperation="darker"}v=a}}function d(a){if(u!=a)m.strokeStyle=u=a}function f(a){if(w!=a)m.fillStyle=w=a}var a=a||{},g=this,e,h,i,j=new THREE.Projector,k=a.canvas!==void 0?a.canvas:document.createElement("canvas"),
q,n,o,s,m=k.getContext("2d"),p=new THREE.Color(0),r=0,t=1,v=0,u=null,w=null,y=null,F=null,D=null,G,I,K,Q,N=new THREE.RenderableVertex,B=new THREE.RenderableVertex,O,S,A,l,V,E,z,T,W,M,ma,aa,Z=new THREE.Color,X=new THREE.Color,U=new THREE.Color,Y=new THREE.Color,$=new THREE.Color,oa=[],ga=[],ra,qa,ha,ka,Ea,Aa,ya,xa,za,wa,sa=new THREE.Rectangle,na=new THREE.Rectangle,ja=new THREE.Rectangle,ta=!1,ua=new THREE.Color,Ba=new THREE.Color,Ga=new THREE.Color,da=new THREE.Vector3,R,Ca,Ra,Da,Oa,Pa,a=16;R=document.createElement("canvas");
R.width=R.height=2;Ca=R.getContext("2d");Ca.fillStyle="rgba(0,0,0,1)";Ca.fillRect(0,0,2,2);Ra=Ca.getImageData(0,0,2,2);Da=Ra.data;Oa=document.createElement("canvas");Oa.width=Oa.height=a;Pa=Oa.getContext("2d");Pa.translate(-a/2,-a/2);Pa.scale(a,a);a--;this.domElement=k;this.sortElements=this.sortObjects=this.autoClear=!0;this.info={render:{vertices:0,faces:0}};this.setSize=function(a,b){q=a;n=b;o=Math.floor(q/2);s=Math.floor(n/2);k.width=q;k.height=n;sa.set(-o,-s,o,s);na.set(-o,-s,o,s);t=1;v=0;D=
F=y=w=u=null};this.setClearColor=function(a,b){p.copy(a);r=b;na.set(-o,-s,o,s)};this.setClearColorHex=function(a,b){p.setHex(a);r=b;na.set(-o,-s,o,s)};this.clear=function(){m.setTransform(1,0,0,-1,o,s);na.isEmpty()||(na.minSelf(sa),na.inflate(2),r<1&&m.clearRect(Math.floor(na.getX()),Math.floor(na.getY()),Math.floor(na.getWidth()),Math.floor(na.getHeight())),r>0&&(c(THREE.NormalBlending),b(1),f("rgba("+Math.floor(p.r*255)+","+Math.floor(p.g*255)+","+Math.floor(p.b*255)+","+r+")"),m.fillRect(Math.floor(na.getX()),
Math.floor(na.getY()),Math.floor(na.getWidth()),Math.floor(na.getHeight()))),na.empty())};this.render=function(a,k){function n(a){var b,c,d,f;ua.setRGB(0,0,0);Ba.setRGB(0,0,0);Ga.setRGB(0,0,0);for(b=0,c=a.length;b<c;b++)d=a[b],f=d.color,d instanceof THREE.AmbientLight?(ua.r+=f.r,ua.g+=f.g,ua.b+=f.b):d instanceof THREE.DirectionalLight?(Ba.r+=f.r,Ba.g+=f.g,Ba.b+=f.b):d instanceof THREE.PointLight&&(Ga.r+=f.r,Ga.g+=f.g,Ga.b+=f.b)}function q(a,b,c,d){var f,g,e,h,i,l;for(f=0,g=a.length;f<g;f++)e=a[f],
h=e.color,e instanceof THREE.DirectionalLight?(i=e.matrixWorld.getPosition(),l=c.dot(i),l<=0||(l*=e.intensity,d.r+=h.r*l,d.g+=h.g*l,d.b+=h.b*l)):e instanceof THREE.PointLight&&(i=e.matrixWorld.getPosition(),l=c.dot(da.sub(i,b).normalize()),l<=0||(l*=e.distance==0?1:1-Math.min(b.distanceTo(i)/e.distance,1),l!=0&&(l*=e.intensity,d.r+=h.r*l,d.g+=h.g*l,d.b+=h.b*l)))}function p(a,g,e){b(e.opacity);c(e.blending);var h,da,i,l,j,k;if(e instanceof THREE.ParticleBasicMaterial){if(e.map)l=e.map.image,j=l.width>>
1,k=l.height>>1,e=g.scale.x*o,i=g.scale.y*s,h=e*j,da=i*k,ja.set(a.x-h,a.y-da,a.x+h,a.y+da),sa.intersects(ja)&&(m.save(),m.translate(a.x,a.y),m.rotate(-g.rotation),m.scale(e,-i),m.translate(-j,-k),m.drawImage(l,0,0),m.restore())}else e instanceof THREE.ParticleCanvasMaterial&&(h=g.scale.x*o,da=g.scale.y*s,ja.set(a.x-h,a.y-da,a.x+h,a.y+da),sa.intersects(ja)&&(d(e.color.getContextStyle()),f(e.color.getContextStyle()),m.save(),m.translate(a.x,a.y),m.rotate(-g.rotation),m.scale(h,da),e.program(m),m.restore()))}
function r(a,f,g,e){b(e.opacity);c(e.blending);m.beginPath();m.moveTo(a.positionScreen.x,a.positionScreen.y);m.lineTo(f.positionScreen.x,f.positionScreen.y);m.closePath();if(e instanceof THREE.LineBasicMaterial){a=e.linewidth;if(y!=a)m.lineWidth=y=a;a=e.linecap;if(F!=a)m.lineCap=F=a;a=e.linejoin;if(D!=a)m.lineJoin=D=a;d(e.color.getContextStyle());m.stroke();ja.inflate(e.linewidth*2)}}function t(a,d,f,e,h,j,m,R){g.info.render.vertices+=3;g.info.render.faces++;b(R.opacity);c(R.blending);O=a.positionScreen.x;
S=a.positionScreen.y;A=d.positionScreen.x;l=d.positionScreen.y;V=f.positionScreen.x;E=f.positionScreen.y;w(O,S,A,l,V,E);if(R instanceof THREE.MeshBasicMaterial)if(R.map)R.map.mapping instanceof THREE.UVMapping&&(ka=m.uvs[0],Sa(O,S,A,l,V,E,ka[e].u,ka[e].v,ka[h].u,ka[h].v,ka[j].u,ka[j].v,R.map));else if(R.envMap){if(R.envMap.mapping instanceof THREE.SphericalReflectionMapping)a=k.matrixWorldInverse,da.copy(m.vertexNormalsWorld[e]),Ea=(da.x*a.n11+da.y*a.n12+da.z*a.n13)*0.5+0.5,Aa=-(da.x*a.n21+da.y*a.n22+
da.z*a.n23)*0.5+0.5,da.copy(m.vertexNormalsWorld[h]),ya=(da.x*a.n11+da.y*a.n12+da.z*a.n13)*0.5+0.5,xa=-(da.x*a.n21+da.y*a.n22+da.z*a.n23)*0.5+0.5,da.copy(m.vertexNormalsWorld[j]),za=(da.x*a.n11+da.y*a.n12+da.z*a.n13)*0.5+0.5,wa=-(da.x*a.n21+da.y*a.n22+da.z*a.n23)*0.5+0.5,Sa(O,S,A,l,V,E,Ea,Aa,ya,xa,za,wa,R.envMap)}else R.wireframe?Ha(R.color,R.wireframeLinewidth,R.wireframeLinecap,R.wireframeLinejoin):J(R.color);else if(R instanceof THREE.MeshLambertMaterial)R.map&&!R.wireframe&&(R.map.mapping instanceof
THREE.UVMapping&&(ka=m.uvs[0],Sa(O,S,A,l,V,E,ka[e].u,ka[e].v,ka[h].u,ka[h].v,ka[j].u,ka[j].v,R.map)),c(THREE.SubtractiveBlending)),ta?!R.wireframe&&R.shading==THREE.SmoothShading&&m.vertexNormalsWorld.length==3?(X.r=U.r=Y.r=ua.r,X.g=U.g=Y.g=ua.g,X.b=U.b=Y.b=ua.b,q(i,m.v1.positionWorld,m.vertexNormalsWorld[0],X),q(i,m.v2.positionWorld,m.vertexNormalsWorld[1],U),q(i,m.v3.positionWorld,m.vertexNormalsWorld[2],Y),X.r=Math.max(0,Math.min(R.color.r*X.r,1)),X.g=Math.max(0,Math.min(R.color.g*X.g,1)),X.b=
Math.max(0,Math.min(R.color.b*X.b,1)),U.r=Math.max(0,Math.min(R.color.r*U.r,1)),U.g=Math.max(0,Math.min(R.color.g*U.g,1)),U.b=Math.max(0,Math.min(R.color.b*U.b,1)),Y.r=Math.max(0,Math.min(R.color.r*Y.r,1)),Y.g=Math.max(0,Math.min(R.color.g*Y.g,1)),Y.b=Math.max(0,Math.min(R.color.b*Y.b,1)),$.r=(U.r+Y.r)*0.5,$.g=(U.g+Y.g)*0.5,$.b=(U.b+Y.b)*0.5,ha=L(X,U,Y,$),Ma(O,S,A,l,V,E,0,0,1,0,0,1,ha)):(Z.r=ua.r,Z.g=ua.g,Z.b=ua.b,q(i,m.centroidWorld,m.normalWorld,Z),Z.r=Math.max(0,Math.min(R.color.r*Z.r,1)),Z.g=
Math.max(0,Math.min(R.color.g*Z.g,1)),Z.b=Math.max(0,Math.min(R.color.b*Z.b,1)),R.wireframe?Ha(Z,R.wireframeLinewidth,R.wireframeLinecap,R.wireframeLinejoin):J(Z)):R.wireframe?Ha(R.color,R.wireframeLinewidth,R.wireframeLinecap,R.wireframeLinejoin):J(R.color);else if(R instanceof THREE.MeshDepthMaterial)ra=k.near,qa=k.far,X.r=X.g=X.b=1-La(a.positionScreen.z,ra,qa),U.r=U.g=U.b=1-La(d.positionScreen.z,ra,qa),Y.r=Y.g=Y.b=1-La(f.positionScreen.z,ra,qa),$.r=(U.r+Y.r)*0.5,$.g=(U.g+Y.g)*0.5,$.b=(U.b+Y.b)*
0.5,ha=L(X,U,Y,$),Ma(O,S,A,l,V,E,0,0,1,0,0,1,ha);else if(R instanceof THREE.MeshNormalMaterial)Z.r=Na(m.normalWorld.x),Z.g=Na(m.normalWorld.y),Z.b=Na(m.normalWorld.z),R.wireframe?Ha(Z,R.wireframeLinewidth,R.wireframeLinecap,R.wireframeLinejoin):J(Z)}function u(a,d,f,e,h,da,j,R,m){g.info.render.vertices+=4;g.info.render.faces++;b(R.opacity);c(R.blending);if(R.map||R.envMap)t(a,d,e,0,1,3,j,R,m),t(h,f,da,1,2,3,j,R,m);else if(O=a.positionScreen.x,S=a.positionScreen.y,A=d.positionScreen.x,l=d.positionScreen.y,
V=f.positionScreen.x,E=f.positionScreen.y,z=e.positionScreen.x,T=e.positionScreen.y,W=h.positionScreen.x,M=h.positionScreen.y,ma=da.positionScreen.x,aa=da.positionScreen.y,R instanceof THREE.MeshBasicMaterial)v(O,S,A,l,V,E,z,T),R.wireframe?Ha(R.color,R.wireframeLinewidth,R.wireframeLinecap,R.wireframeLinejoin):J(R.color);else if(R instanceof THREE.MeshLambertMaterial)ta?!R.wireframe&&R.shading==THREE.SmoothShading&&j.vertexNormalsWorld.length==4?(X.r=U.r=Y.r=$.r=ua.r,X.g=U.g=Y.g=$.g=ua.g,X.b=U.b=
Y.b=$.b=ua.b,q(i,j.v1.positionWorld,j.vertexNormalsWorld[0],X),q(i,j.v2.positionWorld,j.vertexNormalsWorld[1],U),q(i,j.v4.positionWorld,j.vertexNormalsWorld[3],Y),q(i,j.v3.positionWorld,j.vertexNormalsWorld[2],$),X.r=Math.max(0,Math.min(R.color.r*X.r,1)),X.g=Math.max(0,Math.min(R.color.g*X.g,1)),X.b=Math.max(0,Math.min(R.color.b*X.b,1)),U.r=Math.max(0,Math.min(R.color.r*U.r,1)),U.g=Math.max(0,Math.min(R.color.g*U.g,1)),U.b=Math.max(0,Math.min(R.color.b*U.b,1)),Y.r=Math.max(0,Math.min(R.color.r*Y.r,
1)),Y.g=Math.max(0,Math.min(R.color.g*Y.g,1)),Y.b=Math.max(0,Math.min(R.color.b*Y.b,1)),$.r=Math.max(0,Math.min(R.color.r*$.r,1)),$.g=Math.max(0,Math.min(R.color.g*$.g,1)),$.b=Math.max(0,Math.min(R.color.b*$.b,1)),ha=L(X,U,Y,$),w(O,S,A,l,z,T),Ma(O,S,A,l,z,T,0,0,1,0,0,1,ha),w(W,M,V,E,ma,aa),Ma(W,M,V,E,ma,aa,1,0,1,1,0,1,ha)):(Z.r=ua.r,Z.g=ua.g,Z.b=ua.b,q(i,j.centroidWorld,j.normalWorld,Z),Z.r=Math.max(0,Math.min(R.color.r*Z.r,1)),Z.g=Math.max(0,Math.min(R.color.g*Z.g,1)),Z.b=Math.max(0,Math.min(R.color.b*
Z.b,1)),v(O,S,A,l,V,E,z,T),R.wireframe?Ha(Z,R.wireframeLinewidth,R.wireframeLinecap,R.wireframeLinejoin):J(Z)):(v(O,S,A,l,V,E,z,T),R.wireframe?Ha(R.color,R.wireframeLinewidth,R.wireframeLinecap,R.wireframeLinejoin):J(R.color));else if(R instanceof THREE.MeshNormalMaterial)Z.r=Na(j.normalWorld.x),Z.g=Na(j.normalWorld.y),Z.b=Na(j.normalWorld.z),v(O,S,A,l,V,E,z,T),R.wireframe?Ha(Z,R.wireframeLinewidth,R.wireframeLinecap,R.wireframeLinejoin):J(Z);else if(R instanceof THREE.MeshDepthMaterial)ra=k.near,
qa=k.far,X.r=X.g=X.b=1-La(a.positionScreen.z,ra,qa),U.r=U.g=U.b=1-La(d.positionScreen.z,ra,qa),Y.r=Y.g=Y.b=1-La(e.positionScreen.z,ra,qa),$.r=$.g=$.b=1-La(f.positionScreen.z,ra,qa),ha=L(X,U,Y,$),w(O,S,A,l,z,T),Ma(O,S,A,l,z,T,0,0,1,0,0,1,ha),w(W,M,V,E,ma,aa),Ma(W,M,V,E,ma,aa,1,0,1,1,0,1,ha)}function w(a,b,c,d,f,g){m.beginPath();m.moveTo(a,b);m.lineTo(c,d);m.lineTo(f,g);m.lineTo(a,b);m.closePath()}function v(a,b,c,d,f,g,e,h){m.beginPath();m.moveTo(a,b);m.lineTo(c,d);m.lineTo(f,g);m.lineTo(e,h);m.lineTo(a,
b);m.closePath()}function Ha(a,b,c,f){if(y!=b)m.lineWidth=y=b;if(F!=c)m.lineCap=F=c;if(D!=f)m.lineJoin=D=f;d(a.getContextStyle());m.stroke();ja.inflate(b*2)}function J(a){f(a.getContextStyle());m.fill()}function Sa(a,b,c,d,g,e,h,da,i,l,j,R,k){if(k.image.width!=0){if(k.needsUpdate==!0||oa[k.id]==void 0){var n=k.wrapS==THREE.RepeatWrapping,Ca=k.wrapT==THREE.RepeatWrapping;oa[k.id]=m.createPattern(k.image,n&&Ca?"repeat":n&&!Ca?"repeat-x":!n&&Ca?"repeat-y":"no-repeat");k.needsUpdate=!1}f(oa[k.id]);var n=
k.offset.x/k.repeat.x,Ca=k.offset.y/k.repeat.y,q=k.image.width*k.repeat.x,o=k.image.height*k.repeat.y,h=(h+n)*q,da=(da+Ca)*o,i=(i+n)*q,l=(l+Ca)*o,j=(j+n)*q,R=(R+Ca)*o;c-=a;d-=b;g-=a;e-=b;i-=h;l-=da;j-=h;R-=da;n=i*R-j*l;if(n==0){if(ga[k.id]===void 0)b=document.createElement("canvas"),b.width=k.image.width,b.height=k.image.height,b=b.getContext("2d"),b.drawImage(k.image,0,0),ga[k.id]=b.getImageData(0,0,k.image.width,k.image.height).data;b=ga[k.id];h=(Math.floor(h)+Math.floor(da)*k.image.width)*4;Z.setRGB(b[h]/
255,b[h+1]/255,b[h+2]/255);J(Z)}else n=1/n,k=(R*c-l*g)*n,l=(R*d-l*e)*n,c=(i*g-j*c)*n,d=(i*e-j*d)*n,a=a-k*h-c*da,h=b-l*h-d*da,m.save(),m.transform(k,l,c,d,a,h),m.fill(),m.restore()}}function Ma(a,b,c,d,f,g,e,h,da,i,l,j,R){var k,n;k=R.width-1;n=R.height-1;e*=k;h*=n;da*=k;i*=n;l*=k;j*=n;c-=a;d-=b;f-=a;g-=b;da-=e;i-=h;l-=e;j-=h;n=1/(da*j-l*i);k=(j*c-i*f)*n;i=(j*d-i*g)*n;c=(da*f-l*c)*n;d=(da*g-l*d)*n;a=a-k*e-c*h;b=b-i*e-d*h;m.save();m.transform(k,i,c,d,a,b);m.clip();m.drawImage(R,0,0);m.restore()}function L(a,
b,c,d){var f=~~(a.r*255),g=~~(a.g*255),a=~~(a.b*255),e=~~(b.r*255),h=~~(b.g*255),b=~~(b.b*255),da=~~(c.r*255),i=~~(c.g*255),c=~~(c.b*255),l=~~(d.r*255),j=~~(d.g*255),d=~~(d.b*255);Da[0]=f<0?0:f>255?255:f;Da[1]=g<0?0:g>255?255:g;Da[2]=a<0?0:a>255?255:a;Da[4]=e<0?0:e>255?255:e;Da[5]=h<0?0:h>255?255:h;Da[6]=b<0?0:b>255?255:b;Da[8]=da<0?0:da>255?255:da;Da[9]=i<0?0:i>255?255:i;Da[10]=c<0?0:c>255?255:c;Da[12]=l<0?0:l>255?255:l;Da[13]=j<0?0:j>255?255:j;Da[14]=d<0?0:d>255?255:d;Ca.putImageData(Ra,0,0);Pa.drawImage(R,
0,0);return Oa}function La(a,b,c){a=(a-b)/(c-b);return a*a*(3-2*a)}function Na(a){a=(a+1)*0.5;return a<0?0:a>1?1:a}function Ia(a,b){var c=b.x-a.x,d=b.y-a.y,f=c*c+d*d;f!=0&&(f=1/Math.sqrt(f),c*=f,d*=f,b.x+=c,b.y+=d,a.x-=c,a.y-=d)}var P,Ta,va,Fa;this.autoClear?this.clear():m.setTransform(1,0,0,-1,o,s);g.info.render.vertices=0;g.info.render.faces=0;e=j.projectScene(a,k,this.sortElements);h=e.elements;i=e.lights;(ta=i.length>0)&&n(i);for(P=0,Ta=h.length;P<Ta;P++)if(va=h[P],Fa=va.material,Fa=Fa instanceof
THREE.MeshFaceMaterial?va.faceMaterial:Fa,!(Fa==null||Fa.opacity==0)){ja.empty();if(va instanceof THREE.RenderableParticle)G=va,G.x*=o,G.y*=s,p(G,va,Fa,a);else if(va instanceof THREE.RenderableLine)G=va.v1,I=va.v2,G.positionScreen.x*=o,G.positionScreen.y*=s,I.positionScreen.x*=o,I.positionScreen.y*=s,ja.addPoint(G.positionScreen.x,G.positionScreen.y),ja.addPoint(I.positionScreen.x,I.positionScreen.y),sa.intersects(ja)&&r(G,I,va,Fa,a);else if(va instanceof THREE.RenderableFace3)G=va.v1,I=va.v2,K=va.v3,
G.positionScreen.x*=o,G.positionScreen.y*=s,I.positionScreen.x*=o,I.positionScreen.y*=s,K.positionScreen.x*=o,K.positionScreen.y*=s,Fa.overdraw&&(Ia(G.positionScreen,I.positionScreen),Ia(I.positionScreen,K.positionScreen),Ia(K.positionScreen,G.positionScreen)),ja.add3Points(G.positionScreen.x,G.positionScreen.y,I.positionScreen.x,I.positionScreen.y,K.positionScreen.x,K.positionScreen.y),sa.intersects(ja)&&t(G,I,K,0,1,2,va,Fa,a);else if(va instanceof THREE.RenderableFace4)G=va.v1,I=va.v2,K=va.v3,Q=
va.v4,G.positionScreen.x*=o,G.positionScreen.y*=s,I.positionScreen.x*=o,I.positionScreen.y*=s,K.positionScreen.x*=o,K.positionScreen.y*=s,Q.positionScreen.x*=o,Q.positionScreen.y*=s,N.positionScreen.copy(I.positionScreen),B.positionScreen.copy(Q.positionScreen),Fa.overdraw&&(Ia(G.positionScreen,I.positionScreen),Ia(I.positionScreen,Q.positionScreen),Ia(Q.positionScreen,G.positionScreen),Ia(K.positionScreen,N.positionScreen),Ia(K.positionScreen,B.positionScreen)),ja.addPoint(G.positionScreen.x,G.positionScreen.y),
ja.addPoint(I.positionScreen.x,I.positionScreen.y),ja.addPoint(K.positionScreen.x,K.positionScreen.y),ja.addPoint(Q.positionScreen.x,Q.positionScreen.y),sa.intersects(ja)&&u(G,I,K,Q,N,B,va,Fa,a);na.addRectangle(ja)}m.setTransform(1,0,0,1,0,0)}};
THREE.SVGRenderer=function(){function a(a,b,c,d){var f,g,e,h,i,j;for(f=0,g=a.length;f<g;f++)e=a[f],h=e.color,e instanceof THREE.DirectionalLight?(i=e.matrixWorld.getPosition(),j=c.dot(i),j<=0||(j*=e.intensity,d.r+=h.r*j,d.g+=h.g*j,d.b+=h.b*j)):e instanceof THREE.PointLight&&(i=e.matrixWorld.getPosition(),j=c.dot(G.sub(i,b).normalize()),j<=0||(j*=e.distance==0?1:1-Math.min(b.distanceTo(i)/e.distance,1),j!=0&&(j*=e.intensity,d.r+=h.r*j,d.g+=h.g*j,d.b+=h.b*j)))}function b(a){I[a]==null&&(I[a]=document.createElementNS("http://www.w3.org/2000/svg",
"path"),O==0&&I[a].setAttribute("shape-rendering","crispEdges"));return I[a]}function c(a){a=(a+1)*0.5;return a<0?0:a>1?1:a}var d=this,f,g,e,h=new THREE.Projector,i=document.createElementNS("http://www.w3.org/2000/svg","svg"),j,k,q,n,o,s,m,p,r=new THREE.Rectangle,t=new THREE.Rectangle,v=!1,u=new THREE.Color,w=new THREE.Color,y=new THREE.Color,F=new THREE.Color,D,G=new THREE.Vector3,I=[],K=[],Q,N,B,O=1;this.domElement=i;this.sortElements=this.sortObjects=this.autoClear=!0;this.info={render:{vertices:0,
faces:0}};this.setQuality=function(a){switch(a){case "high":O=1;break;case "low":O=0}};this.setSize=function(a,b){j=a;k=b;q=j/2;n=k/2;i.setAttribute("viewBox",-q+" "+-n+" "+j+" "+k);i.setAttribute("width",j);i.setAttribute("height",k);r.set(-q,-n,q,n)};this.clear=function(){for(;i.childNodes.length>0;)i.removeChild(i.childNodes[0])};this.render=function(j,k){var l,G,E,z;this.autoClear&&this.clear();d.info.render.vertices=0;d.info.render.faces=0;f=h.projectScene(j,k,this.sortElements);g=f.elements;
e=f.lights;B=N=0;if(v=e.length>0){w.setRGB(0,0,0);y.setRGB(0,0,0);F.setRGB(0,0,0);for(l=0,G=e.length;l<G;l++)z=e[l],E=z.color,z instanceof THREE.AmbientLight?(w.r+=E.r,w.g+=E.g,w.b+=E.b):z instanceof THREE.DirectionalLight?(y.r+=E.r,y.g+=E.g,y.b+=E.b):z instanceof THREE.PointLight&&(F.r+=E.r,F.g+=E.g,F.b+=E.b)}for(l=0,G=g.length;l<G;l++)if(E=g[l],z=E.material,z=z instanceof THREE.MeshFaceMaterial?E.faceMaterial:z,!(z==null||z.opacity==0))if(t.empty(),E instanceof THREE.RenderableParticle)o=E,o.x*=
q,o.y*=-n;else if(E instanceof THREE.RenderableLine){if(o=E.v1,s=E.v2,o.positionScreen.x*=q,o.positionScreen.y*=-n,s.positionScreen.x*=q,s.positionScreen.y*=-n,t.addPoint(o.positionScreen.x,o.positionScreen.y),t.addPoint(s.positionScreen.x,s.positionScreen.y),r.intersects(t)){E=o;var T=s,W=B++;K[W]==null&&(K[W]=document.createElementNS("http://www.w3.org/2000/svg","line"),O==0&&K[W].setAttribute("shape-rendering","crispEdges"));Q=K[W];Q.setAttribute("x1",E.positionScreen.x);Q.setAttribute("y1",E.positionScreen.y);
Q.setAttribute("x2",T.positionScreen.x);Q.setAttribute("y2",T.positionScreen.y);z instanceof THREE.LineBasicMaterial&&(Q.setAttribute("style","fill: none; stroke: "+z.color.getContextStyle()+"; stroke-width: "+z.linewidth+"; stroke-opacity: "+z.opacity+"; stroke-linecap: "+z.linecap+"; stroke-linejoin: "+z.linejoin),i.appendChild(Q))}}else if(E instanceof THREE.RenderableFace3){if(o=E.v1,s=E.v2,m=E.v3,o.positionScreen.x*=q,o.positionScreen.y*=-n,s.positionScreen.x*=q,s.positionScreen.y*=-n,m.positionScreen.x*=
q,m.positionScreen.y*=-n,t.addPoint(o.positionScreen.x,o.positionScreen.y),t.addPoint(s.positionScreen.x,s.positionScreen.y),t.addPoint(m.positionScreen.x,m.positionScreen.y),r.intersects(t)){var T=o,W=s,I=m;d.info.render.vertices+=3;d.info.render.faces++;Q=b(N++);Q.setAttribute("d","M "+T.positionScreen.x+" "+T.positionScreen.y+" L "+W.positionScreen.x+" "+W.positionScreen.y+" L "+I.positionScreen.x+","+I.positionScreen.y+"z");z instanceof THREE.MeshBasicMaterial?u.copy(z.color):z instanceof THREE.MeshLambertMaterial?
v?(u.r=w.r,u.g=w.g,u.b=w.b,a(e,E.centroidWorld,E.normalWorld,u),u.r=Math.max(0,Math.min(z.color.r*u.r,1)),u.g=Math.max(0,Math.min(z.color.g*u.g,1)),u.b=Math.max(0,Math.min(z.color.b*u.b,1))):u.copy(z.color):z instanceof THREE.MeshDepthMaterial?(D=1-z.__2near/(z.__farPlusNear-E.z*z.__farMinusNear),u.setRGB(D,D,D)):z instanceof THREE.MeshNormalMaterial&&u.setRGB(c(E.normalWorld.x),c(E.normalWorld.y),c(E.normalWorld.z));z.wireframe?Q.setAttribute("style","fill: none; stroke: "+u.getContextStyle()+"; stroke-width: "+
z.wireframeLinewidth+"; stroke-opacity: "+z.opacity+"; stroke-linecap: "+z.wireframeLinecap+"; stroke-linejoin: "+z.wireframeLinejoin):Q.setAttribute("style","fill: "+u.getContextStyle()+"; fill-opacity: "+z.opacity);i.appendChild(Q)}}else if(E instanceof THREE.RenderableFace4&&(o=E.v1,s=E.v2,m=E.v3,p=E.v4,o.positionScreen.x*=q,o.positionScreen.y*=-n,s.positionScreen.x*=q,s.positionScreen.y*=-n,m.positionScreen.x*=q,m.positionScreen.y*=-n,p.positionScreen.x*=q,p.positionScreen.y*=-n,t.addPoint(o.positionScreen.x,
o.positionScreen.y),t.addPoint(s.positionScreen.x,s.positionScreen.y),t.addPoint(m.positionScreen.x,m.positionScreen.y),t.addPoint(p.positionScreen.x,p.positionScreen.y),r.intersects(t))){var T=o,W=s,I=m,ma=p;d.info.render.vertices+=4;d.info.render.faces++;Q=b(N++);Q.setAttribute("d","M "+T.positionScreen.x+" "+T.positionScreen.y+" L "+W.positionScreen.x+" "+W.positionScreen.y+" L "+I.positionScreen.x+","+I.positionScreen.y+" L "+ma.positionScreen.x+","+ma.positionScreen.y+"z");z instanceof THREE.MeshBasicMaterial?
u.copy(z.color):z instanceof THREE.MeshLambertMaterial?v?(u.r=w.r,u.g=w.g,u.b=w.b,a(e,E.centroidWorld,E.normalWorld,u),u.r=Math.max(0,Math.min(z.color.r*u.r,1)),u.g=Math.max(0,Math.min(z.color.g*u.g,1)),u.b=Math.max(0,Math.min(z.color.b*u.b,1))):u.copy(z.color):z instanceof THREE.MeshDepthMaterial?(D=1-z.__2near/(z.__farPlusNear-E.z*z.__farMinusNear),u.setRGB(D,D,D)):z instanceof THREE.MeshNormalMaterial&&u.setRGB(c(E.normalWorld.x),c(E.normalWorld.y),c(E.normalWorld.z));z.wireframe?Q.setAttribute("style",
"fill: none; stroke: "+u.getContextStyle()+"; stroke-width: "+z.wireframeLinewidth+"; stroke-opacity: "+z.opacity+"; stroke-linecap: "+z.wireframeLinecap+"; stroke-linejoin: "+z.wireframeLinejoin):Q.setAttribute("style","fill: "+u.getContextStyle()+"; fill-opacity: "+z.opacity);i.appendChild(Q)}}};
THREE.ShaderChunk={fog_pars_fragment:"#ifdef USE_FOG\nuniform vec3 fogColor;\n#ifdef FOG_EXP2\nuniform float fogDensity;\n#else\nuniform float fogNear;\nuniform float fogFar;\n#endif\n#endif",fog_fragment:"#ifdef USE_FOG\nfloat depth = gl_FragCoord.z / gl_FragCoord.w;\n#ifdef FOG_EXP2\nconst float LOG2 = 1.442695;\nfloat fogFactor = exp2( - fogDensity * fogDensity * depth * depth * LOG2 );\nfogFactor = 1.0 - clamp( fogFactor, 0.0, 1.0 );\n#else\nfloat fogFactor = smoothstep( fogNear, fogFar, depth );\n#endif\ngl_FragColor = mix( gl_FragColor, vec4( fogColor, gl_FragColor.w ), fogFactor );\n#endif",envmap_pars_fragment:"#ifdef USE_ENVMAP\nvarying vec3 vReflect;\nuniform float reflectivity;\nuniform samplerCube envMap;\nuniform float flipEnvMap;\nuniform int combine;\n#endif",
envmap_fragment:"#ifdef USE_ENVMAP\n#ifdef DOUBLE_SIDED\nfloat flipNormal = ( -1.0 + 2.0 * float( gl_FrontFacing ) );\nvec4 cubeColor = textureCube( envMap, flipNormal * vec3( flipEnvMap * vReflect.x, vReflect.yz ) );\n#else\nvec4 cubeColor = textureCube( envMap, vec3( flipEnvMap * vReflect.x, vReflect.yz ) );\n#endif\n#ifdef GAMMA_INPUT\ncubeColor.xyz *= cubeColor.xyz;\n#endif\nif ( combine == 1 ) {\ngl_FragColor.xyz = mix( gl_FragColor.xyz, cubeColor.xyz, reflectivity );\n} else {\ngl_FragColor.xyz = gl_FragColor.xyz * cubeColor.xyz;\n}\n#endif",
envmap_pars_vertex:"#ifdef USE_ENVMAP\nvarying vec3 vReflect;\nuniform float refractionRatio;\nuniform bool useRefract;\n#endif",envmap_vertex:"#ifdef USE_ENVMAP\nvec4 mPosition = objectMatrix * vec4( position, 1.0 );\nvec3 nWorld = mat3( objectMatrix[ 0 ].xyz, objectMatrix[ 1 ].xyz, objectMatrix[ 2 ].xyz ) * normal;\nif ( useRefract ) {\nvReflect = refract( normalize( mPosition.xyz - cameraPosition ), normalize( nWorld.xyz ), refractionRatio );\n} else {\nvReflect = reflect( normalize( mPosition.xyz - cameraPosition ), normalize( nWorld.xyz ) );\n}\n#endif",
map_particle_pars_fragment:"#ifdef USE_MAP\nuniform sampler2D map;\n#endif",map_particle_fragment:"#ifdef USE_MAP\ngl_FragColor = gl_FragColor * texture2D( map, gl_PointCoord );\n#endif",map_pars_vertex:"#ifdef USE_MAP\nvarying vec2 vUv;\nuniform vec4 offsetRepeat;\n#endif",map_pars_fragment:"#ifdef USE_MAP\nvarying vec2 vUv;\nuniform sampler2D map;\n#endif",map_vertex:"#ifdef USE_MAP\nvUv = uv * offsetRepeat.zw + offsetRepeat.xy;\n#endif",map_fragment:"#ifdef USE_MAP\n#ifdef GAMMA_INPUT\nvec4 texelColor = texture2D( map, vUv );\ntexelColor.xyz *= texelColor.xyz;\ngl_FragColor = gl_FragColor * texelColor;\n#else\ngl_FragColor = gl_FragColor * texture2D( map, vUv );\n#endif\n#endif",
lightmap_pars_fragment:"#ifdef USE_LIGHTMAP\nvarying vec2 vUv2;\nuniform sampler2D lightMap;\n#endif",lightmap_pars_vertex:"#ifdef USE_LIGHTMAP\nvarying vec2 vUv2;\n#endif",lightmap_fragment:"#ifdef USE_LIGHTMAP\ngl_FragColor = gl_FragColor * texture2D( lightMap, vUv2 );\n#endif",lightmap_vertex:"#ifdef USE_LIGHTMAP\nvUv2 = uv2;\n#endif",lights_lambert_pars_vertex:"uniform vec3 ambient;\nuniform vec3 diffuse;\nuniform vec3 ambientLightColor;\n#if MAX_DIR_LIGHTS > 0\nuniform vec3 directionalLightColor[ MAX_DIR_LIGHTS ];\nuniform vec3 directionalLightDirection[ MAX_DIR_LIGHTS ];\n#endif\n#if MAX_POINT_LIGHTS > 0\nuniform vec3 pointLightColor[ MAX_POINT_LIGHTS ];\nuniform vec3 pointLightPosition[ MAX_POINT_LIGHTS ];\nuniform float pointLightDistance[ MAX_POINT_LIGHTS ];\n#endif\n#ifdef WRAP_AROUND\nuniform vec3 wrapRGB;\n#endif",
lights_lambert_vertex:"vLightFront = vec3( 0.0 );\n#ifdef DOUBLE_SIDED\nvLightBack = vec3( 0.0 );\n#endif\ntransformedNormal = normalize( transformedNormal );\n#if MAX_DIR_LIGHTS > 0\nfor( int i = 0; i < MAX_DIR_LIGHTS; i ++ ) {\nvec4 lDirection = viewMatrix * vec4( directionalLightDirection[ i ], 0.0 );\nvec3 dirVector = normalize( lDirection.xyz );\nfloat dotProduct = dot( transformedNormal, dirVector );\nvec3 directionalLightWeighting = vec3( max( dotProduct, 0.0 ) );\n#ifdef DOUBLE_SIDED\nvec3 directionalLightWeightingBack = vec3( max( -dotProduct, 0.0 ) );\n#ifdef WRAP_AROUND\nvec3 directionalLightWeightingHalfBack = vec3( max( -0.5 * dotProduct + 0.5, 0.0 ) );\n#endif\n#endif\n#ifdef WRAP_AROUND\nvec3 directionalLightWeightingHalf = vec3( max( 0.5 * dotProduct + 0.5, 0.0 ) );\ndirectionalLightWeighting = mix( directionalLightWeighting, directionalLightWeightingHalf, wrapRGB );\n#ifdef DOUBLE_SIDED\ndirectionalLightWeightingBack = mix( directionalLightWeightingBack, directionalLightWeightingHalfBack, wrapRGB );\n#endif\n#endif\nvLightFront += directionalLightColor[ i ] * directionalLightWeighting;\n#ifdef DOUBLE_SIDED\nvLightBack += directionalLightColor[ i ] * directionalLightWeightingBack;\n#endif\n}\n#endif\n#if MAX_POINT_LIGHTS > 0\nfor( int i = 0; i < MAX_POINT_LIGHTS; i ++ ) {\nvec4 lPosition = viewMatrix * vec4( pointLightPosition[ i ], 1.0 );\nvec3 lVector = lPosition.xyz - mvPosition.xyz;\nfloat lDistance = 1.0;\nif ( pointLightDistance[ i ] > 0.0 )\nlDistance = 1.0 - min( ( length( lVector ) / pointLightDistance[ i ] ), 1.0 );\nlVector = normalize( lVector );\nfloat dotProduct = dot( transformedNormal, lVector );\nvec3 pointLightWeighting = vec3( max( dotProduct, 0.0 ) );\n#ifdef DOUBLE_SIDED\nvec3 pointLightWeightingBack = vec3( max( -dotProduct, 0.0 ) );\n#ifdef WRAP_AROUND\nvec3 pointLightWeightingHalfBack = vec3( max( -0.5 * dotProduct + 0.5, 0.0 ) );\n#endif\n#endif\n#ifdef WRAP_AROUND\nvec3 pointLightWeightingHalf = vec3( max( 0.5 * dotProduct + 0.5, 0.0 ) );\npointLightWeighting = mix( pointLightWeighting, pointLightWeightingHalf, wrapRGB );\n#ifdef DOUBLE_SIDED\npointLightWeightingBack = mix( pointLightWeightingBack, pointLightWeightingHalfBack, wrapRGB );\n#endif\n#endif\nvLightFront += pointLightColor[ i ] * pointLightWeighting * lDistance;\n#ifdef DOUBLE_SIDED\nvLightBack += pointLightColor[ i ] * pointLightWeightingBack * lDistance;\n#endif\n}\n#endif\nvLightFront = vLightFront * diffuse + ambient * ambientLightColor;\n#ifdef DOUBLE_SIDED\nvLightBack = vLightBack * diffuse + ambient * ambientLightColor;\n#endif",
lights_phong_pars_vertex:"#if MAX_POINT_LIGHTS > 0\n#ifndef PHONG_PER_PIXEL\nuniform vec3 pointLightPosition[ MAX_POINT_LIGHTS ];\nuniform float pointLightDistance[ MAX_POINT_LIGHTS ];\nvarying vec4 vPointLight[ MAX_POINT_LIGHTS ];\n#endif\n#endif",lights_phong_vertex:"#if MAX_POINT_LIGHTS > 0\n#ifndef PHONG_PER_PIXEL\nfor( int i = 0; i < MAX_POINT_LIGHTS; i ++ ) {\nvec4 lPosition = viewMatrix * vec4( pointLightPosition[ i ], 1.0 );\nvec3 lVector = lPosition.xyz - mvPosition.xyz;\nfloat lDistance = 1.0;\nif ( pointLightDistance[ i ] > 0.0 )\nlDistance = 1.0 - min( ( length( lVector ) / pointLightDistance[ i ] ), 1.0 );\nvPointLight[ i ] = vec4( lVector, lDistance );\n}\n#endif\n#endif",
lights_phong_pars_fragment:"uniform vec3 ambientLightColor;\n#if MAX_DIR_LIGHTS > 0\nuniform vec3 directionalLightColor[ MAX_DIR_LIGHTS ];\nuniform vec3 directionalLightDirection[ MAX_DIR_LIGHTS ];\n#endif\n#if MAX_POINT_LIGHTS > 0\nuniform vec3 pointLightColor[ MAX_POINT_LIGHTS ];\n#ifdef PHONG_PER_PIXEL\nuniform vec3 pointLightPosition[ MAX_POINT_LIGHTS ];\nuniform float pointLightDistance[ MAX_POINT_LIGHTS ];\n#else\nvarying vec4 vPointLight[ MAX_POINT_LIGHTS ];\n#endif\n#endif\n#ifdef WRAP_AROUND\nuniform vec3 wrapRGB;\n#endif\nvarying vec3 vViewPosition;\nvarying vec3 vNormal;",
lights_phong_fragment:"vec3 normal = normalize( vNormal );\nvec3 viewPosition = normalize( vViewPosition );\n#ifdef DOUBLE_SIDED\nnormal = normal * ( -1.0 + 2.0 * float( gl_FrontFacing ) );\n#endif\n#if MAX_POINT_LIGHTS > 0\nvec3 pointDiffuse  = vec3( 0.0 );\nvec3 pointSpecular = vec3( 0.0 );\nfor ( int i = 0; i < MAX_POINT_LIGHTS; i ++ ) {\n#ifdef PHONG_PER_PIXEL\nvec4 lPosition = viewMatrix * vec4( pointLightPosition[ i ], 1.0 );\nvec3 lVector = lPosition.xyz + vViewPosition.xyz;\nfloat lDistance = 1.0;\nif ( pointLightDistance[ i ] > 0.0 )\nlDistance = 1.0 - min( ( length( lVector ) / pointLightDistance[ i ] ), 1.0 );\nlVector = normalize( lVector );\n#else\nvec3 lVector = normalize( vPointLight[ i ].xyz );\nfloat lDistance = vPointLight[ i ].w;\n#endif\nfloat dotProduct = dot( normal, lVector );\n#ifdef WRAP_AROUND\nfloat pointDiffuseWeightFull = max( dotProduct, 0.0 );\nfloat pointDiffuseWeightHalf = max( 0.5 * dotProduct + 0.5, 0.0 );\nvec3 pointDiffuseWeight = mix( vec3 ( pointDiffuseWeightFull ), vec3( pointDiffuseWeightHalf ), wrapRGB );\n#else\nfloat pointDiffuseWeight = max( dotProduct, 0.0 );\n#endif\npointDiffuse  += diffuse * pointLightColor[ i ] * pointDiffuseWeight * lDistance;\nvec3 pointHalfVector = normalize( lVector + viewPosition );\nfloat pointDotNormalHalf = max( dot( normal, pointHalfVector ), 0.0 );\nfloat pointSpecularWeight = max( pow( pointDotNormalHalf, shininess ), 0.0 );\n#ifdef PHYSICALLY_BASED_SHADING\nvec3 schlick = specular + vec3( 1.0 - specular ) * pow( dot( lVector, pointHalfVector ), 5.0 );\npointSpecular += schlick * pointLightColor[ i ] * pointSpecularWeight * pointDiffuseWeight * lDistance;\n#else\npointSpecular += specular * pointLightColor[ i ] * pointSpecularWeight * pointDiffuseWeight * lDistance;\n#endif\n}\n#endif\n#if MAX_DIR_LIGHTS > 0\nvec3 dirDiffuse  = vec3( 0.0 );\nvec3 dirSpecular = vec3( 0.0 );\nfor( int i = 0; i < MAX_DIR_LIGHTS; i ++ ) {\nvec4 lDirection = viewMatrix * vec4( directionalLightDirection[ i ], 0.0 );\nvec3 dirVector = normalize( lDirection.xyz );\nfloat dotProduct = dot( normal, dirVector );\n#ifdef WRAP_AROUND\nfloat dirDiffuseWeightFull = max( dotProduct, 0.0 );\nfloat dirDiffuseWeightHalf = max( 0.5 * dotProduct + 0.5, 0.0 );\nvec3 dirDiffuseWeight = mix( vec3( dirDiffuseWeightFull ), vec3( dirDiffuseWeightHalf ), wrapRGB );\n#else\nfloat dirDiffuseWeight = max( dotProduct, 0.0 );\n#endif\ndirDiffuse  += diffuse * directionalLightColor[ i ] * dirDiffuseWeight;\nvec3 dirHalfVector = normalize( dirVector + viewPosition );\nfloat dirDotNormalHalf = max( dot( normal, dirHalfVector ), 0.0 );\nfloat dirSpecularWeight = max( pow( dirDotNormalHalf, shininess ), 0.0 );\n#ifdef PHYSICALLY_BASED_SHADING\nvec3 schlick = specular + vec3( 1.0 - specular ) * pow( dot( dirVector, dirHalfVector ), 5.0 );\ndirSpecular += schlick * directionalLightColor[ i ] * dirSpecularWeight * dirDiffuseWeight;\n#else\ndirSpecular += specular * directionalLightColor[ i ] * dirSpecularWeight * dirDiffuseWeight;\n#endif\n}\n#endif\nvec3 totalDiffuse = vec3( 0.0 );\nvec3 totalSpecular = vec3( 0.0 );\n#if MAX_DIR_LIGHTS > 0\ntotalDiffuse += dirDiffuse;\ntotalSpecular += dirSpecular;\n#endif\n#if MAX_POINT_LIGHTS > 0\ntotalDiffuse += pointDiffuse;\ntotalSpecular += pointSpecular;\n#endif\n#ifdef METAL\ngl_FragColor.xyz = gl_FragColor.xyz * ( totalDiffuse + ambientLightColor * ambient + totalSpecular );\n#else\ngl_FragColor.xyz = gl_FragColor.xyz * ( totalDiffuse + ambientLightColor * ambient ) + totalSpecular;\n#endif",
color_pars_fragment:"#ifdef USE_COLOR\nvarying vec3 vColor;\n#endif",color_fragment:"#ifdef USE_COLOR\ngl_FragColor = gl_FragColor * vec4( vColor, opacity );\n#endif",color_pars_vertex:"#ifdef USE_COLOR\nvarying vec3 vColor;\n#endif",color_vertex:"#ifdef USE_COLOR\n#ifdef GAMMA_INPUT\nvColor = color * color;\n#else\nvColor = color;\n#endif\n#endif",skinning_pars_vertex:"#ifdef USE_SKINNING\nuniform mat4 boneGlobalMatrices[ MAX_BONES ];\n#endif",skinning_vertex:"#ifdef USE_SKINNING\ngl_Position  = ( boneGlobalMatrices[ int( skinIndex.x ) ] * skinVertexA ) * skinWeight.x;\ngl_Position += ( boneGlobalMatrices[ int( skinIndex.y ) ] * skinVertexB ) * skinWeight.y;\ngl_Position  = projectionMatrix * modelViewMatrix * gl_Position;\n#endif",
morphtarget_pars_vertex:"#ifdef USE_MORPHTARGETS\n#ifndef USE_MORPHNORMALS\nuniform float morphTargetInfluences[ 8 ];\n#else\nuniform float morphTargetInfluences[ 4 ];\n#endif\n#endif",morphtarget_vertex:"#ifdef USE_MORPHTARGETS\nvec3 morphed = vec3( 0.0 );\nmorphed += ( morphTarget0 - position ) * morphTargetInfluences[ 0 ];\nmorphed += ( morphTarget1 - position ) * morphTargetInfluences[ 1 ];\nmorphed += ( morphTarget2 - position ) * morphTargetInfluences[ 2 ];\nmorphed += ( morphTarget3 - position ) * morphTargetInfluences[ 3 ];\n#ifndef USE_MORPHNORMALS\nmorphed += ( morphTarget4 - position ) * morphTargetInfluences[ 4 ];\nmorphed += ( morphTarget5 - position ) * morphTargetInfluences[ 5 ];\nmorphed += ( morphTarget6 - position ) * morphTargetInfluences[ 6 ];\nmorphed += ( morphTarget7 - position ) * morphTargetInfluences[ 7 ];\n#endif\nmorphed += position;\ngl_Position = projectionMatrix * modelViewMatrix * vec4( morphed, 1.0 );\n#endif",
default_vertex:"#ifndef USE_MORPHTARGETS\n#ifndef USE_SKINNING\ngl_Position = projectionMatrix * mvPosition;\n#endif\n#endif",morphnormal_vertex:"#ifdef USE_MORPHNORMALS\nvec3 morphedNormal = vec3( 0.0 );\nmorphedNormal +=  ( morphNormal0 - normal ) * morphTargetInfluences[ 0 ];\nmorphedNormal +=  ( morphNormal1 - normal ) * morphTargetInfluences[ 1 ];\nmorphedNormal +=  ( morphNormal2 - normal ) * morphTargetInfluences[ 2 ];\nmorphedNormal +=  ( morphNormal3 - normal ) * morphTargetInfluences[ 3 ];\nmorphedNormal += normal;\nvec3 transformedNormal = normalMatrix * morphedNormal;\n#else\nvec3 transformedNormal = normalMatrix * normal;\n#endif",
shadowmap_pars_fragment:"#ifdef USE_SHADOWMAP\nuniform sampler2D shadowMap[ MAX_SHADOWS ];\nuniform vec2 shadowMapSize[ MAX_SHADOWS ];\nuniform float shadowDarkness[ MAX_SHADOWS ];\nuniform float shadowBias[ MAX_SHADOWS ];\nvarying vec4 vShadowCoord[ MAX_SHADOWS ];\nfloat unpackDepth( const in vec4 rgba_depth ) {\nconst vec4 bit_shift = vec4( 1.0 / ( 256.0 * 256.0 * 256.0 ), 1.0 / ( 256.0 * 256.0 ), 1.0 / 256.0, 1.0 );\nfloat depth = dot( rgba_depth, bit_shift );\nreturn depth;\n}\n#endif",shadowmap_fragment:"#ifdef USE_SHADOWMAP\n#ifdef SHADOWMAP_DEBUG\nvec3 frustumColors[3];\nfrustumColors[0] = vec3( 1.0, 0.5, 0.0 );\nfrustumColors[1] = vec3( 0.0, 1.0, 0.8 );\nfrustumColors[2] = vec3( 0.0, 0.5, 1.0 );\n#endif\n#ifdef SHADOWMAP_CASCADE\nint inFrustumCount = 0;\n#endif\nfloat fDepth;\nvec3 shadowColor = vec3( 1.0 );\nfor( int i = 0; i < MAX_SHADOWS; i ++ ) {\nvec3 shadowCoord = vShadowCoord[ i ].xyz / vShadowCoord[ i ].w;\nbvec4 inFrustumVec = bvec4 ( shadowCoord.x >= 0.0, shadowCoord.x <= 1.0, shadowCoord.y >= 0.0, shadowCoord.y <= 1.0 );\nbool inFrustum = all( inFrustumVec );\n#ifdef SHADOWMAP_CASCADE\ninFrustumCount += int( inFrustum );\nbvec3 frustumTestVec = bvec3( inFrustum, inFrustumCount == 1, shadowCoord.z <= 1.0 );\n#else\nbvec2 frustumTestVec = bvec2( inFrustum, shadowCoord.z <= 1.0 );\n#endif\nbool frustumTest = all( frustumTestVec );\nif ( frustumTest ) {\nshadowCoord.z += shadowBias[ i ];\n#ifdef SHADOWMAP_SOFT\nfloat shadow = 0.0;\nconst float shadowDelta = 1.0 / 9.0;\nfloat xPixelOffset = 1.0 / shadowMapSize[ i ].x;\nfloat yPixelOffset = 1.0 / shadowMapSize[ i ].y;\nfloat dx0 = -1.25 * xPixelOffset;\nfloat dy0 = -1.25 * yPixelOffset;\nfloat dx1 = 1.25 * xPixelOffset;\nfloat dy1 = 1.25 * yPixelOffset;\nfDepth = unpackDepth( texture2D( shadowMap[ i ], shadowCoord.xy + vec2( dx0, dy0 ) ) );\nif ( fDepth < shadowCoord.z ) shadow += shadowDelta;\nfDepth = unpackDepth( texture2D( shadowMap[ i ], shadowCoord.xy + vec2( 0.0, dy0 ) ) );\nif ( fDepth < shadowCoord.z ) shadow += shadowDelta;\nfDepth = unpackDepth( texture2D( shadowMap[ i ], shadowCoord.xy + vec2( dx1, dy0 ) ) );\nif ( fDepth < shadowCoord.z ) shadow += shadowDelta;\nfDepth = unpackDepth( texture2D( shadowMap[ i ], shadowCoord.xy + vec2( dx0, 0.0 ) ) );\nif ( fDepth < shadowCoord.z ) shadow += shadowDelta;\nfDepth = unpackDepth( texture2D( shadowMap[ i ], shadowCoord.xy ) );\nif ( fDepth < shadowCoord.z ) shadow += shadowDelta;\nfDepth = unpackDepth( texture2D( shadowMap[ i ], shadowCoord.xy + vec2( dx1, 0.0 ) ) );\nif ( fDepth < shadowCoord.z ) shadow += shadowDelta;\nfDepth = unpackDepth( texture2D( shadowMap[ i ], shadowCoord.xy + vec2( dx0, dy1 ) ) );\nif ( fDepth < shadowCoord.z ) shadow += shadowDelta;\nfDepth = unpackDepth( texture2D( shadowMap[ i ], shadowCoord.xy + vec2( 0.0, dy1 ) ) );\nif ( fDepth < shadowCoord.z ) shadow += shadowDelta;\nfDepth = unpackDepth( texture2D( shadowMap[ i ], shadowCoord.xy + vec2( dx1, dy1 ) ) );\nif ( fDepth < shadowCoord.z ) shadow += shadowDelta;\nshadowColor = shadowColor * vec3( ( 1.0 - shadowDarkness[ i ] * shadow ) );\n#else\nvec4 rgbaDepth = texture2D( shadowMap[ i ], shadowCoord.xy );\nfloat fDepth = unpackDepth( rgbaDepth );\nif ( fDepth < shadowCoord.z )\nshadowColor = shadowColor * vec3( 1.0 - shadowDarkness[ i ] );\n#endif\n}\n#ifdef SHADOWMAP_DEBUG\n#ifdef SHADOWMAP_CASCADE\nif ( inFrustum && inFrustumCount == 1 ) gl_FragColor.xyz *= frustumColors[ i ];\n#else\nif ( inFrustum ) gl_FragColor.xyz *= frustumColors[ i ];\n#endif\n#endif\n}\n#ifdef GAMMA_OUTPUT\nshadowColor *= shadowColor;\n#endif\ngl_FragColor.xyz = gl_FragColor.xyz * shadowColor;\n#endif",
shadowmap_pars_vertex:"#ifdef USE_SHADOWMAP\nvarying vec4 vShadowCoord[ MAX_SHADOWS ];\nuniform mat4 shadowMatrix[ MAX_SHADOWS ];\n#endif",shadowmap_vertex:"#ifdef USE_SHADOWMAP\nfor( int i = 0; i < MAX_SHADOWS; i ++ ) {\n#ifdef USE_MORPHTARGETS\nvShadowCoord[ i ] = shadowMatrix[ i ] * objectMatrix * vec4( morphed, 1.0 );\n#else\nvShadowCoord[ i ] = shadowMatrix[ i ] * objectMatrix * vec4( position, 1.0 );\n#endif\n}\n#endif",alphatest_fragment:"#ifdef ALPHATEST\nif ( gl_FragColor.a < ALPHATEST ) discard;\n#endif",
linear_to_gamma_fragment:"#ifdef GAMMA_OUTPUT\ngl_FragColor.xyz = sqrt( gl_FragColor.xyz );\n#endif"};
THREE.UniformsUtils={merge:function(a){var b,c,d,f={};for(b=0;b<a.length;b++)for(c in d=this.clone(a[b]),d)f[c]=d[c];return f},clone:function(a){var b,c,d,f={};for(b in a)for(c in f[b]={},a[b])d=a[b][c],f[b][c]=d instanceof THREE.Color||d instanceof THREE.Vector2||d instanceof THREE.Vector3||d instanceof THREE.Vector4||d instanceof THREE.Matrix4||d instanceof THREE.Texture?d.clone():d instanceof Array?d.slice():d;return f}};
THREE.UniformsLib={common:{diffuse:{type:"c",value:new THREE.Color(15658734)},opacity:{type:"f",value:1},map:{type:"t",value:0,texture:null},offsetRepeat:{type:"v4",value:new THREE.Vector4(0,0,1,1)},lightMap:{type:"t",value:2,texture:null},envMap:{type:"t",value:1,texture:null},flipEnvMap:{type:"f",value:-1},useRefract:{type:"i",value:0},reflectivity:{type:"f",value:1},refractionRatio:{type:"f",value:0.98},combine:{type:"i",value:0},morphTargetInfluences:{type:"f",value:0}},fog:{fogDensity:{type:"f",
value:2.5E-4},fogNear:{type:"f",value:1},fogFar:{type:"f",value:2E3},fogColor:{type:"c",value:new THREE.Color(16777215)}},lights:{ambientLightColor:{type:"fv",value:[]},directionalLightDirection:{type:"fv",value:[]},directionalLightColor:{type:"fv",value:[]},pointLightColor:{type:"fv",value:[]},pointLightPosition:{type:"fv",value:[]},pointLightDistance:{type:"fv1",value:[]}},particle:{psColor:{type:"c",value:new THREE.Color(15658734)},opacity:{type:"f",value:1},size:{type:"f",value:1},scale:{type:"f",
value:1},map:{type:"t",value:0,texture:null},fogDensity:{type:"f",value:2.5E-4},fogNear:{type:"f",value:1},fogFar:{type:"f",value:2E3},fogColor:{type:"c",value:new THREE.Color(16777215)}},shadowmap:{shadowMap:{type:"tv",value:6,texture:[]},shadowMapSize:{type:"v2v",value:[]},shadowBias:{type:"fv1",value:[]},shadowDarkness:{type:"fv1",value:[]},shadowMatrix:{type:"m4v",value:[]}}};
THREE.ShaderLib={depth:{uniforms:{mNear:{type:"f",value:1},mFar:{type:"f",value:2E3},opacity:{type:"f",value:1}},vertexShader:"void main() {\ngl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n}",fragmentShader:"uniform float mNear;\nuniform float mFar;\nuniform float opacity;\nvoid main() {\nfloat depth = gl_FragCoord.z / gl_FragCoord.w;\nfloat color = 1.0 - smoothstep( mNear, mFar, depth );\ngl_FragColor = vec4( vec3( color ), opacity );\n}"},normal:{uniforms:{opacity:{type:"f",
value:1}},vertexShader:"varying vec3 vNormal;\nvoid main() {\nvec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );\nvNormal = normalize( normalMatrix * normal );\ngl_Position = projectionMatrix * mvPosition;\n}",fragmentShader:"uniform float opacity;\nvarying vec3 vNormal;\nvoid main() {\ngl_FragColor = vec4( 0.5 * normalize( vNormal ) + 0.5, opacity );\n}"},basic:{uniforms:THREE.UniformsUtils.merge([THREE.UniformsLib.common,THREE.UniformsLib.fog,THREE.UniformsLib.shadowmap]),vertexShader:[THREE.ShaderChunk.map_pars_vertex,
THREE.ShaderChunk.lightmap_pars_vertex,THREE.ShaderChunk.envmap_pars_vertex,THREE.ShaderChunk.color_pars_vertex,THREE.ShaderChunk.skinning_pars_vertex,THREE.ShaderChunk.morphtarget_pars_vertex,THREE.ShaderChunk.shadowmap_pars_vertex,"void main() {\nvec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );",THREE.ShaderChunk.map_vertex,THREE.ShaderChunk.lightmap_vertex,THREE.ShaderChunk.envmap_vertex,THREE.ShaderChunk.color_vertex,THREE.ShaderChunk.skinning_vertex,THREE.ShaderChunk.morphtarget_vertex,
THREE.ShaderChunk.default_vertex,THREE.ShaderChunk.shadowmap_vertex,"}"].join("\n"),fragmentShader:["uniform vec3 diffuse;\nuniform float opacity;",THREE.ShaderChunk.color_pars_fragment,THREE.ShaderChunk.map_pars_fragment,THREE.ShaderChunk.lightmap_pars_fragment,THREE.ShaderChunk.envmap_pars_fragment,THREE.ShaderChunk.fog_pars_fragment,THREE.ShaderChunk.shadowmap_pars_fragment,"void main() {\ngl_FragColor = vec4( diffuse, opacity );",THREE.ShaderChunk.map_fragment,THREE.ShaderChunk.alphatest_fragment,
THREE.ShaderChunk.lightmap_fragment,THREE.ShaderChunk.color_fragment,THREE.ShaderChunk.envmap_fragment,THREE.ShaderChunk.shadowmap_fragment,THREE.ShaderChunk.linear_to_gamma_fragment,THREE.ShaderChunk.fog_fragment,"}"].join("\n")},lambert:{uniforms:THREE.UniformsUtils.merge([THREE.UniformsLib.common,THREE.UniformsLib.fog,THREE.UniformsLib.lights,THREE.UniformsLib.shadowmap,{ambient:{type:"c",value:new THREE.Color(328965)},wrapRGB:{type:"v3",value:new THREE.Vector3(1,1,1)}}]),vertexShader:["varying vec3 vLightFront;\n#ifdef DOUBLE_SIDED\nvarying vec3 vLightBack;\n#endif",
THREE.ShaderChunk.map_pars_vertex,THREE.ShaderChunk.lightmap_pars_vertex,THREE.ShaderChunk.envmap_pars_vertex,THREE.ShaderChunk.lights_lambert_pars_vertex,THREE.ShaderChunk.color_pars_vertex,THREE.ShaderChunk.skinning_pars_vertex,THREE.ShaderChunk.morphtarget_pars_vertex,THREE.ShaderChunk.shadowmap_pars_vertex,"void main() {\nvec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );",THREE.ShaderChunk.map_vertex,THREE.ShaderChunk.lightmap_vertex,THREE.ShaderChunk.envmap_vertex,THREE.ShaderChunk.color_vertex,
THREE.ShaderChunk.morphnormal_vertex,THREE.ShaderChunk.lights_lambert_vertex,THREE.ShaderChunk.skinning_vertex,THREE.ShaderChunk.morphtarget_vertex,THREE.ShaderChunk.default_vertex,THREE.ShaderChunk.shadowmap_vertex,"}"].join("\n"),fragmentShader:["uniform float opacity;\nvarying vec3 vLightFront;\n#ifdef DOUBLE_SIDED\nvarying vec3 vLightBack;\n#endif",THREE.ShaderChunk.color_pars_fragment,THREE.ShaderChunk.map_pars_fragment,THREE.ShaderChunk.lightmap_pars_fragment,THREE.ShaderChunk.envmap_pars_fragment,
THREE.ShaderChunk.fog_pars_fragment,THREE.ShaderChunk.shadowmap_pars_fragment,"void main() {\ngl_FragColor = vec4( vec3 ( 1.0 ), opacity );",THREE.ShaderChunk.map_fragment,THREE.ShaderChunk.alphatest_fragment,"#ifdef DOUBLE_SIDED\nif ( gl_FrontFacing )\ngl_FragColor.xyz *= vLightFront;\nelse\ngl_FragColor.xyz *= vLightBack;\n#else\ngl_FragColor.xyz *= vLightFront;\n#endif",THREE.ShaderChunk.lightmap_fragment,THREE.ShaderChunk.color_fragment,THREE.ShaderChunk.envmap_fragment,THREE.ShaderChunk.shadowmap_fragment,
THREE.ShaderChunk.linear_to_gamma_fragment,THREE.ShaderChunk.fog_fragment,"}"].join("\n")},phong:{uniforms:THREE.UniformsUtils.merge([THREE.UniformsLib.common,THREE.UniformsLib.fog,THREE.UniformsLib.lights,THREE.UniformsLib.shadowmap,{ambient:{type:"c",value:new THREE.Color(328965)},specular:{type:"c",value:new THREE.Color(1118481)},shininess:{type:"f",value:30},wrapRGB:{type:"v3",value:new THREE.Vector3(1,1,1)}}]),vertexShader:["varying vec3 vViewPosition;\nvarying vec3 vNormal;",THREE.ShaderChunk.map_pars_vertex,
THREE.ShaderChunk.lightmap_pars_vertex,THREE.ShaderChunk.envmap_pars_vertex,THREE.ShaderChunk.lights_phong_pars_vertex,THREE.ShaderChunk.color_pars_vertex,THREE.ShaderChunk.skinning_pars_vertex,THREE.ShaderChunk.morphtarget_pars_vertex,THREE.ShaderChunk.shadowmap_pars_vertex,"void main() {\nvec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );",THREE.ShaderChunk.map_vertex,THREE.ShaderChunk.lightmap_vertex,THREE.ShaderChunk.envmap_vertex,THREE.ShaderChunk.color_vertex,"#ifndef USE_ENVMAP\nvec4 mPosition = objectMatrix * vec4( position, 1.0 );\n#endif\nvViewPosition = -mvPosition.xyz;",
THREE.ShaderChunk.morphnormal_vertex,"vNormal = transformedNormal;",THREE.ShaderChunk.lights_phong_vertex,THREE.ShaderChunk.skinning_vertex,THREE.ShaderChunk.morphtarget_vertex,THREE.ShaderChunk.default_vertex,THREE.ShaderChunk.shadowmap_vertex,"}"].join("\n"),fragmentShader:["uniform vec3 diffuse;\nuniform float opacity;\nuniform vec3 ambient;\nuniform vec3 specular;\nuniform float shininess;",THREE.ShaderChunk.color_pars_fragment,THREE.ShaderChunk.map_pars_fragment,THREE.ShaderChunk.lightmap_pars_fragment,
THREE.ShaderChunk.envmap_pars_fragment,THREE.ShaderChunk.fog_pars_fragment,THREE.ShaderChunk.lights_phong_pars_fragment,THREE.ShaderChunk.shadowmap_pars_fragment,"void main() {\ngl_FragColor = vec4( vec3 ( 1.0 ), opacity );",THREE.ShaderChunk.map_fragment,THREE.ShaderChunk.alphatest_fragment,THREE.ShaderChunk.lights_phong_fragment,THREE.ShaderChunk.lightmap_fragment,THREE.ShaderChunk.color_fragment,THREE.ShaderChunk.envmap_fragment,THREE.ShaderChunk.shadowmap_fragment,THREE.ShaderChunk.linear_to_gamma_fragment,
THREE.ShaderChunk.fog_fragment,"}"].join("\n")},particle_basic:{uniforms:THREE.UniformsUtils.merge([THREE.UniformsLib.particle,THREE.UniformsLib.shadowmap]),vertexShader:["uniform float size;\nuniform float scale;",THREE.ShaderChunk.color_pars_vertex,THREE.ShaderChunk.shadowmap_pars_vertex,"void main() {",THREE.ShaderChunk.color_vertex,"vec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );\n#ifdef USE_SIZEATTENUATION\ngl_PointSize = size * ( scale / length( mvPosition.xyz ) );\n#else\ngl_PointSize = size;\n#endif\ngl_Position = projectionMatrix * mvPosition;",
THREE.ShaderChunk.shadowmap_vertex,"}"].join("\n"),fragmentShader:["uniform vec3 psColor;\nuniform float opacity;",THREE.ShaderChunk.color_pars_fragment,THREE.ShaderChunk.map_particle_pars_fragment,THREE.ShaderChunk.fog_pars_fragment,THREE.ShaderChunk.shadowmap_pars_fragment,"void main() {\ngl_FragColor = vec4( psColor, opacity );",THREE.ShaderChunk.map_particle_fragment,THREE.ShaderChunk.alphatest_fragment,THREE.ShaderChunk.color_fragment,THREE.ShaderChunk.shadowmap_fragment,THREE.ShaderChunk.fog_fragment,
"}"].join("\n")},depthRGBA:{uniforms:{},vertexShader:[THREE.ShaderChunk.morphtarget_pars_vertex,"void main() {\nvec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );",THREE.ShaderChunk.morphtarget_vertex,THREE.ShaderChunk.default_vertex,"}"].join("\n"),fragmentShader:"vec4 pack_depth( const in float depth ) {\nconst vec4 bit_shift = vec4( 256.0 * 256.0 * 256.0, 256.0 * 256.0, 256.0, 1.0 );\nconst vec4 bit_mask  = vec4( 0.0, 1.0 / 256.0, 1.0 / 256.0, 1.0 / 256.0 );\nvec4 res = fract( depth * bit_shift );\nres -= res.xxyz * bit_mask;\nreturn res;\n}\nvoid main() {\ngl_FragData[ 0 ] = pack_depth( gl_FragCoord.z );\n}"}};
THREE.WebGLRenderer=function(a){function b(a,b){var c=a.vertices.length,d=b.material;if(d.attributes){if(a.__webglCustomAttributesList===void 0)a.__webglCustomAttributesList=[];for(var f in d.attributes){var e=d.attributes[f];if(!e.__webglInitialized||e.createUniqueBuffers){e.__webglInitialized=!0;var g=1;e.type==="v2"?g=2:e.type==="v3"?g=3:e.type==="v4"?g=4:e.type==="c"&&(g=3);e.size=g;e.array=new Float32Array(c*g);e.buffer=l.createBuffer();e.buffer.belongsToAttribute=f;e.needsUpdate=!0}a.__webglCustomAttributesList.push(e)}}}
function c(a,b){if(a.material&&!(a.material instanceof THREE.MeshFaceMaterial))return a.material;else if(b.materialIndex>=0)return a.geometry.materials[b.materialIndex]}function d(a){return a instanceof THREE.MeshBasicMaterial&&!a.envMap||a instanceof THREE.MeshDepthMaterial?!1:a&&a.shading!==void 0&&a.shading===THREE.SmoothShading?THREE.SmoothShading:THREE.FlatShading}function f(a){return a.map||a.lightMap||a instanceof THREE.ShaderMaterial?!0:!1}function g(a,b,c){var d,f,e,g,h=a.vertices;g=h.length;
var i=a.colors,j=i.length,k=a.__vertexArray,m=a.__colorArray,n=a.__sortArray,q=a.__dirtyVertices,o=a.__dirtyColors,s=a.__webglCustomAttributesList;if(c.sortParticles){za.multiplySelf(c.matrixWorld);for(d=0;d<g;d++)f=h[d].position,wa.copy(f),za.multiplyVector3(wa),n[d]=[wa.z,d];n.sort(function(a,b){return b[0]-a[0]});for(d=0;d<g;d++)f=h[n[d][1]].position,e=d*3,k[e]=f.x,k[e+1]=f.y,k[e+2]=f.z;for(d=0;d<j;d++)e=d*3,f=i[n[d][1]],m[e]=f.r,m[e+1]=f.g,m[e+2]=f.b;if(s)for(i=0,j=s.length;i<j;i++)if(h=s[i],
h.boundTo===void 0||h.boundTo==="vertices")if(e=0,f=h.value.length,h.size===1)for(d=0;d<f;d++)g=n[d][1],h.array[d]=h.value[g];else if(h.size===2)for(d=0;d<f;d++)g=n[d][1],g=h.value[g],h.array[e]=g.x,h.array[e+1]=g.y,e+=2;else if(h.size===3)if(h.type==="c")for(d=0;d<f;d++)g=n[d][1],g=h.value[g],h.array[e]=g.r,h.array[e+1]=g.g,h.array[e+2]=g.b,e+=3;else for(d=0;d<f;d++)g=n[d][1],g=h.value[g],h.array[e]=g.x,h.array[e+1]=g.y,h.array[e+2]=g.z,e+=3;else if(h.size===4)for(d=0;d<f;d++)g=n[d][1],g=h.value[g],
h.array[e]=g.x,h.array[e+1]=g.y,h.array[e+2]=g.z,h.array[e+3]=g.w,e+=4}else{if(q)for(d=0;d<g;d++)f=h[d].position,e=d*3,k[e]=f.x,k[e+1]=f.y,k[e+2]=f.z;if(o)for(d=0;d<j;d++)f=i[d],e=d*3,m[e]=f.r,m[e+1]=f.g,m[e+2]=f.b;if(s)for(i=0,j=s.length;i<j;i++)if(h=s[i],h.needsUpdate&&(h.boundTo===void 0||h.boundTo==="vertices"))if(f=h.value.length,e=0,h.size===1)for(d=0;d<f;d++)h.array[d]=h.value[d];else if(h.size===2)for(d=0;d<f;d++)g=h.value[d],h.array[e]=g.x,h.array[e+1]=g.y,e+=2;else if(h.size===3)if(h.type===
"c")for(d=0;d<f;d++)g=h.value[d],h.array[e]=g.r,h.array[e+1]=g.g,h.array[e+2]=g.b,e+=3;else for(d=0;d<f;d++)g=h.value[d],h.array[e]=g.x,h.array[e+1]=g.y,h.array[e+2]=g.z,e+=3;else if(h.size===4)for(d=0;d<f;d++)g=h.value[d],h.array[e]=g.x,h.array[e+1]=g.y,h.array[e+2]=g.z,h.array[e+3]=g.w,e+=4}if(q||c.sortParticles)l.bindBuffer(l.ARRAY_BUFFER,a.__webglVertexBuffer),l.bufferData(l.ARRAY_BUFFER,k,b);if(o||c.sortParticles)l.bindBuffer(l.ARRAY_BUFFER,a.__webglColorBuffer),l.bufferData(l.ARRAY_BUFFER,m,
b);if(s)for(i=0,j=s.length;i<j;i++)if(h=s[i],h.needsUpdate||c.sortParticles)l.bindBuffer(l.ARRAY_BUFFER,h.buffer),l.bufferData(l.ARRAY_BUFFER,h.array,b)}function e(a,b){return b.z-a.z}function h(a,b,c){if(a.length)for(var d=0,f=a.length;d<f;d++)M=E=null,T=W=Y=U=X=-1,a[d].render(b,c,Aa,ya),M=E=null,T=W=Y=U=X=-1}function i(a,b,c,d,f,e,g,h){var i,j,l,k;b?(j=a.length-1,k=b=-1):(j=0,b=a.length,k=1);for(var m=j;m!==b;m+=k)if(i=a[m],i.render){j=i.object;l=i.buffer;if(h)i=h;else{i=i[c];if(!i)continue;g&&
A.setBlending(i.blending);A.setDepthTest(i.depthTest);A.setDepthWrite(i.depthWrite);r(i.polygonOffset,i.polygonOffsetFactor,i.polygonOffsetUnits)}A.setObjectFaces(j);l instanceof THREE.BufferGeometry?A.renderBufferDirect(d,f,e,i,l,j):A.renderBuffer(d,f,e,i,l,j)}}function j(a,b,c,d,f,e,g){for(var h,i,j=0,l=a.length;j<l;j++)if(h=a[j],i=h.object,i.visible){if(g)h=g;else{h=h[b];if(!h)continue;e&&A.setBlending(h.blending);A.setDepthTest(h.depthTest);A.setDepthWrite(h.depthWrite);r(h.polygonOffset,h.polygonOffsetFactor,
h.polygonOffsetUnits)}A.renderImmediateObject(c,d,f,h,i)}}function k(a,b,c){a.push({buffer:b,object:c,opaque:null,transparent:null})}function q(a){for(var b in a.attributes)if(a.attributes[b].needsUpdate)return!0;return!1}function n(a){for(var b in a.attributes)a.attributes[b].needsUpdate=!1}function o(a,b){for(var c=a.length-1;c>=0;c--)a[c].object===b&&a.splice(c,1)}function s(a,b){for(var c=a.length-1;c>=0;c--)a[c]===b&&a.splice(c,1)}function m(a,b,c,d,f){d.program||A.initMaterial(d,b,c,f);if(d.morphTargets&&
!f.__webglMorphTargetInfluences){f.__webglMorphTargetInfluences=new Float32Array(A.maxMorphTargets);for(var e=0,g=A.maxMorphTargets;e<g;e++)f.__webglMorphTargetInfluences[e]=0}var h=!1,e=d.program,g=e.uniforms,i=d.uniforms;e!==E&&(l.useProgram(e),E=e,h=!0);if(d.id!==T)T=d.id,h=!0;if(h||a!==M)l.uniformMatrix4fv(g.projectionMatrix,!1,a._projectionMatrixArray),a!==M&&(M=a);if(h){if(c&&d.fog)if(i.fogColor.value=c.color,c instanceof THREE.Fog)i.fogNear.value=c.near,i.fogFar.value=c.far;else if(c instanceof
THREE.FogExp2)i.fogDensity.value=c.density;if(d instanceof THREE.MeshPhongMaterial||d instanceof THREE.MeshLambertMaterial||d.lights){var j,k=0,m=0,n=0,q,o,s,p=na,r=p.directional.colors,t=p.directional.positions,z=p.point.colors,u=p.point.positions,w=p.point.distances,D=0,G=0,W=s=0;for(c=0,h=b.length;c<h;c++)if(j=b[c],!j.onlyShadow)if(q=j.color,o=j.intensity,s=j.distance,j instanceof THREE.AmbientLight)A.gammaInput?(k+=q.r*q.r,m+=q.g*q.g,n+=q.b*q.b):(k+=q.r,m+=q.g,n+=q.b);else if(j instanceof THREE.DirectionalLight)s=
D*3,A.gammaInput?(r[s]=q.r*q.r*o*o,r[s+1]=q.g*q.g*o*o,r[s+2]=q.b*q.b*o*o):(r[s]=q.r*o,r[s+1]=q.g*o,r[s+2]=q.b*o),sa.copy(j.matrixWorld.getPosition()),sa.subSelf(j.target.matrixWorld.getPosition()),sa.normalize(),t[s]=sa.x,t[s+1]=sa.y,t[s+2]=sa.z,D+=1;else if(j instanceof THREE.PointLight||j instanceof THREE.SpotLight)W=G*3,A.gammaInput?(z[W]=q.r*q.r*o*o,z[W+1]=q.g*q.g*o*o,z[W+2]=q.b*q.b*o*o):(z[W]=q.r*o,z[W+1]=q.g*o,z[W+2]=q.b*o),j=j.matrixWorld.getPosition(),u[W]=j.x,u[W+1]=j.y,u[W+2]=j.z,w[G]=s,
G+=1;for(c=D*3,h=r.length;c<h;c++)r[c]=0;for(c=G*3,h=z.length;c<h;c++)z[c]=0;p.point.length=G;p.directional.length=D;p.ambient[0]=k;p.ambient[1]=m;p.ambient[2]=n;c=na;i.ambientLightColor.value=c.ambient;i.directionalLightColor.value=c.directional.colors;i.directionalLightDirection.value=c.directional.positions;i.pointLightColor.value=c.point.colors;i.pointLightPosition.value=c.point.positions;i.pointLightDistance.value=c.point.distances}if(d instanceof THREE.MeshBasicMaterial||d instanceof THREE.MeshLambertMaterial||
d instanceof THREE.MeshPhongMaterial)i.opacity.value=d.opacity,A.gammaInput?i.diffuse.value.copyGammaToLinear(d.color):i.diffuse.value=d.color,(i.map.texture=d.map)&&i.offsetRepeat.value.set(d.map.offset.x,d.map.offset.y,d.map.repeat.x,d.map.repeat.y),i.lightMap.texture=d.lightMap,i.envMap.texture=d.envMap,i.flipEnvMap.value=d.envMap instanceof THREE.WebGLRenderTargetCube?1:-1,i.reflectivity.value=d.reflectivity,i.refractionRatio.value=d.refractionRatio,i.combine.value=d.combine,i.useRefract.value=
d.envMap&&d.envMap.mapping instanceof THREE.CubeRefractionMapping;if(d instanceof THREE.LineBasicMaterial)i.diffuse.value=d.color,i.opacity.value=d.opacity;else if(d instanceof THREE.ParticleBasicMaterial)i.psColor.value=d.color,i.opacity.value=d.opacity,i.size.value=d.size,i.scale.value=F.height/2,i.map.texture=d.map;else if(d instanceof THREE.MeshPhongMaterial)i.shininess.value=d.shininess,A.gammaInput?(i.ambient.value.copyGammaToLinear(d.ambient),i.specular.value.copyGammaToLinear(d.specular)):
(i.ambient.value=d.ambient,i.specular.value=d.specular),d.wrapAround&&i.wrapRGB.value.copy(d.wrapRGB);else if(d instanceof THREE.MeshLambertMaterial)A.gammaInput?i.ambient.value.copyGammaToLinear(d.ambient):i.ambient.value=d.ambient,d.wrapAround&&i.wrapRGB.value.copy(d.wrapRGB);else if(d instanceof THREE.MeshDepthMaterial)i.mNear.value=a.near,i.mFar.value=a.far,i.opacity.value=d.opacity;else if(d instanceof THREE.MeshNormalMaterial)i.opacity.value=d.opacity;if(f.receiveShadow&&!d._shadowPass&&i.shadowMatrix){h=
c=0;for(k=b.length;h<k;h++)if(m=b[h],m.castShadow&&(m instanceof THREE.SpotLight||m instanceof THREE.DirectionalLight&&!m.shadowCascade))i.shadowMap.texture[c]=m.shadowMap,i.shadowMapSize.value[c]=m.shadowMapSize,i.shadowMatrix.value[c]=m.shadowMatrix,i.shadowDarkness.value[c]=m.shadowDarkness,i.shadowBias.value[c]=m.shadowBias,c++}b=d.uniformsList;for(i=0,c=b.length;i<c;i++)if(m=e.uniforms[b[i][1]])if(h=b[i][0],n=h.type,k=h.value,n==="i")l.uniform1i(m,k);else if(n==="f")l.uniform1f(m,k);else if(n===
"v2")l.uniform2f(m,k.x,k.y);else if(n==="v3")l.uniform3f(m,k.x,k.y,k.z);else if(n==="v4")l.uniform4f(m,k.x,k.y,k.z,k.w);else if(n==="c")l.uniform3f(m,k.r,k.g,k.b);else if(n==="fv1")l.uniform1fv(m,k);else if(n==="fv")l.uniform3fv(m,k);else if(n==="v2v"){if(!h._array)h._array=new Float32Array(2*k.length);for(n=0,p=k.length;n<p;n++)r=n*2,h._array[r]=k[n].x,h._array[r+1]=k[n].y;l.uniform2fv(m,h._array)}else if(n==="v3v"){if(!h._array)h._array=new Float32Array(3*k.length);for(n=0,p=k.length;n<p;n++)r=
n*3,h._array[r]=k[n].x,h._array[r+1]=k[n].y,h._array[r+2]=k[n].z;l.uniform3fv(m,h._array)}else if(n=="v4v"){if(!h._array)h._array=new Float32Array(4*k.length);for(n=0,p=k.length;n<p;n++)r=n*4,h._array[r]=k[n].x,h._array[r+1]=k[n].y,h._array[r+2]=k[n].z,h._array[r+3]=k[n].w;l.uniform4fv(m,h._array)}else if(n==="m4"){if(!h._array)h._array=new Float32Array(16);k.flattenToArray(h._array);l.uniformMatrix4fv(m,!1,h._array)}else if(n==="m4v"){if(!h._array)h._array=new Float32Array(16*k.length);for(n=0,p=
k.length;n<p;n++)k[n].flattenToArrayOffset(h._array,n*16);l.uniformMatrix4fv(m,!1,h._array)}else if(n==="t"){if(l.uniform1i(m,k),m=h.texture)if(m.image instanceof Array&&m.image.length===6){if(h=m,h.image.length===6)if(h.needsUpdate){if(!h.image.__webglTextureCube)h.image.__webglTextureCube=l.createTexture();l.activeTexture(l.TEXTURE0+k);l.bindTexture(l.TEXTURE_CUBE_MAP,h.image.__webglTextureCube);k=[];for(m=0;m<6;m++){n=k;p=m;if(A.autoScaleCubemaps){if(r=h.image[m],z=ta,!(r.width<=z&&r.height<=z))u=
Math.max(r.width,r.height),t=Math.floor(r.width*z/u),z=Math.floor(r.height*z/u),u=document.createElement("canvas"),u.width=t,u.height=z,u.getContext("2d").drawImage(r,0,0,r.width,r.height,0,0,t,z),r=u}else r=h.image[m];n[p]=r}m=k[0];n=(m.width&m.width-1)===0&&(m.height&m.height-1)===0;p=y(h.format);r=y(h.type);v(l.TEXTURE_CUBE_MAP,h,n);for(m=0;m<6;m++)l.texImage2D(l.TEXTURE_CUBE_MAP_POSITIVE_X+m,0,p,p,r,k[m]);h.generateMipmaps&&n&&l.generateMipmap(l.TEXTURE_CUBE_MAP);h.needsUpdate=!1;if(h.onUpdate)h.onUpdate()}else l.activeTexture(l.TEXTURE0+
k),l.bindTexture(l.TEXTURE_CUBE_MAP,h.image.__webglTextureCube)}else m instanceof THREE.WebGLRenderTargetCube?(h=m,l.activeTexture(l.TEXTURE0+k),l.bindTexture(l.TEXTURE_CUBE_MAP,h.__webglTexture)):A.setTexture(m,k)}else if(n==="tv"){if(!h._array){h._array=[];for(n=0,p=h.texture.length;n<p;n++)h._array[n]=k+n}l.uniform1iv(m,h._array);for(n=0,p=h.texture.length;n<p;n++)(m=h.texture[n])&&A.setTexture(m,h._array[n])}if((d instanceof THREE.ShaderMaterial||d instanceof THREE.MeshPhongMaterial||d.envMap)&&
g.cameraPosition!==null)b=a.matrixWorld.getPosition(),l.uniform3f(g.cameraPosition,b.x,b.y,b.z);(d instanceof THREE.MeshPhongMaterial||d instanceof THREE.MeshLambertMaterial||d instanceof THREE.ShaderMaterial||d.skinning)&&g.viewMatrix!==null&&l.uniformMatrix4fv(g.viewMatrix,!1,a._viewMatrixArray);d.skinning&&l.uniformMatrix4fv(g.boneGlobalMatrices,!1,f.boneMatrices)}l.uniformMatrix4fv(g.modelViewMatrix,!1,f._modelViewMatrixArray);g.normalMatrix&&l.uniformMatrix3fv(g.normalMatrix,!1,f._normalMatrixArray);
(d instanceof THREE.ShaderMaterial||d.envMap||d.skinning||f.receiveShadow)&&g.objectMatrix!==null&&l.uniformMatrix4fv(g.objectMatrix,!1,f._objectMatrixArray);return e}function p(a,b){a._modelViewMatrix.multiplyToArray(b.matrixWorldInverse,a.matrixWorld,a._modelViewMatrixArray);var c=THREE.Matrix4.makeInvert3x3(a._modelViewMatrix);c&&c.transposeIntoArray(a._normalMatrixArray)}function r(a,b,c){$!==a&&(a?l.enable(l.POLYGON_OFFSET_FILL):l.disable(l.POLYGON_OFFSET_FILL),$=a);if(a&&(oa!==b||ga!==c))l.polygonOffset(b,
c),oa=b,ga=c}function t(a,b){var c;a==="fragment"?c=l.createShader(l.FRAGMENT_SHADER):a==="vertex"&&(c=l.createShader(l.VERTEX_SHADER));l.shaderSource(c,b);l.compileShader(c);return!l.getShaderParameter(c,l.COMPILE_STATUS)?(console.error(l.getShaderInfoLog(c)),console.error(b),null):c}function v(a,b,c){c?(l.texParameteri(a,l.TEXTURE_WRAP_S,y(b.wrapS)),l.texParameteri(a,l.TEXTURE_WRAP_T,y(b.wrapT)),l.texParameteri(a,l.TEXTURE_MAG_FILTER,y(b.magFilter)),l.texParameteri(a,l.TEXTURE_MIN_FILTER,y(b.minFilter))):
(l.texParameteri(a,l.TEXTURE_WRAP_S,l.CLAMP_TO_EDGE),l.texParameteri(a,l.TEXTURE_WRAP_T,l.CLAMP_TO_EDGE),l.texParameteri(a,l.TEXTURE_MAG_FILTER,w(b.magFilter)),l.texParameteri(a,l.TEXTURE_MIN_FILTER,w(b.minFilter)))}function u(a,b){l.bindRenderbuffer(l.RENDERBUFFER,a);b.depthBuffer&&!b.stencilBuffer?(l.renderbufferStorage(l.RENDERBUFFER,l.DEPTH_COMPONENT16,b.width,b.height),l.framebufferRenderbuffer(l.FRAMEBUFFER,l.DEPTH_ATTACHMENT,l.RENDERBUFFER,a)):b.depthBuffer&&b.stencilBuffer?(l.renderbufferStorage(l.RENDERBUFFER,
l.DEPTH_STENCIL,b.width,b.height),l.framebufferRenderbuffer(l.FRAMEBUFFER,l.DEPTH_STENCIL_ATTACHMENT,l.RENDERBUFFER,a)):l.renderbufferStorage(l.RENDERBUFFER,l.RGBA4,b.width,b.height)}function w(a){switch(a){case THREE.NearestFilter:case THREE.NearestMipMapNearestFilter:case THREE.NearestMipMapLinearFilter:return l.NEAREST;default:return l.LINEAR}}function y(a){switch(a){case THREE.RepeatWrapping:return l.REPEAT;case THREE.ClampToEdgeWrapping:return l.CLAMP_TO_EDGE;case THREE.MirroredRepeatWrapping:return l.MIRRORED_REPEAT;
case THREE.NearestFilter:return l.NEAREST;case THREE.NearestMipMapNearestFilter:return l.NEAREST_MIPMAP_NEAREST;case THREE.NearestMipMapLinearFilter:return l.NEAREST_MIPMAP_LINEAR;case THREE.LinearFilter:return l.LINEAR;case THREE.LinearMipMapNearestFilter:return l.LINEAR_MIPMAP_NEAREST;case THREE.LinearMipMapLinearFilter:return l.LINEAR_MIPMAP_LINEAR;case THREE.ByteType:return l.BYTE;case THREE.UnsignedByteType:return l.UNSIGNED_BYTE;case THREE.ShortType:return l.SHORT;case THREE.UnsignedShortType:return l.UNSIGNED_SHORT;
case THREE.IntType:return l.INT;case THREE.UnsignedIntType:return l.UNSIGNED_INT;case THREE.FloatType:return l.FLOAT;case THREE.AlphaFormat:return l.ALPHA;case THREE.RGBFormat:return l.RGB;case THREE.RGBAFormat:return l.RGBA;case THREE.LuminanceFormat:return l.LUMINANCE;case THREE.LuminanceAlphaFormat:return l.LUMINANCE_ALPHA}return 0}var a=a||{},F=a.canvas!==void 0?a.canvas:document.createElement("canvas"),D=a.precision!==void 0?a.precision:"mediump",G=a.alpha!==void 0?a.alpha:!0,I=a.premultipliedAlpha!==
void 0?a.premultipliedAlpha:!0,K=a.antialias!==void 0?a.antialias:!1,Q=a.stencil!==void 0?a.stencil:!0,N=a.preserveDrawingBuffer!==void 0?a.preserveDrawingBuffer:!1,B=a.clearColor!==void 0?new THREE.Color(a.clearColor):new THREE.Color(0),O=a.clearAlpha!==void 0?a.clearAlpha:0,S=a.maxLights!==void 0?a.maxLights:4;this.domElement=F;this.context=null;this.autoUpdateScene=this.autoUpdateObjects=this.sortObjects=this.autoClearStencil=this.autoClearDepth=this.autoClearColor=this.autoClear=!0;this.shadowMapEnabled=
this.physicallyBasedShading=this.gammaOutput=this.gammaInput=!1;this.shadowMapCullFrontFaces=this.shadowMapSoft=this.shadowMapAutoUpdate=!0;this.shadowMapCascade=this.shadowMapDebug=!1;this.maxMorphTargets=8;this.maxMorphNormals=4;this.autoScaleCubemaps=!0;this.renderPluginsPre=[];this.renderPluginsPost=[];this.info={memory:{programs:0,geometries:0,textures:0},render:{calls:0,vertices:0,faces:0,points:0}};var A=this,l,V=[],E=null,z=null,T=-1,W=null,M=null,ma=0,aa=null,Z=null,X=null,U=null,Y=null,
$=null,oa=null,ga=null,ra=null,qa=0,ha=0,ka=0,Ea=0,Aa=0,ya=0,xa=new THREE.Frustum,za=new THREE.Matrix4,wa=new THREE.Vector4,sa=new THREE.Vector3,na={ambient:[0,0,0],directional:{length:0,colors:[],positions:[]},point:{length:0,colors:[],positions:[],distances:[]}};l=function(){var a;try{if(!(a=F.getContext("experimental-webgl",{alpha:G,premultipliedAlpha:I,antialias:K,stencil:Q,preserveDrawingBuffer:N})))throw"Error creating WebGL context.";console.log(navigator.userAgent+" | "+a.getParameter(a.VERSION)+
" | "+a.getParameter(a.VENDOR)+" | "+a.getParameter(a.RENDERER)+" | "+a.getParameter(a.SHADING_LANGUAGE_VERSION))}catch(b){console.error(b)}return a}();l.clearColor(0,0,0,1);l.clearDepth(1);l.clearStencil(0);l.enable(l.DEPTH_TEST);l.depthFunc(l.LEQUAL);l.frontFace(l.CCW);l.cullFace(l.BACK);l.enable(l.CULL_FACE);l.enable(l.BLEND);l.blendEquation(l.FUNC_ADD);l.blendFunc(l.SRC_ALPHA,l.ONE_MINUS_SRC_ALPHA);l.clearColor(B.r,B.g,B.b,O);this.context=l;var ja=l.getParameter(l.MAX_VERTEX_TEXTURE_IMAGE_UNITS);
l.getParameter(l.MAX_TEXTURE_SIZE);var ta=l.getParameter(l.MAX_CUBE_MAP_TEXTURE_SIZE);this.getContext=function(){return l};this.supportsVertexTextures=function(){return ja>0};this.setSize=function(a,b){F.width=a;F.height=b;this.setViewport(0,0,F.width,F.height)};this.setViewport=function(a,b,c,d){qa=a;ha=b;ka=c;Ea=d;l.viewport(qa,ha,ka,Ea)};this.setScissor=function(a,b,c,d){l.scissor(a,b,c,d)};this.enableScissorTest=function(a){a?l.enable(l.SCISSOR_TEST):l.disable(l.SCISSOR_TEST)};this.setClearColorHex=
function(a,b){B.setHex(a);O=b;l.clearColor(B.r,B.g,B.b,O)};this.setClearColor=function(a,b){B.copy(a);O=b;l.clearColor(B.r,B.g,B.b,O)};this.getClearColor=function(){return B};this.getClearAlpha=function(){return O};this.clear=function(a,b,c){var d=0;if(a===void 0||a)d|=l.COLOR_BUFFER_BIT;if(b===void 0||b)d|=l.DEPTH_BUFFER_BIT;if(c===void 0||c)d|=l.STENCIL_BUFFER_BIT;l.clear(d)};this.clearTarget=function(a,b,c,d){this.setRenderTarget(a);this.clear(b,c,d)};this.addPostPlugin=function(a){a.init(this);
this.renderPluginsPost.push(a)};this.addPrePlugin=function(a){a.init(this);this.renderPluginsPre.push(a)};this.deallocateObject=function(a){if(a.__webglInit)if(a.__webglInit=!1,delete a._modelViewMatrix,delete a._normalMatrixArray,delete a._modelViewMatrixArray,delete a._objectMatrixArray,a instanceof THREE.Mesh)for(var b in a.geometry.geometryGroups){var c=a.geometry.geometryGroups[b];l.deleteBuffer(c.__webglVertexBuffer);l.deleteBuffer(c.__webglNormalBuffer);l.deleteBuffer(c.__webglTangentBuffer);
l.deleteBuffer(c.__webglColorBuffer);l.deleteBuffer(c.__webglUVBuffer);l.deleteBuffer(c.__webglUV2Buffer);l.deleteBuffer(c.__webglSkinVertexABuffer);l.deleteBuffer(c.__webglSkinVertexBBuffer);l.deleteBuffer(c.__webglSkinIndicesBuffer);l.deleteBuffer(c.__webglSkinWeightsBuffer);l.deleteBuffer(c.__webglFaceBuffer);l.deleteBuffer(c.__webglLineBuffer);var d=void 0,f=void 0;if(c.numMorphTargets)for(d=0,f=c.numMorphTargets;d<f;d++)l.deleteBuffer(c.__webglMorphTargetsBuffers[d]);if(c.numMorphNormals)for(d=
0,f=c.numMorphNormals;d<f;d++)l.deleteBuffer(c.__webglMorphNormalsBuffers[d]);if(c.__webglCustomAttributesList)for(d in d=void 0,c.__webglCustomAttributesList)l.deleteBuffer(c.__webglCustomAttributesList[d].buffer);A.info.memory.geometries--}else if(a instanceof THREE.Ribbon)a=a.geometry,l.deleteBuffer(a.__webglVertexBuffer),l.deleteBuffer(a.__webglColorBuffer),A.info.memory.geometries--;else if(a instanceof THREE.Line)a=a.geometry,l.deleteBuffer(a.__webglVertexBuffer),l.deleteBuffer(a.__webglColorBuffer),
A.info.memory.geometries--;else if(a instanceof THREE.ParticleSystem)a=a.geometry,l.deleteBuffer(a.__webglVertexBuffer),l.deleteBuffer(a.__webglColorBuffer),A.info.memory.geometries--};this.deallocateTexture=function(a){if(a.__webglInit)a.__webglInit=!1,l.deleteTexture(a.__webglTexture),A.info.memory.textures--};this.updateShadowMap=function(a,b){E=null;T=W=Y=U=X=-1;this.shadowMapPlugin.update(a,b)};this.renderBufferImmediate=function(a,b,c){if(!a.__webglVertexBuffer)a.__webglVertexBuffer=l.createBuffer();
if(!a.__webglNormalBuffer)a.__webglNormalBuffer=l.createBuffer();a.hasPos&&(l.bindBuffer(l.ARRAY_BUFFER,a.__webglVertexBuffer),l.bufferData(l.ARRAY_BUFFER,a.positionArray,l.DYNAMIC_DRAW),l.enableVertexAttribArray(b.attributes.position),l.vertexAttribPointer(b.attributes.position,3,l.FLOAT,!1,0,0));if(a.hasNormal){l.bindBuffer(l.ARRAY_BUFFER,a.__webglNormalBuffer);if(c===THREE.FlatShading){var d,f,e,g,h,i,j,k,m,n,q=a.count*3;for(n=0;n<q;n+=9)c=a.normalArray,d=c[n],f=c[n+1],e=c[n+2],g=c[n+3],i=c[n+
4],k=c[n+5],h=c[n+6],j=c[n+7],m=c[n+8],d=(d+g+h)/3,f=(f+i+j)/3,e=(e+k+m)/3,c[n]=d,c[n+1]=f,c[n+2]=e,c[n+3]=d,c[n+4]=f,c[n+5]=e,c[n+6]=d,c[n+7]=f,c[n+8]=e}l.bufferData(l.ARRAY_BUFFER,a.normalArray,l.DYNAMIC_DRAW);l.enableVertexAttribArray(b.attributes.normal);l.vertexAttribPointer(b.attributes.normal,3,l.FLOAT,!1,0,0)}l.drawArrays(l.TRIANGLES,0,a.count);a.count=0};this.renderBufferDirect=function(a,b,c,d,f,e){if(d.opacity!==0&&(c=m(a,b,c,d,e),a=c.attributes,b=!1,d=f.id*16777215+c.id*2+(d.wireframe?
1:0),d!==W&&(W=d,b=!0),e instanceof THREE.Mesh)){e=f.offsets;d=0;for(c=e.length;d<c;++d)b&&(l.bindBuffer(l.ARRAY_BUFFER,f.vertexPositionBuffer),l.vertexAttribPointer(a.position,f.vertexPositionBuffer.itemSize,l.FLOAT,!1,0,e[d].index*12),a.normal>=0&&f.vertexNormalBuffer&&(l.bindBuffer(l.ARRAY_BUFFER,f.vertexNormalBuffer),l.vertexAttribPointer(a.normal,f.vertexNormalBuffer.itemSize,l.FLOAT,!1,0,e[d].index*12)),a.uv>=0&&f.vertexUvBuffer&&(f.vertexUvBuffer?(l.bindBuffer(l.ARRAY_BUFFER,f.vertexUvBuffer),
l.vertexAttribPointer(a.uv,f.vertexUvBuffer.itemSize,l.FLOAT,!1,0,e[d].index*8),l.enableVertexAttribArray(a.uv)):l.disableVertexAttribArray(a.uv)),a.color>=0&&f.vertexColorBuffer&&(l.bindBuffer(l.ARRAY_BUFFER,f.vertexColorBuffer),l.vertexAttribPointer(a.color,f.vertexColorBuffer.itemSize,l.FLOAT,!1,0,e[d].index*16)),l.bindBuffer(l.ELEMENT_ARRAY_BUFFER,f.vertexIndexBuffer)),l.drawElements(l.TRIANGLES,e[d].count,l.UNSIGNED_SHORT,e[d].start*2),A.info.render.calls++,A.info.render.vertices+=e[d].count,
A.info.render.faces+=e[d].count/3}};this.renderBuffer=function(a,b,c,d,f,e){if(d.opacity!==0){var g,h,c=m(a,b,c,d,e),b=c.attributes,a=!1,c=f.id*16777215+c.id*2+(d.wireframe?1:0);c!==W&&(W=c,a=!0);if(!d.morphTargets&&b.position>=0)a&&(l.bindBuffer(l.ARRAY_BUFFER,f.__webglVertexBuffer),l.vertexAttribPointer(b.position,3,l.FLOAT,!1,0,0));else if(e.morphTargetBase){c=d.program.attributes;e.morphTargetBase!==-1?(l.bindBuffer(l.ARRAY_BUFFER,f.__webglMorphTargetsBuffers[e.morphTargetBase]),l.vertexAttribPointer(c.position,
3,l.FLOAT,!1,0,0)):c.position>=0&&(l.bindBuffer(l.ARRAY_BUFFER,f.__webglVertexBuffer),l.vertexAttribPointer(c.position,3,l.FLOAT,!1,0,0));if(e.morphTargetForcedOrder.length){g=0;var i=e.morphTargetForcedOrder;for(h=e.morphTargetInfluences;g<d.numSupportedMorphTargets&&g<i.length;)l.bindBuffer(l.ARRAY_BUFFER,f.__webglMorphTargetsBuffers[i[g]]),l.vertexAttribPointer(c["morphTarget"+g],3,l.FLOAT,!1,0,0),d.morphNormals&&(l.bindBuffer(l.ARRAY_BUFFER,f.__webglMorphNormalsBuffers[i[g]]),l.vertexAttribPointer(c["morphNormal"+
g],3,l.FLOAT,!1,0,0)),e.__webglMorphTargetInfluences[g]=h[i[g]],g++}else{var i=[],j=-1,k=0;h=e.morphTargetInfluences;var n,q=h.length;g=0;for(e.morphTargetBase!==-1&&(i[e.morphTargetBase]=!0);g<d.numSupportedMorphTargets;){for(n=0;n<q;n++)!i[n]&&h[n]>j&&(k=n,j=h[k]);l.bindBuffer(l.ARRAY_BUFFER,f.__webglMorphTargetsBuffers[k]);l.vertexAttribPointer(c["morphTarget"+g],3,l.FLOAT,!1,0,0);d.morphNormals&&(l.bindBuffer(l.ARRAY_BUFFER,f.__webglMorphNormalsBuffers[k]),l.vertexAttribPointer(c["morphNormal"+
g],3,l.FLOAT,!1,0,0));e.__webglMorphTargetInfluences[g]=j;i[k]=1;j=-1;g++}}d.program.uniforms.morphTargetInfluences!==null&&l.uniform1fv(d.program.uniforms.morphTargetInfluences,e.__webglMorphTargetInfluences)}if(a){if(f.__webglCustomAttributesList)for(g=0,h=f.__webglCustomAttributesList.length;g<h;g++)c=f.__webglCustomAttributesList[g],b[c.buffer.belongsToAttribute]>=0&&(l.bindBuffer(l.ARRAY_BUFFER,c.buffer),l.vertexAttribPointer(b[c.buffer.belongsToAttribute],c.size,l.FLOAT,!1,0,0));b.color>=0&&
(l.bindBuffer(l.ARRAY_BUFFER,f.__webglColorBuffer),l.vertexAttribPointer(b.color,3,l.FLOAT,!1,0,0));b.normal>=0&&(l.bindBuffer(l.ARRAY_BUFFER,f.__webglNormalBuffer),l.vertexAttribPointer(b.normal,3,l.FLOAT,!1,0,0));b.tangent>=0&&(l.bindBuffer(l.ARRAY_BUFFER,f.__webglTangentBuffer),l.vertexAttribPointer(b.tangent,4,l.FLOAT,!1,0,0));b.uv>=0&&(f.__webglUVBuffer?(l.bindBuffer(l.ARRAY_BUFFER,f.__webglUVBuffer),l.vertexAttribPointer(b.uv,2,l.FLOAT,!1,0,0),l.enableVertexAttribArray(b.uv)):l.disableVertexAttribArray(b.uv));
b.uv2>=0&&(f.__webglUV2Buffer?(l.bindBuffer(l.ARRAY_BUFFER,f.__webglUV2Buffer),l.vertexAttribPointer(b.uv2,2,l.FLOAT,!1,0,0),l.enableVertexAttribArray(b.uv2)):l.disableVertexAttribArray(b.uv2));d.skinning&&b.skinVertexA>=0&&b.skinVertexB>=0&&b.skinIndex>=0&&b.skinWeight>=0&&(l.bindBuffer(l.ARRAY_BUFFER,f.__webglSkinVertexABuffer),l.vertexAttribPointer(b.skinVertexA,4,l.FLOAT,!1,0,0),l.bindBuffer(l.ARRAY_BUFFER,f.__webglSkinVertexBBuffer),l.vertexAttribPointer(b.skinVertexB,4,l.FLOAT,!1,0,0),l.bindBuffer(l.ARRAY_BUFFER,
f.__webglSkinIndicesBuffer),l.vertexAttribPointer(b.skinIndex,4,l.FLOAT,!1,0,0),l.bindBuffer(l.ARRAY_BUFFER,f.__webglSkinWeightsBuffer),l.vertexAttribPointer(b.skinWeight,4,l.FLOAT,!1,0,0))}e instanceof THREE.Mesh?(d.wireframe?(d=d.wireframeLinewidth,d!==ra&&(l.lineWidth(d),ra=d),a&&l.bindBuffer(l.ELEMENT_ARRAY_BUFFER,f.__webglLineBuffer),l.drawElements(l.LINES,f.__webglLineCount,l.UNSIGNED_SHORT,0)):(a&&l.bindBuffer(l.ELEMENT_ARRAY_BUFFER,f.__webglFaceBuffer),l.drawElements(l.TRIANGLES,f.__webglFaceCount,
l.UNSIGNED_SHORT,0)),A.info.render.calls++,A.info.render.vertices+=f.__webglFaceCount,A.info.render.faces+=f.__webglFaceCount/3):e instanceof THREE.Line?(e=e.type===THREE.LineStrip?l.LINE_STRIP:l.LINES,d=d.linewidth,d!==ra&&(l.lineWidth(d),ra=d),l.drawArrays(e,0,f.__webglLineCount),A.info.render.calls++):e instanceof THREE.ParticleSystem?(l.drawArrays(l.POINTS,0,f.__webglParticleCount),A.info.render.calls++,A.info.render.points+=f.__webglParticleCount):e instanceof THREE.Ribbon&&(l.drawArrays(l.TRIANGLE_STRIP,
0,f.__webglVertexCount),A.info.render.calls++)}};this.render=function(a,b,c,d){var f,g,k,n,m=a.__lights,q=a.fog;T=-1;this.autoUpdateObjects&&this.initWebGLObjects(a);b.parent===void 0&&(console.warn("DEPRECATED: Camera hasn't been added to a Scene. Adding it..."),a.add(b));this.autoUpdateScene&&a.updateMatrixWorld();h(this.renderPluginsPre,a,b);A.info.render.calls=0;A.info.render.vertices=0;A.info.render.faces=0;A.info.render.points=0;b.matrixWorldInverse.getInverse(b.matrixWorld);if(!b._viewMatrixArray)b._viewMatrixArray=
new Float32Array(16);b.matrixWorldInverse.flattenToArray(b._viewMatrixArray);if(!b._projectionMatrixArray)b._projectionMatrixArray=new Float32Array(16);b.projectionMatrix.flattenToArray(b._projectionMatrixArray);za.multiply(b.projectionMatrix,b.matrixWorldInverse);xa.setFromMatrix(za);this.setRenderTarget(c);(this.autoClear||d)&&this.clear(this.autoClearColor,this.autoClearDepth,this.autoClearStencil);n=a.__webglObjects;for(d=0,f=n.length;d<f;d++)if(g=n[d],k=g.object,g.render=!1,k.visible&&(!(k instanceof
THREE.Mesh||k instanceof THREE.ParticleSystem)||!k.frustumCulled||xa.contains(k))){k.matrixWorld.flattenToArray(k._objectMatrixArray);p(k,b);var o=g,s=o.object,t=o.buffer,z=void 0,z=z=void 0,z=s.material;if(z instanceof THREE.MeshFaceMaterial){if(z=t.materialIndex,z>=0)z=s.geometry.materials[z],z.transparent?(o.transparent=z,o.opaque=null):(o.opaque=z,o.transparent=null)}else if(z)z.transparent?(o.transparent=z,o.opaque=null):(o.opaque=z,o.transparent=null);g.render=!0;if(this.sortObjects)k.renderDepth?
g.z=k.renderDepth:(wa.copy(k.position),za.multiplyVector3(wa),g.z=wa.z)}this.sortObjects&&n.sort(e);n=a.__webglObjectsImmediate;for(d=0,f=n.length;d<f;d++)if(g=n[d],k=g.object,k.visible)k.matrixAutoUpdate&&k.matrixWorld.flattenToArray(k._objectMatrixArray),p(k,b),k=g.object.material,k.transparent?(g.transparent=k,g.opaque=null):(g.opaque=k,g.transparent=null);a.overrideMaterial?(this.setBlending(a.overrideMaterial.blending),this.setDepthTest(a.overrideMaterial.depthTest),this.setDepthWrite(a.overrideMaterial.depthWrite),
r(a.overrideMaterial.polygonOffset,a.overrideMaterial.polygonOffsetFactor,a.overrideMaterial.polygonOffsetUnits),i(a.__webglObjects,!1,"",b,m,q,!0,a.overrideMaterial),j(a.__webglObjectsImmediate,"",b,m,q,!1,a.overrideMaterial)):(this.setBlending(THREE.NormalBlending),i(a.__webglObjects,!0,"opaque",b,m,q,!1),j(a.__webglObjectsImmediate,"opaque",b,m,q,!1),i(a.__webglObjects,!1,"transparent",b,m,q,!0),j(a.__webglObjectsImmediate,"transparent",b,m,q,!0));h(this.renderPluginsPost,a,b);c&&c.generateMipmaps&&
c.minFilter!==THREE.NearestFilter&&c.minFilter!==THREE.LinearFilter&&(c instanceof THREE.WebGLRenderTargetCube?(l.bindTexture(l.TEXTURE_CUBE_MAP,c.__webglTexture),l.generateMipmap(l.TEXTURE_CUBE_MAP),l.bindTexture(l.TEXTURE_CUBE_MAP,null)):(l.bindTexture(l.TEXTURE_2D,c.__webglTexture),l.generateMipmap(l.TEXTURE_2D),l.bindTexture(l.TEXTURE_2D,null)));this.setDepthTest(!0);this.setDepthWrite(!0)};this.renderImmediateObject=function(a,b,c,d,f){var e=m(a,b,c,d,f);W=-1;A.setObjectFaces(f);f.immediateRenderCallback?
f.immediateRenderCallback(e,l,xa):f.render(function(a){A.renderBufferImmediate(a,e,d.shading)})};this.initWebGLObjects=function(a){if(!a.__webglObjects)a.__webglObjects=[],a.__webglObjectsImmediate=[],a.__webglSprites=[],a.__webglFlares=[];for(;a.__objectsAdded.length;){var e=a.__objectsAdded[0],h=a,i=void 0,j=void 0,m=void 0;if(!e.__webglInit)if(e.__webglInit=!0,e._modelViewMatrix=new THREE.Matrix4,e._normalMatrixArray=new Float32Array(9),e._modelViewMatrixArray=new Float32Array(16),e._objectMatrixArray=
new Float32Array(16),e.matrixWorld.flattenToArray(e._objectMatrixArray),e instanceof THREE.Mesh){if(j=e.geometry,j instanceof THREE.Geometry){if(j.geometryGroups===void 0){var m=j,p=void 0,r=void 0,t=void 0,z=void 0,C=void 0,u=void 0,w=void 0,v={},D=m.morphTargets.length,E=m.morphNormals.length;m.geometryGroups={};for(p=0,r=m.faces.length;p<r;p++)t=m.faces[p],z=t.materialIndex,u=z!==void 0?z:-1,v[u]===void 0&&(v[u]={hash:u,counter:0}),w=v[u].hash+"_"+v[u].counter,m.geometryGroups[w]===void 0&&(m.geometryGroups[w]=
{faces3:[],faces4:[],materialIndex:z,vertices:0,numMorphTargets:D,numMorphNormals:E}),C=t instanceof THREE.Face3?3:4,m.geometryGroups[w].vertices+C>65535&&(v[u].counter+=1,w=v[u].hash+"_"+v[u].counter,m.geometryGroups[w]===void 0&&(m.geometryGroups[w]={faces3:[],faces4:[],materialIndex:z,vertices:0,numMorphTargets:D,numMorphNormals:E})),t instanceof THREE.Face3?m.geometryGroups[w].faces3.push(p):m.geometryGroups[w].faces4.push(p),m.geometryGroups[w].vertices+=C;m.geometryGroupsList=[];p=void 0;for(p in m.geometryGroups)m.geometryGroups[p].id=
ma++,m.geometryGroupsList.push(m.geometryGroups[p])}for(i in j.geometryGroups)if(m=j.geometryGroups[i],!m.__webglVertexBuffer){p=m;p.__webglVertexBuffer=l.createBuffer();p.__webglNormalBuffer=l.createBuffer();p.__webglTangentBuffer=l.createBuffer();p.__webglColorBuffer=l.createBuffer();p.__webglUVBuffer=l.createBuffer();p.__webglUV2Buffer=l.createBuffer();p.__webglSkinVertexABuffer=l.createBuffer();p.__webglSkinVertexBBuffer=l.createBuffer();p.__webglSkinIndicesBuffer=l.createBuffer();p.__webglSkinWeightsBuffer=
l.createBuffer();p.__webglFaceBuffer=l.createBuffer();p.__webglLineBuffer=l.createBuffer();t=r=void 0;if(p.numMorphTargets){p.__webglMorphTargetsBuffers=[];for(r=0,t=p.numMorphTargets;r<t;r++)p.__webglMorphTargetsBuffers.push(l.createBuffer())}if(p.numMorphNormals){p.__webglMorphNormalsBuffers=[];for(r=0,t=p.numMorphNormals;r<t;r++)p.__webglMorphNormalsBuffers.push(l.createBuffer())}A.info.memory.geometries++;z=e;C=z.geometry;r=m.faces3;u=m.faces4;p=r.length*3+u.length*4;t=r.length*1+u.length*2;u=
r.length*3+u.length*4;r=c(z,m);w=f(r);v=d(r);D=r.vertexColors?r.vertexColors:!1;m.__vertexArray=new Float32Array(p*3);if(v)m.__normalArray=new Float32Array(p*3);if(C.hasTangents)m.__tangentArray=new Float32Array(p*4);if(D)m.__colorArray=new Float32Array(p*3);if(w){if(C.faceUvs.length>0||C.faceVertexUvs.length>0)m.__uvArray=new Float32Array(p*2);if(C.faceUvs.length>1||C.faceVertexUvs.length>1)m.__uv2Array=new Float32Array(p*2)}if(z.geometry.skinWeights.length&&z.geometry.skinIndices.length)m.__skinVertexAArray=
new Float32Array(p*4),m.__skinVertexBArray=new Float32Array(p*4),m.__skinIndexArray=new Float32Array(p*4),m.__skinWeightArray=new Float32Array(p*4);m.__faceArray=new Uint16Array(t*3);m.__lineArray=new Uint16Array(u*2);C=z=void 0;if(m.numMorphTargets){m.__morphTargetsArrays=[];for(z=0,C=m.numMorphTargets;z<C;z++)m.__morphTargetsArrays.push(new Float32Array(p*3))}if(m.numMorphNormals){m.__morphNormalsArrays=[];for(z=0,C=m.numMorphNormals;z<C;z++)m.__morphNormalsArrays.push(new Float32Array(p*3))}m.__webglFaceCount=
t*3;m.__webglLineCount=u*2;if(r.attributes){if(m.__webglCustomAttributesList===void 0)m.__webglCustomAttributesList=[];t=void 0;for(t in r.attributes){var z=r.attributes[t],C={},y;for(y in z)C[y]=z[y];if(!C.__webglInitialized||C.createUniqueBuffers)C.__webglInitialized=!0,u=1,C.type==="v2"?u=2:C.type==="v3"?u=3:C.type==="v4"?u=4:C.type==="c"&&(u=3),C.size=u,C.array=new Float32Array(p*u),C.buffer=l.createBuffer(),C.buffer.belongsToAttribute=t,z.needsUpdate=!0,C.__original=z;m.__webglCustomAttributesList.push(C)}}m.__inittedArrays=
!0;j.__dirtyVertices=!0;j.__dirtyMorphTargets=!0;j.__dirtyElements=!0;j.__dirtyUvs=!0;j.__dirtyNormals=!0;j.__dirtyTangents=!0;j.__dirtyColors=!0}}}else if(e instanceof THREE.Ribbon){if(j=e.geometry,!j.__webglVertexBuffer)m=j,m.__webglVertexBuffer=l.createBuffer(),m.__webglColorBuffer=l.createBuffer(),A.info.memory.geometries++,m=j,p=m.vertices.length,m.__vertexArray=new Float32Array(p*3),m.__colorArray=new Float32Array(p*3),m.__webglVertexCount=p,j.__dirtyVertices=!0,j.__dirtyColors=!0}else if(e instanceof
THREE.Line){if(j=e.geometry,!j.__webglVertexBuffer)m=j,m.__webglVertexBuffer=l.createBuffer(),m.__webglColorBuffer=l.createBuffer(),A.info.memory.geometries++,m=j,p=e,r=m.vertices.length,m.__vertexArray=new Float32Array(r*3),m.__colorArray=new Float32Array(r*3),m.__webglLineCount=r,b(m,p),j.__dirtyVertices=!0,j.__dirtyColors=!0}else if(e instanceof THREE.ParticleSystem&&(j=e.geometry,!j.__webglVertexBuffer))m=j,m.__webglVertexBuffer=l.createBuffer(),m.__webglColorBuffer=l.createBuffer(),A.info.geometries++,
m=j,p=e,r=m.vertices.length,m.__vertexArray=new Float32Array(r*3),m.__colorArray=new Float32Array(r*3),m.__sortArray=[],m.__webglParticleCount=r,b(m,p),j.__dirtyVertices=!0,j.__dirtyColors=!0;if(!e.__webglActive){if(e instanceof THREE.Mesh)if(j=e.geometry,j instanceof THREE.BufferGeometry)k(h.__webglObjects,j,e);else for(i in j.geometryGroups)m=j.geometryGroups[i],k(h.__webglObjects,m,e);else e instanceof THREE.Ribbon||e instanceof THREE.Line||e instanceof THREE.ParticleSystem?(j=e.geometry,k(h.__webglObjects,
j,e)):THREE.MarchingCubes!==void 0&&e instanceof THREE.MarchingCubes||e.immediateRenderCallback?h.__webglObjectsImmediate.push({object:e,opaque:null,transparent:null}):e instanceof THREE.Sprite?h.__webglSprites.push(e):e instanceof THREE.LensFlare&&h.__webglFlares.push(e);e.__webglActive=!0}a.__objectsAdded.splice(0,1)}for(;a.__objectsRemoved.length;)e=a.__objectsRemoved[0],h=a,e instanceof THREE.Mesh||e instanceof THREE.ParticleSystem||e instanceof THREE.Ribbon||e instanceof THREE.Line?o(h.__webglObjects,
e):e instanceof THREE.Sprite?s(h.__webglSprites,e):e instanceof THREE.LensFlare?s(h.__webglFlares,e):(e instanceof THREE.MarchingCubes||e.immediateRenderCallback)&&o(h.__webglObjectsImmediate,e),e.__webglActive=!1,a.__objectsRemoved.splice(0,1);e=0;for(h=a.__webglObjects.length;e<h;e++)if(y=a.__webglObjects[e].object,i=y.geometry,j=t=r=void 0,y instanceof THREE.Mesh)if(i instanceof THREE.BufferGeometry)i.__dirtyVertices=!1,i.__dirtyElements=!1,i.__dirtyUvs=!1,i.__dirtyNormals=!1,i.__dirtyColors=!1;
else{m=0;for(p=i.geometryGroupsList.length;m<p;m++)if(r=i.geometryGroupsList[m],j=c(y,r),t=j.attributes&&q(j),i.__dirtyVertices||i.__dirtyMorphTargets||i.__dirtyElements||i.__dirtyUvs||i.__dirtyNormals||i.__dirtyColors||i.__dirtyTangents||t){var T=y,t=l.DYNAMIC_DRAW,z=!i.dynamic,v=j;if(r.__inittedArrays){var D=d(v),E=v.vertexColors?v.vertexColors:!1,W=f(v),G=D===THREE.SmoothShading,F=u=C=void 0,J=void 0,I=void 0,Z=void 0,L=void 0,K=void 0,S=void 0,O=F=void 0,P=void 0,M=void 0,B=void 0,N=J=void 0,
aa=void 0,Q=void 0,U=B=M=P=J=S=void 0,X=void 0,Y=void 0,$=L=void 0,V=void 0,ca=J=P=V=$=M=P=V=$=M=P=V=$=M=P=void 0,ga=void 0,oa=Z=void 0,ka=void 0,ia=void 0,ra=void 0,ha=void 0,la=void 0,B=la=void 0,qa=O=ia=ga=0,na=0,ja=ca=F=0,ba=L=N=0,H=0,pa=void 0,ba=r.__vertexArray,ka=r.__uvArray,H=r.__uv2Array,oa=r.__normalArray,I=r.__tangentArray,aa=r.__colorArray,U=r.__skinVertexAArray,X=r.__skinVertexBArray,Y=r.__skinIndexArray,K=r.__skinWeightArray,$=r.__morphTargetsArrays,V=r.__morphNormalsArrays,w=r.__webglCustomAttributesList,
x=void 0,x=r.__faceArray,pa=r.__lineArray,Q=T.geometry,sa=Q.__dirtyElements,ta=Q.__dirtyUvs,Z=Q.__dirtyNormals,S=Q.__dirtyTangents,Ea=Q.__dirtyColors,ra=Q.__dirtyMorphTargets,la=Q.vertices,T=r.faces3,fa=r.faces4,ea=Q.faces,Aa=Q.faceVertexUvs[0],za=Q.faceVertexUvs[1],wa=Q.skinVerticesA,ya=Q.skinVerticesB,xa=Q.skinIndices,Ja=Q.skinWeights,Ka=Q.morphTargets,Qa=Q.morphNormals;if(Q.__dirtyVertices){for(C=0,u=T.length;C<u;C++)J=ea[T[C]],P=la[J.a].position,M=la[J.b].position,B=la[J.c].position,ba[ia]=P.x,
ba[ia+1]=P.y,ba[ia+2]=P.z,ba[ia+3]=M.x,ba[ia+4]=M.y,ba[ia+5]=M.z,ba[ia+6]=B.x,ba[ia+7]=B.y,ba[ia+8]=B.z,ia+=9;for(C=0,u=fa.length;C<u;C++)J=ea[fa[C]],P=la[J.a].position,M=la[J.b].position,B=la[J.c].position,J=la[J.d].position,ba[ia]=P.x,ba[ia+1]=P.y,ba[ia+2]=P.z,ba[ia+3]=M.x,ba[ia+4]=M.y,ba[ia+5]=M.z,ba[ia+6]=B.x,ba[ia+7]=B.y,ba[ia+8]=B.z,ba[ia+9]=J.x,ba[ia+10]=J.y,ba[ia+11]=J.z,ia+=12;l.bindBuffer(l.ARRAY_BUFFER,r.__webglVertexBuffer);l.bufferData(l.ARRAY_BUFFER,ba,t)}if(ra)for(ia=0,ra=Ka.length;ia<
ra;ia++){ba=0;for(C=0,u=T.length;C<u;C++){la=T[C];J=ea[la];P=Ka[ia].vertices[J.a].position;M=Ka[ia].vertices[J.b].position;B=Ka[ia].vertices[J.c].position;ha=$[ia];ha[ba]=P.x;ha[ba+1]=P.y;ha[ba+2]=P.z;ha[ba+3]=M.x;ha[ba+4]=M.y;ha[ba+5]=M.z;ha[ba+6]=B.x;ha[ba+7]=B.y;ha[ba+8]=B.z;if(v.morphNormals)G?(B=Qa[ia].vertexNormals[la],J=B.a,P=B.b,M=B.c):M=P=J=Qa[ia].faceNormals[la],la=V[ia],la[ba]=J.x,la[ba+1]=J.y,la[ba+2]=J.z,la[ba+3]=P.x,la[ba+4]=P.y,la[ba+5]=P.z,la[ba+6]=M.x,la[ba+7]=M.y,la[ba+8]=M.z;ba+=
9}for(C=0,u=fa.length;C<u;C++){la=fa[C];J=ea[la];P=Ka[ia].vertices[J.a].position;M=Ka[ia].vertices[J.b].position;B=Ka[ia].vertices[J.c].position;J=Ka[ia].vertices[J.d].position;ha=$[ia];ha[ba]=P.x;ha[ba+1]=P.y;ha[ba+2]=P.z;ha[ba+3]=M.x;ha[ba+4]=M.y;ha[ba+5]=M.z;ha[ba+6]=B.x;ha[ba+7]=B.y;ha[ba+8]=B.z;ha[ba+9]=J.x;ha[ba+10]=J.y;ha[ba+11]=J.z;if(v.morphNormals)G?(B=Qa[ia].vertexNormals[la],J=B.a,P=B.b,M=B.c,B=B.d):B=M=P=J=Qa[ia].faceNormals[la],la=V[ia],la[ba]=J.x,la[ba+1]=J.y,la[ba+2]=J.z,la[ba+3]=
P.x,la[ba+4]=P.y,la[ba+5]=P.z,la[ba+6]=M.x,la[ba+7]=M.y,la[ba+8]=M.z,la[ba+9]=B.x,la[ba+10]=B.y,la[ba+11]=B.z;ba+=12}l.bindBuffer(l.ARRAY_BUFFER,r.__webglMorphTargetsBuffers[ia]);l.bufferData(l.ARRAY_BUFFER,$[ia],t);v.morphNormals&&(l.bindBuffer(l.ARRAY_BUFFER,r.__webglMorphNormalsBuffers[ia]),l.bufferData(l.ARRAY_BUFFER,V[ia],t))}if(Ja.length){for(C=0,u=T.length;C<u;C++)J=ea[T[C]],$=Ja[J.a],V=Ja[J.b],P=Ja[J.c],K[L]=$.x,K[L+1]=$.y,K[L+2]=$.z,K[L+3]=$.w,K[L+4]=V.x,K[L+5]=V.y,K[L+6]=V.z,K[L+7]=V.w,
K[L+8]=P.x,K[L+9]=P.y,K[L+10]=P.z,K[L+11]=P.w,$=xa[J.a],V=xa[J.b],P=xa[J.c],Y[L]=$.x,Y[L+1]=$.y,Y[L+2]=$.z,Y[L+3]=$.w,Y[L+4]=V.x,Y[L+5]=V.y,Y[L+6]=V.z,Y[L+7]=V.w,Y[L+8]=P.x,Y[L+9]=P.y,Y[L+10]=P.z,Y[L+11]=P.w,$=wa[J.a],V=wa[J.b],P=wa[J.c],U[L]=$.x,U[L+1]=$.y,U[L+2]=$.z,U[L+3]=1,U[L+4]=V.x,U[L+5]=V.y,U[L+6]=V.z,U[L+7]=1,U[L+8]=P.x,U[L+9]=P.y,U[L+10]=P.z,U[L+11]=1,$=ya[J.a],V=ya[J.b],P=ya[J.c],X[L]=$.x,X[L+1]=$.y,X[L+2]=$.z,X[L+3]=1,X[L+4]=V.x,X[L+5]=V.y,X[L+6]=V.z,X[L+7]=1,X[L+8]=P.x,X[L+9]=P.y,X[L+
10]=P.z,X[L+11]=1,L+=12;for(C=0,u=fa.length;C<u;C++)J=ea[fa[C]],$=Ja[J.a],V=Ja[J.b],P=Ja[J.c],M=Ja[J.d],K[L]=$.x,K[L+1]=$.y,K[L+2]=$.z,K[L+3]=$.w,K[L+4]=V.x,K[L+5]=V.y,K[L+6]=V.z,K[L+7]=V.w,K[L+8]=P.x,K[L+9]=P.y,K[L+10]=P.z,K[L+11]=P.w,K[L+12]=M.x,K[L+13]=M.y,K[L+14]=M.z,K[L+15]=M.w,$=xa[J.a],V=xa[J.b],P=xa[J.c],M=xa[J.d],Y[L]=$.x,Y[L+1]=$.y,Y[L+2]=$.z,Y[L+3]=$.w,Y[L+4]=V.x,Y[L+5]=V.y,Y[L+6]=V.z,Y[L+7]=V.w,Y[L+8]=P.x,Y[L+9]=P.y,Y[L+10]=P.z,Y[L+11]=P.w,Y[L+12]=M.x,Y[L+13]=M.y,Y[L+14]=M.z,Y[L+15]=M.w,
$=wa[J.a],V=wa[J.b],P=wa[J.c],M=wa[J.d],U[L]=$.x,U[L+1]=$.y,U[L+2]=$.z,U[L+3]=1,U[L+4]=V.x,U[L+5]=V.y,U[L+6]=V.z,U[L+7]=1,U[L+8]=P.x,U[L+9]=P.y,U[L+10]=P.z,U[L+11]=1,U[L+12]=M.x,U[L+13]=M.y,U[L+14]=M.z,U[L+15]=1,$=ya[J.a],V=ya[J.b],P=ya[J.c],J=ya[J.d],X[L]=$.x,X[L+1]=$.y,X[L+2]=$.z,X[L+3]=1,X[L+4]=V.x,X[L+5]=V.y,X[L+6]=V.z,X[L+7]=1,X[L+8]=P.x,X[L+9]=P.y,X[L+10]=P.z,X[L+11]=1,X[L+12]=J.x,X[L+13]=J.y,X[L+14]=J.z,X[L+15]=1,L+=16;L>0&&(l.bindBuffer(l.ARRAY_BUFFER,r.__webglSkinVertexABuffer),l.bufferData(l.ARRAY_BUFFER,
U,t),l.bindBuffer(l.ARRAY_BUFFER,r.__webglSkinVertexBBuffer),l.bufferData(l.ARRAY_BUFFER,X,t),l.bindBuffer(l.ARRAY_BUFFER,r.__webglSkinIndicesBuffer),l.bufferData(l.ARRAY_BUFFER,Y,t),l.bindBuffer(l.ARRAY_BUFFER,r.__webglSkinWeightsBuffer),l.bufferData(l.ARRAY_BUFFER,K,t))}if(Ea&&E){for(C=0,u=T.length;C<u;C++)J=ea[T[C]],L=J.vertexColors,K=J.color,L.length===3&&E===THREE.VertexColors?(U=L[0],X=L[1],Y=L[2]):Y=X=U=K,aa[N]=U.r,aa[N+1]=U.g,aa[N+2]=U.b,aa[N+3]=X.r,aa[N+4]=X.g,aa[N+5]=X.b,aa[N+6]=Y.r,aa[N+
7]=Y.g,aa[N+8]=Y.b,N+=9;for(C=0,u=fa.length;C<u;C++)J=ea[fa[C]],L=J.vertexColors,K=J.color,L.length===4&&E===THREE.VertexColors?(U=L[0],X=L[1],Y=L[2],L=L[3]):L=Y=X=U=K,aa[N]=U.r,aa[N+1]=U.g,aa[N+2]=U.b,aa[N+3]=X.r,aa[N+4]=X.g,aa[N+5]=X.b,aa[N+6]=Y.r,aa[N+7]=Y.g,aa[N+8]=Y.b,aa[N+9]=L.r,aa[N+10]=L.g,aa[N+11]=L.b,N+=12;N>0&&(l.bindBuffer(l.ARRAY_BUFFER,r.__webglColorBuffer),l.bufferData(l.ARRAY_BUFFER,aa,t))}if(S&&Q.hasTangents){for(C=0,u=T.length;C<u;C++)J=ea[T[C]],S=J.vertexTangents,N=S[0],aa=S[1],
Q=S[2],I[ca]=N.x,I[ca+1]=N.y,I[ca+2]=N.z,I[ca+3]=N.w,I[ca+4]=aa.x,I[ca+5]=aa.y,I[ca+6]=aa.z,I[ca+7]=aa.w,I[ca+8]=Q.x,I[ca+9]=Q.y,I[ca+10]=Q.z,I[ca+11]=Q.w,ca+=12;for(C=0,u=fa.length;C<u;C++)J=ea[fa[C]],S=J.vertexTangents,N=S[0],aa=S[1],Q=S[2],S=S[3],I[ca]=N.x,I[ca+1]=N.y,I[ca+2]=N.z,I[ca+3]=N.w,I[ca+4]=aa.x,I[ca+5]=aa.y,I[ca+6]=aa.z,I[ca+7]=aa.w,I[ca+8]=Q.x,I[ca+9]=Q.y,I[ca+10]=Q.z,I[ca+11]=Q.w,I[ca+12]=S.x,I[ca+13]=S.y,I[ca+14]=S.z,I[ca+15]=S.w,ca+=16;l.bindBuffer(l.ARRAY_BUFFER,r.__webglTangentBuffer);
l.bufferData(l.ARRAY_BUFFER,I,t)}if(Z&&D){for(C=0,u=T.length;C<u;C++)if(J=ea[T[C]],I=J.vertexNormals,Z=J.normal,I.length===3&&G)for(ca=0;ca<3;ca++)Z=I[ca],oa[F]=Z.x,oa[F+1]=Z.y,oa[F+2]=Z.z,F+=3;else for(ca=0;ca<3;ca++)oa[F]=Z.x,oa[F+1]=Z.y,oa[F+2]=Z.z,F+=3;for(C=0,u=fa.length;C<u;C++)if(J=ea[fa[C]],I=J.vertexNormals,Z=J.normal,I.length===4&&G)for(ca=0;ca<4;ca++)Z=I[ca],oa[F]=Z.x,oa[F+1]=Z.y,oa[F+2]=Z.z,F+=3;else for(ca=0;ca<4;ca++)oa[F]=Z.x,oa[F+1]=Z.y,oa[F+2]=Z.z,F+=3;l.bindBuffer(l.ARRAY_BUFFER,
r.__webglNormalBuffer);l.bufferData(l.ARRAY_BUFFER,oa,t)}if(ta&&Aa&&W){for(C=0,u=T.length;C<u;C++)if(F=T[C],F=Aa[F],F!==void 0)for(ca=0;ca<3;ca++)oa=F[ca],ka[O]=oa.u,ka[O+1]=oa.v,O+=2;for(C=0,u=fa.length;C<u;C++)if(F=fa[C],F=Aa[F],F!==void 0)for(ca=0;ca<4;ca++)oa=F[ca],ka[O]=oa.u,ka[O+1]=oa.v,O+=2;O>0&&(l.bindBuffer(l.ARRAY_BUFFER,r.__webglUVBuffer),l.bufferData(l.ARRAY_BUFFER,ka,t))}if(ta&&za&&W){for(C=0,u=T.length;C<u;C++)if(F=T[C],O=za[F],O!==void 0)for(ca=0;ca<3;ca++)ka=O[ca],H[qa]=ka.u,H[qa+
1]=ka.v,qa+=2;for(C=0,u=fa.length;C<u;C++)if(F=fa[C],O=za[F],O!==void 0)for(ca=0;ca<4;ca++)ka=O[ca],H[qa]=ka.u,H[qa+1]=ka.v,qa+=2;qa>0&&(l.bindBuffer(l.ARRAY_BUFFER,r.__webglUV2Buffer),l.bufferData(l.ARRAY_BUFFER,H,t))}if(sa){for(C=0,u=T.length;C<u;C++)x[na]=ga,x[na+1]=ga+1,x[na+2]=ga+2,na+=3,pa[ja]=ga,pa[ja+1]=ga+1,pa[ja+2]=ga,pa[ja+3]=ga+2,pa[ja+4]=ga+1,pa[ja+5]=ga+2,ja+=6,ga+=3;for(C=0,u=fa.length;C<u;C++)x[na]=ga,x[na+1]=ga+1,x[na+2]=ga+3,x[na+3]=ga+1,x[na+4]=ga+2,x[na+5]=ga+3,na+=6,pa[ja]=ga,
pa[ja+1]=ga+1,pa[ja+2]=ga,pa[ja+3]=ga+3,pa[ja+4]=ga+1,pa[ja+5]=ga+2,pa[ja+6]=ga+2,pa[ja+7]=ga+3,ja+=8,ga+=4;l.bindBuffer(l.ELEMENT_ARRAY_BUFFER,r.__webglFaceBuffer);l.bufferData(l.ELEMENT_ARRAY_BUFFER,x,t);l.bindBuffer(l.ELEMENT_ARRAY_BUFFER,r.__webglLineBuffer);l.bufferData(l.ELEMENT_ARRAY_BUFFER,pa,t)}if(w)for(ca=0,ga=w.length;ca<ga;ca++)if(x=w[ca],x.__original.needsUpdate){H=0;if(x.size===1)if(x.boundTo===void 0||x.boundTo==="vertices"){for(C=0,u=T.length;C<u;C++)J=ea[T[C]],x.array[H]=x.value[J.a],
x.array[H+1]=x.value[J.b],x.array[H+2]=x.value[J.c],H+=3;for(C=0,u=fa.length;C<u;C++)J=ea[fa[C]],x.array[H]=x.value[J.a],x.array[H+1]=x.value[J.b],x.array[H+2]=x.value[J.c],x.array[H+3]=x.value[J.d],H+=4}else{if(x.boundTo==="faces"){for(C=0,u=T.length;C<u;C++)pa=x.value[T[C]],x.array[H]=pa,x.array[H+1]=pa,x.array[H+2]=pa,H+=3;for(C=0,u=fa.length;C<u;C++)pa=x.value[fa[C]],x.array[H]=pa,x.array[H+1]=pa,x.array[H+2]=pa,x.array[H+3]=pa,H+=4}}else if(x.size===2)if(x.boundTo===void 0||x.boundTo==="vertices"){for(C=
0,u=T.length;C<u;C++)J=ea[T[C]],P=x.value[J.a],M=x.value[J.b],B=x.value[J.c],x.array[H]=P.x,x.array[H+1]=P.y,x.array[H+2]=M.x,x.array[H+3]=M.y,x.array[H+4]=B.x,x.array[H+5]=B.y,H+=6;for(C=0,u=fa.length;C<u;C++)J=ea[fa[C]],P=x.value[J.a],M=x.value[J.b],B=x.value[J.c],J=x.value[J.d],x.array[H]=P.x,x.array[H+1]=P.y,x.array[H+2]=M.x,x.array[H+3]=M.y,x.array[H+4]=B.x,x.array[H+5]=B.y,x.array[H+6]=J.x,x.array[H+7]=J.y,H+=8}else{if(x.boundTo==="faces"){for(C=0,u=T.length;C<u;C++)B=M=P=pa=x.value[T[C]],x.array[H]=
P.x,x.array[H+1]=P.y,x.array[H+2]=M.x,x.array[H+3]=M.y,x.array[H+4]=B.x,x.array[H+5]=B.y,H+=6;for(C=0,u=fa.length;C<u;C++)J=B=M=P=pa=x.value[fa[C]],x.array[H]=P.x,x.array[H+1]=P.y,x.array[H+2]=M.x,x.array[H+3]=M.y,x.array[H+4]=B.x,x.array[H+5]=B.y,x.array[H+6]=J.x,x.array[H+7]=J.y,H+=8}}else if(x.size===3)if(v=x.type==="c"?["r","g","b"]:["x","y","z"],x.boundTo===void 0||x.boundTo==="vertices"){for(C=0,u=T.length;C<u;C++)J=ea[T[C]],P=x.value[J.a],M=x.value[J.b],B=x.value[J.c],x.array[H]=P[v[0]],x.array[H+
1]=P[v[1]],x.array[H+2]=P[v[2]],x.array[H+3]=M[v[0]],x.array[H+4]=M[v[1]],x.array[H+5]=M[v[2]],x.array[H+6]=B[v[0]],x.array[H+7]=B[v[1]],x.array[H+8]=B[v[2]],H+=9;for(C=0,u=fa.length;C<u;C++)J=ea[fa[C]],P=x.value[J.a],M=x.value[J.b],B=x.value[J.c],J=x.value[J.d],x.array[H]=P[v[0]],x.array[H+1]=P[v[1]],x.array[H+2]=P[v[2]],x.array[H+3]=M[v[0]],x.array[H+4]=M[v[1]],x.array[H+5]=M[v[2]],x.array[H+6]=B[v[0]],x.array[H+7]=B[v[1]],x.array[H+8]=B[v[2]],x.array[H+9]=J[v[0]],x.array[H+10]=J[v[1]],x.array[H+
11]=J[v[2]],H+=12}else{if(x.boundTo==="faces"){for(C=0,u=T.length;C<u;C++)B=M=P=pa=x.value[T[C]],x.array[H]=P[v[0]],x.array[H+1]=P[v[1]],x.array[H+2]=P[v[2]],x.array[H+3]=M[v[0]],x.array[H+4]=M[v[1]],x.array[H+5]=M[v[2]],x.array[H+6]=B[v[0]],x.array[H+7]=B[v[1]],x.array[H+8]=B[v[2]],H+=9;for(C=0,u=fa.length;C<u;C++)J=B=M=P=pa=x.value[fa[C]],x.array[H]=P[v[0]],x.array[H+1]=P[v[1]],x.array[H+2]=P[v[2]],x.array[H+3]=M[v[0]],x.array[H+4]=M[v[1]],x.array[H+5]=M[v[2]],x.array[H+6]=B[v[0]],x.array[H+7]=
B[v[1]],x.array[H+8]=B[v[2]],x.array[H+9]=J[v[0]],x.array[H+10]=J[v[1]],x.array[H+11]=J[v[2]],H+=12}}else if(x.size===4)if(x.boundTo===void 0||x.boundTo==="vertices"){for(C=0,u=T.length;C<u;C++)J=ea[T[C]],P=x.value[J.a],M=x.value[J.b],B=x.value[J.c],x.array[H]=P.x,x.array[H+1]=P.y,x.array[H+2]=P.z,x.array[H+3]=P.w,x.array[H+4]=M.x,x.array[H+5]=M.y,x.array[H+6]=M.z,x.array[H+7]=M.w,x.array[H+8]=B.x,x.array[H+9]=B.y,x.array[H+10]=B.z,x.array[H+11]=B.w,H+=12;for(C=0,u=fa.length;C<u;C++)J=ea[fa[C]],P=
x.value[J.a],M=x.value[J.b],B=x.value[J.c],J=x.value[J.d],x.array[H]=P.x,x.array[H+1]=P.y,x.array[H+2]=P.z,x.array[H+3]=P.w,x.array[H+4]=M.x,x.array[H+5]=M.y,x.array[H+6]=M.z,x.array[H+7]=M.w,x.array[H+8]=B.x,x.array[H+9]=B.y,x.array[H+10]=B.z,x.array[H+11]=B.w,x.array[H+12]=J.x,x.array[H+13]=J.y,x.array[H+14]=J.z,x.array[H+15]=J.w,H+=16}else if(x.boundTo==="faces"){for(C=0,u=T.length;C<u;C++)B=M=P=pa=x.value[T[C]],x.array[H]=P.x,x.array[H+1]=P.y,x.array[H+2]=P.z,x.array[H+3]=P.w,x.array[H+4]=M.x,
x.array[H+5]=M.y,x.array[H+6]=M.z,x.array[H+7]=M.w,x.array[H+8]=B.x,x.array[H+9]=B.y,x.array[H+10]=B.z,x.array[H+11]=B.w,H+=12;for(C=0,u=fa.length;C<u;C++)J=B=M=P=pa=x.value[fa[C]],x.array[H]=P.x,x.array[H+1]=P.y,x.array[H+2]=P.z,x.array[H+3]=P.w,x.array[H+4]=M.x,x.array[H+5]=M.y,x.array[H+6]=M.z,x.array[H+7]=M.w,x.array[H+8]=B.x,x.array[H+9]=B.y,x.array[H+10]=B.z,x.array[H+11]=B.w,x.array[H+12]=J.x,x.array[H+13]=J.y,x.array[H+14]=J.z,x.array[H+15]=J.w,H+=16}l.bindBuffer(l.ARRAY_BUFFER,x.buffer);
l.bufferData(l.ARRAY_BUFFER,x.array,t)}z&&(delete r.__inittedArrays,delete r.__colorArray,delete r.__normalArray,delete r.__tangentArray,delete r.__uvArray,delete r.__uv2Array,delete r.__faceArray,delete r.__vertexArray,delete r.__lineArray,delete r.__skinVertexAArray,delete r.__skinVertexBArray,delete r.__skinIndexArray,delete r.__skinWeightArray)}}i.__dirtyVertices=!1;i.__dirtyMorphTargets=!1;i.__dirtyElements=!1;i.__dirtyUvs=!1;i.__dirtyNormals=!1;i.__dirtyColors=!1;i.__dirtyTangents=!1;j.attributes&&
n(j)}else if(y instanceof THREE.Ribbon){if(i.__dirtyVertices||i.__dirtyColors){j=i;y=l.DYNAMIC_DRAW;C=m=C=z=z=void 0;u=j.vertices;p=j.colors;w=u.length;r=p.length;v=j.__vertexArray;t=j.__colorArray;D=j.__dirtyColors;if(j.__dirtyVertices){for(z=0;z<w;z++)C=u[z].position,m=z*3,v[m]=C.x,v[m+1]=C.y,v[m+2]=C.z;l.bindBuffer(l.ARRAY_BUFFER,j.__webglVertexBuffer);l.bufferData(l.ARRAY_BUFFER,v,y)}if(D){for(z=0;z<r;z++)C=p[z],m=z*3,t[m]=C.r,t[m+1]=C.g,t[m+2]=C.b;l.bindBuffer(l.ARRAY_BUFFER,j.__webglColorBuffer);
l.bufferData(l.ARRAY_BUFFER,t,y)}}i.__dirtyVertices=!1;i.__dirtyColors=!1}else if(y instanceof THREE.Line){j=c(y,r);t=j.attributes&&q(j);if(i.__dirtyVertices||i.__dirtyColors||t){y=i;m=l.DYNAMIC_DRAW;w=p=W=u=E=void 0;u=y.vertices;r=y.colors;w=u.length;t=r.length;v=y.__vertexArray;z=y.__colorArray;D=y.__dirtyColors;C=y.__webglCustomAttributesList;ea=fa=T=G=W=E=void 0;if(y.__dirtyVertices){for(E=0;E<w;E++)W=u[E].position,p=E*3,v[p]=W.x,v[p+1]=W.y,v[p+2]=W.z;l.bindBuffer(l.ARRAY_BUFFER,y.__webglVertexBuffer);
l.bufferData(l.ARRAY_BUFFER,v,m)}if(D){for(u=0;u<t;u++)w=r[u],p=u*3,z[p]=w.r,z[p+1]=w.g,z[p+2]=w.b;l.bindBuffer(l.ARRAY_BUFFER,y.__webglColorBuffer);l.bufferData(l.ARRAY_BUFFER,z,m)}if(C)for(E=0,W=C.length;E<W;E++)if(ea=C[E],ea.needsUpdate&&(ea.boundTo===void 0||ea.boundTo==="vertices")){p=0;T=ea.value.length;if(ea.size===1)for(G=0;G<T;G++)ea.array[G]=ea.value[G];else if(ea.size===2)for(G=0;G<T;G++)fa=ea.value[G],ea.array[p]=fa.x,ea.array[p+1]=fa.y,p+=2;else if(ea.size===3)if(ea.type==="c")for(G=
0;G<T;G++)fa=ea.value[G],ea.array[p]=fa.r,ea.array[p+1]=fa.g,ea.array[p+2]=fa.b,p+=3;else for(G=0;G<T;G++)fa=ea.value[G],ea.array[p]=fa.x,ea.array[p+1]=fa.y,ea.array[p+2]=fa.z,p+=3;else if(ea.size===4)for(G=0;G<T;G++)fa=ea.value[G],ea.array[p]=fa.x,ea.array[p+1]=fa.y,ea.array[p+2]=fa.z,ea.array[p+3]=fa.w,p+=4;l.bindBuffer(l.ARRAY_BUFFER,ea.buffer);l.bufferData(l.ARRAY_BUFFER,ea.array,m)}}i.__dirtyVertices=!1;i.__dirtyColors=!1;j.attributes&&n(j)}else if(y instanceof THREE.ParticleSystem)j=c(y,r),
t=j.attributes&&q(j),(i.__dirtyVertices||i.__dirtyColors||y.sortParticles||t)&&g(i,l.DYNAMIC_DRAW,y),i.__dirtyVertices=!1,i.__dirtyColors=!1,j.attributes&&n(j)};this.initMaterial=function(a,b,c,d){var f,e,g,h,i;a instanceof THREE.MeshDepthMaterial?i="depth":a instanceof THREE.MeshNormalMaterial?i="normal":a instanceof THREE.MeshBasicMaterial?i="basic":a instanceof THREE.MeshLambertMaterial?i="lambert":a instanceof THREE.MeshPhongMaterial?i="phong":a instanceof THREE.LineBasicMaterial?i="basic":a instanceof
THREE.ParticleBasicMaterial&&(i="particle_basic");if(i){var j=THREE.ShaderLib[i];a.uniforms=THREE.UniformsUtils.clone(j.uniforms);a.vertexShader=j.vertexShader;a.fragmentShader=j.fragmentShader}var k,m;e=j=0;for(k=0,m=b.length;k<m;k++)f=b[k],f.onlyShadow||(f instanceof THREE.DirectionalLight&&e++,f instanceof THREE.PointLight&&j++,f instanceof THREE.SpotLight&&j++);j+e<=S?k=e:(k=Math.ceil(S*e/(j+e)),j=S-k);f=k;e=j;var n=0;for(j=0,k=b.length;j<k;j++)m=b[j],m.castShadow&&(m instanceof THREE.SpotLight&&
n++,m instanceof THREE.DirectionalLight&&!m.shadowCascade&&n++);var q=50;if(d!==void 0&&d instanceof THREE.SkinnedMesh)q=d.bones.length;var o;a:{k=a.fragmentShader;m=a.vertexShader;var j=a.uniforms,b=a.attributes,c={map:!!a.map,envMap:!!a.envMap,lightMap:!!a.lightMap,vertexColors:a.vertexColors,fog:c,useFog:a.fog,sizeAttenuation:a.sizeAttenuation,skinning:a.skinning,morphTargets:a.morphTargets,morphNormals:a.morphNormals,maxMorphTargets:this.maxMorphTargets,maxMorphNormals:this.maxMorphNormals,maxDirLights:f,
maxPointLights:e,maxBones:q,shadowMapEnabled:this.shadowMapEnabled&&d.receiveShadow,shadowMapSoft:this.shadowMapSoft,shadowMapDebug:this.shadowMapDebug,shadowMapCascade:this.shadowMapCascade,maxShadows:n,alphaTest:a.alphaTest,metal:a.metal,perPixel:a.perPixel,wrapAround:a.wrapAround,doubleSided:d&&d.doubleSided},s,d=[];i?d.push(i):(d.push(k),d.push(m));for(s in c)d.push(s),d.push(c[s]);i=d.join();for(s=0,d=V.length;s<d;s++)if(V[s].code===i){o=V[s].program;break a}s=l.createProgram();d=["precision mediump float;",
ja>0?"#define VERTEX_TEXTURES":"",A.gammaInput?"#define GAMMA_INPUT":"",A.gammaOutput?"#define GAMMA_OUTPUT":"",A.physicallyBasedShading?"#define PHYSICALLY_BASED_SHADING":"","#define MAX_DIR_LIGHTS "+c.maxDirLights,"#define MAX_POINT_LIGHTS "+c.maxPointLights,"#define MAX_SHADOWS "+c.maxShadows,"#define MAX_BONES "+c.maxBones,c.map?"#define USE_MAP":"",c.envMap?"#define USE_ENVMAP":"",c.lightMap?"#define USE_LIGHTMAP":"",c.vertexColors?"#define USE_COLOR":"",c.skinning?"#define USE_SKINNING":"",
c.morphTargets?"#define USE_MORPHTARGETS":"",c.morphNormals?"#define USE_MORPHNORMALS":"",c.perPixel?"#define PHONG_PER_PIXEL":"",c.wrapAround?"#define WRAP_AROUND":"",c.doubleSided?"#define DOUBLE_SIDED":"",c.shadowMapEnabled?"#define USE_SHADOWMAP":"",c.shadowMapSoft?"#define SHADOWMAP_SOFT":"",c.shadowMapDebug?"#define SHADOWMAP_DEBUG":"",c.shadowMapCascade?"#define SHADOWMAP_CASCADE":"",c.sizeAttenuation?"#define USE_SIZEATTENUATION":"","uniform mat4 objectMatrix;\nuniform mat4 modelViewMatrix;\nuniform mat4 projectionMatrix;\nuniform mat4 viewMatrix;\nuniform mat3 normalMatrix;\nuniform vec3 cameraPosition;\nattribute vec3 position;\nattribute vec3 normal;\nattribute vec2 uv;\nattribute vec2 uv2;\n#ifdef USE_COLOR\nattribute vec3 color;\n#endif\n#ifdef USE_MORPHTARGETS\nattribute vec3 morphTarget0;\nattribute vec3 morphTarget1;\nattribute vec3 morphTarget2;\nattribute vec3 morphTarget3;\n#ifdef USE_MORPHNORMALS\nattribute vec3 morphNormal0;\nattribute vec3 morphNormal1;\nattribute vec3 morphNormal2;\nattribute vec3 morphNormal3;\n#else\nattribute vec3 morphTarget4;\nattribute vec3 morphTarget5;\nattribute vec3 morphTarget6;\nattribute vec3 morphTarget7;\n#endif\n#endif\n#ifdef USE_SKINNING\nattribute vec4 skinVertexA;\nattribute vec4 skinVertexB;\nattribute vec4 skinIndex;\nattribute vec4 skinWeight;\n#endif\n"].join("\n");
f=["precision "+D+" float;","#define MAX_DIR_LIGHTS "+c.maxDirLights,"#define MAX_POINT_LIGHTS "+c.maxPointLights,"#define MAX_SHADOWS "+c.maxShadows,c.alphaTest?"#define ALPHATEST "+c.alphaTest:"",A.gammaInput?"#define GAMMA_INPUT":"",A.gammaOutput?"#define GAMMA_OUTPUT":"",A.physicallyBasedShading?"#define PHYSICALLY_BASED_SHADING":"",c.useFog&&c.fog?"#define USE_FOG":"",c.useFog&&c.fog instanceof THREE.FogExp2?"#define FOG_EXP2":"",c.map?"#define USE_MAP":"",c.envMap?"#define USE_ENVMAP":"",c.lightMap?
"#define USE_LIGHTMAP":"",c.vertexColors?"#define USE_COLOR":"",c.metal?"#define METAL":"",c.perPixel?"#define PHONG_PER_PIXEL":"",c.wrapAround?"#define WRAP_AROUND":"",c.doubleSided?"#define DOUBLE_SIDED":"",c.shadowMapEnabled?"#define USE_SHADOWMAP":"",c.shadowMapSoft?"#define SHADOWMAP_SOFT":"",c.shadowMapDebug?"#define SHADOWMAP_DEBUG":"",c.shadowMapCascade?"#define SHADOWMAP_CASCADE":"","uniform mat4 viewMatrix;\nuniform vec3 cameraPosition;\n"].join("\n");l.attachShader(s,t("fragment",f+k));
l.attachShader(s,t("vertex",d+m));l.linkProgram(s);l.getProgramParameter(s,l.LINK_STATUS)||console.error("Could not initialise shader\nVALIDATE_STATUS: "+l.getProgramParameter(s,l.VALIDATE_STATUS)+", gl error ["+l.getError()+"]");s.uniforms={};s.attributes={};var p,d="viewMatrix,modelViewMatrix,projectionMatrix,normalMatrix,objectMatrix,cameraPosition,boneGlobalMatrices,morphTargetInfluences".split(",");for(p in j)d.push(p);p=d;for(d=0,j=p.length;d<j;d++)k=p[d],s.uniforms[k]=l.getUniformLocation(s,
k);d="position,normal,uv,uv2,tangent,color,skinVertexA,skinVertexB,skinIndex,skinWeight".split(",");for(p=0;p<c.maxMorphTargets;p++)d.push("morphTarget"+p);for(p=0;p<c.maxMorphNormals;p++)d.push("morphNormal"+p);for(o in b)d.push(o);o=d;for(p=0,b=o.length;p<b;p++)c=o[p],s.attributes[c]=l.getAttribLocation(s,c);s.id=V.length;V.push({program:s,code:i});A.info.memory.programs=V.length;o=s}a.program=o;o=a.program.attributes;o.position>=0&&l.enableVertexAttribArray(o.position);o.color>=0&&l.enableVertexAttribArray(o.color);
o.normal>=0&&l.enableVertexAttribArray(o.normal);o.tangent>=0&&l.enableVertexAttribArray(o.tangent);a.skinning&&o.skinVertexA>=0&&o.skinVertexB>=0&&o.skinIndex>=0&&o.skinWeight>=0&&(l.enableVertexAttribArray(o.skinVertexA),l.enableVertexAttribArray(o.skinVertexB),l.enableVertexAttribArray(o.skinIndex),l.enableVertexAttribArray(o.skinWeight));if(a.attributes)for(h in a.attributes)o[h]!==void 0&&o[h]>=0&&l.enableVertexAttribArray(o[h]);if(a.morphTargets){a.numSupportedMorphTargets=0;s="morphTarget";
for(h=0;h<this.maxMorphTargets;h++)p=s+h,o[p]>=0&&(l.enableVertexAttribArray(o[p]),a.numSupportedMorphTargets++)}if(a.morphNormals){a.numSupportedMorphNormals=0;s="morphNormal";for(h=0;h<this.maxMorphNormals;h++)p=s+h,o[p]>=0&&(l.enableVertexAttribArray(o[p]),a.numSupportedMorphNormals++)}a.uniformsList=[];for(g in a.uniforms)a.uniformsList.push([a.uniforms[g],g])};this.setFaceCulling=function(a,b){a?(!b||b==="ccw"?l.frontFace(l.CCW):l.frontFace(l.CW),a==="back"?l.cullFace(l.BACK):a==="front"?l.cullFace(l.FRONT):
l.cullFace(l.FRONT_AND_BACK),l.enable(l.CULL_FACE)):l.disable(l.CULL_FACE)};this.setObjectFaces=function(a){if(aa!==a.doubleSided)a.doubleSided?l.disable(l.CULL_FACE):l.enable(l.CULL_FACE),aa=a.doubleSided;if(Z!==a.flipSided)a.flipSided?l.frontFace(l.CW):l.frontFace(l.CCW),Z=a.flipSided};this.setDepthTest=function(a){U!==a&&(a?l.enable(l.DEPTH_TEST):l.disable(l.DEPTH_TEST),U=a)};this.setDepthWrite=function(a){Y!==a&&(l.depthMask(a),Y=a)};this.setBlending=function(a){if(a!==X){switch(a){case THREE.NoBlending:l.disable(l.BLEND);
break;case THREE.AdditiveBlending:l.enable(l.BLEND);l.blendEquation(l.FUNC_ADD);l.blendFunc(l.SRC_ALPHA,l.ONE);break;case THREE.SubtractiveBlending:l.enable(l.BLEND);l.blendEquation(l.FUNC_ADD);l.blendFunc(l.ZERO,l.ONE_MINUS_SRC_COLOR);break;case THREE.MultiplyBlending:l.enable(l.BLEND);l.blendEquation(l.FUNC_ADD);l.blendFunc(l.ZERO,l.SRC_COLOR);break;default:l.enable(l.BLEND),l.blendEquationSeparate(l.FUNC_ADD,l.FUNC_ADD),l.blendFuncSeparate(l.SRC_ALPHA,l.ONE_MINUS_SRC_ALPHA,l.ONE,l.ONE_MINUS_SRC_ALPHA)}X=
a}};this.setTexture=function(a,b){if(a.needsUpdate){if(!a.__webglInit)a.__webglInit=!0,a.__webglTexture=l.createTexture(),A.info.memory.textures++;l.activeTexture(l.TEXTURE0+b);l.bindTexture(l.TEXTURE_2D,a.__webglTexture);var c=a.image,d=(c.width&c.width-1)===0&&(c.height&c.height-1)===0,f=y(a.format),e=y(a.type);v(l.TEXTURE_2D,a,d);a instanceof THREE.DataTexture?l.texImage2D(l.TEXTURE_2D,0,f,c.width,c.height,0,f,e,c.data):l.texImage2D(l.TEXTURE_2D,0,f,f,e,a.image);a.generateMipmaps&&d&&l.generateMipmap(l.TEXTURE_2D);
a.needsUpdate=!1;if(a.onUpdate)a.onUpdate()}else l.activeTexture(l.TEXTURE0+b),l.bindTexture(l.TEXTURE_2D,a.__webglTexture)};this.setRenderTarget=function(a){var b=a instanceof THREE.WebGLRenderTargetCube;if(a&&!a.__webglFramebuffer){if(a.depthBuffer===void 0)a.depthBuffer=!0;if(a.stencilBuffer===void 0)a.stencilBuffer=!0;a.__webglTexture=l.createTexture();var c=(a.width&a.width-1)===0&&(a.height&a.height-1)===0,d=y(a.format),f=y(a.type);if(b){a.__webglFramebuffer=[];a.__webglRenderbuffer=[];l.bindTexture(l.TEXTURE_CUBE_MAP,
a.__webglTexture);v(l.TEXTURE_CUBE_MAP,a,c);for(c=0;c<6;c++){a.__webglFramebuffer[c]=l.createFramebuffer();a.__webglRenderbuffer[c]=l.createRenderbuffer();l.texImage2D(l.TEXTURE_CUBE_MAP_POSITIVE_X+c,0,d,a.width,a.height,0,d,f,null);var e=a,g=l.TEXTURE_CUBE_MAP_POSITIVE_X+c;l.bindFramebuffer(l.FRAMEBUFFER,a.__webglFramebuffer[c]);l.framebufferTexture2D(l.FRAMEBUFFER,l.COLOR_ATTACHMENT0,g,e.__webglTexture,0);u(a.__webglRenderbuffer[c],a)}}else a.__webglFramebuffer=l.createFramebuffer(),a.__webglRenderbuffer=
l.createRenderbuffer(),l.bindTexture(l.TEXTURE_2D,a.__webglTexture),v(l.TEXTURE_2D,a,c),l.texImage2D(l.TEXTURE_2D,0,d,a.width,a.height,0,d,f,null),d=l.TEXTURE_2D,l.bindFramebuffer(l.FRAMEBUFFER,a.__webglFramebuffer),l.framebufferTexture2D(l.FRAMEBUFFER,l.COLOR_ATTACHMENT0,d,a.__webglTexture,0),u(a.__webglRenderbuffer,a);b?l.bindTexture(l.TEXTURE_CUBE_MAP,null):l.bindTexture(l.TEXTURE_2D,null);l.bindRenderbuffer(l.RENDERBUFFER,null);l.bindFramebuffer(l.FRAMEBUFFER,null)}a?(b=b?a.__webglFramebuffer[a.activeCubeFace]:
a.__webglFramebuffer,d=a.width,a=a.height,c=f=0):(b=null,d=ka,a=Ea,f=qa,c=ha);b!==z&&(l.bindFramebuffer(l.FRAMEBUFFER,b),l.viewport(f,c,d,a),z=b);Aa=d;ya=a};this.shadowMapPlugin=new THREE.ShadowMapPlugin;this.addPrePlugin(this.shadowMapPlugin);this.addPostPlugin(new THREE.SpritePlugin);this.addPostPlugin(new THREE.LensFlarePlugin)};
THREE.WebGLRenderTarget=function(a,b,c){this.width=a;this.height=b;c=c||{};this.wrapS=c.wrapS!==void 0?c.wrapS:THREE.ClampToEdgeWrapping;this.wrapT=c.wrapT!==void 0?c.wrapT:THREE.ClampToEdgeWrapping;this.magFilter=c.magFilter!==void 0?c.magFilter:THREE.LinearFilter;this.minFilter=c.minFilter!==void 0?c.minFilter:THREE.LinearMipMapLinearFilter;this.offset=new THREE.Vector2(0,0);this.repeat=new THREE.Vector2(1,1);this.format=c.format!==void 0?c.format:THREE.RGBAFormat;this.type=c.type!==void 0?c.type:
THREE.UnsignedByteType;this.depthBuffer=c.depthBuffer!==void 0?c.depthBuffer:!0;this.stencilBuffer=c.stencilBuffer!==void 0?c.stencilBuffer:!0;this.generateMipmaps=!0};
THREE.WebGLRenderTarget.prototype.clone=function(){var a=new THREE.WebGLRenderTarget(this.width,this.height);a.wrapS=this.wrapS;a.wrapT=this.wrapT;a.magFilter=this.magFilter;a.minFilter=this.minFilter;a.offset.copy(this.offset);a.repeat.copy(this.repeat);a.format=this.format;a.type=this.type;a.depthBuffer=this.depthBuffer;a.stencilBuffer=this.stencilBuffer;return a};THREE.WebGLRenderTargetCube=function(a,b,c){THREE.WebGLRenderTarget.call(this,a,b,c);this.activeCubeFace=0};
THREE.WebGLRenderTargetCube.prototype=new THREE.WebGLRenderTarget;THREE.WebGLRenderTargetCube.prototype.constructor=THREE.WebGLRenderTargetCube;THREE.RenderableVertex=function(){this.positionWorld=new THREE.Vector3;this.positionScreen=new THREE.Vector4;this.visible=!0};THREE.RenderableVertex.prototype.copy=function(a){this.positionWorld.copy(a.positionWorld);this.positionScreen.copy(a.positionScreen)};
THREE.RenderableFace3=function(){this.v1=new THREE.RenderableVertex;this.v2=new THREE.RenderableVertex;this.v3=new THREE.RenderableVertex;this.centroidWorld=new THREE.Vector3;this.centroidScreen=new THREE.Vector3;this.normalWorld=new THREE.Vector3;this.vertexNormalsWorld=[new THREE.Vector3,new THREE.Vector3,new THREE.Vector3];this.faceMaterial=this.material=null;this.uvs=[[]];this.z=null};
THREE.RenderableFace4=function(){this.v1=new THREE.RenderableVertex;this.v2=new THREE.RenderableVertex;this.v3=new THREE.RenderableVertex;this.v4=new THREE.RenderableVertex;this.centroidWorld=new THREE.Vector3;this.centroidScreen=new THREE.Vector3;this.normalWorld=new THREE.Vector3;this.vertexNormalsWorld=[new THREE.Vector3,new THREE.Vector3,new THREE.Vector3,new THREE.Vector3];this.faceMaterial=this.material=null;this.uvs=[[]];this.z=null};THREE.RenderableObject=function(){this.z=this.object=null};
THREE.RenderableParticle=function(){this.rotation=this.z=this.y=this.x=null;this.scale=new THREE.Vector2;this.material=null};THREE.RenderableLine=function(){this.z=null;this.v1=new THREE.RenderableVertex;this.v2=new THREE.RenderableVertex;this.material=null};
THREE.ColorUtils={adjustHSV:function(a,b,c,d){var f=THREE.ColorUtils.__hsv;THREE.ColorUtils.rgbToHsv(a,f);f.h=THREE.Math.clamp(f.h+b,0,1);f.s=THREE.Math.clamp(f.s+c,0,1);f.v=THREE.Math.clamp(f.v+d,0,1);a.setHSV(f.h,f.s,f.v)},rgbToHsv:function(a,b){var c=a.r,d=a.g,f=a.b,g=Math.max(Math.max(c,d),f),e=Math.min(Math.min(c,d),f);if(e===g)e=c=0;else{var h=g-e,e=h/g,c=c===g?(d-f)/h:d===g?2+(f-c)/h:4+(c-d)/h;c/=6;c<0&&(c+=1);c>1&&(c-=1)}b===void 0&&(b={h:0,s:0,v:0});b.h=c;b.s=e;b.v=g;return b}};
THREE.ColorUtils.__hsv={h:0,s:0,v:0};
THREE.GeometryUtils={merge:function(a,b){for(var c,d,f=a.vertices.length,g=b instanceof THREE.Mesh?b.geometry:b,e=a.vertices,h=g.vertices,i=a.faces,j=g.faces,k=a.faceVertexUvs[0],q=g.faceVertexUvs[0],n={},o=0;o<a.materials.length;o++)n[a.materials[o].id]=o;if(b instanceof THREE.Mesh)b.matrixAutoUpdate&&b.updateMatrix(),c=b.matrix,d=new THREE.Matrix4,d.extractRotation(c,b.scale);for(var o=0,s=h.length;o<s;o++){var m=h[o].clone();c&&c.multiplyVector3(m.position);e.push(m)}for(o=0,s=j.length;o<s;o++){var e=
j[o],p,r,t=e.vertexNormals,v=e.vertexColors;e instanceof THREE.Face3?p=new THREE.Face3(e.a+f,e.b+f,e.c+f):e instanceof THREE.Face4&&(p=new THREE.Face4(e.a+f,e.b+f,e.c+f,e.d+f));p.normal.copy(e.normal);d&&d.multiplyVector3(p.normal);h=0;for(m=t.length;h<m;h++)r=t[h].clone(),d&&d.multiplyVector3(r),p.vertexNormals.push(r);p.color.copy(e.color);h=0;for(m=v.length;h<m;h++)r=v[h],p.vertexColors.push(r.clone());if(e.materialIndex!==void 0){h=g.materials[e.materialIndex];m=h.id;v=n[m];if(v===void 0)v=a.materials.length,
n[m]=v,a.materials.push(h);p.materialIndex=v}p.centroid.copy(e.centroid);c&&c.multiplyVector3(p.centroid);i.push(p)}for(o=0,s=q.length;o<s;o++){c=q[o];d=[];h=0;for(m=c.length;h<m;h++)d.push(new THREE.UV(c[h].u,c[h].v));k.push(d)}},clone:function(a){var b=new THREE.Geometry,c,d=a.vertices,f=a.faces,g=a.faceVertexUvs[0];if(a.materials)b.materials=a.materials.slice();for(a=0,c=d.length;a<c;a++)b.vertices.push(d[a].clone());for(a=0,c=f.length;a<c;a++)b.faces.push(f[a].clone());for(a=0,c=g.length;a<c;a++){for(var d=
g[a],f=[],e=0,h=d.length;e<h;e++)f.push(new THREE.UV(d[e].u,d[e].v));b.faceVertexUvs[0].push(f)}return b},randomPointInTriangle:function(a,b,c){var d,f,g,e=new THREE.Vector3,h=THREE.GeometryUtils.__v1;d=THREE.GeometryUtils.random();f=THREE.GeometryUtils.random();d+f>1&&(d=1-d,f=1-f);g=1-d-f;e.copy(a);e.multiplyScalar(d);h.copy(b);h.multiplyScalar(f);e.addSelf(h);h.copy(c);h.multiplyScalar(g);e.addSelf(h);return e},randomPointInFace:function(a,b,c){var d,f,g;if(a instanceof THREE.Face3)return d=b.vertices[a.a].position,
f=b.vertices[a.b].position,g=b.vertices[a.c].position,THREE.GeometryUtils.randomPointInTriangle(d,f,g);else if(a instanceof THREE.Face4){d=b.vertices[a.a].position;f=b.vertices[a.b].position;g=b.vertices[a.c].position;var b=b.vertices[a.d].position,e;c?a._area1&&a._area2?(c=a._area1,e=a._area2):(c=THREE.GeometryUtils.triangleArea(d,f,b),e=THREE.GeometryUtils.triangleArea(f,g,b),a._area1=c,a._area2=e):(c=THREE.GeometryUtils.triangleArea(d,f,b),e=THREE.GeometryUtils.triangleArea(f,g,b));return THREE.GeometryUtils.random()*
(c+e)<c?THREE.GeometryUtils.randomPointInTriangle(d,f,b):THREE.GeometryUtils.randomPointInTriangle(f,g,b)}},randomPointsInGeometry:function(a,b){function c(a){function b(c,d){if(d<c)return c;var f=c+Math.floor((d-c)/2);return j[f]>a?b(c,f-1):j[f]<a?b(f+1,d):f}return b(0,j.length-1)}var d,f,g=a.faces,e=a.vertices,h=g.length,i=0,j=[],k,q,n,o;for(f=0;f<h;f++){d=g[f];if(d instanceof THREE.Face3)k=e[d.a].position,q=e[d.b].position,n=e[d.c].position,d._area=THREE.GeometryUtils.triangleArea(k,q,n);else if(d instanceof
THREE.Face4)k=e[d.a].position,q=e[d.b].position,n=e[d.c].position,o=e[d.d].position,d._area1=THREE.GeometryUtils.triangleArea(k,q,o),d._area2=THREE.GeometryUtils.triangleArea(q,n,o),d._area=d._area1+d._area2;i+=d._area;j[f]=i}d=[];e={};for(f=0;f<b;f++)h=THREE.GeometryUtils.random()*i,h=c(h),d[f]=THREE.GeometryUtils.randomPointInFace(g[h],a,!0),e[h]?e[h]+=1:e[h]=1;return d},triangleArea:function(a,b,c){var d,f=THREE.GeometryUtils.__v1;f.sub(a,b);d=f.length();f.sub(a,c);a=f.length();f.sub(b,c);c=f.length();
b=0.5*(d+a+c);return Math.sqrt(b*(b-d)*(b-a)*(b-c))},center:function(a){a.computeBoundingBox();var b=a.boundingBox,c=new THREE.Vector3;c.add(b.min,b.max);c.multiplyScalar(-0.5);a.applyMatrix((new THREE.Matrix4).setTranslation(c.x,c.y,c.z));a.computeBoundingBox();return c},normalizeUVs:function(a){for(var a=a.faceVertexUvs[0],b=0,c=a.length;b<c;b++)for(var d=a[b],f=0,g=d.length;f<g;f++)d[f].u!==1&&(d[f].u-=Math.floor(d[f].u)),d[f].v!==1&&(d[f].v-=Math.floor(d[f].v))},triangulateQuads:function(a){for(var b=
a.faces.length-1;b>=0;b--){var c=a.faces[b];if(c instanceof THREE.Face4){var d=c.a,f=c.b,g=c.c,e=c.d,h=c.clone(),c=c.clone();h.a=d;h.b=f;h.c=e;c.a=f;c.b=g;c.c=e;a.faces.splice(b,1,h,c);for(d=0;d<a.faceVertexUvs.length;d++)a.faceVertexUvs[d].length&&(h=a.faceVertexUvs[d][b],f=h[1],g=h[2],e=h[3],h=[h[0].clone(),f.clone(),e.clone()],f=[f.clone(),g.clone(),e.clone()],a.faceVertexUvs[d].splice(b,1,h,f));for(d=0;d<a.faceUvs.length;d++)a.faceUvs[d].length&&(f=a.faceUvs[d][b],a.faceUvs[d].splice(b,1,f,f))}}a.computeCentroids();
a.computeFaceNormals();a.computeVertexNormals();a.hasTangents&&a.computeTangents()},explode:function(a){for(var b=[],c=0,d=a.faces.length;c<d;c++){var f=b.length,g=a.faces[c];if(g instanceof THREE.Face4){var e=g.a,h=g.b,i=g.c,e=a.vertices[e],h=a.vertices[h],i=a.vertices[i],j=a.vertices[g.d];b.push(e.clone());b.push(h.clone());b.push(i.clone());b.push(j.clone());g.a=f;g.b=f+1;g.c=f+2;g.d=f+3}else e=g.a,h=g.b,i=g.c,e=a.vertices[e],h=a.vertices[h],i=a.vertices[i],b.push(e.clone()),b.push(h.clone()),
b.push(i.clone()),g.a=f,g.b=f+1,g.c=f+2}a.vertices=b},tessellate:function(a,b){var c,d,f,g,e,h,i,j,k,q,n,o,s,m,p,r,t;for(c=a.faces.length-1;c>=0;c--)if(d=a.faces[c],d instanceof THREE.Face3){if(f=d.a,g=d.b,e=d.c,i=a.vertices[f],j=a.vertices[g],k=a.vertices[e],n=i.position.distanceTo(j.position),o=j.position.distanceTo(k.position),q=i.position.distanceTo(k.position),n>b||o>b||q>b){h=a.vertices.length;t=d.clone();d=d.clone();n>=o&&n>=q?(i=i.clone(),i.position.lerpSelf(j.position,0.5),t.a=f,t.b=h,t.c=
e,d.a=h,d.b=g,d.c=e,f=0):o>=n&&o>=q?(i=j.clone(),i.position.lerpSelf(k.position,0.5),t.a=f,t.b=g,t.c=h,d.a=h,d.b=e,d.c=f,f=1):(i=i.clone(),i.position.lerpSelf(k.position,0.5),t.a=f,t.b=g,t.c=h,d.a=h,d.b=g,d.c=e,f=2);a.faces.splice(c,1,t,d);a.vertices.push(i);for(g=0;g<a.faceVertexUvs.length;g++)a.faceVertexUvs[g].length&&(k=a.faceVertexUvs[g][c],j=k[0],e=k[1],i=k[2],f===0?(n=j.clone(),n.lerpSelf(e,0.5),k=[j.clone(),n.clone(),i.clone()],e=[n.clone(),e.clone(),i.clone()]):f===1?(n=e.clone(),n.lerpSelf(i,
0.5),k=[j.clone(),e.clone(),n.clone()],e=[n.clone(),i.clone(),j.clone()]):(n=j.clone(),n.lerpSelf(i,0.5),k=[j.clone(),e.clone(),n.clone()],e=[n.clone(),e.clone(),i.clone()]),a.faceVertexUvs[g].splice(c,1,k,e))}}else if(f=d.a,g=d.b,e=d.c,h=d.d,i=a.vertices[f],j=a.vertices[g],k=a.vertices[e],q=a.vertices[h],n=i.position.distanceTo(j.position),o=j.position.distanceTo(k.position),s=k.position.distanceTo(q.position),m=i.position.distanceTo(q.position),n>b||o>b||s>b||m>b){p=a.vertices.length;r=a.vertices.length+
1;t=d.clone();d=d.clone();n>=o&&n>=s&&n>=m||s>=o&&s>=n&&s>=m?(n=i.clone(),n.position.lerpSelf(j.position,0.5),j=k.clone(),j.position.lerpSelf(q.position,0.5),t.a=f,t.b=p,t.c=r,t.d=h,d.a=p,d.b=g,d.c=e,d.d=r,f=0):(n=j.clone(),n.position.lerpSelf(k.position,0.5),j=q.clone(),j.position.lerpSelf(i.position,0.5),t.a=f,t.b=g,t.c=p,t.d=r,d.a=r,d.b=p,d.c=e,d.d=h,f=1);a.faces.splice(c,1,t,d);a.vertices.push(n);a.vertices.push(j);for(g=0;g<a.faceVertexUvs.length;g++)a.faceVertexUvs[g].length&&(k=a.faceVertexUvs[g][c],
j=k[0],e=k[1],i=k[2],k=k[3],f===0?(n=j.clone(),n.lerpSelf(e,0.5),o=i.clone(),o.lerpSelf(k,0.5),j=[j.clone(),n.clone(),o.clone(),k.clone()],e=[n.clone(),e.clone(),i.clone(),o.clone()]):(n=e.clone(),n.lerpSelf(i,0.5),o=k.clone(),o.lerpSelf(j,0.5),j=[j.clone(),e.clone(),n.clone(),o.clone()],e=[o.clone(),n.clone(),i.clone(),k.clone()]),a.faceVertexUvs[g].splice(c,1,j,e))}}};THREE.GeometryUtils.random=THREE.Math.random16;THREE.GeometryUtils.__v1=new THREE.Vector3;
THREE.ImageUtils={crossOrigin:"anonymous",loadTexture:function(a,b,c){var d=new Image,f=new THREE.Texture(d,b);d.onload=function(){f.needsUpdate=!0;c&&c(this)};d.crossOrigin=this.crossOrigin;d.src=a;return f},loadTextureCube:function(a,b,c){var d,f=[],g=new THREE.Texture(f,b);f.loadCount=0;for(b=0,d=a.length;b<d;++b)f[b]=new Image,f[b].onload=function(){f.loadCount+=1;if(f.loadCount===6)g.needsUpdate=!0;c&&c(this)},f[b].crossOrigin=this.crossOrigin,f[b].src=a[b];return g},getNormalMap:function(a,
b){var c=function(a){var b=Math.sqrt(a[0]*a[0]+a[1]*a[1]+a[2]*a[2]);return[a[0]/b,a[1]/b,a[2]/b]};b|=1;var d=a.width,f=a.height,g=document.createElement("canvas");g.width=d;g.height=f;var e=g.getContext("2d");e.drawImage(a,0,0);for(var h=e.getImageData(0,0,d,f).data,i=e.createImageData(d,f),j=i.data,k=0;k<d;k++)for(var q=1;q<f;q++){var n=q-1<0?f-1:q-1,o=(q+1)%f,s=k-1<0?d-1:k-1,m=(k+1)%d,p=[],r=[0,0,h[(q*d+k)*4]/255*b];p.push([-1,0,h[(q*d+s)*4]/255*b]);p.push([-1,-1,h[(n*d+s)*4]/255*b]);p.push([0,
-1,h[(n*d+k)*4]/255*b]);p.push([1,-1,h[(n*d+m)*4]/255*b]);p.push([1,0,h[(q*d+m)*4]/255*b]);p.push([1,1,h[(o*d+m)*4]/255*b]);p.push([0,1,h[(o*d+k)*4]/255*b]);p.push([-1,1,h[(o*d+s)*4]/255*b]);n=[];s=p.length;for(o=0;o<s;o++){var m=p[o],t=p[(o+1)%s],m=[m[0]-r[0],m[1]-r[1],m[2]-r[2]],t=[t[0]-r[0],t[1]-r[1],t[2]-r[2]];n.push(c([m[1]*t[2]-m[2]*t[1],m[2]*t[0]-m[0]*t[2],m[0]*t[1]-m[1]*t[0]]))}p=[0,0,0];for(o=0;o<n.length;o++)p[0]+=n[o][0],p[1]+=n[o][1],p[2]+=n[o][2];p[0]/=n.length;p[1]/=n.length;p[2]/=n.length;
r=(q*d+k)*4;j[r]=(p[0]+1)/2*255|0;j[r+1]=(p[1]+0.5)*255|0;j[r+2]=p[2]*255|0;j[r+3]=255}e.putImageData(i,0,0);return g},generateDataTexture:function(a,b,c){for(var d=a*b,f=new Uint8Array(3*d),g=Math.floor(c.r*255),e=Math.floor(c.g*255),c=Math.floor(c.b*255),h=0;h<d;h++)f[h*3]=g,f[h*3+1]=e,f[h*3+2]=c;a=new THREE.DataTexture(f,a,b,THREE.RGBFormat);a.needsUpdate=!0;return a}};
THREE.SceneUtils={showHierarchy:function(a,b){THREE.SceneUtils.traverseHierarchy(a,function(a){a.visible=b})},traverseHierarchy:function(a,b){var c,d,f=a.children.length;for(d=0;d<f;d++)c=a.children[d],b(c),THREE.SceneUtils.traverseHierarchy(c,b)},createMultiMaterialObject:function(a,b){var c,d=b.length,f=new THREE.Object3D;for(c=0;c<d;c++){var g=new THREE.Mesh(a,b[c]);f.add(g)}return f},cloneObject:function(a){var b;a instanceof THREE.MorphAnimMesh?(b=new THREE.MorphAnimMesh(a.geometry,a.material),
b.duration=a.duration,b.mirroredLoop=a.mirroredLoop,b.time=a.time,b.lastKeyframe=a.lastKeyframe,b.currentKeyframe=a.currentKeyframe,b.direction=a.direction,b.directionBackwards=a.directionBackwards):a instanceof THREE.SkinnedMesh?b=new THREE.SkinnedMesh(a.geometry,a.material):a instanceof THREE.Mesh?b=new THREE.Mesh(a.geometry,a.material):a instanceof THREE.Line?b=new THREE.Line(a.geometry,a.material,a.type):a instanceof THREE.Ribbon?b=new THREE.Ribbon(a.geometry,a.material):a instanceof THREE.ParticleSystem?
(b=new THREE.ParticleSystem(a.geometry,a.material),b.sortParticles=a.sortParticles):a instanceof THREE.Particle?b=new THREE.Particle(a.material):a instanceof THREE.Sprite?(b=new THREE.Sprite({}),b.color.copy(a.color),b.map=a.map,b.blending=a.blending,b.useScreenCoordinates=a.useScreenCoordinates,b.mergeWith3D=a.mergeWith3D,b.affectedByDistance=a.affectedByDistance,b.scaleByViewport=a.scaleByViewport,b.alignment=a.alignment,b.rotation3d.copy(a.rotation3d),b.rotation=a.rotation,b.opacity=a.opacity,
b.uvOffset.copy(a.uvOffset),b.uvScale.copy(a.uvScale)):a instanceof THREE.LOD?b=new THREE.LOD:a instanceof THREE.MarchingCubes?(b=new THREE.MarchingCubes(a.resolution,a.material),b.field.set(a.field),b.isolation=a.isolation):a instanceof THREE.Object3D&&(b=new THREE.Object3D);b.name=a.name;b.parent=a.parent;b.up.copy(a.up);b.position.copy(a.position);b.rotation instanceof THREE.Vector3&&b.rotation.copy(a.rotation);b.eulerOrder=a.eulerOrder;b.scale.copy(a.scale);b.dynamic=a.dynamic;b.doubleSided=a.doubleSided;
b.flipSided=a.flipSided;b.renderDepth=a.renderDepth;b.rotationAutoUpdate=a.rotationAutoUpdate;b.matrix.copy(a.matrix);b.matrixWorld.copy(a.matrixWorld);b.matrixRotationWorld.copy(a.matrixRotationWorld);b.matrixAutoUpdate=a.matrixAutoUpdate;b.matrixWorldNeedsUpdate=a.matrixWorldNeedsUpdate;b.quaternion.copy(a.quaternion);b.useQuaternion=a.useQuaternion;b.boundRadius=a.boundRadius;b.boundRadiusScale=a.boundRadiusScale;b.visible=a.visible;b.castShadow=a.castShadow;b.receiveShadow=a.receiveShadow;b.frustumCulled=
a.frustumCulled;for(var c=0;c<a.children.length;c++){var d=THREE.SceneUtils.cloneObject(a.children[c]);b.children[c]=d;d.parent=b}if(a instanceof THREE.LOD)for(c=0;c<a.LODs.length;c++)b.LODs[c]={visibleAtDistance:a.LODs[c].visibleAtDistance,object3D:b.children[c]};return b},detach:function(a,b,c){a.applyMatrix(b.matrixWorld);b.remove(a);c.add(a)},attach:function(a,b,c){var d=new THREE.Matrix4;d.getInverse(c.matrixWorld);a.applyMatrix(d);b.remove(a);c.add(a)}};
if(THREE.WebGLRenderer)THREE.ShaderUtils={lib:{fresnel:{uniforms:{mRefractionRatio:{type:"f",value:1.02},mFresnelBias:{type:"f",value:0.1},mFresnelPower:{type:"f",value:2},mFresnelScale:{type:"f",value:1},tCube:{type:"t",value:1,texture:null}},fragmentShader:"uniform samplerCube tCube;\nvarying vec3 vReflect;\nvarying vec3 vRefract[3];\nvarying float vReflectionFactor;\nvoid main() {\nvec4 reflectedColor = textureCube( tCube, vec3( -vReflect.x, vReflect.yz ) );\nvec4 refractedColor = vec4( 1.0, 1.0, 1.0, 1.0 );\nrefractedColor.r = textureCube( tCube, vec3( -vRefract[0].x, vRefract[0].yz ) ).r;\nrefractedColor.g = textureCube( tCube, vec3( -vRefract[1].x, vRefract[1].yz ) ).g;\nrefractedColor.b = textureCube( tCube, vec3( -vRefract[2].x, vRefract[2].yz ) ).b;\nrefractedColor.a = 1.0;\ngl_FragColor = mix( refractedColor, reflectedColor, clamp( vReflectionFactor, 0.0, 1.0 ) );\n}",
vertexShader:"uniform float mRefractionRatio;\nuniform float mFresnelBias;\nuniform float mFresnelScale;\nuniform float mFresnelPower;\nvarying vec3 vReflect;\nvarying vec3 vRefract[3];\nvarying float vReflectionFactor;\nvoid main() {\nvec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );\nvec4 mPosition = objectMatrix * vec4( position, 1.0 );\nvec3 nWorld = normalize ( mat3( objectMatrix[0].xyz, objectMatrix[1].xyz, objectMatrix[2].xyz ) * normal );\nvec3 I = mPosition.xyz - cameraPosition;\nvReflect = reflect( I, nWorld );\nvRefract[0] = refract( normalize( I ), nWorld, mRefractionRatio );\nvRefract[1] = refract( normalize( I ), nWorld, mRefractionRatio * 0.99 );\nvRefract[2] = refract( normalize( I ), nWorld, mRefractionRatio * 0.98 );\nvReflectionFactor = mFresnelBias + mFresnelScale * pow( 1.0 + dot( normalize( I ), nWorld ), mFresnelPower );\ngl_Position = projectionMatrix * mvPosition;\n}"},
normal:{uniforms:THREE.UniformsUtils.merge([THREE.UniformsLib.fog,THREE.UniformsLib.lights,THREE.UniformsLib.shadowmap,{enableAO:{type:"i",value:0},enableDiffuse:{type:"i",value:0},enableSpecular:{type:"i",value:0},enableReflection:{type:"i",value:0},tDiffuse:{type:"t",value:0,texture:null},tCube:{type:"t",value:1,texture:null},tNormal:{type:"t",value:2,texture:null},tSpecular:{type:"t",value:3,texture:null},tAO:{type:"t",value:4,texture:null},tDisplacement:{type:"t",value:5,texture:null},uNormalScale:{type:"f",
value:1},uDisplacementBias:{type:"f",value:0},uDisplacementScale:{type:"f",value:1},uDiffuseColor:{type:"c",value:new THREE.Color(16777215)},uSpecularColor:{type:"c",value:new THREE.Color(1118481)},uAmbientColor:{type:"c",value:new THREE.Color(16777215)},uShininess:{type:"f",value:30},uOpacity:{type:"f",value:1},uReflectivity:{type:"f",value:0.5},uOffset:{type:"v2",value:new THREE.Vector2(0,0)},uRepeat:{type:"v2",value:new THREE.Vector2(1,1)},wrapRGB:{type:"v3",value:new THREE.Vector3(1,1,1)}}]),
fragmentShader:["uniform vec3 uAmbientColor;\nuniform vec3 uDiffuseColor;\nuniform vec3 uSpecularColor;\nuniform float uShininess;\nuniform float uOpacity;\nuniform bool enableDiffuse;\nuniform bool enableSpecular;\nuniform bool enableAO;\nuniform bool enableReflection;\nuniform sampler2D tDiffuse;\nuniform sampler2D tNormal;\nuniform sampler2D tSpecular;\nuniform sampler2D tAO;\nuniform samplerCube tCube;\nuniform float uNormalScale;\nuniform float uReflectivity;\nvarying vec3 vTangent;\nvarying vec3 vBinormal;\nvarying vec3 vNormal;\nvarying vec2 vUv;\nuniform vec3 ambientLightColor;\n#if MAX_DIR_LIGHTS > 0\nuniform vec3 directionalLightColor[ MAX_DIR_LIGHTS ];\nuniform vec3 directionalLightDirection[ MAX_DIR_LIGHTS ];\n#endif\n#if MAX_POINT_LIGHTS > 0\nuniform vec3 pointLightColor[ MAX_POINT_LIGHTS ];\nvarying vec4 vPointLight[ MAX_POINT_LIGHTS ];\n#endif\n#ifdef WRAP_AROUND\nuniform vec3 wrapRGB;\n#endif\nvarying vec3 vViewPosition;",
THREE.ShaderChunk.shadowmap_pars_fragment,THREE.ShaderChunk.fog_pars_fragment,"void main() {\ngl_FragColor = vec4( vec3( 1.0 ), uOpacity );\nvec3 specularTex = vec3( 1.0 );\nvec3 normalTex = texture2D( tNormal, vUv ).xyz * 2.0 - 1.0;\nnormalTex.xy *= uNormalScale;\nnormalTex = normalize( normalTex );\nif( enableDiffuse ) {\n#ifdef GAMMA_INPUT\nvec4 texelColor = texture2D( tDiffuse, vUv );\ntexelColor.xyz *= texelColor.xyz;\ngl_FragColor = gl_FragColor * texelColor;\n#else\ngl_FragColor = gl_FragColor * texture2D( tDiffuse, vUv );\n#endif\n}\nif( enableAO ) {\n#ifdef GAMMA_INPUT\nvec4 aoColor = texture2D( tAO, vUv );\naoColor.xyz *= aoColor.xyz;\ngl_FragColor.xyz = gl_FragColor.xyz * aoColor.xyz;\n#else\ngl_FragColor.xyz = gl_FragColor.xyz * texture2D( tAO, vUv ).xyz;\n#endif\n}\nif( enableSpecular )\nspecularTex = texture2D( tSpecular, vUv ).xyz;\nmat3 tsb = mat3( normalize( vTangent ), normalize( vBinormal ), normalize( vNormal ) );\nvec3 finalNormal = tsb * normalTex;\nvec3 normal = normalize( finalNormal );\nvec3 viewPosition = normalize( vViewPosition );\n#if MAX_POINT_LIGHTS > 0\nvec3 pointDiffuse = vec3( 0.0 );\nvec3 pointSpecular = vec3( 0.0 );\nfor ( int i = 0; i < MAX_POINT_LIGHTS; i ++ ) {\nvec3 pointVector = normalize( vPointLight[ i ].xyz );\nfloat pointDistance = vPointLight[ i ].w;\n#ifdef WRAP_AROUND\nfloat pointDiffuseWeightFull = max( dot( normal, pointVector ), 0.0 );\nfloat pointDiffuseWeightHalf = max( 0.5 * dot( normal, pointVector ) + 0.5, 0.0 );\nvec3 pointDiffuseWeight = mix( vec3 ( pointDiffuseWeightFull ), vec3( pointDiffuseWeightHalf ), wrapRGB );\n#else\nfloat pointDiffuseWeight = max( dot( normal, pointVector ), 0.0 );\n#endif\npointDiffuse += pointDistance * pointLightColor[ i ] * uDiffuseColor * pointDiffuseWeight;\nvec3 pointHalfVector = normalize( pointVector + viewPosition );\nfloat pointDotNormalHalf = max( dot( normal, pointHalfVector ), 0.0 );\nfloat pointSpecularWeight = specularTex.r * max( pow( pointDotNormalHalf, uShininess ), 0.0 );\npointSpecular += pointDistance * pointLightColor[ i ] * uSpecularColor * pointSpecularWeight * pointDiffuseWeight;\n}\n#endif\n#if MAX_DIR_LIGHTS > 0\nvec3 dirDiffuse = vec3( 0.0 );\nvec3 dirSpecular = vec3( 0.0 );\nfor( int i = 0; i < MAX_DIR_LIGHTS; i++ ) {\nvec4 lDirection = viewMatrix * vec4( directionalLightDirection[ i ], 0.0 );\nvec3 dirVector = normalize( lDirection.xyz );\n#ifdef WRAP_AROUND\nfloat directionalLightWeightingFull = max( dot( normal, dirVector ), 0.0 );\nfloat directionalLightWeightingHalf = max( 0.5 * dot( normal, dirVector ) + 0.5, 0.0 );\nvec3 dirDiffuseWeight = mix( vec3( directionalLightWeightingFull ), vec3( directionalLightWeightingHalf ), wrapRGB );\n#else\nfloat dirDiffuseWeight = max( dot( normal, dirVector ), 0.0 );\n#endif\ndirDiffuse += directionalLightColor[ i ] * uDiffuseColor * dirDiffuseWeight;\nvec3 dirHalfVector = normalize( dirVector + viewPosition );\nfloat dirDotNormalHalf = max( dot( normal, dirHalfVector ), 0.0 );\nfloat dirSpecularWeight = specularTex.r * max( pow( dirDotNormalHalf, uShininess ), 0.0 );\ndirSpecular += directionalLightColor[ i ] * uSpecularColor * dirSpecularWeight * dirDiffuseWeight;\n}\n#endif\nvec3 totalDiffuse = vec3( 0.0 );\nvec3 totalSpecular = vec3( 0.0 );\n#if MAX_DIR_LIGHTS > 0\ntotalDiffuse += dirDiffuse;\ntotalSpecular += dirSpecular;\n#endif\n#if MAX_POINT_LIGHTS > 0\ntotalDiffuse += pointDiffuse;\ntotalSpecular += pointSpecular;\n#endif\ngl_FragColor.xyz = gl_FragColor.xyz * ( totalDiffuse + ambientLightColor * uAmbientColor) + totalSpecular;\nif ( enableReflection ) {\nvec3 wPos = cameraPosition - vViewPosition;\nvec3 vReflect = reflect( normalize( wPos ), normal );\nvec4 cubeColor = textureCube( tCube, vec3( -vReflect.x, vReflect.yz ) );\n#ifdef GAMMA_INPUT\ncubeColor.xyz *= cubeColor.xyz;\n#endif\ngl_FragColor.xyz = mix( gl_FragColor.xyz, cubeColor.xyz, specularTex.r * uReflectivity );\n}",
THREE.ShaderChunk.shadowmap_fragment,THREE.ShaderChunk.linear_to_gamma_fragment,THREE.ShaderChunk.fog_fragment,"}"].join("\n"),vertexShader:["attribute vec4 tangent;\nuniform vec2 uOffset;\nuniform vec2 uRepeat;\n#ifdef VERTEX_TEXTURES\nuniform sampler2D tDisplacement;\nuniform float uDisplacementScale;\nuniform float uDisplacementBias;\n#endif\nvarying vec3 vTangent;\nvarying vec3 vBinormal;\nvarying vec3 vNormal;\nvarying vec2 vUv;\n#if MAX_POINT_LIGHTS > 0\nuniform vec3 pointLightPosition[ MAX_POINT_LIGHTS ];\nuniform float pointLightDistance[ MAX_POINT_LIGHTS ];\nvarying vec4 vPointLight[ MAX_POINT_LIGHTS ];\n#endif\nvarying vec3 vViewPosition;",
THREE.ShaderChunk.shadowmap_pars_vertex,"void main() {\nvec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );\nvViewPosition = -mvPosition.xyz;\nvNormal = normalMatrix * normal;\nvTangent = normalMatrix * tangent.xyz;\nvBinormal = cross( vNormal, vTangent ) * tangent.w;\nvUv = uv * uRepeat + uOffset;\n#if MAX_POINT_LIGHTS > 0\nfor( int i = 0; i < MAX_POINT_LIGHTS; i++ ) {\nvec4 lPosition = viewMatrix * vec4( pointLightPosition[ i ], 1.0 );\nvec3 lVector = lPosition.xyz - mvPosition.xyz;\nfloat lDistance = 1.0;\nif ( pointLightDistance[ i ] > 0.0 )\nlDistance = 1.0 - min( ( length( lVector ) / pointLightDistance[ i ] ), 1.0 );\nlVector = normalize( lVector );\nvPointLight[ i ] = vec4( lVector, lDistance );\n}\n#endif\n#ifdef VERTEX_TEXTURES\nvec3 dv = texture2D( tDisplacement, uv ).xyz;\nfloat df = uDisplacementScale * dv.x + uDisplacementBias;\nvec4 displacedPosition = vec4( normalize( vNormal.xyz ) * df, 0.0 ) + mvPosition;\ngl_Position = projectionMatrix * displacedPosition;\n#else\ngl_Position = projectionMatrix * mvPosition;\n#endif",
THREE.ShaderChunk.shadowmap_vertex,"}"].join("\n")},cube:{uniforms:{tCube:{type:"t",value:1,texture:null},tFlip:{type:"f",value:-1}},vertexShader:"varying vec3 vViewPosition;\nvoid main() {\nvec4 mPosition = objectMatrix * vec4( position, 1.0 );\nvViewPosition = cameraPosition - mPosition.xyz;\ngl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n}",fragmentShader:"uniform samplerCube tCube;\nuniform float tFlip;\nvarying vec3 vViewPosition;\nvoid main() {\nvec3 wPos = cameraPosition - vViewPosition;\ngl_FragColor = textureCube( tCube, vec3( tFlip * wPos.x, wPos.yz ) );\n}"}}};
THREE.BufferGeometry=function(){this.id=THREE.GeometryCount++;this.vertexColorArray=this.vertexUvArray=this.vertexNormalArray=this.vertexPositionArray=this.vertexIndexArray=this.vertexColorBuffer=this.vertexUvBuffer=this.vertexNormalBuffer=this.vertexPositionBuffer=this.vertexIndexBuffer=null;this.dynamic=!1;this.boundingSphere=this.boundingBox=null;this.morphTargets=[]};THREE.BufferGeometry.prototype={constructor:THREE.BufferGeometry,computeBoundingBox:function(){},computeBoundingSphere:function(){}};
THREE.Curve=function(){};THREE.Curve.prototype.getPoint=function(){console.log("Warning, getPoint() not implemented!");return null};THREE.Curve.prototype.getPointAt=function(a){return this.getPoint(this.getUtoTmapping(a))};THREE.Curve.prototype.getPoints=function(a){a||(a=5);var b,c=[];for(b=0;b<=a;b++)c.push(this.getPoint(b/a));return c};THREE.Curve.prototype.getSpacedPoints=function(a){a||(a=5);var b,c=[];for(b=0;b<=a;b++)c.push(this.getPointAt(b/a));return c};
THREE.Curve.prototype.getLength=function(){var a=this.getLengths();return a[a.length-1]};THREE.Curve.prototype.getLengths=function(a){a||(a=200);if(this.cacheArcLengths&&this.cacheArcLengths.length==a+1)return this.cacheArcLengths;var b=[],c,d=this.getPoint(0),f,g=0;b.push(0);for(f=1;f<=a;f++)c=this.getPoint(f/a),g+=c.distanceTo(d),b.push(g),d=c;return this.cacheArcLengths=b};
THREE.Curve.prototype.getUtoTmapping=function(a,b){var c=this.getLengths(),d=0,f=c.length,g;g=b?b:a*c[f-1];for(var e=0,h=f-1,i;e<=h;)if(d=Math.floor(e+(h-e)/2),i=c[d]-g,i<0)e=d+1;else if(i>0)h=d-1;else{h=d;break}d=h;if(c[d]==g)return d/(f-1);e=c[d];return c=(d+(g-e)/(c[d+1]-e))/(f-1)};THREE.Curve.prototype.getNormalVector=function(a){a=this.getTangent(a);return new THREE.Vector2(-a.y,a.x)};
THREE.Curve.prototype.getTangent=function(a){var b=a-1.0E-4;a+=1.0E-4;b<0&&(b=0);a>1&&(a=1);b=this.getPoint(b);a=this.getPoint(a);return b.clone().subSelf(a).normalize()};THREE.Curve.prototype.getTangentAt=function(a){return this.getTangent(this.getUtoTmapping(a))};THREE.LineCurve=function(a,b){a instanceof THREE.Vector2?(this.v1=a,this.v2=b):THREE.LineCurve.oldConstructor.apply(this,arguments)};
THREE.LineCurve.oldConstructor=function(a,b,c,d){this.constructor(new THREE.Vector2(a,b),new THREE.Vector2(c,d))};THREE.LineCurve.prototype=new THREE.Curve;THREE.LineCurve.prototype.constructor=THREE.LineCurve;THREE.LineCurve.prototype.getPoint=function(a){var b=new THREE.Vector2;b.sub(this.v2,this.v1);b.multiplyScalar(a).addSelf(this.v1);return b};THREE.LineCurve.prototype.getPointAt=function(a){return this.getPoint(a)};
THREE.LineCurve.prototype.getTangent=function(){var a=new THREE.Vector2;a.sub(this.v2,this.v1);a.normalize();return a};THREE.QuadraticBezierCurve=function(a,b,c){if(!(b instanceof THREE.Vector2))var d=Array.prototype.slice.call(arguments),a=new THREE.Vector2(d[0],d[1]),b=new THREE.Vector2(d[2],d[3]),c=new THREE.Vector2(d[4],d[5]);this.v0=a;this.v1=b;this.v2=c};THREE.QuadraticBezierCurve.prototype=new THREE.Curve;THREE.QuadraticBezierCurve.prototype.constructor=THREE.QuadraticBezierCurve;
THREE.QuadraticBezierCurve.prototype.getPoint=function(a){var b;b=THREE.Shape.Utils.b2(a,this.v0.x,this.v1.x,this.v2.x);a=THREE.Shape.Utils.b2(a,this.v0.y,this.v1.y,this.v2.y);return new THREE.Vector2(b,a)};THREE.QuadraticBezierCurve.prototype.getTangent=function(a){var b;b=THREE.Curve.Utils.tangentQuadraticBezier(a,this.v0.x,this.v1.x,this.v2.x);a=THREE.Curve.Utils.tangentQuadraticBezier(a,this.v0.y,this.v1.y,this.v2.y);b=new THREE.Vector2(b,a);b.normalize();return b};
THREE.CubicBezierCurve=function(a,b,c,d){if(!(b instanceof THREE.Vector2))var f=Array.prototype.slice.call(arguments),a=new THREE.Vector2(f[0],f[1]),b=new THREE.Vector2(f[2],f[3]),c=new THREE.Vector2(f[4],f[5]),d=new THREE.Vector2(f[6],f[7]);this.v0=a;this.v1=b;this.v2=c;this.v3=d};THREE.CubicBezierCurve.prototype=new THREE.Curve;THREE.CubicBezierCurve.prototype.constructor=THREE.CubicBezierCurve;
THREE.CubicBezierCurve.prototype.getPoint=function(a){var b;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);return new THREE.Vector2(b,a)};THREE.CubicBezierCurve.prototype.getTangent=function(a){var b;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();return b};
THREE.SplineCurve=function(a){this.points=a==void 0?[]:a};THREE.SplineCurve.prototype=new THREE.Curve;THREE.SplineCurve.prototype.constructor=THREE.SplineCurve;
THREE.SplineCurve.prototype.getPoint=function(a){var b=new THREE.Vector2,c=[],d=this.points,f;f=(d.length-1)*a;a=Math.floor(f);f-=a;c[0]=a==0?a:a-1;c[1]=a;c[2]=a>d.length-2?a:a+1;c[3]=a>d.length-3?a:a+2;b.x=THREE.Curve.Utils.interpolate(d[c[0]].x,d[c[1]].x,d[c[2]].x,d[c[3]].x,f);b.y=THREE.Curve.Utils.interpolate(d[c[0]].y,d[c[1]].y,d[c[2]].y,d[c[3]].y,f);return b};THREE.ArcCurve=function(a,b,c,d,f,g){this.aX=a;this.aY=b;this.aRadius=c;this.aStartAngle=d;this.aEndAngle=f;this.aClockwise=g};
THREE.ArcCurve.prototype=new THREE.Curve;THREE.ArcCurve.prototype.constructor=THREE.ArcCurve;THREE.ArcCurve.prototype.getPoint=function(a){var b=this.aEndAngle-this.aStartAngle;this.aClockwise||(a=1-a);b=this.aStartAngle+a*b;a=this.aX+this.aRadius*Math.cos(b);b=this.aY+this.aRadius*Math.sin(b);return new THREE.Vector2(a,b)};
THREE.Curve.Utils={tangentQuadraticBezier:function(a,b,c,d){return 2*(1-a)*(c-b)+2*a*(d-c)},tangentCubicBezier:function(a,b,c,d,f){return-3*b*(1-a)*(1-a)+3*c*(1-a)*(1-a)-6*a*c*(1-a)+6*a*d*(1-a)-3*a*a*d+3*a*a*f},tangentSpline:function(a){return 6*a*a-6*a+(3*a*a-4*a+1)+(-6*a*a+6*a)+(3*a*a-2*a)},interpolate:function(a,b,c,d,f){var a=(c-a)*0.5,d=(d-b)*0.5,g=f*f;return(2*b-2*c+a+d)*f*g+(-3*b+3*c-2*a-d)*g+a*f+b}};
THREE.Curve.create=function(a,b){a.prototype=new THREE.Curve;a.prototype.constructor=a;a.prototype.getPoint=b;return a};THREE.LineCurve3=THREE.Curve.create(function(a,b){this.v1=a;this.v2=b},function(a){var b=new THREE.Vector3;b.sub(this.v2,this.v1);b.multiplyScalar(a);b.addSelf(this.v1);return b});
THREE.QuadraticBezierCurve3=THREE.Curve.create(function(a,b,c){this.v0=a;this.v1=b;this.v2=c},function(a){var b,c;b=THREE.Shape.Utils.b2(a,this.v0.x,this.v1.x,this.v2.x);c=THREE.Shape.Utils.b2(a,this.v0.y,this.v1.y,this.v2.y);a=THREE.Shape.Utils.b2(a,this.v0.z,this.v1.z,this.v2.z);return new THREE.Vector3(b,c,a)});
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,c;b=THREE.Shape.Utils.b3(a,this.v0.x,this.v1.x,this.v2.x,this.v3.x);c=THREE.Shape.Utils.b3(a,this.v0.y,this.v1.y,this.v2.y,this.v3.y);a=THREE.Shape.Utils.b3(a,this.v0.z,this.v1.z,this.v2.z,this.v3.z);return new THREE.Vector3(b,c,a)});
THREE.SplineCurve3=THREE.Curve.create(function(a){this.points=a==void 0?[]:a},function(a){var b=new THREE.Vector3,c=[],d=this.points,f;f=(d.length-1)*a;a=Math.floor(f);f-=a;c[0]=a==0?a:a-1;c[1]=a;c[2]=a>d.length-2?a:a+1;c[3]=a>d.length-3?a:a+2;b.x=THREE.Curve.Utils.interpolate(d[c[0]].x,d[c[1]].x,d[c[2]].x,d[c[3]].x,f);b.y=THREE.Curve.Utils.interpolate(d[c[0]].y,d[c[1]].y,d[c[2]].y,d[c[3]].y,f);b.z=THREE.Curve.Utils.interpolate(d[c[0]].z,d[c[1]].z,d[c[2]].z,d[c[3]].z,f);return b});
THREE.CurvePath=function(){this.curves=[];this.bends=[];this.autoClose=!1};THREE.CurvePath.prototype=new THREE.Curve;THREE.CurvePath.prototype.constructor=THREE.CurvePath;THREE.CurvePath.prototype.add=function(a){this.curves.push(a)};THREE.CurvePath.prototype.checkConnection=function(){};THREE.CurvePath.prototype.closePath=function(){var a=this.curves[0].getPoint(0),b=this.curves[this.curves.length-1].getPoint(1);a.equals(b)||this.curves.push(new THREE.LineCurve(b,a))};
THREE.CurvePath.prototype.getPoint=function(a){for(var b=a*this.getLength(),c=this.getCurveLengths(),a=0;a<c.length;){if(c[a]>=b)return b=c[a]-b,a=this.curves[a],b=1-b/a.getLength(),a.getPointAt(b);a++}return null};THREE.CurvePath.prototype.getLength=function(){var a=this.getCurveLengths();return a[a.length-1]};
THREE.CurvePath.prototype.getCurveLengths=function(){if(this.cacheLengths&&this.cacheLengths.length==this.curves.length)return this.cacheLengths;var a=[],b=0,c,d=this.curves.length;for(c=0;c<d;c++)b+=this.curves[c].getLength(),a.push(b);return this.cacheLengths=a};
THREE.CurvePath.prototype.getBoundingBox=function(){var a=this.getPoints(),b,c,d,f;b=c=Number.NEGATIVE_INFINITY;d=f=Number.POSITIVE_INFINITY;var g,e,h,i;i=new THREE.Vector2;for(e=0,h=a.length;e<h;e++){g=a[e];if(g.x>b)b=g.x;else if(g.x<d)d=g.x;if(g.y>c)c=g.y;else if(g.y<c)f=g.y;i.addSelf(g.x,g.y)}return{minX:d,minY:f,maxX:b,maxY:c,centroid:i.divideScalar(h)}};THREE.CurvePath.prototype.createPointsGeometry=function(a){return this.createGeometry(this.getPoints(a,!0))};
THREE.CurvePath.prototype.createSpacedPointsGeometry=function(a){return this.createGeometry(this.getSpacedPoints(a,!0))};THREE.CurvePath.prototype.createGeometry=function(a){for(var b=new THREE.Geometry,c=0;c<a.length;c++)b.vertices.push(new THREE.Vertex(new THREE.Vector3(a[c].x,a[c].y,0)));return b};THREE.CurvePath.prototype.addWrapPath=function(a){this.bends.push(a)};
THREE.CurvePath.prototype.getTransformedPoints=function(a,b){var c=this.getPoints(a),d,f;if(!b)b=this.bends;for(d=0,f=b.length;d<f;d++)c=this.getWrapPoints(c,b[d]);return c};THREE.CurvePath.prototype.getTransformedSpacedPoints=function(a,b){var c=this.getSpacedPoints(a),d,f;if(!b)b=this.bends;for(d=0,f=b.length;d<f;d++)c=this.getWrapPoints(c,b[d]);return c};
THREE.CurvePath.prototype.getWrapPoints=function(a,b){var c=this.getBoundingBox(),d,f,g,e,h,i;for(d=0,f=a.length;d<f;d++)g=a[d],e=g.x,h=g.y,i=e/c.maxX,i=b.getUtoTmapping(i,e),e=b.getPoint(i),h=b.getNormalVector(i).multiplyScalar(h),g.x=e.x+h.x,g.y=e.y+h.y;return a};
THREE.EventTarget=function(){var a={};this.addEventListener=function(b,c){a[b]==void 0&&(a[b]=[]);a[b].indexOf(c)===-1&&a[b].push(c)};this.dispatchEvent=function(b){for(var c in a[b.type])a[b.type][c](b)};this.removeEventListener=function(b,c){var d=a[b].indexOf(c);d!==-1&&a[b].splice(d,1)}};THREE.Gyroscope=function(){THREE.Object3D.call(this)};THREE.Gyroscope.prototype=new THREE.Object3D;THREE.Gyroscope.prototype.constructor=THREE.Gyroscope;
THREE.Gyroscope.prototype.updateMatrixWorld=function(a){this.matrixAutoUpdate&&this.updateMatrix();if(this.matrixWorldNeedsUpdate||a)this.parent?(this.matrixWorld.multiply(this.parent.matrixWorld,this.matrix),this.matrixWorld.decompose(this.translationWorld,this.rotationWorld,this.scaleWorld),this.matrix.decompose(this.translationObject,this.rotationObject,this.scaleObject),this.matrixWorld.compose(this.translationWorld,this.rotationObject,this.scaleWorld)):this.matrixWorld.copy(this.matrix),this.matrixWorldNeedsUpdate=
!1,a=!0;for(var b=0,c=this.children.length;b<c;b++)this.children[b].updateMatrixWorld(a)};THREE.Gyroscope.prototype.translationWorld=new THREE.Vector3;THREE.Gyroscope.prototype.translationObject=new THREE.Vector3;THREE.Gyroscope.prototype.rotationWorld=new THREE.Quaternion;THREE.Gyroscope.prototype.rotationObject=new THREE.Quaternion;THREE.Gyroscope.prototype.scaleWorld=new THREE.Vector3;THREE.Gyroscope.prototype.scaleObject=new THREE.Vector3;
THREE.Path=function(a){THREE.CurvePath.call(this);this.actions=[];a&&this.fromPoints(a)};THREE.Path.prototype=new THREE.CurvePath;THREE.Path.prototype.constructor=THREE.Path;THREE.PathActions={MOVE_TO:"moveTo",LINE_TO:"lineTo",QUADRATIC_CURVE_TO:"quadraticCurveTo",BEZIER_CURVE_TO:"bezierCurveTo",CSPLINE_THRU:"splineThru",ARC:"arc"};THREE.Path.prototype.fromPoints=function(a){this.moveTo(a[0].x,a[0].y);for(var b=1,c=a.length;b<c;b++)this.lineTo(a[b].x,a[b].y)};
THREE.Path.prototype.moveTo=function(a,b){var c=Array.prototype.slice.call(arguments);this.actions.push({action:THREE.PathActions.MOVE_TO,args:c})};THREE.Path.prototype.lineTo=function(a,b){var c=Array.prototype.slice.call(arguments),d=this.actions[this.actions.length-1].args;this.curves.push(new THREE.LineCurve(new THREE.Vector2(d[d.length-2],d[d.length-1]),new THREE.Vector2(a,b)));this.actions.push({action:THREE.PathActions.LINE_TO,args:c})};
THREE.Path.prototype.quadraticCurveTo=function(a,b,c,d){var f=Array.prototype.slice.call(arguments),g=this.actions[this.actions.length-1].args;this.curves.push(new THREE.QuadraticBezierCurve(new THREE.Vector2(g[g.length-2],g[g.length-1]),new THREE.Vector2(a,b),new THREE.Vector2(c,d)));this.actions.push({action:THREE.PathActions.QUADRATIC_CURVE_TO,args:f})};
THREE.Path.prototype.bezierCurveTo=function(a,b,c,d,f,g){var e=Array.prototype.slice.call(arguments),h=this.actions[this.actions.length-1].args;this.curves.push(new THREE.CubicBezierCurve(new THREE.Vector2(h[h.length-2],h[h.length-1]),new THREE.Vector2(a,b),new THREE.Vector2(c,d),new THREE.Vector2(f,g)));this.actions.push({action:THREE.PathActions.BEZIER_CURVE_TO,args:e})};
THREE.Path.prototype.splineThru=function(a){var b=Array.prototype.slice.call(arguments),c=this.actions[this.actions.length-1].args,c=[new THREE.Vector2(c[c.length-2],c[c.length-1])];Array.prototype.push.apply(c,a);this.curves.push(new THREE.SplineCurve(c));this.actions.push({action:THREE.PathActions.CSPLINE_THRU,args:b})};
THREE.Path.prototype.arc=function(a,b,c,d,f,g){var e=Array.prototype.slice.call(arguments);this.curves.push(new THREE.ArcCurve(a,b,c,d,f,g));this.actions.push({action:THREE.PathActions.ARC,args:e})};THREE.Path.prototype.getSpacedPoints=function(a){a||(a=40);for(var b=[],c=0;c<a;c++)b.push(this.getPoint(c/a));return b};
THREE.Path.prototype.getPoints=function(a,b){var a=a||12,c=[],d,f,g,e,h,i,j,k,q,n,o,s,m;for(d=0,f=this.actions.length;d<f;d++)switch(g=this.actions[d],e=g.action,g=g.args,e){case THREE.PathActions.LINE_TO:c.push(new THREE.Vector2(g[0],g[1]));break;case THREE.PathActions.QUADRATIC_CURVE_TO:h=g[2];i=g[3];q=g[0];n=g[1];c.length>0?(e=c[c.length-1],o=e.x,s=e.y):(e=this.actions[d-1].args,o=e[e.length-2],s=e[e.length-1]);for(e=1;e<=a;e++)m=e/a,g=THREE.Shape.Utils.b2(m,o,q,h),m=THREE.Shape.Utils.b2(m,s,n,
i),c.push(new THREE.Vector2(g,m));break;case THREE.PathActions.BEZIER_CURVE_TO:h=g[4];i=g[5];q=g[0];n=g[1];j=g[2];k=g[3];c.length>0?(e=c[c.length-1],o=e.x,s=e.y):(e=this.actions[d-1].args,o=e[e.length-2],s=e[e.length-1]);for(e=1;e<=a;e++)m=e/a,g=THREE.Shape.Utils.b3(m,o,q,j,h),m=THREE.Shape.Utils.b3(m,s,n,k,i),c.push(new THREE.Vector2(g,m));break;case THREE.PathActions.CSPLINE_THRU:e=this.actions[d-1].args;e=[new THREE.Vector2(e[e.length-2],e[e.length-1])];m=a*g[0].length;e=e.concat(g[0]);g=new THREE.SplineCurve(e);
for(e=1;e<=m;e++)c.push(g.getPointAt(e/m));break;case THREE.PathActions.ARC:e=this.actions[d-1].args;h=g[0];i=g[1];j=g[2];q=g[3];m=g[4];n=!!g[5];k=e[e.length-2];o=e[e.length-1];e.length==0&&(k=o=0);s=m-q;var p=a*2;for(e=1;e<=p;e++)m=e/p,n||(m=1-m),m=q+m*s,g=k+h+j*Math.cos(m),m=o+i+j*Math.sin(m),c.push(new THREE.Vector2(g,m))}b&&c.push(c[0]);return c};THREE.Path.prototype.transform=function(a,b){this.getBoundingBox();return this.getWrapPoints(this.getPoints(b),a)};
THREE.Path.prototype.nltransform=function(a,b,c,d,f,g){var e=this.getPoints(),h,i,j,k,q;for(h=0,i=e.length;h<i;h++)j=e[h],k=j.x,q=j.y,j.x=a*k+b*q+c,j.y=d*q+f*k+g;return e};
THREE.Path.prototype.debug=function(a){var b=this.getBoundingBox();a||(a=document.createElement("canvas"),a.setAttribute("width",b.maxX+100),a.setAttribute("height",b.maxY+100),document.body.appendChild(a));b=a.getContext("2d");b.fillStyle="white";b.fillRect(0,0,a.width,a.height);b.strokeStyle="black";b.beginPath();var c,d,f;for(a=0,c=this.actions.length;a<c;a++)d=this.actions[a],f=d.args,d=d.action,d!=THREE.PathActions.CSPLINE_THRU&&b[d].apply(b,f);b.stroke();b.closePath();b.strokeStyle="red";d=
this.getPoints();for(a=0,c=d.length;a<c;a++)f=d[a],b.beginPath(),b.arc(f.x,f.y,1.5,0,Math.PI*2,!1),b.stroke(),b.closePath()};
THREE.Path.prototype.toShapes=function(){var a,b,c,d,f=[],g=new THREE.Path;for(a=0,b=this.actions.length;a<b;a++)c=this.actions[a],d=c.args,c=c.action,c==THREE.PathActions.MOVE_TO&&g.actions.length!=0&&(f.push(g),g=new THREE.Path),g[c].apply(g,d);g.actions.length!=0&&f.push(g);if(f.length==0)return[];var e;d=[];a=!THREE.Shape.Utils.isClockWise(f[0].getPoints());if(f.length==1)return g=f[0],e=new THREE.Shape,e.actions=g.actions,e.curves=g.curves,d.push(e),d;if(a){e=new THREE.Shape;for(a=0,b=f.length;a<
b;a++)g=f[a],THREE.Shape.Utils.isClockWise(g.getPoints())?(e.actions=g.actions,e.curves=g.curves,d.push(e),e=new THREE.Shape):e.holes.push(g)}else{for(a=0,b=f.length;a<b;a++)g=f[a],THREE.Shape.Utils.isClockWise(g.getPoints())?(e&&d.push(e),e=new THREE.Shape,e.actions=g.actions,e.curves=g.curves):e.holes.push(g);d.push(e)}return d};THREE.Shape=function(){THREE.Path.apply(this,arguments);this.holes=[]};THREE.Shape.prototype=new THREE.Path;THREE.Shape.prototype.constructor=THREE.Path;
THREE.Shape.prototype.extrude=function(a){return new THREE.ExtrudeGeometry(this,a)};THREE.Shape.prototype.getPointsHoles=function(a){var b,c=this.holes.length,d=[];for(b=0;b<c;b++)d[b]=this.holes[b].getTransformedPoints(a,this.bends);return d};THREE.Shape.prototype.getSpacedPointsHoles=function(a){var b,c=this.holes.length,d=[];for(b=0;b<c;b++)d[b]=this.holes[b].getTransformedSpacedPoints(a,this.bends);return d};
THREE.Shape.prototype.extractAllPoints=function(a){return{shape:this.getTransformedPoints(a),holes:this.getPointsHoles(a)}};THREE.Shape.prototype.extractAllSpacedPoints=function(a){return{shape:this.getTransformedSpacedPoints(a),holes:this.getSpacedPointsHoles(a)}};
THREE.Shape.Utils={removeHoles:function(a,b){var c=a.concat(),d=c.concat(),f,g,e,h,i,j,k,q,n,o,s=[];for(i=0;i<b.length;i++){j=b[i];Array.prototype.push.apply(d,j);g=Number.POSITIVE_INFINITY;for(f=0;f<j.length;f++){n=j[f];o=[];for(q=0;q<c.length;q++)k=c[q],k=n.distanceToSquared(k),o.push(k),k<g&&(g=k,e=f,h=q)}f=h-1>=0?h-1:c.length-1;g=e-1>=0?e-1:j.length-1;var m=[j[e],c[h],c[f]];q=THREE.FontUtils.Triangulate.area(m);var p=[j[e],j[g],c[h]];n=THREE.FontUtils.Triangulate.area(p);o=h;k=e;h+=1;e+=-1;h<
0&&(h+=c.length);h%=c.length;e<0&&(e+=j.length);e%=j.length;f=h-1>=0?h-1:c.length-1;g=e-1>=0?e-1:j.length-1;m=[j[e],c[h],c[f]];m=THREE.FontUtils.Triangulate.area(m);p=[j[e],j[g],c[h]];p=THREE.FontUtils.Triangulate.area(p);q+n>m+p&&(h=o,e=k,h<0&&(h+=c.length),h%=c.length,e<0&&(e+=j.length),e%=j.length,f=h-1>=0?h-1:c.length-1,g=e-1>=0?e-1:j.length-1);q=c.slice(0,h);n=c.slice(h);o=j.slice(e);k=j.slice(0,e);g=[j[e],j[g],c[h]];s.push([j[e],c[h],c[f]]);s.push(g);c=q.concat(o).concat(k).concat(n)}return{shape:c,
isolatedPts:s,allpoints:d}},triangulateShape:function(a,b){var c=THREE.Shape.Utils.removeHoles(a,b),d=c.allpoints,f=c.isolatedPts,c=THREE.FontUtils.Triangulate(c.shape,!1),g,e,h,i,j={};for(g=0,e=d.length;g<e;g++)i=d[g].x+":"+d[g].y,j[i]!==void 0&&console.log("Duplicate point",i),j[i]=g;for(g=0,e=c.length;g<e;g++){h=c[g];for(d=0;d<3;d++)i=h[d].x+":"+h[d].y,i=j[i],i!==void 0&&(h[d]=i)}for(g=0,e=f.length;g<e;g++){h=f[g];for(d=0;d<3;d++)i=h[d].x+":"+h[d].y,i=j[i],i!==void 0&&(h[d]=i)}return c.concat(f)},
isClockWise:function(a){return THREE.FontUtils.Triangulate.area(a)<0},b2p0:function(a,b){var c=1-a;return c*c*b},b2p1:function(a,b){return 2*(1-a)*a*b},b2p2:function(a,b){return a*a*b},b2:function(a,b,c,d){return this.b2p0(a,b)+this.b2p1(a,c)+this.b2p2(a,d)},b3p0:function(a,b){var c=1-a;return c*c*c*b},b3p1:function(a,b){var c=1-a;return 3*c*c*a*b},b3p2:function(a,b){return 3*(1-a)*a*a*b},b3p3:function(a,b){return a*a*a*b},b3:function(a,b,c,d,f){return this.b3p0(a,b)+this.b3p1(a,c)+this.b3p2(a,d)+
this.b3p3(a,f)}};THREE.TextPath=function(a,b){THREE.Path.call(this);this.parameters=b||{};this.set(a)};THREE.TextPath.prototype.set=function(a,b){b=b||this.parameters;this.text=a;var c=b.curveSegments!==void 0?b.curveSegments:4,d=b.font!==void 0?b.font:"helvetiker",f=b.weight!==void 0?b.weight:"normal",g=b.style!==void 0?b.style:"normal";THREE.FontUtils.size=b.size!==void 0?b.size:100;THREE.FontUtils.divisions=c;THREE.FontUtils.face=d;THREE.FontUtils.weight=f;THREE.FontUtils.style=g};
THREE.TextPath.prototype.toShapes=function(){for(var a=THREE.FontUtils.drawText(this.text).paths,b=[],c=0,d=a.length;c<d;c++)Array.prototype.push.apply(b,a[c].toShapes());return b};
THREE.AnimationHandler=function(){var a=[],b={},c={update:function(b){for(var c=0;c<a.length;c++)a[c].update(b)},addToUpdate:function(b){a.indexOf(b)===-1&&a.push(b)},removeFromUpdate:function(b){b=a.indexOf(b);b!==-1&&a.splice(b,1)},add:function(a){b[a.name]!==void 0&&console.log("THREE.AnimationHandler.add: Warning! "+a.name+" already exists in library. Overwriting.");b[a.name]=a;if(a.initialized!==!0){for(var c=0;c<a.hierarchy.length;c++){for(var d=0;d<a.hierarchy[c].keys.length;d++){if(a.hierarchy[c].keys[d].time<
0)a.hierarchy[c].keys[d].time=0;if(a.hierarchy[c].keys[d].rot!==void 0&&!(a.hierarchy[c].keys[d].rot instanceof THREE.Quaternion)){var h=a.hierarchy[c].keys[d].rot;a.hierarchy[c].keys[d].rot=new THREE.Quaternion(h[0],h[1],h[2],h[3])}}if(a.hierarchy[c].keys.length&&a.hierarchy[c].keys[0].morphTargets!==void 0){h={};for(d=0;d<a.hierarchy[c].keys.length;d++)for(var i=0;i<a.hierarchy[c].keys[d].morphTargets.length;i++){var j=a.hierarchy[c].keys[d].morphTargets[i];h[j]=-1}a.hierarchy[c].usedMorphTargets=
h;for(d=0;d<a.hierarchy[c].keys.length;d++){var k={};for(j in h){for(i=0;i<a.hierarchy[c].keys[d].morphTargets.length;i++)if(a.hierarchy[c].keys[d].morphTargets[i]===j){k[j]=a.hierarchy[c].keys[d].morphTargetsInfluences[i];break}i===a.hierarchy[c].keys[d].morphTargets.length&&(k[j]=0)}a.hierarchy[c].keys[d].morphTargetsInfluences=k}}for(d=1;d<a.hierarchy[c].keys.length;d++)a.hierarchy[c].keys[d].time===a.hierarchy[c].keys[d-1].time&&(a.hierarchy[c].keys.splice(d,1),d--);for(d=0;d<a.hierarchy[c].keys.length;d++)a.hierarchy[c].keys[d].index=
d}d=parseInt(a.length*a.fps,10);a.JIT={};a.JIT.hierarchy=[];for(c=0;c<a.hierarchy.length;c++)a.JIT.hierarchy.push(Array(d));a.initialized=!0}},get:function(a){if(typeof a==="string")return b[a]?b[a]:(console.log("THREE.AnimationHandler.get: Couldn't find animation "+a),null)},parse:function(a){var b=[];if(a instanceof THREE.SkinnedMesh)for(var c=0;c<a.bones.length;c++)b.push(a.bones[c]);else d(a,b);return b}},d=function(a,b){b.push(a);for(var c=0;c<a.children.length;c++)d(a.children[c],b)};c.LINEAR=
0;c.CATMULLROM=1;c.CATMULLROM_FORWARD=2;return c}();THREE.Animation=function(a,b,c,d){this.root=a;this.data=THREE.AnimationHandler.get(b);this.hierarchy=THREE.AnimationHandler.parse(a);this.currentTime=0;this.timeScale=1;this.isPlaying=!1;this.loop=this.isPaused=!0;this.interpolationType=c!==void 0?c:THREE.AnimationHandler.LINEAR;this.JITCompile=d!==void 0?d:!0;this.points=[];this.target=new THREE.Vector3};
THREE.Animation.prototype.play=function(a,b){if(!this.isPlaying){this.isPlaying=!0;this.loop=a!==void 0?a:!0;this.currentTime=b!==void 0?b:0;var c,d=this.hierarchy.length,f;for(c=0;c<d;c++){f=this.hierarchy[c];if(this.interpolationType!==THREE.AnimationHandler.CATMULLROM_FORWARD)f.useQuaternion=!0;f.matrixAutoUpdate=!0;if(f.animationCache===void 0)f.animationCache={},f.animationCache.prevKey={pos:0,rot:0,scl:0},f.animationCache.nextKey={pos:0,rot:0,scl:0},f.animationCache.originalMatrix=f instanceof
THREE.Bone?f.skinMatrix:f.matrix;var g=f.animationCache.prevKey;f=f.animationCache.nextKey;g.pos=this.data.hierarchy[c].keys[0];g.rot=this.data.hierarchy[c].keys[0];g.scl=this.data.hierarchy[c].keys[0];f.pos=this.getNextKeyWith("pos",c,1);f.rot=this.getNextKeyWith("rot",c,1);f.scl=this.getNextKeyWith("scl",c,1)}this.update(0)}this.isPaused=!1;THREE.AnimationHandler.addToUpdate(this)};
THREE.Animation.prototype.pause=function(){this.isPaused?THREE.AnimationHandler.addToUpdate(this):THREE.AnimationHandler.removeFromUpdate(this);this.isPaused=!this.isPaused};
THREE.Animation.prototype.stop=function(){this.isPaused=this.isPlaying=!1;THREE.AnimationHandler.removeFromUpdate(this);for(var a=0;a<this.hierarchy.length;a++)if(this.hierarchy[a].animationCache!==void 0)this.hierarchy[a]instanceof THREE.Bone?this.hierarchy[a].skinMatrix=this.hierarchy[a].animationCache.originalMatrix:this.hierarchy[a].matrix=this.hierarchy[a].animationCache.originalMatrix,delete this.hierarchy[a].animationCache};
THREE.Animation.prototype.update=function(a){if(this.isPlaying){var b=["pos","rot","scl"],c,d,f,g,e,h,i,j,k=this.data.JIT.hierarchy,q,n;this.currentTime+=a*this.timeScale;n=this.currentTime;q=this.currentTime%=this.data.length;j=parseInt(Math.min(q*this.data.fps,this.data.length*this.data.fps),10);for(var o=0,s=this.hierarchy.length;o<s;o++)if(a=this.hierarchy[o],i=a.animationCache,this.JITCompile&&k[o][j]!==void 0)a instanceof THREE.Bone?(a.skinMatrix=k[o][j],a.matrixAutoUpdate=!1,a.matrixWorldNeedsUpdate=
!1):(a.matrix=k[o][j],a.matrixAutoUpdate=!1,a.matrixWorldNeedsUpdate=!0);else{if(this.JITCompile)a instanceof THREE.Bone?a.skinMatrix=a.animationCache.originalMatrix:a.matrix=a.animationCache.originalMatrix;for(var m=0;m<3;m++){c=b[m];e=i.prevKey[c];h=i.nextKey[c];if(h.time<=n){if(q<n)if(this.loop){e=this.data.hierarchy[o].keys[0];for(h=this.getNextKeyWith(c,o,1);h.time<q;)e=h,h=this.getNextKeyWith(c,o,h.index+1)}else{this.stop();return}else{do e=h,h=this.getNextKeyWith(c,o,h.index+1);while(h.time<
q)}i.prevKey[c]=e;i.nextKey[c]=h}a.matrixAutoUpdate=!0;a.matrixWorldNeedsUpdate=!0;d=(q-e.time)/(h.time-e.time);f=e[c];g=h[c];if(d<0||d>1)console.log("THREE.Animation.update: Warning! Scale out of bounds:"+d+" on bone "+o),d=d<0?0:1;if(c==="pos")if(c=a.position,this.interpolationType===THREE.AnimationHandler.LINEAR)c.x=f[0]+(g[0]-f[0])*d,c.y=f[1]+(g[1]-f[1])*d,c.z=f[2]+(g[2]-f[2])*d;else{if(this.interpolationType===THREE.AnimationHandler.CATMULLROM||this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD)if(this.points[0]=
this.getPrevKeyWith("pos",o,e.index-1).pos,this.points[1]=f,this.points[2]=g,this.points[3]=this.getNextKeyWith("pos",o,h.index+1).pos,d=d*0.33+0.33,f=this.interpolateCatmullRom(this.points,d),c.x=f[0],c.y=f[1],c.z=f[2],this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD)d=this.interpolateCatmullRom(this.points,d*1.01),this.target.set(d[0],d[1],d[2]),this.target.subSelf(c),this.target.y=0,this.target.normalize(),d=Math.atan2(this.target.x,this.target.z),a.rotation.set(0,d,0)}else if(c===
"rot")THREE.Quaternion.slerp(f,g,a.quaternion,d);else if(c==="scl")c=a.scale,c.x=f[0]+(g[0]-f[0])*d,c.y=f[1]+(g[1]-f[1])*d,c.z=f[2]+(g[2]-f[2])*d}}if(this.JITCompile&&k[0][j]===void 0){this.hierarchy[0].updateMatrixWorld(!0);for(o=0;o<this.hierarchy.length;o++)k[o][j]=this.hierarchy[o]instanceof THREE.Bone?this.hierarchy[o].skinMatrix.clone():this.hierarchy[o].matrix.clone()}}};
THREE.Animation.prototype.interpolateCatmullRom=function(a,b){var c=[],d=[],f,g,e,h,i,j;f=(a.length-1)*b;g=Math.floor(f);f-=g;c[0]=g===0?g:g-1;c[1]=g;c[2]=g>a.length-2?g:g+1;c[3]=g>a.length-3?g:g+2;g=a[c[0]];h=a[c[1]];i=a[c[2]];j=a[c[3]];c=f*f;e=f*c;d[0]=this.interpolate(g[0],h[0],i[0],j[0],f,c,e);d[1]=this.interpolate(g[1],h[1],i[1],j[1],f,c,e);d[2]=this.interpolate(g[2],h[2],i[2],j[2],f,c,e);return d};
THREE.Animation.prototype.interpolate=function(a,b,c,d,f,g,e){a=(c-a)*0.5;d=(d-b)*0.5;return(2*(b-c)+a+d)*e+(-3*(b-c)-2*a-d)*g+a*f+b};THREE.Animation.prototype.getNextKeyWith=function(a,b,c){var d=this.data.hierarchy[b].keys;for(this.interpolationType===THREE.AnimationHandler.CATMULLROM||this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD?c=c<d.length-1?c:d.length-1:c%=d.length;c<d.length;c++)if(d[c][a]!==void 0)return d[c];return this.data.hierarchy[b].keys[0]};
THREE.Animation.prototype.getPrevKeyWith=function(a,b,c){for(var d=this.data.hierarchy[b].keys,c=this.interpolationType===THREE.AnimationHandler.CATMULLROM||this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD?c>0?c:0:c>=0?c:c+d.length;c>=0;c--)if(d[c][a]!==void 0)return d[c];return this.data.hierarchy[b].keys[d.length-1]};
THREE.KeyFrameAnimation=function(a,b,c){this.root=a;this.data=THREE.AnimationHandler.get(b);this.hierarchy=THREE.AnimationHandler.parse(a);this.currentTime=0;this.timeScale=0.001;this.isPlaying=!1;this.loop=this.isPaused=!0;this.JITCompile=c!==void 0?c:!0;a=0;for(b=this.hierarchy.length;a<b;a++){var c=this.data.hierarchy[a].sids,d=this.hierarchy[a];if(this.data.hierarchy[a].keys.length&&c){for(var f=0;f<c.length;f++){var g=c[f],e=this.getNextKeyWith(g,a,0);e&&e.apply(g)}d.matrixAutoUpdate=!1;this.data.hierarchy[a].node.updateMatrix();
d.matrixWorldNeedsUpdate=!0}}};
THREE.KeyFrameAnimation.prototype.play=function(a,b){if(!this.isPlaying){this.isPlaying=!0;this.loop=a!==void 0?a:!0;this.currentTime=b!==void 0?b:0;this.startTimeMs=b;this.startTime=1E7;this.endTime=-this.startTime;var c,d=this.hierarchy.length,f,g;for(c=0;c<d;c++){f=this.hierarchy[c];g=this.data.hierarchy[c];f.useQuaternion=!0;if(g.animationCache===void 0)g.animationCache={},g.animationCache.prevKey=null,g.animationCache.nextKey=null,g.animationCache.originalMatrix=f instanceof THREE.Bone?f.skinMatrix:
f.matrix;f=this.data.hierarchy[c].keys;if(f.........完整代码请登录后点击上方下载按钮下载查看

网友评论0